Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into meixiongfeng
This commit is contained in:
commit
f325fa1f58
@ -94,3 +94,29 @@
|
||||
"data":"",
|
||||
}
|
||||
```
|
||||
|
||||
### 支付发货API
|
||||
- 接口名:paydelivery
|
||||
- 接口说明:web 服务器给玩家发送邮件
|
||||
- 请求地址:{IP}:{port}/paydelivery
|
||||
- 请求参数:orderid(订单号|签名),productid(商品id|签名),price(总金额|签名),amount(购买数量|签名),uid(用户id|签名),sign(签名)
|
||||
- 请求样例
|
||||
```
|
||||
{
|
||||
"orderid":"orderid0001",
|
||||
"productid":"productid_1",
|
||||
"price":35.5,
|
||||
"amount": 1,
|
||||
"uid":"df01_123dasqwe123",
|
||||
"sign":"asjioqiowjeioqjweijqwejoi"
|
||||
}
|
||||
```
|
||||
- 返回参数 code(0:成功 -1 失败),msg(结果描述),data(返回的额外数据)
|
||||
- 返回样例
|
||||
```
|
||||
{
|
||||
"code":0,
|
||||
"msg":"成功",
|
||||
"data":"",
|
||||
}
|
||||
```
|
@ -89,7 +89,7 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
|
||||
//查找任务数据
|
||||
if v, ok := record.Vals[cfg.Id]; ok {
|
||||
newArr := make([]int32, len(vals))
|
||||
newArr = vals
|
||||
copy(newArr, vals)
|
||||
srcCount := v.Data[0]
|
||||
newArr[0] = srcCount + vals[0]
|
||||
v.Data = toMap(newArr...)
|
||||
|
@ -119,7 +119,7 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB
|
||||
}
|
||||
|
||||
if err := this.moduleTask.modelTask.Change(uid, update); err != nil {
|
||||
|
||||
this.moduleTask.Error("change err", log.Field{Key: "uid", Value: uid})
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,6 +147,7 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB
|
||||
|
||||
// 成就列表
|
||||
var achieveList []*pb.TaskData
|
||||
var bflag bool
|
||||
if taskTag == comm.TASK_ACHIEVE {
|
||||
for _, v := range task.AchieveList {
|
||||
if curTask := this.moduleTask.configure.getTaskById(v.TaskId); curTask != nil {
|
||||
@ -170,6 +171,32 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range achieveList {
|
||||
oldVal := v.Progress
|
||||
var newVal int32
|
||||
if p, ok := dr.Vals[v.TypeId]; ok {
|
||||
if len(p.Data) == 0 {
|
||||
continue
|
||||
}
|
||||
newVal = p.Data[0]
|
||||
if code := this.moduleTask.ModuleRtask.CheckCondi(uid, v.TypeId); code == pb.ErrorCode_Success {
|
||||
v.Progress = p.Data[0]
|
||||
v.Status = 1
|
||||
} else {
|
||||
v.Progress = p.Data[0]
|
||||
}
|
||||
}
|
||||
if oldVal != newVal {
|
||||
bflag = true
|
||||
}
|
||||
}
|
||||
if bflag {
|
||||
update["achieveList"] = achieveList
|
||||
if err := this.moduleTask.modelTask.Change(uid, update); err != nil {
|
||||
log.Error("err", log.Field{Key: "uid", Value: uid})
|
||||
}
|
||||
}
|
||||
task.AchieveList = achieveList
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ 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"`
|
||||
}
|
||||
@ -23,13 +25,26 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
||||
err := c.BindJSON(&req)
|
||||
this.module.Debugf("PayDelivery:%+v err:%v", req, err)
|
||||
var (
|
||||
payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{}
|
||||
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{}
|
||||
payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{
|
||||
Uid: req.Uid,
|
||||
Orderid: req.Order,
|
||||
Productid: req.ProductID,
|
||||
Price: req.Price,
|
||||
Amount: req.Amount,
|
||||
}
|
||||
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{
|
||||
Code: 0,
|
||||
Msg: "成功",
|
||||
Data: "",
|
||||
}
|
||||
)
|
||||
defer c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: nil})
|
||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "uid": req.Uid}); sign != req.Sign {
|
||||
defer func() {
|
||||
c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: ""})
|
||||
}()
|
||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "price": req.Price, "amount": req.Amount, "uid": req.Uid}); sign != req.Sign {
|
||||
this.module.Errorf("PayDelivery SignError sgin:%s", sign)
|
||||
payresp.Code = pb.ErrorCode_SignError
|
||||
payresp.Msg = pb.GetErrorCodeMsg(pb.ErrorCode_SignError)
|
||||
return
|
||||
}
|
||||
if err = this.module.service.RpcCall(
|
||||
|
@ -120,6 +120,17 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
return
|
||||
}
|
||||
|
||||
// 发奖
|
||||
if code = this.module.DispenseRes(session, curTaskConf.Reword, true); code != pb.ErrorCode_Success {
|
||||
this.module.Error("资源发放",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "groupId", Value: req.GroupId},
|
||||
log.Field{Key: "taskId", Value: req.TaskId},
|
||||
log.Field{Key: "reword", Value: curTaskConf.Reword},
|
||||
log.Field{Key: "code", Value: code},
|
||||
)
|
||||
}
|
||||
|
||||
for _, v := range curTaskConf.Reword {
|
||||
if v.A == comm.HeroType {
|
||||
hero = append(hero, v.T)
|
||||
@ -134,16 +145,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
}
|
||||
}
|
||||
rsp.Newheros = newhero
|
||||
// 发奖
|
||||
if code = this.module.DispenseRes(session, curTaskConf.Reword, true); code != pb.ErrorCode_Success {
|
||||
this.module.Error("资源发放",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "groupId", Value: req.GroupId},
|
||||
log.Field{Key: "taskId", Value: req.TaskId},
|
||||
log.Field{Key: "reword", Value: curTaskConf.Reword},
|
||||
log.Field{Key: "code", Value: code},
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断任务是否已完成
|
||||
|
@ -377,6 +377,8 @@ type PayDeliveryReq struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
func (x *PayDeliveryReq) Reset() {
|
||||
@ -432,6 +434,20 @@ func (x *PayDeliveryReq) GetProductid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PayDeliveryReq) GetPrice() float32 {
|
||||
if x != nil {
|
||||
return x.Price
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PayDeliveryReq) GetAmount() int32 {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
///支付系统发货请求 回应
|
||||
type PayDeliveryResp struct {
|
||||
state protoimpl.MessageState
|
||||
@ -526,19 +542,22 @@ var file_pay_pay_msg_proto_rawDesc = []byte{
|
||||
0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
|
||||
0x12, 0x1e, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
|
||||
0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x79, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f,
|
||||
0x22, 0x5a, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52,
|
||||
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 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, 0x22, 0x57, 0x0a, 0x0f,
|
||||
0x50, 0x61, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x1e, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e,
|
||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73,
|
||||
0x67, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x22, 0x88, 0x01, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79,
|
||||
0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64,
|
||||
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,
|
||||
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,
|
||||
0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user