This commit is contained in:
azw 2023-07-30 15:57:25 +08:00
parent 153c9262fe
commit bb84a010ef
2 changed files with 23 additions and 34 deletions

View File

@ -37,4 +37,18 @@ class OutAppOrder extends BaseModel {
);
}
public static function markFailed($orderId)
{
SqlHelper::update(
myself()->_get(),
't_outapp_order',
array(
'order_id' => $orderId,
),
array(
'state' => self::FAILED_STATE,
)
);
}
}

View File

@ -21,12 +21,7 @@ use models\OutAppOrder;
use services\LogService;
class OutAppPurchase {
public function process()
{
error_log("OutAppPurchase --- " . json_encode($_REQUEST));
/*
// let repdata = {
// account_id: string
// order_id: string
@ -43,6 +38,14 @@ class OutAppPurchase {
// TRANSFER_FAIL = 98, // 转账错误
// FAIL = 99, // 也是错误
//
*/
class OutAppPurchase {
public function process()
{
error_log("OutAppPurchase --- " . json_encode($_REQUEST));
if (!$this->verifySign()) {
error_log("verifySign error --- " . json_encode($_REQUEST));
myself()->_rspErr(1, 'verifySign error');
@ -74,14 +77,6 @@ class OutAppPurchase {
myself()->_rspErr(0, 'order is finished');
return;
}
$conn = myself()->_getMysql('');
$id = $order['id'];
$goods_num = $order['goods_num'];
$o_status = $order['status'];
$address = $order['address'];
$buyStatus = 0; // 1: 成功, 2: 失败
switch ($status) {
case "9":
@ -99,8 +94,6 @@ class OutAppPurchase {
break;
}
SqlHelper::update($conn, 't_shop_buy_order', array('order_id' => $order_id), array('status' => $buyStatus));
if ($buyStatus == 2) {
$this->_rspErr(2, "buyStatus error, buyStatus: {$buyStatus}");
return;
@ -139,24 +132,6 @@ class OutAppPurchase {
$this->_rspOk();
}
private function _addGoods($address, $goods)
{
$itemService = new ShopAddItemService();
$item_id = $goods['goods_id'];
$goods_num = $goods['goods_num'];
$id = null;
if ($goods['id']) {
$id = $goods['id'];
}
error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id);
$itemService->addItem($address, $item_id, $goods_num);
if ($id) {
ShopBuyRecord::addWithAddress($address, $id, $goods_num);
}
}
private function beginFirstTupop($address)
{
$conn = myself()->_getMysql('');