SystemSubscribe.php 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. }