| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace addons\Alitopay\api\controllers;
- use addons\Alitopay\common\models\Order;
- use addons\Alitopay\common\services\ApplyService;
- use addons\Alitopay\common\services\OrderService;
- use yii\helpers\Json;
- use yii\web\Controller;
- use Yii;
- class NotifyController extends Controller
- {
- public function __construct ($id, $module, $config = [])
- {
- parent::__construct($id, $module, $config);
- }
- public $enableCsrfValidation = false;
- /**
- * 审核异步通知
- * @desc
- * @return bool
- */
- public function actionApply(){
- $data = Yii::$app->request->post();
- $form = new ApplyService();
- $data['msg_type'] = 1;
- $result = $form->ApplyAuthNotify($data);
- if($result){
- return 'ok';
- }else{
- echo "request_data:".$form->error;
- return false;
- }
- }
- public function actionAuth(){
- $data = Yii::$app->request->post();
- $form = new ApplyService();
- $data['msg_type'] = 2;
- $result = $form->ApplyAuthNotify($data);
- if($result){
- return 'ok';
- }else{
- echo "request_data:".$form->error;
- return false;
- }
- }
- /**
- * 支付异步回调
- * @PostMapping("actionPay")
- * @Middlewares({
- * @Middleware()
- * })
- */
- public function actionPay(){
- $order_list = $this->request->post("order_list");
- if(empty($order_list)){
- return "success";
- }
- $order_list = Json::decode($order_list);
- $service = new OrderService();
- $service->orderNotifyHandle($order_list);
- return "success";
- }
- }
|