This commit is contained in:
hujiabin 2023-06-20 11:31:22 +08:00
parent 05de1aef26
commit be116d84f3

View File

@ -184,53 +184,53 @@ class PassController extends BaseAuthedController {
)); ));
} }
public function buyPlatinumPass(){ // public function buyPlatinumPass(){
if (empty($this->_getAddress())){ // if (empty($this->_getAddress())){
$this->_rspErr(1, 'address is empty'); // $this->_rspErr(1, 'address is empty');
return; // return;
} // }
$price = getReqVal('price', ''); // $price = getReqVal('price', '');
if ($price != \mt\Parameter::getVal('battlepass_price','')){ // if ($price != \mt\Parameter::getVal('battlepass_price','')){
$this->_rspErr(1, 'The price is wrong'); // $this->_rspErr(1, 'The price is wrong');
return; // return;
} // }
$response = services\BlockChainService::gameItemMallBuy( // $response = services\BlockChainService::gameItemMallBuy(
Transaction::BUY_PASS_ACTION_TYPE,$price,V_ITEM_PASS,1); // Transaction::BUY_PASS_ACTION_TYPE,$price,V_ITEM_PASS,1);
//
// $this->_setV(TN_DAILY_BUY_PASS_STATE, 0,1);
// BcOrder::upsert($response['trans_id'],array(
// 'item_id'=>V_ITEM_PASS,
// 'item_num'=>1,
// ));
// $this->_rspData($response);
// }
$this->_setV(TN_DAILY_BUY_PASS_STATE, 0,1); // public function buyLevel(){
BcOrder::upsert($response['trans_id'],array( // if (empty($this->_getAddress())){
'item_id'=>V_ITEM_PASS, // $this->_rspErr(1, 'address is empty');
'item_num'=>1, // return;
)); // }
$this->_rspData($response); // $level = getReqVal('level', '');
} // $price = getReqVal('price', '');
// $passMeta = \mt\BattlePass::find($level);
public function buyLevel(){ // if (!$passMeta){
if (empty($this->_getAddress())){ // $this->_rspErr(1, 'param level error or null');
$this->_rspErr(1, 'address is empty'); // return;
return; // }
} // $celPrice = ($passMeta['total_exp'] - $this->userInfo['exp']) * \mt\Parameter::getVal('battlepass_buy_lv_price','');
$level = getReqVal('level', ''); // if ($celPrice != $price){
$price = getReqVal('price', ''); // $this->_rspErr(1, 'The price is wrong');
$passMeta = \mt\BattlePass::find($level); // return;
if (!$passMeta){ // }
$this->_rspErr(1, 'param level error or null'); // $response = services\BlockChainService::gameItemMallBuy(
return; // Transaction::BUY_EXP_ACTION_TYPE,$price,V_ITEM_EXP,$passMeta['total_exp'] - $this->userInfo['exp']);
} // $this->_setV(TN_DAILY_BUY_LEVEL_STATE, 0,1);
$celPrice = ($passMeta['total_exp'] - $this->userInfo['exp']) * \mt\Parameter::getVal('battlepass_buy_lv_price',''); // BcOrder::upsert($response['trans_id'],array(
if ($celPrice != $price){ // 'item_id'=>V_ITEM_EXP,
$this->_rspErr(1, 'The price is wrong'); // 'item_num'=>$passMeta['total_exp'] - $this->userInfo['exp'],
return; // ));
} // $this->_rspData($response);
$response = services\BlockChainService::gameItemMallBuy( // }
Transaction::BUY_EXP_ACTION_TYPE,$price,V_ITEM_EXP,$passMeta['total_exp'] - $this->userInfo['exp']);
$this->_setV(TN_DAILY_BUY_LEVEL_STATE, 0,1);
BcOrder::upsert($response['trans_id'],array(
'item_id'=>V_ITEM_EXP,
'item_num'=>$passMeta['total_exp'] - $this->userInfo['exp'],
));
$this->_rspData($response);
}
public function resetPassLevel(){ public function resetPassLevel(){