- save original price when accepted or rejected.
This commit is contained in:
@@ -1103,7 +1103,7 @@ func GetStoreOpRequests(ctx *jxcontext.Context, fromTime, toTime time.Time, keyw
|
|||||||
SELECT SQL_CALC_FOUND_ROWS
|
SELECT SQL_CALC_FOUND_ROWS
|
||||||
t1.id, t1.created_at, t1.updated_at, t1.last_operator, t1.deleted_at,
|
t1.id, t1.created_at, t1.updated_at, t1.last_operator, t1.deleted_at,
|
||||||
t1.type, t1.store_id, t1.item_id, t1.status, t1.user_id, t1.int_param1, t1.int_param2, t1.remark,
|
t1.type, t1.store_id, t1.item_id, t1.status, t1.user_id, t1.int_param1, t1.int_param2, t1.remark,
|
||||||
t2.name store_name, t3.prefix sku_name_prefix, t3.name sku_name_name, MAX(t5.unit_price) unit_price
|
t2.name store_name, t3.prefix sku_name_prefix, t3.name sku_name_name, MAX(IF(t1.status = ?, t5.unit_price, t1.int_param0)) unit_price
|
||||||
FROM store_op_request t1
|
FROM store_op_request t1
|
||||||
JOIN store t2 ON t1.store_id = t2.id
|
JOIN store t2 ON t1.store_id = t2.id
|
||||||
JOIN sku_name t3 ON t1.item_id = t3.id
|
JOIN sku_name t3 ON t1.item_id = t3.id
|
||||||
@@ -1111,6 +1111,7 @@ func GetStoreOpRequests(ctx *jxcontext.Context, fromTime, toTime time.Time, keyw
|
|||||||
LEFT JOIN store_sku_bind t5 ON t1.store_id = t5.store_id AND t4.id = t5.sku_id AND t5.deleted_at = ?
|
LEFT JOIN store_sku_bind t5 ON t1.store_id = t5.store_id AND t4.id = t5.sku_id AND t5.deleted_at = ?
|
||||||
WHERE 1 = 1`
|
WHERE 1 = 1`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
|
model.RequestStatusNew,
|
||||||
utils.DefaultTimeValue,
|
utils.DefaultTimeValue,
|
||||||
}
|
}
|
||||||
if keyword != "" {
|
if keyword != "" {
|
||||||
@@ -1213,6 +1214,10 @@ func changeStoreOpStatus(ctx *jxcontext.Context, reqIDs []int, status int8, reje
|
|||||||
globals.SugarLogger.Debugf("changeStoreOpStatus, reqIDs:%v", reqIDs)
|
globals.SugarLogger.Debugf("changeStoreOpStatus, reqIDs:%v", reqIDs)
|
||||||
if globals.EnablePendingChange {
|
if globals.EnablePendingChange {
|
||||||
if len(reqIDs) > 0 {
|
if len(reqIDs) > 0 {
|
||||||
|
infoMap, err2 := getStoreOpRequestsInfo(reqIDs)
|
||||||
|
if err = err2; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
defer dao.Rollback(db)
|
defer dao.Rollback(db)
|
||||||
@@ -1220,11 +1225,14 @@ func changeStoreOpStatus(ctx *jxcontext.Context, reqIDs []int, status int8, reje
|
|||||||
op := &model.StoreOpRequest{}
|
op := &model.StoreOpRequest{}
|
||||||
op.Remark = rejectReason
|
op.Remark = rejectReason
|
||||||
op.Status = status
|
op.Status = status
|
||||||
|
if infoMap[reqID] != nil {
|
||||||
|
op.IntParam0 = infoMap[reqID].UnitPrice
|
||||||
|
}
|
||||||
dao.WrapUpdateULEntity(op, ctx.GetUserName())
|
dao.WrapUpdateULEntity(op, ctx.GetUserName())
|
||||||
op.DeletedAt = time.Now()
|
op.DeletedAt = time.Now()
|
||||||
op.ID = reqID
|
op.ID = reqID
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(op, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(op, false))
|
||||||
if _, err = dao.UpdateEntity(db, op, "Remark", "Status", "DeletedAt", "LastOperator", "UpdatedAt"); err != nil {
|
if _, err = dao.UpdateEntity(db, op, "IntParam0", "Remark", "Status", "DeletedAt", "LastOperator", "UpdatedAt"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ type StoreOpRequest struct {
|
|||||||
ItemID int `orm:"column(item_id)" json:"itemID"` // 这个根据type不同,可能是SKUNAME ID或SKU ID
|
ItemID int `orm:"column(item_id)" json:"itemID"` // 这个根据type不同,可能是SKUNAME ID或SKU ID
|
||||||
Status int8 `json:"status"`
|
Status int8 `json:"status"`
|
||||||
UserID string `orm:"size(48);column(user_id)" json:"userID"`
|
UserID string `orm:"size(48);column(user_id)" json:"userID"`
|
||||||
|
IntParam0 int `json:"intParam0"` // 表示原价
|
||||||
IntParam1 int `json:"intParam1"`
|
IntParam1 int `json:"intParam1"`
|
||||||
IntParam2 int `json:"intParam2"`
|
IntParam2 int `json:"intParam2"`
|
||||||
JsonParam string `orm:"size(3000)" json:"jsonParam"`
|
JsonParam string `orm:"size(3000)" json:"jsonParam"`
|
||||||
|
|||||||
Reference in New Issue
Block a user