| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 广告添加 | |||
| * 添加广告 | |||
| * | |||
| * @version $id:ad_add.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 广告修改 | |||
| * 修改广告 | |||
| * | |||
| * @version $id:ad_edit.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 图片发布 | |||
| * 发布图片模型 | |||
| * | |||
| * @version $id:album_add.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 图片修改 | |||
| * 修改图片模型 | |||
| * | |||
| * @version $id:album_edit.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 用于后台的api接口 | |||
| * 后台api接口 | |||
| * | |||
| * @version $id:api.php 8:26 2022年11月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 文档发布 | |||
| * 发布自定义文档模型 | |||
| * | |||
| * @version $id:archives_add.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 文档处理 | |||
| * 处理自定义文档模型 | |||
| * | |||
| * @version $id:archives_do.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 文档修改 | |||
| * 修改自定义文档模型 | |||
| * | |||
| * @version $id:archives_edit.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 单表模型文档发布 | |||
| * 发布分类文档模型 | |||
| * | |||
| * @version $id:archives_sg_add.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 单表模型文档修改 | |||
| * 修改分类文档模型 | |||
| * | |||
| * @version $id:archives_sg_edit.php 8:26 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 文档发布 | |||
| * 发布文档模型 | |||
| * | |||
| * @version $id:article_add.php 2020年9月14日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 允许的站内链接 | |||
| * 允许站内链接 | |||
| * | |||
| * @version $id:article_allowurl_edit.php 11:36 2010年10月8日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 文档修改 | |||
| * 修改文档模型 | |||
| * | |||
| * @version $id:article_edit.php 14:12 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 栏目添加 | |||
| * 添加栏目 | |||
| * | |||
| * @version $id:catalog_add.php 14:31 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 栏目修改 | |||
| * 修改栏目 | |||
| * | |||
| * @version $id:catalog_edit.php 14:31 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 管理目录配置文件 | |||
| * 管理目录配置 | |||
| * | |||
| * @version $id:config.php 14:31 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 单表模型列表 | |||
| * 图片/软件列表 | |||
| * | |||
| * @version $id:content_sg_list.php 14:31 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 退出 | |||
| * 退出登录 | |||
| * | |||
| * @version $id:exit.php 19:09 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 评论修改 | |||
| * 修改评论 | |||
| * | |||
| * @version $id:feedback_edit.php 19:09 2010年7月12日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 友情链接添加 | |||
| * 添加友情链接 | |||
| * | |||
| * @version $id:friendlink_add.php 10:59 2010年7月13日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 友情链接修改 | |||
| * 修改友情链接 | |||
| * | |||
| * @version $id:friendlink_edit.php 10:59 2010年7月13日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 管理后台首页 | |||
| * 后台管理主页 | |||
| * | |||
| * @version $id:index.php 11:06 2010年7月13日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 管理后台首页主体 | |||
| * 仪表盘 | |||
| * | |||
| * @version $id:index_body.php 11:06 2010年7月13日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 菜单项 | |||
| * 侧边菜单 | |||
| * | |||
| * @version $id:index_menu.php 11:06 2010年7月13日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 附件添加 | |||
| * 添加附件 | |||
| * | |||
| * @version $id:media_add.php 2 15:25 2011-6-2 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 附件修改 | |||
| * 修改附件 | |||
| * | |||
| * @version $id:media_edit.php 11:17 2010年7月19日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 会员操作日志记录管理 | |||
| * 会员日志管理 | |||
| * | |||
| * @version $id:member_operations.php 11:24 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 会员短消息,发布所有消息 | |||
| * 会员短消息,发布所有消息 | |||
| * | |||
| * @version $id:member_pmall.php 11:24 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 会员短消息,发送到一个 | |||
| * 会员短消息,发送一个消息 | |||
| * | |||
| * @version $id:member_pmone.php 11:24 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 升级为管理员 | |||
| * 升级管理员 | |||
| * | |||
| * @version $id:member_toadmin.php 14:09 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 生成模块 | |||
| * 模块生成 | |||
| * | |||
| * @version $id:module_make.php 14:17 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 自定义模型字段添加 | |||
| * 添加自定义模型字段 | |||
| * | |||
| * @version $id:mychannel_field_add.php 15:07 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 自定义模型字段修改 | |||
| * 修改自定义模型字段 | |||
| * | |||
| * @version $id:mychannel_field_edit.php 15:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 自定义标记修改 | |||
| * 修改自定义标记 | |||
| * | |||
| * @version $id:mytag_edit.php 15:37 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 根据条件生成标记 | |||
| * 自定义标记向导生成条件标记 | |||
| * | |||
| * @version $id:mytag_tag_guide_ok.php 15:39 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -13,7 +13,7 @@ if (DEDEBIZ_SAFE_MODE) { | |||
| die(DedeAlert("系统已启用安全模式,无法使用当前功能",ALERT_DANGER)); | |||
| } | |||
| CheckPurview('temp_Other'); | |||
| //根据条件生成标记 | |||
| //根据生成条件标记 | |||
| $attlist = ""; | |||
| $attlist .= " row='".$row."'"; | |||
| $attlist .= " titlelen='".$titlelen."'"; | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 软件发布 | |||
| * 发布软件模型 | |||
| * | |||
| * @version $id:soft_add.php 16:09 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 软件配置 | |||
| * 系统配置变量保存 | |||
| * | |||
| * @version $id:soft_config.php 16:09 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 软件修改 | |||
| * 修改软件模型 | |||
| * | |||
| * @version $id:soft_edit.php 16:09 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 专题添加 | |||
| * 发布专题 | |||
| * | |||
| * @version $id:spec_add.php 16:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 专题修改 | |||
| * 修改专题 | |||
| * | |||
| * @version $id:spec_edit.php 16:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 用户管理 | |||
| * 后台管理员 | |||
| * | |||
| * @version $id:sys_admin_user.php 16:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 添加系统管理员 | |||
| * 添加管理员 | |||
| * | |||
| * @version $id:sys_admin_user_add.php 16:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 修改系统管理员 | |||
| * 修改管理员 | |||
| * | |||
| * @version $id:sys_admin_user_edit.php 16:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 获取用户的统计信息 | |||
| * 获取管理员统计信息 | |||
| * | |||
| * @version $id:sys_admin_user_edit.php 16:22 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,5 +1,4 @@ | |||
| <?php | |||
| /** | |||
| * 云服务配置 | |||
| * | |||
| @@ -9,7 +8,7 @@ | |||
| * @license https://www.dedebiz.com/license | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__) . "/config.php"); | |||
| require_once(dirname(__FILE__)."/config.php"); | |||
| CheckPurview('sys_Edit'); | |||
| $dopost = isset($dopost) ? $dopost : ''; | |||
| $client = new DedeBizClient(); | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 系统权限组添加 | |||
| * 添加系统权限组 | |||
| * | |||
| * @version $id:sys_group_add.php 22:28 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 系统权限组修改 | |||
| * 修改系统权限组 | |||
| * | |||
| * @version $id:sys_group_edit.php 22:28 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 系统配置 | |||
| * 系统配置变量 | |||
| * | |||
| * @version $id:sys_info.php 22:28 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -17,7 +17,7 @@ function ReWriteConfig() | |||
| { | |||
| global $dsql, $configfile; | |||
| if (!is_writeable($configfile)) { | |||
| echo "配置文件{$configfile}不支持写入,无法修改系统配置参数"; | |||
| echo "配置文件<span class='text-primary'>{$configfile}</span>不支持写入,无法修改系统配置参数"; | |||
| exit(); | |||
| } | |||
| $fp = fopen($configfile, 'w'); | |||
| @@ -61,7 +61,7 @@ if ($dopost == "save") { | |||
| else if ($dopost == 'add') { | |||
| CheckCSRF(); | |||
| if ($vartype == 'bool' && ($nvarvalue != 'Y' && $nvarvalue != 'N')) { | |||
| ShowMsg("布尔变量值必须为'Y'或'N'", "-1"); | |||
| ShowMsg("布尔变量值必须为Y或N", "-1"); | |||
| exit(); | |||
| } | |||
| if ($valtype == 'number') { | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 安全检测 | |||
| * 系统修复工具 | |||
| * | |||
| * @version $id:sys_safetest.php 2 9:25 2010-11-12 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * SQL命令执行器 | |||
| * SQL命令工具 | |||
| * | |||
| * @version $id:sys_sql_query.php 22:28 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 获取TAGS管理 | |||
| * 标签管理 | |||
| * | |||
| * @version $id:tag_test_action.php 23:07 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -3,7 +3,7 @@ | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | |||
| <title>发布商品</title> | |||
| <title>发布自定义文档模型</title> | |||
| <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="../static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="../static/web/css/admin.css"> | |||
| @@ -3,7 +3,7 @@ | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | |||
| <title>修改商品</title> | |||
| <title>修改自定义文档模型</title> | |||
| <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="../static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="../static/web/css/admin.css"> | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 模板文件管理 | |||
| * 模板管理 | |||
| * | |||
| * @version $id:templets_main.php 23:07 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 管理一个模板 | |||
| * 模板编译 | |||
| * | |||
| * @version $id:templets_one.php 23:07 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 添加一个模板 | |||
| * 添加模板 | |||
| * | |||
| * @version $id:templets_one_add.php 23:07 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 修改一个模板 | |||
| * 修改模板 | |||
| * | |||
| * @version $id:templets_one_edit.php 23:07 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -67,7 +67,7 @@ if ($dopost == "saveedit") { | |||
| $sg->SaveToHtml(); | |||
| $i++; | |||
| } | |||
| ShowMsg("成功更新 $i 个页面", '-1'); | |||
| ShowMsg("成功更新<span class='text-primary'>$i</span>个页面", '-1'); | |||
| exit(); | |||
| } else if ($dopost == "mksel") { | |||
| if (empty($ids)) { | |||
| @@ -84,7 +84,7 @@ if ($dopost == "saveedit") { | |||
| $sg->SaveToHtml(); | |||
| $i++; | |||
| } | |||
| ShowMsg("成功更新 $i 个页面", '-1'); | |||
| ShowMsg("成功更新<span class='text-primary'>$i</span>个页面", '-1'); | |||
| exit(); | |||
| } | |||
| } else if ($dopost == "view") { | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 投票模块 | |||
| * 添加投票模块 | |||
| * | |||
| * @version $id:vote_add.php 23:54 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * 投票模块修改 | |||
| * 修改投票模块 | |||
| * | |||
| * @version $id:vote_edit.php 23:54 2010年7月20日 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| @@ -379,10 +379,6 @@ input[type=file] { | |||
| max-width:280px; | |||
| max-height:168px | |||
| } | |||
| .album-imgs img { | |||
| max-width:260px; | |||
| max-height:156px | |||
| } | |||
| #btnScrollTop { | |||
| display:none; | |||
| position:fixed; | |||
| @@ -42,7 +42,7 @@ function MakeUpload(mnum) | |||
| fhtml = ''; | |||
| fhtml += "<div><label><input type='checkbox' name='isokcheck"+startNum+"' id='isokcheck"+startNum+"' value='1' "+dsel+" onClick='CheckSelTable("+startNum+")'> 显示图片"+startNum+"上传框</label></div>"; | |||
| fhtml += "<div id=\"seltb"+startNum+"\" style=\""+dplay+"\">"; | |||
| fhtml += "<p>图片"+startNum+":<input type='text' name='imgfile"+startNum+"' class='form-control d-inline-block w-50 mr-2' placeholder='请输入网址'><span class='btn btn-success btn-sm'>选择</span></p>"; | |||
| fhtml += "<p>图片"+startNum+":<input type='text' name='imgfile"+startNum+"' class='form-control d-inline-block w-50 mr-2' placeholder='请输入网址'></p>"; | |||
| fhtml += "<p>图片简介:<textarea name='imgmsg"+startNum+"' class='form-control'></textarea></p>"; | |||
| fhtml += "</div>"; | |||
| upfield.innerHTML += fhtml; | |||
| @@ -673,7 +673,7 @@ function HideEmail($email) | |||
| $em = explode("@",$email); | |||
| $name = implode('@', array_slice($em, 0, count($em)-1)); | |||
| $len = floor(strlen($name)/2); | |||
| return substr($name,0, $len) . str_repeat('*', $len) . "@" . end($em); | |||
| return substr($name,0, $len).str_repeat('*', $len)."@".end($em); | |||
| } | |||
| //自定义函数接口 | |||
| if (file_exists(DEDEINC.'/extend.func.php')) { | |||
| @@ -72,7 +72,7 @@ class ImageResize | |||
| if (empty($image_data) || $image_data === null) { | |||
| throw new ImageResizeException('image_data must not be empty'); | |||
| } | |||
| $resize = new self('data://application/octet-stream;base64,' . base64_encode($image_data)); | |||
| $resize = new self('data://application/octet-stream;base64,'.base64_encode($image_data)); | |||
| return $resize; | |||
| } | |||
| @@ -458,7 +458,7 @@ class ImageResize | |||
| { | |||
| $image_type = $image_type ?: $this->source_type; | |||
| header('Content-Type: ' . image_type_to_mime_type($image_type)); | |||
| header('Content-Type: '.image_type_to_mime_type($image_type)); | |||
| $this->save(null, $image_type, $quality); | |||
| } | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 支付宝App支付网关 | |||
| * Class App | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicAliPay; | |||
| */ | |||
| class App extends BasicAliPay | |||
| { | |||
| /** | |||
| * App constructor. | |||
| * @param array $options | |||
| @@ -21,7 +19,6 @@ class App extends BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.app.pay'); | |||
| $this->params->set('product_code', 'QUICK_MSECURITY_PAY'); | |||
| } | |||
| /** | |||
| * 创建数据操作 | |||
| * @param array $options | |||
| @@ -32,4 +29,5 @@ class App extends BasicAliPay | |||
| $this->applyData($options); | |||
| return http_build_query($this->options->get()); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 支付宝电子面单下载 | |||
| * Class Bill | |||
| @@ -19,7 +18,6 @@ class Bill extends BasicAliPay | |||
| parent::__construct($options); | |||
| $this->options->set('method', 'alipay.data.dataservice.bill.downloadurl.query'); | |||
| } | |||
| /** | |||
| * 创建数据操作 | |||
| * @param array $options | |||
| @@ -31,4 +29,5 @@ class Bill extends BasicAliPay | |||
| { | |||
| return $this->getResult($options); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 支付宝刷卡支付 | |||
| * Class Pos | |||
| @@ -20,7 +19,6 @@ class Pos extends BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.pay'); | |||
| $this->params->set('product_code', 'FACE_TO_FACE_PAYMENT'); | |||
| } | |||
| /** | |||
| * 创建数据操作 | |||
| * @param array $options | |||
| @@ -32,4 +30,5 @@ class Pos extends BasicAliPay | |||
| { | |||
| return $this->getResult($options); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 支付宝扫码支付 | |||
| * Class Scan | |||
| @@ -19,7 +18,6 @@ class Scan extends BasicAliPay | |||
| parent::__construct($options); | |||
| $this->options->set('method', 'alipay.trade.precreate'); | |||
| } | |||
| /** | |||
| * 创建数据操作 | |||
| * @param array $options | |||
| @@ -31,4 +29,5 @@ class Scan extends BasicAliPay | |||
| { | |||
| return $this->getResult($options); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 支付宝标准接口 | |||
| * Class Trade | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicAliPay; | |||
| */ | |||
| class Trade extends BasicAliPay | |||
| { | |||
| /** | |||
| * 设置交易接口地址 | |||
| * @param string $method | |||
| @@ -21,7 +19,6 @@ class Trade extends BasicAliPay | |||
| $this->options->set('method', $method); | |||
| return $this; | |||
| } | |||
| /** | |||
| * 获取交易接口地址 | |||
| * @return string | |||
| @@ -30,7 +27,6 @@ class Trade extends BasicAliPay | |||
| { | |||
| return $this->options->get('method'); | |||
| } | |||
| /** | |||
| * 设置接口公共参数 | |||
| * @param array $option | |||
| @@ -43,7 +39,6 @@ class Trade extends BasicAliPay | |||
| } | |||
| return $this; | |||
| } | |||
| /** | |||
| * 获取接口公共参数 | |||
| * @return array|string|null | |||
| @@ -52,7 +47,6 @@ class Trade extends BasicAliPay | |||
| { | |||
| return $this->options->get(); | |||
| } | |||
| /** | |||
| * 执行通过接口 | |||
| * @param array $options | |||
| @@ -64,4 +58,5 @@ class Trade extends BasicAliPay | |||
| { | |||
| return $this->getResult($options); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -3,7 +3,6 @@ namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| use WeChat\Exceptions\InvalidArgumentException; | |||
| /** | |||
| * 支付宝转账到账户 | |||
| * Class Transfer | |||
| @@ -11,7 +10,6 @@ use WeChat\Exceptions\InvalidArgumentException; | |||
| */ | |||
| class Transfer extends BasicAliPay | |||
| { | |||
| /** | |||
| * 旧版 向指定支付宝账户转账 | |||
| * @param array $options | |||
| @@ -24,7 +22,6 @@ class Transfer extends BasicAliPay | |||
| $this->options->set('method', 'alipay.fund.trans.toaccount.transfer'); | |||
| return $this->getResult($options); | |||
| } | |||
| /** | |||
| * 新版 向指定支付宝账户转账 | |||
| * @param array $options | |||
| @@ -38,7 +35,6 @@ class Transfer extends BasicAliPay | |||
| $this->options->set('method', 'alipay.fund.trans.uni.transfer'); | |||
| return $this->getResult($options); | |||
| } | |||
| /** | |||
| * 新版 转账业务单据查询接口 | |||
| * @param array $options | |||
| @@ -53,7 +49,6 @@ class Transfer extends BasicAliPay | |||
| return $this->getResult($options); | |||
| } | |||
| /** | |||
| * 新版 支付宝资金账户资产查询接口 | |||
| * @param array $options | |||
| @@ -67,7 +62,6 @@ class Transfer extends BasicAliPay | |||
| $this->options->set('method', 'alipay.fund.account.query'); | |||
| return $this->getResult($options); | |||
| } | |||
| /** | |||
| * 新版 设置网关应用公钥证书SN、支付宝根证书SN | |||
| */ | |||
| @@ -88,4 +82,5 @@ class Transfer extends BasicAliPay | |||
| throw new InvalidArgumentException("Missing options -- [alipay_root_cert_sn]"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 手机WAP网站支付支持 | |||
| * Class Wap | |||
| @@ -20,7 +19,6 @@ class Wap extends BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.wap.pay'); | |||
| $this->params->set('product_code', 'QUICK_WAP_WAY'); | |||
| } | |||
| /** | |||
| * 创建数据操作 | |||
| * @param array $options | |||
| @@ -31,4 +29,5 @@ class Wap extends BasicAliPay | |||
| parent::applyData($options); | |||
| return $this->buildPayHtml(); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace AliPay; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicAliPay; | |||
| /** | |||
| * 支付宝网站支付 | |||
| * Class Web | |||
| @@ -20,7 +19,6 @@ class Web extends BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.page.pay'); | |||
| $this->params->set('product_code', 'FAST_INSTANT_TRADE_PAY'); | |||
| } | |||
| /** | |||
| * 创建数据操作 | |||
| * @param array $options | |||
| @@ -31,4 +29,5 @@ class Web extends BasicAliPay | |||
| parent::applyData($options); | |||
| return $this->buildPayHtml(); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\DataArray; | |||
| use WeChat\Exceptions\InvalidInstanceException; | |||
| /** | |||
| * 加载缓存器 | |||
| * | |||
| @@ -80,13 +79,11 @@ class We | |||
| * @var string | |||
| */ | |||
| const VERSION = '1.2.37'; | |||
| /** | |||
| * 静态配置 | |||
| * @var DataArray | |||
| */ | |||
| private static $config; | |||
| /** | |||
| * 设置及获取参数 | |||
| * @param array $option | |||
| @@ -102,7 +99,6 @@ class We | |||
| } | |||
| return []; | |||
| } | |||
| /** | |||
| * 静态魔术加载方法 | |||
| * @param string $name 静态类名 | |||
| @@ -113,15 +109,15 @@ class We | |||
| public static function __callStatic($name, $arguments) | |||
| { | |||
| if (substr($name, 0, 6) === 'WeChat') { | |||
| $class = 'WeChat\\' . substr($name, 6); | |||
| $class = 'WeChat\\'.substr($name, 6); | |||
| } elseif (substr($name, 0, 6) === 'WeMini') { | |||
| $class = 'WeMini\\' . substr($name, 6); | |||
| $class = 'WeMini\\'.substr($name, 6); | |||
| } elseif (substr($name, 0, 6) === 'AliPay') { | |||
| $class = 'AliPay\\' . substr($name, 6); | |||
| $class = 'AliPay\\'.substr($name, 6); | |||
| } elseif (substr($name, 0, 7) === 'WePayV3') { | |||
| $class = 'WePayV3\\' . substr($name, 7); | |||
| $class = 'WePayV3\\'.substr($name, 7); | |||
| } elseif (substr($name, 0, 5) === 'WePay') { | |||
| $class = 'WePay\\' . substr($name, 5); | |||
| $class = 'WePay\\'.substr($name, 5); | |||
| } | |||
| if (!empty($class) && class_exists($class)) { | |||
| $option = array_shift($arguments); | |||
| @@ -130,5 +126,5 @@ class We | |||
| } | |||
| throw new InvalidInstanceException("class {$name} not found"); | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 卡券管理 | |||
| * Class Card | |||
| @@ -23,7 +22,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 设置买单接口 | |||
| * @param string $card_id | |||
| @@ -38,7 +36,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id, 'is_open' => $is_open]); | |||
| } | |||
| /** | |||
| * 设置自助核销接口 | |||
| * @param string $card_id | |||
| @@ -53,7 +50,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id, 'is_open' => $is_open]); | |||
| } | |||
| /** | |||
| * 创建二维码接口 | |||
| * @param array $data | |||
| @@ -67,7 +63,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 创建货架接口 | |||
| * @param array $data | |||
| @@ -81,7 +76,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 导入自定义code | |||
| * @param string $card_id | |||
| @@ -96,7 +90,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id, 'code' => $code]); | |||
| } | |||
| /** | |||
| * 查询导入code数目 | |||
| * @param string $card_id | |||
| @@ -110,7 +103,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id]); | |||
| } | |||
| /** | |||
| * 核查code接口 | |||
| * @param string $card_id 进行导入code的卡券ID | |||
| @@ -125,7 +117,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id, 'code' => $code]); | |||
| } | |||
| /** | |||
| * 图文消息群发卡券 | |||
| * @param string $card_id | |||
| @@ -139,7 +130,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id]); | |||
| } | |||
| /** | |||
| * 设置测试白名单 | |||
| * @param array $openids | |||
| @@ -154,7 +144,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['openid' => $openids, 'username' => $usernames]); | |||
| } | |||
| /** | |||
| * 线下核销查询Code | |||
| * @param string $code 单张卡券的唯一标准 | |||
| @@ -173,7 +162,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 线下核销核销Code | |||
| * @param string $code 需核销的Code码 | |||
| @@ -190,7 +178,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * Code解码接口 | |||
| * @param string $encrypt_code | |||
| @@ -204,7 +191,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['encrypt_code' => $encrypt_code]); | |||
| } | |||
| /** | |||
| * 获取用户已领取卡券接口 | |||
| * @param string $openid | |||
| @@ -221,7 +207,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 查看卡券详情 | |||
| * @param string $card_id | |||
| @@ -235,7 +220,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id]); | |||
| } | |||
| /** | |||
| * 批量查询卡券列表 | |||
| * @param int $offset 查询卡列表的起始偏移量,从0开始,即offset: 5是指从从列表里的第六个开始读取 | |||
| @@ -253,7 +237,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 更改卡券信息接口 | |||
| * @param string $card_id | |||
| @@ -268,7 +251,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id, 'member_card' => $member_card]); | |||
| } | |||
| /** | |||
| * 修改库存接口 | |||
| * @param string $card_id 卡券ID | |||
| @@ -287,7 +269,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 更改Code接口 | |||
| * @param string $code 需变更的Code码 | |||
| @@ -305,7 +286,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 删除卡券接口 | |||
| * @param string $card_id | |||
| @@ -319,7 +299,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id]); | |||
| } | |||
| /** | |||
| * 设置卡券失效接口 | |||
| * @param string $code | |||
| @@ -337,7 +316,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 拉取卡券概况数据接口 | |||
| * @param string $begin_date 查询数据的起始时间 | |||
| @@ -354,7 +332,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 获取免费券数据接口 | |||
| * @param string $begin_date 查询数据的起始时间 | |||
| @@ -373,8 +350,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 激活会员卡 | |||
| * @param array $data | |||
| @@ -388,7 +363,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 设置开卡字段接口 | |||
| * 用户激活时需要填写的选项 | |||
| @@ -403,7 +377,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 获取用户提交资料 | |||
| * 根据activate_ticket获取到用户填写的信息 | |||
| @@ -418,7 +391,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['activate_ticket' => $activate_ticket]); | |||
| } | |||
| /** | |||
| * 更新会员信息 | |||
| * @param array $data | |||
| @@ -432,7 +404,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 拉取会员卡概况数据接口 | |||
| * @param string $begin_date 查询数据的起始时间 | |||
| @@ -449,7 +420,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 拉取单张会员卡数据接口 | |||
| * @param string $begin_date 查询数据的起始时间 | |||
| @@ -466,7 +436,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 拉取会员信息(积分查询)接口 | |||
| * @param string $card_id 查询会员卡的cardid | |||
| @@ -482,7 +451,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 设置支付后投放卡券接口 | |||
| * @param array $data | |||
| @@ -496,7 +464,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 删除支付后投放卡券规则 | |||
| * @param integer $rule_id 支付即会员的规则名称 | |||
| @@ -510,7 +477,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['rule_id' => $rule_id]); | |||
| } | |||
| /** | |||
| * 查询支付后投放卡券规则详情 | |||
| * @param integer $rule_id 要查询规则id | |||
| @@ -524,7 +490,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['rule_id' => $rule_id]); | |||
| } | |||
| /** | |||
| * 批量查询支付后投放卡券规则 | |||
| * @param integer $offset 起始偏移量 | |||
| @@ -541,7 +506,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 创建支付后领取立减金活动 | |||
| * @param array $data | |||
| @@ -555,7 +519,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 开通券点账户接口 | |||
| * @return array | |||
| @@ -568,7 +531,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 对优惠券批价 | |||
| * @param string $card_id 需要来配置库存的card_id | |||
| @@ -583,7 +545,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['card_id' => $card_id, 'quantity' => $quantity]); | |||
| } | |||
| /** | |||
| * 查询券点余额接口 | |||
| * @return array | |||
| @@ -596,7 +557,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 确认兑换库存接口 | |||
| * @param string $card_id 需要来兑换库存的card_id | |||
| @@ -613,7 +573,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 充值券点接口 | |||
| * @param integer $coin_count | |||
| @@ -627,7 +586,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['coin_count' => $coin_count]); | |||
| } | |||
| /** | |||
| * 查询订单详情接口 | |||
| * @param string $order_id | |||
| @@ -641,7 +599,6 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['order_id' => $order_id]); | |||
| } | |||
| /** | |||
| * 查询券点流水详情接口 | |||
| * @param array $data | |||
| @@ -655,5 +612,5 @@ class Card extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -3,7 +3,6 @@ namespace WeChat\Contracts; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Exceptions\InvalidArgumentException; | |||
| use WeChat\Exceptions\InvalidResponseException; | |||
| /** | |||
| * 支付宝支付基类 | |||
| * Class AliPay | |||
| @@ -17,31 +16,26 @@ abstract class BasicAliPay | |||
| * @var DataArray | |||
| */ | |||
| protected $config; | |||
| /** | |||
| * 当前请求数据 | |||
| * @var DataArray | |||
| */ | |||
| protected $options; | |||
| /** | |||
| * DzContent数据 | |||
| * @var DataArray | |||
| */ | |||
| protected $params; | |||
| /** | |||
| * 静态缓存 | |||
| * @var static | |||
| */ | |||
| protected static $cache; | |||
| /** | |||
| * 正常请求网关 | |||
| * @var string | |||
| */ | |||
| protected $gateway = 'https://openapi.alipay.com/gateway.do?charset=utf-8'; | |||
| /** | |||
| * AliPay constructor. | |||
| * @param array $options | |||
| @@ -80,7 +74,6 @@ abstract class BasicAliPay | |||
| $this->options->set('app_auth_token', $options['app_auth_token']); | |||
| } | |||
| } | |||
| /** | |||
| * 静态创建对象 | |||
| * @param array $config | |||
| @@ -88,11 +81,10 @@ abstract class BasicAliPay | |||
| */ | |||
| public static function instance(array $config) | |||
| { | |||
| $key = md5(get_called_class() . serialize($config)); | |||
| $key = md5(get_called_class().serialize($config)); | |||
| if (isset(self::$cache[$key])) return self::$cache[$key]; | |||
| return self::$cache[$key] = new static($config); | |||
| } | |||
| /** | |||
| * 查询支付宝订单状态 | |||
| * @param string $out_trade_no | |||
| @@ -105,7 +97,6 @@ abstract class BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.query'); | |||
| return $this->getResult(['out_trade_no' => $out_trade_no]); | |||
| } | |||
| /** | |||
| * 支付宝订单退款操作 | |||
| * @param array|string $options 退款参数或退款商户订单号 | |||
| @@ -120,7 +111,6 @@ abstract class BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.refund'); | |||
| return $this->getResult($options); | |||
| } | |||
| /** | |||
| * 关闭支付宝进行中的订单 | |||
| * @param array|string $options | |||
| @@ -134,7 +124,6 @@ abstract class BasicAliPay | |||
| $this->options->set('method', 'alipay.trade.close'); | |||
| return $this->getResult($options); | |||
| } | |||
| /** | |||
| * 获取通知数据 | |||
| * | |||
| @@ -158,7 +147,6 @@ abstract class BasicAliPay | |||
| } | |||
| return $data; | |||
| } | |||
| /** | |||
| * 验证接口返回的数据签名 | |||
| * @param array $data 通知数据 | |||
| @@ -181,7 +169,6 @@ abstract class BasicAliPay | |||
| } | |||
| return $data; | |||
| } | |||
| /** | |||
| * 获取数据签名 | |||
| * @return string | |||
| @@ -197,7 +184,6 @@ abstract class BasicAliPay | |||
| } | |||
| return base64_encode($sign); | |||
| } | |||
| /** | |||
| * 去除证书前后内容及空白 | |||
| * @param string $sign | |||
| @@ -205,10 +191,9 @@ abstract class BasicAliPay | |||
| */ | |||
| protected function trimCert($sign) | |||
| { | |||
| // if (file_exists($sign)) $sign = file_get_contents($sign); | |||
| //if (file_exists($sign)) $sign = file_get_contents($sign); | |||
| return preg_replace(['/\s+/', '/\-{5}.*?\-{5}/'], '', $sign); | |||
| } | |||
| /** | |||
| * 数据签名处理 | |||
| * @param array $data 需要进行签名数据 | |||
| @@ -226,7 +211,6 @@ abstract class BasicAliPay | |||
| } | |||
| return join('&', $attrs); | |||
| } | |||
| /** | |||
| * 数据包生成及数据签名 | |||
| * @param array $options | |||
| @@ -236,7 +220,6 @@ abstract class BasicAliPay | |||
| $this->options->set('biz_content', json_encode($this->params->merge($options), 256)); | |||
| $this->options->set('sign', $this->getSign()); | |||
| } | |||
| /** | |||
| * 请求接口并验证访问数据 | |||
| * @param array $options | |||
| @@ -247,7 +230,7 @@ abstract class BasicAliPay | |||
| protected function getResult($options) | |||
| { | |||
| $this->applyData($options); | |||
| $method = str_replace('.', '_', $this->options['method']) . '_response'; | |||
| $method = str_replace('.', '_', $this->options['method']).'_response'; | |||
| $data = json_decode(Tools::get($this->gateway, $this->options->get()), true); | |||
| if (!isset($data[$method]['code']) || $data[$method]['code'] !== '10000') { | |||
| throw new InvalidResponseException( | |||
| @@ -258,10 +241,9 @@ abstract class BasicAliPay | |||
| ); | |||
| } | |||
| return $data[$method]; | |||
| // 去除返回结果签名检查 | |||
| // return $this->verify($data[$method], $data['sign']); | |||
| //去除返回结果签名检查 | |||
| //return $this->verify($data[$method], $data['sign']); | |||
| } | |||
| /** | |||
| * 生成支付HTML代码 | |||
| * @return string | |||
| @@ -276,7 +258,6 @@ abstract class BasicAliPay | |||
| $html .= "<input type='submit' value='ok' style='display:none;'></form>"; | |||
| return "{$html}<script>document.forms['alipaysubmit'].submit();</script>"; | |||
| } | |||
| /** | |||
| * 新版 从证书中提取序列号 | |||
| * @param string $sign | |||
| @@ -284,11 +265,10 @@ abstract class BasicAliPay | |||
| */ | |||
| public function getCertSN($sign) | |||
| { | |||
| // if (file_exists($sign)) $sign = file_get_contents($sign); | |||
| //if (file_exists($sign)) $sign = file_get_contents($sign); | |||
| $ssl = openssl_x509_parse($sign); | |||
| return md5($this->_arr2str(array_reverse($ssl['issuer'])) . $ssl['serialNumber']); | |||
| return md5($this->_arr2str(array_reverse($ssl['issuer'])).$ssl['serialNumber']); | |||
| } | |||
| /** | |||
| * 新版 提取根证书序列号 | |||
| * @param string $sign | |||
| @@ -297,24 +277,23 @@ abstract class BasicAliPay | |||
| public function getRootCertSN($sign) | |||
| { | |||
| $sn = null; | |||
| // if (file_exists($sign)) $sign = file_get_contents($sign); | |||
| //if (file_exists($sign)) $sign = file_get_contents($sign); | |||
| $array = explode("-----END CERTIFICATE-----", $sign); | |||
| for ($i = 0; $i < count($array) - 1; $i++) { | |||
| $ssl[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----"); | |||
| $ssl[$i] = openssl_x509_parse($array[$i]."-----END CERTIFICATE-----"); | |||
| if (strpos($ssl[$i]['serialNumber'], '0x') === 0) { | |||
| $ssl[$i]['serialNumber'] = $this->_hex2dec($ssl[$i]['serialNumber']); | |||
| } | |||
| if ($ssl[$i]['signatureTypeLN'] == "sha1WithRSAEncryption" || $ssl[$i]['signatureTypeLN'] == "sha256WithRSAEncryption") { | |||
| if ($sn == null) { | |||
| $sn = md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']); | |||
| $sn = md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])).$ssl[$i]['serialNumber']); | |||
| } else { | |||
| $sn = $sn . "_" . md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']); | |||
| $sn = $sn."_".md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])).$ssl[$i]['serialNumber']); | |||
| } | |||
| } | |||
| } | |||
| return $sn; | |||
| } | |||
| /** | |||
| * 新版 数组转字符串 | |||
| * @param array $array | |||
| @@ -325,13 +304,11 @@ abstract class BasicAliPay | |||
| $string = []; | |||
| if ($array && is_array($array)) { | |||
| foreach ($array as $key => $value) { | |||
| $string[] = $key . '=' . $value; | |||
| $string[] = $key.'='.$value; | |||
| } | |||
| } | |||
| return implode(',', $string); | |||
| } | |||
| /** | |||
| * 新版 0x转高精度数字 | |||
| * @param string $hex | |||
| @@ -345,12 +322,11 @@ abstract class BasicAliPay | |||
| } | |||
| return $dec; | |||
| } | |||
| /** | |||
| * 应用数据操作 | |||
| * @param array $options | |||
| * @return mixed | |||
| */ | |||
| abstract public function apply($options); | |||
| } | |||
| } | |||
| ?> | |||
| @@ -4,7 +4,6 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Exceptions\InvalidArgumentException; | |||
| use WeChat\Exceptions\InvalidDecryptException; | |||
| use WeChat\Exceptions\InvalidResponseException; | |||
| /** | |||
| * 微信通知处理基本类 | |||
| * Class BasicPushEvent | |||
| @@ -17,43 +16,36 @@ class BasicPushEvent | |||
| * @var string | |||
| */ | |||
| protected $appid; | |||
| /** | |||
| * 公众号推送XML内容 | |||
| * @var string | |||
| */ | |||
| protected $postxml; | |||
| /** | |||
| * 公众号推送加密类型 | |||
| * @var string | |||
| */ | |||
| protected $encryptType; | |||
| /** | |||
| * 公众号的推送请求参数 | |||
| * @var DataArray | |||
| */ | |||
| protected $input; | |||
| /** | |||
| * 当前公众号配置对象 | |||
| * @var DataArray | |||
| */ | |||
| protected $config; | |||
| /** | |||
| * 公众号推送内容对象 | |||
| * @var DataArray | |||
| */ | |||
| protected $receive; | |||
| /** | |||
| * 准备回复的消息内容 | |||
| * @var array | |||
| */ | |||
| protected $message; | |||
| /** | |||
| * BasicPushEvent constructor. | |||
| * @param array $options | |||
| @@ -70,11 +62,11 @@ class BasicPushEvent | |||
| if (empty($options['token'])) { | |||
| throw new InvalidArgumentException("Missing Config -- [token]"); | |||
| } | |||
| // 参数初始化 | |||
| //参数初始化 | |||
| $this->config = new DataArray($options); | |||
| $this->input = new DataArray($_REQUEST); | |||
| $this->appid = $this->config->get('appid'); | |||
| // 推送消息处理 | |||
| //推送消息处理 | |||
| if ($_SERVER['REQUEST_METHOD'] == "POST") { | |||
| $this->postxml = file_get_contents("php://input"); | |||
| $this->encryptType = $this->input->get('encrypt_type'); | |||
| @@ -83,7 +75,7 @@ class BasicPushEvent | |||
| throw new InvalidArgumentException("Missing Config -- [encodingaeskey]"); | |||
| } | |||
| if (!class_exists('Prpcrypt', false)) { | |||
| require __DIR__ . '/Prpcrypt.php'; | |||
| require __DIR__.'/Prpcrypt.php'; | |||
| } | |||
| $prpcrypt = new \Prpcrypt($this->config->get('encodingaeskey')); | |||
| $result = Tools::xml2arr($this->postxml); | |||
| @@ -101,7 +93,6 @@ class BasicPushEvent | |||
| throw new InvalidResponseException('Invalid interface request.', '0'); | |||
| } | |||
| } | |||
| /** | |||
| * 消息是否需要加密 | |||
| * @return boolean | |||
| @@ -110,7 +101,6 @@ class BasicPushEvent | |||
| { | |||
| return $this->encryptType === 'aes'; | |||
| } | |||
| /** | |||
| * 回复消息 | |||
| * @param array $data 消息内容 | |||
| @@ -124,10 +114,10 @@ class BasicPushEvent | |||
| $xml = Tools::arr2xml(empty($data) ? $this->message : $data); | |||
| if ($this->isEncrypt() || $isEncrypt) { | |||
| if (!class_exists('Prpcrypt', false)) { | |||
| require __DIR__ . '/Prpcrypt.php'; | |||
| require __DIR__.'/Prpcrypt.php'; | |||
| } | |||
| $prpcrypt = new \Prpcrypt($this->config->get('encodingaeskey')); | |||
| // 如果是第三方平台,加密得使用 component_appid | |||
| //如果是第三方平台,加密得使用 component_appid | |||
| $component_appid = $this->config->get('component_appid'); | |||
| $appid = empty($component_appid) ? $this->appid : $component_appid; | |||
| $array = $prpcrypt->encrypt($xml, $appid); | |||
| @@ -144,7 +134,6 @@ class BasicPushEvent | |||
| @ob_clean(); | |||
| echo $xml; | |||
| } | |||
| /** | |||
| * 验证来自微信服务器 | |||
| * @param string $str | |||
| @@ -160,7 +149,6 @@ class BasicPushEvent | |||
| sort($tmpArr, SORT_STRING); | |||
| return sha1(implode($tmpArr)) === $signature; | |||
| } | |||
| /** | |||
| * 获取公众号推送对象 | |||
| * @param null|string $field 指定获取字段 | |||
| @@ -170,7 +158,6 @@ class BasicPushEvent | |||
| { | |||
| return $this->receive->get($field); | |||
| } | |||
| /** | |||
| * 获取当前微信OPENID | |||
| * @return string | |||
| @@ -179,7 +166,6 @@ class BasicPushEvent | |||
| { | |||
| return $this->receive->get('FromUserName'); | |||
| } | |||
| /** | |||
| * 获取当前推送消息类型 | |||
| * @return string | |||
| @@ -188,7 +174,6 @@ class BasicPushEvent | |||
| { | |||
| return $this->receive->get('MsgType'); | |||
| } | |||
| /** | |||
| * 获取当前推送消息ID | |||
| * @return string | |||
| @@ -197,7 +182,6 @@ class BasicPushEvent | |||
| { | |||
| return $this->receive->get('MsgId'); | |||
| } | |||
| /** | |||
| * 获取当前推送时间 | |||
| * @return integer | |||
| @@ -206,7 +190,6 @@ class BasicPushEvent | |||
| { | |||
| return $this->receive->get('CreateTime'); | |||
| } | |||
| /** | |||
| * 获取当前推送公众号 | |||
| * @return string | |||
| @@ -215,4 +198,5 @@ class BasicPushEvent | |||
| { | |||
| return $this->receive->get('ToUserName'); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -3,50 +3,42 @@ namespace WeChat\Contracts; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Exceptions\InvalidArgumentException; | |||
| use WeChat\Exceptions\InvalidResponseException; | |||
| /** | |||
| * Class BasicWeChat | |||
| * @package WeChat\Contracts | |||
| */ | |||
| class BasicWeChat | |||
| { | |||
| /** | |||
| * 当前微信配置 | |||
| * @var DataArray | |||
| */ | |||
| public $config; | |||
| /** | |||
| * 访问AccessToken | |||
| * @var string | |||
| */ | |||
| public $access_token = ''; | |||
| /** | |||
| * 当前请求方法参数 | |||
| * @var array | |||
| */ | |||
| protected $currentMethod = []; | |||
| /** | |||
| * 当前模式 | |||
| * @var bool | |||
| */ | |||
| protected $isTry = false; | |||
| /** | |||
| * 静态缓存 | |||
| * @var static | |||
| */ | |||
| protected static $cache; | |||
| /** | |||
| * 注册代替函数 | |||
| * @var string | |||
| */ | |||
| protected $GetAccessTokenCallback; | |||
| /** | |||
| * BasicWeChat constructor. | |||
| * @param array $options | |||
| @@ -67,7 +59,6 @@ class BasicWeChat | |||
| } | |||
| $this->config = new DataArray($options); | |||
| } | |||
| /** | |||
| * 静态创建对象 | |||
| * @param array $config | |||
| @@ -75,11 +66,10 @@ class BasicWeChat | |||
| */ | |||
| public static function instance(array $config) | |||
| { | |||
| $key = md5(get_called_class() . serialize($config)); | |||
| $key = md5(get_called_class().serialize($config)); | |||
| if (isset(self::$cache[$key])) return self::$cache[$key]; | |||
| return self::$cache[$key] = new static($config); | |||
| } | |||
| /** | |||
| * 获取访问 AccessToken | |||
| * @return string | |||
| @@ -91,12 +81,12 @@ class BasicWeChat | |||
| if (!empty($this->access_token)) { | |||
| return $this->access_token; | |||
| } | |||
| $cache = $this->config->get('appid') . '_access_token'; | |||
| $cache = $this->config->get('appid').'_access_token'; | |||
| $this->access_token = Tools::getCache($cache); | |||
| if (!empty($this->access_token)) { | |||
| return $this->access_token; | |||
| } | |||
| // 处理开放平台授权公众号获取AccessToken | |||
| //处理开放平台授权公众号获取AccessToken | |||
| if (!empty($this->GetAccessTokenCallback) && is_callable($this->GetAccessTokenCallback)) { | |||
| $this->access_token = call_user_func_array($this->GetAccessTokenCallback, [$this->config->get('appid'), $this]); | |||
| if (!empty($this->access_token)) { | |||
| @@ -112,7 +102,6 @@ class BasicWeChat | |||
| } | |||
| return $this->access_token = $result['access_token']; | |||
| } | |||
| /** | |||
| * 设置外部接口 AccessToken | |||
| * @param string $accessToken | |||
| @@ -128,10 +117,9 @@ class BasicWeChat | |||
| if (!is_string($accessToken)) { | |||
| throw new InvalidArgumentException("Invalid AccessToken type, need string."); | |||
| } | |||
| $cache = $this->config->get('appid') . '_access_token'; | |||
| $cache = $this->config->get('appid').'_access_token'; | |||
| Tools::setCache($cache, $this->access_token = $accessToken); | |||
| } | |||
| /** | |||
| * 清理删除 AccessToken | |||
| * @return bool | |||
| @@ -139,9 +127,8 @@ class BasicWeChat | |||
| public function delAccessToken() | |||
| { | |||
| $this->access_token = ''; | |||
| return Tools::delCache($this->config->get('appid') . '_access_token'); | |||
| return Tools::delCache($this->config->get('appid').'_access_token'); | |||
| } | |||
| /** | |||
| * 以GET获取接口数据并转为数组 | |||
| * @param string $url 接口地址 | |||
| @@ -163,7 +150,6 @@ class BasicWeChat | |||
| throw new InvalidResponseException($exception->getMessage(), $exception->getCode()); | |||
| } | |||
| } | |||
| /** | |||
| * 以POST获取接口数据并转为数组 | |||
| * @param string $url 接口地址 | |||
| @@ -187,7 +173,6 @@ class BasicWeChat | |||
| throw new InvalidResponseException($exception->getMessage(), $exception->getCode()); | |||
| } | |||
| } | |||
| /** | |||
| * 注册当前请求接口 | |||
| * @param string $url 接口地址 | |||
| @@ -203,7 +188,6 @@ class BasicWeChat | |||
| if (empty($this->access_token)) $this->access_token = $this->getAccessToken(); | |||
| return $url = str_replace('ACCESS_TOKEN', urlencode($this->access_token), $url); | |||
| } | |||
| /** | |||
| * 接口通用POST请求方法 | |||
| * @param string $url 接口URL | |||
| @@ -218,7 +202,6 @@ class BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data, $isBuildJson); | |||
| } | |||
| /** | |||
| * 接口通用GET请求方法 | |||
| * @param string $url 接口URL | |||
| @@ -231,5 +214,5 @@ class BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -3,7 +3,6 @@ namespace WeChat\Contracts; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Exceptions\InvalidArgumentException; | |||
| use WeChat\Exceptions\InvalidResponseException; | |||
| /** | |||
| * 微信支付基础类 | |||
| * Class BasicPay | |||
| @@ -16,19 +15,16 @@ class BasicWePay | |||
| * @var DataArray | |||
| */ | |||
| protected $config; | |||
| /** | |||
| * 当前请求数据 | |||
| * @var DataArray | |||
| */ | |||
| protected $params; | |||
| /** | |||
| * 静态缓存 | |||
| * @var static | |||
| */ | |||
| protected static $cache; | |||
| /** | |||
| * WeChat constructor. | |||
| * @param array $options | |||
| @@ -48,13 +44,13 @@ class BasicWePay | |||
| Tools::$cache_path = $options['cache_path']; | |||
| } | |||
| $this->config = new DataArray($options); | |||
| // 商户基础参数 | |||
| //商户基础参数 | |||
| $this->params = new DataArray([ | |||
| 'appid' => $this->config->get('appid'), | |||
| 'mch_id' => $this->config->get('mch_id'), | |||
| 'nonce_str' => Tools::createNoncestr(), | |||
| ]); | |||
| // 商户参数支持 | |||
| //商户参数支持 | |||
| if ($this->config->get('sub_appid')) { | |||
| $this->params->set('sub_appid', $this->config->get('sub_appid')); | |||
| } | |||
| @@ -62,7 +58,6 @@ class BasicWePay | |||
| $this->params->set('sub_mch_id', $this->config->get('sub_mch_id')); | |||
| } | |||
| } | |||
| /** | |||
| * 静态创建对象 | |||
| * @param array $config | |||
| @@ -70,11 +65,10 @@ class BasicWePay | |||
| */ | |||
| public static function instance(array $config) | |||
| { | |||
| $key = md5(get_called_class() . serialize($config)); | |||
| $key = md5(get_called_class().serialize($config)); | |||
| if (isset(self::$cache[$key])) return self::$cache[$key]; | |||
| return self::$cache[$key] = new static($config); | |||
| } | |||
| /** | |||
| * 获取微信支付通知 | |||
| * @return array | |||
| @@ -88,7 +82,6 @@ class BasicWePay | |||
| } | |||
| throw new InvalidResponseException('Invalid Notify.', '0'); | |||
| } | |||
| /** | |||
| * 获取微信支付通知回复内容 | |||
| * @return string | |||
| @@ -97,7 +90,6 @@ class BasicWePay | |||
| { | |||
| return Tools::arr2xml(['return_code' => 'SUCCESS', 'return_msg' => 'OK']); | |||
| } | |||
| /** | |||
| * 生成支付签名 | |||
| * @param array $data 参与签名的数据 | |||
| @@ -113,13 +105,12 @@ class BasicWePay | |||
| if ('' === $v || null === $v) continue; | |||
| $buff .= "{$k}={$v}&"; | |||
| } | |||
| $buff .= ("key=" . $this->config->get('mch_key')); | |||
| $buff .= ("key=".$this->config->get('mch_key')); | |||
| if (strtoupper($signType) === 'MD5') { | |||
| return strtoupper(md5($buff)); | |||
| } | |||
| return strtoupper(hash_hmac('SHA256', $buff, $this->config->get('mch_key'))); | |||
| } | |||
| /** | |||
| * 转换短链接 | |||
| * @param string $longUrl 需要转换的URL,签名用原串,传输需URLencode | |||
| @@ -132,7 +123,6 @@ class BasicWePay | |||
| $url = 'https://api.mch.weixin.qq.com/tools/shorturl'; | |||
| return $this->callPostApi($url, ['long_url' => $longUrl]); | |||
| } | |||
| /** | |||
| * 数组直接转xml数据输出 | |||
| * @param array $data | |||
| @@ -147,7 +137,6 @@ class BasicWePay | |||
| } | |||
| echo $xml; | |||
| } | |||
| /** | |||
| * 以 Post 请求接口 | |||
| * @param string $url 请求 | |||
| @@ -170,8 +159,8 @@ class BasicWePay | |||
| if (is_string($option['ssl_p12']) && file_exists($option['ssl_p12'])) { | |||
| $content = file_get_contents($option['ssl_p12']); | |||
| if (openssl_pkcs12_read($content, $certs, $this->config->get('mch_id'))) { | |||
| $option['ssl_key'] = Tools::pushFile(md5($certs['pkey']) . '.pem', $certs['pkey']); | |||
| $option['ssl_cer'] = Tools::pushFile(md5($certs['cert']) . '.pem', $certs['cert']); | |||
| $option['ssl_key'] = Tools::pushFile(md5($certs['pkey']).'.pem', $certs['pkey']); | |||
| $option['ssl_cer'] = Tools::pushFile(md5($certs['cert']).'.pem', $certs['cert']); | |||
| } else throw new InvalidArgumentException("P12 certificate does not match MCH_ID --- ssl_p12"); | |||
| } | |||
| if (empty($option['ssl_cer']) || !file_exists($option['ssl_cer'])) { | |||
| @@ -192,3 +181,4 @@ class BasicWePay | |||
| return $result; | |||
| } | |||
| } | |||
| ?> | |||
| @@ -17,12 +17,12 @@ class BasicWeWork extends BasicWeChat | |||
| public function getAccessToken() | |||
| { | |||
| if ($this->access_token) return $this->access_token; | |||
| $ckey = $this->config->get('appid') . '_access_token'; | |||
| $ckey = $this->config->get('appid').'_access_token'; | |||
| if ($this->access_token = Tools::getCache($ckey)) return $this->access_token; | |||
| list($appid, $secret) = [$this->config->get('appid'), $this->config->get('appsecret')]; | |||
| $result = Tools::json2arr(Tools::get("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={$appid}&corpsecret={$secret}")); | |||
| if (isset($result['access_token']) && $result['access_token']) Tools::setCache($ckey, $result['access_token'], 7000); | |||
| return $this->access_token = $result['access_token']; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,20 +2,17 @@ | |||
| namespace WeChat\Contracts; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use ArrayAccess; | |||
| /** | |||
| * Class DataArray | |||
| * @package WeChat | |||
| */ | |||
| class DataArray implements ArrayAccess | |||
| { | |||
| /** | |||
| * 当前配置值 | |||
| * @var array | |||
| */ | |||
| private $config = []; | |||
| /** | |||
| * Config constructor. | |||
| * @param array $options | |||
| @@ -24,7 +21,6 @@ class DataArray implements ArrayAccess | |||
| { | |||
| $this->config = $options; | |||
| } | |||
| /** | |||
| * 设置配置项值 | |||
| * @param string $offset | |||
| @@ -34,7 +30,6 @@ class DataArray implements ArrayAccess | |||
| { | |||
| $this->offsetSet($offset, $value); | |||
| } | |||
| /** | |||
| * 获取配置项参数 | |||
| * @param string|null $offset | |||
| @@ -44,7 +39,6 @@ class DataArray implements ArrayAccess | |||
| { | |||
| return $this->offsetGet($offset); | |||
| } | |||
| /** | |||
| * 合并数据到对象 | |||
| * @param array $data 需要合并的数据 | |||
| @@ -58,7 +52,6 @@ class DataArray implements ArrayAccess | |||
| } | |||
| return array_merge($this->config, $data); | |||
| } | |||
| /** | |||
| * 设置配置项值 | |||
| * @param string $offset | |||
| @@ -73,7 +66,6 @@ class DataArray implements ArrayAccess | |||
| $this->config[$offset] = $value; | |||
| } | |||
| } | |||
| /** | |||
| * 判断配置Key是否存在 | |||
| * @param string $offset | |||
| @@ -84,7 +76,6 @@ class DataArray implements ArrayAccess | |||
| { | |||
| return isset($this->config[$offset]); | |||
| } | |||
| /** | |||
| * 清理配置项 | |||
| * @param string|null $offset | |||
| @@ -98,7 +89,6 @@ class DataArray implements ArrayAccess | |||
| unset($this->config[$offset]); | |||
| } | |||
| } | |||
| /** | |||
| * 获取配置项参数 | |||
| * @param string|null $offset | |||
| @@ -112,4 +102,5 @@ class DataArray implements ArrayAccess | |||
| } | |||
| return isset($this->config[$offset]) ? $this->config[$offset] : null; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -167,7 +167,6 @@ class DataError | |||
| 9001035 => '设备申请参数不合法', | |||
| 9001036 => '查询起始值 begin 不合法', | |||
| ]; | |||
| /** | |||
| * 异常代码解析描述 | |||
| * @param string $code | |||
| @@ -177,5 +176,5 @@ class DataError | |||
| { | |||
| return isset(self::$message[$code]) ? self::$message[$code] : $code; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -1,7 +1,6 @@ | |||
| <?php | |||
| namespace WeChat\Contracts; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * 自定义CURL文件类 | |||
| * Class MyCurlFile | |||
| @@ -14,7 +13,6 @@ class MyCurlFile extends \stdClass | |||
| * @var string | |||
| */ | |||
| public $datatype = 'MY_CURL_FILE'; | |||
| /** | |||
| * MyCurlFile constructor. | |||
| * @param string|array $filename | |||
| @@ -34,10 +32,9 @@ class MyCurlFile extends \stdClass | |||
| if (empty($this->mimetype)) $this->mimetype = Tools::getExtMine($this->extension); | |||
| if (empty($this->postname)) $this->postname = pathinfo($filename, PATHINFO_BASENAME); | |||
| $this->content = base64_encode(file_get_contents($filename)); | |||
| $this->tempname = md5($this->content) . ".{$this->extension}"; | |||
| $this->tempname = md5($this->content).".{$this->extension}"; | |||
| } | |||
| } | |||
| /** | |||
| * 获取文件上传信息 | |||
| * @return \CURLFile|string | |||
| @@ -52,14 +49,13 @@ class MyCurlFile extends \stdClass | |||
| return "@{$this->tempname};filename={$this->postname};type={$this->mimetype}"; | |||
| } | |||
| } | |||
| /** | |||
| * 通用销毁函数清理缓存文件 | |||
| * 提前删除过期因此放到了网络请求之后 | |||
| */ | |||
| public function __destruct() | |||
| { | |||
| // Tools::delCache($this->tempname); | |||
| //Tools::delCache($this->tempname); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -6,9 +6,7 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| */ | |||
| class PKCS7Encoder | |||
| { | |||
| public static $blockSize = 32; | |||
| /** | |||
| * 对需要加密的明文进行填充补位 | |||
| * @param string $text 需要进行填充补位操作的明文 | |||
| @@ -24,9 +22,8 @@ class PKCS7Encoder | |||
| for ($index = 0; $index < $amount_to_pad; $index++) { | |||
| $tmp .= $pad_chr; | |||
| } | |||
| return $text . $tmp; | |||
| return $text.$tmp; | |||
| } | |||
| /** | |||
| * 对解密后的明文进行补位删除 | |||
| * @param string $text 解密后的明文 | |||
| @@ -40,18 +37,14 @@ class PKCS7Encoder | |||
| } | |||
| return substr($text, 0, strlen($text) - $pad); | |||
| } | |||
| } | |||
| /** | |||
| * 公众号消息 - 加解密 | |||
| * Class Prpcrypt | |||
| */ | |||
| class Prpcrypt | |||
| { | |||
| public $key; | |||
| /** | |||
| * Prpcrypt constructor. | |||
| * @param $key | |||
| @@ -60,7 +53,6 @@ class Prpcrypt | |||
| { | |||
| $this->key = base64_decode("{$key}="); | |||
| } | |||
| /** | |||
| * 对明文进行加密 | |||
| * @param string $text 需要加密的明文 | |||
| @@ -73,14 +65,13 @@ class Prpcrypt | |||
| $random = $this->getRandomStr(); | |||
| $iv = substr($this->key, 0, 16); | |||
| $pkcEncoder = new PKCS7Encoder(); | |||
| $text = $pkcEncoder->encode($random . pack("N", strlen($text)) . $text . $appid); | |||
| $text = $pkcEncoder->encode($random.pack("N", strlen($text)).$text.$appid); | |||
| $encrypted = openssl_encrypt($text, 'AES-256-CBC', substr($this->key, 0, 32), OPENSSL_ZERO_PADDING, $iv); | |||
| return [ErrorCode::$OK, $encrypted]; | |||
| } catch (Exception $e) { | |||
| return [ErrorCode::$EncryptAESError, null]; | |||
| } | |||
| } | |||
| /** | |||
| * 对密文进行解密 | |||
| * @param string $encrypted 需要解密的密文 | |||
| @@ -108,7 +99,6 @@ class Prpcrypt | |||
| return [ErrorCode::$IllegalBuffer, null]; | |||
| } | |||
| } | |||
| /** | |||
| * 随机生成16位字符串 | |||
| * @param string $str | |||
| @@ -123,9 +113,7 @@ class Prpcrypt | |||
| } | |||
| return $str; | |||
| } | |||
| } | |||
| /** | |||
| * 仅用作类内部使用 | |||
| * 不用于官方API接口的errCode码 | |||
| @@ -160,7 +148,6 @@ class ErrorCode | |||
| '40010' => 'Base64解码失败', | |||
| '40011' => '公众帐号生成回包xml失败', | |||
| ]; | |||
| /** | |||
| * 获取错误消息内容 | |||
| * @param string $code 错误代码 | |||
| @@ -173,5 +160,5 @@ class ErrorCode | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| ?> | |||
| @@ -4,7 +4,6 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Exceptions\InvalidArgumentException; | |||
| use WeChat\Exceptions\InvalidResponseException; | |||
| use WeChat\Exceptions\LocalCacheException; | |||
| /** | |||
| * 网络请求支持 | |||
| * Class Tools | |||
| @@ -17,24 +16,21 @@ class Tools | |||
| * @var null | |||
| */ | |||
| public static $cache_path = null; | |||
| /** | |||
| * 缓存写入操作 | |||
| * @var array | |||
| */ | |||
| public static $cache_callable = [ | |||
| 'set' => null, // 写入缓存 | |||
| 'get' => null, // 获取缓存 | |||
| 'del' => null, // 删除缓存 | |||
| 'put' => null, // 写入文件 | |||
| 'set' => null,//写入缓存 | |||
| 'get' => null,//获取缓存 | |||
| 'del' => null,//删除缓存 | |||
| 'put' => null,//写入文件 | |||
| ]; | |||
| /** | |||
| * 网络缓存 | |||
| * @var array | |||
| */ | |||
| private static $cache_curl = []; | |||
| /** | |||
| * 产生随机字符串 | |||
| * @param int $length 指定字符长度 | |||
| @@ -49,8 +45,6 @@ class Tools | |||
| } | |||
| return $str; | |||
| } | |||
| /** | |||
| * 根据文件后缀获取文件类型 | |||
| * @param string|array $ext 文件后缀 | |||
| @@ -66,7 +60,6 @@ class Tools | |||
| } | |||
| return join(',', array_unique($mine)); | |||
| } | |||
| /** | |||
| * 获取所有文件扩展的类型 | |||
| * @return array | |||
| @@ -83,7 +76,6 @@ class Tools | |||
| } | |||
| return $mines; | |||
| } | |||
| /** | |||
| * 创建CURL文件对象 | |||
| * @param mixed $filename | |||
| @@ -105,7 +97,6 @@ class Tools | |||
| } | |||
| return $filename; | |||
| } | |||
| /** | |||
| * 数组转XML内容 | |||
| * @param array $data | |||
| @@ -113,9 +104,8 @@ class Tools | |||
| */ | |||
| public static function arr2xml($data) | |||
| { | |||
| return "<xml>" . self::_arr2xml($data) . "</xml>"; | |||
| return "<xml>".self::_arr2xml($data)."</xml>"; | |||
| } | |||
| /** | |||
| * XML内容生成 | |||
| * @param array $data 数据 | |||
| @@ -130,7 +120,7 @@ class Tools | |||
| if (is_array($val) || is_object($val)) { | |||
| $content .= self::_arr2xml($val); | |||
| } elseif (is_string($val)) { | |||
| $content .= '<![CDATA[' . preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/", '', $val) . ']]>'; | |||
| $content .= '<![CDATA['.preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/", '', $val).']]>'; | |||
| } else { | |||
| $content .= $val; | |||
| } | |||
| @@ -138,7 +128,6 @@ class Tools | |||
| } | |||
| return $content; | |||
| } | |||
| /** | |||
| * 解析XML内容到数组 | |||
| * @param string $xml | |||
| @@ -155,7 +144,6 @@ class Tools | |||
| } | |||
| return json_decode(json_encode($data), true); | |||
| } | |||
| /** | |||
| * 解析XML文本内容 | |||
| * @param string $xml | |||
| @@ -166,7 +154,6 @@ class Tools | |||
| $state = xml_parse($parser = xml_parser_create(), $xml, true); | |||
| return xml_parser_free($parser) && $state ? self::xml2arr($xml) : false; | |||
| } | |||
| /** | |||
| * 数组转xml内容 | |||
| * @param array $data | |||
| @@ -177,7 +164,6 @@ class Tools | |||
| $json = json_encode($data, JSON_UNESCAPED_UNICODE); | |||
| return $json === '[]' ? '{}' : $json; | |||
| } | |||
| /** | |||
| * 数组对象Emoji编译处理 | |||
| * @param array $data | |||
| @@ -196,7 +182,6 @@ class Tools | |||
| } | |||
| return $data; | |||
| } | |||
| /** | |||
| * 数组对象Emoji反解析处理 | |||
| * @param array $data | |||
| @@ -215,7 +200,6 @@ class Tools | |||
| } | |||
| return $data; | |||
| } | |||
| /** | |||
| * Emoji原形转换为String | |||
| * @param string $content | |||
| @@ -227,7 +211,6 @@ class Tools | |||
| return addslashes($string[0]); | |||
| }, json_encode($content))); | |||
| } | |||
| /** | |||
| * Emoji字符串转换为原形 | |||
| * @param string $content | |||
| @@ -239,7 +222,6 @@ class Tools | |||
| return '\\'; | |||
| }, json_encode($content))); | |||
| } | |||
| /** | |||
| * 解析JSON内容到数组 | |||
| * @param string $json | |||
| @@ -257,7 +239,6 @@ class Tools | |||
| } | |||
| return $result; | |||
| } | |||
| /** | |||
| * 以get访问模拟访问 | |||
| * @param string $url 访问URL | |||
| @@ -271,7 +252,6 @@ class Tools | |||
| $options['query'] = $query; | |||
| return self::doRequest('get', $url, $options); | |||
| } | |||
| /** | |||
| * 以post访问模拟访问 | |||
| * @param string $url 访问URL | |||
| @@ -285,7 +265,6 @@ class Tools | |||
| $options['data'] = $data; | |||
| return self::doRequest('post', $url, $options); | |||
| } | |||
| /** | |||
| * CURL模拟网络请求 | |||
| * @param string $method 请求方法 | |||
| @@ -297,25 +276,25 @@ class Tools | |||
| public static function doRequest($method, $url, $options = []) | |||
| { | |||
| $curl = curl_init(); | |||
| // GET参数设置 | |||
| //GET参数设置 | |||
| if (!empty($options['query'])) { | |||
| $url .= (stripos($url, '?') !== false ? '&' : '?') . http_build_query($options['query']); | |||
| $url .= (stripos($url, '?') !== false ? '&' : '?').http_build_query($options['query']); | |||
| } | |||
| // CURL头信息设置 | |||
| //CURL头信息设置 | |||
| if (!empty($options['headers'])) { | |||
| curl_setopt($curl, CURLOPT_HTTPHEADER, $options['headers']); | |||
| } | |||
| // POST数据设置 | |||
| //POST数据设置 | |||
| if (strtolower($method) === 'post') { | |||
| curl_setopt($curl, CURLOPT_POST, true); | |||
| curl_setopt($curl, CURLOPT_POSTFIELDS, self::_buildHttpData($options['data'])); | |||
| } | |||
| // 证书文件设置 | |||
| //证书文件设置 | |||
| if (!empty($options['ssl_cer'])) if (file_exists($options['ssl_cer'])) { | |||
| curl_setopt($curl, CURLOPT_SSLCERTTYPE, 'PEM'); | |||
| curl_setopt($curl, CURLOPT_SSLCERT, $options['ssl_cer']); | |||
| } else throw new InvalidArgumentException("Certificate files that do not exist. --- [ssl_cer]"); | |||
| // 证书文件设置 | |||
| //证书文件设置 | |||
| if (!empty($options['ssl_key'])) if (file_exists($options['ssl_key'])) { | |||
| curl_setopt($curl, CURLOPT_SSLKEYTYPE, 'PEM'); | |||
| curl_setopt($curl, CURLOPT_SSLKEY, $options['ssl_key']); | |||
| @@ -327,14 +306,13 @@ class Tools | |||
| curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |||
| curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); | |||
| list($content) = [curl_exec($curl), curl_close($curl)]; | |||
| // 清理 CURL 缓存文件 | |||
| //清理 CURL 缓存文件 | |||
| if (!empty(self::$cache_curl)) foreach (self::$cache_curl as $key => $file) { | |||
| Tools::delCache($file); | |||
| unset(self::$cache_curl[$key]); | |||
| } | |||
| return $content; | |||
| } | |||
| /** | |||
| * POST数据过滤处理 | |||
| * @param array $data 需要处理的数据 | |||
| @@ -365,7 +343,6 @@ class Tools | |||
| } | |||
| return $build ? http_build_query($data) : $data; | |||
| } | |||
| /** | |||
| * 写入文件 | |||
| * @param string $name 文件名称 | |||
| @@ -384,7 +361,6 @@ class Tools | |||
| } | |||
| return $file; | |||
| } | |||
| /** | |||
| * 缓存配置与存储 | |||
| * @param string $name 缓存名称 | |||
| @@ -405,7 +381,6 @@ class Tools | |||
| } | |||
| return $file; | |||
| } | |||
| /** | |||
| * 获取缓存内容 | |||
| * @param string $name 缓存名称 | |||
| @@ -426,7 +401,6 @@ class Tools | |||
| } | |||
| return null; | |||
| } | |||
| /** | |||
| * 移除缓存文件 | |||
| * @param string $name 缓存名称 | |||
| @@ -440,7 +414,6 @@ class Tools | |||
| $file = self::_getCacheName($name); | |||
| return !file_exists($file) || @unlink($file); | |||
| } | |||
| /** | |||
| * 应用缓存目录 | |||
| * @param string $name | |||
| @@ -449,10 +422,11 @@ class Tools | |||
| private static function _getCacheName($name) | |||
| { | |||
| if (empty(self::$cache_path)) { | |||
| self::$cache_path = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR; | |||
| self::$cache_path = dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'Cache'.DIRECTORY_SEPARATOR; | |||
| } | |||
| self::$cache_path = rtrim(self::$cache_path, '/\\') . DIRECTORY_SEPARATOR; | |||
| self::$cache_path = rtrim(self::$cache_path, '/\\').DIRECTORY_SEPARATOR; | |||
| file_exists(self::$cache_path) || mkdir(self::$cache_path, 0755, true); | |||
| return self::$cache_path . $name; | |||
| return self::$cache_path.$name; | |||
| } | |||
| } | |||
| ?> | |||
| @@ -3,7 +3,6 @@ namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| use WeChat\Contracts\Tools; | |||
| /** | |||
| * 客服消息处理 | |||
| * Class Custom | |||
| @@ -26,7 +25,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 修改客服帐号 | |||
| * @param string $kf_account 客服账号 | |||
| @@ -42,7 +40,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 删除客服帐号 | |||
| * @param string $kf_account 客服账号 | |||
| @@ -57,7 +54,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 邀请绑定客服帐号 | |||
| * @param string $kf_account 完整客服帐号,格式为:帐号前缀@公众号微信号 | |||
| @@ -71,7 +67,6 @@ class Custom extends BasicWeChat | |||
| $url = 'https://api.weixin.qq.com/customservice/kfaccount/inviteworker?access_token=ACCESS_TOKEN'; | |||
| return $this->callPostApi($url, ['kf_account' => $kf_account, 'invite_wx' => $invite_wx]); | |||
| } | |||
| /** | |||
| * 获取所有客服账号 | |||
| * @return array | |||
| @@ -84,7 +79,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 设置客服帐号的头像 | |||
| * @param string $kf_account 客户账号 | |||
| @@ -99,7 +93,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($image)]); | |||
| } | |||
| /** | |||
| * 客服接口-发消息 | |||
| * @param array $data | |||
| @@ -113,7 +106,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 客服输入状态 | |||
| * @param string $openid 普通用户(openid) | |||
| @@ -128,7 +120,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['touser' => $openid, 'command' => $command]); | |||
| } | |||
| /** | |||
| * 根据标签进行群发【订阅号与服务号认证后均可用】 | |||
| * @param array $data | |||
| @@ -142,7 +133,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 根据OpenID列表群发【订阅号不可用,服务号认证后可用】 | |||
| * @param array $data | |||
| @@ -156,7 +146,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 删除群发【订阅号与服务号认证后均可用】 | |||
| * @param integer $msg_id 发送出去的消息ID | |||
| @@ -173,7 +162,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 预览接口【订阅号与服务号认证后均可用】 | |||
| * @param array $data | |||
| @@ -187,7 +175,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 查询群发消息发送状态【订阅号与服务号认证后均可用】 | |||
| * @param integer $msg_id 群发消息后返回的消息id | |||
| @@ -201,7 +188,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['msg_id' => $msg_id]); | |||
| } | |||
| /** | |||
| * 获取群发速度 | |||
| * @return array | |||
| @@ -214,7 +200,6 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, []); | |||
| } | |||
| /** | |||
| * 设置群发速度 | |||
| * @param integer $speed 群发速度的级别 | |||
| @@ -228,6 +213,5 @@ class Custom extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['speed' => $speed]); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 微信草稿箱管理 | |||
| * Class Draft | |||
| @@ -24,7 +23,6 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['articles' => $articles]); | |||
| } | |||
| /** | |||
| * 获取草稿 | |||
| * @param string $media_id | |||
| @@ -39,8 +37,6 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media_id' => $media_id]); | |||
| } | |||
| /** | |||
| * 删除草稿 | |||
| * @param string $media_id | |||
| @@ -54,7 +50,6 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media_id' => $media_id]); | |||
| } | |||
| /** | |||
| * 新增图文素材 | |||
| * @param array $data 文件名称 | |||
| @@ -68,7 +63,6 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 修改草稿 | |||
| * @param string $media_id 要修改的图文消息的id | |||
| @@ -85,7 +79,6 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 获取草稿总数 | |||
| * @return array | |||
| @@ -98,7 +91,6 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 获取草稿列表 | |||
| * @param int $offset 从全部素材的该偏移位置开始返回,0表示从第一个素材返回 | |||
| @@ -114,5 +106,5 @@ class Draft extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['no_content' => $no_content, 'offset' => $offset, 'count' => $count]); | |||
| } | |||
| } | |||
| ?> | |||
| @@ -12,7 +12,6 @@ class InvalidArgumentException extends \InvalidArgumentException | |||
| * @var array | |||
| */ | |||
| public $raw = []; | |||
| /** | |||
| * InvalidArgumentException constructor. | |||
| * @param string $message | |||
| @@ -24,4 +23,5 @@ class InvalidArgumentException extends \InvalidArgumentException | |||
| parent::__construct($message, intval($code)); | |||
| $this->raw = $raw; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -12,7 +12,6 @@ class InvalidDecryptException extends \Exception | |||
| * @var array | |||
| */ | |||
| public $raw = []; | |||
| /** | |||
| * InvalidDecryptException constructor. | |||
| * @param string $message | |||
| @@ -24,4 +23,5 @@ class InvalidDecryptException extends \Exception | |||
| parent::__construct($message, intval($code)); | |||
| $this->raw = $raw; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -12,7 +12,6 @@ class InvalidInstanceException extends \Exception | |||
| * @var array | |||
| */ | |||
| public $raw = []; | |||
| /** | |||
| * InvalidResponseException constructor. | |||
| * @param string $message | |||
| @@ -24,4 +23,5 @@ class InvalidInstanceException extends \Exception | |||
| parent::__construct($message, intval($code)); | |||
| $this->raw = $raw; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -12,7 +12,6 @@ class InvalidResponseException extends \Exception | |||
| * @var array | |||
| */ | |||
| public $raw = []; | |||
| /** | |||
| * InvalidResponseException constructor. | |||
| * @param string $message | |||
| @@ -24,5 +23,5 @@ class InvalidResponseException extends \Exception | |||
| parent::__construct($message, intval($code)); | |||
| $this->raw = $raw; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -8,12 +8,10 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| */ | |||
| class LocalCacheException extends \Exception | |||
| { | |||
| /** | |||
| * @var array | |||
| */ | |||
| public $raw = []; | |||
| /** | |||
| * LocalCacheException constructor. | |||
| * @param string $message | |||
| @@ -25,5 +23,5 @@ class LocalCacheException extends \Exception | |||
| parent::__construct($message, intval($code)); | |||
| $this->raw = $raw; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 发布能力 | |||
| * Class Freepublish | |||
| @@ -25,7 +24,6 @@ class Freepublish extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media_id' => $media_id]); | |||
| } | |||
| /** | |||
| * 发布状态轮询接口 | |||
| * @param mixed $publish_id | |||
| @@ -39,7 +37,6 @@ class Freepublish extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['publish_id' => $publish_id]); | |||
| } | |||
| /** | |||
| * 删除发布 | |||
| * 发布成功之后,随时可以通过该接口删除。此操作不可逆,请谨慎操作。 | |||
| @@ -55,7 +52,6 @@ class Freepublish extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['article_id' => $article_id, 'index' => $index]); | |||
| } | |||
| /** | |||
| * 通过 article_id 获取已发布文章 | |||
| * @param mixed $article_id 要获取的草稿的article_id | |||
| @@ -69,7 +65,6 @@ class Freepublish extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['article_id' => $article_id]); | |||
| } | |||
| /** | |||
| * 获取成功发布列表 | |||
| * @param int $offset 从全部素材的该偏移位置开始返回,0表示从第一个素材返回 | |||
| @@ -85,4 +80,5 @@ class Freepublish extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['no_content' => $no_content, 'offset' => $offset, 'count' => $count]); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 接口调用频次限制 | |||
| * Class Limit | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicWeChat; | |||
| */ | |||
| class Limit extends BasicWeChat | |||
| { | |||
| /** | |||
| * 公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零 | |||
| * @return array | |||
| @@ -22,7 +20,6 @@ class Limit extends BasicWeChat | |||
| $url = 'https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN'; | |||
| return $this->callPostApi($url, ['appid' => $this->config->get('appid')]); | |||
| } | |||
| /** | |||
| * 网络检测 | |||
| * @param string $action 执行的检测动作 | |||
| @@ -36,7 +33,6 @@ class Limit extends BasicWeChat | |||
| $url = 'https://api.weixin.qq.com/cgi-bin/callback/check?access_token=ACCESS_TOKEN'; | |||
| return $this->callPostApi($url, ['action' => $action, 'check_operator' => $operator]); | |||
| } | |||
| /** | |||
| * 获取微信服务器IP地址 | |||
| * @return array | |||
| @@ -49,4 +45,5 @@ class Limit extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -4,7 +4,6 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| use WeChat\Contracts\Tools; | |||
| use WeChat\Exceptions\InvalidResponseException; | |||
| /** | |||
| * 微信素材管理 | |||
| * Class Media | |||
| @@ -29,7 +28,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename)], false); | |||
| } | |||
| /** | |||
| * 获取临时素材 | |||
| * @param string $media_id | |||
| @@ -52,7 +50,6 @@ class Media extends BasicWeChat | |||
| } | |||
| return is_null($outType) ? $result : $outType($result); | |||
| } | |||
| /** | |||
| * 新增图文素材 | |||
| * @param array $data 文件名称 | |||
| @@ -66,7 +63,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 更新图文素材 | |||
| * @param string $media_id 要修改的图文消息的id | |||
| @@ -83,7 +79,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 上传图文消息内的图片获取URL | |||
| * @param mixed $filename | |||
| @@ -97,7 +92,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename)], false); | |||
| } | |||
| /** | |||
| * 新增其他类型永久素材 | |||
| * @param mixed $filename 文件名称 | |||
| @@ -116,7 +110,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename), 'description' => Tools::arr2json($description)], false); | |||
| } | |||
| /** | |||
| * 获取永久素材 | |||
| * @param string $media_id | |||
| @@ -139,7 +132,6 @@ class Media extends BasicWeChat | |||
| } | |||
| return is_null($outType) ? $result : $outType($result); | |||
| } | |||
| /** | |||
| * 删除永久素材 | |||
| * @param string $media_id | |||
| @@ -153,7 +145,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['media_id' => $media_id]); | |||
| } | |||
| /** | |||
| * 获取素材总数 | |||
| * @return array | |||
| @@ -166,7 +157,6 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 获取素材列表 | |||
| * @param string $type | |||
| @@ -185,4 +175,5 @@ class Media extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['type' => $type, 'offset' => $offset, 'count' => $count]); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 微信菜单管理 | |||
| * Class Menu | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicWeChat; | |||
| */ | |||
| class Menu extends BasicWeChat | |||
| { | |||
| /** | |||
| * 自定义菜单查询接口 | |||
| * @return array | |||
| @@ -23,7 +21,6 @@ class Menu extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 自定义菜单删除接口 | |||
| * @return array | |||
| @@ -36,7 +33,6 @@ class Menu extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 自定义菜单创建 | |||
| * @param array $data | |||
| @@ -50,7 +46,6 @@ class Menu extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 创建个性化菜单 | |||
| * @param array $data | |||
| @@ -64,7 +59,6 @@ class Menu extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 删除个性化菜单 | |||
| * @param string $menuid | |||
| @@ -78,7 +72,6 @@ class Menu extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['menuid' => $menuid]); | |||
| } | |||
| /** | |||
| * 测试个性化菜单匹配结果 | |||
| * @param string $openid | |||
| @@ -92,4 +85,5 @@ class Menu extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['user_id' => $openid]); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 微信网页授权 | |||
| * Class Oauth | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicWeChat; | |||
| */ | |||
| class Oauth extends BasicWeChat | |||
| { | |||
| /** | |||
| * Oauth 授权跳转接口 | |||
| * @param string $redirect_url 授权回跳地址 | |||
| @@ -24,7 +22,6 @@ class Oauth extends BasicWeChat | |||
| $redirect_uri = urlencode($redirect_url); | |||
| return "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appid}&redirect_uri={$redirect_uri}&response_type=code&scope={$scope}&state={$state}#wechat_redirect"; | |||
| } | |||
| /** | |||
| * 通过 code 获取 AccessToken 和 openid | |||
| * @param string $code 授权Code值,不传则取GET参数 | |||
| @@ -40,7 +37,6 @@ class Oauth extends BasicWeChat | |||
| $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$appsecret}&code={$code}&grant_type=authorization_code"; | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 刷新AccessToken并续期 | |||
| * @param string $refresh_token | |||
| @@ -54,7 +50,6 @@ class Oauth extends BasicWeChat | |||
| $url = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={$appid}&grant_type=refresh_token&refresh_token={$refresh_token}"; | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 检验授权凭证(access_token)是否有效 | |||
| * @param string $access_token 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同 | |||
| @@ -68,7 +63,6 @@ class Oauth extends BasicWeChat | |||
| $url = "https://api.weixin.qq.com/sns/auth?access_token={$access_token}&openid={$openid}"; | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 拉取用户信息(需scope为 snsapi_userinfo) | |||
| * @param string $access_token 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同 | |||
| @@ -84,3 +78,4 @@ class Oauth extends BasicWeChat | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| } | |||
| ?> | |||
| @@ -7,7 +7,6 @@ use WePay\Order; | |||
| use WePay\Refund; | |||
| use WePay\Transfers; | |||
| use WePay\TransfersBank; | |||
| /** | |||
| * 微信支付商户 | |||
| * Class Pay | |||
| @@ -15,7 +14,6 @@ use WePay\TransfersBank; | |||
| */ | |||
| class Pay extends BasicWePay | |||
| { | |||
| /** | |||
| * 统一下单 | |||
| * @param array $options | |||
| @@ -27,7 +25,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->create($options); | |||
| } | |||
| /** | |||
| * 刷卡支付 | |||
| * @param array $options | |||
| @@ -39,7 +36,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->micropay($options); | |||
| } | |||
| /** | |||
| * 创建JsApi及H5支付参数 | |||
| * @param string $prepay_id 统一下单预支付码 | |||
| @@ -49,7 +45,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->jsapiParams($prepay_id); | |||
| } | |||
| /** | |||
| * 获取APP支付参数 | |||
| * @param string $prepay_id 统一下单预支付码 | |||
| @@ -59,7 +54,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->appParams($prepay_id); | |||
| } | |||
| /** | |||
| * 获取支付规则二维码 | |||
| * @param string $product_id 商户定义的商品id 或者订单号 | |||
| @@ -69,7 +63,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->qrcParams($product_id); | |||
| } | |||
| /** | |||
| * 查询订单 | |||
| * @param array $options | |||
| @@ -81,7 +74,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->query($options); | |||
| } | |||
| /** | |||
| * 关闭订单 | |||
| * @param string $out_trade_no 商户订单号 | |||
| @@ -93,7 +85,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->close($out_trade_no); | |||
| } | |||
| /** | |||
| * 申请退款 | |||
| * @param array $options | |||
| @@ -105,7 +96,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Refund::instance($this->config->get())->create($options); | |||
| } | |||
| /** | |||
| * 查询退款 | |||
| * @param array $options | |||
| @@ -117,7 +107,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Refund::instance($this->config->get())->query($options); | |||
| } | |||
| /** | |||
| * 交易保障 | |||
| * @param array $options | |||
| @@ -129,7 +118,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->report($options); | |||
| } | |||
| /** | |||
| * 授权码查询openid | |||
| * @param string $authCode 扫码支付授权码,设备读取用户微信中的条码或者二维码信息 | |||
| @@ -141,7 +129,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Order::instance($this->config->get())->queryAuthCode($authCode); | |||
| } | |||
| /** | |||
| * 下载对账单 | |||
| * @param array $options 静音参数 | |||
| @@ -154,7 +141,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Bill::instance($this->config->get())->download($options, $outType); | |||
| } | |||
| /** | |||
| * 拉取订单评价数据 | |||
| * @param array $options | |||
| @@ -166,7 +152,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Bill::instance($this->config->get())->comment($options); | |||
| } | |||
| /** | |||
| * 企业付款到零钱 | |||
| * @param array $options | |||
| @@ -178,7 +163,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Transfers::instance($this->config->get())->create($options); | |||
| } | |||
| /** | |||
| * 查询企业付款到零钱 | |||
| * @param string $partner_trade_no 商户调用企业付款API时使用的商户订单号 | |||
| @@ -190,7 +174,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return Transfers::instance($this->config->get())->query($partner_trade_no); | |||
| } | |||
| /** | |||
| * 企业付款到银行卡 | |||
| * @param array $options | |||
| @@ -203,7 +186,6 @@ class Pay extends BasicWePay | |||
| { | |||
| return TransfersBank::instance($this->config->get())->create($options); | |||
| } | |||
| /** | |||
| * 商户企业付款到银行卡操作进行结果查询 | |||
| * @param string $partner_trade_no 商户订单号,需保持唯一 | |||
| @@ -215,4 +197,5 @@ class Pay extends BasicWePay | |||
| { | |||
| return TransfersBank::instance($this->config->get())->query($partner_trade_no); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 商店管理 | |||
| * Class Product | |||
| @@ -26,7 +25,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 设置测试人员白名单 | |||
| * @param array $openids 测试人员的openid列表 | |||
| @@ -42,7 +40,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 获取商品二维码 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -61,7 +58,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 查询商品信息 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -78,7 +74,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 批量查询商品信息 | |||
| * @param integer $offset 批量查询的起始位置,从0开始,包含该起始位置 | |||
| @@ -98,7 +93,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 更新商品信息 | |||
| * @param array $data | |||
| @@ -112,7 +106,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 清除商品信息 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -127,7 +120,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]); | |||
| } | |||
| /** | |||
| * 检查wxticket参数 | |||
| * @param string $ticket | |||
| @@ -141,7 +133,6 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['ticket' => $ticket]); | |||
| } | |||
| /** | |||
| * 清除扫码记录 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -158,5 +149,5 @@ class Product extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 二维码管理 | |||
| * Class Qrcode | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicWeChat; | |||
| */ | |||
| class Qrcode extends BasicWeChat | |||
| { | |||
| /** | |||
| * 创建二维码ticket | |||
| * @param string|integer $scene 场景 | |||
| @@ -21,22 +19,21 @@ class Qrcode extends BasicWeChat | |||
| */ | |||
| public function create($scene, $expire_seconds = 0) | |||
| { | |||
| if (is_integer($scene)) { // 二维码场景类型 | |||
| if (is_integer($scene)) { //二维码场景类型 | |||
| $data = ['action_info' => ['scene' => ['scene_id' => $scene]]]; | |||
| } else { | |||
| $data = ['action_info' => ['scene' => ['scene_str' => $scene]]]; | |||
| } | |||
| if ($expire_seconds > 0) { // 临时二维码 | |||
| if ($expire_seconds > 0) { //临时二维码 | |||
| $data['expire_seconds'] = $expire_seconds; | |||
| $data['action_name'] = is_integer($scene) ? 'QR_SCENE' : 'QR_STR_SCENE'; | |||
| } else { // 永久二维码 | |||
| } else { //永久二维码 | |||
| $data['action_name'] = is_integer($scene) ? 'QR_LIMIT_SCENE' : 'QR_LIMIT_STR_SCENE'; | |||
| } | |||
| $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=ACCESS_TOKEN"; | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 通过ticket换取二维码 | |||
| * @param string $ticket 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码。 | |||
| @@ -44,9 +41,8 @@ class Qrcode extends BasicWeChat | |||
| */ | |||
| public function url($ticket) | |||
| { | |||
| return "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . urlencode($ticket); | |||
| return "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=".urlencode($ticket); | |||
| } | |||
| /** | |||
| * 长链接转短链接接口 | |||
| * @param string $longUrl 需要转换的长链接 | |||
| @@ -60,4 +56,5 @@ class Qrcode extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['action' => 'long2short', 'long_url' => $longUrl]); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicPushEvent; | |||
| /** | |||
| * 公众号推送管理 | |||
| * Class Receive | |||
| @@ -10,7 +9,6 @@ use WeChat\Contracts\BasicPushEvent; | |||
| */ | |||
| class Receive extends BasicPushEvent | |||
| { | |||
| /** | |||
| * 转发多客服消息 | |||
| * @param string $account | |||
| @@ -27,7 +25,6 @@ class Receive extends BasicPushEvent | |||
| empty($account) || $this->message['TransInfo'] = ['KfAccount' => $account]; | |||
| return $this; | |||
| } | |||
| /** | |||
| * 设置文本消息 | |||
| * @param string $content 文本内容 | |||
| @@ -44,7 +41,6 @@ class Receive extends BasicPushEvent | |||
| ]; | |||
| return $this; | |||
| } | |||
| /** | |||
| * 设置回复图文 | |||
| * @param array $newsData | |||
| @@ -62,7 +58,6 @@ class Receive extends BasicPushEvent | |||
| ]; | |||
| return $this; | |||
| } | |||
| /** | |||
| * 设置图片消息 | |||
| * @param string $mediaId 图片媒体ID | |||
| @@ -79,7 +74,6 @@ class Receive extends BasicPushEvent | |||
| ]; | |||
| return $this; | |||
| } | |||
| /** | |||
| * 设置语音回复消息 | |||
| * @param string $mediaid 语音媒体ID | |||
| @@ -96,7 +90,6 @@ class Receive extends BasicPushEvent | |||
| ]; | |||
| return $this; | |||
| } | |||
| /** | |||
| * 设置视频回复消息 | |||
| * @param string $mediaid 视频媒体ID | |||
| @@ -119,7 +112,6 @@ class Receive extends BasicPushEvent | |||
| ]; | |||
| return $this; | |||
| } | |||
| /** | |||
| * 设置音乐回复消息 | |||
| * @param string $title 音乐标题 | |||
| @@ -148,4 +140,5 @@ class Receive extends BasicPushEvent | |||
| } | |||
| return $this; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -2,7 +2,6 @@ | |||
| namespace WeChat; | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| use WeChat\Contracts\BasicWeChat; | |||
| /** | |||
| * 扫一扫接入管理 | |||
| * Class Scan | |||
| @@ -22,7 +21,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpGetForJson($url); | |||
| } | |||
| /** | |||
| * 创建商品 | |||
| * @param array $data | |||
| @@ -36,7 +34,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 商品发布 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -53,7 +50,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 设置测试人员白名单 | |||
| * @param array $openids 测试人员的openid列表 | |||
| @@ -69,7 +65,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 获取商品二维码 | |||
| * @param string $keystandard | |||
| @@ -88,7 +83,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 查询商品信息 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -103,7 +97,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]); | |||
| } | |||
| /** | |||
| * 批量查询商品信息 | |||
| * @param integer $offset 批量查询的起始位置,从0开始,包含该起始位置。 | |||
| @@ -123,7 +116,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 更新商品信息 | |||
| * @param array $data | |||
| @@ -137,7 +129,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, $data); | |||
| } | |||
| /** | |||
| * 清除商品信息 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -152,7 +143,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]); | |||
| } | |||
| /** | |||
| * 检查wxticket参数 | |||
| * @param string $ticket | |||
| @@ -166,7 +156,6 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['ticket' => $ticket]); | |||
| } | |||
| /** | |||
| * 清除扫码记录 | |||
| * @param string $keystandard 商品编码标准 | |||
| @@ -182,5 +171,5 @@ class Scan extends BasicWeChat | |||
| $this->registerApi($url, __FUNCTION__, func_get_args()); | |||
| return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr, 'extinfo' => $extinfo]); | |||
| } | |||
| } | |||
| } | |||
| ?> | |||