aa
This commit is contained in:
@@ -2740,7 +2740,3 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func GetThingMap(ctx *jxcontext.Context, vendorOrgCode string) (getThingMapResult []*dao.GetThingMapCategoryResult, err error) {
|
||||
return dao.GetThingMapCategory(dao.GetDB(), []int{model.VendorIDJD}, nil, []string{vendorOrgCode})
|
||||
}
|
||||
|
||||
@@ -28,38 +28,6 @@ func GetThingMapList(db *DaoDB, thingType int, vendorIDs, thingIDs []int, vendor
|
||||
return cats, err
|
||||
}
|
||||
|
||||
type GetThingMapCategoryResult struct {
|
||||
model.ThingMap
|
||||
Name string `orm:"size(255)" json:"name"`
|
||||
ParentID int `orm:"column(parent_id)" json:"parentID"`
|
||||
Level int8 `json:"level"`
|
||||
Seq int `json:"seq"`
|
||||
}
|
||||
|
||||
func GetThingMapCategory(db *DaoDB, vendorIDs, thingIDs []int, vendorOrgCodes []string) (cats []*GetThingMapCategoryResult, err error) {
|
||||
sql := `
|
||||
SELECT t1.*, t2.name, t2.parent_id, t2.level, t2.seq
|
||||
FROM thing_map t1
|
||||
JOIN sku_category t2 ON t2.id = t1.thing_id AND t2.deleted_at = ?
|
||||
WHERE t1.deleted_at = ? AND t1.thing_type = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
model.ThingTypeCategory,
|
||||
}
|
||||
if len(thingIDs) > 0 {
|
||||
sql += " AND t1.thing_id IN (" + GenQuestionMarks(len(thingIDs)) + ")"
|
||||
sqlParams = append(sqlParams, thingIDs)
|
||||
}
|
||||
if len(vendorOrgCodes) > 0 {
|
||||
sql += " AND t1.vendor_org_code IN (" + GenQuestionMarks(len(vendorOrgCodes)) + ")"
|
||||
sqlParams = append(sqlParams, vendorOrgCodes)
|
||||
}
|
||||
err = GetRows(db, &cats, sql, sqlParams...)
|
||||
return cats, err
|
||||
}
|
||||
|
||||
func GetThingMapMap(db *DaoDB, thingType int, vendorIDs, thingIDs []int) (thingMapMap map[int64][]*model.ThingMap, err error) {
|
||||
thingMapList, err := GetThingMapList(db, thingType, vendorIDs, thingIDs, nil)
|
||||
if err == nil {
|
||||
|
||||
@@ -21,9 +21,6 @@ type ThingMap struct {
|
||||
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
||||
|
||||
Remark string `orm:"size(255)" json:"remark"`
|
||||
|
||||
ThingName string `json:"thingName"`
|
||||
ThingSeq int `json:"thingSeq"`
|
||||
}
|
||||
|
||||
func (*ThingMap) TableUnique() [][]string {
|
||||
|
||||
@@ -556,85 +556,3 @@ func (c *SkuController) UpdateSkuExinfoMap() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到京东账号分类
|
||||
// @Description 得到京东账号分类
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrgCode query string true "账号ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetThingMap [get]
|
||||
func (c *SkuController) GetThingMap() {
|
||||
c.callGetThingMap(func(params *tSkuGetThingMapParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetThingMap(params.Ctx, params.VendorOrgCode)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 新增京东账号分类
|
||||
// @Description 新增京东账号分类
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrgCode formData string true "账号ID"
|
||||
// @Param categroyID formData int false "京西分类id"
|
||||
// @Param level formData int true "分类级别"
|
||||
// @Param parentID formData int true "分类父ID"
|
||||
// @Param vendorCategroyName formData string true "类别name"
|
||||
// @Param vendorCategroySeq formData int true "类别序号"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /AddThingMap [post]
|
||||
func (c *SkuController) AddThingMap() {
|
||||
c.callAddThingMap(func(params *tSkuAddThingMapParams) (retVal interface{}, errCode string, err error) {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改京东账号分类
|
||||
// @Description 修改京东账号分类
|
||||
// @Param token header string true "认证token"
|
||||
// @Param ID formData int true "记录ID"
|
||||
// @Param categoryID formData int false "京西分类id"
|
||||
// @Param storeCategroyName formData string false "类别name"
|
||||
// @Param level formData int true "分类级别"
|
||||
// @Param parentID formData int true "分类父ID"
|
||||
// @Param isDelete formData bool false "是否是删除操作,默认false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateThingMap [put]
|
||||
func (c *SkuController) UpdateThingMap() {
|
||||
c.callUpdateThingMap(func(params *tSkuUpdateThingMapParams) (retVal interface{}, errCode string, err error) {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 京东账号分类重排序
|
||||
// @Description 京东账号分类重排序
|
||||
// @Param token header string true "认证token"
|
||||
// @Param categoryID formData int true "父ID"
|
||||
// @Param vendorOrgCode formData string true "门店ID"
|
||||
// @Param categoryIDs formData string true "同一父类别下的所有子类别ID列表([1,2,3,4])"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /ReorderJdCategories [put]
|
||||
func (c *SkuController) ReorderJdCategories() {
|
||||
c.callReorderJdCategories(func(params *tSkuReorderJdCategoriesParams) (retVal interface{}, errCode string, err error) {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 复制京东账号分类
|
||||
// @Description 复制京东账号分类
|
||||
// @Param token header string true "认证token"
|
||||
// @Param fromVendorOrgCode formData string true "源门店ID"
|
||||
// @Param toVendorOrgCodes formData string true "目标门店的IDs"
|
||||
// @Param categoryIDs formData string false "原门店的分类IDs,不传代表整个复制"
|
||||
// @Param isAsync formData bool false "是否异步操作"
|
||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CopyJdStoreCategories [put]
|
||||
func (c *SkuController) CopyJdStoreCategories() {
|
||||
c.callCopyJdStoreCategories(func(params *tSkuCopyJdStoreCategoriesParams) (retVal interface{}, errCode string, err error) {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1667,8 +1667,8 @@ func init() {
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
|
||||
beego.ControllerComments{
|
||||
Method: "CopyJdStoreCategories",
|
||||
Router: `/CopyJdStoreCategories`,
|
||||
Method: "CopyJdCategories",
|
||||
Router: `/CopyJdCategories`,
|
||||
AllowHTTPMethods: []string{"put"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
|
||||
Reference in New Issue
Block a user