90 lines
3.9 KiB
Go
90 lines
3.9 KiB
Go
package controllers
|
||
|
||
import (
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/initdata"
|
||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type InitDataController struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 初始化place信息
|
||
// @Description 初始化place信息,要求:jde_city, jde_district, ebde_places, mtpsdeliveryprice
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /InitPlace [post]
|
||
func (c *InitDataController) InitPlace() {
|
||
c.callInitPlace(func(params *tInitdataInitPlaceParams) (retVal interface{}, errCode string, err error) {
|
||
err = initdata.InitPlace(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 初始化skuname(当前主要是计算md5)
|
||
// @Description 初始化skuname(当前主要是计算md5)
|
||
// @Param token header string true "认证token"
|
||
// @Param isForce formData bool false "是否强刷,即即使本地已经有了hashCode也重新计算,缺省为false"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /InitSkuName [post]
|
||
func (c *InitDataController) InitSkuName() {
|
||
c.callInitSkuName(func(params *tInitdataInitSkuNameParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = initdata.InitSkuName(params.Ctx, params.IsForce, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 初始化vendor category
|
||
// @Description 初始化vendor category(当前只有美团外卖的通过这个设置)
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /InitVendorCategory [post]
|
||
func (c *InitDataController) InitVendorCategory() {
|
||
c.callInitVendorCategory(func(params *tInitdataInitVendorCategoryParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = initdata.InitVendorCategory(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 将为份的商品在京东转成SPU
|
||
// @Description 将为份的商品在京东转成SPU
|
||
// @Param token header string true "认证token"
|
||
// @Param count formData int false "转换的数量,缺省0表示全部"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /Convert2JDSPU [post]
|
||
func (c *InitDataController) Convert2JDSPU() {
|
||
c.callConvert2JDSPU(func(params *tInitdataConvert2JDSPUParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = initdata.Convert2JDSPU(params.Ctx, params.Count, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 将京东商店为份的SPU转换
|
||
// @Description 将京东商店为份的SPU转换
|
||
// @Param token header string true "认证token"
|
||
// @Param step formData int true "门店列表"
|
||
// @Param storeIDs formData string false "门店列表"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /Change2JDSPU4Store [post]
|
||
func (c *InitDataController) Change2JDSPU4Store() {
|
||
c.callChange2JDSPU4Store(func(params *tInitdataChange2JDSPU4StoreParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||
retVal, err = initdata.Change2JDSPU4Store(params.Ctx, storeIDs, params.Step, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|