tomap
This commit is contained in:
@@ -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
|
||||
value := reflect.ValueOf(actual)
|
||||
if value.Kind() != reflect.Slice && value.Kind() != reflect.Array {
|
||||
if value.Kind() != reflect.Map {
|
||||
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++ {
|
||||
res = append(res, value.Index(i).Interface().(string))
|
||||
}
|
||||
return res, nil
|
||||
return temp, nil
|
||||
}
|
||||
|
||||
@@ -1528,7 +1528,7 @@ func (c *StoreController) CreateDDStoreFence() {
|
||||
return nil, "", err
|
||||
} else {
|
||||
for k, v := range temp {
|
||||
info[i] = map[string]string{utils.Int2Str(k): v}
|
||||
info[i] = map[string]string{k: v}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user