Files
baseapi/platformapi/ebaiapi/store_page.go
2019-10-22 14:25:29 +08:00

672 lines
25 KiB
Go

package ebaiapi
import (
"fmt"
"net/http"
"strings"
"time"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/platformapi"
"git.rosy.net.cn/baseapi/utils"
)
const (
storeURL = "https://be.ele.me"
getStoreURL = "https://newretail.ele.me"
swithShopURL = "crm/manager/switchshop"
)
const (
CommentLevelAll = -1
CommentLevel1 = 1
CommentLevel2 = 2
CommentLevel3 = 3
CommentLevel4 = 4
CommentLevel5 = 5
CommentContentAll = -1
CommentContentHaveContent = 1
CommentContentNoContent = 0
)
type PageShopUserInfo struct {
CategoryID string `json:"category_id"`
CityID string `json:"city_id"`
CityName string `json:"city_name"`
DeliveryParty string `json:"delivery_party"`
EleID string `json:"ele_id"`
EleSoaToken string `json:"ele_soa_token"`
IsAPI int `json:"is_api"`
IsStore interface{} `json:"is_store"`
MerchantID string `json:"merchant_id"`
MerchantName string `json:"merchant_name"`
Role struct {
Ename string `json:"ename"`
Name string `json:"name"`
ShopRoleID int64 `json:"shop_role_id"`
} `json:"role"`
SalesID string `json:"sales_id"`
SalesName string `json:"sales_name"`
ServicePackage struct {
BaiduSign int `json:"baiduSign"`
EleSign int `json:"eleSign"`
} `json:"service_package"`
ShopInfo struct {
AreaID string `json:"area_id"`
BaiduBusinessState string `json:"baidu_business_state"`
BaiduOnlineStatus string `json:"baidu_online_status"`
BaiduTakeoutLogo string `json:"baidu_takeout_logo"`
CategoryID string `json:"category_id"`
CategoryIds string `json:"category_ids"`
CategoryName string `json:"category_name"`
County string `json:"county"`
CreateType string `json:"create_type"`
CreatedAt string `json:"created_at"`
CrmOncallType int `json:"crm_oncall_type"`
EffectiveAt string `json:"effective_at"`
EleBusinessState string `json:"ele_business_state"`
EleDeliveryParty string `json:"ele_delivery_party"`
EleID string `json:"ele_id"`
EleOnlineStatus string `json:"ele_online_status"`
EleShopLogo interface{} `json:"ele_shop_logo"`
IsSignZhongbao string `json:"is_sign_zhongbao"`
OnlineStatus string `json:"online_status"`
Phone string `json:"phone"`
ServStatus string `json:"serv_status"`
ShopTransactionOpen int `json:"shop_transaction_open"`
SourceName string `json:"source_name"`
SupplierID string `json:"supplier_id"`
TakeoutBoxPrice string `json:"takeout_box_price"`
TakeoutDispatchTime []*BussinessTimeInfo `json:"takeout_dispatch_time"`
TakeoutOncallType string `json:"takeout_oncall_type"`
TakeoutOpenTime []*BussinessTimeInfo `json:"takeout_open_time"`
TakeoutServicePhone string `json:"takeout_service_phone"`
TakeoutShopLogo string `json:"takeout_shop_logo"`
TransferStatus string `json:"transfer_status"`
} `json:"shop_info"`
ShopRole int `json:"shop_role"`
ShopUserID string `json:"shop_user_id"`
SwitchFromSupplier int `json:"switch_from_supplier"`
UserName string `json:"user_name"`
UserPhone string `json:"user_phone"`
YellowPrompt struct {
Capacity int `json:"capacity"`
Complete int `json:"complete"`
Display bool `json:"display"`
Msg string `json:"msg"`
MsgCount int `json:"msg_count"`
MsgList []interface{} `json:"msg_list"`
Online int `json:"online"`
PcURL string `json:"pc_url"`
TransferStatus string `json:"transfer_status"`
Type int `json:"type"`
URL string `json:"url"`
} `json:"yellow_prompt"`
}
type PageShopHealthInfo struct {
MerchantID string `json:"merchant_id"`
MerchantName string `json:"merchant_name"`
BadOrderRate string `json:"bad_order_rate"`
Category2 string `json:"category_2"`
Data string `json:"data"`
EndTime string `json:"endTime"`
HasPhotoRate string `json:"has_photo_rate"`
Hours string `json:"hours"`
ID string `json:"id"`
IsButie string `json:"is_butie"`
IsCp string `json:"is_cp"`
IsDeliverFee string `json:"is_deliver_fee"`
IsGood string `json:"is_good"`
IsHealthy string `json:"is_healthy"`
IsJiedan string `json:"is_jiedan"`
IsManjian string `json:"is_manjian"`
IsQisong string `json:"is_qisong"`
IsShopNew string `json:"is_shop_new"`
IsSku string `json:"is_sku"`
IsYinye string `json:"is_yinye"`
IsYoutu string `json:"is_youtu"`
IsZs string `json:"is_zs"`
MinDeliveryFee string `json:"min_delivery_fee"`
MinDeliveryPrice string `json:"min_delivery_price"`
RestaurantSubsidy string `json:"restaurant_subsidy"`
ShopCategory string `json:"shop_category"`
ShopID string `json:"shop_id"`
SkuNum string `json:"sku_num"`
StartTime string `json:"startTime"`
TargetButie string `json:"target_butie"`
TargetCp string `json:"target_cp"`
TargetDeliverFee string `json:"target_deliver_fee"`
TargetJiedan string `json:"target_jiedan"`
TargetQisong string `json:"target_qisong"`
TargetSku string `json:"target_sku"`
TargetYinye string `json:"target_yinye"`
TargetYoutu string `json:"target_youtu"`
UnvalidOrderNum string `json:"unvalid_order_num"`
UpdateTime string `json:"update_time"`
Week string `json:"week"`
}
type ActivityTagInfo struct {
Color struct {
BgColor string `json:"bg_color"`
FrameColor string `json:"frame_color"`
FrontColor string `json:"front_color"`
} `json:"color"`
Discount string `json:"discount"`
Msg string `json:"msg"`
Type string `json:"type"`
}
type PageListInnerShopInfo struct {
ActivityTag []*ActivityTagInfo `json:"activity_tag"`
BrandName string `json:"brand_name"`
BusinessStatus int `json:"business_status"`
BusinessTime []*BussinessTimeInfo `json:"business_time"`
CanRefund int `json:"can_refund"`
CashGiftComment string `json:"cash_gift_comment"`
DeliveryTime int `json:"delivery_time"`
DisplayRefundLabel int `json:"display_refund_label"`
Distance float64 `json:"distance"`
EleID string `json:"ele_id"`
FlashsalesStyleShop int `json:"flashsales_style_shop"`
HasFoodEnsurance int `json:"has_food_ensurance"`
HasServiceCommitment int `json:"has_service_commitment"`
HitGod int `json:"hit_god"`
IsBrand int `json:"is_brand"`
IsDoubleTwelve int `json:"is_double_twelve"`
IsRank int `json:"is_rank"`
IsTransfer int `json:"is_transfer"`
LogoURL string `json:"logo_url"`
OverallRating float64 `json:"overall_rating"`
SaledMonth int `json:"saled_month"`
SameBrandFolding []struct {
DeliveryTime int `json:"delivery_time"`
Distance float64 `json:"distance"`
EleID string `json:"ele_id"`
IsTransfer int `json:"is_transfer"`
ShopName string `json:"shop_name"`
Wid string `json:"wid"`
} `json:"same_brand_folding"`
ShopLabels string `json:"shop_labels"`
ShopName string `json:"shop_name"`
TakeoutCost float64 `json:"takeout_cost"`
TakeoutPrice float64 `json:"takeout_price"`
Type interface{} `json:"type"`
WelfareInfo []struct {
IconColor struct {
BgColor string `json:"bg_color"`
FrameColor string `json:"frame_color"`
FrontColor string `json:"front_color"`
} `json:"icon_color"`
IconName string `json:"icon_name"`
IconNameOther string `json:"icon_name_other"`
Msg string `json:"msg"`
Type string `json:"type"`
} `json:"welfare_info"`
Wid string `json:"wid"`
}
type PageListShopInfo struct {
ActivityEntry interface{} `json:"activity_entry"`
AoiID string `json:"aoi_id"`
DisplayWindow []struct {
CategoryIds []string `json:"category_ids"`
CurrentPrice string `json:"current_price"`
Image string `json:"image"`
ItemID string `json:"item_id"`
LeftNum int `json:"left_num"`
Name string `json:"name"`
OriginPrice string `json:"origin_price"`
SkuID string `json:"sku_id"`
} `json:"display_window"`
ShopInfo *PageListInnerShopInfo `json:"shop_info"`
}
type PageListInfo struct {
ShopList []*PageListShopInfo `json:"shop_list"`
Total int `json:"total"`
UserType string `json:"user_type"`
}
type PageShopInfo struct {
Activities []struct {
IconColor struct {
BgColor string `json:"bg_color"`
FrameColor string `json:"frame_color"`
FrontColor string `json:"front_color"`
} `json:"icon_color"`
IconName string `json:"icon_name"`
IconNameOther string `json:"icon_name_other"`
Msg string `json:"msg"`
Type string `json:"type"`
} `json:"activities"`
ActivityTag []*ActivityTagInfo `json:"activity_tag"`
Address string `json:"address"`
Albums []interface{} `json:"albums"`
BdHeadBg string `json:"bd_head_bg"`
BdHeadColor string `json:"bd_head_color"`
Brand string `json:"brand"`
BusinessStatus int `json:"business_status"`
CanRefund int `json:"can_refund"`
Category string `json:"category"`
CityID string `json:"city_id"`
CurrentBusinessTime interface{} `json:"current_business_time"` // 无值时为空字符串,有值时为对象:{"end":"20:45","start":"08:05"}
DeliveryInfo []interface{} `json:"delivery_info"`
DeliveryMode struct {
Tag []interface{} `json:"tag"`
Text string `json:"text"`
} `json:"delivery_mode"`
Description string `json:"description"`
DisplayRefundLabel int `json:"display_refund_label"`
Distance int `json:"distance"`
EleBusinessState int `json:"ele_business_state"`
EleID string `json:"ele_id"`
FirstOpenTime *BussinessTimeInfo `json:"first_open_time"`
HitGod int `json:"hit_god"`
ImagePath string `json:"image_path"`
IsColdChain int `json:"is_cold_chain"`
IsDoubleTwelve int `json:"is_double_twelve"`
IsMedicineShop int `json:"is_medicine_shop"`
IsOwnTheme int `json:"is_own_theme"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
MedicineQualification []*struct {
AptitudeName string `json:"aptitude_name"`
AptitudePhoto []string `json:"aptitude_photo"`
AptitudeType string `json:"aptitude_type"`
LicenseNumber string `json:"license_number"`
} `json:"medicine_qualification"`
Name string `json:"name"`
NewStyle bool `json:"new_style"`
OTakoutCost int `json:"o_takout_cost"`
OTakoutPrice int `json:"o_takout_price"`
OrderLeadTime interface{} `json:"order_lead_time"`
Phone string `json:"phone"`
PromotionInfo string `json:"promotion_info"`
Qualification string `json:"qualification"`
RecentOrderNum int `json:"recent_order_num"`
ShopID string `json:"shop_id"`
ShopScore float64 `json:"shop_score"`
ShopSourceFrom int `json:"shop_source_from"`
SkuCount int `json:"sku_count"`
TakeoutCost float64 `json:"takeout_cost"`
TakeoutInvoice float64 `json:"takeout_invoice"`
TakeoutInvoiceMinPrice string `json:"takeout_invoice_min_price"`
TakeoutOpenTime string `json:"takeout_open_time"`
TakeoutPrice float64 `json:"takeout_price"`
}
func (a *API) AccessStorePage2(subURL string, params map[string]interface{}, isPost bool, cookies map[string]string) (retVal map[string]interface{}, err error) {
if a.GetCookieCount() == 0 {
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
}
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
var request *http.Request
if !isPost {
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(storeURL, subURL, params), nil)
} else {
request, _ = http.NewRequest(http.MethodPost, utils.GenerateGetURL(storeURL, subURL, nil), strings.NewReader(utils.Map2URLValues(params).Encode()))
request.Header.Set("charset", "UTF-8")
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
}
a.FillRequestCookies(request)
for k, v := range cookies {
request.AddCookie(&http.Cookie{
Name: k,
Value: v,
})
}
return request
},
a.config,
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
if jsonResult1 == nil {
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
}
retVal = jsonResult1
code := int(utils.MustInterface2Int64(jsonResult1["errno"]))
if code == ResponseCodeSuccess {
if subURL == swithShopURL {
for _, v := range response.Cookies() {
if v.Name == "SWITCH_SHOP" {
retVal = utils.Struct2FlatMap(v)
break
}
}
} else {
retVal, _ = jsonResult1["data"].(map[string]interface{})
}
return platformapi.ErrLevelSuccess, nil
}
newErr := utils.NewErrorIntCode(jsonResult1["errmsg"].(string), code)
if code == ResponseCodeCallElmFailed {
return platformapi.ErrLevelRecoverableErr, newErr
}
baseapi.SugarLogger.Debugf("ebai AccessStorePage failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
return platformapi.ErrLevelCodeIsNotOK, newErr
})
return retVal, err
}
func (a *API) AccessStorePage(subURL string, params map[string]interface{}, isPost bool) (retVal map[string]interface{}, err error) {
return a.AccessStorePage2(subURL, params, isPost, nil)
}
func (a *API) GetRealMobile4Order(orderId string) (mobile string, err error) {
retVal, err := a.GetStoreOrderInfo(orderId)
if err == nil {
return retVal["order_basic"].(map[string]interface{})["user_phone_call"].(string), nil
}
return "", err
}
func (a *API) GetStoreOrderInfo(orderId string) (storeOrderInfo map[string]interface{}, err error) {
retVal, err := a.AccessStorePage("crm/orderlist", map[string]interface{}{
"keyword": orderId,
}, false)
if err == nil {
resultList := retVal["order_list"].([]interface{})
if len(resultList) > 0 {
return resultList[0].(map[string]interface{}), nil
}
return nil, fmt.Errorf("不能找到订单:%s的相关信息", orderId)
}
return nil, err
}
// todo 与上一个函数重了
func (a *API) GetStoreOrderInfoList(fromTime, toTime string, shopID string, orderStatus int) (storeOrderList []map[string]interface{}, err error) {
// pageSize := 20
pageNo := 1
params := map[string]interface{}{
"start_timestamp": utils.Str2Time(fromTime).Unix(),
"end_timestamp": utils.Str2Time(toTime).Unix(),
"shop_id": shopID,
}
if orderStatus >= 0 {
params["order_status"] = orderStatus
}
for {
params["page"] = pageNo
retVal, err2 := a.AccessStorePage("crm/orderlist", params, false)
if err = err2; err == nil {
resultList := retVal["order_list"].([]interface{})
storeOrderList = append(storeOrderList, utils.Slice2MapSlice(resultList)...)
if len(storeOrderList) >= int(utils.MustInterface2Int64(retVal["order_count"])) {
return storeOrderList, nil
}
pageNo++
} else {
return nil, err
}
}
return nil, err
}
func (a *API) getCommentList(isElm bool, fromTime, toTime time.Time, shopID, supplierID string, replyStatus, level, nonEmpty int) (commentList []map[string]interface{}, err error) {
pageSize := 200
pageNo := 1
params := map[string]interface{}{
"start_time": utils.Time2Str(fromTime),
"end_time": utils.Time2Str(toTime),
"page_count": pageSize,
}
if shopID != "" {
params["shop_id"] = shopID
} else if supplierID != "" {
params["supplier_id"] = supplierID
}
if replyStatus != ReplyStatusAll {
params["reply_status"] = replyStatus
}
if level != CommentLevelAll {
params["level"] = level
}
if nonEmpty != CommentContentAll {
params["nonempty"] = nonEmpty
}
fixedURL := fmt.Sprintf("crm/%s", []string{
"getelecommentlist",
"getcommentlist",
}[1-utils.Bool2Int(isElm)])
for {
params["page_num"] = pageNo
retVal, err2 := a.AccessStorePage(fixedURL, params, false)
if err = err2; err == nil {
for _, comment := range retVal["comment_list"].([]interface{}) {
commentMap := comment.(map[string]interface{})
for _, orderComment := range commentMap["order_commentList"].([]interface{}) {
orderCommentMap := orderComment.(map[string]interface{})
orderCommentMap["order_id"] = commentMap["order_id"]
orderCommentMap["shop_id"] = commentMap["shop_id"]
commentList = append(commentList, orderComment.(map[string]interface{}))
}
}
if len(commentList) >= int(utils.MustInterface2Int64(retVal["total"])) {
return commentList, nil
}
pageNo++
} else {
return nil, err
}
}
return nil, err
}
func (a *API) GetEleCommentList(fromTime, toTime time.Time, shopID, supplierID string, replyStatus, level, nonEmpty int) (commentList []map[string]interface{}, err error) {
return a.getCommentList(true, fromTime, toTime, shopID, supplierID, replyStatus, level, nonEmpty)
}
func (a *API) GetCommentList(fromTime, toTime time.Time, shopID, supplierID string, replyStatus, level, nonEmpty int) (commentList []map[string]interface{}, err error) {
return a.getCommentList(false, fromTime, toTime, shopID, supplierID, replyStatus, level, nonEmpty)
}
func (a *API) PageGetSkuList(baiduShopID int64) (skuList []map[string]interface{}, err error) {
pageSize := 200
pageNo := 1
params := map[string]interface{}{
"upc_type": 2,
"weight": 2,
"wid": baiduShopID,
"perpage": pageSize,
}
for {
params["curpage"] = pageNo
retVal, err2 := a.AccessStorePage("commodity/getskulist", params, false)
if err = err2; err == nil {
for _, sku := range retVal["sku_list"].([]interface{}) {
skuList = append(skuList, sku.(map[string]interface{}))
}
if len(skuList) >= int(utils.Str2Int64(utils.Interface2String(retVal["total"]))) {
return skuList, nil
}
pageNo++
} else {
return nil, err
}
}
return nil, err
}
func (a *API) PageGetCustomSkuList(baiduShopID int64, customCatID int64) (skuList []map[string]interface{}, err error) {
params := map[string]interface{}{
"wid": baiduShopID,
"custom_cat_id": customCatID,
}
retVal, err := a.AccessStorePage("commodity/getCustomSkuList", params, false)
if err == nil {
return utils.Slice2MapSlice(retVal["sku_list"].([]interface{})), nil
}
return nil, err
}
func (a *API) PageGetCustomCatList(baiduShopID int64) (catList []map[string]interface{}, err error) {
params := map[string]interface{}{
"wid": baiduShopID,
}
retVal, err := a.AccessStorePage("commodity/GetCustomCatList", params, false)
if err == nil {
return utils.Slice2MapSlice(retVal["cat_list"].([]interface{})), nil
}
return nil, err
}
func (a *API) GetStoreList(lng string, lat string, pageNo, pageSize int) (shopListInfo *PageListInfo, err error) {
if pageNo <= 0 {
pageNo = 1
}
if pageSize > 20 || pageSize <= 0 {
pageSize = 20
}
params := map[string]interface{}{
"channel": "kitchen",
"rn": pageSize,
"pn": pageNo,
"lng": lng,
"lat": lat,
}
// 水果
// https://h5.ele.me/restapi/shopping/v3/restaurants?latitude=30.64743&longitude=104.089981&keyword=&offset=0&limit=8&extras[]=activities&extras[]=tags&terminal=h5&rank_id=456ad3b166954bc996324b6fc43a29fb&order_by=0&brand_ids[]=&restaurant_category_ids[]=245
result, err := a.AccessStorePageNoCookie("newretail/main/shoplist", params)
if err == nil && result != nil {
err = utils.Map2StructByJson(result, &shopListInfo, true)
}
return shopListInfo, err
}
func (a *API) GetStoreList2(lng float64, lat float64) (shopListInfo *PageListInfo, err error) {
pageSize := 20
pageNo := 1
for {
retVal, err2 := a.GetStoreList(fmt.Sprintf("%.6f", lng), fmt.Sprintf("%.6f", lat), pageNo, pageSize)
if err = err2; err == nil {
if shopListInfo == nil {
shopListInfo = retVal
} else {
shopListInfo.ShopList = append(shopListInfo.ShopList, retVal.ShopList...)
}
if len(retVal.ShopList) < pageSize {
break
}
pageNo++
} else {
break
}
}
return shopListInfo, err
}
func (a *API) GetStoreInfo(storeId string) (storeInfo map[string]interface{}, err error) {
params := map[string]interface{}{
"shop_id": storeId,
"lng": 0,
"lat": 0,
}
retVal, err := a.AccessStorePageNoCookie("newretail/shop/getshopinfo", params)
if err != nil {
return nil, err
}
if retVal != nil {
retVal["shop_id"] = storeId
}
return retVal, err
}
func (a *API) GetStoreInfo2(storeID string) (storeInfo *PageShopInfo, err error) {
retVal, err := a.GetStoreInfo(storeID)
if err == nil {
if retVal != nil {
err = utils.Map2StructByJson(retVal, &storeInfo, true)
}
}
return storeInfo, err
}
func (a *API) AccessStorePageNoCookie(subURL string, params map[string]interface{}) (retVal map[string]interface{}, err error) {
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
fullURL := utils.GenerateGetURL(getStoreURL, subURL, params)
request, _ := http.NewRequest(http.MethodGet, fullURL, nil)
if err != nil {
return nil
}
return request
},
a.config,
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
if jsonResult1 == nil {
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
}
code := int(utils.MustInterface2Int64(jsonResult1["error_no"]))
if code == ResponseCodeSuccess {
retVal = jsonResult1["result"].(map[string]interface{})
return platformapi.ErrLevelSuccess, nil
} else if code == GetStoreSuccessButUnderfind {
return platformapi.ErrLevelSuccess, nil
}
newErr := utils.NewErrorIntCode(jsonResult1["error_msg"].(string), code)
return platformapi.ErrLevelCodeIsNotOK, newErr
})
return retVal, err
}
func (a *API) SwitchShop(baiduShopID int64) (switchShopCookie string, err error) {
result, err := a.AccessStorePage("crm/manager/switchshop", map[string]interface{}{
"switch_shop_id": baiduShopID,
}, true)
if err == nil {
switchShopCookie = utils.Interface2String(result["Value"])
}
return switchShopCookie, err
}
func (a *API) GetShopUserInfo2(switchShopCookie string) (shopUserInfo *PageShopUserInfo, err error) {
shopInfo, err := a.AccessStorePage2("crm/account/getshopuserinfo", nil, true, map[string]string{
"SWITCH_SHOP": switchShopCookie,
})
if err == nil {
err = utils.Map2StructByJson(shopInfo, &shopUserInfo, true)
}
return shopUserInfo, err
}
func (a *API) GetShopUserInfo(baiduShopID int64) (shopUserInfo *PageShopUserInfo, err error) {
switchShopCookie, err := a.SwitchShop(baiduShopID)
if err != nil {
return nil, err
}
return a.GetShopUserInfo2(switchShopCookie)
}
func (a *API) GetShopHealthByDetail2(switchShopCookie string) (shopHealthDetail *PageShopHealthInfo, err error) {
shopInfo, err := a.GetShopUserInfo2(switchShopCookie)
if err != nil {
return nil, err
}
result, err := a.AccessStorePage2("crm/getshophealthydetail", map[string]interface{}{
"shop_id": shopInfo.EleID,
}, true, map[string]string{
"SWITCH_SHOP": switchShopCookie,
})
if err == nil {
if err = utils.Map2StructByJson(result, &shopHealthDetail, true); err == nil {
shopHealthDetail.MerchantID = shopInfo.MerchantID
shopHealthDetail.MerchantName = shopInfo.MerchantName
}
}
return shopHealthDetail, err
}
func (a *API) GetShopHealthByDetail(baiduShopID int64) (shopHealthDetail *PageShopHealthInfo, err error) {
switchShopCookie, err := a.SwitchShop(baiduShopID)
if err != nil {
return nil, err
}
return a.GetShopHealthByDetail2(switchShopCookie)
}