From f7ada31d50584cf0af276555229ef4a3f95025b7 Mon Sep 17 00:00:00 2001 From: jianyan74 Date: Fri, 15 Nov 2019 16:35:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/components/Bootstrap.php | 21 +- addons/RfMerchants/common/config/api.php | 2 +- addons/RfMerchants/common/config/backend.php | 396 +++--------------- addons/RfMerchants/common/config/merchant.php | 357 +--------------- addons/RfMerchants/common/enums/LevelEnum.php | 26 -- addons/RfMerchants/common/enums/MediaType.php | 26 -- .../enums/MenuClientPlatformTypeEnum.php | 26 -- .../common/enums/MenuLanguageEnum.php | 44 -- addons/RfMerchants/common/enums/MenuSex.php | 22 - .../RfMerchants/common/models/Attachment.php | 146 ------- .../common/models/AttachmentNews.php | 82 ---- .../common/models/DefaultModel.php | 21 + addons/RfMerchants/common/models/Fans.php | 122 ------ addons/RfMerchants/common/models/FansStat.php | 81 ---- .../RfMerchants/common/models/FansTagMap.php | 48 --- addons/RfMerchants/common/models/FansTags.php | 51 --- addons/RfMerchants/common/models/FormId.php | 67 --- .../RfMerchants/common/models/MassRecord.php | 89 ---- addons/RfMerchants/common/models/Menu.php | 188 --------- .../common/models/MenuProvinces.php | 51 --- .../RfMerchants/common/models/MsgHistory.php | 86 ---- addons/RfMerchants/common/models/Qrcode.php | 125 ------ .../RfMerchants/common/models/QrcodeStat.php | 83 ---- .../common/models/ReplyDefault.php | 55 --- addons/RfMerchants/common/models/Rule.php | 161 ------- .../RfMerchants/common/models/RuleKeyword.php | 71 ---- .../common/models/RuleKeywordStat.php | 122 ------ addons/RfMerchants/common/models/RuleStat.php | 102 ----- addons/RfMerchants/common/models/Setting.php | 65 --- .../RfMerchants/common/models/SettingForm.php | 4 +- .../common/queues/WechatTemplateMsgJob.php | 33 -- addons/RfWechat/common/config/backend.php | 10 + addons/RfWechat/common/config/merchant.php | 10 + 33 files changed, 104 insertions(+), 2689 deletions(-) delete mode 100644 addons/RfMerchants/common/enums/LevelEnum.php delete mode 100644 addons/RfMerchants/common/enums/MediaType.php delete mode 100644 addons/RfMerchants/common/enums/MenuClientPlatformTypeEnum.php delete mode 100644 addons/RfMerchants/common/enums/MenuLanguageEnum.php delete mode 100644 addons/RfMerchants/common/enums/MenuSex.php delete mode 100644 addons/RfMerchants/common/models/Attachment.php delete mode 100644 addons/RfMerchants/common/models/AttachmentNews.php create mode 100644 addons/RfMerchants/common/models/DefaultModel.php delete mode 100644 addons/RfMerchants/common/models/Fans.php delete mode 100644 addons/RfMerchants/common/models/FansStat.php delete mode 100644 addons/RfMerchants/common/models/FansTagMap.php delete mode 100644 addons/RfMerchants/common/models/FansTags.php delete mode 100644 addons/RfMerchants/common/models/FormId.php delete mode 100644 addons/RfMerchants/common/models/MassRecord.php delete mode 100644 addons/RfMerchants/common/models/Menu.php delete mode 100644 addons/RfMerchants/common/models/MenuProvinces.php delete mode 100644 addons/RfMerchants/common/models/MsgHistory.php delete mode 100644 addons/RfMerchants/common/models/Qrcode.php delete mode 100644 addons/RfMerchants/common/models/QrcodeStat.php delete mode 100644 addons/RfMerchants/common/models/ReplyDefault.php delete mode 100644 addons/RfMerchants/common/models/Rule.php delete mode 100644 addons/RfMerchants/common/models/RuleKeyword.php delete mode 100644 addons/RfMerchants/common/models/RuleKeywordStat.php delete mode 100644 addons/RfMerchants/common/models/RuleStat.php delete mode 100644 addons/RfMerchants/common/models/Setting.php delete mode 100644 addons/RfMerchants/common/queues/WechatTemplateMsgJob.php diff --git a/addons/RfMerchants/common/components/Bootstrap.php b/addons/RfMerchants/common/components/Bootstrap.php index 29dd005f4..6281e6db6 100644 --- a/addons/RfMerchants/common/components/Bootstrap.php +++ b/addons/RfMerchants/common/components/Bootstrap.php @@ -1,35 +1,24 @@ set('wechatServices', [ - 'class' => 'addons\RfWechat\services\Application', - ]); - // 注册资源 - if (in_array(Yii::$app->id, [AppEnum::MERCHANT, AppEnum::BACKEND])) { - AddonHelper::filePath(); - } } } \ No newline at end of file diff --git a/addons/RfMerchants/common/config/api.php b/addons/RfMerchants/common/config/api.php index 7d3cb2500..13446bea9 100644 --- a/addons/RfMerchants/common/config/api.php +++ b/addons/RfMerchants/common/config/api.php @@ -15,7 +15,7 @@ // ----------------------- 菜单配置 ----------------------- // 'menuConfig' => [ - 'location' => 'default', // default:系统顶部菜单;addons:应用中心菜单 + 'location' => 'addons', // default:系统顶部菜单;addons:应用中心菜单 'icon' => 'fa fa-puzzle-piece', ], diff --git a/addons/RfMerchants/common/config/backend.php b/addons/RfMerchants/common/config/backend.php index 099bf25ca..8707eb14e 100644 --- a/addons/RfMerchants/common/config/backend.php +++ b/addons/RfMerchants/common/config/backend.php @@ -4,284 +4,39 @@ // ----------------------- 权限配置 ----------------------- // 'authItem' => [ - [ - 'title' => '增强功能', - 'name' => 'function', - 'child' => [ - [ - 'title' => '自动回复', - 'name' => 'autoReply', - 'child' => [ - [ - 'title' => '关键字首页', - 'name' => 'rule/index', - ], - [ - 'title' => '关键字新增/编辑', - 'name' => 'rule/edit', - ], - [ - 'title' => '关键字删除', - 'name' => 'rule/delete', - ], - [ - 'title' => '关键字状态修改', - 'name' => 'rule/ajax-update', - ], - [ - 'title' => '非文字自动回复', - 'name' => 'setting/special-message', - ], - [ - 'title' => '关注/默认回复', - 'name' => 'reply-default/index', - ], - ], - ], - [ - 'title' => '自定义菜单', - 'name' => 'menu', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'menu/index', - ], - [ - 'title' => '新增/编辑', - 'name' => 'menu/edit', - ], - [ - 'title' => '删除', - 'name' => 'menu/delete', - ], - [ - 'title' => '状态修改', - 'name' => 'menu/ajax-update', - ], - [ - 'title' => '同步菜单', - 'name' => 'menu/sync', - ], - [ - 'title' => '生效并置顶', - 'name' => 'menu/save', - ], - ], - ], - [ - 'title' => '二维码/转化链接', - 'name' => 'qrCode', - 'child' => [ - [ - 'title' => '二维码管理', - 'name' => 'qrCodeManager', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'qrcode/index', - ], - [ - 'title' => '编辑', - 'name' => 'qrcode/edit', - ], - [ - 'title' => '新增', - 'name' => 'qrcode/add', - ], - [ - 'title' => '删除全部', - 'name' => 'qrcode/delete-all', - ], - [ - 'title' => '下载', - 'name' => 'qrcode/down', - ], - ], - ], - [ - 'title' => '扫描统计', - 'name' => 'qrCodeStatistical', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'qrcode-stat/index', - ], - [ - 'title' => '删除', - 'name' => 'qrcode-stat/delete', - ], - ], - ], - [ - 'title' => '长链接转二维码', - 'name' => 'qrCodeLongUrl', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'qrcode/long-url', - ], - [ - 'title' => '转化链接', - 'name' => 'qrcode/qr', - ], - ], - ] - ], - ], - ], - ], - [ - 'title' => '粉丝管理', - 'name' => 'fans', - 'child' => [ - [ - 'title' => '粉丝列表', - 'name' => 'fansManager', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'fans/index', - ], - [ - 'title' => '获取全部粉丝', - 'name' => 'fans/sync-all-openid', - ], - [ - 'title' => '同步', - 'name' => 'fans/sync', - ], - [ - 'title' => '标签分组', - 'name' => 'fans/move-tag', - ], - [ - 'title' => '发送消息', - 'name' => 'fans/send-message', - ], - [ - 'title' => '详情', - 'name' => 'fans/view', - ], - ] - ], - [ - 'title' => '粉丝标签', - 'name' => 'fansTags', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'fans-tags/index', - ], - [ - 'title' => '删除', - 'name' => 'fans-tags/delete', - ], - [ - 'title' => '同步', - 'name' => 'fans-tags/synchro', - ], - ] - ], - ] - ], - [ - 'title' => '素材库', - 'name' => 'attachment', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'attachment/index', - ], - [ - 'title' => '图文新增/编辑', - 'name' => 'attachment/news-edit', - ], - [ - 'title' => '图片/音频/视频新增', - 'name' => 'attachment/create', - ], - [ - 'title' => '删除', - 'name' => 'attachment/delete', - ], - [ - 'title' => '手机预览', - 'name' => 'attachment/preview', - ], - [ - 'title' => '消息群发', - 'name' => 'attachment/send', - ], - [ - 'title' => '同步', - 'name' => 'attachment/sync', - ], - ], - ], - [ - 'title' => '历史消息', - 'name' => 'msgHistory', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'msg-history/index', - ], - [ - 'title' => '删除', - 'name' => 'msg-history/delete', - ], - ] - ], - [ - 'title' => '定时群发', - 'name' => 'massRecord', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'mass-record/index', - ], - [ - 'title' => '新增', - 'name' => 'mass-record/edit', - ], - [ - 'title' => '删除', - 'name' => 'mass-record/delete', - ], - ] - ], - [ - 'title' => '数据统计', - 'name' => 'dataStatistics', - 'child' => [ - [ - 'title' => '粉丝关注统计', - 'name' => 'stat/fans-follow', - ], - [ - 'title' => '回复规则使用量', - 'name' => 'stat/rule', - ], - [ - 'title' => '关键字命中规则', - 'name' => 'stat/rule-keyword', - ], - ], - ], - [ - 'title' => '参数配置', - 'name' => 'setting/history-stat', - ], - [ - 'title' => '公用', - 'name' => 'other', - 'child' => [ - [ - 'title' => '图片加载', - 'name' => 'analysis/image', - ], - ], - ] + 'merchant/index' => '商户管理', + 'merchant/ajax-edit' => '商户编辑', + 'merchant/ajax-update' => '商户状态修改', + 'merchant/delete' => '商户删除', + 'role/index' => '角色管理', + 'role/edit' => '角色编辑', + 'role/ajax-update' => '角色状态修改', + 'role/delete' => '角色删除', + 'menu/index' => '菜单管理', + 'menu/ajax-edit' => '菜单编辑', + 'menu/ajax-update' => '菜单状态修改', + 'menu/delete' => '菜单删除', + 'menu-cate/index' => '菜单分类', + 'menu-cate/ajax-edit' => '菜单分类编辑', + 'menu-cate/ajax-update' => '菜单分类状态修改', + 'menu-cate/delete' => '菜单分类删除', + 'config/index' => '配置管理', + 'config/ajax-edit' => '配置编辑', + 'config/ajax-update' => '配置状态修改', + 'config/delete' => '配置删除', + 'config-cate/index' => '配置分类', + 'config-cate/ajax-edit' => '配置分类编辑', + 'config-cate/ajax-update' => '配置分类状态修改', + 'config-cate/delete' => '配置分类删除', + 'auth-item/index' => '权限管理', + 'auth-item/ajax-edit' => '权限编辑', + 'auth-item/ajax-update' => '权限状态修改', + 'auth-item/delete' => '权限删除', + 'member/index' => '用户管理', + 'member/edit' => '用户编辑', + 'member/ajax-edit' => '用户账号密码', + 'member/ajax-update' => '用户状态修改', + 'member/destroy' => '用户删除', ], // ----------------------- 快捷入口 ----------------------- // @@ -292,83 +47,34 @@ // ----------------------- 菜单配置 ----------------------- // 'menuConfig' => [ - 'location' => 'default', // default:系统顶部菜单;addons:应用中心菜单 - 'icon' => 'fa fa-wechat', + 'location' => 'default', // default:系统顶部菜单;addons:应用中心菜单 + 'icon' => 'fa fa-mortar-board', ], 'menu' => [ [ - 'title' => '增强功能', - 'route' => 'function', - 'icon' => 'fa fa-superpowers', - 'child' => [ - [ - 'title' => '自动回复', - 'route' => 'rule/index', - ], - [ - 'title' => '自定义菜单', - 'route' => 'menu/index', - ], - [ - 'title' => '二维码/转化链接', - 'route' => 'qrcode/index', - ], - ], - ], - [ - 'title' => '粉丝管理', - 'route' => 'fans', - 'icon' => 'fa fa-heart', - 'child' => [ - [ - 'title' => '粉丝列表', - 'route' => 'fans/index', - ], - [ - 'title' => '粉丝标签', - 'route' => 'fans-tags/index', - ], - ], - ], - [ - 'title' => '素材库', - 'route' => 'attachment/index', - 'icon' => 'fa fa-file', - ], - [ - 'title' => '历史消息', - 'route' => 'msg-history/index', - 'icon' => 'fa fa-comments', + 'title' => '商户信息', + 'route' => 'merchant/index', + 'icon' => 'fa fa-user-plus', + 'params' => [] ], [ - 'title' => '定时群发', - 'route' => 'mass-record/index', - 'icon' => 'fa fa-send', + 'title' => '商户菜单', + 'route' => 'menu/index', + 'icon' => 'fa fa-list', + 'params' => [] ], [ - 'title' => '数据统计', - 'route' => 'dataStatistics', - 'icon' => 'fa fa-pie-chart', - 'child' => [ - [ - 'title' => '粉丝关注统计', - 'route' => 'stat/fans-follow', - ], - [ - 'title' => '回复规则使用量', - 'route' => 'stat/rule', - ], - [ - 'title' => '关键字命中规则', - 'route' => 'stat/rule-keyword', - ], - ], + 'title' => '商户配置', + 'route' => 'config/index', + 'icon' => 'fa fa-gear', + 'params' => [] ], [ - 'title' => '参数配置', - 'route' => 'setting/history-stat', - 'icon' => 'fa fa-cog', + 'title' => '商户权限', + 'route' => 'auth-item/index', + 'icon' => 'fa fa-user-secret', + 'params' => [] ], ], ]; \ No newline at end of file diff --git a/addons/RfMerchants/common/config/merchant.php b/addons/RfMerchants/common/config/merchant.php index 099bf25ca..13446bea9 100644 --- a/addons/RfMerchants/common/config/merchant.php +++ b/addons/RfMerchants/common/config/merchant.php @@ -4,284 +4,7 @@ // ----------------------- 权限配置 ----------------------- // 'authItem' => [ - [ - 'title' => '增强功能', - 'name' => 'function', - 'child' => [ - [ - 'title' => '自动回复', - 'name' => 'autoReply', - 'child' => [ - [ - 'title' => '关键字首页', - 'name' => 'rule/index', - ], - [ - 'title' => '关键字新增/编辑', - 'name' => 'rule/edit', - ], - [ - 'title' => '关键字删除', - 'name' => 'rule/delete', - ], - [ - 'title' => '关键字状态修改', - 'name' => 'rule/ajax-update', - ], - [ - 'title' => '非文字自动回复', - 'name' => 'setting/special-message', - ], - [ - 'title' => '关注/默认回复', - 'name' => 'reply-default/index', - ], - ], - ], - [ - 'title' => '自定义菜单', - 'name' => 'menu', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'menu/index', - ], - [ - 'title' => '新增/编辑', - 'name' => 'menu/edit', - ], - [ - 'title' => '删除', - 'name' => 'menu/delete', - ], - [ - 'title' => '状态修改', - 'name' => 'menu/ajax-update', - ], - [ - 'title' => '同步菜单', - 'name' => 'menu/sync', - ], - [ - 'title' => '生效并置顶', - 'name' => 'menu/save', - ], - ], - ], - [ - 'title' => '二维码/转化链接', - 'name' => 'qrCode', - 'child' => [ - [ - 'title' => '二维码管理', - 'name' => 'qrCodeManager', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'qrcode/index', - ], - [ - 'title' => '编辑', - 'name' => 'qrcode/edit', - ], - [ - 'title' => '新增', - 'name' => 'qrcode/add', - ], - [ - 'title' => '删除全部', - 'name' => 'qrcode/delete-all', - ], - [ - 'title' => '下载', - 'name' => 'qrcode/down', - ], - ], - ], - [ - 'title' => '扫描统计', - 'name' => 'qrCodeStatistical', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'qrcode-stat/index', - ], - [ - 'title' => '删除', - 'name' => 'qrcode-stat/delete', - ], - ], - ], - [ - 'title' => '长链接转二维码', - 'name' => 'qrCodeLongUrl', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'qrcode/long-url', - ], - [ - 'title' => '转化链接', - 'name' => 'qrcode/qr', - ], - ], - ] - ], - ], - ], - ], - [ - 'title' => '粉丝管理', - 'name' => 'fans', - 'child' => [ - [ - 'title' => '粉丝列表', - 'name' => 'fansManager', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'fans/index', - ], - [ - 'title' => '获取全部粉丝', - 'name' => 'fans/sync-all-openid', - ], - [ - 'title' => '同步', - 'name' => 'fans/sync', - ], - [ - 'title' => '标签分组', - 'name' => 'fans/move-tag', - ], - [ - 'title' => '发送消息', - 'name' => 'fans/send-message', - ], - [ - 'title' => '详情', - 'name' => 'fans/view', - ], - ] - ], - [ - 'title' => '粉丝标签', - 'name' => 'fansTags', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'fans-tags/index', - ], - [ - 'title' => '删除', - 'name' => 'fans-tags/delete', - ], - [ - 'title' => '同步', - 'name' => 'fans-tags/synchro', - ], - ] - ], - ] - ], - [ - 'title' => '素材库', - 'name' => 'attachment', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'attachment/index', - ], - [ - 'title' => '图文新增/编辑', - 'name' => 'attachment/news-edit', - ], - [ - 'title' => '图片/音频/视频新增', - 'name' => 'attachment/create', - ], - [ - 'title' => '删除', - 'name' => 'attachment/delete', - ], - [ - 'title' => '手机预览', - 'name' => 'attachment/preview', - ], - [ - 'title' => '消息群发', - 'name' => 'attachment/send', - ], - [ - 'title' => '同步', - 'name' => 'attachment/sync', - ], - ], - ], - [ - 'title' => '历史消息', - 'name' => 'msgHistory', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'msg-history/index', - ], - [ - 'title' => '删除', - 'name' => 'msg-history/delete', - ], - ] - ], - [ - 'title' => '定时群发', - 'name' => 'massRecord', - 'child' => [ - [ - 'title' => '首页', - 'name' => 'mass-record/index', - ], - [ - 'title' => '新增', - 'name' => 'mass-record/edit', - ], - [ - 'title' => '删除', - 'name' => 'mass-record/delete', - ], - ] - ], - [ - 'title' => '数据统计', - 'name' => 'dataStatistics', - 'child' => [ - [ - 'title' => '粉丝关注统计', - 'name' => 'stat/fans-follow', - ], - [ - 'title' => '回复规则使用量', - 'name' => 'stat/rule', - ], - [ - 'title' => '关键字命中规则', - 'name' => 'stat/rule-keyword', - ], - ], - ], - [ - 'title' => '参数配置', - 'name' => 'setting/history-stat', - ], - [ - 'title' => '公用', - 'name' => 'other', - 'child' => [ - [ - 'title' => '图片加载', - 'name' => 'analysis/image', - ], - ], - ] + ], // ----------------------- 快捷入口 ----------------------- // @@ -292,83 +15,11 @@ // ----------------------- 菜单配置 ----------------------- // 'menuConfig' => [ - 'location' => 'default', // default:系统顶部菜单;addons:应用中心菜单 - 'icon' => 'fa fa-wechat', + 'location' => 'addons', // default:系统顶部菜单;addons:应用中心菜单 + 'icon' => 'fa fa-puzzle-piece', ], 'menu' => [ - [ - 'title' => '增强功能', - 'route' => 'function', - 'icon' => 'fa fa-superpowers', - 'child' => [ - [ - 'title' => '自动回复', - 'route' => 'rule/index', - ], - [ - 'title' => '自定义菜单', - 'route' => 'menu/index', - ], - [ - 'title' => '二维码/转化链接', - 'route' => 'qrcode/index', - ], - ], - ], - [ - 'title' => '粉丝管理', - 'route' => 'fans', - 'icon' => 'fa fa-heart', - 'child' => [ - [ - 'title' => '粉丝列表', - 'route' => 'fans/index', - ], - [ - 'title' => '粉丝标签', - 'route' => 'fans-tags/index', - ], - ], - ], - [ - 'title' => '素材库', - 'route' => 'attachment/index', - 'icon' => 'fa fa-file', - ], - [ - 'title' => '历史消息', - 'route' => 'msg-history/index', - 'icon' => 'fa fa-comments', - ], - [ - 'title' => '定时群发', - 'route' => 'mass-record/index', - 'icon' => 'fa fa-send', - ], - [ - 'title' => '数据统计', - 'route' => 'dataStatistics', - 'icon' => 'fa fa-pie-chart', - 'child' => [ - [ - 'title' => '粉丝关注统计', - 'route' => 'stat/fans-follow', - ], - [ - 'title' => '回复规则使用量', - 'route' => 'stat/rule', - ], - [ - 'title' => '关键字命中规则', - 'route' => 'stat/rule-keyword', - ], - ], - ], - [ - 'title' => '参数配置', - 'route' => 'setting/history-stat', - 'icon' => 'fa fa-cog', - ], + ], ]; \ No newline at end of file diff --git a/addons/RfMerchants/common/enums/LevelEnum.php b/addons/RfMerchants/common/enums/LevelEnum.php deleted file mode 100644 index 7032be69a..000000000 --- a/addons/RfMerchants/common/enums/LevelEnum.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -class LevelEnum extends BaseEnum -{ - /** - * @return array - */ - public static function getMap(): array - { - return [ - '1' => '普通订阅号', - '2' => '普通服务号', - '3' => '认证订阅号', - '4' => '认证服务号/认证媒体/政府订阅号', - ]; - } -} \ No newline at end of file diff --git a/addons/RfMerchants/common/enums/MediaType.php b/addons/RfMerchants/common/enums/MediaType.php deleted file mode 100644 index 8fb41b6e0..000000000 --- a/addons/RfMerchants/common/enums/MediaType.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -class MediaType extends BaseEnum -{ - /** - * @return array - */ - public static function getMap(): array - { - return [ - 'news' => '微信图文', - 'image' => '图片', - 'voice' => '语音', - 'video' => '视频', - ]; - } -} \ No newline at end of file diff --git a/addons/RfMerchants/common/enums/MenuClientPlatformTypeEnum.php b/addons/RfMerchants/common/enums/MenuClientPlatformTypeEnum.php deleted file mode 100644 index 2db27c731..000000000 --- a/addons/RfMerchants/common/enums/MenuClientPlatformTypeEnum.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -class MenuClientPlatformTypeEnum extends BaseEnum -{ - /** - * @return array - */ - public static function getMap(): array - { - return [ - '' => '不限', - 1 => 'IOS(苹果)', - 2 => 'Android(安卓)', - 3 => 'Others(其他)', - ]; - } -} \ No newline at end of file diff --git a/addons/RfMerchants/common/enums/MenuLanguageEnum.php b/addons/RfMerchants/common/enums/MenuLanguageEnum.php deleted file mode 100644 index b39989b6f..000000000 --- a/addons/RfMerchants/common/enums/MenuLanguageEnum.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class MenuLanguageEnum extends BaseEnum -{ - /** - * @return array - */ - public static function getMap(): array - { - return [ - '' => '不限', - 'zh_CN' => '简体中文', - 'zh_TW' => '繁体中文TW', - 'zh_HK' => '繁体中文HK', - 'en' => '英文', - 'id' => '印尼', - 'ms' => '马来', - 'es' => '西班牙', - 'ko' => '韩国', - 'it' => '意大利', - 'ja' => '日本', - 'pl' => '波兰', - 'pt' => '葡萄牙', - 'ru' => '俄国', - 'th' => '泰文', - 'vi' => '越南', - 'ar' => '阿拉伯语', - 'hi' => '北印度', - 'he' => '希伯来', - 'tr' => '土耳其', - 'de' => '德语', - 'fr' => '法语', - ]; - } -} \ No newline at end of file diff --git a/addons/RfMerchants/common/enums/MenuSex.php b/addons/RfMerchants/common/enums/MenuSex.php deleted file mode 100644 index 500d62df2..000000000 --- a/addons/RfMerchants/common/enums/MenuSex.php +++ /dev/null @@ -1,22 +0,0 @@ - - */ -class MenuSex extends BaseEnum -{ - public static function getMap(): array - { - return [ - '' => '不限', - 1 => '男', - 2 => '女', - ]; - } -} \ No newline at end of file diff --git a/addons/RfMerchants/common/models/Attachment.php b/addons/RfMerchants/common/models/Attachment.php deleted file mode 100644 index 6ceadec26..000000000 --- a/addons/RfMerchants/common/models/Attachment.php +++ /dev/null @@ -1,146 +0,0 @@ - '图文素材', - self::TYPE_IMAGE => '图片素材', - // self::TYPE_TEXT => '文字素材', - self::TYPE_VOICE => '音频素材', - // self::TYPE_CARD => '卡卷素材', - self::TYPE_VIDEO => '视频素材', - ]; - - const MODEL_PERM = 'perm'; - const MODEL_TMEP = 'tmep'; - - /** - * @var array - */ - public static $modeExplain = [ - self::MODEL_PERM => '永久素材', - self::MODEL_TMEP => '临时素材', - ]; - - /** - * 微信图片前缀 - */ - const WECHAT_MEDIAT_URL = 'http://mmbiz.qpic.cn'; - - const LINK_TYPE_WECHAT = 1; - const LINK_TYPE_LOCAL = 2; - - public static $linkTypeExplain = [ - self::LINK_TYPE_WECHAT => '微信图文', - self::LINK_TYPE_LOCAL => '本地图文', - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return '{{%wechat_attachment}}'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['merchant_id', 'width', 'height', 'link_type', 'status', 'created_at', 'updated_at'], 'integer'], - [['file_name', 'local_url', 'media_id'], 'string', 'max' => 150], - [['media_id'], 'string', 'max' => 50], - [['media_type'], 'string', 'max' => 15], - [['media_url'], 'string', 'max' => 5000], - [['description'], 'string', 'max' => 200], - [['is_temporary'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'file_name' => '文件名称', - 'local_url' => '本地素材', - 'media_type' => '资源类型', - 'media_id' => '资源id', - 'media_url' => '资源Url', - 'description' => '视频详情', - 'width' => '宽度', - 'height' => '高度', - 'is_temporary' => '是否临时', - 'link_type' => '是否微信图文', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 关联图文 - * - * @return \yii\db\ActiveQuery - */ - public function getNews() - { - return $this->hasMany(AttachmentNews::class, ['attachment_id' => 'id']); - } - - /** - * @throws \Throwable - * @throws \yii\db\StaleObjectException - */ - public function afterDelete() - { - AttachmentNews::deleteAll(['attachment_id' => $this->id]); - - if ($this->media_type == self::TYPE_NEWS) { - Rule::deleteAll(['module' => $this->media_type, 'data' => $this->id]); - MassRecord::deleteAll(['module' => $this->media_type, 'data' => $this->id]); - } else { - Rule::deleteAll(['module' => $this->media_type, 'data' => $this->media_type]); - MassRecord::deleteAll(['module' => $this->media_type, 'data' => $this->media_type]); - } - - parent::afterDelete(); - } -} diff --git a/addons/RfMerchants/common/models/AttachmentNews.php b/addons/RfMerchants/common/models/AttachmentNews.php deleted file mode 100644 index 8cc65f170..000000000 --- a/addons/RfMerchants/common/models/AttachmentNews.php +++ /dev/null @@ -1,82 +0,0 @@ - 50], - [['thumb_url', 'digest', 'content_source_url', 'media_url'], 'string', 'max' => 200], - [['author'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'attachment_id' => '关联id', - 'title' => '标题', - 'thumb_media_id' => '缩略图资源id', - 'thumb_url' => '缩略图 Url', - 'author' => '作者', - 'digest' => 'Digest', - 'show_cover_pic' => '封面', - 'content' => '内容', - 'content_source_url' => '外链', - 'media_url' => '资源 Url', - 'sort' => '排序', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 关联素材 - */ - public function getAttachment() - { - return $this->hasOne(Attachment::class, ['id' => 'attachment_id']); - } -} diff --git a/addons/RfMerchants/common/models/DefaultModel.php b/addons/RfMerchants/common/models/DefaultModel.php new file mode 100644 index 000000000..f1d0927f9 --- /dev/null +++ b/addons/RfMerchants/common/models/DefaultModel.php @@ -0,0 +1,21 @@ + '已关注', - self::FOLLOW_OFF => '未关注', - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return '{{%wechat_fans}}'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['merchant_id', 'member_id', 'sex', 'follow', 'followtime', 'unfollowtime', 'group_id', 'last_updated', 'status', 'created_at', 'updated_at'], 'integer'], - [['unionid'], 'string', 'max' => 64], - [['openid', 'nickname'], 'string', 'max' => 50], - [['head_portrait'], 'string', 'max' => 255], - [['tag'], 'string', 'max' => 1000], - [['last_longitude', 'last_latitude'], 'string', 'max' => 10], - [['last_address', 'country', 'province', 'city'], 'string', 'max' => 100], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'member_id' => 'Member ID', - 'unionid' => 'Unionid', - 'openid' => 'Openid', - 'nickname' => '昵称', - 'head_portrait' => '头像', - 'sex' => '性别', - 'follow' => '关注状态', - 'followtime' => '关注时间', - 'unfollowtime' => '取消关注时间', - 'group_id' => 'Group ID', - 'tag' => '标签', - 'last_longitude' => 'Last Longitude', - 'last_latitude' => 'Last Latitude', - 'last_address' => 'Last Address', - 'last_updated' => 'Last Updated', - 'country' => '国家', - 'province' => '省', - 'city' => '市', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 关联会员 - */ - public function getMember() - { - return $this->hasOne(Member::class, ['id' => 'member_id']); - } - - /** - * 标签关联 - * - * @return \yii\db\ActiveQuery - */ - public function getTags() - { - return $this->hasMany(FansTagMap::class,['fans_id' => 'id']); - } -} diff --git a/addons/RfMerchants/common/models/FansStat.php b/addons/RfMerchants/common/models/FansStat.php deleted file mode 100644 index 35979534c..000000000 --- a/addons/RfMerchants/common/models/FansStat.php +++ /dev/null @@ -1,81 +0,0 @@ - 'ID', - 'new_attention' => '今日新关注', - 'cancel_attention' => '今日取消关注', - 'cumulate_attention' => '累计关注', - 'date' => '日期', - 'status' => 'Status', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 行为 - * @return array - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::class, - 'attributes' => [ - ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at'], - ], - ], - [ - 'class' => BlameableBehavior::class, - 'attributes' => [ - ActiveRecord::EVENT_BEFORE_INSERT => ['merchant_id'], - ], - 'value' => Yii::$app->services->merchant->getId(), - ] - ]; - } -} diff --git a/addons/RfMerchants/common/models/FansTagMap.php b/addons/RfMerchants/common/models/FansTagMap.php deleted file mode 100644 index 1c25444bd..000000000 --- a/addons/RfMerchants/common/models/FansTagMap.php +++ /dev/null @@ -1,48 +0,0 @@ - ['fans_id', 'tag_id']], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'fans_id' => '粉丝id', - 'tag_id' => '标签id', - ]; - } -} diff --git a/addons/RfMerchants/common/models/FansTags.php b/addons/RfMerchants/common/models/FansTags.php deleted file mode 100644 index 28d086622..000000000 --- a/addons/RfMerchants/common/models/FansTags.php +++ /dev/null @@ -1,51 +0,0 @@ - 'ID', - 'tags' => '标签', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } -} diff --git a/addons/RfMerchants/common/models/FormId.php b/addons/RfMerchants/common/models/FormId.php deleted file mode 100644 index 25a0eef26..000000000 --- a/addons/RfMerchants/common/models/FormId.php +++ /dev/null @@ -1,67 +0,0 @@ - 100], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'merchant_id' => '商户id', - 'member_id' => '用户id', - 'form_id' => 'formid', - 'stoped_at' => '失效时间', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } - - /** - * @param bool $insert - * @return bool - * @throws \yii\base\Exception - */ - public function beforeSave($insert) - { - if ($this->isNewRecord) { - // 小程序formid有效时间为7天 - $this->stoped_at = time() + 7 * 24 * 60 * 60 - 60; - } - - return parent::beforeSave($insert); - } -} \ No newline at end of file diff --git a/addons/RfMerchants/common/models/MassRecord.php b/addons/RfMerchants/common/models/MassRecord.php deleted file mode 100644 index b8371f5d4..000000000 --- a/addons/RfMerchants/common/models/MassRecord.php +++ /dev/null @@ -1,89 +0,0 @@ - 50], - [['error_content'], 'string'], - [['send_time'], 'safe'], - [['data'], 'string'], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'fans_num' => '粉丝数量', - 'msg_id' => '消息ID', - 'tag_id' => '粉丝标签', - 'tag_name' => '标签名称', - 'send_type' => '发送类型', - 'send_time' => '发送时间', - 'send_status' => '发送状态', - 'final_send_time' => '实际发送时间', - 'error_content' => '报错原因', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getAttachment() - { - return $this->hasOne(Attachment::class, ['id' => 'data']); - } - - public function beforeSave($insert) - { - $this->send_time = StringHelper::dateToInt($this->send_time); - return parent::beforeSave($insert); - } -} diff --git a/addons/RfMerchants/common/models/Menu.php b/addons/RfMerchants/common/models/Menu.php deleted file mode 100644 index f21e955d4..000000000 --- a/addons/RfMerchants/common/models/Menu.php +++ /dev/null @@ -1,188 +0,0 @@ - '默认菜单', - self::TYPE_INDIVIDUATION => '个性化菜单', - ]; - - /** - * 菜单类型 - * 注: 有value属性的在提交菜单是该类型的值必须设置为此值, 没有的则不限制 - * @var array - */ - public static $menuTypes = [ - 'click' => [ - 'name' => '发送消息 ', - 'meta' => 'key', - 'alert' => '微信服务器会通过消息接口推送消息类型为event的结构给开发者(参考消息接口指南),并且带上按钮中开发者填写的key值,开发者可以通过自定义的key值与用户进行交互;' - ], - 'view' => [ - 'name' => '跳转网页', - 'meta' => 'url', - 'alert' => '微信客户端将会打开开发者在按钮中填写的网页URL,可与网页授权获取用户基本信息接口结合,获得用户基本信息。' - ], - 'scancode_waitmsg' => [ - 'name' => '扫码', - 'meta' => 'key', - 'value' => 'rselfmenu_0_0', - 'alert' => '微信客户端将调起扫一扫工具,完成扫码操作后,将扫码的结果传给开发者,同时收起扫一扫工具,然后弹出“消息接收中”提示框。' - ], - 'scancode_push' => [ - 'name' => '扫码(等待信息)', - 'meta' => 'key', - 'value' => 'rselfmenu_0_1', - 'alert' => '微信客户端将调起扫一扫工具,完成扫码操作后显示扫描结果(如果是URL,将进入URL),且会将扫码的结果传给开发者。' - ], - 'location_select' => [ - 'name' => '地理位置', - 'meta' => 'key', - 'value' => 'rselfmenu_2_0', - 'alert' => '微信客户端将调起地理位置选择工具,完成选择操作后,将选择的地理位置发送给开发者的服务器,同时收起位置选择工具。' - ], - 'pic_sysphoto' => [ - 'name' => '拍照发图', - 'meta' => 'key', - 'value' => 'rselfmenu_1_0', - 'alert' => '微信客户端将调起系统相机,完成拍照操作后,会将拍摄的相片发送给开发者,并推送事件给开发者,同时收起系统相机。' - ], - 'pic_photo_or_album' => [ - 'name' => '拍照相册 ', - 'meta' => 'key', - 'value' => 'rselfmenu_1_1', - 'alert' => '微信客户端将弹出选择器供用户选择“拍照”或者“从手机相册选择”。用户选择后即走其他两种流程。' - ], - 'pic_weixin' => [ - 'name' => '相册发图 ', - 'meta' => 'key', - 'value' => 'rselfmenu_1_2', - 'alert' => '微信客户端将调起微信相册,完成选择操作后,将选择的相片发送给开发者的服务器,并推送事件给开发者,同时收起相册。' - ], - 'miniprogram' => [ - 'name' => '关联小程序', - 'meta' => 'key', - 'alert' => '点击该菜单跳转到关联的小程序' - ], - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return '{{%wechat_menu}}'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['title'], 'required'], - [['merchant_id', 'menu_id', 'type', 'sex', 'tag_id', 'client_platform_type', 'status', 'created_at', 'updated_at'], 'integer'], - [['menu_data'], 'safe'], - [['title'], 'string', 'max' => 30], - [['province', 'country'], 'string', 'max' => 100], - [['city', 'language'], 'string', 'max' => 50], - [['title'], 'verifyEmpty'], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'menu_id' => 'Menu ID', - 'type' => '类型', - 'title' => '菜单名称', - 'sex' => '性别', - 'tag_id' => '标签', - 'client_platform_type' => '客户端类型', - 'province' => '省', - 'city' => '市', - 'language' => '语言', - 'menu_data' => '微信数据', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 验证是否全部为空 - * - * @return bool|void - */ - public function verifyEmpty() - { - if($this->type == self::TYPE_INDIVIDUATION && empty($this->sex) && empty($this->tag_id) && empty($this->client_platform_type) && empty($this->city) && empty($this->province) && empty($this->language)) { - $this->addError('sex', '菜单显示对象至少要有一个匹配信息是不为空的'); - } - } - - /** - * 修改默认菜单状态 - * - * @param bool $insert - * @return bool - */ - public function beforeSave($insert) - { - $this->status = StatusEnum::ENABLED; - return parent::beforeSave($insert); - } - - /** - * 修改其他菜单状态 - * - * @param bool $insert - * @param array $changedAttributes - */ - public function afterSave($insert, $changedAttributes) - { - if ($this->type == self::TYPE_CUSTOM) { - self::updateAll(['status' => StatusEnum::DISABLED], - [ - 'and', - ['not in', 'id', [$this->id]], - ['type' => self::TYPE_CUSTOM], - ['merchant_id' => \Yii::$app->services->merchant->getId()] - ]); - } - - parent::afterSave($insert, $changedAttributes); - } -} diff --git a/addons/RfMerchants/common/models/MenuProvinces.php b/addons/RfMerchants/common/models/MenuProvinces.php deleted file mode 100644 index f686e6e57..000000000 --- a/addons/RfMerchants/common/models/MenuProvinces.php +++ /dev/null @@ -1,51 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'title' => '标题', - 'pid' => '父级id', - 'level' => '级别', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } -} diff --git a/addons/RfMerchants/common/models/MsgHistory.php b/addons/RfMerchants/common/models/MsgHistory.php deleted file mode 100644 index c082147a7..000000000 --- a/addons/RfMerchants/common/models/MsgHistory.php +++ /dev/null @@ -1,86 +0,0 @@ - 50], - [['message'], 'string', 'max' => 1000], - [['addons_name'], 'string', 'max' => 100], - [['type', 'event'], 'string', 'max' => 20], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'rule_id' => '规则ID', - 'keyword_id' => '关键字ID', - 'openid' => 'Openid', - 'module' => '触发模块', - 'message' => '微信消息', - 'type' => '消息类型', - 'event' => '事件', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } - - /** - * 关联粉丝 - * - * @return \yii\db\ActiveQuery - */ - public function getFans() - { - return $this->hasOne(Fans::class, ['openid' => 'openid']); - } - - /** - * 关联规则 - * - * @return \yii\db\ActiveQuery - */ - public function getRule() - { - return $this->hasOne(Rule::class, ['id' => 'rule_id']); - } -} diff --git a/addons/RfMerchants/common/models/Qrcode.php b/addons/RfMerchants/common/models/Qrcode.php deleted file mode 100644 index 2ebceab90..000000000 --- a/addons/RfMerchants/common/models/Qrcode.php +++ /dev/null @@ -1,125 +0,0 @@ - 50], - [['keyword'], 'string', 'max' => 100], - [['scene_str'], 'string', 'max' => 64], - [['ticket'], 'string', 'max' => 250], - [['type'], 'string', 'max' => 10], - [['url'], 'string', 'max' => 80], - ['model', 'verifyModel'], - ['expire_seconds', 'compare', 'compareValue' => 2592000, 'operator' => '<='], - ['expire_seconds', 'compare', 'compareValue' => 60, 'operator' => '>='], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'name' => '二维码名称', - 'keyword' => '二维码触发的关键字', - 'scene_id' => '场景ID', - 'scene_str' => '场景名称', - 'model' => '二维码类型', - 'ticket' => '微信Ticket', - 'expire_seconds' => '过期时间', - 'subnum' => '扫描次数', - 'type' => '类别', - 'extra' => 'Extra', - 'url' => '二维码图片解析后的地址', - 'end_time' => 'End Time', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } - - /** - * 验证提交的类别 - */ - public function verifyModel() - { - if ($this->isNewRecord) { - // 临时 - if ($this->model == self::MODEL_TEM) { - empty($this->expire_seconds) && $this->addError('expire_seconds', '临时二维码过期时间必填'); - } else { - !$this->scene_str && $this->addError('scene_str', '永久二维码场景字符串必填'); - - if (self::find()->where(['scene_str' => $this->scene_str, 'merchant_id' => Yii::$app->services->merchant->getId()])->one()) { - $this->addError('scene_str', '场景值已经存在'); - } - } - } - } - - /** - * @param bool $insert - * @return bool - */ - public function beforeSave($insert) - { - if ($this->isNewRecord) { - $this->end_time = time() + (int) $this->expire_seconds; - } - - return parent::beforeSave($insert); - } -} diff --git a/addons/RfMerchants/common/models/QrcodeStat.php b/addons/RfMerchants/common/models/QrcodeStat.php deleted file mode 100644 index 53b913a19..000000000 --- a/addons/RfMerchants/common/models/QrcodeStat.php +++ /dev/null @@ -1,83 +0,0 @@ - '关注', - self::TYPE_SCAN => '扫描', - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return '{{%wechat_qrcode_stat}}'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['merchant_id', 'qrcord_id', 'type', 'scene_id', 'status', 'created_at', 'updated_at'], 'integer'], - [['openid', 'name'], 'string', 'max' => 50], - [['scene_str'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'qrcord_id' => '二维码id', - 'openid' => '用户openid', - 'type' => '二维码类别', - 'name' => '二维码名称', - 'scene_str' => '场景值', - 'scene_id' => '场景id', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } - - /** - * 关联粉丝 - * - * @return \yii\db\ActiveQuery - */ - public function getFans() - { - return $this->hasOne(Fans::class, ['openid' => 'openid'])->select('openid, nickname, follow'); - } -} diff --git a/addons/RfMerchants/common/models/ReplyDefault.php b/addons/RfMerchants/common/models/ReplyDefault.php deleted file mode 100644 index 53e593028..000000000 --- a/addons/RfMerchants/common/models/ReplyDefault.php +++ /dev/null @@ -1,55 +0,0 @@ - 200], - [['follow_content', 'default_content'], 'trim'], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'follow_content' => '关注回复关键字', - 'default_content' => '默认回复关键字', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } -} diff --git a/addons/RfMerchants/common/models/Rule.php b/addons/RfMerchants/common/models/Rule.php deleted file mode 100644 index f95fea04e..000000000 --- a/addons/RfMerchants/common/models/Rule.php +++ /dev/null @@ -1,161 +0,0 @@ - '文字回复', - self::RULE_MODULE_IMAGE => '图片回复', - self::RULE_MODULE_NEWS => '图文回复', - // self::RULE_MODULE_MUSIC => '音乐回复', - self::RULE_MODULE_VOICE => '语音回复', - self::RULE_MODULE_VIDEO => '视频回复', - // self::RULE_MODULE_ADDON => '模块回复', - self::RULE_MODULE_USER_API => '自定义接口回复', - // self::RULE_MODULE_WX_CARD => '微信卡卷回复', - // self::RULE_MODULE_DEFAULT => '默认回复', - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return '{{%wechat_rule}}'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - ['name', 'required'], - ['name', 'unique','message' => '规则名称已经被占用', - 'filter' => function ($query) { - $query->andWhere(['merchant_id' => Yii::$app->services->merchant->getId()]); - }], - [['merchant_id', 'sort', 'status', 'created_at', 'updated_at'], 'integer'], - [['name', 'module'], 'string', 'max' => 50], - [['data'], 'string'], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'name' => '规则名称', - 'module' => '对应模块', - 'sort' => '排序', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '修改时间', - ]; - } - - /** - * 关联关键字 - * - * @return \yii\db\ActiveQuery - */ - public function getRuleKeyword() - { - return $this->hasMany(RuleKeyword::class, ['rule_id' => 'id'])->orderBy('type asc'); - } - - /** - * 关联资源 - * - * @return \yii\db\ActiveQuery - */ - public function getAttachment() - { - return $this->hasMany(Attachment::class, ['media_id' => 'data']); - } - - - /** - * 关联图文资源 - * - * @return \yii\db\ActiveQuery - */ - public function getNews() - { - return $this->hasMany(AttachmentNews::class,['attachment_id' => 'data'])->orderBy('id asc'); - } - - /** - * 关联图文资源 - * - * @return \yii\db\ActiveQuery - */ - public function getNewsTop() - { - return $this->hasOne(AttachmentNews::class,['attachment_id' => 'data'])->where(['sort' => 0]); - } - - /** - * 删除其他数据 - */ - public function afterDelete() - { - $id = $this->id; - // 关键字删除 - RuleKeyword::deleteAll(['rule_id' => $id]); - // 规则统计 - RuleStat::deleteAll(['rule_id' => $id]); - // 关键字规则统计 - RuleKeywordStat::deleteAll(['rule_id' => $id]); - - parent::afterDelete(); - } - - /** - * @param bool $insert - * @param array $changedAttributes - */ - public function afterSave($insert, $changedAttributes) - { - // 更新状态和排序 - RuleKeyword::updateAll(['sort' => $this->sort, 'status' => $this->status], ['rule_id' => $this->id]); - parent::afterSave($insert, $changedAttributes); - } -} diff --git a/addons/RfMerchants/common/models/RuleKeyword.php b/addons/RfMerchants/common/models/RuleKeyword.php deleted file mode 100644 index f05d8fc2b..000000000 --- a/addons/RfMerchants/common/models/RuleKeyword.php +++ /dev/null @@ -1,71 +0,0 @@ - '直接匹配关键字', - self::TYPE_INCLUDE => '正则表达式', - self::TYPE_REGULAR => '包含关键字', - self::TYPE_TAKE => '直接接管', - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return '{{%wechat_rule_keyword}}'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['merchant_id', 'rule_id', 'type', 'sort', 'status'], 'integer'], - [['module', 'content'], 'required'], - [['module'], 'string', 'max' => 50], - [['content'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'rule_id' => '规则ID', - 'module' => '处理的模块', - 'content' => '内容', - 'type' => '类别', - 'sort' => '排序', - 'status' => '状态', - ]; - } -} diff --git a/addons/RfMerchants/common/models/RuleKeywordStat.php b/addons/RfMerchants/common/models/RuleKeywordStat.php deleted file mode 100644 index 88c16858c..000000000 --- a/addons/RfMerchants/common/models/RuleKeywordStat.php +++ /dev/null @@ -1,122 +0,0 @@ - 50], - [['keyword_content'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'rule_id' => '规则ID', - 'keyword_id' => '关键字id', - 'rule_name' => '规则名称', - 'keyword_type' => '关键字类型', - 'keyword_content' => '关键字内容', - 'hit' => '触发次数', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 关联规则 - * - * @return \yii\db\ActiveQuery - */ - public function getRule() - { - return $this->hasOne(Rule::class,['id' => 'rule_id']); - } - - /** - * 关联关键字 - * - * @return \yii\db\ActiveQuery - */ - public function getRuleKeyword() - { - return $this->hasOne(RuleKeyword::class,['id' => 'keyword_id']); - } - - /** - * @param bool $insert - * @return bool - */ - public function beforeSave($insert) - { - if($this->isNewRecord) { - $this->created_at = strtotime(date('Y-m-d')); - } - - return parent::beforeSave($insert); - } - - /** - * @return array - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::class, - 'attributes' => [ - ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at'], - ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], - ], - ], - [ - 'class' => BlameableBehavior::class, - 'attributes' => [ - ActiveRecord::EVENT_BEFORE_INSERT => ['merchant_id'], - ], - 'value' => Yii::$app->services->merchant->getId(), - ] - ]; - } -} diff --git a/addons/RfMerchants/common/models/RuleStat.php b/addons/RfMerchants/common/models/RuleStat.php deleted file mode 100644 index b90f5dec7..000000000 --- a/addons/RfMerchants/common/models/RuleStat.php +++ /dev/null @@ -1,102 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'rule_id' => 'Rule ID', - 'rule_name' => '规则名称', - 'hit' => '触发次数', - 'status' => '状态', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - /** - * 关联规则 - * - * @return \yii\db\ActiveQuery - */ - public function getRule() - { - return $this->hasOne(Rule::class,['id' => 'rule_id']); - } - - /** - * @param bool $insert - * @return bool - */ - public function beforeSave($insert) - { - if($this->isNewRecord) { - $this->created_at = strtotime(date('Y-m-d')); - } - - return parent::beforeSave($insert); - } - - /** - * @return array - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::class, - 'attributes' => [ - ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at'], - ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], - ], - ], - [ - 'class' => BlameableBehavior::class, - 'attributes' => [ - ActiveRecord::EVENT_BEFORE_INSERT => ['merchant_id'], - ], - 'value' => Yii::$app->services->merchant->getId(), - ] - ]; - } -} diff --git a/addons/RfMerchants/common/models/Setting.php b/addons/RfMerchants/common/models/Setting.php deleted file mode 100644 index 940a0da8d..000000000 --- a/addons/RfMerchants/common/models/Setting.php +++ /dev/null @@ -1,65 +0,0 @@ - 'ID', - 'merchant_id' => '商户', - 'history' => '历史消息参数设置', - 'special' => '特殊消息回复参数', - 'status' => '状态', - 'created_at' => 'Created At', - 'updated_at' => 'Updated At', - ]; - } -} diff --git a/addons/RfMerchants/common/models/SettingForm.php b/addons/RfMerchants/common/models/SettingForm.php index f0e8d991c..7504c6a33 100644 --- a/addons/RfMerchants/common/models/SettingForm.php +++ b/addons/RfMerchants/common/models/SettingForm.php @@ -1,12 +1,12 @@ wechatServices->wechatTemplateMsg->realSend($this->data); - } -} \ No newline at end of file diff --git a/addons/RfWechat/common/config/backend.php b/addons/RfWechat/common/config/backend.php index 5fec644b5..099bf25ca 100644 --- a/addons/RfWechat/common/config/backend.php +++ b/addons/RfWechat/common/config/backend.php @@ -271,6 +271,16 @@ [ 'title' => '参数配置', 'name' => 'setting/history-stat', + ], + [ + 'title' => '公用', + 'name' => 'other', + 'child' => [ + [ + 'title' => '图片加载', + 'name' => 'analysis/image', + ], + ], ] ], diff --git a/addons/RfWechat/common/config/merchant.php b/addons/RfWechat/common/config/merchant.php index 5fec644b5..099bf25ca 100644 --- a/addons/RfWechat/common/config/merchant.php +++ b/addons/RfWechat/common/config/merchant.php @@ -271,6 +271,16 @@ [ 'title' => '参数配置', 'name' => 'setting/history-stat', + ], + [ + 'title' => '公用', + 'name' => 'other', + 'child' => [ + [ + 'title' => '图片加载', + 'name' => 'analysis/image', + ], + ], ] ],