上传支付接口完成
This commit is contained in:
parent
80f0744ac5
commit
cc4640574b
@ -11,6 +11,12 @@ import (
|
||||
/*
|
||||
MD5加密
|
||||
*/
|
||||
//MD5加密 大写
|
||||
func MD5(str string) string {
|
||||
h := md5.New()
|
||||
h.Write([]byte(str))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
//MD5加密 大写
|
||||
func MD5EncToUpper(str string) string {
|
||||
|
@ -10,14 +10,8 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type PayDelivery struct {
|
||||
pb.DBSystemNotify
|
||||
Order string `json:"orderid"`
|
||||
ProductID string `json:"productid"`
|
||||
Price float32 `json:"price"`
|
||||
Amount int32 `json:"amount"`
|
||||
Uid string `json:"uid"`
|
||||
Sign string `json:"sign"`
|
||||
type PayDeliveryResults struct {
|
||||
Code int32 `json:"s"`
|
||||
}
|
||||
|
||||
//充值发货
|
||||
@ -30,7 +24,7 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
||||
Uid: req[0].(string),
|
||||
Productid: req[1].(string),
|
||||
Orderid: req[2].(string),
|
||||
Price: req[3].(float32),
|
||||
Price: int32(req[3].(float64)),
|
||||
Amount: 1,
|
||||
}
|
||||
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{
|
||||
@ -40,10 +34,16 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
||||
}
|
||||
)
|
||||
defer func() {
|
||||
c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: ""})
|
||||
if payresp.Code != 0 {
|
||||
c.JSON(http.StatusOK, &PayDeliveryResults{Code: -2})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, &PayDeliveryResults{Code: 1})
|
||||
}
|
||||
|
||||
}()
|
||||
sign := md5.MD5EncToLower(fmt.Sprintf("%s%s%s%d%s%s", req[0], req[1], req[2], req[3], req[4], this.options.Key))
|
||||
if sign != req[4] {
|
||||
sginStr := fmt.Sprintf("%s%s%s%d%s", req[0], req[1], req[2], req[3], this.options.Key)
|
||||
sign := md5.MD5(sginStr)
|
||||
if sign != req[4].(string) {
|
||||
payresp.Code = pb.ErrorCode_SignError
|
||||
payresp.Msg = pb.GetErrorCodeMsg(pb.ErrorCode_SignError)
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ const (
|
||||
PlayType_academy PlayType = 8 //联盟学院
|
||||
PlayType_heroteaching PlayType = 9 //英雄教学
|
||||
PlayType_combat PlayType = 10 //新关卡
|
||||
PlayType_enchant PlayType = 11 // 附魔副本
|
||||
)
|
||||
|
||||
// Enum value maps for PlayType.
|
||||
@ -107,7 +106,6 @@ var (
|
||||
8: "academy",
|
||||
9: "heroteaching",
|
||||
10: "combat",
|
||||
11: "enchant",
|
||||
}
|
||||
PlayType_value = map[string]int32{
|
||||
"null": 0,
|
||||
@ -121,7 +119,6 @@ var (
|
||||
"academy": 8,
|
||||
"heroteaching": 9,
|
||||
"combat": 10,
|
||||
"enchant": 11,
|
||||
}
|
||||
)
|
||||
|
||||
@ -675,7 +672,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{
|
||||
0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x6e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x70,
|
||||
0x76, 0x65, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x70, 0x10, 0x02, 0x12, 0x07, 0x0a,
|
||||
0x03, 0x70, 0x76, 0x62, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a,
|
||||
0xa6, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x99, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x6e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69,
|
||||
0x6e, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x10, 0x02,
|
||||
0x12, 0x09, 0x0a, 0x05, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x68,
|
||||
@ -684,14 +681,13 @@ var file_battle_battle_db_proto_rawDesc = []byte{
|
||||
0x61, 0x73, 0x79, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x07,
|
||||
0x12, 0x0b, 0x0a, 0x07, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x10, 0x08, 0x12, 0x10, 0x0a,
|
||||
0x0c, 0x68, 0x65, 0x72, 0x6f, 0x74, 0x65, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x09, 0x12,
|
||||
0x0a, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x65,
|
||||
0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x10, 0x0b, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42, 0x61, 0x74,
|
||||
0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e, 0x10, 0x00,
|
||||
0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44, 0x42, 0x42,
|
||||
0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x64, 0x72, 0x61,
|
||||
0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x0a, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x2a, 0x1f, 0x0a, 0x0c, 0x42,
|
||||
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69,
|
||||
0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c,
|
||||
0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x64, 0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12,
|
||||
0x08, 0x0a, 0x04, 0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -276,6 +276,7 @@ const (
|
||||
// pay
|
||||
ErrorCode_PayBuyNumNotEnough ErrorCode = 3701 //支付次数不足
|
||||
ErrorCode_PayRenewTimeErr ErrorCode = 3702 // 续费时间没达到要求
|
||||
ErrorCode_PayOrderCompleted ErrorCode = 3703 // 订单已完成
|
||||
// worldtask
|
||||
ErrorCode_WorldtaskFinish ErrorCode = 3801 //任务完成失败
|
||||
ErrorCode_WorldtaskLvNotEnough ErrorCode = 3802 //等级不满足
|
||||
@ -515,6 +516,7 @@ var (
|
||||
3602: "GrowtaskAdvReceive",
|
||||
3701: "PayBuyNumNotEnough",
|
||||
3702: "PayRenewTimeErr",
|
||||
3703: "PayOrderCompleted",
|
||||
3801: "WorldtaskFinish",
|
||||
3802: "WorldtaskLvNotEnough",
|
||||
3803: "WorldtaskNoAccept",
|
||||
@ -749,6 +751,7 @@ var (
|
||||
"GrowtaskAdvReceive": 3602,
|
||||
"PayBuyNumNotEnough": 3701,
|
||||
"PayRenewTimeErr": 3702,
|
||||
"PayOrderCompleted": 3703,
|
||||
"WorldtaskFinish": 3801,
|
||||
"WorldtaskLvNotEnough": 3802,
|
||||
"WorldtaskNoAccept": 3803,
|
||||
@ -790,7 +793,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_errorcode_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2a, 0xb2, 0x29, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0xca, 0x29, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
@ -1109,20 +1112,21 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12,
|
||||
0x17, 0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45,
|
||||
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52,
|
||||
0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14,
|
||||
0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73,
|
||||
0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12,
|
||||
0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63,
|
||||
0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc,
|
||||
0x1d, 0x12, 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69,
|
||||
0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c,
|
||||
0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73,
|
||||
0x68, 0x65, 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d,
|
||||
0x79, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x16,
|
||||
0x0a, 0x11, 0x50, 0x61, 0x79, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x64, 0x10, 0xf7, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14,
|
||||
0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e,
|
||||
0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x12,
|
||||
0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f,
|
||||
0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72,
|
||||
0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d,
|
||||
0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73,
|
||||
0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e,
|
||||
0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43,
|
||||
0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -374,11 +374,11 @@ type PayDeliveryReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||
Orderid string `protobuf:"bytes,2,opt,name=orderid,proto3" json:"orderid"`
|
||||
Productid string `protobuf:"bytes,3,opt,name=productid,proto3" json:"productid"`
|
||||
Price float32 `protobuf:"fixed32,4,opt,name=price,proto3" json:"price"`
|
||||
Amount int32 `protobuf:"varint,5,opt,name=amount,proto3" json:"amount"`
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||
Orderid string `protobuf:"bytes,2,opt,name=orderid,proto3" json:"orderid"`
|
||||
Productid string `protobuf:"bytes,3,opt,name=productid,proto3" json:"productid"`
|
||||
Price int32 `protobuf:"varint,4,opt,name=price,proto3" json:"price"`
|
||||
Amount int32 `protobuf:"varint,5,opt,name=amount,proto3" json:"amount"`
|
||||
}
|
||||
|
||||
func (x *PayDeliveryReq) Reset() {
|
||||
@ -434,7 +434,7 @@ func (x *PayDeliveryReq) GetProductid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PayDeliveryReq) GetPrice() float32 {
|
||||
func (x *PayDeliveryReq) GetPrice() int32 {
|
||||
if x != nil {
|
||||
return x.Price
|
||||
}
|
||||
@ -454,7 +454,7 @@ type PayDeliveryResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"`
|
||||
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"s"` //头像
|
||||
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
|
||||
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data"`
|
||||
}
|
||||
@ -548,7 +548,7 @@ var file_pay_pay_msg_proto_rawDesc = []byte{
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x64, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x70, 0x72,
|
||||
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72,
|
||||
0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x57, 0x0a, 0x0f, 0x50,
|
||||
0x61, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e,
|
||||
|
Loading…
Reference in New Issue
Block a user