/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $input = $request->all(); $imgPath = 'img/uploads/'; $timestamp = time(); $fileProperties = ['img_artwork', 'img_signature', 'img_optional']; foreach ($fileProperties as $fileProperty) { if ($request->hasFile($fileProperty)) { $file = $request->file($fileProperty); $extension = $file->getClientOriginalExtension(); $randomstring = self::generateRandomString(20); $filename = $timestamp . '-' . $randomstring . '.' . $extension; $file->move($imgPath, $filename); $input[$fileProperty] = '/' . $imgPath . $filename; } } $input['enddate'] = Carbon::createFromFormat('Y-m-d', $input['enddate']); $auction = Auction::create($input); $owner = Auth::user(); $auction->owner()->associate($owner); $style = AuctionStyle::findOrFail($request->get('auction_style_id')); $auction->auctionstyles()->associate($style); $auction->save(); return redirect()->route('myauctions'); }
/** * Execute the console command. * * @return mixed */ public function fire() { try { // to caculate auciton winner Auction::cronRunTheWheel(); } catch (Exception $e) { if ($e->getCode() > 2000) { LogCronjob::addLog($this->name, $e->getMessage()); } } }
/** * Execute the console command. * * @return mixed */ public function fire() { try { LogCronjob::addLog($this->name, 'START-CRONJOB'); // to cacualte the unpaied auction Auction::cronYouCheater(); } catch (Exception $e) { if ($e->getCode() > 2000) { LogCronjob::addLog($this->name, $e->getMessage()); } } }
public function getAuction($id) { try { $auction = Auction::find($id); if (empty($auction)) { throw new Exception("没有找到请求的数据", 2001); } $auction->load('eventItem'); $data = $auction->showDetail(); $re = Tools::reTrue('获取竞拍成功', $data); } catch (Exception $e) { $re = Tools::reFalse($e->getCode(), '获取竞拍失败:' . $e->getMessage()); } return Response::json($re); }
$date2 = '2014-10-26 9:13'; $bid3 = "Bert"; $value3 = 15.5; $date3 = '2015-10-26 15:00'; $Bids = array(new Bid($bid1, $value1, $date1), new Bid($bid2, $value2, $date2), new Bid($bid3, $value3, $date3)); echo "<dl>"; echo "<dt>{$Auction1->getArticle()}</dt>\n <dd><p>{$Auction1->getAnotation()}</p>\n <p>Price: {$Auction1->getPrice()}€</p>\n <p>Ended {$Auction1->getDate()}</p>\n <p><ul>\n <li>{$Bids[2]->getName()}; {$Bids[2]->getValue()}€; {$Bids[2]->getDate()}; Sold;</li>\n <li>{$Bids[1]->getName()}; {$Bids[1]->getValue()}€; {$Bids[1]->getDate()}</li>\n <li>{$Bids[0]->getName()}; {$Bids[0]->getValue()}€; {$Bids[0]->getDate()}</li>\n </ul></p>\n </dd>"; $name1 = "Miguel Howard"; $mail1 = "*****@*****.**"; $gender1 = "male"; $Users[0] = new User($name1, $mail1, $gender1); $article = "Linen Jacket"; $anotation = "It has a smooth chalk stripe pattern which gives the suit a refined look. The 6 buttons of his double\n breasted jacket are all buttoned up with the exception of one, it adds a casual touch to an elegant look.<br>\n The jacket is the same length all around, it has vents at either side, there's a pocket on either side and there's\n a breast pocket which contains a stylish pocket square."; $price = 135; $time = "2015-10-29 12:00"; $Auction1 = new Auction($article, $price, $anotation, $time); $bid1 = "Miguel"; $value1 = 140; $date1 = '2015-10-28 13:58'; $Bids[0] = new Bid($bid1, $value1, $date1); $bid2 = "Rush"; $value2 = 155; $date2 = '2014-10-29 9:13'; $Bids[1] = new Bid($bid2, $value2, $date2); echo "<dt>{$Auction1->getArticle()}</dt>\n <dd><p>{$Auction1->getAnotation()}</p>\n <p>Price: {$Auction1->getPrice()}€</p>\n <p>Ends {$Auction1->getDate()}</p>\n <p><ul>\n <li>{$Bids[1]->getName()}; {$Bids[1]->getValue()}€; {$Bids[1]->getDate()}</li>\n <li>{$Bids[0]->getName()}; {$Bids[0]->getValue()}€; {$Bids[0]->getDate()}</li>\n </ul></p>\n </dd>"; echo "</dl>"; $Users[] = new User("Andrius Bankauskas", "*****@*****.**", "male"); $Bids[1] = new Bid("ThankYou", "5", "2015-10-29 12:00"); $Auction1->setArticle("Buy food")->setAnotation("very tasty!")->setPrice("5")->setDate("2015-10-29 12:00"); echo "<dt>{$Auction1->getArticle()}</dt>\n <dd><p>{$Auction1->getAnotation()}</p>\n <p>Price: {$Auction1->getPrice()}€</p>\n <p>Ends {$Auction1->getDate()}</p>\n <p><ul>\n <li>{$Bids[1]->getName()}; {$Bids[1]->getValue()}€; {$Bids[1]->getDate()} Sold!</li>\n <li>{$Bids[0]->getName()}; {$Bids[0]->getValue()}€; {$Bids[0]->getDate()}</li>\n </ul></p>\n </dd>"; echo "</dl>";
<a href="myBids.php"> <div class = "fontAwesome"> <span class="fa-stack fa-3x"> <i class="fa fa-circle fa-stack-2x text-primary"></i> <i class="fa fa-check fa-stack-1x fa-inverse"></i> </span> <h4>My bids</h4> </div> </a> </div> </div> </div> </div> <?php $auction = new Auction($conn); //index = auctionID, $auctionList = $auction->recommend($_SESSION['user']['userId']); //print_r($auctionList); //create new array that contains all the indexes of auctionList that has value of 2 $auctionIdArray = []; //key->value because we need the index foreach ($auctionList as $key => $val) { if ($val == 2) { $auctionIdArray[] = $key; } } ?> <h2>Recommended items</h2><br> <table class = "table table-hover table-condensed">
if (isset($_POST['postAuction'])) { $userId = $_SESSION['user']['userId']; //insert auction into auction table //insert item id here too //auctionID $datePosted = $date = date('Y-m-d'); $endDate = $_POST['endDate']; $startPrice = $_POST['startPrice']; $resPrice = $_POST['resPrice']; //$count = 0;//number of views //insert item into item table //insert item id here too $itemName = $_POST['itemName']; $description = $_POST['description']; $category = $_POST['category']; $auction = new Auction($conn); $item = new Item($conn); if ($auction->addAuction($datePosted, $endDate, $startPrice, $resPrice, $currentItemID, $userId) && $item->addItem($currentItemID, $itemName, $description, $category, $userId)) { echo ' <div class = "alert alert-success"> Auction successfully posted </div> '; } else { echo ' <div class = "alert alert-danger"> Error posting auction </div> '; } }
function bid($amount) { global $CFG; date_default_timezone_set($CFG->default_timezone); if (!($this->id > 0)) { return false; } if ($this->is_expired) { return false; } if (!is_numeric($amount)) { $this->errors[] = $CFG->auction_invalid_bid_error; return false; } if (User::isLoggedIn()) { if (DB::tableExists($this->table . '_bids')) { $user_id = User::$info['id']; $this->minimum_increase = !($this->high_bid > 0) ? $this->initial_bid : $this->minimum_increase; if ($amount >= $this->item_info['high_bid'] + $this->minimum_increase || $this->high_bid_user_id == User::$info['id'] && $amount > $this->item_info['high_bid']) { if ($this->proxy_bids) { $proxy = Auction::getHighestProxy(); if ($this->high_bid_user_id != User::$info['id']) { if ($amount <= $proxy['amount']) { $proxy_increase = $amount + $this->minimum_increase <= $proxy['amount'] ? $amount + $this->minimum_increase : $proxy['amount']; DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $user_id, 'amount' => $amount, 'date' => $this->now)); DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $this->high_bid_user_id, 'amount' => $proxy_increase, 'is_proxy' => 'Y', 'date' => $this->now)); DB::update($this->table, array('high_bid' => $proxy_increase), $this->id); //Auction::realizeBids($proxy_increase); $this->high_bid = $proxy_increase; $outbid = true; } elseif ($amount > $proxy['amount'] && $amount < $proxy['amount'] + $this->minimum_increase && $proxy['user_id'] != $user_id) { $this->errors[] = str_ireplace('[field]', $this->minimum_increase, $CFG->auction_min_increase_error); DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $user_id, 'amount' => $amount, 'date' => $this->now)); DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $this->high_bid_user_id, 'amount' => $proxy['amount'], 'is_proxy' => 'Y', 'date' => $this->now)); DB::update($this->table, array('high_bid' => $proxy['amount']), $this->id); //Auction::realizeBids($proxy['amount']); $this->high_bid = $proxy['amount']; $outbid = true; } else { if ($proxy['amount'] > $this->high_bid) { if ($proxy['amount'] > $this->high_bid + $this->minimum_increase) { $this->high_bid = $proxy['amount']; } } if ($amount > $proxy['amount'] + $this->minimum_increase) { DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $user_id, 'amount' => $amount, 'is_proxy' => 'N', 'is_realized' => 'N', 'date' => $this->now)); $this->high_bid = $proxy['amount']; } } } else { if ($amount < $proxy['amount']) { $this->errors[] = str_ireplace('[field]', $amount, $CFG->auction_outbid_self_proxy_error); $outbid = true; } else { $this->messages[] = str_ireplace('[field]', $amount, $CFG->auction_new_proxy_message); DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $user_id, 'amount' => $amount, 'is_proxy' => 'N', 'is_realized' => 'N', 'date' => $this->now)); $bypass = true; } } } if ($this->anti_sniping && $this->anti_sniping_increase) { if ($this->time_remaining < $this->anti_sniping) { if (!($this->proxy_bids && $this->high_bid_user_id == User::$info['id'])) { Auction::addTime($this->anti_sniping_increase); } } } //DB::insert($this->table.'_bids',array('item_id'=>$15this->id,'item_table'=>$this->table,'user_id'=>$user_id,'amount'=>$amount)); if (!$outbid) { $new_bid = $this->proxy_bids ? $this->high_bid + $this->minimum_increase : $amount; $new_bid = $this->proxy_bids && $this->high_bid_user_id == $user_id ? $this->high_bid : $new_bid; //$new_bid = (!($this->high_bid > 0)) ? $amount : $new_bid; $this->high_bid = $new_bid; $this->high_bid_user_id = $user_id; $is_proxy = $this->proxy_bids && $amount > $this->high_bid + $this->minimum_increase ? 'Y' : 'N'; Auction::realizeBids($new_bid); if (!$bypass) { DB::insert($this->table . '_bids', array('item_id' => $this->id, 'item_table' => $this->table, 'user_id' => $user_id, 'amount' => $new_bid, 'is_proxy' => $is_proxy, 'date' => $this->now)); } DB::update($this->table, array('high_bid' => $new_bid, 'high_bid_user_id' => $user_id), $this->id); $this->messages[] = $CFG->auction_high_bid_message; return true; } else { if (!is_array($this->errors)) { $this->errors[] = $CFG->auction_outbid_error; } return false; } } elseif ($amount >= $this->item_info['high_bid'] && $amount < $this->item_info['high_bid'] + $this->minimum_increase) { $this->errors[] = str_ireplace('[field]', $this->minimum_increase, $CFG->auction_min_increase_error); return false; } elseif ($amount < $this->item_info['high_bid'] && $this->item_info['high_bid_user_id'] != $user_id) { $this->errors[] = str_ireplace('[field]', $this->high_bid, $CFG->auction_bid_too_low_error); return false; } elseif ($amount < $this->item_info['high_bid'] && $this->item_info['high_bid_user_id'] == $user_id) { $this->errors[] = $CFG->auction_outbid_self_error; return false; } } else { $this->errors[] = $CFG->auction_table_error; } } else { $this->errors[] = $CFG->auction_login_error; } }
$userId = $_SESSION['user']['userId']; $bidDate = $date = date('Y-m-d'); $bidPrice = $_POST['bidPrice']; if ($bidPrice < $auctionItemRow['startPrice'] || $bidPrice <= $highestBid[0]) { echo ' <div class = "alert alert-danger"> Error bidding - bid price must be higher than start price or highest bid! </div> '; } else { //get starting price, if bidprice<starting price then show error. //$bidQuery = "INSERT INTO `bids` (`auctionID`, `userId`, `bidPrice`, `bidDate`) VALUES ('$auctionID', '$userId', '$bidPrice', '$bidDate')"; //update auction bid count //$updateQuery = "UPDATE `auction` SET bids = bids+1 WHERE auctionID='$auctionID'"; //auction manager $auction = new Auction($conn); if ($auction->addBid($auctionID, $userId, $bidPrice, $bidDate)) { echo ' <div class = "alert alert-success"> Bid successful </div> '; //notifyBidders($auctionID, $bidPrice, $bidDate, $userId) $auction->notifyBidders($auctionID, $bidPrice, $bidDate, $userId); } else { echo ' <div class = "alert alert-danger"> Error bidding </div> '; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <?php if ($_SERVER["REQUEST_METHOD"] == "GET") { $link = mysqli_connect("localhost", "root", "booksmart", "booksmart"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } if (isset($_GET['auction_id'])) { $auction_id = mysqli_real_escape_string($link, $_GET['auction_id']); //sanitize auction_id input } else { $auction_id = $_SESSION['AUCTION_INFO']->getAuctionId(); } $auction_query = mysqli_query($link, "SELECT * FROM auctions WHERE auction_id='{$auction_id}'"); $auction = new Auction(); if ($auction_query !== null) { while ($row = mysqli_fetch_array($auction_query)) { $auction->setAuctionId($row['auction_id']); $auction->setAuctionTitle($row['auction_title']); $auction->setAuctionDesc($row['auction_desc']); $auction->setISBN($row['isbn']); $auction->setBINPrice($row['bin_price']); $auction->setStartBidPrice($row['start_bid_price']); $auction->setUserId($row['user_id']); $auction->setCreationTime($row['auction_creation_time']); $auction->setEndTime($row['auction_end_time']); $auction->setAuctionEnded($row['auction_ended']); $auction->setWinnerUserName($row['winner_username']); } }
$canBuy = $_SESSION['canBuy']; require 'config.php'; if ($canBuy == false) { $_SESSION['error'] = $lang['purchaseItem']['no_buy']; header("Location: ../index.php"); } require 'itemInfo.php'; require_once '../classes/Auction.php'; require_once '../classes/EconAccount.php'; if ($useTwitter == true) { require_once 'twitter.class.php'; } $itemId = mysql_real_escape_string(stripslashes($_POST['ID'])); $numberLeft = 0; $player = new EconAccount($user, $useMySQLiConomy, $iConTableName); $auction = new Auction($itemId); $owner = new EconAccount($auction->owner, $useMySQLiConomy, $iConTableName); $itemEnchantsArray = $auction->getEnchantmentArray(); if (is_numeric($_POST['Quantity']) && $_POST['Quantity'] > 0) { $buyQuantity = mysql_real_escape_string(stripslashes(round(abs($_POST['Quantity'])))); } elseif ($_POST['Quantity'] <= 0) { $_SESSION['error'] = $lang['purchaseItem']['insufficient_quantity']; header("Location: ../index.php"); return; } else { $buyQuantity = $auction->quantity; } $toDelete = false; $totalPrice = round($auction->price * $buyQuantity, 2); $numberLeft = $auction->quantity - $buyQuantity; if ($numberLeft < 0 && $auction->quantity > 0) {
public static function cronYouCheater() { $date = Tools::getNow(false); $now = $date->format('Y-m-d H:i:s'); $date->modify('-2 days'); $end = $date->format('Y-m-dH:i:s'); $auction = Auction::join('event_items', function ($q) { $q->on('event_items.e_id', '=', 'auctions.e_id'); })->where('event_items.e_end_at', '<', $end)->where(function ($q) { $q->where('auctions.a_status', '=', 2)->orWhere('auctions.a_status', '=', 1); })->first(); if (empty($auction)) { throw new Exception("没有需要处理的竞拍", 2000); } if ($auction->a_status == 2 && $auction->a_win_id) { $win = AuctionBid::find($auction->a_win_id); if (!empty($win)) { $date->modify('+10 days'); $end = $date->format('Y-m-d H:i:s'); $blacklist = new AuctionBlacklist(); $blacklist->u_id = $win->u_id; $blacklist->a_id = $auction->a_id; $blacklist->start_at = $now; $blacklist->end_at = $end; $blacklist->remart = '超时未购买'; $blacklist->save(); } } $auction->a_status = 4; $auction->save(); return true; }
public function listAuctions() { $token = Input::get('token', ''); $u_id = Input::get('u_id', ''); $won = Input::get('won'); $per_page = Input::get('per_page', 30); try { $user = User::chkUserByToken($token, $u_id); $query = Auction::with('eventItem')->join('event_items', function ($q) { $q->on('event_items.e_id', '=', 'auctions.e_id'); })->join('auction_bids', function ($q) { $q->on('auction_bids.a_id', '=', 'auctions.a_id'); })->where('auction_bids.u_id', '=', $u_id); if ($won) { $query = $query->where('auction_bids.is_win', '=', 1); } $query = $query->groupBy('auctions.a_id')->orderBy('auctions.created_at', 'DESC'); $list = $query->paginate($per_page); $data = []; foreach ($list as $key => $auction) { $data[] = $auction->showDetail(); } $re = Tools::reTrue('获取竞拍成功', $data, $list); } catch (Exception $e) { $re = Tools::reFalse($e->getCode(), '获取竞拍失败:' . $e->getMessage()); } return Response::json($re); }
<?php session_start(); if (!isset($_SESSION['User'])) { header("Location: login.php"); } $user = $_SESSION['User']; $isAdmin = $_SESSION['Admin']; require 'config.php'; require 'itemInfo.php'; require_once '../classes/Auction.php'; $auctionId = mysql_real_escape_string(stripslashes($_GET['id'])); $auction = new Auction($auctionId); $queryEnchantLinks = mysql_query("SELECT * FROM WA_EnchantLinks WHERE itemId = '{$id}' AND itemTableId = '1'"); //return mysql_num_rows($queryEnchantLinks); $itemEnchantsArray = array(); while (list($idt, $enchIdt, $itemTableIdt, $itemIdt) = mysql_fetch_row($queryEnchantLinks)) { $itemEnchantsArray[] = $enchIdt; } //echo $itemOwner.":".$user; if ($isAdmin == "true") { $queryPlayerItems = mysql_query("SELECT * FROM WA_Items WHERE player='{$auction->owner}'"); $foundItem = false; $stackId = 0; $stackQuant = 0; while (list($pid, $pitemName, $pitemDamage, $pitemOwner, $pitemQuantity) = mysql_fetch_row($queryPlayerItems)) { if ($auction->name == $pitemName) { if ($auction->damage == $pitemDamage) { $queryEnchantLinksMarket = mysql_query("SELECT * FROM WA_EnchantLinks WHERE itemTableId = '0' AND itemId = '{$pid}'"); $marketEnchantsArray = array(); while (list($idt, $enchIdt, $itemTableIdt, $itemIdt) = mysql_fetch_row($queryEnchantLinksMarket)) {
function Order() { // ログイン処理する前に処理するもの // まだユーザデータ読んでません switch (true) { case $_GET["menu"] === "auction": include CLASS_AUCTION; $ItemAuction = new Auction(item); $ItemAuction->AuctionHttpQuery("auction"); $ItemAuction->ItemCheckSuccess(); // 競売が終了した品物を調べる $ItemAuction->UserSaveData(); // 競売品と金額を各IDに配って保存する break; case $_GET["menu"] === "rank": include CLASS_RANKING; $Ranking = new Ranking(); break; } if (true === ($message = $this->CheckLogin())) { //if( false ): // ログイン include_once DATA_ITEM; include CLASS_CHAR; if ($this->FirstLogin()) { return 0; } switch (true) { case $this->OptionOrder(): return false; case $_POST["delete"]: if ($this->DeleteMyData()) { return 0; } // 設定 // 設定 case $_SERVER["QUERY_STRING"] === "setting": if ($this->SettingProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->SettingShow(); return 0; // オークション // オークション case $_GET["menu"] === "auction": $this->LoadUserItem(); //道具データ読む $this->AuctionHeader(); /* * 出品用のフォーム * 表示を要求した場合か、 * 出品に失敗した場合表示する。 */ $ResultExhibit = $this->AuctionItemExhibitProcess($ItemAuction); $ResultBidding = $this->AuctionItemBiddingProcess($ItemAuction); $ItemAuction->ItemSaveData(); // 変更があった場合だけ保存する。 // 出品リストを表示する if ($_POST["ExhibitItemForm"]) { $this->fpCloseAll(); $this->AuctionItemExhibitForm($ItemAuction); // 出品か竞标に成功した場合はデータを保存する } else { if ($ResultExhibit !== false) { if ($ResultExhibit === true || $ResultBidding === true) { $this->SaveData(); } $this->fpCloseAll(); $this->AuctionItemBiddingForm($ItemAuction); // それ以外 } else { $this->fpCloseAll(); $this->AuctionItemExhibitForm($ItemAuction); } } $this->AuctionFoot($ItemAuction); return 0; // 狩場 // 狩場 case $_SERVER["QUERY_STRING"] === "hunt": $this->LoadUserItem(); //道具データ読む $this->fpCloseAll(); $this->HuntShow(); return 0; // 街 // 街 case $_SERVER["QUERY_STRING"] === "town": $this->LoadUserItem(); //道具データ読む $this->fpCloseAll(); $this->TownShow(); return 0; // シミュれ // シミュれ case $_SERVER["QUERY_STRING"] === "simulate": $this->CharDataLoadAll(); //キャラデータ読む if ($this->SimuBattleProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->SimuBattleShow($result); return 0; // ユニオン // ユニオン case $_GET["union"]: $this->CharDataLoadAll(); //キャラデータ読む include CLASS_UNION; include DATA_MONSTER; if ($this->UnionProcess()) { // 戦闘する $this->SaveData(); $this->fpCloseAll(); } else { // 表示 $this->fpCloseAll(); $this->UnionShow(); } return 0; // 一般モンスター // 一般モンスター case $_GET["common"]: $this->CharDataLoadAll(); //キャラデータ読む $this->LoadUserItem(); //道具データ読む if ($this->MonsterBattle()) { $this->SaveData(); $this->fpCloseAll(); } else { $this->fpCloseAll(); $this->MonsterShow(); } return 0; // キャラステ // キャラステ case $_GET["char"]: $this->CharDataLoadAll(); //キャラデータ読む include DATA_SKILL; include DATA_JUDGE_SETUP; $this->LoadUserItem(); //道具データ読む $this->CharStatProcess(); $this->fpCloseAll(); $this->CharStatShow(); return 0; // 道具一覧 // 道具一覧 case $_SERVER["QUERY_STRING"] === "item": $this->LoadUserItem(); //道具データ読む //$this->ItemProcess(); $this->fpCloseAll(); $this->ItemShow(); return 0; // 精錬 // 精錬 case $_GET["menu"] === "refine": $this->LoadUserItem(); $this->SmithyRefineHeader(); if ($this->SmithyRefineProcess()) { $this->SaveData(); } $this->fpCloseAll(); $result = $this->SmithyRefineShow(); return 0; // 製作 // 製作 case $_GET["menu"] === "create": $this->LoadUserItem(); $this->SmithyCreateHeader(); include DATA_CREATE; //製作できるものデータ等 if ($this->SmithyCreateProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->SmithyCreateShow(); return 0; // ショップ(旧式:買う,売る,打工) // ショップ(旧式:買う,売る,打工) case $_SERVER["QUERY_STRING"] === "shop": $this->LoadUserItem(); //道具データ読む if ($this->ShopProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->ShopShow(); return 0; // ショップ(買う) // ショップ(買う) case $_GET["menu"] === "buy": $this->LoadUserItem(); //道具データ読む $this->ShopHeader(); if ($this->ShopBuyProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->ShopBuyShow(); return 0; // ショップ(売る) // ショップ(売る) case $_GET["menu"] === "sell": $this->LoadUserItem(); //道具データ読む $this->ShopHeader(); if ($this->ShopSellProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->ShopSellShow(); return 0; // ショップ(働く) // ショップ(働く) case $_GET["menu"] === "work": $this->ShopHeader(); if ($this->WorkProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->WorkShow(); return 0; // ランキング // ランキング case $_GET["menu"] === "rank": $this->CharDataLoadAll(); //キャラデータ読む $RankProcess = $this->RankProcess($Ranking); if ($RankProcess === "BATTLE") { $this->SaveData(); $this->fpCloseAll(); } else { if ($RankProcess === true) { $this->SaveData(); $this->fpCloseAll(); $this->RankShow($Ranking); } else { $this->fpCloseAll(); $this->RankShow($Ranking); } } return 0; // 雇用 // 雇用 case $_SERVER["QUERY_STRING"] === "recruit": if ($this->RecruitProcess()) { $this->SaveData(); } $this->fpCloseAll(); $this->RecruitShow($result); return 0; // それ以外(トップ) // それ以外(トップ) default: $this->CharDataLoadAll(); //キャラデータ読む $this->fpCloseAll(); $this->LoginMain(); return 0; } } else { // ログアウト $this->fpCloseAll(); switch (true) { case $this->OptionOrder(): return false; case $_POST["Make"]: list($bool, $message) = $this->MakeNewData(); if (true === $bool) { $this->LoginForm($message); return false; } case $_SERVER["QUERY_STRING"] === "newgame": $this->NewForm($message); return false; default: $this->LoginForm($message); } } }
public function checkoutAuction() { if ($this->c_type != 4) { return true; } $auction = Auction::find($this->p_id); $auction->a_status = 3; $bid = AuctionBid::find($auction->a_win_id); $bid->is_pay = 1; $auction->save(); $bid->save(); return true; }
private static function queryResultToAdvancedAuctions($result) { $liveAuctions = []; while ($row = $result->fetch_assoc()) { $auction = new Auction($row); $auctionId = $auction->getAuctionId(); $bids = self::getAuctionBids($auctionId); $views = $auction->getViews(); $watches = self::getAuctionWatches($auctionId); $liveAuction = new AdvancedAuction($auction, $bids, $views, $watches); $liveAuctions[] = $liveAuction; } return $liveAuctions; }