- sync store category.
This commit is contained in:
@@ -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 "需要修改的商品名ID,payload中的相应数据会被忽略"
|
||||
// @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 "需要修改的商品名ID,payload中的相应数据会被忽略"
|
||||
// @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
|
||||
})
|
||||
}
|
||||
|
||||
35
controllers/cms_task.go
Normal file
35
controllers/cms_task.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type TaskController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title 查询长时间运行任务
|
||||
// @Description 查询长时间运行任务
|
||||
// @Param token header string true "认证token"
|
||||
// @Param taskID query string false "任务ID"
|
||||
// @Param fromStatus query int false "起始状态"
|
||||
// @Param toStatus query int false "结束状态"
|
||||
// @Param lastHours query int false "多少小时以内的"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetTasks [get]
|
||||
func (c *TaskController) GetTasks() {
|
||||
c.callGetTasks(func(params *tTaskGetTasksParams) (retVal interface{}, errCode string, err error) {
|
||||
if params.MapData["fromStatus"] == nil {
|
||||
params.FromStatus = tasksch.TaskStatusBegin
|
||||
if params.MapData["toStatus"] == nil {
|
||||
params.ToStatus = tasksch.TaskStatusEnd
|
||||
}
|
||||
} else if params.MapData["toStatus"] == nil {
|
||||
params.ToStatus = params.FromStatus
|
||||
}
|
||||
retVal = tasksch.GetTasks(params.TaskID, params.FromStatus, params.ToStatus, params.LastHours)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user