DiverseYouthNightSchool/application/api/controller/WechatUtil.php

66 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?php
namespace app\api\controller;
use app\common\controller\Api;
use app\common\model\style\HomeImages;
/**
* 微信工具类接口
*/
class WechatUtil extends Api
{
protected $noNeedLogin = ['scheme'];
protected $noNeedRight = ['*'];
public function index()
{
$this->success('请求成功');
}
/**
* @ApiTitle(微信小程序生成url-scheme)
* @ApiSummary(微信小程序生成url-scheme)
* @ApiRoute(/api/wechat_util/scheme)
* @ApiMethod(POST)
* @ApiParams (name="id", type="integer", required=true, description="会员ID")
* @ApiParams (name="name", type="string", required=true, description="用户名")
* @ApiParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn({
"code" => 1,
"msg" => "获取成功",
"data" => {}
*})
*/
public function scheme() {
$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]);
}
}