This commit is contained in:
邹宗楠
2024-12-10 09:11:00 +08:00
parent 2f5c36f4bb
commit 4454c36edd
2 changed files with 55 additions and 22 deletions

View File

@@ -114,18 +114,18 @@ func (a *API) CommentAddReply(poiCode string, commentID int64, reply string) (er
}
func (a *API) GetComment4ShanGou(param map[string]interface{}, isPost bool, cookie string) ([]*CommentsList, error) {
wmPoiId := NumberCell + fmt.Sprintf("name=\"wmPoiId\"\r\n\r\n%v\r\n", param["wmPoiId"])
appType := NumberCell + fmt.Sprintf("name=\"appType\"\r\n\r\n%v\r\n", param["appType"])
pageNum := NumberCell + fmt.Sprintf("name=\"pageNum\"\r\n\r\n%v\r\n", param["pageNum"])
rate := NumberCell + fmt.Sprintf("name=\"rate\"\r\n\r\n%v\r\n", param["rate"])
reply := NumberCell + fmt.Sprintf("name=\"reply\"\r\n\r\n%v\r\n", param["reply"])
context := NumberCell + fmt.Sprintf("name=\"context\"\r\n\r\n%v\r\n", param["context"])
startDate := NumberCell + fmt.Sprintf("name=\"startDate\"\r\n\r\n%v\r\n", param["startDate"])
endDate := NumberCell + fmt.Sprintf("name=\"endDate\"\r\n\r\n%v\r\n", param["endDate"])
timeType := NumberCell + fmt.Sprintf("name=\"timeType\"\r\n\r\n%v\r\n-----011000010111000001101001--\r\n\r\n", param["timeType"])
date := wmPoiId + appType + pageNum + rate + reply + context + startDate + endDate + timeType
//wmPoiId := NumberCell + fmt.Sprintf("name=\"wmPoiId\"\r\n\r\n%v\r\n", param["wmPoiId"])
//appType := NumberCell + fmt.Sprintf("name=\"appType\"\r\n\r\n%v\r\n", param["appType"])
//pageNum := NumberCell + fmt.Sprintf("name=\"pageNum\"\r\n\r\n%v\r\n", param["pageNum"])
//rate := NumberCell + fmt.Sprintf("name=\"rate\"\r\n\r\n%v\r\n", param["rate"])
//reply := NumberCell + fmt.Sprintf("name=\"reply\"\r\n\r\n%v\r\n", param["reply"])
//context := NumberCell + fmt.Sprintf("name=\"context\"\r\n\r\n%v\r\n", param["context"])
//startDate := NumberCell + fmt.Sprintf("name=\"startDate\"\r\n\r\n%v\r\n", param["startDate"])
//endDate := NumberCell + fmt.Sprintf("name=\"endDate\"\r\n\r\n%v\r\n", param["endDate"])
//timeType := NumberCell + fmt.Sprintf("name=\"timeType\"\r\n\r\n%v\r\n-----011000010111000001101001--\r\n\r\n", param["timeType"])
//date := wmPoiId + appType + pageNum + rate + reply + context + startDate + endDate + timeType
result, err := a.AccessStoreComment(CommentUrl, date, isPost, cookie)
result, err := a.AccessStoreComment(CommentUrl, param, isPost, cookie)
if err != nil {
return nil, err
}
@@ -148,14 +148,15 @@ func (a *API) GetComment4ShanGou(param map[string]interface{}, isPost bool, cook
// AccessStoreComment 拉去美团页面上的评价订单
// https://shangoue.meituan.com/api/support/customer/comment/r/list
func (a *API) AccessStoreComment(fullURL string, param string, isPost bool, cookie string) (retVal map[string]interface{}, err error) {
func (a *API) AccessStoreComment(fullURL string, param map[string]interface{}, isPost bool, cookie string) (retVal map[string]interface{}, err error) {
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
var request *http.Request
if isPost {
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(param))
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(param).Encode()))
request.Header.Set("Cookie", cookie)
request.Header.Set("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
request.Header.Set("accept", "application/json, text/plain, */*")
}
a.FillRequestCookies(request)
return request

View File

@@ -7,8 +7,12 @@ import (
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/baseapi/utils/errlist"
"git.rosy.net.cn/jx-callback/globals"
"github.com/go-redis/redis"
"io/ioutil"
"net/http"
"reflect"
"strings"
"testing"
"time"
)
@@ -186,16 +190,44 @@ func TestEncryptIm(t *testing.T) {
}
func TestNew2(t *testing.T) {
//fmt.Println(reflect.TypeOf(file1))
//fmt.Println(reflect.TypeOf(file3))
//fmt.Println(reflect.TypeOf(file2))
url := "http://p1.meituan.net/retailsp/5f1bc1a6d72b2f36bf6fec6b0130fceb34799.jpg"
resp, err := http.Get(url)
if err != nil {
globals.SugarLogger.Debugf("err := %v", err)
return
}
str := "20235760123"
defer resp.Body.Close()
fmt.Println(str[:2])
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
globals.SugarLogger.Debugf("err := %v", err)
return
}
//var n = 0
//fmt.Println(n)
//fmt.Println(reflect.TypeOf(n))
ioutil.WriteFile("image.jpg", data, 0644)
}
func TestGetImage(t *testing.T) {
url := `https://shangoue.meituan.com/reuse/sc/product/retail/r/getStandardProductListWithCond?yodaReady=h5&csecplatform=4&csecversion=2.4.0`
cl := http.Client{}
var request *http.Request
request, err := http.NewRequest(http.MethodPost, url, strings.NewReader(utils.Map2URLValues(map[string]interface{}{"keyword": "6985391315640", "pageNo": 1, "pageSize": 20, "wmPoiId": "9460317"}).Encode()))
if err != nil {
fmt.Println(err)
}
request.Header.Add("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; n=tel1808018; e_u_id_3299326472=cbee20e50a13edae555928828ac9a4e7; _ga=GA1.1.2133425411.1707118186; _ga_95GX0SH5GM=GS1.1.1730448478.2.1.1730448606.0.0.0; swim_line=default; utm_source=; au_trace_key_net=default; openh5_uuid=6150CECD00F8926053D5784EE8E108EC3F622CECA73B5042408DE46AB37C3D80; isIframe=false; userTicket=cteBaZfiYYehopyFurCWuHDRuBLtBCOgSLQTEpZH; u=893483812; mt_c_token=AgFhIKvKZR3yJQZyN6LClIEFOLAxyC2Pr8Uv1v3f9pv1zGe4HofPU-UlZX1HGw6oyngC3nxkV-mdugAAAABHJAAAHRjG8Fplw2RZbjiB-j8NMvGRTEb7vpsqrqNRp8cfFOHb0idS4Ama7CpOdykbFaM3; _lx_utm=utm_source%3D60066; isNewCome=1; e_b_id_352126=6813adcfb974e59ad7ab66053dd074e5; mtcdn=K; wpush_server_url=wss://wpush.meituan.com; acctId=57396785; token=0srO0aJRGFCN_oPbv7MPWYnJE-hkZHDW8ogfR-eFW-MA*; brandId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=true; bsid=UkNhzlEAE-DMmFFbVgJ9sJMMzCT-ng7B-ckf6HizwBYJuLWS56VkXhDkcseBOgI2HGD-_rYqXWwYgGhLmdBGDQ; grayPath=newRoot; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; unified_new_order_signal_times=; gatherPoi=; timeout=2000; accessToken=UkNhzlEAE-DMmFFbVgJ9sJMMzCT-ng7B-ckf6HizwBYJuLWS56VkXhDkcseBOgI2HGD-_rYqXWwYgGhLmdBGDQ; pharmacistAccount=0; wmPoiId=9460317; wmPoiName=京西菜市(竞成农贸市场店); logistics_support=1; set_info={"wmPoiId":9460317,"ignoreSetRouterProxy":true}; igateApp=igate; _gw_ab_call_29856_79=TRUE; _gw_ab_29856_79=455; cacheTimeMark=2024-12-04; signToken="3RkSYPIXkG4CUswRI20aWL0H+WRnuE+q/0EzuCYditH5VNpS19RGxJlQwIClh0Ox87wWNSMzshjFoXcFZkZOXHWSCeFve39F0W9w8CN8jUtQPu7MyxxXSa7+P6kYqSmZa0ZoKdFr+MZ/d2HQtkYSsg=="; shopCategory=market; logan_session_token=i7cvmgxyg1jndxy58k0w; _lxsdk_s=1939097efd9-f63-6a2-90d||33`)
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
request.Header.Set("accept", "application/json, text/plain, */*")
response, err := cl.Do(request)
defer response.Body.Close()
data, err := ioutil.ReadAll(response.Body)
if err != nil {
fmt.Println(err)
}
globals.SugarLogger.Debugf("---%s", string(data))
}