site_api/app/api/controller/Home/Highlights/Highlights.php
2024-05-02 21:48:35 +08:00

52 lines
1.4 KiB
PHP

<?php
namespace app\api\controller\Home\Highlights;
use app\BaseController;
use app\common\model\Home\Highlights\Highlights as ModelHighlights;
use app\Request;
use think\Validate;
use think\exception\ValidateException;
use think\facade\Filesystem;
use app\common\arw\adjfut\src\Excel;
use app\common\arw\adjfut\src\UploadFile;
use think\facade\Db;
use app\common\exception\Tool;
use think\facade\Env;
class Highlights extends BaseController
{
/**
* 获取亮点列表
*/
public function getHighlightsList(Request $request): array
{
$params = $request->param();
$con = [];
$this->validate($params, ['locale' => 'require']);
$con = Tool::getOptionalQuery(['c.i18n_lang_type_code', '=', 'locale']);
$query = ModelHighlights::where($con)
->alias('a')
->leftjoin('i18n_lang_type c', 'a.i18n_lang_type_guid = c.i18n_lang_type_guid')
->field([
'a.highlights_id',
'a.highlights_guid',
'a.i18n_lang_type_guid',
'c.i18n_lang_type_code',
'a.highlights_title',
'a.highlights_sort'
])
->order('highlights_sort', 'asc')
->select();
return msg(0, "获取亮点列表成功!", [
'data' => $query,
'count' => count($query)
]);
}
}