Browse Source

xxxx

master
黄梓健 5 years ago
parent
commit
fa8e827956
  1. 27
      controllers/client/activity.go
  2. 2
      controllers/client/live.go
  3. 5
      models/shake_red_envelope_record.go

27
controllers/client/activity.go

@ -39,34 +39,25 @@ func (t *ActivityCtl) ModuleCurrent() {
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
var data map[string]interface{}
switch moduleName {
case define.MODULE_TUGWAR: // 拔河
data, err := bahe_service.GetCurrentTugWar(activityId, uid, activity.RehearsalId)
t.CheckErr(err)
t.JSON(data)
data, err = bahe_service.GetCurrentTugWar(activityId, uid, activity.RehearsalId)
case define.MODULE_CALORIE: // 卡路里
data, err := calorie_service.GetCurrentCalorie(activityId, uid, activity.RehearsalId)
t.CheckErr(err)
t.JSON(data)
data, err = calorie_service.GetCurrentCalorie(activityId, uid, activity.RehearsalId)
case define.MODULE_SHAKRB: // 摇红包
// 没有初始状态 // 记下参与人数
data, err := red_envelope_service.GetCurrentRB(activityId, uid, activity.RehearsalId)
t.CheckErr(err)
t.JSON(data)
data, err = red_envelope_service.GetCurrentRB(activityId, uid, activity.RehearsalId)
case define.MODULE_AUCTION:
// 竞拍
data, err := auction_service.GetCurrentAuction(activityId, activity.RehearsalId, t.MustGetUID())
t.CheckErr(err)
t.JSON(data)
data, err = auction_service.GetCurrentAuction(activityId, activity.RehearsalId, t.MustGetUID())
case define.MODULE_VOTE:
data, err := vote_service.GetCurrentVote(activityId, uid, activity.RehearsalId)
t.CheckErr(err)
t.JSON(data)
data, err = vote_service.GetCurrentVote(activityId, uid, activity.RehearsalId)
case define.MODULE_BULLYS:
data, err := bully_screen_service.GetCurrentBullyScreen(activityId)
t.CheckErr(err)
t.JSON(data)
data, err = bully_screen_service.GetCurrentBullyScreen(activityId)
default:
t.ERROR("不存在该模块", code.MSG_MODULE_NOT_EXIST)
}
t.CheckErr(err)
t.JSON(data)
}

2
controllers/client/live.go

@ -200,7 +200,7 @@ func (t *LiveCtl) GetLiveRedPack() {
t.Assert(exist, code.MSG_USER_NOT_EXIST, "不存在用户")
redPack := new(models.ShakeRedEnvelopeRecord)
exist, err = redPack.GetLiveRedPackRecord(ruleId)
exist, err = redPack.GetLiveRedPackRecord(ruleId, rule.RehearsalId)
t.CheckErr(err)
if !exist {
// 通知其他的人

5
models/shake_red_envelope_record.go

@ -85,6 +85,7 @@ func GetRedEnvelopesByUserId(userId int64) ([]*ShakeRedEnvelopeRecord, error) {
return records, err
}
func (t *ShakeRedEnvelopeRecord) GetLiveRedPackRecord(id interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and red_envelope_type = 1 and live_red_envelope_rule_id=?", id).Get(t)
func (t *ShakeRedEnvelopeRecord) GetLiveRedPackRecord(id, rehearsalId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and red_envelope_type = 1 and user_id == 0 "+
"live_red_envelope_rule_id=? and rehearsal_id=?", id, rehearsalId).Get(t)
}
Loading…
Cancel
Save