You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package client
import ( "hudongzhuanjia/controllers" "hudongzhuanjia/models" activity_service "hudongzhuanjia/services/activity" auction_service "hudongzhuanjia/services/auction" bahe_service "hudongzhuanjia/services/bahe" bully_screen_service "hudongzhuanjia/services/bully_screen" calorie_service "hudongzhuanjia/services/calorie" red_envelope_service "hudongzhuanjia/services/red_envelope" vote_service "hudongzhuanjia/services/vote" "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" )
type ActivityCtl struct { controllers.AuthorCtl }
func (t *ActivityCtl) ModuleStatus() { activityId := t.MustGetActivityId() moduleName := t.MustGet("module_name") exist, err := activity_service.ExistModuleByActivityId(activityId, moduleName) t.CheckErr(err) t.JSON(map[string]interface{}{ "status": exist, }) }
// 某个模块的活动状态
func (t *ActivityCtl) ModuleCurrent() { activityId := t.MustGetActivityId() moduleName := t.MustGet("module_name") uid := t.MustGetUID()
activity := new(models.Activity) exist, err := models.GetById(activity, activityId) t.CheckErr(err) t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
switch moduleName { case define.MODULE_TUGWAR: // 拔河
data, err := bahe_service.GetCurrentTugWar(activityId, uid, activity.RehearsalId) t.CheckErr(err) t.JSON(data) case define.MODULE_CALORIE: // 卡路里
data, err := calorie_service.GetCurrentCalorie(activityId, uid, activity.RehearsalId) t.CheckErr(err) t.JSON(data) case define.MODULE_SHAKRB: // 摇红包
// 没有初始状态 // 记下参与人数
data, err := red_envelope_service.GetCurrentRB(activityId, uid, activity.RehearsalId) t.CheckErr(err) t.JSON(data) case define.MODULE_AUCTION: // 竞拍
data, err := auction_service.GetCurrentAuction(activityId, activity.RehearsalId, t.MustGetUID()) t.CheckErr(err) t.JSON(data) case define.MODULE_VOTE: data, err := vote_service.GetCurrentVote(activityId, uid, activity.RehearsalId) t.CheckErr(err) t.JSON(data) case define.MODULE_BULLYS: data, err := bully_screen_service.GetCurrentBullyScreen(activityId) t.CheckErr(err) t.JSON(data) default: t.ERROR("不存在该模块", code.MSG_MODULE_NOT_EXIST) } }
|