<?php

namespace app\api\controller\infoArticleType;

use app\BaseController;
use app\common\model\infoArticleType\infoArticleType as ModelinfoArticleType;
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 infoArticleType extends BaseController
{
    /**
     * 获取资讯文章类型列表
     */
    public function getinfoArticleTypeList(Request $request): array
    {
        $params = $request->param();
        $con = [];

        $con = Tool::getOptionalQuery();

        $query = ModelinfoArticleType::where($con)
            ->field([
'info_article_type_id',
'info_article_type_guid',
'info_article_type_name',
'info_article_type_sort'
])
            ->order('info_article_type_sort', 'asc');

        

        return msg("获取资讯文章类型列表成功!",$query);
    }

    /**
     * 获取资讯文章类型详情
     */
    public function getinfoArticleTypeInfo(Request $request): array
    {
        $params = $request->param();

        $this->validate($params, ['info_article_type_guid' => 'require']);

        $find = ModelinfoArticleType::field([
'info_article_type_id',
'info_article_type_guid',
'info_article_type_name',
'info_article_type_sort'
])
                ->where('info_article_type_guid',$params['info_article_type_guid'])
                ->find();

        return msg(0,'获取资讯文章类型详情成功!',['data' => $find]);
    }

}
