113 行
7.8 KiB
SQL
113 行
7.8 KiB
SQL
-- ==============================================================================
|
|
-- 恒联数通 · 正式投入生产环境 全量测试数据安全清理脚本
|
|
-- 适用场景:系统正式投产上线前,全量清空所有测试账号、测试订单、分润记录、
|
|
-- 提现数据、微信授权、互动行为与大盘指标,重置自增ID为 1。
|
|
--
|
|
-- 【受白名单保护的系统基座资产(绝对不清理)】:
|
|
-- 1. 管理员与权限体系 (hla_admin, hla_auth_group, hla_auth_group_access, hla_auth_rule)
|
|
-- 2. 商城商品基座 (hla_shopro_goods, hla_shopro_goods_sku, hla_shopro_goods_sku_price, hla_shopro_goods_service, hla_category, hla_shopro_category)
|
|
-- 3. 分销与计奖规则 (hla_shopro_commission_goods, hla_shopro_commission_level)
|
|
-- 4. 全局系统配置 (hla_config, hla_shopro_config, hla_shopro_pay_config, hla_shopro_notification_config)
|
|
-- 5. 装修模板与页面 (hla_shopro_decorate, hla_shopro_decorate_page)
|
|
-- 6. 物流配送与地区字典 (hla_shopro_dispatch, hla_shopro_dispatch_express, hla_shopro_data_area, hla_shopro_data_express)
|
|
-- 7. 附件媒体库 (hla_attachment - 保留商品图、分类图、Banner等素材)
|
|
-- ==============================================================================
|
|
|
|
SET FOREIGN_KEY_CHECKS = 0;
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 1. 清理用户体系与第三方认证授权数据 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_user`; -- 会员主表
|
|
TRUNCATE TABLE `hla_user_token`; -- 会员登录Token凭证
|
|
TRUNCATE TABLE `hla_shopro_third_oauth`; -- 微信小程序/公众号等第三方授权绑定关系
|
|
TRUNCATE TABLE `hla_shopro_user_account`; -- 会员提现账户绑定表(银行卡/支付宝/微信)
|
|
TRUNCATE TABLE `hla_shopro_user_address`; -- 会员收货地址库
|
|
TRUNCATE TABLE `hla_shopro_user_invoice`; -- 会员发票抬头库
|
|
TRUNCATE TABLE `hla_sms`; -- 手机验证码记录
|
|
TRUNCATE TABLE `hla_ems`; -- 邮箱验证码记录
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 2. 清理商城订单及交易明细数据 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_shopro_order`; -- 商城订单主表
|
|
TRUNCATE TABLE `hla_shopro_order_item`; -- 订单商品行明细
|
|
TRUNCATE TABLE `hla_shopro_order_action`; -- 订单状态流转与操作日志
|
|
TRUNCATE TABLE `hla_shopro_order_address`; -- 订单收货地址历史快照
|
|
TRUNCATE TABLE `hla_shopro_order_express`; -- 订单发货物流包裹
|
|
TRUNCATE TABLE `hla_shopro_order_express_log`; -- 订单快递轨迹日志
|
|
TRUNCATE TABLE `hla_shopro_order_invoice`; -- 订单开票记录
|
|
TRUNCATE TABLE `hla_shopro_order_aftersale`; -- 售后退款申请
|
|
TRUNCATE TABLE `hla_shopro_order_aftersale_log`;-- 售后协商与处理明细
|
|
TRUNCATE TABLE `hla_shopro_pay`; -- 支付单流水表
|
|
TRUNCATE TABLE `hla_shopro_refund`; -- 退款单记录表
|
|
TRUNCATE TABLE `hla_shopro_trade_order`; -- 充值交易订单表
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 3. 清理分销与合伙人收益流水数据 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_shopro_commission_agent`; -- 分销商成员档案与推荐关系树
|
|
TRUNCATE TABLE `hla_shopro_commission_order`; -- 分销订单关联表
|
|
TRUNCATE TABLE `hla_shopro_commission_reward`; -- 分销佣金明细
|
|
TRUNCATE TABLE `hla_shopro_commission_log`; -- 分销动态日志
|
|
TRUNCATE TABLE `hla_shopro_partner_reward`; -- 收益中心全量流水(推三返一/创客级差/协同/超越/团队奖/dmepa加权/兑换券释放)
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 4. 清理用户资金与钱包变动日志 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_shopro_user_wallet_log`; -- 用户钱包变动日志(余额/积分/佣金)
|
|
TRUNCATE TABLE `hla_user_money_log`; -- FastAdmin原生余额流水日志
|
|
TRUNCATE TABLE `hla_user_score_log`; -- FastAdmin原生积分流水日志
|
|
TRUNCATE TABLE `hla_shopro_withdraw`; -- 用户提现申请表
|
|
TRUNCATE TABLE `hla_shopro_withdraw_log`; -- 用户提现审核与打款日志
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 5. 清理收益日结(日柱)、DMEPA汇率快照与兑换券任务 (TRUNCATE)
|
|
-- 清空后系统历史合格单数 N = 0,大盘实时汇率自动回归初始值 0.00000075 元/枚
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_shopro_partner_daily_report`; -- 每日收益日结对账报表
|
|
TRUNCATE TABLE `hla_shopro_partner_rate_log`; -- DMEPA大盘汇率历史快照日志
|
|
TRUNCATE TABLE `hla_shopro_partner_voucher_plan`; -- 消费兑换券365天线性释放计划
|
|
TRUNCATE TABLE `hla_shopro_partner_voucher_log`; -- 兑换券每日释放明细流水(若存在)
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 6. 清理互动行为、客服聊天、搜索词与用户反馈 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_shopro_cart`; -- 购物车未结算商品
|
|
TRUNCATE TABLE `hla_shopro_user_goods_log`; -- 用户收藏夹与足迹浏览历史
|
|
TRUNCATE TABLE `hla_shopro_search_history`; -- 用户搜索历史词
|
|
TRUNCATE TABLE `hla_shopro_share`; -- 用户分享与裂变记录
|
|
TRUNCATE TABLE `hla_shopro_notification`; -- 站内通知与消息
|
|
TRUNCATE TABLE `hla_shopro_feedback`; -- 用户意见反馈
|
|
TRUNCATE TABLE `hla_shopro_goods_comment`; -- 商品测试评价与买家秀
|
|
TRUNCATE TABLE `hla_shopro_chat_record`; -- 客服聊天消息记录
|
|
TRUNCATE TABLE `hla_shopro_chat_user`; -- 客服会话用户列表
|
|
TRUNCATE TABLE `hla_shopro_chat_service_log`; -- 客服服务日志
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 7. 清理营销活动参与记录 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_shopro_user_coupon`; -- 用户领取的优惠券明细
|
|
TRUNCATE TABLE `hla_shopro_activity_signin`; -- 签到打卡日志
|
|
TRUNCATE TABLE `hla_shopro_activity_gift_log`; -- 满赠活动领取日志
|
|
TRUNCATE TABLE `hla_shopro_activity_groupon`; -- 拼团记录
|
|
TRUNCATE TABLE `hla_shopro_activity_groupon_log`;-- 参团记录
|
|
TRUNCATE TABLE `hla_shopro_activity_order`; -- 活动专享订单
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 8. 清理系统任务队列、库存流水与管理员操作日志 (TRUNCATE)
|
|
-- ------------------------------------------------------------------------------
|
|
TRUNCATE TABLE `hla_jobs`; -- 异步延迟队列任务表
|
|
TRUNCATE TABLE `hla_shopro_goods_stock_log`; -- 商品库存变动日志
|
|
TRUNCATE TABLE `hla_shopro_goods_stock_warning`;-- 库存预警记录
|
|
TRUNCATE TABLE `hla_admin_log`; -- 管理员后台操作测试日志
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- 9. 重置商品真实销售量 (UPDATE)
|
|
-- 将真实订单带来的 sales 重置归零,保留后台配置的虚拟展示销量 show_sales
|
|
-- ------------------------------------------------------------------------------
|
|
UPDATE `hla_shopro_goods` SET `sales` = 0;
|
|
UPDATE `hla_shopro_goods_sku_price` SET `sales` = 0;
|
|
|
|
SET FOREIGN_KEY_CHECKS = 1;
|