Showing
3 changed files
with
10 additions
and
1 deletions
| ... | @@ -43,12 +43,15 @@ class PayController extends Controller | ... | @@ -43,12 +43,15 @@ class PayController extends Controller |
| 43 | $order_sn = $request->post('order_sn'); | 43 | $order_sn = $request->post('order_sn'); |
| 44 | $pay_type = $request->post('pay_type'); | 44 | $pay_type = $request->post('pay_type'); |
| 45 | $token = $request->post('token'); | 45 | $token = $request->post('token'); |
| 46 | + $others = $request->post('others',[]); | ||
| 47 | + $transactionId = $others['apple']['transactionIdentifier']; | ||
| 48 | + $originalTransactionId = $others['apple']['originalTransactionIdentifier']; | ||
| 46 | 49 | ||
| 47 | $order = Order::query()->where('order_sn', $order_sn)->first(); | 50 | $order = Order::query()->where('order_sn', $order_sn)->first(); |
| 48 | 51 | ||
| 49 | if ($order->status != Order::UNPAID) return Response::fail('订单错误!'); | 52 | if ($order->status != Order::UNPAID) return Response::fail('订单错误!'); |
| 50 | 53 | ||
| 51 | - $payment = $factory->init($pay_type)->verify($order, $token); | 54 | + $payment = $factory->init($pay_type)->verify($order, $token, $transactionId, $originalTransactionId); |
| 52 | 55 | ||
| 53 | if ($payment) return Response::success(['order_sn' => $order_sn], '支付成功'); | 56 | if ($payment) return Response::success(['order_sn' => $order_sn], '支付成功'); |
| 54 | else return Response::fail('订单错误!'); | 57 | else return Response::fail('订单错误!'); | ... | ... |
| ... | @@ -14,6 +14,12 @@ class UserProfile extends Model | ... | @@ -14,6 +14,12 @@ class UserProfile extends Model |
| 14 | 14 | ||
| 15 | protected $fillable = ['user_id','unionid']; | 15 | protected $fillable = ['user_id','unionid']; |
| 16 | 16 | ||
| 17 | + const IS_VIP = 1; | ||
| 18 | + | ||
| 19 | + const NO_VIP = 0; | ||
| 20 | + | ||
| 21 | + const WAIT_VIP = 2; // 已付款,等待处理(回调不及时,需要等待) | ||
| 22 | + | ||
| 17 | public function user() | 23 | public function user() |
| 18 | { | 24 | { |
| 19 | return $this->belongsTo('App\Models\User', 'id', 'user_id'); | 25 | return $this->belongsTo('App\Models\User', 'id', 'user_id'); | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment