- replace literal 'admin' with const
This commit is contained in:
@@ -77,7 +77,7 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []st
|
|||||||
authBindEx = &auth2.AuthBindEx{
|
authBindEx = &auth2.AuthBindEx{
|
||||||
AuthBind: *authBind,
|
AuthBind: *authBind,
|
||||||
}
|
}
|
||||||
err = a.AddAuthBind(authBindEx, "admin") // 自动绑定
|
err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定
|
||||||
} else if dao.IsNoRowsError(err) {
|
} else if dao.IsNoRowsError(err) {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (a *Auther) ChangePassword(userID, oldPassMD5, newPassMD5 string) (err erro
|
|||||||
_, err = dao.UpdateEntityLogically(db, authBind, map[string]interface{}{
|
_, err = dao.UpdateEntityLogically(db, authBind, map[string]interface{}{
|
||||||
"AuthSecret": encryptPwd,
|
"AuthSecret": encryptPwd,
|
||||||
"AuthSecret2": salt,
|
"AuthSecret2": salt,
|
||||||
}, "admin", nil)
|
}, model.AdminName, nil)
|
||||||
}
|
}
|
||||||
} else if dao.IsNoRowsError(err) {
|
} else if dao.IsNoRowsError(err) {
|
||||||
err = a.AddAuthBind(&auth2.AuthBindEx{
|
err = a.AddAuthBind(&auth2.AuthBindEx{
|
||||||
@@ -71,7 +71,7 @@ func (a *Auther) ChangePassword(userID, oldPassMD5, newPassMD5 string) (err erro
|
|||||||
AuthSecret: encryptPwd,
|
AuthSecret: encryptPwd,
|
||||||
AuthSecret2: salt,
|
AuthSecret2: salt,
|
||||||
},
|
},
|
||||||
}, "admin")
|
}, model.AdminName)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
|
|||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if isNewComment {
|
if isNewComment {
|
||||||
// dao.WrapAddIDCULEntity(orderComment, "admin")
|
// dao.WrapAddIDCULEntity(orderComment, model.AdminName)
|
||||||
err = dao.CreateEntity(db, comment2)
|
err = dao.CreateEntity(db, comment2)
|
||||||
} else if comment2 != nil {
|
} else if comment2 != nil {
|
||||||
_, err = dao.UpdateEntity(db, comment2)
|
_, err = dao.UpdateEntity(db, comment2)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (*UserProvider) GetUser(authID, authIDType string) (user auth2.IUser) {
|
|||||||
func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error) {
|
func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error) {
|
||||||
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
||||||
"Mobile": mobile,
|
"Mobile": mobile,
|
||||||
}, "admin", map[string]interface{}{
|
}, model.AdminName, map[string]interface{}{
|
||||||
"UserID": userID,
|
"UserID": userID,
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
@@ -55,7 +55,7 @@ func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error)
|
|||||||
func (*UserProvider) UpdateUserEmail(userID string, email string) (err error) {
|
func (*UserProvider) UpdateUserEmail(userID string, email string) (err error) {
|
||||||
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
||||||
"Email": email,
|
"Email": email,
|
||||||
}, "admin", map[string]interface{}{
|
}, model.AdminName, map[string]interface{}{
|
||||||
"UserID": userID,
|
"UserID": userID,
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
AdminCtx = NewWithUserName(nil, "jxadmin", nil, nil)
|
AdminCtx = NewWithUserName(nil, model.AdminName, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWithUserName(rootTask tasksch.ITask, userName string, w http.ResponseWriter, r *http.Request) (ctx *Context) {
|
func NewWithUserName(rootTask tasksch.ITask, userName string, w http.ResponseWriter, r *http.Request) (ctx *Context) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package tasks
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
@@ -187,7 +188,7 @@ func SaveWeimobToken(token *weimobapi.TokenInfo) (err error) {
|
|||||||
Thirdparty: "weimob",
|
Thirdparty: "weimob",
|
||||||
Token: string(utils.MustMarshal(token)),
|
Token: string(utils.MustMarshal(token)),
|
||||||
Date: utils.Time2Str(time.Now().Add((time.Duration(token.ExpiresIn) - weimobTokenExpires/time.Second) * time.Second)),
|
Date: utils.Time2Str(time.Now().Add((time.Duration(token.ExpiresIn) - weimobTokenExpires/time.Second) * time.Second)),
|
||||||
LastOperator: "admin",
|
LastOperator: model.AdminName,
|
||||||
}
|
}
|
||||||
return dao.CreateOrUpdate(db, config)
|
return dao.CreateOrUpdate(db, config)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ const (
|
|||||||
AuthBindStatusDisabled = 2
|
AuthBindStatusDisabled = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
AdminName = "jxadmin"
|
||||||
|
)
|
||||||
|
|
||||||
type AuthBind struct {
|
type AuthBind struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
result2 string
|
result2 string
|
||||||
err2 error
|
err2 error
|
||||||
)
|
)
|
||||||
task := tasksch.NewParallelTask("jd GetOrder", nil, "admin", func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, errInner error) {
|
task := tasksch.NewParallelTask("jd GetOrder", nil, model.AdminName, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, errInner error) {
|
||||||
taskIndex := batchItemList[0].(int)
|
taskIndex := batchItemList[0].(int)
|
||||||
switch taskIndex {
|
switch taskIndex {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user