1
This commit is contained in:
83
platformapi/tao_vegetable/store.go
Normal file
83
platformapi/tao_vegetable/store.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package tao_vegetable
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/request"
|
||||
)
|
||||
|
||||
var (
|
||||
chanType = int64(DefaultChannelSourceType)
|
||||
)
|
||||
|
||||
// ShopUpdateStatus 更新渠道店营业状态
|
||||
func (a *API) ShopUpdateStatus(storeID string, status int64) error {
|
||||
store := ability3156.NewAbility3156(&a.client)
|
||||
resp, err := store.AlibabaAelophyShopUpdatestatus(&request.AlibabaAelophyShopUpdatestatusRequest{
|
||||
ShopStatusUpdateRequest: &domain.AlibabaAelophyShopUpdatestatusShopStatusUpdateRequest{
|
||||
StoreId: &storeID,
|
||||
ChannelSourceType: &chanType,
|
||||
Status: &status,
|
||||
},
|
||||
}, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.ApiResult.ErrMsg != nil {
|
||||
return fmt.Errorf("ShopUpdateStatus:requestId:" + resp.RequestId + "msg:" + *resp.ApiResult.ErrMsg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ShopUpdateRange 更新渠道店销售范围
|
||||
func (a *API) ShopUpdateRange(storeID string, points []Points) error {
|
||||
var (
|
||||
store = ability3156.NewAbility3156(&a.client)
|
||||
tPoint []domain.AlibabaAelophyShopUpdaterangePoint
|
||||
)
|
||||
for _, v := range points {
|
||||
tPoint = append(tPoint, domain.AlibabaAelophyShopUpdaterangePoint{
|
||||
Lat: &v.Lat,
|
||||
Lng: &v.Lng,
|
||||
})
|
||||
}
|
||||
resp, err := store.AlibabaAelophyShopUpdaterange(&request.AlibabaAelophyShopUpdaterangeRequest{ShopRangeUpdateRequest: &domain.AlibabaAelophyShopUpdaterangeShopRangeUpdateRequest{
|
||||
StoreId: &storeID,
|
||||
ShopRanges: &[]domain.AlibabaAelophyShopUpdaterangeShopRange{
|
||||
{
|
||||
Points: &tPoint,
|
||||
},
|
||||
},
|
||||
ChannelSourceType: &chanType,
|
||||
},
|
||||
}, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.ApiResult.ErrMsg != nil {
|
||||
return fmt.Errorf("ShopUpdateRange:requestId:" + resp.RequestId + "msg:" + *resp.ApiResult.ErrMsg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ShopUpdateInfo 更新渠道店基础信息,只能更新营业时间
|
||||
// 08:00 营业开始时间(HH:mm)
|
||||
func (a *API) ShopUpdateInfo(storeID, sTime, eTime string) error {
|
||||
store := ability3156.NewAbility3156(&a.client)
|
||||
resp, err := store.AlibabaAelophyShopUpdateinfo(&request.AlibabaAelophyShopUpdateinfoRequest{
|
||||
ShopInfoUpdateRequest: &domain.AlibabaAelophyShopUpdateinfoShopInfoUpdateRequest{
|
||||
StoreId: &storeID,
|
||||
StartTime: &sTime,
|
||||
EndTime: &eTime,
|
||||
ChannelSourceType: &chanType,
|
||||
},
|
||||
}, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.ApiResult.ErrMsg != nil {
|
||||
return fmt.Errorf("ShopUpdateInfo:requestId:" + resp.RequestId + "msg:" + *resp.ApiResult.ErrMsg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user