response($this->error("", "参数错误!")); // 获取对应的信息 try{ // 获取对应的信息 $className = $this->params['app_type'].'TemplateInfo'; $classList = get_class_methods(self::class); $info = []; if(in_array($className,$classList)) $info = $this->$className($keywords); return $this->response($this->success($info)); }catch(Exception $e){ return $this->response($this->error("", $e->getMessage())); } } /** * Common: 模板消息配置信息获取 —— 支付宝模板消息获取 * Author: wu-hui * Time: 2023/01/10 11:54 * @param $keywords * @return array */ public function aliappTemplateInfo($keywords){ $templateIds = Db::name('message') ->whereIn('keywords',$keywords) ->where('aliapp_is_open',1) ->column('aliapp_template_id'); return array_filter($templateIds); } // 模板消息配置信息获取 —— 微信小程序 public function weappTemplateInfo($keywords){} // 模板消息配置信息获取 —— 微信公众号 public function wechatTemplateInfo($keywords){} /** * Common: 记录小程序订阅消息订阅记录 * Author: wu-hui * Time: 2023/01/10 14:07 * @return false|string|void */ public function subscriptionRecord(){ $token = $this->checkToken(); if ($token[ 'code' ] < 0) return $this->response($token); // 参数获取 $currentSubscribedEntityIds = json_decode(input('currentSubscribedEntityIds',''),TRUE); if(is_array($currentSubscribedEntityIds) && $currentSubscribedEntityIds){ $insertData = []; foreach($currentSubscribedEntityIds as $templateId){ $insertData[] = [ 'site_id' => $this->site_id, 'uid' => $this->member_id, 'template_id' => $templateId, 'type' => $this->params['app_type'] ?? '', 'create_time' => time(), ]; } Db::name('message_form_id')->insertAll($insertData); } return $this->response($this->success('操作完成')); } }