jh-admin/addon/saas/event/RechargeOrderPay.php

52 lines
2.1 KiB
PHP

<?php
/**
* SAAS应用系统 --- 十年开发经验汇集巨献!
* ==========================================================
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
* ----------------------------------------------------------
* 官方网址: https://www.zoomtk.com
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
* ==========================================================
*/
namespace addon\saas\event;
use think\facade\Cache;
use think\facade\Db;
class RechargeOrderPay
{
/***
* 代理充值
* @param $param
* @throws \think\db\exception\DbException
*/
public function handle($param)
{
$payInfo=$param['payInfo']??'';
if($payInfo &&$payInfo['event']=='SaasRechargeOrderPayNotify'){
$pay_detail=explode('_',$payInfo['pay_detail']);
$site_id=$pay_detail[0];
$member_id=$pay_detail[1];
$condition=[
'site_id'=>$site_id
];
$order_status=Db::name('cloud_order')->where(['third_order_id'=>$payInfo['out_trade_no']])->value('order_status');
if(!$order_status){
model('website')->setInc($condition,'agent_money',$payInfo['pay_money']);
Db::name('cloud_order')->where(['third_order_id'=>$payInfo['out_trade_no']])->update(['order_status'=>1,'pay_status'=>1]);
$log = array (
"uid" => $member_id,
"username" =>$site_id,
"site_id" => $site_id,
"url" => '',
"ip" => '',
"data" =>'',
"action_name" =>'SAAS充值'.$payInfo['pay_money'].'元',
"create_time" => time(),
);
model("user_log")->add($log);
Cache::tag("website")->clear();
}
}
}
}