承接 newngapi/ngapi 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

newngapi/ngapi

Composer 安装命令:

composer require newngapi/ngapi

包简介

A PHP SDK for integrating with the NG gaming platform API. This SDK provides a simple and efficient way to interact with the NG gaming platform's API services.

README 文档

README

NG游戏平台API的PHP SDK。此SDK提供了一种简单高效的方式来与NG游戏平台的API服务进行交互。

官方资源

系统要求

  • PHP >= 7.0
  • Composer
  • Guzzle HTTP客户端

安装

composer require newngapi/ngapi

使用方法

use Newngapi\Ngapi\Client;

// 初始化客户端
$client = new Client(
    'https://api.example.com', // 基础URL
    'your_sn',                // NG平台的SN
    'your_secret_key'        // NG平台的密钥
);

// 创建玩家
$result = $client->createPlayer('ag', 'player123', 'CNY');

// 获取玩家余额
$balance = $client->getBalance('ag', 'player123', 'CNY');

// 获取游戏URL
$gameUrl = $client->getGameUrl(
    'ag',
    'player123',
    '1',  // 游戏类型: 1=视讯, 2=老虎机, 3=彩票, 4=体育, 5=电竞, 6=捕鱼, 7=棋牌
    'CNY',
    'device1'  // device1=电脑网页版, device2=手机网页版
);

// 资金转账
$transfer = $client->transfer(
    'ag',
    'player123',
    'CNY',
    '100.00',
    '1',  // 1=转入, 2=转出
    'order1234567890123456'  // 可选的订单ID
);

开发

安装

git clone https://github.com/newngapi/ngapi.git
cd ngapi
composer install

测试

./vendor/bin/phpunit

代码规范

本项目遵循PSR-4自动加载标准和PSR-12编码风格。

可用方法

  1. createPlayer(string $platType, string $playerId, string $currency) - 创建玩家
  2. getBalance(string $platType, string $playerId, string $currency) - 获取玩家余额
  3. getAllBalance(string $playerId, string $currency) - 获取所有平台余额
  4. transferAll(string $playerId, string $currency) - 全部转账
  5. getGameUrl(string $platType, string $playerId, string $gameType, string $currency, string $ingress, ?string $lang = null, ?string $gameCode = null, ?string $returnUrl = null, ?string $oddsType = null) - 获取游戏URL
  6. getDemoUrl(string $platType, string $playerId, string $gameType, string $currency, string $ingress, ?string $lang = null, ?string $gameCode = null, ?string $returnUrl = null) - 获取试玩URL
  7. getRealTimeRecords(string $currency, ?string $pageNo = null, ?string $pageSize = null) - 获取实时记录
  8. getOrderRecords(string $currency, string $orderIds) - 获取订单记录
  9. getHistoryRecords(string $currency, string $startTime, string $endTime, ?string $pageNo = null, ?string $pageSize = null) - 获取历史记录
  10. transfer(string $platType, string $playerId, string $currency, string $amount, string $type, ?string $orderId = null) - 转账
  11. getTransferStatus(string $playerId, string $currency, string $orderId) - 获取转账状态
  12. getGameCode(string $platType) - 获取游戏代码
  13. getQuota() - 获取配额

错误处理

SDK会对无效参数抛出InvalidArgumentException异常,并以以下格式返回错误响应:

[
    'code' => 10001,  // 错误代码
    'msg' => '错误信息',
    'data' => null
]

常见错误代码

  • 10000: 成功
  • 10001: 请求错误
  • 10002: 玩家ID已存在
  • 10003: 玩家ID不存在
  • 10004: 玩家ID格式错误
  • 10005: 转账错误
  • 10006: 金额错误
  • 10007: 时间格式错误
  • 10008: 返回URL错误
  • 10009: 接口请求过于频繁
  • 10010: 游戏不支持试玩
  • 10011: 订单ID格式错误
  • 10012: 订单ID已存在
  • 10013: 订单ID不存在
  • 10014: 配额不足
  • 10015: 商户余额不足
  • 10403: IP访问受限
  • 10404: 签名验证失败
  • 10405: 缺少参数
  • 10406: 参数过多
  • 10407: 平台代码错误
  • 10408: 游戏类型错误
  • 10409: 转账类型错误

游戏类型说明

  • 1: 视讯游戏
  • 2: 老虎机游戏
  • 3: 彩票游戏
  • 4: 体育博彩
  • 5: 电子竞技
  • 6: 捕鱼游戏
  • 7: 棋牌游戏

设备类型说明

  • device1: 电脑网页版
  • device2: 手机网页版

转账类型说明

  • 1: 转入(从平台转入游戏)
  • 2: 转出(从游戏转出到平台)

技术支持

如需技术支持或有疑问,请联系:

贡献

  1. Fork本仓库
  2. 创建您的功能分支 (git checkout -b feature/amazing-feature)
  3. 提交您的更改 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 开启Pull Request

许可证

MIT

此文档为中文版本,如需查看英文版本请访问 README.en.md

newngapi/ngapi 适用场景与选型建议

newngapi/ngapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「sdk」 「integration」 「casino」 「gaming」 「NG」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 newngapi/ngapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 newngapi/ngapi 我们能提供哪些服务?
定制开发 / 二次开发

基于 newngapi/ngapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 28
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-15