aa
This commit is contained in:
@@ -44,6 +44,18 @@ func (a *API) Err2CallbackResponse(err error) *CallbackResponse {
|
|||||||
return a.PackCallbackResult(err.Error())
|
return a.PackCallbackResult(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) SetCallbackToken(token string) {
|
||||||
|
a.locker.RLock()
|
||||||
|
defer a.locker.RUnlock()
|
||||||
|
a.callbackToken = token
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) SetCallbackAESKey(b []byte) {
|
||||||
|
a.locker.RLock()
|
||||||
|
defer a.locker.RUnlock()
|
||||||
|
a.callbackAESKey = b
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) GetCallbackToken() string {
|
func (a *API) GetCallbackToken() string {
|
||||||
a.locker.RLock()
|
a.locker.RLock()
|
||||||
defer a.locker.RUnlock()
|
defer a.locker.RUnlock()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestOrderGet(t *testing.T) {
|
func TestOrderGet(t *testing.T) {
|
||||||
result, err := api.OrderGet("2157781636259071682")
|
result, err := api.OrderGet("5032717275039729232")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -79,16 +79,17 @@ func TestShopAptitudeGet(t *testing.T) {
|
|||||||
|
|
||||||
func TestShopUpdate(t *testing.T) {
|
func TestShopUpdate(t *testing.T) {
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
KeyName: "好菜鲜生-测试店",
|
//KeyName: "好菜鲜生(龙宫市场店)",
|
||||||
KeyPhone: "13812345678",
|
//KeyPhone: "13812345678",
|
||||||
KeyBaiduShopID: testShopBaiduID,
|
KeyBaiduShopID: "32267358118",
|
||||||
"longitude": 116.307884,
|
//"longitude": 116.307884,
|
||||||
"latitude": 40.036828,
|
//"latitude": 40.036828,
|
||||||
"coord_type": "amap",
|
//"coord_type": "amap",
|
||||||
"province": "131",
|
//"province": "131",
|
||||||
"city": "131",
|
//"city": "131",
|
||||||
"county": "1960",
|
//"county": "1960",
|
||||||
"address": "北京市海淀区上地信息路甲9号",
|
//"address": "北京市海淀区上地信息路甲9号",
|
||||||
|
"shop_logo": "http://image.jxc4.com/image/e078b225d7b232b4497a689dbf65159e.jpg",
|
||||||
}
|
}
|
||||||
err := api.ShopUpdate(params)
|
err := api.ShopUpdate(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestQueryPromotionInfo(t *testing.T) {
|
|||||||
|
|
||||||
func TestQueryPromotionSku(t *testing.T) {
|
func TestQueryPromotionSku(t *testing.T) {
|
||||||
skuIDs := []int64{
|
skuIDs := []int64{
|
||||||
2023335105,
|
2022336911,
|
||||||
// 2023335104,
|
// 2023335104,
|
||||||
// 2023335088,
|
// 2023335088,
|
||||||
// 2023335057,
|
// 2023335057,
|
||||||
|
|||||||
@@ -226,7 +226,82 @@ func TestUpdateDeliveryPromise(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUploadImageNew(t *testing.T) {
|
func TestUploadImageNew(t *testing.T) {
|
||||||
fmt.Println(int(utils.Str2Time("2021-03-09 23:59:59").Sub(utils.Str2Time("2021-03-07 00:00:00")).Hours()) / 24)
|
s := "PLLPLA"
|
||||||
|
fmt.Println(checkRecord(s))
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkRecord(s string) bool {
|
||||||
|
countL := 0
|
||||||
|
countA := 0
|
||||||
|
for _, v := range s {
|
||||||
|
if v == 'A' {
|
||||||
|
countA++
|
||||||
|
if countA > 1 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if v == 'L' {
|
||||||
|
countL++
|
||||||
|
if countL > 2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
countL = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func sink(array []int, length int) {
|
||||||
|
start := 0
|
||||||
|
for {
|
||||||
|
//2*n+1 可以画图就知道为什么了,是左边子节点
|
||||||
|
next := 2*start + 1
|
||||||
|
if next > length {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if next+1 <= length && array[next+1] < array[next] {
|
||||||
|
next++
|
||||||
|
}
|
||||||
|
|
||||||
|
//上层小于下面,不用互换了
|
||||||
|
if array[start] <= array[next] {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
//互换继续下沉
|
||||||
|
array[start], array[next] = array[next], array[start]
|
||||||
|
start = next
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//堆
|
||||||
|
//top k
|
||||||
|
func topk(s []int, k, i int) {
|
||||||
|
for {
|
||||||
|
left := i*2 + 1
|
||||||
|
right := i*2 + 2
|
||||||
|
if i < 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if right == k {
|
||||||
|
if s[i] < s[left] {
|
||||||
|
s[i], s[left] = s[left], s[i]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if s[i] < s[left] || s[i] < s[right] {
|
||||||
|
if s[left] < s[right] {
|
||||||
|
s[i], s[right] = s[right], s[i]
|
||||||
|
} else {
|
||||||
|
s[i], s[left] = s[left], s[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if i-1 < 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
i = (i - 1) / 2
|
||||||
|
}
|
||||||
|
fmt.Println("loop s", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
//给定一个包含正整数、加(+)、减(-)、乘(*)、除(/)的算数表达式(括号除外),计算其结果。
|
//给定一个包含正整数、加(+)、减(-)、乘(*)、除(/)的算数表达式(括号除外),计算其结果。
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ func TestRetailDiscountBatchSave(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRetailDiscountList(t *testing.T) {
|
func TestRetailDiscountList(t *testing.T) {
|
||||||
result, err := api.RetailDiscountList("12405467", RetailActTypeDirectDown)
|
result, err := api.RetailDiscountList("8040309", RetailActTypeDirectDown)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
// 菜市
|
// 菜市
|
||||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||||
|
|
||||||
// 果园
|
// 果园
|
||||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gbUPuDi9v0BKfnjdFz5IYw") //token_nH_IlcWQKAkZBqklwItNRw
|
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gbUPuDi9v0BKfnjdFz5IYw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||||
cookieStr := `
|
cookieStr := `
|
||||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -37,9 +37,10 @@ func TestCreateUnitorderOrder(t *testing.T) {
|
|||||||
|
|
||||||
func TestCreateH5UnitorderOrder(t *testing.T) {
|
func TestCreateH5UnitorderOrder(t *testing.T) {
|
||||||
api.CreateH5UnitorderOrder(&CreateH5UnitorderOrderParam{
|
api.CreateH5UnitorderOrder(&CreateH5UnitorderOrderParam{
|
||||||
Reqsn: "88320943177180",
|
Reqsn: "88320943177180_4",
|
||||||
Trxamt: 1,
|
Trxamt: 1,
|
||||||
NotifyUrl: "http://callback.test.jxc4.com/tlpay/msg/",
|
NotifyUrl: "https://print.jxc4.com/callback/msg",
|
||||||
|
Returl: "https://print.jxc4.com",
|
||||||
Charset: "UTF-8",
|
Charset: "UTF-8",
|
||||||
Body: "test",
|
Body: "test",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user