AliPay.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/6/2
  7. *
  8. *
  9. */
  10. namespace app\controller\api;
  11. use app\common\model\store\order\StoreGroupOrder;
  12. use app\controller\api\merchant\sxy\Access;
  13. use crmeb\services\QrcodeService;
  14. use crmeb\services\WechatService;
  15. class AliPay
  16. {
  17. public function getPayInfo()
  18. {
  19. $groupOrderId = request()->param('groupOrderId');
  20. $groupOrder = StoreGroupOrder::where('group_order_id', $groupOrderId)->find()->toArray();
  21. if (!$groupOrder) {
  22. return app('json')->fail('订单不存在');
  23. }
  24. if ($groupOrder['paid'] == 1) {
  25. return app('json')->fail('订单已支付');
  26. }
  27. $access = new Access();
  28. $res = $access->pay_huifu('ALI','',$groupOrder,'支付宝支付',env('APP_URL')."/api/hf_notify/pay");
  29. // 更新store_group_order表hf_pay_id,pay_type
  30. StoreGroupOrder::update(['hf_pay_id' => $res['id'], 'pay_type' => 4], ['group_order_id' => $groupOrderId]);
  31. // 更新store_order表pay_type
  32. StoreGroupOrder::update(['pay_type' => 4], ['group_order_id' => $groupOrderId]);
  33. return app('json')->success($res);
  34. }
  35. }