Browse Source

team

master
黄梓健 5 years ago
parent
commit
525286110c
  1. 19
      controllers/pc/auction.go
  2. 6
      controllers/pc/calorie.go
  3. 6
      controllers/pc/shake_red_envelope.go
  4. 6
      controllers/pc/sign.go
  5. 9
      controllers/pc/tug_war.go
  6. 6
      controllers/pc/upper_wall.go
  7. 16
      controllers/pc/vote.go
  8. 3
      models/area_store.go
  9. 2
      models/shake_red_envelope_record.go

19
controllers/pc/auction.go

@ -231,11 +231,22 @@ func (t *AuctionCtl) Records() {
//获取二维码
func (t *AuctionCtl) Qrcode() {
//将服务器得地址和activity_id,动态生成二维码
uid := t.MustGetUID()
activityId := t.MustGetInt64("activity_id")
auctionId := t.MustGetInt64("auction_activity_id")
rehearsalId := t.MustGetInt("rehearsal_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在")
qrcode, err := utils.GenH5Qrcode(define.H5Auction, map[string]interface{}{
"activity_id": t.MustGetInt64("activity_id"),
"customer_id": t.MustGetUID(),
"auction_id": t.MustGetInt64("auction_activity_id"),
"rehearsal_id": t.MustGetInt64("rehearsal_id"),
"activity_id": activityId,
"area_id": area.Id,
"customer_id": uid,
"auction_id": auctionId,
"rehearsal_id": rehearsalId,
})
t.CheckErr(err)
t.JSON(map[string]interface{}{

6
controllers/pc/calorie.go

@ -102,9 +102,15 @@ func (t *CalorieCtl) Qrcode() {
uid := t.MustGetUID()
calorieId := t.MustGetInt64("calorie_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")
qrcode, err := utils.GenH5Qrcode(define.H5Calorie, map[string]interface{}{
"activity_id": activityId,
"customer_id": uid,
"area_id": area.Id,
"calorie_id": calorieId,
})
t.CheckErr(err)

6
controllers/pc/shake_red_envelope.go

@ -198,9 +198,15 @@ func (t *ShakeRedEnvelopeCtl) Qrcode() {
rehearsalId := t.MustGetInt64("rehearsal_id")
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(customerId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在")
//将服务器得地址和activity_id,动态生成二维码
qrcode, err := utils.GenH5Qrcode(define.H5ShakeRb, map[string]interface{}{
"activity_id": activityId,
"area_id": area.Id,
"customer_id": customerId,
"rule_id": ruleId,
"rehearsal_id": rehearsalId,

6
controllers/pc/sign.go

@ -22,9 +22,15 @@ func (t *SignCtl) Qrcode() {
uid := t.MustGetUID()
signUpId := t.MustGetInt64("sign_rule_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")
//将服务器得地址和activity_id,动态生成二维码
qrcode, err := utils.GenH5Qrcode(define.H5SignIn, map[string]interface{}{
"activity_id": activityId,
"area_id": area.Id,
"customer_id": uid,
"sign_rule_id": signUpId,
})

9
controllers/pc/tug_war.go

@ -105,8 +105,13 @@ func (t *TugOfWarCtl) Team() {
rehearsalId := t.MustGetInt64("rehearsal_id")
customerId := t.MustGetUID()
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(customerId)
t.CheckErr(err)
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区信息异常")
bahe := new(models.TugOfWar)
exist, err := models.GetById(bahe, baheId)
exist, err = models.GetById(bahe, baheId)
t.CheckErr(err)
t.Assert(exist, code.MSG_TUGWAR_NOT_EXIST, "拔河不存在")
@ -122,6 +127,7 @@ func (t *TugOfWarCtl) Team() {
// 非随机模式,自选队伍
for index := range teams {
qrcode, err = utils.GenH5Qrcode(define.H5TugOfWar, map[string]interface{}{
"area_id": area.Id,
"activity_id": bahe.ActivityId,
"customer_id": customerId,
"bahe_activity_id": bahe.Id,
@ -133,6 +139,7 @@ func (t *TugOfWarCtl) Team() {
}
} else {
qrcode, err = utils.GenH5Qrcode(define.H5TugOfWar, map[string]interface{}{
"area_id": area.Id,
"activity_id": bahe.ActivityId,
"customer_id": customerId,
"bahe_activity_id": bahe.Id,

6
controllers/pc/upper_wall.go

@ -155,8 +155,14 @@ func (t *UpperWallCtl) Qrcode() {
rehearsalId := t.MustGetInt64("rehearsal_id")
uid := t.MustGetUID()
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")
qrcode, err := utils.GenH5Qrcode(define.H5Index, map[string]interface{}{
"activity_id": activityId,
"area_id": area.Id,
"customer_id": uid,
"rehearsal_id": rehearsalId,
})

16
controllers/pc/vote.go

@ -19,10 +19,20 @@ type VoteCtl struct {
//二维码
func (t *VoteCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
voteActivityId := t.MustGetInt64("vote_activity_id")
uid := t.MustGetUID()
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")
qrcode, err := utils.GenH5Qrcode(define.H5Vote, map[string]interface{}{
"activity_id": t.MustGetInt64("activity_id"),
"customer_id": t.MustGetUID(),
"vote_activity_id": t.MustGetInt64("vote_activity_id"),
"activity_id": activityId,
"area_id": area.Id,
"customer_id": uid,
"vote_activity_id": voteActivityId,
})
t.CheckErr(err)

3
models/area_store.go

@ -26,6 +26,9 @@ func (t *AreaStore) TableName() string {
return AreaStoreTableName
}
func (t *AreaStore) GetByCustomerId(customerId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and customer_id=?", customerId).Get(t)
}
func (t *AreaStore) GetAreaStoreById(id int64) (bool, error) {
return core.GetXormAuto().Where("id=? and is_delete=0", id).Get(t)
}

2
models/shake_red_envelope_record.go

@ -62,7 +62,7 @@ func (t *ShakeRedEnvelopeRecord) Count(aid, rid, said, srid int64, status int64)
}
func (t *ShakeRedEnvelopeRecord) GetByRuleId(ruleId, rehearsalId, _type interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and is_draw=-1 and red_envelope_type = ? "+
return core.GetXormAuto().Where("is_delete=0 and is_draw=-1 and red_envelope_type = ? and "+
"shake_red_envelope_rule_id=? and rehearsal_id=?", _type, ruleId, rehearsalId).Get(t)
}

Loading…
Cancel
Save