- Contract.php: 返回合约账户余额(balance_contract) - My.php: 地址管理增加BTC/ETH - AppContract.php: 一键平仓(closeall) - AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2) - site.php: 手续费减半(0.018→0.009) - agent_permission_setup.sql: 代理权限SQL - crypto_news_crawler.py: 新闻自动采集脚本
38 lines
957 B
PHP
Executable File
38 lines
957 B
PHP
Executable File
<?php
|
|
|
|
namespace app\api\library;
|
|
|
|
use Exception;
|
|
use think\exception\Handle;
|
|
|
|
/**
|
|
* 自定义API模块的错误显示
|
|
*/
|
|
class ExceptionHandle extends Handle
|
|
{
|
|
|
|
public function render(Exception $e)
|
|
{
|
|
// 在生产环境下返回code信息
|
|
if (!\think\Config::get('app_debug')) {
|
|
$statuscode = $code = 500;
|
|
$msg = 'An error occurred';
|
|
// 验证异常
|
|
if ($e instanceof \think\exception\ValidateException) {
|
|
$code = 0;
|
|
$statuscode = 200;
|
|
$msg = $e->getError();
|
|
}
|
|
// Http异常
|
|
if ($e instanceof \think\exception\HttpException) {
|
|
$statuscode = $code = $e->getStatusCode();
|
|
}
|
|
return json(['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => null], $statuscode);
|
|
}
|
|
|
|
//其它此交由系统处理
|
|
return parent::render($e);
|
|
}
|
|
|
|
}
|