- add jxcontext.Context to all public API.

This commit is contained in:
gazebo
2018-10-21 22:41:11 +08:00
parent 5d2bf9a510
commit b51ceb3d1d
22 changed files with 228 additions and 200 deletions

View File

@@ -11,6 +11,7 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/excel"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
@@ -132,7 +133,7 @@ func init() {
gob.Register([]*SkuPrice{})
}
func CreateJdPromotion(isIDJd bool, isAsync bool, params *PromotionParams, userName string) (hint string, err error) {
func CreateJdPromotion(ctx *jxcontext.Context, isIDJd bool, isAsync bool, params *PromotionParams, userName string) (hint string, err error) {
if len(params.SkuPrices) == 0 {
return "", ErrEmptySkus
}
@@ -306,7 +307,7 @@ func CreateJdPromotion(isIDJd bool, isAsync bool, params *PromotionParams, userN
return rootTask.ID, err
}
func CreatePromotionByExcel(isAsync bool, promotionType int, fileHeader *multipart.FileHeader, userName string) (hint string, err error) {
func CreatePromotionByExcel(ctx *jxcontext.Context, isAsync bool, promotionType int, fileHeader *multipart.FileHeader, userName string) (hint string, err error) {
file, err := fileHeader.Open()
if err != nil {
return hint, err
@@ -353,7 +354,7 @@ func CreatePromotionByExcel(isAsync bool, promotionType int, fileHeader *multipa
}
// globals.SugarLogger.Debug(utils.Format4Output(promotionParams, false))
// globals.SugarLogger.Debug(isAsync)
return CreateJdPromotion(true, isAsync, promotionParams, userName)
return CreateJdPromotion(ctx, true, isAsync, promotionParams, userName)
}
func excelStr2Time(timeStr string) (tm time.Time, err error) {

View File

@@ -7,6 +7,7 @@ import (
"github.com/KenmyZhang/aliyun-communicate"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
@@ -21,7 +22,7 @@ type tMobileInfo struct {
Mobile string
}
func SendAdvertingByGoodsOrder(advertising string, days int, isAsync bool, userName string) (hint string, err error) {
func SendAdvertingByGoodsOrder(ctx *jxcontext.Context, advertising string, days int, isAsync bool, userName string) (hint string, err error) {
globals.SugarLogger.Debugf("SendAdvertingByGoodsOrder advertising:%s, days:%d, isAsync:%t, userName:%s", advertising, days, isAsync, userName)
if days == 0 {