예제 #1
0
 function job_pos()
 {
     $uid = $this->user['id'];
     if (IS_POST) {
         $job_id = intval($_POST['job_id']);
         $type = I("post.type");
         if ($job_id == 0) {
             Utils::resOut(-1, '参数错误');
             exit;
         }
         if ($type != 'emergency' && $type != 'recommend' && $type != 'highlight') {
             Utils::resOut(-1, '推广类型错误');
             exit;
         }
         $start_time = I("post.start_time");
         $end_time = I("post.end_time");
         $now = date("Y-m-d", time());
         if ($start_time < $now) {
             Utils::resOut(-1, '开始时间不能在今天之前');
             exit;
         }
         $start_time = strtotime($start_time);
         $end_time = strtotime($end_time);
         $days = ($end_time - $start_time) / (24 * 3600) + 1;
         if ($start_time > $end_time) {
             Utils::resOut(-1, '开始时间不能大于结束时间');
             exit;
         }
         $end_time = $end_time + 24 * 3600;
         //查询需花费金额
         $cost = M("CostConfig");
         $res = $cost->field("name,value")->where("name='{$type}'")->select();
         if (!$res) {
             Utils::resOut(-1, '推广类型错误');
         }
         //查询是否重复推广
         $job_posM = M("JobPos");
         $jobPosData = $job_posM->where("type='{$type}' and job_id={$job_id}")->select();
         if ($jobPosData) {
             foreach ($jobPosData as $k => $v) {
                 if ($start_time >= $v['start_time'] && $start_time <= $v['end_time']) {
                     Utils::resOut(-1, '此时间段已经有推广了,无需重复添加');
                     exit;
                 }
                 if ($end_time > $v['end_time'] && $start_time <= $v['end_time']) {
                     Utils::resOut(-1, '此时间段已经有推广了,无需重复添加');
                     exit;
                 }
             }
         }
         //查询用户余额
         $ac = M("Account");
         $resUser = $ac->where("uid={$uid}")->select();
         $costMoney = $res[0]['value'] * $days;
         $yue = $resUser[0]['money'];
         if ($costMoney > $yue) {
             Utils::resOut(-1, '对不起您的余额不足');
             exit;
         }
         $data['job_id'] = $job_id;
         $data['type'] = $type;
         $data['start_time'] = $start_time;
         $data['end_time'] = $end_time;
         $data['status'] = 1;
         $res = M("JobPos")->add($data);
         if ($res) {
             //扣除钱
             $up['money'] = $yue - $costMoney;
             $ac->where("uid={$uid}")->save($up);
             logCost($this->user['id'], $costMoney, 1, $type);
             Utils::resOut(0, '操作成功');
             exit;
         } else {
             Utils::resOut(-1, '操作失败');
             exit;
         }
     }
     if (!isset($_GET['id']) || !isset($_GET['type'])) {
         $this->error('访问出错');
         exit;
     }
     $id = intval($_GET['id']);
     $resJob = $this->jobs->where("uid={$uid}")->find($id);
     if (!$resJob) {
         $this->error('您访问的页面不存在');
         exit;
     }
     $type = I('get.type');
     //查询此操作需要多少钱
     $cres = M("CostConfig")->where("name='{$type}'")->select();
     if (!$cres) {
         $this->error('此操作不存在');
         exit;
     }
     $costMoney = $cres[0]['value'];
     $this->assign("job", $resJob);
     $this->assign("costMoney", $costMoney);
     if ($type == 'recommend') {
         $typeV = '置顶';
     } elseif ($type == 'highlight') {
         $typeV = '高亮';
     } else {
         $typeV = '加急';
     }
     $this->assign("type", $typeV);
     //我的余额
     $acM = M("Account")->field('money')->where("uid={$uid}")->select();
     $this->assign('yue', $acM[0]['money']);
     $this->display();
 }
예제 #2
0
 function upload_identify()
 {
     $uid = $_SESSION['user']['id'];
     $utype = $_SESSION['user']['utype'];
     $user = new MemberModel();
     $res = $user->audit_status($uid);
     $ustatus = $res['audit'];
     if ($utype == 1) {
         if ($ustatus == 1) {
             if ($res['identify_z'] && $res['identify_f']) {
                 Utils::resOut('-1', '您提交的资料正在验证');
                 exit;
             }
         }
     }
     if ($utype == 2) {
         if ($ustatus == 1) {
             Utils::resOut('-1', '您提交的资料正在验证');
             exit;
         }
     }
     if ($ustatus == 2) {
         Utils::resOut('-1', '您已经通过认证,无需在认证');
         exit;
     }
     if (!isset($_GET['act'])) {
         Utils::resOut(-1, '非法访问1');
         exit;
     } elseif ($_GET['act'] != 'z' && $_GET['act'] != 'f' && $_GET['act'] != 'l') {
         Utils::resOut(-1, '非法访问2');
         exit;
     }
     $act = I('get.act');
     if ($act == 'l' && $utype == 1) {
         Utils::resOut('-4', '您是个人用户不能上传营业执照');
         exit;
     }
     if ($act == 'z' || $act == 'f' && $utype == 2) {
         if ($utype == 2) {
             Utils::resOut('-4', '您是企业用户不能上传身份证');
             exit;
         }
     }
     $upload = new \Think\Upload();
     $upload->maxSize = 3145728;
     $upload->exts = array("jpg", "gif", "png", "jpeg");
     $upload->rootPath = "./data/upload/";
     $upload->savePath = "";
     $info = $upload->upload();
     if (!$info) {
         Utils::resOut(-2, $upload->getError());
         exit;
     }
     $rootPath = substr($upload->rootPath, 2);
     $img_path = $rootPath . $upload->savePath . "/" . $info['file']['savepath'] . $info['file']['savename'];
     //开始更新字段
     if ($act == 'z') {
         $field = $img_path;
         $utype = 1;
     } elseif ($act == 'f') {
         $data['identify_f'] = $img_path;
         $data['utype'] = 1;
     } else {
         $data['license'] = $img_path;
         $data['utype'] = 2;
     }
     $res = $user->identify($img_path, $act, $utype);
     if ($res) {
         Utils::resOut('0', $img_path);
         exit;
     } else {
         Utils::resOut('-3', '更新失败,请重试');
         exit;
     }
 }
예제 #3
0
 function get_son_cate()
 {
     if (IS_AJAX && IS_POST) {
         if (!isset($_POST['id'])) {
             Utils::resOut(-1, 'id未传');
             exit;
         }
         $id = intval($_POST['id']);
         $cate = M("Cate");
         $data = $cate->where("parent={$id}")->select();
         Utils::resOut(0, $data);
     }
 }
예제 #4
0
 function refreshResume()
 {
     if (IS_AJAX) {
         if (!isset($_POST['rid'])) {
             Utils::resOut(-1, '简历参数有误');
             exit;
         }
         $rid = intval($_POST['rid']);
         $data['refreshtime'] = time();
         $res = $this->resume->aeresume($data, 1, $rid);
         if ($res) {
             Utils::resOut(0, '刷新成功');
             exit;
         } else {
             Utils::resOut(-1, '刷新失败');
             exit;
         }
     }
 }