<?php
namespace app\workerapi\logic;
use app\common\logic\BaseLogic;
use app\common\model\feedback\Feedback;

/**
 * @author 林海涛
 * @date 2024/7/11 下午2:41
 */
class FeedbackLogic extends BaseLogic
{
    public static function addFeedback($params, $userId)
    {
        try {
            FeedBack::create([
                'user_id' => $userId,
                'feedback_type' => $params['feedback_type'],
                'description' => $params['description'],
                'pictures' => $params['pictures'] ?? null,
            ]);
            return true;
        } catch (\Exception $e) {
            self::setError($e->getMessage());
            return false;
        }
    }
}