|
@@ -180,33 +180,13 @@ func UserUpdates(this *UserIdReq) bool {
|
|
|
}
|
|
|
|
|
|
func UserDels(this *UserIdReq) bool {
|
|
|
- ok := false
|
|
|
- userData := entity.BaseMysql.FindOne(entity.UserTable, map[string]interface{}{"id": this.Id}, "", "")
|
|
|
- if userData != nil && len(*userData) > 0 {
|
|
|
- flag := entity.BaseMysql.ExecTx("", func(tx *sql.Tx) bool {
|
|
|
- thisdata := *userData
|
|
|
- ok1 := entity.BaseMysql.DeleteByTx(tx, entity.UserTable, map[string]interface{}{"id": this.Id})
|
|
|
- snapshot := entity.BaseMysql.InsertByTx(tx, entity.UserSnapshotTable, map[string]interface{}{
|
|
|
- "appid": thisdata["appid"],
|
|
|
- "user_id": this.Id,
|
|
|
- "phone": thisdata["phone"],
|
|
|
- "nickname": thisdata["nickname"],
|
|
|
- "headimg": thisdata["headimg"],
|
|
|
- "company": thisdata["company"],
|
|
|
- "position": thisdata["position"],
|
|
|
- "password": thisdata["password"],
|
|
|
- "s_openid": thisdata["s_openid"],
|
|
|
- "a_openid": thisdata["a_openid"],
|
|
|
- "unionid": thisdata["unionid"],
|
|
|
- "create_time": time.Now().Format("2006-01-02 15:04:05"),
|
|
|
- })
|
|
|
- return ok1 && snapshot > 0
|
|
|
- })
|
|
|
- if flag {
|
|
|
- ok = true
|
|
|
- }
|
|
|
- }
|
|
|
- return ok
|
|
|
+ return entity.BaseMysql.ExecTx("", func(tx *sql.Tx) bool {
|
|
|
+ _, e1 := entity.BaseMysql.ExecBySqlByTx(tx, `select * into base_user_backup from base_user where id=?`, this.Id)
|
|
|
+ _, e2 := entity.BaseMysql.ExecBySqlByTx(tx, `select * into base_position_backup from base_position where user_id=?`, this.Id)
|
|
|
+ _, e3 := entity.BaseMysql.ExecBySqlByTx(tx, `select a.* into base_person_backup from base_person a inner join base_user b on (b.id=? and a.id=b.person_id)`, this.Id)
|
|
|
+ _, e4 := entity.BaseMysql.ExecBySqlByTx(tx, `select a.* into base_account_backup from base_account a inner join base_user b on (b.id=? and a.person_id=b.person_id)`, this.Id)
|
|
|
+ return e1 == nil && e2 == nil && e3 == nil && e4 == nil
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//
|