1
This commit is contained in:
@@ -16,23 +16,28 @@ const (
|
||||
)
|
||||
|
||||
type OrderComment struct {
|
||||
AddComment string `json:"add_comment"`
|
||||
AddCommentTime string `json:"add_comment_time"`
|
||||
CommentContent string `json:"comment_content"`
|
||||
CommentID int64 `json:"comment_id"`
|
||||
CommentLables string `json:"comment_lables"`
|
||||
CommentLableList []string `json:"comment_lable_list"`
|
||||
CommentPictures string `json:"comment_pictures"`
|
||||
CommentTime string `json:"comment_time"`
|
||||
CriticFoodList string `json:"critic_food_list"`
|
||||
DeliveryCommentScore int `json:"delivery_comment_score"`
|
||||
FoodCommentScore int `json:"food_comment_score"`
|
||||
OrderCommentScore int `json:"order_comment_score"`
|
||||
PackingScore int `json:"packing_score"`
|
||||
PraiseFoodList string `json:"praise_food_list"`
|
||||
ReplyStatus int `json:"reply_status"`
|
||||
Result string `json:"result"`
|
||||
ShipTime int `json:"ship_time"`
|
||||
AddComment string `json:"add_comment"`
|
||||
AddCommentTime string `json:"add_comment_time"`
|
||||
CommentContent string `json:"comment_content"`
|
||||
CommentID int64 `json:"comment_id"`
|
||||
CommentLables string `json:"comment_lables"`
|
||||
CommentLableList []string `json:"comment_lable_list"`
|
||||
CommentPictures string `json:"comment_pictures"`
|
||||
CommentTime string `json:"comment_time"`
|
||||
CriticFoodList string `json:"critic_food_list"`
|
||||
DeliveryCommentScore int `json:"delivery_comment_score"`
|
||||
FoodCommentScore int `json:"food_comment_score"`
|
||||
OrderCommentScore int `json:"order_comment_score"`
|
||||
PackingScore int `json:"packing_score"`
|
||||
PraiseFoodList string `json:"praise_food_list"`
|
||||
ReplyStatus int `json:"reply_status"`
|
||||
Result string `json:"result"`
|
||||
ShipTime int `json:"ship_time"`
|
||||
CommentOrderDetail []CommentOrderDetailList `json:"comment_order_detail"`
|
||||
}
|
||||
type CommentOrderDetailList struct {
|
||||
FoodName string `json:"food_name"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
// 根据门店id批量查询评价信息(新版)
|
||||
|
||||
@@ -2,17 +2,30 @@ package mtwmapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestCommentQuery(t *testing.T) {
|
||||
result, err := api.CommentQuery("18805464", "20231009", "20231011", 0, 0, CommentReplyStatusNotReplied)
|
||||
result, err := api.CommentQuery("8694203", "20240711", "20240716", 0, 0, CommentReplyStatusAll)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
for _, mtwmComment := range result {
|
||||
foodNameList := make([]string, len(mtwmComment.CommentOrderDetail))
|
||||
for _, fn := range mtwmComment.CommentOrderDetail {
|
||||
if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 {
|
||||
foodNameList = append(foodNameList, fn.FoodName)
|
||||
} else {
|
||||
foodNameList = append(foodNameList, fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")])
|
||||
}
|
||||
}
|
||||
fmt.Println(foodNameList)
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
|
||||
//t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestCommentAddReply(t *testing.T) {
|
||||
@@ -21,7 +34,3 @@ func TestCommentAddReply(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTime(t *testing.T) {
|
||||
fmt.Println(utils.TryStr2Time("2023-07-16"))
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
// 菜市
|
||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
|
||||
// 果园
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_s_eXEi_n4M9EIM8noEJAOQ") //token_n4TwqCntWWuvQwAawzxC0w
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_s_eXEi_n4M9EIM8noEJAOQ") //token_n4TwqCntWWuvQwAawzxC0w
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
|
||||
@@ -296,20 +296,21 @@ func TestMap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailDat(t *testing.T) {
|
||||
err := api.RetailInitData("F71D0F0881A211ED9D81525400E86DC0", "16185779", "31173", map[string]interface{}{
|
||||
"app_spu_code": "31173",
|
||||
"category_code": "3039",
|
||||
"common_attr_value": "[{\"attrId\":1200000088,\"attrName\":\"品牌\",\"valueList\":[{\"valueId\":1000001,\"value\":\"其他品牌\"}]},{\"attrId\":1200000094,\"attrName\":\"产地\",\"valueList\":[{\"valueId\":100000050,\"value\":\"中国\"}]},{\"attrId\":1200000132,\"attrName\":\"国产/进口\",\"valueList\":[{\"valueId\":1300000003,\"value\":\"国产\"}]},{\"attrId\":1200000210,\"attrName\":\"商品类别\",\"valueList\":[{\"valueId\":1300002991,\"value\":\"水果混合切片\"}]},{\"attrId\":1200000286,\"attrName\":\"果品品牌\",\"valueList\":[{\"valueId\":1300000249,\"value\":\"其他\"}]},{\"attrId\":1200004449,\"attrName\":\"拼数\",\"valueList\":[{\"valueId\":1300015654,\"value\":\"单拼\"}]}]",
|
||||
err := api.RetailInitData("F71D0F0881A211ED9D81525400E86DC0", "2461794", "24918", map[string]interface{}{
|
||||
"app_food_code": "24918",
|
||||
"available_times": "{\"friday\":\"09:00-14:00\",\"monday\":\"09:00-14:00\",\"saturday\":\"09:00-14:00\",\"sunday\":\"09:00-14:00\",\"thursday\":\"09:00-14:00\",\"tuesday\":\"09:00-14:00\",\"wednesday\":\"09:00-14:00\"}",
|
||||
"category_code": "35",
|
||||
"common_attr_value": "[{\"attr_id\":\"1200000210\",\"attr_name\":\"商品类别\",\"valueList\":[{\"value_id\":\"1300000249\",\"value\":\"其他\"}]},{\"attr_id\":\"1200000352\",\"attr_name\":\"储存方式\",\"valueList\":[{\"value_id\":\"1300017321\",\"value\":\"冷鲜\"}]},{\"attr_id\":\"1200000135\",\"attr_name\":\"包装方式\",\"valueList\":[{\"value_id\":\"1300000232\",\"value\":\"散装\"}]}]",
|
||||
"description": "",
|
||||
"is_sold_out": 0,
|
||||
"min_order_count": 1,
|
||||
"name": "【果切】香甜芒果果切1盒约250g",
|
||||
"picture": "https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg",
|
||||
"price": 13.9,
|
||||
"sequence": 494,
|
||||
"skus": "[{\"ladder_box_num\":1,\"ladder_box_price\":0.5,\"price\":13.9,\"sku_id\":\"31173\",\"spec\":\"250g\",\"stock\":\"9999\",\"weight\":250}]",
|
||||
"tag_id": "200002727",
|
||||
"unit": "盒",
|
||||
"name": "【新鲜】牛瘦肉约250g/份",
|
||||
"picture": "https://image.jxc4.com/image/fe667213afabf9ed6b26e96bce57d070.jpg,https://image.jxc4.com/image/feb5e5ce1b80751d3d49f78a4e723346.jpg",
|
||||
"picture_contents": "C9F45DC9AED2AE59E2A5D6A6BD5579EA",
|
||||
"sequence": 14,
|
||||
"skus": "[{\"box_num\":\"0\",\"box_price\":\"0\",\"ladder_box_num\":\"0\",\"ladder_box_price\":\"0\",\"sku_id\":\"24918\",\"spec\":\"250g\",\"stock\":\"9999\",\"weight\":250}]",
|
||||
"tag_id": "200002836",
|
||||
"unit": "份",
|
||||
})
|
||||
globals.SugarLogger.Debugf("err %s", utils.Format4Output(err, false))
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability304"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability304/request"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -75,8 +74,6 @@ func (a *API) GetRefreshToken(refreshToken string) (*StoreTokenInfo, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
globals.SugarLogger.Debugf("=====data.TokenResult := %s", data.TokenResult)
|
||||
globals.SugarLogger.Debugf("=====data.Body := %s", data.Body)
|
||||
|
||||
var token *StoreTokenInfo
|
||||
if err := json.Unmarshal([]byte(data.TokenResult), &token); err != nil {
|
||||
|
||||
@@ -86,7 +86,6 @@ func (a *API) QueryStoreSKu(param *request.AlibabaWdkSkuQueryRequest) (*[]domain
|
||||
|
||||
// StoreSkuUpdateOffShelf 门店商品上下架
|
||||
func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUpdateRequest) error {
|
||||
//globals.SugarLogger.Debugf("进入 StoreSkuUpdateOffShelf")
|
||||
client := ability587.NewAbility587(&a.client)
|
||||
|
||||
data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token)
|
||||
@@ -112,10 +111,9 @@ func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []int64) []strin
|
||||
for i := 0; i < len(skuList); i++ {
|
||||
param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(utils.Int64ToStr(skuList[i]))
|
||||
data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token)
|
||||
globals.SugarLogger.Debugf("data = %s", utils.Format4Output(data, false))
|
||||
//if !*data.ApiResult.Success {
|
||||
// errs = append(errs, *data.ApiResult.ErrMsg)
|
||||
//}
|
||||
if !*data.ApiResult.Success {
|
||||
errs = append(errs, *data.ApiResult.ErrMsg)
|
||||
}
|
||||
if i%5 == 0 {
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
@@ -126,13 +124,10 @@ func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []int64) []strin
|
||||
|
||||
// StoreSkuStock 商品库存同步
|
||||
func (a *API) StoreSkuStock(param *request589.AlibabaWdkStockPublishRequest) error {
|
||||
//globals.SugarLogger.Debugf("进入 StoreSkuStock")
|
||||
client := ability589.NewAbility589(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkStockPublish(param)
|
||||
//globals.SugarLogger.Debugf("StoreSkuStock err := %s", utils.Format4Output(data, false))
|
||||
if !data.IsSuccess {
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(data.Message)
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ var (
|
||||
|
||||
func init() {
|
||||
apiTao = NewTaoVegetable(AppKey, AppSecret, ServerUrl)
|
||||
apiTao.SetToken("62006222ad76ec6c2fcdd2267c9693ZZ1c32229bc924d622584604406")
|
||||
apiTao.SetToken("50000C01a13ljEUzdXgCw5mv01c160262DomLhzdTxCjYiptAOsapuQWvBzLJtHnBNdu")
|
||||
//apiTao.SetRefreshToken("50001C01332tTDbqudmRgtqgdCjy5lvtFkgQIVevSEgb1cadbd188xSBJv6Zo5XpXvKK")
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
|
||||
Reference in New Issue
Block a user