aa
This commit is contained in:
@@ -42,7 +42,7 @@ func TestCommonShopCategories(t *testing.T) {
|
||||
"category1": "厨房生鲜",
|
||||
"category2": "水产"
|
||||
} */
|
||||
result, err := api.CommonShopCategories(277, 2)
|
||||
result, err := api.CommonShopCategories(274, 2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
|
||||
@@ -13,7 +13,7 @@ const (
|
||||
)
|
||||
|
||||
func TestGetStationInfoList(t *testing.T) {
|
||||
result, err := api.GetStationInfoList("12005640", []int64{2023434101})
|
||||
result, err := api.GetStationInfoList("12005640", []int64{2023417515})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -23,9 +23,9 @@ func TestGetStationInfoList(t *testing.T) {
|
||||
func TestDelVipPrice(t *testing.T) {
|
||||
err := api.DelVipPrice("667281", []*SkuIdEntity{
|
||||
&SkuIdEntity{
|
||||
OutSkuId: "26074",
|
||||
OutSkuId: "31196",
|
||||
},
|
||||
}, "")
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -218,6 +218,8 @@ func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}
|
||||
return a.AccessAPI2(cmd, isGet, bizParams, resultKeyData, "")
|
||||
}
|
||||
|
||||
//美团认证
|
||||
//https://open-shangou.meituan.com/home/guide/38
|
||||
func (a *API) GetOAuthCode(appPoiCode string) (retVal interface{}, err error) {
|
||||
retVal, err = a.AccessAPI2("oauth/authorize", true, map[string]interface{}{
|
||||
"app_poi_code": appPoiCode,
|
||||
@@ -233,3 +235,19 @@ func (a *API) GetAccessToken(code string) (retVal interface{}, err error) {
|
||||
}, "access_token", "")
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) GetAccessToken2(appPoiCode string) (retVal interface{}, err error) {
|
||||
retVal, err = a.AccessAPI2("oauth/authorize", true, map[string]interface{}{
|
||||
"response_type": "token",
|
||||
"app_poi_code": appPoiCode,
|
||||
}, "access_token", "")
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) RefreshAccessToken(token string) (retVal interface{}, err error) {
|
||||
retVal, err = a.AccessAPI2("oauth/token", false, map[string]interface{}{
|
||||
"grant_type": "refresh_token",
|
||||
"refresh_token": token,
|
||||
}, "access_token", "")
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
@@ -55,3 +55,11 @@ func TestGetAccessToken(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestGetAccessToken2(t *testing.T) {
|
||||
result, err := api.GetAccessToken2("10874383")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
@@ -184,3 +184,89 @@ func (a *API) ImageUploadByURL(poiCode, imgName, imgURL string) (imgID string, e
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
type PoiSettleSaveParam struct {
|
||||
Type int `json:"type"` //0创建,1更新
|
||||
ApplyInfos []*ApplyInfo `json:"apply_info"`
|
||||
}
|
||||
|
||||
type ApplyInfo struct {
|
||||
AppPoiCode string `json:"app_poi_code"`
|
||||
SettlementID int `json:"settlement_id"`
|
||||
MultiPoiBasicInfo *MultiPoiBasicInfo `json:"multi_poi_basic_info"`
|
||||
MultiPoiCertInfos []*MultiPoiCertInfo `json:"multi_poi_cert_infos"`
|
||||
MultiPoiShippingInfo *MultiPoiShippingInfo `json:"multi_poi_shipping_info"`
|
||||
}
|
||||
|
||||
type MultiPoiBasicInfo struct {
|
||||
Name string `json:"name"`
|
||||
City string `json:"city"`
|
||||
Address string `json:"address"`
|
||||
Longitude string `json:"longitude"`
|
||||
Latitude string `json:"latitude"`
|
||||
FirstTag int `json:"first_tag"`
|
||||
CallCenter string `json:"call_center"`
|
||||
ContactName string `json:"contact_name"`
|
||||
ContactPhone string `json:"contact_phone"`
|
||||
EcommerceAccountPhone string `json:"ecommerce_account_phone"`
|
||||
ShippingTime string `json:"shipping_time"`
|
||||
}
|
||||
|
||||
type MultiPoiCertInfo struct {
|
||||
IsLongTime int `json:"is_long_time"`
|
||||
Type int `json:"type"`
|
||||
LicenseAddress string `json:"license_address,omitempty"`
|
||||
LicenseCheckDate string `json:"license_check_date,omitempty"`
|
||||
LicenseCheckOrganization string `json:"license_check_organization,omitempty"`
|
||||
LicenseLegalPerson string `json:"license_legal_person,omitempty"`
|
||||
LicenseName string `json:"license_name,omitempty"`
|
||||
LicenseNumber string `json:"license_number,omitempty"`
|
||||
LicenseOperator string `json:"license_operator,omitempty"`
|
||||
LicenseProject string `json:"license_project,omitempty"`
|
||||
LicenseRegisterDate string `json:"license_register_date,omitempty"`
|
||||
LicenseSocialCreditCode string `json:"license_social_credit_code,omitempty"`
|
||||
LicenseSubject string `json:"license_subject,omitempty"`
|
||||
LicensePic string `json:"license_pic"`
|
||||
LicenseValidity string `json:"license_validity,omitempty"`
|
||||
LicenseValidStartDate string `json:"license_valid_start_date,omitempty"`
|
||||
}
|
||||
|
||||
type MultiPoiShippingInfo struct {
|
||||
ShippingType int `json:"shipping_type"`
|
||||
MinPrice float64 `json:"min_price"`
|
||||
ShippingFee string `json:"shipping_fee"`
|
||||
}
|
||||
|
||||
//https://open-shangou.meituan.com/home/docDetail/530
|
||||
func (a *API) PoiSettleSave(poiSettleSaveParam *PoiSettleSaveParam) (err error) {
|
||||
_, err = a.AccessAPI("ecommerce/poi/settle/multi/save", false, utils.Struct2FlatMap(poiSettleSaveParam))
|
||||
return err
|
||||
}
|
||||
|
||||
type PoiSettleCategoryListResult struct {
|
||||
SingleCategoryTree []struct {
|
||||
LevelOneName string `json:"level_one_name"`
|
||||
LevelOneCode int `json:"level_one_code"`
|
||||
LevelTwoInfo []struct {
|
||||
LevelTwoName string `json:"level_two_name"`
|
||||
LevelTwoCode int `json:"level_two_code"`
|
||||
} `json:"level_two_info"`
|
||||
} `json:"single_category_tree"`
|
||||
MultiCategoryTree []struct {
|
||||
LevelOneName string `json:"level_one_name"`
|
||||
LevelOneCode int `json:"level_one_code"`
|
||||
LevelTwoInfo []struct {
|
||||
LevelTwoName string `json:"level_two_name"`
|
||||
LevelTwoCode int `json:"level_two_code"`
|
||||
} `json:"level_two_info"`
|
||||
} `json:"multi_category_tree"`
|
||||
}
|
||||
|
||||
//查询门店经营品类列表
|
||||
func (a *API) PoiSettleCategoryList() (poiSettleCategoryListResult *PoiSettleCategoryListResult, err error) {
|
||||
result, err := a.AccessAPI("ecommerce/poi/settle/category/list", true, nil)
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result, &poiSettleCategoryListResult, false)
|
||||
}
|
||||
return poiSettleCategoryListResult, err
|
||||
}
|
||||
|
||||
@@ -113,3 +113,31 @@ func TestPackagePriceGet(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(priceInfo, false))
|
||||
}
|
||||
|
||||
func TestPoiSettleSave(t *testing.T) {
|
||||
err := api.PoiSettleSave(&PoiSettleSaveParam{
|
||||
Type: 0,
|
||||
ApplyInfos: []*ApplyInfo{
|
||||
&ApplyInfo{
|
||||
AppPoiCode: "",
|
||||
SettlementID: 0, //结算ID
|
||||
MultiPoiBasicInfo: &MultiPoiBasicInfo{
|
||||
Name: "xxx店",
|
||||
City: "成都",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// t.Log(utils.Format4Output(priceInfo, false))
|
||||
}
|
||||
|
||||
func TestPoiSettleCategoryList(t *testing.T) {
|
||||
result, err := api.PoiSettleCategoryList()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user