Browse Source

修改方法参数

master v0.2.1
guzeng 2 years ago
parent
commit
9a0eabaa50
2 changed files with 16 additions and 17 deletions
  1. +1
    -1
      client.go
  2. +15
    -16
      client_test.go

+ 1
- 1
client.go View File

@ -55,7 +55,7 @@ func Create(site_id, dbname string, data map[string]string, url ...string) (*Ord
}
func CreateByCart(dbname, site_id string, data map[string]interface{}, url ...string) (*OrderCreateRes, error) {
func CreateByCart(site_id, dbname string, data map[string]interface{}, url ...string) (*OrderCreateRes, error) {
if dbname == "" || len(data) < 1 {
return nil, errors.New("参数错误")


+ 15
- 16
client_test.go View File

@ -4,22 +4,21 @@ import (
"testing"
)
func Test_Create(t *testing.T) {
func Test_CreateByCart(t *testing.T) {
// products := []map[string]string{
// map[string]string{
// "product_id": "18",
// "sku_id": "6",
// "quantity": "3",
// },
// map[string]string{
// "product_id": "6",
// "sku_id": "7",
// "quantity": "2",
// },
// }
data := map[string]string{
"product_id": "19",
products := []map[string]string{
map[string]string{
"product_id": "19",
"sku_id": "6",
"quantity": "3",
},
map[string]string{
"product_id": "26",
"quantity": "4",
},
}
data := map[string]interface{}{
"product": products,
"name": "5BC02AB31C",
"mobile": "326598744",
"user_id": "2",
@ -28,7 +27,7 @@ func Test_Create(t *testing.T) {
"sku_id": "5",
}
ret, err := Create("100064", "shop_v2", data)
ret, err := CreateByCart("100064", "shop_v2", data)
t.Log(ret)
t.Log(err)


Loading…
Cancel
Save