50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Pingan_users_log_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_pingan_users_log';
|
|
const TYPE_ADD = 1;
|
|
const TYPE_UPDATE = 2;
|
|
|
|
const TYPE_LIST = [
|
|
self::TYPE_ADD => '新增',
|
|
self::TYPE_UPDATE => '更新'
|
|
];
|
|
const SHOW_CONTENT_LIST = [
|
|
"username" => "姓名",
|
|
"userCode" => "工号",
|
|
"centerNumber" => "中心",
|
|
"orgName" => "归属机构"
|
|
];
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
public function getChangeData($row)
|
|
{
|
|
$this->load->model('agent/pingan/pingan_users_model');
|
|
$beforeData = json_decode($row['beforeData'], true);
|
|
$afterData = json_decode($row['afterData'], true);
|
|
$beforeContent = "";
|
|
$afterContent = "";
|
|
foreach (self::SHOW_CONTENT_LIST as $key => $value) {
|
|
if ($beforeData[$key] != $afterData[$key]) {
|
|
$beforeValue = $beforeData[$key] ?: "";
|
|
$afterValue = $afterData[$key] ?: "";
|
|
if ($key == "centerNumber") {
|
|
$beforeValue && $beforeValue = Pingan_users_model::TYPE_CENTER[$beforeValue];
|
|
$afterValue && $afterValue = Pingan_users_model::TYPE_CENTER[$afterValue];
|
|
}
|
|
$beforeContent .= "$value: 【{$beforeValue}】";
|
|
$afterContent .= "$value: 【{$afterValue}】";
|
|
}
|
|
}
|
|
return [
|
|
'beforeContent' => $beforeContent,
|
|
'afterContent' => $afterContent
|
|
];
|
|
}
|
|
} |