Ver código fonte

删除用户体系

wangchuanjin 2 anos atrás
pai
commit
80cdbc79be
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      service/user.go

+ 5 - 1
service/user.go

@@ -185,7 +185,11 @@ func UserDels(this *UserIdReq) bool {
 		_, 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
+		d1 := entity.BaseMysql.UpdateOrDeleteBySqlByTx(tx, `delete a from base_person a inner join base_user b on (b.id=? and a.id=b.person_id)`, this.Id)
+		d2 := entity.BaseMysql.UpdateOrDeleteBySqlByTx(tx, `delete a from base_account a inner join base_user b on (b.id=? and a.person_id=b.person_id)`, this.Id)
+		d3 := entity.BaseMysql.UpdateOrDeleteBySqlByTx(tx, `delete from base_user where id=?`, this.Id)
+		d4 := entity.BaseMysql.UpdateOrDeleteBySqlByTx(tx, `delete from base_position where user_id=?`, this.Id)
+		return e1 == nil && e2 == nil && e3 == nil && e4 == nil && d1 >= 0 && d2 >= 0 && d3 >= 0 && d4 >= 0
 	})
 }