fix:
This commit is contained in:
parent
a6689f2ad1
commit
ae7ef8980a
|
@ -299,7 +299,7 @@ func UserShareCardMyCard(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
dateVm, err := model.GetUserShareCardDateVm(uc.Uid)
|
||||
dateVm, err := model.GetUserShareCardDateVmInfo(uc.Uid)
|
||||
if err != nil {
|
||||
logger.Error("get user share card date vm err:", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
|
@ -507,6 +507,11 @@ func ShareCardRetrieveCancel(c *gin.Context) {
|
|||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
if retrieve.State != model.RetrieveStateInCheck {
|
||||
logger.Error("state err:", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
var refundOrderSn string
|
||||
if retrieve.RetrieveCardType == 2 {
|
||||
refundOrderSn = model.GetShareCardRetrieveOrderSn()
|
||||
|
@ -650,27 +655,28 @@ func CardIssueCreate(c *gin.Context) {
|
|||
ObtainType: req.ObtainType,
|
||||
Problem: req.Problem,
|
||||
Remark: req.Remark,
|
||||
State: model.CardIssueStateFollowing,
|
||||
}
|
||||
} else if req.ObtainType == "rent_card" {
|
||||
var order model.Order
|
||||
err := model.NewOrderQuerySet(model.DB).IDEq(req.RelevanceId).One(&order)
|
||||
var orderCard model.OrderCard
|
||||
err := model.NewOrderCardQuerySet(model.DB).IDEq(req.RelevanceId).One(&orderCard)
|
||||
if err != nil {
|
||||
logger.Error("order err:", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
if uint32(order.Uid) != uc.Uid {
|
||||
if uint32(orderCard.Uid) != uc.Uid {
|
||||
logger.Error("order uid err:")
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
feedback = &model.CardIssueFeedback{
|
||||
Uid: uint32(order.Uid),
|
||||
GameCardId: uint32(order.GameCardId),
|
||||
SerialNumber: order.GameCardSerialNumber,
|
||||
GameCardGoodsId: uint32(order.GameCardGoodsId),
|
||||
StoreId: uint32(order.StoreId),
|
||||
RelevanceId: order.ID,
|
||||
Uid: uint32(orderCard.Uid),
|
||||
GameCardId: uint32(orderCard.GameCardId),
|
||||
SerialNumber: orderCard.SerialNumber,
|
||||
GameCardGoodsId: uint32(orderCard.GameCardGoodsId),
|
||||
StoreId: uint32(orderCard.StoreId),
|
||||
RelevanceId: orderCard.ID,
|
||||
ObtainType: req.ObtainType,
|
||||
Problem: req.Problem,
|
||||
Remark: req.Remark,
|
||||
|
@ -691,6 +697,43 @@ func CardIssueCreate(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
func CardIssueCancel(c *gin.Context) {
|
||||
req := struct {
|
||||
CardIssueFeedbackId uint32 `json:"card_issue_feedback_id"`
|
||||
}{}
|
||||
if c.ShouldBindJSON(&req) != nil {
|
||||
logger.Error("parameter err")
|
||||
RespJson(c, status.BadRequest, nil)
|
||||
return
|
||||
}
|
||||
//uc := auth.GetCurrentUser(c)
|
||||
//if uc == nil {
|
||||
// RespJson(c, status.Unauthorized, nil)
|
||||
// return
|
||||
//}
|
||||
var cardIssueFeedback model.CardIssueFeedback
|
||||
err := model.NewCardIssueFeedbackQuerySet(model.DB).IDEq(req.CardIssueFeedbackId).One(&cardIssueFeedback)
|
||||
if err != nil {
|
||||
logger.Error("card issue feedback err:", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
if cardIssueFeedback.State != model.CardIssueStateFollowing {
|
||||
logger.Error("state err:")
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
_, err = model.NewCardIssueFeedbackQuerySet(model.DB).IDEq(req.CardIssueFeedbackId).GetUpdater().
|
||||
SetState(model.CardIssueStateCanceled).UpdateNum()
|
||||
if err != nil {
|
||||
logger.Error("update card issue feedback err:", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
RespOK(c, nil)
|
||||
return
|
||||
}
|
||||
func CardIssueList(c *gin.Context) {
|
||||
req := struct {
|
||||
Uid uint32 `json:"uid"`
|
||||
|
@ -731,7 +774,7 @@ func CardIssueList(c *gin.Context) {
|
|||
totalPage := count / req.PageSize
|
||||
|
||||
err = qs.OrderDescByID().Offset(page * req.PageSize).Limit(req.PageSize).All(&issueFeedbacks)
|
||||
if err != nil {
|
||||
if err != nil && err != model.RecordNotFound {
|
||||
logger.Error("card issue feedback err")
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
|
@ -745,3 +788,42 @@ func CardIssueList(c *gin.Context) {
|
|||
RespOK(c, ret)
|
||||
return
|
||||
}
|
||||
|
||||
func CardIssueInfo(c *gin.Context) {
|
||||
req := struct {
|
||||
CardIssueFeedbackId uint32 `json:"card_issue_feedback_id"`
|
||||
}{}
|
||||
if c.ShouldBindJSON(&req) != nil {
|
||||
logger.Error("parameter err")
|
||||
RespJson(c, status.BadRequest, nil)
|
||||
return
|
||||
}
|
||||
var issueFeedback model.CardIssueFeedback
|
||||
err := model.NewCardIssueFeedbackQuerySet(model.DB).IDEq(req.CardIssueFeedbackId).One(&issueFeedback)
|
||||
if err != nil {
|
||||
logger.Error("card issue feedback err")
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
//model.GetImpo()
|
||||
|
||||
var store model.Store
|
||||
err = model.NewStoreQuerySet(model.DB).IDEq(issueFeedback.StoreId).One(&store)
|
||||
if err != nil && err != model.RecordNotFound {
|
||||
logger.Error("store err")
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
var gameCard model.GameCard
|
||||
err = model.NewGameCardQuerySet(model.DB).IDEq(issueFeedback.GameCardId).One(&gameCard)
|
||||
if err != nil && err != model.RecordNotFound {
|
||||
logger.Error("game card err")
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
issueFeedback.Store = &store
|
||||
issueFeedback.GameCard = &gameCard
|
||||
|
||||
RespOK(c, issueFeedback)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -237,6 +237,62 @@ func (qs GameCardGoodsQuerySet) DeletedAtNe(deletedAt time.Time) GameCardGoodsQu
|
|||
return qs.w(qs.db.Where("deleted_at != ?", deletedAt))
|
||||
}
|
||||
|
||||
// FunctionStateEq is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateEq(functionState uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("function_state = ?", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateGt is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateGt(functionState uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("function_state > ?", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateGte is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateGte(functionState uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("function_state >= ?", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateIn is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateIn(functionState ...uint32) GameCardGoodsQuerySet {
|
||||
if len(functionState) == 0 {
|
||||
qs.db.AddError(errors.New("must at least pass one functionState in FunctionStateIn"))
|
||||
return qs.w(qs.db)
|
||||
}
|
||||
return qs.w(qs.db.Where("function_state IN (?)", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateLt is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateLt(functionState uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("function_state < ?", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateLte is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateLte(functionState uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("function_state <= ?", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateNe is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateNe(functionState uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("function_state != ?", functionState))
|
||||
}
|
||||
|
||||
// FunctionStateNotIn is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) FunctionStateNotIn(functionState ...uint32) GameCardGoodsQuerySet {
|
||||
if len(functionState) == 0 {
|
||||
qs.db.AddError(errors.New("must at least pass one functionState in FunctionStateNotIn"))
|
||||
return qs.w(qs.db)
|
||||
}
|
||||
return qs.w(qs.db.Where("function_state NOT IN (?)", functionState))
|
||||
}
|
||||
|
||||
// GameCardIdEq is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) GameCardIdEq(gameCardId uint64) GameCardGoodsQuerySet {
|
||||
|
@ -397,6 +453,12 @@ func (qs GameCardGoodsQuerySet) OrderAscByDeletedAt() GameCardGoodsQuerySet {
|
|||
return qs.w(qs.db.Order("deleted_at ASC"))
|
||||
}
|
||||
|
||||
// OrderAscByFunctionState is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderAscByFunctionState() GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Order("function_state ASC"))
|
||||
}
|
||||
|
||||
// OrderAscByGameCardId is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderAscByGameCardId() GameCardGoodsQuerySet {
|
||||
|
@ -421,6 +483,12 @@ func (qs GameCardGoodsQuerySet) OrderAscBySerialNumber() GameCardGoodsQuerySet {
|
|||
return qs.w(qs.db.Order("serial_number ASC"))
|
||||
}
|
||||
|
||||
// OrderAscByShareProfitType is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderAscByShareProfitType() GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Order("share_profit_type ASC"))
|
||||
}
|
||||
|
||||
// OrderAscByStatus is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderAscByStatus() GameCardGoodsQuerySet {
|
||||
|
@ -457,6 +525,12 @@ func (qs GameCardGoodsQuerySet) OrderDescByDeletedAt() GameCardGoodsQuerySet {
|
|||
return qs.w(qs.db.Order("deleted_at DESC"))
|
||||
}
|
||||
|
||||
// OrderDescByFunctionState is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderDescByFunctionState() GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Order("function_state DESC"))
|
||||
}
|
||||
|
||||
// OrderDescByGameCardId is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderDescByGameCardId() GameCardGoodsQuerySet {
|
||||
|
@ -481,6 +555,12 @@ func (qs GameCardGoodsQuerySet) OrderDescBySerialNumber() GameCardGoodsQuerySet
|
|||
return qs.w(qs.db.Order("serial_number DESC"))
|
||||
}
|
||||
|
||||
// OrderDescByShareProfitType is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderDescByShareProfitType() GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Order("share_profit_type DESC"))
|
||||
}
|
||||
|
||||
// OrderDescByStatus is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) OrderDescByStatus() GameCardGoodsQuerySet {
|
||||
|
@ -635,6 +715,62 @@ func (qs GameCardGoodsQuerySet) SerialNumberNotlike(serialNumber string) GameCar
|
|||
return qs.w(qs.db.Where("serial_number NOT LIKE ?", serialNumber))
|
||||
}
|
||||
|
||||
// ShareProfitTypeEq is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeEq(shareProfitType uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("share_profit_type = ?", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeGt is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeGt(shareProfitType uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("share_profit_type > ?", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeGte is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeGte(shareProfitType uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("share_profit_type >= ?", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeIn is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeIn(shareProfitType ...uint32) GameCardGoodsQuerySet {
|
||||
if len(shareProfitType) == 0 {
|
||||
qs.db.AddError(errors.New("must at least pass one shareProfitType in ShareProfitTypeIn"))
|
||||
return qs.w(qs.db)
|
||||
}
|
||||
return qs.w(qs.db.Where("share_profit_type IN (?)", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeLt is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeLt(shareProfitType uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("share_profit_type < ?", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeLte is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeLte(shareProfitType uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("share_profit_type <= ?", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeNe is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeNe(shareProfitType uint32) GameCardGoodsQuerySet {
|
||||
return qs.w(qs.db.Where("share_profit_type != ?", shareProfitType))
|
||||
}
|
||||
|
||||
// ShareProfitTypeNotIn is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) ShareProfitTypeNotIn(shareProfitType ...uint32) GameCardGoodsQuerySet {
|
||||
if len(shareProfitType) == 0 {
|
||||
qs.db.AddError(errors.New("must at least pass one shareProfitType in ShareProfitTypeNotIn"))
|
||||
return qs.w(qs.db)
|
||||
}
|
||||
return qs.w(qs.db.Where("share_profit_type NOT IN (?)", shareProfitType))
|
||||
}
|
||||
|
||||
// StatusEq is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (qs GameCardGoodsQuerySet) StatusEq(status uint8) GameCardGoodsQuerySet {
|
||||
|
@ -804,6 +940,13 @@ func (u GameCardGoodsUpdater) SetDeletedAt(deletedAt *time.Time) GameCardGoodsUp
|
|||
return u
|
||||
}
|
||||
|
||||
// SetFunctionState is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (u GameCardGoodsUpdater) SetFunctionState(functionState uint32) GameCardGoodsUpdater {
|
||||
u.fields[string(GameCardGoodsDBSchema.FunctionState)] = functionState
|
||||
return u
|
||||
}
|
||||
|
||||
// SetGameCardId is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (u GameCardGoodsUpdater) SetGameCardId(gameCardId uint64) GameCardGoodsUpdater {
|
||||
|
@ -832,6 +975,13 @@ func (u GameCardGoodsUpdater) SetSerialNumber(serialNumber string) GameCardGoods
|
|||
return u
|
||||
}
|
||||
|
||||
// SetShareProfitType is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (u GameCardGoodsUpdater) SetShareProfitType(shareProfitType uint32) GameCardGoodsUpdater {
|
||||
u.fields[string(GameCardGoodsDBSchema.ShareProfitType)] = shareProfitType
|
||||
return u
|
||||
}
|
||||
|
||||
// SetStatus is an autogenerated method
|
||||
// nolint: dupl
|
||||
func (u GameCardGoodsUpdater) SetStatus(status uint8) GameCardGoodsUpdater {
|
||||
|
@ -881,44 +1031,50 @@ func (f GameCardGoodsDBSchemaField) String() string {
|
|||
|
||||
// GameCardGoodsDBSchema stores db field names of GameCardGoods
|
||||
var GameCardGoodsDBSchema = struct {
|
||||
ID GameCardGoodsDBSchemaField
|
||||
CreatedAt GameCardGoodsDBSchemaField
|
||||
UpdatedAt GameCardGoodsDBSchemaField
|
||||
DeletedAt GameCardGoodsDBSchemaField
|
||||
GameCardId GameCardGoodsDBSchemaField
|
||||
SerialNumber GameCardGoodsDBSchemaField
|
||||
Status GameCardGoodsDBSchemaField
|
||||
StoreId GameCardGoodsDBSchemaField
|
||||
Provider GameCardGoodsDBSchemaField
|
||||
CardType GameCardGoodsDBSchemaField
|
||||
ID GameCardGoodsDBSchemaField
|
||||
CreatedAt GameCardGoodsDBSchemaField
|
||||
UpdatedAt GameCardGoodsDBSchemaField
|
||||
DeletedAt GameCardGoodsDBSchemaField
|
||||
GameCardId GameCardGoodsDBSchemaField
|
||||
SerialNumber GameCardGoodsDBSchemaField
|
||||
Status GameCardGoodsDBSchemaField
|
||||
StoreId GameCardGoodsDBSchemaField
|
||||
Provider GameCardGoodsDBSchemaField
|
||||
CardType GameCardGoodsDBSchemaField
|
||||
FunctionState GameCardGoodsDBSchemaField
|
||||
ShareProfitType GameCardGoodsDBSchemaField
|
||||
}{
|
||||
|
||||
ID: GameCardGoodsDBSchemaField("id"),
|
||||
CreatedAt: GameCardGoodsDBSchemaField("created_at"),
|
||||
UpdatedAt: GameCardGoodsDBSchemaField("updated_at"),
|
||||
DeletedAt: GameCardGoodsDBSchemaField("deleted_at"),
|
||||
GameCardId: GameCardGoodsDBSchemaField("game_card_id"),
|
||||
SerialNumber: GameCardGoodsDBSchemaField("serial_number"),
|
||||
Status: GameCardGoodsDBSchemaField("status"),
|
||||
StoreId: GameCardGoodsDBSchemaField("store_id"),
|
||||
Provider: GameCardGoodsDBSchemaField("provider"),
|
||||
CardType: GameCardGoodsDBSchemaField("card_type"),
|
||||
ID: GameCardGoodsDBSchemaField("id"),
|
||||
CreatedAt: GameCardGoodsDBSchemaField("created_at"),
|
||||
UpdatedAt: GameCardGoodsDBSchemaField("updated_at"),
|
||||
DeletedAt: GameCardGoodsDBSchemaField("deleted_at"),
|
||||
GameCardId: GameCardGoodsDBSchemaField("game_card_id"),
|
||||
SerialNumber: GameCardGoodsDBSchemaField("serial_number"),
|
||||
Status: GameCardGoodsDBSchemaField("status"),
|
||||
StoreId: GameCardGoodsDBSchemaField("store_id"),
|
||||
Provider: GameCardGoodsDBSchemaField("provider"),
|
||||
CardType: GameCardGoodsDBSchemaField("card_type"),
|
||||
FunctionState: GameCardGoodsDBSchemaField("function_state"),
|
||||
ShareProfitType: GameCardGoodsDBSchemaField("share_profit_type"),
|
||||
}
|
||||
|
||||
// Update updates GameCardGoods fields by primary key
|
||||
// nolint: dupl
|
||||
func (o *GameCardGoods) Update(db *gorm.DB, fields ...GameCardGoodsDBSchemaField) error {
|
||||
dbNameToFieldName := map[string]interface{}{
|
||||
"id": o.ID,
|
||||
"created_at": o.CreatedAt,
|
||||
"updated_at": o.UpdatedAt,
|
||||
"deleted_at": o.DeletedAt,
|
||||
"game_card_id": o.GameCardId,
|
||||
"serial_number": o.SerialNumber,
|
||||
"status": o.Status,
|
||||
"store_id": o.StoreId,
|
||||
"provider": o.Provider,
|
||||
"card_type": o.CardType,
|
||||
"id": o.ID,
|
||||
"created_at": o.CreatedAt,
|
||||
"updated_at": o.UpdatedAt,
|
||||
"deleted_at": o.DeletedAt,
|
||||
"game_card_id": o.GameCardId,
|
||||
"serial_number": o.SerialNumber,
|
||||
"status": o.Status,
|
||||
"store_id": o.StoreId,
|
||||
"provider": o.Provider,
|
||||
"card_type": o.CardType,
|
||||
"function_state": o.FunctionState,
|
||||
"share_profit_type": o.ShareProfitType,
|
||||
}
|
||||
u := map[string]interface{}{}
|
||||
for _, f := range fields {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -225,12 +225,14 @@ const (
|
|||
// gen:qs
|
||||
type GameCardGoods struct {
|
||||
Model
|
||||
GameCardId uint64 `json:"game_card_id"` // 游戏卡id
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
Status uint8 `json:"status"` // 状态:1-库存中 2-在途 3-客户持有
|
||||
StoreId uint64 `json:"store_id"` // 门店id
|
||||
Provider string `json:"provider"` // 供应商
|
||||
CardType string `json:"card_type" gorm:"index"` //
|
||||
GameCardId uint64 `json:"game_card_id"` // 游戏卡id
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
Status uint8 `json:"status"` // 状态:1-库存中 2-在途 3-客户持有 4-调拨 5-待收回 6-已收回
|
||||
StoreId uint64 `json:"store_id"` // 门店id
|
||||
Provider string `json:"provider"` // 供应商
|
||||
CardType string `json:"card_type" gorm:"index"` // -用户共享 -公共
|
||||
FunctionState uint32 `json:"function_state"` // 1-异常 2-正常
|
||||
ShareProfitType uint32 `json:"share_profit_type"` // 1-非共享收益卡 2-共享收益卡
|
||||
}
|
||||
|
||||
func (*GameCardGoods) TableName() string {
|
||||
|
|
|
@ -167,7 +167,11 @@ func InitDBProd() {
|
|||
func TestHotSearch_TableName(t *testing.T) {
|
||||
InitTestDB()
|
||||
|
||||
list := []string{"马里奥赛车8豪华版", "任天堂明星大乱斗 特别版", "超级马力欧 奥德赛", "塞尔达传说:旷野之息", "宝可梦:剑 / 盾", "精灵宝可梦 Let's Go! 皮卡丘/Let's Go! 伊布", "喷射战士2", "超级马力欧派对", "新超级马里奥兄弟U", "路易基鬼屋3", "超级马力欧创作家2", "塞尔达传说:织梦岛", "集合了!动物森友会", "1-2 Switch", "马里奥网球Aces", "马里奥+疯兔:王国之战", "火焰之纹章:风花雪月", "星之卡比:新星同盟", "大金刚国度:热带寒流"}
|
||||
list := []string{"马里奥赛车8豪华版", "任天堂明星大乱斗 特别版", "超级马力欧 奥德赛", "塞尔达传说:旷野之息",
|
||||
"宝可梦:剑 / 盾", "精灵宝可梦 Let's Go! 皮卡丘/Let's Go! 伊布", "喷射战士2", "超级马力欧派对",
|
||||
"新超级马里奥兄弟U", "路易基鬼屋3", "超级马力欧创作家2", "塞尔达传说:织梦岛", "集合了!动物森友会",
|
||||
"1-2 Switch", "马里奥网球Aces", "马里奥+疯兔:王国之战", "火焰之纹章:风花雪月", "星之卡比:新星同盟",
|
||||
"大金刚国度:热带寒流"}
|
||||
for i, s := range list {
|
||||
hotSearch := &HotSearch{
|
||||
Keyword: s,
|
||||
|
|
|
@ -349,7 +349,6 @@ func (m *Order) Revert() error {
|
|||
func (m *Order) RevertCancel() (bool, error) {
|
||||
var (
|
||||
orderCard OrderCard
|
||||
//order Order
|
||||
//card GameCard
|
||||
)
|
||||
|
||||
|
|
|
@ -70,20 +70,40 @@ const (
|
|||
// gen:qs
|
||||
type UserShareCard struct {
|
||||
Model
|
||||
Uid uint32 `json:"uid" gorm:"index"`
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
BillSn string `json:"bill_sn" gorm:"index"`
|
||||
GameCardId uint32 `json:"game_card_id" gorm:"index"`
|
||||
State string `json:"state" gorm:"index"`
|
||||
GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
UserShareCardBillId uint32 `json:"user_share_card_bill_id" gorm:"index"`
|
||||
ShareCardBillGameId uint32 `json:"share_card_bill_game_id" gorm:"index"`
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
ProfitState uint32 `json:"profit_state"` // 1-未生效 2-生效
|
||||
TotalVm uint32 `json:"total_vm"` // 累计积分
|
||||
RetrieveSerialNumber string `json:"retrieve_serial_number" gorm:"index"` // 收卡编号
|
||||
RetrieveGameCardGoodsId uint32 `json:"retrieve_game_card_goods_id" gorm:"index"` // 收回卡id
|
||||
GameCard GameCard `json:"game_card" gorm:"-"`
|
||||
//Uid uint32 `json:"uid" gorm:"index"`
|
||||
//SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
//BillSn string `json:"bill_sn" gorm:"index"`
|
||||
//GameCardId uint32 `json:"game_card_id" gorm:"index"`
|
||||
//State string `json:"state" gorm:"index"`
|
||||
//GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
//UserShareCardBillId uint32 `json:"user_share_card_bill_id" gorm:"index"`
|
||||
//ShareCardBillGameId uint32 `json:"share_card_bill_game_id" gorm:"index"`
|
||||
//StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
//ProfitState uint32 `json:"profit_state"` // 1-未生效 2-生效
|
||||
//TotalVm uint32 `json:"total_vm"` // 累计积分
|
||||
//RetrieveSerialNumber string `json:"retrieve_serial_number" gorm:"index"` // 收卡编号
|
||||
//RetrieveGameCardGoodsId uint32 `json:"retrieve_game_card_goods_id" gorm:"index"` // 收回卡id
|
||||
|
||||
Uid uint32 `json:"uid" gorm:"index"`
|
||||
GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
GameCardId uint32 `json:"game_card_id" gorm:"index"`
|
||||
|
||||
AllotSerialNumber string `json:"allot_serial_number" gorm:"index"` // 库存共享卡编号 分配收回卡 绑定新卡编号
|
||||
AllotCardGoodsId uint32 `json:"allot_card_goods_id" gorm:"index"` // 库存共享卡id
|
||||
UserShareCardBillId uint32 `json:"user_share_card_bill_id" gorm:"index"`
|
||||
BillSn string `json:"bill_sn" gorm:"index"`
|
||||
|
||||
State string `json:"state" gorm:"index"`
|
||||
|
||||
ShareCardBillGameId uint32 `json:"share_card_bill_game_id" gorm:"index"`
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
ProfitState uint32 `json:"profit_state"` // 1-未生效 2-生效
|
||||
TotalVm uint32 `json:"total_vm"` // 累计积分
|
||||
RetrieveSerialNumber string `json:"retrieve_serial_number" gorm:"index"` // 收卡编号
|
||||
RetrieveGameCardGoodsId uint32 `json:"retrieve_game_card_goods_id" gorm:"index"` // 收回卡id
|
||||
|
||||
GameCard GameCard `json:"game_card" gorm:"-"`
|
||||
}
|
||||
|
||||
// gen:qs
|
||||
|
@ -187,24 +207,44 @@ const (
|
|||
|
||||
// gen:qs
|
||||
type ShareCardRetrieveCard struct {
|
||||
Model
|
||||
ShareCardRetrieveId uint32 `json:"share_card_retrieve_id" gorm:"index"`
|
||||
UserShareCardId uint32 `json:"user_share_card_id" gorm:"index"` // 用户共享卡收回
|
||||
Uid uint32 `json:"uid" gorm:"index"`
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
State string `json:"state" gorm:"index"` // 1-暂无库存 2-待发卡 3-待取卡 4-已发卡 5-已收卡 6-已取消
|
||||
BillSn string `json:"bill_sn" gorm:"index"`
|
||||
GameCardId uint32 `json:"game_card_id" gorm:"index"`
|
||||
RetrieveCardType uint32 `json:"retrieve_card_type" gorm:"index"` // 1-送卡 2-邮寄
|
||||
GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
UserShareCardBillId uint32 `json:"user_share_card_bill_id" gorm:"index"`
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
Remark string `json:"remark"`
|
||||
RetrieveSerialNumber string `json:"retrieve_serial_number" gorm:"index"` // 收卡编号
|
||||
RetrieveGameCardGoodsId uint32 `json:"retrieve_game_card_goods_id" gorm:"index"` // 收回卡id
|
||||
GameCard GameCard `json:"game_card" gorm:"-"`
|
||||
Store Store `json:"store" gorm:"-"`
|
||||
//ShareCardRetrieveId uint32 `json:"share_card_retrieve_id" gorm:"index"`
|
||||
//UserShareCardId uint32 `json:"user_share_card_id" gorm:"index"` // 用户共享卡收回
|
||||
//Uid uint32 `json:"uid" gorm:"index"`
|
||||
//SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
//State string `json:"state" gorm:"index"` // 1-暂无库存 2-待发卡 3-待取卡 4-已发卡 5-已收卡 6-已取消
|
||||
//BillSn string `json:"bill_sn" gorm:"index"`
|
||||
//GameCardId uint32 `json:"game_card_id" gorm:"index"`
|
||||
//RetrieveCardType uint32 `json:"retrieve_card_type" gorm:"index"` // 1-送卡 2-邮寄
|
||||
//GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
//UserShareCardBillId uint32 `json:"user_share_card_bill_id" gorm:"index"`
|
||||
//StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
//Remark string `json:"remark"`
|
||||
//RetrieveSerialNumber string `json:"retrieve_serial_number" gorm:"index"` // 收卡编号
|
||||
//RetrieveGameCardGoodsId uint32 `json:"retrieve_game_card_goods_id" gorm:"index"` // 收回卡id
|
||||
|
||||
Model
|
||||
ShareCardRetrieveId uint32 `json:"share_card_retrieve_id" gorm:"index"` // 收回卡单id
|
||||
UserShareCardId uint32 `json:"user_share_card_id" gorm:"index"` // 用户共享卡id
|
||||
Uid uint32 `json:"uid" gorm:"index"`
|
||||
State string `json:"state" gorm:"index"` // -暂无库存 -待发卡 -待取卡 -已发卡 -已收卡 -已取消
|
||||
TransportType uint32 `json:"transport_type" gorm:"index"` // 1-送卡到门店 2-邮寄
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 编号
|
||||
GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
GameCardId uint32 `json:"game_card_id" gorm:"index"`
|
||||
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 共享卡门店id
|
||||
UserShareCardBillId uint32 `json:"user_share_card_bill_id" gorm:"index"`
|
||||
BillSn string `json:"bill_sn" gorm:"index"`
|
||||
|
||||
RetrieveSerialNumber string `json:"retrieve_serial_number" gorm:"index"` // 收卡编号
|
||||
RetrieveGameCardGoodsId uint32 `json:"retrieve_game_card_goods_id" gorm:"index"` // 收回卡id
|
||||
Remark string `json:"remark"`
|
||||
|
||||
OriginalCardType string `json:"retrieve_card_type" gorm:"index"` // -公共卡 -用户共享 回收前的卡类型 原卡类型
|
||||
AllotUserShareCardId uint32 `json:"allot_user_share_card_id"` // 分配用户共享卡id
|
||||
|
||||
GameCard GameCard `json:"game_card" gorm:"-"`
|
||||
Store Store `json:"store" gorm:"-"`
|
||||
ShareCardRetrieve ShareCardRetrieve `json:"share_card_retrieve" gorm:"-"`
|
||||
//TotalVm uint32 `json:"total_vm"` // 累计积分
|
||||
//ShareCardBillGameId uint32 `json:"share_card_bill_game_id" gorm:"index"`
|
||||
|
@ -212,11 +252,15 @@ type ShareCardRetrieveCard struct {
|
|||
}
|
||||
|
||||
const (
|
||||
CardIssueStateUnFollow = "unfollow" // 待处理
|
||||
CardIssueStateFollowing = "following" // 处理中
|
||||
CardIssueStateFollowed = "followed" // 已处理
|
||||
CardIssueStateCompleted = "completed" // 已完成
|
||||
CardIssueStateCanceled = "canceled" // 已取消
|
||||
)
|
||||
const (
|
||||
ObtainTypeRetrieveCard = "retrieve_card" // 收回卡
|
||||
ObtainTypeRentCard = "rent_card" // 租卡
|
||||
)
|
||||
|
||||
// gen:qs
|
||||
type CardIssueFeedback struct {
|
||||
|
@ -227,12 +271,34 @@ type CardIssueFeedback struct {
|
|||
GameCardGoodsId uint32 `json:"game_card_goods_id" gorm:"index"`
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
RelevanceId uint32 `json:"relevance_id" gorm:"index"` // 关联id
|
||||
ObtainType string `json:"obtain_type"` // 卡类型
|
||||
State string `json:"state" gorm:"index"` //
|
||||
ObtainType string `json:"obtain_type"` // 卡类型: -收回卡 -租卡
|
||||
State string `json:"state" gorm:"index"` // 状态:
|
||||
Problem string `json:"problem"` // 问题
|
||||
Remark string `json:"remark"`
|
||||
|
||||
GameCard *GameCard `json:"game_card" gorm:"-"`
|
||||
ExpressCompany string `json:"express_company"` // 物流公司
|
||||
ExpressCompanyNo string `json:"express_company_no"` // 物流公司编号
|
||||
ExpressNo string `json:"express_no" gorm:"index"` // 物流单号
|
||||
IsNormalFunction uint32 `json:"is_normal_function"` // 功能是否正常:1-是 2-否
|
||||
IsPackingIntact uint32 `json:"is_packing_intact"` // 包装是否完整:1-是 2-否
|
||||
IsCardBreakage uint32 `json:"is_card_breakage"` // 卡带是否破损:1-是 2-否
|
||||
DeliverExpressCompany string `json:"deliver_express_company"` // 发货物流公司
|
||||
DeliverExpressCompanyNo string `json:"deliver_express_company_no"` // 发货物流公司编号
|
||||
DeliverExpressNo string `json:"deliver_express_no" gorm:"index"` // 发货物流单号
|
||||
ReissueSerialNumber string `json:"reissue_serial_number" gorm:"index"` // 补发货编码
|
||||
ReissueGameCardGoodsId uint32 `json:"reissue_game_card_goods_id" gorm:"index"` // 补发货卡id
|
||||
DeliverTime time.Time `json:"deliver_time"` // 发货时间
|
||||
CheckTime time.Time `json:"check_time"` // 检测时间
|
||||
CheckSysUid string `json:"check_sys_uid" gorm:"index"` // 检测店员账号用户id
|
||||
ReceiptTime time.Time `json:"receipt_time"` // 签收时间
|
||||
//CheckShopAssistant string `json:"check_shop_assistant" gorm:"index"` // 检测店员账号
|
||||
|
||||
UserInfo *User `json:"user_info" gorm:"-"`
|
||||
GameCard *GameCard `json:"game_card" gorm:"-"`
|
||||
Store *Store `json:"store" gorm:"-"`
|
||||
ShareCardRetrieve *ShareCardRetrieve `json:"share_card_retrieve" gorm:"-"`
|
||||
Order *Order `json:"order" gorm:"-"`
|
||||
// card_issue_feedback
|
||||
}
|
||||
|
||||
func GetUserShareCardBillList(uid uint32, page, pageSize int, state string) ([]UserShareCardBill, int, error) {
|
||||
|
@ -557,22 +623,32 @@ func GetUserShareCardVmList(uid uint32, page, pageSize int, goodsId uint32) ([]U
|
|||
return shareCardVms, totalPage, nil
|
||||
}
|
||||
|
||||
func GetUserShareCardDateVm(uid uint32) (ShareCardDateVm, error) {
|
||||
func GetUserShareCardDateVmInfo(uid uint32) (ShareCardDateVm, error) {
|
||||
var cardDateVm ShareCardDateVm
|
||||
err := NewShareCardDateVmQuerySet(DB).UidEq(uid).ProvideDateEq(utils.ZeroDateFormat(-1)).One(&cardDateVm)
|
||||
//err := NewShareCardDateVmQuerySet(DB).UidEq(uid).ProvideDateEq(utils.ZeroDateFormat(-1)).One(&cardDateVm)
|
||||
err := NewShareCardDateVmQuerySet(DB).UidEq(uid).OrderDescByID().Limit(1).One(&cardDateVm)
|
||||
if err != nil && err != RecordNotFound {
|
||||
logger.Error("share card date vm err:", err)
|
||||
}
|
||||
|
||||
//count := len(cardDateVms)
|
||||
//var cardDateVm ShareCardDateVm
|
||||
//if count == 2 {
|
||||
// cardDateVm = cardDateVms[1]
|
||||
// cardDateVm.TotalVm += cardDateVms[0].Vm
|
||||
//} else if count == 1 {
|
||||
// cardDateVm = cardDateVms[0]
|
||||
//} else {
|
||||
//
|
||||
//}
|
||||
return cardDateVm, nil
|
||||
}
|
||||
|
||||
type ShareCardRetrieveCreateReq struct {
|
||||
SerialNumbers []string `json:"serial_numbers"`
|
||||
StoreId uint32 `json:"store_id"` // 门店id
|
||||
RetrieveCardType uint32 `json:"retrieve_card_type"`
|
||||
AddressId uint32 `json:"address_id"` // 收货地址
|
||||
Amount uint32 `json:"amount"` // 金额
|
||||
StoreId uint32 `json:"store_id"` // 门店id
|
||||
RetrieveCardType uint32 `json:"retrieve_card_type"` // 1-送到门店 2-邮寄 TODO 修改
|
||||
AddressId uint32 `json:"address_id"` // 收货地址
|
||||
Amount uint32 `json:"amount"` // 金额
|
||||
Uid uint32 `json:"uid"`
|
||||
}
|
||||
|
||||
|
@ -631,7 +707,8 @@ func (m *ShareCardRetrieveCreateReq) RetrieveCreate() (*ShareCardRetrieve, error
|
|||
State: RetrieveStateInCheck,
|
||||
BillSn: userShareCards[i].BillSn,
|
||||
GameCardId: userShareCards[i].GameCardId,
|
||||
RetrieveCardType: m.RetrieveCardType,
|
||||
TransportType: m.RetrieveCardType,
|
||||
//RetrieveCardType: m.RetrieveCardType,
|
||||
GameCardGoodsId: userShareCards[i].GameCardGoodsId,
|
||||
UserShareCardBillId: userShareCards[i].ShareCardBillGameId,
|
||||
StoreId: m.StoreId,
|
||||
|
@ -885,6 +962,9 @@ func CardIssueFeedbackListSetGame(list []CardIssueFeedback) []CardIssueFeedback
|
|||
for i, _ := range list {
|
||||
ids = append(ids, list[i].GameCardId)
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return list
|
||||
}
|
||||
gameMap, err := GameCardMap(ids)
|
||||
if err != nil {
|
||||
logger.Error("set store err:", err)
|
||||
|
|
|
@ -143,7 +143,7 @@ type UserMemberExpireDelay struct {
|
|||
DelayAmount uint32 `json:"delay_amount"`
|
||||
ExpireDays uint32 `json:"expire_days"`
|
||||
DailyFee uint32 `json:"daily_fee"`
|
||||
IsPay uint32 `json:"is_pay"`
|
||||
IsPay uint32 `json:"is_pay"` // 1-已支付
|
||||
}
|
||||
|
||||
func GetUserByUid(uid uint32) *User {
|
||||
|
|
|
@ -203,8 +203,10 @@ func ConfigAppRouter(r gin.IRouter) {
|
|||
shareCard.POST("retrieve_card/detail", controller.ShareCardRetrieveDetail) // 我的共享卡收回详情
|
||||
shareCard.POST("retrieve_card/confirm", controller.ShareCardRetrieveConfirm) // 我的共享卡收回确认
|
||||
|
||||
shareCard.POST("card_issue/add", controller.CardIssueCreate) // 我的共享卡问题反馈
|
||||
shareCard.POST("card_issue/list", controller.CardIssueList) // 我的共享卡问题反馈列表
|
||||
shareCard.POST("card_issue/add", controller.CardIssueCreate) // 我的共享卡问题反馈
|
||||
shareCard.POST("card_issue/cancel", controller.CardIssueCancel) // 我的共享卡问题反馈
|
||||
shareCard.POST("card_issue/list", controller.CardIssueList) // 我的共享卡问题反馈列表
|
||||
shareCard.POST("card_issue/info", controller.CardIssueInfo) // 我的共享卡问题反馈详情
|
||||
|
||||
//shoppingCart.POST("del", controller.ShoppingCartDel) //
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user