Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
82233b430b | ||
![]() |
428f0c5029 | ||
![]() |
9907a11796 | ||
![]() |
e4bcd6daac |
23
doc/IM.py
Normal file
23
doc/IM.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import _common
|
||||||
|
|
||||||
|
class IM(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.apis = [
|
||||||
|
{
|
||||||
|
'name': 'userInfo',
|
||||||
|
'desc': '执行gm指令(格式:".指令 参数1 参数2 ...", 查看指令帮助".help")',
|
||||||
|
'group': 'IM',
|
||||||
|
'url': 'webapp/index.php?c=IM&a=userInfo',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['target_id', '', '用户account_id(如果要获取自己的就传自己的account_id)']
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['info',_common.UserDetailInfo(), '用户信息(详细)'],
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
@ -565,9 +565,13 @@ CREATE TABLE `t_game_log` (
|
|||||||
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '日志类型',
|
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '日志类型',
|
||||||
`subtype` varchar(255) NOT NULL DEFAULT '' COMMENT '日志子类型',
|
`subtype` varchar(255) NOT NULL DEFAULT '' COMMENT '日志子类型',
|
||||||
`param1` varchar(666) NOT NULL DEFAULT '' COMMENT 'param1',
|
`param1` varchar(666) NOT NULL DEFAULT '' COMMENT 'param1',
|
||||||
`param2` varchar(666) NOT NULL DEFAULT '' COMMENT 'param2',
|
`param2` text COMMENT 'param2',
|
||||||
`param3` varchar(666) NOT NULL DEFAULT '' COMMENT 'param3',
|
`param3` text COMMENT 'param3',
|
||||||
`param4` varchar(666) NOT NULL DEFAULT '' COMMENT 'param4',
|
`param4` text COMMENT 'param4',
|
||||||
|
`param5` text COMMENT 'param5',
|
||||||
|
`param6` text COMMENT 'param6',
|
||||||
|
`param7` text COMMENT 'param7',
|
||||||
|
`param8` text COMMENT 'param8',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
@ -323,6 +323,12 @@ class BaseAuthedController extends BaseController {
|
|||||||
if ($newlV != $userDb['level']){
|
if ($newlV != $userDb['level']){
|
||||||
//协议通知前端等级变更
|
//协议通知前端等级变更
|
||||||
$propertyChgService->addUserLevelChg();
|
$propertyChgService->addUserLevelChg();
|
||||||
|
//记录日志
|
||||||
|
$this->_addLog('upgrade','user_level',array(
|
||||||
|
'param1' => 'oldLv:'.$userDb['level'],
|
||||||
|
'param2' => 'newLv:'.$newlV,
|
||||||
|
'param3' => 'newEXP:'.$newExp,
|
||||||
|
));
|
||||||
//添加奖励
|
//添加奖励
|
||||||
for ($i=$userDb['level']+1; $i<=$newlV; $i++){
|
for ($i=$userDb['level']+1; $i<=$newlV; $i++){
|
||||||
$taskMeta = \mt\Task::findAchievementLevel($i);
|
$taskMeta = \mt\Task::findAchievementLevel($i);
|
||||||
@ -410,6 +416,8 @@ class BaseAuthedController extends BaseController {
|
|||||||
Bag::addItem($item['item_id'], $item['item_num']);
|
Bag::addItem($item['item_id'], $item['item_num']);
|
||||||
$propertyService->addBagChg();
|
$propertyService->addBagChg();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
for ($i=0; $i<$item['item_num']; $i++){
|
for ($i=0; $i<$item['item_num']; $i++){
|
||||||
switch ($itemMeta['type']) {
|
switch ($itemMeta['type']) {
|
||||||
case mt\Item::HERO_TYPE:
|
case mt\Item::HERO_TYPE:
|
||||||
@ -487,6 +495,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -646,6 +655,10 @@ class BaseAuthedController extends BaseController {
|
|||||||
'param2' => getXVal($params, 'param2', ''),
|
'param2' => getXVal($params, 'param2', ''),
|
||||||
'param3' => getXVal($params, 'param3', ''),
|
'param3' => getXVal($params, 'param3', ''),
|
||||||
'param4' => getXVal($params, 'param4', ''),
|
'param4' => getXVal($params, 'param4', ''),
|
||||||
|
'param5' => getXVal($params, 'param5', ''),
|
||||||
|
'param6' => getXVal($params, 'param6', ''),
|
||||||
|
'param7' => getXVal($params, 'param7', ''),
|
||||||
|
'param8' => getXVal($params, 'param8', ''),
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
);
|
);
|
||||||
|
@ -215,6 +215,21 @@ class ChipController extends BaseAuthedController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$chipDbNew = Chip::toDto(Chip::find($idxMain));
|
$chipDbNew = Chip::toDto(Chip::find($idxMain));
|
||||||
|
$this->_addLog('upgrade','chip_level',array(
|
||||||
|
'param1' => 'tokenId:'.$chipDbMain['token_id'],
|
||||||
|
'param2' => 'uniid:'.$chipDbMain['idx'],
|
||||||
|
'param3' => 'itemId:'.$chipDbMain['item_id'],
|
||||||
|
'param4' => 'oldLv:'.$chipDbMain['chip_grade'],
|
||||||
|
'param5' => 'newLv:'.$chipDbNew['chip_grade'],
|
||||||
|
'param6' => json_encode($chipDbNew),
|
||||||
|
));
|
||||||
|
$this->_addLog('consume','chip',array(
|
||||||
|
'param1' => 'uniid:'. $chipDbParam['idx'],
|
||||||
|
'param2' => 'itemId:'.$chipDbParam['item_id'],
|
||||||
|
));
|
||||||
|
$this->_addLog('consume','cost',array(
|
||||||
|
'param1' => json_encode($costItems),
|
||||||
|
));
|
||||||
$this->_rspData([
|
$this->_rspData([
|
||||||
'data'=>$chipDbNew,
|
'data'=>$chipDbNew,
|
||||||
'property_chg' => $propertyChgService->toDto(),
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
|
@ -159,6 +159,9 @@ class FragmentController extends BaseAuthedController
|
|||||||
$this->_decItems($costItems);
|
$this->_decItems($costItems);
|
||||||
//生成英雄
|
//生成英雄
|
||||||
Hero::addHero($itemMeta);
|
Hero::addHero($itemMeta);
|
||||||
|
|
||||||
|
$this->_Log($decItems,$costItems);
|
||||||
|
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
@ -195,6 +198,7 @@ class FragmentController extends BaseAuthedController
|
|||||||
$itemMeta = $itemMetaList[$key];
|
$itemMeta = $itemMetaList[$key];
|
||||||
//生成英雄
|
//生成英雄
|
||||||
Hero::addHero($itemMeta);
|
Hero::addHero($itemMeta);
|
||||||
|
$this->_Log($decItems,$costItems);
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
@ -247,6 +251,7 @@ class FragmentController extends BaseAuthedController
|
|||||||
$this->_decItems($costItems);
|
$this->_decItems($costItems);
|
||||||
//生成武器
|
//生成武器
|
||||||
Gun::addGun($itemMeta);
|
Gun::addGun($itemMeta);
|
||||||
|
$this->_Log($decItems,$costItems);
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
@ -283,6 +288,7 @@ class FragmentController extends BaseAuthedController
|
|||||||
$itemMeta = $itemMetaList[$key];
|
$itemMeta = $itemMetaList[$key];
|
||||||
//生成枪械
|
//生成枪械
|
||||||
Gun::addGun($itemMeta);
|
Gun::addGun($itemMeta);
|
||||||
|
$this->_Log($decItems,$costItems);
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
@ -302,6 +308,15 @@ class FragmentController extends BaseAuthedController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _Log($decItems,$costItems){
|
||||||
|
$this->_addLog('consume','fragment',array(
|
||||||
|
'param1' => json_encode($decItems),
|
||||||
|
));
|
||||||
|
$this->_addLog('consume','cost',array(
|
||||||
|
'param1' => json_encode($costItems),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public function showBaseByItemId(){
|
public function showBaseByItemId(){
|
||||||
$item_id = getReqVal('item_id','');
|
$item_id = getReqVal('item_id','');
|
||||||
$itemMeta = mt\Item::get($item_id);
|
$itemMeta = mt\Item::get($item_id);
|
||||||
|
@ -245,6 +245,21 @@ class GunController extends BaseAuthedController {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$newGun = Gun::toDto(Gun::find($gunUniId));
|
$newGun = Gun::toDto(Gun::find($gunUniId));
|
||||||
|
$this->_addLog('upgrade','gun_level',array(
|
||||||
|
'param1' => 'tokenId:'.$gunDb['token_id'],
|
||||||
|
'param2' => 'uniid:'.$gunDb['idx'],
|
||||||
|
'param3' => 'itemId:'.$gunDb['gun_id'],
|
||||||
|
'param4' => 'oldLv:'.$gunDb['gun_lv'],
|
||||||
|
'param5' => 'newLv:'.$newGun['gun_lv'],
|
||||||
|
'param6' => json_encode($newGun),
|
||||||
|
));
|
||||||
|
$this->_addLog('consume','gun',array(
|
||||||
|
'param1' => 'uniid:'. $costGunDb['idx'],
|
||||||
|
'param2' => 'itemId:'.$costGunDb['gun_id'],
|
||||||
|
));
|
||||||
|
$this->_addLog('consume','cost',array(
|
||||||
|
'param1' => json_encode($costItems),
|
||||||
|
));
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addGunChg();
|
$propertyChgService->addGunChg();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
|
@ -244,11 +244,26 @@ class HeroController extends BaseAuthedController {
|
|||||||
Hero::update($costHeroUniId, array(
|
Hero::update($costHeroUniId, array(
|
||||||
'account_id' => myself()->_getAccountId() . '!!!',
|
'account_id' => myself()->_getAccountId() . '!!!',
|
||||||
));
|
));
|
||||||
|
$this->_addLog('consume','hero',array(
|
||||||
|
'param1' => 'uniid:'. $costHeroDb['idx'],
|
||||||
|
'param2' => 'itemId:'.$costHeroDb['hero_id'],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
if ($heroDb['hero_lv'] + 1 > myself()->_getV(TN_HERO_MAX_LEVEL, 0)) {
|
if ($heroDb['hero_lv'] + 1 > myself()->_getV(TN_HERO_MAX_LEVEL, 0)) {
|
||||||
myself()->_setV(TN_HERO_MAX_LEVEL, 0, $heroDb['hero_lv'] + 1);
|
myself()->_setV(TN_HERO_MAX_LEVEL, 0, $heroDb['hero_lv'] + 1);
|
||||||
}
|
}
|
||||||
$newHero = Hero::toDto(Hero::find($heroUniId));
|
$newHero = Hero::toDto(Hero::find($heroUniId));
|
||||||
|
$this->_addLog('upgrade','hero_level',array(
|
||||||
|
'param1' => 'tokenId:'. $heroDb['token_id'],
|
||||||
|
'param2' => 'uniid:'.$heroDb['idx'],
|
||||||
|
'param3' => 'itemId:'.$heroDb['hero_id'],
|
||||||
|
'param4' => 'oldLv:'.$heroDb['hero_lv'],
|
||||||
|
'param5' => 'newLv:'.$newHero['hero_lv'],
|
||||||
|
'param6' => json_encode($newHero),
|
||||||
|
));
|
||||||
|
$this->_addLog('consume','cost',array(
|
||||||
|
'param1' => json_encode($costItems),
|
||||||
|
));
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addHeroChg();
|
$propertyChgService->addHeroChg();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
|
22
webapp/controller/IMController.class.php
Normal file
22
webapp/controller/IMController.class.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('models/User.php');
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
use models\User;
|
||||||
|
class IMController extends BaseAuthedController {
|
||||||
|
|
||||||
|
public function userInfo()
|
||||||
|
{
|
||||||
|
$targetId = getReqVal('target_id', '');
|
||||||
|
$userDb = User::find($targetId);
|
||||||
|
if (!$userDb) {
|
||||||
|
$this->_rspErr(1, 'Account does not exist');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$userDto = User::info($userDb);
|
||||||
|
$this->_rspData(array(
|
||||||
|
'info' => $userDto
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -146,6 +146,9 @@ class UserController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (SERVER_ENV == _TEST) {
|
if (SERVER_ENV == _TEST) {
|
||||||
|
|
||||||
array_push($addItems,
|
array_push($addItems,
|
||||||
@ -161,6 +164,7 @@ class UserController extends BaseAuthedController {
|
|||||||
'item_num' => 1
|
'item_num' => 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$awardService = new services\AwardService();
|
$awardService = new services\AwardService();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user