123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?php
- namespace app\common\library;
- use think\Controller;
- use function EasyWeChat\Kernel\Support\get_client_ip;
- date_default_timezone_set('Asia/Shanghai');
- header('Content-type:text/html;charset=utf-8');
- require_once env('root_path').'application/common/library/shande/Common.php';
- require_once env('root_path').'application/common/library/shande/H5FastPay.php';
- class Shande extends Controller
- {
-
-
- public static function orderPay($order_no,$amout,$body,$notifyurl,$frontUrl)
- {
- $client = new \H5FastPay;
-
- $client->body = array(
- 'orderCode' => $order_no,
-
- 'totalAmount' => $amout,
- 'subject' => $body,
- 'body' => $body,
- 'payMode' => 'sand_h5',
- 'clientIp' => get_client_ip(),
-
- 'notifyUrl' => $notifyurl,
-
- 'frontUrl' => $frontUrl,
- );
-
- $ret = $client->request('orderPay');
- return $ret;
- }
-
- public function orderQuery()
- {
- $client = new \H5FastPay;
-
- $client->body = array(
- 'orderCode' => date('YmdHis', time()) + '0601',
- 'extend' => ''
- );
-
- $ret = $client->request('orderQuery');
- echo '<pre class="myCode">';
- print_r($ret);
- echo '</pre>';
- }
-
- public function orderRefund()
- {
- $client = new \H5FastPay;
-
- $client->body = array(
- 'orderCode' => 'Y20181204170925675836',
- 'oriOrderCode' => '2017091551421977',
- 'refundAmount' => '000000000012',
- 'refundMarketAmount' => '000000000012',
- 'notifyUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak/test/dist/notifyUrl.php',
- 'refundReason' => 'test',
- 'extend' => ''
- );
-
- $ret = $client->request('orderRefund');
- echo '<pre class="myCode">';
- print_r($ret);
- echo '</pre>';
- }
-
- public function notify()
- {
- $client = new H5FastPay;
- $sign = $_POST['sign'];
- $data = stripslashes($_POST['data']);
-
- try {
- $verifyFlag = $client->verify($data, $sign);
- if ($verifyFlag) {
- echo '签名正确';
- } else {
- echo '签名错误';
- }
- } catch (\Exception $e) {
- echo $e->getMessage();
- }
- }
-
- public function orderMcAutoNotice()
- {
- $client = new H5FastPay;
-
- $client->body = array(
- 'orderCode' => 'Y201805071725592',
- 'noticeType' => '00',
- );
-
- $ret = $client->request('orderMcAutoNotice');
- echo '<pre class="myCode">';
- print_r($ret);
- echo '</pre>';
- }
-
- public function clearfileDownload()
- {
- $client = new H5FastPay;
-
- $client->body = array(
- 'clearDate' => '20200611',
- 'fileType' => '1',
- 'extend' => ''
- );
-
- $ret = $client->request('clearfileDownload');
- echo '<pre class="myCode">';
- print_r($ret);
- echo '</pre>';
- }
- }
|