| xqd
@@ -12,23 +12,11 @@ use Alipay\EasySDK\Kernel\Config;
|
|
|
*/
|
|
|
class PayController extends Controller
|
|
|
{
|
|
|
- public function __construct()
|
|
|
- {
|
|
|
- $this->user = auth('api')->user();
|
|
|
- $this->userId = $this->user ? $this->user->id : 0;
|
|
|
-
|
|
|
- //如果用户被删除,会自动退出登录
|
|
|
- if (!empty($this->user->deleted_at)) {
|
|
|
- $this->user->online = 0;
|
|
|
- $this->user->save();
|
|
|
- auth('api')->logout();
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
public function getOptions(){
|
|
|
$options = new Config();
|
|
|
$options->protocol = 'https';
|
|
|
- $options->gatewayHost = 'https://openapi.alipay.com/gateway.do';
|
|
|
+ $options->gatewayHost = 'openapi.alipay.com';
|
|
|
$options->signType = 'RSA2';
|
|
|
|
|
|
$options->appId = '2016082201783461';
|
| xqd
@@ -42,7 +30,6 @@ class PayController extends Controller
|
|
|
* 构建支付
|
|
|
*/
|
|
|
public function payment(Request $request){
|
|
|
- Factory::setOptions($this->getOptions());
|
|
|
$order_id = $request->get('order_id');
|
|
|
$pay_type = $request->get('pay_type');
|
|
|
if(!$order_id || !$pay_type){
|
| xqd
@@ -52,6 +39,7 @@ class PayController extends Controller
|
|
|
if(!$order){
|
|
|
return $this->error("订单不存在!");
|
|
|
}
|
|
|
+ Factory::setOptions($this->getOptions());
|
|
|
$result = Factory::payment()->common()->create("加入企业会员",$order->order_no,0.01,1);
|
|
|
|
|
|
dd($result);
|