|
@@ -6,9 +6,8 @@ use think\Session;
|
|
|
use think\Db;
|
|
|
class WeChart {
|
|
|
|
|
|
- protected $app_id ='wx7a5f15ddeda9ef5a';
|
|
|
- protected $app_secret = 'a4c33b42917949652c31447e42132de0';
|
|
|
-
|
|
|
+ protected $app_id ='wx4ccfaf737dd24004';
|
|
|
+ protected $app_secret = 'a7a7e0e7e3ce132f751e85202a09e0dc';
|
|
|
|
|
|
/**
|
|
|
* 获取token
|
|
@@ -28,48 +27,55 @@ class WeChart {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function send_message($order_sn=''){
|
|
|
-
|
|
|
+ public function sendMsg($openid,$jump_url)
|
|
|
+ {
|
|
|
+ $access_token = $this->getAccessToken();
|
|
|
$url='https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token='.$access_token;
|
|
|
- $order = Db::name('StoreOrder')->field('id,order_sn,create_at,num,take_time,user_id,goods_id')->where('order_sn',$order_sn)->find();
|
|
|
- $member = Db::name('storeMember')->field('id,vip_level,openid,username,nickname')->where('id',$order['user_id'])->find();
|
|
|
- $book_book = Db::name('book_book')->field('id,title')->where('id',$order['goods_id'])->find();
|
|
|
$data=[
|
|
|
- 'touser'=>$member['openid'],
|
|
|
+ 'touser'=>$openid,
|
|
|
'mp_template_msg'=>[
|
|
|
- "appid"=>"wx3346d52f010b611d",
|
|
|
- "template_id"=>"SH6KcRTVDiU0-7cSDujHsCg8MhbgzGpHb8US1QiPYW0",
|
|
|
- "url"=>"http://www.baidu.com",
|
|
|
+ "appid"=>"wx8e881917d7c4c283",// 公众号
|
|
|
+ "template_id"=>"2n42cwWat6UsokuOd9uqYAKIOF4Jbezw7hwVht11pz4",
|
|
|
+ "url"=>$jump_url,
|
|
|
'miniprogram'=>[
|
|
|
- "appid"=>"wx2b03c73ff0547cc3",
|
|
|
+ "appid"=>"wx4ccfaf737dd24004",// 小程序
|
|
|
],
|
|
|
'data'=>[
|
|
|
'first'=>[
|
|
|
- "value"=>'恭喜你已借阅到该图书',
|
|
|
+ "value"=>'一剑霜寒',
|
|
|
"color"=>"#173177"
|
|
|
],
|
|
|
'keyword1'=>[
|
|
|
- "value"=>$book_book['title'],
|
|
|
+ "value"=>'临沂',
|
|
|
"color"=>"#173177"
|
|
|
],
|
|
|
'keyword2'=>[
|
|
|
- "value"=>$member['username']?$member['username']:$member['nickname'],
|
|
|
+ "value"=>'2021-10-20',
|
|
|
"color"=>"#173177"
|
|
|
],
|
|
|
'keyword3'=>[
|
|
|
- "value"=>date('Y-m-d H:i:s',time()),
|
|
|
+ "value"=>'20:30',
|
|
|
+ "color"=>"#173177"
|
|
|
+ ],
|
|
|
+ 'keyword4'=>[
|
|
|
+ "value"=>'李白刷野',
|
|
|
+ "color"=>"#173177"
|
|
|
+ ],
|
|
|
+ 'keyword5'=>[
|
|
|
+ "value"=>'20:30',
|
|
|
"color"=>"#173177"
|
|
|
],
|
|
|
'remark'=>[
|
|
|
- "value"=>'谢谢你对哩哈教育的支持!',
|
|
|
+ "value"=>'屋里割草',
|
|
|
"color"=>"#173177"
|
|
|
]
|
|
|
]
|
|
|
],
|
|
|
];
|
|
|
- $res = requestPost($url,json_encode($data));
|
|
|
+ $res = http_curl($url,'post',$data);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|