| // +------------------------------------------------+ 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) . '
'; } } else { $string = $content; } return $string; } else { return ''; } } }