ReportDao.php 836 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Dao\Report;
  3. use App\Models\Report\ReportLog;
  4. class ReportDao
  5. {
  6. /**
  7. * @param $data
  8. * @return false
  9. */
  10. public function saveReportLog($data): bool
  11. {
  12. if (empty($data)) {
  13. return false;
  14. }
  15. return ReportLog::insert($data);
  16. }
  17. /**
  18. * @param $clickId
  19. * @param $eventType
  20. * @return array
  21. */
  22. public function getReportLogByClickId($clickId, $eventType): array
  23. {
  24. if (empty($clickId)) {
  25. return [];
  26. }
  27. $result = ReportLog::select('id', 'clickid', 'projectid', 'promotionid', 'uid')
  28. ->where('clickid', $clickId)
  29. ->where('event_type', $eventType)
  30. ->first();
  31. return $result ? $result->toArray() : [];
  32. }
  33. }