浏览代码

Merge branch 'refs/heads/dev-ll'

# Conflicts:
#	game/config/data/discreteRuleConfig.json
#	game/game_cluster/nodes/game/module/player/cashout.go
#	game/game_cluster/nodes/game/module/player/invite.go
#	game/game_cluster/robot_client/main.go
zhengtao 8 月之前
父节点
当前提交
a2cf3ee1c8

+ 11 - 10
extend/slice/slice_test.go

@@ -9,12 +9,12 @@ import (
 	"time"
 )
 
-func TestUnique(t *testing.T) {
-	list := Unique[string]("1", "2", "3", "1")
-	fmt.Println(list)
-}
+//func TestUnique(t *testing.T) {
+//	list := Unique[string]("1", "2", "3", "1")
+//	fmt.Println(list)
+//}
 
-var currentTime = int64(1727366400)
+var currentTime = int64(1727683200)
 
 func TestUniques(t *testing.T) {
 	//s1 := []string{"1", "2", "3"}
@@ -23,16 +23,17 @@ func TestUniques(t *testing.T) {
 	//list := Uniques[string](s1, s2)
 	//fmt.Println(list)
 
-	//var roolDay = time.Now().Unix()
-	var roolDay = int64(1727337600)
+	// 上次恢复时间
+	var roolDay = int64(1727593200)
 
 	for i := 0; i < 10; i++ {
 		RefreshRoll(&roolDay)
 	}
+
 }
 
 func RefreshRoll(roolDay *int64) bool {
-	arr := []string{"8", "16", "24"}
+	arr := []string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"}
 	slice := make([]int, 0)
 	for _, s := range arr {
 		hour, _ := mhayaString.ToInt(s)
@@ -41,7 +42,7 @@ func RefreshRoll(roolDay *int64) bool {
 
 	// 小时数,24小时制
 	//curHour := time.Now().Hour()
-	curHour := 24
+	curHour := 16
 	rollHour := time.Unix(*roolDay, 0).Hour()
 
 	isToday := mhayaTime.CreateFromTimestamp(*roolDay).IsToday()
@@ -52,7 +53,7 @@ func RefreshRoll(roolDay *int64) bool {
 	}
 
 	fmt.Println("slice:", slice)
-	if slices.Contains(slice, curHour) && isToday {
+	if slices.Contains(slice, curHour) {
 		*roolDay = currentTime
 		fmt.Println(" execute ==> num := p.Item[ItemRoll].AddSameTwo()")
 		return true

+ 9 - 9
game/config/data/achieveTaskConfig.json

@@ -1,11 +1,11 @@
 [
-		{"ID":1,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://x.com/Mhaya_Official","Order":2},
-		{"ID":2,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://t.me/mhayafree","Order":1},
-		{"ID":3,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://www.youtube.com/@mhayaPlaytoearn","Order":3},
-		{"ID":4,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://discord.com/invite/mhaya","Order":4},
-		{"ID":5,"Enable":1,"Type":2,"Condition":{"min":1,"max":5},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":6},
-		{"ID":6,"Enable":1,"Type":2,"Condition":{"min":6,"max":10},"Reward":[{"itemBaseType":2,"itemID":6,"amount":15},{"itemBaseType":1,"itemID":7,"amount":3}],"Url":"","Order":7},
-		{"ID":7,"Enable":1,"Type":2,"Condition":{"min":11,"max":20},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":4}],"Url":"","Order":8},
-		{"ID":8,"Enable":1,"Type":2,"Condition":{"min":21,"max":30},"Reward":[{"itemBaseType":2,"itemID":6,"amount":25},{"itemBaseType":1,"itemID":7,"amount":5}],"Url":"","Order":9},
-		{"ID":9,"Enable":1,"Type":3,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://t.me/mhayafree","Order":5}
+		{"ID":1,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://x.com/Mhaya_Official","Order":2,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/xicon.png"},
+		{"ID":2,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://t.me/mhayafree","Order":1,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/tgicon.png"},
+		{"ID":3,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://www.youtube.com/@mhayaPlaytoearn","Order":3,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon1.png"},
+		{"ID":4,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://discord.com/invite/mhaya","Order":4,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/discord.png"},
+		{"ID":5,"Enable":1,"Type":2,"Condition":{"min":1,"max":5},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":6,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"ID":6,"Enable":1,"Type":2,"Condition":{"min":6,"max":10},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":7,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"ID":7,"Enable":1,"Type":2,"Condition":{"min":11,"max":20},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":8,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"ID":8,"Enable":1,"Type":2,"Condition":{"min":21,"max":999999},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":9,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"ID":9,"Enable":1,"Type":3,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://t.me/mhayafree","Order":5,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/xicon.png"}	
 ]

+ 13 - 13
game/config/data/discreteRuleConfig.json

@@ -1,15 +1,15 @@
 [
-		{"ID":1,"Reward":[{"itemBaseType":1,"itemID":1,"amount":30},{"itemBaseType":2,"itemID":6,"amount":30}],"Condition":""},
-		{"ID":2,"Reward":[{"itemBaseType":1,"itemID":5,"amount":10000}],"Condition":"2"},
-		{"ID":3,"Reward":[{"itemBaseType":1,"itemID":5,"amount":30000}],"Condition":"2"},
-		{"ID":4,"Reward":[{"itemBaseType":1,"itemID":5,"amount":20000},{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":7,"amount":3}],"Condition":"2"},
-		{"ID":5,"Reward":null,"Condition":"21600,1800"},
-		{"ID":6,"Reward":[{"itemBaseType":1,"itemID":7,"amount":10}],"Condition":"30"},
-		{"ID":7,"Reward":[{"itemBaseType":1,"itemID":7,"amount":1}],"Condition":"86400"},
-		{"ID":8,"Reward":[{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":1,"amount":10}],"Condition":""},
-		{"ID":9,"Reward":null,"Condition":"7"},
-		{"ID":10,"Reward":null,"Condition":"1"},
-		{"ID":11,"Reward":null,"Condition":"1"},
-		{"ID":12,"Reward":null,"Condition":"4,6"},
-		{"ID":13,"Reward":null,"Condition":"0.2,2000"}
+	{"ID":1,"Reward":[{"itemBaseType":1,"itemID":1,"amount":150},{"itemBaseType":2,"itemID":6,"amount":150}],"Condition":""},
+	{"ID":2,"Reward":[{"itemBaseType":1,"itemID":5,"amount":10000}],"Condition":"2"},
+	{"ID":3,"Reward":[{"itemBaseType":1,"itemID":5,"amount":30000}],"Condition":"2"},
+	{"ID":4,"Reward":[{"itemBaseType":1,"itemID":5,"amount":20000},{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":7,"amount":3}],"Condition":"2"},
+	{"ID":6,"Reward":[{"itemBaseType":1,"itemID":7,"amount":10}],"Condition":"30"},
+	{"ID":7,"Reward":[{"itemBaseType":1,"itemID":7,"amount":1}],"Condition":"86400"},
+	{"ID":8,"Reward":[{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":1,"amount":10}],"Condition":""},
+	{"ID":9,"Reward":null,"Condition":"7"},
+	{"ID":10,"Reward":null,"Condition":"1"},
+	{"ID":11,"Reward":null,"Condition":"1"},
+	{"ID":12,"Reward":null,"Condition":"4,6"},
+	{"ID":13,"Reward":null,"Condition":"0.2,1"},
+	{"ID":14,"Reward":null,"Condition":"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24"}
 ]

+ 2 - 0
game/game_cluster/internal/mdb/models/achieveTask.go

@@ -18,6 +18,8 @@ const (
 	UCashOutConfig       = 10
 	TonCashOutConfig     = 11
 	NewPlayer10Draw      = 12
+	InviteRatio          = 13
+	RefreshRollNew       = 14
 )
 
 type AchieveTaskBase struct {

+ 5 - 5
game/game_cluster/internal/mdb/models/player.go

@@ -224,14 +224,14 @@ func (p *Player) LevelUp() bool {
 }
 
 func (p *Player) RefreshRoll() bool {
-	ret, ok := data.DiscreteRuleConfig.Get(RefreshRoll)
+	ret, ok := data.DiscreteRuleConfig.Get(RefreshRollNew)
 	if !ok {
 		return false
 	}
 	arr := strings.Split(ret.Condition, ",")
-	if len(arr) != 2 {
-		return false
-	}
+	//if len(arr) != 2 {
+	//	return false
+	//}
 
 	slice := make([]int, 0)
 	for _, s := range arr {
@@ -253,7 +253,7 @@ func (p *Player) RefreshRoll() bool {
 		})
 	}
 
-	if slices.Contains(slice, curHour) && isToday {
+	if slices.Contains(slice, curHour) {
 		p.RollDay = mhayaTime.Now().Unix()
 		num := p.Item[ItemRoll].AddSameTwo(8)
 		if num > 0 {

+ 1 - 0
game/game_cluster/internal/param/param.go

@@ -179,4 +179,5 @@ type SetPwdReq struct {
 type InviteRatioResp struct {
 	Ratio    float64 `json:"ratio"`
 	ClaimNum int     `json:"claimNUm"`
+	MinClaim int     `json:"minClaim"`
 }

+ 2 - 0
game/game_cluster/nodes/game/module/player/actor_player.go

@@ -85,6 +85,8 @@ func (p *actorPlayer) OnInit() {
 
 	p.Remote().Register("cashOutList", p.cashOutList) // 提现记录
 
+	p.Remote().Register("unitTest", p.unitTest)
+
 	p.Timer().Add(10*time.Second, p.refreshRoll)
 	p.Timer().Add(3*time.Second, p.SetRewardToDB)
 	p.Timer().Add(1*time.Minute, p.setRedis)

+ 17 - 2
game/game_cluster/nodes/game/module/player/cashout.go

@@ -2,8 +2,6 @@ package player
 
 import (
 	"context"
-	"log"
-	"time"
 
 	mhayaCrypto "github.com/mhaya/extend/crypto"
 	cstring "github.com/mhaya/extend/string"
@@ -15,9 +13,13 @@ import (
 	"github.com/mhaya/game/game_cluster/internal/mdb"
 	"github.com/mhaya/game/game_cluster/internal/mdb/models"
 	"github.com/mhaya/game/game_cluster/internal/param"
+	mhayaUnit "github.com/mhaya/game/game_cluster/unit"
 	"go.mongodb.org/mongo-driver/bson"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 	"go.mongodb.org/mongo-driver/mongo/options"
+	"log"
+	"sync"
+	"time"
 )
 
 func (p *actorPlayer) cashOut(req *param.CashOutReq) int32 {
@@ -266,3 +268,16 @@ func (p *actorPlayer) updCashOutStatusByOld(tp int) {
 	}
 	p.dirty = true
 }
+
+// 基于启动项目环境的单元测试
+func (p *actorPlayer) unitTest() {
+	var wg sync.WaitGroup
+	// 邀请排行榜机器人
+	accounts := mhayaUnit.BuildAccount(100)
+	for _, account := range accounts {
+		wg.Add(1)
+		mhayaUnit.InviteRankRobot(account, &wg)
+	}
+	wg.Wait()
+
+}

+ 2 - 4
game/game_cluster/nodes/game/module/player/invite.go

@@ -100,20 +100,18 @@ func (p *actorPlayer) inviteRewardRatio() (*param.InviteRatioResp, int32) {
 		return nil, code.PlayerNotLogin
 	}
 
-	inviteReword, _ := data.DiscreteRuleConfig.Get(13)
+	inviteReword, _ := data.DiscreteRuleConfig.Get(models.InviteRatio)
 	split := strings.Split(inviteReword.Condition, ",")
 	ratio, _ := strconv.ParseFloat(split[0], 64)
 	minClaim, _ := strconv.Atoi(split[1])
 
 	key := fmt.Sprintf("%v:1:%v", constant.InviteScoreKey, p.Player.UserName)
 	claimScore, _ := mdb.RDB.Get(context.Background(), key).Int()
-	if claimScore < minClaim {
-		return &param.InviteRatioResp{}, code.OK
-	}
 
 	return &param.InviteRatioResp{
 		Ratio:    ratio,
 		ClaimNum: claimScore,
+		MinClaim: minClaim,
 	}, code.OK
 }
 

+ 1 - 1
game/game_cluster/nodes/game/module/player/stat.go

@@ -59,7 +59,7 @@ func (p *actorPlayer) playerStart() {
 }
 
 func (p *actorPlayer) inviteScore(num int) {
-	scoreRatio, _ := data.DiscreteRuleConfig.Get(13)
+	scoreRatio, _ := data.DiscreteRuleConfig.Get(models.InviteRatio)
 	split := strings.Split(scoreRatio.Condition, ",")
 	ratio, _ := strconv.ParseFloat(split[0], 64)
 	inviteScore := math.Floor(float64(num) * ratio)

+ 23 - 0
game/game_cluster/nodes/web/controller/cashout.go

@@ -137,3 +137,26 @@ func (p *Controller) cashOutList(c *mhayaGin.Context) {
 
 	code.RenderResult(c, code.OK, resp)
 }
+
+func (p *Controller) unitTest(c *mhayaGin.Context) {
+	token, err := p.Auth(c)
+	if code.IsFail(err) {
+		mhayaLogger.Warnf("if cashOutList token err {. params=%s", c.GetHeader(constant.Token))
+		code.RenderResult(c, code.AccountTokenValidateFail)
+		return
+	}
+
+	ctl, ok := p.GetChildActor(token.PlayerID)
+	if !ok {
+		code.RenderResult(c, code.Error)
+		return
+	}
+	errCode := ctl.CallWait(token.TargetPath, "unitTest", nil, nil)
+	if code.IsFail(errCode) {
+		mhayaLogger.Warnf("[unitTest] errCode = %v", errCode)
+		code.RenderResult(c, errCode)
+		return
+	}
+
+	code.RenderResult(c, code.OK)
+}

+ 1 - 0
game/game_cluster/nodes/web/controller/controller.go

@@ -92,6 +92,7 @@ func (p *Controller) Init() {
 	group.POST("/cashOut", p.cashOut)
 	group.POST("/setPwd", p.setPwd)
 	group.POST("/cashOutList", p.cashOutList)
+	group.POST("/unitTest", p.unitTest)
 
 	system := mhayaActor.NewSystem()
 	system.SetApp(p.App)

+ 34 - 0
game/game_cluster/robot_client/main.go

@@ -50,6 +50,40 @@ func main() {
 	}
 
 }
+//func main() {
+//
+//	//accounts := make(map[string]*param.LoginReq)
+//	//for i := 1; i <= maxRobotNum; i++ {
+//	//	str := strconv.Itoa(i)
+//	//	accounts[str] = &param.LoginReq{
+//	//		Pid:      2,
+//	//		OpenID:   str,
+//	//		Platform: "ios",
+//	//		Channel:  "tg",
+//	//	}
+//	//}
+//	//var Url = ""
+//	//for _, val := range accounts {
+//	//	k := rand.Intn(2)
+//	//	if k == 1 {
+//	//		Url = url2
+//	//	} else {
+//	//		Url = url
+//	//	}
+//	//	fmt.Println(Url)
+//	//	time.Sleep(200 * time.Millisecond)
+//	//	go RunRobot(Url, val)
+//	//}
+//
+//	var wg sync.WaitGroup
+//	// 邀请排行榜机器人
+//	accounts := BuildAccount(100)
+//	for _, account := range accounts {
+//		wg.Add(1)
+//		InviteRankRobot(account, &wg)
+//	}
+//	wg.Wait()
+//}
 
 var Player = []string{"28q1PjXEh3M", "28q1PjY2LSm", "28q1PjYpgFW", "28q1PjYLLvw", "28qeTc4cwBj", "28q1RgBeGYq", "28q1PjYLLvx", "28qfgUzvh67", "28qeLPTxn79", "28qfBVzrRqm", "28qf5VTadno", "28qfdrK9yVN", "28qg8W7Lbmh"}
 

+ 126 - 0
game/game_cluster/unit/unit.go

@@ -0,0 +1,126 @@
+package unit
+
+import (
+	"fmt"
+	jsoniter "github.com/json-iterator/go"
+	mhayaHttp "github.com/mhaya/extend/http"
+	"github.com/mhaya/game/game_cluster/internal/code"
+	"github.com/mhaya/game/game_cluster/internal/constant"
+	"github.com/mhaya/game/game_cluster/internal/mdb/models"
+	"github.com/mhaya/game/game_cluster/internal/param"
+	mhayaLogger "github.com/mhaya/logger"
+	"math/rand"
+	"strconv"
+	"sync"
+	"time"
+)
+
+var (
+	maxRobotNum       = 1000 // 运行x个机器人
+	url               = "http://127.0.0.1:20000"
+	url2              = "http://127.0.0.1:20001" // web node
+	addr              = "127.0.0.1:10011"        // 网关地址(正式环境通过区服列表获取)
+	serverId    int32 = 10001                    // 测试的游戏服id
+	pid               = "2126001"                // 测试的sdk包id
+	printLog          = false                    // 是否输出详细日志
+)
+
+// 邀请排行榜机器人
+func InviteRankRobot(account *param.LoginReq, wg *sync.WaitGroup) {
+	defer wg.Done()
+	// 注册邀请人账号
+	_, userName := RegisterAndLogin(url, account)
+	//
+	//params := map[string]interface{}{
+	//	"parentName": userName,
+	//}
+	// 注册被邀请人账号并填写邀请
+	RegisterAndLogin(url, account)
+
+	time.Sleep(time.Duration(rand.Int31n(10)) * time.Millisecond)
+
+	//Invite(url, params, token)
+
+	//设置邀请榜单
+	models.SetRank(constant.RankSourceInvite, 0, userName, 1)
+}
+
+func BuildAccount(total int) []*param.LoginReq {
+	accounts := make([]*param.LoginReq, 0)
+	for i := 1; i <= total; i++ {
+		str := strconv.Itoa(i)
+		accounts = append(accounts, &param.LoginReq{
+			Pid:      2,
+			OpenID:   str,
+			Platform: "ios",
+			Channel:  "tg",
+		})
+	}
+	return accounts
+}
+
+// 注册并登录
+func RegisterAndLogin(url string, val *param.LoginReq) (string, string) {
+	token := RegisterDevAccount(url, val)
+	if token == "" {
+		return "", ""
+	}
+	params := map[string]interface{}{
+		"nickName": "guest" + val.OpenID,
+	}
+	userName := Login(url, params, token)
+
+	time.Sleep(time.Duration(rand.Int31n(2)) * time.Millisecond)
+	return token, userName
+}
+
+func RegisterDevAccount(url string, val *param.LoginReq) string {
+	requestURL := fmt.Sprintf("%s/auth", url)
+
+	params := map[string]interface{}{
+		"pid":      val.Pid,
+		"openid":   val.OpenID,
+		"platform": val.Platform,
+		"channel":  val.Channel,
+	}
+
+	jsonBytes, _, err := mhayaHttp.PostJSON(requestURL, params)
+	if err != nil {
+		mhayaLogger.Warn(err)
+		return ""
+	}
+
+	rsp := &code.Result{}
+	err = jsoniter.Unmarshal(jsonBytes, rsp)
+	if err != nil {
+		mhayaLogger.Warn(err)
+		return ""
+	}
+	if rsp.Code == 0 {
+		mhayaLogger.Debugf("register account = %v, result = %v", val.OpenID, rsp)
+		return rsp.Data.(string)
+	}
+	return ""
+}
+
+func Login(url string, params map[string]interface{}, token string) string {
+	requestURL := fmt.Sprintf("%s/login", url)
+	jsonBytes, err := mhayaHttp.PostJSONWithHeader(requestURL, params, token)
+	if err != nil {
+		mhayaLogger.Warn(err)
+		return ""
+	}
+
+	rsp := &code.Result{}
+	err = jsoniter.Unmarshal(jsonBytes, rsp)
+	if err != nil {
+		mhayaLogger.Warn(err)
+		return ""
+	}
+
+	mhayaLogger.Debugf("Login OK")
+
+	m := rsp.Data.(map[string]interface{})
+	i := m["userName"]
+	return i.(string)
+}