Pay.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * 官网的公共控制器类
  4. *
  5. */
  6. namespace app\home\controller;
  7. use app\common\library\AirwallexPay;
  8. use think\Controller;
  9. class Pay extends Controller
  10. {
  11. public function airwallex()
  12. {
  13. $pay = new AirwallexPay();
  14. $pay->getToken();
  15. // $money = input('money', 0, 'intval');
  16. $orderid = input('orderid', '');
  17. $goods = input('goods', '');
  18. $urltype = input('urltype',1);
  19. $money = cache('memberCoin:real_amount:'.$orderid);
  20. if($urltype == 1){
  21. $return_url = 'https://www.46yx.com/coin_airwallex/recharge.html';
  22. }elseif($urltype == 3){
  23. $return_url = "https://" . HTTP_HOST_URL . "/v1.pay_return/pay_success_airwallex.html";
  24. }
  25. if($money<0){
  26. echo 'money err'; exit();
  27. }
  28. if(!$orderid){
  29. echo 'orderid err'; exit();
  30. }
  31. $result = $pay->createOrder($money, $orderid,$return_url);
  32. $result['goods'] = $goods;
  33. $this->assign('result', $result);
  34. return $this->fetch();
  35. }
  36. }