- 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

@@ -7,6 +7,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/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner"
@@ -25,7 +26,7 @@ type tWaybillExt struct {
StoreID int `json:"storeID" orm:"column(store_id)"`
}
func (c *OrderManager) GetStoreOrderInfo(storeID string, lastHours int, fromStatus, toStatus, offset, pageSize int) (orders []*model.GoodsOrderExt, err error) {
func (c *OrderManager) GetStoreOrderInfo(ctx *jxcontext.Context, storeID string, lastHours int, fromStatus, toStatus, offset, pageSize int) (orders []*model.GoodsOrderExt, err error) {
globals.SugarLogger.Debugf("GetStoreOrderInfo storeID:%s", storeID)
if lastHours > maxLastHours {
lastHours = maxLastHours
@@ -58,7 +59,7 @@ func (c *OrderManager) GetStoreOrderInfo(storeID string, lastHours int, fromStat
return nil, err
}
func (c *OrderManager) GetStoreOrderCountInfo(storeID string, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID string, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%s", storeID)
if lastHours > maxLastHours {
lastHours = maxLastHours
@@ -82,7 +83,7 @@ func (c *OrderManager) GetStoreOrderCountInfo(storeID string, lastHours int) (co
return nil, err
}
func (c *OrderManager) GetOrderSkuInfo(vendorOrderID string, vendorID int) (skus []*model.OrderSkuExt, err error) {
func (c *OrderManager) GetOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (skus []*model.OrderSkuExt, err error) {
globals.SugarLogger.Debugf("GetOrderSkuInfo orderID:%s", vendorOrderID)
if globals.OrderUseNewTable {
db := dao.GetDB()
@@ -148,7 +149,7 @@ func (c *OrderManager) GetOrderSkuInfo(vendorOrderID string, vendorID int) (skus
return nil, err
}
func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int, isRefresh bool) (order *model.GoodsOrderExt, err error) {
func (c *OrderManager) GetOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, isRefresh bool) (order *model.GoodsOrderExt, err error) {
globals.SugarLogger.Debugf("GetOrderInfo orderID:%s", vendorOrderID)
db := orm.NewOrm()
orders := []*model.GoodsOrderExt{}
@@ -180,7 +181,7 @@ func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int, isRefres
return nil, err
}
func (c *OrderManager) GetOrderWaybillInfo(vendorOrderID string, vendorID int) (bills []*model.Waybill, err error) {
func (c *OrderManager) GetOrderWaybillInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (bills []*model.Waybill, err error) {
globals.SugarLogger.Debugf("GetOrderWaybillInfo orderID:%s", vendorOrderID)
db := orm.NewOrm()
_, err = db.Raw(`
@@ -195,7 +196,7 @@ func (c *OrderManager) GetOrderWaybillInfo(vendorOrderID string, vendorID int) (
return nil, err
}
func (c *OrderManager) ExportMTWaybills(fromDateStr, toDateStr string) (excelContent []byte, err error) {
func (c *OrderManager) ExportMTWaybills(ctx *jxcontext.Context, fromDateStr, toDateStr string) (excelContent []byte, err error) {
globals.SugarLogger.Debugf("ExportMTWaybills from:%s to:%s", fromDateStr, toDateStr)
fromDate := utils.Str2Time(fromDateStr)
@@ -236,7 +237,7 @@ func (c *OrderManager) ExportMTWaybills(fromDateStr, toDateStr string) (excelCon
return nil, err
}
func (c *OrderManager) GetOrders(fromDateStr, toDateStr string, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr string, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
globals.SugarLogger.Debugf("GetOrders from:%s to:%s", fromDateStr, toDateStr)
fromDate := utils.Str2Time(fromDateStr)
@@ -357,7 +358,7 @@ func (c *OrderManager) GetOrders(fromDateStr, toDateStr string, params map[strin
return pagedInfo, err
}
func (c *OrderManager) GetWaybills(fromDateStr, toDateStr string, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
func (c *OrderManager) GetWaybills(ctx *jxcontext.Context, fromDateStr, toDateStr string, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
globals.SugarLogger.Debugf("GetWaybills from:%s to:%s", fromDateStr, toDateStr)
fromDate := utils.Str2Time(fromDateStr)