aa
This commit is contained in:
@@ -340,71 +340,73 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) {
|
||||
)
|
||||
resultMap = make(map[int]int)
|
||||
user, _ := dao.GetUserByID(db, "user_id", userID)
|
||||
if user.BindStoreID != "" {
|
||||
for _, v := range strings.Split(user.BindStoreID, ",") {
|
||||
resultMap[utils.Str2Int(v)] = utils.Str2Int(v)
|
||||
if user != nil {
|
||||
if user.BindStoreID != "" {
|
||||
for _, v := range strings.Split(user.BindStoreID, ",") {
|
||||
resultMap[utils.Str2Int(v)] = utils.Str2Int(v)
|
||||
}
|
||||
return resultMap, err
|
||||
}
|
||||
} else {
|
||||
userRoles, err2 := dao.GetUserRole2(db, []string{userID}, nil)
|
||||
err = err2
|
||||
for _, v := range userRoles {
|
||||
var (
|
||||
brandIDs, cityCodes, storeIDs []int
|
||||
)
|
||||
// if _, ok := brandIDMap[v.BrandID]; !ok {
|
||||
// brandIDMap[v.BrandID] = 1
|
||||
// }
|
||||
// if v.CityCodes != "" {
|
||||
// for _, cityCode := range jxutils.StrListToIntList(strings.Split(v.CityCodes, ",")) {
|
||||
// if _, ok := cityCodeMap[cityCode]; !ok {
|
||||
// cityCodeMap[cityCode] = 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if v.StoreIDs != "" {
|
||||
// for _, storeID := range jxutils.StrListToIntList(strings.Split(v.StoreIDs, ",")) {
|
||||
// if _, ok := storeIDMap[storeID]; !ok {
|
||||
// storeIDMap[storeID] = 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if v.CityCodes == "" && v.StoreIDs == "" {
|
||||
continue
|
||||
}
|
||||
if v.BrandID != 0 {
|
||||
brandIDs = append(brandIDs, v.BrandID)
|
||||
}
|
||||
if v.CityCodes != "0" && v.CityCodes != "" {
|
||||
cityCodes = append(cityCodes, jxutils.StrListToIntList(strings.Split(v.CityCodes, ","))...)
|
||||
}
|
||||
if v.StoreIDs != "" {
|
||||
storeIDs = append(storeIDs, jxutils.StrListToIntList(strings.Split(v.StoreIDs, ","))...)
|
||||
}
|
||||
if stores, err := dao.GetStoreList(db, storeIDs, cityCodes, nil, brandIDs, nil, ""); len(stores) > 0 && err == nil {
|
||||
for _, v := range stores {
|
||||
resultMap[v.ID] = v.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
// for k, _ := range brandIDMap {
|
||||
// brandIDs = append(brandIDs, k)
|
||||
// }
|
||||
// for k, _ := range cityCodeMap {
|
||||
// cityCodes = append(cityCodes, k)
|
||||
// }
|
||||
// for k, _ := range storeIDMap {
|
||||
// storeIDs = append(storeIDs, k)
|
||||
// }
|
||||
// if stores1, err := dao.GetStoreList(db, nil, nil, brandIDs, nil, nil, ""); len(stores1) > 0 && err == nil {
|
||||
// stores = append(stores, stores1...)
|
||||
// }
|
||||
// if stores2, err := dao.GetStoreList(db, nil, cityCodes, nil, nil, nil, ""); len(stores2) > 0 && err == nil {
|
||||
// stores = append(stores, stores2...)
|
||||
// }
|
||||
// if stores3, err := dao.GetStoreList(db, storeIDs, nil, nil, nil, nil, ""); len(stores3) > 0 && err == nil {
|
||||
// stores = append(stores, stores3...)
|
||||
// }
|
||||
}
|
||||
userRoles, err2 := dao.GetUserRole2(db, []string{userID}, nil)
|
||||
err = err2
|
||||
for _, v := range userRoles {
|
||||
var (
|
||||
brandIDs, cityCodes, storeIDs []int
|
||||
)
|
||||
// if _, ok := brandIDMap[v.BrandID]; !ok {
|
||||
// brandIDMap[v.BrandID] = 1
|
||||
// }
|
||||
// if v.CityCodes != "" {
|
||||
// for _, cityCode := range jxutils.StrListToIntList(strings.Split(v.CityCodes, ",")) {
|
||||
// if _, ok := cityCodeMap[cityCode]; !ok {
|
||||
// cityCodeMap[cityCode] = 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if v.StoreIDs != "" {
|
||||
// for _, storeID := range jxutils.StrListToIntList(strings.Split(v.StoreIDs, ",")) {
|
||||
// if _, ok := storeIDMap[storeID]; !ok {
|
||||
// storeIDMap[storeID] = 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if v.CityCodes == "" && v.StoreIDs == "" {
|
||||
continue
|
||||
}
|
||||
if v.BrandID != 0 {
|
||||
brandIDs = append(brandIDs, v.BrandID)
|
||||
}
|
||||
if v.CityCodes != "0" && v.CityCodes != "" {
|
||||
cityCodes = append(cityCodes, jxutils.StrListToIntList(strings.Split(v.CityCodes, ","))...)
|
||||
}
|
||||
if v.StoreIDs != "" {
|
||||
storeIDs = append(storeIDs, jxutils.StrListToIntList(strings.Split(v.StoreIDs, ","))...)
|
||||
}
|
||||
if stores, err := dao.GetStoreList(db, storeIDs, cityCodes, nil, brandIDs, nil, ""); len(stores) > 0 && err == nil {
|
||||
for _, v := range stores {
|
||||
resultMap[v.ID] = v.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
// for k, _ := range brandIDMap {
|
||||
// brandIDs = append(brandIDs, k)
|
||||
// }
|
||||
// for k, _ := range cityCodeMap {
|
||||
// cityCodes = append(cityCodes, k)
|
||||
// }
|
||||
// for k, _ := range storeIDMap {
|
||||
// storeIDs = append(storeIDs, k)
|
||||
// }
|
||||
// if stores1, err := dao.GetStoreList(db, nil, nil, brandIDs, nil, nil, ""); len(stores1) > 0 && err == nil {
|
||||
// stores = append(stores, stores1...)
|
||||
// }
|
||||
// if stores2, err := dao.GetStoreList(db, nil, cityCodes, nil, nil, nil, ""); len(stores2) > 0 && err == nil {
|
||||
// stores = append(stores, stores2...)
|
||||
// }
|
||||
// if stores3, err := dao.GetStoreList(db, storeIDs, nil, nil, nil, nil, ""); len(stores3) > 0 && err == nil {
|
||||
// stores = append(stores, stores3...)
|
||||
// }
|
||||
return resultMap, err
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
// 审核售后单申请
|
||||
func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.AfsOrder, approveType int, reason string) (err error) {
|
||||
func (c *PurchaseHandler) Refund(ctx *jxcontext.Context, order *model.AfsOrder, approveType int, reason string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ func Init() {
|
||||
// orm.RegisterDataBase(aliasName, driverName, dataSource, params)
|
||||
orm.RegisterDataBase("default", "mysql", web.AppConfig.DefaultString("dbConnectStr", ""))
|
||||
orm.RegisterDataBase("c4beta", "mysql", "ubuntu:WebServer@1@tcp(111.231.218.230:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true")
|
||||
orm.RegisterDataBase("api", "mysql", "root:WebServer@1@tcp(127.0.0.1:3306)/api?charset=utf8mb4&loc=Local&parseTime=true")
|
||||
|
||||
orm.RegisterModel(new(legacymodel.Config))
|
||||
orm.RegisterModel(new(legacymodel.BlackClient))
|
||||
orm.RegisterModel(new(legacymodel.JxBadComments))
|
||||
|
||||
Reference in New Issue
Block a user