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',