!token改为7部分
This commit is contained in:
@@ -157,7 +157,7 @@ func getFixedTokenName(token string) *AuthInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
|
func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
|
||||||
token, tokenType := createToken(user)
|
token, tokenType := createToken(user, authBindInfo)
|
||||||
expireDuration := DefTokenDuration
|
expireDuration := DefTokenDuration
|
||||||
authInfo = &AuthInfo{
|
authInfo = &AuthInfo{
|
||||||
AuthBindInfo: authBindInfo,
|
AuthBindInfo: authBindInfo,
|
||||||
@@ -378,9 +378,9 @@ func ClearUserToken(userID string) {
|
|||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
|
|
||||||
func createToken(user IUser) (token string, tokenType int) {
|
func createToken(user IUser, authBindInfo *AuthBindEx) (token string, tokenType int) {
|
||||||
userID := TokenUserEmpty
|
userID := TokenUserEmpty
|
||||||
userName := TokenUserEmpty
|
userName := authBindInfo.AuthID
|
||||||
tokenType = TokenTypeOnlyAuth
|
tokenType = TokenTypeOnlyAuth
|
||||||
if user != nil {
|
if user != nil {
|
||||||
userID = user.GetID()
|
userID = user.GetID()
|
||||||
@@ -392,8 +392,9 @@ func createToken(user IUser) (token string, tokenType int) {
|
|||||||
TokenVer,
|
TokenVer,
|
||||||
userID,
|
userID,
|
||||||
time.Now().Format("20060102-150405"),
|
time.Now().Format("20060102-150405"),
|
||||||
userName,
|
authBindInfo.Type,
|
||||||
utils.GetUUID(),
|
utils.GetUUID(),
|
||||||
|
userName,
|
||||||
}, TokenTypeSep), tokenType
|
}, TokenTypeSep), tokenType
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +405,7 @@ func GetTokenType(token string) (tokenType int) {
|
|||||||
tokenType = TokenTypeNone
|
tokenType = TokenTypeNone
|
||||||
if token != "" {
|
if token != "" {
|
||||||
tokenPartList := strings.Split(token, TokenTypeSep)
|
tokenPartList := strings.Split(token, TokenTypeSep)
|
||||||
if (len(tokenPartList) == 1) || (len(tokenPartList) == 6 && tokenPartList[2] != TokenUserEmpty) {
|
if (len(tokenPartList) == 1) || (len(tokenPartList) >= 6 && tokenPartList[2] != TokenUserEmpty) {
|
||||||
tokenType = TokenTypeNormal
|
tokenType = TokenTypeNormal
|
||||||
} else {
|
} else {
|
||||||
tokenType = TokenTypeOnlyAuth
|
tokenType = TokenTypeOnlyAuth
|
||||||
|
|||||||
@@ -1037,7 +1037,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
}
|
}
|
||||||
setStoreSkuBindStatus(skuBind, model.SyncFlagNewMask)
|
setStoreSkuBindStatus(skuBind, model.SyncFlagNewMask)
|
||||||
dao.WrapAddIDCULDEntity(skuBind, userName)
|
dao.WrapAddIDCULDEntity(skuBind, userName)
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(skuBind, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(skuBind, false))
|
||||||
if deletedSku := dao.GetDeletedStoreSkuBind(db, skuBind.StoreID, skuBind.SkuID); deletedSku == nil {
|
if deletedSku := dao.GetDeletedStoreSkuBind(db, skuBind.StoreID, skuBind.SkuID); deletedSku == nil {
|
||||||
if err = dao.CreateEntity(db, skuBind); err != nil {
|
if err = dao.CreateEntity(db, skuBind); err != nil {
|
||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
|
|||||||
Reference in New Issue
Block a user