Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdf46a01ec | |||
| a34d344110 | |||
| a60851f892 |
@@ -5,7 +5,7 @@
|
||||
"homepage": "http://git.yuzhankeji.cn/xuanchen/WoUnicom.git",
|
||||
"authors": [
|
||||
{
|
||||
"name": "玄尘",
|
||||
"name": "xuanchen",
|
||||
"email": "122383162@qq.com"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -11,11 +11,11 @@ return [
|
||||
'uri' => [
|
||||
'unicom' => [
|
||||
//下单
|
||||
'order' => 'https://www.unicompayment.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8',
|
||||
'order' => 'https://epay.10010.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8',
|
||||
//查询
|
||||
'query' => 'https://www.unicompayment.com/CashierWeb/query/order.htm?reqCharSet=UTF-8',
|
||||
'query' => 'https://epay.10010.com/CashierWeb/query/order.htm?reqCharSet=UTF-8',
|
||||
//单笔退款
|
||||
'refund' => 'https://www.unicompayment.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8',
|
||||
'refund' => 'https://epay.10010.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8',
|
||||
],
|
||||
'ysd' => [
|
||||
'order' => env('APP_URL', 'https://card.ysd-bs.com'),
|
||||
|
||||
@@ -315,11 +315,15 @@ class Init
|
||||
|
||||
parse_str($content, $data);
|
||||
|
||||
$this->data = $data;
|
||||
|
||||
if ($data['transRet'] != 'SUCCESS') {
|
||||
$this->code = false;
|
||||
$this->message = $data['resultDis'];
|
||||
}
|
||||
|
||||
$this->code = true;
|
||||
|
||||
} else {
|
||||
$this->code = false;
|
||||
$this->message = '接口错误 Post';
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
namespace XuanChen\WoUnicom;
|
||||
|
||||
use App\Models\Payment;
|
||||
use App\Models\Welfare;
|
||||
use App\Models\WelfareOrder;
|
||||
use App\Models\WelfarePayment;
|
||||
use Carbon\Carbon;
|
||||
use XuanChen\WoUnicom\Action\Init;
|
||||
use XuanChen\WoUnicom\Action\Order;
|
||||
@@ -78,8 +81,9 @@ class WoUnicom
|
||||
*/
|
||||
public function callback($inputs)
|
||||
{
|
||||
info('weounicom inputs');
|
||||
info($inputs);
|
||||
if (empty($inputs)) {
|
||||
return '缺少必要参数';
|
||||
}
|
||||
|
||||
$params = str_replace('$', '&', $inputs);
|
||||
parse_str($params, $data);
|
||||
@@ -93,19 +97,35 @@ class WoUnicom
|
||||
//验签成功
|
||||
if ($res === true) {
|
||||
|
||||
$order = \App\Models\Order::where('orderid', $data['orderid'])->first();
|
||||
if ($order && $order->state == 'UNPAY') {
|
||||
$payment = \App\Models\Payment::where('orderable_type', get_class($order))
|
||||
->where('orderable_id', $order->id)
|
||||
->latest()
|
||||
->first();
|
||||
//福利订单
|
||||
if (str_contains($data['orderid'], 'WEAL')) {
|
||||
$order = WelfareOrder::where('orderid', $data['orderid'])->first();
|
||||
if ($order && $order->status == 'UNPAY') {
|
||||
$payment = $order->payment;
|
||||
|
||||
$payment->paid([
|
||||
'type' => 'UNICOM',
|
||||
'payfloodid' => $data['payfloodid'],
|
||||
]);
|
||||
$order->paid();
|
||||
}
|
||||
|
||||
} else {
|
||||
$order = \App\Models\Order::where('orderid', $data['orderid'])->first();
|
||||
if ($order && $order->state == 'UNPAY') {
|
||||
$payment = \App\Models\Payment::where('orderable_type', get_class($order))
|
||||
->where('orderable_id', $order->id)
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
$payment->state = 'SUCCESS';
|
||||
$payment->out_trade_no = $data['payfloodid'];
|
||||
$payment->type = 'UNICOM';
|
||||
$payment->paid_at = Carbon::now();
|
||||
$payment->save();
|
||||
$order->paid();
|
||||
}
|
||||
|
||||
$payment->state = 'SUCCESS';
|
||||
$payment->out_trade_no = $data['payfloodid'];
|
||||
$payment->type = 'UNICOM';
|
||||
$payment->paid_at = Carbon::now();
|
||||
$payment->save();
|
||||
$order->paid();
|
||||
}
|
||||
|
||||
return 'SUCCESS';
|
||||
|
||||
Reference in New Issue
Block a user