Browse Source

order

master
黄梓健 5 years ago
parent
commit
ff0bbdff70
  1. 6
      controllers/author.go
  2. 12
      controllers/client/upper_wall.go
  3. 2
      controllers/pc/auction.go
  4. 2
      controllers/pc/calorie.go
  5. 4
      controllers/pc/lottery_draw.go
  6. 2
      controllers/pc/order_draw.go
  7. 8
      controllers/pc/reward.go
  8. 2
      controllers/pc/shake_red_envelope.go
  9. 2
      controllers/pc/sign.go
  10. 22
      controllers/pc/tug_war.go
  11. 12
      controllers/pc/upper_wall.go
  12. 2
      controllers/pc/vote.go
  13. 3
      log/hdzj.log
  14. 4
      models/area_store.go
  15. 9
      models/upper_wall.go
  16. 2
      services/activity/module.go
  17. 5
      services/lottery/lottery.go
  18. 24
      services/upper_wall/upper_wall.go

6
controllers/author.go

@ -15,11 +15,11 @@ type AuthorCtl struct {
func (t *AuthorCtl) Prepare() {
t.BaseCtl.Prepare()
skip, _ := t.GetInt("skip")
if skip == 1 {
skip, _ := t.GetInt64("skip")
if skip != 0 {
t.claims = &jwt.Claims{
AccountType: "customer",
AccountId: 1,
AccountId: skip,
CustomerId: 1,
CustomerPid: 0,
ActivityId: 1,

12
controllers/client/upper_wall.go

@ -4,6 +4,7 @@ import (
"fmt"
"hudongzhuanjia/controllers"
"hudongzhuanjia/models"
"hudongzhuanjia/services/upper_wall"
"hudongzhuanjia/utils/code"
"time"
)
@ -56,14 +57,6 @@ func (t *UpperWallCtl) Send() {
t.SUCCESS("成功")
}
type UpperWallResult struct {
Id int64 `json:"id"`
Content string `json:"content"`
Img string `json:"img"`
Category string `json:"category"`
Status int `json:"status"`
}
func (t *UpperWallCtl) List() {
activityId := t.MustGetInt64("activity_id")
userId := t.MustGetUID()
@ -73,8 +66,7 @@ func (t *UpperWallCtl) List() {
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
list := make([]*UpperWallResult, 0)
err = models.GetUpperWallResultByUserIdAndActivityId(list, userId, activity.Id, activity.RehearsalId)
list, err := upper_wall.GetUpperWallResult(userId, activity.Id, activity.RehearsalId)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"list": list,

2
controllers/pc/auction.go

@ -239,7 +239,7 @@ func (t *AuctionCtl) Qrcode() {
rehearsalId := t.MustGetInt("rehearsal_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
exist, err := area.GetByCustomerId(uid, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在")

2
controllers/pc/calorie.go

@ -102,7 +102,7 @@ func (t *CalorieCtl) Qrcode() {
calorieId := t.MustGetInt64("calorie_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
exist, err := area.GetByCustomerId(uid, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")

4
controllers/pc/lottery_draw.go

@ -186,7 +186,7 @@ func (t *LotteryDrawCtl) Users() {
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
area := new(models.AreaStore)
exist, err = area.GetByCustomerId(customerId)
exist, err = area.GetByCustomerId(customerId, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区不存在")
@ -229,7 +229,7 @@ func (t *LotteryDrawCtl) Lottery() {
// 多地区设置
area := new(models.AreaStore)
exist, err = area.GetByCustomerId(customerId)
exist, err = area.GetByCustomerId(customerId, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_DATA_NOT_EXIST, "地区不存在")

2
controllers/pc/order_draw.go

@ -272,7 +272,7 @@ func (t *OrderDrawCtl) Draw() {
t.CheckRunning(activity.Status)
area := new(models.AreaStore)
exist, err = area.GetByCustomerId(customerId)
exist, err = area.GetByCustomerId(customerId, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_DATA_NOT_EXIST, "地区不存在")

8
controllers/pc/reward.go

@ -74,14 +74,8 @@ func (t *RewardCtl) WaitReview() {
func (t *RewardCtl) Review() {
status := t.MustGetBool("status")
ids := strings.Split(t.MustGet("ids"), "|")
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)
@ -105,7 +99,7 @@ func (t *RewardCtl) Review() {
_, err = models.Update(v.Id, v, "status")
t.CheckErr(err)
if activity.RehearsalId != 0 && v.Type == 0 { // 线下h5彩排不需要金额
if v.RehearsalId != 0 && v.Type == 0 { // 线下h5彩排不需要金额
continue
}

2
controllers/pc/shake_red_envelope.go

@ -199,7 +199,7 @@ func (t *ShakeRedEnvelopeCtl) Qrcode() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(customerId)
exist, err := area.GetByCustomerId(customerId, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在")

2
controllers/pc/sign.go

@ -23,7 +23,7 @@ func (t *SignCtl) Qrcode() {
signUpId := t.MustGetInt64("sign_rule_id")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
exist, err := area.GetByCustomerId(uid, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")

22
controllers/pc/tug_war.go

@ -102,19 +102,23 @@ func (t *TugOfWarCtl) Stop() {
func (t *TugOfWarCtl) Team() {
baheId := t.MustGetInt64("bahe_activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
customerId := t.MustGetUID()
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(customerId)
t.CheckErr(err)
//t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区信息异常")
bahe := new(models.TugOfWar)
exist, err = models.Get(bahe, baheId)
exist, err := models.Get(bahe, baheId)
t.CheckErr(err)
t.Assert(exist, code.MSG_TUGWAR_NOT_EXIST, "拔河不存在")
activity := new(models.Activity)
exist, err = models.Get(activity, bahe.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
area := new(models.AreaStore)
exist, err = area.GetByCustomerId(customerId, bahe.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区信息异常")
//获取队伍信息: 名字、二维码、颜色
teams := make([]*models.BaheTeam, 0)
total, err := core.GetXormAuto().Where("is_delete=0 and bahe_activity_id=?", bahe.Id).FindAndCount(&teams)
@ -132,7 +136,7 @@ func (t *TugOfWarCtl) Team() {
"customer_id": customerId,
"bahe_activity_id": bahe.Id,
"bahe_team_id": teams[index].Id,
"rehearsal_id": rehearsalId,
"rehearsal_id": activity.RehearsalId,
})
t.CheckErr(err)
teams[index].Qrcode = qrcode
@ -144,7 +148,7 @@ func (t *TugOfWarCtl) Team() {
"customer_id": customerId,
"bahe_activity_id": bahe.Id,
"bahe_team_id": 0,
"rehearsal_id": rehearsalId,
"rehearsal_id": activity.RehearsalId,
})
t.CheckErr(err)
}

12
controllers/pc/upper_wall.go

@ -152,19 +152,23 @@ func (t *UpperWallCtl) Total() {
// 跳到主页
func (t *UpperWallCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
uid := t.MustGetUID()
activity := new(models.Activity)
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动信息异常")
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
exist, err = area.GetByCustomerId(uid, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "地区信息异常")
qrcode, err := utils.GenH5Qrcode(define.H5Index, map[string]interface{}{
"activity_id": activityId,
"area_id": area.Id,
"customer_id": uid,
"rehearsal_id": rehearsalId,
"rehearsal_id": activity.RehearsalId,
})
t.CheckErr(err)

2
controllers/pc/vote.go

@ -24,7 +24,7 @@ func (t *VoteCtl) Qrcode() {
uid := t.MustGetUID()
area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid)
exist, err := area.GetByCustomerId(uid, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户信息异常")

3
log/hdzj.log

@ -100,3 +100,6 @@
2020-05-22 15:06:18.656 ERROR logger/logger.go:87 微信响应次数: 1
2020-05-22 15:08:27.956 ERROR logger/logger.go:87 微信响应次数: 1
2020-05-22 15:08:56.782 ERROR logger/logger.go:87 微信响应次数: 2
2020-05-22 16:08:14.919 ERROR logger/logger.go:87 获取过期打赏错误原因Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
2020-05-22 16:08:14.920 ERROR logger/logger.go:87 定时任务错误原因Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
2020-05-22 16:35:51.409 ERROR logger/logger.go:87 check err{error 25 0 sql: expected 3 arguments, got 2}

4
models/area_store.go

@ -26,8 +26,8 @@ func (t *AreaStore) TableName() string {
return AreaStoreTableName
}
func (t *AreaStore) GetByCustomerId(customerId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and customer_id=?", customerId).Get(t)
func (t *AreaStore) GetByCustomerId(customerId, activityId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and customer_id=? and activity_id=?", customerId, activityId).Get(t)
}
func (t *AreaStore) GetAreaStoreById(id int64) (bool, error) {
return core.GetXormAuto().Where("id=? and is_delete=0", id).Get(t)

9
models/upper_wall.go

@ -1,7 +1,6 @@
package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time"
)
@ -22,11 +21,3 @@ 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)
}

2
services/activity/module.go

@ -27,7 +27,7 @@ func GetModuleService(moduleName, activityId interface{}) (*models.ActivityModul
module := new(models.ActivityModuleService)
exist, err := core.GetXormAuto().Table(module).Alias("s").
Join("LEFT", new(models.ModuleServiceHistory).Alias("h"),
"s.service_module_history_id=h.id and h.name=?").
"s.service_module_history_id=h.id").
Where("s.activity_id=? and s.is_delete=0 and h.name=?", activityId, moduleName).
Get(module)
return module, exist, err

5
services/lottery/lottery.go

@ -20,7 +20,8 @@ type LotteryUser struct {
func GetLotteryUsers(ids []int64) ([]*LotteryUser, error) {
users := make([]*LotteryUser, 0)
err := core.GetXormAuto().Select("id as user_id, nickname as username, avatar, phone").
err := core.GetXormAuto().Table(new(models.User)).
Select("id as user_id, nickname as username, avatar, phone").
In("id", ids).Find(&users)
return users, err
}
@ -56,7 +57,7 @@ func GetLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId,
}
err = core.GetXormAuto().Table(new(models.SignHistory)).Select("user_id").
Where("is_delete=0 and rehearsal_id=? and area_id=? and activity_id=?",
activityId, rehearsalId, areaId).NotIn("user_id", recordIds).Find(&userIds)
rehearsalId, areaId, activityId).NotIn("user_id", recordIds).Find(&userIds)
return userIds, nil
}

24
services/upper_wall/upper_wall.go

@ -0,0 +1,24 @@
package upper_wall
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/models"
)
type UpperWallResult struct {
Id int64 `json:"id"`
Content string `json:"content"`
Img string `json:"img"`
Category string `json:"category"`
Status int `json:"status"`
}
func GetUpperWallResult(userId, activityId, rehearsalId interface{}) ([]*UpperWallResult, error) {
result := make([]*UpperWallResult, 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=?",
userId, activityId, rehearsalId).
OrderBy("created_at desc").Find(&result)
return result, err
}
Loading…
Cancel
Save