application/admin/controller/Pay.php

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
 * 易想会员管理营销系统
 * =========================================================
 * 天津市华易动力信息科技有限公司 , 保留所有权利。
 * ----------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
 * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
 * =========================================================
 * @author : hy_team
 * @date : 2019-08-10
 */
namespace app\admin\controller;

use think\Controller;
use app\common\service\Weixin;
use app\common\service\WeixinPay;
use app\common\service\Member;
use app\common\model\PayLog as PayLogModel;
use app\common\model\oncecardRechargePayLog;
use app\common\model\balanceRechargePayLog;
use think\facade\Log;
use app\common\service\Order as OrderService;
use app\common\service\Recharge as RechargeService;

class Pay extends Controller
{
    //初始化
    public function __construct()
    {
        parent::__construct();
        $this->WeixinPay = new WeixinPay();
    }
    
    // 微信异步回调
    public function wechatNotify()
    {
        $res = $this->WeixinPay->notify();
        
        if(isset($res['result_code']) && $res['result_code'] == 'SUCCESS' && isset($res['return_code']) && $res['return_code'] == 'SUCCESS'){
            //订单支付成功
            $orderno = $res['out_trade_no'];
            $openid = $res['openid'];
            $transaction_id = $res['transaction_id'];
            $pay_type = 1;

            if (strlen($orderno) == 20) {
                // 套餐订单
                $result = (new OrderService)->update_complete_order($orderno,$openid,$pay_type,$transaction_id);

                if($result !== true){
                    //记录错误日志
                    Log::record("微信支付订单完成错误 错误码:40014 错误信息:".$result,'WARN');
                }

            } else {
                // 流水
                if (substr($orderno,14,1) == 1) { 
                    // 次卡充值业务
                    $result = (new RechargeService)->oncecard_recharge($orderno,$openid,$pay_type,$transaction_id);
后面还有 153 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。