aa
This commit is contained in:
@@ -36,9 +36,9 @@ func init() {
|
|||||||
|
|
||||||
// 京西果园
|
// 京西果园
|
||||||
// api = New("35957", "10013fbb7c2ddad7")
|
// api = New("35957", "10013fbb7c2ddad7")
|
||||||
api.SetCookie("PASSPORT_DELIMONT_TOKEN", "PBE_2.0_5cd1c6141c127d4188f026ac01fc93656266683e8dfb3127c2fdf894259e9034125ff3bdd2a997a385802ee3ef1802ba93a04acea34fde2d2b6e802c5dcd4ec6e3f4ad909a1d806e3ceeb349ed726b03d60ed1fe7010d4140aa338d9c5f05e3fec172c78d3d7f0ca579d61b7015af1bf99aa46b04d2b8a64aa50646dc09afe94b6b60e0ba9a933635db5e8b2a035e9b6d693b289acf1b256d5b9a3f8478c87b0b009115bfd1394f20bb5a0dc2c07b8d013a25f286ec6bf7f2d86010d65507e31358834b7a6b58fbd88cb3f1a12cf71c997b91c1527f6f3c10693f7c2bd6073da8633a98cd2dc1114dfa5be5ee0e60b02cf7e4a94d0fb563a8c01717e7c050f02249117219c07a2eb211577c208ba77f4d536fa25139bc249be93b38d6fc495ef67a32aa206835d177db402bc534de1d29caf4f6b4fbcd912c13f167d00d1732222744c336a5189728f72fb5e153c4b1164171cfb0c811f34f4c2fedd43f721b8706b43f8d631251c")
|
// api.SetCookie("PASSPORT_DELIMONT_TOKEN", "PBE_2.0_5cd1c6141c127d4188f026ac01fc93656266683e8dfb3127c2fdf894259e9034125ff3bdd2a997a385802ee3ef1802ba93a04acea34fde2d2b6e802c5dcd4ec6e3f4ad909a1d806e3ceeb349ed726b03d60ed1fe7010d4140aa338d9c5f05e3fec172c78d3d7f0ca579d61b7015af1bf99aa46b04d2b8a64aa50646dc09afe94b6b60e0ba9a933635db5e8b2a035e9b6d693b289acf1b256d5b9a3f8478c87b0b009115bfd1394f20bb5a0dc2c07b8d013a25f286ec6bf7f2d86010d65507e31358834b7a6b58fbd88cb3f1a12cf71c997b91c1527f6f3c10693f7c2bd6073da8633a98cd2dc1114dfa5be5ee0e60b02cf7e4a94d0fb563a8c01717e7c050f02249117219c07a2eb211577c208ba77f4d536fa25139bc249be93b38d6fc495ef67a32aa206835d177db402bc534de1d29caf4f6b4fbcd912c13f167d00d1732222744c336a5189728f72fb5e153c4b1164171cfb0c811f34f4c2fedd43f721b8706b43f8d631251c")
|
||||||
api.SetCookie("WMUSS", "4AAPQCAAB5PF0aUGcBVzoRTCEkOFhFIhx-Yk9vN2EfPHYoLlROKBEsQmAUQjhNUgRt0ADAP5x-RFklwAAdjxGO11iOj8xKXYSSDIJb2BcPghsaklNfQwGS10JOVRFfhAiYElhEXFXIzoJKyloCGdwdFE6Qk9FRxojUFN3FVEHNjJPZJu4Bt9nxQ13cwoMbjA")
|
api.SetCookie("WMUSS", "OGEXYTMTAwMDAyNzYxNzAwOTEyTmEyYjVodzNQ")
|
||||||
api.SetCookie("WMSTOKEN", "AcAANQZAABbC04rUBZFc2UYanlocDAaP0dcfzZCeS1SHQ1qJ15ExgAA13A2dGLjdbcitBZJu4Bn6B_g6cZAAA0tyyFm8cdBaNAQAAwug8HTG0xRjwt1UZzbcAAN7ofRO")
|
api.SetCookie("WMSTOKEN", "OGEXYTMTAwMDAyNzYxNzAwOTEyTmEyYjVodzNQ")
|
||||||
// api.SetCookieWithStr(`
|
// api.SetCookieWithStr(`
|
||||||
// PASSPORT_DELIMONT_TOKEN=PBE_2.0_5cd1c6141c127d4188f026ac01fc93656266683e8dfb3127c2fdf894259e9034125ff3bdd2a997a385802ee3ef1802ba93a04acea34fde2d2b6e802c5dcd4ec6e3f4ad909a1d806e3ceeb349ed726b03d60ed1fe7010d4140aa338d9c5f05e3fec172c78d3d7f0ca579d61b7015af1bf99aa46b04d2b8a64aa50646dc09afe94b6b60e0ba9a933635db5e8b2a035e9b6d693b289acf1b256d5b9a3f8478c87b0b009115bfd1394f20bb5a0dc2c07b8d013a25f286ec6bf7f2d86010d65507e31358834b7a6b58fbd88cb3f1a12cf71c997b91c1527f6f3c10693f7c2bd6073da8633a98cd2dc1114dfa5be5ee0e60b02cf7e4a94d0fb563a8c01717e7c050f02249117219c07a2eb211577c208ba77f4d536fa25139bc249be93b38d6fc495ef67a32aa206835d177db402bc534de1d29caf4f6b4fbcd912c13f167d00d1732222744c336a5189728f72fb5e153c4b1164171cfb0c811f34f4c2fedd43f721b8706b43f8d631251c
|
// PASSPORT_DELIMONT_TOKEN=PBE_2.0_5cd1c6141c127d4188f026ac01fc93656266683e8dfb3127c2fdf894259e9034125ff3bdd2a997a385802ee3ef1802ba93a04acea34fde2d2b6e802c5dcd4ec6e3f4ad909a1d806e3ceeb349ed726b03d60ed1fe7010d4140aa338d9c5f05e3fec172c78d3d7f0ca579d61b7015af1bf99aa46b04d2b8a64aa50646dc09afe94b6b60e0ba9a933635db5e8b2a035e9b6d693b289acf1b256d5b9a3f8478c87b0b009115bfd1394f20bb5a0dc2c07b8d013a25f286ec6bf7f2d86010d65507e31358834b7a6b58fbd88cb3f1a12cf71c997b91c1527f6f3c10693f7c2bd6073da8633a98cd2dc1114dfa5be5ee0e60b02cf7e4a94d0fb563a8c01717e7c050f02249117219c07a2eb211577c208ba77f4d536fa25139bc249be93b38d6fc495ef67a32aa206835d177db402bc534de1d29caf4f6b4fbcd912c13f167d00d1732222744c336a5189728f72fb5e153c4b1164171cfb0c811f34f4c2fedd43f721b8706b43f8d631251c
|
||||||
// `)
|
// `)
|
||||||
|
|||||||
@@ -640,15 +640,15 @@ func (a *API) AccessStorePage2(subURL, storeURL2 string, params map[string]inter
|
|||||||
if storeURL2 != "" {
|
if storeURL2 != "" {
|
||||||
return platformapi.ErrLevelSuccess, nil
|
return platformapi.ErrLevelSuccess, nil
|
||||||
}
|
}
|
||||||
if jsonResult1["errno"] == nil {
|
// if jsonResult1["errno"] == nil {
|
||||||
if storeURL2 == "" {
|
// if storeURL2 == "" {
|
||||||
if jsonResult1[platformapi.KeyData] == nil {
|
// if jsonResult1[platformapi.KeyData] == nil {
|
||||||
baseapi.SugarLogger.Warnf("ebai AccessStorePage2, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
// baseapi.SugarLogger.Warnf("ebai AccessStorePage2, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||||
} else {
|
// } else {
|
||||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("%s return not json", subURL)
|
// return platformapi.ErrLevelRecoverableErr, fmt.Errorf("%s return not json", subURL)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
code := int(utils.MustInterface2Int64(jsonResult1["errno"]))
|
code := int(utils.MustInterface2Int64(jsonResult1["errno"]))
|
||||||
if code == ResponseCodeSuccess || code == ResponseCodeSuccess2 {
|
if code == ResponseCodeSuccess || code == ResponseCodeSuccess2 {
|
||||||
if subURL == swithShopURL {
|
if subURL == swithShopURL {
|
||||||
@@ -1148,3 +1148,330 @@ func (a *API) GetEbaiShopShareInfo() (err error) {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetMainActivityListResult struct {
|
||||||
|
TemplateName interface{} `json:"templateName"`
|
||||||
|
BeginTimeRun interface{} `json:"beginTimeRun"`
|
||||||
|
EndTimeRun interface{} `json:"endTimeRun"`
|
||||||
|
Weeks interface{} `json:"weeks"`
|
||||||
|
AllowCancel interface{} `json:"allowCancel"`
|
||||||
|
InvestmentType int `json:"investmentType"`
|
||||||
|
ActivityPactName interface{} `json:"activityPactName"`
|
||||||
|
ActivityPactText interface{} `json:"activityPactText"`
|
||||||
|
ActivityPlayRule interface{} `json:"activityPlayRule"`
|
||||||
|
OperationalReviewStartTime interface{} `json:"operationalReviewStartTime"`
|
||||||
|
OperationalReviewEndTime interface{} `json:"operationalReviewEndTime"`
|
||||||
|
SignUpStatus string `json:"signUpStatus"`
|
||||||
|
IsLimit bool `json:"is_limit"`
|
||||||
|
ActivityType string `json:"activity_type"`
|
||||||
|
Weekday interface{} `json:"weekday"`
|
||||||
|
Flag string `json:"flag"`
|
||||||
|
StopStatus int `json:"stop_status"`
|
||||||
|
StopReason string `json:"stop_reason"`
|
||||||
|
CreatedAt int64 `json:"created_at"`
|
||||||
|
SkuCount int `json:"skuCount"`
|
||||||
|
Platform interface{} `json:"platform"`
|
||||||
|
PcActivityImgURL interface{} `json:"pcActivityImgUrl"`
|
||||||
|
AppActivityImgURL interface{} `json:"appActivityImgUrl"`
|
||||||
|
SignUpMinCycleTime interface{} `json:"signUpMinCycleTime"`
|
||||||
|
SignUpMaxCycleTime interface{} `json:"signUpMaxCycleTime"`
|
||||||
|
ReviewRuleID interface{} `json:"reviewRuleId"`
|
||||||
|
ReviewRuleName interface{} `json:"reviewRuleName"`
|
||||||
|
InviteActivityType int `json:"inviteActivityType"`
|
||||||
|
InvestmentTemplate int `json:"investmentTemplate"`
|
||||||
|
InvestmentWay int `json:"investmentWay"`
|
||||||
|
IsOld interface{} `json:"isOld"`
|
||||||
|
CreatedUserID string `json:"createdUserId"`
|
||||||
|
CreatedUserName string `json:"createdUserName"`
|
||||||
|
UpdatedAt string `json:"updatedAt"`
|
||||||
|
IsDelete int `json:"isDelete"`
|
||||||
|
InviteNum int `json:"inviteNum"`
|
||||||
|
AcceptNum int `json:"acceptNum"`
|
||||||
|
WaitApproveNum int `json:"waitApproveNum"`
|
||||||
|
ApproveNum int `json:"approveNum"`
|
||||||
|
GoodsNum int `json:"goodsNum"`
|
||||||
|
IsNewActivity int `json:"isNewActivity"`
|
||||||
|
SubActivityIds []int64 `json:"subActivityIds"`
|
||||||
|
CreatedUserNickName string `json:"createdUserNickName"`
|
||||||
|
TimeMode int `json:"timeMode"`
|
||||||
|
ActivityID int64 `json:"activity_id"`
|
||||||
|
StartTime int64 `json:"start_time"`
|
||||||
|
EndTime int64 `json:"end_time"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
RecruitName string `json:"recruit_name"`
|
||||||
|
RecruitDesc string `json:"recruit_desc"`
|
||||||
|
RecruitStartTime interface{} `json:"recruit_start_time"`
|
||||||
|
RecruitEndTime interface{} `json:"recruit_end_time"`
|
||||||
|
AllowSign bool `json:"allowSign"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//饿百平台流量活动
|
||||||
|
//https://ebai-zs.ele.me/api/activities/main-activity-list?pageSize=20&page=1&supplier_id=2233065879
|
||||||
|
func (a *API) GetMainActivityList(supplierID int) (getMainActivityListResult []*GetMainActivityListResult, err error) {
|
||||||
|
result, err := a.AccessStorePage("api/activities/main-activity-list", "https://ebai-zs.ele.me", map[string]interface{}{
|
||||||
|
"supplier_id": supplierID,
|
||||||
|
"pageSize": 30,
|
||||||
|
"page": 1,
|
||||||
|
}, false)
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result["data"].(map[string]interface{})["rows"], &getMainActivityListResult, false)
|
||||||
|
}
|
||||||
|
return getMainActivityListResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMainActivityDetailResult struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
MainActivityID int64 `json:"mainActivityId"`
|
||||||
|
ActivityID int64 `json:"activityId"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
TemplateID int `json:"templateId"`
|
||||||
|
TemplateName string `json:"templateName"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
BeginTime string `json:"beginTime"`
|
||||||
|
EndTime string `json:"endTime"`
|
||||||
|
BeginTimeRun string `json:"beginTimeRun"`
|
||||||
|
EndTimeRun string `json:"endTimeRun"`
|
||||||
|
Weeks string `json:"weeks"`
|
||||||
|
SigninStartTime string `json:"signinStartTime"`
|
||||||
|
SigninEndTime string `json:"signinEndTime"`
|
||||||
|
AuditStartTime string `json:"auditStartTime"`
|
||||||
|
OperationalReviewStartTime string `json:"operationalReviewStartTime"`
|
||||||
|
AuditEndTime string `json:"auditEndTime"`
|
||||||
|
OperationalReviewEndTime string `json:"operationalReviewEndTime"`
|
||||||
|
WeekRun interface{} `json:"weekRun"`
|
||||||
|
ApplyPlatform int `json:"applyPlatform"`
|
||||||
|
AllowCancel int `json:"allowCancel"`
|
||||||
|
ActivityType int `json:"activityType"`
|
||||||
|
InvestmentType int `json:"investmentType"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
ActivityPactName interface{} `json:"activityPactName"`
|
||||||
|
ActivityPactText interface{} `json:"activityPactText"`
|
||||||
|
ActivityPlayRule interface{} `json:"activityPlayRule"`
|
||||||
|
CreatedAt string `json:"createdAt"`
|
||||||
|
SuspendReason interface{} `json:"suspendReason"`
|
||||||
|
IsOld int `json:"isOld"`
|
||||||
|
InviteActivityType interface{} `json:"inviteActivityType"`
|
||||||
|
InvestmentTemplate int `json:"investmentTemplate"`
|
||||||
|
IsNewActivity int `json:"isNewActivity"`
|
||||||
|
PcActivityImgURL interface{} `json:"pcActivityImgUrl"`
|
||||||
|
AppActivityImgURL interface{} `json:"appActivityImgUrl"`
|
||||||
|
SignUpMinCycleTime interface{} `json:"signUpMinCycleTime"`
|
||||||
|
SignUpMaxCycleTime interface{} `json:"signUpMaxCycleTime"`
|
||||||
|
PlayID int `json:"playId"`
|
||||||
|
PlayName interface{} `json:"playName"`
|
||||||
|
ActivitySignupRecords interface{} `json:"activitySignupRecords"`
|
||||||
|
SignUpShopType int `json:"signUpShopType"`
|
||||||
|
ResponsePlayDataInfoDTO interface{} `json:"responsePlayDataInfoDTO"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//饿百平台流量活动详情
|
||||||
|
//https://ebai-zs.ele.me/api/activities/get-main-activity-detail?id=8134513001
|
||||||
|
func (a *API) GetMainActivityDetail(actID int) (getMainActivityDetailResult []*GetMainActivityDetailResult, err error) {
|
||||||
|
result, err := a.AccessStorePage("api/activities/get-main-activity-detail", "https://ebai-zs.ele.me", map[string]interface{}{
|
||||||
|
"id": actID,
|
||||||
|
}, false)
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result["data"].(map[string]interface{})["subActivities"], &getMainActivityDetailResult, false)
|
||||||
|
}
|
||||||
|
return getMainActivityDetailResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetSubActivityDetailResult struct {
|
||||||
|
Activity struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
MainActivityID int64 `json:"mainActivityId"`
|
||||||
|
ActivityID int64 `json:"activityId"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
TemplateID int `json:"templateId"`
|
||||||
|
TemplateName string `json:"templateName"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
BeginTime string `json:"beginTime"`
|
||||||
|
EndTime string `json:"endTime"`
|
||||||
|
BeginTimeRun string `json:"beginTimeRun"`
|
||||||
|
EndTimeRun string `json:"endTimeRun"`
|
||||||
|
Weeks string `json:"weeks"`
|
||||||
|
SigninStartTime string `json:"signinStartTime"`
|
||||||
|
SigninEndTime string `json:"signinEndTime"`
|
||||||
|
AuditStartTime string `json:"auditStartTime"`
|
||||||
|
OperationalReviewStartTime interface{} `json:"operationalReviewStartTime"`
|
||||||
|
AuditEndTime string `json:"auditEndTime"`
|
||||||
|
OperationalReviewEndTime interface{} `json:"operationalReviewEndTime"`
|
||||||
|
WeekRun interface{} `json:"weekRun"`
|
||||||
|
ApplyPlatform int `json:"applyPlatform"`
|
||||||
|
AllowCancel int `json:"allowCancel"`
|
||||||
|
ActivityType int `json:"activityType"`
|
||||||
|
InvestmentType int `json:"investmentType"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
ActivityPactName interface{} `json:"activityPactName"`
|
||||||
|
ActivityPactText interface{} `json:"activityPactText"`
|
||||||
|
ActivityPlayRule interface{} `json:"activityPlayRule"`
|
||||||
|
CreatedAt string `json:"createdAt"`
|
||||||
|
SuspendReason interface{} `json:"suspendReason"`
|
||||||
|
IsOld int `json:"isOld"`
|
||||||
|
InviteActivityType int `json:"inviteActivityType"`
|
||||||
|
InvestmentTemplate int `json:"investmentTemplate"`
|
||||||
|
IsNewActivity int `json:"isNewActivity"`
|
||||||
|
PcActivityImgURL interface{} `json:"pcActivityImgUrl"`
|
||||||
|
AppActivityImgURL interface{} `json:"appActivityImgUrl"`
|
||||||
|
SignUpMinCycleTime interface{} `json:"signUpMinCycleTime"`
|
||||||
|
SignUpMaxCycleTime interface{} `json:"signUpMaxCycleTime"`
|
||||||
|
PlayID int `json:"playId"`
|
||||||
|
PlayName interface{} `json:"playName"`
|
||||||
|
ActivitySignupRecords []struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
ActivityID int64 `json:"activityId"`
|
||||||
|
BeginTime string `json:"beginTime"`
|
||||||
|
EndTime string `json:"endTime"`
|
||||||
|
SignupStoreCount int `json:"signupStoreCount"`
|
||||||
|
SignupCommodityCount int `json:"signupCommodityCount"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
GatewayActivityID int `json:"gatewayActivityId"`
|
||||||
|
ActivityInfoID int `json:"activityInfoId"`
|
||||||
|
} `json:"activitySignupRecords"`
|
||||||
|
SignUpShopType int `json:"signUpShopType"`
|
||||||
|
ResponsePlayDataInfoDTO interface{} `json:"responsePlayDataInfoDTO"`
|
||||||
|
MarketPlay struct {
|
||||||
|
Model struct {
|
||||||
|
UUID string `json:"uuid"`
|
||||||
|
WorkspaceUUID string `json:"workspaceUuid"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Code struct {
|
||||||
|
Content string `json:"content"`
|
||||||
|
} `json:"code"`
|
||||||
|
Metas []struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
FieldType int `json:"fieldType"`
|
||||||
|
DataType string `json:"dataType"`
|
||||||
|
EditorType string `json:"editorType"`
|
||||||
|
DefaultValue interface{} `json:"defaultValue"`
|
||||||
|
Props interface{} `json:"props"`
|
||||||
|
Array bool `json:"array"`
|
||||||
|
FieldIndex int `json:"fieldIndex"`
|
||||||
|
Tip interface{} `json:"tip"`
|
||||||
|
Group struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
} `json:"group"`
|
||||||
|
Validator struct {
|
||||||
|
ValidatorType string `json:"validatorType"`
|
||||||
|
Expression string `json:"expression"`
|
||||||
|
ValidatorParameters string `json:"validatorParameters"`
|
||||||
|
} `json:"validator"`
|
||||||
|
Items interface{} `json:"items"`
|
||||||
|
SubFields interface{} `json:"subFields"`
|
||||||
|
} `json:"metas"`
|
||||||
|
Fields []struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description interface{} `json:"description"`
|
||||||
|
FieldType int `json:"fieldType"`
|
||||||
|
DataType string `json:"dataType"`
|
||||||
|
EditorType string `json:"editorType"`
|
||||||
|
DefaultValue string `json:"defaultValue"`
|
||||||
|
Props string `json:"props"`
|
||||||
|
Array bool `json:"array"`
|
||||||
|
FieldIndex interface{} `json:"fieldIndex"`
|
||||||
|
Tip interface{} `json:"tip"`
|
||||||
|
Group struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
} `json:"group"`
|
||||||
|
Validator interface{} `json:"validator"`
|
||||||
|
Items interface{} `json:"items"`
|
||||||
|
SubFields interface{} `json:"subFields"`
|
||||||
|
} `json:"fields"`
|
||||||
|
Pipelines []struct {
|
||||||
|
ResourceType string `json:"resourceType"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
FieldMappings []struct {
|
||||||
|
FieldName string `json:"fieldName"`
|
||||||
|
Expression string `json:"expression"`
|
||||||
|
} `json:"fieldMappings"`
|
||||||
|
} `json:"pipelines"`
|
||||||
|
} `json:"model"`
|
||||||
|
Instance struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
ComponentType string `json:"componentType"`
|
||||||
|
WorkspaceUUID string `json:"workspaceUuid"`
|
||||||
|
Metas struct {
|
||||||
|
ActivityID string `json:"activityId"`
|
||||||
|
ModelUUID string `json:"_model_uuid_"`
|
||||||
|
} `json:"metas"`
|
||||||
|
Fields struct {
|
||||||
|
Creator string `json:"creator"`
|
||||||
|
DateRange string `json:"dateRange"`
|
||||||
|
UserScope string `json:"userScope"`
|
||||||
|
SaleRule string `json:"saleRule"`
|
||||||
|
Weekday string `json:"weekday"`
|
||||||
|
OutBizContext string `json:"outBizContext"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ItemDiscountType string `json:"itemDiscountType"`
|
||||||
|
UserLimit string `json:"userLimit"`
|
||||||
|
EffectiveChannel string `json:"effectiveChannel"`
|
||||||
|
Budget string `json:"budget"`
|
||||||
|
TimeRange string `json:"timeRange"`
|
||||||
|
} `json:"fields"`
|
||||||
|
Features struct {
|
||||||
|
} `json:"features"`
|
||||||
|
CreateTime string `json:"createTime"`
|
||||||
|
} `json:"instance"`
|
||||||
|
} `json:"marketPlay"`
|
||||||
|
} `json:"activity"`
|
||||||
|
Rule struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
ActivityID interface{} `json:"activityId"`
|
||||||
|
SkuID interface{} `json:"skuId"`
|
||||||
|
UpcCode interface{} `json:"upcCode"`
|
||||||
|
UpcSet interface{} `json:"upcSet"`
|
||||||
|
CommodityName interface{} `json:"commodityName"`
|
||||||
|
SkuCatJSON string `json:"skuCatJson"`
|
||||||
|
SkuTitleKeyword interface{} `json:"skuTitleKeyword"`
|
||||||
|
MaxDiscount interface{} `json:"maxDiscount"`
|
||||||
|
MinDiscount interface{} `json:"minDiscount"`
|
||||||
|
MaxOriginalPrice string `json:"maxOriginalPrice"`
|
||||||
|
MinOriginalPrice string `json:"minOriginalPrice"`
|
||||||
|
MaxPresentPrice interface{} `json:"maxPresentPrice"`
|
||||||
|
MinPresentPrice interface{} `json:"minPresentPrice"`
|
||||||
|
CommodityAmount interface{} `json:"commodityAmount"`
|
||||||
|
MaxCommodityAmount int `json:"maxCommodityAmount"`
|
||||||
|
SevenDaysMinValidOrderCnt int `json:"sevenDaysMinValidOrderCnt"`
|
||||||
|
SevenDaysMaxValidOrderCnt int `json:"sevenDaysMaxValidOrderCnt"`
|
||||||
|
ThirtyDaysMinValidOrderCnt int `json:"thirtyDaysMinValidOrderCnt"`
|
||||||
|
ThirtyDaysMaxValidOrderCnt int `json:"thirtyDaysMaxValidOrderCnt"`
|
||||||
|
SevenDaysMinTotalAmt string `json:"sevenDaysMinTotalAmt"`
|
||||||
|
SevenDaysMaxTotalAmt string `json:"sevenDaysMaxTotalAmt"`
|
||||||
|
ThirtyDaysMinTotalAmt string `json:"thirtyDaysMinTotalAmt"`
|
||||||
|
ThirtyDaysMaxTotalAmt string `json:"thirtyDaysMaxTotalAmt"`
|
||||||
|
SevenDaysMinPrice int `json:"sevenDaysMinPrice"`
|
||||||
|
FifteenDaysMinPrice int `json:"fifteenDaysMinPrice"`
|
||||||
|
Type interface{} `json:"type"`
|
||||||
|
MinCommodityStocks int `json:"minCommodityStocks"`
|
||||||
|
MaxCommodityStocks int `json:"maxCommodityStocks"`
|
||||||
|
SkuCategorySource int `json:"skuCategorySource"`
|
||||||
|
} `json:"rule"`
|
||||||
|
Status struct {
|
||||||
|
Value string `json:"value"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
} `json:"status"`
|
||||||
|
CityAgentAllow bool `json:"cityAgentAllow"`
|
||||||
|
UploadedBefore bool `json:"uploadedBefore"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//饿百平台流量活动详情
|
||||||
|
//https://ebai-zs.ele.me/api/activities/get-sub-activity-detail?id=6134599001&isMobile=0
|
||||||
|
func (a *API) GetSubActivityDetail(actID int) (getSubActivityDetailResult *GetSubActivityDetailResult, err error) {
|
||||||
|
result, err := a.AccessStorePage("api/activities/get-sub-activity-detail", "https://ebai-zs.ele.me", map[string]interface{}{
|
||||||
|
"id": actID,
|
||||||
|
}, false)
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result["data"].(map[string]interface{}), &getSubActivityDetailResult, false)
|
||||||
|
}
|
||||||
|
return getSubActivityDetailResult, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -201,3 +201,27 @@ func TestGetEbaiShopShareInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
// t.Log(utils.Format4Output(result, false))
|
// t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetMainActivityList(t *testing.T) {
|
||||||
|
result, err := api.GetMainActivityList(2233065879)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetMainActivityDetail(t *testing.T) {
|
||||||
|
result, err := api.GetMainActivityDetail(8134513001)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetSubActivityDetail(t *testing.T) {
|
||||||
|
result, err := api.GetSubActivityDetail(6134599001)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ func init() {
|
|||||||
// api.SetJdCookie(cookieValue)
|
// api.SetJdCookie(cookieValue)
|
||||||
// api.SetCookie("user", "VCQUVHVJI4ELNGFZOYMCDYDUSHEJMPXZRZXSNBRB4MVBNENP72REAAZR3R4SGDJ5ZI4FLYLLN5EGBBMTFCWHZVESIWBNLKZPLHWD6UIBTPXOF5IXM6AVA3V6TUNZD5UJS43AROJ2IRPZWEN5AGZYBUEGD3MSKKBKBSRP3DSEQXLITYNBLFZCHXCA7L4KGOSJRMM7R5IQP7QGLGRQB27AOE4YMLRJ3UPTZADPWJOYB3UZ7UZHLBVZRREEX647O3WQUU4BYXUOFZPIPRR77W3PQV543E")
|
// api.SetCookie("user", "VCQUVHVJI4ELNGFZOYMCDYDUSHEJMPXZRZXSNBRB4MVBNENP72REAAZR3R4SGDJ5ZI4FLYLLN5EGBBMTFCWHZVESIWBNLKZPLHWD6UIBTPXOF5IXM6AVA3V6TUNZD5UJS43AROJ2IRPZWEN5AGZYBUEGD3MSKKBKBSRP3DSEQXLITYNBLFZCHXCA7L4KGOSJRMM7R5IQP7QGLGRQB27AOE4YMLRJ3UPTZADPWJOYB3UZ7UZHLBVZRREEX647O3WQUU4BYXUOFZPIPRR77W3PQV543E")
|
||||||
api.SetCookieWithStr(`
|
api.SetCookieWithStr(`
|
||||||
lsp-store1.jddj.com=LZSN2D4HNL7VHORO6VYPUBXBW33EQX2RQK5RL67NL62WPT7YDRVO3IZPU2644VM3AF245ANGSYECBFWQWT23NCMR4PSPSYIB2DE4AEG3C54CJ3IVE4NT772Y2ZXOXVHV6MXMGEQMTUA77SWSPFSKHWSL46U5QMM63EFG7M4X6LTPQTVXUQEFGS4MN4SASUJXKO3H5VAYNYSHYPQFRWX33CS3V7ZFZJG5TJBH3ASTKUTN4B27RGRU7M7KEKNI4UAHGIZX33RF2MHCF76BF2KB2Q3HTNXN7FSC2NHYJWBRIIRMP6W44EDED2ZMUGIFYVUY5JBXDO6GUFM74; josl-privilege1.jddj.com=LZSN2D4HNL7VHORO6VYPUBXBW33EQX2RQK5RL67NL62WPT7YDRVO3IZPU2644VM3AF245ANGSYECBFWQWT23NCMR4PSPSYIB2DE4AEG3C54CJ3IVE4NT772Y2ZXOXVHV6MXMGEQMTUA77SWSPFSKHWSL446BI2GZ76YICKHNQQE7LANVONY2SAVICNPUYL3EC2WOWZGHBIBFL2YASQA4SIPT7U327WMVWVWNW7STKUTN4B27RGRU7M7KEKNI4UAHP4BS6QGR22RJNP36KSPH3CWW7B5LYP3Q7XIQACN34TM6JCBC3BWLILQOALXSO3ZBU5Q2RZJH2BMPIU3CGHF22D5GNS3U7O2AN3PH5TI; o2o-pms1.jddj.com=LZSN2D4HNL7VHORO6VYPUBXBW33EQX2RQK5RL67NL62WPT7YDRVO3IZPU2644VM3AF245ANGSYECBFWQWT23NCMR4PSPSYIB2DE4AEG3C54CJ3IVE4NT772Y2ZXOXVHV6MXMGEQMTUA77SWSPFSKHWSL446BI2GZ76YICKHNQQE7LANVONYZR2KMLOWLHCAFI2P76M5DAFNZUD7V5LW3HQ6SB2ZHOMAEFZSUGDFJS2PVBZCSMSBXBXIJ6YFLJLKPH52G7I62SDF5RHGRTVGRAGFPLM; o2o-stock1.jddj.com=LZSN2D4HNL7VHORO6VYPUBXBW33EQX2RQK5RL67NL62WPT7YDRVO3IZPU2644VM3AF245ANGSYECBFWQWT23NCMR4PSPSYIB2DE4AEG3C54CJ3IVE4NT772Y2ZXOXVHV6MXMGEQMTUA77SWSPFSKHWSL446BI2GZ76YICKHNQQE7LANVONYZPQ63PZY7AT3AV3NFZUW43OVQTBSSIABQF7LPHTNYYSJ2LCKKUA5JS2PVBZCSMSBXBXIJ6YFLJLKPSHZBQN5H3C4TCLUKVQGVYJFI7A; store_deviceid=89a38e81dfbb776fa5f866f74ed437a3; store_session=%231616491340877; UM_distinctid=1785e64face506-0d40b0789ccacd-43734711-15f900-1785e64facfd5; jdO2OOpenPortalSessionId=891154C098C60F80008BAEFD62FA1D76.s1; JSESSIONID=D8C44B9F4593E0B675B45112F5ADCBF1.s1
|
lsp-store1.jddj.com=LSQNGFCHHF25J36CP5K7IVZ7GQ3IGPWLA3UFJDLOGRJ7D5JSEQY63IZPU2644VM3AF245ANGSYECBX4YHWF7LQNI46AL3RNJUBNL46ZJP6APMSIB5S2IL44UFTUXD4ES7NJGTRND64MSP5YAUIRCUGXTR3DP2X4QGGUXUZMYYZDPZYNHFSZ2WADBZSSJK5NTIGIQPPKWULCZTFMODOZQIP3QS74RQ25D3XYAYGWXTHOKBSRIYFDGFS4MIBIGXPL4JOU24WJL4PVF3PPYDNTOLLXDABUFAZSE6C6CNOMI6L2TAK43JJIJQRQAQUQSU537ZFLVPGBYFDJYY; store_deviceid=f8dc2505cd85d22da78edb86122bead7; jdO2OOpenPortalSessionId=D8F6FF9EE5D52F16E828FA7C3E6E0F25.s1; JSESSIONID=8DD77790D60936A8C0DA05C8F032CDF0.s1
|
||||||
|
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -302,9 +302,10 @@ func TestPeiZhiJdZhangHao(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
api.SaveCheckedInters()
|
if err := api.SaveCheckedInters(); err == nil {
|
||||||
time.Sleep(time.Second * 2)
|
time.Sleep(time.Second * 2)
|
||||||
api.ToOnline()
|
api.ToOnline()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSecond(t *testing.T) {
|
func TestSecond(t *testing.T) {
|
||||||
|
|||||||
104
platformapi/mtunionapi/mtunionapi.go
Normal file
104
platformapi/mtunionapi/mtunionapi.go
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
package mtunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi"
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
prodURL = "https://runion.meituan.com"
|
||||||
|
sigKey = "sign"
|
||||||
|
)
|
||||||
|
|
||||||
|
type API struct {
|
||||||
|
appKey string
|
||||||
|
appSecret string
|
||||||
|
client *http.Client
|
||||||
|
config *platformapi.APIConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(appKey, appSecret string, config ...*platformapi.APIConfig) *API {
|
||||||
|
curConfig := platformapi.DefAPIConfig
|
||||||
|
if len(config) > 0 {
|
||||||
|
curConfig = *config[0]
|
||||||
|
}
|
||||||
|
return &API{
|
||||||
|
appKey: appKey,
|
||||||
|
appSecret: appSecret,
|
||||||
|
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
||||||
|
config: &curConfig,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) signParam(params map[string]interface{}) (sig string) {
|
||||||
|
var valueList []string
|
||||||
|
for k, v := range params {
|
||||||
|
if k != sigKey {
|
||||||
|
if str := fmt.Sprint(v); str != "" {
|
||||||
|
valueList = append(valueList, fmt.Sprintf("%s%s", k, str))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Sort(sort.StringSlice(valueList))
|
||||||
|
valueList = append(valueList, fmt.Sprintf("%s", a.appSecret))
|
||||||
|
var valueList2 = make([]string, len(valueList)+1)
|
||||||
|
at := copy(valueList2, valueList[:0])
|
||||||
|
at += copy(valueList2[at:], []string{a.appSecret})
|
||||||
|
copy(valueList2[at:], valueList[0:])
|
||||||
|
sig = strings.Join(valueList2, "")
|
||||||
|
binSig := md5.Sum([]byte(sig))
|
||||||
|
sig = fmt.Sprintf("%x", binSig)
|
||||||
|
return sig
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) AccessAPI(action string, isPost bool, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
params["key"] = a.appKey
|
||||||
|
params = utils.MergeMaps(params, bizParams)
|
||||||
|
signStr := a.signParam(params)
|
||||||
|
params[sigKey] = signStr
|
||||||
|
fullURL := utils.GenerateGetURL(prodURL, action, nil)
|
||||||
|
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||||
|
func() *http.Request {
|
||||||
|
var request *http.Request
|
||||||
|
if !isPost {
|
||||||
|
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", params), nil)
|
||||||
|
} else {
|
||||||
|
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(params).Encode()))
|
||||||
|
}
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
if utils.MustInterface2Int64(jsonResult1["status"]) != 0 {
|
||||||
|
errLevel = platformapi.ErrLevelGeneralFail
|
||||||
|
err = utils.NewErrorCode(jsonResult1["des"].(string), utils.Int64ToStr(utils.MustInterface2Int64(jsonResult1["status"])))
|
||||||
|
baseapi.SugarLogger.Debugf("jdeclp AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||||
|
}
|
||||||
|
retVal = jsonResult1
|
||||||
|
}
|
||||||
|
return errLevel, err
|
||||||
|
})
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//https://union.meituan.com/v2/apiDetail?id=8
|
||||||
|
//https://runion.meituan.com/generateLink
|
||||||
|
func (a *API) GenerateLink(actID int, userID string) (url string, err error) {
|
||||||
|
_, err = a.AccessAPI("miniCode", false, map[string]interface{}{
|
||||||
|
"sid": userID,
|
||||||
|
"actId": actID,
|
||||||
|
})
|
||||||
|
return url, err
|
||||||
|
}
|
||||||
30
platformapi/mtunionapi/mtunionapi_test.go
Normal file
30
platformapi/mtunionapi/mtunionapi_test.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package mtunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
api *API
|
||||||
|
sugarLogger *zap.SugaredLogger
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
logger, _ := zap.NewDevelopment()
|
||||||
|
sugarLogger = logger.Sugar()
|
||||||
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
|
api = New("b6481f92b47918cd6e42e7ea4fae6084", "84d390777ddf691ff092e744ba26bfdd")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGenerateLink(t *testing.T) {
|
||||||
|
_, err := api.GenerateLink(2, strings.ToLower("EFA9876238FC11EB9101525400C36BDA"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
// t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user