= 5.5.0
* @method $this pid(int $value = null) 商户ID
* @method $this outTradeNo(string $value = null) 设置订单号
* @method $this notifyUrl(string $value = null) 设置异步回调地址
* @method $this returnUrl(string $value = null) 设置同步回调地址
* @method $this type(string $value = null) 支付类型
* @method $this name(string $value = '# {$out_trade_no} 在线支付') 设置订单名称
* @method $this money(float $value = null) 设置订单金额
* @method $this sitename(string $value = '在线支付') 设置网站名称
* @method $this signType(string $value = 'MD5') 设置加密类型
* @method $this sign(string $value = null) 签名值
*/
namespace addons\eepay;
use addons\eepay\Sdk;
use addons\third\model\Third;
use app\common\library\Auth;
use Exception;
use think\Session;
use Yansongda\Pay\Pay;
use Yansongda\Supports\Str;
/**
* 订单服务类
*
* @package addons\epay\library
*/
class Service
{
public static function pay($cs)
{
// print_r($cs);
// exit;
$sdk = new SDK();
$sdk->key('111');
// 发起订单
try {
echo $sdk->pid(1000)
->url('http://snrbew.cn/')
->outTradeNo($cs['orderid'])
->type($cs['type'])
->notifyUrl('http://cwmh.h5mhsc.top/addons/epay/api/notifyx212313')//'/addons/epay/api/notifyx/type/alipay',
->returnUrl('http://cwmh.h5mhsc.top/addons/epay/api/returnx2')// 'return_url' => '/addons/epay/api/returnx/type/alipay',
->money($cs['amount'])
// ->money(1)
->submit()
->getHtmlForm();
} catch (EpayException $e) {
echo $e->getMessage();
}
// 发起订单
// try {
// echo $sdk->pid(10067)
// ->url('http://xxx.xx')
// ->outTradeNo(time() . mt_rand(100, 999))
// ->type('alipay')
// ->notifyUrl('http://demo.com/notify_url.php')
// ->returnUrl('http://demo.com/return_url.php')
// ->money(0.01)
// ->submit()
// ->getHtmlForm();
// } catch (EpayException $e) {
// echo $e->getMessage();
// }
// 回调验证
// try {
// // 参数验证
// $data = $_GET;
// if (!(isset($data['out_trade_no']) && isset($data['sign']))) {
// throw new EpayException('error');
// }
// // 签名验证
// if (!$sdk->signVerify($data)) {
// throw new EpayException('error');
// }
//
// // 交易状态 ## 交易成功
// if ($data['trade_status'] == 'TRADE_SUCCESS') {
// echo 'TRADE_SUCCESS
';
// // ...... 相关业务代码
// }
//
// echo 'success';
// } catch (EpayException $e) {
// echo $e->getMessage();
// }
}
public static function payssss($cs)
{
// print_r($cs);
// exit;
$sdk = new SDK();
$sdk->key('11111');
// 发起订单
try {
echo $sdk->pid(1000)
->url('http://snrbew.cn/')
->outTradeNo($cs['orderid'])
->type($cs['type'])
// ->notifyUrl('http://mh.h5mhsc.cn/addons/epay/api/notifyx212313')//'/addons/epay/api/notifyx/type/alipay',
->notifyUrl('http://cwmh.h5mhsc.top/addons/epay/api/notifyx2')//'/addons/epay/api/notifyx/type/alipay',
->returnUrl('http://cwmh.h5mhsc.top/addons/epay/api/returnx2222222')// 'return_url' => '/addons/epay/api/returnx/type/alipay',
->money($cs['amount'])
// ->money(1)
->submit()
->getHtmlForm();
} catch (EpayException $e) {
echo $e->getMessage();
}
}
public static function payfh($cs)
{
// print_r($cs);
// exit;
$sdk = new SDK();
$sdk->key('11111');
// 发起订单
try {
echo $sdk->pid(1000)
->url('http://snrbew.cn/')
->outTradeNo($cs['orderid'])
->type($cs['type'])
->notifyUrl('http://cwmh.h5mhsc.top/addons/epay/api/notifyx22')//'/addons/epay/api/notifyx/type/alipay',
->returnUrl('http://cwmh.h5mhsc.top/addons/epay/api/returnx22')// 'return_url' => '/addons/epay/api/returnx/type/alipay',
->money($cs['amount'])
->submit()
->getHtmlForm();
} catch (EpayException $e) {
echo $e->getMessage();
}
// 发起订单
// try {
// echo $sdk->pid(10067)
// ->url('http://xxx.xx')
// ->outTradeNo(time() . mt_rand(100, 999))
// ->type('alipay')
// ->notifyUrl('http://demo.com/notify_url.php')
// ->returnUrl('http://demo.com/return_url.php')
// ->money(0.01)
// ->submit()
// ->getHtmlForm();
// } catch (EpayException $e) {
// echo $e->getMessage();
// }
// 回调验证
// try {
// // 参数验证
// $data = $_GET;
// if (!(isset($data['out_trade_no']) && isset($data['sign']))) {
// throw new EpayException('error');
// }
// // 签名验证
// if (!$sdk->signVerify($data)) {
// throw new EpayException('error');
// }
//
// // 交易状态 ## 交易成功
// if ($data['trade_status'] == 'TRADE_SUCCESS') {
// echo 'TRADE_SUCCESS
';
// // ...... 相关业务代码
// }
//
// echo 'success';
// } catch (EpayException $e) {
// echo $e->getMessage();
// }
}
}