init commit
This commit is contained in:
77
application/api/model/wdsxh/article/Article.php
Normal file
77
application/api/model/wdsxh/article/Article.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* Class Article
|
||||
* Desc 文章管理
|
||||
* Create on 2024/3/12 10:10
|
||||
* Create by @小趴菜
|
||||
*/
|
||||
|
||||
namespace app\api\model\wdsxh\article;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'wdsxh_article';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = true;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected function getCreatetimeAttr($value)
|
||||
{
|
||||
$new_date = date("Y-m-d H:i", $value);
|
||||
return $new_date;
|
||||
}
|
||||
|
||||
protected function getImageAttr($value)
|
||||
{
|
||||
return wdsxh_full_url($value);
|
||||
}
|
||||
|
||||
protected function getFilesAttr($value, $data)
|
||||
{
|
||||
$return_data = [];
|
||||
if (empty($value)) {
|
||||
return $return_data;
|
||||
} else {
|
||||
$filesdataArray = json_decode($data['filesdata'], true);
|
||||
$array = explode(',',$value);
|
||||
foreach ($array as $k=>$v) {
|
||||
// 获取文件扩展名
|
||||
$path_parts = pathinfo($v);
|
||||
$extension = isset($path_parts['extension']) ? '.' . $path_parts['extension'] : '';
|
||||
|
||||
// 拼接文件名和扩展名
|
||||
$fullName = $filesdataArray[$k]['name'] . $extension;
|
||||
|
||||
$return_data[$k] = array(
|
||||
'name'=>$fullName,
|
||||
'file'=>wdsxh_full_url($v),
|
||||
);
|
||||
}
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
30
application/api/model/wdsxh/article/ArticleCat.php
Normal file
30
application/api/model/wdsxh/article/ArticleCat.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* Class ArticleCat
|
||||
* Desc 文章分类
|
||||
* Create on 2024/3/12 11:36
|
||||
* Create by @小趴菜
|
||||
*/
|
||||
|
||||
namespace app\api\model\wdsxh\article;
|
||||
|
||||
use app\api\model\wdsxh\Base;
|
||||
|
||||
class ArticleCat extends Base
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'wdsxh_article_cat';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user