Browse Source

打赏和霸屏

master
黄梓健 5 years ago
parent
commit
b929e5e82d
  1. 18
      controllers/pc/bully_screen.go
  2. 11
      controllers/pc/reward.go
  3. 10
      models/real_sign_history.go

18
controllers/pc/bully_screen.go

@ -46,14 +46,13 @@ func (t *BullyScreenCtl) Review() {
customerId := t.MustGetUID()
status := t.MustGetBool("status")
ids := strings.Split(t.MustGet("ids"), "|")
//activityId := t.MustGetInt64("activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
activityId := t.MustGetInt64("activity_id")
//rehearsalId := t.MustGetInt64("rehearsal_id")
//// TODO: new feat
//activity := new(models.Activity)
//exist, err := models.Get(activity, activityId)
//t.CheckErr(err)
//t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
activity := new(models.Activity)
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
//将金额退回给用户
result, err := models.GetBullyScreenHistoryByIds(ids)
@ -65,7 +64,7 @@ func (t *BullyScreenCtl) Review() {
_, err = models.Update(v.Id, v, "status")
t.CheckErr(err)
if rehearsalId != 0 { // 彩排
if activity.RehearsalId != 0 { // 彩排
continue
}
@ -75,7 +74,8 @@ func (t *BullyScreenCtl) Review() {
v.Status = 2
_, err = models.Update(v.Id, v, "status")
t.CheckErr(err)
if rehearsalId != 0 {
if activity.RehearsalId != 0 {
continue
}
// 订单宣告完成

11
controllers/pc/reward.go

@ -74,9 +74,14 @@ func (t *RewardCtl) WaitReview() {
func (t *RewardCtl) Review() {
status := t.MustGetBool("status")
ids := strings.Split(t.MustGet("ids"), "|")
rehearsalId := t.MustGetInt64("rehearsal_id")
activityId := t.MustGetInt64("activity")
uid := t.MustGetUID()
activity := new(models.Activity)
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
result, err := models.GetRewardHistoryByIds(ids)
t.CheckErr(err)
@ -87,7 +92,7 @@ func (t *RewardCtl) Review() {
_, err = models.Update(v.Id, v, "status")
t.CheckErr(err)
if rehearsalId != 0 { // 彩排不需要金额
if activity.RehearsalId != 0 { // 彩排不需要金额
continue
}
@ -100,7 +105,7 @@ func (t *RewardCtl) Review() {
_, err = models.Update(v.Id, v, "status")
t.CheckErr(err)
if rehearsalId != 0 && v.Type == 0 { // 线下h5彩排不需要金额
if activity.RehearsalId != 0 && v.Type == 0 { // 线下h5彩排不需要金额
continue
}

10
models/real_sign_history.go

@ -1,8 +1,9 @@
package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
const RealSignHistoryTN = TableNamePrefix + "real_sign_history"
@ -34,12 +35,11 @@ func (t *RealSignHistory) Check(uid, aid, rid int64) (bool, error) {
uid, aid, rid).Get(t)
}
func (t *RealSignHistory) UpdateById(ids []interface{}, fields ...string) (err error) {
func (t *RealSignHistory) UpdateById(ids interface{}, fields ...string) (err error) {
if len(fields) > 0 {
_, err = core.GetXormAuto().In("id", ids...).Cols(fields...).Update(t)
_, err = core.GetXormAuto().In("id", ids).Cols(fields...).Update(t)
} else {
_, err = core.GetXormAuto().In("id", ids...).AllCols().Update(t)
_, err = core.GetXormAuto().In("id", ids).AllCols().Update(t)
}
return err
}

Loading…
Cancel
Save