Browse Source

fix:bug

token_replace
黄梓健 5 years ago
parent
commit
d085813f67
  1. 4
      controllers/client/shake_red_envelope.go
  2. 10
      controllers/pc/vote.go
  3. 5
      models/new_vote_activity.go

4
controllers/client/shake_red_envelope.go

@ -97,9 +97,7 @@ func (t *ShakeRedEnvelopeCtl) Shake() {
if activity.RehearsalId == 0 {
result, err := pay_service.SendRedPack("欧轩互动", user.Openid, "红包只会越抢越多",
"直播抢红包活动", "抢的多,赚得多", int(record.Amount*100), 1, 2)
if err != nil {
t.ERROR("红包被领完了", code.MSG_SHAKERB_RECORD_NOT_HIT)
}
t.CheckErr(err)
record.MchBillno = result.MchBillno
models.Update(record.Id, record, "mch_billno")
}

10
controllers/pc/vote.go

@ -133,7 +133,8 @@ func (t *VoteCtl) JoinTotal() {
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
total, err := core.GetXormAuto().Distinct("user_id").Where("vote_activity_id=? and rehearsal_id=? "+
" and is_delete=0", voteActivityId, activity.RehearsalId, activity.ArchId).Count(new(models.NewVoteActivityHistory))
" arch_id=? and is_delete=0", voteActivityId, activity.RehearsalId, activity.ArchId).
Count(new(models.NewVoteActivityHistory))
t.CheckErr(err)
t.JSON(total)
}
@ -142,7 +143,12 @@ func (t *VoteCtl) JoinTotal() {
func (t *VoteCtl) List() {
activityId := t.MustGetInt64("activity_id")
votes, err := models.GetVoteListByActivityId(activityId)
activity := new(models.Activity)
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
votes, err := models.GetVoteListByActivityId(activityId, activity.ArchId)
t.CheckErr(err)
ids := make([]int64, 0)

5
models/new_vote_activity.go

@ -11,6 +11,7 @@ const NewVoteActivityTableName = TableNamePrefix + "new_vote_activity"
type NewVoteActivity struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
Arch int `json:"arch" xorm:"not null default 0 comment('归档') INT(11)"`
VoteActivityLadders []*NewVoteActivityLadder `json:"vote_activity_ladders" xorm:"-"`
Theme string `json:"theme" xorm:"not null default('') comment('投票主题') VARCHAR(255)"`
JoinWay string `json:"join_way" xorm:"not null comment('参与方式说明') TEXT"`
@ -63,9 +64,9 @@ func UpdateVoteStatusByActivityId(aid int64) (int64, error) {
Update(&NewVoteActivity{VoteStatus: define.StatusNotBegin})
}
func GetVoteListByActivityId(activityId interface{}) ([]*NewVoteActivity, error) {
func GetVoteListByActivityId(activityId, archId interface{}) ([]*NewVoteActivity, error) {
votes := make([]*NewVoteActivity, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and arch_id=?", activityId, archId).
Asc("created_at").Find(&votes)
return votes, err
}
Loading…
Cancel
Save