438 lines
22 KiB
Go
438 lines
22 KiB
Go
package controllers
|
||
|
||
import (
|
||
"fmt"
|
||
"math"
|
||
"time"
|
||
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type StoreSkuController struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 得到商家商品信息
|
||
// @Description 得到商家商品信息,如下条件之间是与的关系。对于没有认领的商品,按城市限制。但对于已经认领的商品就不限制了,因为已经在平台上可售,可以操作(改价等等)
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param isFocus query bool true "是否已关注(认领)"
|
||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||
// @Param nameID query int false "SkuName ID"
|
||
// @Param nameIDs query string false "SkuName ID列表对象"
|
||
// @Param skuID query int false "Sku ID"
|
||
// @Param skuIDs query string false "Sku ID列表对象"
|
||
// @Param name query string false "商品名称(不要求完全一致)"
|
||
// @Param prefix query string false "商品前缀(不要求完全一致)"
|
||
// @Param categoryID query int false "商品所属类别ID"
|
||
// @Param unit query string false "商品单位"
|
||
// @Param jdID query int false "商品京东ID"
|
||
// @Param fromStatus query int false "查询起始状态(0:不可售,1:可售)"
|
||
// @Param toStatus query int false "查询结束状态(0:不可售,1:可售)"
|
||
// @Param stFromTime query string false "统计SKU开始时间"
|
||
// @Param stToTime query string false "统计SKU结束时间"
|
||
// @Param stFromCount query int false "统计SKU,结果集起始数量(包括)"
|
||
// @Param stToCount query int false "统计SKU,结果集结束数量(包括)"
|
||
// @Param isGetOpRequest query bool false "是否返回相应的待审核变动请求,缺省为false不返回"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Param isBySku query bool false "是否按SKU分拆"
|
||
// @Param jdSyncStatus query int false "京东同步标识"
|
||
// @Param ebaiSyncStatus query int false "饿百同步标识"
|
||
// @Param mtwmSyncStatus query int false "美团外卖同步标识"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreSkus [get]
|
||
func (c *StoreSkuController) GetStoreSkus() {
|
||
c.callGetStoreSkus(func(params *tStoreSkuGetStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||
var skuIDs []int
|
||
if err = jxutils.Strings2Objs(params.SkuIDs, &skuIDs); err == nil {
|
||
retVal, err = cms.GetStoreSkus(params.Ctx, params.StoreID, skuIDs, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到商家商品信息
|
||
// @Description 得到商家商品信息,如下条件之间是与的关系。对于没有认领的商品,按城市限制。但对于已经认领的商品就不限制了,因为已经在平台上可售,可以操作(改价等等)
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs query string false "门店ID"
|
||
// @Param isFocus query bool true "是否已关注(认领)"
|
||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||
// @Param nameIDs query string false "SkuName ID列表对象"
|
||
// @Param skuIDs query string false "Sku ID列表对象"
|
||
// @Param name query string false "商品名称(不要求完全一致)"
|
||
// @Param prefix query string false "商品前缀(不要求完全一致)"
|
||
// @Param categoryID query int false "商品所属类别ID"
|
||
// @Param unit query string false "商品单位"
|
||
// @Param jdID query int false "商品京东ID"
|
||
// @Param fromStatus query int false "查询起始状态(0:不可售,1:可售)"
|
||
// @Param toStatus query int false "查询结束状态(0:不可售,1:可售)"
|
||
// @Param stFromTime query string false "统计SKU开始时间"
|
||
// @Param stToTime query string false "统计SKU结束时间"
|
||
// @Param stFromCount query int false "统计SKU,结果集起始数量(包括)"
|
||
// @Param stToCount query int false "统计SKU,结果集结束数量(包括)"
|
||
// @Param isGetOpRequest query bool false "是否返回相应的待审核变动请求,缺省为false不返回"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Param isBySku query bool false "是否按SKU分拆"
|
||
// @Param jdSyncStatus query int false "京东同步标识"
|
||
// @Param ebaiSyncStatus query int false "饿百同步标识"
|
||
// @Param mtwmSyncStatus query int false "美团外卖同步标识"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoresSkus [get,post]
|
||
func (c *StoreSkuController) GetStoresSkus() {
|
||
c.callGetStoresSkus(func(params *tStoreSkuGetStoresSkusParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs, skuIDs []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs); err == nil {
|
||
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到异常门店商品数量
|
||
// @Description 得到异常门店商品数量
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param syncStatus query int true "同步标志掩码"
|
||
// @Param isBySku query bool false "是否按SKU分拆"
|
||
// @Param fromStatus query int false "查询起始状态(0:不可售,1:可售)"
|
||
// @Param toStatus query int false "查询结束状态(0:不可售,1:可售)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreAbnormalSkuCount [get]
|
||
func (c *StoreSkuController) GetStoreAbnormalSkuCount() {
|
||
c.callGetStoreAbnormalSkuCount(func(params *tStoreSkuGetStoreAbnormalSkuCountParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetStoreAbnormalSkuCount(params.Ctx, params.StoreID, params.SyncStatus, params.IsBySku, params.MapData)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店商品全信息
|
||
// @Description 得到异常门店商品数量
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param vendorIDs query string false "厂商ID列表"
|
||
// @Param skuIDs query string true "Sku ID列表对象"
|
||
// @Param isContinueWhenError query bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetVendorStoreSkusInfo [get]
|
||
func (c *StoreSkuController) GetVendorStoreSkusInfo() {
|
||
c.callGetVendorStoreSkusInfo(func(params *tStoreSkuGetVendorStoreSkusInfoParams) (retVal interface{}, errCode string, err error) {
|
||
var vendorIDs, skuIDs []int
|
||
err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs, params.SkuIDs, &skuIDs)
|
||
if err == nil {
|
||
retVal, err = cms.GetVendorStoreSkusInfo(params.Ctx, params.StoreID, vendorIDs, skuIDs, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 修改商家商品绑定
|
||
// @Description 修改商家商品绑定,请换用UpdateStoresSkus
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true 门店ID"
|
||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoreSku [put]
|
||
func (c *StoreSkuController) UpdateStoreSku() {
|
||
c.callUpdateStoreSku(func(params *tStoreSkuUpdateStoreSkuParams) (retVal interface{}, errCode string, err error) {
|
||
var skuBindInfo cms.StoreSkuBindInfo
|
||
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfo); err == nil {
|
||
retVal, err = cms.UpdateStoreSku(params.Ctx, params.StoreID, &skuBindInfo, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 批量修改商家商品绑定
|
||
// @Description 批量修改商家商品绑定,请换用UpdateStoresSkus
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "门店ID"
|
||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象数组"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoreSkus [put]
|
||
func (c *StoreSkuController) UpdateStoreSkus() {
|
||
c.callUpdateStoreSkus(func(params *tStoreSkuUpdateStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||
var skuBindInfos []*cms.StoreSkuBindInfo
|
||
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err == nil {
|
||
retVal, err = cms.UpdateStoreSkus(params.Ctx, params.StoreID, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 同步商家商品信息
|
||
// @Description 同步商家商品信息
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorIDs formData string false "厂商ID列表"
|
||
// @Param storeIDs formData string false "门店ID列表"
|
||
// @Param skuIDs formData string false "SKU ID列表,缺省为全部"
|
||
// @Param isForce formData bool false "是否强制(设置修改标志)"
|
||
// @Param isAsync formData bool true "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /SyncStoresSkus [put]
|
||
func (c *StoreSkuController) SyncStoresSkus() {
|
||
c.callSyncStoresSkus(func(params *tStoreSkuSyncStoresSkusParams) (retVal interface{}, errCode string, err error) {
|
||
db := dao.GetDB()
|
||
var storeIDs, skuIDs, vendorIDs []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.VendorIDs, &vendorIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, db, vendorIDs, storeIDs, skuIDs, params.IsForce, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 批量修改多商家商品绑定
|
||
// @Description 批量修改多商家商品绑定
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string true "门店ID列表"
|
||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象数组"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoresSkus [put]
|
||
func (c *StoreSkuController) UpdateStoresSkus() {
|
||
c.callUpdateStoresSkus(func(params *tStoreSkuUpdateStoresSkusParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs []int
|
||
var skuBindInfos []*cms.StoreSkuBindInfo
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Payload, &skuBindInfos); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
retVal, err = cms.UpdateStoresSkus(params.Ctx, storeIDs, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 按门店商品维度批量修改多商家商品绑定
|
||
// @Description 按门店商品维度批量修改多商家商品绑定
|
||
// @Param token header string true "认证token"
|
||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象数组"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoresSkusByBind [put]
|
||
func (c *StoreSkuController) UpdateStoresSkusByBind() {
|
||
c.callUpdateStoresSkusByBind(func(params *tStoreSkuUpdateStoresSkusByBindParams) (retVal interface{}, errCode string, err error) {
|
||
var skuBindInfos []*cms.StoreSkuBindInfo
|
||
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
retVal, err = cms.UpdateStoresSkusByBind(params.Ctx, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 拷贝门店SKU信息
|
||
// @Description 拷贝门店SKU信息(此函数当前只是本地数据操作,要同步到远端需要调用SyncStoresSkus)
|
||
// @Param token header string true "认证token"
|
||
// @Param fromStoreID formData int true "源门店ID"
|
||
// @Param toStoreID formData int true "目标门店ID"
|
||
// @Param copyMode formData string true "拷贝模式,fresh:目标门店数据全部清除后拷贝,update:确保指定的源数据全部拷贝,已有的忽略"
|
||
// @Param pricePercentage formData int false "价格调整百分比,缺省为100%"
|
||
// @Param categoryIDs formData string false "json数据,skuName所属的类别,[1,2,3]"
|
||
// @Param skuIDs formData string false "json数据,skuID列表,[1,2,3]"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /CopyStoreSkus [post]
|
||
func (c *StoreSkuController) CopyStoreSkus() {
|
||
c.callCopyStoreSkus(func(params *tStoreSkuCopyStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.CopyStoreSkus(params.Ctx, params.FromStoreID, params.ToStoreID, params.CopyMode, params.MapData, params.Ctx.GetUserName())
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 批量修改多商家商品可售状态
|
||
// @Description 批量修改多商家商品可售状态
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string true "门店ID列表"
|
||
// @Param payload formData string true "json数据,StoreSkuBindSkuInfo对象数组"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Param autoSaleAt formData string false "临时不可售到期时间"
|
||
// @Param ignoreDontSale formData bool false "在临时不可售时,是否忽略当前是不可售的商品"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoresSkusSale [put]
|
||
func (c *StoreSkuController) UpdateStoresSkusSale() {
|
||
c.callUpdateStoresSkusSale(func(params *tStoreSkuUpdateStoresSkusSaleParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs []int
|
||
var skuBindSkuInfos []*cms.StoreSkuBindSkuInfo
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Payload, &skuBindSkuInfos); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
timeList, err := jxutils.BatchStr2Time(params.AutoSaleAt)
|
||
if err != nil {
|
||
return retVal, "", err
|
||
}
|
||
retVal, err = cms.UpdateStoresSkusSale(params.Ctx, storeIDs, skuBindSkuInfos, timeList[0], params.IgnoreDontSale, params.Ctx.GetUserName(), params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到商家商品销售情况
|
||
// @Description 得到商家商品销售情况
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs query string true "门店ID列表"
|
||
// @Param skuIDs query string true "Sku ID列表"
|
||
// @Param stFromTime query string true "统计SKU开始时间"
|
||
// @Param stToTime query string false "统计SKU结束时间"
|
||
// @Param stFromCount query int false "统计SKU,结果集起始数量(包括)"
|
||
// @Param stToCount query int false "统计SKU,结果集结束数量(包括)"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoresSkusSaleInfo [get]
|
||
func (c *StoreSkuController) GetStoresSkusSaleInfo() {
|
||
c.callGetStoresSkusSaleInfo(func(params *tStoreSkuGetStoresSkusSaleInfoParams) (retVal interface{}, errCode string, err error) {
|
||
var (
|
||
storeIDs, skuIDs []int
|
||
timeList []time.Time
|
||
)
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
if timeList, err = jxutils.BatchStr2Time(params.StFromTime, params.StToTime); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
if params.MapData["stToToCount"] == nil {
|
||
params.StToCount = math.MaxInt32
|
||
}
|
||
retVal, err = cms.GetStoresSkusSaleInfo(params.Ctx, storeIDs, skuIDs, timeList[0], timeList[1], params.StFromCount, params.StToCount)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到商家商品修改价格请求信息
|
||
// @Description 得到商家商品修改价格请求信息
|
||
// @Param token header string true "认证token"
|
||
// @Param fromTime query string false "申请开始时间"
|
||
// @Param toTime query string false "申请结束时间"
|
||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||
// @Param storeIDs query string false "门店ID列表"
|
||
// @Param itemIDs query string false "id列表对象,当前指skuname id"
|
||
// @Param types query string false "类型列表对象"
|
||
// @Param statuss query string false "状态列表对象"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreOpRequests [get]
|
||
func (c *StoreSkuController) GetStoreOpRequests() {
|
||
c.callGetStoreOpRequests(func(params *tStoreSkuGetStoreOpRequestsParams) (retVal interface{}, errCode string, err error) {
|
||
var (
|
||
timeList []time.Time
|
||
storeIDs, typeList, statusList, itemIDs []int
|
||
)
|
||
if timeList, err = jxutils.BatchStr2Time(params.FromTime, params.ToTime); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Types, &typeList, params.Statuss, &statusList, params.ItemIDs, &itemIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
retVal, err = cms.GetStoreOpRequests(params.Ctx, timeList[0], timeList[1], params.Keyword, storeIDs, itemIDs, typeList, statusList, params.Offset, params.PageSize)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 处理商家商品价格申请
|
||
// @Description 处理商家商品价格申请
|
||
// @Param token header string true "认证token"
|
||
// @Param reqIDs formData string true "请求ID列表对象"
|
||
// @Param handleType formData int true "-1拒绝,1批准"
|
||
// @Param rejectReason formData string false "拒绝理由,拒绝时要求"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /HandleStoreOpRequest [put]
|
||
func (c *StoreSkuController) HandleStoreOpRequest() {
|
||
c.callHandleStoreOpRequest(func(params *tStoreSkuHandleStoreOpRequestParams) (retVal interface{}, errCode string, err error) {
|
||
var reqIDs []int
|
||
if err = jxutils.Strings2Objs(params.ReqIDs, &reqIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
if params.HandleType == 1 {
|
||
err = cms.AcceptStoreOpRequests(params.Ctx, reqIDs)
|
||
} else if params.HandleType == -1 {
|
||
err = cms.RejectStoreOpRequests(params.Ctx, reqIDs, params.RejectReason)
|
||
} else {
|
||
err = fmt.Errorf("handleType=%d是非法值", params.HandleType)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 根据厂家门店商品信息相应刷新本地数据
|
||
// @Description 根据厂家门店商品信息相应刷新本地数据
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string true "门店ID列表"
|
||
// @Param vendorID formData int true "厂商ID(当前只支持京东)"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /RefreshStoresSkuByVendor [put]
|
||
func (c *StoreSkuController) RefreshStoresSkuByVendor() {
|
||
c.callRefreshStoresSkuByVendor(func(params *tStoreSkuRefreshStoresSkuByVendorParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDList []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
|
||
retVal, err = cms.RefreshStoresSkuByVendor(params.Ctx, storeIDList, params.VendorID, params.IsAsync)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 京东商家商品状态同步
|
||
// @Description 京东商家商品状态同步
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string true "门店ID列表"
|
||
// @Param skuIDs formData string false "SKU ID列表,缺省为全部"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /SyncJdStoreProducts [put]
|
||
func (c *StoreSkuController) SyncJdStoreProducts() {
|
||
c.callSyncJdStoreProducts(func(params *tStoreSkuSyncJdStoreProductsParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDList, skuIDList []int
|
||
err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList, params.SkuIDs, &skuIDList)
|
||
if err == nil {
|
||
retVal, err = cms.SyncJdStoreProducts(params.Ctx, storeIDList, skuIDList, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 从订单得到本地没有关注的商品信息
|
||
// @Description 从订单得到本地没有关注的商品信息
|
||
// @Param token header string true "认证token"
|
||
// @Param fromTime query string true "扫描的订单开始时间"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetMissingStoreSkuFromOrder [get]
|
||
func (c *StoreSkuController) GetMissingStoreSkuFromOrder() {
|
||
c.callGetMissingStoreSkuFromOrder(func(params *tStoreSkuGetMissingStoreSkuFromOrderParams) (retVal interface{}, errCode string, err error) {
|
||
timeList, err := jxutils.BatchStr2Time(params.FromTime)
|
||
if err == nil {
|
||
retVal, err = cms.GetMissingStoreSkuFromOrder(params.Ctx, timeList[0])
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|