Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-08-05 15:13:44 +08:00
10 changed files with 95 additions and 24 deletions

View File

@@ -85,8 +85,9 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
"actStatusName": model.ActStatusName,
"actCreateTypeName": model.ActCreateTypeName,
"storeAuditStatusName": model.StoreAuditStatusName,
"configTypeList": model.ConfigTypeList,
"configTypeName": model.ConfigTypeName,
"autoSaleAt": "20:45:00",
"userTypeName": model.UserTypeName,
},
}
Init()
@@ -200,7 +201,7 @@ func SendMsg2Somebody(ctx *jxcontext.Context, mobileNum, verifyCode, msgType, ms
return err
}
func checkConfig(configType, value string) (err error) {
func checkConfig(configType, key, value string) (err error) {
switch configType {
case model.ConfigTypePricePack:
if value != "" {
@@ -211,18 +212,18 @@ func checkConfig(configType, value string) (err error) {
}
case model.ConfigTypeBank:
if value != "" {
if model.BankName[value] == "" {
err = fmt.Errorf("银行代码:%s不支持请联系开发", value)
if model.BankName[key] == "" {
err = fmt.Errorf("银行代码:%s不支持请联系开发", value)
}
}
default:
err = fmt.Errorf("当前只支持配置:%s, 传入的配置类型:%s", utils.Format4Output(model.ConfigTypeList, true), configType)
err = fmt.Errorf("当前只支持配置:%s, 传入的配置类型:%s", utils.Format4Output(model.ConfigTypeName, true), configType)
}
return err
}
func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error) {
if err = checkConfig(configType, value); err != nil {
if err = checkConfig(configType, key, value); err != nil {
return err
}
@@ -237,7 +238,7 @@ func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error
}
func DeleteConfig(ctx *jxcontext.Context, key, configType string) (err error) {
if err = checkConfig(configType, ""); err != nil {
if err = checkConfig(configType, key, ""); err != nil {
return err
}
switch configType {
@@ -266,7 +267,7 @@ func UpdateConfig(ctx *jxcontext.Context, key, configType, value string) (err er
if key == "" {
return fmt.Errorf("修改配置必须给定key")
}
if err = checkConfig(configType, value); err != nil {
if err = checkConfig(configType, key, value); err != nil {
return err
}

View File

@@ -51,7 +51,7 @@ type StoreSkuExt struct {
SubStoreID int `orm:"column(sub_store_id)" json:"subStoreID"`
BindPrice int `json:"price"` // 单位为分不用int64的原因是这里不需要累加
UnitPrice int `json:"unitPrice"` // 这个是一斤的门店商品价放在这里的原因是避免额外增加一张store sku_name表逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致
BindStatus int `json:"storeSkuStatus"`
StoreSkuStatus int `json:"storeSkuStatus"`
EbaiID int64 `orm:"column(ebai_id);index" json:"ebaiID"`
MtwmID int64 `orm:"column(mtwm_id)" json:"mtwmID"` // 这个也不是必须的只是为了DAO取数据语句一致

View File

@@ -298,22 +298,28 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler != nil {
updateList = append(updateList, calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
} else {
isAddedStock := false
if model.IsSyncStatusPrice(sku.StoreSkuSyncStatus) {
bareSku = storeSkuSyncInfo2Bare(calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
priceList = append(priceList, bareSku)
}
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler == nil {
if bareSku == nil {
bareSku = storeSkuSyncInfo2Bare(sku)
}
stockList = append(stockList, bareSku)
}
// if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler == nil {
// if bareSku == nil {
// bareSku = storeSkuSyncInfo2Bare(sku)
// }
// stockList = append(stockList, bareSku)
// isAddedStock = true
// }
if model.IsSyncStatusSale(sku.StoreSkuSyncStatus) {
if bareSku == nil {
bareSku = storeSkuSyncInfo2Bare(sku)
}
if sku.MergedStatus == model.SkuStatusNormal {
onlineList = append(onlineList, bareSku)
if !isAddedStock {
stockList = append(stockList, bareSku)
isAddedStock = true
}
} else {
offlineList = append(offlineList, bareSku)
}

View File

@@ -152,3 +152,7 @@ func OnDingDingMsg(msg map[string]interface{}) (callbackResponse *dingdingapi.Ca
}
return api.DingDingAPI.Err2CallbackResponse(nil)
}
func GetUsers(ctx *jxcontext.Context, userType int, userID2, mobile, userName string) (userList []*model.User, err error) {
return dao.GetUsers(dao.GetDB(), userType, userID2, mobile, userName)
}