阶段更新

This commit is contained in:
2023-09-05 10:49:03 +08:00
parent 55e1cf6b7c
commit 3f58973c30
11 changed files with 92 additions and 23 deletions

View File

@@ -115,7 +115,6 @@ class Init
{
$sign = $this->getSign();
$this->params['signMsg'] = $sign;
return $this->params;
}
@@ -197,7 +196,7 @@ class Init
ksort($params);
$signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|')));
$signStr .= '|key='.$this->key;
return $signStr;
}
@@ -207,7 +206,7 @@ class Init
* @Author: 玄尘
* @Date : 2021/5/6 8:32
*/
public function getUnicomData($prefix = '$')
public function getUnicomData($prefix = '&')
{
$str = '';

View File

@@ -21,7 +21,7 @@ class Order extends Init
$this->addData();
$this->setSignData();
return $this->getUnicomData();
return $this->getUnicomData('$');
}
/**

View File

@@ -16,7 +16,7 @@ class Query extends Init
$this->setIsLower(false);
$this->addData();
$this->setSignData();
$url = config('wounicomweb.uri.unicom.query');
$url = config('wounicom.uri.unicom.query');
$this->sendPost($this->params, $url);
return $this->respond();
@@ -31,7 +31,7 @@ class Query extends Init
'orderNo' => $order->orderid,
'orderDate' => $order->created_at->format('Ymd'),
'charSet' => 'UTF-8',
'signType' => config('wounicomweb.signType'),
'signType' => config('wounicom.signType'),
];
$this->params = $data;

View File

@@ -18,7 +18,7 @@ class Refund extends Init
$this->reSetParams();
$this->setIsLower(false);
$this->setSignData();
$url = config('wounicomweb.uri.unicom.refund');
$url = config('wounicom.uri.unicom.refund');
$this->sendPost($this->params, $url);
return $this->respond();

View File

@@ -16,10 +16,11 @@ class ServiceProvider extends LaravelServiceProvider
{
if ($this->app->runningInConsole()) {
$this->publishes([__DIR__.'/../config/config.php' => config_path('wounicomweb.php')]);
$this->loadMigrationsFrom(__DIR__.'/../database/migrations/');
}
$this->app->bind('xuanchen.wounicomweb', function ($app) {
return new WoUnicom();
return new WoUnicomWeb();
});
}
@@ -30,7 +31,7 @@ class ServiceProvider extends LaravelServiceProvider
*/
public function boot()
{
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'wounicom');
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'wounicomweb');
}
}

View File

@@ -2,7 +2,7 @@
namespace XuanChen\WoUnicomWeb\Traits;
use XuanChen\WoUnicomWeb\Model\Wounicom as LogModel;
use XuanChen\WoUnicomWeb\Model\WounicomWeb as LogModel;
trait Log
{
@@ -11,6 +11,7 @@ trait Log
/**
* Notes: 输入日志
*
* @Author: 玄尘
* @Date : 2021/5/11 15:58
* @param $data
@@ -33,6 +34,7 @@ trait Log
/**
* Notes: 更新
*
* @Author: 玄尘
* @Date : 2021/7/23 11:03
* @param $data

View File

@@ -3,6 +3,7 @@
namespace XuanChen\WoUnicomWeb;
use App\Helpers\Helper;
use App\Models\ActivityMonthOrder;
use App\Models\ActivitySchoolOrder;
use App\Models\ActivityPetroOrder;
use App\Models\ActivityUnicomOrder;
@@ -95,6 +96,7 @@ class WoUnicomWeb
*/
public function callback($inputs)
{
info($inputs);
if (empty($inputs)) {
return '缺少必要参数';
}
@@ -126,7 +128,7 @@ class WoUnicomWeb
break;
case 'school':
$order = ActivitySchoolOrder::where('orderid', $data['orderid'])->first();
if ($order && $order->state == 'UNPAY') {
if ($order && $order->state == ActivitySchoolOrder::ORDER_UNPAY) {
$payment = Payment::where('orderable_type', get_class($order))
->where('orderable_id', $order->id)
->latest()
@@ -142,6 +144,22 @@ class WoUnicomWeb
break;
case 'petro':
$order = ActivityPetroOrder::where('orderid', $data['orderid'])->first();
if ($order && $order->state == ActivityMonthOrder::ORDER_UNPAY) {
$payment = Payment::where('orderable_type', get_class($order))
->where('orderable_id', $order->id)
->latest()
->first();
$payment->state = Payment::STATE_SUCCESS;
$payment->out_trade_no = $data['payfloodid'];
$payment->type = Payment::TYPT_UNICOM_WEB;
$payment->paid_at = Carbon::now();
$payment->save();
$order->paid();
}
break;
case 'unicom':
$order = ActivityUnicomOrder::where('orderid', $data['orderid'])->first();
if ($order && $order->state == 'UNPAY') {
$payment = Payment::where('orderable_type', get_class($order))
->where('orderable_id', $order->id)
@@ -156,8 +174,8 @@ class WoUnicomWeb
$order->paid();
}
break;
case 'unicom':
$order = ActivityUnicomOrder::where('orderid', $data['orderid'])->first();
case 'month':
$order = ActivityMonthOrder::where('orderid', $data['orderid'])->first();
if ($order && $order->state == 'UNPAY') {
$payment = Payment::where('orderable_type', get_class($order))
->where('orderable_id', $order->id)