Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb

This commit is contained in:
hujiabin 2024-07-26 14:45:55 +08:00
commit e8b4609ac3
4 changed files with 106 additions and 0 deletions

View File

@ -1908,3 +1908,28 @@ CREATE TABLE `t_server_task_battle_count` (
PRIMARY KEY (`idx`) PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_recharge_order`
--
DROP TABLE IF EXISTS `t_recharge_order`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_recharge_order` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`order_id` varchar(255) COMMENT '订单号',
`account_id` varchar(60) NOT NULL COMMENT '账号id',
`account_address` varchar(60) NOT NULL COMMENT '钱包地址',
`currency_address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址',
`currency_name` varchar(60) NOT NULL DEFAULT '' COMMENT '货币名称',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '0: 支付中 1 已发货',
`item_id` int(11) NOT NULL COMMENT '道具id',
`item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具数量',
`price` varchar(60) COLLATE utf8_bin NOT NULL COMMENT '价格',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `order_id` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -101,6 +101,7 @@ class BaseAuthedController extends BaseController {
if (SERVER_ENV != _DEBUG) { if (SERVER_ENV != _DEBUG) {
if (SERVER_ENV == _TEST) { if (SERVER_ENV == _TEST) {
if ($this->sessionId == "CzRXrGHxwQZJNCeXkTRA") { if ($this->sessionId == "CzRXrGHxwQZJNCeXkTRA") {
return;
} else { } else {
if (!phpcommon\isValidSessionId($this->accountId, if (!phpcommon\isValidSessionId($this->accountId,
$this->sessionId)) { $this->sessionId)) {

View File

@ -4,6 +4,7 @@ require_once('mt/Parameter.php');
require_once('mt/Item.php'); require_once('mt/Item.php');
require_once('mt/Drop.php'); require_once('mt/Drop.php');
require_once('mt/Hero.php'); require_once('mt/Hero.php');
require_once('mt/Recharge.php');
require_once('models/Hero.php'); require_once('models/Hero.php');
require_once('models/Gun.php'); require_once('models/Gun.php');
@ -14,6 +15,7 @@ require_once('models/BuyRecord.php');
require_once('models/Chip.php'); require_once('models/Chip.php');
require_once('models/BcOrder.php'); require_once('models/BcOrder.php');
require_once('models/Mall.php'); require_once('models/Mall.php');
require_once('models/Recharge.php');
require_once('services/AwardService.php'); require_once('services/AwardService.php');
require_once('services/PropertyChgService.php'); require_once('services/PropertyChgService.php');
@ -28,6 +30,7 @@ use models\BuyRecord;
use models\Chip; use models\Chip;
use models\BcOrder; use models\BcOrder;
use models\Mall; use models\Mall;
use models\Recharge;
use services\BlockChainService; use services\BlockChainService;
@ -454,6 +457,43 @@ class BlockChainController extends BaseAuthedController {
)); ));
} }
public function rechargeBuyS()
{
$goodsMeta = mt\Recharge::get(getReqVal('goods_id', ''));
if (!$goodsMeta) {
myself()->_rspErr(1, 'goods_id paramater error');
return;
}
$orderId = Recharge::addOrder($goodsMeta['id']);
{
$params = array(
'c' => 'BcService',
'a' => 'recharge',
'account_address' => myself()->_getAddress(),
'passport_address' => myself()->_getAddress(),
'net_id' => NET_ID,
'amount' => 1,
'currency_name' => 'TestToken',
'order_id' => $orderId,
);
error_log(json_encode($params));
{
$url = self::getWeb3ServiceUrl();
$response = '';
if (!phpcommon\HttpClient::get
($url,
$params,
$response)) {
myself()->_rspErr(500, 'server internal error');
die();
return;
}
error_log($response);
echo $response;
}
}
}
private static function getWeb3ServiceUrl() private static function getWeb3ServiceUrl()
{ {
$web3ServiceCluster = require_once('../config/web3service.cluster.php'); $web3ServiceCluster = require_once('../config/web3service.cluster.php');

View File

@ -0,0 +1,40 @@
<?php
namespace models;
require_once('models/BuyRecord.php');
use phpcommon\SqlHelper;
class Recharge
{
public static function addOrder($goodsId){
$orderId = BuyRecord::genOrderId
(
GAME_ID,
phpcommon\BC_FUNC_CREATION,
myself()->_getNowTime(),
myself()->_getAddress()
);
SqlHelper::insert
(myself()->_getSelfMysql(),
't_recharge_order',
array(
'order_id' => $orderId,
'account_id' => myself()->_getAccountId(),
'account_address' => myself()->_getAddress(),
'currency_address' => '0xfd42bfb03212da7e1a4608a44d7658641d99cf34',
'currency_name' => 'TestToken',
'status' => 0,
'item_id' => $goodsId,
'item_num' => 1,
'price' => 1,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
return $orderId;
}
}