This commit is contained in:
aozhiwei 2023-08-02 13:22:17 +08:00
parent 1914112edf
commit 928b6f6615
4 changed files with 15 additions and 7 deletions

View File

@ -246,7 +246,12 @@ class ShopController extends BaseAuthedController {
$this->_rspErr(2, "inapp purchase failed");
return;
}
if ($goodsMeta['shop_id'] != mt\Shop::INAPP_SHOP) {
if (!in_array($goodsMeta['shop_id'],
array(
mt\Shop::INAPP_SHOP_CEG,
mt\Shop::INAPP_SHOP_DIAMOND
)
)) {
$this->_rspErr(3, "inapp purchase failed");
return;
}
@ -263,7 +268,7 @@ class ShopController extends BaseAuthedController {
return;
}
$price = $goodsMeta['price'];
if (empty($price) || $pirce < 0.001) {
if (empty($price) || $price < 0.001) {
$this->_rspErr(1, "config error");
return;
}
@ -277,7 +282,7 @@ class ShopController extends BaseAuthedController {
);
InAppRecord::addAmount($price);
$this->_rspData(array(
'order_id' => $order_id,
'order_id' => $orderId,
));
}

View File

@ -17,7 +17,7 @@ class InAppOrder extends BaseModel {
public static function find($orderId)
{
$row = SqlHelper::ormSelectOne(
myself()->_get(),
myself()->_getMysql(''),
't_inapp_order',
array(
'order_id' => $orderId,
@ -29,7 +29,7 @@ class InAppOrder extends BaseModel {
public static function add($orderId, $platform, $goodsId, $price)
{
SqlHelper::insert(
myself()->_get(),
myself()->_getMysql(''),
't_inapp_order',
array(
'order_id' => $orderId,

View File

@ -4,6 +4,7 @@
namespace models;
use phpcommon;
use phpcommon\SqlHelper;
class OrderId {
@ -20,7 +21,7 @@ class OrderId {
)
);
$lastIdx = SqlHelper::getLastInsertId(myself()->_getSelfMysql());
$orderId = strftime('%Y%m%d%H%M%S', myself()->_getNowTime()) . pad($lastIdx % 100000, 5);
$orderId = strftime('%Y%m%d%H%M%S', myself()->_getNowTime()) . phpcommon\pad($lastIdx % 100000, 5);
return $orderId;
}

View File

@ -43,7 +43,9 @@ class Shop {
const WEEKLY_BUY_LIMIT = 2;
const TOTAL_BUY_LIMIT = 3;
const INAPP_SHOP = 9;
const INAPP_SHOP_CEG = 7;
const INAPP_SHOP_DIAMOND = 9;
const OUTSIDE_SHOP = 100;
public static function get($id)