PageRenderTime 42ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/controller/admin/interview1.php

https://github.com/pennsong/ShiyishiWeb
PHP | 185 lines | 167 code | 8 blank | 10 comment | 17 complexity | 1e27bccff2063451e0f50217f29ee29c MD5 | raw file
  1. <?php
  2. class interview_Controller extends Controller{
  3. function init(){
  4. $this->app_video_interview = Load::model('app_video_interview');
  5. $this->app_person_interview = Load::model('app_person_interview');
  6. $this->e_user = Load::model('e_user');
  7. $this->myjob_int = Load::model('myjob_int');
  8. $this->resume = Load::model('resume');
  9. $this->conf = Load::conf('conf');
  10. $this->vodrooms = $this->conf['vodrooms'];
  11. }
  12. function indexAction(){
  13. $this->_forward('list');
  14. }
  15. function listAction(){
  16. $status = $this->_get('s',0);
  17. $all = $this->_get('a',1);
  18. //$arows = $this->app_video_interview->fetchAll(' starttime > '.time()." and status = ".intval($status)." ");
  19. if($all){
  20. $url = $this->getPageUrl().'/list.do?s='.$status."&a=".$all;
  21. $wheres = " status = ".intval($status);
  22. $orderby = 'createtime desc';
  23. }else{
  24. $url = $this->getPageUrl().'/list.do?s='.$status;
  25. $wheres = ' starttime > '.time()." and status = ".intval($status);
  26. $orderby = 'createtime desc';
  27. }
  28. $page = $this->_get('page',1);
  29. $rows = $this->app_video_interview->pageAll($page, 50, $url,$wheres,$orderby);
  30. if($rows){
  31. foreach($rows as $key => $val){
  32. $user = $this->e_user->find($val['cid']);
  33. $rows[$key]['company'] = $user['company'];
  34. $myjob_int = $this->myjob_int->fetchAll(" interview_date <=".$val['starttime']." and interview_date <".$val['endtime']." and interview_type=2 and eid = ".$val['cid']);
  35. $rows[$key]['uname'] = '';
  36. $tmp = array();
  37. foreach($myjob_int as $k => $v){
  38. $resume = $this->resume->fetchRow('uid='.$v['uid']);
  39. if(!in_array($resume['uname'],$tmp)){
  40. $rows[$key]['uname'] .= " ".$resume['uname'];
  41. $tmp[] = $resume['uname'];
  42. }
  43. }
  44. $rows[$key]['hours'] = ceil(($val['endtime']-$val['starttime'])/3600);
  45. }
  46. }
  47. $this->assign('page',$page);
  48. $this->assign('s',$status);
  49. $this->assign('rows', $rows);
  50. $this->assign('url', $url);
  51. $this->assign('turl',$url.'&page='.$page);
  52. $this->display('interview_list.tpl');
  53. }
  54. function editAction(){
  55. //error_reporting(E_ALL);
  56. $ids = $this->_get('ids');
  57. $status = intval($this->_get('status'));
  58. if(!is_array($ids)){
  59. $x[] = intval($ids);
  60. $ids = $x;
  61. }
  62. if($ids){
  63. foreach($ids as $key => $val){
  64. $info = $this->app_video_interview->find(intval($val));
  65. $info['status'] = $status;
  66. if($status == 1){
  67. $okrooms = array();
  68. //验证是否还有空闲房间
  69. $arows = $this->app_video_interview->fetchAll($info['endtime'].' > starttime and endtime > '.$info['starttime']." and status = 1 ");
  70. if(!empty($arows)){
  71. foreach($arows as $ar){
  72. $okrooms[] = $ar['room'];
  73. }
  74. }
  75. if($okrooms){
  76. $vodrooms = array_diff($this->vodrooms,$okrooms);
  77. }else{
  78. $vodrooms = $this->vodrooms;
  79. }
  80. //print_r($vodrooms);
  81. if(!empty($vodrooms)){
  82. $info['room'] = array_pop($vodrooms);
  83. $info['passtime'] = date("Y-m-d H:i:s");
  84. $person = $this->app_person_interview->fetchAll(' aid = '.$info['id']);
  85. foreach($person as $k => $v){
  86. $this->logininfo = F::logininfo("enterp");
  87. $this->logincheck("enterp");
  88. $this->company = $this->logininfo['company'];
  89. $str = $this->company."邀请您 ".date('Y-m-d H:i:s',$v['starttime']).'至'.date('Y-m-d H:i:s',$v['endtime']).'参加在线面试 http://www.channelwin.info/';
  90. $str = iconv('UTF-8','GBK',$str);
  91. $str = urlencode($str);
  92. $resume = $this->resume->fetchRow('uid='.$v['uid']);
  93. $content = file_get_contents('http://3tong.cn:8082/ema_new/http/SendSms?Account=88010108&Password=cbff36039c3d0212b3e34c23dcde1456&SubCode=&Phone='.$resume['phone'].'&Content='.$str);
  94. if($content!=''){
  95. $v['status'] = 1;
  96. $this->app_person_interview->save($v);
  97. }
  98. }
  99. }else{
  100. $this->showmsg('无空闲房间,不能通过申请','list.do');
  101. }
  102. }else{
  103. $info['room'] = "";
  104. $info['nopasstime'] = date("Y-m-d H:i:s");
  105. }
  106. //print_r($info);exit;
  107. $this->app_video_interview->save($info);
  108. }
  109. }
  110. $this->showmsg('操作成功','list.do');
  111. //$this->wajaxmsg('操作成功',1);
  112. }
  113. function delAction(){
  114. $ids = $this->_get('ids');
  115. if(!is_array($ids)){
  116. $x[] = intval($ids);
  117. $ids = $x;
  118. }
  119. if($ids){
  120. foreach($ids as $key => $val){
  121. $info = $this->app_video_interview->find(intval($val));
  122. $info['status'] = 2;
  123. $this->app_video_interview->save($info);
  124. }
  125. }
  126. //$this->showmsg('操作成功','list.do');
  127. $this->wajaxmsg('操作成功',1);
  128. }
  129. function initleaderAction(){
  130. $eid = $this->logininfo['uid'];
  131. $nowtime = time();
  132. $intdate = (int)date("Ymd");
  133. //$this->vodrooms
  134. $phone = trim($this->_get('mobile'));
  135. $aid = intval($this->_get('aid'));
  136. $info = $this->app_video_interview->find(intval($aid));
  137. $leadermodel = Load::model('leader');
  138. //验证
  139. $check = $leadermodel->fetchRow("eid=".$eid." AND roomid=".$info['id']." AND room='".$info['room']."'");
  140. $had = false;
  141. if($check&&$check['id']>0){
  142. if($check['phone']==$phone){
  143. $had = true;
  144. $id = $check['id'];
  145. $passwd = $check['passwd'];
  146. }else{
  147. $check['phone']=$phone;
  148. $passwd = F::getRandomstr(6,'number');
  149. $id = $check['id'];
  150. $leadermodel->save($check);
  151. $this->ajaxmsg('had');
  152. }
  153. }
  154. if(!$had){
  155. $passwd = F::getRandomstr(6,'number');
  156. $llinfo = array('eid'=>$eid,'roomid'=>$room['info'],'room'=>$info['room'],'phone'=>$phone,'startdate'=>$info['starttime'],'enddate'=>$info['endtime'],'passwd'=>$passwd);
  157. $id = $leadermodel->save($llinfo);
  158. }
  159. $smstxt = "您好,请您于".date("m-d H:i",$room['starttime'])."登录".str_replace('http://','',BASE_URL.'/i/'.$id).",密码:".$passwd;
  160. $str = iconv('UTF-8','GBK',$smstxt);
  161. $str = urlencode($str);
  162. $content = file_get_contents('http://3tong.cn:8082/ema_new/http/SendSms?Account=88010108&Password=cbff36039c3d0212b3e34c23dcde1456&SubCode=&Phone='.$phone.'&Content='.$str);
  163. //短信接口 发送短信 目前没有
  164. $this->ajaxmsg('success');
  165. }
  166. function addleaderAction(){
  167. error_reporting(E_ALL);
  168. $aid = intval($this->_get('aid'));
  169. $info = $this->app_video_interview->find(intval($aid));
  170. if(!isset($info['id'])){
  171. $this->wajaxmsg('非法操作',1);
  172. }
  173. $this->assign('aid', $aid);
  174. $this->display('addleader.tpl');
  175. }
  176. }
  177. ?>