diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index 8df403a..c61d271 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -363,6 +363,52 @@ type PutWareHouseResp struct { Data PutWareHouseData `json:"data"` } +type QueryGamblingData struct { + CatId int `json:"catId"` + Round int `json:"round"` + RewardNumber int `json:"rewardNumber"` + MyNumber int `json:"myNumber"` + Status int `json:"status"` + Nickname string `json:"nickname"` + HeadImg string `json:"headImg"` +} + +type QueryGamblingResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data []QueryGamblingData `json:"data"` +} + +type NumberListDesc struct { + Number int `json:"number"` + Choosed bool `json:"choosed"` +} + +type NumberListData struct { + Round int `json:"round"` + NumberList []NumberListDesc `json:"numberList"` +} + +type NumberListResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data NumberListData `json:"data"` +} + +type ChooseNumReq struct { + Number int `json:"number"` + Round int `json:"round"` + CatId int `json:"catId"` +} + +type ChooseNumData struct { +} +type ChooseNumResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data ChooseNumData `json:"data"` +} + type TakeWareHouseReq struct { CatId string `json:"catId"` } @@ -627,48 +673,56 @@ type AchieveMentData struct { //玩家数据 type UserData struct { - UserId int //玩家id - RegTime int //注册时间 - Gold int64 //金币 - GoldSum int64 //玩家累计金币 - Love int64 //爱心值 - Goldrate int64 //金币生成速率 - Loverate int64 //爱心生产速率 - Highestlv int //当前最高猫等级 - InviteId int //邀请者uid - CurBoxLv int //当前猫箱子等级 - IsDouble int //当前加速标签 1表示3倍收益 0表示正常 - StartDoubleTime int //开始双倍时间 - DoubleLeftTimes int //剩余加速金币次数 - GetWatchAdsGoldTime int //看广告领金币次数 - DrawTicket int //抽奖券次数 - DrawTicketTimes int //剩余增加抽奖券次数 - DratMult int //下次抽奖的倍数 - DrawLastRewardId int //上一次的奖励ID - DrawTableCount int //当前抽奖次数 5次以后归零 - IsAuto int //当前是否自动合成 - IsBoxAcc int //是否处于加速生成箱子状态 - RandGiftNum int //当前剩余空投猫粮次数 - RandGiftDay int //记录当前猫粮日期,当日期变化则重置RandGiftNum - RandGiftTime int //记录上一次空投猫粮时间 - Redbag float32 //红包值 单位为分 - Head string //头像地址 - NickName string //昵称 - RealName string //实名 - IsFirstRedBgCat int //是否合成过红包猫 0表示否1表示是 - OfflineGold int64 //离线金币 - OfflineLove int64 //离线爱心 - LastLoginTime int //上次登陆时间 - LastTimingRewardHour int //上次领取整点奖励的时刻 - FlopCardCnt int //翻牌次数计数 - FlopCardLefCnt int //剩余翻拍次数 - CatShopInfo CatShopData //猫咖门店数据 - Taskinfo TaskData //任务数据 - AchieveMent AchieveMentData //成就数据 - PosInfo []CatPosInfo //位置信息 从0开始 - BuyCatInfo []BuyCatInfoData //商店购买猫数据 第一个元素为1级猫 第二个为2级猫以此类推 - CatRoomInfo []CatRoomData //猫咖店数据 - + UserId int //玩家id + RegTime int //注册时间 + Gold int64 //金币 + GoldSum int64 //玩家累计金币 + Love int64 //爱心值 + Goldrate int64 //金币生成速率 + Loverate int64 //爱心生产速率 + Highestlv int //当前最高猫等级 + InviteId int //邀请者uid + CurBoxLv int //当前猫箱子等级 + IsDouble int //当前加速标签 1表示3倍收益 0表示正常 + StartDoubleTime int //开始双倍时间 + DoubleLeftTimes int //剩余加速金币次数 + GetWatchAdsGoldTime int //看广告领金币次数 + DrawTicket int //抽奖券次数 + DrawTicketTimes int //剩余增加抽奖券次数 + DratMult int //下次抽奖的倍数 + DrawLastRewardId int //上一次的奖励ID + DrawTableCount int //当前抽奖次数 5次以后归零 + IsAuto int //当前是否自动合成 + IsBoxAcc int //是否处于加速生成箱子状态 + RandGiftNum int //当前剩余空投猫粮次数 + RandGiftDay int //记录当前猫粮日期,当日期变化则重置RandGiftNum + RandGiftTime int //记录上一次空投猫粮时间 + Redbag float32 //红包值 单位为分 + Head string //头像地址 + NickName string //昵称 + RealName string //实名 + IsFirstRedBgCat int //是否合成过红包猫 0表示否1表示是 + OfflineGold int64 //离线金币 + OfflineLove int64 //离线爱心 + LastLoginTime int //上次登陆时间 + LastTimingRewardHour int //上次领取整点奖励的时刻 + FlopCardCnt int //翻牌次数计数 + FlopCardLefCnt int //剩余翻拍次数 + CatShopInfo CatShopData //猫咖门店数据 + Taskinfo TaskData //任务数据 + AchieveMent AchieveMentData //成就数据 + PosInfo []CatPosInfo //位置信息 从0开始 + BuyCatInfo []BuyCatInfoData //商店购买猫数据 第一个元素为1级猫 第二个为2级猫以此类推 + CatRoomInfo []CatRoomData //猫咖店数据 + CaiPiaoInfo []UserCaiPiaoHistory //记录玩家参与过的赌博猫历史记录 + +} + +type UserCaiPiaoHistory struct { + Cnum int //选择的号码 + RewardNum int //当期开奖的号码 + Round int //轮数 + CatId int //猫ID } //仓库数据详情 @@ -696,3 +750,35 @@ const ( ACH_TYPE_GETSTORY = 9 //累计解锁新故事 ACH_TYPE_GBESHOP = 10 //累计用于新店铺 ) + +//赌博猫相关数据结构 +type UserCaiPiaoInfo struct { + CatId int //猫ID + UserId int //uuid + ChooseNum int //选择号码 +} + +//当期奖池信息 +type CurDuboCatList struct { + CurRound int //当前轮次 + CurNum int //当前人数 + FakeNum int //当期不开奖号码 如果0表示当期真实开奖 + List []UserCaiPiaoInfo //当期彩池人数 +} + +//待开奖奖池信息 +type WaitDuboCatList struct { + CurRound int //当前轮次 + RewardNum int //开奖号码 + List []UserCaiPiaoInfo //当期彩池人数 + RewardUser int //中奖者ID 如果假中奖为0 +} + +//已开奖列表 +type AlreadyDuboCatList struct { + CurRound int //当前轮次 + RewardNum int //开奖号码 + List []UserCaiPiaoInfo //当期彩池人数 + RewardUser int //中奖者ID 如果假中奖为0 + TimeStr int //开奖时刻 +} diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index 109139f..d375b24 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -12,6 +12,128 @@ import ( "time" ) +//生成数字 +func GenerateNums(start, end, count int) []int { + var nums []int + r := rand.New(rand.NewSource(time.Now().UnixNano())) + for len(nums) < count { + //生成随机数 + num := r.Intn((end - start)) + start + 1 + //查重 + exist := false + for _, v := range nums { + if v == num { + exist = true + break + } + } + if !exist { + nums = append(nums, num) + } + } + return nums +} + +//生成新的一期初始化奖池随机数 +func NewCaiPiaoRound(start, end, count, round int) { + nums := GenerateNums(start, end, count) + //存入redis + fakenum := GetCaiPiaoFake(round) + var curround CurDuboCatList + curround.CurRound = round + curround.CurNum = 0 + curround.FakeNum = fakenum + + savestr, err := json.Marshal(&curround) + if err != nil { + err = redishandler.GetRedisClient().SetString(redis.CAIPIAOKAIJIANGCURRENT_KEY, string(savestr)) + if err != nil { + logger.Error("NewCaiPiaoRound err=%v", err) + } + } else { + logger.Error("NewCaiPiaoRound err=%v", err) + } + + //首先清楚原先的号码 + redishandler.GetRedisClient().Delete(redis.CAIPIAOLEFTNUM_KEY) + for _, val := range nums { + if fakenum == val { + continue + } + redishandler.GetRedisClient().HSet(redis.CAIPIAOLEFTNUM_KEY, strconv.Itoa(val), strconv.Itoa(val)) + } +} + +//获取已开奖赌博猫列表 +func GetWaitCaiCatList() []WaitDuboCatList { + var rtsl []WaitDuboCatList + vv, err := redishandler.GetRedisClient().HGetAllValues(redis.CAIPIAOKAIJIANGWAIT_KEY) + if err != nil { + //logger.Error("GetTeamListByCond err") + return rtsl + } + + for _, val := range vv { + //one := new(WaitDuboCatList) + var one WaitDuboCatList + bytestr := val.([]byte) + err = json.Unmarshal(bytestr, &one) + if err == nil { + rtsl = append(rtsl, one) + } + } + return rtsl +} + +//获取正在投注的赌博猫池子列表 +func GetCurCaiCatList() *CurDuboCatList { + curstr, err := redishandler.GetRedisClient().GetString(redis.CAIPIAOKAIJIANGCURRENT_KEY) + if err != nil { + return nil + } + prt := new(CurDuboCatList) + err = json.Unmarshal([]byte(curstr), prt) + if err != nil { + logger.Error("GetCurCaiCatList err=%v", err) + return nil + } + return prt +} + +//设置当前彩池 +func SetCurCaiCatList(c *CurDuboCatList) { + savestr, err := json.Marshal(c) + if err != nil { + logger.Error("SetCurCaiCatList err=%v", err) + } + + err = redishandler.GetRedisClient().SetString(redis.CAIPIAOKAIJIANGCURRENT_KEY, string(savestr)) + if err != nil { + logger.Error("SetCurCaiCatList err=%v", err) + } +} + +//赌博猫开奖真假接口 返回非零表示当期作弊号码 +func GetCaiPiaoFake(round int) int { + numstr, err := redishandler.GetRedisClient().HGet(redis.CAIPIAOISFAKE_KEY, strconv.Itoa(round)) + if err != nil { + return 0 + } + rtnum, err := strconv.Atoi(numstr) + if err != nil { + logger.Error("GetCaiPiaoFake failede err=%v", err) + return 0 + } + return rtnum +} + +func SetCaiPiaoFake(num, round int) { + err := redishandler.GetRedisClient().HSet(redis.CAIPIAOISFAKE_KEY, strconv.Itoa(round), strconv.Itoa(num)) + if err != nil { + logger.Error("SetCaiPiaoFake err=%v", err) + } +} + //加红包接口 func (u *UserData) AddRedPackect(num float32) { //todo 接后台 diff --git a/src/HttpServer/logic/httpserver.go b/src/HttpServer/logic/httpserver.go index 1ecdb81..953b77b 100644 --- a/src/HttpServer/logic/httpserver.go +++ b/src/HttpServer/logic/httpserver.go @@ -50,6 +50,11 @@ func startServerHttpServe() { http.HandleFunc("/api/package/catList", QueryWareHouse) //背包列表 http.HandleFunc("/api/package/putToPackage", PutCattoWareHouse) //加入背包 http.HandleFunc("/api/package/getFromPackage", TakeCatoutfromWareHouse) //背包中取出 + http.HandleFunc("/api/gambling/catList", QueryGambling) //赌博猫列表 + http.HandleFunc("/api/gambling/numberList", NumberList) //获取号码 + http.HandleFunc("/api/gambling/chooseNum", ChooseNum) //选取号码 + http.HandleFunc("/api/gambling/autoChoose", AutoChoose) //自动选号码 + http.HandleFunc("/api/gambling/removeCat", RemoveCat) //清除猫 /////---------------------------------------------------------------------old http.HandleFunc("/happycat/exchangetwoPos", ExchangePos) //交换位置 @@ -428,6 +433,96 @@ func PutCattoWareHouse(w http.ResponseWriter, r *http.Request) { HandlerPutCattoWareHouse(w, s, Uuid) } +func RemoveCat(w http.ResponseWriter, r *http.Request) { + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) + } + if Uuid == 0 { + SetHeader(w) + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("RemoveCat , body:%v,uuid=%v", s, Uuid) + + HandlerRemoveCat(w, s, Uuid) +} + +func AutoChoose(w http.ResponseWriter, r *http.Request) { + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) + } + if Uuid == 0 { + SetHeader(w) + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("AutoChoose , body:%v,uuid=%v", s, Uuid) + + HandlerAutoChoose(w, s, Uuid) +} + +func ChooseNum(w http.ResponseWriter, r *http.Request) { + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) + } + if Uuid == 0 { + SetHeader(w) + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("ChooseNum , body:%v,uuid=%v", s, Uuid) + + HandlerChooseNum(w, s, Uuid) +} + +func NumberList(w http.ResponseWriter, r *http.Request) { + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) + } + if Uuid == 0 { + SetHeader(w) + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("NumberList , body:%v,uuid=%v", s, Uuid) + + HandlerNumberList(w, s, Uuid) +} + +func QueryGambling(w http.ResponseWriter, r *http.Request) { + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) + } + if Uuid == 0 { + SetHeader(w) + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("QueryGambling , body:%v,uuid=%v", s, Uuid) + + HandlerQueryGambling(w, s, Uuid) +} + func TakeCatoutfromWareHouse(w http.ResponseWriter, r *http.Request) { Uuid := 0 if len(r.Header) > 0 { diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index f2c9740..0def9e7 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -21,6 +21,15 @@ var ( func init() { //m_userInfo = beegomap.NewBeeMap() Maplock = new(sync.RWMutex) + +} + +func MyInit() { + pc := GetCurCaiCatList() + if pc == nil { + //初始化彩池 + NewCaiPiaoRound(0, 200, 200, 1) + } } func SetHeader(w http.ResponseWriter) { @@ -1308,6 +1317,335 @@ func HandlerQueryWareHouse(w http.ResponseWriter, data string, uuid int) { fmt.Fprint(w, string(respstr)) } +func HandlerRemoveCat(w http.ResponseWriter, data string, uuid int) { + SetHeader(w) + var resp ChooseNumResp + + resp.Code = 0 + resp.Message = "success" + + for { + + resp.Code = 0 + + break + } + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + +func HandlerAutoChoose(w http.ResponseWriter, data string, uuid int) { + SetHeader(w) + var resp ChooseNumResp + + resp.Code = 0 + resp.Message = "success" + + for { + + //首先找一个可以选取的号码 + cnum := 0 + vv, err := redishandler.GetRedisClient().HGetAllKeys(redis.CAIPIAOLEFTNUM_KEY) + if err != nil { + logger.Error("HandlerAutoChoose getuserinfo failed=%v", err) + resp.Code = 1 + resp.Message = "HandlerAutoChoose failed" + break + } + + for _, val := range vv { + //one := new(WaitDuboCatList) + bytestr := val.([]byte) + num, err := strconv.Atoi(string(bytestr)) + if err == nil { + cnum = num + break + } + } + + if cnum == 0 { + //已经没有被选的号码了 + logger.Error("HandlerAutoChoose no num failed=%v", err) + resp.Code = 1 + resp.Message = "no num" + break + } + + //加入当前彩池 + curpool := GetCurCaiCatList() + if curpool == nil { + //理论上会报错 + logger.Error("HandlerChooseNum pool empty!!") + resp.Message = " pool empty" + resp.Code = 1 + break + } else { + //将该号码移除 + redishandler.GetRedisClient().HDel(redis.CAIPIAOLEFTNUM_KEY, strconv.Itoa(cnum)) + //添加 + var tmp UserCaiPiaoInfo + tmp.ChooseNum = cnum + tmp.CatId = 48 + tmp.UserId = uuid + curpool.List = append(curpool.List, tmp) + curpool.CurNum = len(curpool.List) + SetCurCaiCatList(curpool) + //需要处理一下奖池是否满了 + fullnum := 199 + if curpool.FakeNum == 0 { + fullnum++ + } + + if curpool.CurNum >= fullnum { + //已经满了 重新生成新的奖池 将原先的加入到待开奖列表 + var waits WaitDuboCatList + waits.CurRound = curpool.CurRound + waits.RewardNum = 0 + waits.RewardUser = 0 + waits.List = append(waits.List, curpool.List...) + + savestr, _ := json.Marshal(&waits) + err = redishandler.GetRedisClient().HSet(redis.CAIPIAOKAIJIANGWAIT_KEY, strconv.Itoa(waits.CurRound), string(savestr)) + if err != nil { + logger.Error("HandlerChooseNum err=%v", err) + } + + //生成新的彩池 + NewCaiPiaoRound(0, 200, 200, waits.CurRound+1) + } + + } + + resp.Code = 0 + + break + } + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + +func HandlerChooseNum(w http.ResponseWriter, data string, uuid int) { + SetHeader(w) + var resp ChooseNumResp + + resp.Code = 0 + resp.Message = "success" + var rdata ChooseNumReq + err := json.Unmarshal([]byte(data), &rdata) + if err != nil { + logger.Info("json decode HandlerChooseNum data failed:%v", err, " for:%v", data) + resp.Message = "json unmarshal failed" + resp.Code = 1 + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) + return + } + + for { + //先判断一下当前号码是否已被选取 + isexist, err := redishandler.GetRedisClient().HExists(redis.CAIPIAOLEFTNUM_KEY, strconv.Itoa(rdata.Number)) + if err != nil { + logger.Info("HandlerChooseNum failed:%v", err, " for:%v", data) + resp.Message = "redis failed" + resp.Code = 1 + break + } + + if !isexist { + //已经被选了 + logger.Info("HandlerChooseNum number alreadypicked failed:%v", err, " for:%v", data) + resp.Message = " alreadypicked" + resp.Code = 100 + break + } + + //加入当前彩池 + curpool := GetCurCaiCatList() + if curpool == nil { + //理论上会报错 + logger.Error("HandlerChooseNum pool empty!!") + resp.Message = " pool empty" + resp.Code = 1 + break + } else { + //将该号码移除 + redishandler.GetRedisClient().HDel(redis.CAIPIAOLEFTNUM_KEY, strconv.Itoa(rdata.Number)) + //添加 + var tmp UserCaiPiaoInfo + tmp.ChooseNum = rdata.Number + tmp.CatId = rdata.CatId + tmp.UserId = uuid + curpool.List = append(curpool.List, tmp) + curpool.CurNum = len(curpool.List) + SetCurCaiCatList(curpool) + //需要处理一下奖池是否满了 + fullnum := 199 + if curpool.FakeNum == 0 { + fullnum++ + } + + if curpool.CurNum >= fullnum { + //已经满了 重新生成新的奖池 将原先的加入到待开奖列表 + var waits WaitDuboCatList + waits.CurRound = curpool.CurRound + waits.RewardNum = 0 + waits.RewardUser = 0 + waits.List = append(waits.List, curpool.List...) + + savestr, _ := json.Marshal(&waits) + err = redishandler.GetRedisClient().HSet(redis.CAIPIAOKAIJIANGWAIT_KEY, strconv.Itoa(waits.CurRound), string(savestr)) + if err != nil { + logger.Error("HandlerChooseNum err=%v", err) + } + + //生成新的彩池 + NewCaiPiaoRound(0, 200, 200, waits.CurRound+1) + } + + } + + resp.Code = 0 + + break + } + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + +func HandlerNumberList(w http.ResponseWriter, data string, uuid int) { + SetHeader(w) + var resp NumberListResp + + resp.Code = 0 + resp.Message = "success" + + for { + uinfo, err := GetUserInfo(strconv.Itoa(uuid)) + if err != nil || uinfo == nil { + logger.Error("HandlerNumberList getuserinfo failed=%v", err) + resp.Code = 1 + resp.Message = "get userinfo failed" + break + } + //先选取号码 + vv, err := redishandler.GetRedisClient().HGetAllKeys(redis.CAIPIAOLEFTNUM_KEY) + if err != nil { + logger.Error("HandlerNumberList getuserinfo failed=%v", err) + resp.Code = 1 + resp.Message = "HandlerNumberList failed" + break + } + + var numlist []int + for _, val := range vv { + //one := new(WaitDuboCatList) + bytestr := val.([]byte) + num, err := strconv.Atoi(string(bytestr)) + if err == nil { + numlist = append(numlist, num) + } + if len(numlist) >= 6 { + break + } + } + + //查询当前奖池 + curpool := GetCurCaiCatList() + if curpool != nil { + resp.Data.Round = curpool.CurRound + } + + for _, val := range numlist { + var tmp NumberListDesc + tmp.Number = val + tmp.Choosed = false + resp.Data.NumberList = append(resp.Data.NumberList, tmp) + } + + resp.Code = 0 + + break + } + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + +func HandlerQueryGambling(w http.ResponseWriter, data string, uuid int) { + SetHeader(w) + var resp QueryGamblingResp + + resp.Code = 0 + resp.Message = "success" + + for { + uinfo, err := GetUserInfo(strconv.Itoa(uuid)) + if err != nil || uinfo == nil { + logger.Error("HandlerQueryGambling getuserinfo failed=%v", err) + resp.Code = 1 + resp.Message = "get userinfo failed" + break + } + + //先查询已开奖的 + for _, vv := range uinfo.CaiPiaoInfo { + var tmp QueryGamblingData + tmp.CatId = vv.CatId + tmp.Nickname = uinfo.NickName + tmp.HeadImg = uinfo.Head + tmp.MyNumber = vv.Cnum + tmp.RewardNumber = vv.RewardNum + tmp.Round = vv.Round + tmp.Status = 1 + if vv.RewardNum == vv.Cnum { + tmp.Status = 2 + } + + resp.Data = append(resp.Data, tmp) + } + + //查询待开奖的 + waitlist := GetWaitCaiCatList() + for _, vv := range waitlist { + for _, val := range vv.List { + if val.UserId == uuid { + var tmp QueryGamblingData + tmp.CatId = val.CatId + tmp.Nickname = uinfo.NickName + tmp.HeadImg = uinfo.Head + tmp.MyNumber = val.ChooseNum + tmp.RewardNumber = 0 //0表示未开奖 + tmp.Round = vv.CurRound + tmp.Status = 0 + resp.Data = append(resp.Data, tmp) + } + } + } + + //查询当前奖池 + curpool := GetCurCaiCatList() + if curpool != nil { + for _, val := range curpool.List { + if val.UserId == uuid { + var tmp QueryGamblingData + tmp.CatId = val.CatId + tmp.Nickname = uinfo.NickName + tmp.HeadImg = uinfo.Head + tmp.MyNumber = val.ChooseNum + tmp.RewardNumber = 0 //0表示未开奖 + tmp.Round = curpool.CurRound + tmp.Status = 0 + resp.Data = append(resp.Data, tmp) + } + } + } + resp.Code = 0 + + break + } + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + func HandlerPutCattoWareHouse(w http.ResponseWriter, data string, uuid int) { SetHeader(w) var resp PutWareHouseResp diff --git a/src/HttpServer/main/main.go b/src/HttpServer/main/main.go index 39f70fc..f35ebb6 100644 --- a/src/HttpServer/main/main.go +++ b/src/HttpServer/main/main.go @@ -57,6 +57,7 @@ func main() { return } + logic.MyInit() go logic.StartHttpServe() //go logic.StartHttpTicker() time.Sleep(time.Duration(2) * time.Second) diff --git a/src/common/redis/def.go b/src/common/redis/def.go index 318a830..c137ae5 100644 --- a/src/common/redis/def.go +++ b/src/common/redis/def.go @@ -1,12 +1,18 @@ package redis const ( - USER_INFO__KEY = "HAPPYCATSERVER_USER_USER_INFO" //玩家数据 - USER_LAST_CALC_TIME = "HAPPYCATSERVER_USER_LAST_CALC_TIME" //玩家上一次数据计算时间 - USER_INVITE_ID = "HAPPYCATSERVER_USER_INVITE_ID" //玩家邀请者ID - USER_STARTDOUBLE_TIME = "HAPPYCATSERVER_USER_STARTDOUBLE_TIME" //开启双倍时间 - USER_STARTAUTO_TIME = "HAPPYCATSERVER_USER_STARTAUTO_TIME" //开启自动合成时间 - USER_STARTACC_BOX_TIME = "HAPPYCATSERVER_USER_STARTACC_BOX_TIME" //开启加速成产箱子 - USER_WAREHOUSE_INFO = "HAPPYCATSERVER_USER_WAREHOUSE_INFO" //玩家仓库信息 - USER_GOLD_RANK = "HAPPYCATSERVER_USER_GOLD_RANK" //玩家排行榜,根据金币排 + USER_INFO__KEY = "HAPPYCATSERVER_USER_USER_INFO" //玩家数据 + USER_LAST_CALC_TIME = "HAPPYCATSERVER_USER_LAST_CALC_TIME" //玩家上一次数据计算时间 + USER_INVITE_ID = "HAPPYCATSERVER_USER_INVITE_ID" //玩家邀请者ID + USER_STARTDOUBLE_TIME = "HAPPYCATSERVER_USER_STARTDOUBLE_TIME" //开启双倍时间 + USER_STARTAUTO_TIME = "HAPPYCATSERVER_USER_STARTAUTO_TIME" //开启自动合成时间 + USER_STARTACC_BOX_TIME = "HAPPYCATSERVER_USER_STARTACC_BOX_TIME" //开启加速成产箱子 + USER_WAREHOUSE_INFO = "HAPPYCATSERVER_USER_WAREHOUSE_INFO" //玩家仓库信息 + USER_GOLD_RANK = "HAPPYCATSERVER_USER_GOLD_RANK" //玩家排行榜,根据金币排 + CAIPIAOISFAKE_KEY = "HAPPYCATSERVER_CAIPIAOISFAKE_KEY" //赌博毛是否真的开奖开关 hset field 为轮数 + CAIPIAOKAIJIANGHISTORY_KEY = "HAPPYCATSERVER_CAIPIAOKAIJIANGHISTORY_KEY" //已开奖的玩家开奖记录列表 hset field未轮数 + CAIPIAOKAIJIANGWAIT_KEY = "HAPPYCATSERVER_CAIPIAOKAIJIANGWAIT_KEY" //待开奖开奖的玩家开奖记录列表hset field未轮数 等待开奖 + CAIPIAOKAIJIANGCURRENT_KEY = "HAPPYCATSERVER_CAIPIAOKAIJIANGCURRENT_KEY" //当前轮次的奖池 未满人数未开奖将 CurDuboCatList + CAIPIAOLEFTNUM_KEY = "HAPPYCATSERVER_CAIPIAOLEFTNUM_KEY" //当期未选号码 + ) -- libgit2 0.21.0