- 去除无用代码,主要是promotion相关的
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/promotion"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jd"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
@@ -110,10 +109,9 @@ func (c *DjswController) Token() {
|
||||
func (c *DjswController) StockIsHave() {
|
||||
// globals.SugarLogger.Info(string(c.Ctx.Input.RequestBody))
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
obj, callbackResponse := api.JdAPI.GetStoreStockCallbackMsg(getUsefulRequest(c.Ctx))
|
||||
_, callbackResponse := api.JdAPI.GetStoreStockCallbackMsg(getUsefulRequest(c.Ctx))
|
||||
if callbackResponse == nil {
|
||||
// globals.SugarLogger.Debugf("StockIsHave, obj:%s", utils.Format4Output(obj, false))
|
||||
callbackResponse = promotion.OnStoreStockMsg(obj)
|
||||
}
|
||||
c.Data["json"] = c.transferResponse("StockIsHave", callbackResponse)
|
||||
c.ServeJSON()
|
||||
@@ -126,11 +124,7 @@ func (c *DjswController) SinglePromoteCreate() {
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
obj, callbackResponse := api.JdAPI.GetOrderCallbackMsg(getUsefulRequest(c.Ctx))
|
||||
if callbackResponse == nil {
|
||||
if globals.EnableNewAct {
|
||||
callbackResponse = jd.OnActMsg(obj)
|
||||
} else {
|
||||
callbackResponse = promotion.OnNewPromotionMsg(obj)
|
||||
}
|
||||
callbackResponse = jd.OnActMsg(obj)
|
||||
}
|
||||
c.Data["json"] = c.transferResponse("SinglePromoteCreate", callbackResponse)
|
||||
c.ServeJSON()
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/promotion"
|
||||
)
|
||||
|
||||
type PromotionController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title 创建活动
|
||||
// @Description 创建活动
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorID formData int true "厂商ID,当前只支持,京东:0,京西(用于记录活动信息):99"
|
||||
// @Param name formData string true "活动名,必须唯一(所以名子上最好带上日期)"
|
||||
// @Param beginAt formData string true "开始日期"
|
||||
// @Param endAt formData string true "结束日期"
|
||||
// @Param type formData int true "活动类型,3:直降,4:限时抢购"
|
||||
// @Param storeIDs formData string true "json数据,storeID列表[1,2,3]"
|
||||
// @Param skuPrices formData string true "json数据,价格信息列表"
|
||||
// @Param limitDaily formData int false "是否按日0-不限,1-限购 (限时抢需填)"
|
||||
// @Param limitDevice formData int false "是否设备限购0-不限,1-限购"
|
||||
// @Param limitPin formData int false "是否账号限购0-不限,1-限购"
|
||||
// @Param limitCount formData int false "限购件数 0-不限,如账号限购、设备限购有一个为1,则限购件数必须大于0的整数"
|
||||
// @Param isAsync formData bool false "是否异步,缺省否(暂时只支持同步)"
|
||||
// @Param isContinueWhenError formData bool false "单个广告失败是否继续,缺省false"
|
||||
// @Param advertising formData string false "广告语"
|
||||
// @Param vendorPromotionID formData string false "厂商活动id,设置此字段表示关联京东活动,并不会真正去创建"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CreatePromotion [post]
|
||||
func (c *PromotionController) CreatePromotion() {
|
||||
c.callCreatePromotion(func(params *tPromotionCreatePromotionParams) (retVal interface{}, errCode string, err error) {
|
||||
if globals.EnableNewAct {
|
||||
if true { //params.VendorID == model.VendorIDJD {
|
||||
return retVal, "", fmt.Errorf("请使用新版活动管理创建活动")
|
||||
}
|
||||
}
|
||||
beginAt, err := utils.TryStr2Time(params.BeginAt)
|
||||
if err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
endAt, err := utils.TryStr2Time(params.EndAt)
|
||||
if err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
promotionParams := &promotion.PromotionParams{
|
||||
Name: params.Name,
|
||||
BeginAt: beginAt,
|
||||
EndAt: endAt,
|
||||
Type: params.Type,
|
||||
Advertising: params.Advertising,
|
||||
}
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.StoreIDs), &promotionParams.StoreIDs); err == nil {
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.SkuPrices), &promotionParams.SkuPrices); err == nil {
|
||||
retVal, err = promotion.CreateJdPromotion(params.Ctx, params.VendorID, false, params.IsAsync, params.IsContinueWhenError, params.VendorPromotionID, promotionParams, params.MapData)
|
||||
}
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
// // @Title 发送文件给门店
|
||||
// // @Description 发送文件给门店,调用GET方法得到浏览器端参考的上传HTML实现,userfiles
|
||||
// // @Param type formData int true "活动类型,3:直降,4:限时抢购"
|
||||
// // @Param isAsync formData bool false "是否异常,缺省否(暂时只支持同步)"
|
||||
// // @Success 200 {object} controllers.CallResult
|
||||
// // @Failure 200 {object} controllers.CallResult
|
||||
// // @router /CreatePromotionByExcel [post,get]
|
||||
// func (c *PromotionController) CreatePromotionByExcel() {
|
||||
// if c.Ctx.Input.IsGet() {
|
||||
// w := c.Ctx.ResponseWriter
|
||||
// // 上传页面
|
||||
// w.Header().Add("Content-Type", "text/html")
|
||||
// w.WriteHeader(200)
|
||||
// html := `
|
||||
// <form enctype="multipart/form-data" action="/v2/promotion/CreatePromotionByExcel" method="POST">
|
||||
// Send this file: <input name="userfile" accept="*.xlsx" type="file" />
|
||||
// <input type="text" name="type" />
|
||||
// <input type="text" name="isAsync" />
|
||||
// <input type="submit" value="Send File" />
|
||||
// </form>
|
||||
// `
|
||||
// io.WriteString(w, html)
|
||||
// } else if c.Ctx.Input.IsPost() {
|
||||
// c.callCreatePromotionByExcel(func(params *tPromotionCreatePromotionByExcelParams) (retVal interface{}, errCode string, err error) {
|
||||
// r := c.Ctx.Request
|
||||
// files := r.MultipartForm.File["userfile"]
|
||||
// retVal, err = promotion.CreatePromotionByExcel(params.Ctx, params.IsAsync, params.Type, files[0], "userName") //params.Ctx.GetUserName())
|
||||
// return retVal, "", err
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Title 根据历史订单信息发送活动消息
|
||||
// @Description 根据历史订单信息发送活动消息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param advertising formData string true "广告语"
|
||||
// @Param days formData int false "多少天以内订单数据中的用户(-1:全部,0:60天,缺省0)"
|
||||
// @Param isAsync formData bool false "是否异步,缺省否"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /SendAdvertingByGoodsOrder [post]
|
||||
func (c *PromotionController) SendAdvertingByGoodsOrder() {
|
||||
c.callSendAdvertingByGoodsOrder(func(params *tPromotionSendAdvertingByGoodsOrderParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = promotion.SendAdvertingByGoodsOrder(params.Ctx, params.Advertising, params.Days, params.IsAsync, params.Ctx.GetUserName())
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 查询活动
|
||||
// @Description 查询活动
|
||||
// @Param token header string true "认证token"
|
||||
// @Param keyword query string false "关键字"
|
||||
// @Param vendorID query int false "厂商ID,当前只支持京东:0 "
|
||||
// @Param promotionID query int false "活动id"
|
||||
// @Param vendorPromotionID query string false "厂商活动id"
|
||||
// @Param days query int false "多少天内创建的,缺省7天"
|
||||
// @Param name query string false "活动名,不完全匹配"
|
||||
// @Param cityCode query int false "活动门店所属城市code"
|
||||
// @Param beginAt query string false "开始日期,包括"
|
||||
// @Param endAt query string false "结束日期,包括"
|
||||
// @Param type query int false "活动类型,3:直降,4:限时抢购"
|
||||
// @Param storeID query int false "包含门店"
|
||||
// @Param skuID query int false "包含sku"
|
||||
// @Param offset query int false "活动列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "活动列表页大小(缺省为50,-1表示全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetPromotions [get]
|
||||
func (c *PromotionController) GetPromotions() {
|
||||
c.callGetPromotions(func(params *tPromotionGetPromotionsParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = promotion.GetJdPromotions(params.Ctx, params.Keyword, params.MapData, params.Offset, params.PageSize)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 取消活动
|
||||
// @Description 取消活动
|
||||
// @Param token header string true "认证token"
|
||||
// @Param promotionID formData int true "活动id"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CancelPromotion [put]
|
||||
func (c *PromotionController) CancelPromotion() {
|
||||
c.callCancelPromotion(func(params *tPromotionCancelPromotionParams) (retVal interface{}, errCode string, err error) {
|
||||
err = promotion.CancelJdPromotion(params.Ctx, params.PromotionID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 锁定解锁活动SKU
|
||||
// @Description 锁定解锁活动SKU
|
||||
// @Param token header string true "认证token"
|
||||
// @Param promotionID formData int true "活动id"
|
||||
// @Param isLock formData int true "锁定标志,0:不锁定,1:锁定"
|
||||
// @Param skuIDs formData string false "缺省全部"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /LockPromotionSkus [put]
|
||||
func (c *PromotionController) LockPromotionSkus() {
|
||||
c.callLockPromotionSkus(func(params *tPromotionLockPromotionSkusParams) (retVal interface{}, errCode string, err error) {
|
||||
var skuIDs []int
|
||||
if params.SkuIDs != "" {
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.SkuIDs), &skuIDs); err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
}
|
||||
retVal, err = promotion.LockPromotionSkus(params.Ctx, params.PromotionID, params.IsLock, skuIDs)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改活动商品门店结算价
|
||||
// @Description 修改活动商品门店结算价
|
||||
// @Param token header string true "认证token"
|
||||
// @Param promotionID formData int true "活动id"
|
||||
// @Param skuPrices formData string true "json数据,价格信息列表(只有EarningPrice有效)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdatePromotionSkusEarningPrice [put]
|
||||
func (c *PromotionController) UpdatePromotionSkusEarningPrice() {
|
||||
c.callUpdatePromotionSkusEarningPrice(func(params *tPromotionUpdatePromotionSkusEarningPriceParams) (retVal interface{}, errCode string, err error) {
|
||||
var skuPriceList []*promotion.SkuPrice
|
||||
if err = jxutils.Strings2Objs(params.SkuPrices, &skuPriceList); err == nil {
|
||||
retVal, err = promotion.UpdatePromotionSkusEarningPrice(params.Ctx, params.PromotionID, skuPriceList)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 从远程更新活动状态
|
||||
// @Description 从远程更新活动状态
|
||||
// @Param token header string true "认证token"
|
||||
// @Param promotionID formData int true "活动id"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /RefreshPromotionStatus [put]
|
||||
func (c *PromotionController) RefreshPromotionStatus() {
|
||||
c.callRefreshPromotionStatus(func(params *tPromotionRefreshPromotionStatusParams) (retVal interface{}, errCode string, err error) {
|
||||
err = promotion.UpdatePromotionStatusFromRemote(params.Ctx, params.PromotionID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package controllers
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/misc"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/tempop"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
@@ -10,8 +12,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/misc"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
)
|
||||
|
||||
type TempOpController struct {
|
||||
@@ -54,35 +54,35 @@ func (c *InitDataController) Change2JDSPU4Store() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 将遗留JD订单合并
|
||||
// @Description 将遗留JD订单合并
|
||||
// @Param token header string true "认证token"
|
||||
// @Param isAsync formData bool false "是否异步操作"
|
||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /TransferLegacyJdOrder [post]
|
||||
func (c *InitDataController) TransferLegacyJdOrder() {
|
||||
c.callTransferLegacyJdOrder(func(params *tInitdataTransferLegacyJdOrderParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = tempop.TransferLegacyJdOrder(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
// // @Title 将遗留JD订单合并
|
||||
// // @Description 将遗留JD订单合并
|
||||
// // @Param token header string true "认证token"
|
||||
// // @Param isAsync formData bool false "是否异步操作"
|
||||
// // @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// // @Success 200 {object} controllers.CallResult
|
||||
// // @Failure 200 {object} controllers.CallResult
|
||||
// // @router /TransferLegacyJdOrder [post]
|
||||
// func (c *InitDataController) TransferLegacyJdOrder() {
|
||||
// c.callTransferLegacyJdOrder(func(params *tInitdataTransferLegacyJdOrderParams) (retVal interface{}, errCode string, err error) {
|
||||
// retVal, err = tempop.TransferLegacyJdOrder(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||||
// return retVal, "", err
|
||||
// })
|
||||
// }
|
||||
|
||||
// @Title 将goods_order中缺失的订单从goods_order_original中恢复
|
||||
// @Description 将goods_order中缺失的订单从goods_order_original中恢复
|
||||
// @Param token header string true "认证token"
|
||||
// @Param isAsync formData bool false "是否异步操作"
|
||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CreateOrderFromOriginal [post]
|
||||
func (c *InitDataController) CreateOrderFromOriginal() {
|
||||
c.callCreateOrderFromOriginal(func(params *tInitdataCreateOrderFromOriginalParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = tempop.CreateOrderFromOriginal(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
// // @Title 将goods_order中缺失的订单从goods_order_original中恢复
|
||||
// // @Description 将goods_order中缺失的订单从goods_order_original中恢复
|
||||
// // @Param token header string true "认证token"
|
||||
// // @Param isAsync formData bool false "是否异步操作"
|
||||
// // @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// // @Success 200 {object} controllers.CallResult
|
||||
// // @Failure 200 {object} controllers.CallResult
|
||||
// // @router /CreateOrderFromOriginal [post]
|
||||
// func (c *InitDataController) CreateOrderFromOriginal() {
|
||||
// c.callCreateOrderFromOriginal(func(params *tInitdataCreateOrderFromOriginalParams) (retVal interface{}, errCode string, err error) {
|
||||
// retVal, err = tempop.CreateOrderFromOriginal(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||||
// return retVal, "", err
|
||||
// })
|
||||
// }
|
||||
|
||||
// @Title 拉取京东订单补齐本地
|
||||
// @Description 拉取京东订单补齐本地
|
||||
@@ -277,7 +277,7 @@ func (c *TempOpController) TestIt() {
|
||||
// @Title 开启或结束所有平台商店的额外时间
|
||||
// @Description 开启或结束所有平台商店的额外时间,并且修改所有商品库存为0或99999(开启:0 , 结束:99999)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorIDs formData string false "运营商ID列表(美团1 饿百3)"
|
||||
// @Param vendorIDs formData string false "运营商ID列表(美团1 饿百3)"
|
||||
// @Param storeIDs formData string false "京西门店ID列表"
|
||||
// @Param startOrEndStore formData bool true "开启或结束"
|
||||
// @Param startTime formData int false "开始营业时间(格式:930代表早上9点30分)"
|
||||
@@ -301,7 +301,7 @@ func (c *TempOpController) TestStartOrEndOpStore() {
|
||||
// @Title 京西平台和其他平台商品的对比
|
||||
// @Description 京西平台和其他平台商品的对比
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorIDs formData string false "运营商ID列表(京东0 美团1 饿百3)"
|
||||
// @Param vendorIDs formData string false "运营商ID列表(京东0 美团1 饿百3)"
|
||||
// @Param storeIDs formData string false "京西门店ID列表"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
|
||||
Reference in New Issue
Block a user