Log.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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\store\system;
  12. use app\controller\store\AuthController;
  13. use app\services\store\SystemStoreStaffServices;
  14. use app\services\system\log\SystemLogServices;
  15. use think\db\exception\DataNotFoundException;
  16. use think\db\exception\DbException;
  17. use think\db\exception\ModelNotFoundException;
  18. use think\facade\App;
  19. /**
  20. * Class Log
  21. * @package app\controller\store\system
  22. */
  23. class Log extends AuthController
  24. {
  25. /**
  26. * Log constructor.
  27. * @param App $app
  28. * @param SystemLogServices $services
  29. */
  30. public function __construct(App $app, SystemLogServices $services)
  31. {
  32. parent::__construct($app);
  33. $this->services = $services;
  34. $this->services->deleteLog();
  35. }
  36. /**
  37. * 显示操作记录
  38. */
  39. public function index()
  40. {
  41. $where = $this->request->getMore([
  42. ['pages', ''],
  43. ['path', ''],
  44. ['ip', ''],
  45. ['admin_id', ''],
  46. ['data', '', '', 'time'],
  47. ]);
  48. $where['store_id'] = $this->storeId;
  49. return $this->success($this->services->getLogList($where, (int)$this->storeStaffInfo['level']));
  50. }
  51. /**
  52. * 获取
  53. * @param SystemStoreStaffServices $services
  54. * @return mixed
  55. * @throws DataNotFoundException
  56. * @throws DbException
  57. * @throws ModelNotFoundException
  58. */
  59. public function search_admin(SystemStoreStaffServices $services)
  60. {
  61. $info = $services->getOrdAdmin('id,staff_name', $this->storeId, $this->storeStaffInfo['level']);
  62. return $this->success(compact('info'));
  63. }
  64. }