|
@@ -6,6 +6,7 @@ use app\enterprise\model\Talent;
|
|
|
use app\common\api\DictApi;
|
|
|
use app\common\api\TalentConditionApi;
|
|
|
use app\common\api\TalentLogApi;
|
|
|
+use app\common\api\TalentState;
|
|
|
|
|
|
/**
|
|
|
* Description of TalentApi
|
|
@@ -30,7 +31,7 @@ class TalentApi {
|
|
|
return Talent::findOrEmpty($id);
|
|
|
}
|
|
|
|
|
|
- public static function getList($request, $checkStates = []) {
|
|
|
+ public static function getList($request, $step = 0) {
|
|
|
$order = trim($request->param("order")) ?: "desc";
|
|
|
$offset = trim($request->param("offset")) ?: 0;
|
|
|
$limit = trim($request->param("limit")) ?: 10;
|
|
@@ -47,68 +48,84 @@ class TalentApi {
|
|
|
if (session("user")["usertype"] == 2) {
|
|
|
$where[] = ["enterprise_id", "=", session("user")["uid"]];
|
|
|
}
|
|
|
- if ($checkStates) {
|
|
|
- $where[] = ["checkState", "in", $checkStates];
|
|
|
- }
|
|
|
- if ($name) {
|
|
|
- $where[] = ["name", "like", "%" . $name . "%"];
|
|
|
- }
|
|
|
- if ($idCard) {
|
|
|
- $where[] = ["card_number", "like", "%" . $idCard . "%"];
|
|
|
- }
|
|
|
- if ($sex) {
|
|
|
- $where[] = ["sex", $sex];
|
|
|
- }
|
|
|
- if ($nation) {
|
|
|
- $where[] = ["nation", $nation];
|
|
|
- }
|
|
|
- if ($nationality) {
|
|
|
- $where[] = ["nationality", $nationality];
|
|
|
- }
|
|
|
- if ($talentArrange) {
|
|
|
- $where[] = ["talent_arrange", $talentArrange];
|
|
|
- }
|
|
|
- if ($checkState) {
|
|
|
- switch ($checkState) {
|
|
|
- case -1:
|
|
|
- $where[] = [["checkState", $checkState], ["isPublic", ">=", 5]];
|
|
|
- break;
|
|
|
+ if ($step) {
|
|
|
+ switch ($step) {
|
|
|
case 1:
|
|
|
- $where[] = [["checkState", $checkState]];
|
|
|
+ $where[] = ["checkState", "in", [TalentState::FST_SAVE, TalentState::BASE_REJECT, TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
|
|
|
+ switch ($checkState) {
|
|
|
+ case -1:
|
|
|
+ $where[] = ["checkState", "=", TalentState::BASE_VERIFY_FAIL];
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ $where[] = ["checkState", "=", TalentState::FST_SAVE];
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $where[] = ["checkState", "=", TalentState::BASE_REJECT];
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $where[] = ["checkState", "=", TalentState::FST_SUBMIT];
|
|
|
+ break;
|
|
|
+ }
|
|
|
break;
|
|
|
case 2:
|
|
|
- $where[] = [["checkState", "in", "5,10"]];
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- $where[] = [["checkState", "not in", "1,5,10"], ["isPublic", "<", 5]];
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- $where[] = [["checkState", 35], ["isPublic", ">=", 5]];
|
|
|
- break;
|
|
|
+ $where[] = ["checkState", "not in", [TalentState::FST_SAVE, TalentState::BASE_REJECT, TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
|
|
|
+ switch ($checkState) {
|
|
|
+ case -1:
|
|
|
+ $where[] = ["checkState", "in", [TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL]];
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ $where[] = ["checkState", "=", TalentState::SCND_SAVE];
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $where[] = ["checkState", "in", [TalentState::FST_VERIFY_REJECT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $where[] = ["checkState", "in", [TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::REVERIFY_PASS, TalentState::ZX_PASS,
|
|
|
+ TalentState::ANNOUNCED_REVERIFY_PASS, TalentState::PUBLISH_PASS]];
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $where[] = ["checkState", "=", TalentState::CERTIFICATED];
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ if ($name) {
|
|
|
+ $where[] = ["name", "like", "%" . $name . "%"];
|
|
|
+ }
|
|
|
+ if ($idCard) {
|
|
|
+ $where[] = ["card_number", "like", "%" . $idCard . "%"];
|
|
|
+ }
|
|
|
+ if ($sex) {
|
|
|
+ $where[] = ["sex", "=", $sex];
|
|
|
+ }
|
|
|
+ if ($nation) {
|
|
|
+ $where[] = ["nation", "=", $nation];
|
|
|
+ }
|
|
|
+ if ($nationality) {
|
|
|
+ $where[] = ["nationality", "=", $nationality];
|
|
|
+ }
|
|
|
+ if ($talentArrange) {
|
|
|
+ $where[] = ["talent_arrange", "=", $talentArrange];
|
|
|
+ }
|
|
|
+ $count = Talent::where($where)->count();
|
|
|
+ $list = Talent::where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
|
|
|
+ $talentTagList = DictApi::selectByParentCode("enterprise_tag"); //单位标签
|
|
|
+ $talentArangeList = DictApi::selectByParentCode("talent_arrange"); //人才层次
|
|
|
+ $industries = DictApi::selectByParentCode("industry_field"); //产业
|
|
|
+ $enterprise = \app\common\model\Enterprise::find(session("user")["uid"]);
|
|
|
+ foreach ($list as $key => $item) {
|
|
|
+ $condition = TalentConditionApi::getOne($item["talent_condition"]);
|
|
|
+ $list[$key]["talentArrangeName"] = isset($talentArangeList[$item["talent_arrange"]]) ? $talentArangeList[$item["talent_arrange"]] : "";
|
|
|
+ $list[$key]["identifyConditionText"] = $condition["name"];
|
|
|
+ $list[$key]["companyIds"] = $condition["companyIds"];
|
|
|
+ $list[$key]["type"] = $enterprise["type"];
|
|
|
+ $list[$key]["enterpriseName"] = $enterprise["name"];
|
|
|
+ $list[$key]["industryName"] = $industries[$enterprise["industryFieldNew"]];
|
|
|
+ $list[$key]["enterpriseTagName"] = $talentTagList[$enterprise["enterpriseTag"]];
|
|
|
+ $last_log = TalentLogApi::getLastLog($item["id"], 1);
|
|
|
+ $list[$key]["real_state"] = $last_log["state"];
|
|
|
+ }
|
|
|
+ return ["total" => $count, "rows" => $list];
|
|
|
}
|
|
|
- if ($request->param("type") == 2) {
|
|
|
- $where[] = [["checkState", 35], ["isPublic", 6]];
|
|
|
- }
|
|
|
- $count = Talent::where($where)->count();
|
|
|
- $list = Talent::where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
|
|
|
- $talentTagList = DictApi::selectByParentCode("enterprise_tag"); //单位标签
|
|
|
- $talentArangeList = DictApi::selectByParentCode("talent_arrange"); //人才层次
|
|
|
- $industries = DictApi::selectByParentCode("industry_field"); //产业
|
|
|
- $enterprise = \app\common\model\Enterprise::find(session("user")["uid"]);
|
|
|
- foreach ($list as $key => $item) {
|
|
|
- $condition = TalentConditionApi::getOne($item["talent_condition"]);
|
|
|
- $list[$key]["talentArrangeName"] = isset($talentArangeList[$item["talent_arrange"]]) ? $talentArangeList[$item["talent_arrange"]] : "";
|
|
|
- $list[$key]["identifyConditionText"] = $condition["name"];
|
|
|
- $list[$key]["companyIds"] = $condition["companyIds"];
|
|
|
- $list[$key]["type"] = $enterprise["type"];
|
|
|
- $list[$key]["enterpriseName"] = $enterprise["name"];
|
|
|
- $list[$key]["industryName"] = $industries[$enterprise["industryFieldNew"]];
|
|
|
- $list[$key]["enterpriseTagName"] = $talentTagList[$enterprise["enterpriseTag"]];
|
|
|
- $last_log = TalentLogApi::getLastLog($item["id"], 1);
|
|
|
- $list[$key]["real_state"] = $last_log["state"];
|
|
|
- }
|
|
|
- return ["total" => $count, "rows" => $list];
|
|
|
}
|
|
|
|
|
|
}
|