feat(zy): 增加俱乐部详情接口并优化游戏详情页面

- 新增俱乐部详情接口,包括成员性别比例和关注度统计
- 在游戏详情页面增加关注度统计
- 更新游戏活动状态文案
- 优化 dd 和 getsql 函数输出格式
This commit is contained in:
2025-05-18 11:44:02 +08:00
parent 6c4fc6bff6
commit 55af3cb570
4 changed files with 29 additions and 8 deletions

View File

@@ -71,6 +71,24 @@ class Club extends Base
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
}
public function view()
{
$model = $this->model->get($this->request->param('id'))->toarray();
if (empty($model)) {
$this->error(__('No rows were found'));
}
$menber = Menber::alias('m')
->join([User::$tableName => 'u'], 'u.id = m.user_id')
->where('club_id', $model['id'])->field('gender,count(*) as num')->group('u.gender')
->column('count(*) as num','gender');
$model['gender0'] = $menber[0] ?? 0;
$model['gender1'] = $menber[1] ?? 0;
$this->model->where('id', $model['id'])->setInc('attention');
$this->success('Success', $model);
}
public function add()
{
$result = false;

View File

@@ -63,6 +63,7 @@ class Game extends Base
$this->error(__('No rows were found'));
}
$this->model->where('id', $model['id'])->setInc('attention');
$model['cost'] = json_decode($model['cost'] ?? '[]', true);
$model['referee'] = explode(',', $model['referee']);

View File

@@ -66,10 +66,10 @@ return [
"Type0" => "一次性",
"Type1" => "周期性",
"Status0" => "未开始",
"Status0" => "发布",
"Status1" => "报名中",
"Status2" => "进行",
"Status3" => "结束",
"Status2" => "比赛",
"Status3" => "结束",
"Week0" => "周日",
"Week1" => "周一",

View File

@@ -593,13 +593,14 @@ if (!function_exists('dd')) {
*/
function dd(...$params)
{
echo '<pre>';
echo '
';
foreach ($params as $p) {
print_r($p);
echo '
<br>';
';
}
echo '</pre>';
// echo '</pre>';
die;
}
}
@@ -610,9 +611,10 @@ if (!function_exists('getsql')) {
*/
function getsql($query)
{
echo '<pre>';
echo '
';
print_r($query->fetchSql()->select());
echo '</pre>';
// echo '</pre>';
die;
}
}