This commit is contained in:
aozhiwei 2022-12-07 16:56:25 +08:00
commit 805681b86f
10 changed files with 285 additions and 30 deletions

View File

@ -2,6 +2,22 @@
import _common
class NftIntro(object):
def __init__(self):
self.fields = [
['idx', 0, 'idx'],
['token_id', '', 'token_id'],
['token_type', 0, 'nft类型 1:英雄 2:枪支 3:芯片'],
['createtime', 0, '创建时间(上架时间)'],
['modifytime', 0, '修改时间(更新价格等)'],
['s_price', 0, '出售价格-暂定'],
['c_name', '', '缓存-名称'],
['c_job', 0, '缓存-职业'],
['c_lv', 0, '缓存-级别'],
['c_id', 0, '缓存-idx'],
['details', _common.NftDetail(), 'nft列表'],
]
class Market(object):
def __init__(self):
@ -287,4 +303,53 @@ class Market(object):
_common.NftView(),
]
},
{
'name': 'listSellNfts',
'desc': '获取上架出售的NFTs',
'group': 'Market',
'url': 'webapp/index.php?c=Market&a=listSellNfts',
'params': [
['account', '', '账号id'],
['token', '', 'token'],
['start', 0, '分页开始偏移'],
['page_size', 0, '分页大小'],
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格 3:星级质量 4:等级 5:能量值 6:生命值 7:攻击力 8:防御力'],
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
['type', 0, '物品类型 1:英雄 2:武器 3:芯片'],
['job_filters', '', '职业过滤(用|分割)'],
['search_filters', '', '搜索过滤(用|分割)'],
['lv_filter', 0, '等级过滤'],
['price_filter', '', '价格过滤(用|分割)']
],
'response': [
_common.RspHead(),
['total', 0, '出售的列表总数量(当前过滤配置)'],
['start', 0, '有效的分页偏移'],
['page_size', 0, '有效的分页大小'],
['!nfts', [NftIntro()], 'nft列表'],
]
},
{
'name': 'listMyNfts',
'desc': '获取自己的NFTs',
'group': 'Market',
'url': 'webapp/index.php?c=Market&a=listMyNfts',
'params': [
['account', '', '账号id'],
['token', '', 'token'],
['start', 0, '分页开始偏移'],
['page_size', 0, '分页大小'],
['type', 0, '物品类型 1:英雄 2:武器 3:芯片'],
['job_filters', '', '职业过滤(用|分割)'],
['search_filters', '', '搜索过滤(用|分割)'],
['lv_filter', 0, '等级过滤'],
],
'response': [
_common.RspHead(),
['total', 0, '出售的列表总数量(当前过滤配置)'],
['start', 0, '有效的分页偏移'],
['page_size', 0, '有效的分页大小'],
['!nfts', [NftIntro()], 'nft列表'],
]
}
]

View File

@ -8,7 +8,7 @@ function add(name) {
function init() {
add('fragment');
add('damping');
//add('season');
add('season');
add('feeback');
}

View File

@ -7,6 +7,7 @@ const constant = require('../constant');
class Season {
seasonList = [];
async start() {
console.log("season ranking start1");
while (true) {
await this.doRoutine(utils.getUtcTime());
const nowTime = utils.getUtcTime();
@ -18,7 +19,7 @@ class Season {
async doRoutine(nowTime) {
try {
console.log("season ranking start");
console.log("season ranking start2");
// console.time("season ranking");
this.seasonList = [];
metaFactory.traverseMetaList("RankSeason", (config, idx) => {
@ -30,7 +31,7 @@ class Season {
return true;
});
console.log("season ranking");
console.log("season ranking",this.seasonList);
if (this.checkSeasonEnd(nowTime)) {
await this.calcRanking(nowTime);
}
@ -180,4 +181,4 @@ function init() {
(new Season()).start();
}
exports.init = init;
exports.init = init;

View File

@ -51,16 +51,18 @@ class BlockChainController extends BaseAuthedController {
{
$trans = array();
foreach (Transaction::all() as $tran) {
array_push(
$trans,
array(
'trans_id' => $tran['trans_id'],
'item_id' => $tran['item_id'],
'action' => Transaction::getActionDesc($tran),
'status' => Transaction::getStatusDesc($tran),
'time' => $tran['createtime'],
)
);
if (myself()->_getNowTime() - $tran['createtime'] < 24*3600){
array_push(
$trans,
array(
'trans_id' => $tran['trans_id'],
'item_id' => $tran['item_id'],
'action' => Transaction::getActionDesc($tran),
'status' => Transaction::getStatusDesc($tran),
'time' => $tran['createtime'],
)
);
}
}
$this->_rspData(array(
'transactions' => $trans

View File

@ -65,6 +65,8 @@ class EventRankingController extends BaseAuthedController
':type' => $type
)
);
$this->myRanked['value'] = $this->getMyValue($wave,$type);
$data = $this->paginate($rows,$page,$size);
$pages = $data['pages'];
$rankingList = $data['lists'];
@ -80,6 +82,7 @@ class EventRankingController extends BaseAuthedController
':type' => $type
)
);
$this->myRanked['value'] = $this->getMyValue($wave,$type);
$ranked = 0;
foreach ($rows as $row) {
$ranked += 1;
@ -111,6 +114,7 @@ class EventRankingController extends BaseAuthedController
':type' => $type
)
);
$this->myRanked['value'] = $this->getMyValue($wave,$type);
$data = $this->paginate($rows,$page,$size);
$pages = $data['pages'];
$rankingList = $data['lists'];
@ -219,6 +223,20 @@ class EventRankingController extends BaseAuthedController
);
}
private function getMyValue($wave,$type){
$value = myself()->_getSelfMysql()->execQuery(
'SELECT * FROM t_rank_activity ' .
'WHERE wave=:wave AND type=:type AND account_id=:account_id ' .
"LIMIT 1",
array(
':wave' => $wave,
':type' => $type,
':account_id' => myself()->_getAccountId()
)
);
return $value ? $value[0]['value'] : 0;
}
private function celAward($wave,$type,$ranked){
$rankingMeta = \mt\EventRanking::findByWaveOrType($wave,$type);
$rewardNum = 0;
@ -253,7 +271,7 @@ class EventRankingController extends BaseAuthedController
public function settlementRankingAward(){
$id = getReqVal('id', 0);
// $currentRankingMeta = mt\EventRanking::getCurrentRanking();
// $awardList = array();
$awardList = array();
// if ($currentRankingMeta){
$lastRankingMeta = mt\EventRanking::find($id);
if ($lastRankingMeta){

View File

@ -21,6 +21,9 @@ require_once('phpcommon/bchelper.php');
use phpcommon\SqlHelper;
use models\BoxOrder;
use models\Nft;
use models\Hero;
use models\Gun;
use models\Chip;
use models\BuyRecord;
use services\MarketService;
use services\LuckyBoxService;
@ -534,4 +537,135 @@ class MarketController extends BaseController {
myself()->_rspOk();
}
public function listSellNfts()
{
$account = getReqVal('account', '');
$token = getReqVal('token', '');
$start = getReqVal('start', 0);
$page_size = getReqVal('page_size', 10);
$order_method = getReqVal('order_method', 0);
$order_asc = getReqVal('order_asc', 1);
$type = getReqVal('type', 1);
$job_filters = getReqVal('job_filters', '');
$job_filter_array = explode('|', $job_filters);
$search_filters = getReqVal('search_filters', '');
$search_filter_array = explode('|', $search_filters);
$lv_filter = getReqVal('lv_filter', 15);
$price_filter = getReqVal('price_filter', '');
$price_filter_array = explode('|', $price_filter);
$conn = myself()->_getMysql('');
$rows = SqlHelper::ormSelect(
$conn,
't_market_store'
);
$total = count($rows);
$page_end = $start + $page_size;
if ($page_end > $total)
$page_end = $total;
$nfts = array();
for ($x = $start; $x < $page_end; $x++) {
$row = $rows[$x];
$nftDb = Nft::getNft($row['token_id']);
if (!$nftDb) {
myself()->_rspErr(1, 'nft not exists');
return;
}
$nft = Nft::toDto($nftDb);
$t = $row['token_type'];
switch($t) {
case Nft::HERO_TYPE: {
} break;
case Nft::EQUIP_TYPE: {
} break;
case Nft::CHIP_TYPE: {
} break;
default: {
}
}
$row['details'] = $nft;
array_push($nfts, $row);
}
$this->_rspData(array(
"total" => count($rows),
"start" => $start,
"page_size" => $page_size,
'nfts' => $nfts,
));
}
public function listMyNfts()
{
$account = getReqVal('account', '');
$token = getReqVal('token', '');
$start = getReqVal('start', 0);
$page_size = getReqVal('page_size', 10);
$order_method = getReqVal('order_method', 0);
$order_asc = getReqVal('order_asc', 1);
$type = getReqVal('type', 1);
$job_filters = getReqVal('job_filters', '');
$job_filter_array = explode('|', $job_filters);
$search_filters = getReqVal('search_filters', '');
$search_filter_array = explode('|', $search_filters);
$lv_filter = getReqVal('lv_filter', 15);
$price_filter = getReqVal('price_filter', '');
$price_filter_array = explode('|', $price_filter);
$conn = myself()->_getMysql('');
$rows = SqlHelper::ormSelect(
$conn,
't_market_store'
);
$total = count($rows);
$page_end = $start + $page_size;
if ($page_end > $total)
$page_end = $total;
$nfts = array();
for ($x = $start; $x < $page_end; $x++) {
$row = $rows[$x];
$nftDb = Nft::getNft($row['token_id']);
if (!$nftDb) {
myself()->_rspErr(1, 'nft not exists');
return;
}
$nft = Nft::toDto($nftDb);
$t = $row['token_type'];
switch($t) {
case Nft::HERO_TYPE: {
} break;
case Nft::EQUIP_TYPE: {
} break;
case Nft::CHIP_TYPE: {
} break;
default: {
}
}
$row['details'] = $nft;
array_push($nfts, $row);
}
$this->_rspData(array(
"total" => count($rows),
"start" => $start,
"page_size" => $page_size,
'nfts' => $nfts,
));
}
}

View File

@ -11,6 +11,7 @@ require_once('services/NftService.php');
require_once('services/FormulaService.php');
use mt;
use phpcommon;
use phpcommon\SqlHelper;
use services\NftService;
use services\FormulaService;
@ -105,12 +106,17 @@ class Gun extends BaseModel {
myself()->_getMysql($accountId),
't_gun',
array(
'account_id' => $accountId,
'idx' => $gunUniId,
)
);
if ($row) {
$row['gun_uniid'] = $row['idx'];
if ($row['account_id'] != $accountId) {
$openId = phpcommon\extractOpenId($accountId);
if (!NftService::isEquipOwner($openId, $row['token_id'])) {
$row = null;
}
}
}
return $row;
}

View File

@ -8,22 +8,25 @@ use phpcommon\SqlHelper;
class NftActive extends BaseModel
{
public static function upsert($data){
if ($data['token_id']){
$where = array(
'token_id' =>$data['token_id'],
'daytime' =>myself()->_getDaySeconds(myself()->_getNowTime()),
);
}else{
$where = array(
'uniid' =>$data['uniid'],
'daytime' =>myself()->_getDaySeconds(myself()->_getNowTime()),
);
}
// if ($data['token_id']){
// $where = array(
// 'token_id' =>$data['token_id'],
// 'daytime' =>myself()->_getDaySeconds(myself()->_getNowTime()),
// );
// }else{
// $where = array(
// 'uniid' =>$data['uniid'],
// 'daytime' =>myself()->_getDaySeconds(myself()->_getNowTime()),
// );
// }
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_nft_active',
$where,
array(
'uniid' =>$data['uniid'],
'daytime' =>myself()->_getDaySeconds(myself()->_getNowTime()),
),
array(
),
array(

View File

@ -264,6 +264,28 @@ class User extends BaseModel {
}
}
}
for ($i = 0; $i < $len - 1; $i++) {
for ($j = $i + 1; $j < $len; $j++) {
if ($users[$i]['score'] == $users[$j]['score'] &&
$users[$i]['score_modifytime'] > $users[$j]['score_modifytime']) {
$tmp = $users[$i];
$users[$i] = $users[$j];
$users[$j] = $tmp;
}
}
}
for ($i = 0; $i < $len - 1; $i++) {
for ($j = $i + 1; $j < $len; $j++) {
if ($users[$i]['score'] == $users[$j]['score'] &&
$users[$i]['score_modifytime'] == $users[$j]['score_modifytime'] &&
$users[$i]['idx'] < $users[$j]['idx']
) {
$tmp = $users[$i];
$users[$i] = $users[$j];
$users[$j] = $tmp;
}
}
}
return $users;
}

View File

@ -994,7 +994,9 @@ class MissionService extends BaseService {
//PVE角色NFT每日获得极限CEG+PVE武器NFT每日获得极限CEG*90%/悬赏任务数量
$totalHeroUpLimit = 0;
$totalGunUpLimit = 0;
$count = $this->getOfferRewardMissionCount();
// $count = $this->getOfferRewardMissionCount();
$count = mt\Parameter::getVal
('wanted_refresh_mission_num', 0);
$propertyChgService->addUserChg();
foreach ($mission['objects'] as $obj) {
switch ($obj['type']) {
@ -1074,7 +1076,9 @@ class MissionService extends BaseService {
private function calcCegPreview($objects)
{
$count = $this->getOfferRewardMissionCount();
// $count = $this->getOfferRewardMissionCount();
$count = mt\Parameter::getVal
('wanted_refresh_mission_num', 0);
$cegNum = 0;
foreach ($objects as $obj) {
$type = $obj['type'];