/**
*
* API接口明细记录
* @param $uid
* @param string $classify 模块
* @param string $type 变动类型
* @param string $url 接口地址
* @param string $content 发送内容
* @param string $result 返回值
* @return bool
*/
function apilog($classify, $type, $url, $content, $result)
{
$destination = RUNTIME_PATH . 'log' . DS . date("Ym") . DS . date('d') . 'api.log';
$path = dirname($destination);
!is_dir($path) && mkdir($path, 0755, true);
if (is_file($destination) && floor(2097152) <= filesize($destination)) {
rename($destination, dirname($destination) . DS . time() . '-' . basename($destination));
}
$now = '[ 创建时间 ] ' . date("Y-m-d H:i:s");
$localurl = '[ 运行链接 ] ' . getUrl();
$classify = '[ 模块 ] ' . $classify;
$type = '[ 类型 ] ' . $type;
$url = '[ 接口链接 ] ' . $url;
$message = "---------------------------------------------------------------\r\n{$now}\r\n{$localurl}\r\n{$classify}\r\n{$type}\r\n{$url}\r\n";
$f = fopen($destination, 'a');
$file = fwrite($f, print_r($message . '[ 接口内容 ] ', true));
$file = fwrite($f, print_r($content, true));
$file = fwrite($f, print_r("\r\n[ 接口返回结果 ] ", true));
$file = fwrite($f, print_r($result, true));
$file = fwrite($f, print_r("\r\n\r\n", true));
return true;
}