sugangqiang 1 سال پیش
والد
کامیت
e72325ac0d
1فایلهای تغییر یافته به همراه14 افزوده شده و 10 حذف شده
  1. 14 10
      app/enterprise/controller/Talent.php

+ 14 - 10
app/enterprise/controller/Talent.php

@@ -1603,27 +1603,31 @@ class Talent extends EnterpriseController {
             $where[] = ["card_number", "not in", $sList];
         }
         $twiceIdentifyPersons = \app\common\api\VerifyApi::getTwiceIdentifyPersons();
-        if ($twiceIdentifyPersons) {
+        if ($twiceIdentifyPersons && $type == ProjectState::LEVELCHANGE) {
             $_whr = $where;
-            $where[] = ["card_number", "not in", $twiceIdentifyPersons];
             $_whr[] = ["card_number", "in", $twiceIdentifyPersons];
-            $tmpList = TalentModel::where($_whr)->field("id,name")->select()->toArray();
+            $tmpList = TalentModel::where($_whr)->field("id,name,card_number")->select()->toArray();
 
             $twiceIdentifyPersonList = [];
-            foreach ($tmpList as $person) {
-                if (!$twiceIdentifyPersonList[$person["card_number"]]) {
-                    $twiceIdentifyPersonList[$person["card_number"]] = $person;
+            foreach ($tmpList as $key => $person) {
+                $_cardNumber = $person["card_number"];
+                if (!$twiceIdentifyPersonList[$_cardNumber]) {
+                    $twiceIdentifyPersonList[$_cardNumber] = $person;
                 } else {
-                    if ($person["talent_arrange"] < $twiceIdentifyPersonList[$person["card_number"]]["talent_arrange"]) {
-                        $twiceIdentifyPersonList[$person["card_number"]] = $person;
+                    if ($person["talent_arrange"] < $twiceIdentifyPersonList[$_cardNumber]["talent_arrange"]) {
+                        $twiceIdentifyPersonList[$_cardNumber] = $person;
                     }
                 }
             }
             sort($twiceIdentifyPersonList);
         }
-        $result = TalentModel::where($where)->field("id,name")->select()->toArray();
+        $result = TalentModel::where($where)->field("id,name,card_number")->select()->toArray();
         if ($twiceIdentifyPersonList) {
-            $result = array_merge($twiceIdentifyPersonList, (array) $result);
+            foreach ($result as &$res) {
+                if ($twiceIdentifyPersonList[$res["card_number"]]) {
+                    $res["id"] = $twiceIdentifyPersonList[$res["card_number"]]["id"];
+                }
+            }
         }
         return json($result);
     }