fix:
This commit is contained in:
parent
a0a31709e5
commit
688a10f782
|
@ -242,7 +242,7 @@ func OrderCreate(c *gin.Context) {
|
|||
orderCreateLocker.Lock()
|
||||
defer orderCreateLocker.Unlock()
|
||||
|
||||
unreturnedOrders, err := model.IsHaveUnreturnedOrders(uc.Uid)
|
||||
unreturnedOrders, err := model.IsHaveUnreturnedOrders(uc.Uid) // TODO
|
||||
if err != nil {
|
||||
logger.Error("err:", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
|
@ -366,13 +366,13 @@ func OrderCreate(c *gin.Context) {
|
|||
// RespJson(c, status.InternalServerError, nil)
|
||||
// return
|
||||
//}
|
||||
|
||||
orderId := fmt.Sprintf("%d", order.ID)
|
||||
//orderId = "100000"
|
||||
fmt.Println("orderId", orderId)
|
||||
fmt.Println("Price", req.Price)
|
||||
fmt.Println("WxOpenID", user.WxOpenID)
|
||||
fmt.Println("WxPayRentCard", wxpay.WxPayRentCard)
|
||||
//
|
||||
//orderId := fmt.Sprintf("%d", order.ID)
|
||||
////orderId = "100000"
|
||||
//fmt.Println("orderId", orderId)
|
||||
//fmt.Println("Price", req.Price)
|
||||
//fmt.Println("WxOpenID", user.WxOpenID)
|
||||
//fmt.Println("WxPayRentCard", wxpay.WxPayRentCard)
|
||||
webPay, err := wxpay.WebPay(order.OrderSn, req.Price, user.WxOpenID, "N", wxpay.WxPayRentCard)
|
||||
if err != nil {
|
||||
logger.Error(errors.New("WebPay err"))
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"github.com/codinl/go-logger"
|
||||
"github.com/jinzhu/gorm"
|
||||
"math/rand"
|
||||
"qiniupkg.com/x/log.v7"
|
||||
"time"
|
||||
|
@ -69,7 +70,7 @@ type OrderCard struct {
|
|||
GameCardId uint32 `json:"game_card_id" gorm:"index"` // 游戏id
|
||||
GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"` // 游戏卡id
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
Status uint8 `json:"status" gorm:"index"`
|
||||
Status uint8 `json:"status" gorm:"index"` // 1-待领取 2-游玩中 3-已归还 4-未领取
|
||||
}
|
||||
|
||||
func (*Order) TableName() string {
|
||||
|
@ -448,3 +449,29 @@ func UnPayOrderSetCancel(uid uint32) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
func (m *Order) CreateByCardInfoList(cardInfos []CardInfo, gdb *gorm.DB) error {
|
||||
err := gdb.Create(m).Error
|
||||
if err != nil {
|
||||
log.Error("err:", err)
|
||||
return err
|
||||
}
|
||||
if m.ID == 0 {
|
||||
return errors.New("order id is 0")
|
||||
}
|
||||
for _, v := range cardInfos {
|
||||
for i := 0; i < int(v.Count); i++ {
|
||||
//OrderCard{
|
||||
// OrderId: m.ID,
|
||||
// Uid: uint32(m.Uid),
|
||||
// GameCardId: v.GameCardId,
|
||||
// GameCardGoodsId: 0,
|
||||
// StoreId: uint32(m.StoreId),
|
||||
// Status: 0,
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user