| @@ -4,7 +4,3 @@ INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, | |||
| INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (11, '抖音尊享', 11, 12, '[1, 2, 4, 5, 6, 50, 105, 106, 201, 202, 211, 212, 221, 222, 409, 411, 416, 501, 502, 504, 505, 506, 511, 512, 591, 592, 595, 602, 606, 610, 613, 641, 680, 711, 901, 902, 903, 931, 932]'); | |||
| ALTER TABLE `mallink`.`wx_pay_account` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `private_cert_path`; | |||
| @@ -0,0 +1,200 @@ | |||
| ALTER TABLE `mallink`.`wx_c_user_from_0` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_1` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_2` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_3` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_4` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_5` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_6` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_7` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_8` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_9` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_10` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_11` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_12` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_13` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_14` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_15` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_16` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_17` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_18` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_19` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_20` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_21` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_22` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_23` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_24` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_25` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_26` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_27` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_28` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_29` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_30` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_31` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_32` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_33` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_34` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_35` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_36` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_37` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_38` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_39` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_40` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_41` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_42` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_43` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_44` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_45` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_46` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_47` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_48` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_49` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_50` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_51` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_52` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_53` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_54` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_55` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_56` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_57` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_58` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_59` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_60` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_61` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_62` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_63` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_64` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_65` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_66` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_67` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_68` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_69` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_70` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_71` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_72` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_73` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_74` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_75` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_76` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_77` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_78` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_79` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_80` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_81` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_82` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_83` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_84` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_85` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_86` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_87` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_88` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_89` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_90` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_91` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_92` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_93` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_94` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_95` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_96` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_97` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_98` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| ALTER TABLE `mallink`.`wx_c_user_from_99` | |||
| ADD COLUMN `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT 'app平台 1:微信 2:阿里 3:头条' AFTER `create_date`; | |||
| @@ -0,0 +1,100 @@ | |||
| CREATE TABLE tt_c_user_0 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_1 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_2 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_3 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_4 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_5 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_6 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_7 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_8 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_9 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_10 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_11 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_12 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_13 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_14 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_15 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_16 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_17 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_18 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_19 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_20 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_21 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_22 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_23 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_24 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_25 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_26 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_27 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_28 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_29 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_30 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_31 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_32 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_33 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_34 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_35 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_36 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_37 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_38 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_39 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_40 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_41 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_42 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_43 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_44 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_45 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_46 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_47 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_48 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_49 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_50 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_51 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_52 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_53 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_54 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_55 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_56 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_57 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_58 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_59 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_60 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_61 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_62 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_63 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_64 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_65 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_66 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_67 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_68 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_69 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_70 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_71 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_72 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_73 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_74 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_75 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_76 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_77 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_78 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_79 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_80 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_81 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_82 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_83 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_84 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_85 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_86 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_87 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_88 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_89 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_90 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_91 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_92 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_93 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_94 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_95 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_96 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_97 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_98 LIKE wx_c_user_0; | |||
| CREATE TABLE tt_c_user_99 LIKE wx_c_user_0; | |||
| @@ -3,12 +3,9 @@ package com.iformall.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxCUserBasicChild; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| @@ -130,7 +127,7 @@ public class BaseController { | |||
| * 微信端获取当前用户 wx_c_user,非会员 | |||
| * 请尽量多用getTenantId, getUserId | |||
| */ | |||
| public WxCUser getWxCUser() { | |||
| public CUser getCUser() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| BaseCUserEntity baseuser = (BaseCUserEntity) request.getAttribute(Constant.REQUEST_C_USER_KEY); | |||
| @@ -140,7 +137,7 @@ public class BaseController { | |||
| if (baseuser.getRealUser() == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxCUser user = RedisCacheUtils.getFieldObject(baseuser, "realUser", WxCUser.class); | |||
| CUser user = RedisCacheUtils.getFieldObject(baseuser, "realUser", CUser.class); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (user.getTenantId() == null) { | |||
| user.setTenantId(tenantEntity.getTenantId()); | |||
| @@ -64,14 +64,14 @@ public class WxCreditHistoryController extends BaseController{ | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); | |||
| WxCUser wxCUser = getWxCUser(); | |||
| if(wxCUser.getUserId() == null){ | |||
| CUser cuser = getCUser(); | |||
| if(cuser.getUserId() == null){ | |||
| return new ResultData(ErrorCode.PHONE_NOT_FOUND,"用户未授权手机号"); | |||
| } | |||
| wxCreditHistory.setTenantId(wxCUser.getFinalTenantId()); | |||
| wxCreditHistory.setCUserId(wxCUser.getUserId()); | |||
| wxCreditHistory.setOperatorId(wxCUser.getUserId()); | |||
| wxCreditHistory.setTenantId(cuser.getFinalTenantId()); | |||
| wxCreditHistory.setCUserId(cuser.getUserId()); | |||
| wxCreditHistory.setOperatorId(cuser.getUserId()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| if(wxCreditHistory.getCreditType().equals(EnumScoreType.GAME_ADD_CREDIT.getCode())){ | |||
| @@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import com.iformall.annotation.RedisCache; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.CUser; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.exception.MallinkException; | |||
| import io.swagger.annotations.Api; | |||
| @@ -59,7 +60,7 @@ public class WxLiveController extends BaseController { | |||
| @GetMapping("/replayList") | |||
| public ResultData getLiveReplay(Integer room_id, Integer start, Integer limit) { | |||
| ResultData resultData = new ResultData(); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| try { | |||
| WxMaService wxMaService = getWeappService(user.getAppId()); | |||
| resultData.data = wxMaService.getLiveService().getLiveReplay(room_id,start,limit); | |||
| @@ -2,9 +2,11 @@ package com.iformall.controller; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.CUser; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxMsgValidationcode; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| @@ -52,7 +54,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| //只需要一端发就可以了 | |||
| WxAppinfo appinfo = WxAppinfoService.getCAppInfo(getTenantInfo(), EnumPayWay.PAY_WAY_WECHAT); | |||
| WxAppinfo appinfo = WxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.WX); | |||
| wxMsgValidationcode.setAppid(appinfo.getAppId()); | |||
| return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | |||
| } | |||
| @@ -63,14 +65,14 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData hasvalidationcode(String phone, Integer type, String code) { | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.updateTenantInfo(getTenantInfo()); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| wxMsgValidationcode.setCode(code); | |||
| //只需要一端发就可以了 | |||
| WxAppinfo appinfo = WxAppinfoService.getCAppInfo(getTenantInfo(), EnumPayWay.PAY_WAY_WECHAT); | |||
| WxAppinfo appinfo = WxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.WX); | |||
| wxMsgValidationcode.setAppid(appinfo.getAppId()); | |||
| //wxMsgValidationcode.setAppid(user.getAppId()); | |||
| ResultData rd = wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); | |||
| @@ -86,7 +88,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| // 更新 WxCUser | |||
| user.setVerifyCodePhone(phone); | |||
| user.setUpdateDate(new Date()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| wxCUserService.saveOrUpdate((WxCUser) user); | |||
| wxCUserService.delForUserIdOnly(user.getId(),user.getUserId(),user.getTenantId()); | |||
| // wxCUserService.assureUserIdOnly(user.getId(),); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE,user,wxMsgValidationcode,null); | |||
| @@ -4,6 +4,7 @@ import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import com.iformall.domain.po.*; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -21,14 +22,6 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxBatchOrder; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.WxPayOrder; | |||
| import com.iformall.enums.EnumComposeOrder; | |||
| import com.iformall.enums.EnumCreditLockedStatus; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| @@ -101,7 +94,7 @@ public class WxPayOrderController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "composeOrderType不能为空"); | |||
| } | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (!user.basicInfoIs()) { | |||
| logger.error("暂未成为会员,请授权手机号"); | |||
| return new ResultData(ErrorCode.USER_IS_NOT_MEMBER.getCode(), "暂未成为会员,请授权手机号"); | |||
| @@ -205,7 +198,7 @@ public class WxPayOrderController extends BaseController { | |||
| check(composeOrder,payOrder); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(payOrder, EnumPayWay.getEnum(payOrder.getPayVendor())); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(payOrder, EnumPayWay.getEnum(payOrder.getPayVendor()).getPlat()); | |||
| //WxCUser user = getUser(); | |||
| //WxAppinfo appInfo = getAppInfo(user.getAppId()); | |||
| if (null == appInfo) { | |||
| @@ -1,9 +1,6 @@ | |||
| package com.iformall.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; | |||
| import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| @@ -17,14 +14,15 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCUserVo; | |||
| import com.iformall.domain.vo.WxLevelMerchantCVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.IPUtil; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -47,13 +45,14 @@ import java.util.Map; | |||
| @RequestMapping("/api/user") | |||
| @Api(description = "用户登陆授权相关接口") | |||
| public class WxUserGrantController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private boolean isFmOpen; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| private CUserServiceFactory cuserFactory; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @@ -146,27 +145,32 @@ public class WxUserGrantController extends BaseController { | |||
| Map resultMap = new HashMap(); | |||
| WxCUserFrom wxCUserFrom = new WxCUserFrom(); | |||
| String appId = map.get("appId"); | |||
| String code = map.get("code"); | |||
| String sceneAddress = map.get("sceneAddress"); | |||
| String scene = map.get("scene"); | |||
| if (StringUtils.isNotBlank(scene) && | |||
| !scene.equals(Constant.UNDEFINED)) { // from pages/index/index onLoad.options.scene | |||
| wxCUserFrom.setScene(scene); | |||
| //登录凭证不能为空 | |||
| if (StringUtils.isBlank(appId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); | |||
| } | |||
| if (StringUtils.isNotBlank(sceneAddress) && | |||
| !sceneAddress.equalsIgnoreCase(Constant.UNDEFINED)) { // from app.js onLaunch.options.scene | |||
| wxCUserFrom.setSceneAddress(sceneAddress); | |||
| if (StringUtils.isBlank(code)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "code不能为空"); | |||
| } | |||
| String longitude = map.get("longitude"); | |||
| String latitude = map.get("latitude"); | |||
| String systemInfo = map.get("systemInfo"); | |||
| WxCUserFrom wxCUserFrom = new WxCUserFrom(); | |||
| //分享参数 | |||
| try { | |||
| String sceneAddress = map.get("sceneAddress"); | |||
| String scene = map.get("scene"); | |||
| if (StringUtils.isNotBlank(scene) && | |||
| !scene.equals(Constant.UNDEFINED)) { // from pages/index/index onLoad.options.scene | |||
| wxCUserFrom.setScene(scene); | |||
| } | |||
| if (StringUtils.isNotBlank(sceneAddress) && | |||
| !sceneAddress.equalsIgnoreCase(Constant.UNDEFINED)) { // from app.js onLaunch.options.scene | |||
| wxCUserFrom.setSceneAddress(sceneAddress); | |||
| } | |||
| String basicUserId = map.get("UId"); | |||
| String merchantId = map.get("MId"); | |||
| if(StringUtils.isNotBlank(basicUserId)){ | |||
| @@ -182,38 +186,22 @@ public class WxUserGrantController extends BaseController { | |||
| logger.error("分享参数错误",e); | |||
| } | |||
| //其他参数 | |||
| String systemInfo = map.get("systemInfo"); | |||
| //登录凭证不能为空 | |||
| if (StringUtils.isBlank(appId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(code)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "code不能为空"); | |||
| } | |||
| // 通过authorizerInfo得到tenant_id | |||
| WxAuthorizerInfo wxAuthorizerInfo = null; | |||
| WxAppinfo wxAppinfo = null; | |||
| WxMall wxMall = null; | |||
| WxMaService wxMaService = null; | |||
| wxAuthorizerInfo = wxAuthorizerInfoService.getByAppId(appId); | |||
| if (wxAuthorizerInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| if (!wxAuthorizerInfo.getEnable().equals(EnumEnableType.Enable.getCode())) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); | |||
| } | |||
| wxAppinfo = wxAppinfoService.getByAppId(appId); | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(appId); | |||
| if(wxAppinfo == null){ | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| if(!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())){ | |||
| return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); | |||
| } | |||
| wxMall = mallService.getByTenantId(wxAuthorizerInfo.getTenantId()); | |||
| EnumAppPlat appPlat = EnumAppPlat.getByCode(wxAppinfo.getPlat()); | |||
| if(appPlat == null){ | |||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||
| } | |||
| wxCUserFrom.setPlat(appPlat.getCode()); | |||
| WxMall wxMall = mallService.getByTenantId(wxAppinfo.getTenantId()); | |||
| if(wxMall == null){ | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| @@ -230,36 +218,18 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| if(mallList != null && mallList.size() >0){ | |||
| mallList.stream().forEach(cs -> { | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cs.getTenantId(), EnumPayWay.PAY_WAY_WECHAT); | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cs.getTenantId(), EnumAppPlat.WX); | |||
| cs.setAppId(cAppInfo.getAppId()); | |||
| }); | |||
| resultMap.put("subMalls", JSON.toJSONString(mallList)); | |||
| } | |||
| if (isFmOpen) { | |||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||
| } else { | |||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| if (StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||
| updateAppAccessToken(wxAppinfo, wxMaService); | |||
| } else { | |||
| // 检查token是否已过期, 1小时就重新获取 | |||
| Date curDate = new Date(); | |||
| if (curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.H_EXPIRE) { | |||
| updateAppAccessToken(wxAppinfo, wxMaService); | |||
| } | |||
| } | |||
| } | |||
| String token = null; | |||
| String session_key = null; | |||
| String openId = null; | |||
| String unionId = null; | |||
| try { | |||
| WxMaJscode2SessionResult session = wxMaService.jsCode2SessionInfo(code); | |||
| WxMaJscode2SessionResult session = cuserFactory.getCUserService(appPlat).jsCode2SessionInfo(code, wxAppinfo, isFmOpen); | |||
| logger.info("sessionResult: " + session); | |||
| if (null != session) { | |||
| logger.info("sessionResultDetail: [openid]" + session.getOpenid()+",[sessionkey]"+session.getSessionKey()+",[unionid]"+session.getUnionid()); | |||
| @@ -272,7 +242,7 @@ public class WxUserGrantController extends BaseController { | |||
| logger.info("session_key: " + session_key + ", openId: " + openId + ", unionId: " + unionId); | |||
| resultMap.put("openId", openId); | |||
| } catch (WxErrorException e) { | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage(), e); | |||
| return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); | |||
| } | |||
| @@ -282,99 +252,31 @@ public class WxUserGrantController extends BaseController { | |||
| request.setAttribute(Constant.PARENT_TENANT_ID, wxMall.getParentTenantId()); | |||
| String ipaddress = IPUtil.getIpAddr(request); | |||
| WxCUser newUser = new WxCUser(); | |||
| newUser.updateTenantInfo(wxMall.getTenantInfo()); | |||
| newUser.setAppId(appId); | |||
| newUser.setOpenId(openId); | |||
| WxCUser oldUser = wxCUserService.getByOpenId(newUser); | |||
| if (oldUser != null) { | |||
| // 已有用户 | |||
| token = oldUser.createToken(new Date(),oldUser.getTenantId()); | |||
| resultMap.put("token", token); | |||
| if(StringUtils.isBlank(oldUser.getParentTenantId()) && StringUtils.isNotBlank(wxMall.getParentTenantId())){ | |||
| oldUser.setParentTenantId(wxMall.getParentTenantId()); | |||
| } | |||
| oldUser.setRegisterIp(ipaddress); | |||
| oldUser.setSessionKey(session_key); | |||
| oldUser.setAppId(appId); | |||
| oldUser.setOpenId(openId); | |||
| oldUser.setUnionId(unionId); | |||
| if (StringUtils.isNotBlank(wxAuthorizerInfo.getOpenAppid())) { | |||
| oldUser.setOpenAppId(wxAuthorizerInfo.getOpenAppid()); | |||
| } | |||
| CUser cUser = new CUser(); | |||
| cUser.updateTenantInfo(wxMall.getTenantInfo()); | |||
| cUser.setAppId(appId); | |||
| cUser.setOpenId(openId); | |||
| if (StringUtils.isNotBlank(longitude)) { | |||
| oldUser.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| } | |||
| if (StringUtils.isNotBlank(latitude)) { | |||
| oldUser.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||
| } | |||
| cUser.setUnionId(unionId); | |||
| cUser.setRegisterIp(ipaddress); | |||
| cUser.setSessionKey(session_key); | |||
| if (StringUtils.isNotBlank(systemInfo)) { | |||
| if (StringUtils.isNotBlank(systemInfo)) { | |||
| try{ | |||
| JSONObject extraInfo = new JSONObject(); | |||
| extraInfo.put("systemInfo", JSONObject.parseObject(systemInfo)); | |||
| oldUser.setExtraInfo(extraInfo.toJSONString()); | |||
| } | |||
| oldUser.setLoginCount(oldUser.getLoginCount() + 1); | |||
| oldUser.setActiveTime(new Date()); | |||
| wxCUserService.saveOrUpdate(oldUser); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, oldUser.getId()); | |||
| updateCacheCUser(token, oldUser); | |||
| // 登录后处理 | |||
| wxCUserFrom.setCUserId(oldUser.getId()); | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.NO.getCode()); | |||
| wxCUserService.actionMsgAfterLogin(wxCUserFrom); | |||
| } else { | |||
| // 新用户 | |||
| newUser.updateTenantInfo(wxMall.getTenantInfo()); | |||
| if(StringUtils.isNotBlank(wxMall.getParentTenantId())){ | |||
| newUser.setParentTenantId(wxMall.getParentTenantId()); | |||
| } | |||
| token = newUser.createToken(new Date(),newUser.getTenantId()); | |||
| resultMap.put("token", token); | |||
| newUser.setRegisterIp(ipaddress); | |||
| newUser.setSceneAddress(wxCUserFrom.getSceneAddress()); | |||
| newUser.setScene(wxCUserFrom.getScene()); | |||
| cUser.setExtraInfo(extraInfo.toJSONString()); | |||
| }catch(Exception e){ | |||
| newUser.setSessionKey(session_key); | |||
| if (StringUtils.isNotBlank(longitude)) { | |||
| newUser.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| } | |||
| if (StringUtils.isNotBlank(latitude)) { | |||
| newUser.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||
| } | |||
| if (StringUtils.isNotBlank(systemInfo)) { | |||
| JSONObject extraInfo = new JSONObject(); | |||
| extraInfo.put("systemInfo", JSONObject.parseObject(systemInfo)); | |||
| newUser.setExtraInfo(extraInfo.toJSONString()); | |||
| } | |||
| newUser.setLoginCount(1); | |||
| newUser.setActiveTime(new Date()); | |||
| wxCUserService.saveOrUpdate(newUser); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, newUser.getId()); | |||
| } | |||
| //处理登陆用户 | |||
| cUser = cuserFactory.getCUserService(appPlat).handleLoginUser(cUser,wxCUserFrom); | |||
| updateCacheCUser(token, newUser); | |||
| // 登录后处理 | |||
| wxCUserFrom.setCUserId(newUser.getId()); | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.YES.getCode()); | |||
| wxCUserService.actionMsgAfterLogin(wxCUserFrom); | |||
| resultMap.put("token", cUser.getToken()); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, cUser.getId()); | |||
| } | |||
| if (StringUtils.isBlank(token) || "null".equals(token) || "undefined".equals(token) ) { | |||
| return new ResultData(Result.ERROR,"token无效"+token); | |||
| } | |||
| updateCacheCUser(cUser.getToken(), cUser); | |||
| return new ResultData(resultMap); | |||
| } | |||
| @@ -408,16 +310,14 @@ public class WxUserGrantController extends BaseController { | |||
| @PostMapping("/updateScene") | |||
| @ApiOperation(value = "用户更新scene", notes = "{\"scene\":\"string\"}") | |||
| public ResultData updateScene(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| logger.info(map.toString()); | |||
| String scene = map.get("scene"); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (StringUtils.isBlank(user.getScene()) || | |||
| user.getScene().equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| if(StringUtils.isNotBlank(scene) && scene.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| user.setScene(scene); | |||
| wxCUserService.updateScene(user); | |||
| cuserFactory.getCUserService(user.getAppPlat()).updateScene(user); | |||
| removeCacheCUser(); | |||
| } | |||
| } | |||
| @@ -427,18 +327,15 @@ public class WxUserGrantController extends BaseController { | |||
| @PostMapping("/updateLBS") | |||
| @ApiOperation(value = "用户更新位置信息", notes = "{\"latitude\":\"string\",\"longitude\":\"string\"}") | |||
| public ResultData updateLBS(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| logger.info(map.toString()); | |||
| String longitude = map.get("longitude"); | |||
| String latitude = map.get("latitude"); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (!StringUtils.isBlank(longitude)) | |||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| if (!StringUtils.isBlank(latitude)) | |||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||
| wxCUserService.updateLBS(user); | |||
| removeCacheCUser(); | |||
| cuserFactory.getCUserService(user.getAppPlat()).updateLBS(user); | |||
| return new ResultData(); | |||
| } | |||
| @@ -446,46 +343,17 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation(value = "用户更新扩展信息(手机)", notes = "{\"systemInfo\":\"string\"}") | |||
| public ResultData updateExtInfo(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| String systemInfo = map.get("systemInfo"); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (StringUtils.isNotBlank(systemInfo)) { | |||
| JSONObject extraInfo = new JSONObject(); | |||
| extraInfo.put("systemInfo", JSONObject.parseObject(systemInfo)); | |||
| user.setExtraInfo(extraInfo.toJSONString()); | |||
| } | |||
| wxCUserService.updateExtInfo(user); | |||
| removeCacheCUser(); | |||
| cuserFactory.getCUserService(user.getAppPlat()).updateExtInfo(user); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * WxAppInfo更新accessToken | |||
| * | |||
| * @param wxAppinfo | |||
| * @param wxMaService | |||
| */ | |||
| private void updateAppAccessToken(WxAppinfo wxAppinfo, WxMaService wxMaService) { | |||
| try { | |||
| String accessToken = wxMaService.getAccessToken(true); | |||
| WxAppinfo updateApp = new WxAppinfo(); | |||
| updateApp.setId(wxAppinfo.getId()); | |||
| updateApp.setAccessToken(accessToken); | |||
| updateApp.setLastTokenTime(new Date()); | |||
| updateApp.setExpiresIn(7200); | |||
| wxAppinfo.setAccessToken(updateApp.getAccessToken()); | |||
| wxAppinfo.setLastTokenTime(updateApp.getLastTokenTime()); | |||
| wxAppinfo.setExpiresIn(updateApp.getExpiresIn()); | |||
| wxAppinfoService.saveOrUpdate(updateApp); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| /** | |||
| * 获取用户的昵称等信息 | |||
| * | |||
| @@ -495,69 +363,31 @@ public class WxUserGrantController extends BaseController { | |||
| @PostMapping("/getUserInfo") | |||
| @ApiOperation(value = "授权后获取用户的昵称,unionId等信息", notes = "{\"encryptedData\":\"string\",\"iv\":\"string\"}") | |||
| public ResultData getUserInfo(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| logger.info(map.toString()); | |||
| Map resultMap = new HashMap(); | |||
| String encryptedData = map.get("encryptedData"); | |||
| String iv = map.get("iv"); | |||
| if (StringUtils.isBlank(encryptedData)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "encryptedData不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(iv)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv不能为空"); | |||
| } | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (user != null) { | |||
| logger.debug(user.toString()); | |||
| WxMaService wxMaService = getWeappService(user.getAppId()); | |||
| String session_key = user.getSessionKey(); | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); | |||
| if(wxAppinfo == null){ | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| try { | |||
| // 解密用户信息 | |||
| WxMaUserInfo userInfo = wxMaService.getUserService().getUserInfo(session_key, encryptedData, iv); | |||
| if (userInfo != null) { | |||
| logger.debug(userInfo.toString()); | |||
| WxCUser updateUser = new WxCUser(); | |||
| updateUser.setId(user.getId()); | |||
| updateUser.setUnionId(userInfo.getUnionId()); | |||
| updateUser.setNickName(userInfo.getNickName()); | |||
| updateUser.setGender(Integer.parseInt(userInfo.getGender())); | |||
| updateUser.setAvatarUrl(userInfo.getAvatarUrl()); | |||
| updateUser.setProvince(userInfo.getProvince()); | |||
| updateUser.setCity(userInfo.getCity()); | |||
| updateUser.setLanguage(userInfo.getLanguage()); | |||
| user.setUnionId(userInfo.getUnionId()); | |||
| user.setNickName(userInfo.getNickName()); | |||
| user.setGender(Integer.parseInt(userInfo.getGender())); | |||
| user.setAvatarUrl(userInfo.getAvatarUrl()); | |||
| user.setProvince(userInfo.getProvince()); | |||
| user.setCity(userInfo.getCity()); | |||
| user.setLanguage(userInfo.getLanguage()); | |||
| wxCUserService.saveOrUpdate(updateUser); | |||
| if(user.getUserId() != null){ | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(user.getUserId()); | |||
| wxCUserBasicInfo.setSex(user.getGender()); | |||
| wxCUserBasicInfo.setAvatarUrl(user.getAvatarUrl()); | |||
| wxCUserBasicInfo.setFinalTenantId(user.getFinalTenantId()); | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| removeCacheMember(user.getUserId()); | |||
| } | |||
| removeCacheCUser(); | |||
| resultMap.put("openId", user.getOpenId()); | |||
| resultMap.put("unionId", user.getUnionId()); | |||
| resultMap.put("msg", "获取用户信息成功!"); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.NICK_NAME_DECODE_ERR, resultMap); | |||
| } | |||
| cuserFactory.getCUserService(user.getAppPlat()).decryptUserInfo(encryptedData, iv,user,wxAppinfo,isFmOpen); | |||
| resultMap.put("openId", user.getOpenId()); | |||
| resultMap.put("unionId", user.getUnionId()); | |||
| resultMap.put("msg", "获取用户信息成功!"); | |||
| return new ResultData(resultMap); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage(), e); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); | |||
| @@ -577,11 +407,8 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation(value = "授权后获取用户的手机号", notes = "{\"encryptedData\":\"string\",\"iv\":\"string\"}") | |||
| public ResultData getUserPhone(@RequestBody Map<String, String> map) { | |||
| logger.info(map.toString()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| String encryptedData = map.get("encryptedData"); | |||
| String iv = map.get("iv"); | |||
| //登录凭证不能为空 | |||
| if (StringUtils.isBlank(encryptedData)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "encryptedData 不能为空"); | |||
| @@ -591,54 +418,23 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| Map resultMap = new HashMap(); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (user == null) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); | |||
| if(wxAppinfo == null){ | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxMaService wxMaService = getWeappService(user.getAppId()); | |||
| String session_key = user.getSessionKey(); | |||
| try { | |||
| // 解密 | |||
| WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(session_key, encryptedData, iv); | |||
| logger.info(phoneNoInfo.toString()); | |||
| if (null != phoneNoInfo) { | |||
| logger.debug(phoneNoInfo.toString()); | |||
| user.setPhone(phoneNoInfo.getPhoneNumber()); | |||
| user.setPurePhone(phoneNoInfo.getPurePhoneNumber()); | |||
| user.setCountryCode(phoneNoInfo.getCountryCode()); | |||
| if (!user.getPhone().contains("*")) { // 用户手机非加密 | |||
| String phone = user.getPhone(); | |||
| if (phone != null && phone.contains("*")) { | |||
| phone = user.getVerifyCodePhone(); | |||
| } | |||
| // 更新到basicinfo | |||
| Long userBasicId = saveToBasicInfoByCUser(phone, user.getNickName(), user.getAvatarUrl(), user.getGender(), user.getUserId()); | |||
| if (null != userBasicId) { | |||
| if(userBasicId.intValue() == -1){ | |||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); | |||
| } | |||
| user.setUserId(userBasicId); | |||
| }else{ | |||
| return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); | |||
| } | |||
| wxCUserService.saveOrUpdate(user); | |||
| wxCUserService.delForUserIdOnly(user.getId(),user.getUserId(),user.getTenantId()); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE, user,user,null); | |||
| } | |||
| removeCacheCUser(); | |||
| resultMap.put("msg", "授权手机成功!"); | |||
| resultMap.put("phone", phoneNoInfo.getPhoneNumber()); | |||
| } else { | |||
| return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); | |||
| } | |||
| } catch (Exception e) { | |||
| String phone = cuserFactory.getCUserService(user.getAppPlat()).decryptPhoneNoInfo(encryptedData, iv, user, wxAppinfo, isFmOpen); | |||
| resultMap.put("msg", "授权手机成功!"); | |||
| resultMap.put("phone", phone); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| }catch (Exception e) { | |||
| this.logger.error(e.getMessage(), e); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); | |||
| } | |||
| @@ -655,7 +451,7 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation(value = "判断用户是否完成授权", notes = "") | |||
| public ResultData checkWechatStatus() { | |||
| Map resultMap = new HashMap(); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (StringUtils.isNoneEmpty(user.getNickName())) { | |||
| resultMap.put("nickName", user.getNickName()); | |||
| } else { | |||
| @@ -686,7 +482,7 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation(value = "判断用户是否完成昵称授权", notes = "") | |||
| public ResultData checkUserStatus() { | |||
| Map resultMap = new HashMap(); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (StringUtils.isNoneEmpty(user.getNickName())) { | |||
| resultMap.put("nickName", user.getNickName()); | |||
| } else { | |||
| @@ -705,7 +501,7 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation(value = "判断用户是否完成手机授权", notes = "") | |||
| public ResultData checkPhoneStatus() { | |||
| Map resultMap = new HashMap(); | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if (StringUtils.isNotBlank(user.getPhone())) { | |||
| resultMap.put("phone", user.getPhone()); | |||
| } else { | |||
| @@ -725,7 +521,7 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation("获取当前用户信息") | |||
| @GetMapping("/userinfo") | |||
| public ResultData getUserInfo() { | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| WxCUserVo userVo = new WxCUserVo(); | |||
| org.springframework.beans.BeanUtils.copyProperties(user, userVo); | |||
| @@ -849,7 +645,7 @@ public class WxUserGrantController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); | |||
| } | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| String session_key = user.getSessionKey(); | |||
| try { | |||
| @@ -966,15 +762,15 @@ public class WxUserGrantController extends BaseController { | |||
| @PostMapping("/updateMsg") | |||
| @ApiOperation(value = "updateMsg", notes = "{\"id\":\"string\"}") | |||
| public ResultData updateMsg() { | |||
| WxCUser user = getWxCUser(); | |||
| wxCUserService.updateMsgCount(user); | |||
| CUser user = getCUser(); | |||
| cuserFactory.getCUserService(user.getAppPlat()).updateMsgCount(user); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("获取当前用户二维码") | |||
| @GetMapping("/userinfoQrCode") | |||
| public ResultData getUserinfoQrCode() { | |||
| WxCUser user = getWxCUser(); | |||
| CUser user = getCUser(); | |||
| if(user.basicInfoIs()){ | |||
| String key = Constant.cuserQr+ getTenantInfo().getTenantId() + ":" +user.getUserId(); | |||
| String qrCode = RedisCacheUtils.getCacheString(objectCommonRedisTemplate, key); | |||
| @@ -116,7 +116,7 @@ public class CashOutSchedule { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void cashOutBack(WxCashOut cashout,EnumPayWay payWay) { | |||
| //查询零钱是否已经到账 | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(cashout, payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(cashout, payWay.getPlat()); | |||
| if (null == appInfo) { | |||
| return; | |||
| } | |||
| @@ -303,7 +303,7 @@ public class OrderExpiringSchedule { | |||
| // if (null == cUser) { | |||
| // return true; | |||
| // } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(order, payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(order, payWay.getPlat()); | |||
| //WxAppinfo appInfo = wxAppinfoService.getByAppId(cUser.getAppId()); | |||
| //找不到appInfo,问题单,不能删 | |||
| if(appInfo == null) { | |||
| @@ -345,6 +345,7 @@ public enum ErrorCode{ | |||
| MCH_INFO_NOT_EQUAL(12022, "微信商户平台信息不对应"), | |||
| API_KEY_NOT_FOUND(12023, "支付密钥未配置"), | |||
| CERT_PATH_NOT_FOUND(12024, "双向证书未配置"), | |||
| APP_PLAT_ERROR(12025, "平台配置错误"), | |||
| PROFIT_SHARING_REQUEST_FAILED(12030, "分账请求失败"), | |||
| PROFIT_SHARING_APPLY_FAILED(12031, "分账业务失败"), | |||
| @@ -0,0 +1,135 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.utils.Constant; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| @JsonIgnoreProperties(ignoreUnknown = true) | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class CUser extends BaseCUserEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="微信openId",name="openId") | |||
| private String openId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信unionId",name="unionId") | |||
| private String unionId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户性别",name="gender") | |||
| private Integer gender; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户头像地址",name="avatarUrl") | |||
| private String avatarUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户没有区号的手机号",name="purePhone") | |||
| private String purePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在城市",name="city") | |||
| private String city; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在省份",name="province") | |||
| private String province; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在语言",name="language") | |||
| private String language; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户手机区号",name="countryCode") | |||
| private String countryCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户注册IP",name="registerIp") | |||
| private String registerIp; | |||
| @io.swagger.annotations.ApiModelProperty(value="验证码手机",name="verifyCodePhone") | |||
| private String verifyCodePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="注册时记录用户扫码渠道,如朋友圈广告",name="qrcodeSource") | |||
| private String qrcodeSource; | |||
| @io.swagger.annotations.ApiModelProperty(value="二维码来源,小程序",name="scene") | |||
| private String scene; | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道,小程序",name="sceneAddress") | |||
| private String sceneAddress; | |||
| @io.swagger.annotations.ApiModelProperty(value="session key for 微信小程序",name="sessionKey") | |||
| private String sessionKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="score") | |||
| private Integer score; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序的appId",name="appId") | |||
| private String appId; | |||
| /*经度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||
| private BigDecimal longitude; | |||
| /*纬度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| /*登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| /*附加信息**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="附加信息",name="extraInfo") | |||
| private String extraInfo; | |||
| /**是否关注公众号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注公众号",name="isSubscribe") | |||
| private Integer isSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信开放平台appId",name="openAppId") | |||
| private String openAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号openId",name="mpOpenId") | |||
| private String mpOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号appId",name="mpAppId") | |||
| private String mpAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注服务号",name="mpSubscribe") | |||
| private Integer mpSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号时间",name="mpSubscribeTime") | |||
| private Date mpSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号Scene",name="mpSubscribeScene") | |||
| private String mpSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号openId",name="subsOpenId") | |||
| private String subsOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号appId",name="subsAppId") | |||
| private String subsAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注订阅号",name="subsSubscribe") | |||
| private Integer subsSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号时间",name="subsSubscribeTime") | |||
| private Date subsSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | |||
| private String subsSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| private Integer credit; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道名称",name="channelName") | |||
| private String channelName; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道描述",name="sceneDescription") | |||
| protected String sceneDescription; | |||
| @TableField(exist = false) | |||
| List<String> sceneList; | |||
| @TableField(exist = false) | |||
| protected Date startDate; | |||
| @TableField(exist = false) | |||
| protected Date endDate; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型 枚举:EnumUserType",name="operatorType") | |||
| private Integer operatorType; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||
| private Long operatorId; | |||
| } | |||
| @@ -22,118 +22,7 @@ import java.util.UUID; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCUser extends BaseCUserEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="微信openId",name="openId") | |||
| private String openId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信unionId",name="unionId") | |||
| private String unionId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户性别",name="gender") | |||
| private Integer gender; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户头像地址",name="avatarUrl") | |||
| private String avatarUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户没有区号的手机号",name="purePhone") | |||
| private String purePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在城市",name="city") | |||
| private String city; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在省份",name="province") | |||
| private String province; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在语言",name="language") | |||
| private String language; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户手机区号",name="countryCode") | |||
| private String countryCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户注册IP",name="registerIp") | |||
| private String registerIp; | |||
| @io.swagger.annotations.ApiModelProperty(value="验证码手机",name="verifyCodePhone") | |||
| private String verifyCodePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="注册时记录用户扫码渠道,如朋友圈广告",name="qrcodeSource") | |||
| private String qrcodeSource; | |||
| @io.swagger.annotations.ApiModelProperty(value="二维码来源,小程序",name="scene") | |||
| private String scene; | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道,小程序",name="sceneAddress") | |||
| private String sceneAddress; | |||
| @io.swagger.annotations.ApiModelProperty(value="session key for 微信小程序",name="sessionKey") | |||
| private String sessionKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="score") | |||
| private Integer score; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序的appId",name="appId") | |||
| private String appId; | |||
| /*经度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||
| private BigDecimal longitude; | |||
| /*纬度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| /*登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| /*附加信息**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="附加信息",name="extraInfo") | |||
| private String extraInfo; | |||
| /**是否关注公众号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注公众号",name="isSubscribe") | |||
| private Integer isSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信开放平台appId",name="openAppId") | |||
| private String openAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号openId",name="mpOpenId") | |||
| private String mpOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号appId",name="mpAppId") | |||
| private String mpAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注服务号",name="mpSubscribe") | |||
| private Integer mpSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号时间",name="mpSubscribeTime") | |||
| private Date mpSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号Scene",name="mpSubscribeScene") | |||
| private String mpSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号openId",name="subsOpenId") | |||
| private String subsOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号appId",name="subsAppId") | |||
| private String subsAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注订阅号",name="subsSubscribe") | |||
| private Integer subsSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号时间",name="subsSubscribeTime") | |||
| private Date subsSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | |||
| private String subsSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| private Integer credit; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道名称",name="channelName") | |||
| private String channelName; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道描述",name="sceneDescription") | |||
| protected String sceneDescription; | |||
| @TableField(exist = false) | |||
| List<String> sceneList; | |||
| @TableField(exist = false) | |||
| protected Date startDate; | |||
| @TableField(exist = false) | |||
| protected Date endDate; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型 枚举:EnumUserType",name="operatorType") | |||
| private Integer operatorType; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||
| private Long operatorId; | |||
| public class WxCUser extends CUser { | |||
| public String createToken(Date currentDate,String tenantId) { | |||
| if(StringUtils.isBlank(tenantId)){ | |||
| @@ -37,7 +37,7 @@ public class WxCUserFrom extends TenantEntity { | |||
| return fromTypeDesc; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="cUserId",name="cUserId") | |||
| @io.swagger.annotations.ApiModelProperty(value="wx_c_user id",name="cUserId") | |||
| private Long cUserId; | |||
| @TableField(exist = false) | |||
| @Excel(name = "用户昵称", width = 20, orderNum = "2") | |||
| @@ -108,6 +108,8 @@ public class WxCUserFrom extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="app平台 EnumAppPlat ",name="plat") | |||
| private Integer plat; | |||
| @TableField(exist = false) | |||
| private Date startDate; | |||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.UserUtil; | |||
| import lombok.Data; | |||
| @@ -36,6 +37,9 @@ public class BaseCUserEntity extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="真实对象如wxCUser",name="realUser") | |||
| @TableField(exist = false) | |||
| protected Object realUser; | |||
| @TableField(exist = false) | |||
| protected EnumAppPlat appPlat; | |||
| /** | |||
| * 是否是会员 | |||
| @@ -84,4 +88,12 @@ public class BaseCUserEntity extends TenantEntity { | |||
| public void setRealUser(Object realUser) { | |||
| this.realUser = realUser; | |||
| } | |||
| public EnumAppPlat getAppPlat() { | |||
| return appPlat; | |||
| } | |||
| public void setAppPlat(EnumAppPlat appPlat) { | |||
| this.appPlat = appPlat; | |||
| } | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.domain.po.tt; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.CUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.utils.Constant; | |||
| import lombok.Data; | |||
| @@ -20,118 +21,7 @@ import java.util.UUID; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class TtCUser extends BaseCUserEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="openId",name="openId") | |||
| private String openId; | |||
| @io.swagger.annotations.ApiModelProperty(value="unionId",name="unionId") | |||
| private String unionId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户性别",name="gender") | |||
| private Integer gender; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户头像地址",name="avatarUrl") | |||
| private String avatarUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户没有区号的手机号",name="purePhone") | |||
| private String purePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在城市",name="city") | |||
| private String city; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在省份",name="province") | |||
| private String province; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在语言",name="language") | |||
| private String language; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户手机区号",name="countryCode") | |||
| private String countryCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户注册IP",name="registerIp") | |||
| private String registerIp; | |||
| @io.swagger.annotations.ApiModelProperty(value="验证码手机",name="verifyCodePhone") | |||
| private String verifyCodePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="注册时记录用户扫码渠道,如朋友圈广告",name="qrcodeSource") | |||
| private String qrcodeSource; | |||
| @io.swagger.annotations.ApiModelProperty(value="二维码来源,小程序",name="scene") | |||
| private String scene; | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道,小程序",name="sceneAddress") | |||
| private String sceneAddress; | |||
| @io.swagger.annotations.ApiModelProperty(value="session key for 微信小程序",name="sessionKey") | |||
| private String sessionKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="score") | |||
| private Integer score; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序的appId",name="appId") | |||
| private String appId; | |||
| /*经度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||
| private BigDecimal longitude; | |||
| /*纬度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| /*登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| /*附加信息**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="附加信息",name="extraInfo") | |||
| private String extraInfo; | |||
| /**是否关注公众号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注公众号",name="isSubscribe") | |||
| private Integer isSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信开放平台appId",name="openAppId") | |||
| private String openAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号openId",name="mpOpenId") | |||
| private String mpOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号appId",name="mpAppId") | |||
| private String mpAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注服务号",name="mpSubscribe") | |||
| private Integer mpSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号时间",name="mpSubscribeTime") | |||
| private Date mpSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号Scene",name="mpSubscribeScene") | |||
| private String mpSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号openId",name="subsOpenId") | |||
| private String subsOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号appId",name="subsAppId") | |||
| private String subsAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注订阅号",name="subsSubscribe") | |||
| private Integer subsSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号时间",name="subsSubscribeTime") | |||
| private Date subsSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | |||
| private String subsSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| private Integer credit; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道名称",name="channelName") | |||
| private String channelName; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道描述",name="sceneDescription") | |||
| protected String sceneDescription; | |||
| @TableField(exist = false) | |||
| List<String> sceneList; | |||
| @TableField(exist = false) | |||
| protected Date startDate; | |||
| @TableField(exist = false) | |||
| protected Date endDate; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型 枚举:EnumUserType",name="operatorType") | |||
| private Integer operatorType; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||
| private Long operatorId; | |||
| public class TtCUser extends CUser { | |||
| public String createToken(Date currentDate,String tenantId) { | |||
| if(StringUtils.isBlank(tenantId)){ | |||
| @@ -1,6 +1,5 @@ | |||
| package com.iformall.douyin.miniapp.api; | |||
| import cn.binarywang.wx.miniapp.api.WxMaUserService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import cn.binarywang.wx.miniapp.config.WxMaConfig; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| @@ -19,25 +19,29 @@ public interface TtCUserMapper extends CommonMapper<TtCUser, Long> { | |||
| TtCUser findByToken(@Param("token")String token,@Param("tenantId")String tenantId); | |||
| TtCUser getById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| TtCUser selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto dto); | |||
| long findCount(WxCUserBasicInfoDto basicDto); | |||
| List<TtCUser> listByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("cUser")TtCUser record); | |||
| List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto basicDto); | |||
| long countByChannel(List<TenantEntity> tenantEntitys, TtCUser cUser); | |||
| List<TtCUser> listByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("ttCUser")TtCUser ttCUser); | |||
| long countByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("ttCUser")TtCUser ttCUser); | |||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||
| void updateUserId(TtCUser user); | |||
| void updateUserId(TtCUser record); | |||
| void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | |||
| void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | |||
| List<String> listOpenId(TtCUser record); | |||
| void updateMsgCount(TtCUser user); | |||
| void updateMsgCount(TtCUser record); | |||
| // void updateMsgCountDown(@Param("tenantId")String tenantId, @Param("openId")String openId); | |||
| List<String> findOpenIdList(@Param("userId")Long userId, @Param("tenantId")String tenantId); | |||
| void updateMsgCountDown(@Param("tenantId")String tenantId, @Param("openId")String openId); | |||
| List<String> findTokenList(@Param("id")Long id,@Param("userId")Long userId, @Param("tenantId")String tenantId); | |||
| } | |||
| @@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Param; | |||
| public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| List<WxCUser> findList(WxCUser wxCUser); | |||
| List<WxCUser> findList(WxCUser record); | |||
| WxCUser findByOpenId(WxCUser record); | |||
| @@ -21,17 +21,17 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| WxCUser selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| long findCount(WxCUserBasicInfoDto basicDto); | |||
| List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto basicDto); | |||
| List<WxCUser> listByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCUser")WxCUser wxCUser); | |||
| long countByChannel(List<TenantEntity> tenantEntitys, WxCUser wxCUser); | |||
| long countByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCUser")WxCUser wxCUser); | |||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||
| void updateUserId(WxCUser user); | |||
| void updateUserId(WxCUser record); | |||
| void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | |||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxProjectConfig; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @@ -61,7 +62,7 @@ public interface WxAppinfoService { | |||
| * 获取c端小程序信息 | |||
| * @return | |||
| */ | |||
| WxAppinfo getCAppInfo(TenantEntity tenantEntity,EnumPayWay payWay); | |||
| WxAppinfo getCAppInfo(TenantEntity tenantEntity,EnumAppPlat appPlat); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -80,5 +81,5 @@ public interface WxAppinfoService { | |||
| WxAppinfo getByAppIdFromRedis(String appId); | |||
| WxAppinfo getByIdFromRedis(Long id); | |||
| WxAppinfo getCAppInfoFromRedis(String tenantId, EnumPayWay payWayWechat); | |||
| WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat appPlat); | |||
| } | |||
| @@ -1,5 +1,9 @@ | |||
| package com.iformall.service.cuser; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import com.iformall.domain.po.CUser; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUserFrom; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| /** | |||
| @@ -11,4 +15,22 @@ public interface CUserServiceApapter { | |||
| public BaseCUserEntity getByToken(String token); | |||
| public BaseCUserEntity getByObj(Object cuser); | |||
| WxMaJscode2SessionResult jsCode2SessionInfo(String code, WxAppinfo wxAppinfo, Boolean isFmOpen); | |||
| void decryptUserInfo(String encryptedData, String iv, CUser cuser, WxAppinfo wxAppinfo, Boolean isFmOpen); | |||
| String decryptPhoneNoInfo(String encryptedData, String iv, CUser cuser, WxAppinfo wxAppinfo, boolean isFmOpen); | |||
| CUser handleLoginUser(CUser cUser, WxCUserFrom wxCUserFrom); | |||
| CUser getById(Long id, String tenantId); | |||
| void updateScene(CUser user); | |||
| void updateLBS(CUser user); | |||
| void updateExtInfo(CUser user); | |||
| void updateMsgCount(CUser user); | |||
| } | |||
| @@ -1,25 +1,71 @@ | |||
| package com.iformall.service.cuser; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| import java.util.concurrent.ConcurrentHashMap; | |||
| import com.iformall.domain.po.CUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCUserFrom; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.FmInsideCLoginMsg; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.MemCouponFromDspService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.service.cuser.tt.TtCUserServiceAdapter; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.service.cuser.wx.WxCUserServiceAdapter; | |||
| @Service | |||
| public class CUserServiceFactory { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private Map<Integer,CUserServiceApapter> serviceMap ; | |||
| @Autowired | |||
| WxCUserServiceAdapter wxCuserService; | |||
| private WxCUserServiceAdapter wxCuserService; | |||
| @Autowired | |||
| TtCUserServiceAdapter ttCuserService; | |||
| private Map<Integer,CUserServiceApapter> serviceMap ; | |||
| private TtCUserServiceAdapter ttCuserService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private MemCouponFromDspService memCouponFromDspService; | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| private WxScoreRulesService wxScoreRulesService; | |||
| @Autowired | |||
| @Qualifier("baseCUserTokenRedisTemplate") | |||
| RedisTemplate<String, BaseCUserEntity> baseCUserTokenRedisTemplate; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| public CUserServiceApapter getCUserService(EnumAppPlat plat) { | |||
| return getcUserServiceMap().get(plat.getCode()); | |||
| @@ -34,4 +80,122 @@ public class CUserServiceFactory { | |||
| serviceMap.put(EnumAppPlat.TOUTIAO.getCode(), ttCuserService); | |||
| return serviceMap; | |||
| } | |||
| public void actionMsgAfterLogin(WxCUserFrom wxCUserFrom) { | |||
| wxCUserFrom.setCreateDate(new Date()); | |||
| FmInsideCLoginMsg loginMsg = new FmInsideCLoginMsg(); | |||
| loginMsg.updateTenantInfo(wxCUserFrom); | |||
| loginMsg.setMsgType(EnumMsgRecordType.INSIDE_C_LOGIN.getCode()); | |||
| loginMsg.setWxCUserFrom(wxCUserFrom); | |||
| mqBaseProducer.sendMessage(loginMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| public void actionAfterLogin(CUser user) { | |||
| // 成长值 | |||
| try { | |||
| wxScoreRulesService.addScore(user, EnumScoreType.LOGIN, user); | |||
| } catch (MallinkException e) { | |||
| logger.error("c_user 成长值 " + e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("c_user 成长值 " + e.getMessage()); | |||
| } | |||
| // 用户登陆后 更新最后一次活跃时间 | |||
| if (user.getUserId() != null) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getUserId(),user.getFinalTenantId()); | |||
| if (wxCUserBasicInfo != null) { | |||
| WxCUserBasicInfo basicInfo = new WxCUserBasicInfo(); | |||
| basicInfo.setId(wxCUserBasicInfo.getId()); | |||
| basicInfo.setFinalTenantId(user.getFinalTenantId()); | |||
| basicInfo.setActiveTime(new Date()); | |||
| int loingcount = 0; | |||
| try { | |||
| loingcount = Integer.parseInt(wxCUserBasicInfo.getLoginCount().toString()); | |||
| }catch(Exception e) { | |||
| } | |||
| basicInfo.setLoginCount(loingcount+1); | |||
| wxCUserBasicInfoService.update(basicInfo); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, user,user,null); | |||
| } | |||
| } | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| public Long saveToBasicInfoByCUser(TenantEntity tenantEntity,String userPhone,String userName,String avatarUrl,Integer sex,Long userId) { | |||
| if (StringUtils.isBlank(userPhone)) | |||
| return null; | |||
| WxCUserBasicInfo byId = null; | |||
| if (null != userId) { | |||
| byId = wxCUserBasicInfoService.getById(userId,tenantEntity.getFinalTenantId()); | |||
| } | |||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, userPhone); | |||
| if (basicInfo != null) { | |||
| if (byId != null) { | |||
| if (!byId.getId().equals(basicInfo.getId())) { | |||
| //数据库存在此手机号的会员,并且当前微信存在另一手机号会员 | |||
| logger.error("会员" + userId + "更换手机号时,当前手机号会员表已存在:" + userPhone); | |||
| return Long.valueOf(-1); | |||
| } | |||
| } | |||
| if (!basicInfo.getTenantId().contains("," + tenantEntity.getTenantId() + ",")) { | |||
| basicInfo.setTenantId(basicInfo.getTenantId() + tenantEntity.getTenantId() + ","); | |||
| } | |||
| basicInfo.setNickName(userName); | |||
| basicInfo.setAvatarUrl(avatarUrl); | |||
| basicInfo.setSex(sex); | |||
| wxCUserBasicInfoService.update(basicInfo); | |||
| cleanBasicUser(basicInfo.getId()); | |||
| return basicInfo.getId(); | |||
| } else { | |||
| if (byId != null) { | |||
| if (!byId.getTenantId().contains("," + tenantEntity.getTenantId() + ",")) { | |||
| byId.setTenantId(byId.getTenantId() + tenantEntity.getTenantId() + ","); | |||
| } | |||
| byId.setPhone(userPhone); | |||
| byId.setNickName(userName); | |||
| byId.setAvatarUrl(avatarUrl); | |||
| byId.setSex(sex); | |||
| wxCUserBasicInfoService.update(byId); | |||
| cleanBasicUser(byId.getId()); | |||
| return byId.getId(); | |||
| } else { | |||
| basicInfo = new WxCUserBasicInfo(); | |||
| basicInfo.setTenantId("," + tenantEntity.getTenantId() + ","); | |||
| basicInfo.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||
| basicInfo.setPhone(userPhone); | |||
| basicInfo.setNickName(userName); | |||
| basicInfo.setAvatarUrl(avatarUrl); | |||
| basicInfo.setSex(sex); | |||
| wxCUserBasicInfoService.save(basicInfo); | |||
| cleanBasicUser(basicInfo.getId()); | |||
| // 首次授权, 增加成长值及积分 | |||
| // 成长值 | |||
| wxScoreRulesService.addScore(tenantEntity, EnumScoreType.WECHAT_PHONE, basicInfo); | |||
| // 增加积分 | |||
| wxCUserBasicInfoService.addCredit(basicInfo.getId(),tenantEntity,EnumScoreType.WECHAT_PHONE); | |||
| // 外部注券 | |||
| memCouponFromDspService.couponOrderFromDsp(tenantEntity, userPhone); | |||
| return basicInfo.getId(); | |||
| } | |||
| } | |||
| } | |||
| public void cleanCuserToken(String token){ | |||
| String key = Constant.tokenPrev + token; | |||
| if(baseCUserTokenRedisTemplate.hasKey(key)){ | |||
| baseCUserTokenRedisTemplate.delete(key); | |||
| } | |||
| } | |||
| public void cleanBasicUser(Long memberId){ | |||
| String key = "webapp:member:"+memberId; | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | |||
| String shortKey = "webapp:short:member:"+memberId; | |||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, shortKey); | |||
| } | |||
| } | |||
| @@ -1,20 +1,57 @@ | |||
| package com.iformall.service.cuser.tt; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.tt.TtCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.douyin.miniapp.api.TtMaService; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.TtCUserMapper; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.cuser.CUserServiceApapter; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.MaUtil; | |||
| import lombok.SneakyThrows; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| public class TtCUserServiceAdapter implements CUserServiceApapter{ | |||
| public class TtCUserServiceAdapter extends CUserServiceFactory implements CUserServiceApapter{ | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| TtCUserMapper ttCUserMapper; | |||
| @Autowired | |||
| MaUtil maUtil; | |||
| private BaseCUserEntity generateBaseEntity(TtCUser ttCUser) { | |||
| BaseCUserEntity entity = new BaseCUserEntity(); | |||
| @@ -23,6 +60,7 @@ public class TtCUserServiceAdapter implements CUserServiceApapter{ | |||
| entity.setUserId(ttCUser.getUserId()); | |||
| entity.setToken(ttCUser.getToken()); | |||
| entity.updateTenantInfo(ttCUser); | |||
| entity.setAppPlat(EnumAppPlat.TOUTIAO); | |||
| entity.setRealUser(ttCUser); | |||
| return entity; | |||
| } | |||
| @@ -50,4 +88,218 @@ public class TtCUserServiceAdapter implements CUserServiceApapter{ | |||
| return generateBaseEntity(ttCUser); | |||
| } | |||
| @SneakyThrows | |||
| @Override | |||
| public WxMaJscode2SessionResult jsCode2SessionInfo(String code, WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| TtMaService ttMaService = this.getTtMaService(wxAppinfo, isFmOpen); | |||
| return ttMaService.jsCode2SessionInfo(code); | |||
| } | |||
| @Override | |||
| public void decryptUserInfo(String encryptedData, String iv, CUser cuser, WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| TtMaService ttMaService = this.getTtMaService(wxAppinfo, isFmOpen); | |||
| WxMaUserInfo userInfo = ttMaService.getUserService().getUserInfo(cuser.getSessionKey(), encryptedData, iv); | |||
| if (userInfo != null) { | |||
| TtCUser updateUser = new TtCUser(); | |||
| updateUser.setId(cuser.getId()); | |||
| updateUser.updateTenantInfo(cuser); | |||
| updateUser.setUnionId(userInfo.getUnionId()); | |||
| updateUser.setNickName(userInfo.getNickName()); | |||
| updateUser.setGender(Integer.parseInt(userInfo.getGender())); | |||
| updateUser.setAvatarUrl(userInfo.getAvatarUrl()); | |||
| updateUser.setProvince(userInfo.getProvince()); | |||
| updateUser.setCity(userInfo.getCity()); | |||
| updateUser.setLanguage(userInfo.getLanguage()); | |||
| updateUser.setUpdateDate(new Date()); | |||
| ttCUserMapper.updateUserId(updateUser); | |||
| if(cuser.getUserId() != null){ | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(cuser.getUserId()); | |||
| wxCUserBasicInfo.setFinalTenantId(cuser.getFinalTenantId()); | |||
| wxCUserBasicInfo.setSex(updateUser.getGender()); | |||
| wxCUserBasicInfo.setAvatarUrl(updateUser.getAvatarUrl()); | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| cleanBasicUser(cuser.getUserId()); | |||
| } | |||
| cleanCuserToken(cuser.getToken()); | |||
| } else { | |||
| throw new MallinkException(ErrorCode.SYS_BEAN_EMPTY_PROPERTY_ERROR.getCode(), "未获取到用户信息"); | |||
| } | |||
| } | |||
| @Override | |||
| public String decryptPhoneNoInfo(String encryptedData, String iv, CUser cuser, WxAppinfo wxAppinfo, boolean isFmOpen) { | |||
| TtMaService ttMaService = this.getTtMaService(wxAppinfo, isFmOpen); | |||
| WxMaPhoneNumberInfo phoneNoInfo = ttMaService.getUserService().getPhoneNoInfo(cuser.getSessionKey(), encryptedData, iv); | |||
| if (null != phoneNoInfo) { | |||
| if(phoneNoInfo.getPhoneNumber().contains("*")){ | |||
| throw new MallinkException(ErrorCode.PHONE_IS_ENCRYPTED); | |||
| } | |||
| TtCUser updateUser = new TtCUser(); | |||
| updateUser.setId(cuser.getId()); | |||
| updateUser.updateTenantInfo(cuser); | |||
| updateUser.setPhone(phoneNoInfo.getPhoneNumber()); | |||
| updateUser.setPurePhone(phoneNoInfo.getPurePhoneNumber()); | |||
| updateUser.setCountryCode(phoneNoInfo.getCountryCode()); | |||
| // 更新到basicinfo | |||
| Long userBasicId = saveToBasicInfoByCUser(updateUser,updateUser.getPhone(), cuser.getNickName(), cuser.getAvatarUrl(), cuser.getGender(), cuser.getUserId()); | |||
| if (null != userBasicId) { | |||
| if(userBasicId.intValue() == -1){ | |||
| throw new MallinkException(ErrorCode.USER_PHONE_IS_FOUND); | |||
| } | |||
| updateUser.setUserId(userBasicId); | |||
| }else{ | |||
| throw new MallinkException(ErrorCode.PHONE_DECODE_ERR); | |||
| } | |||
| updateUser.setUpdateDate(new Date()); | |||
| ttCUserMapper.updateById(updateUser); | |||
| delForUserIdOnly(updateUser.getId(),updateUser.getUserId(),updateUser.getTenantId()); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE, updateUser,updateUser,null); | |||
| cleanCuserToken(cuser.getToken()); | |||
| return updateUser.getPhone(); | |||
| } else { | |||
| throw new MallinkException(ErrorCode.PHONE_DECODE_ERR); | |||
| } | |||
| } | |||
| @Override | |||
| public CUser handleLoginUser(CUser cUser, WxCUserFrom wxCUserFrom) { | |||
| TtCUser newUser = new TtCUser(); | |||
| newUser.updateTenantInfo(cUser); | |||
| newUser.setAppId(cUser.getAppId()); | |||
| newUser.setOpenId(cUser.getOpenId()); | |||
| TtCUser oldUser = ttCUserMapper.findByOpenId(newUser); | |||
| if (oldUser != null) { | |||
| // 已有用户 | |||
| oldUser.createToken(new Date(),oldUser.getTenantId()); | |||
| oldUser.setRegisterIp(cUser.getRegisterIp()); | |||
| oldUser.setSessionKey(cUser.getSessionKey()); | |||
| oldUser.setUnionId(cUser.getUnionId()); | |||
| oldUser.setExtraInfo(cUser.getExtraInfo()); | |||
| oldUser.setLoginCount(oldUser.getLoginCount() + 1); | |||
| oldUser.setActiveTime(new Date()); | |||
| oldUser.setUpdateDate(new Date()); | |||
| ttCUserMapper.updateById(oldUser); | |||
| cUser = oldUser; | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.NO.getCode()); | |||
| } else { | |||
| // 新用户 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| newUser.setId(idWorker.nextId()); | |||
| newUser.createToken(new Date(),newUser.getTenantId()); | |||
| newUser.setRegisterIp(cUser.getRegisterIp()); | |||
| newUser.setSessionKey(cUser.getSessionKey()); | |||
| newUser.setUnionId(cUser.getUnionId()); | |||
| newUser.setSceneAddress(wxCUserFrom.getSceneAddress()); | |||
| newUser.setScene(wxCUserFrom.getScene()); | |||
| newUser.setExtraInfo(cUser.getExtraInfo()); | |||
| newUser.setLoginCount(1); | |||
| newUser.setActiveTime(new Date()); | |||
| newUser.setCreateDate(new Date()); | |||
| newUser.setUpdateDate(new Date()); | |||
| ttCUserMapper.insert(newUser); | |||
| cUser = newUser; | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.YES.getCode()); | |||
| } | |||
| wxCUserFrom.setCUserId(cUser.getId()); | |||
| actionMsgAfterLogin(wxCUserFrom); | |||
| return cUser; | |||
| } | |||
| @Override | |||
| public CUser getById(Long id, String tenantId) { | |||
| return ttCUserMapper.selectById(id,tenantId); | |||
| } | |||
| @Override | |||
| public void updateScene(CUser user) { | |||
| TtCUser userL = new TtCUser(); | |||
| userL.updateTenantInfo(user); | |||
| userL.setId(user.getId()); | |||
| userL.setScene(user.getScene()); | |||
| userL.setUpdateDate(new Date()); | |||
| ttCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| @Override | |||
| public void updateLBS(CUser user) { | |||
| TtCUser userL = new TtCUser(); | |||
| userL.setId(user.getId()); | |||
| userL.updateTenantInfo(user); | |||
| userL.setLongitude(user.getLongitude()); | |||
| userL.setLatitude(user.getLatitude()); | |||
| userL.setUpdateDate(new Date()); | |||
| ttCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| @Override | |||
| public void updateExtInfo(CUser user) { | |||
| TtCUser userL = new TtCUser(); | |||
| userL.setId(user.getId()); | |||
| userL.updateTenantInfo(user); | |||
| userL.setExtraInfo(user.getExtraInfo()); | |||
| userL.setUpdateDate( new Date()); | |||
| ttCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| @Override | |||
| public void updateMsgCount(CUser user) { | |||
| ttCUserMapper.updateMsgCount((TtCUser) user); | |||
| } | |||
| private TtMaService getTtMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| TtMaService ttMaService = maUtil.getTtappService(wxAppinfo); | |||
| if (StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||
| updateAppAccessToken(wxAppinfo, ttMaService); | |||
| } else { | |||
| // 检查token是否已过期, 1小时就重新获取 | |||
| Date curDate = new Date(); | |||
| if (curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.H_EXPIRE) { | |||
| updateAppAccessToken(wxAppinfo, ttMaService); | |||
| } | |||
| } | |||
| return ttMaService; | |||
| } | |||
| private void updateAppAccessToken(WxAppinfo wxAppinfo, TtMaService ttMaService) { | |||
| try { | |||
| String accessToken = ttMaService.getAccessToken(true); | |||
| WxAppinfo updateApp = new WxAppinfo(); | |||
| updateApp.setId(wxAppinfo.getId()); | |||
| updateApp.setAccessToken(accessToken); | |||
| updateApp.setLastTokenTime(new Date()); | |||
| updateApp.setExpiresIn(7200); | |||
| wxAppinfo.setAccessToken(updateApp.getAccessToken()); | |||
| wxAppinfo.setLastTokenTime(updateApp.getLastTokenTime()); | |||
| wxAppinfo.setExpiresIn(updateApp.getExpiresIn()); | |||
| wxAppinfoService.saveOrUpdate(updateApp); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| private void delForUserIdOnly(Long id, Long userId, String tenantId) { | |||
| List<String> tokenList = ttCUserMapper.findTokenList(id,userId, tenantId); | |||
| if(tokenList != null){ | |||
| for (String token:tokenList) { | |||
| cleanCuserToken(token); | |||
| } | |||
| } | |||
| ttCUserMapper.delForUserIdOnly(id,userId,tenantId); | |||
| } | |||
| } | |||
| @@ -1,21 +1,60 @@ | |||
| package com.iformall.service.cuser.wx; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.MaUtil; | |||
| import lombok.SneakyThrows; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.service.cuser.CUserServiceApapter; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxCUserServiceAdapter implements CUserServiceApapter{ | |||
| public class WxCUserServiceAdapter extends CUserServiceFactory implements CUserServiceApapter{ | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| private FmOpenService openService; | |||
| @Autowired | |||
| private WxCUserMapper wxCUserMapper; | |||
| @Autowired | |||
| MaUtil maUtil; | |||
| private BaseCUserEntity generateBaseEntity(WxCUser wxCUser) { | |||
| BaseCUserEntity entity = new BaseCUserEntity(); | |||
| @@ -24,6 +63,7 @@ public class WxCUserServiceAdapter implements CUserServiceApapter{ | |||
| entity.setUserId(wxCUser.getUserId()); | |||
| entity.setToken(wxCUser.getToken()); | |||
| entity.updateTenantInfo(wxCUser); | |||
| entity.setAppPlat(EnumAppPlat.WX); | |||
| entity.setRealUser(wxCUser); | |||
| return entity; | |||
| } | |||
| @@ -51,4 +91,223 @@ public class WxCUserServiceAdapter implements CUserServiceApapter{ | |||
| return generateBaseEntity(wxCUser); | |||
| } | |||
| @SneakyThrows | |||
| @Override | |||
| public WxMaJscode2SessionResult jsCode2SessionInfo(String code, WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| WxMaService wxMaService = this.getWxMaService(wxAppinfo, isFmOpen); | |||
| return wxMaService.jsCode2SessionInfo(code); | |||
| } | |||
| @Override | |||
| public void decryptUserInfo(String encryptedData, String iv, CUser cuser, WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| WxMaService wxMaService = this.getWxMaService(wxAppinfo, isFmOpen); | |||
| WxMaUserInfo userInfo = wxMaService.getUserService().getUserInfo(cuser.getSessionKey(), encryptedData, iv); | |||
| if (userInfo != null) { | |||
| WxCUser updateUser = new WxCUser(); | |||
| updateUser.setId(cuser.getId()); | |||
| updateUser.updateTenantInfo(cuser); | |||
| updateUser.setUnionId(userInfo.getUnionId()); | |||
| updateUser.setNickName(userInfo.getNickName()); | |||
| updateUser.setGender(Integer.parseInt(userInfo.getGender())); | |||
| updateUser.setAvatarUrl(userInfo.getAvatarUrl()); | |||
| updateUser.setProvince(userInfo.getProvince()); | |||
| updateUser.setCity(userInfo.getCity()); | |||
| updateUser.setLanguage(userInfo.getLanguage()); | |||
| updateUser.setUpdateDate(new Date()); | |||
| wxCUserMapper.updateUserId(updateUser); | |||
| if(cuser.getUserId() != null){ | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(cuser.getUserId()); | |||
| wxCUserBasicInfo.setFinalTenantId(cuser.getFinalTenantId()); | |||
| wxCUserBasicInfo.setSex(updateUser.getGender()); | |||
| wxCUserBasicInfo.setAvatarUrl(updateUser.getAvatarUrl()); | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| cleanBasicUser(cuser.getUserId()); | |||
| } | |||
| cleanCuserToken(cuser.getToken()); | |||
| } else { | |||
| throw new MallinkException(ErrorCode.SYS_BEAN_EMPTY_PROPERTY_ERROR.getCode(), "未获取到用户信息"); | |||
| } | |||
| } | |||
| @Override | |||
| public String decryptPhoneNoInfo(String encryptedData, String iv, CUser cuser, WxAppinfo wxAppinfo, boolean isFmOpen) { | |||
| WxMaService wxMaService = this.getWxMaService(wxAppinfo, isFmOpen); | |||
| WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(cuser.getSessionKey(), encryptedData, iv); | |||
| if (null != phoneNoInfo) { | |||
| if(phoneNoInfo.getPhoneNumber().contains("*")){ | |||
| throw new MallinkException(ErrorCode.PHONE_IS_ENCRYPTED); | |||
| } | |||
| WxCUser updateUser = new WxCUser(); | |||
| updateUser.setId(cuser.getId()); | |||
| updateUser.updateTenantInfo(cuser); | |||
| updateUser.setPhone(phoneNoInfo.getPhoneNumber()); | |||
| updateUser.setPurePhone(phoneNoInfo.getPurePhoneNumber()); | |||
| updateUser.setCountryCode(phoneNoInfo.getCountryCode()); | |||
| // 更新到basicinfo | |||
| Long userBasicId = saveToBasicInfoByCUser(updateUser,updateUser.getPhone(), cuser.getNickName(), cuser.getAvatarUrl(), cuser.getGender(), cuser.getUserId()); | |||
| if (null != userBasicId) { | |||
| if(userBasicId.intValue() == -1){ | |||
| throw new MallinkException(ErrorCode.USER_PHONE_IS_FOUND); | |||
| } | |||
| updateUser.setUserId(userBasicId); | |||
| }else{ | |||
| throw new MallinkException(ErrorCode.PHONE_DECODE_ERR); | |||
| } | |||
| updateUser.setUpdateDate(new Date()); | |||
| wxCUserMapper.updateById(updateUser); | |||
| delForUserIdOnly(updateUser.getId(),updateUser.getUserId(),updateUser.getTenantId()); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE, updateUser,updateUser,null); | |||
| cleanCuserToken(cuser.getToken()); | |||
| return updateUser.getPhone(); | |||
| } else { | |||
| throw new MallinkException(ErrorCode.PHONE_DECODE_ERR); | |||
| } | |||
| } | |||
| @Override | |||
| public CUser handleLoginUser(CUser cUser, WxCUserFrom wxCUserFrom) { | |||
| WxCUser newUser = new WxCUser(); | |||
| newUser.updateTenantInfo(cUser); | |||
| newUser.setAppId(cUser.getAppId()); | |||
| newUser.setOpenId(cUser.getOpenId()); | |||
| WxCUser oldUser = wxCUserMapper.findByOpenId(newUser); | |||
| if (oldUser != null) { | |||
| // 已有用户 | |||
| oldUser.createToken(new Date(),oldUser.getTenantId()); | |||
| oldUser.setRegisterIp(cUser.getRegisterIp()); | |||
| oldUser.setSessionKey(cUser.getSessionKey()); | |||
| oldUser.setUnionId(cUser.getUnionId()); | |||
| oldUser.setExtraInfo(cUser.getExtraInfo()); | |||
| oldUser.setLoginCount(oldUser.getLoginCount() + 1); | |||
| oldUser.setActiveTime(new Date()); | |||
| oldUser.setUpdateDate(new Date()); | |||
| wxCUserMapper.updateById(oldUser); | |||
| cUser = oldUser; | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.NO.getCode()); | |||
| } else { | |||
| // 新用户 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| newUser.setId(idWorker.nextId()); | |||
| newUser.createToken(new Date(),newUser.getTenantId()); | |||
| newUser.setRegisterIp(cUser.getRegisterIp()); | |||
| newUser.setSessionKey(cUser.getSessionKey()); | |||
| newUser.setUnionId(cUser.getUnionId()); | |||
| newUser.setSceneAddress(wxCUserFrom.getSceneAddress()); | |||
| newUser.setScene(wxCUserFrom.getScene()); | |||
| newUser.setExtraInfo(cUser.getExtraInfo()); | |||
| newUser.setLoginCount(1); | |||
| newUser.setActiveTime(new Date()); | |||
| newUser.setCreateDate(new Date()); | |||
| newUser.setUpdateDate(new Date()); | |||
| wxCUserMapper.insert(newUser); | |||
| cUser = newUser; | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.YES.getCode()); | |||
| } | |||
| wxCUserFrom.setCUserId(cUser.getId()); | |||
| actionMsgAfterLogin(wxCUserFrom); | |||
| return cUser; | |||
| } | |||
| @Override | |||
| public CUser getById(Long id, String tenantId) { | |||
| return wxCUserMapper.selectById(id,tenantId); | |||
| } | |||
| @Override | |||
| public void updateScene(CUser user) { | |||
| WxCUser userL = new WxCUser(); | |||
| userL.updateTenantInfo(user); | |||
| userL.setId(user.getId()); | |||
| userL.setScene(user.getScene()); | |||
| userL.setUpdateDate(new Date()); | |||
| wxCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| @Override | |||
| public void updateLBS(CUser user) { | |||
| WxCUser userL = new WxCUser(); | |||
| userL.setId(user.getId()); | |||
| userL.updateTenantInfo(user); | |||
| userL.setLongitude(user.getLongitude()); | |||
| userL.setLatitude(user.getLatitude()); | |||
| userL.setUpdateDate(new Date()); | |||
| wxCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| @Override | |||
| public void updateExtInfo(CUser user) { | |||
| WxCUser userL = new WxCUser(); | |||
| userL.setId(user.getId()); | |||
| userL.updateTenantInfo(user); | |||
| userL.setExtraInfo(user.getExtraInfo()); | |||
| userL.setUpdateDate( new Date()); | |||
| wxCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| } | |||
| @Override | |||
| public void updateMsgCount(CUser user) { | |||
| wxCUserMapper.updateMsgCount((WxCUser) user); | |||
| } | |||
| private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| WxMaService wxMaService = null; | |||
| if (isFmOpen) { | |||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(wxAppinfo.getAppId()); | |||
| } else { | |||
| wxMaService = maUtil.getWeappService(wxAppinfo); | |||
| if (StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||
| updateAppAccessToken(wxAppinfo, wxMaService); | |||
| } else { | |||
| // 检查token是否已过期, 1小时就重新获取 | |||
| Date curDate = new Date(); | |||
| if (curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.H_EXPIRE) { | |||
| updateAppAccessToken(wxAppinfo, wxMaService); | |||
| } | |||
| } | |||
| } | |||
| return wxMaService; | |||
| } | |||
| private void updateAppAccessToken(WxAppinfo wxAppinfo, WxMaService wxMaService) { | |||
| try { | |||
| String accessToken = wxMaService.getAccessToken(true); | |||
| WxAppinfo updateApp = new WxAppinfo(); | |||
| updateApp.setId(wxAppinfo.getId()); | |||
| updateApp.setAccessToken(accessToken); | |||
| updateApp.setLastTokenTime(new Date()); | |||
| updateApp.setExpiresIn(7200); | |||
| wxAppinfo.setAccessToken(updateApp.getAccessToken()); | |||
| wxAppinfo.setLastTokenTime(updateApp.getLastTokenTime()); | |||
| wxAppinfo.setExpiresIn(updateApp.getExpiresIn()); | |||
| wxAppinfoService.saveOrUpdate(updateApp); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| private void delForUserIdOnly(Long id, Long userId, String tenantId) { | |||
| List<String> tokenList = wxCUserMapper.findTokenList(id,userId, tenantId); | |||
| if(tokenList != null){ | |||
| for (String token:tokenList) { | |||
| cleanCuserToken(token); | |||
| } | |||
| } | |||
| wxCUserMapper.delForUserIdOnly(id,userId,tenantId); | |||
| } | |||
| } | |||
| @@ -82,7 +82,7 @@ public class QrCodeServiceImpl implements QrCodeService { | |||
| String name,EnumPayWay payWay) { | |||
| // type 0 有限二维码, 1 无限制二维码 | |||
| // withText 0 不带字 1. 带下面的字,2 带下面的两行字 | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantEntity,payWay); | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantEntity,payWay.getPlat()); | |||
| String filepath = fmUploadDir; | |||
| String fileName = name + ".png"; | |||
| @@ -119,7 +119,7 @@ public class QrCodeServiceImpl implements QrCodeService { | |||
| String name,EnumPayWay payWay) { | |||
| // type 0 有限二维码, 1 无限制二维码 | |||
| // withText 0 不带字 1. 带下面的字,2 带下面的两行字 | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantEntity,payWay); | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantEntity,payWay.getPlat()); | |||
| String filepath = fmUploadDir; | |||
| String fileName = name + ".png"; | |||
| @@ -64,7 +64,7 @@ public class TtCUserServiceImpl implements TtCUserService { | |||
| @Override | |||
| public TtCUser getById(Long id,String tenantId) { | |||
| return ttCUserMapper.getById(id,tenantId); | |||
| return ttCUserMapper.selectById(id,tenantId); | |||
| } | |||
| @Override | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxProjectConfig; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| @@ -37,13 +38,13 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||
| RedisTemplate<String, Object> wxAppinfoRedisTemplate; | |||
| @Override | |||
| public WxAppinfo getCAppInfo(TenantEntity tenantEntity,EnumPayWay payWay) { | |||
| public WxAppinfo getCAppInfo(TenantEntity tenantEntity,EnumAppPlat appPlat) { | |||
| WxAppinfo appInfo = null; | |||
| WxAppinfo appinfoQ = new WxAppinfo(); | |||
| if (null == payWay.getPlat()) { | |||
| appinfoQ.setPlat(EnumPayWay.PAY_WAY_WECHAT.getPlat().getCode()); | |||
| if (null == appPlat) { | |||
| appinfoQ.setPlat(EnumAppPlat.WX.getCode()); | |||
| }else { | |||
| appinfoQ.setPlat(payWay.getPlat().getCode()); | |||
| appinfoQ.setPlat(appPlat.getCode()); | |||
| } | |||
| appinfoQ.updateTenantInfo(tenantEntity); | |||
| @@ -147,15 +148,15 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||
| } | |||
| @Override | |||
| public WxAppinfo getCAppInfoFromRedis(String tenantId, EnumPayWay payWayWechat) { | |||
| public WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat plat) { | |||
| WxAppinfo record = null; | |||
| String key = Constant.appinfoPrev + tenantId + "-" + payWayWechat.getPlat() | |||
| String key = Constant.appinfoPrev + tenantId + "-" + plat | |||
| + "-" + EnumAppType.C.getCode(); | |||
| record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); | |||
| if (null == record) { | |||
| TenantEntity tenantEntity = new TenantEntity(); | |||
| tenantEntity.setTenantId(tenantId); | |||
| record = this.getCAppInfo(tenantEntity, payWayWechat); | |||
| record = this.getCAppInfo(tenantEntity, plat); | |||
| if(record != null){ | |||
| RedisCacheUtils.cache(wxAppinfoRedisTemplate, key, record, 3600*24*7); | |||
| } | |||
| @@ -156,7 +156,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| } | |||
| break; | |||
| case ASSIGN_TAGS_TRIGGER_PHONE: { | |||
| WxCUser param = (WxCUser) obj; | |||
| CUser param = (CUser) obj; | |||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(param.getUserId(),param.getFinalTenantId()); | |||
| if (user != null) { | |||
| if (user.getPhone() != null) { | |||
| @@ -234,7 +234,7 @@ public class WxCashOutServiceImpl implements WxCashOutService { | |||
| if (null == cashout ) { | |||
| return; | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity, payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity, payWay.getPlat()); | |||
| if (null == appInfo) { | |||
| return; | |||
| } | |||
| @@ -384,7 +384,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| private WxAppinfo getAppinfo(TenantEntity tenantEntity,Integer payWay) { | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.getEnum(payWay)); | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.getEnum(payWay).getPlat()); | |||
| if (wxAppinfo == null) | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| @@ -860,7 +860,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); | |||
| } | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(couponOrder,EnumPayWay.getEnum(couponOrder.getPayVendor())); | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(couponOrder,EnumPayWay.getEnum(couponOrder.getPayVendor()).getPlat()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(wxAppinfo.getPayId()); | |||
| OrderAdapterService orderAdapterService = orderFactory.getOrderAdapterService(couponOrder.getComposeOrderType()); | |||
| @@ -1603,7 +1603,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); | |||
| } | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(bUser,payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(bUser,payWay.getPlat()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| if (payAccount.checkShare()) { | |||
| @@ -64,7 +64,7 @@ public class WxCouponPresentServiceImpl implements WxCouponPresentService { | |||
| record.setSendAmount(phoneSet.size()); | |||
| wxCouponPresentMapper.insert(record); | |||
| //小程序 | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,payWay.getPlat()); | |||
| String title = record.getCouponName(); | |||
| String name = appInfo.getName(); | |||
| List<WxCouponPassword> tempList = new ArrayList<>(); | |||
| @@ -475,7 +475,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ); | |||
| appName = appList.get(0).getName(); | |||
| }else { | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw.getPlat()); | |||
| appName = appInfo.getName(); | |||
| } | |||
| Map<String, String> msgReplaceMap = new HashMap(); | |||
| @@ -373,7 +373,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| TenantEntity tenantEntity = new TenantEntity(); | |||
| tenantEntity.setTenantId(wxMsg.getTenantId()); | |||
| tenantEntity.setParentTenantId(wxMsg.getParentTenantId()); | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.PAY_WAY_WECHAT); | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumAppPlat.WX); | |||
| SmartAppMsg smartAppMsg = new SmartAppMsg(); | |||
| smartAppMsg.updateTenantInfo(tenantEntity); | |||
| smartAppMsg.setMsgType(EnumMsgRecordType.SMART_APP_TO.getCode()); | |||
| @@ -7,6 +7,7 @@ import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.WxProjectConfig; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.mapper.WxPayAccountMapper; | |||
| import com.iformall.service.WxAppinfoService; | |||
| @@ -87,7 +88,7 @@ public class WxPayAccountServiceImpl implements WxPayAccountService { | |||
| public WxPayService getWxPayService(String tenantId) { | |||
| TenantEntity tenantEntity = new TenantEntity(); | |||
| tenantEntity.setTenantId(tenantId); | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.PAY_WAY_WECHAT); | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumAppPlat.WX); | |||
| WxPayAccount payAccount = this.getByTenantId(tenantId); | |||
| if(cAppInfo != null && payAccount != null){ | |||
| return maUtil.getWxPayService(cAppInfo,payAccount); | |||
| @@ -438,7 +438,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| public ResultData createMicroPayOrder(WxMerchantBUser user, WxPayOrder record, EnumPayWay payWay,PayExtraParam params) { | |||
| final IdWorker idworker = IdWorker.get(); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(user,payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(user,payWay.getPlat()); | |||
| if (null == params) { | |||
| params = new PayExtraParam(); | |||
| } | |||
| @@ -593,7 +593,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), "payOrder not found"); | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,payWay); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,payWay.getPlat()); | |||
| PayAdapterService payService = payServiceFactory.getPayAdapterService(payWay.getCode()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| PayQueryAdapterResult apiResult = payService.queryPayStatus(record, appInfo, payAccount); | |||
| @@ -700,7 +700,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| @Override | |||
| public ResultData payOrderReverse(WxPayOrder record) { | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,EnumPayWay.getEnum(record.getPayVendor())); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,EnumPayWay.getEnum(record.getPayVendor()).getPlat()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| try { | |||
| PayAdapterResult result = payServiceFactory.getPayAdapterService(record.getPayVendor()).payOrderReverse(appInfo, record, payAccount); | |||
| @@ -1071,7 +1071,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | |||
| } | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(order,payWay); | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(order,payWay.getPlat()); | |||
| if (record.getPayAmount().intValue() == 0 || record.getPayAmount().equals(order.getPayment())) { | |||
| doCouponPayOrder(user, record, order,payWay); | |||
| @@ -1207,7 +1207,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| // 有价券 | |||
| if (EnumPayStatus.PAY_STATUS_FAIL.getCode() == status) { | |||
| // 1. get appinfo | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,EnumPayWay.getEnum(record.getPayVendor())); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,EnumPayWay.getEnum(record.getPayVendor()).getPlat()); | |||
| // 前端支付取消, | |||
| // 回调未返回,主动检查支付订单状态 | |||
| try { | |||
| @@ -551,20 +551,17 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| @Override | |||
| public int addScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param) { | |||
| WxCUser wxCUser = null; | |||
| WxCUserCar userCar = null; | |||
| WxCUserBasicInfo userBasicInfo = null; | |||
| Long userId = null; | |||
| if (param instanceof WxCUser) { | |||
| wxCUser = (WxCUser) param; | |||
| userId = wxCUser.getUserId(); | |||
| if (param instanceof CUser) { | |||
| CUser cuser = (CUser) param; | |||
| userId = cuser.getUserId(); | |||
| } | |||
| if (param instanceof WxCUserCar) { | |||
| userCar = (WxCUserCar) param; | |||
| WxCUserCar userCar = (WxCUserCar) param; | |||
| userId = userCar.getCUserId(); | |||
| } | |||
| if (param instanceof WxCUserBasicInfo) { | |||
| userBasicInfo = (WxCUserBasicInfo) param; | |||
| WxCUserBasicInfo userBasicInfo = (WxCUserBasicInfo) param; | |||
| userId = userBasicInfo.getId(); | |||
| } | |||
| if(userId == null){ | |||
| @@ -10,6 +10,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxTemplateMsg; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumTemplateType; | |||
| import com.iformall.mapper.WxTemplateMsgMapper; | |||
| @@ -118,7 +119,7 @@ public class WxTemplateMsgServiceImpl implements WxTemplateMsgService { | |||
| if(byId == null){ | |||
| return new ResultData(ErrorCode.TEMPLATE_NOT_FOUND); | |||
| } | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(wxTemplateMsg, EnumPayWay.PAY_WAY_WECHAT); | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(wxTemplateMsg, EnumAppPlat.TOUTIAO); | |||
| WxMaService wxMaService = null; | |||
| if(isFmOpen) { | |||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appinfo.getAppId()); | |||
| @@ -5,11 +5,13 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.msg.BaseMsg; | |||
| import com.iformall.domain.po.msg.FmInsideCLoginMsg; | |||
| import com.iformall.domain.po.msg.FmInsideCouponVerifyMsg; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumCUserFrom; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import com.iformall.service.msg.MsgSendService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -28,7 +30,7 @@ public class FmInsideCLoginMsgServiceImpl implements MsgSendService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserService userService; | |||
| private CUserServiceFactory cuserFactory; | |||
| @Autowired | |||
| private WxCUserFromService wxCUserFromService; | |||
| @@ -40,12 +42,12 @@ public class FmInsideCLoginMsgServiceImpl implements MsgSendService { | |||
| if(msg.getWxCUserFrom() != null && msg.getWxCUserFrom().getCUserId() != null){ | |||
| WxCUserFrom wxCUserFrom = msg.getWxCUserFrom(); | |||
| Long cUserId = wxCUserFrom.getCUserId(); | |||
| WxCUser user = userService.getById(cUserId,msg.getTenantId()); | |||
| CUser user = cuserFactory.getCUserService(EnumAppPlat.getByCode(wxCUserFrom.getPlat())).getById(cUserId,msg.getTenantId()); | |||
| if(user == null) { | |||
| logger.error("用户ID未找到: " + cUserId); | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户ID未找到" + cUserId); | |||
| } | |||
| userService.actionAfterLogin(user); | |||
| cuserFactory.actionAfterLogin(user); | |||
| if(wxCUserFrom.getFromType() != null | |||
| && !(wxCUserFrom.getFromType().equals(EnumCUserFrom.FROM_C_USER.getCode()) && wxCUserFrom.getFromId().equals(user.getId())) | |||
| && !(wxCUserFrom.getFromType().equals(EnumCUserFrom.FROM_C_USER_BASIC_INFO.getCode()) && user.getUserId() != null && wxCUserFrom.getFromId().equals(user.getUserId()))){ | |||
| @@ -150,11 +150,12 @@ | |||
| and `score` = #{score} | |||
| </if> | |||
| <if test="startdate != null"> | |||
| and `create_date` >= #{startdate} | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test="enddate != null"> | |||
| and `create_date` <= #{enddate} | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != appId "> | |||
| @@ -165,6 +166,10 @@ | |||
| and `token` like concat('%', #{token},'%') | |||
| </if> | |||
| <if test=" null != expireTime "> | |||
| and `expire_time` = #{expireTime} | |||
| </if> | |||
| <if test=" null != latitude "> | |||
| and `latitude` = #{latitude} | |||
| </if> | |||
| @@ -227,7 +232,7 @@ | |||
| <select id="listOpenId" parameterType="com.iformall.domain.po.tt.TtCUser" resultType="String"> | |||
| select open_id from tt_c_user where msg_count > 0 | |||
| select open_id from tt_c_user where msg_count >= 10 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -237,8 +242,8 @@ | |||
| </select> | |||
| <update id="updateMsgCount" parameterType="com.iformall.domain.po.tt.TtCUser"> | |||
| update tt_c_user set msg_count = msg_count+2 | |||
| where 1=1 | |||
| update tt_c_user set msg_count = msg_count+2 | |||
| where msg_count < 10 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| @@ -251,35 +256,39 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateMsgCountDown"> | |||
| update tt_c_user set msg_count = msg_count-1 | |||
| where msg_count > 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| and `open_id` = #{openId} | |||
| </update> | |||
| <!-- <update id="updateMsgCountDown">--> | |||
| <!-- update tt_c_user set msg_count = msg_count-1--> | |||
| <!-- where msg_count > 0--> | |||
| <!-- <if test=" null != tenantId and '' != tenantId">--> | |||
| <!-- and `tenant_id` = #{tenantId}--> | |||
| <!-- </if>--> | |||
| <!-- and `open_id` = #{openId}--> | |||
| <!-- </update>--> | |||
| <select id="findByOpenId" parameterType="com.iformall.domain.po.tt.TtCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| where `app_id` = #{appId} and `open_id` = #{openId} | |||
| </select> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| where `open_id` = #{openId} | |||
| <if test=" null != appId and '' != appId"> | |||
| and `app_id` = #{appId} | |||
| </if> | |||
| </select> | |||
| <select id="findByUnionId" parameterType="com.iformall.domain.po.tt.TtCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | |||
| </select> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | |||
| </select> | |||
| <select id="findByToken" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| where `token` = #{token} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="getById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| where `token` = #{token} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from tt_c_user where 1=1 | |||
| @@ -313,7 +322,7 @@ | |||
| </if> | |||
| <if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType"> | |||
| (select count(id) from | |||
| (select count(id) from | |||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where | |||
| @@ -359,47 +368,47 @@ | |||
| select id,user_id,nick_name,phone,create_date,scene_address from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where 1=1 | |||
| <if test=" null != cUser.tenantId and '' != cUser.tenantId"> | |||
| and `tenant_id` = #{cUser.tenantId} | |||
| <if test=" null != ttCUser.tenantId and '' != ttCUser.tenantId"> | |||
| and `tenant_id` = #{ttCUser.tenantId} | |||
| </if> | |||
| <if test=" null != cUser.parentTenantId and '' != cUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{cUser.parentTenantId} | |||
| <if test=" null != ttCUser.parentTenantId and '' != ttCUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{ttCUser.parentTenantId} | |||
| </if> | |||
| <if test=" null != cUser.startDate "> | |||
| and create_date >= #{cUser.startDate} | |||
| <if test=" null != ttCUser.startDate "> | |||
| and create_date >= #{ttCUser.startDate} | |||
| </if> | |||
| <if test=" null != cUser.endDate"> | |||
| and create_date < #{cUser.endDate} | |||
| <if test=" null != ttCUser.endDate"> | |||
| and create_date < #{ttCUser.endDate} | |||
| </if> | |||
| <if test=" cUser.sceneList!= null "> | |||
| <if test=" ttCUser.sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="cUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| <foreach collection="ttCUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != cUser.sortColumns"> order by ${cUser.sortColumns} </if> | |||
| <if test=" null == cUser.sortColumns"> order by create_date desc </if> | |||
| <if test=" null != ttCUser.sortColumns"> order by ${ttCUser.sortColumns} </if> | |||
| <if test=" null == ttCUser.sortColumns"> order by create_date desc </if> | |||
| </select> | |||
| <select id="countByChannel" resultType="java.lang.Long" > | |||
| select count(id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where 1=1 | |||
| <if test=" null != cUser.tenantId and '' != cUser.tenantId"> | |||
| and `tenant_id` = #{cUser.tenantId} | |||
| <if test=" null != ttCUser.tenantId and '' != ttCUser.tenantId"> | |||
| and `tenant_id` = #{ttCUser.tenantId} | |||
| </if> | |||
| <if test=" null != cUser.parentTenantId and '' != cUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{cUser.parentTenantId} | |||
| <if test=" null != ttCUser.parentTenantId and '' != ttCUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{ttCUser.parentTenantId} | |||
| </if> | |||
| <if test=" null != cUser.startDate "> | |||
| and create_date >= #{cUser.startDate} | |||
| <if test=" null != ttCUser.startDate "> | |||
| and create_date >= #{ttCUser.startDate} | |||
| </if> | |||
| <if test=" null != cUser.endDate"> | |||
| and create_date < #{cUser.endDate} | |||
| <if test=" null != ttCUser.endDate"> | |||
| and create_date < #{ttCUser.endDate} | |||
| </if> | |||
| <if test=" cUser.sceneList!= null "> | |||
| <if test=" ttCUser.sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="cUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| <foreach collection="ttCUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| @@ -417,13 +426,23 @@ | |||
| <update id="delForUserIdOnly"> | |||
| update tt_c_user set update_date=now(), | |||
| token = null, | |||
| expire_time=now(), | |||
| tenant_id = IF(tenant_id is null ,null,CONCAT(tenant_id,"_del")), | |||
| parent_tenant_id = IF(parent_tenant_id is null ,null,CONCAT(parent_tenant_id,"_del")), | |||
| open_id = IF(open_id is null ,null,CONCAT(open_id,"_del")), | |||
| union_id = IF(union_id is null ,null,CONCAT(union_id,"_del")) | |||
| where user_id = #{userId} and tenant_id = #{tenantId} and id != #{id} | |||
| phone = null, | |||
| pure_phone = null, | |||
| user_id = null | |||
| where user_id = #{userId} and tenant_id = #{tenantId} and id != #{id} | |||
| </update> | |||
| <select id="findTokenList" parameterType="hashmap" resultType="String" > | |||
| select token from tt_c_user where user_id=#{userId} and tenant_id = #{tenantId} and id != #{id} | |||
| </select> | |||
| <!-- tenant_id = IF(tenant_id is null ,null,CONCAT(tenant_id,"_del")),--> | |||
| <!-- parent_tenant_id = IF(parent_tenant_id is null ,null,CONCAT(parent_tenant_id,"_del")),--> | |||
| <!-- open_id = IF(open_id is null ,null,CONCAT(open_id,"_del")),--> | |||
| <!-- union_id = IF(union_id is null ,null,CONCAT(union_id,"_del"))--> | |||
| <select id="findOpenIdList" parameterType="hashmap" resultType="String" > | |||
| select open_id from tt_c_user where user_id=#{userId} and tenant_id = #{tenantId} | |||
| </select> | |||
| </mapper> | |||
| @@ -27,11 +27,14 @@ | |||
| <result column="share_user_name" jdbcType="VARCHAR" property="shareUserName" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="plat" jdbcType="INTEGER" property="plat" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| wcuf.`id`,wcuf.`tenant_id`,wcuf.`parent_tenant_id`,wcuf.`c_user_id`,wcuf.`scene`,wcuf.`scene_address`, | |||
| wcuf.`from_type`,wcuf.`from_id`,wcuf.`is_new_user`,wcuf.`share_user_type`,wcuf.`share_user`,wcuf.`create_date` | |||
| wcuf.`from_type`,wcuf.`from_id`,wcuf.`is_new_user`,wcuf.`share_user_type`,wcuf.`share_user`,wcuf.`create_date`, | |||
| wcuf.`plat` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -76,6 +79,9 @@ | |||
| <if test=" null != endDate"> | |||
| and wcuf.`create_date` <= #{endDate} | |||
| </if> | |||
| <if test=" null != plat"> | |||
| and wcuf.`plat` = #{plat} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and wcuf.id in | |||
| @@ -210,7 +210,7 @@ public class TtOrderController extends BaseController { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumPayWay.PAY_WAY_TT); | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||
| if (cAppInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); | |||
| } | |||