仓库初始化
This commit is contained in:
66
application/api/controller/Page.php
Normal file
66
application/api/controller/Page.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
|
||||
class Page extends controller
|
||||
{
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
//允许跨域
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
}
|
||||
/*
|
||||
* 单页查询
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
public function get_page_by_id()
|
||||
{
|
||||
$id = input('id', '');
|
||||
$reslut = model('Page')->get_page($id);
|
||||
return V(1,'操作成功', $reslut);
|
||||
}
|
||||
/*
|
||||
* 单页输出
|
||||
* @param id
|
||||
* @return html
|
||||
*/
|
||||
public function page_show()
|
||||
{
|
||||
$id = input('id', '');
|
||||
$reslut = model('Page')->get_page($id);
|
||||
$html = $reslut['content'] ? $reslut['content'] : '';
|
||||
//解析html
|
||||
$html = htmlspecialchars_decode($html);
|
||||
return $html;
|
||||
}
|
||||
/*
|
||||
* 用户服务协议
|
||||
*/
|
||||
public function user_agreement()
|
||||
{
|
||||
$id = 1;
|
||||
$reslut = model('Page')->get_page($id);
|
||||
$html = $reslut['content'] ? $reslut['content'] : '';
|
||||
//解析html
|
||||
$html = htmlspecialchars_decode($html);
|
||||
return $html;
|
||||
}
|
||||
|
||||
/*
|
||||
* 盲盒规则链接
|
||||
*/
|
||||
public function get_gift_box_rule(){
|
||||
$box_id = input('box_id',0);
|
||||
$gift_bag = Db::name('vs_gift_bag')->where('id',$box_id)->find();
|
||||
if(empty($gift_bag)){
|
||||
echo '参数错误';
|
||||
}
|
||||
$ext = json_decode($gift_bag['ext'],true);
|
||||
echo $ext['introd']??"";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user