refactor(zy): 修改消息通知的类型和功能
This commit is contained in:
@@ -9,6 +9,7 @@ use app\admin\model\zy\Stadium;
|
||||
use app\admin\model\zy\game\Game;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\shopro\Category;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\game\GameJoin;
|
||||
use think\exception\ValidateException;
|
||||
use app\admin\model\shopro\goods\Goods;
|
||||
@@ -211,7 +212,8 @@ class Activity extends Base
|
||||
}
|
||||
$order = GameJoin::where('game_id', $game['id'])->count();
|
||||
$gender = ['man' => 0, 'woman' => 0];
|
||||
$participant = [];
|
||||
$user = auth_user();
|
||||
$participant = $msgs = [];
|
||||
foreach ($params['users'] as $u) {
|
||||
$order++;
|
||||
$participant[] = [
|
||||
@@ -229,6 +231,19 @@ class Activity extends Base
|
||||
} else {
|
||||
$gender['man'] += 1;
|
||||
}
|
||||
$msgs[] = [
|
||||
'type' => 1,
|
||||
'name' => '系统消息',
|
||||
'avatar' => '',
|
||||
'from_id' => 0,
|
||||
'user_id' => $u['user_id'],
|
||||
'content' => json_encode([
|
||||
'msgType' => 1,
|
||||
'content' => $user['nickname'] . ' 帮你报名了组球',
|
||||
'game_id' => $game['id'],
|
||||
'act_id' => $game['act_id'],
|
||||
])
|
||||
];
|
||||
}
|
||||
foreach ($gender as $k => $v) {
|
||||
if ($params['goods_list'][$k]['goods_num'] != $v) {
|
||||
@@ -254,6 +269,7 @@ class Activity extends Base
|
||||
$p['game_join_id'] = $join->id;
|
||||
}
|
||||
(new Participant)->insertAll($participant);
|
||||
(new Message())->insertAll($msgs);
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user