diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index c5ccdd61..269b1192 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -469,6 +469,7 @@ class ShopController extends BaseAuthedController { private function getInAppBalance() { + $totalAmount = InAppRecord::getTotalAmount(); $recordDb = InAppRecord::get(); $upLimit = mt\Parameter::getVal('inapp_daily_up_limit', 0); $todayAmount = 0; diff --git a/webapp/models/InAppRecord.php b/webapp/models/InAppRecord.php index 18b2b255..86bde406 100644 --- a/webapp/models/InAppRecord.php +++ b/webapp/models/InAppRecord.php @@ -20,6 +20,22 @@ class InAppRecord extends BaseModel { return $row; } + public static function getTotalAmount() + { + $row = myself()->_getSelfMysql()->execQueryOne( + 'SELECT SUM(amount_ok) AS total_amount FROM t_inapp_record WHERE account_id=:account_id', + array( + 'account_id' => myself()->_getAccountId() + ) + ); + if ($row) { + if ($row['total_amount']) { + return $row['total_amount']; + } + } + return 0; + } + public static function addAmount($amount) { SqlHelper::upsert(