| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- // +----------------------------------------------------------------------
- // | saiadmin [ saiadmin快速开发框架 ]
- // +----------------------------------------------------------------------
- // | Author: your name
- // +----------------------------------------------------------------------
- namespace app\v1\logic\center;
- use plugin\saiadmin\basic\BaseLogic;
- use plugin\saiadmin\exception\ApiException;
- use app\v1\model\center\GameMain;
- use plugin\saiadmin\app\model\system\SystemUser;
- /**
- * 主包管理逻辑层
- */
- class GameMainLogic extends BaseLogic
- {
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->model = new GameMain();
- }
- /**
- * 获取主游戏options列表
- * @param int $userId
- * @return array
- */
- public function getMainGameOptions()
- {
- $list = $this->model->field('id,name')->where('status', 1)->order('sort', 'desc')->select()->toArray();
- $list = array_map(function ($item) {
- return [
- 'label' => $item['name'],
- 'value' => $item['id']
- ];
- }, $list);
- return $list;
- }
- /**
- * 根据主包ID获取主包名称
- * @param int $mainId
- * @return string
- */
- public function getMainGameNameById($mainId)
- {
- return $this->model->where('id', $mainId)->value('name');
- }
- /**
- * 获取主包map
- * @return array
- */
- public function getMainGameMap()
- {
- return $this->model->column('name', 'id');
- }
- }
|