Commit 4d73688d28750445f020ac5348554499f936e0b6

Authored by 李旭
1 parent b54d20a9
Exists in master

金币减半

Showing 1 changed file with 16 additions and 11 deletions   Show diff stats
src/HttpServer/logic/logic.go
@@ -321,7 +321,8 @@ func HandlerAddgold(w http.ResponseWriter, data string) { @@ -321,7 +321,8 @@ func HandlerAddgold(w http.ResponseWriter, data string) {
321 break 321 break
322 } 322 }
323 323
324 - rdata.Gold_num = 5 * 2 324 + //rdata.Gold_num = 5 * 2
  325 + rdata.Gold_num = 5
325 uinfo, err := GetUserInfo(rdata.Openid) 326 uinfo, err := GetUserInfo(rdata.Openid)
326 if err != nil || uinfo == nil { 327 if err != nil || uinfo == nil {
327 logger.Info(" HandlerAddgold getdata failed:%v,for:%v", err, data) 328 logger.Info(" HandlerAddgold getdata failed:%v,for:%v", err, data)
@@ -432,14 +433,14 @@ func HandlerFetchproterybox(w http.ResponseWriter, data string) { @@ -432,14 +433,14 @@ func HandlerFetchproterybox(w http.ResponseWriter, data string) {
432 break 433 break
433 } 434 }
434 435
435 - currkey := "leftcnt_" + DateNowStr()  
436 - newleftcnt := GetConcurrency(currkey, rdata.Openid)  
437 - if newleftcnt < 1 {  
438 - logger.Info(" HandlerFetchproterybox GetConcurrency LeftCnt failed:%v,for:%v", err, data)  
439 - resp.RetMsg = "当天领取已达上限"  
440 - resp.ErrNum = ERROR_FETCHLIMIT  
441 - break  
442 - } 436 + //currkey := "leftcnt_" + DateNowStr()
  437 + //newleftcnt := GetConcurrency(currkey, rdata.Openid)
  438 + //if newleftcnt < 1 {
  439 + // logger.Info(" HandlerFetchproterybox GetConcurrency LeftCnt failed:%v,for:%v", err, data)
  440 + // resp.RetMsg = "当天领取已达上限"
  441 + // resp.ErrNum = ERROR_FETCHLIMIT
  442 + // break
  443 + //}
443 444
444 //判断当前剩余次数 445 //判断当前剩余次数
445 if uinfo.LeftCnt == 0 { 446 if uinfo.LeftCnt == 0 {
@@ -465,6 +466,10 @@ func HandlerFetchproterybox(w http.ResponseWriter, data string) { @@ -465,6 +466,10 @@ func HandlerFetchproterybox(w http.ResponseWriter, data string) {
465 break 466 break
466 } 467 }
467 468
  469 + if cfg.Reward > 0 {
  470 + cfg.Reward = int(cfg.Reward/2)
  471 + }
  472 +
468 //加金币 473 //加金币
469 addgold, sumgold, err := AddCoinToTouTiao(rdata.Openid, 1, cfg.Reward, "每日领取宝箱奖励", "other") 474 addgold, sumgold, err := AddCoinToTouTiao(rdata.Openid, 1, cfg.Reward, "每日领取宝箱奖励", "other")
470 if err != nil { 475 if err != nil {
@@ -481,8 +486,8 @@ func HandlerFetchproterybox(w http.ResponseWriter, data string) { @@ -481,8 +486,8 @@ func HandlerFetchproterybox(w http.ResponseWriter, data string) {
481 resp.RetData.Goldnum = addgold 486 resp.RetData.Goldnum = addgold
482 resp.RetData.Sumgold = sumgold 487 resp.RetData.Sumgold = sumgold
483 resp.RetData.Curlevle = uinfo.CalcCurLe() 488 resp.RetData.Curlevle = uinfo.CalcCurLe()
484 - //resp.RetData.Leftcnt = uinfo.LeftCnt  
485 - resp.RetData.Leftcnt = Decrcurrency(currkey, rdata.Openid) 489 + resp.RetData.Leftcnt = uinfo.LeftCnt
  490 + //resp.RetData.Leftcnt = Decrcurrency(currkey, rdata.Openid)
486 resp.RetData.Curpoerty = uinfo.Property 491 resp.RetData.Curpoerty = uinfo.Property
487 492
488 //保存 493 //保存