Commit 126e0aa3e1a2604609ec4d65c45f20fc1758d066

Authored by 陆恒
1 parent 9b46f38a
Exists in master

提交代码

src/HttpServer/jsonconf/BoxConfig.json 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +[
  2 + {
  3 + "id": 1,
  4 + "type": 1,
  5 + "time": 5,
  6 + "rate": 30,
  7 + "rmb_num": "金币奖励"
  8 + },
  9 + {
  10 + "id": 2,
  11 + "type": 1,
  12 + "time": 10,
  13 + "rate": 20,
  14 + "rmb_num": "金币奖励"
  15 + },
  16 + {
  17 + "id": 3,
  18 + "type": 2,
  19 + "time": 0.2,
  20 + "rate": 20,
  21 + "rmb_num": "红包"
  22 + },
  23 + {
  24 + "id": 4,
  25 + "type": 2,
  26 + "time": 0.3,
  27 + "rate": 30,
  28 + "rmb_num": "红包"
  29 + }
  30 +]
0 \ No newline at end of file 31 \ No newline at end of file
src/HttpServer/jsonconf/GiftConfig.json 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +[
  2 + {
  3 + "id": 1,
  4 + "type": 1,
  5 + "time": 10,
  6 + "rate": 30,
  7 + "rmb_num": "金币奖励"
  8 + },
  9 + {
  10 + "id": 2,
  11 + "type": 1,
  12 + "time": 20,
  13 + "rate": 20,
  14 + "rmb_num": "金币奖励"
  15 + },
  16 + {
  17 + "id": 3,
  18 + "type": 2,
  19 + "time": 0.2,
  20 + "rate": 20,
  21 + "rmb_num": "红包"
  22 + },
  23 + {
  24 + "id": 4,
  25 + "type": 2,
  26 + "time": 0.3,
  27 + "rate": 30,
  28 + "rmb_num": "红包"
  29 + }
  30 +]
0 \ No newline at end of file 31 \ No newline at end of file
src/HttpServer/jsonconf/RmbConfig.json 0 → 100644
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  1 +[
  2 + {
  3 + "id": 1,
  4 + "rmb_num": 0.5,
  5 + "time": 1,
  6 + "login_day": 2,
  7 + "cat_level": 5
  8 + },
  9 + {
  10 + "id": 2,
  11 + "rmb_num": 1,
  12 + "time": 1,
  13 + "login_day": 5,
  14 + "cat_level": 10
  15 + },
  16 + {
  17 + "id": 3,
  18 + "rmb_num": 1.5,
  19 + "time": 1,
  20 + "login_day": 7,
  21 + "cat_level": 15
  22 + },
  23 + {
  24 + "id": 4,
  25 + "rmb_num": 3,
  26 + "time": 1,
  27 + "login_day": 10,
  28 + "cat_level": 20
  29 + },
  30 + {
  31 + "id": 5,
  32 + "rmb_num": 5,
  33 + "time": 1,
  34 + "login_day": 15,
  35 + "cat_level": 25
  36 + },
  37 + {
  38 + "id": 6,
  39 + "rmb_num": 30,
  40 + "time": 1,
  41 + "login_day": 20,
  42 + "cat_level": 35
  43 + },
  44 + {
  45 + "id": 7,
  46 + "rmb_num": 100,
  47 + "time": 999,
  48 + "login_day": 1,
  49 + "cat_level": 1
  50 + }
  51 +]
0 \ No newline at end of file 52 \ No newline at end of file
src/HttpServer/jsonconf/jsonconf.go
@@ -50,11 +50,30 @@ type TurnTableDesc struct { @@ -50,11 +50,30 @@ type TurnTableDesc struct {
50 Idx int `json:"idx"` 50 Idx int `json:"idx"`
51 } 51 }
52 52
  53 +type BoxConfigDesc struct {
  54 + Id int `json:"id"`
  55 + Ttype int `json:"type"`
  56 + Time float32 `json:"time"`
  57 + Rate int `json:"rate"`
  58 + Rmb_num string `json:"rmb_num"`
  59 +}
  60 +
  61 +type RMBConfigDesc struct {
  62 + Id int `json:"id"`
  63 + Time int `json:"time"`
  64 + Rmb_num float32 `json:"rmb_num"`
  65 + Login_day int `json:"login_day"`
  66 + Cat_level string `json:"cat_level"`
  67 +}
  68 +
53 type GameConfig struct { 69 type GameConfig struct {
54 CardConfig []CardDesc 70 CardConfig []CardDesc
55 CatConfig []CatDesc 71 CatConfig []CatDesc
56 RedCatConfig []RedCatDesc 72 RedCatConfig []RedCatDesc
57 TurnTableConfig []TurnTableDesc 73 TurnTableConfig []TurnTableDesc
  74 + BoxConfig []BoxConfigDesc
  75 + GiftConfig []BoxConfigDesc
  76 + RMBConfig []RMBConfigDesc
58 } 77 }
59 78
60 func GetJsonConf() *GameConfig { 79 func GetJsonConf() *GameConfig {
@@ -177,6 +196,45 @@ func LoadJsonConf() error { @@ -177,6 +196,45 @@ func LoadJsonConf() error {
177 return err 196 return err
178 } 197 }
179 198
  199 + path = "../jsonconf/RmbConfig.json"
  200 + content, err = file_get_contents(path)
  201 + if err != nil {
  202 + logger.Info("loadJsonConf failed1,err=%v", err)
  203 + return err
  204 + }
  205 +
  206 + err = json.Unmarshal([]byte(content), &g_jsonconf.RMBConfig)
  207 + if err != nil {
  208 + logger.Info("loadJsonConf failed1,err=%v", err)
  209 + return err
  210 + }
  211 +
  212 + path = "../jsonconf/BoxConfig.json"
  213 + content, err = file_get_contents(path)
  214 + if err != nil {
  215 + logger.Info("loadJsonConf failed1,err=%v", err)
  216 + return err
  217 + }
  218 +
  219 + err = json.Unmarshal([]byte(content), &g_jsonconf.BoxConfig)
  220 + if err != nil {
  221 + logger.Info("loadJsonConf failed1,err=%v", err)
  222 + return err
  223 + }
  224 +
  225 + path = "../jsonconf/GiftConfig.json"
  226 + content, err = file_get_contents(path)
  227 + if err != nil {
  228 + logger.Info("loadJsonConf failed1,err=%v", err)
  229 + return err
  230 + }
  231 +
  232 + err = json.Unmarshal([]byte(content), &g_jsonconf.GiftConfig)
  233 + if err != nil {
  234 + logger.Info("loadJsonConf failed1,err=%v", err)
  235 + return err
  236 + }
  237 +
180 logger.Info("loadJsonConf success pconf=%v,err=%v", *g_jsonconf, err) 238 logger.Info("loadJsonConf success pconf=%v,err=%v", *g_jsonconf, err)
181 return err 239 return err
182 } 240 }
src/HttpServer/logic/datadef.go
@@ -723,6 +723,8 @@ type AchieveMentData struct { @@ -723,6 +723,8 @@ type AchieveMentData struct {
723 type UserData struct { 723 type UserData struct {
724 UserId int //玩家id 724 UserId int //玩家id
725 RegTime int //注册时间 725 RegTime int //注册时间
  726 + ContinueLoginDay int //连续登陆天数
  727 + SumLoginDay int //累计登录天数
726 Gold int64 //金币 728 Gold int64 //金币
727 GoldSum int64 //玩家累计金币 729 GoldSum int64 //玩家累计金币
728 Love int64 //爱心值 730 Love int64 //爱心值
src/HttpServer/logic/function.go
@@ -316,6 +316,8 @@ func (u *UserData) HandlePassDay() { @@ -316,6 +316,8 @@ func (u *UserData) HandlePassDay() {
316 if int64(u.LastLoginTime)-time.Now().Unix() > 86400 { 316 if int64(u.LastLoginTime)-time.Now().Unix() > 86400 {
317 //已经过了很多天了 317 //已经过了很多天了
318 318
  319 + u.ContinueLoginDay = 1
  320 + u.SumLoginDay++
319 isdiffday = true 321 isdiffday = true
320 } else { 322 } else {
321 //t同一天 不做处理 323 //t同一天 不做处理
@@ -324,9 +326,10 @@ func (u *UserData) HandlePassDay() { @@ -324,9 +326,10 @@ func (u *UserData) HandlePassDay() {
324 //不是同一天了 326 //不是同一天了
325 isdiffday = true 327 isdiffday = true
326 if nowtimestamp.Unix() != lasttimestamp.Unix()+86400 { 328 if nowtimestamp.Unix() != lasttimestamp.Unix()+86400 {
327 - 329 + u.ContinueLoginDay = 1
  330 + u.SumLoginDay++
328 } else { 331 } else {
329 - 332 + u.ContinueLoginDay++
330 } 333 }
331 logger.Info("HandlePassDay now=%v,last=%v", nowtimestamp.Unix(), lasttimestamp.Unix()) 334 logger.Info("HandlePassDay now=%v,last=%v", nowtimestamp.Unix(), lasttimestamp.Unix())
332 } 335 }
@@ -398,6 +401,8 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) { @@ -398,6 +401,8 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) {
398 udata.DratMult = 1 401 udata.DratMult = 1
399 udata.DrawTableCount = 1 402 udata.DrawTableCount = 1
400 udata.FlopCardCnt = 1 403 udata.FlopCardCnt = 1
  404 + udata.ContinueLoginDay = 1
  405 + udata.SumLoginDay = 1
401 //test 406 //test
402 udata.FlopCardLefCnt = 100 407 udata.FlopCardLefCnt = 100
403 udata.NickName = "著名的沙雕玩家" 408 udata.NickName = "著名的沙雕玩家"