Commit 85d24c85 authored by wangzhengwen's avatar wangzhengwen

订单storeuser

parent 9c804c83
...@@ -143,6 +143,7 @@ class PayController ...@@ -143,6 +143,7 @@ class PayController
// 查询支付订单 // 查询支付订单
$payment = Db::name('payment') $payment = Db::name('payment')
->where('order_no', $orderNo) ->where('order_no', $orderNo)
->where('pay_status', 0)
->find(); ->find();
if (!$payment || $payment['pay_method'] != PayService::PAY_METHOD_WECHAT) { if (!$payment || $payment['pay_method'] != PayService::PAY_METHOD_WECHAT) {
......
...@@ -46,11 +46,20 @@ class PayService ...@@ -46,11 +46,20 @@ class PayService
{ {
try { try {
if (empty($orderId) || !in_array($orderType, [1, 2])) {
throw new \Exception('orderType不合法');
}
if($orderType == self::ORDER_TYPE_COURSE) { if($orderType == self::ORDER_TYPE_COURSE) {
$title = Db::name('course')->where('id', $orderId)->value('title'); $store = Db::name('course')->where('id', $orderId)->field('title,user_id,id')->find();
}else{ }else{
$title = Db::name('cert')->where('id', $orderId)->value('title'); $store = Db::name('cert')->where('id', $orderId)->field('title,user_id,id')->find();
} }
if (empty($store)) {
throw new \Exception('原商品不存在');
}
$orderNoType = match($orderType) { $orderNoType = match($orderType) {
1 => 'kc', 1 => 'kc',
2 => 'zs', 2 => 'zs',
...@@ -70,16 +79,18 @@ class PayService ...@@ -70,16 +79,18 @@ class PayService
'order_price' => $amount, 'order_price' => $amount,
'order_type' => $orderType, 'order_type' => $orderType,
'user_id' => $userId, 'user_id' => $userId,
'subject' => $title, 'subject' => $store['title'] ?? null,
'req_info' => json_encode($reqInfo, JSON_UNESCAPED_UNICODE), 'req_info' => json_encode($reqInfo, JSON_UNESCAPED_UNICODE),
'createtime' => time(), 'createtime' => time(),
'updatetime' => time(), 'updatetime' => time(),
'expire_time' => time() + self::ORDER_TIMEOUT // 2小时过期 'expire_time' => time() + self::ORDER_TIMEOUT, // 2小时过期
'store_user_id'=>$store['user_id'] ?? 0,
]; ];
//如果是免费证书 //如果是免费证书
if ($orderType == self::ORDER_TYPE_CERT and $amount <=0) { if ($orderType == self::ORDER_TYPE_CERT and $amount <=0) {
$paymentData['pay_status'] = self::PAY_STATUS_SUCCESS; $paymentData['pay_status'] = self::PAY_STATUS_SUCCESS;
$paymentData['pay_method'] = 3;
self::handleBusinessAfterPayment($paymentData); self::handleBusinessAfterPayment($paymentData);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment