| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace addons\YunfastPay\api\modules\v1\controllers;
- use addons\YunfastPay\common\services\NotifyService;
- use addons\YunfastPay\common\services\YunPayService;
- use Yii;
- use yii\helpers\Json;
- use yii\web\Controller;
- use function addons\YunfastPay\common\encrypt;
- /**
- * 支付回调控制器
- * Class NotifyController
- * @package addons\YunfastPay\api\modules\v1\controllers
- */
- class NotifyController extends Controller
- {
- public $enableCsrfValidation = false;
- /**
- * 首页
- *
- * @return void
- */
- public function actionIndex()
- {
- $msg = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input");
- $mall_id = $this->request->get('mall_id');
- $type = $this->request->get('type');
- if (empty($msg)) {
- # 如果没有数据,直接返回失败
- echo "数据有误";exit;
- }
- if (empty($mall_id)) {
- Yii::error('银典支付缺少mall-id');
- die;
- }
- $service = new NotifyService(['mall_id' => $mall_id]);
- $service->check($msg, $type);
- echo "{\"respCode\" : \"0000\", \"respMsg\" : \"成功\"}";
- }
- }
|