loginAction.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. class loginClassAction extends ActionNot{
  3. public function defaultAction()
  4. {
  5. //判断是否可以快捷登录
  6. $iskj = $this->weiuser();
  7. if($this->rock->iswebbro(1)){
  8. $token = $this->option->getval('dingding_token0');
  9. if(!isempt($token))$iskj=3;
  10. }
  11. $this->assign('iskj', $iskj);
  12. $ptoken = $this->get('ptoken');
  13. $loginyzm = (int)getconfig('loginyzm','0');
  14. if(!isempt($ptoken))$loginyzm = 0;
  15. $this->assign('loginyzm', $loginyzm); //登录类型
  16. $this->smartydata['platsign'] = $this->getsession('platsign');
  17. }
  18. //判断当前使用微信啥的
  19. public function weiuser()
  20. {
  21. $iskj = 0;
  22. if($this->rock->iswebbro(0)){
  23. $qycrid = $this->option->getval('weixinqy_corpid');
  24. if($this->rock->isqywx){
  25. if(!isempt($qycrid))$iskj=2;
  26. }else{
  27. //$coppid = $this->option->getval('weixin_corpid');
  28. //if(!isempt($coppid))$iskj=1;
  29. if($iskj==0 && !isempt($qycrid))$iskj=2;
  30. if($iskj==0 && $this->option->getval('wxgzh_tplmess')=='1')$iskj=4;
  31. }
  32. }
  33. return $iskj;
  34. }
  35. /**
  36. * 微信快捷登录
  37. */
  38. public function wxloginAction()
  39. {
  40. $this->display= false;
  41. $iskj = $this->weiuser();
  42. if($iskj==2){
  43. m('weixinqy:oauth')->login();
  44. }else if($iskj==4){
  45. m('wxgzh:oauth')->oauthto('we','login');
  46. }else{
  47. m('weixin:oauth')->login();
  48. }
  49. }
  50. //获取后回调
  51. public function wxlogincodeAction()
  52. {
  53. $this->display= false;
  54. $iskj = $this->weiuser();
  55. if($iskj==2){
  56. m('weixinqy:oauth')->logincode();
  57. }else{
  58. m('weixin:oauth')->logincode();
  59. }
  60. }
  61. /**
  62. * 微信授权绑定
  63. */
  64. public function oauthtoAction()
  65. {
  66. $this->display= false;
  67. m('wxgzh:oauth')->oauthto();
  68. }
  69. public function oauthbackAction()
  70. {
  71. $state = $this->get('state','bang');
  72. $ubarr = m('wxgzh:oauth')->oauthback();
  73. if($state=='login'){
  74. m('wxgzh:oauth')->wxloginback($ubarr);
  75. }else{
  76. if(!is_array($ubarr)){
  77. $this->assign('backstate', '0');
  78. $this->assign('backerror', $ubarr);
  79. }else{
  80. $this->assign('backstate', '1');
  81. $this->assign('backarr', $ubarr);
  82. }
  83. }
  84. }
  85. /**
  86. * 无登录页面的快捷登录
  87. */
  88. public function qywxloginAction()
  89. {
  90. $this->display= false;
  91. m('weixinqy:oauth')->login('qy');
  92. }
  93. public function qywxlogincodeAction()
  94. {
  95. m('weixinqy:oauth')->logincode('qy');
  96. }
  97. }