This commit is contained in:
richboo111
2023-03-28 14:39:41 +08:00
9 changed files with 124 additions and 14 deletions

View File

@@ -29,13 +29,13 @@ func init() {
// api = New("62289", "d3ec2358d6a819ea")
// 京西菜市
api = New("34665", "c3db75b754ea2d89")
//api = New("34665", "c3db75b754ea2d89")
//菜市测试
// api = New("62923", "aa4cdc6c1108486b")
// 京西果园
//api = New("35957", "10013fbb7c2ddad7")
api = New("35957", "10013fbb7c2ddad7")
// api.SetCookie("PASSPORT_DELIMONT_TOKEN", "PBE_2.0_5cd1c6141c127d4188f026ac01fc93656266683e8dfb3127c2fdf894259e9034125ff3bdd2a997a385802ee3ef1802ba93a04acea34fde2d2b6e802c5dcd4ec6e3f4ad909a1d806e3ceeb349ed726b03d60ed1fe7010d4140aa338d9c5f05e3fec172c78d3d7f0ca579d61b7015af1bf99aa46b04d2b8a64aa50646dc09afe94b6b60e0ba9a933635db5e8b2a035e9b6d693b289acf1b256d5b9a3f8478c87b0b009115bfd1394f20bb5a0dc2c07b8d013a25f286ec6bf7f2d86010d65507e31358834b7a6b58fbd88cb3f1a12cf71c997b91c1527f6f3c10693f7c2bd6073da8633a98cd2dc1114dfa5be5ee0e60b02cf7e4a94d0fb563a8c01717e7c050f02249117219c07a2eb211577c208ba77f4d536fa25139bc249be93b38d6fc495ef67a32aa206835d177db402bc534de1d29caf4f6b4fbcd912c13f167d00d1732222744c336a5189728f72fb5e153c4b1164171cfb0c811f34f4c2fedd43f721b8706b43f8d631251c")
//api.SetCookie("WMUSS", "NTE2NDMTAwMDAyNzYxNzAwOTEyTmUzNWJNcDlQ ")
//api.SetCookie("WMSTOKEN", "NTE2NDMTAwMDAyNzYxNzAwOTEyTmUzNWJNcDlQ ")

View File

@@ -1,13 +1,14 @@
package ebaiapi
import (
"fmt"
"testing"
"git.rosy.net.cn/baseapi/utils"
)
func TestOrderGet(t *testing.T) {
result, err := api.OrderGet("4013840036319612596")
result, err := api.OrderGet("4055150105296238277")
if err != nil {
t.Fatal(err)
} else {
@@ -165,3 +166,83 @@ func TestAggrent(t *testing.T) {
t.Fatal(err)
}
}
func TestForAA(t *testing.T) {
var a = []int64{6044969,
6043622,
6044971,
6042562,
31728,
31729,
32143,
32142,
6043605,
6043604,
6042743,
30226,
30225,
6043959,
6043960,
6042349,
6042296,
31882,
31871,
6042704,
6039499,
30415,
30414,
32364,
32363,
6043603,
6043602,
30224,
30223,
6042284,
30215,
30214,
6039424,
31235,
30368,
30370,
30369,
30183,
30182,
6042733,
6042737,
30237,
30236,
6042287,
30213,
6042288,
30233,
30207,
30206,
30190,
30189,
6042167,
6042166,
30413}
var cc = ""
for _, v := range a {
if v != 30413 {
cc += utils.Int64ToStr(v) + ","
}
cc += utils.Int64ToStr(v)
}
fmt.Println(cc)
}
func TestOnline(t *testing.T) {
fmt.Println(0&(2|4|32) != 0)
fmt.Println(MergeStoreStatus(-2, 1))
}
// 合并得到最终的门店状态
func MergeStoreStatus(status int, vendorStatus int) int {
if status < vendorStatus {
return status
}
return vendorStatus
}

View File

@@ -2,6 +2,7 @@ package jdapi
import (
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"regexp"
"strings"
@@ -799,6 +800,8 @@ func (a *API) GetSkuCategoryBySkuName(productName string) (*GetSkuCategoryBySkuN
"productName": productName,
"fields": []string{"category"},
}, nil, nil, nil)
globals.SugarLogger.Debugf("GetSkuCategoryBySkuName :%s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("err :%v", err)
if err != nil {
return nil, err
}

View File

@@ -35,7 +35,7 @@ func TestChangeShopCategoryOrder(t *testing.T) {
}
func TestGetSkuCategoryByName(t *testing.T) {
data, err := api.GetSkuCategoryBySkuName("九龙醉 42度 浓香型 白贴九龙白酒")
data, err := api.GetSkuCategoryBySkuName("胡萝卜")
globals.SugarLogger.Debugf("data:=%s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("data:=%v", err)
}

View File

@@ -172,6 +172,7 @@ func (a *API) GetPrinterStatus(printNo string) (status int64, err error) {
}
func (a *API) DoPrint(printNo, content string, orderNo int) (msgID string, err error) {
content = utils.FilterMb4(content)
result, err := a.AccessAPI("DoPrint", map[string]interface{}{
"print_no": printNo,
"content": content,

View File

@@ -131,6 +131,7 @@ type RetailDiscountActData struct {
Stock int `json:"stock,omitempty"` // 当日剩余活动商品数量。只有当发起查询时间处于活动生效时段内时(start_time、end_time、period、weeks_time均需满足),该字段才代表实际剩余活动商品数量,否则显示的是创建活动时规定的当日活动库存
Status int `json:"status,omitempty"` // 活动状态0:已过期1:已生效2:待生效。
Name string `json:"name,omitempty"`
SkuId string `json:"sku_id"` // 京西商品id
}
type RetailDiscountActResult struct {
@@ -397,6 +398,7 @@ func (a *API) RetailDiscountList(poiCode string, actType int) (actList []*Retail
actType = RetailActTypeDirectDown
}
for {
result, err := a.AccessAPI("act/retail/discount/list", true, map[string]interface{}{
KeyAppPoiCode: poiCode,
"act_type": actType,
@@ -441,7 +443,7 @@ func (a *API) RetailDiscountDelete2(poiCode string, actType int, actIDList []str
return failedList, err
}
func (a *API) RetailDiscountDelete(poiCode string, actType int, actIDList []string) (err error) {
func (a *API) RetailiscountDelete(poiCode string, actType int, actIDList []string) (err error) {
_, err = a.RetailDiscountDelete2(poiCode, actType, actIDList)
return err
}

View File

@@ -1,6 +1,7 @@
package mtwmapi
import (
"git.rosy.net.cn/jx-callback/globals"
"testing"
"time"
@@ -154,18 +155,14 @@ func TestRetailDiscountBatchSave(t *testing.T) {
}
func TestRetailDiscountList(t *testing.T) {
result, err := api.RetailDiscountList("8040309", RetailActTypeDirectDown)
result, err := api.RetailDiscountList("8694203", RetailActTypeSecKill)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestRetailDiscountDelete(t *testing.T) {
err := api.RetailDiscountDelete(testPoiCode, RetailActTypeDirectDown, []string{"329187452"})
if err != nil {
t.Fatal(err)
for _, v := range result {
globals.SugarLogger.Debugf("%s", utils.Format4Output(v, false))
}
//t.Log(utils.Format4Output(result, false))
}
func TestInStoreCouponList(t *testing.T) {

View File

@@ -7,10 +7,22 @@ import (
"testing"
)
func TestN2ame(t *testing.T) {
polay := make(map[string]interface{}, 0)
polay["a"] = ""
polay["b"] = "1"
fmt.Println(polay["a"].(string))
fmt.Println(polay["b"].(string))
fmt.Println(polay["c"].(string))
}
func TestGetRecommendCategory(t *testing.T) {
img, _, err := GetTiktokImgListTest(a, "668707", "", "", "http://img20.360buyimg.com/vc/jfs/t1/8979/39/8591/236012/5c0e45f3E1537c120/a66aafc95cf66977.jpg", "http://img20.360buyimg.com/vc/jfs/t1/23027/3/955/82830/5c0e45f3E0855eeae/ae65ee9555a29579.jpg")
fmt.Println(err)
a.GetRecommendCategory(strings.Split(img, "|"))
data, err := a.GetRecommendCategory(strings.Split(img, "|"))
fmt.Println(data)
fmt.Println(err)
}
// GetTiktokImgList 获取抖音图片链接

View File

@@ -81,5 +81,19 @@ func IsNil(i interface{}) bool {
recover()
}()
vi := reflect.ValueOf(i)
switch vi.Kind() {
case reflect.String:
return len(i.(string)) == 0
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return i.(int) == 0
case reflect.Float32, reflect.Float64:
return i.(float64) == 0.0
case reflect.Bool:
return i.(bool)
case reflect.Map:
return len(i.(map[interface{}]interface{})) == 0
case reflect.Slice:
return len(i.([]interface{})) == 0
}
return vi.IsNil()
}