Index.php 1.1 KB
<?php

namespace app\api\controller;

use app\api\model\News;
use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * @ApiTitle    (首页轮播图)
     * @ApiMethod   (POST)
     * @ApiHeaders  (name=token, type=string, required=true, description="请求的Token")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功'
    'data':'轮播图数组'
    })
     */
    public function banner()
    {

        $model  = new News();
        $list = $model->where('status','normal')->column('image');
        $this->success('banner',$list);
    }

    /**
     * @ApiTitle    (首页分类)
     * @ApiMethod   (POST)
     * @ApiHeaders  (name=token, type=string, required=true, description="请求的Token")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功'
    'data':'轮播图数组'
    })
     */
    public function category()
    {

        $model  = new Cat();
        $list = $model->where('status','normal')->column('image');
        $this->success('banner',$list);
    }
}