BaseWorkController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\api\v1\work;
  12. /**
  13. * Class BaseWorkController
  14. * @package app\controller\api\v1\work
  15. */
  16. abstract class BaseWorkController
  17. {
  18. /**
  19. * 客户userid
  20. * @var string
  21. */
  22. protected $userid;
  23. /**
  24. * 客户详细信息
  25. * @var array
  26. */
  27. protected $clientInfo;
  28. /**
  29. * @var \think\facade\Request|\think\Request
  30. */
  31. protected $request;
  32. /**
  33. * @var
  34. */
  35. protected $service;
  36. /**
  37. * BaseWorkController constructor.
  38. */
  39. public function __construct()
  40. {
  41. $this->request = request();
  42. $this->clientInfo = $this->request->clientInfo();
  43. $this->userid = $this->request->userid();
  44. }
  45. /**
  46. * @param $msg
  47. * @param array $data
  48. * @return mixed
  49. */
  50. public function success($msg, array $data = [])
  51. {
  52. return app('json')->success($msg, $data);
  53. }
  54. /**
  55. * @param string $msg
  56. * @param array|null $data
  57. * @return mixed
  58. */
  59. public function fail($msg = 'fail', ?array $data = null)
  60. {
  61. return app('json')->fail($msg, $data);
  62. }
  63. }