MCPcopy Index your code
hub / github.com/TruthHun/DocHub / Sign

Method Sign

controllers/HomeControllers/UserController.go:424–448  ·  view source on GitHub ↗

会员签到,增加金币

()

Source from the content-addressed store, hash-verified

422
423//会员签到,增加金币
424func (this *UserController) Sign() {
425
426 if this.IsLogin == 0 {
427 this.ResponseJson(false, "签到失败,请先登录")
428 }
429
430 var data = models.Sign{
431 Uid: this.IsLogin,
432 Date: time.Now().Format("20060102"),
433 }
434 _, err := orm.NewOrm().Insert(&data)
435 if err != nil {
436 this.ResponseJson(false, "签到失败,您今天已签到")
437 }
438
439 if err = models.Regulate(models.GetTableUserInfo(), "Coin", this.Sys.Sign, fmt.Sprintf("Id=%v", this.IsLogin)); err == nil {
440 log := models.CoinLog{
441 Uid: this.IsLogin,
442 Coin: this.Sys.Sign,
443 Log: fmt.Sprintf("签到成功,获得 %v 个金币", this.Sys.Sign),
444 }
445 models.NewCoinLog().LogRecord(log)
446 }
447 this.ResponseJson(true, fmt.Sprintf("恭喜您,今日签到成功,领取了 %v 个金币", this.Sys.Sign))
448}
449
450// 检测用户是否已登录
451func (this *UserController) CheckLogin() {

Callers

nothing calls this directly

Calls 3

InsertMethod · 0.80
LogRecordMethod · 0.80
ResponseJsonMethod · 0.45

Tested by

no test coverage detected