休闲平台登录修改
This commit is contained in:
parent
f4fc8225ef
commit
1694d93397
|
@ -30,7 +30,6 @@ import (
|
|||
const (
|
||||
WEBAPI_TRANSACTE_EVENT int = iota
|
||||
WEBAPI_TRANSACTE_RESPONSE
|
||||
PLATFORMAPPKEY = "PLATFORMAPPKEYtest123"
|
||||
)
|
||||
|
||||
var WebApiStats = new(sync.Map)
|
||||
|
@ -159,7 +158,7 @@ func PlatformSrvApi(rw http.ResponseWriter, req *http.Request) {
|
|||
params := make(map[string]string)
|
||||
json.Unmarshal(data, ¶ms)
|
||||
|
||||
realSign := webapi.MD5Params(params, PLATFORMAPPKEY, "sign")
|
||||
realSign := webapi.MD5Params(params, webapi.Config.GameApiKey, "sign")
|
||||
|
||||
sign := params["sign"]
|
||||
if realSign != sign {
|
||||
|
|
|
@ -100,5 +100,9 @@
|
|||
"common": {
|
||||
"AppId": "5c56d1644966f078bfb90c71",
|
||||
"IsDevMode": true
|
||||
},
|
||||
"webapi": {
|
||||
"GameApiURL": "http://103.39.231.66:1099/api/game_srv/platform_config",
|
||||
"GameApiKey": "PLATFORMAPPKEYtest123"
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ var (
|
|||
|
||||
type Configuration struct {
|
||||
GameApiURL string
|
||||
GameApiKey string
|
||||
}
|
||||
|
||||
func (this *Configuration) Name() string {
|
||||
|
|
|
@ -237,3 +237,13 @@ func API_GetActConfig(appId string) ([]byte, error) {
|
|||
func ApiGetInviteLink(appId string, body proto.Message) ([]byte, error) {
|
||||
return postRequest(appId, "/get_invite_link", nil, body, "http", DEFAULT_TIMEOUT)
|
||||
}
|
||||
|
||||
// 平台登录返回
|
||||
type PlatfromGameLoginRsp struct {
|
||||
Code int `json:"code"`
|
||||
Data struct {
|
||||
Url string `json:"url"`
|
||||
} `json:"data"`
|
||||
Message string `json:"message"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
|
|
@ -250,6 +250,7 @@ func (this *CSLoginHandler) Process(s *netlib.Session, packetid int, data interf
|
|||
|
||||
// 用缓存信息做登录,有account
|
||||
// 根据StartLogin代码,这里ls.acc一定不为nil
|
||||
// 验证token
|
||||
ls = LoginStateMgrSington.GetLoginStateByName(UserKey(csl.GetUsername(), csl.GetPlatform(), tagkey))
|
||||
if ls != nil {
|
||||
acc := ls.acc
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -2876,6 +2877,33 @@ func init() {
|
|||
return common.ResponseTag_TransactYield, pack
|
||||
}))
|
||||
|
||||
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/createUser", WebAPIHandlerWrapper(
|
||||
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
||||
pack := &webapi.PlatfromGameLoginRsp{
|
||||
Success: false,
|
||||
Code: 200,
|
||||
Message: "未知错误",
|
||||
}
|
||||
pack.Data.Url = "http://192.168.31.173/web-mobile-p102/"
|
||||
|
||||
logger.Logger.Tracef("/api/platform/createUse %v", pack)
|
||||
|
||||
var jsonDataRsp []byte
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
//b, err = webapi.API_ExchangeRecord(common.GetAppId(), msg)
|
||||
pack.Success = true
|
||||
pack.Message = "返回成功"
|
||||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||
|
||||
jsonDataRsp, _ = json.Marshal(pack)
|
||||
|
||||
tNode.TransRep.RetFiels = jsonDataRsp
|
||||
tNode.Resume()
|
||||
}), "/api/platform/createUse").Start()
|
||||
return common.ResponseTag_TransactYield, jsonDataRsp
|
||||
}))
|
||||
|
||||
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/exchange_order", WebAPIHandlerWrapper(
|
||||
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
||||
pack := &webapiproto.SAGetExchangeOrder{
|
||||
|
@ -2979,41 +3007,6 @@ func init() {
|
|||
return common.ResponseTag_TransactYield, pack
|
||||
}))
|
||||
|
||||
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/createUse", WebAPIHandlerWrapper(
|
||||
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
||||
pack := &webapiproto.SAGetExchangeOrder{
|
||||
Tag: webapiproto.TagCode_FAILED,
|
||||
}
|
||||
msg := &webapiproto.ASGetExchangeOrder{}
|
||||
var err error
|
||||
err = proto.Unmarshal(params, msg)
|
||||
if err != nil {
|
||||
pack.Tag = webapiproto.TagCode_FAILED
|
||||
logger.Logger.Errorf("/api/game/exchange_order Unmarshal err: %v", err)
|
||||
return common.ResponseTag_ParamError, pack
|
||||
}
|
||||
|
||||
logger.Logger.Tracef("/api/game/exchange_order %v", msg)
|
||||
|
||||
var b []byte
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
b, err = webapi.API_ExchangeRecord(common.GetAppId(), msg)
|
||||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||
if err != nil || b == nil {
|
||||
logger.Logger.Errorf("/api/game/exchange_order API_ExchangeList err: %v", err)
|
||||
pack.Tag = webapiproto.TagCode_FAILED
|
||||
} else {
|
||||
err = proto.Unmarshal(b, pack)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("/api/game/exchange_order Unmarshal err: %v", err)
|
||||
}
|
||||
}
|
||||
tNode.TransRep.RetFiels = pack
|
||||
tNode.Resume()
|
||||
}), "/api/game/exchange_order").Start()
|
||||
return common.ResponseTag_TransactYield, pack
|
||||
}))
|
||||
}
|
||||
|
||||
type playerDataParam struct {
|
||||
|
|
Loading…
Reference in New Issue