feat(消息模块): 优化消息查询逻辑,支持俱乐部消息展示
- 修改了 User、Activity、Circle、Club 和 Game 控制器中的消息查询逻辑 - 增加了对俱乐部成员的判断,使得俱乐部消息能够展示给相关用户 - 调整了消息表中的字段名称,统一使用 user_id 替代 target_id - 优化了订单创建流程,只在需要时创建订单 - 更新了活动模型中的 costKey 属性,以适应新的费用结构 - 添加了新的费用类型翻译,以支持多退少补等功能
This commit is contained in:
@@ -235,18 +235,21 @@ class Activity extends Base
|
||||
$this->error('报名人数错误');
|
||||
}
|
||||
}
|
||||
$orderCreate = new OrderCreate($params);
|
||||
$result = $orderCreate->calc('create');
|
||||
$order = $orderCreate->create($result);
|
||||
$join = new GameJoin;
|
||||
$join->allowField(true)->save([
|
||||
'act_id' => $game['act_id'],
|
||||
'game_id' => $game['id'],
|
||||
'user_id' => $this->auth->id,
|
||||
'order_id' => $order['id'],
|
||||
'status' => 0, //待支付
|
||||
'users' => json_encode($params['users'] ?? [])
|
||||
]);
|
||||
$cost = json_decode($game['cost'], true);
|
||||
if (!empty($cost['type']) && ($cost['type'] == 10 || $cost['type'] == 30)) {
|
||||
$orderCreate = new OrderCreate($params);
|
||||
$result = $orderCreate->calc('create');
|
||||
$order = $orderCreate->create($result);
|
||||
$join = new GameJoin;
|
||||
$join->allowField(true)->save([
|
||||
'act_id' => $game['act_id'],
|
||||
'game_id' => $game['id'],
|
||||
'user_id' => $this->auth->id,
|
||||
'order_id' => $order['id'],
|
||||
'status' => 0, //待支付
|
||||
'users' => json_encode($params['users'] ?? [])
|
||||
]);
|
||||
}
|
||||
foreach ($participant as &$p) {
|
||||
$p['game_join_id'] = $join->id;
|
||||
}
|
||||
@@ -258,6 +261,6 @@ class Activity extends Base
|
||||
$this->error($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
$this->success('Success', $order);
|
||||
$this->success('Success', $order ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ class Circle extends Base
|
||||
'name' => '通知消息',
|
||||
'avatar' => '',
|
||||
'from_id' => 1,
|
||||
'target_id' => $model->user_id,
|
||||
'user_id' => $model->user_id,
|
||||
'content' => json_encode([
|
||||
'topic' => '影圈审核',
|
||||
'result' => ($params['status'] == 1) ? '通过' : '不通过',
|
||||
|
||||
@@ -227,8 +227,7 @@ class Club extends Base
|
||||
'type' => 3,
|
||||
'name' => $club->name,
|
||||
'avatar' => $club->logo,
|
||||
'from_id' => $this->auth->id,
|
||||
'target_id' => $club->id,
|
||||
'from_id' => $club->id,
|
||||
'content' => json_encode([
|
||||
'topic' => '俱乐部加入申请',
|
||||
'俱乐部名称' => $club->name,
|
||||
@@ -301,8 +300,7 @@ class Club extends Base
|
||||
'type' => 3,
|
||||
'name' => $club->name,
|
||||
'avatar' => $club->logo,
|
||||
'from_id' => $this->auth->id,
|
||||
'target_id' => $params['club_id'],
|
||||
'from_id' => $club->id,
|
||||
'content' => json_encode([
|
||||
'topic' => '俱乐部加入申请',
|
||||
'俱乐部名称' => $club->name,
|
||||
|
||||
@@ -118,7 +118,7 @@ class Game extends Base
|
||||
'name' => '系统消息',
|
||||
'avatar' => '',
|
||||
'from_id' => 0,
|
||||
'target_id' => $join->user_id,
|
||||
'user_id' => $join->user_id,
|
||||
'content' => json_encode([
|
||||
'topic' => '退出',
|
||||
'content' => '已退出 ' . $model['name'] . ' 活动',
|
||||
@@ -180,7 +180,7 @@ class Game extends Base
|
||||
'name' => '系统消息',
|
||||
'avatar' => '',
|
||||
'from_id' => 0,
|
||||
'target_id' => $j->user_id,
|
||||
'user_id' => $j->user_id,
|
||||
'content' => json_encode([
|
||||
'topic' => '评论',
|
||||
'content' => $model['name'] . ' 活动已取消',
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use app\admin\model\zy\link\Visitor;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Tags;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\link\Visitor;
|
||||
use app\admin\model\shopro\user\User;
|
||||
use app\admin\model\zy\circle\Circle;
|
||||
use app\admin\model\zy\link\Complaint;
|
||||
|
||||
Reference in New Issue
Block a user