SystemSubscribe.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\admin\model\system\SystemAdmin;
  4. use app\admin\model\system\SystemLog;
  5. /**
  6. * 后台系统事件
  7. * Class SystemSubscribe
  8. * @package crmeb\subscribes
  9. */
  10. class SystemSubscribe
  11. {
  12. public function handle()
  13. {
  14. }
  15. /**
  16. * 添加管理员访问记录
  17. * @param $event
  18. */
  19. public function onAdminVisit($event)
  20. {
  21. list($adminInfo, $type) = $event;
  22. if (strtolower(app('request')->controller()) != 'index') SystemLog::adminVisit($adminInfo->id, $adminInfo->account, $type);
  23. }
  24. /**
  25. * 添加管理员最后登录时间和ip
  26. * @param $event
  27. */
  28. public function onSystemAdminLoginAfter($event)
  29. {
  30. list($adminInfo) = $event;
  31. SystemAdmin::edit(['last_ip' => app('request')->ip(), 'last_time' => time()], $adminInfo['id']);
  32. }
  33. /**
  34. * 商户注册成功之后
  35. * @param $event
  36. */
  37. public function onMerchantRegisterAfter($event)
  38. {
  39. list($merchantInfo) = $event;
  40. }
  41. }