<?php
/**
 * ===========================================================================
 * Veitool 快捷开发框架系统
 * Author: Niaho 26843818@qq.com
 * Copyright (c)2019-2025 www.veitool.com All rights reserved.
 * Licensed: 这不是一个自由软件，不允许对程序代码以任何形式任何目的的再发行
 * ---------------------------------------------------------------------------
 */

namespace app\model;

use think\facade\Db;
use think\Model;

/**
 * 模型公用类
 */
class ArticleModel extends Model
{

    protected $name = 'article';


    public function getCateNameAttr($value, $data)
    {

        return Db::name('article_category')->where('id', $data['cate_id'])->value('title');
    }

    public function getCreatetimeAttr($value, $data)
    {

        return date('Y-m-d H:i:s', $data['createtime']);
    }

    //获取发布者
    public function getAdminnameAttr($value, $data)
    {

        return Db::name('system_manager')->where('userid', $data['admin_id'])->value('username');
    }

    public function getThumbpathAttr($value, $data)
    {
        return get_upload_file($data['thumb']);
    }

}