ReportService.php 656 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace services\common;
  3. use common\models\common\Report;
  4. /**
  5. * Class ReportService
  6. * @package services\common
  7. */
  8. class ReportService extends BaseService
  9. {
  10. /**
  11. * 添加举报
  12. *
  13. * @param integer $id
  14. * @param string $from
  15. * @param array $data
  16. * @return boolean
  17. */
  18. public function addReport(int $id, string $from, array $data)
  19. {
  20. if (!in_array($from, Report::getFromKeys())) return $this->error('来源类型错误');
  21. if (!Report::addReport($this->mall_id, $id, $from, $data)) {
  22. return $this->error('添加投诉失败');
  23. }
  24. return true;
  25. }
  26. }