SystemSubscribe.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\models\system\SystemAdmin;
  4. use app\models\system\SystemBadmin;
  5. use app\models\system\SystemLog;
  6. use app\models\system\SystemLogBadmin;
  7. /**
  8. * 后台系统事件
  9. * Class SystemSubscribe
  10. * @package crmeb\subscribes
  11. */
  12. class SystemSubscribe
  13. {
  14. public function handle()
  15. {
  16. }
  17. /**
  18. * 添加管理员访问记录
  19. * @param $event
  20. */
  21. public function onAdminVisit($event)
  22. {
  23. list($adminInfo, $type, $mer_id) = $event;
  24. if (strtolower(app('request')->controller()) != 'index') {
  25. SystemLog::adminVisit($adminInfo['id'], $adminInfo['account'], $type, $mer_id);
  26. }
  27. }
  28. /**
  29. * 添加管理员访问记录
  30. * @param $event
  31. */
  32. public function onBAdminVisit($event)
  33. {
  34. list($adminInfo, $type) = $event;
  35. if (strtolower(app('request')->controller()) != 'index') {
  36. SystemLogBadmin::adminVisit($adminInfo['id'], $adminInfo['account'], $type);
  37. }
  38. }
  39. /**
  40. * 添加管理员最后登录时间和ip
  41. * @param $event
  42. */
  43. public function onSystemAdminLoginAfter($event)
  44. {
  45. list($adminInfo) = $event;
  46. SystemAdmin::edit(['last_ip' => app('request')->ip(), 'last_time' => time()], $adminInfo['id']);
  47. }
  48. /**
  49. * 添加总后台管理员最后登录时间和ip
  50. * @param $event
  51. */
  52. public function onSystemBAdminLoginAfter($event)
  53. {
  54. list($adminInfo) = $event;
  55. SystemBadmin::edit(['last_ip' => app('request')->ip(), 'last_time' => time()], $adminInfo['id']);
  56. }
  57. /**
  58. * 商户注册成功之后
  59. * @param $event
  60. */
  61. public function onMerchantRegisterAfter($event)
  62. {
  63. list($merchantInfo) = $event;
  64. }
  65. }