修正更新自动时间戳

This commit is contained in:
yumo 2023-07-17 18:45:41 +08:00
parent d7a0de97db
commit d7df6222fe
16 changed files with 21 additions and 32 deletions

View File

@ -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]);

View File

@ -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();

View File

@ -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();

View File

@ -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]);

View File

@ -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']]);
}

View File

@ -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 .= '<url>';
$str .= '<loc>' . url('index/article/lists',["id"=>$v["alias"]?:$v['id']],".html",$domain) . '</loc>';
$str .= '<lastmod>' . date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])) . '</lastmod>';
@ -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 .= '<url>';
$str .= '<loc>' . url('/index/article/detail',["id"=>$v["alias"]?:$v['id']],".html",$domain) . '</loc>';
$str .= '<lastmod>' . date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])) . '</lastmod>';
$str .= '<lastmod>'.date("Y-m-d\TH:i:s+00:00",strtotime($v['create_time'])) .'</lastmod>';
$str .= '<changefreq>monthly</changefreq>';
$str .= '<priority>0.6</priority>';
$str .= '</url>';

View File

@ -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]);

View File

@ -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();

View File

@ -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();

View File

@ -43,7 +43,7 @@ class AdminNotify extends BaseModel
*/
public static function addLog(array $data)
{
return self::insert($data);
return self::create($data);
}
/**

View File

@ -16,6 +16,9 @@ class BaseModel extends Model
private static $transaction = 0;
private static $DbInstance = [];
//自动时间戳
protected $autoWriteTimestamp = true;
/**
* 获取错误信息
* @param string $defaultMsg

View File

@ -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

View File

@ -12,10 +12,6 @@ use app\common\model\UvLog as UvLogModel;
*/
class PvLog extends BaseModel
{
//自动时间戳
protected $autoWriteTimestamp = true;
public function del_data()
{
//获取七天前日期

View File

@ -8,10 +8,6 @@ namespace app\common\model;
*/
class UrlLog extends BaseModel
{
//自动时间戳
protected $autoWriteTimestamp = true;
//更新url_log
public function set_url($title, $url)
{

View File

@ -8,7 +8,4 @@ namespace app\common\model;
*/
class UvLog extends BaseModel
{
//自动时间戳
protected $autoWriteTimestamp = true;
}

View File

@ -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;
-- ----------------------------