lihai-oa/app/api/common.php

35 lines
912 B
PHP

<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-3.0
* @link https://www.gougucms.com
*/
use think\facade\Db;
//读取文章分类列表
function get_article_cate()
{
$cate = \think\facade\Db::name('ArticleCate')->order('create_time asc')->select()->toArray();
return $cate;
}
//写入日志
function add_project_log($uid,$module,$param,$old)
{
$log_data = [];
$key_array = ['id', 'create_time', 'update_time', 'delete_time', 'over_time', 'md_content'];
foreach ($param as $key => $value) {
if (!in_array($key, $key_array)) {
$log_data[] = array(
'module' => $module,
'field' => $key,
$module . '_id' => $param['id'],
'admin_id' => $uid,
'old_content' => $old[$key],
'new_content' => $value,
'create_time' => time(),
);
}
}
Db::name('ProjectLog')->strict(false)->field(true)->insertAll($log_data);
}