-- byxsj33 migration supplement for missing bonus/integral values
-- 目标库：byxsj33 环境的 yangtangyoupin
-- 执行方式：mysql -h 39.106.63.33 -u yangtangyoupin -p yangtangyoupin < docs/company-byxsj33-data-imgration-93229-93230-supplement.sql
--
-- 口径说明：
-- 1) user_id=93230: self_bonus=10436.000 (5218.000*2), integral=5218.000
-- 2) user_id=93229: self_bonus=12407.560 (6203.780*2), integral=4222.150
--
-- 回滚建议（执行前先记录原值）：
-- SELECT id, self_bonus FROM wa_users WHERE id IN (93229, 93230);
-- SELECT uid, integral FROM eb_user WHERE uid IN (93229, 93230);

SET NAMES utf8mb4;
START TRANSACTION;

-- 执行前核对（建议先确认两表均命中 2 行）
SELECT id, self_bonus
FROM wa_users
WHERE id IN (93229, 93230)
ORDER BY id;

SELECT uid, integral
FROM eb_user
WHERE uid IN (93229, 93230)
ORDER BY uid;

-- wa_users 个人奖金补齐
UPDATE wa_users
SET self_bonus = CASE id
    WHEN 93229 THEN 12407.560
    WHEN 93230 THEN 10436.000
    ELSE self_bonus
END
WHERE id IN (93229, 93230);

-- eb_user 易积分补齐
UPDATE eb_user
SET integral = CASE uid
    WHEN 93229 THEN 4222.150
    WHEN 93230 THEN 5218.000
    ELSE integral
END
WHERE uid IN (93229, 93230);

-- 执行后核对
SELECT id, self_bonus
FROM wa_users
WHERE id IN (93229, 93230)
ORDER BY id;

SELECT uid, integral
FROM eb_user
WHERE uid IN (93229, 93230)
ORDER BY uid;

COMMIT;
