💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![](https://img.kancloud.cn/1a/03/1a03b8ee2e35d08f314bc2c098e18783_1102x727.png)我们约定每张表必须对应一个模型,还是以示例模块为例,以上一步的文章分类表cms_cate为例,应该在/application/cms/model目录下创建模型文件Cate.php,文件内容如下: 注意`namespace app\core\cate;`、`class Cate extends Common`和`protected $table = 'ia_example_cate';`需要根据实际情况修改。 ``` <?php /** * +---------------------------------------------------------------------- * | UniAdmin [ 渐进式模块化通用后台 ] * +---------------------------------------------------------------------- * | Copyright (c) 2018-2020 http://uniadmin.jiangruyi.com All rights reserved. * +---------------------------------------------------------------------- * | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) * +---------------------------------------------------------------------- * | Author: jry <ijry@qq.com> * +---------------------------------------------------------------------- */ namespace app\cms\cate; use app\core\model\Common; use think\Model; use think\model\concern\SoftDelete; class Cate extends Common { // 设置当前模型对应的完整数据表名称 protected $table = 'xy_cms_cate'; public static function init() { parent::init(); } // 软删除 use SoftDelete; protected $deleteTime = 'delete_time'; protected $defaultSoftDelete = 0; } ```