Bladeren bron

尝试接口推送

sandm 2 jaren geleden
bovenliggende
commit
4ed9f3e006
2 gewijzigde bestanden met toevoegingen van 54 en 0 verwijderingen
  1. 53 0
      app/Http/Controllers/Web/Talent/JjhcController.php
  2. 1 0
      routes/web.php

+ 53 - 0
app/Http/Controllers/Web/Talent/JjhcController.php

@@ -47,6 +47,59 @@ class JjhcController extends WebBaseController
         return response()->json($data);
     }
 
+    public function getGuid(){
+        $redis = Cache::getRedis();
+        $guid = $redis->get('sjhj_guid');
+        if(!$guid){
+            $client = new \SoapClient("http://222.77.0.158:8090/Convergence/webservice/ConvergenceService?wsdl");
+            // 组织参数  根据接口具体提供参数组织对应参数
+            $param = [
+                'userid'=>'jjswzzb_cxz',
+                'password'=>'Cxz@1234'
+            ];
+            $guid =$client->LoginByAccount ($param);
+            $redis->set('sjhj_guid',$guid);
+            $redis->expire('sjhj_guid',1800);
+        }
+
+        return $guid;
+    }
+
+    public function push(){
+        $guid = $this->getGuid();
+        $list = DB::table("lt_apppointment")->where('huiju',0)->get();
+        $str = '<?xml version="1.0" encoding="UTF-8"?><table>';
+        $template = '<row type="add">
+    <id name="主键" isattachment="false"><![CDATA[%s]></id>
+    <number name="回执单号" isattachment="false"><![CDATA[%s]></number>
+    <username name="姓名" isattachment="false"><![CDATA[%s]></username>
+    <card name="身份证" isattachment="false"><![CDATA[%s]></card>
+    <phone name="手机号" isattachment="false"><![CDATA[%s]></phone>
+    <service name="服务事项" isattachment="false"><![CDATA[%s]></service>
+    <content name="具体事项" isattachment="false"><![CDATA[%s]></content>
+    <is_talent name="是否申报系统人才" isattachment="false"><![CDATA[%s]></is_talent>
+    <status name="状态" isattachment="false"><![CDATA[%s]></status>
+    <evaluate name="评价内容" isattachment="false"><![CDATA[%s]></evaluate>
+    <createtime name="创建时间" isattachment="false"><![CDATA[%s]></createtime>
+</row>';
+        foreach ($list as $k => $v){
+            $time = strtotime($v->createtime);
+            $item_str = sprintf($template,$v->id,$v->number,$v->username,$v->card,$v->phone,$v->service ,$v->content,$v->is_talent,$v->status,$v->evaluate,date("Y/m/d H:i:s",$time));
+            $str .= $item_str;
+        }
+        $str .= '</table>';
+        echo $str;die;
+        $client = new \SoapClient("http://222.77.0.158:8090/Convergence/webservice/ConvergenceService?wsdl");
+        // 组织参数  根据接口具体提供参数组织对应参数
+        $param = [
+            'guid'=>$guid,
+            'catalogid'=>'WEB2443',
+            'xmlstr' => $str
+        ];
+
+
+    }
+
     public function test(Request $request)
     {
         $keyword = $request->input('keyword');

+ 1 - 0
routes/web.php

@@ -909,6 +909,7 @@ Route::group([
     /*$router->get('/bOQ4J1CqySjkWDKh', 'Web\Talent\JjhcController@yqfk')->name('talent.jjhc.yqfk');*/
     $router->post('/yqfk/chaxun', 'Web\Talent\JjhcController@chaxun')->name('talent.jjhc.chaxun');
     $router->get('/test', 'Web\Talent\JjhcController@test')->name('talent.jjhc.test');
+    $router->get('/push','Web\Talent\JjhcController@push')->name('talent.jjhc.push');
 });
 
 Route::group([