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