- TryStr2Time
This commit is contained in:
@@ -224,11 +224,18 @@ func (c *OrderManager) GetOrderWaybillInfo(ctx *jxcontext.Context, vendorOrderID
|
|||||||
func (c *OrderManager) ExportMTWaybills(ctx *jxcontext.Context, 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)
|
globals.SugarLogger.Debugf("ExportMTWaybills from:%s to:%s", fromDateStr, toDateStr)
|
||||||
|
|
||||||
fromDate := utils.Str2Time(fromDateStr)
|
fromDate, err := utils.TryStr2Time(fromDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if toDateStr == "" {
|
if toDateStr == "" {
|
||||||
toDateStr = fromDateStr
|
toDateStr = fromDateStr
|
||||||
}
|
}
|
||||||
toDate := utils.Str2Time(toDateStr).Add(24 * time.Hour)
|
toDate, err := utils.TryStr2Time(toDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
toDate = toDate.Add(24 * time.Hour)
|
||||||
var waybills []*tWaybillExt
|
var waybills []*tWaybillExt
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.*, t2.store_name, IF(t2.store_id <> 0, t2.store_id, t2.jx_store_id) store_id
|
SELECT t1.*, t2.store_name, IF(t2.store_id <> 0, t2.store_id, t2.jx_store_id) store_id
|
||||||
@@ -265,11 +272,18 @@ func (c *OrderManager) ExportMTWaybills(ctx *jxcontext.Context, fromDateStr, toD
|
|||||||
func (c *OrderManager) GetOrders(ctx *jxcontext.Context, 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)
|
globals.SugarLogger.Debugf("GetOrders from:%s to:%s", fromDateStr, toDateStr)
|
||||||
|
|
||||||
fromDate := utils.Str2Time(fromDateStr)
|
fromDate, err := utils.TryStr2Time(fromDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if toDateStr == "" {
|
if toDateStr == "" {
|
||||||
toDateStr = fromDateStr
|
toDateStr = fromDateStr
|
||||||
}
|
}
|
||||||
toDate := utils.Str2Time(toDateStr).Add(24 * time.Hour)
|
toDate, err := utils.TryStr2Time(toDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
toDate = toDate.Add(24 * time.Hour)
|
||||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||||
if offset < 0 {
|
if offset < 0 {
|
||||||
offset = 0
|
offset = 0
|
||||||
@@ -388,11 +402,18 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr
|
|||||||
func (c *OrderManager) GetWaybills(ctx *jxcontext.Context, 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)
|
globals.SugarLogger.Debugf("GetWaybills from:%s to:%s", fromDateStr, toDateStr)
|
||||||
|
|
||||||
fromDate := utils.Str2Time(fromDateStr)
|
fromDate, err := utils.TryStr2Time(fromDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if toDateStr == "" {
|
if toDateStr == "" {
|
||||||
toDateStr = fromDateStr
|
toDateStr = fromDateStr
|
||||||
}
|
}
|
||||||
toDate := utils.Str2Time(toDateStr).Add(24 * time.Hour)
|
toDate, err := utils.TryStr2Time(toDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
toDate = toDate.Add(24 * time.Hour)
|
||||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||||
if offset < 0 {
|
if offset < 0 {
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|||||||
@@ -469,11 +469,19 @@ func GetJdPromotions(ctx *jxcontext.Context, keyword string, params map[string]i
|
|||||||
}
|
}
|
||||||
if params["beginAt"] != nil {
|
if params["beginAt"] != nil {
|
||||||
sql += " AND t1.begin_at <= ?"
|
sql += " AND t1.begin_at <= ?"
|
||||||
sqlParams = append(sqlParams, utils.Str2Time(params["beginAt"].(string)))
|
beginAt, err2 := utils.TryStr2Time(params["beginAt"].(string))
|
||||||
|
if err = err2; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
sqlParams = append(sqlParams, beginAt)
|
||||||
}
|
}
|
||||||
if params["endAt"] != nil {
|
if params["endAt"] != nil {
|
||||||
sql += " AND t1.end_at >= ?"
|
sql += " AND t1.end_at >= ?"
|
||||||
sqlParams = append(sqlParams, utils.Str2Time(params["endAt"].(string)))
|
endAt, err2 := utils.TryStr2Time(params["endAt"].(string))
|
||||||
|
if err = err2; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
sqlParams = append(sqlParams, endAt)
|
||||||
}
|
}
|
||||||
days := defSearchDays
|
days := defSearchDays
|
||||||
if params["days"] != nil {
|
if params["days"] != nil {
|
||||||
|
|||||||
@@ -34,10 +34,18 @@ func (c *PromotionController) CreatePromotion() {
|
|||||||
if params.VendorID != model.VendorIDJD {
|
if params.VendorID != model.VendorIDJD {
|
||||||
return nil, "", errors.New("当前只支持创建京东促销")
|
return nil, "", errors.New("当前只支持创建京东促销")
|
||||||
}
|
}
|
||||||
|
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{
|
promotionParams := &promotion.PromotionParams{
|
||||||
Name: params.Name,
|
Name: params.Name,
|
||||||
BeginAt: utils.Str2Time(params.BeginAt),
|
BeginAt: beginAt,
|
||||||
EndAt: utils.Str2Time(params.EndAt),
|
EndAt: endAt,
|
||||||
Type: params.Type,
|
Type: params.Type,
|
||||||
Advertising: params.Advertising,
|
Advertising: params.Advertising,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
if [ -f "controllers/param_parser.go" ]; then
|
||||||
rm controllers/param_parser.go
|
rm controllers/param_parser.go
|
||||||
|
fi
|
||||||
bee generate docs
|
bee generate docs
|
||||||
cp swagger/param_parser.go.txt controllers/param_parser.go
|
cp swagger/param_parser.go.txt controllers/param_parser.go
|
||||||
|
|||||||
Reference in New Issue
Block a user