diff --git a/app/Services/Gateway/TomatoPay.php b/app/Services/Gateway/TomatoPay.php deleted file mode 100644 index 2496c8b7..00000000 --- a/app/Services/Gateway/TomatoPay.php +++ /dev/null @@ -1,181 +0,0 @@ -0, // 1 启用 0 关闭 - 'alipay'=>1, // 1 启用 0 关闭 - ]; - protected $data = [ - 'wxpay'=>[ //配置微信支付 - 'mchid' => 1555860947, // 商户号 - 'account' => '2487642542@qq.com', //登陆邮箱 - 'token' => "qGNbcGjW8MFhDupjxeJy7wqDUBoz7ZJg" // 安全验证码 - ], - 'alipay'=>[ //配置支付宝支付 - 'mchid' => 1555860935, // 商户号 - 'account' => '2487642542@qq.com', //登陆邮箱 - 'token' => "owVtOoA7n7e3MM7J4yJxiKMaQ8NEOJjr" // 安全验证码 - ], - ]; - - public function purchase($request, $response, $args) - { - $type = $request->getParam('type'); - $price = $request->getParam('price'); - if($this->enabled[$type]==0){ - return json_encode(['errcode'=>-1,'errmsg'=>"非法的支付方式."]); - } - if($price <= 0){ - return json_encode(['errcode'=>-1,'errmsg'=>"非法的金额."]); - } - $user = Auth::getUser(); - $settings = $this->data[$type]; - $pl = new Paylist(); - $pl->userid = $user->id; - $pl->total = $price; - $pl->tradeno = self::generateGuid(); - $pl->save(); - $fqaccount=$settings['account']; - $fqkey=$settings['token']; - $fqmchid = $settings['mchid']; - $fqtype = 1; - $fqtrade = $pl->tradeno; - $fqcny = $price; - $data = [ - 'account' => $settings['account'], - 'mchid' => $settings['mchid'], - 'type' => 1, - 'trade' => $pl->tradeno, - 'cny' => $price, - ]; - $signs = md5("mchid=".$fqmchid."&account=".$fqaccount."&cny=".$fqcny."&type=1&trade=".$fqtrade.$fqkey); - $url="https://b.fanqieui.com/gateways/".$type.".php?account=".$fqaccount."&mchid=".$fqmchid."&type=".$fqtype."&trade=".$fqtrade."&cny=".$fqcny."&signs=".$signs; - $result = ""; - $result = json_encode(array('code'=>$result,'errcode'=>0,'pid' =>$pl->id)); - return $result; - } - - public function notify($request, $response, $args) - { - $type = $args['type']; - $settings = $this->data[$type]; - $order_data = $_REQUEST; - $transid = $order_data['trade_no']; //转账交易号 - $invoiceid = $order_data['out_trade_no']; //订单号 - $amount = $order_data['total_fee']; //获取递过来的总价格 - $status = $order_data['trade_status']; //获取传递过来的交易状态 - $signs = $order_data['sign']; - - $security = array(); - $security['out_trade_no'] = $invoiceid; - $security['total_fee'] = $amount; - $security['trade_no'] = $transid; - $security['trade_status'] = $status; -foreach ($security as $k=>$v) -{ - $o.= "$k=".urlencode($v)."&"; -} -$sign = md5(substr($o,0,-1).$settings['token']); - - - if ($sign == $signs) { - $this->postPayment($order_data['out_trade_no'], "在线支付"); - echo 'success'; - if($ispost==0) header("Location: /user/code"); - - - }else{ - echo '验证失败'; - } - } - public function getPurchaseHTML() - { - return ' -
-

充值

-
支付方式:
- -
- - -
-
-
-
- -
-
- -'; - } - public function getReturnHTML($request, $response, $args) - { - - } - public function getStatus($request, $response, $args) - { - // TODO: Implement getStatus() method. - } -}