71 lines
2.0 KiB
PHP
71 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\ExaminationInformation;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\ExaminationInformation\InfoArticle as ModelinfoArticle;
|
|
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 InfoArticle extends BaseController
|
|
{
|
|
/**
|
|
* 获取资讯文章列表
|
|
*/
|
|
public function getinfoArticleList(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
$con = [];
|
|
|
|
$this->validate($params, [
|
|
'info_article_type_id|文章类型id' => 'require',
|
|
]);
|
|
$con = Tool::getOptionalQuery(['b.info_article_type_id', '='],);
|
|
|
|
$query = ModelinfoArticle::where($con)
|
|
->field([
|
|
'a.info_article_id',
|
|
'a.info_article_type_guid',
|
|
'b.info_article_type_name',
|
|
'a.info_article_title',
|
|
'a.info_article_create_time',
|
|
'a.info_article_cover',
|
|
])
|
|
->alias('a')
|
|
->leftjoin('info_article_type b', 'a.info_article_type_guid = b.info_article_type_guid')
|
|
->hidden(['info_article_type_guid'])
|
|
->order('info_article_order', 'asc');
|
|
|
|
return msg("获取资讯文章列表成功!", $query);
|
|
}
|
|
|
|
/**
|
|
* 获取资讯文章详情
|
|
*/
|
|
public function getinfoArticleInfo(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
|
|
$this->validate($params, ['info_article_id' => 'require']);
|
|
|
|
$find = ModelinfoArticle::field([
|
|
'info_article_id',
|
|
'info_article_title',
|
|
'info_article_content',
|
|
'info_article_create_time',
|
|
])
|
|
->where('info_article_id', $params['info_article_id'])
|
|
->find();
|
|
|
|
return msg(0, '获取资讯文章详情成功!', ['data' => $find]);
|
|
}
|
|
}
|