This commit is contained in:
richboo111
2022-11-22 14:32:43 +08:00
parent 0d9ecc1ae3
commit b326b1d491
2 changed files with 6 additions and 4 deletions

View File

@@ -1100,14 +1100,16 @@ func (p *PurchaseHandler) GetSkus(ctx *jxcontext.Context, vendorOrgCode string,
//以下为辅助函数 //以下为辅助函数
func ToMap(actual interface{}) ([]string, error) { func ToMap(actual interface{}) (map[string]string, error) {
var res []string var res []string
value := reflect.ValueOf(actual) value := reflect.ValueOf(actual)
if value.Kind() != reflect.Slice && value.Kind() != reflect.Array { if value.Kind() != reflect.Map {
return nil, errors.New("parse error") return nil, errors.New("parse error")
} }
temp := actual.(map[string]string)
globals.SugarLogger.Debugf("toMap temp===============%v", temp)
for i := 0; i < value.Len(); i++ { for i := 0; i < value.Len(); i++ {
res = append(res, value.Index(i).Interface().(string)) res = append(res, value.Index(i).Interface().(string))
} }
return res, nil return temp, nil
} }

View File

@@ -1528,7 +1528,7 @@ func (c *StoreController) CreateDDStoreFence() {
return nil, "", err return nil, "", err
} else { } else {
for k, v := range temp { for k, v := range temp {
info[i] = map[string]string{utils.Int2Str(k): v} info[i] = map[string]string{k: v}
} }
} }
} }