Browse Source

修复工作单位变更提交时“未匹配到人才数据”

sugangqiang 1 năm trước cách đây
mục cha
commit
deb6dbbfb6
1 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 17 1
      app/enterprise/controller/TalentWorkUnitChange.php

+ 17 - 1
app/enterprise/controller/TalentWorkUnitChange.php

@@ -76,7 +76,11 @@ class TalentWorkUnitChange extends EnterpriseController {
             if ($check->code == 500) {
                 return $check;
             }
-            $talentInfo = \app\common\api\VerifyApi::getTalentInfoById($request["talentId"]);
+            if (strlen($info["talentId"]) == 19) {
+                $newTalentInfo = $this->getTalentInfoByIdCard($info["idCard"]);
+                $info["talentId"] = $newTalentInfo["id"];
+            }
+            $talentInfo = \app\common\api\VerifyApi::getTalentInfoById($info["talentId"]);
             if (!$talentInfo) {
                 $response->msg = "未匹配到人才数据";
                 return $response;
@@ -203,6 +207,18 @@ class TalentWorkUnitChange extends EnterpriseController {
         return $response;
     }
 
+    private function getTalentInfoByIdCard($idCard, $active = null) {
+        //$where[] = ["enterprise_id", "=", $this->user["uid"]];
+        $where[] = ["card_number", "=", $idCard];
+        $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+        $where[] = ["delete", "=", 0];
+        if ($active) {
+            $where[] = ["active", "=", $active];
+        }
+        $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+        return $ti;
+    }
+
     private function dataCheck($data) {
         $response = new \stdClass();
         $response->code = 500;