- User添加Remark

This commit is contained in:
gazebo
2019-08-06 11:49:42 +08:00
parent 438879ac4f
commit baa9157949
3 changed files with 12 additions and 8 deletions

View File

@@ -10,16 +10,16 @@ import (
)
func TransferLegacyWeixins() (err error) {
const remark4Transfer = "transfer"
// DELETE t1
// FROM auth_bind t1
// WHERE t1.created_at > '2019-08-05';
// WHERE t1.remark = 'transfer';
// DELETE t1
// FROM user t1
// WHERE t1.created_at > '2019-08-05';
// WHERE t1.remark = 'transfer';
// DELETE t1
// FROM casbin_rule t1;
// TRUNCATE TABLE casbin_rule;
sql := `
SELECT *
@@ -46,6 +46,7 @@ func TransferLegacyWeixins() (err error) {
Name: v.NickName,
Mobile: v.Tel,
Type: model.UserTypeStoreBoss,
Remark: remark4Transfer,
}
if user.Name == "" {
user.Name = user.Mobile
@@ -56,7 +57,7 @@ func TransferLegacyWeixins() (err error) {
}
// globals.SugarLogger.Debug(utils.Format4Output(user, false))
if len(userList) == 0 {
err = CreateUser(user)
err = CreateUser(user, v.LastOperator)
} else {
user = userList[0]
}
@@ -70,6 +71,7 @@ func TransferLegacyWeixins() (err error) {
Type: weixin.AuthTypeMP,
AuthID: v.OpenID,
AuthID2: v.OpenIDUnion,
Remark: remark4Transfer,
},
},
})
@@ -81,6 +83,7 @@ func TransferLegacyWeixins() (err error) {
Type: weixin.AuthTypeMini,
AuthID: v.OpenIDMini,
AuthID2: v.OpenIDUnion,
Remark: remark4Transfer,
},
},
})