- User添加Remark
This commit is contained in:
@@ -10,16 +10,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TransferLegacyWeixins() (err error) {
|
func TransferLegacyWeixins() (err error) {
|
||||||
|
const remark4Transfer = "transfer"
|
||||||
// DELETE t1
|
// DELETE t1
|
||||||
// FROM auth_bind t1
|
// FROM auth_bind t1
|
||||||
// WHERE t1.created_at > '2019-08-05';
|
// WHERE t1.remark = 'transfer';
|
||||||
|
|
||||||
// DELETE t1
|
// DELETE t1
|
||||||
// FROM user t1
|
// FROM user t1
|
||||||
// WHERE t1.created_at > '2019-08-05';
|
// WHERE t1.remark = 'transfer';
|
||||||
|
|
||||||
// DELETE t1
|
// TRUNCATE TABLE casbin_rule;
|
||||||
// FROM casbin_rule t1;
|
|
||||||
|
|
||||||
sql := `
|
sql := `
|
||||||
SELECT *
|
SELECT *
|
||||||
@@ -46,6 +46,7 @@ func TransferLegacyWeixins() (err error) {
|
|||||||
Name: v.NickName,
|
Name: v.NickName,
|
||||||
Mobile: v.Tel,
|
Mobile: v.Tel,
|
||||||
Type: model.UserTypeStoreBoss,
|
Type: model.UserTypeStoreBoss,
|
||||||
|
Remark: remark4Transfer,
|
||||||
}
|
}
|
||||||
if user.Name == "" {
|
if user.Name == "" {
|
||||||
user.Name = user.Mobile
|
user.Name = user.Mobile
|
||||||
@@ -56,7 +57,7 @@ func TransferLegacyWeixins() (err error) {
|
|||||||
}
|
}
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(user, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(user, false))
|
||||||
if len(userList) == 0 {
|
if len(userList) == 0 {
|
||||||
err = CreateUser(user)
|
err = CreateUser(user, v.LastOperator)
|
||||||
} else {
|
} else {
|
||||||
user = userList[0]
|
user = userList[0]
|
||||||
}
|
}
|
||||||
@@ -70,6 +71,7 @@ func TransferLegacyWeixins() (err error) {
|
|||||||
Type: weixin.AuthTypeMP,
|
Type: weixin.AuthTypeMP,
|
||||||
AuthID: v.OpenID,
|
AuthID: v.OpenID,
|
||||||
AuthID2: v.OpenIDUnion,
|
AuthID2: v.OpenIDUnion,
|
||||||
|
Remark: remark4Transfer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -81,6 +83,7 @@ func TransferLegacyWeixins() (err error) {
|
|||||||
Type: weixin.AuthTypeMini,
|
Type: weixin.AuthTypeMini,
|
||||||
AuthID: v.OpenIDMini,
|
AuthID: v.OpenIDMini,
|
||||||
AuthID2: v.OpenIDUnion,
|
AuthID2: v.OpenIDUnion,
|
||||||
|
Remark: remark4Transfer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.A
|
|||||||
if inAuthInfo.AuthBindInfo.Type == dingding.AuthTypeStaff {
|
if inAuthInfo.AuthBindInfo.Type == dingding.AuthTypeStaff {
|
||||||
user.Type |= model.UserTypeOperator
|
user.Type |= model.UserTypeOperator
|
||||||
}
|
}
|
||||||
if err = CreateUser(user); err == nil {
|
if err = CreateUser(user, "RegisterUser"); err == nil {
|
||||||
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
||||||
err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo)
|
err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo)
|
||||||
}
|
}
|
||||||
@@ -109,11 +109,11 @@ func GetUserBindAuthInfo(ctx *jxcontext.Context) (authList []*model.AuthBind, er
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateUser(user *model.User) (err error) {
|
func CreateUser(user *model.User, creatorName string) (err error) {
|
||||||
if user == nil || user.UserID2 == "" || user.Name == "" || user.Mobile == "" {
|
if user == nil || user.UserID2 == "" || user.Name == "" || user.Mobile == "" {
|
||||||
return ErrUserIDAndNameMustGiven
|
return ErrUserIDAndNameMustGiven
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(user, "RegisterUser")
|
dao.WrapAddIDCULDEntity(user, creatorName)
|
||||||
user.UserID = utils.GetUUID()
|
user.UserID = utils.GetUUID()
|
||||||
user.Status = model.UserStatusNormal
|
user.Status = model.UserStatusNormal
|
||||||
return dao.CreateEntity(nil, user)
|
return dao.CreateEntity(nil, user)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ type User struct {
|
|||||||
Status int8 `json:"status"`
|
Status int8 `json:"status"`
|
||||||
Type int8 `json:"type"` // 用户类型
|
Type int8 `json:"type"` // 用户类型
|
||||||
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
||||||
|
Remark string `orm:"size(255)" json:"remark"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*User) TableUnique() [][]string {
|
func (*User) TableUnique() [][]string {
|
||||||
|
|||||||
Reference in New Issue
Block a user