MODEL('email'); $birthday = $emailM -> getEmsgOnce(array('title'=>'生日提醒','orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $anniversary= $emailM -> getEmsgOnce(array('title'=>'网站周年','orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $todaydue = $emailM -> getEmsgOnce(array('title'=>array('like','会员套餐还有1天将过期'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $sevenduew['title'][] = array('like','会员套餐还有'); $sevenduew['title'][] = array('like','天将过期'); $sevenduew['orderby'] = 'ctime,desc'; $sevendue = $emailM -> getEmsgOnce($sevenduew,array('field'=>'`ctime`')); $useradd = $emailM -> getEmsgOnce(array('title'=>array('like','未发布简历' ),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $userup = $emailM -> getEmsgOnce(array('title'=>array('like','今天简历刷新'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $addjob = $emailM -> getEmsgOnce(array('title'=>array('like','未发布职位'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $upjob = $emailM -> getEmsgOnce(array('title'=>array('like','未刷新职位'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $this->yunset(array('birthday'=>$birthday,'anniversary'=>$anniversary,'todaydue'=>$todaydue,'sevendue'=>$sevendue,'useradd'=>$useradd,'userup'=>$userup,'addjob'=>$addjob,'upjob'=>$upjob)); $this->yuntpl(array('admin/admin_tuiguang')); } function msgtg_action(){ $mobliemsgM = $this -> MODEL('mobliemsg'); $birthday = $mobliemsgM -> getInfo(array('content'=>array('like','生日'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $anniversary= $mobliemsgM -> getInfo(array('content'=>array('like','周年庆'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $todaydue = $mobliemsgM -> getInfo(array('content'=>array('like','将于1天后到期'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $sevendue = $mobliemsgM -> getInfo(array('content'=>array('like','将于7天后到期'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $useradd = $mobliemsgM -> getInfo(array('content'=>array('like','未发布简历'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $userup = $mobliemsgM -> getInfo(array('content'=>array('like','未刷新简历'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $addjob = $mobliemsgM -> getInfo(array('content'=>array('like','未发布职位'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $upjob = $mobliemsgM -> getInfo(array('content'=>array('like','未刷新职位'),'orderby'=>'ctime,desc'),array('field'=>'`ctime`')); $this->yunset(array('birthday'=>$birthday,'anniversary'=>$anniversary,'todaydue'=>$todaydue,'useradd'=>$useradd,'userup'=>$userup,'addjob'=>$addjob,'upjob'=>$upjob)); $this->yuntpl(array('admin/admin_msgtg')); } function getBirthday_action(){ $jobM = $this->MODEL('job'); $statisM = $this->MODEL('statis'); $resumeM = $this->MODEL('resume'); $companyM = $this->MODEL('company'); $userinfoM = $this->MODEL('userinfo'); $todayduewh['vip_etime'][] = array('>',time()); $todayduewh['vip_etime'][] = array('<',strtotime('+1 day')); $todaydue = $statisM->getList($todayduewh,array('field'=>'uid','usertype'=>'2')); foreach ($todaydue as $v){ $todayuid[]=$v['uid']; } $sevenduewh['vip_etime'][] = array('>',time()); $sevenduewh['vip_etime'][] = array('<',strtotime('+7 day')); $sevendue = $statisM->getList($sevenduewh,array('field'=>'uid','usertype'=>'2')); foreach ($sevendue as $v){ $sevenuid[]=$v['uid']; } $regs = $userinfoM->getList(array('reg_date'=>array('>',strtotime('-7 day')),'usertype'=>'1'),array('field'=>'uid')); foreach($regs as $k=>$v){ $uids[]=$v['uid']; } $upjobA = $jobM->getList(array('lastupdate'=>array('<',strtotime('-7 day')),'r_status'=>array('<>','2'),'groupby'=>'`uid`','orderby'=>'lastupdate,desc'),array('field'=>'`uid`')); $upjob = $upjobA['list']; $upuid = array(); foreach ($upjob as $v){ $upuid[$v['uid']] = $v['uid']; } $upjobArr = $jobM->getList(array('lastupdate'=>array('>=',strtotime('-7 day')),'uid' => array('in', pylode(',', $upuid))),array('field'=>'`uid`')); $upjobs = $upjobArr['list']; $upuids = array(); foreach ($upjobs as $uv){ $upuids[$uv['uid']] = $uv['uid']; } $newUpuids = array_diff($upuid, $upuids); if ($_GET['type']=='email'){ $num['birthday_e'] = $resumeM->getResumeNum(array('birthday'=>array('dateformat','%m%d'),'email'=>array('<>',''), 'email_status'=>'1')); $num['anniversary_e']= $userinfoM->getMemberNum(array('email'=>array('<>',''),'status'=>'1')); $num['todaydue_e'] = $companyM->getCompanyNum(array('email_status'=>'1','linkmail'=>array('<>',''),'r_status'=>array('<>','2'),'uid'=>array('in',pylode(',',$todayuid)))); $num['sevendue_e'] = $companyM->getCompanyNum(array('email_status'=>'1','linkmail'=>array('<>',''),'r_status'=>array('<>','2'),'uid'=>array('in',pylode(',',$sevenuid)))); $num['useradd_e'] = $resumeM->getResumeNum(array('email_status'=>'1','r_status'=>1,'def_job'=>'0','resumetime'=>array('isnull'),'email'=>array('<>',''),'uid'=>array('in',pylode(',',$uids)))); $num['userup_e'] = $resumeM->getResumeNum(array('email_status'=>'1','def_job'=>array('>','0'),'r_status'=>1,'email'=>array('<>',''),'lastupdate'=>array('<',strtotime('-7 day')))); $addjob_ewh['email_status'] = '1'; $addjob_ewh['jobtime'][] = array('>','1'); $addjob_ewh['jobtime'][] = array('<',strtotime('-7 day')); $addjob_ewh['r_status'] = array('<>','2'); $addjob_ewh['linkmail'] = array('<>',''); $num['addjob_e'] = $companyM->getCompanyNum($addjob_ewh); $num['upjob_e'] = $companyM->getCompanyNum(array('email_status'=>'1','linkmail'=>array('<>',''),'r_status'=>array('<>','2'),'uid'=>array('in',pylode(',',$newUpuids)))); }else{ $num['birthday_m'] = $resumeM->getResumeNum(array('birthday'=>array('dateformat','%m%d'),'telphone'=>array('<>',''), 'moblie_status'=>'1')); $num['anniversary_m']= $userinfoM->getMemberNum(array('moblie'=>array('<>',''),'status'=>'1')); $num['todaydue_m'] = $companyM->getCompanyNum(array('moblie_status'=>'1','linktel'=>array('<>',''),'r_status'=>array('<>','2'),'uid'=>array('in',pylode(',',$todayuid)))); $num['sevendue_m'] = $companyM->getCompanyNum(array('moblie_status'=>'1','linktel'=>array('<>',''),'r_status'=>array('<>','2'),'uid'=>array('in',pylode(',',$sevenuid)))); $num['useradd_m'] = $resumeM->getResumeNum(array('moblie_status'=>'1','r_status'=>1,'def_job'=>'0','resumetime'=>array('isnull'),'telphone'=>array('<>',''),'uid'=>array('in',pylode(',',$uids)))); $num['userup_m'] = $resumeM->getResumeNum(array('moblie_status'=>'1','def_job'=>array('>','0'),'r_status'=>1,'telphone'=>array('<>',''),'lastupdate'=>array('<',strtotime('-7 day')))); $addjob_mwh['moblie_status'] = '1'; $addjob_mwh['jobtime'][] = array('>','1'); $addjob_mwh['jobtime'][] = array('<',strtotime('-7 day')); $addjob_mwh['r_status'] = array('<>','2'); $addjob_mwh['linktel'] = array('<>',''); $num['addjob_m'] = $companyM->getCompanyNum($addjob_mwh); $num['upjob_m'] = $companyM->getCompanyNum(array('moblie_status'=>'1','linktel'=>array('<>',''),'r_status'=>array('<>','2'),'uid'=>array('in',pylode(',',$newUpuids)))); } echo json_encode($num);die; } function xls_action() { $jobM = $this->MODEL('job'); $statisM = $this->MODEL('statis'); $resumeM = $this->MODEL('resume'); $companyM = $this->MODEL('company'); $userinfoM = $this->MODEL('userinfo'); $userinfo = array(); $xls_type = $_POST['xls_type']; if($_POST['outtype']=='birthday'){ if($xls_type=='email'){ $rows = $resumeM->getResumeList(array('birthday'=>array('dateformat','%m%d'),'email'=>array('<>',''), 'email_status'=>'1'),array('field'=>'`email`,`uid`,`birthday`,`name`')); }else{ $rows = $resumeM->getResumeList(array('birthday'=>array('dateformat','%m%d'),'telphone'=>array('<>',''), 'moblie_status'=>'1'),array('field'=>'`uid`,`birthday`,`name`,`telphone` as moblie')); } if($rows&&is_array($rows)){ foreach($rows as $k=>$v){ $userinfo[$v['uid']]=$v; } } }else if($_POST['outtype']=='anniversary'){ if($xls_type=='email'){ $rows = $userinfoM->getList(array('email'=>array('<>',''),'status'=>'1'),array('field'=>'`uid`,`username`,`email`')); }else{ $rows = $userinfoM->getList(array('moblie'=>array('<>',''),'status'=>'1'),array('field'=>'`uid`,`username`,`moblie`')); } if($rows&&is_array($rows)){ foreach($rows as $k=>$v){ $userinfo[$v['uid']]=$v; } } }else if($_POST['outtype']=='todaydue' || $_POST['outtype']=='sevendue'){ $dayslimit = $_POST['outtype']=='sevendue'?7:1; $statiswh['vip_etime'][] = array('>',time()); $statiswh['vip_etime'][] = array('<',strtotime('+'.$dayslimit.' day')); $comstatis = $statisM->getList($statiswh,array('field'=>'`uid`,`vip_etime`,`rating_name`','usertype'=>'2')); if(is_array($comstatis)){ foreach($comstatis as $key=>$value){ $uid[] = $value['uid']; } $where['uid'] = array('in',pylode(',',$uid)); $where['name'] = array('<>',''); if($xls_type=='email'){ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linkmail` as email')); }else{ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linktel` as moblie')); } } if($companys&&is_array($companys)){ foreach($companys as $k=>$v){ $userinfo[$v['uid']]=$v; } } }else if($_POST['outtype']=='useradd'){ $dayslimit = 7; $regs = $userinfoM->getList(array('reg_date'=>array('>',strtotime('-'.$dayslimit.' day')),'usertype'=>'1'),array('field'=>'uid,reg_date,username')); foreach($regs as $k=>$v){ $uids[] = $v['uid']; } $where['r_status'] = 1; $where['def_job'] = '0'; $where['resumetime']= array('isnull'); $where['uid'] = array('in',pylode(',',$uids)); if($xls_type=='email'){ $where['email'] = array('<>',''); $where['email_status'] = '1'; $users = $resumeM->getResumeList($where,array('field'=>'`uid`,`name`,`email`,`resumetime`')); }else{ $where['telphone'] = array('<>',''); $where['moblie_status'] = '1'; $users = $resumeM->getResumeList($where,array('field'=>'`uid`,`name`,`resumetime`,`telphone` as `moblie`')); } foreach($users as $k=>$v){ $userinfo[$v['uid']] = $v; } }else if($_POST['outtype']=='userup'){ $where['def_job'] = array('>','0'); $where['r_status'] = 1; $where['lastupdate']= array('<',strtotime('-7 day')); if($xls_type=='email'){ $where['email'] = array('<>',''); $where['email_status'] = '1'; $resumes = $resumeM->getResumeList($where,array('field'=>'distinct `uid`,`name`,`email`,`lastupdate`')); }else{ $where['telphone'] = array('<>',''); $where['moblie_status'] = '1'; $resumes = $resumeM->getResumeList($where,array('field'=>'distinct `uid`,`name`,`lastupdate`,`telphone` as `moblie`')); } foreach($resumes as $k=>$v){ $userinfo[$v['uid']] = $v; } }else if($_POST['outtype']=='addjob'){ $where['jobtime'][] = array('>','1'); $where['jobtime'][] = array('<',strtotime('-7 day')); $where['r_status'] = array('<>','2'); if($xls_type=='email'){ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`jobtime`,`linkmail` as `email`,`linktel` as `moblie`')); }else{ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`jobtime`,`linktel` as `moblie`')); } foreach($companys as $k=>$v){ $userinfo[$v['uid']] = $v; } }else if($_POST['outtype']=='upjob'){ $comjobsA = $jobM->getList(array('lastupdate'=>array('<',strtotime('-7 day')),'r_status'=>array('<>','2'),'groupby'=>'uid','orderby'=>'lastupdate,desc'),array('field'=>'`uid`,`lastupdate`')); $comjobs = $comjobsA['list']; $comids = array(); foreach($comjobs as $k=>$v){ $comids[$v['uid']]=$v['uid']; } $comjobsArr = $jobM->getList(array('lastupdate'=>array('>=',strtotime('-7 day')),'uid' => array('in', pylode(',', $comids))),array('field'=>'`uid`,`lastupdate`')); $comJobs = $comjobsArr['list']; $comidss = array(); foreach($comJobs as $ck=>$cv){ $comidss[$cv['uid']] = $cv['uid']; } $newComids = array_diff($comids, $comidss); $where['name'] = array('<>',''); $where['uid'] = array('in',pylode(',',$newComids)); if($xls_type=='email'){ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linkmail` as `email`')); }else{ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linktel` as `moblie`')); } foreach($companys as $k=>$v){ $userinfo[$v['uid']] = $v; } } if (!empty($userinfo)) { $this->yunset("xls_type", $xls_type); $this->yunset("list", $userinfo); $this->MODEL('log')->addAdminLog("导出邮箱信息"); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=tuiguang.xls"); $this->yuntpl(array('admin/tuiguang_xls')); } else { $this->ACT_layer_msg("没有可以导出的邮箱信息!", 8, $_SERVER['HTTP_REFERER']); } } function finish_action(){ $noticeM = $this->MODEL('notice'); $msgdata = $emaildata = array(); $emaildata['ctime'] = time(); $emaildata['del'] = 1; $emaildata['state'] = 0; $msgdata['ctime'] = time(); $msgdata['del'] = 1; $msgdata['state'] = 0; if($_POST['type']=='birthday'){ $emaildata['title'] = '生日提醒'; $msgdata['content'] = '生日提醒'; }elseif($_POST['type']=='anniversary'){ $emaildata['title'] = '网站周年'; $msgdata['content'] = '周年庆'; }elseif($_POST['type']=='todaydue'){ $emaildata['title'] = '会员套餐还有1天将过期'; $msgdata['content'] = '将于1天后到期'; }elseif($_POST['type']=='sevendue'){ $emaildata['title'] = '会员套餐还有x天将过期'; $msgdata['content'] = '将于7天后到期'; }elseif($_POST['type']=='useradd'){ $emaildata['title'] = '未发布简历'; $msgdata['content'] = '未发布简历'; }elseif($_POST['type']=='userup'){ $emaildata['title'] = '今天简历刷新'; $msgdata['content'] = '未刷新简历'; }elseif($_POST['type']=='addjob'){ $emaildata['title'] = '未发布职位'; $msgdata['content'] = '未发布职位'; }elseif($_POST['type']=='upjob'){ $emaildata['title'] = '未刷新职位'; $msgdata['content'] = '未刷新职位'; } if($_POST['xls_type']=='email'){ $id = $noticeM->insertEmail($emaildata); }else{ $id = $noticeM->insertMsg($msgdata); } if($id){ $arr['status'] = 1; }else{ $arr['status'] = 2; } echo json_encode($arr);die; } function sendPromotion_action(){ $jobM = $this->MODEL('job'); $statisM = $this->MODEL('statis'); $resumeM = $this->MODEL('resume'); $companyM = $this->MODEL('company'); $userinfoM = $this->MODEL('userinfo'); $type = intval($_POST['type']); $emailtype = intval($_POST['emailtype']); $emailtpl = intval($_POST['emailtpl']); $dayslimit = intval($_POST['dayslimit']); $sort = intval($_POST['sort']); if($sort){ if($this->config['sy_email_set']!="1"){ $arr['status'] = 0; $arr['msg'] = '还没有配置邮箱,请联系管理员!'; echo json_encode($arr);die; } }else{ if(!checkMsgOpen($this -> config)){ $arr['status'] = 0; $arr['msg'] = '还没有配置短信,请联系管理员!'; echo json_encode($arr);die; } } $emailarr=$user=$com=$lt=$userinfo=array(); $members=$users=$companys=$uids=$useremail=$comemail=$ltemail=$tpls=array(); if($emailtype=='1'){ if(($this->config['sy_email_birthday']!=1 && $sort == '1') || ($this->config['sy_msg_birthday']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启生日提醒!'; echo json_encode($arr);die; } if($type=='1'){ if($sort){ $users = $resumeM->getResumeList(array('birthday'=>array('dateformat','%m%d'),'email'=>array('<>',''), 'email_status'=>'1'),array('field'=>'`email`,`uid`,`birthday`,`name`')); }else{ $users = $resumeM->getResumeList(array('birthday'=>array('dateformat','%m%d'),'telphone'=>array('<>',''), 'moblie_status'=>'1'),array('field'=>'`uid`,`birthday`,`name`,`telphone` as moblie')); } if($users&&is_array($users)){ foreach($users as $k=>$v){ $userinfo[$v['uid']]=$v; } } } }else if($emailtype=='2'){ if(($this->config['sy_email_webbirthday']!=1 && $sort == '1') || ($this->config['sy_msg_webbirthday']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启周年提醒!'; echo json_encode($arr);die; } if($type=='2'){ if($sort){ $members = $userinfoM->getList(array('email'=>array('<>',''),'status'=>'1'),array('field'=>'`uid`,`username`,`email`')); }else{ $members = $userinfoM->getList(array('moblie'=>array('<>',''),'status'=>'1'),array('field'=>'`uid`,`username`,`moblie`')); } if($members&&is_array($members)){ foreach($members as $k=>$v){ $userinfo[$v['uid']]=$v; } } } }else if($emailtype=='3'){ if(($this->config['sy_email_vipmr']!=1 && $sort == '1') || ($this->config['sy_msg_vipmr']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启会员到期提醒!'; echo json_encode($arr);die; } $statiswh['vip_etime'][] = array('>',time()); $statiswh['vip_etime'][] = array('<',strtotime('+'.$dayslimit.' day')); $comstatis = $statisM->getList($statiswh,array('field'=>'`uid`,`vip_etime`,`rating_name`','usertype'=>'2')); if(is_array($comstatis)){ foreach($comstatis as $key=>$value){ $uid[] = $value['uid']; } $where['uid'] = array('in',pylode(',',$uid)); $where['name'] = array('<>',''); if($sort){ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linkmail` as email')); }else{ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linktel` as moblie')); } foreach($companys as $key=>$value){ foreach ($comstatis as $k=>$v){ if($value['uid']==$v['uid']){ $companys[$key]['vip_etime'] = $v['vip_etime']; $companys[$key]['rating_name'] = $v['rating_name']; } } } } if($companys&&is_array($companys)){ foreach($companys as $k=>$v){ $v['day'] = $dayslimit; $userinfo[$v['uid']]=$v; } } }else if($emailtype=='4'){ if(($this->config['sy_email_useradd']!=1 && $sort == '1') || ($this->config['sy_msg_useradd']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启未发布简历提醒!'; echo json_encode($arr);die; } if($type=='1'){ $regs = $userinfoM->getList(array('reg_date'=>array('>',strtotime('-'.$dayslimit.' day')),'usertype'=>'1'),array('field'=>'uid,reg_date,username')); $regdate=$user=array(); foreach($regs as $k=>$v){ $uids[] = $v['uid']; $regdate[$v['uid']] = $v['reg_date']; $user[$v['uid']] = $v['username']; } $where['r_status'] = 1; $where['def_job'] = '0'; $where['resumetime']= array('isnull'); $where['uid'] = array('in',pylode(',',$uids)); if($sort){ $where['email'] = array('<>',''); $where['email_status'] = '1'; $users = $resumeM->getResumeList($where,array('field'=>'`uid`,`name`,`email`,`resumetime`')); }else{ $where['telphone'] = array('<>',''); $where['moblie_status'] = '1'; $users = $resumeM->getResumeList($where,array('field'=>'`uid`,`name`,`resumetime`,`telphone` as `moblie`')); } foreach($users as $k=>$v){ if($v['name']){ $v['name'] = $user[$v['uid']]; } $userinfo[$v['uid']] = $v; $userinfo[$v['uid']]['day'] = $dayslimit; $userinfo[$v['uid']]['reg_date']= $regdate[$v['uid']]; } } }else if($emailtype=='5'){ if(($this->config['sy_email_userup']!=1 && $sort == '1') || ($this->config['sy_msg_userup']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启未刷新简历提醒!'; echo json_encode($arr);die; } if($type=='1'){ $where['def_job'] = array('>','0'); $where['r_status'] = 1; $where['lastupdate']= array('<',strtotime('-7 day')); if($sort){ $where['email'] = array('<>',''); $where['email_status'] = '1'; $resumes = $resumeM->getResumeList($where,array('field'=>'distinct `uid`,`name`,`email`,`lastupdate`')); }else{ $where['telphone'] = array('<>',''); $where['moblie_status'] = '1'; $resumes = $resumeM->getResumeList($where,array('field'=>'distinct `uid`,`name`,`lastupdate`,`telphone` as `moblie`')); } foreach($resumes as $k=>$v){ $userinfo[$v['uid']] = $v; $userinfo[$v['uid']]['day'] = $dayslimit; } } }else if($emailtype=='6'){ if(($this->config['sy_email_addjob']!=1 && $sort == '1') || ($this->config['sy_msg_addjob']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启未发布职位提醒!'; echo json_encode($arr);die; } if($type=='2'){ $where['jobtime'][] = array('>','1'); $where['jobtime'][] = array('<',strtotime('-7 day')); $where['r_status'] = array('<>','2'); if($sort){ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`jobtime`,`linkmail` as `email`,`linktel` as `moblie`')); }else{ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`jobtime`,`linktel` as `moblie`')); } foreach($companys as $k=>$v){ $userinfo[$v['uid']] = $v; $userinfo[$v['uid']]['day'] = $dayslimit; } } }else if($emailtype=='7'){ if(($this->config['sy_email_upjob']!=1 && $sort == '1') || ($this->config['sy_msg_upjob']!=1 && !$sort)){ $arr['status'] = 0; $arr['msg'] = '请先开启未刷新职位提醒!'; echo json_encode($arr);die; } if($type=='2'){ $comjobsA = $jobM->getList(array('lastupdate'=>array('<',strtotime('-7 day')),'r_status'=>array('<>','2'),'groupby'=>'uid','orderby'=>'lastupdate,desc'),array('field'=>'`uid`,`lastupdate`')); $comjobs = $comjobsA['list']; $comids = array(); foreach($comjobs as $k=>$v){ $comids[$v['uid']]=$v['uid']; } $comjobsArr = $jobM->getList(array('lastupdate'=>array('>=',strtotime('-7 day')),'uid' => array('in', pylode(',', $comids))),array('field'=>'`uid`,`lastupdate`')); $comJobs = $comjobsArr['list']; $comidss = array(); foreach($comJobs as $ck=>$cv){ $comidss[$cv['uid']] = $cv['uid']; } $newComids = array_diff($comids, $comidss); $where['name'] = array('<>',''); $where['uid'] = array('in',pylode(',',$newComids)); if($sort){ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linkmail` as `email`')); }else{ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; $companys = $companyM->getChCompanyList($where,array('field'=>'`uid`,`name`,`linktel` as `moblie`')); } foreach($companys as $k=>$v){ foreach ($comjobs as $val){ if ($v['uid']==$val['uid']){ $companys[$k]['lastupdate']=$val['lastupdate']; } } } foreach($companys as $k=>$v){ $userinfo[$v['uid']] = $v; $userinfo[$v['uid']]['day'] = $dayslimit; } } } if($emailtpl=='1'){ $useremail = array_unique($useremail); $comemail = array_unique($comemail); $ltemail = array_unique($ltemail); set_time_limit(1000); if(count($userinfo)>500){ $arr['status']=0; if($sort){ $arr['msg']='数量过多,第三方发送服务器将会影响,部分邮件无法发送。建议找专业的群发软件!'; }else{ $arr['msg']='数量过多,第三方发送服务器将会影响,部分短信无法发送。建议找专业的群发软件!'; } echo json_encode($arr);die; } } foreach($userinfo as $key=>$value){ $data[] = $this->shjobmsg($value,$emailtype,$sort); } if($data!=""){ if($_POST['action']=='sendEmailMsg'){ $pagesize = intval($_POST['pagelimit']); $sendok = intval($_POST['sendok']); $sendno = intval($_POST['sendno']); $result = $this->sendEmailMsg($pagesize,$sendok,$sendno,$data); if($result){ $toSize = $pagesize * $result['page']; if(count($data) > $toSize){ $npage = $result['page']; $spage = $npage*$pagesize+1; $topage = ($npage+1)*$pagesize; $name = $spage."-".$topage; $this->get_return("3",$npage,"正在发送".$name."份数据",$result['sendok'],$result['sendno']); }else{ $this->get_return("1",0,"发送成功:".$result['sendok'].",失败:".$result['sendno']); } } } } } function shjobmsg($info,$type,$sort){ $data=array(); $tpltype=array( '1' => 'birthday', '2' => 'webbirthday', '3' => 'vipmr', '4' => 'useradd', '5' => 'userup', '6' => 'addjob', '7' => 'upjob' ); $data['type'] = $tpltype[$type]; if($data['type']!=""){ if($type=='1'){ $data['uid'] = $info['uid']; $data['name'] = $info['name']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } $data['username'] = $info['name']; $data['date'] = $info['birthday']; $data['year'] = date("Y")-date("Y",strtotime($info['birthday'])); }elseif ($type=='2'){ $data['uid'] = $info['uid']; $data['name'] = $info['username']; $data['username'] = $info['username']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } }elseif ($type=='3'){ $data['uid'] = $info['uid']; $data['name'] = $info['name']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } $data['ratingname'] = $info['rating_name']; $data['date'] = date("Y-m-d",$info['vip_etime']);//会员到期日期 $data['day'] = ceil(($info['vip_etime'] - time()) / (60 * 60 * 24));//剩余几天到期(向下取整) }elseif ($type=='4'){ if($info['username_n']==''){ $userarr = $this->MODEL('userinfo')->getInfo(array('uid'=>$info['uid']),array('field'=>'`username`')); $data['username'] = $userarr['username']; }else{ $data['username'] = $info['username_n']; } $data['uid'] = $info['uid']; $data['name'] = $info['name_n']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } $data['date'] = date("Y-m-d",$info['reg_date']); $data['day'] = $info['day']; }elseif ($type=='5'){ if($info['username_n']==''){ $userarr = $this->MODEL('userinfo')->getInfo(array('uid'=>$info['uid']),array('field'=>'`username`')); $data['username'] = $userarr['username']; }else{ $data['username'] = $info['username_n']; } $data['uid'] = $info['uid']; $data['name'] = $info['name_n']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } $data['date'] = date("Y-m-d",$info['lastupdate']); $data['day'] = $info['day']; }elseif ($type=='6'){ $data['uid'] = $info['uid']; $data['name'] = $info['name']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } if($info['name']){ $data['username'] = $info['name']; }else{ $data['username'] = $info['username']; } $data['date'] = date("Y-m-d",$info['jobtime']); $data['day'] = $info['day']; }elseif ($type=='7'){ $data['uid'] = $info['uid']; $data['name'] = $info['name']; if($sort){ $data['email'] = $info['email']; }else{ $data['moblie'] = $info['moblie']; } if($info['name']){ $data['username'] = $info['name']; }else{ $data['username'] = $info['username']; } $data['date'] = date("Y-m-d",$info['lastupdate']); $data['day'] = $info['day']; } return $data; } } function sendEmailMsg($pagesize,$sendok,$sendno,$data){ $errorMsg = ''; $notice = $this->MODEL('notice'); if($_POST['value']=='0'){ foreach($data as $key=>$value){ if($key < $pagesize){ if($value['email']){ $retval = $notice->sendEmailType($value); } if($value['moblie']){ $value['port'] = '5'; $retval = $notice->sendSMSType($value); } if($retval['status'] != -1){ $sendok ++; }else{ $sendno ++; } } } $result['sendok'] = $sendok; $result['sendno'] = $sendno; $result['page'] = 1; }else{ $page=$_POST['value']; $start = $page*$pagesize; $end = ($page+1)*$pagesize; foreach($data as $key=>$value){ if( $key >= $start && $key < $end){ if($value['email']){ $retval = $notice->sendEmailType($value); } if($value['moblie']){ $value['port'] = '5'; $retval = $notice->sendSMSType($value); } if($retval['status'] != -1){ $sendok ++; }else{ $sendno ++; } } } $page = $page + 1; $result['sendok'] = $sendok; $result['sendno'] = $sendno; $result['page'] = $page; } return $result; } //简历推广 function tgresume_action(){ $this->yuntpl(array('admin/admin_tgresume')); } function getcom_action(){ $jobM = $this->MODEL('job'); $statisM = $this->MODEL('statis'); $companyM = $this->MODEL('company'); $userinfoM = $this->MODEL('userinfo'); $com = (int)$_POST['com']; $time = time(); if ($com==1){ $row = $statisM->getList(array('vip_etime'=>array('>=',strtotime('today'))),array('field'=>'uid','usertype'=>'2')); }elseif ($com==2){ $rowA = $jobM->getList(array('lastupdate'=>array('>',strtotime('-7 day',$time)),'r_status'=>array('<>','2')),array('field'=>'`uid`')); $row = $rowA['list']; }elseif ($com==3){ $row = $userinfoM->getList(array('reg_date'=>array('>',strtotime('-3 day',$time)),'usertype'=>'2'),array('field'=>'uid')); } $uids = array(); foreach($row as $r){ $uids [] = $r['uid']; } $uids = array_unique($uids); $num = 0; if(count($uids) > 0){ $where['uid'] = array('in',pylode(',', $uids)); $where['name'] = array('<>',''); if($_POST['msgType'] == 2){ $where['linktel'] = array('<>',''); $where['moblie_status'] = '1'; } else{ $where['linkmail'] = array('<>',''); $where['email_status'] = '1'; } $num = $companyM->getCompanyNum($where); } echo $num;die; } function sendresume_action(){ extract($_POST); $stype = intval($stype); if($stype==1){ $company = $this->gsresume($resume,$com,$sendnum,$num); if($company&&is_array($company)){ $pagesize = intval($_POST['pagelimit']); $sendok = intval($_POST['sendok']); $sendno = intval($_POST['sendno']?$_POST['sendno']:0); $value = intval($_POST['value']); $result = $this->sendResumeETG($company,$email_title,$pagesize,$value,$sendok,$sendno); if($result){ $toSize = $pagesize * $result['page']; if(count($company) > $toSize){ $npage = $result['page']; $spage = $npage*$pagesize+1; $topage = ($npage+1)*$pagesize; $name = $spage."-".$topage; $this->get_return("3",$npage,"正在发送".$name."份邮件",$result['sendok'],$result['sendno']); }else{ $this->get_return("1",0,"发送成功:".$result['sendok'].",失败:".$result['sendno']); } } } }else{ if(!checkMsgOpen($this -> config)){ $arr['msg']="还没有配置短信!"; $arr['status']=2; echo json_encode($arr);die; } $company=$this->getsendcom($com,$sendnum,2); if($company&&is_array($company)){ $pagesize = intval($pagelimit); $sendok = intval($sendok); $sendno = intval($sendno?$sendno:0); $value = intval($value); $result = $this->sendResumeMTG($company,$content,$pagesize,$value,$sendok,$sendno); if($result){ $toSize = $pagesize * $result['page']; if(count($company) > $toSize){ $npage = $result['page']; $spage = $npage*$pagesize+1; $topage = ($npage+1)*$pagesize; $name = $spage."-".$topage; $this->get_return("3",$npage,"正在发送".$name."条信息",$result['sendok'],$result['sendno']); }else{ $this->get_return("1",0,"发送成功:".$result['sendok'].",失败:".$result['sendno']); } } } } } function sendResumeETG($company,$title,$pagesize,$value,$sendok,$sendno){ $notice = $this->MODEL('notice'); if($value==0){ foreach($company as $key=>$val){ if($key < $pagesize){ if($val['html']!=''){ $emailData['email'] = $val['linkmail']; $emailData['subject'] = $title; $emailData['content'] = $val['html']; $emailData['uid'] = $val['uid']; $emailData['name'] = $val['name']; $emailData['cname'] = "admin"; $sendid = $notice->sendEmail($emailData); if($sendid['status'] != -1){ $sendok++; }else{ $sendno++; } } } } $result['sendok'] = $sendok; $result['sendno'] = $sendno; $result['page'] = 1; }else{ $page = $_POST['value']; $start = $page*$pagesize; $end = ($page+1)*$pagesize; foreach($company as $key=>$val){ if($key >= $start && $key < $end){ if($val['html']!=''){ $emailData['email'] = $val['linkmail']; $emailData['subject'] = $title; $emailData['content'] = $val['html']; $emailData['uid'] = $val['uid']; $emailData['name'] = $val['name']; $emailData['cname'] = "admin"; $sendid = $notice->sendEmail($emailData); if($sendid['status'] != -1){ $sendok++; }else{ $sendno++; } } } } $page = $page + 1; $result['sendok'] = $sendok; $result['sendno'] = $sendno; $result['page'] = $page; } return $result; } function sendResumeMTG($company,$content,$pagesize,$value,$sendok,$sendno){ $notice = $this->MODEL('notice'); if($value==0){ foreach($company as $key=>$val){ if($key < $pagesize){ $msgData['moblie'] = $val['linktel']; $msgData['content'] = $content; $msgData['uid'] = $val['uid']; $msgData['name'] = $val['name']; $msgData['cname'] = "admin"; $msgData['port'] = '5'; $sendid = $notice->sendSMS($msgData); if($sendid['status'] != -1){ $sendok++; }else{ $sendno++; } } } $result['sendok'] = $sendok; $result['sendno'] = $sendno; $result['page'] = 1; }else{ $page = $_POST['value']; $start = $page*$pagesize; $end = ($page+1)*$pagesize; foreach($company as $key=>$val){ if($key >= $start && $key < $end){ $msgData['moblie'] = $val['linktel']; $msgData['content'] = $content; $msgData['uid'] = $val['uid']; $msgData['name'] = $val['name']; $msgData['cname'] = "admin"; $msgData['port'] = '5'; $sendid = $notice->sendSMS($msgData); if($sendid['status'] != -1){ $sendok++; }else{ $sendno++; } } } $page = $page + 1; $result['sendok'] = $sendok; $result['sendno'] = $sendno; $result['page'] = $page; } return $result; } function gsresume($resume,$com,$sendnum,$num){ $resumeM = $this->MODEL('resume'); $company = $this->getsendcom($com, $sendnum); $cacheM = $this->MODEL('cache'); $cacheList = $cacheM->GetCache('user'); if($company && is_array($company)){ foreach ($company as $v){ $hyid[$v['uid']]['hy'] = $v['hy']; $hyid[$v['uid']]['cityid'] = $v['cityid']; } } if($hyid && is_array($hyid)){ include(CONFIG_PATH."db.data.php"); include PLUS_PATH."/user.cache.php"; foreach ($hyid as $k=>$v){ $where['hy'] = $v['hy']; $where['status'] = array('<>','2'); $where['r_status'] = 1; $where['job_classid'] = array('<>',''); $where['defaults'] = '1'; $where['orderby'] = 'lastupdate,desc'; $where['limit'] = $num; if ($resume==1){ $where['height_status'] = '2'; $expect = $resumeM->getSimpleList($where); }elseif ($resume==2){ $expect = $resumeM->getSimpleList($where); }elseif ($resume==3){ $where['whour'] = array('>','12'); $where['exp'] = array('>','18'); $expect = $resumeM->getSimpleList($where); } if($expect && is_array($expect)){ $html='
网站联系电话:'.$this->config['sy_freewebtel'].' | |||||
姓名 | 年龄 | 学历 | 工作经验 | 性别 | 操作 |
'.$v['uname'].' | '.$age.' | '.$userclass_name[$v['edu']].' | '.$userclass_name[$v['exp']].' | '.$cacheList['user_sex'][$v['sex']].' | 查看 |
网站联系电话:'.$this->config['sy_freewebtel'].' | ||||||
职位 | 工作地点 | 薪资 | 学历要求 | 工作经验 | 性别 | 操作 |
'.mb_substr($v['name'],"0","12","utf-8").' | '.$city_name[$v['cityid']].' | '.$salary.' | '.$comclass_name[$v['edu']].' | '.$comclass_name[$v['exp']].' | '.$cacheList['user_sex'][$v['sex']].' | 查看 |