diff --git a/app/ServicePay/TransCard/BaseCard.php b/app/ServicePay/TransCard/BaseCard.php index b2ddabb..6a245a8 100644 --- a/app/ServicePay/TransCard/BaseCard.php +++ b/app/ServicePay/TransCard/BaseCard.php @@ -5,9 +5,20 @@ namespace App\ServicePay\TransCard; abstract class BaseCard { protected $msg=null; + protected $orderInfo = []; abstract public function message($msg); - abstract public function showInfo(); + public function showInfo(): array + { + $init = [ + 'from_card' => null, + 'pay_money' => null, + 'remark' => null, + 'order_number' => null, + ]; + + return array_merge($init, $this->orderInfo); + } abstract public function orderInfo($requestArr); } \ No newline at end of file diff --git a/app/ServicePay/TransCard/ExampleCard.php b/app/ServicePay/TransCard/ExampleCard.php index e9031b9..5cb8f63 100644 --- a/app/ServicePay/TransCard/ExampleCard.php +++ b/app/ServicePay/TransCard/ExampleCard.php @@ -6,7 +6,7 @@ use App\Models\Order; class ExampleCard extends BaseCard { - private $orderInfo = []; + public function message($msg) { @@ -26,17 +26,17 @@ class ExampleCard extends BaseCard } } - public function showInfo(): array - { - $init = [ - 'from_card' => null, - 'pay_money' => null, - 'remark' => null, - 'order_number' => null, - ]; - - return array_merge($init, $this->orderInfo); - } +// public function showInfo(): array +// { +// $init = [ +// 'from_card' => null, +// 'pay_money' => null, +// 'remark' => null, +// 'order_number' => null, +// ]; +// +// return array_merge($init, $this->orderInfo); +// } //获取订单信息 public function orderInfo($requestArr) @@ -47,9 +47,10 @@ class ExampleCard extends BaseCard $order_money = number_format($order_money, 2, ',', ''); //查找未支付的订单 $t = date('Y-m-d H:i:s'); - return Order::where('ewm_account', $ewm_account) - ->where('order_at', '<', $t) + return Order::where('order_at', '<', $t) ->where('order_money', $order_money) - ->whereIn('status', [0, 2])->first(); + ->where('ewm_account', $ewm_account) +// ->whereIn('status', [0, 2]) + ->orderBy('id', 'desc')->first(); } } \ No newline at end of file diff --git a/app/ServicePay/TransCard/FeilvbinCard.php b/app/ServicePay/TransCard/FeilvbinCard.php index 150e1b8..1b034c2 100644 --- a/app/ServicePay/TransCard/FeilvbinCard.php +++ b/app/ServicePay/TransCard/FeilvbinCard.php @@ -6,7 +6,6 @@ use App\Models\Order; class FeilvbinCard extends BaseCard { - private $orderInfo = []; public function message($msg) { $this->msg = $msg; @@ -22,17 +21,17 @@ class FeilvbinCard extends BaseCard } } - public function showInfo(): array - { - $init = [ - 'from_card' => null, - 'pay_money' => null, - 'remark' => null, - 'order_number' => null, - ]; - - return array_merge($init, $this->orderInfo); - } +// public function showInfo(): array +// { +// $init = [ +// 'from_card' => null, +// 'pay_money' => null, +// 'remark' => null, +// 'order_number' => null, +// ]; +// +// return array_merge($init, $this->orderInfo); +// } public function orderInfo($requestArr) { @@ -42,9 +41,10 @@ class FeilvbinCard extends BaseCard $order_money = number_format($order_money, 2, ',', ''); //查找未支付的订单 $t = date('Y-m-d H:i:s'); - return Order::where('order_money', $order_money) - ->where('order_at', '<', $t) - ->whereRaw('substr(ewm_account,-4,4)=?',[$ewm_account]) - ->whereIn('status', [0, 2])->first(); + return Order::where('order_at', '<', $t) + ->where('order_money', $order_money) + ->whereRaw('substr(ewm_account,-4,4)=?', [$ewm_account]) +// ->whereIn('status', [0, 2]) + ->orderBy('id', 'desc')->first(); } } \ No newline at end of file