diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index 9ad03c8..0d149ce 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -158,7 +158,7 @@ class Admin extends AuthController $data['create_user'] = $this->adminId; $data['create_time'] = time(); $data['update_time'] = time(); - aModel::insert($data); + aModel::create($data); //添加前台用户 $userId = userModel::addAdminUser($data); $res = aModel::update(['uid' => $userId], ['id' => $id]); diff --git a/app/admin/controller/AdminAuth.php b/app/admin/controller/AdminAuth.php index 39bf1dc..bd6a2a1 100644 --- a/app/admin/controller/AdminAuth.php +++ b/app/admin/controller/AdminAuth.php @@ -129,7 +129,7 @@ class AdminAuth extends AuthController if ($id == "") { $data['create_user'] = $this->adminId; $data['create_time'] = time(); - $res = aModel::insert($data); + $res = aModel::create($data); } else { $data['update_user'] = $this->adminId; $data['update_time'] = time(); diff --git a/app/admin/controller/AdminRole.php b/app/admin/controller/AdminRole.php index a09de4c..f7ac596 100644 --- a/app/admin/controller/AdminRole.php +++ b/app/admin/controller/AdminRole.php @@ -103,7 +103,7 @@ class AdminRole extends AuthController if ($id == "") { $data['create_user'] = $this->adminId; $data['create_time'] = time(); - $res = rModel::insert($data); + $res = rModel::create($data); } else { $data['update_user'] = $this->adminId; $data['update_time'] = time(); diff --git a/app/admin/controller/Advert.php b/app/admin/controller/Advert.php index fc1f717..4e3aa75 100644 --- a/app/admin/controller/Advert.php +++ b/app/admin/controller/Advert.php @@ -107,7 +107,7 @@ class Advert extends AuthController $info = aModel::where("alias",$data['alias'])->find($id); if ($info) return app("json")->fail("标识已存在,请修改后重试"); $data['create_time'] = time(); - $res = aModel::insert($data); + $res = aModel::create($data); } else { $data['update_time'] = time(); $res = aModel::update($data, ['id' => $id]); diff --git a/app/admin/controller/Category.php b/app/admin/controller/Category.php index 50cc377..e452c81 100644 --- a/app/admin/controller/Category.php +++ b/app/admin/controller/Category.php @@ -73,7 +73,7 @@ class Category extends AuthController if ($data['alias'] == "") $data['alias'] = get_rand_str(8); if ($data['id'] == "") { $model = new aModel(); - $res = $model->insert($data); + $res = $model->create($data); } else { $res = aModel::update($data, ['id' => $data['id']]); } diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 56d434e..4b47a3f 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -110,10 +110,13 @@ class Index extends AuthController //获取文章分类url $documentCategoryModel = new DocumentCategoryModel(); $categoryInfo = $documentCategoryModel->field('id,alias,title,create_time') - ->where('status', 1)->where('status', 1) + ->where('status', 1) ->page($page, $pagesize) ->order('id desc')->select(); foreach ($categoryInfo as $v) { + echo $v['create_time']; + echo date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])); + echo strtotime($v['create_time']);die(); $str .= ''; $str .= '' . url('index/article/lists',["id"=>$v["alias"]?:$v['id']],".html",$domain) . ''; $str .= '' . date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])) . ''; @@ -129,9 +132,11 @@ class Index extends AuthController ->order('id desc')->select(); foreach ($documentInfo as $v) { + echo date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])); + echo strtotime($v['create_time']);die(); $str .= ''; $str .= '' . url('/index/article/detail',["id"=>$v["alias"]?:$v['id']],".html",$domain) . ''; - $str .= '' . date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])) . ''; + $str .= ''.date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])) .''; $str .= 'monthly'; $str .= '0.6'; $str .= ''; diff --git a/app/admin/controller/Nav.php b/app/admin/controller/Nav.php index b7f882a..435077d 100644 --- a/app/admin/controller/Nav.php +++ b/app/admin/controller/Nav.php @@ -117,7 +117,7 @@ class Nav extends AuthController if ($data['url'] == "") return app("json")->fail("链接不能为空"); if ($id == "") { $data['create_time'] = time(); - $res = aModel::insert($data); + $res = aModel::create($data); } else { $data['update_time'] = time(); $res = aModel::update($data, ['id' => $id]); diff --git a/app/admin/controller/SystemConfig.php b/app/admin/controller/SystemConfig.php index 1f402a9..96844e9 100644 --- a/app/admin/controller/SystemConfig.php +++ b/app/admin/controller/SystemConfig.php @@ -185,7 +185,7 @@ class SystemConfig extends AuthController if ($id == "") { $data['create_user'] = $this->adminId; $data['create_time'] = time(); - $res = cModel::insert($data); + $res = cModel::create($data); } else { $data['update_user'] = $this->adminId; $data['update_time'] = time(); diff --git a/app/admin/controller/SystemConfigTab.php b/app/admin/controller/SystemConfigTab.php index cd20cd9..e494db5 100644 --- a/app/admin/controller/SystemConfigTab.php +++ b/app/admin/controller/SystemConfigTab.php @@ -95,7 +95,7 @@ class SystemConfigTab extends AuthController if ($id == "") { $data['create_user'] = $this->adminId; $data['create_time'] = time(); - $res = tModel::insert($data); + $res = tModel::create($data); } else { $data['update_user'] = $this->adminId; $data['update_time'] = time(); diff --git a/app/common/model/AdminNotify.php b/app/common/model/AdminNotify.php index 1c008e9..15ad4e9 100644 --- a/app/common/model/AdminNotify.php +++ b/app/common/model/AdminNotify.php @@ -43,7 +43,7 @@ class AdminNotify extends BaseModel */ public static function addLog(array $data) { - return self::insert($data); + return self::create($data); } /** diff --git a/app/common/model/BaseModel.php b/app/common/model/BaseModel.php index cb1650e..154f3cd 100644 --- a/app/common/model/BaseModel.php +++ b/app/common/model/BaseModel.php @@ -16,6 +16,9 @@ class BaseModel extends Model private static $transaction = 0; private static $DbInstance = []; + //自动时间戳 + protected $autoWriteTimestamp = true; + /** * 获取错误信息 * @param string $defaultMsg diff --git a/app/common/model/Document.php b/app/common/model/Document.php index e187b6b..b6cdd97 100644 --- a/app/common/model/Document.php +++ b/app/common/model/Document.php @@ -87,15 +87,7 @@ class Document extends BaseModel /** * 更新文件信息 - * @param $dat - * @param string $type - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - /** - * 更新文件信息 - * @param $dat + * @param $date * @param string $type * @throws DataNotFoundException * @throws DbException diff --git a/app/common/model/PvLog.php b/app/common/model/PvLog.php index 08b2c17..9dda339 100644 --- a/app/common/model/PvLog.php +++ b/app/common/model/PvLog.php @@ -12,10 +12,6 @@ use app\common\model\UvLog as UvLogModel; */ class PvLog extends BaseModel { - - //自动时间戳 - protected $autoWriteTimestamp = true; - public function del_data() { //获取七天前日期 diff --git a/app/common/model/UrlLog.php b/app/common/model/UrlLog.php index 47a8cb9..54ba03e 100644 --- a/app/common/model/UrlLog.php +++ b/app/common/model/UrlLog.php @@ -8,10 +8,6 @@ namespace app\common\model; */ class UrlLog extends BaseModel { - - //自动时间戳 - protected $autoWriteTimestamp = true; - //更新url_log public function set_url($title, $url) { diff --git a/app/common/model/UvLog.php b/app/common/model/UvLog.php index a47ae59..9cbf7fb 100644 --- a/app/common/model/UvLog.php +++ b/app/common/model/UvLog.php @@ -8,7 +8,4 @@ namespace app\common\model; */ class UvLog extends BaseModel { - - //自动时间戳 - protected $autoWriteTimestamp = true; } \ No newline at end of file diff --git a/public/install/ape_blog.sql b/public/install/ape_blog.sql index 86e558a..8650d49 100644 --- a/public/install/ape_blog.sql +++ b/public/install/ape_blog.sql @@ -409,7 +409,7 @@ CREATE TABLE `ape_document_category` ( -- Records of ape_document_category -- ---------------------------- BEGIN; -INSERT INTO `ape_document_category` (`id`, `title`, `alias`, `icon`, `type`, `pid`, `sort`, `meta_title`, `keywords`, `description`, `status`, `template`, `link_str`, `view`, `create_time`, `update_time`) VALUES (1, '关于小站', '', '', 0, 0, 99, '关于小站', '关于小站,源码云,源码云博客,关于源码云博客', '源码云博客,源码云博客网站', 1, 'list_default.html', '', 80, 0, 1642089484); +INSERT INTO `ape_document_category` (`id`, `title`, `alias`, `icon`, `type`, `pid`, `sort`, `meta_title`, `keywords`, `description`, `status`, `template`, `link_str`, `view`, `create_time`, `update_time`) VALUES (1, '关于小站', '', '', 0, 0, 99, '关于小站', '关于小站,源码云,源码云博客,关于源码云博客', '源码云博客,源码云博客网站', 1, 'list_default.html', '', 80, 1642089484, 1642089484); COMMIT; -- ----------------------------