|
@@ -97,6 +97,16 @@ class TalentBasicChange extends EnterpriseController {
|
|
|
$response->msg = "修改成功";
|
|
|
return $response;
|
|
|
} else {
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["checkState", "<>", 3];
|
|
|
+ $where[] = ["oldIdCard", "=", $talentInfo["card_number"]];
|
|
|
+ $exist = TbcModel::where($where)->find();
|
|
|
+ if ($exist) {
|
|
|
+ $response->code = 500;
|
|
|
+ $response->msg = "已经存在变更记录,不能重复添加";
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
$data["id"] = getStringId();
|
|
|
$data["oldName"] = $talentInfo["name"];
|
|
|
$data["oldNationality"] = $talentInfo["nationality"];
|
|
@@ -141,31 +151,19 @@ class TalentBasicChange extends EnterpriseController {
|
|
|
$where[] = ["enterprise_id", "=", $this->user["uid"]];
|
|
|
$where[] = ["id", "not in", $changes];
|
|
|
$where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
|
|
|
-
|
|
|
- $twiceIdentifyPersons = \app\common\api\VerifyApi::getTwiceIdentifyPersons();
|
|
|
- if ($twiceIdentifyPersons) {
|
|
|
- $_whr = $where;
|
|
|
- $where[] = ["card_number", "not in", $twiceIdentifyPersons];
|
|
|
- $_whr[] = ["card_number", "in", $twiceIdentifyPersons];
|
|
|
- $tmpList = \app\enterprise\model\Talent::where($_whr)->field("id,name")->select()->toArray();
|
|
|
-
|
|
|
- $twiceIdentifyPersonList = [];
|
|
|
- foreach ($tmpList as $person) {
|
|
|
- if (!$twiceIdentifyPersonList[$person["card_number"]]) {
|
|
|
- $twiceIdentifyPersonList[$person["card_number"]] = $person;
|
|
|
- } else {
|
|
|
- if ($person["talent_arrange"] < $twiceIdentifyPersonList[$person["card_number"]]["talent_arrange"]) {
|
|
|
- $twiceIdentifyPersonList[$person["card_number"]] = $person;
|
|
|
- }
|
|
|
+ $list = \app\enterprise\model\Talent::where($where)->field("id,name,card_number,talent_arrange")->select()->toArray();
|
|
|
+ $checkList = [];
|
|
|
+ foreach ($list as $item) {
|
|
|
+ if ($checkList[$item["card_number"]]) {
|
|
|
+ if ($item["talent_arrange"] < $checkList[$item["card_number"]]["talent_arrange"]) {
|
|
|
+ $checkList[$item["card_number"]] = $item;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ $checkList[$item["card_number"]] = $item;
|
|
|
}
|
|
|
- sort($twiceIdentifyPersonList);
|
|
|
- }
|
|
|
- $list = \app\enterprise\model\Talent::where($where)->field("id,name")->select()->toArray();
|
|
|
- if ($twiceIdentifyPersonList) {
|
|
|
- $list = array_merge($twiceIdentifyPersonList, (array) $list);
|
|
|
}
|
|
|
- $assigns["list"] = $list;
|
|
|
+ sort($checkList);
|
|
|
+ $assigns["list"] = $checkList;
|
|
|
}
|
|
|
$assigns["type"] = $this->user["type"];
|
|
|
$assigns["row"] = $info;
|