90 lines
2.0 KiB
PHP
90 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Service\Common\Pay\Wx;
|
|
|
|
use App\Constants\Common\OrderCode;
|
|
use App\Model\Order;
|
|
use App\Service\ServiceTrait\Api\CheckOrderCallBackTrait;
|
|
use App\Service\ServiceTrait\Api\GoodOrderTrait;
|
|
use App\Service\ServiceTrait\Api\OrderTrait;
|
|
use App\Service\ServiceTrait\Api\PayFinishTrait;
|
|
use Hyperf\DbConnection\Db;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Yansongda\Artful\Exception\InvalidParamsException;
|
|
use function Hyperf\Config\config;
|
|
|
|
class WxJsRechargeOrderService extends WxJsRechargeBaseService
|
|
{
|
|
use CheckOrderCallBackTrait,
|
|
GoodOrderTrait,
|
|
PayFinishTrait;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
const int OrderType = OrderCode::ORDER_TYPE_GOOD;
|
|
|
|
/**
|
|
* 订单 id
|
|
* @var int
|
|
*/
|
|
protected int $orderId;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected string $orderNo;
|
|
|
|
/**
|
|
* @var mixed
|
|
*/
|
|
protected mixed $orderInfo;
|
|
|
|
/**
|
|
* @var mixed
|
|
*/
|
|
protected mixed $payInfo;
|
|
|
|
/**
|
|
* @return ResponseInterface
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
* @throws InvalidParamsException
|
|
*/
|
|
public function callBackHandle()
|
|
{
|
|
$this-> getWechatData();
|
|
|
|
$this->checkWxCallBackOrder();
|
|
|
|
$this->checkOrder();
|
|
|
|
Db::transaction(function (){
|
|
$this->manageOrder();
|
|
|
|
$this->manageWxOrder();
|
|
});
|
|
|
|
//todo 发送订阅通知
|
|
// $this->sendGainCoinMsg();
|
|
|
|
//发送mq通知报表结算
|
|
// $this->sendShareExMq($this->orderInfo->mid,ShareExCode::RECHARGE_COIN, [
|
|
// 'order_id' => $this->orderInfo->id,
|
|
// 'count' => $this->rechargeCoin,
|
|
// ]);
|
|
|
|
return $this->returnSuccess();
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function setNotify(): void
|
|
{
|
|
//返回的回调地址
|
|
$this->config['wechat']['default']['notify_url'] = config('system.api_url').'/common/wxPay/order/js/callBack';
|
|
}
|
|
} |