产品订单自动收货调整,供应商余额结算调整

This commit is contained in:
2025-01-11 15:04:27 +08:00
parent 49f69494d6
commit 1ac9445af6
4 changed files with 25 additions and 13 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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();

View File

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