Browse Source

rm core

master
黄梓健 5 years ago
parent
commit
9a20e1270e
  1. 4
      controllers/client/lottery.go
  2. 7
      controllers/client/reward.go
  3. 25
      controllers/client/sign.go
  4. 32
      controllers/client/tug_war.go
  5. 17
      controllers/client/upper_wall.go
  6. 4
      controllers/client/vote.go
  7. 24
      controllers/pc/lottery_draw.go
  8. 10
      models/activity_module_service.go
  9. 14
      models/bahe_team.go
  10. 5
      models/bahe_team_member.go
  11. 9
      models/invitation_letter.go
  12. 32
      models/lottery_draw_record.go
  13. 1
      models/lottery_draw_rule_ladder.go
  14. 5
      models/module_service_history.go
  15. 5
      models/new_vote_activity.go
  16. 5
      models/sign_history.go
  17. 9
      models/upper_wall.go

4
controllers/client/lottery.go

@ -68,7 +68,7 @@ func (t *LotteryCtl) CheckLottery() {
t.Assert(exist, code.MSG_LOTTERY_RULE_NOT_EXIST, "抽奖规则不存在")
record := new(models.LotteryDrawRecord)
exist, err = record.GetByUserIdAndLadderId(uid, ladderId)
exist, err = record.GetByUserIdAndLadderId(uid, ladderId, ladder.RollNum)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"record": record,
@ -93,7 +93,7 @@ func (t *LotteryCtl) Winners() {
t.Assert(exist, code.MSG_LOTTERY_RULE_NOT_EXIST, "抽奖规则不存在")
result := make([]*LotteryUsersResult, 0)
err = models.GetLotteryUsersResultByLotteryDrawRecord(result, ladderId, activity.RehearsalId)
err = models.GetLotteryUsersResultByLotteryDrawRecord(result, ladderId, activity.RehearsalId, ladder.RollNum)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"total": len(result),

7
controllers/client/reward.go

@ -9,8 +9,6 @@ import (
"hudongzhuanjia/utils"
"hudongzhuanjia/utils/code"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
//打赏
@ -82,7 +80,7 @@ func (t *RewardCtl) Reward() {
history.Status = 0
}
_, err = core.GetXormAuto().InsertOne(history)
_, err = models.Add(history)
t.CheckErr(err)
res["rehearsal_id"] = activity.RehearsalId
@ -103,9 +101,6 @@ func (t *RewardCtl) List() {
t.CheckErr(err)
t.Assert(exist, code.MSG_REWARD_NOT_EXIST, "打赏不存在")
////// todo: 检查订单
//t.CheckErr(bully_reward_service.CheckRewardStatus(rs.Id))
list, err := bully_reward_service.GetRewardList(uid, activity.RehearsalId, rs.Id)
t.CheckErr(err)
t.JSON(map[string]interface{}{

25
controllers/client/sign.go

@ -3,9 +3,7 @@ package client
import (
"encoding/json"
"fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers"
"hudongzhuanjia/logger"
"hudongzhuanjia/models"
ws_send_service "hudongzhuanjia/services/ws_send"
"hudongzhuanjia/utils/code"
@ -70,15 +68,12 @@ func (t *SignCtl) Setting() {
exist, err := service.GetByName(define.MODULE_SIGNIN)
t.CheckErr(err)
t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "签到模块不存在")
histories := make([]*models.ModuleServiceHistory, 0)
err = core.GetXormAuto().Where("is_delete=0 and service_module_id=? and name=?", service.Id, service.Name).Find(&histories)
t.CheckErr(err)
historyIds := make([]int64, 0)
for _, history := range histories {
historyIds = append(historyIds, history.Id)
}
err = models.GetModuleServiceHistoryIdsByIdAndName(&historyIds, service.Id, service.Name)
t.CheckErr(err)
module := new(models.ActivityModuleService)
exist, err = core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).In("service_module_history_id", historyIds).Get(module)
exist, err = module.GetByActivityIdAndHistoryIds(activityId, historyIds)
t.CheckErr(err)
t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "签到模块不存在")
@ -111,9 +106,6 @@ func (t *SignCtl) Sign() {
user := new(models.User)
exist, err = models.Get(user, uid)
logger.Error("user:===>%+v", user)
logger.Error("token:==>%v", t.MustGet("token"))
logger.Error("user_id:===>%v", uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_USER_NOT_EXIST, "用户不存在")
@ -132,16 +124,15 @@ func (t *SignCtl) Sign() {
}
//检查是否已经签到了
signHistory := new(models.SignHistory)
exist, err = signHistory.GetByUserId(activityId, uid, activity.RehearsalId, t.MustGetAreaId())
exist, err = signHistory.GetByUserId(activityId, uid, activity.RehearsalId, area.Id)
t.CheckErr(err)
t.Assert(!exist, code.MSG_SIGN_HISTORY_EXIST, "您已经签到过了") // 存在判断
// 签到人数
signTotal, err := core.GetXormAuto().Where("is_delete=0 and sign_rule_id=? and rehearsal_id=? and activity_id=?",
signUp.Id, activity.RehearsalId, activity.Id).Count(signHistory)
signTotal, err := signHistory.Count(signUp.Id, activity.RehearsalId, activity.Id)
t.CheckErr(err)
signUpTotal, err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activity.Id).Count(new(models.InvitationLetter))
signUpTotal, err := new(models.InvitationLetter).Count(activity.Id, activity.RehearsalId)
t.CheckErr(err)
if activity.RehearsalId != 0 && signTotal >= 10 {
@ -158,7 +149,7 @@ func (t *SignCtl) Sign() {
signHistory.IsDelete = false
signHistory.UpdatedAt = time.Now()
signHistory.CreatedAt = time.Now()
_, err = core.GetXormAuto().InsertOne(signHistory)
_, err = models.Add(signHistory)
t.CheckErr(err)
go ws_send_service.SendSign(fmt.Sprintf("%d", activity.Id),

32
controllers/client/tug_war.go

@ -7,8 +7,6 @@ import (
"hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
type TugOfWarCtl struct {
@ -74,19 +72,6 @@ func (t *TugOfWarCtl) Status() {
})
}
// tug_war doc
// @Summary tug war
// @Description shake bahe activity
// @Tags tug war
// @Accept json
// @Produce json
// @Param bahe_activity_id query int true "Bahe Activity ID"
// @Success 0 {object} models.TugOfWar
// @Success 0 {object} models.BaheTeamMember
// @Success 0 {object} models.BaheTeam
// @Failure 404 {string} string "参数不存在"
// @Failure 405 {object} string "用户不存在"
// @Router /Client/TugOfWarCtl/shake [get]
func (t *TugOfWarCtl) Shake() {
uid := t.MustGetUID()
baheId := t.MustGetInt64("bahe_activity_id")
@ -117,8 +102,7 @@ func (t *TugOfWarCtl) Shake() {
// 根据team_id 获取所有成员的分数
members := make([]*models.BaheTeamMember, 0)
err = core.GetXormAuto().Where("is_delete=0 and team_id=? and rehearsal_id=?",
member.TeamId, member.RehearsalId).Desc("score").Asc("sort_time").Find(&members)
err = models.GetBaheMembersByTeamId(members, member.TeamId, member.RehearsalId)
t.CheckErr(err)
var rank int
@ -172,17 +156,7 @@ func (t *TugOfWarCtl) JoinTeam() {
}
team := new(JoinTeamResult)
session := core.GetXormAuto().Table(new(models.BaheTeam)).Alias("t").
Select("t.id as team_id, t.bahe_team_name as team_name, count(m.id) as number").
Join("LEFT", new(models.BaheTeamMember).Alias("m"),
"m.team_id=t.id and m.is_delete=0 and m.rehearsal_id=?", activity.RehearsalId)
if teamId == 0 { // 人数最少的一队
session = session.Where("t.is_delete=0 and t.bahe_activity_id=? ", bahe.Id).
GroupBy("t.id").Asc("number")
} else {
session = session.Where("t.is_delete=0 and t.id=?", teamId).GroupBy("t.id")
}
exist, err = session.Get(team)
exist, err = models.GetJoinTeamByBaheId(team, bahe.Id, teamId, activity.RehearsalId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ERR, "队伍信息错误, 请重新扫码")
t.Assert(team.Number < bahe.Number, code.MSG_TUGWAR_TEAM_OVER_LIMIT, "队伍满人,请等待下一轮")
@ -203,7 +177,7 @@ func (t *TugOfWarCtl) JoinTeam() {
member.SortTime = time.Now().UnixNano()
member.CreatedAt = time.Now()
member.UpdatedAt = time.Now()
_, err = core.GetXormAuto().InsertOne(member)
_, err = models.Add(member)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"member": member,

17
controllers/client/upper_wall.go

@ -6,8 +6,6 @@ import (
"hudongzhuanjia/models"
"hudongzhuanjia/utils/code"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
type UpperWallCtl struct {
@ -53,12 +51,12 @@ func (t *UpperWallCtl) Send() {
uw.Status = 0
uw.CreatedAt = time.Now()
uw.UpdatedAt = time.Now()
_, err = core.GetXormAuto().Insert(uw)
_, err = models.Add(uw)
t.CheckErr(err)
t.SUCCESS("成功")
}
type UWListResult struct {
type UpperWallResult struct {
Id int64 `json:"id"`
Content string `json:"content"`
Img string `json:"img"`
@ -68,18 +66,15 @@ type UWListResult struct {
func (t *UpperWallCtl) List() {
activityId := t.MustGetInt64("activity_id")
uid := t.MustGetUID()
userId := t.MustGetUID()
activity := new(models.Activity)
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
list := make([]*UWListResult, 0)
err = core.GetXormAuto().Table(new(models.UpperWall)).
Select("id, content, img, category, status").
Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=?",
uid, activityId, activity.RehearsalId).
OrderBy("created_at desc").Find(&list)
list := make([]*UpperWallResult, 0)
err = models.GetUpperWallResultByUserIdAndActivityId(list, userId, activity.Id, activity.RehearsalId)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"list": list,

4
controllers/client/vote.go

@ -61,7 +61,7 @@ func (t *VoteCtl) Vote() {
history.IsDelete = false
history.CreatedAt = time.Now()
history.UpdatedAt = time.Now()
_, err = core.GetXormAuto().InsertOne(history)
_, err = models.Add(history)
t.CheckErr(err)
// vote ladder total_number + 1
@ -83,7 +83,7 @@ func (t *VoteCtl) List() {
t.CheckRunning(activity.Status)
votes := make([]*models.NewVoteActivity, 0)
err = core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).Desc("created_at").Find(&votes)
err = models.GetVoteListByActivityId(votes, activity.Id)
t.CheckErr(err)
t.JSON(map[string]interface{}{

24
controllers/pc/lottery_draw.go

@ -34,10 +34,9 @@ func (t *LotteryDrawCtl) Start() {
}
ladder.Status = define.StatusRunning
ladder.UpdatedAt = time.Now()
t.CheckErr(models.Save(map[string]interface{}{
"id=": ladderId,
}, ladder, "status", "updated_at"))
ladder.RollNum = 0
_, err = models.Update(ladder.Id, ladder, "status", "roll_num", "updated_at")
t.CheckErr(err)
// 通知直播开始抽奖
im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeLotteryDrawStart,
map[string]interface{}{
@ -62,11 +61,15 @@ func (t *LotteryDrawCtl) StartRoll() {
if ladder.Status != define.StatusRunning {
t.ERROR(fmt.Sprintf("该活动%s", ladder.Status), code.MSG_ERR)
}
ladder.RollNum += 1
_, err = models.Update(ladder.Id, ladder, "roll_num")
// 通知直播开始抽奖
im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeLotteryDrawRollStart,
map[string]interface{}{
"lottery_draw_ladder_id": ladder.Id,
"timestamp": time.Now().Unix(),
"roll_num": ladder.RollNum,
"desc": "开始滚动",
"number": num,
})
@ -91,6 +94,7 @@ func (t *LotteryDrawCtl) StopRoll() {
map[string]interface{}{
"lottery_draw_ladder_id": ladder.Id,
"timestamp": time.Now().Unix(),
"roll_num": ladder.RollNum,
"desc": "停止滚动",
"number": num,
})
@ -113,9 +117,9 @@ func (t *LotteryDrawCtl) Stop() {
ladder.Status = define.StatusEnding
ladder.UpdatedAt = time.Now()
t.CheckErr(models.Save(map[string]interface{}{
"id=": ladderId,
}, ladder, "status", "updated_at"))
ladder.RollNum = 0
_, err = models.Update(ladder.Id, ladder, "status, updated_at, roll_num")
t.CheckErr(err)
// 通知直播开始抽奖
im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeLotteryDrawStop,
@ -431,7 +435,7 @@ func (t *LotteryDrawCtl) Lottery() {
userPrize.IsDelete = false
userPrize.CreatedAt = time.Now()
userPrize.UpdatedAt = time.Now()
_, err = core.GetXormAuto().Insert(userPrize)
_, err = models.Add(userPrize)
t.CheckErr(err)
record := new(models.LotteryDrawRecord)
@ -447,10 +451,11 @@ func (t *LotteryDrawCtl) Lottery() {
record.PrizeName = ladder.PrizeName
record.AreaId = area.Id
record.AreaName = area.Name
record.RollNum = ladder.RollNum
record.IsDelete = false
record.CreatedAt = time.Now()
record.UpdatedAt = time.Now()
_, err = core.GetXormAuto().InsertOne(record)
_, err = models.Add(record)
t.CheckErr(err)
}
@ -459,6 +464,7 @@ func (t *LotteryDrawCtl) Lottery() {
map[string]interface{}{
"lottery_draw_ladder_id": ladder.Id,
"winners": winners,
"roll_num": ladder.RollNum,
"timestamp": time.Now().Unix(),
"desc": "抽奖结果",
})

10
models/activity_module_service.go

@ -45,6 +45,12 @@ func (t *ActivityModuleService) Alias(name string) string {
return AliasTableName(t, name)
}
func (t *ActivityModuleService) GetByActivityIdAndHistoryId(aid, hid int64) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and service_module_history_id=?", aid, hid).Get(t)
//
//func (t *ActivityModuleService) GetByActivityIdAndHistoryId(aid, hid int64) (bool, error) {
// return core.GetXormAuto().Where("is_delete=0 and activity_id=? and service_module_history_id=?", aid, hid).Get(t)
//}
func (t *ActivityModuleService) GetByActivityIdAndHistoryIds(activityId, historyIds interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
In("service_module_history_id", historyIds).Get(t)
}

14
models/bahe_team.go

@ -29,3 +29,17 @@ func (t *BaheTeam) TableName() string {
func (t *BaheTeam) GetOtherTeam(id, bid int64) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and id=? and bahe_activity_id=?", id, bid).Get(t)
}
func GetJoinTeamByBaheId(obj, baheId, teamId, rehearsalId interface{}) (bool, error) {
session := core.GetXormAuto().Table(new(BaheTeam)).Alias("t").
Select("t.id as team_id, t.bahe_team_name as team_name, count(m.id) as number").
Join("LEFT", new(BaheTeamMember).Alias("m"),
"m.team_id=t.id and m.is_delete=0 and m.rehearsal_id=?", rehearsalId)
if teamId == 0 { // 人数最少的一队
session = session.Where("t.is_delete=0 and t.bahe_activity_id=? ", baheId).
GroupBy("t.id").Asc("number")
} else {
session = session.Where("t.is_delete=0 and t.id=?", teamId).GroupBy("t.id")
}
return session.Get(&obj)
}

5
models/bahe_team_member.go

@ -41,3 +41,8 @@ func (t *BaheTeamMember) IncrScoreById(id, score int64) (int64, error) {
t.SortTime = time.Now().UnixNano()
return core.GetXormAuto().ID(id).Incr("score", score).Cols("score, sort_time").Update(t)
}
func GetBaheMembersByTeamId(obj, teamId, rehearsalId interface{}) error {
return core.GetXormAuto().Where("is_delete=0 and team_id=? and rehearsal_id=?",
teamId, rehearsalId).Desc("score").Asc("sort_time").Find(&obj)
}

9
models/invitation_letter.go

@ -28,10 +28,11 @@ func (t *InvitationLetter) Alias(name string) string {
return AliasTableName(t, name)
}
func (t *InvitationLetter) Insert() (int64, error) {
return core.GetXormAuto().InsertOne(t)
}
func (t *InvitationLetter) GetByUserIdAndActivityId(uid, aid, rid int64) (bool, error) {
return core.GetXormAuto().Where("user_id=? and activity_id=? and rehearsal_id=? and is_delete=0", uid, aid, rid).Get(t)
}
func (t *InvitationLetter) Count(activityId, rehearsalId interface{}) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=?", activityId, rehearsalId).
Count(t)
}

32
models/lottery_draw_record.go

@ -14,12 +14,11 @@ type LotteryDrawRecord struct {
UserPrizeId int64 `json:"user_prize_id" xorm:"not null comment('用户奖品id') INT(11)"`
LotteryDrawActivityId int64 `json:"lottery_draw_activity_id" xorm:"not null comment('抽奖活动id')"`
LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" xorm:"not null comment('抽奖规则id') BIGINT(20)"`
LotteryDrawRuleLadder *LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-"`
LotteryDrawRuleLadderId int64 `json:"lottery_draw_rule_ladder_id" xorm:"not null comment('规则阶梯id')"`
UserId int64 `json:"user_id" xorm:"not null comment('用户id')"`
User *User `json:"user" xorm:"-"`
RollNum int `json:"roll_num" xrom:"not null default 0 comment('滚动次数') INT(11)"`
UserName string `json:"user_name" description:"用户名" xorm:"not null comment('用户名')"`
UserPhone string `json:"user_phone" description:"电话" xorm:"not null comment('电话号码')"`
LotteryDrawRuleLadderId int64 `json:"lottery_draw_rule_ladder_id" xorm:"not null comment('规则阶梯id')"`
PrizeName string `json:"prize_name" description:"奖品名字" xorm:"not null comment('奖品名字')"`
AreaName string `json:"area_name" description:"名字" xorm:"not null comment('地区名字')"`
AreaId int64 `json:"area_id" xorm:"not null default(0) comment('地区id')"`
@ -31,14 +30,23 @@ type LotteryDrawRecord struct {
IsDelete bool `json:"-" xorm:"default(0)"`
CreatedAt time.Time `json:"-" xorm:"created"`
UpdatedAt time.Time `json:"-" xorm:"updated"`
// 无关变量
User *User `json:"user" xorm:"-"`
LotteryDrawRuleLadder *LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-"`
}
func (t *LotteryDrawRecord) TableName() string {
return LotteryDrawRecordTableName
}
func (t *LotteryDrawRecord) GetByUserIdAndLadderId(userId, ladderId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and user_id=? and lottery_draw_rule_ladder_id=?", userId, ladderId).Get(t)
func (t *LotteryDrawRecord) GetByUserIdAndLadderId(userId, ladderId interface{}, rollNum int) (bool, error) {
session := core.GetXormAuto().Where("is_delete=0 and user_id=? and lottery_draw_rule_ladder_id=?", userId, ladderId)
defer session.Close()
if rollNum > 0 {
session.Where("roll_num=?", rollNum)
}
return session.Get(t)
}
func (t *LotteryDrawRecord) GetByUserPrizeId(upId int64) (bool, error) {
@ -50,12 +58,16 @@ func (t *LotteryDrawRecord) Update(id interface{}, field ...string) (int64, erro
return core.GetXormAuto().Where("id=?", id).Update(t)
}
func GetLotteryUsersResultByLotteryDrawRecord(obj, ladderId, rehearsalId interface{}) error {
err := core.GetXormAuto().Table(new(LotteryDrawRecord)).Alias("r").
func GetLotteryUsersResultByLotteryDrawRecord(obj, ladderId, rehearsalId interface{}, rollNum int) error {
session := core.GetXormAuto().Table(new(LotteryDrawRecord)).Alias("r").
Join("LEFT", new(User).Alias("u"), "u.id=r.user_id").
Where("r.is_delete=0 and r.lottery_draw_rule_ladder_id=? and r.rehearsal_id=?", ladderId, rehearsalId).
Find(&obj)
return err
Where("r.is_delete=0 and r.lottery_draw_rule_ladder_id=? and "+
"r.rehearsal_id=?", ladderId, rehearsalId)
defer session.Close()
if rollNum > 0 {
session = session.Where("roll_num=?", rollNum)
}
return session.Find(&obj)
}
func GetUserIdsByLotteryDrawRuleId(obj, ruleId, rehearsalId, areaId interface{}) error {

1
models/lottery_draw_rule_ladder.go

@ -12,6 +12,7 @@ const LotteryDrawRuleLadderTableName = TableNamePrefix + "lottery_draw_rule_ladd
type LotteryDrawRuleLadder struct {
Id int64 `json:"id"`
LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" description:"红包轮次的id"`
RollNum int `json:"roll_num" xorm:"not null default 0 comment('滚动次数') INT(11)"`
PrizeName string `json:"prize_name" description:"奖品名字"`
PrizeNumber int `json:"prize_number" description:"奖品数量"`
Probability float64 `json:"probability" description:"概率"`

5
models/module_service_history.go

@ -36,3 +36,8 @@ func (t *ModuleServiceHistory) GetByModuleIdAndName(id int64, name string) (bool
func (t *ModuleServiceHistory) ExistSignModule(ids []interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and name=?", "签到").In("id", ids...).Exist(t)
}
func GetModuleServiceHistoryIdsByIdAndName(obj, serviceId, serviceName interface{}) error {
return core.GetXormAuto().Table(new(ModuleServiceHistory)).Select("id").
Where("is_delete=0 and service_module_id=? and name=?", serviceId, serviceName).Find(&obj)
}

5
models/new_vote_activity.go

@ -62,3 +62,8 @@ func UpdateVoteStatusByActiviytId(aid int64) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).
Update(&NewVoteActivity{VoteStatus: define.StatusNotBegin})
}
func GetVoteListByActivityId(obj, activityId interface{}) error {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
Desc("created_at").Find(&obj)
}

5
models/sign_history.go

@ -30,9 +30,10 @@ func (t *SignHistory) GetByUserId(aid, uid, rid, arid int64) (bool, error) {
"rehearsal_id=? and area_id=?", aid, uid, rid, arid).Get(t)
}
func (t *SignHistory) Count(id, aid, rid interface{}) (int64, error) {
func (t *SignHistory) Count(signUpId, activityId, rehearsalId interface{}) (int64, error) {
// 签到人数
return core.GetXormAuto().Where("is_delete=0 and sign_rule_id=? and rehearsal_id=? and activity_id=?", id, aid, rid).Count(t)
return core.GetXormAuto().Where("is_delete=0 and sign_rule_id=? and rehearsal_id=? and activity_id=?",
signUpId, rehearsalId, activityId).Count(t)
}
func GetLotteryUsersResultBySignHistory(obj, areaId, activityId, rehearsalId interface{}, ids []int64) error {

9
models/upper_wall.go

@ -1,6 +1,7 @@
package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time"
)
@ -21,3 +22,11 @@ type UpperWall struct {
CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"`
UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"`
}
func GetUpperWallResultByUserIdAndActivityId(obj, userId, activityId, rehearsalId interface{}) error {
return core.GetXormAuto().Table(new(UpperWall)).
Select("id, content, img, category, status").
Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=?",
userId, activityId, rehearsalId).
OrderBy("created_at desc").Find(&obj)
}
Loading…
Cancel
Save