Browse Source

rm core

master
黄梓健 5 years ago
parent
commit
ac18b7038e
  1. 15
      controllers/base.go
  2. 13
      controllers/client/auction.go
  3. 6
      controllers/client/barrage.go
  4. 10
      controllers/client/bully_screen.go
  5. 26
      controllers/client/calorie.go
  6. 3
      controllers/client/good.go
  7. 5
      controllers/client/invite_envelope.go
  8. 9
      controllers/client/login.go
  9. 49
      controllers/client/lottery.go
  10. 2
      controllers/client/order_entry.go
  11. 4
      controllers/pc/auction.go
  12. 2
      controllers/pc/upper_wall.go
  13. 4
      controllers/pc/vote.go
  14. 2
      controllers/pc/ws.go
  15. 12
      models/CalorieUser.go
  16. 5
      models/auction_history.go
  17. 4
      models/auction_result_record.go
  18. 21
      models/base.go
  19. 14
      models/lottery_draw_record.go
  20. 5
      models/order_entry_person.go
  21. 13
      models/sign_history.go
  22. 8
      models/user_prize.go
  23. 2
      services/pay/handle.go

15
controllers/base.go

@ -20,7 +20,6 @@ type BaseCtl struct {
}
func (t *BaseCtl) Prepare() {
//t.OriginResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
t.OriginResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
t.OriginResponseWriter.Header().Set("Access-Control-Allow-Credentials", "true")
t.OriginResponseWriter.Header().Set("Access-Control-Allow-Methods", "*")
@ -43,8 +42,6 @@ func (t *BaseCtl) Prepare() {
}
}
type M map[string]interface{}
func (t *BaseCtl) Bind(obj interface{}) error {
return t.RequestToStruct(obj)
}
@ -199,15 +196,7 @@ func (t *BaseCtl) ERROR(errStr string, code int, data ...string) {
t.DisplayByError(errStr, code, data...)
}
func (t *BaseCtl) CheckInSuccess(str string) {
t.DisplayByError(str, 1)
}
func (t *BaseCtl) SUCCESS(str string) {
t.DisplayByError(str, 0)
}
func (t *BaseCtl) STRING(str string) {
t.Display(nil, str, 0)
}
@ -223,9 +212,9 @@ func (t *BaseCtl) CheckErr(err error) {
}
// false
func (t *BaseCtl) Assert(b bool, errcode int, errmsg string) {
func (t *BaseCtl) Assert(b bool, code int, msg string) {
if !b {
t.ERROR(errmsg, errcode)
t.ERROR(msg, code)
}
return
}

13
controllers/client/auction.go

@ -8,8 +8,6 @@ import (
ws_send_service "hudongzhuanjia/services/ws_send"
"hudongzhuanjia/utils/code"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
type AuctionCtl struct {
@ -70,7 +68,7 @@ func (t *AuctionCtl) Auction() {
history.IsDelete = false
history.CreatedAt = time.Now()
history.UpdatedAt = time.Now()
_, err = core.GetXormAuto().InsertOne(history)
_, err = models.Add(history)
t.CheckErr(err)
if auction.AuctionModel == "加价竞拍" {
@ -78,7 +76,8 @@ func (t *AuctionCtl) Auction() {
exist, err := maxHistory.GetHighestMoney(activity.RehearsalId, auction.Id)
t.CheckErr(err)
if exist && (history.Money < maxHistory.Money || history.UserId != maxHistory.UserId) {
_, err = history.SoftDelete()
history.IsDelete = true
_, err = models.Update(history.Id, history, "is_delete")
t.CheckErr(err)
t.ERROR("加价失败, 价格低于当前最高价", code.MSG_ERR)
return
@ -122,7 +121,7 @@ func (t *AuctionCtl) Auction() {
record.UpdatedAt = time.Now()
record.CreatedAt = time.Now()
record.IsDelete = false
_, err = core.GetXormAuto().InsertOne(record)
_, err = models.Add(record)
t.CheckErr(err)
go ws_send_service.SendAuction(fmt.Sprintf("%d", activity.Id),
@ -140,7 +139,7 @@ func (t *AuctionCtl) Auction() {
})
}
// 加价
t.STRING("加价成功")
t.SUCCESS("加价成功")
}
func (t *AuctionCtl) ExistRecord() {
@ -158,7 +157,7 @@ func (t *AuctionCtl) ExistRecord() {
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
record := new(models.AuctionResultRecord)
exist, err = core.GetXormAuto().Where("is_delete=0 and user_id=? and auction_activity_id=? and rehearsal_id=?", uid, auctionId, activity.RehearsalId).Get(record)
exist, err = record.GetByUserIdAndAuctionId(uid, auctionId, activity.RehearsalId)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"show": exist,

6
controllers/client/barrage.go

@ -2,7 +2,6 @@ package client
import (
"fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers"
"hudongzhuanjia/libs/filter"
"hudongzhuanjia/models"
@ -42,13 +41,14 @@ func (t *BarrageCtl) Send() {
t.Assert(exist, code.MSG_USER_NOT_EXIST, "用户不存在")
//插入弹幕消息
_, err = core.GetXormAuto().InsertOne(&models.BarrageHistory{
history := models.BarrageHistory{
ActivityId: activityId,
UserId: uid,
Content: content,
CreateAt: time.Now(),
UpdateAt: time.Now(),
})
}
_, err = models.Add(&history)
t.CheckErr(err)
customer := new(models.Customer)

10
controllers/client/bully_screen.go

@ -8,8 +8,6 @@ import (
"hudongzhuanjia/services/pay"
"hudongzhuanjia/utils/code"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
//霸屏
@ -48,11 +46,7 @@ func (t *BullyScreenCtl) PaScreen() {
t.CheckErr(err)
t.Assert(exist, code.MSG_USER_NOT_EXIST, "用户不存在")
//扣除用户的金额
// todo:微信直接付款
// 调用微信统一下单接口
amount := bullyScreenServer.Price * second
var res = make(map[string]interface{}, 0)
res["out_trade_no"] = ""
if activity.RehearsalId == 0 {
@ -60,7 +54,7 @@ func (t *BullyScreenCtl) PaScreen() {
t.CheckErr(err)
}
history := &models.BullyScreenHistory{
history := models.BullyScreenHistory{
OutTradeNo: res["out_trade_no"].(string),
BullyScreenServerId: bullyScreenServer.Id,
ActivityId: activityId,
@ -81,7 +75,7 @@ func (t *BullyScreenCtl) PaScreen() {
if activity.RehearsalId != 0 {
history.Status = 0
}
_, err = core.GetXormAuto().InsertOne(history)
_, err = models.Add(&history)
t.CheckErr(err)
t.JSON(res)
}

26
controllers/client/calorie.go

@ -1,7 +1,6 @@
package client
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers"
"hudongzhuanjia/models"
"hudongzhuanjia/utils/code"
@ -41,12 +40,10 @@ func (t *CalorieCtl) Shake() {
calorieUser.Score += int64(score) // 增加
}
count, err := core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=?", calorie.Id, activity.RehearsalId).Count(new(models.CalorieUser))
count, err := calorieUser.CountByCalorieId(calorie.Id, activity.RehearsalId)
t.CheckErr(err)
users := make([]*models.CalorieUser, 0)
err = core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=? and score<=?",
calorie.Id, activity.RehearsalId, calorieUser.Score).Desc("score").Asc("join_time").Find(&users)
users, err := models.GetCalorieUsersByCalorieIdAndScore(calorie.Id, activity.RehearsalId, calorieUser.Score)
t.CheckErr(err)
var rank int
@ -57,27 +54,8 @@ func (t *CalorieCtl) Shake() {
}
}
// 活动时长
//duration := calorie.GameDuration - (time.Now().Unix() - calorie.StartTime) + 6 // 加上倒计时的6s
//if calorie.StartTime == 0 {
// duration = calorie.GameDuration
//}
// 3s 倒计时
//var countDown float64 = 0
//if duration-calorie.GameDuration > 0 {
// countDown = math.Ceil(float64(duration-calorie.GameDuration) / 2.0)
//}
//// 活动结束
//if calorie.Status == define.StatusEnding || duration <= 0 {
// duration = 0
//}
t.JSON(map[string]interface{}{
"rank": rank,
"score": calorieUser.Score, // 分数
//"time": duration - 2*int64(countDown), //时长
//"count_down": countDown, // 倒计时
//"status": calorie.Status, // 状态
})
}

3
controllers/client/good.go

@ -28,7 +28,6 @@ func (t *GoodCtl) GoodDetail() {
func (t *GoodCtl) GoodOption() {
activityId := t.MustGetInt64("activity_id")
//areaId := t.MustGetInt64("area_id")
option := new(models.CustomerOrderOption)
exist, err := option.GetByActivityId(activityId)
@ -37,7 +36,6 @@ func (t *GoodCtl) GoodOption() {
t.JSON([]interface{}{})
return
}
//t.Assert(exist, code.MSG_ORDER_NOT_EXIST, "订单活动不存在")
t.JSON(option)
}
@ -94,6 +92,7 @@ func (t *GoodCtl) ListOrder() {
for _, order := range orders {
orderNos = append(orderNos, order.OrderNo)
}
subs, err := models.GetCustomerOrderSubsByOrderNos(orderNos...)
t.CheckErr(err)
for index, order := range orders {

5
controllers/client/invite_envelope.go

@ -1,7 +1,6 @@
package client
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers"
"hudongzhuanjia/models"
"hudongzhuanjia/utils/code"
@ -36,10 +35,10 @@ func (t *InvitationLetterCtl) Invite() {
letter.IsDelete = false
letter.CreatedAt = time.Now()
letter.UpdatedAt = time.Now()
_, err = core.GetXormAuto().InsertOne(letter)
_, err = models.Add(letter)
t.CheckErr(err)
t.STRING("success")
t.SUCCESS("success")
}
func (t *InvitationLetterCtl) Setting() {

9
controllers/client/login.go

@ -12,8 +12,6 @@ import (
"hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define"
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
//用户
@ -28,8 +26,7 @@ func (t *UserCtl) EntryLogin() {
activityId := t.MustGetInt64("activity_id") // 需要获取
entryPeople := new(models.OrderEntryPerson)
exist, err := core.GetXormAuto().Where("is_delete=0 and account = ? and password = ? and activity_id = ?",
account, password, activityId).Get(entryPeople)
exist, err := entryPeople.Auth(account, password, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ENTRYPEOPLE_NOT_EXIST, "录入人员不存在")
@ -113,7 +110,7 @@ func (t *UserCtl) WxLogin() {
user.CreatedAt = time.Now()
user.UpdatedAt = time.Now()
if !exist {
_, err = core.GetXormAuto().Insert(user)
_, err = models.Add(user)
} else {
_, err = user.SaveUserInfo(user.Id)
}
@ -162,7 +159,7 @@ func (t *UserCtl) Login() {
exist, err := user.GetUserByOpenid(user.Openid)
t.CheckErr(err)
if !exist {
_, err = core.GetXormAuto().Insert(user)
_, err = models.Add(user)
t.CheckErr(err)
}

49
controllers/client/lottery.go

@ -1,7 +1,6 @@
package client
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers"
"hudongzhuanjia/models"
activity_service "hudongzhuanjia/services/activity"
@ -14,16 +13,20 @@ type LotteryCtl struct {
}
func (t *LotteryCtl) UserLotteries() {
uid := t.MustGetUID()
userId := t.MustGetUID()
activityId := t.MustGetInt64("activity_id")
userPrizes := make([]*models.UserPrize, 0)
err := core.GetXormAuto().Where("is_delete=0 and user_id=? ", uid).
Desc("created_at").Find(&userPrizes)
activity := new(models.Activity)
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
prizes, err := models.GetUserPrizesByUserIdAndActivityId(userId, activityId, activity.RehearsalId)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"list": userPrizes,
"total": len(userPrizes),
"list": prizes,
"total": len(prizes),
})
}
@ -67,7 +70,6 @@ func (t *LotteryCtl) CheckLottery() {
record := new(models.LotteryDrawRecord)
exist, err = record.GetByUserIdAndLadderId(uid, ladderId)
t.CheckErr(err)
//t.Assert(exist, code.MSG_LOTTERY_DRAW_NOT_HIT, "没有中奖")
t.JSON(map[string]interface{}{
"record": record,
"ladder": ladder,
@ -75,14 +77,6 @@ func (t *LotteryCtl) CheckLottery() {
})
}
//type WinnersResult struct {
// UserId int64 `json:"user_id"`
// UserName string `json:"user_name"`
// UserPhone string `json:"user_phone"`
// Avatar string `json:"avatar"`
// PrizeName string `json:"prize_name"`
//}
//获取中奖名单
func (t *LotteryCtl) Winners() {
activityId := t.MustGetInt64("activity_id")
@ -99,11 +93,7 @@ func (t *LotteryCtl) Winners() {
t.Assert(exist, code.MSG_LOTTERY_RULE_NOT_EXIST, "抽奖规则不存在")
result := make([]*LotteryUsersResult, 0)
err = core.GetXormAuto().Table(new(models.LotteryDrawRecord)).Alias("record").
Join("LEFT", new(models.User).Alias("user"), "user.id=record.user_id and user.is_delete=0").
Where("record.is_delete=0 and record.lottery_draw_rule_ladder_id=? and record.rehearsal_id=?", ladderId,
activity.RehearsalId).
Find(&result)
err = models.GetLotteryUsersResultByLotteryDrawRecord(result, ladderId, activity.RehearsalId)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"total": len(result),
@ -134,28 +124,19 @@ func (t *LotteryCtl) Users() {
t.CheckErr(err)
t.Assert(exist, code.MSG_LOTTERY_RULE_NOT_EXIST, "抽奖规则不存在")
result := make([]*LotteryUsersResult, 0)
session := core.GetXormAuto().Table(new(models.SignHistory)).Alias("h").
Select("h.user_id, u.nickname as username, u.avatar").Distinct("h.user_id").
Join("LEFT", new(models.User).Alias("u"), "h.user_id=u.id and u.is_delete = 0").
Where("h.is_delete=0 and h.area_id=? and h.activity_id=? and h.rehearsal_id=?",
areaId, activityId, activity.RehearsalId)
moduleService, exist, err := activity_service.GetModuleService(define.MODULE_LOTTERY, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在")
recordIds := make([]int64, 0)
if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT {
// 去重标志
recordIds := make([]int64, 0)
err = core.GetXormAuto().Table(new(models.LotteryDrawRecord)).Select("user_id").
Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and is_delete=0",
ladder.LotteryDrawRuleId, activity.RehearsalId, areaId).Find(&recordIds)
err = models.GetUserIdsByLotteryDrawRuleId(recordIds, ladder.LotteryDrawRuleId, activity.RehearsalId, areaId)
t.CheckErr(err)
session = session.NotIn("h.user_id", recordIds)
}
err = session.Find(&result)
result := make([]*LotteryUsersResult, 0)
err = models.GetLotteryUsersResultBySignHistory(result, areaId, activity.Id, activity.RehearsalId, recordIds)
t.CheckErr(err)
t.JSON(map[string]interface{}{

2
controllers/client/order_entry.go

@ -171,7 +171,7 @@ func (t *OrderEntryCtl) EntryOrders() {
activityId := t.MustGetInt64("activity_id")
entry := new(models.OrderEntryPerson)
exist, err := entry.GetById(uid)
exist, err := models.Get(entry, uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_ENTRYPEOPLE_NOT_EXIST, "录入人员不存在")

4
controllers/pc/auction.go

@ -55,7 +55,7 @@ func (t *AuctionCtl) StartAuction() {
Cols("status", "auction_end_time", "updated_at").Update(auction)
t.CheckErr(err)
t.STRING("操作成功")
t.SUCCESS("操作成功")
}
func (t *AuctionCtl) StopAuction() {
@ -139,7 +139,7 @@ func (t *AuctionCtl) StopAuction() {
})
}
t.STRING("操作成功")
t.SUCCESS("操作成功")
}
// 增加数据

2
controllers/pc/upper_wall.go

@ -112,7 +112,7 @@ func (t *UpperWallCtl) Review() {
"total": len(result)},
})
}
t.STRING("审核成功")
t.SUCCESS("审核成功")
}
//获取黑名单列表

4
controllers/pc/vote.go

@ -93,7 +93,7 @@ func (t *VoteCtl) StartVote() {
_, err = core.GetXormAuto().Where("is_delete=0 and id=?", voteId).
Cols("vote_status", "vote_end_time", "updated_at").Update(vote)
t.CheckErr(err)
t.STRING("操作成功")
t.SUCCESS("操作成功")
}
//停止投票
@ -116,7 +116,7 @@ func (t *VoteCtl) StopVote() {
Cols("vote_status", "updated_at", "vote_end_time").Update(vote)
t.CheckErr(err)
t.STRING("操作成功")
t.SUCCESS("操作成功")
}
//获取参与人数

2
controllers/pc/ws.go

@ -59,5 +59,5 @@ func (t *WsCtl) SaveOp() {
logger.Error("save customer_operation出现错误")
t.ERROR("customer operation格式错误", code.MSG_ERR)
}
t.STRING("success")
t.SUCCESS("success")
}

12
models/CalorieUser.go

@ -34,3 +34,15 @@ func (t *CalorieUser) IncrScore(score int) (int64, error) {
t.JoinTime = time.Now().UnixNano()
return core.GetXormAuto().Where("is_delete=0 and id=?", t.Id).Cols("score", "join_time").Incr("score", score).Update(t)
}
func (t *CalorieUser) CountByCalorieId(calorieId, rehearsalId interface{}) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=?",
calorieId, rehearsalId).Count(t)
}
func GetCalorieUsersByCalorieIdAndScore(calorieId, rehearsalId, score interface{}) ([]*CalorieUser, error) {
users := make([]*CalorieUser, 0)
err := core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=? and score<=?",
calorieId, rehearsalId, score).Desc("score").Asc("join_time").Find(&users)
return users, err
}

5
models/auction_history.go

@ -56,8 +56,3 @@ func GetAuctionHistoriesByAuctionIds(ids []int64, rid int64, orderBy string) ([]
In("auction_activity_id", ids).OrderBy(orderBy).Find(&histories)
return histories, err
}
func (t *AuctionHistory) SoftDelete() (int64, error) {
t.IsDelete = true
return core.GetXormAuto().ID(t.Id).Cols("is_delete").Update(t)
}

4
models/auction_result_record.go

@ -40,3 +40,7 @@ func GetAuctionRecordsByAuctionId(id, rid int64, orderBy string) ([]*AuctionResu
OrderBy(orderBy).Find(&records)
return records, err
}
func (t *AuctionResultRecord) GetByUserIdAndAuctionId(userId, auctionId, rehearsalId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and user_id=? and auction_activity_id=? and rehearsal_id=?", userId, auctionId, rehearsalId).Get(t)
}

21
models/base.go

@ -147,10 +147,25 @@ func Add(bean interface{}) (int64, error) {
return core.GetXormAuto().InsertOne(bean)
}
func Update(bean interface{}, field ...string) (int64, error) {
func Update(id, bean interface{}, field ...string) (int64, error) {
if len(field) > 0 {
return core.GetXormAuto().Cols(field...).Update(bean)
return core.GetXormAuto().ID(id).Cols(field...).Update(bean)
} else {
return core.GetXormAuto().Update(bean)
return core.GetXormAuto().ID(id).Update(bean)
}
}
func Commit(f func(s *xorm.Session) error) error {
session := core.GetXormAuto().NewSession()
defer session.Close()
err := session.Begin()
if err != nil {
return err
}
err = f(session)
if err != nil {
session.Rollback()
return err
}
return session.Commit()
}

14
models/lottery_draw_record.go

@ -49,3 +49,17 @@ func (t *LotteryDrawRecord) Update(id interface{}, field ...string) (int64, erro
t.Id = 0
return core.GetXormAuto().Where("id=?", id).Update(t)
}
func GetLotteryUsersResultByLotteryDrawRecord(obj, ladderId, rehearsalId interface{}) error {
err := 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
}
func GetUserIdsByLotteryDrawRuleId(obj, ruleId, rehearsalId, areaId interface{}) error {
return core.GetXormAuto().Table(new(LotteryDrawRecord)).Select("user_id").
Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and is_delete=0",
ruleId, rehearsalId, areaId).Find(&obj)
}

5
models/order_entry_person.go

@ -27,6 +27,7 @@ func (t *OrderEntryPerson) TableName() string {
return OrderEntryPersonTableName
}
func (t *OrderEntryPerson) GetById(id interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and id=?", id).Get(t)
func (t *OrderEntryPerson) Auth(account, password, activityId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and account = ? and password = ? and activity_id = ?",
account, password, activityId).Get(t)
}

13
models/sign_history.go

@ -34,3 +34,16 @@ func (t *SignHistory) Count(id, aid, rid 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)
}
func GetLotteryUsersResultBySignHistory(obj, areaId, activityId, rehearsalId interface{}, ids []int64) error {
session := core.GetXormAuto().Table(new(SignHistory)).Alias("h").
Select("h.user_id, u.nickname as username, u.avatar").Distinct("h.user_id").
Join("LEFT", new(User).Alias("u"), "h.user_id=u.id and u.is_delete = 0").
Where("h.is_delete=0 and h.area_id=? and h.activity_id=? and h.rehearsal_id=?",
areaId, activityId, rehearsalId)
defer session.Close()
if len(ids) > 0 {
session = session.NotIn("h.user_id", ids)
}
return session.Find(&obj)
}

8
models/user_prize.go

@ -39,3 +39,11 @@ func (t *UserPrize) Update(fields ...string) error {
_, err := core.GetXormAuto().Where("is_delete=0 and id = ? and user_id =?", t.Id, t.UserId).Cols(fields...).Update(t)
return err
}
func GetUserPrizesByUserIdAndActivityId(userId, activityId, rehearsalId interface{}) ([]*UserPrize, error) {
prizes := make([]*UserPrize, 0)
err := core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=?",
userId, activityId, rehearsalId).
Desc("created_at").Find(&prizes)
return prizes, err
}

2
services/pay/handle.go

@ -96,7 +96,7 @@ func HandleSuccess(param *OrderDelayQueueParam) error {
}
customerOrder.UserPrizeId = prize.Id
_, err = models.Update(customerOrder, "user_prize_id")
_, err = models.Update(customerOrder.Id, customerOrder, "user_prize_id")
if err != nil {
err = fmt.Errorf("奖品记录添加失败: err-> %v, out_trade_no-> %v, prize_id->%v", err, param.Order.OutTradeNo, prize.Id)
logger.Error(err)

Loading…
Cancel
Save