This commit is contained in:
邹宗楠
2024-09-19 09:48:16 +08:00
parent b44233b421
commit 312aefbf2c
6 changed files with 90 additions and 57 deletions

View File

@@ -45,56 +45,77 @@ func TestCommentAddReply(t *testing.T) {
}
func TestGetCommonList(t *testing.T) {
var page = 1
param := map[string]interface{}{
"wmPoiId": -1,
"appType": 3,
"pageNum": 1,
"pageNum": page,
"rate": 0,
"reply": -1,
"context": -1,
"startDate": "2024-07-30",
"endDate": "2024-08-04",
"startDate": "2024-09-07",
"endDate": "2024-09-13",
"timeType": 4,
}
cookie := `uuid_update=true; _lxsdk_cuid=18a8c469cebc8-0d5443d9234ef1-26021051-240000-18a8c469cebc8; uuid=19f97d5039dc40979c40.1701152326.1.0.0; device_uuid=!303ca77f-1f5c-4db9-8beb-2140b78696e2; pushToken=01YLhAxagh8b3tlBORRhDbRt9URjGhSdCG84G5-PA1w0*; WEBDFPID=29z4yy3y961959z509u92w75626y558381x7618yx56979584y00uw64-2016762763564-1701402763564QQKUMAGfd79fef3d01d5e9aadc18ccd4d0c95073707; iuuid=6150CECD00F8926053D5784EE8E108EC3F622CECA73B5042408DE46AB37C3D80; _lxsdk=6150CECD00F8926053D5784EE8E108EC3F622CECA73B5042408DE46AB37C3D80; _ga=GA1.2.2133425411.1707118186; isNewCome=1; userTicket=ABDdQinAblqsCpXDsEdtLNYrSpYSSlbRWYlhFyUm; u=893483812; n=tel1808018; lt=AgFCI__eFEzarguG6ly07rQWhiJFBEsWRgxUWRQPXLNOqeBN-U1C0hQ56pWpHL4sm50cGWeduIqVQwAAAAC4IQAAxbA-z1YAE9bBoB64Id-_ZJV3tTdf3aKBnn8v3h5o6AOWhEVtVcGjAr7ax5V84Mej; mt_c_token=AgFCI__eFEzarguG6ly07rQWhiJFBEsWRgxUWRQPXLNOqeBN-U1C0hQ56pWpHL4sm50cGWeduIqVQwAAAAC4IQAAxbA-z1YAE9bBoB64Id-_ZJV3tTdf3aKBnn8v3h5o6AOWhEVtVcGjAr7ax5V84Mej; epassport_token=rAkkpBP8rdoSPXLMTpCsXb_l9KiOTRmMcY-KJWTzi6CuT69LRfHjOplHElKObVDDpsfaXk7uBW0QTdc0DiuHtA; e_u_id_3299326472=a22cdb4f9c9a66958f72f3fe4d99aba6; wpush_server_url=wss://wpush.meituan.com; acctId=57396785; token=044jxrgPZJ-nbc_4HipZQabvwhUAuuAUNP9PmZNtjbSE*; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=true; bsid=VTjYsCinHaOl0xcRok7QVcZ57ATGo7pPLIqbaGdSI9nmXWopU7ZYZ4t8mARrM05mLjhgS7nHNi4V2RaKnK8ufg; grayPath=newRoot; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; igateApp=shangouepc; pharmacistAccount=0; timeout=2000; accessToken=VTjYsCinHaOl0xcRok7QVcZ57ATGo7pPLIqbaGdSI9nmXWopU7ZYZ4t8mARrM05mLjhgS7nHNi4V2RaKnK8ufg; cacheTimeMark=2024-08-07; signToken="KdI9fPkFKRoEnfWfUP0v+VrNpcZDvIHbwlmdRQ90Kv/Y1USBwwtEHiyRyBj/IYwX4iFRngTy97nEX6hKa4JXgGQTdRZDuvNnQ4WrC6lwAVFve73wrsx+DEPeESOZocCUjQHbEZK/Rs5P+8xo/LGHKA=="; logan_session_token=4g11sqt7505ruwmcz8i2; shopCategory=food; _lxsdk_s=19129ff4b09-07c-6d0-ab2%7C%7C592`
result, err := api.GetComment4ShanGou(param, true, cookie)
if err != nil {
fmt.Println(err)
return
}
for _, mtwmComment := range result {
// 商品的名称集合
foodNameList := make(map[string]int, 0)
// 好评商品
for _, fn := range mtwmComment.PraiseFoodList {
foodNameList[fn] = 1
cookie := `uuid_update=true; _lxsdk_cuid=18a8c469cebc8-0d5443d9234ef1-26021051-240000-18a8c469cebc8; uuid=19f97d5039dc40979c40.1701152326.1.0.0; device_uuid=!303ca77f-1f5c-4db9-8beb-2140b78696e2; pushToken=01YLhAxagh8b3tlBORRhDbRt9URjGhSdCG84G5-PA1w0*; WEBDFPID=29z4yy3y961959z509u92w75626y558381x7618yx56979584y00uw64-2016762763564-1701402763564QQKUMAGfd79fef3d01d5e9aadc18ccd4d0c95073707; iuuid=6150CECD00F8926053D5784EE8E108EC3F622CECA73B5042408DE46AB37C3D80; _lxsdk=6150CECD00F8926053D5784EE8E108EC3F622CECA73B5042408DE46AB37C3D80; _ga=GA1.2.2133425411.1707118186; userTicket=ABDdQinAblqsCpXDsEdtLNYrSpYSSlbRWYlhFyUm; u=893483812; n=tel1808018; lt=AgFCI__eFEzarguG6ly07rQWhiJFBEsWRgxUWRQPXLNOqeBN-U1C0hQ56pWpHL4sm50cGWeduIqVQwAAAAC4IQAAxbA-z1YAE9bBoB64Id-_ZJV3tTdf3aKBnn8v3h5o6AOWhEVtVcGjAr7ax5V84Mej; mt_c_token=AgFCI__eFEzarguG6ly07rQWhiJFBEsWRgxUWRQPXLNOqeBN-U1C0hQ56pWpHL4sm50cGWeduIqVQwAAAAC4IQAAxbA-z1YAE9bBoB64Id-_ZJV3tTdf3aKBnn8v3h5o6AOWhEVtVcGjAr7ax5V84Mej; isNewCome=1; e_u_id_3299326472=cbee20e50a13edae555928828ac9a4e7; wpush_server_url=wss://wpush.meituan.com; acctId=62884810; token=0OURmdynYsCHmfmw_BzFZSpdMyN-NpEhy_lOf6ScMSrU*; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; shopCategory=food; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=true; bsid=irU_eBSO6DWvVI9cwYaSs44aob3AdBSsGCnN2zFepz8UnDWL79GP_0eVcOP9Ll6AO3JEvwzF8hn346QXEBVTSw; grayPath=newRoot; signToken="htd1LkHCWu/j5C3Essvpr2DoTjMVQ9NP2EoUaTtqVckFzLzYngYSsLfR/lNoQdZpt4GzudRw9XVhTHnjVJZg9Jic4tdFKg5CauCYZNuoqop1j75praME5P4nx9jBSYBak8038XQGJ7goFnzmpDObYw=="; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; _gw_ab_call_29945_47=TRUE; _gw_ab_29945_47=561; logan_session_token=9nuel9qirajn1ms9ax2h; gatherPoi=; cacheTimeMark=2024-09-14; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; igateApp=shangouepc; timeout=2000; accessToken=irU_eBSO6DWvVI9cwYaSs44aob3AdBSsGCnN2zFepz8UnDWL79GP_0eVcOP9Ll6AO3JEvwzF8hn346QXEBVTSw; pharmacistAccount=0; _lxsdk_s=191ee2d02f8-967-08e-330%7C%7C256`
for {
result, err := api.GetComment4ShanGou(param, true, cookie)
if err != nil {
fmt.Println(err)
return
}
// 差评商品
for _, fn := range mtwmComment.CriticFoodList {
foodNameList[fn] = 1
}
// 列表商品
for _, fn := range mtwmComment.SpuCommentList {
foodNameList[fn.SpuName] = 1
}
// 包含()中文括号的商品
for _, fn := range mtwmComment.OrderStatus.Details {
if len(fn.FoodName)-strings.LastIndex(fn.FoodName, "") > 3 {
foodNameList[strings.TrimSuffix(fn.FoodName, " ")] = 1
} else {
foodNameList[strings.TrimSuffix(fn.FoodName[0:strings.LastIndex(fn.FoodName, "")], " ")] = 1
for _, mtwmComment := range result {
// 商品的名称集合
foodNameList := make(map[string]int, 0)
// 好评商品
for _, fn := range mtwmComment.PraiseFoodList {
foodNameList[fn] = 1
}
// 差评商品
for _, fn := range mtwmComment.CriticFoodList {
foodNameList[fn] = 1
}
// 列表商品
for _, fn := range mtwmComment.SpuCommentList {
foodNameList[fn.SpuName] = 1
}
// 包含()中文括号的商品
for _, fn := range mtwmComment.OrderStatus.Details {
if len(fn.FoodName)-strings.LastIndex(fn.FoodName, "") > 3 {
foodNameList[strings.TrimSuffix(fn.FoodName, " ")] = 1
} else {
foodNameList[strings.TrimSuffix(fn.FoodName[0:strings.LastIndex(fn.FoodName, "")], " ")] = 1
}
}
foodName := make([]string, 0, len(foodNameList))
for fnl, _ := range foodNameList {
foodName = append(foodName, fnl)
}
globals.SugarLogger.Debugf("vendorStoreId :%d , skuName: %s", mtwmComment.WmPoiId, strings.Join(foodName, ","))
}
foodName := make([]string, 0, len(foodNameList))
for fnl, _ := range foodNameList {
foodName = append(foodName, fnl)
if len(result) >= 10 {
page += 1
} else {
break
}
globals.SugarLogger.Debugf("vendorStoreId :%d , skuName: %s", mtwmComment.WmPoiId, strings.Join(foodName, ","))
}
}
//2024-09-14T10:54:11.724+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :17916252 , skuName: 【剥肉】红心柚子肉.250g,【抢鲜吃】泰国椰 子/椰肉 水果切盒-250g,【爆品】缤纷酸奶水果捞 200g
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :21752676 , skuName: 【冰镇】8424西瓜半个约3斤切块,红毛桃 1个
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :17916252 , skuName: 【代餐轻食】混合水果捞.300g
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :5943132 , skuName: 《力荐》超甜黄金百香果 《一盒4粒》表皮褶皱 正常现象介意勿拍160克左右,【整果】金枕榴莲1个装(约3.3-4斤)《保好》,4A麻竹山竹福 利【质量好.不好联系返差价】500g,《冰镇嘎嘎凉》新北海不甜不要钱甜王西瓜【3斤 左右】大小块不定按分量走
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :24330787 , skuName: 超大份低脂水果捞800g约1005ml【免费加 伴侣】
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :5943132 , skuName: 【新上市】红油桃质量一级好【嘎嘎甜】400克 左右
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :2370192 , skuName: 草莓味酸奶水果捞485ml,【果切】赔本赚吆喝缤 纷水果随机切200ml盒,【果切】赔本赚吆喝缤纷水果随机切200ml盒 200毫升,【果切】 番茄+乌梅400ml
//2024-09-14T10:54:11.725+0800 DEBUG mtwmapi/comment_test.go:94 vendorStoreId :21490215 , skuName: 都乐Dole 欢乐果园 来一碗超甜凤梨切 200 克(g),【活动爆品】麒麟西瓜切盒约400g,精品海南小台切盒400g
func TestCommonList2(t *testing.T) {
url := "https://shangoue.meituan.com/api/support/customer/comment/r/list"