public function updateUserStatus() { $reasonid = $_POST['reasonid']; $data['audstart'] = $_POST['statused']; if (!empty($_POST['content'])) { $data['audreason'] = $_POST['content']; } if (!empty($_POST['candidate_time'])) { $data['real_audstart_time'] = $_POST['candidate_time']; } $data['audstarttime'] = time(); $status = M("record")->where("id='{$reasonid}'")->save($data); $status = $_POST['statused']; $statusValue = getCascData("audstart", $status, "信息不明"); //推荐info $recordinfo = M("record")->where("id='{$reasonid}'")->find(); /* * *********************【推荐人/企业】【修改面试状态】操作日志 begin*********************************** */ $resumeInfo = M("resume")->where("id=" . $recordinfo['bt_id'])->find(); $arJobInfo = M("job")->where("id=" . $recordinfo['j_id'])->find(); $arCompanyInfo = M("company")->where("id=" . $arJobInfo['cpid'])->find(); if (!$arJobInfo['title']) { $arJobInfo['title'] = M("casclist")->where("id='{$arJobInfo['Jobcate']}'")->getField("cascname"); } if ($data['audreason']) { $arTNoticeInfo = getTNoticeInfo(9, $resumeInfo['username'], $arCompanyInfo['cpname'], $arJobInfo['title'], "", $statusValue, $data['audreason']); $arCNoticeInfo = getCNoticeInfo(9, $arJobInfo['title'], $resumeInfo['username'], $statusValue, $data['audreason']); } else { $arTNoticeInfo = getTNoticeInfo(7, $resumeInfo['username'], $arCompanyInfo['cpname'], $arJobInfo['title'], "", $statusValue); $arCNoticeInfo = getCNoticeInfo(7, $arJobInfo['title'], $resumeInfo['username'], $statusValue); } $sLogtitle = $arTNoticeInfo[0]; $sLogContent = $arTNoticeInfo[1]; addNoticeLog($arCompanyInfo['id'], $arCompanyInfo['username'], $recordinfo['bt_id'], $recordinfo['j_id'], $sLogtitle, $sLogContent); $sLogtitle = $arCNoticeInfo[0]; $sLogContent = $arCNoticeInfo[1]; addNoticeLog($arCompanyInfo['id'], $arCompanyInfo['username'], $recordinfo['bt_id'], $recordinfo['j_id'], $sLogtitle, $sLogContent, 1, 2); /* * *********************【推荐人/企业】【修改面试状态】操作日志 end*********************************** */ //////////////////////////分享职位送大礼///////////////////////////////// if (C("SHARE_JON_OPEN") === true) { // $id = $_POST['rid'] = 499; //如果是活动1并且是已入职状态则查看是否已经为推荐人的来源用户赠送过 $activiteID = C("SHARE_JOB_ID"); if ($status == 6 && $activiteID == 2) { $activeInfo = M("active")->where("id='{$activiteID}' and status=1 and endtime>'" . date("Y-m-d H:i:s") . "'")->find(); if ($activeInfo) { $memberId = $recordinfo['t_id']; $userInfo = M("member")->where("id=" . $memberId . " AND fromwhere='share'")->find(); if ($userInfo) { //如果存在还没有赠送过并且有来源的username,则赠送给分享人金额 $userinfo = M("userinfo")->where("username='******' and fromusername !=''")->find(); if ($userinfo) { $Recorduserinfo = M("userinfo")->where("username='******'")->find(); $accArr = M("account")->where("uid='{$Recorduserinfo['userid']}'")->find(); //查找推荐人之前的账户信息 $time = time(); if (empty($accArr)) { //插入一条信息账户信息到account表中 $sql = "insert into stj_account(uid,username,account,created_at,updated_at) values({$Recorduserinfo['userid']},'{$Recorduserinfo['username']}'," . C('SHARE_JOB_RECORD_SUCCESS') . ",'{$time}','{$time}')"; M("account")->query($sql); $newAccount = C('SHARE_JOB_RECORD_SUCCESS'); $account = 0; } else { //插入一条日志记录到account_balance中 $newAccount = $accArr['account'] + C('SHARE_JOB_RECORD_SUCCESS'); //更新账户表中的金额和更新时间 $sql = "update stj_account set account='{$newAccount}',updated_at='{$time}' where id ={$accArr['id']}"; M("account")->query($sql); $account = $accArr['account']; } $sql = "insert into stj_account_blance(uid,username,last_account,account,incr,operat,`from`,comment,created_at,updated_at) values({$Recorduserinfo[userid]},'{$Recorduserinfo[username]}',{$account},{$newAccount}," . C('SHARE_JOB_RECORD_SUCCESS') . ",'','shareMoney','分享职位成功入职。','{$time}','{$time}')"; M("account_blance")->query($sql); //首次推荐修改状态 $sql = "update stj_share set num=`num`+1 where decrypturl ='{$userinfo['fromwhere']}'"; M("share")->query($sql); } } } } //如果是活动1并且是已入职状态并且此人是通过分享而来则赠送分享人奖励 $activiteID = C("SHARE_JOB_ID"); if ($status == 6 && $activiteID == 2) { $activeInfo = M("active")->where("id='{$activiteID}' and status=1 and endtime>'" . date("Y-m-d H:i:s") . "'")->find(); if ($activeInfo) { $jobInfo = M("job")->where("id='{$recordinfo['j_id']}'")->find(); $memberId = $jobInfo['cpid']; $userInfo = M("company")->where("id=" . $memberId . " AND fromwhere='share'")->find(); if ($userInfo) { //如果存在还没有赠送过并且有来源的username,则赠送给分享人金额 $userinfo = M("userinfo")->where("username='******' and fromusername !=''")->find(); if ($userinfo) { $Recorduserinfo = M("userinfo")->where("username='******'")->find(); $accArr = M("account")->where("uid='{$Recorduserinfo['userid']}'")->find(); //查找推荐人之前的账户信息 $time = time(); if (empty($accArr)) { //插入一条信息账户信息到account表中 $sql = "insert into stj_account(uid,username,account,created_at,updated_at) values({$Recorduserinfo['userid']},'{$Recorduserinfo['username']}'," . C('SHARE_JOB_COMPANY_SUCCESS') . ",'{$time}','{$time}')"; M("account")->query($sql); $newAccount = C('SHARE_JOB_COMPANY_SUCCESS'); $account = 0; } else { //插入一条日志记录到account_balance中 $newAccount = $accArr['account'] + C('SHARE_JOB_COMPANY_SUCCESS'); //更新账户表中的金额和更新时间 $sql = "update stj_account set account='{$newAccount}',updated_at='{$time}' where id ={$accArr['id']}"; M("account")->query($sql); $account = $accArr['account']; } $sql = "insert into stj_account_blance(uid,username,last_account,account,incr,operat,`from`,comment,created_at,updated_at) values({$Recorduserinfo[userid]},'{$Recorduserinfo[username]}',{$account},{$newAccount}," . C('SHARE_JOB_COMPANY_SUCCESS') . ",'','shareMoney','分享职位企业成功入职。','{$time}','{$time}')"; M("account_blance")->query($sql); //首次推荐修改状态 $sql = "update stj_share set num=`num`+1 where decrypturl ='{$userinfo['fromwhere']}'"; M("share")->query($sql); } } } } } ////////////////////////////////推广奖利送大礼//////////////////////////////////////////////////////// if (C("SHARE_RECOMMENDSHARE_OPEN") === true && $status == 6) { $activiteID = C("SHARE_RECOMMENDSHARE_ID"); if ($status == 6 && $activiteID == 4) { $activeInfo = M("active")->where("id='{$activiteID}' and status=1 and endtime>'" . date("Y-m-d H:i:s") . "'")->find(); if ($activeInfo) { $memberId = $recordinfo['t_id']; $userInfo = M("member")->where("id=" . $memberId . " AND fromwhere='recommentshare'")->find(); if ($userInfo) { //如果存在还没有赠送过并且有来源的username,则赠送给分享人金额 $userinfo = M("userinfo")->where("username='******' and fromusername !=''")->find(); if ($userinfo) { $Recorduserinfo = M("userinfo")->where("username='******'")->find(); $accArr = M("account")->where("uid='{$Recorduserinfo['userid']}'")->find(); //查找推荐人之前的账户信息 $time = time(); if (empty($accArr)) { //插入一条信息账户信息到account表中 $sql = "insert into stj_account(uid,username,account,created_at,updated_at) values({$Recorduserinfo['userid']},'{$Recorduserinfo['username']}'," . C('SHARE_RECOMMENDSHARE_RECORD_SUCCESS') . ",'{$time}','{$time}')"; M("account")->query($sql); $newAccount = C('SHARE_RECOMMENDSHARE_RECORD_SUCCESS'); $account = 0; } else { //插入一条日志记录到account_balance中 $newAccount = $accArr['account'] + C('SHARE_RECOMMENDSHARE_RECORD_SUCCESS'); //更新账户表中的金额和更新时间 $sql = "update stj_account set account='{$newAccount}',updated_at='{$time}' where id ={$accArr['id']}"; M("account")->query($sql); $account = $accArr['account']; } $sql = "insert into stj_account_blance(uid,username,last_account,account,incr,operat,`from`,comment,created_at,updated_at) values({$Recorduserinfo[userid]},'{$Recorduserinfo[username]}',{$account},{$newAccount}," . C('SHARE_RECOMMENDSHARE_RECORD_SUCCESS') . ",'','recommendShare ','推广分享奖励。 。','{$time}','{$time}')"; M("account_blance")->query($sql); //首次推荐修改状态 $sql = "update stj_share set num=`num`+1 where decrypturl ='{$userinfo['fromwhere']}'"; M("share")->query($sql); } } } } $activiteID = C("SHARE_RECOMMENDSHARE_ID"); if ($status == 6 && $activiteID == 4) { $activeInfo = M("active")->where("id='{$activiteID}' and status=1 and endtime>'" . date("Y-m-d H:i:s") . "'")->find(); if ($activeInfo) { $jobInfo = M("job")->where("id='{$recordinfo['j_id']}'")->find(); $memberId = $jobInfo['cpid']; $userInfo = M("company")->where("id=" . $memberId . " AND fromwhere='recommentshare'")->find(); if ($userInfo) { //如果存在还没有赠送过并且有来源的username,则赠送给分享人金额 $userinfo = M("userinfo")->where("username='******' and fromusername !=''")->find(); if ($userinfo) { $Recorduserinfo = M("userinfo")->where("username='******'")->find(); $accArr = M("account")->where("uid='{$Recorduserinfo['userid']}'")->find(); //查找推荐人之前的账户信息 $time = time(); if (empty($accArr)) { //插入一条信息账户信息到account表中 $sql = "insert into stj_account(uid,username,account,created_at,updated_at) values({$Recorduserinfo['userid']},'{$Recorduserinfo['username']}'," . C('SHARE_RECOMMENDSHARE_COMPANY_SUCCESS') . ",'{$time}','{$time}')"; M("account")->query($sql); $newAccount = C('SHARE_RECOMMENDSHARE_COMPANY_SUCCESS'); $account = 0; } else { //插入一条日志记录到account_balance中 $newAccount = $accArr['account'] + C('SHARE_RECOMMENDSHARE_COMPANY_SUCCESS'); //更新账户表中的金额和更新时间 $sql = "update stj_account set account='{$newAccount}',updated_at='{$time}' where id ={$accArr['id']}"; M("account")->query($sql); $account = $accArr['account']; } $sql = "insert into stj_account_blance(uid,username,last_account,account,incr,operat,`from`,comment,created_at,updated_at) values({$Recorduserinfo[userid]},'{$Recorduserinfo[username]}',{$account},{$newAccount}," . C('SHARE_RECOMMENDSHARE_COMPANY_SUCCESS') . ",'','recommendShare ','推广分享奖励。','{$time}','{$time}')"; M("account_blance")->query($sql); //首次推荐修改状态 $sql = "update stj_share set num=`num`+1 where decrypturl ='{$userinfo['fromwhere']}'"; M("share")->query($sql); } } } } } // $recordInfo = M("record")->where("id='$reasonid'")->find(); // echo M("record")->getLastSql(); echo json_encode("ok"); }
public function record_save() { $data['j_id'] = $_POST['j_id']; $userinfo = $_COOKIE['userinfo']; if (empty($userinfo)) { setcookie("gourl", "/Home/Webchat/new_job"); echo json_encode(array("code" => 400, "msg" => "未登录")); die; } else { setcookie("gourl", ""); $userinfoArr = unserialize($userinfo); } $uid = $userinfoArr['userid']; $data['t_id'] = $uid; $data['bt_id'] = $_POST['bt_id']; $data['posttime'] = time(); $data['audstartdate'] = $_POST['audstartdate']; $recordOb = M("record"); $re = $recordOb->add($data); if ($re) { /************************【推荐候选人】操作日志 begin***************/ $username = $userinfoArr['username']; $arResume = M("resume")->where("id=" . $data['bt_id'])->find(); $sRecommended = $arResume['username']; //候选人名称 $arJob = M("job")->where("id=" . $data['j_id'])->find(); $sJobTitle = $arJob['title']; //职位名称 if ($sJobTitle == '0') { $sJobTitle = getCascList($arJob['Jobcate'], "信息不明"); } $arCompany = M("company")->where("id=" . $arJob['cpid'])->find(); $sCompanyName = $arCompany['cpname']; //公司名称 $arNotice = getTNoticeInfo(1, $sRecommended, $sCompanyName, $sJobTitle); $sLogtitle = $arNotice[0]; $sLogContent = $arNotice[1]; $bt_id = $data['bt_id']; //简历id $job_id = $data['j_id']; //职位id addNoticeLog($uid, $username, $bt_id, $job_id, $sLogtitle, $sLogContent); /************************【推荐候选人】操作日志 end***************/ echo json_encode(array("code" => "200", "msg" => "保存成功")); die; } else { echo json_encode(array("code" => "500", "msg" => "保存失败")); die; } }
function RecommendTheCandidate3() { $username = $_SESSION['username']; $this->assign("first_class", 3); $this->assign("second_class", 5); //招聘信息ID $data['j_id'] = intval($_REQUEST["jobid"]); if (!is_array($_REQUEST['id']) && $_SESSION['recommend_jobid'] && $_SESSION['recommend_comid']) { //推荐人添加完简历直接过来 $type = 3; $getid = array($_REQUEST['id']); unset($_SESSION['recommend_jobid']); unset($_SESSION['recommend_comid']); } else { $type = 0; $getid = $_REQUEST['id']; //获取选择的复选框的值 } if (!$getid) { $this->error('未选择记录'); //没选择就提示信息 exit; } if ($data['j_id'] <= 0) { $this->error("参数错误"); exit; } $userInfo = M('member')->where("username='******'")->find(); if (empty($userInfo)) { $this->error("您长时间未操作,请登陆后重试"); exit; } //招聘信息 $jobInfos = M("job")->where("id='{$data['j_id']}'")->find(); $cid = $jobInfos['cpid']; if (!$jobInfos['title']) { $jobInfos['title'] = M("casclist")->where("id='{$jobInfos['Jobcate']}'")->getField("cascname"); } $this->assign("jobInfos", $jobInfos); //选择一个以上,就用,把值连接起来(1,2,3)这样 $data['bt_id'] = $getid; $data['t_id'] = $userInfo['id']; /* * *********限制同一个候选人(电话号码相同的所有简历)已经推荐给该职位、限制同一个候选人已经推荐给该公司职位、限制同一个候选人已经推荐给3家公司******* */ for ($j = 0; $j < count($data['bt_id']); $j++) { $where = ""; //查看与该候选人电话号码相同的候选人的简历id $arAllResume = M("resume")->query("select s.id,s.mobile bt_mobile from stj_resume r join stj_resume s on r.id={$data['bt_id'][$j]} and s.mobile=r.mobile "); foreach ($arAllResume as $v) { $where .= " bt_id=" . $v['id'] . " OR"; } $where = "(" . rtrim($where, "OR") . ")"; //判断该候选人是否已经推荐给该职位 // $isRecord = M("record")->where($where . " AND j_id='$jid' and (audstart=1 or audstart=3 or audstart=5 or audstart=6) and status !=1")->find(); $isRecord = M("record")->where($where . " AND j_id='{$data['j_id']}'")->find(); if ($isRecord) { $this->resumelist = $this->getRecordListByJob($userInfo['id'], $data['j_id']); $this->display("new_recorded_user"); exit; } else { //判断该推荐人是否已经推荐给该企业的一个职位 $isThisCompany = M("record")->query("select * from stj_record where " . $where . " and j_id in (select id from stj_job where cpid = {$cid}) and (audstart=1 or audstart=3 or audstart=5 or audstart=6) and status !=1"); // $isThisCompany = M("record")->query("select * from stj_record where " . $where . " and j_id in (select id from stj_job where cpid = $cid)"); if (!empty($isThisCompany)) { $this->resumelist = $this->getRecordListByJob($userInfo['id'], $data['j_id']); $this->display("new_recorded_user"); exit; } else { //判断该职位是否已经推荐给3家企业 $isThreeCompany = M("record")->query("select * from stj_record r join stj_job b on r.j_id = b.id and " . $where . " and (audstart=1 or audstart=3 or audstart=5 or audstart=6) and status !=1 group by b.cpid;"); // $isThreeCompany = M("record")->query("select * from stj_record r join stj_job b on r.j_id = b.id and " . $where . " group by b.cpid;"); if (count($isThreeCompany) >= 3) { $this->resumelist = $this->getRecordListByJob($userInfo['id'], $data['j_id']); $this->display("new_recorded_user"); exit; } } } } $arRecordCount = M("record")->where("j_id='{$data['j_id']}' and t_id='{$data['t_id']}'")->count(); //如果此职位已经推荐过10个人,则不能再次推荐 if ($arRecordCount > 10) { $this->resumelist = $this->getRecordListByJob($userInfo['id'], $data['j_id']); $this->display("new_recorded_user"); exit; } $data['posttime'] = time(); $sql = "INSERT INTO `stj_record` (`id`, `j_id`, `t_id`, `bt_id`, `audstart`, `audreason`, `sink`, `posttime`, `status`, `because`, `news_status`,`is_send`,`audstartdate`,type,j_title) VALUES "; $sqlvalue = ""; for ($i = 0; $i < count($data['bt_id']); $i++) { // $isRecord = M("record")->where("j_id='$data[j_id]' and bt_id='" . $data[bt_id][$i] . "' and (audstart=1 or audstart=3 or audstart=5 or audstart=6) and status !=1")->find(); $isRecord = M("record")->where("j_id='{$data['j_id']}' and bt_id='" . $data[bt_id][$i] . "'")->find(); $resumeInfo = M("resume")->where("id='" . $data[bt_id][$i] . "'")->find(); $this->assign("resumeInfo", $resumeInfo); if (!$isRecord && $resumeInfo) { $sqlvalue .= "(NULL, '" . $data['j_id'] . "', '" . $data['t_id'] . "', '" . $data['bt_id'][$i] . "', '1', '', '1', '" . $data['posttime'] . "', '0', NULL, '0',1,'{$_REQUEST['audstarttime']}','{$type}','{$jobInfos['title']}'),"; /* * *******************************【推荐候选人】操作日志 begin ************************** */ $companyInfo = M("company")->where("id=" . $jobInfos['cpid'])->find(); $arNoticeInfo = getTNoticeInfo(1, $resumeInfo['username'], $companyInfo['cpname'], $jobInfos['title']); $sLogtitle = $arNoticeInfo[0]; $sLogContent = $arNoticeInfo[1]; addNoticeLog($data['t_id'], $username, $data['bt_id'][$i], $data['j_id'], $sLogtitle, $sLogContent); /* * *******************************【推荐候选人】操作日志 end ************************** */ } } if ($sqlvalue) { $sqlvalue = rtrim($sqlvalue, ","); $add = mysql_query($sql . $sqlvalue); if ($add) { $this->resumelist = $this->getRecordListByJob($userInfo['id'], $data['j_id']); $this->display("new_recorded_user"); } else { $this->display("RecommendTheCandidate"); } } else { $this->resumelist = $this->getRecordListByJob($userInfo['id'], $data['j_id']); // $this->display(); $this->display("new_recorded_user"); } }