<?php

namespace app\mobile\controller;

use app\BaseController;
use app\mobile\logic\PayLogic;
use think\exception\ValidateException;
use think\facade\Validate;

//支付相关
class Pay extends BaseController
{

    //微信支付成功后的异步通知及订单处理
    public function Notify()
    {
        return PayLogic::Notify();
    }

    //检查支付结果
    public function checkPayResult()
    {

        $param = $this->request->only(['pay_code'], 'post');

        $val = Validate::rule(['pay_code|支付编码' => 'require|length:18']);

        if (!$val->check($param)) throw new ValidateException($val->getError());

        return PayLogic::checkPayResult($param['pay_code']);

    }


}