正在显示
1 个修改的文件
包含
39 行增加
和
48 行删除
@@ -94,56 +94,47 @@ class Index extends Api | @@ -94,56 +94,47 @@ class Index extends Api | ||
94 | */ | 94 | */ |
95 | public function senWxmsgToAgentUser($titdesc="", $remark="") | 95 | public function senWxmsgToAgentUser($titdesc="", $remark="") |
96 | { | 96 | { |
97 | - $wxopenid="o5ABA4yWDTLRTf3LkBMMHoV7XOvQ"; | ||
98 | - $sendInfo = array( | ||
99 | - 'first' => array('value' => urlencode($titdesc), 'color' => "#743A3A"), | ||
100 | - 'keyword1' => array('value' => urlencode(date('Y-m-d H:i:s', time())), 'color' => '#173177'), | ||
101 | - 'keyword2' => array('value' => urlencode('企业入驻'), 'color' => '#173177'), | ||
102 | - 'remark' => array('value' => urlencode($remark), 'color' => '#173177'), | ||
103 | - ); | ||
104 | - if ($wxopenid) { | ||
105 | - $config = get_addon_config('wechat'); | ||
106 | - $tourl = 'https://wyc.tenyes.cn/h5/'; | ||
107 | - $ywt_appid = 'wxb7dd0c03865a94e0'; | ||
108 | - $pagepath = 'pages/home/index'; | ||
109 | - $res = $this->sendAstuWxMsgToAgent($sendInfo, $wxopenid, $tourl, $config['app_id'], $config['secret'], $ywt_appid, $pagepath); | ||
110 | - return $res; | ||
111 | - //file_put_contents("pcl_wct_send.log", date("Y-m-d H:i:s") . "1-2-" . json_encode($res, JSON_UNESCAPED_UNICODE) . PHP_EOL, FILE_APPEND); | ||
112 | - } | ||
113 | - } | ||
114 | - | ||
115 | - /** | ||
116 | - * 微信公众号 | ||
117 | - * 经纪人审核 消息推送 | ||
118 | - */ | ||
119 | - function sendAstuWxMsgToAgent($info, $openid, $tourl, $appid, $secret, $ywt_appid, $pagepath) | ||
120 | - { | ||
121 | - $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; | ||
122 | 97 | ||
123 | - $json_token = $this->http_request($myurl); | ||
124 | - $access_tokens = json_decode($json_token, true); | ||
125 | - | ||
126 | - $access_token = $access_tokens['access_token']; | ||
127 | - | ||
128 | - $template = array( | ||
129 | - 'touser' => $openid, // | ||
130 | - 'template_id' => 'zQaLnhEOQxdGOKJlDUAfEoNY4NTmNWy9a9vYzkZjGn8', //模板消息id 必须修改 | ||
131 | - 'url' => $tourl, //点击链接 | ||
132 | - "miniprogram" => [ | ||
133 | - "appid" => $ywt_appid, | ||
134 | - "pagepath" => $pagepath | 98 | + $appid = 'wxb7dd0c03865a94e0';//公众号的appid |
99 | + $secret = '6af75a6fb8211da45631630e34769f82'; | ||
100 | + // 获取token | ||
101 | + $token=$this->getAccToken($appid,$secret); | ||
102 | + | ||
103 | + //$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=".$token; | ||
104 | + $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$token; | ||
105 | + | ||
106 | + $data = [ | ||
107 | + "touser"=>"o5ABA4yWDTLRTf3LkBMMHoV7XOvQ", | ||
108 | + "appid"=>$appid,//公众号 | ||
109 | + //"template_id"=>"nVfy1Tz1EXQ3T2YcGkwgicAjrD0M3N1Ca-CHIJCwjQY",//模板id | ||
110 | + "template_id"=>"zQaLnhEOQxdGOKJlDUAfEoNY4NTmNWy9a9vYzkZjGn8",//模板id | ||
111 | + "url"=>"", | ||
112 | + "miniprogram"=>[ | ||
113 | + "appid"=>"wx58ceff4e93cfc523",//小程序 | ||
114 | + //"pagepath"=>"/pagesIndex/house/billingDetails?type=3&house_user_id=" . $house_user_id . "&house_code_id=" . $house_code_id//pagesIndex/house/billingDetails 未收账单路径 index?foo=bar | ||
115 | + "pagepath"=>""//pagesIndex/house/billingDetails 未收账单路径 index?foo=bar | ||
135 | ], | 116 | ], |
136 | - 'topcolor' => "#173177", | ||
137 | - 'data' => $info | ||
138 | - ); | ||
139 | - | ||
140 | - $json_template = json_encode($template); | ||
141 | - $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token; | ||
142 | - $json = $this->http_request($url, urldecode($json_template)); | ||
143 | - print_r($json);return; | ||
144 | - | ||
145 | - $rs = json_decode($json, true); | ||
146 | - return $rs; | 117 | + "data"=>[ |
118 | + 'thing2' => array( | ||
119 | + 'value'=>"行程", | ||
120 | + 'color'=>'' | ||
121 | + ), | ||
122 | + 'time3'=>array( | ||
123 | + 'value'=>"2024-06-19", | ||
124 | + 'color'=>'' | ||
125 | + ), | ||
126 | + | ||
127 | + 'thing7'=>array( | ||
128 | + 'value'=>"出发地", | ||
129 | + 'color'=>'' | ||
130 | + ), | ||
131 | + 'phone_number5'=>array( | ||
132 | + 'value'=>"联系方式", | ||
133 | + 'color'=>'' | ||
134 | + ), | ||
135 | + ], | ||
136 | + ]; | ||
137 | + return $this->http_request($url,json_encode($data)); //发送请求 | ||
147 | } | 138 | } |
148 | function http_request($url, $data = array()) | 139 | function http_request($url, $data = array()) |
149 | { | 140 | { |
-
请 注册 或 登录 后发表评论