1
This commit is contained in:
parent
855c07b379
commit
5113f30ec4
@ -107,10 +107,10 @@ class ComputingPower(object):
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'exchangeUplimitNew',
|
||||
'desc': '晶体兑换上限',
|
||||
'name': 'exchangeCrystalInfo',
|
||||
'desc': '晶体兑换信息',
|
||||
'group': 'ComputingPower',
|
||||
'url': 'webapp/index.php?c=ComputingPower&a=exchangeUplimitNew',
|
||||
'url': 'webapp/index.php?c=ComputingPower&a=exchangeCrystalInfo',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
],
|
||||
|
@ -351,7 +351,7 @@ class ComputingPowerController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
public function exchangeUplimitNew(){
|
||||
public function exchangeCrystalInfo(){
|
||||
$hashRateService = new \services\HashRateService();
|
||||
$crystalInfo = $hashRateService->getCrystalValue();
|
||||
$this->_rspData(array(
|
||||
@ -460,8 +460,11 @@ class ComputingPowerController extends BaseAuthedController
|
||||
}
|
||||
|
||||
public function test(){
|
||||
print_r(\mt\HashRateTask::getMetaList());
|
||||
|
||||
$hashRateService = new \services\HashRateService();
|
||||
$crystalInfo = $hashRateService->getCrystalValue();
|
||||
$this->_rspData(array(
|
||||
'crystalInfo' => $crystalInfo
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,66 +1,67 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace models;
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
class CrystalRecord extends BaseModel
|
||||
{
|
||||
public static function getCrystalRecordList($cb){
|
||||
SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_crystal_exchange_record',
|
||||
array(
|
||||
'account_id'=>myself()->_getAccountId()
|
||||
),
|
||||
function ($row) use($cb) {
|
||||
$cb($row);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCrystalNum($item_id){
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_crystal_exchange_record',
|
||||
array(
|
||||
'account_id'=>myself()->_getAccountId(),
|
||||
'item_id' => $item_id
|
||||
)
|
||||
);
|
||||
|
||||
$crystalNum = 0;
|
||||
if ($rows){
|
||||
foreach ($rows as $row){
|
||||
$crystalNum += $row['item_num'];
|
||||
}
|
||||
}
|
||||
return $crystalNum;
|
||||
}
|
||||
|
||||
public static function addCrystalRecord($itemId,$itemNum){
|
||||
SqlHelper::insert(
|
||||
myself()->_getSelfMysql(),
|
||||
't_crystal_exchange_record',
|
||||
array(
|
||||
'account_id'=>myself()->_getAccountId(),
|
||||
'address'=>myself()->_getAddress(),
|
||||
'item_id'=>$itemId,
|
||||
'item_num' => $itemNum,
|
||||
'createtime'=>myself()->_getNowTime(),
|
||||
'modifytime'=>myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function getNewestRecordOne($itemId){
|
||||
$sql = "select * from t_crystal_exchange_record where `account_id` = :account_id and item_id = :item_id order by idx desc limit 1";
|
||||
$rows = myself()->_getMysql('')->execQuery($sql,array(
|
||||
'account_id' =>myself()->_getAccountId(),
|
||||
'item_id' =>$itemId,
|
||||
));
|
||||
return count($rows) > 0 ? $rows[0] : array();
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
namespace models;
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
class CrystalRecord extends BaseModel
|
||||
{
|
||||
public static function getCrystalRecordList($cb){
|
||||
SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_crystal_exchange_record',
|
||||
array(
|
||||
'account_id'=>myself()->_getAccountId(),
|
||||
'item_id'=>ComputingPower::CRYSTAL_NEW,
|
||||
),
|
||||
function ($row) use($cb) {
|
||||
$cb($row);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCrystalNum($item_id){
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_crystal_exchange_record',
|
||||
array(
|
||||
'account_id'=>myself()->_getAccountId(),
|
||||
'item_id' => $item_id
|
||||
)
|
||||
);
|
||||
|
||||
$crystalNum = 0;
|
||||
if ($rows){
|
||||
foreach ($rows as $row){
|
||||
$crystalNum += $row['item_num'];
|
||||
}
|
||||
}
|
||||
return $crystalNum;
|
||||
}
|
||||
|
||||
public static function addCrystalRecord($itemId,$itemNum){
|
||||
SqlHelper::insert(
|
||||
myself()->_getSelfMysql(),
|
||||
't_crystal_exchange_record',
|
||||
array(
|
||||
'account_id'=>myself()->_getAccountId(),
|
||||
'address'=>myself()->_getAddress(),
|
||||
'item_id'=>$itemId,
|
||||
'item_num' => $itemNum,
|
||||
'createtime'=>myself()->_getNowTime(),
|
||||
'modifytime'=>myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function getNewestRecordOne($itemId){
|
||||
$sql = "select * from t_crystal_exchange_record where `account_id` = :account_id and item_id = :item_id order by idx desc limit 1";
|
||||
$rows = myself()->_getMysql('')->execQuery($sql,array(
|
||||
'account_id' =>myself()->_getAccountId(),
|
||||
'item_id' =>$itemId,
|
||||
));
|
||||
return count($rows) > 0 ? $rows[0] : array();
|
||||
}
|
||||
|
||||
}
|
@ -167,8 +167,10 @@ class HashRateService extends BaseService
|
||||
$hashRateDb = HashRateTask::findByTaskIdOrSeason($metaTask['id'],$seasonMeta['id']);
|
||||
$userDb = myself()->_safeGetOrmUserInfo();
|
||||
$rankMeta = Rank::getRankById($userDb['rank']);
|
||||
if ($rankMeta['rank_order2'] > $hashRateDb['record_total']){
|
||||
//
|
||||
if ($hashRateDb && $rankMeta['rank_order2'] > $hashRateDb['record_total']){
|
||||
$finalVal = ($rankMeta['rank_order2'] - $hashRateDb['claim_total']) * $metaTask['reward'];
|
||||
|
||||
}
|
||||
} else {
|
||||
$hashRateDb = HashRateTask::findByTaskId($metaTask['id']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user