Files
2025-09-22 18:52:07 +08:00

67 lines
1.4 KiB
PHP

<?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']??"";
}
}