PHP 支付宝支付、订阅支付(周期扣款)整理汇总
最近项目中需要使用支付宝的周期扣款,整理一下各种封装方法
APP支付(服务端)
/******************************************************* 调用方法******************************************************/function test_pay(){$isSubscribe = 1;$price = 0.01;$detail = $body = "会员充值";$orderSn = date("mdHis") . mt_rand(2000, 8000);$hostApi = config('host_api');if (!$isSubscribe) { // 一次性支付$bizSontent = ["timeout_express" => "30m","product_code" => "QUICK_MSECURITY_PAY","total_amount" => $price,"subject" => $detail,"body" => $body,"out_trade_no" => $orderSn,];} else { // 订阅// 参见下文sign_scene参数说明 https://opendocs.alipay.com/open/08bg92?pathHash=b655de17$bizSontent = ["out_trade_no" => $orderSn,"total_amount" => $price, //订单总金额,首次支付的金额,不算在周期扣总金额里。"subject" => $detail,"body" => $body,"product_code" => "CYCLE_PAY_AUTH", // CYCLE_PAY_AUTH"timeout_express" => "90m",//商家扣款协议信息"agreement_sign_params" => ["product_code" => "GENERAL_WITHHOLDING",//收单产品码固定为GENERAL_WITHHOLDING"personal_product_code" => "CYCLE_PAY_AUTH_P", //个人签约产品码固定为CYCLE_PAY_AUTH_P"sign_scene" => "INDUSTRY|DEFAULT_SCENE",//协议签约场景,参见下文sign_scene参数说明 数字传媒行业"external_agreement_no" => $orderSn,//商户签约号,代扣协议中用户的唯一签约号
// "sign_notify_url" => $hostApi . "/v1/notify/alipay_sub",//签约成功异步通知地址"access_params" => [ //签约接入的方式"channel" => "ALIPAYAPP"],// 签约规则"period_rule_params" => ["period_type" => "DAY",//周期类型枚举值为 DAY 和 MONTH"period" => 9999,//周期数,与 period_type 组合使用确定扣款周期 // 扣款周期类型period_type参数为DAY时,扣款周期period参数不得小于7。"execute_time" => date('Y-m-d'),//用户签约后,下一次使用代扣支付扣款的时间"single_amount" => $price,//单次扣款最大金额
// "total_amount" => "0.02",//周期内扣允许扣款的总金额,单位为元
// "total_payments" => "2"//总扣款次数。]],];}$notiyUrl = $hostApi . '/notify/alipay';list($result, $responseNode) = PayUtil::pay($bizSontent, $notiyUrl);dump($result);}
异步回调
// 支付宝异步通知function alipay(){$verify = PayUtil::notifyVerify($_POST);$orderSn = addslashes($_POST['out_trade_no'] ?? ''); //商户订单号$trade_no = addslashes($_POST['trade_no'] ?? ''); //支付宝交易号$trade_status = trim(addslashes($_POST['trade_status'] ?? ''));if (!empty($trade_status)) { // 支付回调LogHelperUtil::outLog('alipay_notify_' . $trade_status, json_encode(['post' => $_POST, 'verify' => $verify]), 'alipay_notify');if (empty($orderSn)) {return "fail";}Db::name('order_log_alipay')->insert(['order_sn' => $orderSn, 'trans_id' => $trade_no, 'create_time' => date('Y-m-d H:i:s'),'content' => json_encode($_POST)]);$orderInfo = OrderModel::get_info(['order_sn' => $orderSn, 'status' => 0, 'pay_type' => 1]);if (!empty($orderInfo) && $trade_status == 'TRADE_SUCCESS') {$this->paySuccess($orderInfo, $trade_no);return "success";}if ($trade_status == 'TRADE_CLOSED') { // 退款return "success";}return "fail";}/**************************************************************** 订阅回调* 重要参数说明* status:协议状态,枚举支持。 NORMAL:正常 UNSIGN:解约。* external_agreement_no:标示用户的唯一签约协议号,商家自定义。仅签约接口传入时返回* agreement_no:支付宝系统中用以唯一标识用户签约记录的编号。* notify_type:异步通知类型,枚举支持。 dut_user_sign:当 status = NORMAL 表示签约成功。 dut_user_unsign:当 status = UNSIGN 表示解约成功。* sign_scene:签约协议场景。* personal_product_code:协议产品码。* alipay_user_id:用户的支付宝账号对应的支付宝唯一用户号。**********************************************************************/$status = $_POST['status'] ?? ''; // 协议状态,枚举支持。 NORMAL:正常 UNSIGN:解约。$notifyType = $_POST['notify_type'] ?? ''; // 异步通知类型,枚举支持。 dut_user_sign:当 status = NORMAL 表示签约成功。 dut_user_unsign:当 status = UNSIGN 表示解约成功。$orderSn = $_POST['external_agreement_no'] ?? ''; // 自定义$agreementNo = $_POST['agreement_no'] ?? '';Db::name('order_log_alipay_sub')->insert(['order_sn' => $orderSn, 'trans_id' => $agreementNo, 'create_time' => date('Y-m-d H:i:s'),'content' => json_encode($_POST)]);LogHelperUtil::outLog('alipay_notify_sub_' . $status, json_encode(['post' => $_POST, 'verify' => $verify]), 'alipay_notify_sub');if (empty($agreementNo)) {return "fail";}$orderInfo = OrderSubscribeModel::get_info(['order_sn' => $orderSn, 'pay_type' => 1]);$oid = intval($orderInfo['id'] ?? 0); // 订单IDif ($status == 'UNSIGN' && $notifyType == 'dut_user_unsign') { // 解约$response = OrderSubscribeModel::update_data(['id' => $oid], ['status' => 2, // 0-签约中 1-已订阅 2-已退订'contract_del_date' => date('Y-m-d H:i:s'), // 解约时间]);return "success";}// 0-签约中 1-已订阅 2-已退订if (!empty($orderInfo) && $status == 'NORMAL' && $notifyType == 'dut_user_sign') { // 签约成功// 记录签约成功的订单$response = OrderSubscribeModel::update_data(['id' => $oid], ['status' => 1, // 0-签约中 1-已订阅 2-已退订'agreement_no' => $agreementNo, // 签约号'contract_date' => date('Y-m-d H:i:s'), // 签约时间]);if ($response) {$toDay = date('Y-m-d');$kontDay = date('Y-m-d', strtotime("+1 day"));$nextPay = $orderInfo['next_pay'] ?? '';if ($nextPay == $kontDay || $toDay == $nextPay) {$notiyUrl = config('host_api') . '/notify/alipay_sub_knot?order_sn=' . $orderSn;send_socket_time_task($notiyUrl, 300);LogHelperUtil::outLog('alipay_notify_sub_' . $status, "已加入队列" . $notiyUrl, 'alipay_notify_sub');}}return "success";}return "fail";}
周期扣款操作(定时任务)
// 支付宝订阅自动扣款function alipay_sub_knot(){$orderSnSub = trim(addslashes($_GET['order_sn'] ?? ''));if (empty($orderSnSub)) {return 'fail-sn';}// 0-签约中 1-已订阅 2-已退订$orderInfo = OrderSubscribeModel::get_info(['order_sn' => $orderSnSub, 'status' => 1]);if (empty($orderInfo)) {return 'fail-order';}$type = $orderInfo['type'] ?? 0; $uid = $orderInfo['uid'] ?? 0;$priceRenew = $orderInfo['price_renew'] ?? 0; // 续订价格$agreementNo = $orderInfo['agreement_no'] ?? ''; // 签约号if (empty($agreementNo)) {return 'fail-order';}LogHelperUtil::outLog('alipay_sub_knot', json_encode(['orderSnSub' => $orderSnSub, 'order' => $orderInfo]), 'alipay_sub_knot');$detail = '周期扣款';$orderSn = "DYK{$type}U" . $uid . date("mdHis") . mt_rand(2000, 8000);list($result) = PayUtil::pay_sub_knot($orderSn, $detail, $priceRenew, $agreementNo);$resultCode = $result['code'] ?? 0;if ($resultCode != 10000) {LogHelperUtil::outLog('alipay_sub_knot_fail', json_encode(['orderSnSub' => $orderSnSub, 'order' => $orderInfo, 'result' => $result]), 'alipay_sub_knot');return "fail-result";}// 扣款成功,写入订单逻辑return "success";}
其他一下方法
function alipay_test(){$agreementNo = '20235529965404462663';list($res,$code) = PayUtil::agreementQuery($agreementNo); // 签约查询dump($res);// 周期性扣款协议执行计划修改list($res,$code) = PayUtil::agreementModify($agreementNo,'2023-11-01','购买了半年包月');dump($res);// 解约list($res,$code) = PayUtil::agreementUnsign($agreementNo);dump($res);return '';}
PayUtil 封装方法文件
<?phpnamespace pay\alipay;class PayUtil
{/*** 发起支付* 支付后签约场景:https://opendocs.alipay.com/pre-open/08bpuc?pathHash=a572b7a7* @param $bizSontent* @param $notiyUrl* @return array|string[]* @author wzb* @date 2023/7/22 9:50*/static function pay($bizSontent = [], $notiyUrl = ''){$alipayConfig = config('alipay_config'); // 配置if (empty($bizSontent) || empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayTradeAppPayRequest();$request->setNotifyUrl($notiyUrl);$request->setBizContent(json_encode($bizSontent));$result = $aop->sdkExecute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";return [$result, $responseNode];}/*** 查询交易信息** @param $outTradeNo* @return string[]|void* @author wzb* @date 2023/7/22 10:03*/static function queryOrder($outTradeNo = ''){$bizSontent = ["out_trade_no" => $outTradeNo,
// "trade_no"=>"DJ4U2407211930124801",
// "query_options"=>[
// "trade_settle_info", // 交易结算信息
// ]];$alipayConfig = config('alipay_config'); // 配置if (empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayTradeQueryRequest();$request->setBizContent(json_encode($bizSontent));$result = $aop->execute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";$response = $result->$responseNode;$response = json_decode(json_encode($response), true);return [$response, $responseNode];}/*** @param string $orderSn 订单号* @param string $detail 说明* @param int $totalAmount 扣款金额* @param string $agreement_no 签约号* @return array|string[]* @author wzb* @date 2023/7/29 10:50*/static function pay_sub_knot($orderSn, $detail, $totalAmount, $agreement_no){$bizSontent = ["out_trade_no" => $orderSn, //订单号"total_amount" => $totalAmount,"subject" => $detail,"product_code" => "GENERAL_WITHHOLDING",// 代扣信息。'agreement_params' => ["agreement_no" => $agreement_no,],];$alipayConfig = config('alipay_config'); // 配置if (empty($bizSontent) || empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayTradePayRequest();$request->setBizContent(json_encode($bizSontent));$result = $aop->execute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";$response = $result->$responseNode;$response = json_decode(json_encode($response), true);return [$response, $responseNode];}/*** 退款* @param $outTradeNo* @param $tradeNo* @param $refundAmount* @return array* @author wzb* @date 2023/7/25 17:14*/static function refundOrder($outTradeNo = '', $tradeNo = '', $refundAmount = 0){$bizSontent = ["out_trade_no" => $outTradeNo,"trade_no" => $tradeNo,"refund_amount" => $refundAmount,];$alipayConfig = config('alipay_config'); // 配置if (empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayTradeRefundRequest();$request->setBizContent(json_encode($bizSontent));$result = $aop->execute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";$response = $result->$responseNode;$response = json_decode(json_encode($response), true);return [$response, $responseNode];}/*** 查询签约接口* https://opendocs.alipay.com/open/3dab71bc_alipay.user.agreement.query?scene=8837b4183390497f84bb53783b488ecc&pathHash=9a0c5949* @return array|string[]* @author wzb* @date 2023/7/29 13:35*/static function agreementQuery($agreementNo){$bizSontent = ["agreement_no" => $agreementNo,];$alipayConfig = config('alipay_config'); // 配置if (empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayUserAgreementQueryRequest();$request->setBizContent(json_encode($bizSontent));$result = $aop->execute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";$response = $result->$responseNode;$response = json_decode(json_encode($response), true);return [$response, $responseNode];}/*** 解约* https://opendocs.alipay.com/open/b841da1f_alipay.user.agreement.unsign?scene=90766afb41f74df6ae1676e89625ebac&pathHash=a3599432* @param string $agreementNo 签约号(协议号)* @param string $orderSn 订单号 代扣协议中标示用户的唯一签约号(确保在商户系统中唯一)。* @return array|string[]* @author wzb* @date 2023/7/29 13:49*/static function agreementUnsign($agreementNo, $orderSn){$bizSontent = ["agreement_no" => $agreementNo,"external_agreement_no" => $orderSn,];$alipayConfig = config('alipay_config'); // 配置if (empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayUserAgreementUnsignRequest();$request->setBizContent(json_encode($bizSontent));$result = $aop->execute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";$response = $result->$responseNode;$response = json_decode(json_encode($response), true);return [$response, $responseNode];}/*** 周期性扣款协议执行计划修改* https://opendocs.alipay.com/open/ed428330_alipay.user.agreement.executionplan.modify?pathHash=e019f106* @param string $agreementNo 签约号(协议号)* @param string $nextPay 商户下一次扣款时间 2023-01-01* @param string $memo 具体修改原因 64个字符* @return array|string[]* @author wzb* @date 2023/7/29 13:45*/static function agreementModify($agreementNo, $nextPay, $memo){$bizSontent = ["agreement_no" => $agreementNo,"deduct_time" => $nextPay,"memo" => $memo,];$alipayConfig = config('alipay_config'); // 配置if (empty($alipayConfig)) {return ['', ''];}$aop = new AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = $alipayConfig['appid'] ?? '';$aop->rsaPrivateKey = $alipayConfig['rsaPrivateKey'] ?? '';$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayUserAgreementExecutionplanModifyRequest();$request->setBizContent(json_encode($bizSontent));$result = $aop->execute($request);$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";$response = $result->$responseNode;$response = json_decode(json_encode($response), true);return [$response, $responseNode];}/*** 验证* @param $arr* @return bool|string[]|null* @author wzb* @date 2023/7/22 10:33*/static function notifyVerify($arr){$alipayConfig = config('alipay_config'); // 配置if (empty($alipayConfig)) {return false;}$aop = new AopClient();$aop->alipayrsaPublicKey = $alipayConfig['alipayrsaPublicKey'] ?? '';$urlString = urldecode(http_build_query($arr));$data = explode('&', $urlString);$params = [];foreach ($data as $param) {$item = explode('=', $param, "2");$params[$item[0]] = $item[1];}$result = $aop->rsaCheckV1($params, null, 'RSA2');return $result;}
}
PHP服务端SDK
相关文章:
PHP 支付宝支付、订阅支付(周期扣款)整理汇总
最近项目中需要使用支付宝的周期扣款,整理一下各种封装方法 APP支付(服务端) /******************************************************* 调用方法******************************************************/function test_pay(){$isSubscri…...
python-pytorch基础之神经网络回归
这里写目录标题 定义数据集定义函数生成数据集 使用Dataloader加载dataset定义神经网络定义实例化查看是否是输出的一个 训练编写trian方法训练并保存模型 测试模型结果构造数据测试结论 定义数据集 import torch import random定义函数 # 生成数据 def get_rancledata():wid…...
linux中通过.desktop文件执行bash命令打开chrome浏览器并传参
.desktop 文件介绍 Ecex 参数介绍 Code 描述 %f %f指向临时文件。用于不了解URL语法的程序。 %F 文件列表。用于可以一次打开多个本地文件的应用程序。每个文件作为单独的参数传递给可执行程序。 %u 单一的URL或者本地文件 %U %u的复数 %i 如果Icon 为空,不应该填写此参数。…...
ChatGPT的应用与发展趋势:解析人工智能的新风口
目录 优势 应用领域 发展趋势 总结 在人工智能技术迅猛发展的时代,自然语言处理系统的提升一直是研究者们追求的目标。作为人工智能领域的重要突破之一,ChatGPT以其出色的语言模型和交互能力,在智能对话领域取得了重要的进展。 ChatGPT是…...
使用maven打jar包时,如何只把依赖的其它jar中的类打进jar包,没有依赖的其它jar包的类文件不打进来?
简介 使用Maven打包时,默认情况下,所有依赖的jar包都会被打包到生成的jar文件中。 如果只想将依赖的其他jar中的类文件打进来,而不包含其它jar包,可以使用Maven的 maven-shade-plugin插件进行配置。 步骤 以下是一个示例配置&…...
arm neon/fpu/mfloat
neon官网介绍: Arm Neon technology is an advanced Single Instruction Multiple Data (SIMD) architecture extension for the A-profile and R-profile processors. Neon technology is a packed SIMD architecture. Neon registers are considered as vectors of elements …...
Maven基础之项目创建、packaging
文章目录 创建 maven 项目流程骨架是浮云,packaging 是关键 创建 maven 项目流程 通过骨架(archetype)创建 maven 工程 第一步:选择 new → maven → Maven Project 第二步:New Maven Project 窗口不作任何设置&…...
c++ std::map 使用注意事项
1. std::map 如果在添加元素前,直接去取 key-value,会怎样 ? 先说答案,map 在添加元素前,直接使用会给 key 添加默认的 value! 2. 问题背景 某项目代码报出个严重的bug,具体现象是某个 map…...
Camera HAL/ISP 专业术语大全
不断更新,建议收藏,快速检索 SOC,System On Chip,片上系统 HAL,Hardware Abstraction Layer,硬件抽象层 ISP,Image Signal Processor,图像信号处理器 KMD,Kernel Mod…...
POI的简单入门
POI的简单入门 导入jar包将数据写入Excel文件读取Excel文件中的数据 导入jar包 Apache POI的maven坐标 <dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.17</version> </dependency>…...
如何将笔记本作为另一台电脑的副屏显示
背景说明 台式电脑一个显示器不够我使用,而手头又没有多的显示器。我的笔记本有屏幕,但是不能直接连HDMI线给台式拓展屏幕。研究一段时间后发现,利用spacedesk软件可以基本完美解决这个问题。 效果演示 软件下载与安装 官网下载最新版(需要…...
深入理解正则表达式:为什么它在Java中如此重要?
文章目录 一、正则表达式1.1 为什么引入正则表达式1.2 什么是正则表达式 二、正则表达式规则2.1 正则表达式的基本语法规则2.2 非贪婪匹配 三、正则表达式在java中的应用3.1 String3.2 java.util.regex 参考资料 一、正则表达式 1.1 为什么引入正则表达式 在实际编写程序的过…...
jmeter实现webservice接口测试
其实可以用jmeter两种sampler进行webservice的测试: 1、SOAP/XML-RPC Request(但是在jmeter3.2以后版本中已经取消了这个取样器) 2、HTTP请求 下面分别介绍两种方式 一、首先需要使用soupUI工具抓取webservice接口的部分需要的信息。 1、新建项目 2、新建成功的…...
js 四舍五入保留一位小数 求百分比
概览:一个数据占一组数据的比率,并且四舍五入保留一位小数。通过Math.round()四舍五入。 参考链接: mdn中文文档Math.round() 实现思路: Math.round(x) 函数返回一个数字四舍五入后最接近的整数。参数x是一个数值 实现代码&a…...
文件上传漏洞总结2
文件上传的大体都已经学习过了 这个假期在给他强化一下 什么是webshell webshell是web入侵的脚本攻击工具。webshell就是一个asp或php木马后门,黑客在入侵了一个网站后,常常在将这些asp或php木马后门文件放置在网站服务器的web目录中,与正常…...
【组内工作】木马回联
文章目录 C2服务器安装和运行方法CrossC2运行方法sliver运行方法empire安装方法DeimosC2安装教程TrevorC2安装教程: C2服务器的流量特征CrossC21. 心跳包2. 命令3. ja3/ja3s Sliver1. http2. https empirehttphttps DeimosC2https TrevorC2 C2服务器安装和运行方法 …...
未来将会有更多基于 Cortana 的设备
在前些日子的 Build 大会首日 Keynote 中,微软正式确认 HP 跟 Intel 也正在开发基于 Cortana 平台的联网家居产品,这是继推出 Invoke 喇叭的 Harman Kardon 后,又有知名大牌加入到 Cortana 的阵营当中,有这样的品牌资源背景&#…...
嵌入式硬件系统的基本组成
嵌入式硬件系统的基本组成 嵌入式系统的硬件是以包含嵌入式微处理器的SOC为核心,主要由SOC、总线、存储器、输入/输出接口和设备组成。 嵌入式微处理器 每个嵌入式系统至少包含一个嵌入式微处理器 嵌入式微处理器体系结构可采用冯.诺依曼(Von Neumann&…...
def __init__(self, **kwargs):中的**kwargs是什么意思
**kwargs是什么意思 在Python中,**kwargs是一种特殊的参数形式,用于接收可变数量的关键字参数(Keyword Arguments)。kwargs是一个字典(dictionary),其中关键字是参数名,对应的值是传…...
web攻击面试|网络渗透面试(三)
Web攻击大纲 常见Web攻击类型: SQL注入攻击:介绍SQL注入攻击的概念、原理和常见的攻击方式,如基于错误消息的注入、基于布尔盲注的注入等。解释攻击者如何利用SQL注入漏洞获取敏感信息或者对数据库进行恶意操作,并提供防御措施&a…...
爬虫基础学习day2
# 爬虫设计领域 工商:企查查、天眼查短视频:抖音、快手、西瓜 ---> 飞瓜电商:京东、淘宝、聚美优品、亚马逊 ---> 分析店铺经营决策标题、排名航空:抓取所有航空公司价格 ---> 去哪儿自媒体:采集自媒体数据进…...
【Oracle】分区表
个人主页:Guiat 归属专栏:Oracle 文章目录 1. 分区表基础概述1.1 分区表的概念与优势1.2 分区类型概览1.3 分区表的工作原理 2. 范围分区 (RANGE Partitioning)2.1 基础范围分区2.1.1 按日期范围分区2.1.2 按数值范围分区 2.2 间隔分区 (INTERVAL Partit…...
Device Mapper 机制
Device Mapper 机制详解 Device Mapper(简称 DM)是 Linux 内核中的一套通用块设备映射框架,为 LVM、加密磁盘、RAID 等提供底层支持。本文将详细介绍 Device Mapper 的原理、实现、内核配置、常用工具、操作测试流程,并配以详细的…...
python报错No module named ‘tensorflow.keras‘
是由于不同版本的tensorflow下的keras所在的路径不同,结合所安装的tensorflow的目录结构修改from语句即可。 原语句: from tensorflow.keras.layers import Conv1D, MaxPooling1D, LSTM, Dense 修改后: from tensorflow.python.keras.lay…...
视频行为标注工具BehaviLabel(源码+使用介绍+Windows.Exe版本)
前言: 最近在做行为检测相关的模型,用的是时空图卷积网络(STGCN),但原有kinetic-400数据集数据质量较低,需要进行细粒度的标注,同时粗略搜了下已有开源工具基本都集中于图像分割这块,…...
C++.OpenGL (14/64)多光源(Multiple Lights)
多光源(Multiple Lights) 多光源渲染技术概览 #mermaid-svg-3L5e5gGn76TNh7Lq {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-3L5e5gGn76TNh7Lq .error-icon{fill:#552222;}#mermaid-svg-3L5e5gGn76TNh7Lq .erro…...
搭建DNS域名解析服务器(正向解析资源文件)
正向解析资源文件 1)准备工作 服务端及客户端都关闭安全软件 [rootlocalhost ~]# systemctl stop firewalld [rootlocalhost ~]# setenforce 0 2)服务端安装软件:bind 1.配置yum源 [rootlocalhost ~]# cat /etc/yum.repos.d/base.repo [Base…...
MySQL 部分重点知识篇
一、数据库对象 1. 主键 定义 :主键是用于唯一标识表中每一行记录的字段或字段组合。它具有唯一性和非空性特点。 作用 :确保数据的完整性,便于数据的查询和管理。 示例 :在学生信息表中,学号可以作为主键ÿ…...
【LeetCode】算法详解#6 ---除自身以外数组的乘积
1.题目介绍 给定一个整数数组 nums,返回 数组 answer ,其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法,且在 O…...
通过MicroSip配置自己的freeswitch服务器进行调试记录
之前用docker安装的freeswitch的,启动是正常的, 但用下面的Microsip连接不上 主要原因有可能一下几个 1、通过下面命令可以看 [rootlocalhost default]# docker exec -it freeswitch fs_cli -x "sofia status profile internal"Name …...
