瀏覽代碼

jjhc开发汇聚接口半自动化版

sandm 2 年之前
父節點
當前提交
83f5433a7c
共有 1 個文件被更改,包括 55 次插入30 次删除
  1. 55 30
      app/Http/Controllers/Web/Talent/JjhcController.php

+ 55 - 30
app/Http/Controllers/Web/Talent/JjhcController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers\Web\Talent;
 
+libxml_disable_entity_loader(false);
 use App\Http\Controllers\Web\WebBaseController;
 use App\Models\RecruitAppointInfo;
 use App\Models\RecruitAppointSelect;
@@ -58,45 +59,69 @@ class JjhcController extends WebBaseController
                 'password'=>'Cxz@1234'
             ];
             $guid =$client->LoginByAccount ($param);
-            $redis->set('sjhj_guid',$guid);
+            $redis->set('sjhj_guid',$guid->return);
             $redis->expire('sjhj_guid',1800);
+            return $guid->return;
         }
 
         return $guid;
     }
 
     public function push(){
+        ini_set('display_errors',1);
+        error_reporting(E_ALL);
         $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
-        ];
+        $index = 0;
+        for ($i = 1;$i<=3;$i++){
+            $list = DB::table("companys")->where('updated_at','>','2019-01-01 00:00:00')->where('huiju',0)->orderBy('created_at','asc')->offset($index)->limit(500)->get();
+            if($list && count($list) > 0){
+                $str = '<?xml version="1.0" encoding="UTF-8"?><table>';
+                $template = '<row type="add">
+    <id name="主键" isattachment="false"><![CDATA[%s]]></id>
+    <username name="企业登录名" isattachment="false"><![CDATA[%s]]></username>
+    <mobile name="手机号" isattachment="false"><![CDATA[%s]]></mobile>
+    <mobile_audit name="手机认证状态" isattachment="false"><![CDATA[%s]]></mobile_audit>
+    <email name="邮箱" isattachment="false"><![CDATA[%s]]></email>
+    <email_audit name="邮箱认证状态" isattachment="false"><![CDATA[%s]]></email_audit>
+    <reg_time name="注册时间" isattachment="false"><![CDATA[%s]]></reg_time>
+    <reg_ip name="注册ip" isattachment="false"><![CDATA[%s]]></reg_ip>
+    <last_login_time name="最后登录时间" isattachment="false"><![CDATA[%s]]></last_login_time>
+    <last_login_ip name="最后登录ip" isattachment="false"><![CDATA[%s]]></last_login_ip>
+    <reg_address name="注册地址" isattachment="false"><![CDATA[%s]]></reg_address>
+    <reg_type name="注册方式" isattachment="false"><![CDATA[%s]]></reg_type>
+    <companyname name="企业名称" isattachment="false"><![CDATA[%s]]></companyname>
+    <certificate_img name="营业执照" isattachment="false"><![CDATA[%s]]></certificate_img>
+    <legal name="法人姓名" isattachment="false"><![CDATA[%s]]></legal>
+    <legal_idcard name="法人身份证" isattachment="false"><![CDATA[%s]]></legal_idcard>
+  </row>';
+
+                foreach ($list as $k => $v){
+                    $certificate_img = empty($v->certificate_img) ? '无' : $v->certificate_img;
+                    $item_str = sprintf($template,$v->id,$v->username,$v->mobile,$v->mobile_audit,$v->email,$v->email_audit,$v->reg_time,$v->reg_ip,$v->last_login_time,$v->last_login_ip,$v->reg_address,$v->reg_type,$v->companyname,$certificate_img,$v->legal,$v->legal_idcard);
+                    $str .= $item_str;
+                }
+                $str .= '</table>';
+
+                try{
+                    $client = new \SoapClient('http://61.131.47.134:8756/Convergence/webservice/ConvergenceService?wsdl');
+                    // 组织参数  根据接口具体提供参数组织对应参数
+                    $param = [
+                        'guid'=>$guid,
+                        'catalogid'=>'WEB2458',
+                        'xmlstr' => $str
+                    ];
 
+                    $res = $client->pushXml($param);
+                    echo $res->return;
+                } catch (\Exception $e){
+                    dd($e->getMessage());
+                }
+            }
+
+
+            $index += 500;
+        }
+        echo $index;
 
     }