- 重构createWaybillOn3rdProviders
This commit is contained in:
@@ -36,6 +36,10 @@ func init() {
|
||||
AdminCtx = NewWithUserName(nil, model.AdminName, nil, nil)
|
||||
}
|
||||
|
||||
func NewWithOnlyUserName(userName string) (ctx *Context) {
|
||||
return NewWithUserName(nil, userName, nil, nil)
|
||||
}
|
||||
|
||||
func NewWithUserName(notUsed interface{}, userName string, w http.ResponseWriter, r *http.Request) (ctx *Context) {
|
||||
ctx = &Context{
|
||||
token: userName,
|
||||
|
||||
@@ -311,3 +311,12 @@ func AddVendorInfo2Err(inErr error, vendorID int) (outErr error) {
|
||||
}
|
||||
return outErr
|
||||
}
|
||||
|
||||
func LimitStringLen(str string, maxLen int) (limitedStr string) {
|
||||
if maxLen > 0 {
|
||||
if strLen := len(str); strLen > maxLen {
|
||||
str = str[:maxLen]
|
||||
}
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user