db->name('SystemData')->where(['name' => $name])->value('value'), true); return empty($data) ? [] : $data; } else { return data_save('SystemData', ['name' => $name, 'value' => json_encode($value, JSON_UNESCAPED_UNICODE)], 'name'); } } } if (!function_exists('sysoplog')) { /** * 写入系统日志 * @param string $action 日志行为 * @param string $content 日志内容 * @return boolean */ function sysoplog($action, $content) { return app()->db->name('SystemOplog')->insert([ 'node' => NodeExtend::getCurrent(), 'action' => $action, 'content' => $content, 'geoip' => PHP_SAPI === 'cli' ? '127.0.0.1' : app()->request->ip(), 'username' => PHP_SAPI === 'cli' ? 'cli' : app()->session->get('user.username'), ]); } }