fix: 修复了用户地址、商品库存等错误; refactor: 重构了登录逻辑,提高了代码可读性; style: 调整了代码格式,使其更加规范; test: 增加了订单支付的测试用例; docs: 更新了相关文档; build: 更新了依赖; ops: 优化了服务器性能; chore: 更新了.gitignore文件;
39 lines
875 B
PHP
39 lines
875 B
PHP
<?php
|
|
|
|
namespace app\api\logic\user;
|
|
|
|
use app\common\logic\BaseLogic;
|
|
use app\common\model\user\UserFeedback;
|
|
use support\exception\BusinessException;
|
|
use think\facade\Db;
|
|
|
|
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;
|
|
} catch (\Throwable $e) {
|
|
Db::rollback();
|
|
throw new BusinessException($e->getMessage());
|
|
|
|
}
|
|
}
|
|
} |