From 6a53d2149218dc4dbea0b658f7af8a1fa710f9db Mon Sep 17 00:00:00 2001 From: "DESKTOP-45ANQ2C\\unis" <121212121@qq.com> Date: Fri, 13 Dec 2024 13:38:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=91=E9=97=B2=E5=B9=B3=E5=8F=B0=E4=B8=8A?= =?UTF-8?q?=E5=88=86=E4=B8=8B=E5=88=86=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapi/deprecated.go | 18 +++++ worldsrv/trascate_webapi.go | 146 ++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) diff --git a/webapi/deprecated.go b/webapi/deprecated.go index b127e9f..1e7bc89 100644 --- a/webapi/deprecated.go +++ b/webapi/deprecated.go @@ -256,3 +256,21 @@ type PlatfromGameLoginRsp struct { Message string `json:"message"` Success bool `json:"success"` } + +// 上分请求 +type PlatfromUpScoreReq struct { + Username string `json:"username"` + Channel string `json:"channel"` + Timestamp int64 `json:"timestamp"` + Count string `json:"count"` +} + +// 上分返回 +type PlatfromUpScoreRsp struct { + Code int `json:"code"` + Data struct { + Count int64 `json:"count"` + } `json:"data"` + Message string `json:"message"` + Success bool `json:"success"` +} diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 7e54b5a..427fd72 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -2962,6 +2962,152 @@ func init() { return common.ResponseTag_TransactYield, jsonDataRsp })) + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/upscore", WebAPIHandlerWrapper( + func(tNode *transact.TransNode, params []byte) (int, interface{}) { + + var AccountInfo *webapi.PlatfromCreateAccountReq + err := json.Unmarshal(params, &AccountInfo) + if err != nil { + logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err) + } + + pack := &webapi.PlatfromGameLoginRsp{ + Success: false, + Code: 200, + Message: "未知错误", + } + + logger.Logger.Tracef("/api/platform/upscore %v", pack) + + var jsonDataRsp []byte + + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + pack.Success = true + pack.Message = "返回成功" + + return nil + }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { + + jsonDataRsp, err = json.Marshal(pack) + if err != nil { + logger.Logger.Errorf("/api/platform/createUser err: %v", err) + } + + tNode.TransRep.RetFiels = jsonDataRsp + tNode.Resume() + }), "/api/platform/upscore").Start() + return common.ResponseTag_TransactYield, jsonDataRsp + })) + + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/downscore", WebAPIHandlerWrapper( + func(tNode *transact.TransNode, params []byte) (int, interface{}) { + + var AccountInfo *webapi.PlatfromCreateAccountReq + err := json.Unmarshal(params, &AccountInfo) + if err != nil { + logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err) + } + + pack := &webapi.PlatfromGameLoginRsp{ + Success: false, + Code: 200, + Message: "未知错误", + } + + logger.Logger.Tracef("/api/platform/downscore %v", pack) + + var jsonDataRsp []byte + + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + + pack.Success = true + pack.Message = "返回成功" + return nil + }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { + + jsonDataRsp, err = json.Marshal(pack) + if err != nil { + logger.Logger.Errorf("/api/platform/downscore err: %v", err) + } + + tNode.TransRep.RetFiels = jsonDataRsp + tNode.Resume() + }), "/api/platform/downscore").Start() + return common.ResponseTag_TransactYield, jsonDataRsp + })) + + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/getstatus", WebAPIHandlerWrapper( + func(tNode *transact.TransNode, params []byte) (int, interface{}) { + + var AccountInfo *webapi.PlatfromCreateAccountReq + err := json.Unmarshal(params, &AccountInfo) + if err != nil { + logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err) + } + + pack := &webapi.PlatfromGameLoginRsp{ + Success: false, + Code: 200, + Message: "未知错误", + } + + logger.Logger.Tracef("/api/platform/getstatus %v", pack) + + var jsonDataRsp []byte + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + pack.Success = true + pack.Message = "返回成功" + + return nil + }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { + + jsonDataRsp, err = json.Marshal(pack) + if err != nil { + logger.Logger.Errorf("/api/platform/getstatus err: %v", err) + } + + tNode.TransRep.RetFiels = jsonDataRsp + tNode.Resume() + }), "/api/platform/getstatus").Start() + return common.ResponseTag_TransactYield, jsonDataRsp + })) + + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/getgamedetailed", WebAPIHandlerWrapper( + func(tNode *transact.TransNode, params []byte) (int, interface{}) { + + var AccountInfo *webapi.PlatfromCreateAccountReq + err := json.Unmarshal(params, &AccountInfo) + if err != nil { + logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err) + } + + pack := &webapi.PlatfromGameLoginRsp{ + Success: false, + Code: 200, + Message: "未知错误", + } + + logger.Logger.Tracef("/api/platform/getgamedetailed %v", pack) + + var jsonDataRsp []byte + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + pack.Success = true + pack.Message = "返回成功" + + return nil + }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { + + jsonDataRsp, err = json.Marshal(pack) + if err != nil { + logger.Logger.Errorf("/api/platform/getgamedetailed err: %v", err) + } + + tNode.TransRep.RetFiels = jsonDataRsp + tNode.Resume() + }), "/api/platform/getgamedetailed").Start() + return common.ResponseTag_TransactYield, jsonDataRsp + })) + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/exchange_order", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, interface{}) { pack := &webapiproto.SAGetExchangeOrder{