-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.go
93 lines (77 loc) · 21.2 KB
/
example.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package main
import (
"encoding/json"
"testing"
"time"
)
func TestApp() {
aid := addressId()
cart := carts()
if len(cart) == 0 {
return
}
reserve := reserveTime(cart["products"], aid)
if len(reserve) == 0 {
return
}
order := checkOrder(aid, cart, reserve)
if len(order) == 0 {
return
}
if submitOrder(aid, cart, order, reserve) {
return
}
}
func TestAppRest(t *testing.T) {
data := []byte(`{"can_used_balance_money":"0.00","can_used_point_money":"0.00","can_used_point_num":0,"cart_count":15,"front_package_bg_color":"#fbfefc","front_package_stock_color":"#2FB157","front_package_text":"即时配送","front_package_type":0,"goods_real_money":"273.20","instant_rebate_money":"0.00","is_presale":0,"is_share_station":0,"only_today_products":[],"only_tomorrow_products":[],"package_id":1,"package_type":2,"total_count":15,"total_money":"273.20","total_origin_money":"273.20","used_balance_money":"0.00","used_point_money":"0.00","used_point_num":0}`)
// t.Log(data)
m := make(map[string]interface{})
err := json.Unmarshal(data, &m)
if err != nil {
t.Fatal(err)
}
data = []byte(`{"cart_count":15,"is_presale":0,"only_tomorrow_products":[],"front_package_type":0,"total_count":15,"goods_real_money":"273.20","can_used_point_num":0,"package_id":1,"front_package_bg_color":"#fbfefc","package_type":2,"can_used_balance_money":"0.00","can_used_point_money":"0.00","is_share_station":0,"total_origin_money":"273.20","used_balance_money":"0.00","only_today_products":[],"instant_rebate_money":"0.00","front_package_stock_color":"#2FB157","front_package_text":"即时配送","used_point_num":0,"total_money":"273.20","used_point_money":"0.00"}`)
// t.Log(data)
m2 := make(map[string]interface{})
err = json.Unmarshal(data, &m2)
if err != nil {
t.Fatal(err)
}
for s := range m {
if _, ok := m2[s]; !ok {
t.Log(s)
}
}
}
func TestProduct(t *testing.T) {
data := `[{"activity_id":"","buy_limit":0,"cart_id":"622aeaee3ef5cb777d65a2be","category_path":"","conditions_num":"","count":2,"delivery_date_tag":"仅今日可配送","description":"","fe":"","id":"622aeaee3ef5cb777d65a2be","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"56,57,675","net_weight":"800","net_weight_unit":"g","no_supplementary_price":"22.90","no_supplementary_total_price":"45.80","order_sort":1,"origin_price":"22.90","parent_batch_type":-1,"parent_id":"","price":"22.90","price_type":0,"product_name":"四川耙耙柑(春见)800G(单果180G以上)","product_type":0,"promotion_num":0,"sale_batcpe":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://imgnew.ddimg.mobi/product/6051f468b5004873971506530581e8d1.jpg?width=800\u0026height=800","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"45.80","total_price":"45.80","type":1,"view_total_weight":"份"},{"activty_id":"","buy_limit":0,"cart_id":"5cd546b97cdbf00b5b7c74e8","category_path":"58f9e574936edfe4568b5789,5e00bc90b0055a0b5b0b388e","conditions_num":"","count":2,"delivery_date_tag":"","description":"","features":"","id":"5cd546b97cdbf00b5b7c74e8","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"201,221,222","net_weight":"3000","net_weight_unit":"ml","no_supplementary_price":"59.90","no_supplementary_total_price":"119.80","order_sort":2,"origin_price":"59.90","parent_batch_type":-1,"parent_id":"","price":"59.90","price_type":0,"product_name":"伊利金典纯牛奶 250ml*12盒/箱","product_type":0on_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://img.ddimg.mobi/product/b755340cdc3281612770704985.jpg?width=800\u0026height=800","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"119.80","total_price":"119.80","type":1,"view_total_weight":"箱"},{"activity_id":"","buy_limit":0,"cart_id":"58ba8ba8936edf5b323c9797","category_path":"58f9e5a1936edf89778b568b,58fb3b89936edfe4568b58ec","conditions_num""","count":2,"delivery_date_tag":"","description":"","features":"","id":"58ba8ba8936edf5b323c9797","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"330,331,333","net_weight":"500","net_weight_unit":"ml","no_supplementary_price":"10.50","no_supplementary_total_price":"21.00","order_sort":3,"origin_price":"10.50","parent_batch_type":-1,"parent_id":"","price":"10.50","price_type":0,"product_name":"海天草菇老抽 500ml/瓶duct_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://ddimg.ddxq.mobi/931627c2e98551524656988081.jpg!maicai.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"21.00","total_price":"21.00","type":1,"view_total_weight":"瓶"},{"activity_id":"","buy_limit":0,"cart_id":"58ba8c02916edf9e4cc23072","category_path":"58f9e5a1936edf89778b568b,58fb3b89936edfe4568b58ec","condition_num":"","count":1,"delivery_date_tag":"","description":"","features":"","id":"58ba8c02916edf9e4cc23072","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"330,331,332","net_weight":"500","net_weight_unit":"ml","no_supplementary_price":"9.90","no_supplementary_total_price":"9.90","order_sort":4,"origin_price":"9.90","parent_batch_type":-1,"parent_id":"","price":"9.90","price_type":0,"product_name":"海天金标生抽酱油 5"product_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://ddimg.ddxq.mobi/879853186f70b1521771055327.jpg!maicai.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"9.90","total_price":"9.90","type":1,"view_total_weight":"瓶"},{"activity_id":"","buy_limit":0,"cart_id":"58b7bc92936edf14323c80f2","category_path":"58f9e5c4936edfe4568b5793,58fb412b936edf42508b45d6","conditins_num":"","count":1,"delivery_date_tag":"","description":"","features":"","id":"58b7bc92936edf14323c80f2","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"567,585,586","net_weight":"500","net_weight_unit":"g","no_supplementary_price":"23.80","no_supplementary_total_price":"23.80","order_sort":5,"origin_price":"23.80","parent_batch_type":-1,"parent_id":"","price":"23.80","price_type":0,"product_name":"冠生园蜂蜜 50,"product_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://ddimg.ddxq.mobi/c320a820c0de21494498061312.jpg!maicai.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"23.80","total_price":"23.80","type":1,"view_total_weight":"瓶"},{"activity_id":"","buy_limit":0,"cart_id":"5f33eae4b0055a3de4293196","category_path":"58f9d213936edfe4568b569a,58fbf49b936edfe6568b5ac5","condtions_num":"","count":1,"delivery_date_tag":"","description":"","features":"","id":"5f33eae4b0055a3de4293196","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"1,1030,1035","net_weight":"250","net_weight_unit":"g","no_supplementary_price":"9.50","no_supplementary_total_price":"9.50","order_sort":6,"origin_price":"9.50","parent_batch_type":-1,"parent_id":"","price":"9.50","price_type":0,"product_name":"【春菜】菠菜苗","product_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://img.ddimg.mobi/product/d598d1a57393d1597238029227.jpg!deliver.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"9.50","total_price":"9.50","type":1,"view_total_weight":"份"},{"activity_id":"","buy_limit":0,"cart_id":"58b7badc916edf004dc1a8ea","category_path":"58f9e5a1936edf89778b568b,58fb3bc1936edfe4568b58f9,"conditions_num":"","count":2,"delivery_date_tag":"","description":"","features":"","id":"58b7badc916edf004dc1a8ea","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"330,340,342","net_weight":"480","net_weight_unit":"ml","no_supplementary_price":"6.90","no_supplementary_total_price":"13.80","order_sort":7,"origin_price":"6.90","parent_batch_type":-1,"parent_id":"","price":"6.90","price_type":0,"product_name":"恒顺葱酒 480ml/瓶","product_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://img.ddimg.mobi/proct/c94595e1f48861548094633542.jpg!deliver.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"13.80","total_price":"13.80","type":1,"view_total_weight":"瓶"},{"activity_id":"","buy_limit":0,"cart_id":"5d5469637cdbf03104725d94","category_path":"59701e80936edf4f38915857,5b0ff8b80675255258bd3de","conditions_num":"","count":2,"delivery_date_tag":"","description":"","features":"","id":"5d5469637cdbf03104725d94","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"536,537,538","net_weight":"160","net_weight_unit":"g","no_supplementary_price":"8.90","no_supplementary_total_price":"17.80","order_sort":8,"origin_price":"8.90","parent_batch_type":-1,"parent_id":"","price":"8.90","price_type":0,"product_name":"洽洽香瓜子 160g/袋","product_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"https://img.ddbi/product/57e7f7c1a30e81577670182657.jpg!deliver.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"17.80","total_price":"17.80","type":1,"view_total_weight":"袋"},{"activity_id":"","buy_limit":0,"cart_id":"5afc36efc0a1eafe018b45c5","category_path":"59701e80936edf4f38915857,5b0ffb806752e55258bd3de","conditions_num":"","count":2,"delivery_date_tag":"","description":"","features":"","id":"5afc36efc0a1eafe018b45c5","instant_rebate_money":"0.00","is_booking":0,"is_bulk":0,"is_gift":0,"is_invoice":1,"is_presale":0,"is_shared_station_product":0,"manage_category_path":"536,537,539","net_weight":"130","net_weight_unit":"g","no_supplementary_price":"5.90","no_supplementary_total_price":"11.80","order_sort":10,"origin_price":"5.90","parent_batch_type":-1,"parent_id":"","price":"5.90","price_type":0,"product_name":"洽洽椒盐花生 130g/袋","product_type":0,"promotion_num":0,"sale_batches":{"batch_type":-1},"size_price":"0.00","sizes":[],"sku_activity_id":"","small_image":"httimg.ddxq.mobi/b2efe787d50731526639597071.jpg!maicai.product.list","storage_value_id":0,"sub_list":[],"supplementary_list":[],"temperature_layer":"","total_origin_price":"11.80","total_price":"11.80","type":1,"view_total_weight":"袋"}]`
t.Log(data)
data = `[{"is_booking":0,"is_shared_station_product":0,"small_image":"https://imgnew.ddimg.mobi/product/6051f468b5004873971506530581e8d1.jpg?width=800&height=800","description":"","sale_batches":{"batch_type":-1},"delivery_date_tag":"仅今日可配送","type":1,"sku_activity_id":"","net_weight":"800","promotion_num":0,"total_origin_money":"45.80","cart_id":"622aeaee3ef5cb777d65a2be","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"22.90","no_supplementary_total_price":"45.80","activity_id":"","id":"622aeaee3ef5cb777d65a2be","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"45.80","count":2,"parent_batch_type":-1,"view_total_weight":"份","product_name":"四川耙耙柑(春见)800G(单果180G以上)","manage_category_path":"56,57,675","buy_limit":0,"total_origin_price":"45.80","product_type":0,"is_gift":0,"no_supplementary_price":"22.90","sub_list":[],"parent_id":"","category_path":"","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":1,"origin_price":"22.90","size_price":"0.00","net_weight_unit":"g","total_money":"45.80"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://img.ddimg.mobi/product/b755340cdc3281612770704985.jpg?width=800&height=800","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"3000","promotion_num":0,"total_origin_money":"119.80","cart_id":"5cd546b97cdbf00b5b7c74e8","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"59.90","no_supplementary_total_price":"119.80","activity_id":"","id":"5cd546b97cdbf00b5b7c74e8","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"119.80","count":2,"parent_batch_type":-1,"view_total_weight":"箱","product_name":"伊利金典纯牛奶 250ml*12盒/箱","manage_category_path":"201,221,222","buy_limit":0,"total_origin_price":"119.80","product_type":0,"is_gift":0,"no_supplementary_price":"59.90","sub_list":[],"parent_id":"","category_path":"58f9e574936edfe4568b5789,5e00bc90b0055a0b5b0b388e","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":2,"origin_price":"59.90","size_price":"0.00","net_weight_unit":"ml","total_money":"119.80"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://ddimg.ddxq.mobi/931627c2e98551524656988081.jpg!maicai.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"500","promotion_num":0,"total_origin_money":"21.00","cart_id":"58ba8ba8936edf5b323c9797","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"10.50","no_supplementary_total_price":"21.00","activity_id":"","id":"58ba8ba8936edf5b323c9797","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"21.00","count":2,"parent_batch_type":-1,"view_total_weight":"瓶","product_name":"海天草菇老抽 500ml/瓶","manage_category_path":"330,331,333","buy_limit":0,"total_origin_price":"21.00","product_type":0,"is_gift":0,"no_supplementary_price":"10.50","sub_list":[],"parent_id":"","category_path":"58f9e5a1936edf89778b568b,58fb3b89936edfe4568b58ec","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":3,"origin_price":"10.50","size_price":"0.00","net_weight_unit":"ml","total_money":"21.00"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://ddimg.ddxq.mobi/879853186f70b1521771055327.jpg!maicai.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"500","promotion_num":0,"total_origin_money":"9.90","cart_id":"58ba8c02916edf9e4cc23072","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"9.90","no_supplementary_total_price":"9.90","activity_id":"","id":"58ba8c02916edf9e4cc23072","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"9.90","count":1,"parent_batch_type":-1,"view_total_weight":"瓶","product_name":"海天金标生抽酱油 500ml/瓶","manage_category_path":"330,331,332","buy_limit":0,"total_origin_price":"9.90","product_type":0,"is_gift":0,"no_supplementary_price":"9.90","sub_list":[],"parent_id":"","category_path":"58f9e5a1936edf89778b568b,58fb3b89936edfe4568b58ec","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":4,"origin_price":"9.90","size_price":"0.00","net_weight_unit":"ml","total_money":"9.90"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://ddimg.ddxq.mobi/c320a820c0de21494498061312.jpg!maicai.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"500","promotion_num":0,"total_origin_money":"23.80","cart_id":"58b7bc92936edf14323c80f2","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"23.80","no_supplementary_total_price":"23.80","activity_id":"","id":"58b7bc92936edf14323c80f2","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"23.80","count":1,"parent_batch_type":-1,"view_total_weight":"瓶","product_name":"冠生园蜂蜜 500g/瓶","manage_category_path":"567,585,586","buy_limit":0,"total_origin_price":"23.80","product_type":0,"is_gift":0,"no_supplementary_price":"23.80","sub_list":[],"parent_id":"","category_path":"58f9e5c4936edfe4568b5793,58fb412b936edf42508b45d6","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":5,"origin_price":"23.80","size_price":"0.00","net_weight_unit":"g","total_money":"23.80"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://img.ddimg.mobi/product/d598d1a57393d1597238029227.jpg!deliver.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"250","promotion_num":0,"total_origin_money":"9.50","cart_id":"5f33eae4b0055a3de4293196","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"9.50","no_supplementary_total_price":"9.50","activity_id":"","id":"5f33eae4b0055a3de4293196","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"9.50","count":1,"parent_batch_type":-1,"view_total_weight":"份","product_name":"【春菜】菠菜苗 250g/份","manage_category_path":"1,1030,1035","buy_limit":0,"total_origin_price":"9.50","product_type":0,"is_gift":0,"no_supplementary_price":"9.50","sub_list":[],"parent_id":"","category_path":"58f9d213936edfe4568b569a,58fbf49b936edfe6568b5ac5","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":6,"origin_price":"9.50","size_price":"0.00","net_weight_unit":"g","total_money":"9.50"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://img.ddimg.mobi/product/c94595e1f48861548094633542.jpg!deliver.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"480","promotion_num":0,"total_origin_money":"13.80","cart_id":"58b7badc916edf004dc1a8ea","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"6.90","no_supplementary_total_price":"13.80","activity_id":"","id":"58b7badc916edf004dc1a8ea","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"13.80","count":2,"parent_batch_type":-1,"view_total_weight":"瓶","product_name":"恒顺葱姜料酒 480ml/瓶","manage_category_path":"330,340,342","buy_limit":0,"total_origin_price":"13.80","product_type":0,"is_gift":0,"no_supplementary_price":"6.90","sub_list":[],"parent_id":"","category_path":"58f9e5a1936edf89778b568b,58fb3bc1936edfe4568b58f9","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":7,"origin_price":"6.90","size_price":"0.00","net_weight_unit":"ml","total_money":"13.80"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://img.ddimg.mobi/product/57e7f7c1a30e81577670182657.jpg!deliver.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"160","promotion_num":0,"total_origin_money":"17.80","cart_id":"5d5469637cdbf03104725d94","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"8.90","no_supplementary_total_price":"17.80","activity_id":"","id":"5d5469637cdbf03104725d94","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"17.80","count":2,"parent_batch_type":-1,"view_total_weight":"袋","product_name":"洽洽香瓜子 160g/袋","manage_category_path":"536,537,538","buy_limit":0,"total_origin_price":"17.80","product_type":0,"is_gift":0,"no_supplementary_price":"8.90","sub_list":[],"parent_id":"","category_path":"59701e80936edf4f38915857,5b0ff8b806752e55258bd3de","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":8,"origin_price":"8.90","size_price":"0.00","net_weight_unit":"g","total_money":"17.80"},{"is_booking":0,"is_shared_station_product":0,"small_image":"https://ddimg.ddxq.mobi/b2efe787d50731526639597071.jpg!maicai.product.list","description":"","sale_batches":{"batch_type":-1},"type":1,"sku_activity_id":"","net_weight":"130","promotion_num":0,"total_origin_money":"11.80","cart_id":"5afc36efc0a1eafe018b45c5","instant_rebate_money":"0.00","temperature_layer":"","is_bulk":0,"sizes":[],"price":"5.90","no_supplementary_total_price":"11.80","activity_id":"","id":"5afc36efc0a1eafe018b45c5","is_invoice":1,"is_presale":0,"supplementary_list":[],"total_price":"11.80","count":2,"parent_batch_type":-1,"view_total_weight":"袋","product_name":"洽洽椒盐花生 130g/袋","manage_category_path":"536,537,539","buy_limit":0,"total_origin_price":"11.80","product_type":0,"is_gift":0,"no_supplementary_price":"5.90","sub_list":[],"parent_id":"","category_path":"59701e80936edf4f38915857,5b0ff8b806752e55258bd3de","storage_value_id":0,"conditions_num":"","price_type":0,"order_sort":10,"origin_price":"5.90","size_price":"0.00","net_weight_unit":"g","total_money":"11.80"}]`
t.Log(data)
}
func TestTimed() {
aid := addressId()
if aid == "" {
return
}
ticker := time.NewTicker(20 * time.Minute)
ch := make(chan struct{})
go func() {
for {
select {
case <-ticker.C:
cart := carts()
if len(cart) != 0 {
reserve := reserveTime(cart["products"], aid)
if len(reserve) != 0 {
if submitOrder(aid, cart, checkOrder(aid, cart, reserve), reserve) {
ch <- struct{}{}
return
}
}
}
}
}
}()
<-ch
}