12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace App\Http\Controllers\Gnight;
- use App\Http\Controllers\Controller;
- use App\Http\Controllers\Miniprogram\Core;
- use App\Models\Gnight\UserModel;
- class Notive extends Controller
- {
- /**
- * 获得新的语音通知
- * @param int $uid
- * @return bool
- * @throws \Exception
- */
- public function getVoice(int $uid)
- {
- $public_id = config('miniprogram.public_id');
- $template_id = '6LemoOMIGrgzoqqFF6HLAqUSE6bHRSoGWVODfvPR9UQ';
- $page = "pages/starter/starter?launch_type=postman";
- $datas = array(
- 'keyword1' => array(
- 'value' => "解锁一条新语音"
- ),
- 'keyword2' => array(
- 'value' => '又有一个好友帮你解锁了!-若不想接收此消息,可在“我-通知开关”中关闭'
- ),
- 'keyword3' => array(
- 'value' => date('Y-m-d H:i:m')
- )
- );
- $emphasis_keyword = "keyword1.DATA";
- $core = new Core();
- return $core->template($uid, $template_id, $public_id, $page, $datas, $emphasis_keyword);
- }
- /**
- * 成功解锁通知
- * @param int $uid
- * @return bool
- * @throws \Exception
- */
- public function lock(int $uid)
- {
- $user = UserModel::find($uid);
- $public_id = config('miniprogram.public_id');
- // $template_id = 'm9Qv4FMHxsDx-J7dEMd9Sgn6ddx1LJRfNnJ2C3WBFIo';
- $template_id = 'vdZmmmUmHMyFLjV3CTvRANavzruks5fm5ixYegRfZ1U';
- $page = "pages/starter/starter?launch_type=postman";
- $datas = array(
- 'keyword1' => array(
- 'value' => "邀好友,解锁声音背后的TA"
- ),
- 'keyword2' => array(
- 'value' => date('Y-m-d H:i:m')
- ),
- 'keyword3' => array(
- 'value' => "亲爱的{$user->nickname}, 你已成功获得三位好友助力,点击查看声音背后的TA吧!"
- )
- );
- $core = new Core();
- return $core->template($user->uid, $template_id, $public_id, $page, $datas);
- }
- /**
- * 成功解锁通知
- * @param int $uid
- * @return bool
- * @throws \Exception
- */
- public function tmp(int $uid)
- {
- $user = UserModel::find($uid);
- $public_id = config('miniprogram.public_id');
- $template_id = 'IBtFcUbtcpyP6dQg66FlhQ2IB0DgaKpisS9ZOIpjSaI';
- if (isset($user->like) && in_array($user->like, [1, 2])) {
- $g = new \App\Models\Gnight\GetVoiceModel();
- $v = $g->pop($uid);
- $page = "pages/starter/starter?scene=voice_id%3d{$v}";
- } else {
- $page = "pages/starter/starter?launch_type=postman";
- }
- $datas = array(
- 'keyword1' => array(
- 'value' => "七夕告白语音"
- ),
- 'keyword2' => array(
- 'value' => "叮-你收到一条『七夕告白语音』请查收~"
- )
- );
- $emphasis_keyword = "keyword1.DATA";
- $core = new Core();
- return $core->template($user->uid, $template_id, $public_id, $page, $datas, $emphasis_keyword);
- }
- }
|