- add dao.SetWeiXinsEmpty2Null
- call SetWeiXinsEmpty2Null in BindMobile2Store and AddMobile2Mobile
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user