Selaa lähdekoodia

人才购房系统

linwu 3 vuotta sitten
vanhempi
commit
4052496075

+ 47 - 33
app/Http/Controllers/Web/Content/BuyhouseController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Web\Content;
 
 use App\Http\Controllers\Web\WebBaseController;
 use App\Models\Article;
+use App\Models\Resume;
 use App\Models\TalentHouse;
 use App\Models\TalentHouseApply;
 use App\Services\Content\ArticleService;
@@ -26,6 +27,7 @@ class BuyhouseController extends WebBaseController
     private $tag_status = ['', 'info', 'success', 'danger'];
     private $apply_status = ['未知', '审核中', '已通过', '已拒绝'];
     private $check_type = ['', 'warning', 'success', 'error'];
+    private $talent_level = ['不是人才', '第一层次', '第二层次', '第三层次', '第四层次', '第五层次', '第六层次', '第七层次'];
     protected $articleService;
     protected $articleCategoryService;
     protected $adService;
@@ -111,15 +113,6 @@ class BuyhouseController extends WebBaseController
      */
     public function list(Request $request)
     {
-        $time         = time();
-        $request_post = [
-            'idCards' => ['350524198704156033'],
-            'sign'    => md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi"),
-            'timeStr' => $time,
-        ];
-        $res          = https_request('http://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards', json_encode($request_post), ['Accept:application/json', 'Content-Type:application/json;charset=utf-8']);
-        dd($res);
-
         $login = $this->checkLogin();
         if ($login) {
             return $login;
@@ -132,16 +125,6 @@ class BuyhouseController extends WebBaseController
             return $this->showMessage('该房源不存在或已删除', $back_url, true, '上一页', '3');
         }
 
-        //人才判断
-        /*$time         = time();
-        $request_post = [
-            'idCards' => ['350524198704156033'],
-            'sign'    => md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi"),
-            'timeStr' => $time,
-        ];
-        $res          = https_request('http://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards', json_encode($request_post), ['Accept:application/json', 'Content-Type:application/json;charset=utf-8']);
-        dd($res);*/
-
         //房源信息
         $house = TalentHouse::where('id', $id)->first();
         if (empty($house)) {
@@ -157,13 +140,6 @@ class BuyhouseController extends WebBaseController
         $apply = TalentHouseApply::where('house_id', $id)->where('user_id', $user_id)->first();
         $check = [];
         if ($apply) {
-            $apply['family']             = json_decode($apply['family'], true);
-            $apply['certificates']       = json_decode($apply['certificates'], true);
-            $apply['marry_prove']        = json_decode($apply['marry_prove'], true);
-            $apply['household_register'] = json_decode($apply['household_register'], true);
-            $apply['work_prove']         = json_decode($apply['work_prove'], true);
-            $apply['checked']            = true;
-
             //审核状态
             if ($apply['rs_check_status'] != 2) {
                 $check['status_text'] = '人社局' . $this->apply_status[$apply['rs_check_status']];
@@ -180,16 +156,54 @@ class BuyhouseController extends WebBaseController
                 $check['type']        = 'success';
             }
         } else {
-            $apply = [
-                'family'             => [['relation' => '', 'realname' => '', 'idcard' => '']],
-                'checked'            => true,
-                'certificates'       => [],
-                'marry_prove'        => [],
-                'household_register' => [],
-                'work_prove'         => [],
+            $time   = time();
+            $resume = Resume::where('uid', $user_id)->where('def', 1)->first();
+            if (empty($resume) || empty($resume['idcard'])) {
+                $back_url = route('person.resume');
+                return $this->showMessage('请先填写一份简历', $back_url, true, '上一页', '3');
+            }
+            $request_post = [
+                'idCards' => [$resume['idcard']],
+                'sign'    => mb_strtoupper(md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi")),
+                'timeStr' => (string)$time,
+            ];
+            $res          = https_request('https://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards', json_encode($request_post), ['Content-Type:application/json']);
+            $talent       = json_decode($res, true);
+            if (empty($talent['obj'])) {
+                $back_url = \Illuminate\Support\Facades\URL::previous();
+                return $this->showMessage('您还未认定人才,暂无申报资格', $back_url, true, '上一页', '3');
+            }
+            $talent = $talent['obj'][0];
+            $add    = [
+                'user_id'              => $user_id,
+                'house_id'             => $id,
+                'name'                 => $talent['name'],
+                'mobile'               => $talent['phone'],
+                'native'               => $talent['nativePlace'],
+                'email'                => $talent['email'],
+                'talent_level'         => $this->talent_level[$talent['talentArrange']],
+                'talent_card_validity' => $talent['activeDate'],
+                'talent_tags'          => '',
+                'talent_condition'     => $talent['identifyCondition'],
+                'family'               => json_encode([['relation' => '', 'realname' => '', 'idcard' => '']]),
+                'certificates'         => '[]',
+                'marry_prove'          => '[]',
+                'household_register'   => '[]',
+                'work_prove'           => '[]',
+                'created_at'           => date('Y-m-d H:i:s'),
+                'updated_at'           => date('Y-m-d H:i:s'),
             ];
+            $id     = TalentHouseApply::insertGetId($add);
+            $apply  = TalentHouseApply::find($id);
         }
 
+        $apply['family']             = json_decode($apply['family'], true);
+        $apply['certificates']       = json_decode($apply['certificates'], true);
+        $apply['marry_prove']        = json_decode($apply['marry_prove'], true);
+        $apply['household_register'] = json_decode($apply['household_register'], true);
+        $apply['work_prove']         = json_decode($apply['work_prove'], true);
+        $apply['checked']            = true;
+
         $return_data = [
             'check'  => $check,
             'apply'  => json_encode($apply),

+ 5 - 1
bootstrap/helpers.php

@@ -660,7 +660,7 @@ function _get_baidumap_api()
     return $result;
 }
 
-function https_request($url, $data = null)
+function https_request($url, $data = null,$header = null)
 {
     if (function_exists('curl_init')) {
         $curl = curl_init();
@@ -668,6 +668,10 @@ function https_request($url, $data = null)
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
         curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+        if(!empty($header)){
+            curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
+            curl_setopt($curl, CURLOPT_HEADER, 0);//返回response头部信息
+        }
         if (!empty($data)) {
             curl_setopt($curl, CURLOPT_POST, 1);
             curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

+ 2 - 1
public/themes/default/views/app/content/buyhouse/list.blade.php

@@ -452,7 +452,7 @@
                     <tr style="height:52px;page-break-inside:avoid">
                         <td valign="center" style="width:200px;">
                             <span class="require">*</span>人才工作单位<br/>
-                            (上传在职证明扫描件)<br/>
+                            (上传在职证明扫描件,格式PNG或JPEG)<br/>
                             <a href="" target="_blank" style="color:blue;">点击下载范本</a>
                         </td>
                         <td valign="center" style="width:1000px;">
@@ -524,6 +524,7 @@
                             </p>
                             <el-form-item size="large">
                                 <el-button type="success" @click="submit('userForm')">提交申请</el-button>
+                                <el-button type="info" @click="location.href = '{{route("buyhouse.login")}}'">返回</el-button>
                             </el-form-item>
                         </td>
                     </tr>