1
This commit is contained in:
parent
7fd712ef81
commit
ce13373ea2
@ -247,7 +247,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
if (!in_array($goodsMeta['shop_id'],
|
if (!in_array($goodsMeta['shop_id'],
|
||||||
array(
|
array(
|
||||||
mt\Shop::INAPP_SHOP_CEG
|
mt\Shop::INAPP_SHOP_DIAMOND
|
||||||
)
|
)
|
||||||
)) {
|
)) {
|
||||||
$this->_rspErr(3, "inapp purchase failed");
|
$this->_rspErr(3, "inapp purchase failed");
|
||||||
|
@ -43,7 +43,7 @@ class InAppOrder extends BaseModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function update($order, $fieldsKv)
|
public static function update($orderId, $fieldsKv)
|
||||||
{
|
{
|
||||||
SqlHelper::update(
|
SqlHelper::update(
|
||||||
myself()->_getMysql(''),
|
myself()->_getMysql(''),
|
||||||
|
@ -14,6 +14,7 @@ require_once("ShopAddItemService.php");
|
|||||||
|
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
|
use mt;
|
||||||
use mt\ShopGoods;
|
use mt\ShopGoods;
|
||||||
use mt\Item;
|
use mt\Item;
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ class InAppPurchase {
|
|||||||
$data = json_decode(file_get_contents('php://input'), true);
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
if (!$this->verifySign($data)) {
|
if (!$this->verifySign($data)) {
|
||||||
$this->_rspErr(1, "signature error");
|
myself()->_rspErr(1, "signature error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,17 +58,17 @@ class InAppPurchase {
|
|||||||
// 1. 从商城购买钻石,有订单号
|
// 1. 从商城购买钻石,有订单号
|
||||||
// 2. 站外充值钻石,没有订单号
|
// 2. 站外充值钻石,没有订单号
|
||||||
// 3. appstore 退款,没有订单号
|
// 3. appstore 退款,没有订单号
|
||||||
|
|
||||||
$records = $data['records'];
|
$records = $data['records'];
|
||||||
for ($i = 0; $i < count($records); $i++) {
|
for ($i = 0; $i < count($records); $i++) {
|
||||||
$this->processOneOrder($records[i]);
|
$this->processOneOrder($records[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_rspOk();
|
myself()->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function verifySign($data)
|
private function verifySign($data)
|
||||||
{
|
{
|
||||||
|
return true;
|
||||||
$channel = $data['channel'];
|
$channel = $data['channel'];
|
||||||
$records = $data['records'];
|
$records = $data['records'];
|
||||||
$sign = $data['sign'];
|
$sign = $data['sign'];
|
||||||
@ -82,7 +83,7 @@ class InAppPurchase {
|
|||||||
$signStr = 'channel=' . $channel . '&' . implode("&", $strings);
|
$signStr = 'channel=' . $channel . '&' . implode("&", $strings);
|
||||||
error_log('InAppPurchase verify ' . $signStr);
|
error_log('InAppPurchase verify ' . $signStr);
|
||||||
|
|
||||||
$signature = hash_hmac('sha256', $singStr, BUY_SERVER_PKEY);
|
$signature = hash_hmac('sha256', $sign, BUY_SERVER_PKEY);
|
||||||
return $sign == $signature;
|
return $sign == $signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ class InAppPurchase {
|
|||||||
|
|
||||||
$orderDb = InAppOrder::find($orderId);
|
$orderDb = InAppOrder::find($orderId);
|
||||||
if (!$orderDb) {
|
if (!$orderDb) {
|
||||||
error_log('InAppPurchase: not found order ' . json_encode($_REQUEST));
|
error_log('InAppPurchase: not found order ' . $orderId . ' ' . json_encode($_REQUEST));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($orderDb['status'] == InAppOrder::FINISHED_STATE) {
|
if ($orderDb['status'] == InAppOrder::FINISHED_STATE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user