DiverseYouthNightSchool/application/api/controller/Index.php

79 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\api\controller;
use app\common\controller\Api;
use app\common\model\style\HomeImages;
/**
* 首页接口
*/
class Index extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 首页
*
*/
public function index()
{
$this->success('请求成功');
}
/**
* 各种协议文章
* @ApiSummary(about_us 关于夜校 site.entry_agreement 入驻协议)
* @ApiMethod (GET)
*/
public function agreement()
{
$data = [
'about_us' => config("site.about_us"),
'entry_agreement' => config("site.entry_agreement")
];
$this->success(__('查询成功'), $data);
}
/**
* @ApiTitle(init接口小程序初始化参数接口)
* @ApiSummary(小程序初始化参数接口)
* @ApiRoute(/api/index/init)
* @ApiMethod(GET)
* @ApiReturn({
"code" => 1,
"msg" => "获取成功",
"data" => {}
*})
*/
public function init() {
$home_data = [];
$home_data['top_image'] = [
'type' => config('site.home_top_type'),
'image' => cdnurl(config('site.home_top_image'), true),
'url' => config('site.home_top_url'),
];
//首页轮播图
$home_data['top_images'] = HomeImages::allList(1, 20);
$base_info = [
"site_name"=>config('site.name'),
// "site_logo"=>cdnurl(config('site.logo'), true),
"site_beian"=>config('site.beian'),
"site_version"=>''.config('site.version'),
"site_city"=>config('site.the_city'),
"site_timezone"=>config('site.timezone'),
];
$this->success('',["base_info"=>$base_info,"home_data"=>$home_data]);
}
}