This commit is contained in:
邹宗楠
2022-08-25 09:50:52 +08:00
parent a3ea6de99d
commit a84ad79665
2 changed files with 10 additions and 6 deletions

View File

@@ -1,15 +1,19 @@
package dao
import (
"testing"
"encoding/json"
"git.rosy.net.cn/baseapi/utils"
"testing"
)
func TestGetUsers(t *testing.T) {
userList, _, err := GetUsers(GetDB(), 0, "", nil, nil, []string{"18180948107"}, 0, 0)
if err != nil {
aa := `{"allSkuCount":"9","allSkuTypeCount":"9","appId":"1000","businessType":"1","buyerComment":"用户备注","consigneeAddress":"四川省成都市某个地方","consigneeMobile":"13812345678","consigneeName":"用户姓名","eBaiOrderNo":"京西菜市","eBailCode":"","officialName":"京西菜市","orderNo":"901234567890123","orderStatus":"110","payOrderTime":"2018-07-17 22:33:35","qRCOrder":"901234567890123","riderName":"任晏梅","riderPhone":"17882902891,5073","riderVendorId":"102","skuList":"[{"skuName":"小葱约50g/份","skuCount":"X1","salePrice":"1","totalCountPrice":"¥0.01","upc":""},{"skuName":"胡萝卜约300g/份","skuCount":"X1","salePrice":"300","totalCountPrice":"¥3.00","upc":""},{"skuName":"娃娃菜200g/个","skuCount":"X1","salePrice":"300","totalCountPrice":"¥3.00","upc":""},{"skuName":"豌豆米-手工剥豆约100g/份","skuCount":"X1","salePrice":"400","totalCountPrice":"¥4.00","upc":""},{"skuName":"紫薯约300g/份","skuCount":"X1","salePrice":"400","totalCountPrice":"¥4.00","upc":""},{"skuName":"鲜鸡蛋约250g/份","skuCount":"X1","salePrice":"100","totalCountPrice":"¥1.00","upc":""},{"skuName":"[冻]鸡胸肉约200g/份","skuCount":"X1","salePrice":"980","totalCountPrice":"¥9.80","upc":""},{"skuName":"[优]猪肉馅约250g/份","skuCount":"X1","salePrice":"790","totalCountPrice":"¥7.90","upc":""},{"skuName":"[新鲜]新土豆约500g/份","skuCount":"X1","salePrice":"100","totalCountPrice":"¥1.00","upc":""}]","storeName":"京西菜市-测试门店","storeTel":"13688039650","trySendTime":"2018-07-18 11:30:00","userPayMoney":"0","vendOrID":"0","vendorName":"京东到家","vendorOrderNo":"2"}`
conte := make(map[string]string, 0)
if err := json.Unmarshal([]byte(aa), conte); err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(userList, false))
t.Log(utils.Format4Output(conte, false))
}

View File

@@ -345,7 +345,7 @@ func (c *ApiController) DoPrint(dataMap map[string]interface{}) (data, errCode s
content = dataMap[keyContent].(string)
// 打印文件转结构体
contentMap := make(map[string]string)
if err := json.Unmarshal([]byte(content), contentMap); err != nil {
if err := json.Unmarshal([]byte(content), &contentMap); err != nil {
globals.SugarLogger.Debugf("json.Unmarshal 1 err := %v", err)
return "", model.ErrCodeGeneralFailed, err
}