56 lines
2.1 KiB
Go
56 lines
2.1 KiB
Go
package controllers
|
||
|
||
import (
|
||
"git.rosy.net.cn/baseapi/utils"
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type SyncController struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 全部刷新所有门店商家ID
|
||
// @Description 全部刷新所有门店商家ID
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorIDs query string true "需要刷新的厂商ID列表"
|
||
// @Param isAsync query bool false "起始状态"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /RefreshAllStoresID [put]
|
||
func (c *SyncController) RefreshAllStoresID() {
|
||
c.callRefreshAllStoresID(func(params *tSyncRefreshAllStoresIDParams) (retVal interface{}, errCode string, err error) {
|
||
var vendorIDs []int
|
||
if err = utils.UnmarshalUseNumber([]byte(params.VendorIDs), &vendorIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
retVal, err = cms.CurVendorSync.RefreshAllStoresID(params.Ctx, params.IsAsync, vendorIDs)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 重新刷新商家SKU ID
|
||
// @Description 重新刷新商家SKU ID,单门店厂商必须指定storeIDs
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorIDs query string true "需要刷新的厂商ID列表"
|
||
// @Param storeIDs query string false "需要刷新的门店ID列表(对于单门店必须指定)"
|
||
// @Param isAsync query bool false "起始状态"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /RefreshAllSkusID [put]
|
||
func (c *SyncController) RefreshAllSkusID() {
|
||
c.callRefreshAllSkusID(func(params *tSyncRefreshAllSkusIDParams) (retVal interface{}, errCode string, err error) {
|
||
var vendorIDs, storeIDs []int
|
||
if err = utils.UnmarshalUseNumber([]byte(params.VendorIDs), &vendorIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
if params.StoreIDs != "" {
|
||
if err = utils.UnmarshalUseNumber([]byte(params.StoreIDs), &storeIDs); err != nil {
|
||
return retVal, "", err
|
||
}
|
||
}
|
||
retVal, err = cms.CurVendorSync.RefreshAllSkusID(params.Ctx, params.IsAsync, vendorIDs, storeIDs)
|
||
return retVal, "", err
|
||
})
|
||
}
|