AuthController.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\erp;
  12. use crmeb\services\erp\Erp;
  13. use think\Response;
  14. /**
  15. * Class AuthController
  16. * @package app\controller\erp
  17. */
  18. class AuthController
  19. {
  20. /*** @var Erp */
  21. protected $services;
  22. public function __construct(Erp $services)
  23. {
  24. $this->services = $services;
  25. }
  26. /**
  27. * 获取auth测试
  28. * @return mixed
  29. */
  30. public function auth()
  31. {
  32. $params = $this->services->getAuthParams();
  33. $url = $params["url"] . "?";
  34. unset($params["url"]);
  35. $url .= http_build_query($params);
  36. return app('json')->success([$params, 'jump_url' => $url]);
  37. }
  38. /**
  39. * 授权回调测试
  40. * @return mixed
  41. */
  42. public function authCallBack()
  43. {
  44. $rep = $this->services->authCallback();
  45. return Response::create($rep->getData(), "json");
  46. }
  47. /**
  48. * token测试
  49. * @return void
  50. */
  51. public function accessToken()
  52. {
  53. $param = $this->services->getAccessToken();
  54. return app('json')->success($param);
  55. }
  56. }