Merge branch 'dev_login' of git.pogorockgames.com:mango-games/server/game into dev_login
This commit is contained in:
commit
817d62e811
|
@ -100,5 +100,9 @@
|
||||||
"common": {
|
"common": {
|
||||||
"AppId": "5c56d1644966f078bfb90c71",
|
"AppId": "5c56d1644966f078bfb90c71",
|
||||||
"IsDevMode": true
|
"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 {
|
type Configuration struct {
|
||||||
GameApiURL string
|
GameApiURL string
|
||||||
|
GameApiKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Configuration) Name() 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) {
|
func ApiGetInviteLink(appId string, body proto.Message) ([]byte, error) {
|
||||||
return postRequest(appId, "/get_invite_link", nil, body, "http", DEFAULT_TIMEOUT)
|
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
|
// 用缓存信息做登录,有account
|
||||||
// 根据StartLogin代码,这里ls.acc一定不为nil
|
// 根据StartLogin代码,这里ls.acc一定不为nil
|
||||||
|
// 验证token
|
||||||
ls = LoginStateMgrSington.GetLoginStateByName(UserKey(csl.GetUsername(), csl.GetPlatform(), tagkey))
|
ls = LoginStateMgrSington.GetLoginStateByName(UserKey(csl.GetUsername(), csl.GetPlatform(), tagkey))
|
||||||
if ls != nil {
|
if ls != nil {
|
||||||
acc := ls.acc
|
acc := ls.acc
|
||||||
|
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -2876,6 +2877,33 @@ func init() {
|
||||||
return common.ResponseTag_TransactYield, pack
|
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(
|
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/exchange_order", WebAPIHandlerWrapper(
|
||||||
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
||||||
pack := &webapiproto.SAGetExchangeOrder{
|
pack := &webapiproto.SAGetExchangeOrder{
|
||||||
|
@ -2979,41 +3007,6 @@ func init() {
|
||||||
return common.ResponseTag_TransactYield, pack
|
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 {
|
type playerDataParam struct {
|
||||||
|
|
Loading…
Reference in New Issue