|
@@ -289,9 +289,11 @@ func Merge(wId, pId string, choose map[string]int, noteFunc ...func(string)) err
|
|
|
if public.BaseService.CountBySql(`select count(1) as count from base_user a inner join base_account b on (a.id=? and a.person_id=b.person_id and b.type=2 and b.miniprogram_code is null)`, saveBsId) == 0 &&
|
|
|
public.BaseService.CountBySql(`select count(1) as count from base_user a inner join base_account b on (a.id=? and a.person_id=b.person_id and b.type=2 and b.miniprogram_code is null)`, delBsId) > 0 {
|
|
|
ok := public.BaseService.ExecTx("合并小程序用户身份", func(tx *sql.Tx) bool {
|
|
|
- res1 := public.BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_user a inner join base_account b on (a.id=? and a.person_id=b.person_id and b.type=2) set b.person_id=(select person_id from base_user where id=?)`, delBsId, saveBsId)
|
|
|
- res2 := public.BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_position set user_id=? where user_id=? and type=2`, saveBsId, delBsId)
|
|
|
- return res1 >= 0 && res2 >= 0
|
|
|
+ res1 := public.BaseService.UpdateOrDeleteBySqlByTx(tx, `update debris_product.miniprogram_user set mgo_id=?,user_id=? where user_id=?`, saveId, saveBsId, delBsId)
|
|
|
+ res2 := public.BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_user a inner join base_account b on (a.id=? and a.person_id=b.person_id and b.type=2) inner join debris_product.user_power c on (b.id=c.account_id) set c.account_id=(select e.id from base_user d inner join base_account e on (d.id=? and d.person_id=e.person_id and e.type=2))`, delBsId, saveBsId)
|
|
|
+ res3 := public.BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_user a inner join base_account b on (a.id=? and a.person_id=b.person_id and b.type=2) set b.person_id=(select person_id from base_user where id=?)`, delBsId, saveBsId)
|
|
|
+ res4 := public.BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_position set user_id=? where user_id=? and type=2`, saveBsId, delBsId)
|
|
|
+ return res1 >= 0 && res2 >= 0 && res3 >= 0 && res4 >= 0
|
|
|
})
|
|
|
log.Println("合并小程序用户身份", saveId, saveBsId, delId, delBsId, ok)
|
|
|
}
|