OaAdminController.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Ksh
  5. * Date: 2017/6/26
  6. * Time: 11:12
  7. */
  8. namespace api\oa\controller;
  9. use think\Db;
  10. class OaAdminController extends OacallbackController {
  11. function _initialize() {
  12. parent::_initialize();
  13. $this->checkParam();
  14. $this->jumpToLogin();
  15. }
  16. public function index() {
  17. }
  18. function checkParam() {
  19. $this->checkTc();
  20. $this->checkData();
  21. $this->checkGroupId();
  22. }
  23. function checkTc() {
  24. if (empty($this->param['tc'])) {
  25. exit;
  26. }
  27. }
  28. function checkData() {
  29. if (empty($this->param['data'])) {
  30. exit;
  31. }
  32. }
  33. function checkGroupId() {
  34. if (empty($this->param['group_id'])) {
  35. exit;
  36. }
  37. }
  38. public function jumpToLogin() {
  39. $_group_id = $this->param['group_id'];
  40. $_tc = $this->param['tc'];
  41. $_data = $this->param['data'];
  42. $_group_id = $this->param['group_id'];
  43. $_role_id = $this->oa_class->nodeGroupToRole($_group_id);
  44. if (!$_role_id) {
  45. exit;
  46. }
  47. if ((new \huolib\oa\Oa())::SDK_ADMIN_ROLE_ID == $_role_id) {
  48. header('location:'.ADMINSITE.'/admin/public/jump.html?tc='.$_tc.'&data='.$_data.'&group_id='.$_group_id);
  49. exit;
  50. } elseif ((new \huolib\oa\Oa())::SDK_LEGION_ROLE_ID == $_role_id
  51. || (new \huolib\oa\Oa())::SDK_PROMOTER_ROLE_ID == $_role_id
  52. ) {
  53. header('location:'.AGENTSITE.'/agent/login?tc='.$_tc.'&data='.$_data.'&group_id='.$_group_id);
  54. exit;
  55. }
  56. }
  57. }