txd
This commit is contained in:
@@ -1,110 +1,108 @@
|
||||
package domain
|
||||
|
||||
|
||||
type AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest struct {
|
||||
/*
|
||||
活动名称 */
|
||||
ActivityName *string `json:"activity_name,omitempty" `
|
||||
/*
|
||||
活动名称 */
|
||||
ActivityName *string `json:"activity_name,omitempty" `
|
||||
|
||||
/*
|
||||
活动创建者ID(仅数字) */
|
||||
CreatorId *string `json:"creator_id,omitempty" `
|
||||
/*
|
||||
活动创建者ID(仅数字) */
|
||||
CreatorId *string `json:"creator_id,omitempty" `
|
||||
|
||||
/*
|
||||
活动创建者name */
|
||||
CreatorName *string `json:"creator_name,omitempty" `
|
||||
/*
|
||||
活动创建者name */
|
||||
CreatorName *string `json:"creatdeor_name,omitempty" `
|
||||
|
||||
/*
|
||||
活动描述 */
|
||||
Description *string `json:"description,omitempty" `
|
||||
/*
|
||||
活动描述 */
|
||||
Description *string `json:"description,omitempty" `
|
||||
|
||||
/*
|
||||
活动终端:1-APP,2-POS */
|
||||
Terminals *[]int32 `json:"terminals,omitempty" `
|
||||
/*
|
||||
活动终端:1-APP,2-POS */
|
||||
Terminals *[]int32 `json:"terminals,omitempty" `
|
||||
|
||||
/*
|
||||
活动生效的经营店ID */
|
||||
StoreIds *[]string `json:"store_ids,omitempty" `
|
||||
/*
|
||||
活动生效的经营店ID */
|
||||
StoreIds *[]string `json:"store_ids,omitempty" `
|
||||
|
||||
/*
|
||||
外部活动ID(商家自定义) */
|
||||
OutActId *string `json:"out_act_id,omitempty" `
|
||||
/*
|
||||
外部活动ID(商家自定义) */
|
||||
OutActId *string `json:"out_act_id,omitempty" `
|
||||
|
||||
/*
|
||||
特价类型,1-减钱,2-一口价,3-打折 */
|
||||
DiscountType *int64 `json:"discount_type,omitempty" `
|
||||
/*
|
||||
特价类型,1-减钱,2-一口价,3-打折 */
|
||||
DiscountType *int64 `json:"discount_type,omitempty" `
|
||||
|
||||
/*
|
||||
活动开始时间 */
|
||||
StartTime *int64 `json:"start_time,omitempty" `
|
||||
/*
|
||||
活动开始时间 */
|
||||
StartTime *int64 `json:"start_time,omitempty" `
|
||||
|
||||
/*
|
||||
活动结束时间 */
|
||||
EndTime *int64 `json:"end_time,omitempty" `
|
||||
/*
|
||||
活动结束时间 */
|
||||
EndTime *int64 `json:"end_time,omitempty" `
|
||||
|
||||
/*
|
||||
活动人群编码,NEW_USER:新用户,OLD_USER:老用户,LIGHT_NEW_USER:闪购新客,MERCHANT_NEW_USER:商家新用户,MERCHANT_OLD_USER:商家老用户 */
|
||||
MemberCrowdCode *[]string `json:"member_crowd_code,omitempty" `
|
||||
/*
|
||||
活动人群编码,NEW_USER:新用户,OLD_USER:老用户,LIGHT_NEW_USER:闪购新客,MERCHANT_NEW_USER:商家新用户,MERCHANT_OLD_USER:商家老用户 */
|
||||
MemberCrowdCode *[]string `json:"member_crowd_code,omitempty" `
|
||||
|
||||
/*
|
||||
枚举: 2 美团 3 饿了么 26 京东到家 31 翱象淘鲜达 32 翱象共享库存 */
|
||||
Channels *[]string `json:"channels,omitempty" `
|
||||
|
||||
/*
|
||||
扩展信息,json串 */
|
||||
Attributes *string `json:"attributes,omitempty" `
|
||||
/*
|
||||
枚举: 2 美团 3 饿了么 26 京东到家 31 翱象淘鲜达 32 翱象共享库存 */
|
||||
Channels *[]string `json:"channels,omitempty" `
|
||||
|
||||
/*
|
||||
扩展信息,json串 */
|
||||
Attributes *string `json:"attributes,omitempty" `
|
||||
}
|
||||
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetActivityName(v string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.ActivityName = &v
|
||||
return s
|
||||
s.ActivityName = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetCreatorId(v string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.CreatorId = &v
|
||||
return s
|
||||
s.CreatorId = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetCreatorName(v string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.CreatorName = &v
|
||||
return s
|
||||
s.CreatorName = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetDescription(v string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.Description = &v
|
||||
return s
|
||||
s.Description = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetTerminals(v []int32) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.Terminals = &v
|
||||
return s
|
||||
s.Terminals = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetStoreIds(v []string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.StoreIds = &v
|
||||
return s
|
||||
s.StoreIds = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetOutActId(v string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.OutActId = &v
|
||||
return s
|
||||
s.OutActId = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetDiscountType(v int64) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.DiscountType = &v
|
||||
return s
|
||||
s.DiscountType = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetStartTime(v int64) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.StartTime = &v
|
||||
return s
|
||||
s.StartTime = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetEndTime(v int64) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.EndTime = &v
|
||||
return s
|
||||
s.EndTime = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetMemberCrowdCode(v []string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.MemberCrowdCode = &v
|
||||
return s
|
||||
s.MemberCrowdCode = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetChannels(v []string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.Channels = &v
|
||||
return s
|
||||
s.Channels = &v
|
||||
return s
|
||||
}
|
||||
func (s *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) SetAttributes(v string) *AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest {
|
||||
s.Attributes = &v
|
||||
return s
|
||||
s.Attributes = &v
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -7,7 +7,18 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/request"
|
||||
)
|
||||
|
||||
const (
|
||||
StoreOnline = 1 //营业
|
||||
StoreOnlineWord = "营业"
|
||||
StoreOffline = -1 //不营业
|
||||
StoreOfflineWord = "不营业"
|
||||
)
|
||||
|
||||
var (
|
||||
OnlineMap = map[string]int{
|
||||
StoreOnlineWord: StoreOnline,
|
||||
StoreOfflineWord: StoreOffline,
|
||||
}
|
||||
chanType = int64(DefaultChannelSourceType)
|
||||
)
|
||||
|
||||
@@ -20,7 +31,7 @@ func (a *API) ShopUpdateStatus(storeID string, status int64) error {
|
||||
ChannelSourceType: &chanType,
|
||||
Status: &status,
|
||||
},
|
||||
}, "")
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -51,7 +62,7 @@ func (a *API) ShopUpdateRange(storeID string, points []Points) error {
|
||||
},
|
||||
ChannelSourceType: &chanType,
|
||||
},
|
||||
}, "")
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -72,7 +83,7 @@ func (a *API) ShopUpdateInfo(storeID, sTime, eTime string) error {
|
||||
EndTime: &eTime,
|
||||
ChannelSourceType: &chanType,
|
||||
},
|
||||
}, "")
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/domain"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -21,9 +22,49 @@ func TestActivityCreate(t *testing.T) {
|
||||
Terminals: &[]int32{1},
|
||||
StoreIds: &[]string{"JX668998"},
|
||||
DiscountType: utils.Int64ToPointer(3),
|
||||
StartTime: utils.Int64ToPointer(time.Now().Unix()),
|
||||
EndTime: utils.Int64ToPointer(time.Now().Unix() + time.Hour.Milliseconds()),
|
||||
StartTime: utils.Int64ToPointer(time.Now().UnixNano() / int64(time.Millisecond)),
|
||||
EndTime: utils.Int64ToPointer((time.Now().UnixNano() / int64(time.Millisecond)) + 3*time.Hour.Milliseconds()),
|
||||
})
|
||||
fmt.Println(resp)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//查询单品特价活动【同城零售】
|
||||
func TestQueryAct(t *testing.T) {
|
||||
resp, err := apiTao.ActivityQuery(230658198, "")
|
||||
fmt.Println(resp)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//更新单品特价活动【同城零售】
|
||||
func TestUpdateAct(t *testing.T) {
|
||||
err := apiTao.ActivityUpdate(domain.AlibabaRetailMarketingItemdiscountActivityUpdateItemDiscountActivityOperateRequest{
|
||||
ActivityName: utils.String2Pointer("更新单品特价活动测试619"),
|
||||
CreatorId: utils.String2Pointer("20230619180157"),
|
||||
CreatorName: utils.String2Pointer("京西菜市"),
|
||||
Description: utils.String2Pointer("特价活动很火热"),
|
||||
Terminals: &[]int32{1},
|
||||
StoreIds: &[]string{"JX668998"},
|
||||
StartTime: utils.Int64ToPointer(time.Now().UnixNano() / int64(time.Millisecond)),
|
||||
EndTime: utils.Int64ToPointer((time.Now().UnixNano() / int64(time.Millisecond)) + 3*time.Hour.Milliseconds()),
|
||||
ActId: utils.Int64ToPointer(230658198),
|
||||
})
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//删除单品特价活动【同城零售】
|
||||
func TestDeleteAct(t *testing.T) {
|
||||
err := apiTao.ActivityDelete("20230619180157", "京西菜市", 230658198)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
func TestA(t *testing.T) {
|
||||
str := "J100867"
|
||||
if strings.Contains(str, "X") {
|
||||
data := strings.Split(str, "X")
|
||||
fmt.Println(data[1])
|
||||
} else {
|
||||
fmt.Println("null")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
204
platformapi/tao_vegetable/store_skuAct.go
Normal file
204
platformapi/tao_vegetable/store_skuAct.go
Normal file
@@ -0,0 +1,204 @@
|
||||
package tao_vegetable
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
// ActCreateReq 1 活动详情
|
||||
type ActCreateReq = domain.AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest
|
||||
|
||||
// ActSkuAddReq 2 活动商品详情
|
||||
type ActSkuAddReq = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddItemDiscountActivityElementOperateRequest
|
||||
type SkuElement = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto
|
||||
type Limit = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddLimitDto
|
||||
type SkuChannelConfigs = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuChannelConfigDTO
|
||||
|
||||
// ActivityCreate 创建单品特价活动【同城零售】 1-1
|
||||
func (a *API) ActivityCreate(param domain.AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) (actID int64, err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityCreate(&request.AlibabaRetailMarketingItemdiscountActivityCreateRequest{
|
||||
Param: ¶m,
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return 0, fmt.Errorf("ActivityCreate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return utils.Pointer2Int64(resp.Result.Data), nil
|
||||
}
|
||||
|
||||
type skuAct struct {
|
||||
SkuID []string
|
||||
ActID int64
|
||||
}
|
||||
|
||||
// ActivitySkuCreate 特价活动新增商品 1-2
|
||||
func (a *API) ActivitySkuCreate(param domain.AlibabaRetailMarketingItemdiscountActivitySkuAddItemDiscountActivityElementOperateRequest) (error, *skuAct, []string) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivitySkuAdd(&request.AlibabaRetailMarketingItemdiscountActivitySkuAddRequest{
|
||||
Param: ¶m,
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err, nil, *resp.Result.FailedSkuCodes
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return fmt.Errorf("ActivityCreate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage), nil, *resp.Result.FailedSkuCodes
|
||||
}
|
||||
successSkuCode := &skuAct{}
|
||||
for _, v := range *param.SkuElements {
|
||||
if len(*resp.Result.FailedSkuCodes) == 0 {
|
||||
successSkuCode.ActID = *param.ActId
|
||||
successSkuCode.SkuID = append(successSkuCode.SkuID, *v.SkuCode)
|
||||
} else {
|
||||
for _, i := range *resp.Result.FailedSkuCodes {
|
||||
if v.SkuCode == &i {
|
||||
continue
|
||||
}
|
||||
successSkuCode.ActID = *param.ActId
|
||||
successSkuCode.SkuID = append(successSkuCode.SkuID, *v.SkuCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, successSkuCode, *resp.Result.FailedSkuCodes
|
||||
}
|
||||
|
||||
// ActivityQuery 查询单品特价活动【同城零售】 2-1
|
||||
func (a *API) ActivityQuery(actID int64, outActID string) (*domain.AlibabaRetailMarketingItemdiscountActivityQueryItemDiscountPromotionActivityDTO, error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityQuery(&request.AlibabaRetailMarketingItemdiscountActivityQueryRequest{
|
||||
Param0: &domain.AlibabaRetailMarketingItemdiscountActivityQueryItemDiscountActivityQueryRequest{
|
||||
ActId: &actID,
|
||||
OutActId: &outActID,
|
||||
},
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.ErrMessage != "" {
|
||||
return nil, fmt.Errorf("ActivityQuery:requestId:" + resp.RequestId + "msg:" + resp.ErrMessage)
|
||||
}
|
||||
//var retVal = &QueryActResp{}
|
||||
//retVal = ParseQueryActResp(resp.Data)
|
||||
return &resp.Data, nil
|
||||
}
|
||||
|
||||
// ActivitySkuQuery 查询单品特价活动商品【同城零售】 2-2
|
||||
func (a *API) ActivitySkuQuery(actID int64) ([]domain.AlibabaRetailMarketingItemdiscountSkuQuerySkuActivityElementDTO, error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountSkuQuery(&request.AlibabaRetailMarketingItemdiscountSkuQueryRequest{
|
||||
Param0: &domain.AlibabaRetailMarketingItemdiscountSkuQueryItemDiscountActivitySkuQueryRequest{
|
||||
ActId: &actID,
|
||||
PageInfo: &domain.AlibabaRetailMarketingItemdiscountSkuQueryActivitySkuQueryDTO{
|
||||
Current: &DefaultCurrent,
|
||||
PageSize: &DefaultPageSize,
|
||||
},
|
||||
},
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.ErrMessage != "" {
|
||||
return nil, fmt.Errorf("ActivityCreate:requestId:" + resp.RequestId + "msg:" + resp.ErrMessage)
|
||||
}
|
||||
return resp.Data, nil
|
||||
}
|
||||
|
||||
// ActivityDelete 删除单品特价活动【同城零售】 3-1
|
||||
func (a *API) ActivityDelete(creatorID, creatorName string, actID int64) (err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityDelete(&request.AlibabaRetailMarketingItemdiscountActivityDeleteRequest{
|
||||
Param: &domain.AlibabaRetailMarketingItemdiscountActivityDeleteItemDiscountActivityOperateRequest{
|
||||
CreatorId: &creatorID,
|
||||
CreatorName: &creatorName,
|
||||
ActId: &actID,
|
||||
},
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return fmt.Errorf("ActivityDelete:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ActivitySkuDelete 删除特价活动商品 3-2
|
||||
func (a *API) ActivitySkuDelete(param domain.AlibabaRetailMarketingItemdiscountActivitySkuDeleteItemDiscountActivityElementOperateRequest) error {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivitySkuDelete(&request.AlibabaRetailMarketingItemdiscountActivitySkuDeleteRequest{
|
||||
Param: ¶m,
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return fmt.Errorf("ActivityCreate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ActivityUpdate 更新单品特价活动【同城零售】
|
||||
func (a *API) ActivityUpdate(param domain.AlibabaRetailMarketingItemdiscountActivityUpdateItemDiscountActivityOperateRequest) (err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityUpdate(&request.AlibabaRetailMarketingItemdiscountActivityUpdateRequest{
|
||||
Param: ¶m,
|
||||
}, a.token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return fmt.Errorf("ActivityUpdate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//辅助函数
|
||||
|
||||
// ParseQueryActResp 解析查询活动返回值
|
||||
func ParseQueryActResp(data domain.AlibabaRetailMarketingItemdiscountActivityQueryItemDiscountPromotionActivityDTO) *QueryActResp {
|
||||
retVal := &QueryActResp{
|
||||
DiscountType: utils.Pointer2Int64(data.DiscountType),
|
||||
OutActId: utils.Pointer2String(data.OutActId),
|
||||
ActId: utils.Pointer2Int64(data.ActId),
|
||||
ActivityName: utils.Pointer2String(data.ActivityName),
|
||||
Description: utils.Pointer2String(data.Description),
|
||||
StartTime: utils.Pointer2Int64(data.StartTime),
|
||||
EndTime: utils.Pointer2Int64(data.EndTime),
|
||||
CreatorId: utils.Pointer2String(data.CreatorId),
|
||||
CreatorName: utils.Pointer2String(data.CreatorName),
|
||||
}
|
||||
if data.Weekdays != nil {
|
||||
retVal.Weekdays = *data.Weekdays
|
||||
}
|
||||
if data.EveryDayPeriods != nil {
|
||||
retVal.EveryDayPeriods = *data.EveryDayPeriods
|
||||
}
|
||||
if data.Terminals != nil {
|
||||
retVal.Terminals = *data.Terminals
|
||||
}
|
||||
if data.StoreIds != nil {
|
||||
retVal.StoreIds = *data.StoreIds
|
||||
}
|
||||
if data.OuterStoreIds != nil {
|
||||
retVal.OuterStoreIds = *data.OuterStoreIds
|
||||
}
|
||||
if data.MemberCrowdCodes != nil {
|
||||
retVal.MemberCrowdCodes = *data.MemberCrowdCodes
|
||||
}
|
||||
if data.Limit != nil {
|
||||
retVal.Limit = ActivityQueryLimit{
|
||||
TotalLimitCnt: utils.Pointer2Int64(data.Limit.TotalLimitCnt),
|
||||
DailyTotalLimitCnt: utils.Pointer2Int64(data.Limit.DailyTotalLimitCnt),
|
||||
UserTotalLimitCnt: utils.Pointer2Int64(data.Limit.UserTotalLimitCnt),
|
||||
UserDailyLimitCnt: utils.Pointer2Int64(data.Limit.UserDailyLimitCnt),
|
||||
OrderLimitCnt: utils.Pointer2Int64(data.Limit.OrderLimitCnt),
|
||||
}
|
||||
}
|
||||
fmt.Println(utils.Format4Output(retVal, false))
|
||||
return retVal
|
||||
}
|
||||
53
platformapi/tao_vegetable/store_skuAct_model.go
Normal file
53
platformapi/tao_vegetable/store_skuAct_model.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package tao_vegetable
|
||||
|
||||
const (
|
||||
TerminalsAPP = 1 //活动终端app
|
||||
TerminalsPOS = 2 //活动终端pos
|
||||
DiscountTypeDeductMoney = 1 //减钱
|
||||
DiscountTypeOnePrice = 2 //一口价
|
||||
DiscountTypeDiscounts = 3 //打折
|
||||
LimitCntMax = 9999 //活动总限购默认值
|
||||
|
||||
MemberCrowdCodeNewUser = "NEW_USER" //新用户
|
||||
MemberCrowdCodeOldUser = "OLD_USER" //老用户
|
||||
MemberCrowdCodeLightNewUser = "LIGHT_NEW_USER" //闪购新客
|
||||
MemberCrowdCodeMerchantNewUser = "MERCHANT_NEW_USER" //商家新用户
|
||||
MemberCrowdCodeMerchantOldUser = "MERCHANT_OLD_USER" //商家老用户
|
||||
|
||||
ChannelsMT = 2
|
||||
ChannelsELM = 3
|
||||
ChannelsJDDJ = 4
|
||||
ChannelsTXD = 31 //翱象淘鲜达
|
||||
ChannelsShareStock = 32
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultCurrent = int64(1)
|
||||
DefaultPageSize = int64(20)
|
||||
)
|
||||
|
||||
type QueryActResp struct {
|
||||
DiscountType int64 `json:"discount_type,omitempty" ` //单品活动类型1:减钱 2:一口价 3:打折
|
||||
OutActId string `json:"out_act_id,omitempty" ` //外部订单号
|
||||
ActId int64 `json:"act_id,omitempty" ` //营销活动ID
|
||||
ActivityName string `json:"activity_name,omitempty" ` //活动名称
|
||||
Description string `json:"description,omitempty" ` //活动描述
|
||||
StartTime int64 `json:"start_time,omitempty" ` //活动开始时间
|
||||
EndTime int64 `json:"end_time,omitempty" ` //活动结束时间
|
||||
Weekdays []int64 `json:"weekdays,omitempty" ` //活动周几生效
|
||||
EveryDayPeriods []string `json:"every_day_periods,omitempty" ` //活动每天生效时间段
|
||||
Terminals []int32 `json:"terminals,omitempty" ` //优惠适用场景:1:APP 2:POS
|
||||
CreatorId string `json:"creator_id,omitempty" ` //操作人ID
|
||||
CreatorName string `json:"creator_name,omitempty" ` //操作人姓名
|
||||
StoreIds []string `json:"store_ids,omitempty" ` //门店列表
|
||||
OuterStoreIds []string `json:"outer_store_ids,omitempty" ` //外部门店列表
|
||||
MemberCrowdCodes []string `json:"member_crowd_codes,omitempty" ` //人群编码,saas平台人群编码:NEW_USER: 新用户, OLD_USER:老用户,LIGHT_NEW_USER:闪购新客
|
||||
Limit ActivityQueryLimit `json:"limit,omitempty" ` //限购信息
|
||||
}
|
||||
type ActivityQueryLimit struct {
|
||||
TotalLimitCnt int64 `json:"total_limit_cnt,omitempty" ` //活动总限购
|
||||
DailyTotalLimitCnt int64 `json:"daily_total_limit_cnt,omitempty" ` //每日总限购
|
||||
UserTotalLimitCnt int64 `json:"user_total_limit_cnt,omitempty" ` //用户总限购
|
||||
UserDailyLimitCnt int64 `json:"user_daily_limit_cnt,omitempty" ` //用户每日限购
|
||||
OrderLimitCnt int64 `json:"order_limit_cnt,omitempty" ` //每单限购
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package tao_vegetable
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/request"
|
||||
)
|
||||
|
||||
// ActivityCreate 创建单品特价活动【同城零售】
|
||||
func (a *API) ActivityCreate(param domain.AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) (actID *int64, err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityCreate(&request.AlibabaRetailMarketingItemdiscountActivityCreateRequest{
|
||||
Param: ¶m,
|
||||
}, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return nil, fmt.Errorf("ActivityCreate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return resp.Result.Data, nil
|
||||
}
|
||||
|
||||
// ActivityUpdate 更新单品特价活动【同城零售】
|
||||
func (a *API) ActivityUpdate(param domain.AlibabaRetailMarketingItemdiscountActivityUpdateItemDiscountActivityOperateRequest) (actID *int64, err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityUpdate(&request.AlibabaRetailMarketingItemdiscountActivityUpdateRequest{
|
||||
Param: ¶m,
|
||||
}, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return nil, fmt.Errorf("ActivityUpdate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return resp.Result.Data, nil
|
||||
}
|
||||
|
||||
// ActivityDelete 删除单品特价活动【同城零售】
|
||||
func (a *API) ActivityDelete(param domain.AlibabaRetailMarketingItemdiscountActivityDeleteItemDiscountActivityOperateRequest) (actID *int64, err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityDelete(&request.AlibabaRetailMarketingItemdiscountActivityDeleteRequest{
|
||||
Param: ¶m,
|
||||
}, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return nil, fmt.Errorf("ActivityDelete:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
return resp.Result.Data, nil
|
||||
}
|
||||
|
||||
// ActivityQuery 查询单品特价活动【同城零售】
|
||||
func (a *API) ActivityQuery(actID int64, outActID string) (*domain.AlibabaRetailMarketingItemdiscountActivityQueryItemDiscountPromotionActivityDTO, error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityQuery(&request.AlibabaRetailMarketingItemdiscountActivityQueryRequest{
|
||||
Param0: &domain.AlibabaRetailMarketingItemdiscountActivityQueryItemDiscountActivityQueryRequest{
|
||||
ActId: &actID,
|
||||
OutActId: &outActID,
|
||||
},
|
||||
}, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.ErrMessage != "" {
|
||||
return nil, fmt.Errorf("ActivityQuery:requestId:" + resp.RequestId + "msg:" + resp.ErrMessage)
|
||||
}
|
||||
return &resp.Data, nil
|
||||
}
|
||||
Reference in New Issue
Block a user