loginAction.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. class loginClassAction extends ActionNot{
  3. public function defaultAction()
  4. {
  5. $this->tpltype = 'html';
  6. $this->smartydata['ca_adminuser'] = $this->getcookie('ca_adminuser');
  7. $this->smartydata['ca_rempass'] = $this->getcookie('ca_rempass');
  8. $this->smartydata['ca_adminpass'] = $this->getcookie('ca_adminpass');
  9. $this->smartydata['jgheight'] = (int)$this->getcookie('jgheight','40');
  10. $this->smartydata['loginyzm'] = (int)getconfig('loginyzm','0'); //登录类型
  11. $this->smartydata['platsign'] = $this->getsession('platsign');
  12. }
  13. public function checkAjax()
  14. {
  15. $user = $this->jm->base64decode($this->post('adminuser'));
  16. $user = str_replace(' ','',$user);
  17. $pass = $this->jm->base64decode($this->post('adminpass'));
  18. $rempass= $this->post('rempass');
  19. $jmpass = $this->post('jmpass');
  20. $cfrom = $this->post('cfrom','pc');
  21. $jgheight = (int)$this->post('jgheight','0');
  22. if($jmpass == 'true')$pass=$this->jm->uncrypt($pass);
  23. $userp = $user;
  24. $arr = m('login')->start($user, $pass, $cfrom);
  25. $barr = array();
  26. if($jgheight > 0)$this->rock->savecookie('jgheight', $jgheight);
  27. if(is_array($arr)){
  28. if(isset($arr['mobile'])){
  29. $barr = $arr;
  30. $barr['success'] = false;
  31. return $barr;
  32. }
  33. $uid = $arr['uid'];
  34. $name = $arr['name'];
  35. $user = $arr['user'];
  36. $token = $arr['token'];
  37. $face = $arr['face'];
  38. m('login')->setsession($uid, $name, $token, $user);
  39. $this->rock->savecookie('ca_adminuser', $userp);
  40. $this->rock->savecookie('ca_rempass', $rempass);
  41. $ca_adminpass = $this->jm->encrypt($pass);
  42. if($rempass=='0')$ca_adminpass='';
  43. $this->rock->savecookie('ca_adminpass', $ca_adminpass);
  44. $barr['success'] = true;
  45. $barr['face'] = $face;
  46. $barr['token'] = $token;
  47. }else{
  48. $barr['success'] = false;
  49. $barr['msg'] = $arr;
  50. }
  51. return $barr;
  52. }
  53. public function exitAction()
  54. {
  55. m('dept')->online(0);//离线
  56. m('login')->exitlogin('pc',$this->admintoken);
  57. $this->rock->location('?m=login');
  58. }
  59. /**
  60. * 对外的信息收集
  61. */
  62. private $inputobj;
  63. public function collectAction()
  64. {
  65. if(!getconfig('authorkey'))return $this->jm->base64decode('6Z2e5o6I5p2D54mI5peg5rOV5L2.55So5q2k5Yqf6IO9');
  66. $this->title = '信息收集表';
  67. $mid = (int)$this->get('mid','0');
  68. $mrs = m('planm')->getone('`id`='.$mid.' and `type`=2 and `fenlei`=1 and `status`=1');
  69. if(!$mrs)return '信息不存在';
  70. if($mrs['enddt']<$this->rock->now)return '时间已经截止至'.$mrs['enddt'].'';
  71. if($mrs['startdt']>$this->rock->now)return ''.$mrs['startdt'].'时间才可以开始';
  72. $mrs['onlyid'] = '0';
  73. $rows = m('plans')->getall('`mid`='.$mid.'','*','`sort`');
  74. $contstr = '';
  75. $fieldarr= array();
  76. $lexar = array('select','checkbox','checkboxall','radio');
  77. foreach($rows as $k=>$rs){
  78. $arr = array(
  79. 'name' => $rs['pitem'],
  80. 'fieldstype'=> $rs['zxren'],
  81. 'data' => '',
  82. 'attr' => '',
  83. 'dev' => '',
  84. 'isbt' => $rs['itemid'],
  85. );
  86. if(!isempt($rs['zxrenid'])){
  87. if(!in_array($arr['fieldstype'],$lexar)){
  88. $arr['placeholder'] = $rs['zxrenid'];
  89. }else{
  90. $arr['data'] = $rs['zxrenid'];
  91. }
  92. }
  93. $fieldarr['sitemid_'.$rs['id'].''] = $arr;
  94. }
  95. $this->inputobj = c('input');
  96. $this->inputobj->fieldarr = $fieldarr;
  97. foreach($rows as $k=>$rs){
  98. $str = $this->inputobj->getfieldcont('sitemid_'.$rs['id'].'');
  99. $sth = '';
  100. if($rs['itemid']=='1')$sth='<font color=red>*</font>';
  101. $contstr.='<div style="color:#555555">'.$sth.$rs['pitem'].'</div>';
  102. $contstr.='<div>'.$str.'</div>';
  103. $contstr.='<div class="blank15"></div>';
  104. }
  105. $this->title = $mrs['name'];
  106. $this->assign('contstr', $contstr);
  107. $this->assign('fieldarr', $fieldarr);
  108. $this->assign('mrs', $mrs);
  109. }
  110. /**
  111. * 保存外部收集
  112. */
  113. public function collectcheckAction()
  114. {
  115. $mid = (int)$this->post('mid','0');
  116. $onlyid = (int)$this->post('onlyid','0');
  117. $mrs = m('planm')->getone('`id`='.$mid.' and `type`=2');
  118. if(!$mrs)return returnerror('不存在');
  119. $flow = m('flow')->initflow('collects');
  120. $uarr = array(
  121. 'uid' => 0,
  122. 'optdt' => $this->rock->now,
  123. 'optid' => 0,
  124. 'optname' => '',
  125. 'applydt' => $this->rock->date,
  126. 'status' => 0,
  127. 'type' => 3,
  128. 'isturn' => 1,
  129. 'comid' => $mrs['comid'],
  130. 'name' => $mrs['name'],
  131. 'startdt' => $mrs['startdt'],
  132. 'enddt' => $mrs['enddt'],
  133. 'leixing' => $mid,
  134. 'psren' => $mrs['optname'],
  135. 'psrenid' => $mrs['optid'],
  136. );
  137. $id = $flow->insert($uarr);
  138. $flow->loaddata($id, false);
  139. $flow->submit();
  140. return returnsuccess();
  141. }
  142. }
粤ICP备19079148号