1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\service\api\diy;
- use app\dict\diy\AdvPositionDict;
- use app\model\diy\Adv;
- use core\base\BaseApiService;
- use core\exception\ApiException;
- /**
- * 广告服务层
- * Class DiyService
- * @package app\service\api\diy
- */
- class AdvService extends BaseApiService
- {
- public function __construct()
- {
- parent::__construct();
- $this->model = new Adv();
- }
- /**
- * 获取广告信息
- * @return array
- */
- public function getInfo(string $ap_key)
- {
- $adv_position = AdvPositionDict::getAdvPosition();
- $position_list = array_column($adv_position,null,'keywords');
- if(!array_key_exists($ap_key, $position_list)) throw new ApiException("DIY_ADV_POSITION_NOT_EXIST");
- $info = $position_list[$ap_key];
- $info['adv_list'] = $this->model->where([['ap_key', '=', $ap_key]])->order('slide_sort desc')->select()->toArray();
- return $info;
- }
- }
|