diff --git a/bin/梦工厂后台AIP文档.md b/bin/梦工厂后台AIP文档.md index 5b87d1fc2..bf9c5d64b 100644 --- a/bin/梦工厂后台AIP文档.md +++ b/bin/梦工厂后台AIP文档.md @@ -98,7 +98,7 @@ ### 支付发货API - 接口名:paydelivery -- 接口说明:web 服务器给玩家发送邮件 +- 接口说明:web 服务器给玩家发送支付获得商品 - 请求地址:{IP}:{port}/paydelivery - 请求参数:uid(用户id|签名),productid(商品id|签名),orderid(订单号|签名),price(总金额|签名),sign(签名) - 请求样例 diff --git a/modules/buried/module.go b/modules/buried/module.go index 8371d5fd5..75f31da38 100644 --- a/modules/buried/module.go +++ b/modules/buried/module.go @@ -136,12 +136,16 @@ func (this *Buried) ActiveCondition(uid string, condiIds ...int32) (err error) { //激活数据采集点 func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condis []*pb.ConIProgress, err error) { var ( + model *buriedModel bdatas *pb.DBBuried conf *cfg.GameBuriedCondiData bdata *pb.DBBuriedItem ok bool ) - if bdatas, err = this.modelBuried.getUserBurieds(uid); err != nil { + if model, err = this.modelBuried.getburiedModel(uid); err != nil { + return + } + if bdatas, err = model.getUserBurieds(uid); err != nil { return } condis = make([]*pb.ConIProgress, 0) @@ -194,6 +198,7 @@ func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condis []*pb. //设置任务完成状态并校验 func (this *Buried) FinishConditionAndCheck(uid string, finishcondiIds []int32, condiIds ...int32) (condis []*pb.ConIProgress, err error) { var ( + model *buriedModel bdatas *pb.DBBuried bitem *pb.DBBuriedConItem conf *cfg.GameBuriedCondiData @@ -201,7 +206,11 @@ func (this *Buried) FinishConditionAndCheck(uid string, finishcondiIds []int32, chanage bool bdata *pb.DBBuriedItem ) - if bdatas, err = this.modelBuried.getUserBurieds(uid); err != nil { + + if model, err = this.modelBuried.getburiedModel(uid); err != nil { + return + } + if bdatas, err = model.getUserBurieds(uid); err != nil { return } @@ -323,7 +332,7 @@ func (this *Buried) FinishConditionAndCheck(uid string, finishcondiIds []int32, } if chanage { - if err = this.modelBuried.updateUserBurieds(uid, bdatas); err != nil { + if err = model.updateUserBurieds(uid, bdatas); err != nil { this.Error("更新用户埋点数据错误!", log.Field{Key: "err", Value: err.Error()}) return } diff --git a/modules/equipment/module.go b/modules/equipment/module.go index 828f032a7..7eb4bd30b 100644 --- a/modules/equipment/module.go +++ b/modules/equipment/module.go @@ -491,7 +491,7 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, suiteId int32, p errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, Title: pb.ErrorCode_ConfigNoFound.ToString(), - Message: err.Error(), + Message: fmt.Sprintf("no fond pos:%d intlv:%d", pos, lv), } return } else { diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go index 15d7b41b2..83c335577 100644 --- a/modules/shop/api_buy.go +++ b/modules/shop/api_buy.go @@ -112,9 +112,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (errdata } if conf.Buyminnum-record.Buy[req.GoodsId] < req.BuyNum { errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ShopGoodsIsSoldOut, - Title: pb.ErrorCode_ShopGoodsIsSoldOut.ToString(), - Message: err.Error(), + Code: pb.ErrorCode_ShopGoodsIsSoldOut, + Title: pb.ErrorCode_ShopGoodsIsSoldOut.ToString(), } return } diff --git a/modules/sociaty/api_cross_tasklist.go b/modules/sociaty/api_cross_tasklist.go index 7cdeb06e2..7a9d288a5 100644 --- a/modules/sociaty/api_cross_tasklist.go +++ b/modules/sociaty/api_cross_tasklist.go @@ -28,7 +28,6 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList var taskList []*pb.SociatyTask for _, v := range sociatyTask.TaskList { - status := v.Status // if _, ok := this.module.modelSociaty.validTask(uid, v.TaskId); ok { // status = 1 //完成 // } @@ -48,7 +47,7 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList taskList = append(taskList, &pb.SociatyTask{ TaskId: v.TaskId, - Status: status, + Status: v.Status, Received: v.Received, Cond: v.Cond, }) diff --git a/modules/web/api_paydelivery.go b/modules/web/api_paydelivery.go index a9fb56271..dd69dfa62 100644 --- a/modules/web/api_paydelivery.go +++ b/modules/web/api_paydelivery.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/lego/utils/crypto/md5" "go_dreamfactory/pb" "net/http" + "time" ) type PayDeliveryResults struct { @@ -53,8 +54,9 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) { payresp.Code = pb.ErrorCode_SignError payresp.Msg = pb.GetErrorCodeMsg(pb.ErrorCode_SignError) } + ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) if err = this.module.service.RpcCall( - context.Background(), + ctx, comm.Service_Worker, string(comm.Rpc_ModulePayDelivery), payreq, diff --git a/modules/web/api_synccross.go b/modules/web/api_synccross.go index 9b8e92e17..1b1c1cd5f 100644 --- a/modules/web/api_synccross.go +++ b/modules/web/api_synccross.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/db" "net/http" + "time" ) type SyncCrossReq struct { @@ -51,8 +52,9 @@ func (this *Api_Comp) SyncCross(c *engine.Context) { resp.Message = err.Error() return } + ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) if err = this.module.service.RpcBroadcast( - context.Background(), + ctx, comm.Service_Worker, string(comm.Rpc_DBSyncCross), pb.EmptyReq{}, diff --git a/modules/web/api_upload.go b/modules/web/api_upload.go index 215d6b1ae..fad22ee80 100644 --- a/modules/web/api_upload.go +++ b/modules/web/api_upload.go @@ -9,6 +9,7 @@ import ( "go_dreamfactory/sys/configure" "net/http" "strconv" + "time" ) //上传配置文件 @@ -52,8 +53,9 @@ func (this *Api_Comp) Upload(c *engine.Context) { } } } + ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) if err := this.module.service.RpcBroadcast( - context.Background(), + ctx, comm.Service_Worker, string(comm.Rpc_ConfigureUpDate), &pb.EmptyReq{}, diff --git a/modules/worldtask/module.go b/modules/worldtask/module.go index 5bbed8fc5..0b6f284d5 100644 --- a/modules/worldtask/module.go +++ b/modules/worldtask/module.go @@ -126,7 +126,7 @@ func (this *Worldtask) TCondFinishNotify(uid string, conds []*pb.ConIProgress) { for _, cfg := range worldtaskConf.GetDataList() { for _, condId := range cfg.Completetask { for _, cond := range conds { - if condId == cond.Conid && cond.State == pb.BuriedItemFinishState_buried_finish { + if condId == cond.Conid { //&& cond.State == pb.BuriedItemFinishState_buried_finish { //校验任务是否是当前任务 if task, ok := userTask.CurrentTasks[cfg.Group]; ok { var currentTasks []*pb.CurrentTask @@ -160,8 +160,10 @@ func (this *Worldtask) TCondFinishNotify(uid string, conds []*pb.ConIProgress) { return } if curTaskConf.DeliverNpc == 0 { - this.modelWorldtask.taskFinish(session, t.TaskId, userTask, curTaskConf) - this.modelWorldtask.taskFinishPush(session, userTask, curTaskConf) + defer func() { + this.modelWorldtask.taskFinish(session, t.TaskId, userTask, curTaskConf) + this.modelWorldtask.taskFinishPush(session, userTask, curTaskConf) + }() } currentTasks = append(currentTasks, t) } diff --git a/sys/db/dbmodel.go b/sys/db/dbmodel.go index e212e3dbd..62ba11183 100644 --- a/sys/db/dbmodel.go +++ b/sys/db/dbmodel.go @@ -81,7 +81,7 @@ func (this *DBModel) InsertModelLogs(table string, uID string, target interface{ _, err = this.DB.InsertOne(DB_ModelTable, data) if err != nil { - log.Errorf("insert model db err %v", err) + log.Errorf("table:%s insert model db err %v", this.TableName, err) } return err @@ -104,7 +104,7 @@ func (this *DBModel) InsertManyModelLogs(table string, datas map[string]interfac _, err = this.DB.InsertMany(DB_ModelTable, data) if err != nil { - log.Errorf("insert model db err %v", err) + log.Errorf("table:%s insert model db err %v", this.TableName, err) } return err } @@ -122,7 +122,7 @@ func (this *DBModel) DeleteModelLogs(table string, uID string, where interface{} _, err = this.DB.InsertOne(DB_ModelTable, data) if err != nil { - log.Errorf("insert model db err %v", err) + log.Errorf("table:%s insert model db err %v", this.TableName, err) } return err @@ -141,7 +141,7 @@ func (this *DBModel) UpdateModelLogs(table string, uID string, where bson.M, tar _, err = this.DB.InsertOne(DB_ModelTable, data) if err != nil { - log.Errorf("insert model db err %v", err) + log.Errorf("table:%s insert model db err %v", this.TableName, err) } return err