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 view_resume()
 {
     //推荐记录id
     $id = intval($_GET['id']) > 0 ? intval($_GET['id']) : 0;
     //招聘信息id
     $jid = intval($_GET['jid']) > 0 ? intval($_GET['jid']) : 0;
     //推荐人id
     $btid = intval($_GET['btid']) > 0 ? intval($_GET['btid']) : 0;
     if (empty($id) || empty($jid) || empty($btid)) {
         header("location:/");
         die;
     }
     $result = M("resume")->where("id={$btid}")->find();
     $arJobInfo = M("job")->where("id='{$jid}'")->find();
     if (!$arJobInfo['title']) {
         $arJobInfo['title'] = M("casclist")->where("id='{$arJobInfo['Jobcate']}'")->getField("cascname");
     }
     $arRecord = M("record")->where("id='{$id}'")->find();
     if ($arRecord['news_status'] == "0") {
         /*                         * ***************************【推荐人/企业】企业查看简历操作日志 begin************************** */
         $arCompanyInfo = M("company")->where("id={$arJobInfo['cpid']}")->find();
         $username = $this->username;
         $arTNoticeInfo = getTNoticeInfo(6, $resumeInfo['username'], $arCompanyInfo['cpname'], $arJobInfo['title']);
         $sLogtitle = $arTNoticeInfo[0];
         $sLogContent = $arTNoticeInfo[1];
         $arNotice = array("uid" => $arCompanyInfo['id'], "username" => $username, "bt_id" => $btid, "j_id" => $jid, "title" => $sLogtitle, "content" => $sLogContent, "created_at" => time(), "updated_at" => time());
         M("notice_log")->add($arNotice);
         $arCNoticeInfo = getCNoticeInfo(6, $arJobInfo['title'], $resumeInfo['username']);
         $sLogtitle = $arCNoticeInfo[0];
         $sLogContent = $arCNoticeInfo[1];
         $arNotice = array("uid" => $arCompanyInfo['id'], "username" => $username, "bt_id" => $btid, "j_id" => $jid, "title" => $sLogtitle, "content" => $sLogContent, "type" => 2, "created_at" => time(), "updated_at" => time());
         M("notice_log")->add($arNotice);
         /*                         * ***************************【推荐人/企业】企业查看简历操作日志 begin************************** */
         //修改新消息状态
         M("record")->query("UPDATE stj_record set news_status=1 where id='{$id}'");
     }
     $result['sexdata'] = $result['sex'] ? "女" : "男";
     $result['agedata'] = $result['age'] ? $result['age'] : "未填";
     //在职状态
     $result['statedata'] = M("cascadedata")->where("datagroup='zzstart' and datavalue='{$result['state']}'")->getField("dataname");
     //工作经历
     $result['experiencedata'] = M("workexper")->where("keyid='{$result['keyid']}'")->getField("intro");
     $result['experiencedata'] = $result['experiencedata'] ? $result['experiencedata'] : "无";
     //教育经历
     $result['educationdata'] = M("education")->where("keyid='{$result['keyid']}'")->getField("content");
     $result['educationdata'] = $result['educationdata'] ? $result['educationdata'] : "无";
     //资格证书
     $result['zige'] = M("cercate")->where("keyid='{$result['keyid']}'")->getField("zhengshu");
     $result['zige'] = $result['zige'] ? $result['zige'] : "无";
     //推荐理由
     $result['because'] = $result['because'] ? $result['because'] : "无";
     $lArr = array(array("name" => "回到首页", "url" => "/", "img" => "/Public/new-images/head-icon/m-icon1.png"), array("name" => "发布职位", "url" => "/index.php?s=/Company/send_job", "img" => "/Public/new-images/com-head-icon/send_job.png"), array("name" => "正在招聘", "url" => "/index.php?s=/Companyabout/recording", "img" => "/Public/new-images/com-head-icon/recording.png"), array("name" => "往期招聘", "url" => "/index.php?s=/Companyabout/recorded", "img" => "/Public/new-images/com-head-icon/recorded.png"));
     $this->assign("lArr", $lArr);
     $this->assign("header_title", "候选人简历");
     $this->assign("result", $result);
     $this->assign("select", "send_job");
     $this->display("Company/view_resume");
 }