This commit is contained in:
邹宗楠
2022-12-06 11:22:10 +08:00
7 changed files with 23 additions and 19 deletions

View File

@@ -46,7 +46,8 @@ func (c *ShopGetStoreDetailRequest) GetParams() *ShopGetStoreDetailParam {
type ShopGetStoreDetailParam struct { type ShopGetStoreDetailParam struct {
// 门店ID // 门店ID
StoreId int64 `json:"store_id"` StoreId string `json:"store_id"`
//StoreId int64 `json:"store_id"`
// 是否需要poi审核信息只要审核状态的审核不要传true需要详细的提交信息时传true // 是否需要poi审核信息只要审核状态的审核不要传true需要详细的提交信息时传true
IsNeedPoiAuditInfo bool `json:"is_need_poi_audit_info"` IsNeedPoiAuditInfo bool `json:"is_need_poi_audit_info"`
// 是否需要关联的抖店信息只要shopId不要传true需要关联店铺名称等信息时传true // 是否需要关联的抖店信息只要shopId不要传true需要关联店铺名称等信息时传true

View File

@@ -43,18 +43,10 @@ type WarehouseInfoMapItem struct {
UpdateTime int64 `json:"update_time"` UpdateTime int64 `json:"update_time"`
// 创建时间 // 创建时间
CreateTime int64 `json:"create_time"` CreateTime int64 `json:"create_time"`
// 店铺id
ShopId int64 `json:"shop_id"`
// 仓类型
WarehouseType int64 `json:"warehouse_type"`
// 绑定的外部围栏ID列表 // 绑定的外部围栏ID列表
OutFenceIds []string `json:"out_fence_ids"` OutFenceIds []string `json:"out_fence_ids"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Addresses []string `json:"addresses"`
StoreNames []string `json:"store_names"`
} }
type WarehouseGetWarehouseByStoreData struct { type WarehouseGetWarehouseByStoreData struct {
// 仓信息map // 仓信息map
WarehouseInfoMap map[int64][]WarehouseInfoMapItem `json:"warehouse_info_map"` WarehouseInfoMap map[string]WarehouseInfoMapItem `json:"warehouse_info_map"`
} }

View File

@@ -1,11 +1,11 @@
package tiktok_api package tiktok_api
import ( import (
"crypto/md5"
"fmt" "fmt"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals"
"testing" "testing"
"time"
) )
var token = `{"access_token":"2baa1126-bba0-4510-8ffa-6af55ba0bdbd","expires_in":1670828768,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"23b3eb4e-bb00-4b85-952d-de47801de80d","authority_id":""}` var token = `{"access_token":"2baa1126-bba0-4510-8ffa-6af55ba0bdbd","expires_in":1670828768,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"23b3eb4e-bb00-4b85-952d-de47801de80d","authority_id":""}`
@@ -30,5 +30,12 @@ func TestGetSkuDetailLocalID(t *testing.T) {
// //
func TestName(t *testing.T) { func TestName(t *testing.T) {
fmt.Println(time.Now().Day()) body := `[{
"tag": "101",
"msg_id": "69793528590852580050:0:101:1670233754:1024588978:7136048270014416392",
"data": "{\"biz\":2,\"order_status\":2,\"order_type\":0,\"p_id\":5008525809582539796,\"pay_amount\":2640,\"pay_time\":1670233752,\"pay_type\":1,\"s_ids\":[5008525809582539796],\"shop_id\":57939570}"
}]`
signParam := a.appKey + body + a.appSecret
sign := fmt.Sprintf("%X", md5.Sum([]byte(signParam)))
fmt.Println(sign)
} }

View File

@@ -21,7 +21,7 @@ func TestApi(t *testing.T) {
} }
func TestQueryOrderDetail(t *testing.T) { func TestQueryOrderDetail(t *testing.T) {
data, err := a.GetTiktokOrderDetail("4996895368866964710") data, err := a.GetTiktokOrderDetail("5008526050099613284")
globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("=====%s", err) globals.SugarLogger.Debugf("=====%s", err)
} }

View File

@@ -394,7 +394,7 @@ func (a *API) StoreBindWarehouse(param *warehouse_bindStore_request.WarehouseBin
} }
//获取门店绑定的仓库信息 //获取门店绑定的仓库信息
func (a *API) GetWarehouseByStore(storeID int64) (map[int64][]warehouse_getWarehouseByStore_response.WarehouseInfoMapItem, error) { func (a *API) GetWarehouseByStore(storeID int64) (*warehouse_getWarehouseByStore_response.WarehouseGetWarehouseByStoreData, error) {
request := warehouse_getWarehouseByStore_request.New() request := warehouse_getWarehouseByStore_request.New()
request.Param.StoreIds = append(request.Param.StoreIds, storeID) request.Param.StoreIds = append(request.Param.StoreIds, storeID)
response, err := request.Execute(a.accessTokenObj) response, err := request.Execute(a.accessTokenObj)
@@ -407,7 +407,7 @@ func (a *API) GetWarehouseByStore(storeID int64) (map[int64][]warehouse_getWareh
if len(response.Data.WarehouseInfoMap) == 0 { if len(response.Data.WarehouseInfoMap) == 0 {
return nil, errors.New(fmt.Sprintf("门店%d 暂时未绑定仓库,请进行绑定!", storeID)) return nil, errors.New(fmt.Sprintf("门店%d 暂时未绑定仓库,请进行绑定!", storeID))
} }
return response.Data.WarehouseInfoMap, nil return response.Data, nil
} }
//创建电子围栏 //创建电子围栏

View File

@@ -172,20 +172,24 @@ func (a *API) SNSGetUserPhone(jsCode string) (string, error) {
// 获取小程序短连接CBRetrieveToken // 获取小程序短连接CBRetrieveToken
func (a *API) MiniProgramSortLink() (string, error) { func (a *API) MiniProgramSortLink() (string, error) {
weChatToken := "" weChatToken := ""
if token := a.CBGetToken(); token == "" { token := a.CBGetToken()
if token == "" {
newToken, err := a.CBRetrieveToken() newToken, err := a.CBRetrieveToken()
if err != nil { if err != nil {
return "", err return "", err
} }
weChatToken = newToken.AccessToken weChatToken = newToken.AccessToken
} else {
weChatToken = token
} }
parmaJson := map[string]interface{}{ parmaJson := map[string]interface{}{
"access_token": weChatToken, "access_token": weChatToken,
} }
bodyJson := map[string]interface{}{ bodyJson := map[string]interface{}{
"access_token ": weChatToken, //"access_token ": weChatToken,
"expire_type ": 0, "expire_type ": 1,
"expire_time": 1,
} }
body, _ := json.Marshal(bodyJson) body, _ := json.Marshal(bodyJson)
result, err := a.AccessAPI("wxa/generate_urllink", parmaJson, string(body)) result, err := a.AccessAPI("wxa/generate_urllink", parmaJson, string(body))

View File

@@ -73,7 +73,7 @@ func isSNSAction(action string) bool {
} }
func (a *API) AccessAPI(action string, params map[string]interface{}, body string) (retVal map[string]interface{}, err error) { func (a *API) AccessAPI(action string, params map[string]interface{}, body string) (retVal map[string]interface{}, err error) {
if params != nil && body != "" { if params == nil && body == "" {
panic("params and body can not all be empty") panic("params and body can not all be empty")
} }
params2 := make(map[string]interface{}) params2 := make(map[string]interface{})