bingyu-duanxinwangzhan/message-code/message_api/application/common/classLibrary/ClSendMess.php

172 lines
5.1 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: lock
* Date: 2019/6/10
* Time: 11:59 AM
*/
namespace app\common\classLibrary;
class ClSendMess
{
/**
* sendMinProgram
* @param $access_token
* @param $user_openid
* @param $page
* @param $keyword1
* @param $keyword2
* @param $keyword3
* @param $keyword4
* @param $keyword5
* @return bool|mixed
*/
public static function sendMinProgram($access_token,$user_openid,$page,$form_id,$keyword1,$keyword2,$keyword3,$keyword4,$keyword5)
{
$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=".$access_token;
$data = array(
'touser' => $user_openid,
'weapp_template_msg' => array(
'template_id' => '1i7Dl1rpDQyb9cm9WioWSNnogEb2UrfCKCimLy77WhQ',
'page' => $page,
'form_id' => $form_id,
'data' => array(
'keyword1' => array(
'value' => $keyword1
),
'keyword2' => array(
'value' => $keyword2
),
'keyword5' => array(
'value' => $keyword5
),
'keyword3' => array(
'value' => $keyword3
),
'keyword4' => array(
'value' => $keyword4
),
),
"emphasis_keyword" => "keyword1.DATA"
)
);
$rs = ClWechat::http_post($url,json_encode($data));
return $rs;
}
/**
* sendPaySuccess
* @param $access_token
* @param $user_openid
* @param $template_id
* @param $page
* @param $keyword1
* @param $keyword2
* @param $keyword3
* @return bool|mixed
*/
public static function sendPaySuccess($access_token,$user_openid,$page,$keyword1,$keyword2,$keyword3)
{
$url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".$access_token;
$data = array(
'touser' => $user_openid,
'template_id' => '3zFTB1VNypeHU2f1zgyPU5rBW8-ZBJB5vWRZ6hXuYRM',
'page' => $page,
'data' => array(
'thing6' => array(
'value' => $keyword1
),
'amount3' => array(
'value' => $keyword2
),
'date8' => array(
'value' => $keyword3
)
)
);
$rs = ClWechat::http_post($url,json_encode($data));
return $rs;
}
/**
* sendCommentMessage
* @param $access_token
* @param $user_openid
* @param $page
* @param $keyword1
* @param $keyword2
* @param $keyword3
* @param $keyword4
* @return bool|mixed
*/
public static function sendCommentMessage($access_token,$user_openid,$page,$keyword1,$keyword2,$keyword3,$keyword4)
{
$url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".$access_token;
$data = array(
'touser' => $user_openid,
'template_id' => 'BznxFdtj_sAhxLSeFITZJiGEtLbj0-2WaywVBMFmVCE',
'page' => $page,
'data' => array(
'amount5' => array(
'value' => $keyword1
),
'thing3' => array(
'value' => $keyword2
),
'character_string1' => array(
'value' => $keyword3
),
'date2' => array(
'value' => $keyword4
),
'thing4' => array(
'value' => '点击评价'
)
)
);
$rs = ClWechat::http_post($url,json_encode($data));
return $rs;
}
/**
* sendActiveMessage
* @param $access_token
* @param $user_openid
* @param $page
* @param $keyword1
* @param $keyword2
* @param $keyword3
* @param $keyword4
* @return bool|mixed
*/
public static function sendActiveMessage($access_token,$user_openid,$page,$keyword1,$keyword2,$keyword3,$keyword4,$keyword5)
{
$url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".$access_token;
$data = array(
'touser' => $user_openid,
'template_id' => 'cZdc63rPKrjGFx4gsdrdcMDgZto5CnHnf4r2_HasdeE',
'page' => $page,
'data' => array(
'thing10' => array(
'value' => $keyword1
),
'thing11' => array(
'value' => $keyword2
),
'date5' => array(
'value' => $keyword3
),
'thing6' => array(
'value' => $keyword4
),
'phone_number7' => array(
'value' => $keyword5
)
)
);
$rs = ClWechat::http_post($url,json_encode($data));
return $rs;
}
}