| 项目 | 详情 |
|---|---|
| 审查日期 | 2026年5月19日 |
| 审查范围 | 代码规范、重复代码、复杂度、命名规范、注释质量 |
| 发现问题数 | 28个 |
| 高风险 | 8个 |
| 中风险 | 12个 |
| 低风险 | 8个 |
| 区域 | 重复度估算 | 浪费行数 |
|---|---|---|
| 53个渠道适配器 | ~58% | ~3,200行 |
| guildapi vs mcpsapi | ~45% | ~3,000行 |
| home vs mobile | ~48% | ~1,900行 |
| 支付相关 Service | ~35% | ~400行 |
| common.php 重复函数 | 100% | ~800行 |
| 总计 | ~9,300行 |
位置:api/complex/ 目录
结构性重复:
getSuccess() / getFail() 方法 95% 相同checkLogin() / paySign() 流程模板 60% 相同完全相同的文件对:
| 文件对 | 差异行数 |
|--------|----------|
| Demo.php = Kshy.php | 26行 |
| Haofan.php = Haofanceshi.php | 4行 |
| Jiuqu.php ≈ Jiuquxin.php | 10行 |
建议:
BaseComplexAdaptercheckLogin / paySign位置:guildapi/ 和 mcpsapi/ 目录
common.php 对比:
同名 Controller 对比(15个): | Controller | 差异数 | 相似度 | |------------|--------|--------| | Vipinfo | 4行 | 99% | | ChannelRebind | 13行 | 96% | | ChannelWithdraw | 44行 | 82% | | Subpackage | 59行 | 74% | | Account | 28行 | 97% |
建议:
common/helper.php同名 Controller 对比(12个): | Controller | home行数 | mobile行数 | 相似度 | |------------|----------|------------|--------| | CoinAirwallex | 264 | 264 | 62% | | About | 64 | 49 | 58% | | Gift | 155 | 161 | 65% | | Coin | 250 | 242 | 81% |
建议:
auth_code() 函数存在于 4 处:
| 文件 | 行号 |
|------|------|
| common.php | 153 |
| home/common.php | 63 |
| guildapi/common.php | 106 |
| mcpsapi/common.php | 106 |
其他重复函数:
| 函数名 | 出现次数 | 每处行数 |
|--------|----------|----------|
| GetIP | 3 | 18行 |
| getUserIp | 4 | 12行 |
| postXmlCurl | 4 | 15行 |
| xmlToArray | 5 | 8行 |
| getGameIcon | 3 | 27行 |
建议:统一保留一份,其他文件删除
| 排名 | 文件 | 行数 |
|---|---|---|
| 1 | admin/controller/Game.php |
4,130 |
| 2 | admin/controller/Member.php |
2,341 |
| 3 | admin/controller/Pay.php |
1,714 |
| 4 | api/controller/v1/Pay.php |
1,626 |
| 5 | common.php |
1,563 |
| 6 | admin/controller/Channel.php |
1,409 |
| 7 | common/library/HuaweiObs.php |
1,369 |
| 8 | home/controller/Member.php |
1,171 |
| 9 | guildapi/controller/Member.php |
1,157 |
| 10 | service/RetaineService.php |
1,127 |
admin/controller/Game.php| 排名 | 文件 | 函数 | 行数 |
|---|---|---|---|
| 1 | admin/controller/Game.php |
ajaxGetCompanyGames |
684 |
| 2 | service/GamePayService_bak.php |
gamePay |
568 |
| 3 | service/GamePayService.php |
gamePay |
554 |
| 4 | api/controller/v1/Pay.php |
index_bak |
491 |
| 5 | service/WelfareService.php |
getUserlistByGrantTypeGameChannelId |
308 |
| 6 | service/MemberCoinService_bak.php |
payCoin |
274 |
| 7 | admin/controller/Game.php |
update |
247 |
| 8 | admin/controller/Pay.php |
_beforeGetParams |
233 |
| 9 | service/MemberCoinService.php |
payCoin |
208 |
| 10 | admin/controller/Game.php |
create |
201 |
GamePayService::gamePay()(554行)应拆分为:
Game::ajaxGetCompanyGames()(684行)应拆分为:
违规文件(4个):
| 文件 | 类名 | 建议 |
|------|------|------|
| crontab/controller/asyncCallback.php | asyncCallback | AsyncCallback |
| common/model/fkExceptionRecords.php | fkExceptionRecords | FkExceptionRecords |
| common/model/fkExceptionObjects.php | fkExceptionObjects | FkExceptionObjects |
| common/library/jssdk.php | jssdk | JsSdk |
common.php 中的违规方法:
// 当前(不规范)
auth_code()
log_message()
get_top_channel()
get_union_channel()
get_channel_level()
get_game_name()
mg_password()
is_mobile_request()
// 建议
authCode()
logMessage()
getTopChannel()
getUnionChannel()
getChannelLevel()
getGameName()
mgPassword()
isMobileRequest()
api/controller/v1/PayNotify.php 中的违规方法:
qmf_pay() → qmfPay()
ybzf_pay() → ybzfPay()
ldzf_wx_pay() → ldzfWxPay()
qzl_pay() → qzlPay()
pay_refund() → payRefund()
admin/controller/Retaine*.php 中的违规方法:
reg_total() → regTotal()
reg_num() → regNum()
role_num() → roleNum()
one_stay() → oneStay()
thirty_stay() → thirtyStay()
common.php 中的违规变量:
$ckey_length → $ckeyLength
$cryptkey → $cryptKey
$rndkey → $rndKey
$cache_key → $cacheKey
$request_result → $requestResult
路由中的拼音缩写:
| 路由 | 拼音 | 含义 | 建议 |
|------|------|------|------|
| /syxy | 使用协议 | 使用协议 | /agreement |
| /zhaq | 账号安全 | 账号安全 | /account-security |
| /cjwt | 常见问题 | 常见问题 | /faq |
| /zhss | 账号申诉 | 账号申诉 | /appeal |
| /sscx | 申诉查询 | 申诉查询 | /appeal-query |
| /wxss | 微信申诉 | 微信申诉 | /wechat-appeal |
| /xyzx | 游戏资讯 | 游戏资讯 | /game-news |
| /lyzx | 礼仪资讯 | 礼仪资讯 | /gift-news |
| /xypc | 游戏评测 | 游戏评测 | /game-review |
| /xygl | 游戏攻略 | 游戏攻略 | /game-guide |
| /jcsp | 精彩视频 | 精彩视频 | /video-highlights |
控制器中的拼音命名:
| 文件 | 类名 | 建议 |
|------|------|------|
| admin/controller/Ziyuan.php | Ziyuan | Resources |
| 指标 | 数量 | 覆盖率 |
|---|---|---|
| PHP文件总数 | 610 | - |
| 有文件头注释 | 259 | 42.5% |
| 有类注释 | 64 | 10.5% |
| 方法总数 | 3,098 | - |
| 有注释的方法 | 1,695 | 54.7% |
| 无任何注释的文件 | 73 | 12.0% |
| 复杂方法(>30行) | 761 | - |
| 复杂方法有注释 | 13 | 1.7% |
| 序号 | 问题 | 位置 |
|---|---|---|
| 1 | 渠道适配器重复度 58% | api/complex/ |
| 2 | guildapi/mcpsapi 重复度 45% | 两个模块 |
| 3 | common.php 重复函数 | 4处 auth_code() |
| 4 | Game.php 超过 4000 行 | admin/controller/Game.php |
| 5 | 方法名 snake_case 174+ 处 | 全局 |
| 6 | 拼音缩写命名 100+ 处 | 路由、控制器 |
| 7 | 类名小写开头 4 个文件 | 多处 |
| 8 | GamePayService::gamePay() 554行 | service/GamePayService.php |
| 序号 | 问题 | 数量/位置 |
|---|---|---|
| 1 | home/mobile 重复度 48% | 12 个同名控制器 |
| 2 | 支付 Service 重复度 35% | GamePayService/MemberCoinService |
| 3 | 超长文件 >500 行 | 10 个文件 |
| 4 | 超长函数 >100 行 | 32 个函数 |
| 5 | 变量 snake_case | 大量 |
| 6 | 类注释覆盖率 10.5% | 全局 |
| 7 | 复杂方法注释率 1.7% | 761 个复杂方法 |
| 8 | 被注释代码 4149 行 | 全局 |
| 9 | TODO/FIXME 70 个 | 全局 |
| 10 | 文件头注释覆盖率 42.5% | 全局 |
| 11 | 数据库前缀混用 | cy_ 和 nw_ |
| 12 | 参数缺少类型提示 | 538 个参数 |
| 序号 | 问题 |
|---|---|
| 1 | 方法注释覆盖率 54.7% |
| 2 | 常量命名规范(UPPER_SNAKE_CASE) |
| 3 | 文件名小写开头 4 个 |
| 4 | 返回类型声明缺失 3389 个方法 |
| 5 | stub 注释 18 个 |
| 6 | 备份文件未清理 |
| 7 | 部分函数命名不一致 |
| 8 | 魔法数字硬编码 |
BaseComplexAdapter 基类auth_code() 等仅保留一份gamePay()、ajaxGetCompanyGames() 等abstract class BaseComplexAdapter implements ComplexInterface
{
protected $channel;
protected $config;
abstract protected function buildSignParams($data): array;
abstract protected function verifySign($params): bool;
abstract protected function parseLoginResult($response): array;
public function getSuccess($msg = '')
{
echo 'success';
exit;
}
public function getFail($msg = '')
{
echo 'fail:' . $msg;
exit;
}
public function checkLogin($data, $polyChannelGame = [])
{
$this->validateParams($data);
$this->loadConfig($polyChannelGame);
$signParams = $this->buildSignParams($data);
$response = $this->sendRequest($signParams);
return $this->parseLoginResult($response);
}
}
// ❌ 当前(不规范)
public function reg_total() { }
public function reg_num() { }
public function one_stay() { }
// ✅ 建议
public function regTotal() { }
public function regNum() { }
public function oneStay() { }
审查报告生成时间:2026年5月19日