$this->_getDailyV(TN_DAILY_BIND_GOLD, 0), 'draw_state' => $this->_getDailyV(TN_DAILY_DRAW_BIND_GOLD_STATE, 0), 'up_times' => $this->_getDailyV(TN_DAILY_TIER_N_HERO_TIMES, 0), ); $this->_rspData(array( 'data' => $info )); } public function smashOpenS(){ $state = $this->_getDailyV(TN_DAILY_DRAW_BIND_GOLD_STATE, 0); if ($state > 0){ $this->_rspErr(1, "Run out today"); return; } $bindGold = $this->_getDailyV(TN_DAILY_BIND_GOLD, 0); if ($bindGold <= 0){ $this->_rspErr(1, "piggy bank empty"); return; } $rateRange = \mt\Parameter::getListValue('saving_withdraw_rate_range',0); $rate = rand($rateRange[0]*100,$rateRange[1]*100)/100; $normal = \mt\Parameter::getVal('bind_to_normal',0); $gold = max(1,floor($bindGold * $rate * $normal)); $items = array( array( "item_id" => V_ITEM_GOLD, "item_num" => $gold, ) ); $propertyChgService = new services\PropertyChgService(); $awardService = new services\AwardService(); $this->_addItems($items, $awardService,$propertyChgService); $this->_setDailyV(TN_DAILY_DRAW_BIND_GOLD_STATE, 0,1); SqlHelper::insert (myself()->_getSelfMysql(), 't_user_bind_gold_record', array( 'account_id' => myself()->_getAccountId(), 'way' => 2, 'amount' => $gold, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), ) ); $this->_rspData(array( 'award' => $awardService->toDto(), 'property_chg' => $propertyChgService->toDto(), )); } public function drawGoldS(){ $state = $this->_getDailyV(TN_DAILY_DRAW_BIND_GOLD_STATE, 0); if ($state > 0){ $this->_rspErr(1, "Run out today"); return; } $bindGold = $this->_getDailyV(TN_DAILY_BIND_GOLD, 0); if ($bindGold <= 0){ $this->_rspErr(1, "piggy bank empty"); return; } $upTimes = $this->_getDailyV(TN_DAILY_TIER_N_HERO_TIMES, 0); if ($upTimes < 1){ $this->_rspErr(1, "No completion condition"); return; } $normal = \mt\Parameter::getVal('bind_to_normal',0); $gold = max(1,floor($bindGold * $normal)); $items = array( array( "item_id" => V_ITEM_GOLD, "item_num" => $gold, ) ); $propertyChgService = new services\PropertyChgService(); $awardService = new services\AwardService(); $this->_addItems($items, $awardService,$propertyChgService); $this->_setDailyV(TN_DAILY_DRAW_BIND_GOLD_STATE, 0,1); SqlHelper::insert (myself()->_getSelfMysql(), 't_user_bind_gold_record', array( 'account_id' => myself()->_getAccountId(), 'way' => 1, 'amount' => $gold, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), ) ); $this->_rspData(array( 'award' => $awardService->toDto(), 'property_chg' => $propertyChgService->toDto(), )); } public function getRecord(){ $page = getReqVal('page', 0); $out = array( 'pagination' => array(), 'rows' => array() ); SqlHelper::rawQueryPage( myself()->_getSelfMysql(), 'SELECT * FROM t_user_bind_gold_record ', array(), array( 'page' => $page, 'perPage' => 8, 'orderBy' => "ORDER BY createtime DESC", 'handle' => function ($row) use(&$out) { array_push($out['rows'], $row); } ), $out['pagination'] ); myself()->_rspData($out); } }