diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index deb873e1..1a39685a 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -248,9 +248,29 @@ class MarketController extends BaseController { public function queryOrder() { - myself()->_rspData(array( - 'state' => 1 - )); + $orderId = getReqVal('order_id', ''); + $orderDb = BoxOrder::findByOrderId($orderId); + if ($orderDb) { + if (!$orderDb['done']) { + myself()->_rspData(array( + 'state' => 2 + )); + } else { + if ($orderDb['state'] == 1) { + myself()->_rspData(array( + 'state' => 1 + )); + } else { + myself()->_rspData(array( + 'state' => 3 + )); + } + } + } else { + myself()->_rspData(array( + 'state' => 0 + )); + } } public function getNftList() diff --git a/webapp/models/BoxOrder.php b/webapp/models/BoxOrder.php index c42e87a3..df8f292b 100644 --- a/webapp/models/BoxOrder.php +++ b/webapp/models/BoxOrder.php @@ -30,4 +30,16 @@ class BoxOrder extends BaseModel { return $row && $row['buy_count'] ? $row['buy_count'] > 0 : false; } + public function findByOrderId($orderId) + { + $row = SqlHelper::ormSelectOne( + myself()->_getMarketMysql(), + 't_box_order', + array( + 'order_id' => $orderId, + ) + ); + return $row; + } + }