user_id)); } /** * Notes: 消息列表 * @author 段誉(2021/6/22 0:55) */ public function lists() { $type = $this->request->get('type'); $lists = SystemNoticeLogic::lists($this->user_id, $type, $this->page_no, $this->page_size); return JsonServer::success('获取成功', $lists); } /** * @notes 本地生活消息订阅模板ID,需要将template_id放在配置文件中 */ public function getLocalLifeTemplateId() { return JsonServer::success('获取成功', ['id' => ['w6LVw0dwdmBWBlj06j-A-s34NZSdFC5xkasFhZbYSfM']]); } /** * @notes 将template_id放在配置文件中 */ public function sendMsg() { $config = WeChatServer::getMnpConfig(); $app = Factory::miniProgram($config); $user = UserAuth::where(['user_id' => $this->user_id, 'client' => Client_::mnp])->find(); $data = [ 'template_id' => 'w6LVw0dwdmBWBlj06j-A-s34NZSdFC5xkasFhZbYSfM', // 所需下发的订阅模板id 'touser' => $user['openid'], // 接收者(用户)的 openid 'page' => '/pages/goods_cate/goods_cate', // 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。 'data' => [ // 模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } } 'thing1' => [ 'value' => '我的店铺', ], 'thing4' => [ 'value' => '您的店铺审核成功', ], 'phrase5' => [ 'value' => '审核成功' ] ], ]; $app->subscribe_message->send($data); } }