UserVisitListener.php 623 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace app\listener\user;
  3. use app\services\product\product\StoreVisitServices;
  4. use crmeb\interfaces\ListenerInterface;
  5. /**
  6. * 写入用户访问
  7. * Class UserVisitListener
  8. * @package app\listener\user
  9. */
  10. class UserVisitListener implements ListenerInterface
  11. {
  12. public function handle($event): void
  13. {
  14. [$uid, $product_id, $product_type, $cate, $type] = $event;
  15. //写入用户访问记录
  16. /** @var StoreVisitServices $storeVisit */
  17. $storeVisit = app()->make(StoreVisitServices::class);
  18. $storeVisit->setView($uid, $product_id, $product_type, $cate, $type);
  19. }
  20. }