|
@@ -23,11 +23,11 @@ class WechatService {
|
|
|
// http://wechat.pacsonline.cn/wx_patient/api/sendMsg?pushType=1&openid=
|
|
|
}
|
|
|
|
|
|
- public function pushWechatCancel() {
|
|
|
+ public static function pushWechatCancel() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public function pushWechatComplete() {
|
|
|
+ public static function pushWechatComplete() {
|
|
|
|
|
|
}
|
|
|
|
|
@@ -80,4 +80,29 @@ class WechatService {
|
|
|
log::record($sql);
|
|
|
return Db::query($sql, $options);
|
|
|
}
|
|
|
+
|
|
|
+ private function curl_request($url,$method='get',$data=null,$https=true){
|
|
|
+ //1.初识化curl
|
|
|
+ $ch = curl_init($url);
|
|
|
+ //2.根据实际请求需求进行参数封装
|
|
|
+ //返回数据不直接输出
|
|
|
+ curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
|
|
|
+ //如果是https请求
|
|
|
+ if($https === true){
|
|
|
+ curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
|
|
|
+ curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
|
|
|
+ }
|
|
|
+ //如果是post请求
|
|
|
+ if($method === 'post'){
|
|
|
+ //开启发送post请求选项
|
|
|
+ curl_setopt($ch,CURLOPT_POST,true);
|
|
|
+ //发送post的数据
|
|
|
+ curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
|
|
|
+ }
|
|
|
+ //3.发送请求
|
|
|
+ $result = curl_exec($ch);
|
|
|
+ //4.返回返回值,关闭连接
|
|
|
+ curl_close($ch);
|
|
|
+ return $result;
|
|
|
+}
|
|
|
}
|