Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop

This commit is contained in:
richboo111
2022-11-16 09:52:12 +08:00
4 changed files with 63 additions and 17 deletions

View File

@@ -1564,20 +1564,28 @@ func GetStoreBrandInfos(storeID int) (date *BrandInfos, err error) {
return detail, err
}
var FreightTemplateMap = make(map[int]*model.FreightTemplate)
// 查询FreightTemplate
func QueryStoreBindInfo(storeID int) (*model.FreightTemplate, error) {
if storeID == model.NO {
return nil, errors.New("storeId 不能为0")
}
if _, ok := FreightTemplateMap[storeID]; ok {
return FreightTemplateMap[storeID], nil
}
var (
sqlParams []interface{}
bindInfo *model.FreightTemplate
)
sql := "SELECT a.store_id,a.vendor_store_id,a.template_id,a.warehouse_id,a.fence_id,a.trade_limit_id FROM freight_template a "
if storeID != 0 {
sql += "WHERE store_id = ? "
sqlParams = append(sqlParams, storeID)
}
if err := GetRow(GetDB(), &bindInfo, sql, sqlParams); err != nil {
sql := "SELECT a.* FROM freight_template a "
sql += "WHERE a.store_id = ? "
sqlParams = append(sqlParams, storeID)
if err := GetRow(GetDB(), &bindInfo, sql, sqlParams...); err != nil {
return nil, err
}
FreightTemplateMap[storeID] = bindInfo
return bindInfo, nil
}