|
|
@@ -0,0 +1,62 @@
|
|
|
+<?php
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | saiadmin [ saiadmin快速开发框架 ]
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Author: your name
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+namespace app\v1\controller\center;
|
|
|
+
|
|
|
+use plugin\saiadmin\basic\BaseController;
|
|
|
+use app\v1\logic\center\GameGroupLogic;
|
|
|
+use app\v1\validate\center\GameGroupValidate;
|
|
|
+use support\Request;
|
|
|
+use support\Response;
|
|
|
+use support\think\Db;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 游戏分组控制器
|
|
|
+ */
|
|
|
+class GameGroupController extends BaseController
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ */
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $this->logic = new GameGroupLogic();
|
|
|
+ $this->validate = new GameGroupValidate;
|
|
|
+ parent::__construct();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据列表
|
|
|
+ * @param Request $request
|
|
|
+ * @return Response
|
|
|
+ */
|
|
|
+ public function index(Request $request): Response
|
|
|
+ {
|
|
|
+ $where = $request->more([
|
|
|
+ ['name', ''],
|
|
|
+ ]);
|
|
|
+ $query = $this->logic->search($where);
|
|
|
+ $query->order('sort', 'desc');
|
|
|
+ $data = $this->logic->getList($query);
|
|
|
+
|
|
|
+ $allGameList = Db::connect('db_center')->table('pf_game')->field('id,name')->select()->toArray();
|
|
|
+ $allGameList = array_column($allGameList, 'name', 'id');
|
|
|
+
|
|
|
+ foreach ($data['data'] as $key => $value) {
|
|
|
+ $gameList = [];
|
|
|
+ $game_list = explode(',', $value['game_list']);
|
|
|
+ foreach ($game_list as $game_id) {
|
|
|
+ $gameList[] = $allGameList[$game_id] ?? '';
|
|
|
+ }
|
|
|
+ $data['data'][$key]['game_list_str'] = $gameList;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->success($data);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|