From 1ac9445af6f730a7b14cf028e11652883d7f2271 Mon Sep 17 00:00:00 2001 From: liqi Date: Sat, 11 Jan 2025 15:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E8=AE=A2=E5=8D=95=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=94=B6=E8=B4=A7=E8=B0=83=E6=95=B4=EF=BC=8C=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E4=BD=99=E9=A2=9D=E7=BB=93=E7=AE=97=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/forms/LedgerForm.php | 4 ++-- common/forms/ProductRefundForm.php | 9 +++++++++ common/jobs/ProductOrderAutoReceivedJob.php | 14 ++++++++++++++ web/index.php | 11 ----------- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/common/forms/LedgerForm.php b/common/forms/LedgerForm.php index 4d42e8e..1fab060 100644 --- a/common/forms/LedgerForm.php +++ b/common/forms/LedgerForm.php @@ -657,8 +657,8 @@ class LedgerForm extends BaseModel //供应商冻结金额及累计金额更新 AccountBalanceModel::updateAllCounters([ - 'total' => bcmul($v['amount'], -1, 6), - 'frozen' => bcmul($v['amount'], -1, 6), +// 'total' => bcmul($v['amount'], -1, 6), + 'balance' => bcmul($v['amount'], -1, 6), ], [ 'user_id' => $v['user_id'], 'type' => 3 diff --git a/common/forms/ProductRefundForm.php b/common/forms/ProductRefundForm.php index 372c6c6..e8eedb1 100644 --- a/common/forms/ProductRefundForm.php +++ b/common/forms/ProductRefundForm.php @@ -11,6 +11,7 @@ use common\models\oldDb\ProductOrder; use common\models\oldDb\ProductOrderRefund; use common\services\EplPayService; use common\services\WechatService; +use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use yii\base\Exception; use function GuzzleHttp\Promise\all; @@ -87,6 +88,14 @@ class ProductRefundForm extends BaseModel return ['操作成功']; } + /** + * 退款操作 + * @param $productOrderRefund + * @return true + * @throws Exception + * @throws InvalidConfigException + * @throws \yii\db\Exception + */ public function refundMoney($productOrderRefund) { $orderNo = $productOrderRefund->order->order_no; diff --git a/common/jobs/ProductOrderAutoReceivedJob.php b/common/jobs/ProductOrderAutoReceivedJob.php index c357b51..86924d4 100644 --- a/common/jobs/ProductOrderAutoReceivedJob.php +++ b/common/jobs/ProductOrderAutoReceivedJob.php @@ -2,6 +2,7 @@ namespace common\jobs; use common\enums\ProductOrderEnum; +use common\models\newDb\AccountBalanceModel; use common\models\oldDb\ProductOrder; use common\models\oldDb\ProductOrderLog; use yii\queue\JobInterface; @@ -36,6 +37,19 @@ class ProductOrderAutoReceivedJob extends BaseJob implements JobInterface throw new \Exception('订单不存在'); } + if ($ProductOrder->order_type === 5) { + $client = new \GuzzleHttp\Client(); + $response = $client->post( 'https://api.xiaokang88.com/open-api/client-confirm', [ + 'json' => [ + 'order_id' => $this->orderId, + ] + ]); + $body = json_decode($response->getBody()->getContents(), true); + if ($body['code'] != 0) { + exit($body['message']); + } + } + $ProductOrder->status = ProductOrderEnum::CONFIRM; $ProductOrder->received_time = time(); $ProductOrder->save(); diff --git a/web/index.php b/web/index.php index c1a0726..b269876 100644 --- a/web/index.php +++ b/web/index.php @@ -23,17 +23,6 @@ if ($_GET['test']?? '' === 'liqi') { echo $result ? 'OPcache 已重置' : 'OPcache 重置失败';die; } -$client = new \GuzzleHttp\Client(); -$response = $client->post( 'https://api.xiaokang88.com/open-api/client-confirm', [ - 'json' => [ - 'order_id' => 332, - ] -]); -$body = json_decode($response->getBody()->getContents(), true); -if ($body['code'] != 0) { - exit($body['message']); -} -dd($body) //$params = [ // 'name' => '李四', // 'id_card' => '140311199811053052',