Esempio n. 1
0
 function apply_job()
 {
     if (IS_AJAX) {
         $uid = $this->user['id'];
         $jid = intval($_POST['jid']);
         $rid = intval($_POST['rid']);
         if (!Utils::isPositiveInt($jid)) {
             Utils::resOut(-1, '职位参数有误');
             exit;
         }
         $res = $this->jobs->applyJob($uid, $jid, $rid);
         if ($res == -2) {
             Utils::resOut(-2, '该职位不存在');
             exit;
         } elseif ($res == -3) {
             Utils::resOut(-3, '不能申请自己的职位');
             exit;
         } elseif ($res == -4) {
             Utils::resOut(-4, '简历不存在');
             exit;
         } elseif ($res == -5) {
             Utils::resOut(-5, '申请失败,请重试');
             exit;
         } else {
             Utils::resOut(0, '申请成功');
             exit;
         }
     }
 }
 function aeresume()
 {
     if (IS_POST) {
         $data['title'] = I('post.title');
         $data['name'] = I('post.name');
         $data['age'] = I('post.age');
         $data['gender'] = I('post.gender');
         $data['live_place'] = I('post.live_place');
         $data['email'] = I('post.email');
         $data['tel'] = I('post.tel');
         $data['height'] = I('post.height');
         $data['degree'] = I('post.degree');
         $data['resume_content'] = I('post.resume_content');
         if ($data['title'] == '' || strlen($data['title']) > 60) {
             Utils::resOut(-1, '简历名称不能为空,或者超过60个字符');
             exit;
         }
         if ($data['name'] == '' || strlen($data['name']) > 20) {
             Utils::resOut(-1, '姓名不能为空,或者超过20个字符');
             exit;
         }
         if ($data['gender'] != 1 && $data['gender'] != 0) {
             Utils::resOut(-1, '请选择性别');
             exit;
         }
         if (!Utils::isPositiveInt($data['age'])) {
             Utils::resOut(-1, '年龄必须是整数');
             exit;
         }
         if ($data['live_place'] == '' || strlen($data['live_place']) > 60) {
             Utils::resOut(-1, '居住地不能为空,或者超过60个字符');
             exit;
         }
         if (!Utils::isPhoneNum($data['tel'])) {
             Utils::resOut(-1, '手机号码格式有误');
             exit;
         }
         if ($data['email'] != '' && !Utils::isPositiveInt($data['email'])) {
             Utils::resOut(-1, '邮箱格式有误');
             exit;
         }
         $degree = array("小学", '初中', '高中/专科', '大专', '本科', '硕士', '博士', '其他');
         if (!in_array($data['degree'], $degree)) {
             Utils::resOut(-1, '学历有误');
             exit;
         }
         if (!Utils::isPositiveInt($data['height']) && $data['height'] != '') {
             Utils::resOut(-1, '身高只能是整数');
             exit;
         }
         if (strlen($data['resume_content']) < 10 && strlen($data['resume_content']) > 300) {
             Utils::resOut(-1, '工作经历字数必须在10到300之间');
             exit;
         }
         if (isset($_POST['rid']) && $_POST['rid'] > 0) {
             $rid = intval($_POST['rid']);
             $up = 1;
         } else {
             $rid = '';
             $up = 0;
         }
         //            print_r($_POST);die();
         $res = $this->resume->aeresume($data, $up, $rid);
         if ($up) {
             $msg = '修改';
         } else {
             $msg = '新增';
         }
         if (!$res) {
             Utils::resOut('-1', $msg . '简历失败');
             exit;
         } else {
             Utils::resOut(0, $msg . '简历成功');
             exit;
         }
     }
     if (isset($_GET['rid'])) {
         $rid = intval($_GET['rid']);
         $res = $this->resume->getResumeById($rid, $this->user['id']);
         if (!$res) {
             $this->error("访问出错");
             exit;
         }
         $this->assign("resume", $res);
         $this->assign("edit", 1);
     }
     $this->assign("country", M("Region")->where("type=0")->select());
     $this->display();
 }