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/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{},