1
0
Files
helper/application/common/model/Logs.php
2020-08-06 14:58:51 +08:00

60 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\common\model;
class Logs extends _Init
{
/**
* 关闭更新时间写入
*/
protected $updateTime = false;
/**
* 转换datas数据
* @param [type] $value 数据内容
*/
protected function setDatasAttr($value)
{
return !empty($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : '';
}
/**
* 获取昵称
*/
protected function getUidTextAttr($value, $data)
{
return MemberInfo::where('uid', $data['uid'])->value('nickname');
}
/**
* 格式化datas数据
* @param [type] $value datas数据
* @param [type] $data 数据集合
*/
protected function getDatasTextAttr($value, $data)
{
$content = $data['datas'];
if (!empty($content)) {
$content = json_decode($content);
$string = '';
if (is_object($content) && !empty($content)) {
foreach ($content as $key => $value) {
$string .= $key . ' : ' . json_encode($value, JSON_UNESCAPED_UNICODE) . '<br/>';
}
} else {
$string = $content;
}
return $string;
} else {
return '';
}
}
}