- add dao.SetWeiXinsEmpty2Null

- call SetWeiXinsEmpty2Null in BindMobile2Store and AddMobile2Mobile
This commit is contained in:
gazebo
2019-01-30 14:13:58 +08:00
parent 735ec2faa5
commit a61d047f5e
2 changed files with 19 additions and 8 deletions

View File

@@ -114,7 +114,10 @@ func BindMobile2Store(ctx *jxcontext.Context, mobile string, storeID int) (num i
if err = err2; err == nil || err == orm.ErrNoRows {
user.JxStoreID = storeID
if err == nil {
num, err = dao.UpdateEntity(db, user, "JxStoreID")
// todo transaction
if num, err = dao.UpdateEntity(db, user, "JxStoreID"); err == nil {
err = dao.SetWeiXinsEmpty2Null(db, user)
}
} else {
user.ParentID = -1
if err = dao.CreateWeiXins(db, user); err == nil {
@@ -137,7 +140,10 @@ func AddMobile2Mobile(ctx *jxcontext.Context, parentMobile, mobile string) (num
if err = err2; err == nil || err == orm.ErrNoRows {
user.ParentID = parentUser.ID
if err == nil {
num, err = dao.UpdateEntity(db, user, "ParentID")
// todo transaction
if num, err = dao.UpdateEntity(db, user, "ParentID"); err == nil {
err = dao.SetWeiXinsEmpty2Null(db, user)
}
} else {
if err = dao.CreateWeiXins(db, user); err == nil {
num = 1