- sync store category.

This commit is contained in:
gazebo
2018-10-08 15:33:13 +08:00
parent 465f1f0431
commit 922e5175c7
11 changed files with 252 additions and 109 deletions

View File

@@ -2,7 +2,9 @@ package controllers
import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/model/dao"
"github.com/astaxie/beego"
)
@@ -41,7 +43,7 @@ func (c *StoreSkuController) GetStoreSkus() {
// @Description 修改商家商品绑定
// @Param token header string true "认证token"
// @Param storeID formData int true "需要修改的商品名IDpayload中的相应数据会被忽略"
// @Param payload formData string true "json数据StoreSkuBindInfo对象
// @Param payload formData string true "json数据StoreSkuBindInfo对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStoreSku [put]
@@ -59,7 +61,7 @@ func (c *StoreSkuController) UpdateStoreSku() {
// @Description 批量修改商家商品绑定
// @Param token header string true "认证token"
// @Param storeID formData int true "需要修改的商品名IDpayload中的相应数据会被忽略"
// @Param payload formData string true "json数据StoreSkuBindInfo对象数组
// @Param payload formData string true "json数据StoreSkuBindInfo对象数组"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStoreSkus [put]
@@ -72,3 +74,30 @@ func (c *StoreSkuController) UpdateStoreSkus() {
return retVal, "", err
})
}
// @Title 同步商家商品信息
// @Description 同步商家商品信息,单店模式厂商才支持
// @Param token header string true "认证token"
// @Param storeIDs formData string true "门店ID列表"
// @Param vendorID formData int true "厂商ID"
// @Param isSync formData bool true "是否同步操作"
// @Param skuIDs formData string false "SKU ID列表缺省为全部"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SyncStoreSkus [put]
func (c *StoreSkuController) SyncStoreSkus() {
c.callSyncStoreSkus(func(params *tStoreSkuSyncStoreSkusParams) (retVal interface{}, errCode string, err error) {
db := dao.GetDB()
var storeIDs []int
var skuIDs []int
if err = utils.UnmarshalUseNumber([]byte(params.StoreIDs), &storeIDs); err == nil {
if params.SkuIDs != "" {
err = utils.UnmarshalUseNumber([]byte(params.SkuIDs), &skuIDs)
}
if err == nil {
err = basesch.FixedBaseScheduler.GetPurchasePlatformFromVendorID(params.VendorID).SyncStoreSkus(db, storeIDs, skuIDs, params.IsSync, GetUserNameFromToken(params.Token))
}
}
return retVal, "", err
})
}