XinMenDian_HengShou/doc/uprade-20250110.sql

218 lines
24 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.

-- 步骤1开始————————————————
-- 结构更新前
ALTER TABLE `pc_shopdayreport` ADD COLUMN `UpdateTime` datetime(0) NULL COMMENT '统计时间' AFTER `SXBodypartsNum`;
Update pc_shopdayreport set UpdateTime = CreatedTime where UpdateTime is null;
ALTER TABLE `pc_shopregusermonthreport` ADD COLUMN `UpdateTime` datetime(0) NULL COMMENT '统计时间' AFTER `ShopUserWeightAvg`;
Update pc_shopregusermonthreport set UpdateTime = CreatedTime where UpdateTime is null;
TRUNCATE table pc_shopreguser_rank;
ALTER TABLE `pc_shopreguser_enter` ADD `Date` date NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '统计日期';
update pc_shopreguser_enter set Date=DATE(CreatedTime);
ALTER TABLE `pc_shopreguser_bodyresult` ADD `Date` date NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '统计日期';
Update `pc_shopreguser_bodyresult` set `Date` =Date(CreatedTime);
ALTER TABLE `pc_userresult` ADD `RecordDate` date NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '记录日期';
Update pc_userresult set RecordDate=Date(RecordTime);
-- 步骤1结束————————————————
-- 步骤2开始————————————————
-- 重复执行删除 开始 直至全部Affected rows 为 0 12次
delete from pc_shopaccountdayservereport where id in (select id from (select CreatedTime,ServeId,UserId,count(Id) qty,min(id) id from pc_shopaccountdayservereport group by CreatedTime,ServeId,UserId) t where t.qty>1);
delete from pc_shopregusersxdata where id in(select t.id from (select d.id from pc_shopregusersxdata d left join pc_shopreguser u on u.id=d.RegUserId where u.ShopId<>d.ShopId or u.id is null) t);
delete from pc_shopreguserdata where id in(select t.id from( select d.id from pc_shopreguserdata d left join pc_shopreguser u on u.id=d.RegUserId where u.ShopId<>d.ShopId or u.id is null) t);
delete from pc_shopreguser_enter where id in (select id from ( select `Date`, `RegUserId`, `ShopId`,count(*) qty,max(id) id from pc_shopreguser_enter group by `Date`, `RegUserId`, `ShopId`) t where t.qty>1);
delete from pc_shopreguserdata where id = 17064723041733;
delete from pc_shopreguser_bodyresult where id IN( select id from (select `Date`, `RegUserId`, `ShopId`,count(*) qty,max(id) id from `pc_shopreguser_bodyresult` group by `Date`, `RegUserId`, `ShopId`) t where t.qty>1);
delete from pc_result where id in(select id from ( select RecordDate,RegUserId,count(*) qty,min(r.id) id from pc_userresult ur join pc_result r on r.id=ur.ResultId group by RecordDate,RegUserId) t where t.qty>1);
delete from pc_userresult where id in(select id from ( select RecordDate,RegUserId,count(*) qty,min(id) id from pc_userresult group by RecordDate,RegUserId) t where t.qty>1);
DELETE from pc_shopdayreport t1 WHERE id in ( select id from (select `CreatedTime`, `ShopId`, `BusinessId`,count(*) qty,min(id) id from pc_shopdayreport group by `CreatedTime`, `ShopId`, `BusinessId` having count(*)>1)t);
delete from pc_shopregusermonthreport where id in(select id from ( select CreatedTime,ShopId,count(*) qty,min(id) id from pc_shopregusermonthreport group by CreatedTime,ShopId) t where t.qty>1);
delete from pc_shopreguserwx where openid in (select OpenId from ( select `OpenId`,count(*) qty from pc_shopreguserwx group by `OpenId`) t where t.qty>1);
delete from pc_shopreguserwx where RegUserId in (select RegUserId from ( select RegUserId,count(*) qty from pc_shopreguserwx group by RegUserId) t where t.qty>1);
DELETE FROM pc_shopreguser WHERE ID IN(
SELECT ID FROM( SELECT ID FROM pc_shopreguser WHERE SHOPID ='17000843870917' AND (PHONE='15592630916' OR PHONE='18391767793' OR PHONE='13609275138')
AND ( LastLoginIp IS NULL OR LastLoginIp='')) AS T );
delete from pc_shopaccountdayreport where id IN( select id from (select CreatedTime,UserId,count(*) qty,max(id) id from `pc_shopaccountdayreport` group by CreatedTime,UserId) t where t.qty>1);
delete from pc_shopreguserwx where id in (select id from (select OpenId,count(*) qty,min(id) id from pc_shopreguserwx group by OpenId having qty>1)t);
-- 重复执行删除 结束
-- 步骤2结束————————————————
-- 步骤3开始————————————————
-- 清理无用数据 开始 直至全部Affected rows 为 0
delete from pc_shopserviceresultclerk where id in (select id from (select r.id from pc_shopserviceresultclerk r left join pc_shop_account ru on ru.id=r.userid where ru.id is null )t);
delete from pc_shopaccountdayservereport where id in (select id from (select r.id from pc_shopaccountdayservereport r left join pc_shop_account ru on ru.id=r.userid where ru.id is null) t);
delete from pc_shopaccountdayservereport where id in (select id from (select r.id from pc_shopaccountdayservereport r left join pc_shopservice s on s.id=r.serveid where s.id is null )t);
delete from pc_shopaccountdayservereport where id in (select id from ( select r.id from pc_shopaccountdayservereport r left join pc_shopservice s on s.id=r.serveid where s.id is null) t);
delete from pc_shopaccountdayservereport where id IN( select id from (select CreatedTime,ServeId,UserId,count(*) qty,max(id) id from `pc_shopaccountdayservereport` group by CreatedTime,ServeId,UserId) t where t.qty>1);
-- 清理无用数据 结束
-- 步骤3结束————————————————
-- 步骤4开始————————————————
-- 开始使用“工具”-”结构同步...“更新
-- 线上测试库 jt_shop_v2_test ——> 本地新建的数据库 直接部署 保证没有错误
-- 结构更新后
-- 步骤4结束————————————————
-- 步骤5开始————————————————
-- 设置 JT.Shop.Upgrade.Host为启动项目
-- 修改 JT.Shop.Upgrade.Host的数据库配置文件
-- 打开 http://localhost:5041/api/v2/do
-- 步骤5结束————————————————
-- 步骤6开始————————————————
-- $2a$11$pSdA2iZzB0qr0tMELfCTs.OOG35xsmDRxsxyX2zdRMyxPMuEF6ddy
update sys_user set `Password` = '$2a$11$pSdA2iZzB0qr0tMELfCTs.OOG35xsmDRxsxyX2zdRMyxPMuEF6ddy',`Phone` = '15037185661' WHERE `Account` = 'superAdmin';
update pc_shophead_level set ParentId=0,`Level`=0 where HeadId=1;
update pc_shophead set ParentHeadId=0 where id=1;
update sys_menu set AccountIdentity=10 where Application='system' or Application='manage';
update sys_menu set AccountIdentity=10 where code like 'sys_%';
update pc_shop_account set AdminType=3 where AdminType=0;
update pc_shop_account set AdminType=1 where phone='15037185661';
update sys_menu set name='平台用户管理' where code='sys_user_mgr';
update pc_shopreguserdata set LastCycleOrderId =IFNULL( (select CycleOrderId from pc_shopregusersxdata d where d.RegUserId= pc_shopreguserdata.RegUserId ),0) where LastCycleOrderId=0 and RType<5;
update pc_shopreguserdata set ServiceStatus=0 where EXISTS (select * from pc_shopregusersxdata d where d.RegUserId=pc_shopreguserdata.RegUserId and d.CycleOrderId=0 and BodyOrderId=0);
update pc_shopreguserdata set ServiceStatus=1 where EXISTS (select * from pc_shopregusersxdata d where d.RegUserId=pc_shopreguserdata.RegUserId and (d.CycleOrderId>0 or BodyOrderId>0));
update pc_shopreguserdata set FirstWeightTime=( select CreatedTime from pc_shopreguser_sxorder o where o.id=pc_shopreguserdata.LastCycleOrderId ) where FirstWeightTime is null and LastCycleOrderId>0;
update pc_shopreguserdata set RType=6 where ServiceStatus=0 and RType<>6;
update pc_shopreguserdata set IsDB=false,DBTime=null where IsDB=true and StandWeight< LastWeight and RType<3 and Date(DBTime)=Date(DealTime);
update pc_shopreguserdata set IsDB=false,DBTime=null where IsDB=true and StandWeight< LastWeight and RType<3 and Date(DBTime)=Date(LastEntryTime);
update pc_shopreguserdata set IsDB=false,DBTime=null where IsDB=true and StandWeight< MinWeight;
update pc_shopregusersxdata set SerCnt=(select count(*) from pc_shopreguser_bodyresult r where r.RegUserId=pc_shopregusersxdata.RegUserId);
update pc_shop_body_type set Image=CONCAT('/image/body-type/',Image,'.png') where Image not like '%.png';
update pc_shopsetting set WXClientType=1; -- 默认门店客户端H5 WXClientType=0代表微信小程序
-- 步骤6结束————————————————
-- 步骤7开始————————————————
SET FOREIGN_KEY_CHECKS = 0;
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18803388670277, 0, '[0],', '平台财务', 'sys_finance', 0, 'money-collect', '/sys_finance', 'PageView', '', 'busiapp', 0, 'Y', NULL, NULL, 2, 10, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18803415503813, 18803388670277, '[0],[18803388670277],', '点数充值', 'sys_dianshu_recharge', 1, '', '/system/dianshu/recharge', 'system/dianshu/recharge-add', '', 'busiapp', 1, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18803433923909, 18803415503813, '[0],[18803388670277],[18803415503813],', '充值', 'sys_dianshu_recharge_add', 2, '', '', '', 'sys:recharge:add', 'busiapp', 0, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18803445885637, 18803388670277, '[0],[18803388670277],', '点数充值单', 'sys_dianshu_recharge_order', 1, '', '/system/dianshu/recharge-order', 'system/dianshu/recharge-order', '', 'busiapp', 1, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18803469366597, 18803388670277, '[0],[18803388670277],', '目标点数', 'sys_dianshu_target', 1, '', '/system/dianshu/target-list', 'system/dianshu/target-list', '', 'busiapp', 1, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18815692883141, 0, '[0],', '授权版本配置', 'sys_business-version', 0, 'setting', '/sys_business-version', 'PageView', '', 'busiapp', 0, 'Y', NULL, NULL, 2, 10, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18815708928197, 18815692883141, '[0],[18815692883141],', '添加配置', 'sys_business-version_add', 2, '', '/system/business-version/add', '', 'sys:systembusinessversion:add', 'busiapp', 0, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18825046730181, 18815692883141, '[0],[18815692883141],', '编辑配置', 'sys_systembusinessversion_edit', 2, '', '', '', 'sys:systembusinessversion:edit', 'busiapp', 0, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
INSERT INTO `sys_menu`(`Id`, `Pid`, `Pids`, `Name`, `Code`, `Type`, `Icon`, `Router`, `Component`, `Permission`, `Application`, `OpenType`, `Visible`, `Link`, `Redirect`, `Weight`, `Sort`, `Remark`, `Status`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `AccountIdentity`) VALUES (18825066889157, 18815692883141, '[0],[18815692883141],', '版本列表', 'sys_systembusinessversion_list', 1, '', '/system/business/version/list', 'system/business/version/list', '', 'busiapp', 1, 'Y', NULL, NULL, 2, 100, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 10);
SET FOREIGN_KEY_CHECKS = 1;
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (1, '减重', '减重美体师', '', 1, 2, '减重美体师', 1, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 1);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (2, '腹部', '腹部美体师', '', 2, 2, '腹部美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 1);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (3, '手臂', '手臂美体师', '', 3, 2, '手臂美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 1);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (4, '前大腿', '前大腿美体师', '', 4, 2, '前大腿美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 1);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (5, '后大腿', '后大腿美体师', '', 5, 2, '后大腿美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 1);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (6, '小腿', '小腿美体师', '', 6, 2, '小腿美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 1);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (7, '背部', '背部美体师', '', 7, 2, '背部美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 2);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (8, '臀部', '臀部美体师', '', 8, 2, '臀部美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 2);
INSERT INTO `pc_businessshopservice`(`Id`, `Name`, `ShowName`, `Code`, `SortCode`, `Status`, `Remark`, `IsWeight`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`, `BusinessId`, `ShareNameId`, `ComputeTimes`) VALUES (9, '胸部', '胸部美体师', '', 9, 2, '胸部美体师', 0, curdate(), curdate(), NULL, NULL, NULL, NULL, 0, 1, 0, 2);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (1, 142307070910557, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (2, 142307070910562, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (3, 142307070910561, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (4, 142307070910560, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (5, 142307070910559, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (6, 142307070910558, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (7, 142307070910554, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (8, 142307070910555, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (9, 142307070910556, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (10, 16822817362757, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (11, 16822816142533, 1);
INSERT INTO `pc_businessbody`(`Id`, `BodyId`, `BusinessId`) VALUES (12, 16822809742661, 1);
-- 步骤7结束————————————————
-- 步骤8开始————————————————
update pc_systembusinessversionconfig set UseTimes = (select count(id) from pc_dianshu_consume where SBV_ConfigId=pc_systembusinessversionconfig.id);
update pc_systembusinessversionconfig set UsingCount = (select count(id) from pc_shophead where SystemAuthorization_ConfigId=pc_systembusinessversionconfig.id) where SystemApp=2;
update pc_systembusinessversionconfig set UsingCount = (select count(id) from pc_shop where SystemAuthorization_ConfigId=pc_systembusinessversionconfig.id) where SystemApp=1;
update pc_shopreguserdata set UnIncreaseWeight= LastWeight - StandWeight where LastWeight > StandWeight;
update pc_shopreguserdata set UnIncreaseWeight=0 where LastWeight <= StandWeight;
--
UPDATE `pc_shopaccountdayservereport` SET `BusinessId` = (select BusinessId from `pc_shopservice` s where s.id=`pc_shopaccountdayservereport`.ServeId);
UPDATE `pc_shopaccountdayservereport` SET `ShopId` = (select ShopId from `pc_shopservice` s where s.id=`pc_shopaccountdayservereport`.ServeId);
UPDATE `pc_shopservice` SET `ComputeTimes` = 1;
update `pc_shopservice` set `ComputeTimes`=1,IsWeight=1 where name like '减重%';
update `pc_shopservice` set `ComputeTimes`=1,IsWeight=0 where name like '%腹部%' or name like '%手臂%' or name like '%胯部%' or name like '%大腿%' or name like '%小腿%';
update `pc_shopservice` set `ComputeTimes`=2,IsWeight=0 where name like '%背部%' or name like '%臀部%' or name like '%胸部%' or name like '%淋巴排毒%' or name like '%富贵包%';
UPDATE `pc_businessshopservice` SET `ComputeTimes` = 1;
update `pc_businessshopservice` set `ComputeTimes`=1,IsWeight=1 where name like '减重%';
update `pc_businessshopservice` set `ComputeTimes`=1,IsWeight=0 where name like '%腹部%' or name like '%手臂%' or name like '%胯部%' or name like '%大腿%' or name like '%小腿%';
update `pc_businessshopservice` set `ComputeTimes`=2,IsWeight=0 where name like '%背部%' or name like '%臀部%' or name like '%胸部%' or name like '%淋巴排毒%' or name like '%富贵包%';
INSERT INTO `pc_devicetype`(`Id`, `Name`, `Code`, `Pic`, `Desc`, `ProType`, `BleUrl`, `SupType`, `CreatedTime`, `UpdatedTime`, `CreatedUserId`, `CreatedUserName`, `UpdatedUserId`, `UpdatedUserName`, `IsDeleted`) VALUES (14942660236358, '蓝牙', 2, '', '', 1, 'mini', '', '2025-01-13 00:00:00.000000', NULL, NULL, NULL, NULL, NULL, 0);
update pc_shopreguserwx set shopid = IFNULL((select shopid from pc_shopreguser u where u.id=pc_shopreguserwx.RegUserId),0) ;
update pc_shopreguserwx set AppId='wxfcbb905e3b2b14fb' where AppId is null;
delete from pc_shopreguserwx where shopid=0;
-- 步骤8结束————————————————
-- 步骤9开始————————————————
-- 耗时脚本 开始
update pc_shopaccountdayservereport set Cnt = IFNULL((select count(rc.id)*IFNULL(s.ComputeTimes,1) from pc_shopserviceresultclerk rc join pc_shop_service_result sr on sr.id=rc.ResultId left join pc_shopservice s on s.id=rc.ServeId where rc.UserId=`pc_shopaccountdayservereport`.UserId and rc.ServeId=`pc_shopaccountdayservereport`.ServeId and sr.CreatedTime>=`pc_shopaccountdayservereport`.CreatedTime and sr.CreatedTime<DATE_ADD(`pc_shopaccountdayservereport`.CreatedTime,INTERVAL 1 DAY)),0);
UPDATE `pc_shopaccountdayreport` SET `ServeCnt` = IFNULL((select sum(ds.Cnt) from pc_shopaccountdayservereport ds join pc_shopservice s on s.id=ds.ServeId where ds.UserId=`pc_shopaccountdayreport`.UserId and ds.CreatedTime=`pc_shopaccountdayreport`.CreatedTime),0);
UPDATE `pc_shopaccountdayreport` SET `SXBodypartsNum` = IFNULL((select sum(ds.Cnt) from pc_shopaccountdayservereport ds join pc_shopservice s on s.id=ds.ServeId where s.IsWeight=false and ds.UserId=`pc_shopaccountdayreport`.UserId and ds.CreatedTime=`pc_shopaccountdayreport`.CreatedTime),0);
UPDATE `pc_shopdayreport` set SXBodypartsNum= IFNULL((select sum(IFNULL(SXBodypartsNum,0)) from PC_ShopAccountDayReport dr where dr.ShopId=`pc_shopdayreport`.ShopId and dr.CreatedTime=`pc_shopdayreport`.CreatedTime),0);
UPDATE `pc_shopregusermonthreport` set NewUserCnt = IFNULL((select Count(1) from pc_shopreguserdata dr where dr.ShopId=`pc_shopregusermonthreport`.ShopId and dr.DealTime>=`pc_shopregusermonthreport`.CreatedTime and dr.DealTime<DATE_ADD(`pc_shopregusermonthreport`.CreatedTime,INTERVAL 1 MONTH)),0);
-- 耗时脚本 结束
-- 步骤9结束————————————————
-- 切换到JT.Shop.Web.Entry 修改数据库 然后运行
-- https://localhost:7218/api/public/home/RegUserRankCreate?start=2025-01-01&end=2025-04-09 时间为当前时间的前三个月
-- 等队列消费完 进行数据同步(如果要合并数据,下面步骤可最后执行
-- https://localhost:7218/api/public/home/UpdateShareNames 登录平台端编辑版本功能项 部署自动任务)
--使用Navicat Permium 《工具》->《数据同步》;源(线上新测试数据库) jt_shop_v2_test ,目标 本地jt_shop_v2;
-- >(注意)选项中只勾选《插入记录》;
-- > 忽略插入表包括sys_log_ex、sys_role、
-- sys_role_menu、sys_user_role、
-- pc_businessbody、pc_bussinessshopproduct、
-- pc_businessshopservice、pc_share_name
-- > 增加更新表包括sys_user、pc_shop_body_type