1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Modules\Trade\Pay;
- use App\Modules\Subscribe\Models\Order;
- abstract class OrderArousePayAbstract
- {
- /**
- * 唤起支付
- */
- abstract public function arouse(array $data);
- protected $uid;
- public function __construct(int $uid)
- {
- $this->uid = $uid;
- }
- public function handle(array $data)
- {
- $this->createOrder($data);
- return $this->arouse($data);
- }
- public function createOrder(array $data)
- {
- $params = [
- 'uid' => $this->uid,
- 'product_id' => $data['product_id'],
- 'distribution_channel_id' => $data['distribution_channel_id'],
- 'trade_no' => $data['trade_no'],
- 'pay_merchant_id' => isset($data['pay_merchant_id']) ? $data['pay_merchant_id'] : 0,
- 'order_type' => $data['order_type'],
- 'create_ip' => $data['create_ip'],
- 'send_order_id' => $data['send_order_id'],
- 'from_type' => $data['from_type'],
- 'price' => $data['price'] / 100,
- 'status' => 'UNPAID',
- 'transaction_id' => '',
- 'pay_end_at' => '0000-00-00 00:00:00',
- 'pay_merchant_source' => '',
- 'send_order_name' => isset($data['send_order_name']) ? $data['send_order_name'] : '',
- 'pay_type' => isset($data['pay_type']) ? $data['pay_type'] : 1,
- 'from_bid' => isset($data['from_bid']) ? $data['from_bid'] : 0,
- 'activity_id' => isset($data['activity_id']) ? $data['activity_id'] : 0,
- 'inner_send_order_id' => isset($data['inner_send_order_id']) ? $data['inner_send_order_id'] : '',
- ];
- Order::firstOrCreate($params);
- }
- }
|