SyjCommand.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <?php
  2. namespace App\Console\Commands\Notices;
  3. use App\Services\NoticeService\Channels\WeChatTemplateChannel;
  4. use Illuminate\Console\Command;
  5. class SyjCommand extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'notice:syj {notice}';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = '时遇记营销通知';
  19. /**
  20. * Create a new command instance.
  21. *
  22. * @return void
  23. */
  24. public function __construct()
  25. {
  26. parent::__construct();
  27. }
  28. public const PUBLIC_ID = 'gh_c94c95866ca5';
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return mixed
  33. */
  34. public function handle()
  35. {
  36. //
  37. $notice = $this->argument('notice');
  38. \DB::connection()->enableQueryLog(); // 开启查询日志
  39. switch ($notice) {
  40. case 'a':
  41. dump($this->pair1());
  42. break;
  43. case 'b':
  44. dump($this->pair2());
  45. break;
  46. case 'c':
  47. dump($this->card1());
  48. break;
  49. case 'd':
  50. dump($this->card2());
  51. break;
  52. case 'e':
  53. dump($this->card3());
  54. break;
  55. }
  56. $queries = \DB::getQueryLog(); // 获取查询日志
  57. dump($queries);
  58. }
  59. // 关注公众号、有手机号,未参与过活动的
  60. public function pair1()
  61. {
  62. $title = '老用户召回syj-活动召回';
  63. if (
  64. \DB::connection('mysql_datalog')
  65. ->table("notice_logs")
  66. ->where('title', $title)
  67. ->where('date', date("Y-m-d"))
  68. ->count() >= 3000
  69. ) {
  70. return false;
  71. }
  72. // 过滤发送过的人
  73. $filter_users = \DB::connection('mysql_datalog')
  74. ->table("notice_logs")
  75. ->where('title', $title)
  76. ->distinct()
  77. ->pluck('openid');
  78. $users = \DB::table('kddx_user_openid as o')
  79. ->select('o.openid', 'o.sex')
  80. ->join('kdgx_partner_charge_user as u', 'u.uid', '=', 'o.uid')
  81. ->where('o.public_id', self::PUBLIC_ID)
  82. ->where('o.subscribe', 1)
  83. ->whereNotNull('u.phone')
  84. ->whereRaw(" u.`uid` NOT IN( SELECT DISTINCT(`uid`) FROM `kdgx_partner_charge_pair`) ")
  85. ->whereNotIn('o.openid', $filter_users)
  86. ->orderBy('o.id', 'asc')
  87. ->limit(rand(1, 5))
  88. ->get();
  89. foreach ($users as $user) {
  90. $ta = ($user->sex == 2) ? '小哥哥' : '小姐姐';
  91. $templates = [
  92. [
  93. 'template_id' => 'y-SOmy9b5AaN_h652VXw0zWr6E9vKiAojWN0JhJq7-E',
  94. 'data' => [
  95. 'first' => [
  96. 'value' => "你收到一条约会邀请,有{$ta}邀请你谈一场72小时的恋爱!",
  97. ],
  98. 'keyword1' => [
  99. 'value' => '72小时恋爱体验',
  100. ],
  101. 'keyword2' => [
  102. 'value' => '约会邀请',
  103. ],
  104. 'keyword4' => [
  105. 'value' => date('Y-m-d')
  106. ],
  107. 'remark' => [
  108. 'value' => "点此进入了解详情,{$ta}在等你哦~",
  109. ]
  110. ]
  111. ],
  112. [
  113. 'template_id' => 'buiSCGP-jKweNEVi7V8ZK-8Lspem1FopbD5Kvupg1Ig',
  114. 'data' => [
  115. 'first' => [
  116. 'value' => "你收到一条约会邀请,有{$ta}邀请你谈一场72小时的恋爱!",
  117. ],
  118. 'keyword1' => [
  119. 'value' => '72小时恋爱体验',
  120. ],
  121. 'keyword2' => [
  122. 'value' => '约会待开启',
  123. ],
  124. 'remark' => [
  125. 'value' => "点此进入了解详情,{$ta}在等你哦~",
  126. ]
  127. ]
  128. ],
  129. [
  130. 'template_id' => '22_U9jXaYpyk65P9-bPPe_INmrlY2TYooH3pe0kDkxA',
  131. 'data' => [
  132. 'first' => [
  133. 'value' => "你收到一条约会邀请,有{$ta}邀请你谈一场72小时的恋爱!",
  134. ],
  135. 'keyword1' => [
  136. 'value' => '72小时恋爱体验',
  137. ],
  138. 'keyword3' => [
  139. 'value' => date("Y-m-d"),
  140. ],
  141. 'keyword4' => [
  142. 'value' => '当前时间',
  143. ],
  144. 'keyword5' => [
  145. 'value' => '约会邀请',
  146. ],
  147. 'remark' => [
  148. 'value' => "点此进入了解详情,{$ta}在等你哦~",
  149. ]
  150. ]
  151. ]
  152. ];
  153. $rand = rand(0, count($templates) - 1);
  154. $templateId = $templates[$rand]['template_id'];
  155. $parameters = $templates[$rand]['data'];
  156. $page = "pages/pu-article/pu-article?from=template";
  157. $weChatTemplate = new WeChatTemplateChannel();
  158. $weChatTemplate->setAppId(self::PUBLIC_ID)
  159. ->setTitle($title)
  160. ->toUser($user->openid)
  161. ->setPage($page)
  162. ->setTemplateId($templateId)
  163. ->setParameters($parameters)
  164. ->send();
  165. }
  166. return ($users);
  167. }
  168. /*
  169. * 关注公众号、有手机号,仅参与过一次活动,最后登录时间为一个月前的用户
  170. */
  171. public function pair2()
  172. {
  173. $title = '老用户召回syj-活动召回2';
  174. if (
  175. \DB::connection('mysql_datalog')
  176. ->table("notice_logs")
  177. ->where('title', $title)
  178. ->where('date', date("Y-m-d"))
  179. ->count() >= 3000
  180. ) {
  181. return false;
  182. }
  183. // 过滤发送过的人
  184. $filter_users = \DB::connection('mysql_datalog')
  185. ->table("notice_logs")
  186. ->where('title', $title)
  187. ->distinct()
  188. ->pluck('openid');
  189. // 关注公众号、有手机号、登陆时间为一个月之前的人
  190. // 仅参加一次活动
  191. $users = \DB::table('kddx_user_openid as o')
  192. ->select('o.openid', 'o.sex')
  193. ->join('kdgx_partner_charge_user as u', 'u.uid', '=', 'o.uid')
  194. ->whereNotNull('u.phone')
  195. ->where('u.login_at', '<', strtotime("-1 month"))
  196. ->where('o.public_id', self::PUBLIC_ID)
  197. ->where('o.subscribe', 1)
  198. ->whereRaw(" u.`uid` IN( SELECT `uid` FROM `kdgx_partner_charge_pair` GROUP BY `uid` HAVING COUNT(*)= 1 )")
  199. ->whereNotIn('o.openid', $filter_users)
  200. ->orderBy('o.id', 'asc')
  201. ->limit(rand(1, 5))
  202. ->get();
  203. foreach ($users as $user) {
  204. $ta = ($user->sex == 2) ? '小哥哥' : '小姐姐';
  205. $templates = [
  206. [
  207. 'template_id' => 'y-SOmy9b5AaN_h652VXw0zWr6E9vKiAojWN0JhJq7-E',
  208. 'data' => [
  209. 'first' => [
  210. 'value' => "你收到一条约会邀请,有{$ta}邀请你谈一场72小时的恋爱!",
  211. ],
  212. 'keyword1' => [
  213. 'value' => '72小时恋爱体验',
  214. ],
  215. 'keyword2' => [
  216. 'value' => '约会邀请',
  217. ],
  218. 'keyword4' => [
  219. 'value' => date('Y-m-d')
  220. ],
  221. 'remark' => [
  222. 'value' => "点此进入了解详情,{$ta}在等你哦~",
  223. ]
  224. ]
  225. ],
  226. [
  227. 'template_id' => 'buiSCGP-jKweNEVi7V8ZK-8Lspem1FopbD5Kvupg1Ig',
  228. 'data' => [
  229. 'first' => [
  230. 'value' => "你收到一条约会邀请,有{$ta}邀请你谈一场72小时的恋爱!",
  231. ],
  232. 'keyword1' => [
  233. 'value' => '72小时恋爱体验',
  234. ],
  235. 'keyword2' => [
  236. 'value' => '约会待开启',
  237. ],
  238. 'remark' => [
  239. 'value' => "点此进入了解详情,{$ta}在等你哦~",
  240. ]
  241. ]
  242. ],
  243. [
  244. 'template_id' => '22_U9jXaYpyk65P9-bPPe_INmrlY2TYooH3pe0kDkxA',
  245. 'data' => [
  246. 'first' => [
  247. 'value' => "你收到一条约会邀请,有{$ta}邀请你谈一场72小时的恋爱!",
  248. ],
  249. 'keyword1' => [
  250. 'value' => '72小时恋爱体验',
  251. ],
  252. 'keyword3' => [
  253. 'value' => date("Y-m-d"),
  254. ],
  255. 'keyword4' => [
  256. 'value' => '当前时间',
  257. ],
  258. 'keyword5' => [
  259. 'value' => '约会邀请',
  260. ],
  261. 'remark' => [
  262. 'value' => "点此进入了解详情,{$ta}在等你哦~",
  263. ]
  264. ]
  265. ]
  266. ];
  267. $rand = rand(0, count($templates) - 1);
  268. $templateId = $templates[$rand]['template_id'];
  269. $parameters = $templates[$rand]['data'];
  270. $page = "pages/pu-article/pu-article?from=template";
  271. $weChatTemplate = new WeChatTemplateChannel();
  272. $weChatTemplate->setAppId(self::PUBLIC_ID)
  273. ->setTitle($title)
  274. ->toUser($user->openid)
  275. ->setPage($page)
  276. ->setTemplateId($templateId)
  277. ->setParameters($parameters)
  278. ->send();
  279. }
  280. return ($users);
  281. }
  282. /*
  283. * 关注公众号、无卡片ID/有卡片ID(无照片&无语音&无联系方式)
  284. */
  285. public function card1()
  286. {
  287. $title = "老用户召回syj-卡片1";
  288. if (
  289. \DB::connection('mysql_datalog')
  290. ->table("notice_logs")
  291. ->where('title', $title)
  292. ->where('date', date("Y-m-d"))
  293. ->count() >= 3000
  294. ) {
  295. return false;
  296. }
  297. // 过滤发送过的人
  298. $filter_users = \DB::connection('mysql_datalog')
  299. ->table("notice_logs")
  300. ->where('title', $title)
  301. ->distinct()
  302. ->pluck('openid');
  303. $users = \DB::table('kddx_user_openid as o')
  304. ->select('o.openid', 'o.sex')
  305. ->leftjoin("kdgx_partner_charge_partner as p", function ($join) {
  306. $join->on('o.uid', '=', 'p.uid')
  307. ->whereRaw(" (p.`photo_src`!= ''
  308. or p.`photo_1`!= ''
  309. or p.`photo_2`!= ''
  310. or p.`photo_3`!= ''
  311. or p.`photo_4`!= ''
  312. or p.`voice`!= ''
  313. or p.`weixin` is NOT null
  314. or p.`qq` IS NOT NULL)");
  315. })
  316. ->whereNull('p.id')
  317. ->where('o.public_id', self::PUBLIC_ID)
  318. ->where('o.subscribe', 1)
  319. ->whereNotIn('o.openid', $filter_users)
  320. ->orderBy('o.id', 'asc')
  321. ->limit(rand(1, 5))
  322. ->get();
  323. foreach ($users as $user) {
  324. switch ($user->sex) {
  325. case '1':
  326. $ta = '小姐姐';
  327. break;
  328. case '2':
  329. $ta = '小哥哥';
  330. break;
  331. default:
  332. $ta = '新朋友';
  333. break;
  334. }
  335. $templates = [
  336. [
  337. 'template_id' => '94ootk_SJuBQE9Y9d--Ag5lwcEs61NRV4AsimsV3F6Q',
  338. 'data' => [
  339. 'first' => [
  340. 'value' => "小遇今日为你精选了56个兴趣相投又好看的{$ta}。说不定其中就有你心动的人哦!",
  341. ],
  342. 'keyword1' => [
  343. 'value' => '匹配通知',
  344. ],
  345. 'keyword2' => [
  346. 'value' => date('Y-m-d')
  347. ],
  348. 'remark' => [
  349. 'value' => "他们之中离你最近的只有0.5km哦~",
  350. ]
  351. ]
  352. ],
  353. [
  354. 'template_id' => 'buiSCGP-jKweNEVi7V8ZK-8Lspem1FopbD5Kvupg1Ig',
  355. 'data' => [
  356. 'first' => [
  357. 'value' => "小遇今日为你精选了56个兴趣相投又好看的{$ta}。说不定其中就有你心动的人哦!",
  358. ],
  359. 'keyword1' => [
  360. 'value' => '推荐提醒',
  361. ],
  362. 'keyword2' => [
  363. 'value' => date("Y-m-d"),
  364. ],
  365. 'remark' => [
  366. 'value' => "他们之中离你最近的只有0.5km哦~",
  367. ]
  368. ]
  369. ],
  370. [
  371. 'template_id' => 'dD4V6t1sbBDGit_eVq0gZ6bX3RmLPeZU0sdK-bBJRds',
  372. 'data' => [
  373. 'first' => [
  374. 'value' => "小遇今日为你精选了56个兴趣相投又好看的{$ta}。说不定其中就有你心动的人哦!",
  375. ],
  376. 'keyword1' => [
  377. 'value' => '小遇',
  378. ],
  379. 'keyword2' => [
  380. 'value' => '推荐提醒',
  381. ],
  382. 'remark' => [
  383. 'value' => "他们之中离你最近的只有0.5km哦~",
  384. ]
  385. ]
  386. ]
  387. ];
  388. $rand = rand(0, count($templates) - 1);
  389. $templateId = $templates[$rand]['template_id'];
  390. $parameters = $templates[$rand]['data'];
  391. $page = "pages/index/index";
  392. $weChatTemplate = new WeChatTemplateChannel();
  393. $weChatTemplate->setAppId(self::PUBLIC_ID)
  394. ->setTitle($title)
  395. ->toUser($user->openid)
  396. ->setPage($page)
  397. ->setTemplateId($templateId)
  398. ->setParameters($parameters)
  399. ->send();
  400. }
  401. return ($users);
  402. }
  403. /**
  404. * 关注服务号,有卡片信息(照片or语音),未上架的用户
  405. * @return bool
  406. */
  407. public function card2()
  408. {
  409. $title = "老用户召回syj-卡片2";
  410. if (
  411. \DB::connection('mysql_datalog')
  412. ->table("notice_logs")
  413. ->where('title', $title)
  414. ->where('date', date("Y-m-d"))
  415. ->count() >= 3000
  416. ) {
  417. return false;
  418. }
  419. // 过滤发送过的人
  420. $filter_users = \DB::connection('mysql_datalog')
  421. ->table("notice_logs")
  422. ->where('title', $title)
  423. ->distinct()
  424. ->pluck('openid');
  425. $users = \DB::table('kddx_user_openid as o')
  426. ->select('o.openid', 'o.nickname')
  427. ->join("kdgx_partner_charge_partner as p", function ($join) {
  428. $join->on('o.uid', '=', 'p.uid');
  429. })
  430. ->where('o.public_id', self::PUBLIC_ID)
  431. ->where('o.subscribe', 1)
  432. ->whereRaw(" (p.`photo_src`!= ''
  433. or p.`photo_1`!= ''
  434. or p.`photo_2`!= ''
  435. or p.`photo_3`!= ''
  436. or p.`photo_4`!= ''
  437. or p.`voice`!= ''
  438. )")
  439. ->where('p.is_sell', '<>', 1)
  440. ->whereNotIn('o.openid', $filter_users)
  441. ->orderBy('o.id', 'asc')
  442. ->limit(rand(1, 5))
  443. ->get();
  444. foreach ($users as $user) {
  445. $x = rand(100, 1000);
  446. $templates = [
  447. [
  448. 'template_id' => 'RJNTbLGdlK7tLRgt5uoKIEWxlB7-bwCdwgE5yR11aHk',
  449. 'data' => [
  450. 'first' => [
  451. 'value' => "你的交友卡片尚未修改或完善,已错过{$x}次推荐曝光机会",
  452. ],
  453. 'keyword1' => [
  454. 'value' => $user->nickname,
  455. ],
  456. 'keyword2' => [
  457. 'value' => "交友卡片待完善",
  458. ],
  459. 'keyword3' => [
  460. 'value' => date('Y-m-d')
  461. ],
  462. 'remark' => [
  463. 'value' => "点此继续完善卡片重新提交审核,通过后将优先把你推荐给附近的人",
  464. ]
  465. ]
  466. ],
  467. [
  468. 'template_id' => 'T5AvN3tkUKywz1-hVeW2RFLNYV1Ex_EfXI0OE_JQBxM',
  469. 'data' => [
  470. 'first' => [
  471. 'value' => "你的交友卡片尚未修改或完善,已错过{$x}次推荐曝光机会",
  472. ],
  473. 'keyword1' => [
  474. 'value' => date("Y-m-d"),
  475. ],
  476. 'keyword2' => [
  477. 'value' => '交友卡片待完善',
  478. ],
  479. 'remark' => [
  480. 'value' => "点此继续完善卡片重新提交审核,通过后将优先把你推荐给附近的人",
  481. ]
  482. ]
  483. ],
  484. [
  485. 'template_id' => 'nMFoJQdUqb4IB5S-rs1PruWjC1H9HvvGfLCrPkl9iMs',
  486. 'data' => [
  487. 'first' => [
  488. 'value' => "你的交友卡片尚未修改或完善,已错过{$x}次推荐曝光机会",
  489. ],
  490. 'keyword1' => [
  491. 'value' => '交友卡片',
  492. ],
  493. 'keyword2' => [
  494. 'value' => '交友卡片待完善',
  495. ],
  496. 'keyword3' => [
  497. 'value' => '交友卡片',
  498. ],
  499. 'keyword4' => [
  500. 'value' => date('Y-m-d'),
  501. ],
  502. 'remark' => [
  503. 'value' => "点此继续完善卡片重新提交审核,通过后将优先把你推荐给附近的人",
  504. ]
  505. ]
  506. ]
  507. ];
  508. $rand = rand(0, count($templates) - 1);
  509. $templateId = $templates[$rand]['template_id'];
  510. $parameters = $templates[$rand]['data'];
  511. $page = "pages/my-friend-card-editor/my-friend-card-editor";
  512. $weChatTemplate = new WeChatTemplateChannel();
  513. $weChatTemplate->setAppId(self::PUBLIC_ID)
  514. ->setTitle($title)
  515. ->toUser($user->openid)
  516. ->setPage($page)
  517. ->setTemplateId($templateId)
  518. ->setParameters($parameters)
  519. ->send();
  520. }
  521. return $users;
  522. }
  523. /**
  524. * 关注服务号,有交友卡片,超1月未登录
  525. * @return bool
  526. */
  527. public function card3()
  528. {
  529. $title = "老用户召回syj-卡片3";
  530. if (
  531. \DB::connection('mysql_datalog')
  532. ->table("notice_logs")
  533. ->where('title', $title)
  534. ->where('date', date("Y-m-d"))
  535. ->count() >= 3000
  536. ) {
  537. return false;
  538. }
  539. // 过滤发送过的人
  540. $filter_users = \DB::connection('mysql_datalog')
  541. ->table("notice_logs")
  542. ->where('title', $title)
  543. ->distinct()
  544. ->pluck('openid');
  545. $users = \DB::table('kddx_user_openid as o')
  546. ->select('o.openid', 'o.nickname', 'o.sex')
  547. ->join('kdgx_partner_charge_user as u', 'o.uid', '=', 'u.uid')
  548. ->where('u.login_at', '<', strtotime("-1 month"))
  549. ->where('o.public_id', self::PUBLIC_ID)
  550. ->where('o.subscribe', 1)
  551. ->whereNotIn('o.openid', $filter_users)
  552. ->orderBy('o.id', 'asc')
  553. ->limit(rand(1, 5))
  554. ->get();
  555. foreach ($users as $user) {
  556. $x = rand(100, 1000);
  557. switch ($user->sex) {
  558. case '1':
  559. $ta = '小姐姐';
  560. break;
  561. case '2':
  562. $ta = '小哥哥';
  563. break;
  564. default:
  565. $ta = '小姐姐';
  566. break;
  567. }
  568. $templates = [
  569. [
  570. 'template_id' => 'buiSCGP-jKweNEVi7V8ZK-8Lspem1FopbD5Kvupg1Ig',
  571. 'data' => [
  572. 'first' => [
  573. 'value' => "你不在的这段时间里,已经有{$x}个{$ta}看过你的交友卡片了!快来看看都有哪些人吧~",
  574. ],
  575. 'keyword1' => [
  576. 'value' => "访客通知",
  577. ],
  578. 'keyword2' => [
  579. 'value' => date('Y-m-d')
  580. ],
  581. 'remark' => [
  582. 'value' => "他们之中离你最近的只有0.5km哦,来看看你附近的{$ta}吧~",
  583. ]
  584. ]
  585. ],
  586. [
  587. 'template_id' => 'HgmFhBPrOry3i647Zu9AF4Vcfs0MaIj8bE83-G5Kg6Q',
  588. 'data' => [
  589. 'first' => [
  590. 'value' => "你不在的这段时间里,已经有{$x}个{$ta}看过你的交友卡片了!快来看看都有哪些人吧~",
  591. ],
  592. 'keyword1' => [
  593. 'value' => '访客通知',
  594. ],
  595. 'keyword2' => [
  596. 'value' => '分配对象个人中心',
  597. ],
  598. 'keyword3' => [
  599. 'value' => '访客通知',
  600. ],
  601. 'keyword4' => [
  602. 'value' => date("Y-m-d"),
  603. ],
  604. 'remark' => [
  605. 'value' => "他们之中离你最近的只有0.5km哦,来看看你附近的{$ta}吧~",
  606. ]
  607. ]
  608. ],
  609. [
  610. 'template_id' => 'dD4V6t1sbBDGit_eVq0gZ6bX3RmLPeZU0sdK-bBJRds',
  611. 'data' => [
  612. 'first' => [
  613. 'value' => "你不在的这段时间里,已经有{$x}个{$ta}看过你的交友卡片了!快来看看都有哪些人吧~",
  614. ],
  615. 'keyword1' => [
  616. 'value' => '小遇',
  617. ],
  618. 'keyword2' => [
  619. 'value' => '访客提醒',
  620. ],
  621. 'remark' => [
  622. 'value' => "他们之中离你最近的只有0.5km哦,来看看你附近的{$ta}吧~",
  623. ]
  624. ]
  625. ]
  626. ];
  627. $rand = rand(0, count($templates) - 1);
  628. $templateId = $templates[$rand]['template_id'];
  629. $parameters = $templates[$rand]['data'];
  630. $page = "pages/index/index";
  631. $weChatTemplate = new WeChatTemplateChannel();
  632. $weChatTemplate->setAppId(self::PUBLIC_ID)
  633. ->setTitle($title)
  634. ->toUser($user->openid)
  635. ->setPage($page)
  636. ->setTemplateId($templateId)
  637. ->setParameters($parameters)
  638. ->send();
  639. }
  640. return $users;
  641. }
  642. }