vr-shopxo-source/service/Application/Api/Controller/AlipayLifeController.class.php

81 lines
1.9 KiB
PHP
Raw Normal View History

2018-10-22 09:39:41 +00:00
<?php
namespace Api\Controller;
/**
* 支付宝生活号回调处理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-03-02T22:48:35+0800
*/
class AlipayLifeController extends CommonController
{
/**
* [_initialize 前置操作-继承公共前置方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-03-02T22:48:35+0800
*/
public function _initialize()
{
// 调用父类前置方法
parent::_initialize();
}
/**
* 购买确认
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-20
* @desc description
*/
public function Index()
{
2018-10-22 17:13:10 +00:00
// file_put_contents('./gggggg.txt', json_encode($_GET));
// file_put_contents('./pppppp.txt', json_encode($_POST));
// file_put_contents('./ffffff.txt', urldecode(file_get_contents("php://input")));
2018-10-22 09:57:51 +00:00
2018-10-22 09:48:01 +00:00
2018-10-22 09:39:41 +00:00
// 参数
2018-10-22 09:45:16 +00:00
$params = $_POST;
2018-10-22 17:13:10 +00:00
if(empty($params))
{
$input = file_get_contents("php://input");
if(!empty($input))
{
$params = iconv("GBK", "UTF-8", urldecode($input));
}
}
2018-10-22 17:16:26 +00:00
file_put_contents('./pppppp.txt', json_encode($params));
2018-10-22 09:39:41 +00:00
if(empty($params['service']))
{
die('service error');
}
// 类库
$o = new \Library\AlipayLife($params);
// 根据方法处理
switch($params['service'])
{
// 校验
case 'alipay.service.check' :
$o->Check();
break;
2018-10-22 17:13:10 +00:00
// 关注/取消
case 'alipay.mobile.public.message.notify' :
$o->Life();
break;
2018-10-22 09:39:41 +00:00
// 默认
default :
exit('service error');
}
}
}
?>