|
@@ -285,6 +285,16 @@ 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
|
|
|
+ })
|
|
|
+ log.Println("合并小程序用户身份", saveId, saveBsId, delId, delBsId, ok)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//订阅合并处理
|