Files
integral-shop/docs/sql/com-sxsy80-data-cleanup.sql
apple e7ffbbf302 docs(sxsy80): 补充文档、合同资源与数据清理脚本
- 更新前后端 sign_contract_sxsy80.pdf
- 增加 com-sxsy80 说明、数据迁移与 SQL/执行脚本
- 增加 com-xsj33 数据迁移说明与 docs 下合同源文件

Made-with: Cursor
2026-04-26 16:50:36 +08:00

48 lines
1.9 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 太原树英商贸 / yangtangyoupin 数据清理
-- 依据: docs/com-sxsy80-data-imgration.md
-- 执行前请备份数据库。建议在事务中先 SELECT 核对影响行数后再 COMMIT。
SET NAMES utf8mb4;
START TRANSACTION;
SET FOREIGN_KEY_CHECKS = 0;
-- 订单类:整表清空
TRUNCATE TABLE `wa_order`;
TRUNCATE TABLE `wa_withdraw`;
TRUNCATE TABLE `eb_store_order`;
-- 寄售商品:仅保留 created_at >= 2026-04-24 且卖家 user_id 在保留名单内
DELETE FROM `wa_merchandise`
WHERE NOT (
`created_at` >= '2026-04-24 00:00:00'
AND `user_id` IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638)
);
-- 日志类:仅保留名单内 user_id
DELETE FROM `wa_selfbonus_log`
WHERE `user_id` NOT IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638);
DELETE FROM `wa_sharebonus_log`
WHERE `user_id` NOT IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638);
DELETE FROM `wa_coupon_log`
WHERE `user_id` NOT IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638);
-- 积分记录表实际字段为 uid非 user_id
DELETE FROM `eb_user_integral_record`
WHERE `uid` NOT IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638);
-- 商城用户:保留 uid 在名单内
DELETE FROM `eb_user`
WHERE `uid` NOT IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638);
-- WA 用户:保留 id 在名单内
DELETE FROM `wa_users`
WHERE `id` NOT IN (92566,92801,92839,93004,92637,92965,93093,93096,93116,92787,93121,93129,92884,93007,93020,93094,93099,93110,92638);
SET FOREIGN_KEY_CHECKS = 1;
COMMIT;