FeedbackLogic.php 696 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\workerapi\logic;
  3. use app\common\logic\BaseLogic;
  4. use app\common\model\feedback\Feedback;
  5. /**
  6. * @author 林海涛
  7. * @date 2024/7/11 下午2:41
  8. */
  9. class FeedbackLogic extends BaseLogic
  10. {
  11. public static function addFeedback($params, $userId)
  12. {
  13. try {
  14. FeedBack::create([
  15. 'user_id' => $userId,
  16. 'feedback_type' => $params['feedback_type'],
  17. 'description' => $params['description'],
  18. 'pictures' => $params['pictures'] ?? null,
  19. ]);
  20. return true;
  21. } catch (\Exception $e) {
  22. self::setError($e->getMessage());
  23. return false;
  24. }
  25. }
  26. }