You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							36 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
	
	
							36 lines
						
					
					
						
							1.5 KiB
						
					
					
				| <?php
 | |
| namespace LaneWeChat\Core;
 | |
| 
 | |
| class TemplateMessage{
 | |
|     public static function setIndustry($industryId1, $industryId2){
 | |
|         $queryUrl = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=' . AccessToken::getAccessToken(); 
 | |
|         $queryAction = 'POST';
 | |
|         $template = array();
 | |
|         $template['industry_id1'] = "$industryId1";
 | |
|         $template['industry_id2'] = "$industryId2";
 | |
|         $template = json_encode($template);
 | |
|         return Curl::callWebServer($queryUrl, $template, $queryAction);
 | |
|     }
 | |
| 
 | |
|     public static function getTemplateId($templateIdShort){
 | |
|         $queryUrl = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=' . AccessToken::getAccessToken(); 
 | |
|         $queryAction = 'POST';
 | |
|         $template = array();
 | |
|         $template['template_id_short'] = "$templateIdShort";
 | |
|         $template = json_encode($template);
 | |
|         return Curl::callWebServer($queryUrl, $template, $queryAction);
 | |
|     }
 | |
| 
 | |
|     public static function sendTemplateMessage($data, $touser, $templateId, $url, $topcolor='#FF0000'){
 | |
|         $queryUrl = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . AccessToken::getAccessToken(); 
 | |
|         $queryAction = 'POST';
 | |
|         $template = array();
 | |
|         $template['touser'] = $touser;
 | |
|         $template['template_id'] = $templateId;
 | |
|         $template['url'] = $url;
 | |
|         $template['topcolor'] = $topcolor;
 | |
|         $template['data'] = $data;
 | |
|         $template = json_encode($template);
 | |
|         return Curl::callWebServer($queryUrl, $template, $queryAction);
 | |
|     }
 | |
| } |