Files

122 lines
2.3 KiB
PHP

<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:19:33
* @Description:
* @FilePath: \ywxapp_dev\app\backend\controller\Other.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\controller;
use think\Request;
use think\facade\View;
use think\facade\Db;
use think\facade\Config;
/**
* Other 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Other
{
/**
* Summary of needLogin
* @var array
*/
protected $noNeedLogin = [ ];
/**
* Summary of needRight
* @var array
*/
protected $noNeedVerify = ['*'];
/**
* 控制器初始化 initialize
* @return void
*/
protected function initialize()
{}
/**
* 关于
*/
public function about()
{
if (request()->isAjax()) {
return json([
'name' => 'YwxApp',
'version' => \think\facade\App::version(),
'php' => PHP_VERSION,
]);
}
return View::fetch();
}
/**
* 全局搜索(文章标题)
*/
public function search(Request $request)
{
$q = $request->param('q', '');
if (request()->isAjax() && $q) {
$list = Db::name('articles_article')
->where('title', 'like', '%' . $q . '%')
->limit(20)
->select();
return json(['code' => 0, 'data' => $list]);
}
return View::fetch();
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id = null)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}