Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
0919b5ca7c
@ -377,4 +377,62 @@ class AAMarket(object):
|
|||||||
['!rows', [_common.ChainActivity()], '数据'],
|
['!rows', [_common.ChainActivity()], '数据'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'method': 'GET',
|
||||||
|
'name': '/api/recharge/goods',
|
||||||
|
'desc': '充值-商品列表',
|
||||||
|
'group': '!AAMarket',
|
||||||
|
'url': 'https://market-test.kingsome.cn/api/recharge/goods',
|
||||||
|
'is_json_params': False,
|
||||||
|
'request_params': [
|
||||||
|
],
|
||||||
|
'params': [
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['!rows', [_common.RechargeGoods()], '数据'],
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'method': 'POST',
|
||||||
|
'name': '/api/recharge/buy',
|
||||||
|
'desc': '充值-购买',
|
||||||
|
'group': '!AAMarket',
|
||||||
|
'url': 'https://market-test.kingsome.cn/api/recharge/buy',
|
||||||
|
'headers': _common.JwtHeader,
|
||||||
|
'is_json_params': True,
|
||||||
|
'request_params': [
|
||||||
|
],
|
||||||
|
'params': [
|
||||||
|
['net_id', 0, '链id'],
|
||||||
|
['goods_id', '', '商品id'],
|
||||||
|
['account_address', '', '钱包地址(一般为小狐狸)'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['!calls', [
|
||||||
|
['trans_id', '', '事务id'],
|
||||||
|
['trans_req', _common.MFTransactionRequest(), '调用合约参数'],
|
||||||
|
], '合约调用']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'method': 'POST',
|
||||||
|
'name': '/api/recharge/history',
|
||||||
|
'desc': '充值-历史',
|
||||||
|
'group': '!AAMarket',
|
||||||
|
'url': 'https://market-test.kingsome.cn/api/recharge/history',
|
||||||
|
'headers': _common.JwtHeader,
|
||||||
|
'is_json_params': True,
|
||||||
|
'request_params': [
|
||||||
|
],
|
||||||
|
'params': [
|
||||||
|
['net_id', 0, '链id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['page', _common.StreamPage(), '分页信息'],
|
||||||
|
['!rows', [_common.RechargeHistory()], '数据'],
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
@ -121,26 +121,5 @@ class BlockChain(object):
|
|||||||
['order_id', '', '订单id'],
|
['order_id', '', '订单id'],
|
||||||
['!params', [''], '合约参数列表'],
|
['!params', [''], '合约参数列表'],
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
{
|
|
||||||
'name': 'rechargeBuyS',
|
|
||||||
'desc': 'usdt钻石充值',
|
|
||||||
'group': 'BlockChain',
|
|
||||||
'surl': 'webapp/index.php?c=BlockChain&a=rechargeBuyS',
|
|
||||||
'params': [
|
|
||||||
_common.ReqHead(),
|
|
||||||
['goods_id', '', '商品id'],
|
|
||||||
],
|
|
||||||
'response': [
|
|
||||||
_common.RspHead(),
|
|
||||||
['order_id', '', '订单id'],
|
|
||||||
['!calls',
|
|
||||||
[
|
|
||||||
['trans_id', '', '事务id'],
|
|
||||||
['trans_req', _common.MFTransactionRequest(), '调用合约参数'],
|
|
||||||
],
|
|
||||||
'合约调用-队列(排队执行上一个成功才能调用下一个)'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import _common
|
|
||||||
|
|
||||||
class Recharge(object):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.apis = [
|
|
||||||
{
|
|
||||||
'name': 'goodsList',
|
|
||||||
'desc': '充值-商品列表',
|
|
||||||
'group': 'Recharge',
|
|
||||||
'url': 'webapp/index.php?c=Recharge&a=goodsList',
|
|
||||||
'params': [
|
|
||||||
_common.ReqHead(),
|
|
||||||
],
|
|
||||||
'response': [
|
|
||||||
_common.RspHead(),
|
|
||||||
['!goods', [_common.RechargeGoods()], '商品列表']
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
@ -1829,5 +1829,19 @@ class RechargeGoods(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
['goods_id', '', '商品id(购买时用)'],
|
['goods_id', '', '商品id(购买时用)'],
|
||||||
['goods_meta', '', '配置表信息(和excel完全一样)'],
|
['diamond', 0, '充值所得钻石'],
|
||||||
|
['currency', '', '货币地址'],
|
||||||
|
['price', '', '价格'],
|
||||||
|
]
|
||||||
|
|
||||||
|
class RechargeHistory(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['order_id', '', '订单id'],
|
||||||
|
['txhash', '', 'txhash'],
|
||||||
|
['net_id', 0, '链id'],
|
||||||
|
['currency', '', '货币地址'],
|
||||||
|
['amount', '', '货币数'],
|
||||||
|
['createtime', 0, '成交时间'],
|
||||||
]
|
]
|
||||||
|
@ -310,4 +310,28 @@ CREATE TABLE `t_contribution` (
|
|||||||
) 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_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 */;
|
||||||
|
|
||||||
-- Dump completed on 2015-08-19 18:51:22
|
-- Dump completed on 2015-08-19 18:51:22
|
||||||
|
@ -1926,31 +1926,6 @@ CREATE TABLE `t_server_task_battle_count` (
|
|||||||
) 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 */;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `t_switch`
|
-- Table structure for table `t_switch`
|
||||||
--
|
--
|
||||||
|
@ -457,7 +457,7 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rechargeBuyS()
|
private function rechargeBuyS()
|
||||||
{
|
{
|
||||||
$goodsMeta = mt\Recharge::get(getReqVal('goods_id', ''));
|
$goodsMeta = mt\Recharge::get(getReqVal('goods_id', ''));
|
||||||
if (!$goodsMeta) {
|
if (!$goodsMeta) {
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once('mt/Recharge.php');
|
|
||||||
|
|
||||||
class RechargeController extends BaseAuthedController {
|
|
||||||
|
|
||||||
public function goodsList()
|
|
||||||
{
|
|
||||||
$goods = array();
|
|
||||||
mt\Recharge::traverseMeta(function ($meta) use(&$goods) {
|
|
||||||
array_push($goods, array(
|
|
||||||
'goods_id' => $meta['id'],
|
|
||||||
'goods_meta' => $meta,
|
|
||||||
));
|
|
||||||
});
|
|
||||||
myself()->_rspData(array(
|
|
||||||
'goods' => $goods
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,6 +7,7 @@ require_once('models/InGameMall.php');
|
|||||||
|
|
||||||
require_once('services/MailApiService.php');
|
require_once('services/MailApiService.php');
|
||||||
|
|
||||||
|
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use models\InGameMall;
|
use models\InGameMall;
|
||||||
|
|
||||||
|
44
webapp/controller/UnitTestController.class.php
Normal file
44
webapp/controller/UnitTestController.class.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('services/NoticeService.php');
|
||||||
|
|
||||||
|
class UnitTestController extends BaseAuthedController {
|
||||||
|
|
||||||
|
public function _handlePre()
|
||||||
|
{
|
||||||
|
parent::_handlePre();
|
||||||
|
if (SERVER_ENV == _ONLINE) {
|
||||||
|
die("can't create UnitTestController");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNotice()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$marqueeType= getReqVal('type', 1);
|
||||||
|
$loop = getReqVal('loop', 1);
|
||||||
|
$interval = getReqVal('interval', 10);
|
||||||
|
|
||||||
|
$contents= file_get_contents('php://input');
|
||||||
|
$postdata = json_decode($contents, true);
|
||||||
|
|
||||||
|
$content = '';
|
||||||
|
if ($marqueeType == 1) {
|
||||||
|
$elements = $postdata["elements"];
|
||||||
|
$content = services\NoticeService::buildCustom($elements);
|
||||||
|
} else if ($marqueeType == 2) {// deprecated
|
||||||
|
$langKey = $postdata["lang_key"];
|
||||||
|
$langParams = $postdata["lang_params"];
|
||||||
|
$content = services\NoticeService::buildMulLangTemplate($langKey, $langParams);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
services\NoticeService::send($content, $loop, $interval);
|
||||||
|
} catch (Exception $e){
|
||||||
|
error_log($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
80
webapp/services/NoticeService.php
Normal file
80
webapp/services/NoticeService.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace services;
|
||||||
|
|
||||||
|
use phpcommon;
|
||||||
|
|
||||||
|
class NoticeService extends BaseService {
|
||||||
|
|
||||||
|
const ELE_TYPE_RAW_TEXT = 1;
|
||||||
|
const ELE_TYPE_MUL_LANG = 2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"type": 1, //自定义
|
||||||
|
"elements":[
|
||||||
|
{
|
||||||
|
"ele_type": 1, //原始文本
|
||||||
|
"color": "#xxxxxxx", //[可选], 无则使用多语言里的颜色
|
||||||
|
"text": "" //如果是多语言则表示多语言配置表里的key
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ele_type": 2, //多语言(读取多语言表)
|
||||||
|
"color": "#xxxxxxx", //[可选], 无则使用多语言里的颜色
|
||||||
|
"lang_key": "",
|
||||||
|
"lang_params":[
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
public static function buildCustom($elements)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
"type"=>1,
|
||||||
|
"elements"=> $elements,
|
||||||
|
];
|
||||||
|
return json_encode($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function send($content, $loop, $interval) {
|
||||||
|
$appkey = "YOUME1838B3633FF1410BDC9124BBD806F245B9D2E5AC";
|
||||||
|
$identifier="admin";
|
||||||
|
$appsecret="q6B570yTyj/00Nk4mYZtgDwyew5v05t13V1vo4mxpEuAaWUiinAyVxG41sNu3vsFe8sipOLfKfIVYGhzpQrqzvj5sId3mrBfj/s65a2gp36yDrI/nX5BnUAJB317SEosR6xLoPuhBvHU+/1DWI7nKSKaRNxnQiC46PJKFc2kX50BAAE=";
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
"Notice"=>[
|
||||||
|
"ChannelID"=>"world_room_1",//频道 ID,app 内唯一,字符串
|
||||||
|
"NoticeType"=>1,//1 为跑马灯公告,2 为聊天框公告,3 为置顶公告,整数
|
||||||
|
"LoopType"=>1,// 公告循环类型,1 为一次性公告,2 为周期性公告,整数
|
||||||
|
"Title"=>"",// 公告标题,字符串
|
||||||
|
"Content"=>$content,//"testtttttt222",// 公告内容,字符串
|
||||||
|
"LinkKeyWords"=>"",// 链接关键字,字符串
|
||||||
|
"LinkAddr"=>"",// 链接地址,字符串
|
||||||
|
"Creator"=>"",// 公告添加人,字符串
|
||||||
|
"EnableStatus"=>2,// 公告启用状态,1 为停用,2 为启用,整数
|
||||||
|
|
||||||
|
"SendStartTime"=>"",// 公告发送时间,格式为 HH:MM:SS,字符串
|
||||||
|
"SendInstantly"=>1,// 是否即时发送,也属于公告 json 里的字段。1 是,0 否,不指定则不起作用
|
||||||
|
"SendTimes"=>$loop,// 公告发送次数,整数(需要传入)
|
||||||
|
"SendInterval"=>$interval,// 公告发送多次时,每次的间隔,单位秒,整数(需要传入)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$url = "https://sgapi.youme.im/v1/im/add_notice";
|
||||||
|
$curtime = time();
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"appkey" => $appkey,
|
||||||
|
"identifier"=> $appkey,
|
||||||
|
"curtime"=> $curtime,
|
||||||
|
"checksum"=> strtolower(sha1($appsecret.$curtime)),
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = '';
|
||||||
|
phpcommon\HttpClient::postContentEx($url, $params, json_encode($data), $response, ['Content-Type: application/json']);
|
||||||
|
|
||||||
|
if (SERVER_ENV != _ONLINE) {
|
||||||
|
error_log($response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -260,8 +260,9 @@ class RoomBattleDataService extends BaseService {
|
|||||||
//宝箱掉落
|
//宝箱掉落
|
||||||
$chestLootProbArr = explode(";",$rewardMeta['chestLootProb']);
|
$chestLootProbArr = explode(";",$rewardMeta['chestLootProb']);
|
||||||
$rate = isset($chestLootProbArr[$teamRank-1]) ? $chestLootProbArr[$teamRank-1] : 0;
|
$rate = isset($chestLootProbArr[$teamRank-1]) ? $chestLootProbArr[$teamRank-1] : 0;
|
||||||
|
//error_log(json_encode($member));
|
||||||
if ($rate > 0 && !empty($member['box_num'])){
|
if ($rate > 0 && !empty($member['box_num'])){
|
||||||
for ($i = 0; i < $member['box_num']; ++$i) {
|
for ($i = 0; $i < $member['box_num']; ++$i) {
|
||||||
$rand = $rate * 100;
|
$rand = $rate * 100;
|
||||||
$rnd = rand(1,100);
|
$rnd = rand(1,100);
|
||||||
if ($rnd <= $rand){
|
if ($rnd <= $rand){
|
||||||
|
@ -720,6 +720,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0),
|
'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0),
|
||||||
'hero_lv'=> getXVal($info,'hero_lv', 1),
|
'hero_lv'=> getXVal($info,'hero_lv', 1),
|
||||||
'dead_times'=> getXVal($info,'dead_times', 0),
|
'dead_times'=> getXVal($info,'dead_times', 0),
|
||||||
|
'box_num'=> getXVal($info,'box_num', 0),
|
||||||
'battle_score'=> 0,
|
'battle_score'=> 0,
|
||||||
'reward' => $rewards,
|
'reward' => $rewards,
|
||||||
'winningPro' => $winningPro,
|
'winningPro' => $winningPro,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user