- TrimBlanChar to TrimBlankChar
- error_code.go
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -76,5 +77,5 @@ func GetUserInfo(token string) (loginInfo *LoginInfo, err error) {
|
|||||||
if err = globals.Cacher.GetAs(token, loginInfo); err == nil {
|
if err = globals.Cacher.GetAs(token, loginInfo); err == nil {
|
||||||
return loginInfo, nil
|
return loginInfo, nil
|
||||||
}
|
}
|
||||||
return nil, errors.New("token过期或无效,请重新登录")
|
return nil, model.ErrTokenIsInvalid
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import (
|
|||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/auth"
|
"git.rosy.net.cn/jx-callback/business/jxcallback/auth"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"github.com/astaxie/beego"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Context struct {
|
type Context struct {
|
||||||
@@ -52,9 +51,9 @@ func New(rootTask tasksch.ITask, token string, w http.ResponseWriter, r *http.Re
|
|||||||
mapData: make(map[interface{}]interface{}),
|
mapData: make(map[interface{}]interface{}),
|
||||||
}
|
}
|
||||||
ctx.userInfo, err = auth.GetUserInfo(token)
|
ctx.userInfo, err = auth.GetUserInfo(token)
|
||||||
if err != nil && beego.BConfig.RunMode == "prod" {
|
if err != nil {
|
||||||
globals.SugarLogger.Warnf("token is invalid, token:%s", token)
|
// globals.SugarLogger.Warnf("token is invalid, token:%s", token)
|
||||||
// return nil, "", err
|
return nil, model.ErrCodeTokenIsInvalid, err
|
||||||
}
|
}
|
||||||
return ctx, "", nil
|
return ctx, "", nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ func SplitStoreName(fullName, separator, defaultPrefix string) (prefix, bareName
|
|||||||
bareName = strings.Trim(strings.Trim(fullName, defaultPrefix), separator)
|
bareName = strings.Trim(strings.Trim(fullName, defaultPrefix), separator)
|
||||||
|
|
||||||
}
|
}
|
||||||
return utils.TrimBlanChar(defaultPrefix), utils.TrimBlanChar(bareName)
|
return utils.TrimBlankChar(defaultPrefix), utils.TrimBlankChar(bareName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ComposeStoreName(bareName, separator, prefix string) (fullName string) {
|
func ComposeStoreName(bareName, separator, prefix string) (fullName string) {
|
||||||
return prefix + separator + utils.TrimBlanChar(strings.Trim(bareName, separator))
|
return prefix + separator + utils.TrimBlankChar(strings.Trim(bareName, separator))
|
||||||
}
|
}
|
||||||
|
|
||||||
func StrTime2JxOperationTime(strTime string, defValue int16) int16 {
|
func StrTime2JxOperationTime(strTime string, defValue int16) int16 {
|
||||||
|
|||||||
15
business/model/error_code.go
Normal file
15
business/model/error_code.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
const (
|
||||||
|
ErrorCodeIgnore = "ignore"
|
||||||
|
|
||||||
|
ErrCodeSuccess = "0"
|
||||||
|
ErrCodeGeneralFailed = "-1"
|
||||||
|
ErrCodeTokenIsInvalid = "-2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrTokenIsInvalid = errors.New("token过期或无效,请重新登录")
|
||||||
|
)
|
||||||
@@ -47,7 +47,7 @@ func (p *PurchaseHandler) GetOrder(vendorOrderID string) (order *model.GoodsOrde
|
|||||||
ConsigneeMobile: userMap["phone"].(string),
|
ConsigneeMobile: userMap["phone"].(string),
|
||||||
ConsigneeAddress: userMap["address"].(string),
|
ConsigneeAddress: userMap["address"].(string),
|
||||||
CoordinateType: model.CoordinateTypeBaiDu,
|
CoordinateType: model.CoordinateTypeBaiDu,
|
||||||
BuyerComment: utils.TrimBlanChar(utils.Interface2String(orderMap["remark"])),
|
BuyerComment: utils.TrimBlankChar(utils.Interface2String(orderMap["remark"])),
|
||||||
ExpectedDeliveredTime: getTimeFromTimestampStr(utils.Interface2String(orderMap["send_time"])),
|
ExpectedDeliveredTime: getTimeFromTimestampStr(utils.Interface2String(orderMap["send_time"])),
|
||||||
VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(orderMap["status"])),
|
VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(orderMap["status"])),
|
||||||
OrderSeq: int(utils.Str2Int64(utils.Interface2String(orderMap["order_index"]))),
|
OrderSeq: int(utils.Str2Int64(utils.Interface2String(orderMap["order_index"]))),
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ func (p *PurchaseHandler) updateLocalCatAsNew(db *dao.DaoDB, localCatMap map[str
|
|||||||
}
|
}
|
||||||
|
|
||||||
func formatName(name string) string {
|
func formatName(name string) string {
|
||||||
return utils.TrimBlanChar(utils.FilterMb4(name))
|
return utils.TrimBlankChar(utils.FilterMb4(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 饿百的排序是从大到小
|
// 饿百的排序是从大到小
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
ConsigneeName: result["consignee"].(string),
|
ConsigneeName: result["consignee"].(string),
|
||||||
ConsigneeMobile: consigneeMobile,
|
ConsigneeMobile: consigneeMobile,
|
||||||
ConsigneeAddress: result["address"].(string),
|
ConsigneeAddress: result["address"].(string),
|
||||||
BuyerComment: utils.TrimBlanChar(utils.Interface2String(result["description"])),
|
BuyerComment: utils.TrimBlankChar(utils.Interface2String(result["description"])),
|
||||||
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["deliverTime"]), utils.DefaultTimeValue),
|
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["deliverTime"]), utils.DefaultTimeValue),
|
||||||
VendorStatus: utils.Interface2String(result["status"]), // 取订单的原始status,不合并消息类型(因为当前消息类型没有意义)
|
VendorStatus: utils.Interface2String(result["status"]), // 取订单的原始status,不合并消息类型(因为当前消息类型没有意义)
|
||||||
OrderSeq: int(utils.MustInterface2Int64(result["daySn"])),
|
OrderSeq: int(utils.MustInterface2Int64(result["daySn"])),
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
ConsigneeMobile: result["buyerMobile"].(string),
|
ConsigneeMobile: result["buyerMobile"].(string),
|
||||||
ConsigneeAddress: result["buyerFullAddress"].(string),
|
ConsigneeAddress: result["buyerFullAddress"].(string),
|
||||||
CoordinateType: model.CoordinateTypeMars,
|
CoordinateType: model.CoordinateTypeMars,
|
||||||
BuyerComment: utils.TrimBlanChar(utils.Interface2String(result["orderBuyerRemark"])),
|
BuyerComment: utils.TrimBlankChar(utils.Interface2String(result["orderBuyerRemark"])),
|
||||||
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["orderPreEndDeliveryTime"]), utils.DefaultTimeValue),
|
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["orderPreEndDeliveryTime"]), utils.DefaultTimeValue),
|
||||||
VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(result["orderStatus"])),
|
VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(result["orderStatus"])),
|
||||||
OrderSeq: int(utils.MustInterface2Int64(result["orderNum"])),
|
OrderSeq: int(utils.MustInterface2Int64(result["orderNum"])),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
|
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ func (c *FinancialController) ShowStoreLatestBill() {
|
|||||||
htmlResult = fmt.Sprintf(html, bills[0].Url)
|
htmlResult = fmt.Sprintf(html, bills[0].Url)
|
||||||
}
|
}
|
||||||
err2 = err
|
err2 = err
|
||||||
return retVal, ignoreCode, err
|
return retVal, model.ErrorCodeIgnore, err
|
||||||
})
|
})
|
||||||
if htmlResult != "" {
|
if htmlResult != "" {
|
||||||
io.WriteString(w, htmlResult)
|
io.WriteString(w, htmlResult)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/defsch"
|
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/defsch"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
@@ -186,7 +187,7 @@ func (c *OrderController) ExportMTWaybills() {
|
|||||||
}
|
}
|
||||||
content, err = orderman.FixedOrderManager.ExportMTWaybills(params.Ctx, params.FromDate, params.ToDate)
|
content, err = orderman.FixedOrderManager.ExportMTWaybills(params.Ctx, params.FromDate, params.ToDate)
|
||||||
globals.SugarLogger.Debug(err)
|
globals.SugarLogger.Debug(err)
|
||||||
return retVal, ignoreCode, err
|
return retVal, model.ErrorCodeIgnore, err
|
||||||
})
|
})
|
||||||
if content != nil {
|
if content != nil {
|
||||||
c.Ctx.ResponseWriter.Header().Set("Content-Type", "application/vnd.ms-excel")
|
c.Ctx.ResponseWriter.Header().Set("Content-Type", "application/vnd.ms-excel")
|
||||||
|
|||||||
Reference in New Issue
Block a user