1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace web\pc\controller\v8;
- use think\Session;
- use web\common\controller\WebBaseController;
- use web\pc\logic\PayLogic;
- class PayController extends WebBaseController {
- private function setorderid($mem_id) {
- list($usec, $sec) = explode(" ", microtime());
-
- $orderid = $sec.substr($usec, 2, 3).rand(10, 99).sprintf("%04d", $mem_id % 10000);
- return $orderid;
- }
-
- public function doPay() {
- $_class = new PayLogic();
- $type = request()->param('type','alipay');
- $ptb_cnt = request()->param('amount');
- $username = request()->param('username');
- if(empty($type) || empty($ptb_cnt) || empty($username)) {
- $this->error('参数错误');
- }
- switch ($type) {
- case 'alipay' :
- $_res = $_class->_alipayweb();
- if (isset($_res['error']) && $_res['error'] > 0) {
- $this->error($_res['msg']);
- }
- break;
- case 'spay' :
- $_res = $_class->_spayweb();
- if (isset($_res['status']) && $_res['status'] == 1) {
- $this->assign($_res['data']);
- return $this->fetch('Pay/spay');
- } else {
- $this->error('支付失败');
- }
- break;
- default :
- return array('error' => 2, 'msg' => '请选择正确的支付方式');
- }
- }
-
- public function ptb_alipay_notify() {
- $_class = new PayLogic();
- $_class->alipay_notify();
- }
-
- public function ptb_spay_notify() {
- $_class = new PayLogic();
- $_class->spay_notify();
- }
-
- public function spay_status(){
- $_order_id = $this->request->param('order_id');
- $_class = new PayLogic();
- return $_class->spayStatus($_order_id);
- }
- }
|