app_id = $this->input->get('app_id'); $this->reset = $this->input->get('reset'); $this->appid = $this->input->get('appid'); $this->secret = $this->input->get('secret'); $this->corpid = $this->input->get('corpid'); $this->corpsecret = $this->input->get('corpsecret'); $wx_configs = array( //小鱼冒泡 "13.1" => array('appid' => "wx13bb4ff11493bc7c", "secret" => "40d6032dece9aba7f9c2faa482abd827"), ); $wx_config = $wx_configs[$this->app_id]; if ($wx_config) { !$this->appid && $this->appid = $wx_config['appid']; !$this->secret && $this->secret = $wx_config['secret']; } $param = array('appid' => $this->appid, "secret" => $this->secret); $this->load->library("hd_wechat", $param); } /** * 获取access_token */ function access_token() { $access_token = $this->hd_wechat->access_token($this->reset); $data = array("access_token" => $access_token); echo json_encode($data, JSON_UNESCAPED_UNICODE); return; } /** * 获取分享凭证 */ function api_ticket() { $api_ticket = $this->hd_wechat->api_ticket($this->reset); $data = array("api_ticket" => $api_ticket); echo json_encode($data, JSON_UNESCAPED_UNICODE); return; } /* * 企业微信access_token */ public function qy_access_token() { $app = $this->input->get('app'); $corpid = $this->input->get('corpid'); $corpsecret = $this->input->get('corpsecret'); $params = array(); $app && $params['app'] = $app; $corpid && $params['corpid'] = $corpid; $corpsecret && $params['corpsecret'] = $corpsecret; $this->load->library('wx_qyapi', $params); $access_token = $this->wx_qyapi->access_token(); $data['access_token'] = $access_token; echo json_encode($data, JSON_UNESCAPED_UNICODE); return; } /** * Notes:企业微信ticket * Created on: 2022/3/30 9:53 * Created by: dengbw */ public function qy_jsapi_ticket() { $app = $this->input->get('app'); $corpid = $this->input->get('corpid'); $corpsecret = $this->input->get('corpsecret'); $params = array(); $app && $params['app'] = $app; $corpid && $params['corpid'] = $corpid; $corpsecret && $params['corpsecret'] = $corpsecret; $this->load->library('wx_qyapi', $params); $ticket = $this->wx_qyapi->jsapi_ticket(); $data['ticket'] = $ticket; echo json_encode($data, JSON_UNESCAPED_UNICODE); return; } /** * Notes:企业微信自建应用access_token * Created on: 2022/3/30 9:57 * Created by: dengbw */ public function qy_agent_access_token() { $app = $this->input->get('app'); $corpid = $this->input->get('corpid'); $corpsecret = $this->input->get('corpsecret'); $params = array(); $app && $params['app'] = $app; $corpid && $params['corpid'] = $corpid; $corpsecret && $params['corpsecret'] = $corpsecret; $this->load->library('wx_qyapi_agent', $params); $access_token = $this->wx_qyapi_agent->access_token(); $data['access_token'] = $access_token; echo json_encode($data, JSON_UNESCAPED_UNICODE); return; } /** * Notes:企业微信自建应用ticket * Created on: 2022/3/30 9:53 * Created by: dengbw */ public function qy_agent_jsapi_ticket() { $app = $this->input->get('app'); $corpid = $this->input->get('corpid'); $corpsecret = $this->input->get('corpsecret'); $params = array(); $app && $params['app'] = $app; $corpid && $params['corpid'] = $corpid; $corpsecret && $params['corpsecret'] = $corpsecret; $this->load->library('wx_qyapi_agent', $params); $ticket = $this->wx_qyapi_agent->jsapi_ticket(); $data['ticket'] = $ticket; echo json_encode($data, JSON_UNESCAPED_UNICODE); return; } }