diff --git a/business/auth2/authprovider/defauther.go b/business/auth2/authprovider/defauther.go index adbbe752a..e6dd366be 100644 --- a/business/auth2/authprovider/defauther.go +++ b/business/auth2/authprovider/defauther.go @@ -77,7 +77,7 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []st authBindEx = &auth2.AuthBindEx{ AuthBind: *authBind, } - err = a.AddAuthBind(authBindEx, "admin") // 自动绑定 + err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定 } else if dao.IsNoRowsError(err) { err = nil } diff --git a/business/auth2/authprovider/password/password.go b/business/auth2/authprovider/password/password.go index a22c02855..780eae3ba 100644 --- a/business/auth2/authprovider/password/password.go +++ b/business/auth2/authprovider/password/password.go @@ -60,7 +60,7 @@ func (a *Auther) ChangePassword(userID, oldPassMD5, newPassMD5 string) (err erro _, err = dao.UpdateEntityLogically(db, authBind, map[string]interface{}{ "AuthSecret": encryptPwd, "AuthSecret2": salt, - }, "admin", nil) + }, model.AdminName, nil) } } else if dao.IsNoRowsError(err) { err = a.AddAuthBind(&auth2.AuthBindEx{ @@ -71,7 +71,7 @@ func (a *Auther) ChangePassword(userID, oldPassMD5, newPassMD5 string) (err erro AuthSecret: encryptPwd, AuthSecret2: salt, }, - }, "admin") + }, model.AdminName) } return err } diff --git a/business/jxcallback/orderman/oder_comment.go b/business/jxcallback/orderman/oder_comment.go index b14af20be..913f2abda 100644 --- a/business/jxcallback/orderman/oder_comment.go +++ b/business/jxcallback/orderman/oder_comment.go @@ -126,7 +126,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) ( } if err == nil { if isNewComment { - // dao.WrapAddIDCULEntity(orderComment, "admin") + // dao.WrapAddIDCULEntity(orderComment, model.AdminName) err = dao.CreateEntity(db, comment2) } else if comment2 != nil { _, err = dao.UpdateEntity(db, comment2) diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index b3b00b402..a84d0480e 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -46,7 +46,7 @@ func (*UserProvider) GetUser(authID, authIDType string) (user auth2.IUser) { func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error) { _, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{ "Mobile": mobile, - }, "admin", map[string]interface{}{ + }, model.AdminName, map[string]interface{}{ "UserID": userID, }) return err @@ -55,7 +55,7 @@ func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error) func (*UserProvider) UpdateUserEmail(userID string, email string) (err error) { _, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{ "Email": email, - }, "admin", map[string]interface{}{ + }, model.AdminName, map[string]interface{}{ "UserID": userID, }) return err diff --git a/business/jxutils/jxcontext/jxcontext.go b/business/jxutils/jxcontext/jxcontext.go index 6aa7d4469..38916cc8c 100644 --- a/business/jxutils/jxcontext/jxcontext.go +++ b/business/jxutils/jxcontext/jxcontext.go @@ -39,7 +39,7 @@ var ( ) 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) { diff --git a/business/jxutils/tasks/configrefresh.go b/business/jxutils/tasks/configrefresh.go index 641138572..4aff5ac92 100644 --- a/business/jxutils/tasks/configrefresh.go +++ b/business/jxutils/tasks/configrefresh.go @@ -3,6 +3,7 @@ package tasks import ( "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/legacymodel" "git.rosy.net.cn/jx-callback/globals/api" @@ -187,7 +188,7 @@ func SaveWeimobToken(token *weimobapi.TokenInfo) (err error) { Thirdparty: "weimob", Token: string(utils.MustMarshal(token)), 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) } diff --git a/business/model/auth2.go b/business/model/auth2.go index b8f251dc6..6d68d5902 100644 --- a/business/model/auth2.go +++ b/business/model/auth2.go @@ -5,6 +5,10 @@ const ( AuthBindStatusDisabled = 2 ) +const ( + AdminName = "jxadmin" +) + type AuthBind struct { ModelIDCULD diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index 0410e3465..8c02f0896 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -69,7 +69,7 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err result2 string 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) switch taskIndex { case 0: