Browse Source

修改代码

fuyu 5 years ago
parent
commit
316d143ebd
1 changed files with 38 additions and 6 deletions
  1. 38 6
      application/inter/service/WechatService.php

+ 38 - 6
application/inter/service/WechatService.php

@@ -8,9 +8,7 @@ class WechatService {
 
 
   public function pushWechatOrder($exam_id) {
-    var_dump($exam_id);
     $openids = $this->getPushOpenId($exam_id);
-    var_dump($openids);
     if(!$openids) {
       log::record('---------没有找到对应openid--------');
       return false;
@@ -20,19 +18,53 @@ class WechatService {
       $url   = "http://wechat.pacsonline.cn/wx_patient/api/sendMsg?pushType=1&openid=";
       $full_url = $url . $v['openid'];
       // 请求
-      var_dump($full_url);
+      log::record('---------发送微信通知-发起订单-------');
+      log::record($full_url);
       $res = $this->curl_request($full_url, 'GET');
-      var_dump($res);
+      log::record('---------微信通知结果--------');
+      log::record($res);
     }
     return true;
   }
 
-  public function pushWechatCancel() {
+  public function pushWechatCancel($exam_id) {
+    $openids = $this->getPushOpenId($exam_id);
+    if(!$openids) {
+      log::record('---------没有找到对应openid--------');
+      return false;
+    }
 
+    foreach($openids as $v) {
+      $url   = "http://wechat.pacsonline.cn/wx_patient/api/sendMsg?pushType=1&openid=";
+      $full_url = $url . $v['openid'];
+      // 请求
+      log::record('---------发送微信通知-取消订单-------');
+      log::record($full_url);
+      $res = $this->curl_request($full_url, 'GET');
+      log::record('---------微信通知结果--------');
+      log::record($res);
+    }
+    return true;
   }
 
-  public function pushWechatComplete() {
+  public function pushWechatComplete($exam_id) {
+    $openids = $this->getPushOpenId($exam_id);
+    if(!$openids) {
+      log::record('---------没有找到对应openid--------');
+      return false;
+    }
 
+    foreach($openids as $v) {
+      $url   = "http://wechat.pacsonline.cn/wx_patient/api/sendMsg?pushType=1&openid=";
+      $full_url = $url . $v['openid'];
+      // 请求
+      log::record('---------发送微信通知-完成订单-------');
+      log::record($full_url);
+      $res = $this->curl_request($full_url, 'GET');
+      log::record('---------微信通知结果--------');
+      log::record($res);
+    }
+    return true;
   }
 
   private function getPushOpenId($exam_id) {