Commit 7dc2b033 authored by chenweijian's avatar chenweijian

上麦

parent 0dd8eeac
......@@ -2,12 +2,14 @@ package rpc
import (
"encoding/json"
"errors"
"fmt"
"git.hilo.cn/hilo-common/_const/enum/timezone_e"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/consul"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/utils"
"math/rand"
)
......@@ -190,3 +192,37 @@ func getGroupHost() string {
mylogrus.MyLog.Infof("getHostGroup:%v---%v", r, groupServerHost[r])
return groupServerHost[r]
}
// 活动积分增加 fType: 1.上麦 2.ludo游戏完成 3.slots游戏完成 4.fruit游戏完成 5.特定座驾进入房间
func MicIn(model *domain.Model, groupId, nonce, token string) error {
defer utils.CheckGoPanic()
type MicInResp struct {
Code int `json:"code"`
Data struct {
MicIndex int `json:"micIndex"`
} `json:"data"`
}
_url := fmt.Sprintf("%v://%v/v1/imGroup/mic/in", defaultGroupServerScheme, getGroupHost())
header := map[string]string{
"nonce": nonce,
"token": token,
}
resp, err := HttpPostForm(model, _url, header, map[string]string{
"groupUuid": groupId,
"i": "", // 空则随意上一个空位置
})
if err != nil {
model.Log.Errorf("MicIn fail:%v", err)
return err
}
response := new(MicInResp)
if err = json.Unmarshal(resp, response); err != nil {
model.Log.Errorf("MicIn json fail:%v", err)
return err
}
if response.Code != 200 || response.Data.MicIndex < 0 {
model.Log.Errorf(fmt.Sprintf("Mic In Not 200:%v,groupId:%v", response, groupId))
return errors.New(fmt.Sprintf("Mic In Not 200:%v", response))
}
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment