Files
hyperf_service/app/Service/ServiceTrait/Api/PayFinishTrait.php
2025-02-21 19:10:58 +08:00

31 lines
894 B
PHP

<?php
namespace App\Service\ServiceTrait\Api;
use App\Constants\Common\PayCode;
use App\Exception\ErrException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
trait PayFinishTrait
{
/**
* 操作微信订单
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function manageWxOrder(): void
{
$this->payInfo->status = PayCode::FINISH_PAY;
$this->payInfo->wx_transaction_id = $this->callbackData['transaction_id'];
$this->payInfo->notify_json = json_encode($this->callbackData);
if (!$this->orderInfo->save()) {
$this->log->debug(__CLASS__.':Function:manageWxOrder:更新充值订单的状态失败:'.$this->payInfo->id);
throw new ErrException('更新充值订单的状态失败');
}
}
}