12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace app\enterprise\api;
- use app\enterprise\model\Talent;
- use app\common\api\DictApi;
- /**
- * Description of TalentApi
- *
- * @author sgq
- */
- class TalentApi {
- public static function getList($request) {
- $order = trim($request->param("order")) ?: "desc";
- $offset = trim($request->param("offset")) ?: 0;
- $limit = trim($request->param("limit")) ?: 10;
- $name = trim($request->param("name"));
- $idCard = trim($request->param("idCard"));
- $sex = trim($request->param("sex"));
- $nation = trim($request->param("nation"));
- $nationality = trim($request->param("nationality"));
- $talentType = trim($request->param("talentType"));
- $talentArrange = trim($request->param("talentArrange"));
- $checkState = trim($request->param("checkState"));
- $where = [];
- if ($name) {
- $where[] = ["name", "like", "%" . $name . "%"];
- }
- if ($idCard) {
- $where[] = ["idCard", "like", "%" . $idCard . "%"];
- }
- if ($sex) {
- $where[] = ["sex", $sex];
- }
- if ($nation) {
- $where[] = ["nation", $nation];
- }
- if ($nationality) {
- $where[] = ["nationality", $nationality];
- }
- if ($talentType) {
- $where[] = ["talentType", $talentType];
- }
- if ($talentArrange) {
- $where[] = ["name", $talentArrange];
- }
- if ($checkState) {
- switch ($checkState) {
- case -1:
- $where[] = [["checkState", $checkState], ["isPublic", ">=", 5]];
- break;
- case 1:
- $where[] = [["checkState", $checkState]];
- 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;
- }
- }
- 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();
- $talentTypeList = DictApi::selectByParentCode("un_jbt_talentType"); //人才标签
- $talentArangeList = DictApi::selectByParentCode("un_talentLevel");//人才层次
- //$talentTypeNameList = DictApi::selectByParentCode("un_talentLevel");//认定条件
- //DictApi::selectByParentCode($code);
- foreach ($list as $key => $item) {
- $list[$key]["talentArrangeName"] = $talentArangeList[$item["talentArrange"]];
- $list[$key]["talentTypeName"] = $talentTypeList[$item["talentType"]];
- $list[$key]["identifyConditionText"] = "";
- }
- return ["total" => $count, "rows" => $list];
- }
- }
|