fuyu пре 5 година
родитељ
комит
1210dd54f8

+ 3 - 1
application/inter/controller/Application.php

@@ -275,8 +275,10 @@ class Application extends Base
     }
      *")
      **/
-    public function apply(){
+    public function apply(WechatService $wechatService){
         try{
+            var_dump(1);
+            var_dump($wechatService);
             log::record($_REQUEST);
             $sessionid = $_REQUEST['sessionid'];
             $doctor = Cache::get($sessionid);

+ 8 - 9
application/inter/service/WechatService.php

@@ -4,9 +4,9 @@ namespace app\inter\service;
 use think\Db;
 
 class WechatService {
-  public static function pushWechatOrder($exam_id) {
+  public function pushWechatOrder($exam_id) {
     var_dump($exam_id);
-    $openids = self::getPushOpenId($exam_id);
+    $openids = $this->getPushOpenId($exam_id);
     var_dump($openids);
     if(!$openids) {
       log::record('---------没有找到对应openid--------');
@@ -17,21 +17,21 @@ class WechatService {
       $url   = "http://wechat.pacsonline.cn/wx_patient/api/sendMsg?pushType=1&openid=";
       $full_url = $url . $v['openid'];
       // 请求
-      $res = self::curl_request($full_url, 'GET');
+      $res = $this->curl_request($full_url, 'GET');
     }
     return true;
     // http://wechat.pacsonline.cn/wx_patient/api/sendMsg?pushType=1&openid=
   }
 
-  public static function pushWechatCancel() {
+  public function pushWechatCancel() {
 
   }
 
-  public static function pushWechatComplete() {
+  public function pushWechatComplete() {
 
   }
 
-  private static function getPushOpenId($exam_id) {
+  private function getPushOpenId($exam_id) {
     $exams = DB::table("exams")
     ->alias('e')
     ->join('studies s', 'e.study_id = s.id')
@@ -39,7 +39,6 @@ class WechatService {
     ->field('e.patient_id, s.accession_num, s.studyid, pi.temp_patient_id, pi.card_num, pi.phone')
     ->where('e.id', $exam_id)
     ->find();
-
     if(!$exams) {
       return false;
     }
@@ -81,7 +80,7 @@ class WechatService {
     return Db::query($sql, $options);
   }
 
-  private static function curl_request($url,$method='get',$data=null,$https=true){
+  private function curl_request($url,$method='get',$data=null,$https=true){
     //1.初识化curl
     $ch = curl_init($url);
     //2.根据实际请求需求进行参数封装
@@ -104,5 +103,5 @@ class WechatService {
     //4.返回返回值,关闭连接
     curl_close($ch);
     return $result;
-}
+  }
 }