2024-06-01 13:32:43 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\api\logic\user;
|
|
|
|
|
|
|
|
use app\common\logic\BaseLogic;
|
|
|
|
use app\common\model\user\UserFeedback;
|
2024-08-27 11:56:48 +08:00
|
|
|
use support\exception\BusinessException;
|
|
|
|
use think\facade\Db;
|
2024-06-01 13:32:43 +08:00
|
|
|
|
|
|
|
class UserFeedbackLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @notes 添加用户反馈表
|
|
|
|
* @param array $params
|
|
|
|
* @return bool
|
|
|
|
* @author likeadmin
|
|
|
|
* @date 2024/05/13 16:56
|
|
|
|
*/
|
|
|
|
public static function add(array $params,$uid): bool
|
|
|
|
{
|
|
|
|
Db::startTrans();
|
|
|
|
try {
|
|
|
|
UserFeedback::create([
|
|
|
|
'uid' => $uid,
|
|
|
|
'content' => $params['content'],
|
|
|
|
'images' => $params['images'] ? json_encode($params['images']) : null,
|
|
|
|
'name' => $params['name'],
|
|
|
|
'contact' => $params['contact'],
|
|
|
|
'create_time' => time(),
|
|
|
|
]);
|
|
|
|
Db::commit();
|
|
|
|
return true;
|
2024-08-27 11:56:48 +08:00
|
|
|
} catch (\Throwable $e) {
|
2024-06-01 13:32:43 +08:00
|
|
|
Db::rollback();
|
2024-08-27 11:56:48 +08:00
|
|
|
throw new BusinessException($e->getMessage());
|
|
|
|
|
2024-06-01 13:32:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|