From a4ed423b4c87a6ac001bfed18409453f561aedb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E6=A0=88=E5=B0=8F=E5=AD=A6=E7=94=9F?= <1518079521@qq.com> Date: Sat, 15 Jun 2024 15:36:09 +0800 Subject: [PATCH] update niucloud --- niucloud/app/adminapi/controller/diy/Diy.php | 2 + .../app/adminapi/controller/diy/DiyRoute.php | 16 +- .../app/adminapi/controller/home/Site.php | 15 + .../app/adminapi/controller/login/Login.php | 4 +- .../controller/member/MemberLevel.php | 2 +- .../adminapi/controller/pay/PayChannel.php | 8 + .../adminapi/controller/site/SiteGroup.php | 11 + .../app/adminapi/controller/site/User.php | 7 - .../app/adminapi/controller/sys/Config.php | 22 + .../app/adminapi/controller/sys/System.php | 22 - .../app/adminapi/controller/user/User.php | 89 +- .../adminapi/controller/verify/Verifier.php | 9 + .../app/adminapi/controller/verify/Verify.php | 1 + .../controller/wxoplatform/Config.php | 57 ++ .../controller/wxoplatform/Oplatform.php | 40 + .../controller/wxoplatform/Server.php | 46 + .../controller/wxoplatform/WeappVersion.php | 49 + niucloud/app/adminapi/route/home.php | 7 +- niucloud/app/adminapi/route/pay.php | 2 + niucloud/app/adminapi/route/site.php | 2 + niucloud/app/adminapi/route/sys.php | 9 +- niucloud/app/adminapi/route/user.php | 20 +- niucloud/app/adminapi/route/verify.php | 2 + niucloud/app/adminapi/route/wxoplatform.php | 57 ++ niucloud/app/api/controller/diy/Diy.php | 18 +- .../app/api/controller/member/Account.php | 24 +- .../app/api/controller/member/Address.php | 6 +- niucloud/app/api/controller/pay/Pay.php | 5 +- niucloud/app/api/controller/weapp/Serve.php | 48 + niucloud/app/api/controller/wechat/Serve.php | 1 + niucloud/app/api/controller/wechat/Wechat.php | 28 +- niucloud/app/api/middleware/ApiChannel.php | 1 + niucloud/app/api/route/diy.php | 2 + niucloud/app/api/route/member.php | 7 +- niucloud/app/api/route/route.php | 10 + niucloud/app/command/queue/Queue.php | 1 + niucloud/app/command/schedule/Schedule.php | 4 - niucloud/app/common.php | 4 +- niucloud/app/dict/common/ChannelDict.php | 21 +- niucloud/app/dict/diy/ComponentDict.php | 30 +- niucloud/app/dict/diy/LinkDict.php | 16 + niucloud/app/dict/diy/PagesDict.php | 4 +- niucloud/app/dict/member/MemberLevelDict.php | 77 ++ niucloud/app/dict/member/gift.php | 36 + niucloud/app/dict/menu/admin.php | 924 +++++++++++++++-- niucloud/app/dict/menu/site.php | 959 +++++++++++++++--- niucloud/app/dict/pay/PayDict.php | 20 +- niucloud/app/dict/poster/ComponentDict.php | 12 +- niucloud/app/dict/sys/CloudDict.php | 7 +- niucloud/app/dict/sys/ConfigKeyDict.php | 7 +- niucloud/app/dict/sys/SmsDict.php | 13 +- niucloud/app/dict/sys/StorageDict.php | 18 +- niucloud/app/dict/sys/WxOplatform.php | 132 +++ niucloud/app/event.php | 3 + niucloud/app/install/source/database.sql | 35 +- .../wxoplatform/GetVersionUploadResult.php | 34 + .../app/job/wxoplatform/SiteWeappCommit.php | 34 + .../wxoplatform/SubmitAudit.php} | 21 + .../job/wxoplatform/VersionUploadSuccess.php | 34 + .../job/wxoplatform/WeappAuthChangeAfter.php | 34 + niucloud/app/job/wxoplatform/WeappCommit.php | 34 + .../job/wxoplatform/WechatAuthChangeAfter.php | 34 + niucloud/app/lang/zh-cn/api.php | 12 +- niucloud/app/lang/zh-cn/dict.php | 14 +- .../member/MemberExportDataListener.php | 11 +- .../member/MemberExportTypeListener.php | 13 +- niucloud/app/listener/notice/Sms.php | 4 +- .../system/BottomNavigationListener.php | 2 +- .../listener/system/WeappAuthChangeAfter.php | 41 + niucloud/app/model/diy/DiyRoute.php | 2 +- .../app/model/member/MemberAccountLog.php | 26 + niucloud/app/model/member/MemberAddress.php | 11 - niucloud/app/model/member/MemberCashOut.php | 2 +- niucloud/app/model/member/MemberLevel.php | 3 +- niucloud/app/model/site/SiteGroup.php | 2 +- niucloud/app/model/sys/SysUser.php | 19 +- niucloud/app/model/sys/SysUserRole.php | 4 +- .../app/model/sys/UserCreateSiteLimit.php | 38 + .../app/model/sys/WxOplatfromWeappVersion.php | 51 + niucloud/app/model/verify/Verify.php | 13 + .../app/service/admin/auth/AuthService.php | 13 +- .../app/service/admin/auth/ConfigService.php | 2 - .../app/service/admin/auth/LoginService.php | 24 +- .../service/admin/diy/DiyConfigService.php | 20 +- .../app/service/admin/diy/DiyRouteService.php | 2 +- niucloud/app/service/admin/diy/DiyService.php | 9 +- .../service/admin/home/AuthSiteService.php | 64 +- .../app/service/admin/notice/SmsService.php | 3 +- .../service/admin/site/SiteGroupService.php | 37 +- .../app/service/admin/site/SiteService.php | 6 +- .../service/admin/site/SiteUserService.php | 82 +- .../app/service/admin/stat/StatService.php | 14 +- .../service/admin/sys/AttachmentService.php | 2 +- .../app/service/admin/sys/ConfigService.php | 25 +- .../app/service/admin/sys/MenuService.php | 27 +- .../app/service/admin/sys/SystemService.php | 11 - .../service/admin/upgrade/UpgradeService.php | 17 + .../service/admin/user/UserRoleService.php | 19 +- .../app/service/admin/user/UserService.php | 219 ++-- .../service/admin/verify/VerifierService.php | 12 + .../service/admin/verify/VerifyService.php | 8 +- .../admin/weapp/WeappVersionService.php | 36 +- .../wxoplatform/OplatformConfigService.php | 51 + .../wxoplatform/OplatformServerService.php | 111 ++ .../admin/wxoplatform/OplatformService.php | 156 +++ .../admin/wxoplatform/WeappVersionService.php | 343 +++++++ .../app/service/api/diy/DiyConfigService.php | 30 +- niucloud/app/service/api/diy/DiyService.php | 2 +- .../app/service/api/login/AuthService.php | 3 +- .../app/service/api/login/RegisterService.php | 2 +- .../app/service/api/member/AddressService.php | 10 +- .../api/member/MemberAccountService.php | 74 +- .../service/api/member/MemberLevelService.php | 11 +- .../service/api/member/MemberSignService.php | 43 +- niucloud/app/service/api/pay/PayService.php | 10 +- niucloud/app/service/api/sys/AreaService.php | 6 +- .../service/api/weapp/WeappServeService.php | 41 + .../core/addon/CoreAddonDownloadService.php | 1 + niucloud/app/service/core/addon/WapTrait.php | 25 +- .../service/core/diy/CoreDiyConfigService.php | 8 +- .../core/member/CoreMemberAddressService.php | 23 +- .../app/service/core/pay/CorePayService.php | 5 +- .../service/core/pay/CoreRefundService.php | 6 +- .../service/core/pay/CoreTransferService.php | 4 +- .../core/paytype/CoreBalanceService.php | 51 +- .../service/core/poster/CorePosterService.php | 7 +- .../service/core/sys/CoreExportService.php | 2 - .../service/core/upload/CoreFetchService.php | 4 +- .../core/upload/CoreStorageService.php | 1 + .../service/core/verify/CoreVerifyService.php | 6 +- .../core/weapp/CoreWeappAuthService.php | 16 +- .../core/weapp/CoreWeappCloudService.php | 54 +- .../core/weapp/CoreWeappConfigService.php | 24 +- .../core/weapp/CoreWeappServeService.php | 49 + .../service/core/weapp/CoreWeappService.php | 67 +- .../core/weapp/CoreWeappTemplateService.php | 4 +- .../core/wechat/CoreWechatApiService.php | 1 - .../core/wechat/CoreWechatConfigService.php | 27 +- .../core/wechat/CoreWechatMessageService.php | 2 - .../core/wechat/CoreWechatReplyService.php | 1 - .../core/wechat/CoreWechatServeService.php | 9 +- .../service/core/wechat/CoreWechatService.php | 49 +- .../core/wechat/CoreWechatTemplateService.php | 1 - .../CoreOplatformConfigService.php | 78 ++ .../core/wxoplatform/CoreOplatformService.php | 309 ++++++ niucloud/app/upgrade/v040/upgrade.sql | 38 + niucloud/app/validate/channel/Weapp.php | 4 +- niucloud/app/validate/channel/Wechat.php | 6 +- niucloud/app/validate/member/Address.php | 6 +- niucloud/config/pay.php | 6 +- niucloud/config/sms.php | 6 +- niucloud/config/upload.php | 6 +- niucloud/config/version.php | 4 +- niucloud/core/dict/Config.php | 41 + niucloud/core/dict/UniappComponent.php | 2 +- niucloud/core/dict/UniappPages.php | 2 +- niucloud/core/dict/UniappTemplate.php | 2 +- niucloud/core/pay/Alipay.php | 1 - niucloud/core/pay/BasePay.php | 1 - niucloud/core/poster/Poster.php | 2 +- 160 files changed, 5169 insertions(+), 802 deletions(-) create mode 100644 niucloud/app/adminapi/controller/wxoplatform/Config.php create mode 100644 niucloud/app/adminapi/controller/wxoplatform/Oplatform.php create mode 100644 niucloud/app/adminapi/controller/wxoplatform/Server.php create mode 100644 niucloud/app/adminapi/controller/wxoplatform/WeappVersion.php create mode 100644 niucloud/app/adminapi/route/wxoplatform.php create mode 100644 niucloud/app/api/controller/weapp/Serve.php create mode 100644 niucloud/app/dict/member/MemberLevelDict.php create mode 100644 niucloud/app/dict/sys/WxOplatform.php create mode 100644 niucloud/app/job/wxoplatform/GetVersionUploadResult.php create mode 100644 niucloud/app/job/wxoplatform/SiteWeappCommit.php rename niucloud/app/{adminapi/route/upload.php => job/wxoplatform/SubmitAudit.php} (59%) create mode 100644 niucloud/app/job/wxoplatform/VersionUploadSuccess.php create mode 100644 niucloud/app/job/wxoplatform/WeappAuthChangeAfter.php create mode 100644 niucloud/app/job/wxoplatform/WeappCommit.php create mode 100644 niucloud/app/job/wxoplatform/WechatAuthChangeAfter.php create mode 100644 niucloud/app/listener/system/WeappAuthChangeAfter.php create mode 100644 niucloud/app/model/sys/UserCreateSiteLimit.php create mode 100644 niucloud/app/model/sys/WxOplatfromWeappVersion.php create mode 100644 niucloud/app/service/admin/wxoplatform/OplatformConfigService.php create mode 100644 niucloud/app/service/admin/wxoplatform/OplatformServerService.php create mode 100644 niucloud/app/service/admin/wxoplatform/OplatformService.php create mode 100644 niucloud/app/service/admin/wxoplatform/WeappVersionService.php create mode 100644 niucloud/app/service/api/weapp/WeappServeService.php create mode 100644 niucloud/app/service/core/weapp/CoreWeappServeService.php create mode 100644 niucloud/app/service/core/wxoplatform/CoreOplatformConfigService.php create mode 100644 niucloud/app/service/core/wxoplatform/CoreOplatformService.php create mode 100644 niucloud/app/upgrade/v040/upgrade.sql create mode 100644 niucloud/core/dict/Config.php diff --git a/niucloud/app/adminapi/controller/diy/Diy.php b/niucloud/app/adminapi/controller/diy/Diy.php index b525d7c78..4751887a1 100644 --- a/niucloud/app/adminapi/controller/diy/Diy.php +++ b/niucloud/app/adminapi/controller/diy/Diy.php @@ -114,6 +114,8 @@ class Diy extends BaseAdminController [ "page_title", "" ], [ "title", "" ], [ "name", "" ], + [ 'template', '' ], + [ 'mode', 'diy' ], // 页面展示模式,diy:自定义,fixed:固定 [ "value", "", false ], [ 'is_change', '' ] ]); diff --git a/niucloud/app/adminapi/controller/diy/DiyRoute.php b/niucloud/app/adminapi/controller/diy/DiyRoute.php index 773ef03ec..2f0c81a92 100644 --- a/niucloud/app/adminapi/controller/diy/DiyRoute.php +++ b/niucloud/app/adminapi/controller/diy/DiyRoute.php @@ -34,7 +34,7 @@ class DiyRoute extends BaseAdminController [ 'url', '' ], // 路由地址,格式:/app/pages/index/index [ 'addon_name', '' ] // 插件标识 ]); - return success((new DiyRouteService())->getList($data)); + return success(( new DiyRouteService() )->getList($data)); } /** @@ -44,7 +44,7 @@ class DiyRoute extends BaseAdminController */ public function info(int $id) { - return success((new DiyRouteService())->getInfo($id)); + return success(( new DiyRouteService() )->getInfo($id)); } /** @@ -54,7 +54,7 @@ class DiyRoute extends BaseAdminController */ public function getInfoByName(string $name) { - return success((new DiyRouteService())->getInfoByName($name)); + return success(( new DiyRouteService() )->getInfoByName($name)); } /** @@ -71,7 +71,7 @@ class DiyRoute extends BaseAdminController [ "is_share", "" ] ]); $this->validate($data, 'app\validate\diy\DiyRoute.add'); - $id = (new DiyRouteService())->add($data); + $id = ( new DiyRouteService() )->add($data); return success('ADD_SUCCESS', [ 'id' => $id ]); } @@ -90,7 +90,7 @@ class DiyRoute extends BaseAdminController [ "is_share", "" ] ]); $this->validate($data, 'app\validate\diy\DiyRoute.edit'); - (new DiyRouteService())->edit($id, $data); + ( new DiyRouteService() )->edit($id, $data); return success('MODIFY_SUCCESS'); } @@ -101,7 +101,7 @@ class DiyRoute extends BaseAdminController */ public function del(int $id) { - (new DiyRouteService())->del($id); + ( new DiyRouteService() )->del($id); return success('DELETE_SUCCESS'); } @@ -118,7 +118,7 @@ class DiyRoute extends BaseAdminController [ 'is_share', 0 ], [ 'sort', 0 ] ]); - (new DiyRouteService())->modifyShare($data); + ( new DiyRouteService() )->modifyShare($data); return success('MODIFY_SUCCESS'); } @@ -129,7 +129,7 @@ class DiyRoute extends BaseAdminController */ public function getApps() { - return success((new DiyRouteService())->getApps()); + return success(( new DiyRouteService() )->getApps()); } } diff --git a/niucloud/app/adminapi/controller/home/Site.php b/niucloud/app/adminapi/controller/home/Site.php index 167ae6c20..54eccedd1 100644 --- a/niucloud/app/adminapi/controller/home/Site.php +++ b/niucloud/app/adminapi/controller/home/Site.php @@ -73,4 +73,19 @@ class Site extends BaseAdminController return success('MODIFY_SUCCESS'); } + public function getSiteGroup() { + return success((new AuthSiteService())->getSiteGroup()); + } + + /** + * 创建站点 + * @return Response + */ + public function create() { + $data = $this->request->params([ + ['site_name', ''], + ['group_id', 0] + ]); + return success((new AuthSiteService())->createSite($data)); + } } diff --git a/niucloud/app/adminapi/controller/login/Login.php b/niucloud/app/adminapi/controller/login/Login.php index 6a3153148..a98daf929 100644 --- a/niucloud/app/adminapi/controller/login/Login.php +++ b/niucloud/app/adminapi/controller/login/Login.php @@ -72,9 +72,7 @@ class Login extends BaseAdminController } public function test(){ - $res = event("MemberAccount", ['account_type' => MemberAccountTypeDict::GROWTH, 'site_id' => 166, - 'member_id' => 10143]); - dd($res); + (new UpgradeService())->executeSql(root_path().'app/upgrade/v011/upgrade.sql'); } public function geAddonPackagePath(string $addon) diff --git a/niucloud/app/adminapi/controller/member/MemberLevel.php b/niucloud/app/adminapi/controller/member/MemberLevel.php index 7846918ef..765c64e89 100644 --- a/niucloud/app/adminapi/controller/member/MemberLevel.php +++ b/niucloud/app/adminapi/controller/member/MemberLevel.php @@ -82,7 +82,7 @@ class MemberLevel extends BaseAdminController [ 'growth', 0 ], [ 'remark', '' ], [ 'level_benefits', [] ], - [ 'level_gifts', [] ] + [ 'level_gifts', [] ], ]); $this->validate($data, 'app\validate\member\MemberLevel.edit'); ( new MemberLevelService() )->edit($id, $data); diff --git a/niucloud/app/adminapi/controller/pay/PayChannel.php b/niucloud/app/adminapi/controller/pay/PayChannel.php index 67412734f..a8b666075 100644 --- a/niucloud/app/adminapi/controller/pay/PayChannel.php +++ b/niucloud/app/adminapi/controller/pay/PayChannel.php @@ -93,4 +93,12 @@ class PayChannel extends BaseAdminController (new PayChannelService())->setAll($data['config']); return success('SET_SUCCESS'); } + + /** + * 获取全部支付方式 + * @return Response + */ + public function getPayTypeList() { + return success(data:PayDict::getPayType()); + } } diff --git a/niucloud/app/adminapi/controller/site/SiteGroup.php b/niucloud/app/adminapi/controller/site/SiteGroup.php index 2891bcbe2..f96274bf9 100644 --- a/niucloud/app/adminapi/controller/site/SiteGroup.php +++ b/niucloud/app/adminapi/controller/site/SiteGroup.php @@ -104,4 +104,15 @@ class SiteGroup extends BaseAdminController return success((new SiteGroupService())->getAll($data)); } + /** + * 所有分组 + * @return Response + */ + public function getUserSiteGroupAll() + { + $data = $this->request->params([ + ['uid', 0], + ]); + return success((new SiteGroupService())->getUserSiteGroupAll($data['uid'])); + } } diff --git a/niucloud/app/adminapi/controller/site/User.php b/niucloud/app/adminapi/controller/site/User.php index 73d0c919c..c7a699909 100644 --- a/niucloud/app/adminapi/controller/site/User.php +++ b/niucloud/app/adminapi/controller/site/User.php @@ -29,10 +29,6 @@ class User extends BaseAdminController { $data = $this->request->params([ ['username', ''], - ['realname', ''], - ['role', ''], - ['create_time', []], - ['last_time', []], ]); $list = (new SiteUserService())->getPage($data); return success($list); @@ -121,7 +117,6 @@ class User extends BaseAdminController */ public function lock($uid) { - (new SiteUserService())->lock($uid); return success('MODIFY_SUCCESS'); } @@ -135,6 +130,4 @@ class User extends BaseAdminController (new SiteUserService())->unlock($uid); return success('MODIFY_SUCCESS'); } - - } diff --git a/niucloud/app/adminapi/controller/sys/Config.php b/niucloud/app/adminapi/controller/sys/Config.php index 444b81477..c5d5da150 100644 --- a/niucloud/app/adminapi/controller/sys/Config.php +++ b/niucloud/app/adminapi/controller/sys/Config.php @@ -200,4 +200,26 @@ class Config extends BaseAdminController return success(data: ( new ConfigService() )->getLayout()); } + /** + * 设置布局设置 + * @return Response + */ + public function setThemeColor() + { + $data = $this->request->params([ + [ 'key', '' ], + [ 'value', '' ], + ]); + ( new ConfigService() )->setThemeColor($data); + return success(); + } + + /** + * 获取布局设置 + * @return Response + */ + public function getThemeColor() + { + return success(data: ( new ConfigService() )->getThemeColor()); + } } diff --git a/niucloud/app/adminapi/controller/sys/System.php b/niucloud/app/adminapi/controller/sys/System.php index 01f5c71f9..50a0afcd4 100644 --- a/niucloud/app/adminapi/controller/sys/System.php +++ b/niucloud/app/adminapi/controller/sys/System.php @@ -76,28 +76,6 @@ class System extends BaseAdminController return success(data: (new SystemService())->checkSchedule()); } - /** - * 获取布局 - * @return Response - */ - public function layout() { - $layouts = event('SiteLayout'); - if (count($layouts) > 1) { - array_multisort(array_column($layouts, 'sort'), SORT_ASC, $layouts); - } - return success($layouts); - } - - /** - * - * 设置布局 - * @return Response - */ - public function setLayout(){ - $key = input('key', ''); - return success(data: (new SystemService())->setLayout($key)); - } - /** * 环境变量查询 * @return Response diff --git a/niucloud/app/adminapi/controller/user/User.php b/niucloud/app/adminapi/controller/user/User.php index be141db89..f13b58ea6 100644 --- a/niucloud/app/adminapi/controller/user/User.php +++ b/niucloud/app/adminapi/controller/user/User.php @@ -11,6 +11,7 @@ namespace app\adminapi\controller\user; +use app\dict\sys\UserDict; use app\service\admin\user\UserService; use core\base\BaseAdminController; use think\Response; @@ -21,12 +22,12 @@ class User extends BaseAdminController { $data = $this->request->params([ ['username', ''], - ['real_name', ''] + ['real_name', ''], + ['last_time', []] ]); - $list = (new UserService())->getUserAdminPage($data); + $list = (new UserService())->getPage($data); return success($list); - } /** @@ -36,17 +37,17 @@ class User extends BaseAdminController */ public function info($uid) { - return success((new UserService())->getUserAdminInfo($uid)); + return success((new UserService())->getInfo($uid)); } - public function pages() + public function getUserAll() { $data = $this->request->params([ ['username', ''], ['realname', ''], ['create_time', []], ]); - $list = (new UserService())->getUserAllPage($data); + $list = (new UserService())->getUserAll($data); return success($list); } @@ -57,4 +58,80 @@ class User extends BaseAdminController $is_exist = (new UserService())->checkUsername($data['username']); return success(data:$is_exist); } + + /** + * 添加用户 + * @return Response + * @throws \Exception + */ + public function add() { + $data = $this->request->params([ + ['username', ''], + ['password', ''], + ['real_name', ''], + ['status', UserDict::ON], + ['head_img', ''], + ['create_site_limit', []] + ]); + (new UserService())->add($data); + return success(); + } + + /** + * 获取用户站点创建限制 + * @param $uid + * @return Response + */ + public function getUserCreateSiteLimit($uid){ + return success(data:(new UserService())->getUserCreateSiteLimit($uid)); + } + + /** + * 获取用户站点创建限制 + * @param $uid + * @return Response + */ + public function getUserCreateSiteLimitInfo($id){ + return success(data:(new UserService())->getUserCreateSiteLimitInfo($id)); + } + + /** + * 添加用户站点创建限制 + * @param $uid + * @return Response + */ + public function addUserCreateSiteLimit($uid){ + $data = $this->request->params([ + ['uid', 0], + ['group_id', 0], + ['num', 1], + ['month', 1], + ]); + (new UserService())->addUserCreateSiteLimit($data); + return success('SUCCESS'); + } + + /** + * 编辑用户站点创建限制 + * @param $uid + * @return Response + */ + public function editUserCreateSiteLimit($id){ + $data = $this->request->params([ + ['num', 1], + ['month', 1], + ]); + (new UserService())->editUserCreateSiteLimit($id, $data); + return success('SUCCESS'); + } + + /** + * 删除用户站点创建限制 + * @param $uid + * @return Response + */ + public function delUserCreateSiteLimit($id){ + (new UserService())->delUserCreateSiteLimit($id); + return success('SUCCESS'); + } } diff --git a/niucloud/app/adminapi/controller/verify/Verifier.php b/niucloud/app/adminapi/controller/verify/Verifier.php index a84f891d1..1ab65d5db 100644 --- a/niucloud/app/adminapi/controller/verify/Verifier.php +++ b/niucloud/app/adminapi/controller/verify/Verifier.php @@ -27,6 +27,15 @@ class Verifier extends BaseAdminController return success(data:(new VerifierService())->getPage()); } + /** + * 核销人员列表 + * @return Response + */ + public function select() + { + return success(data:(new VerifierService())->getList()); + } + /** * 添加核销员 * @param int $order_id diff --git a/niucloud/app/adminapi/controller/verify/Verify.php b/niucloud/app/adminapi/controller/verify/Verify.php index 7585122da..54e619ecc 100644 --- a/niucloud/app/adminapi/controller/verify/Verify.php +++ b/niucloud/app/adminapi/controller/verify/Verify.php @@ -27,6 +27,7 @@ class Verify extends BaseAdminController ['relate_tag', 0], ['type', ''], ['code', ''], + ['verifier_member_id', ''], ['create_time', []] ]); return success((new VerifyService())->getPage($data)); diff --git a/niucloud/app/adminapi/controller/wxoplatform/Config.php b/niucloud/app/adminapi/controller/wxoplatform/Config.php new file mode 100644 index 000000000..23acdb103 --- /dev/null +++ b/niucloud/app/adminapi/controller/wxoplatform/Config.php @@ -0,0 +1,57 @@ +getConfig()); + } + + /** + * 设置微信开放平台配置信息 + * @return Response + */ + public function set() + { + $data = $this->request->params([ + ['app_id', ''], + ['app_secret', ''], + ['token', ''], + ['aes_key', ''], + ['develop_app_id', ''], + ['develop_upload_private_key', ''] + ]); + (new OplatformConfigService())->setConfig($data); + return success('SET_SUCCESS'); + } + + /** + * 获取微信开放平台静态资源 + * @return Response + */ + public function static() + { + return success((new OplatformConfigService())->getStaticInfo()); + } + +} diff --git a/niucloud/app/adminapi/controller/wxoplatform/Oplatform.php b/niucloud/app/adminapi/controller/wxoplatform/Oplatform.php new file mode 100644 index 000000000..878ae01cd --- /dev/null +++ b/niucloud/app/adminapi/controller/wxoplatform/Oplatform.php @@ -0,0 +1,40 @@ +createPreAuthorizationUrl()); + } + + /** + * 授权 + * @return Response + */ + public function authorization() { + $data = $this->request->params([ + ['auth_code', ''], + ['expires_in', ''], + ]); + return success((new OplatformService())->authorization($data)); + } +} diff --git a/niucloud/app/adminapi/controller/wxoplatform/Server.php b/niucloud/app/adminapi/controller/wxoplatform/Server.php new file mode 100644 index 000000000..c687ec43a --- /dev/null +++ b/niucloud/app/adminapi/controller/wxoplatform/Server.php @@ -0,0 +1,46 @@ +server(); + return response($result->getBody())->header([ + 'Content-Type' => 'text/plain;charset=utf-8' + ]); + } + + /** + * 微信开放平台消息与事件接收 + * @param string $appid + * @return Response + */ + public function message(string $appid) { + ob_clean(); + $result = (new OplatformServerService())->message($appid); + return response($result->getBody())->header([ + 'Content-Type' => 'text/plain;charset=utf-8' + ]); + } + +} diff --git a/niucloud/app/adminapi/controller/wxoplatform/WeappVersion.php b/niucloud/app/adminapi/controller/wxoplatform/WeappVersion.php new file mode 100644 index 000000000..8d7acc277 --- /dev/null +++ b/niucloud/app/adminapi/controller/wxoplatform/WeappVersion.php @@ -0,0 +1,49 @@ +add(); + return success(); + } + + /** + * 获取最后一次提交记录 + * @return Response + */ + public function lastCommitRecord() { + return success(data:(new WeappVersionService())->getLastCommitRecord()); + } + + public function commitRecord() { + return success(data:(new WeappVersionService())->getPage()); + } + + /** + * 站点小程序提交 + * @return Response + */ + public function siteWeappCommit() { + (new WeappVersionService())->siteWeappCommit(); + return success(); + } +} diff --git a/niucloud/app/adminapi/route/home.php b/niucloud/app/adminapi/route/home.php index 134c67da2..f1bc93e23 100644 --- a/niucloud/app/adminapi/route/home.php +++ b/niucloud/app/adminapi/route/home.php @@ -28,6 +28,9 @@ Route::group('home', function () { Route::get('site/:id', 'home.Site/info'); //更新站点信息 Route::put('site/:id', 'home.Site/edit'); - + // 获取可选择的店铺套餐 + Route::get('site/group', 'home.Site/getSiteGroup'); + // 获取可选择的店铺套餐 + Route::post('site/create', 'home.Site/create'); })->middleware(AdminCheckToken::class, true) - ->middleware(AdminLog::class); \ No newline at end of file + ->middleware(AdminLog::class); diff --git a/niucloud/app/adminapi/route/pay.php b/niucloud/app/adminapi/route/pay.php index 413aa3d74..ad65c7b94 100644 --- a/niucloud/app/adminapi/route/pay.php +++ b/niucloud/app/adminapi/route/pay.php @@ -48,6 +48,8 @@ Route::group('pay', function () { Route::get('refund/type', 'pay.PayRefund/getRefundType'); //退款转账 Route::post('refund/transfer', 'pay.PayRefund/transfer'); + // 获取全部支付方式 + Route::get('type/all', 'pay.PayChannel/getPayTypeList'); })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/adminapi/route/site.php b/niucloud/app/adminapi/route/site.php index 486734801..5cae0c3ae 100644 --- a/niucloud/app/adminapi/route/site.php +++ b/niucloud/app/adminapi/route/site.php @@ -50,6 +50,8 @@ Route::group('site', function () { Route::delete('group/:group_id', 'site.SiteGroup/del'); //获取所有分组 Route::get('group/all', 'site.SiteGroup/all'); + //获取所有分组以及用户站点数 + Route::get('group/user', 'site.SiteGroup/getUserSiteGroupAll'); /***************************************************** 当前站点用户 *************************************************/ //站点用户列表 Route::get('user', 'site.User/lists'); diff --git a/niucloud/app/adminapi/route/sys.php b/niucloud/app/adminapi/route/sys.php index 2390f72bc..31e336ec7 100644 --- a/niucloud/app/adminapi/route/sys.php +++ b/niucloud/app/adminapi/route/sys.php @@ -111,6 +111,11 @@ Route::group('sys', function() { // 布局设置 Route::put('config/layout', 'sys.Config/setLayout'); + // 色调设置 + Route::get('config/themecolor', 'sys.Config/getThemeColor'); + // 色调设置 + Route::put('config/themecolor', 'sys.Config/setThemeColor'); + /***************************************************** 图片上传 ****************************************************/ //附件图片上传 Route::post('image', 'upload.Upload/image'); @@ -210,10 +215,6 @@ Route::group('sys', function() { /***************************************************** 公共字典数据 ****************************************************/ Route::get('date/month', 'sys.Common/getMonth'); Route::get('date/week', 'sys.Common/getWeek'); - - /***************************************************** 获取布局 ****************************************************/ - Route::get('layout', 'sys.System/layout'); - Route::put('layout', 'sys.System/setLayout'); /***************************************************** 获取导出数据 ****************************************************/ //报表导出列表 Route::get('export', 'sys.Export/lists'); diff --git a/niucloud/app/adminapi/route/user.php b/niucloud/app/adminapi/route/user.php index 629c2dfc1..a69c0618f 100644 --- a/niucloud/app/adminapi/route/user.php +++ b/niucloud/app/adminapi/route/user.php @@ -21,13 +21,25 @@ use think\facade\Route; Route::group('user', function () { /***************************************************** 用户 ****************************************************/ //用户列表 - Route::get('user', 'user.user/lists'); + Route::get('user', 'user.User/lists'); //全部用户列表 - Route::get('user_all', 'user.user/pages'); + Route::get('user_all', 'user.User/getUserAll'); //用户详情 - Route::get('user/:uid', 'user.user/info'); + Route::get('user/:uid', 'user.User/info'); // 查询账号是否存在 - Route::get('isexist', 'user.user/checkUserIsExist'); + Route::get('isexist', 'user.User/checkUserIsExist'); + //添加用户 + Route::post('user', 'user.User/add'); + // 获取用户站点创建限制 + Route::get('user/create_site_limit/:uid', 'user.User/getUserCreateSiteLimit'); + // 获取用户站点创建限制 + Route::get('user/create_site_limit/info/:id', 'user.User/getUserCreateSiteLimitInfo'); + // 增加用户站点创建限制 + Route::post('user/create_site_limit', 'user.User/addUserCreateSiteLimit'); + // 编辑用户站点创建限制 + Route::put('user/create_site_limit/:id', 'user.User/editUserCreateSiteLimit'); + // 删除用户站点创建限制 + Route::delete('user/create_site_limit/:id', 'user.User/delUserCreateSiteLimit'); })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/adminapi/route/verify.php b/niucloud/app/adminapi/route/verify.php index fa0a67394..c544621d1 100644 --- a/niucloud/app/adminapi/route/verify.php +++ b/niucloud/app/adminapi/route/verify.php @@ -30,6 +30,8 @@ Route::group('verify', function () { Route::post('verifier', 'verify.Verifier/add'); // 获取核销员列表 Route::get('verifier', 'verify.Verifier/lists'); + // 获取核销员列表 + Route::get('verifier/select', 'verify.Verifier/select'); // 获取核销类型 Route::get('verifier/type', 'verify.Verifier/getVerifyType'); // 删除核销员 diff --git a/niucloud/app/adminapi/route/wxoplatform.php b/niucloud/app/adminapi/route/wxoplatform.php new file mode 100644 index 000000000..259edf100 --- /dev/null +++ b/niucloud/app/adminapi/route/wxoplatform.php @@ -0,0 +1,57 @@ +middleware([ + AdminCheckToken::class, + AdminCheckRole::class, + AdminLog::class +]); + +Route::group('wxoplatform', function () { + // 第三方平台授权事件接收 + Route::post('server', 'wxoplatform.Server/server'); + // 第三方平台消息与事件接收 + Route::post('message/:appid', 'wxoplatform.Server/message'); +}); + +//系统环境(不效验登录状态) +Route::group('sys', function() { + Route::get('wxoplatform/config', 'wxoplatform.Config/get'); +}); diff --git a/niucloud/app/api/controller/diy/Diy.php b/niucloud/app/api/controller/diy/Diy.php index 744945a0f..7f83f8fe4 100644 --- a/niucloud/app/api/controller/diy/Diy.php +++ b/niucloud/app/api/controller/diy/Diy.php @@ -30,7 +30,19 @@ class Diy extends BaseApiController [ 'id', '' ], [ 'name', '' ] ]); - return success((new DiyService())->getInfo($params)); + return success(( new DiyService() )->getInfo($params)); + } + + /** + * 底部菜单信息 + * @return Response + */ + public function tabbarList() + { + $params = $this->request->params([ + [ 'key', '' ], + ]); + return success(( new DiyConfigService() )->getBottomList($params)); } /** @@ -42,7 +54,7 @@ class Diy extends BaseApiController $params = $this->request->params([ [ 'key', 'app' ], ]); - return success((new DiyConfigService())->getBottomConfig($params[ 'key' ])); + return success(( new DiyConfigService() )->getBottomConfig($params[ 'key' ])); } /** @@ -55,6 +67,6 @@ class Diy extends BaseApiController [ 'route', '' ], [ 'params', '' ] ]); - return success((new DiyRouteService())->getShare($data)); + return success(( new DiyRouteService() )->getShare($data)); } } diff --git a/niucloud/app/api/controller/member/Account.php b/niucloud/app/api/controller/member/Account.php index 5c5d1ed92..9d8221206 100644 --- a/niucloud/app/api/controller/member/Account.php +++ b/niucloud/app/api/controller/member/Account.php @@ -15,6 +15,7 @@ use app\dict\member\MemberAccountChangeTypeDict; use app\dict\member\MemberAccountTypeDict; use app\service\api\member\MemberAccountService; use core\base\BaseApiController; +use core\exception\AdminException; use think\db\exception\DbException; use think\Response; @@ -51,6 +52,18 @@ class Account extends BaseApiController return success((new MemberAccountService())->getPage($data)); } + /** + * 余额流水(新) + * @return Response + */ + public function balanceList(): Response + { + $data = $this->request->params([ + ['from_type', ''] + ]); + return success((new MemberAccountService())->getPages($data)); + } + /** * 零钱流水 * @return Response @@ -85,7 +98,9 @@ class Account extends BaseApiController public function commission(): Response { $data = $this->request->params([ - ['from_type', ''] + ['from_type', ''], + ['account_data_gt', ''], + ['account_data_lt', ''], ]); $data['account_type'] = MemberAccountTypeDict::COMMISSION; return success((new MemberAccountService())->getPage($data)); @@ -98,8 +113,13 @@ class Account extends BaseApiController */ public function getFromType($account_type): Response { - + if (!array_key_exists($account_type, MemberAccountTypeDict::getType())) throw new AdminException('MEMBER_TYPE_NOT_EXIST'); return success(MemberAccountChangeTypeDict::getType($account_type)); } + public function pointCount() + { + return success((new MemberAccountService())->getPointCount()); + } + } diff --git a/niucloud/app/api/controller/member/Address.php b/niucloud/app/api/controller/member/Address.php index 03a0c6f5f..7bb22ca7b 100644 --- a/niucloud/app/api/controller/member/Address.php +++ b/niucloud/app/api/controller/member/Address.php @@ -27,9 +27,7 @@ class Address extends BaseApiController * @return \think\Response */ public function lists(){ - $data = $this->request->params([ - ["type",""] - ]); + $data = $this->request->params([]); return success((new AddressService())->getList($data)); } @@ -59,7 +57,6 @@ class Address extends BaseApiController ["lng",""], ["lat",""], ["is_default",0], - ["type",''] ]); $this->validate($data, 'app\validate\member\Address.add'); $id = (new AddressService())->add($data); @@ -84,7 +81,6 @@ class Address extends BaseApiController ["lng",""], ["lat",""], ["is_default",0], - ["type",''] ]); $this->validate($data, 'app\validate\member\Address.edit'); (new AddressService())->edit($id, $data); diff --git a/niucloud/app/api/controller/pay/Pay.php b/niucloud/app/api/controller/pay/Pay.php index 0bc562559..41675c594 100644 --- a/niucloud/app/api/controller/pay/Pay.php +++ b/niucloud/app/api/controller/pay/Pay.php @@ -47,10 +47,11 @@ class Pay extends BaseApiController ['quit_url', ''], ['buyer_id', ''], ['return_url', ''], - ['voucher', ''] + ['voucher', ''], + ['openid', ''] ]); - return success('SUCCESS',(new PayService())->pay($data['type'], $data['trade_type'], $data['trade_id'], $data['return_url'], $data['quit_url'], $data['buyer_id'], $data['voucher'])); + return success('SUCCESS',(new PayService())->pay($data['type'], $data['trade_type'], $data['trade_id'], $data['return_url'], $data['quit_url'], $data['buyer_id'], $data['voucher'], $data['openid'])); } public function info($trade_type, $trade_id) diff --git a/niucloud/app/api/controller/weapp/Serve.php b/niucloud/app/api/controller/weapp/Serve.php new file mode 100644 index 000000000..668934d7c --- /dev/null +++ b/niucloud/app/api/controller/weapp/Serve.php @@ -0,0 +1,48 @@ +serve(); + return response($result->getBody())->header([ + 'Content-Type' => 'text/plain;charset=utf-8' + ]); + } + + +} diff --git a/niucloud/app/api/controller/wechat/Serve.php b/niucloud/app/api/controller/wechat/Serve.php index a59ae3132..a0932a949 100644 --- a/niucloud/app/api/controller/wechat/Serve.php +++ b/niucloud/app/api/controller/wechat/Serve.php @@ -37,6 +37,7 @@ class Serve extends BaseController * @throws Throwable */ public function serve($site_id){ + ob_clean(); $result = (new WechatServeService())->serve(); return response($result->getBody())->header([ 'Content-Type' => 'text/plain;charset=utf-8' diff --git a/niucloud/app/api/controller/wechat/Wechat.php b/niucloud/app/api/controller/wechat/Wechat.php index db5454a3f..b332dccd4 100644 --- a/niucloud/app/api/controller/wechat/Wechat.php +++ b/niucloud/app/api/controller/wechat/Wechat.php @@ -37,7 +37,33 @@ class Wechat extends BaseController } /** - * 授权登录 + * code获取微信信息 + * @return Response + */ + public function getWechatUser(){ + $data = $this->request->params([ + ['code', ''], + ]); + $wechat_auth_service = new WechatAuthService(); + $data = $wechat_auth_service->userFromCode($data['code']); + return success(['data'=> json_encode($data)]); + } + + /** + * 授权信息登录 + * @return Response + */ + public function wechatLogin(){ + $data = $this->request->params([ + ['data', ''], + ]); + $wechat_auth_service = new WechatAuthService(); + [$avatar, $nickname, $openid, $unionid] = json_decode($data['data'], true); + return success($wechat_auth_service->login($openid, $nickname, $avatar, $unionid)); + } + + /** + * 授权code登录 * @return Response * @throws DataNotFoundException * @throws DbException diff --git a/niucloud/app/api/middleware/ApiChannel.php b/niucloud/app/api/middleware/ApiChannel.php index ae89c41d3..c4458d71c 100644 --- a/niucloud/app/api/middleware/ApiChannel.php +++ b/niucloud/app/api/middleware/ApiChannel.php @@ -32,6 +32,7 @@ class ApiChannel //微信或支付宝 $channel_rules = [ 'wechat/serve/', + 'weapp/serve/', 'pay/notify////' ]; if (in_array($request->rule()->getRule(), $channel_rules)) { diff --git a/niucloud/app/api/route/diy.php b/niucloud/app/api/route/diy.php index ef199c356..bffc5a8eb 100644 --- a/niucloud/app/api/route/diy.php +++ b/niucloud/app/api/route/diy.php @@ -24,6 +24,8 @@ Route::group('diy', function() { Route::get('tabbar', 'diy.Diy/tabbar'); + Route::get('tabbar/list', 'diy.Diy/tabbarList'); + Route::get('share', 'diy.Diy/share'); })->middleware(ApiLog::class) diff --git a/niucloud/app/api/route/member.php b/niucloud/app/api/route/member.php index 0f100dc5c..b4fcc1926 100644 --- a/niucloud/app/api/route/member.php +++ b/niucloud/app/api/route/member.php @@ -39,6 +39,8 @@ Route::group('member', function () { Route::get('account/point', 'member.Account/point'); //会员余额流水 Route::get('account/balance', 'member.Account/balance'); + //会员余额流水(新) + Route::get('account/balance_list', 'member.Account/balanceList'); //会员零钱流水 Route::get('account/money', 'member.Account/money'); //会员零钱流水 @@ -47,8 +49,11 @@ Route::group('member', function () { Route::get('account/commission', 'member.Account/commission'); //账户来源 Route::get('account/fromtype/:account_type', 'member.Account/getFromType'); + //积分数量 + Route::get('account/pointcount', 'member.Account/pointCount'); + /***************************************************** 会员提现 ****************************************************/ - Route::get('account/point', 'member.Account/point'); + //会员提现列表 Route::get('cash_out', 'member.MemberCashOut/lists'); //会员提现详情 diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index ad0414053..61586c583 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -23,6 +23,12 @@ Route::any('wechat/serve/:site_id', 'wechat.Serve/serve') ->middleware(ApiCheckToken::class) ->middleware(ApiLog::class); +// 微信小程序消息推送 +Route::any('weapp/serve/:site_id', 'weapp.Serve/serve') + ->middleware(ApiChannel::class) + ->middleware(ApiCheckToken::class) + ->middleware(ApiLog::class); + Route::group(function() { Route::post('niucloud/notify', function(){ return (new CoreNotifyService())->notify(); @@ -36,6 +42,10 @@ Route::group(function() { Route::group(function() { //获取授权地址 Route::get('wechat/codeurl', 'wechat.Wechat/getCodeUrl'); + //获取授权信息 + Route::get('wechat/user', 'wechat.Wechat/getWechatUser'); + //公众号通过授权信息登录 + Route::post('wechat/userlogin', 'wechat.Wechat/wechatLogin'); //公众号通过code登录 Route::post('wechat/login', 'wechat.Wechat/login'); diff --git a/niucloud/app/command/queue/Queue.php b/niucloud/app/command/queue/Queue.php index 619ed3acc..c5210cb7f 100644 --- a/niucloud/app/command/queue/Queue.php +++ b/niucloud/app/command/queue/Queue.php @@ -51,6 +51,7 @@ class Queue extends Command 'connect_timeout' => 10, 'max_attempts' => 3, 'retry_seconds' => 5, + 'prefix' => md5(root_path()) ]; if(!empty(env('redis.redis_password'))){ $redis_option['auth'] = env('redis.redis_password'); diff --git a/niucloud/app/command/schedule/Schedule.php b/niucloud/app/command/schedule/Schedule.php index a8929dba3..4ca17e915 100644 --- a/niucloud/app/command/schedule/Schedule.php +++ b/niucloud/app/command/schedule/Schedule.php @@ -4,18 +4,14 @@ namespace app\command\schedule; use app\command\WorkerCommand; use app\dict\schedule\ScheduleDict; -use app\service\core\addon\CoreAddonService; use app\service\core\schedule\CoreScheduleService; use think\console\Command; use think\console\Input; use think\console\input\Argument; use think\console\input\Option; use think\console\Output; -use think\helper\Str; use Workerman\Crontab\Crontab; -use Workerman\RedisQueue\Client; use Workerman\Worker; -use yunwuxin\cron\Task; class Schedule extends Command { diff --git a/niucloud/app/common.php b/niucloud/app/common.php index 8b76af006..94647fee2 100644 --- a/niucloud/app/common.php +++ b/niucloud/app/common.php @@ -878,7 +878,7 @@ function file_copy(string $source_file, string $to_file) */ function qrcode($url, $page, $data, $site_id, $dir = '', $channel = 'h5', $style = [ 'is_transparent' => true ], $outfile = true) { - if($outfile){ + if ($outfile) { $dir = $dir ? : 'upload' . '/' . 'qrcode' . '/' . $site_id;//二维码默认存储位置 if (!is_dir($dir) && !mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); @@ -894,7 +894,7 @@ function qrcode($url, $page, $data, $site_id, $dir = '', $channel = 'h5', $style 'filepath' => $path ?? '', 'url' => $url, 'page' => $page, - 'data' => $data , + 'data' => $data, 'site_id' => $site_id, 'channel' => $channel, 'outfile' => $outfile diff --git a/niucloud/app/dict/common/ChannelDict.php b/niucloud/app/dict/common/ChannelDict.php index e85526456..af02b4b27 100644 --- a/niucloud/app/dict/common/ChannelDict.php +++ b/niucloud/app/dict/common/ChannelDict.php @@ -19,25 +19,24 @@ namespace app\dict\common; */ class ChannelDict { - //微信小程序 - public const WEAPP = 'weapp'; - //微信公众号 - public const WECHAT = 'wechat'; - //手机端H5 - public const H5 = 'h5'; //电脑端PC public const PC = 'pc'; + //手机端H5 + public const H5 = 'h5'; //app端 public const APP = 'app'; - + //微信公众号 + public const WECHAT = 'wechat'; + //微信小程序 + public const WEAPP = 'weapp'; public static function getType($type = '') { $data = [ - self::H5 => get_lang('dict_channel.channel_h5'),//'手机H5', - self::APP => get_lang('dict_channel.channel_app'),//'手机app', - self::PC => get_lang('dict_channel.channel_pc'),//'电脑PC', - self::WECHAT => get_lang('dict_channel.channel_wechat'),//'微信公众号', + self::PC => get_lang('dict_channel.channel_pc'),//'电脑PC' + self::H5 => get_lang('dict_channel.channel_h5'),//'手机H5' + self::APP => get_lang('dict_channel.channel_app'),//'手机app' + self::WECHAT => get_lang('dict_channel.channel_wechat'),//'微信公众号' self::WEAPP => get_lang('dict_channel.channel_weapp'),//微信小程序 ]; if (empty($type)) { diff --git a/niucloud/app/dict/diy/ComponentDict.php b/niucloud/app/dict/diy/ComponentDict.php index d8d2ae558..27662de22 100644 --- a/niucloud/app/dict/diy/ComponentDict.php +++ b/niucloud/app/dict/diy/ComponentDict.php @@ -29,7 +29,7 @@ class ComponentDict 'list' => [ 'Text' => [ 'title' => '标题', - 'icon' => 'iconfont-iconbiaoti', + 'icon' => 'iconfont iconbiaotipc', 'path' => 'edit-text', // 编辑组件属性名称 'support_page' => [], // 支持页面 'uses' => 0, // 最大添加数量 @@ -76,7 +76,7 @@ class ComponentDict "fontWeight" => "normal" ], "more" => [ - "text" => "查看更多", + "text" => "更多", "control" => false, "isShow" => true, "link" => [ @@ -88,7 +88,7 @@ class ComponentDict ], 'ImageAds' => [ 'title' => '图片广告', - 'icon' => 'iconfont-icontupianguanggao1', + 'icon' => 'iconfont icontupiandaohangpc', 'path' => 'edit-image-ads', 'support_page' => [], 'uses' => 0, @@ -109,7 +109,7 @@ class ComponentDict ], 'GraphicNav' => [ 'title' => '图文导航', - 'icon' => 'iconfont-icontuwendaohang2', + 'icon' => 'iconfont icontuwendaohangpc', 'path' => 'edit-graphic-nav', 'support_page' => [], 'uses' => 0, @@ -194,7 +194,7 @@ class ComponentDict ], 'RubikCube' => [ 'title' => '魔方', - 'icon' => 'iconfont-iconmofang1', + 'icon' => 'iconfont iconmofangpc', 'path' => 'edit-rubik-cube', 'support_page' => [], 'uses' => 0, @@ -224,7 +224,7 @@ class ComponentDict ], 'HotArea' => [ 'title' => '热区', - 'icon' => 'iconfont-iconrequ', + 'icon' => 'iconfont iconrequpc', 'path' => 'edit-hot-area', 'support_page' => [], 'uses' => 0, @@ -238,7 +238,7 @@ class ComponentDict ], 'MemberInfo' => [ 'title' => '会员信息', - 'icon' => 'iconfont-iconhuiyuanzhongxin', + 'icon' => 'iconfont iconhuiyuanqiandaopc', 'path' => 'edit-member-info', 'support_page' => [ 'DIY_MEMBER_INDEX' ], 'uses' => 1, @@ -253,7 +253,7 @@ class ComponentDict ], 'MemberLevel' => [ 'title' => '会员等级', - 'icon' => 'iconfont-iconhuangguan', + 'icon' => 'iconfont iconhuiyuandengjipc', 'path' => 'edit-member-level', 'support_page' => [], 'uses' => 1, @@ -265,7 +265,7 @@ class ComponentDict ], 'Notice' => [ 'title' => '公告', - 'icon' => 'iconfont-icongonggao', + 'icon' => 'iconfont icongonggaopc', 'path' => 'edit-notice', 'support_page' => [], 'uses' => 0, @@ -292,7 +292,7 @@ class ComponentDict ], 'RichText' => [ 'title' => '富文本', - 'icon' => 'iconfont-iconfuwenben1', + 'icon' => 'iconfont iconfuwenbenpc', 'path' => 'edit-rich-text', 'support_page' => [], 'uses' => 0, @@ -303,7 +303,7 @@ class ComponentDict ], 'ActiveCube' => [ 'title' => '活动魔方', - 'icon' => 'iconfont-iconmofang1', + 'icon' => 'iconfont iconmofangpc', 'path' => 'edit-active-cube', 'support_page' => [], 'uses' => 0, @@ -460,7 +460,7 @@ class ComponentDict ], 'CarouselSearch' => [ 'title' => '轮播搜索', - 'icon' => 'iconfont-iconsousuokuang', + 'icon' => 'iconfont iconlunbosousuopc', 'path' => 'edit-carousel-search', 'support_page' => [], 'uses' => 1, @@ -543,7 +543,7 @@ class ComponentDict ], 'FloatBtn' => [ 'title' => '浮动按钮', - 'icon' => 'iconfont-iconfudonganniu1', + 'icon' => 'iconfont iconfudonganniupc', 'path' => 'edit-float-btn', 'support_page' => [], 'uses' => 1, @@ -566,7 +566,7 @@ class ComponentDict ], 'HorzBlank' => [ 'title' => '辅助空白', - 'icon' => 'iconfont-iconfuzhukongbai1', + 'icon' => 'iconfont iconfuzhukongbaipc', 'path' => 'edit-horz-blank', 'support_page' => [], 'uses' => 0, @@ -577,7 +577,7 @@ class ComponentDict ], 'HorzLine' => [ 'title' => '辅助线', - 'icon' => 'iconfont-iconfuzhuxian1', + 'icon' => 'iconfont iconfuzhuxianpc', 'path' => 'edit-horz-line', 'support_page' => [], 'uses' => 0, diff --git a/niucloud/app/dict/diy/LinkDict.php b/niucloud/app/dict/diy/LinkDict.php index 553f98d07..5b77d1888 100644 --- a/niucloud/app/dict/diy/LinkDict.php +++ b/niucloud/app/dict/diy/LinkDict.php @@ -132,6 +132,22 @@ class LinkDict 'key' => 'app' ], 'child_list' => [] + ], + 'DIY_JUMP_OTHER_APPLET' => [ + 'title' => get_lang('dict_diy.diy_jump_other_applet'), + 'addon_info' => [ + 'title' => '系统', + 'key' => 'app' + ], + 'child_list' => [] + ], + 'DIY_MAKE_PHONE_CALL' => [ + 'title' => get_lang('dict_diy.diy_make_phone_call'), + 'addon_info' => [ + 'title' => '系统', + 'key' => 'app' + ], + 'child_list' => [] ] ]; diff --git a/niucloud/app/dict/diy/PagesDict.php b/niucloud/app/dict/diy/PagesDict.php index 2d7e61d86..3da0fdf78 100644 --- a/niucloud/app/dict/diy/PagesDict.php +++ b/niucloud/app/dict/diy/PagesDict.php @@ -500,7 +500,7 @@ class PagesDict "color" => "#FFFFFF" ], "imageSize" => 25, - "aroundRadius" => 25, + "aroundRadius" => 0, "font" => [ "size" => 13, "weight" => "normal", @@ -943,7 +943,7 @@ class PagesDict "color" => "#FFFFFF" ], "imageSize" => 25, - "aroundRadius" => 25, + "aroundRadius" => 0, "font" => [ "size" => 13, "weight" => "normal", diff --git a/niucloud/app/dict/member/MemberLevelDict.php b/niucloud/app/dict/member/MemberLevelDict.php new file mode 100644 index 000000000..f03195ea4 --- /dev/null +++ b/niucloud/app/dict/member/MemberLevelDict.php @@ -0,0 +1,77 @@ + [ + 'bg_color' => '#414852', + 'level_color' => '#666666', + 'progress' => ['#999999','#666666'], + 'gift'=> '#ECEBEB', + ], + 'level_2' => [ + 'bg_color' => '#354B54', + 'level_color' => '#116787', + 'progress' => ['#4BA5C7','#116787'], + 'gift'=> '#F1FDFF', + ], + 'level_3' => [ + 'bg_color' => '#203B54', + 'level_color' => '#286BAA', + 'progress' => ['#529BDF','#286BAA'], + 'gift'=> '#E3F2FF', + ], + 'level_4' => [ + 'bg_color' => '#403E32', + 'level_color' => '#967600', + 'progress' => ['#D1A400','#967600'], + 'gift'=> '#FFFAE3', + ], + 'level_5' => [ + 'bg_color' => '#36354B', + 'level_color' => '#4B3EF9', + 'progress' => ['#8F87FF','#4B3EF9'], + 'gift'=> '#E7EEFF', + ], + 'level_6' => [ + 'bg_color' => '#362F28', + 'level_color' => '#9F5300', + 'progress' => ['#EFA244','#9F5300'], + 'gift'=> '#FFF5DC', + ], + 'level_7' => [ + 'bg_color' => '#322432', + 'level_color' => '#DE43D6', + 'progress' => ['#FFA0FA','#DE43D6'], + 'gift'=> '#FFEAFF', + ], + 'level_8' => [ + 'bg_color' => '#301C1E', + 'level_color' => '#DE000B', + 'progress' => ['#FF8B36','#DE000B'], + 'gift'=> '#FFE3E6', + ], + ]; + } +} \ No newline at end of file diff --git a/niucloud/app/dict/member/gift.php b/niucloud/app/dict/member/gift.php index 6114a781e..459178af1 100644 --- a/niucloud/app/dict/member/gift.php +++ b/niucloud/app/dict/member/gift.php @@ -23,6 +23,24 @@ return [ 'background' => '/static/resource/images/member/gift/gift_balance_bg.png' ]; return $content; + }, + // 会员签到(日签) + 'member_sign' => function($site_id, $config) { + $content = []; + $content[] = [ + 'text' => "{$config['money']}元", + 'icon' => '/static/resource/images/member/sign/packet.png' + ]; + return $content; + }, + // 会员签到(连签) + 'member_sign_continue' => function($site_id, $config) { + $content = []; + $content[] = [ + 'text' => "{$config['money']}元", + 'icon' => '/static/resource/images/member/sign/packet01.png' + ]; + return $content; } ] ], @@ -47,6 +65,24 @@ return [ 'background' => '/static/resource/images/member/gift/gift_point_bg.png' ]; return $content; + }, + // 会员签到(日签) + 'member_sign' => function($site_id, $config) { + $content = []; + $content[] = [ + 'text' => "{$config['num']}积分", + 'icon' => '/static/resource/images/member/sign/point.png' + ]; + return $content; + }, + // 会员签到(连签) + 'member_sign_continue' => function($site_id, $config) { + $content = []; + $content[] = [ + 'text' => "{$config['num']}积分", + 'icon' => '/static/resource/images/member/sign/point01.png' + ]; + return $content; } ] ] diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index 52698ded8..a34b0fe05 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -6,7 +6,7 @@ return [ 'menu_short_name' => '首页', 'parent_key' => '', 'menu_type' => '1', - 'icon' => 'element-Monitor', + 'icon' => 'element Monitor', 'api_url' => '', 'router_path' => 'index', 'view_path' => 'index/index', @@ -14,6 +14,22 @@ return [ 'sort' => '100', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '统计数据', + 'menu_key' => 'admin_index_stat', + 'menu_short_name' => '统计数据', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'stat/index', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '系统设置', @@ -21,7 +37,7 @@ return [ 'menu_short_name' => '配置', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Setting', + 'icon' => 'element Setting', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -35,7 +51,7 @@ return [ 'menu_key' => 'website_setting', 'menu_short_name' => '网站设置', 'menu_type' => '0', - 'icon' => 'iconfont-iconwangzhan1', + 'icon' => 'iconfont iconwangzhan1', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -49,7 +65,7 @@ return [ 'menu_key' => 'base_setting', 'menu_short_name' => '基础设置', 'menu_type' => '1', - 'icon' => 'element-Basketball', + 'icon' => 'element Basketball', 'api_url' => 'sys/config/website', 'router_path' => 'setting/website/system', 'view_path' => 'setting/system', @@ -57,13 +73,29 @@ return [ 'sort' => '100', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_base_setting', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/website', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '版权设置', 'menu_key' => 'setting_copyright', 'menu_short_name' => '版权设置', 'menu_type' => '1', - 'icon' => 'iconfont-iconbanquan1', + 'icon' => 'iconfont iconbanquan1', 'api_url' => 'sys/config/copyright', 'router_path' => 'setting/website/copyright', 'view_path' => 'setting/copyright', @@ -71,6 +103,22 @@ return [ 'sort' => '90', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_setting_copyright', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/copyright', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ], ], @@ -79,7 +127,7 @@ return [ 'menu_key' => 'auth', 'menu_short_name' => '权限设置', 'menu_type' => '0', - 'icon' => 'iconfont-iconquanxianguanli', + 'icon' => 'iconfont iconquanxianguanli', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -93,21 +141,107 @@ return [ 'menu_key' => 'auth_list', 'menu_short_name' => '管理员', 'menu_type' => '1', - 'icon' => 'element-Lock', - 'api_url' => '', + 'icon' => 'element Lock', + 'api_url' => 'site/user', 'router_path' => 'setting/auth/user', 'view_path' => 'auth/user', - 'methods' => '', + 'methods' => 'get', 'sort' => '100', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '管理员信息', + 'menu_key' => 'auth_user_detail', + 'menu_short_name' => '管理员信息', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加管理员', + 'menu_key' => 'add_site_user', + 'menu_short_name' => '添加管理员', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑管理员', + 'menu_key' => 'edit_site_user', + 'menu_short_name' => '编辑管理员', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '修改管理员属性', + 'menu_key' => 'edit_site_user_field', + 'menu_short_name' => '修改管理员属性', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user//', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '锁定', + 'menu_key' => 'lock_site_user', + 'menu_short_name' => '锁定', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/lock/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '解锁', + 'menu_key' => 'unlock_site_user', + 'menu_short_name' => '解锁用户', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/unlock/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '管理员角色', 'menu_key' => 'auth_role', 'menu_short_name' => '管理员角色', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuiyuanliebiao', + 'icon' => 'iconfont iconhuiyuanliebiao', 'api_url' => 'sys/role', 'router_path' => 'setting/auth/role', 'view_path' => 'auth/role', @@ -165,7 +299,7 @@ return [ 'menu_key' => 'auth_log', 'menu_short_name' => '操作日志', 'menu_type' => '1', - 'icon' => 'element-Document', + 'icon' => 'element Document', 'api_url' => 'sys/log', 'router_path' => 'setting/auth/log', 'view_path' => 'auth/log', @@ -181,7 +315,7 @@ return [ 'menu_key' => 'setting_storage', 'menu_short_name' => '存储设置', 'menu_type' => '1', - 'icon' => 'element-FolderChecked', + 'icon' => 'element FolderChecked', 'api_url' => 'sys/storage', 'router_path' => 'setting/storage', 'view_path' => 'setting/storage', @@ -189,13 +323,43 @@ return [ 'sort' => '30', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '获取存储配置', + 'menu_key' => 'setting_storage_value', + 'menu_short_name' => '获取存储配置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/storage/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '存储设置修改', + 'menu_key' => 'edit_setting_storage', + 'menu_short_name' => '存储设置修改', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/storage/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '登录设置', 'menu_key' => 'setting_login', 'menu_short_name' => '登录设置', 'menu_type' => '1', - 'icon' => 'iconfont-iconzhuceshezhi', + 'icon' => 'iconfont iconzhuceshezhi', 'api_url' => 'sys/config/login', 'router_path' => 'setting/adminlogin', 'view_path' => 'setting/adminlogin', @@ -203,41 +367,105 @@ return [ 'sort' => '20', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_setting_login', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/login', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '微信开放平台', - 'menu_key' => 'setting_oplatform', + 'menu_key' => 'wx_oplatform', 'menu_short_name' => '微信开放平台', - 'menu_type' => '1', - 'icon' => 'iconfont-iconweixin', - 'api_url' => 'sys/wxoplatform', - 'router_path' => 'setting/oplatform', - 'view_path' => 'setting/wxoplatform', - 'methods' => 'get', - 'sort' => '20', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '小程序平台', - 'menu_key' => 'setting_weapp_oplatform', - 'menu_short_name' => '小程序平台', - 'menu_type' => '1', - 'icon' => 'iconfont-iconxiaochengxushezhi', - 'api_url' => 'sys/weapp', - 'router_path' => 'setting/weapp', - 'view_path' => 'setting/weapp', + 'menu_type' => '0', + 'icon' => 'iconfont iconweixin', + 'api_url' => '', + 'router_path' => '', + 'view_path' => '', 'methods' => 'get', 'sort' => '20', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '开放平台配置', + 'menu_key' => 'setting_oplatform', + 'menu_short_name' => '开放平台配置', + 'menu_type' => '1', + 'icon' => 'iconfont iconweixin', + 'api_url' => 'wxoplatform/config', + 'router_path' => 'setting/oplatform', + 'view_path' => 'wxoplatform/setting', + 'methods' => 'get', + 'sort' => '20', + 'status' => '1', + 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_wxoplatform_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wxoplatform/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + [ + 'menu_name' => '小程序同步', + 'menu_key' => 'oplatform_weapp_version', + 'menu_short_name' => '小程序同步', + 'menu_type' => '1', + 'icon' => 'iconfont iconweixin', + 'api_url' => 'wxoplatform/weapp/commit', + 'router_path' => 'wxoplatform/weapp_version', + 'view_path' => 'wxoplatform/weapp_version', + 'methods' => 'get', + 'sort' => '10', + 'status' => '1', + 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '同步', + 'menu_key' => 'commit_oplatform_weapp_version', + 'menu_short_name' => '同步', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wxoplatform/weapp/version/commit', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + ] ], [ 'menu_name' => '素材管理', 'menu_key' => 'attachment', 'menu_short_name' => '素材管理', 'menu_type' => '1', - 'icon' => 'element-Files', + 'icon' => 'element Files', 'api_url' => 'sys/attachment', 'router_path' => 'setting/attachment', 'view_path' => 'tools/attachment', @@ -245,13 +473,99 @@ return [ 'sort' => '10', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '删除素材', + 'menu_key' => 'delete_attachment', + 'menu_short_name' => '删除素材', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/del', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '移动素材', + 'menu_key' => 'move_attachment', + 'menu_short_name' => '移动素材', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/batchmove', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加分组', + 'menu_key' => 'add_attachment_category', + 'menu_short_name' => '删除素材', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加分组', + 'menu_key' => 'add_attachment_category', + 'menu_short_name' => '添加分组', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑分组', + 'menu_key' => 'edit_attachment_category', + 'menu_short_name' => '编辑分组', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑分组', + 'menu_key' => 'edit_attachment_category', + 'menu_short_name' => '编辑分组', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + ] ], [ 'menu_name' => '地图设置', 'menu_key' => 'map_setting', 'menu_short_name' => '地图设置', 'menu_type' => '1', - 'icon' => 'element-Message', + 'icon' => 'element Message', 'api_url' => 'sys/config/map', 'router_path' => 'setting/map', 'view_path' => 'setting/map', @@ -259,13 +573,29 @@ return [ 'sort' => '9', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_layout_setting', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/map', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '布局设置', 'menu_key' => 'layout_setting', 'menu_short_name' => '布局设置', 'menu_type' => '1', - 'icon' => 'element-Message', + 'icon' => 'element Message', 'api_url' => 'sys/config/layout', 'router_path' => 'setting/layout', 'view_path' => 'setting/layout', @@ -273,6 +603,22 @@ return [ 'sort' => '8', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_layout_setting', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/layout', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ], ], @@ -282,7 +628,7 @@ return [ 'menu_short_name' => '站点', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Memo', + 'icon' => 'element Memo', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -296,7 +642,7 @@ return [ 'menu_key' => 'site_list', 'menu_short_name' => '站点列表', 'menu_type' => '1', - 'icon' => 'element-OfficeBuilding', + 'icon' => 'element OfficeBuilding', 'api_url' => 'site/site', 'router_path' => 'site/list', 'view_path' => 'site/list', @@ -347,22 +693,36 @@ return [ 'status' => '1', 'is_show' => '1', ], + [ + 'menu_name' => '关闭站点', + 'menu_key' => 'close_site', + 'menu_short_name' => '关闭站点', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/closesite/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '开启站点', + 'menu_key' => 'open_site', + 'menu_short_name' => '开启站点', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/opensite/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], ], ], - [ - 'menu_name' => '站点用户', - 'menu_key' => 'site_user_list', - 'menu_short_name' => '站点用户', - 'menu_type' => '1', - 'icon' => 'element-OfficeBuilding', - 'api_url' => 'site/user', - 'router_path' => 'site/user', - 'view_path' => 'site/user', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - ], [ 'menu_name' => '站点详情', 'menu_key' => 'site_info', @@ -382,8 +742,8 @@ return [ 'menu_key' => 'site_user_info', 'menu_short_name' => '用户详情', 'menu_type' => '1', - 'icon' => 'element-OfficeBuilding', - 'api_url' => '', + 'icon' => 'element OfficeBuilding', + 'api_url' => 'user/user/', 'router_path' => 'site/user_info', 'view_path' => 'site/user_info', 'methods' => 'get', @@ -396,7 +756,7 @@ return [ 'menu_key' => 'site_group', 'menu_short_name' => '站点套餐', 'menu_type' => '1', - 'icon' => 'element-PriceTag', + 'icon' => 'element PriceTag', 'api_url' => 'site/group', 'router_path' => 'site/group', 'view_path' => 'site/group', @@ -404,30 +764,176 @@ return [ 'sort' => '80', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '删除站点套餐', + 'menu_key' => 'delete_site_group', + 'menu_short_name' => '删除站点套餐', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/group/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '站点套餐编辑', 'menu_key' => 'site_group_edit', 'menu_short_name' => '站点套餐编辑', 'menu_type' => '1', - 'icon' => 'element-PriceTag', - 'api_url' => 'site/group_edit', + 'icon' => 'element PriceTag', + 'api_url' => '', 'router_path' => 'site/group_edit', 'view_path' => 'site/group_edit', - 'methods' => 'get', + 'methods' => '', 'sort' => '70', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '添加站点套餐', + 'menu_key' => 'add_site_group', + 'menu_short_name' => '添加站点套餐', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/group', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑站点套餐', + 'menu_key' => 'edit_site_group', + 'menu_short_name' => '编辑站点套餐', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/group/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ], ], + [ + 'menu_name' => '用户', + 'menu_key' => 'site_user_list', + 'menu_short_name' => '用户', + 'menu_type' => '1', + 'icon' => 'iconfont iconhuiyuanzhongxin', + 'api_url' => 'user/user', + 'router_path' => 'site/user', + 'view_path' => 'site/user', + 'methods' => 'get', + 'sort' => '79', + 'status' => '1', + 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '添加站点用户', + 'menu_key' => 'add_user', + 'menu_short_name' => '', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'user/user', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '获取用户套餐权限', + 'menu_key' => 'get_user_create_site_limit', + 'menu_short_name' => '', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'user/user/create_site_limit/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '获取用户套餐权限信息', + 'menu_key' => 'get_user_create_site_limit_info', + 'menu_short_name' => '', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'user/user/create_site_limit/info/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加套餐权限', + 'menu_key' => 'add_user_create_site_limit', + 'menu_short_name' => '', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'user/user/create_site_limit', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑套餐权限', + 'menu_key' => 'edit_user_create_site_limit', + 'menu_short_name' => '', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'user/user/create_site_limit/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '删除套餐权限', + 'menu_key' => 'del_user_create_site_limit', + 'menu_short_name' => '', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'user/user/create_site_limit/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + ] + ], [ 'menu_name' => '应用市场', 'menu_key' => 'app_store', 'menu_short_name' => '应用', 'parent_key' => '', 'menu_type' => '1', - 'icon' => 'element-ShoppingBag', + 'icon' => 'element ShoppingBag', 'api_url' => 'addon/local', 'router_path' => 'app_manage/app_store', 'view_path' => 'index/store', @@ -435,13 +941,99 @@ return [ 'sort' => '70', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '安装插件', + 'menu_key' => 'install_addon', + 'menu_short_name' => '安装插件', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/install/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '插件卸载', + 'menu_key' => 'uninstall_addon', + 'menu_short_name' => '插件卸载', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/uninstall/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '插件云安装', + 'menu_key' => 'cloud_install_addon', + 'menu_short_name' => '插件云安装', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/cloudinstall/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '插件下载', + 'menu_key' => 'addon_download', + 'menu_short_name' => '插件下载', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/download/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '云编译', + 'menu_key' => 'cloud_build', + 'menu_short_name' => '云编译', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'niucloud/build', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '插件升级', + 'menu_key' => 'addon_upgrade', + 'menu_short_name' => '插件升级', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'upgrade/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '开发', 'menu_key' => 'app_manage_tool', 'menu_short_name' => '开发', 'menu_type' => '1', - 'icon' => 'iconfont-iconchajian1', + 'icon' => 'iconfont iconchajian1', 'api_url' => '', 'router_path' => 'app_manage/tools', 'view_path' => 'index/tools', @@ -456,7 +1048,7 @@ return [ 'menu_short_name' => '工具管理', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Edit', + 'icon' => 'element Edit', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -470,7 +1062,7 @@ return [ 'menu_key' => 'addon_develop', 'menu_short_name' => '插件开发', 'menu_type' => '1', - 'icon' => 'iconfont-iconchajiankaifa', + 'icon' => 'iconfont iconchajiankaifa', 'api_url' => '', 'router_path' => 'tools/addon', 'view_path' => 'tools/addon/index', @@ -478,13 +1070,43 @@ return [ 'sort' => '110', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '删除插件', + 'menu_key' => 'delete_develop_addon', + 'menu_short_name' => '删除插件', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/addon_develop/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '打包插件', + 'menu_key' => 'build_develop_addon', + 'menu_short_name' => '打包插件', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/addon_develop/build/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '代码生成', 'menu_key' => 'code', 'menu_short_name' => '代码生成', 'menu_type' => '1', - 'icon' => 'iconfont-icondaimashengcheng', + 'icon' => 'iconfont icondaimashengcheng', 'api_url' => 'generator/generator', 'router_path' => 'tools/code', 'view_path' => 'tools/code/index', @@ -493,6 +1115,78 @@ return [ 'status' => '1', 'is_show' => '1', ], + [ + 'menu_name' => '数据表编辑', + 'menu_key' => 'code_edit', + 'menu_short_name' => '数据表编辑', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => '', + 'router_path' => 'tools/code/edit', + 'view_path' => 'tools/code/edit', + 'methods' => '', + 'sort' => '99', + 'status' => '1', + 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '添加数据表', + 'menu_key' => 'add_generator', + 'menu_short_name' => '添加数据表', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'generator/generator', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑数据表', + 'menu_key' => 'edit_generator', + 'menu_short_name' => '编辑数据表', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'generator/generator/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '删除数据表', + 'menu_key' => 'delete_generator', + 'menu_short_name' => '删除数据表', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'generator/generator/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '代码生成', + 'menu_key' => 'generator_download', + 'menu_short_name' => '代码生成', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'generator/download', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], [ 'menu_name' => '插件添加/编辑', 'menu_key' => 'addon_edit', @@ -506,13 +1200,43 @@ return [ 'sort' => '90', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '添加插件', + 'menu_key' => 'add_develop_addon', + 'menu_short_name' => '添加插件', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/addon_develop/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑插件', + 'menu_key' => 'edit_develop_addon', + 'menu_short_name' => '编辑插件', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'addon/addon_develop/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + ] ], [ 'menu_name' => '数据字典', 'menu_key' => 'sys_dict_dict_dict_list', 'menu_short_name' => '数据字典', 'menu_type' => '1', - 'icon' => 'iconfont-iconwenzhangguanli1', + 'icon' => 'iconfont iconwenzhangguanli1', 'api_url' => 'dict/post/post', 'router_path' => 'tools/list', 'view_path' => 'dict/list', @@ -565,26 +1289,12 @@ return [ ], ], ], - [ - 'menu_name' => '数据表编辑', - 'menu_key' => 'code_edit', - 'menu_short_name' => '数据表编辑', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'tools/code/edit', - 'view_path' => 'tools/code/edit', - 'methods' => '', - 'sort' => '80', - 'status' => '1', - 'is_show' => '0', - ], [ 'menu_name' => '环境检测', 'menu_key' => 'tools_check_environment', 'menu_short_name' => '环境检测', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuanjingjiance', + 'icon' => 'iconfont iconhuanjingjiance', 'api_url' => '', 'router_path' => 'tools/detection', 'view_path' => 'tools/detection', @@ -742,7 +1452,7 @@ return [ 'menu_key' => 'tools_schedule', 'menu_short_name' => '计划任务', 'menu_type' => '1', - 'icon' => 'iconfont-iconjihuarenwu', + 'icon' => 'iconfont iconjihuarenwu', 'api_url' => 'sys/schedule/list', 'router_path' => 'tools/schedule', 'view_path' => 'tools/schedule', @@ -814,21 +1524,51 @@ return [ 'menu_key' => 'app_auth', 'menu_short_name' => '授权信息', 'menu_type' => '1', - 'icon' => 'iconfont-iconshouquanxinxi2', - 'api_url' => 'niucloud/authinfo', + 'icon' => 'iconfont iconshouquanxinxi2', + 'api_url' => '', 'router_path' => 'tools/authorize', 'view_path' => 'app/authorize', - 'methods' => 'get', + 'methods' => '', 'sort' => '30', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '系统升级', + 'menu_key' => 'system_upgrade', + 'menu_short_name' => '系统升级', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'upgrade', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '绑定授权信息', + 'menu_key' => 'bind_app_auth', + 'menu_short_name' => '绑定授权信息', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'niucloud/authinfo', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '开发者key', 'menu_key' => 'developer_token', 'menu_short_name' => '开发者key', 'menu_type' => '1', - 'icon' => 'iconfont-iconshouquanxinxi2', + 'icon' => 'iconfont iconshouquanxinxi2', 'api_url' => 'sys/config/developer_token', 'router_path' => 'tools/developer_token', 'view_path' => 'setting/developer_token', @@ -836,6 +1576,22 @@ return [ 'sort' => '20', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_developer_token', + 'menu_short_name' => '同步', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/developer_token', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ], ], diff --git a/niucloud/app/dict/menu/site.php b/niucloud/app/dict/menu/site.php index 39288f063..9f026e23a 100644 --- a/niucloud/app/dict/menu/site.php +++ b/niucloud/app/dict/menu/site.php @@ -6,7 +6,7 @@ return [ 'menu_short_name' => '装修', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Brush', + 'icon' => 'element Brush', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -34,7 +34,7 @@ return [ 'menu_key' => 'diy_page_decorate_index', 'menu_short_name' => '启动页', 'menu_type' => '1', - 'icon' => 'element-House', + 'icon' => 'element House', 'api_url' => '', 'router_path' => 'diy/index', 'view_path' => 'diy/index', @@ -42,13 +42,29 @@ return [ 'sort' => '100', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '设置使用页', + 'menu_key' => 'set_siy_use', + 'menu_short_name' => '设置使用页', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'diy/use', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '个人中心', 'menu_key' => 'diy_page_decorate_member_index', 'menu_short_name' => '个人中心', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuiyuanliebiao', + 'icon' => 'iconfont iconhuiyuanliebiao', 'api_url' => '', 'router_path' => 'diy/member', 'view_path' => 'diy/member', @@ -76,7 +92,7 @@ return [ 'menu_key' => 'diy_page_list', 'menu_short_name' => '微页面', 'menu_type' => '1', - 'icon' => 'iconfont-icondianpuzhuangxiu', + 'icon' => 'iconfont icondianpuzhuangxiu', 'api_url' => 'diy/diy', 'router_path' => 'diy/list', 'view_path' => 'diy/list', @@ -84,13 +100,29 @@ return [ 'sort' => '98', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '分享设置', + 'menu_key' => 'save_diy_share', + 'menu_short_name' => '分享设置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'diy/diy/share', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '页面路径', 'menu_key' => 'diy_page_route', 'menu_short_name' => '页面路径', 'menu_type' => '1', - 'icon' => 'iconfont-icondianpuzhuangxiu', + 'icon' => 'iconfont icondianpuzhuangxiu', 'api_url' => 'diy/diy', 'router_path' => 'diy/route', 'view_path' => 'diy/route', @@ -104,7 +136,7 @@ return [ 'menu_key' => 'diy_bottom', 'menu_short_name' => '底部导航', 'menu_type' => '1', - 'icon' => 'iconfont-icondibudaohang', + 'icon' => 'iconfont icondibudaohang', 'api_url' => 'diy/bottom', 'router_path' => 'diy/tabbar', 'view_path' => 'diy/tabbar', @@ -134,7 +166,7 @@ return [ 'menu_key' => 'attachment', 'menu_short_name' => '素材管理', 'menu_type' => '1', - 'icon' => 'element-Files', + 'icon' => 'element Files', 'api_url' => 'sys/attachment', 'router_path' => 'diy/attachment', 'view_path' => 'tools/attachment', @@ -142,13 +174,99 @@ return [ 'sort' => '95', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '删除素材', + 'menu_key' => 'delete_attachment', + 'menu_short_name' => '删除素材', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/del', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '移动素材', + 'menu_key' => 'move_attachment', + 'menu_short_name' => '移动素材', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/batchmove', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加分组', + 'menu_key' => 'add_attachment_category', + 'menu_short_name' => '删除素材', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加分组', + 'menu_key' => 'add_attachment_category', + 'menu_short_name' => '添加分组', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑分组', + 'menu_key' => 'edit_attachment_category', + 'menu_short_name' => '编辑分组', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '编辑分组', + 'menu_key' => 'edit_attachment_category', + 'menu_short_name' => '编辑分组', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/attachment/category/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + ] ], [ 'menu_name' => '海报管理', 'menu_key' => 'poster_management', 'menu_short_name' => '海报管理', 'menu_type' => '1', - 'icon' => 'element-Files', + 'icon' => 'element Files', 'api_url' => 'poster', 'router_path' => 'poster/list', 'view_path' => 'poster/list', @@ -179,7 +297,7 @@ return [ 'menu_short_name' => '会员', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'iconfont-iconjiaoseyonghu', + 'icon' => 'iconfont iconjiaoseyonghu', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -193,7 +311,7 @@ return [ 'menu_key' => 'member_list', 'menu_short_name' => '会员列表', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuiyuanliebiao', + 'icon' => 'iconfont iconhuiyuanliebiao', 'api_url' => 'member/member', 'router_path' => 'member/member', 'view_path' => 'member/member', @@ -203,7 +321,7 @@ return [ 'is_show' => '1', 'children' => [ [ - 'menu_name' => '编辑', + 'menu_name' => '编辑会员', 'menu_key' => 'member_update', 'menu_short_name' => '编辑', 'menu_type' => '2', @@ -216,6 +334,34 @@ return [ 'status' => '1', 'is_show' => '1', ], + [ + 'menu_name' => '添加会员', + 'menu_key' => 'member_add', + 'menu_short_name' => '添加', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/member', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '0', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '会员导出', + 'menu_key' => 'member_export', + 'menu_short_name' => '会员导出', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/member/export', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '0', + 'status' => '1', + 'is_show' => '1', + ], ], ], [ @@ -267,7 +413,7 @@ return [ 'menu_key' => 'member_label', 'menu_short_name' => '会员标签', 'menu_type' => '1', - 'icon' => 'element-CollectionTag', + 'icon' => 'element CollectionTag', 'api_url' => 'member/label', 'router_path' => 'member/label', 'view_path' => 'member/label', @@ -325,7 +471,7 @@ return [ 'menu_key' => 'member_level', 'menu_short_name' => '会员等级', 'menu_type' => '0', - 'icon' => 'element-CollectionTag', + 'icon' => 'element CollectionTag', 'api_url' => 'member/level', 'router_path' => 'member/level', 'view_path' => 'member/level', @@ -339,7 +485,7 @@ return [ 'menu_key' => 'member_level_list', 'menu_short_name' => '会员等级', 'menu_type' => '1', - 'icon' => 'element-CollectionTag', + 'icon' => 'element CollectionTag', 'api_url' => 'member/level', 'router_path' => 'member/level', 'view_path' => 'member/level', @@ -351,7 +497,7 @@ return [ [ 'menu_name' => '添加等级', 'menu_key' => 'member_level_add', - 'menu_short_name' => '添加标签', + 'menu_short_name' => '添加等级', 'menu_type' => '2', 'icon' => '', 'api_url' => 'member/level', @@ -365,7 +511,7 @@ return [ [ 'menu_name' => '编辑等级', 'menu_key' => 'member_level_edit', - 'menu_short_name' => '编辑标签', + 'menu_short_name' => '编辑等级', 'menu_type' => '2', 'icon' => '', 'api_url' => 'member/level/', @@ -398,13 +544,29 @@ return [ 'menu_short_name' => '添加/编辑等级', 'menu_type' => '1', 'icon' => '', - 'api_url' => 'member/label/', + 'api_url' => '', 'router_path' => 'member/level_edit', 'view_path' => 'member/level_edit', - 'methods' => 'get', + 'methods' => '', 'sort' => '49', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '会员等级信息', + 'menu_key' => 'member_level_info', + 'menu_short_name' => '会员等级信息', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/level/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '成长值规则', @@ -443,7 +605,7 @@ return [ 'menu_key' => 'member_growth', 'menu_short_name' => '会员成长值', 'menu_type' => '1', - 'icon' => 'iconfont-iconjifen-xianxing', + 'icon' => 'iconfont iconjifen-xianxing', 'api_url' => 'member/account/growth', 'router_path' => 'member/growth', 'view_path' => 'member/growth', @@ -457,11 +619,11 @@ return [ 'menu_key' => 'member_point', 'menu_short_name' => '会员积分', 'menu_type' => '0', - 'icon' => 'iconfont-iconjifen-xianxing', - 'api_url' => 'member/account/point', - 'router_path' => 'member/point', - 'view_path' => 'member/point', - 'methods' => 'get', + 'icon' => 'iconfont iconjifen-xianxing', + 'api_url' => '', + 'router_path' => '', + 'view_path' => '', + 'methods' => '', 'sort' => '51', 'status' => '1', 'is_show' => '1', @@ -471,7 +633,7 @@ return [ 'menu_key' => 'member_point_list', 'menu_short_name' => '积分明细', 'menu_type' => '1', - 'icon' => 'iconfont-iconjifen-xianxing', + 'icon' => 'iconfont iconjifen-xianxing', 'api_url' => 'member/account/point', 'router_path' => 'member/point', 'view_path' => 'member/point', @@ -517,7 +679,7 @@ return [ 'menu_key' => 'member_balance', 'menu_short_name' => '会员余额', 'menu_type' => '1', - 'icon' => 'element-Money', + 'icon' => 'element Money', 'api_url' => 'member/account/balance', 'router_path' => 'member/balance', 'view_path' => 'member/balance', @@ -531,7 +693,7 @@ return [ 'menu_key' => 'member_commission', 'menu_short_name' => '会员佣金', 'menu_type' => '1', - 'icon' => 'element-Money', + 'icon' => 'element Money', 'api_url' => 'member/account/commission', 'router_path' => 'member/commission', 'view_path' => 'member/commission', @@ -548,7 +710,7 @@ return [ 'menu_short_name' => '财务', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Box', + 'icon' => 'element Box', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -562,7 +724,7 @@ return [ 'menu_key' => 'site_account_list', 'menu_short_name' => '财务流水', 'menu_type' => '1', - 'icon' => 'element-Postcard', + 'icon' => 'element Postcard', 'api_url' => 'finance/account', 'router_path' => 'finance/account', 'view_path' => 'finance/account', @@ -576,7 +738,7 @@ return [ 'menu_key' => 'site_pay_detail', 'menu_short_name' => '支付单据详情', 'menu_type' => '1', - 'icon' => 'element-Postcard', + 'icon' => 'element Postcard', 'api_url' => 'pay/detail', 'router_path' => 'finance/pay/detail', 'view_path' => 'finance/pay_detail', @@ -590,7 +752,7 @@ return [ 'menu_key' => 'cash_out_list', 'menu_short_name' => '会员提现', 'menu_type' => '1', - 'icon' => 'element-Postcard', + 'icon' => 'element Postcard', 'api_url' => 'member/cash_out', 'router_path' => 'finance/cash_out', 'view_path' => 'finance/cash_out', @@ -598,28 +760,74 @@ return [ 'sort' => '97', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '提现审核', + 'menu_key' => 'cash_out_audit', + 'menu_short_name' => '提现审核', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/cash_out/audit//', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '转账', + 'menu_key' => 'cash_out_transfer', + 'menu_short_name' => '转账', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/cash_out/transfer/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '会员退款', 'menu_key' => 'member_refund_list', 'menu_short_name' => '会员退款', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuiyuantixian', - 'api_url' => 'pay/pay_refund', + 'icon' => 'iconfont iconhuiyuantixian', + 'api_url' => 'pay/refund', 'router_path' => 'finance/refund', 'view_path' => 'finance/pay_refund', 'methods' => 'get', 'sort' => '9', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '转账', + 'menu_key' => 'cash_out_transfer', + 'menu_short_name' => '转账', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'pay/refund/transfer/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '退款详情', 'menu_key' => 'member_refund_detail', 'menu_short_name' => '退款详情', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuiyuantixian', - 'api_url' => 'pay/refund', + 'icon' => 'iconfont iconhuiyuantixian', + 'api_url' => 'pay/refund/', 'router_path' => 'finance/refund/detail', 'view_path' => 'finance/refund_detail', 'methods' => 'get', @@ -635,7 +843,7 @@ return [ 'menu_short_name' => '营销', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'iconfont-iconyingxiao', + 'icon' => 'iconfont iconyingxiao', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -664,13 +872,43 @@ return [ 'menu_short_name' => '核销员', 'menu_type' => '1', 'icon' => '', - 'api_url' => '', + 'api_url' => 'verify/verifier', 'router_path' => 'marketing/verifier', 'view_path' => 'marketing/verifier', 'methods' => 'get', 'sort' => '48', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '添加核销员', + 'menu_key' => 'add_verifier', + 'menu_short_name' => '添加核销员', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'verify/verifier', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '删除核销员', + 'menu_key' => 'delete_verifier', + 'menu_short_name' => '删除核销员', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'verify/verifier/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '核销记录', @@ -678,7 +916,7 @@ return [ 'menu_short_name' => '核销记录', 'menu_type' => '1', 'icon' => '', - 'api_url' => '', + 'api_url' => 'verify/verify/record', 'router_path' => 'marketing/verify', 'view_path' => 'marketing/verify', 'methods' => 'get', @@ -692,7 +930,7 @@ return [ 'menu_short_name' => '核销详情', 'menu_type' => '1', 'icon' => '', - 'api_url' => '', + 'api_url' => 'verify/verify/', 'router_path' => 'marketing/verify/detail', 'view_path' => 'marketing/verify_detail', 'methods' => 'get', @@ -707,7 +945,7 @@ return [ 'menu_key' => 'sign', 'menu_short_name' => '签到管理', 'menu_type' => '1', - 'icon' => 'element-FolderChecked', + 'icon' => 'element FolderChecked', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -721,22 +959,38 @@ return [ 'menu_key' => 'sign_set', 'menu_short_name' => '签到设置', 'menu_type' => '1', - 'icon' => 'element-FolderChecked', - 'api_url' => '', + 'icon' => 'element FolderChecked', + 'api_url' => 'member/sign/config', 'router_path' => 'marketing/sign/config', 'view_path' => 'marketing/sign_config', 'methods' => 'get', 'sort' => '30', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_sign_set', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/sign/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '签到记录', 'menu_key' => 'sign_list', 'menu_short_name' => '签到记录', 'menu_type' => '1', - 'icon' => 'element-FolderChecked', - 'api_url' => '', + 'icon' => 'element FolderChecked', + 'api_url' => 'member/sign', 'router_path' => 'marketing/sign', 'view_path' => 'marketing/sign_list', 'methods' => 'get', @@ -754,7 +1008,7 @@ return [ 'menu_short_name' => '应用', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'iconfont-iconmanage-apply', + 'icon' => 'iconfont iconmanage-apply', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -768,7 +1022,7 @@ return [ 'menu_key' => 'addon_list', 'menu_short_name' => '应用列表', 'menu_type' => '1', - 'icon' => 'iconfont-iconmanage-apply', + 'icon' => 'iconfont iconmanage-apply', 'api_url' => 'addon/list', 'router_path' => 'app/index', 'view_path' => 'app/index', @@ -785,7 +1039,7 @@ return [ 'menu_short_name' => '渠道', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-DataBoard', + 'icon' => 'element DataBoard', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -795,25 +1049,41 @@ return [ 'is_show' => '1', 'children' => [ [ - 'menu_name' => '电脑端', + 'menu_name' => 'PC端', 'menu_key' => 'pc_config', - 'menu_short_name' => '电脑端', + 'menu_short_name' => 'PC端', 'menu_type' => '1', - 'icon' => 'iconfont-icondesktop', - 'api_url' => '', + 'icon' => 'iconfont icondesktop', + 'api_url' => 'channel/pc/config', 'router_path' => 'channel/pc/config', 'view_path' => 'channel/pc/config', - 'methods' => '', + 'methods' => 'get', 'sort' => '100', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_pc_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'channel/pc/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => 'H5端', 'menu_key' => 'h5_config', 'menu_short_name' => 'H5端', 'menu_type' => '1', - 'icon' => 'iconfont-iconh5e', + 'icon' => 'iconfont iconh5e', 'api_url' => 'channel/h5/config', 'router_path' => 'channel/h5/config', 'view_path' => 'channel/h5/config', @@ -821,14 +1091,30 @@ return [ 'sort' => '90', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_h5_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'channel/h5/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '微信公众号', 'menu_key' => 'channel_wechat', 'menu_short_name' => '微信公众号', 'menu_type' => '1', - 'icon' => 'iconfont-iconweixingongzhonghao1', - 'api_url' => 'wechat/access', + 'icon' => 'iconfont iconweixingongzhonghao1', + 'api_url' => '', 'router_path' => 'channel/wechat', 'view_path' => 'channel/wechat/access', 'methods' => '', @@ -841,7 +1127,7 @@ return [ 'menu_key' => 'weapp_access', 'menu_short_name' => '微信小程序', 'menu_type' => '1', - 'icon' => 'iconfont-iconxiaochengxushezhi', + 'icon' => 'iconfont iconxiaochengxushezhi', 'api_url' => 'weapp/access', 'router_path' => 'channel/weapp', 'view_path' => 'channel/weapp/access', @@ -855,7 +1141,7 @@ return [ 'menu_key' => 'aliapp_weapp_access', 'menu_short_name' => '支付宝小程序', 'menu_type' => '1', - 'icon' => 'iconfont-iconzhifubao', + 'icon' => 'iconfont iconzhifubao', 'api_url' => 'aliapp/access', 'router_path' => 'channel/aliapp', 'view_path' => 'channel/aliapp/access', @@ -891,6 +1177,22 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_wechat_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wechat/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '公众号回复配置', @@ -905,6 +1207,36 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '默认回复设置', + 'menu_key' => 'wechat_default_reply_set', + 'menu_short_name' => '默认回复设置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wechat/reply/default', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '关注回复设置', + 'menu_key' => 'wechat_subscribe_reply_set', + 'menu_short_name' => '关注回复设置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wechat/reply/subscribe', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '关键字回复添加/编辑', @@ -977,6 +1309,22 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_wechat_menu', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wechat/menu', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '模板消息', @@ -991,6 +1339,22 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '同步', + 'menu_key' => 'sync_wechat_template_message', + 'menu_short_name' => '同步', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'wechat/template/sync', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '配置教程', @@ -1019,6 +1383,22 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_weapp_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'weapp/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '订阅消息', @@ -1033,6 +1413,22 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '同步', + 'menu_key' => 'sync_weapp_template_message', + 'menu_short_name' => '同步', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'weapp/template/sync', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '小程序发布', @@ -1047,6 +1443,22 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '一键云端发布', + 'menu_key' => 'add_weapp_code', + 'menu_short_name' => '一键云端发布', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'weapp/version', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '支付宝配置', @@ -1057,10 +1469,26 @@ return [ 'api_url' => 'aliapp/config', 'router_path' => 'channel/aliapp/config', 'view_path' => 'channel/aliapp/config', - 'methods' => 'put', + 'methods' => 'get', 'sort' => '0', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_aliapp_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'aliapp/config', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '配置教程', @@ -1084,7 +1512,7 @@ return [ 'menu_short_name' => '权限', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Lock', + 'icon' => 'element Lock', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -1095,10 +1523,10 @@ return [ 'children' => [ [ 'menu_name' => '管理员', - 'menu_key' => 'auth_user', + 'menu_key' => 'auth_list', 'menu_short_name' => '管理员', 'menu_type' => '1', - 'icon' => 'iconfont-iconyonghu', + 'icon' => 'element Lock', 'api_url' => 'site/user', 'router_path' => 'auth/user', 'view_path' => 'auth/user', @@ -1108,74 +1536,102 @@ return [ 'is_show' => '1', 'children' => [ [ - 'menu_name' => '新增', - 'menu_key' => 'auth_user_add', - 'menu_short_name' => '新增', + 'menu_name' => '管理员信息', + 'menu_key' => 'auth_user_detail', + 'menu_short_name' => '管理员信息', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '添加管理员', + 'menu_key' => 'add_site_user', + 'menu_short_name' => '添加管理员', 'menu_type' => '2', 'icon' => '', 'api_url' => 'site/user', 'router_path' => '', 'view_path' => '', 'methods' => 'post', - 'sort' => '1', + 'sort' => '100', 'status' => '1', 'is_show' => '1', ], [ - 'menu_name' => '编辑', - 'menu_key' => 'auth_user_update', - 'menu_short_name' => '编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'site/user/', - 'router_path' => '', - 'view_path' => 'put', - 'methods' => '', - 'sort' => '1', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '删除', - 'menu_key' => 'auth_user_del', - 'menu_short_name' => '删除', + 'menu_name' => '编辑管理员', + 'menu_key' => 'edit_site_user', + 'menu_short_name' => '编辑管理员', 'menu_type' => '2', 'icon' => '', 'api_url' => 'site/user/', 'router_path' => '', 'view_path' => '', - 'methods' => 'delete', - 'sort' => '1', + 'methods' => 'put', + 'sort' => '100', 'status' => '1', 'is_show' => '1', ], [ - 'menu_name' => '详情', - 'menu_key' => 'auth_user_info', - 'menu_short_name' => '详情', + 'menu_name' => '修改管理员属性', + 'menu_key' => 'edit_site_user_field', + 'menu_short_name' => '修改管理员属性', 'menu_type' => '2', 'icon' => '', - 'api_url' => 'sys/user/', + 'api_url' => 'site/user//', 'router_path' => '', 'view_path' => '', - 'methods' => 'get', - 'sort' => '0', + 'methods' => 'put', + 'sort' => '100', 'status' => '1', 'is_show' => '1', ], - ], + [ + 'menu_name' => '锁定', + 'menu_key' => 'lock_site_user', + 'menu_short_name' => '锁定', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/lock/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '解锁', + 'menu_key' => 'unlock_site_user', + 'menu_short_name' => '解锁用户', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'site/user/unlock/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ - 'menu_name' => '角色管理', + 'menu_name' => '管理员角色', 'menu_key' => 'auth_role', - 'menu_short_name' => '角色管理', + 'menu_short_name' => '管理员角色', 'menu_type' => '1', - 'icon' => 'iconfont-iconhuiyuanliebiao', + 'icon' => 'iconfont iconhuiyuanliebiao', 'api_url' => 'sys/role', - 'router_path' => 'auth/role', + 'router_path' => 'setting/auth/role', 'view_path' => 'auth/role', 'methods' => 'get', - 'sort' => '90', + 'sort' => '70', 'status' => '1', 'is_show' => '1', 'children' => [ @@ -1228,12 +1684,12 @@ return [ 'menu_key' => 'auth_log', 'menu_short_name' => '操作日志', 'menu_type' => '1', - 'icon' => 'element-Document', + 'icon' => 'element Document', 'api_url' => 'sys/log', - 'router_path' => 'auth/log', + 'router_path' => 'setting/auth/log', 'view_path' => 'auth/log', 'methods' => 'get', - 'sort' => '80', + 'sort' => '60', 'status' => '1', 'is_show' => '1', ], @@ -1245,7 +1701,7 @@ return [ 'menu_short_name' => '设置', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element-Setting', + 'icon' => 'element Setting', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -1259,7 +1715,7 @@ return [ 'menu_key' => 'setting_system', 'menu_short_name' => '网站设置', 'menu_type' => '0', - 'icon' => 'element-Basketball', + 'icon' => 'element Basketball', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -1273,7 +1729,7 @@ return [ 'menu_key' => 'setting_system_web', 'menu_short_name' => '基础设置', 'menu_type' => '1', - 'icon' => 'element-Basketball', + 'icon' => 'element Basketball', 'api_url' => 'sys/config/website', 'router_path' => 'setting/system', 'view_path' => 'setting/system', @@ -1281,13 +1737,29 @@ return [ 'sort' => '100', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_base_setting', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/website', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '版权设置', 'menu_key' => 'setting_copyright', 'menu_short_name' => '版权设置', 'menu_type' => '1', - 'icon' => 'iconfont-iconbanquan1', + 'icon' => 'iconfont iconbanquan1', 'api_url' => 'sys/config/copyright', 'router_path' => 'setting/copyright', 'view_path' => 'setting/copyright', @@ -1295,6 +1767,22 @@ return [ 'sort' => '90', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_setting_copyright', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/copyright', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ] ], @@ -1304,7 +1792,7 @@ return [ 'menu_key' => 'setting_member', 'menu_short_name' => '会员设置', 'menu_type' => '0', - 'icon' => 'iconfont-iconjiaoseyonghu', + 'icon' => 'iconfont iconjiaoseyonghu', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -1318,7 +1806,7 @@ return [ 'menu_key' => 'setting_member_config', 'menu_short_name' => '会员设置', 'menu_type' => '1', - 'icon' => 'iconfont-iconjiaoseyonghu', + 'icon' => 'iconfont iconjiaoseyonghu', 'api_url' => 'member/config/member', 'router_path' => 'setting/member', 'view_path' => 'setting/member', @@ -1326,13 +1814,29 @@ return [ 'sort' => '71', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_setting_member_config', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/config/member', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '注册登录', 'menu_key' => 'setting_login_register', 'menu_short_name' => '注册登录', 'menu_type' => '1', - 'icon' => 'iconfont-iconzhuceshezhi', + 'icon' => 'iconfont iconzhuceshezhi', 'api_url' => 'member/config/login', 'router_path' => 'setting/login', 'view_path' => 'setting/login', @@ -1340,16 +1844,31 @@ return [ 'sort' => '70', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_setting_login_register', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/config/login', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ] ], - [ 'menu_name' => '支付管理', 'menu_key' => 'setting_pay', 'menu_short_name' => '支付管理', 'menu_type' => '1', - 'icon' => 'element-Wallet', + 'icon' => 'element Wallet', 'api_url' => '', 'router_path' => 'setting/pay', 'view_path' => '', @@ -1423,14 +1942,30 @@ return [ 'menu_key' => 'cash_out_config', 'menu_short_name' => '提现设置', 'menu_type' => '1', - 'icon' => 'element-Postcard', + 'icon' => 'element Postcard', 'api_url' => 'member/config/cash_out', 'router_path' => 'setting/cash_out', 'view_path' => 'setting/cash_out', - 'methods' => 'post', + 'methods' => 'get', 'sort' => '59', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '设置', + 'menu_key' => 'cash_out_config_set', + 'menu_short_name' => '设置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'member/config/cash_out', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '90', + 'status' => '1', + 'is_show' => '1', + ], + ], ], ], ], @@ -1440,7 +1975,7 @@ return [ 'menu_key' => 'setting_notice', 'menu_short_name' => '消息管理', 'menu_type' => '1', - 'icon' => 'element-ChatLineSquare', + 'icon' => 'element ChatLineSquare', 'api_url' => '', 'router_path' => 'setting/notice', 'view_path' => '', @@ -1462,6 +1997,50 @@ return [ 'sort' => '10', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '消息详情', + 'menu_key' => 'notice_detail', + 'menu_short_name' => '消息详情', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'notice/notice/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '消息启动关闭', + 'menu_key' => 'notice_edit_status', + 'menu_short_name' => '消息启动关闭', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'notice/notice/editstatus', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '消息修改', + 'menu_key' => 'notice_edit', + 'menu_short_name' => '消息修改', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'notice/notice/edit', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + ] ], [ 'menu_name' => '发送记录', @@ -1484,7 +2063,7 @@ return [ 'menu_key' => 'sms_notice', 'menu_short_name' => '短信管理', 'menu_type' => '0', - 'icon' => 'element-Message', + 'icon' => 'element Message', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -1499,13 +2078,43 @@ return [ 'menu_short_name' => '短信设置', 'menu_type' => '1', 'icon' => '', - 'api_url' => 'notice/sms', + 'api_url' => 'notice/notice/sms', 'router_path' => 'setting/sms/setting', 'view_path' => 'setting/sms', 'methods' => 'get', 'sort' => '12', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '获取短信配置', + 'menu_key' => 'get_sms_config', + 'menu_short_name' => '获取短信配置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'notice/notice/sms/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '修改短信配置', + 'menu_key' => 'set_sms_config', + 'menu_short_name' => '修改短信配置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'notice/notice/sms/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '发送记录', @@ -1520,6 +2129,22 @@ return [ 'sort' => '11', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '发送记录详情', + 'menu_key' => 'sms_log_detail', + 'menu_short_name' => '发送记录详情', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'notice/sms/log/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], ], ], @@ -1528,7 +2153,7 @@ return [ 'menu_key' => 'setting_tool', 'menu_short_name' => '系统工具', 'menu_type' => '0', - 'icon' => 'element-FolderChecked', + 'icon' => 'element FolderChecked', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -1542,7 +2167,7 @@ return [ 'menu_key' => 'system_agreement', 'menu_short_name' => '协议管理', 'menu_type' => '1', - 'icon' => 'element-Notebook', + 'icon' => 'element Notebook', 'api_url' => 'sys/agreement', 'router_path' => 'setting/agreement', 'view_path' => 'setting/agreement', @@ -1557,20 +2182,50 @@ return [ 'menu_short_name' => '协议编辑', 'menu_type' => '1', 'icon' => '', - 'api_url' => 'sys/agreement/', + 'api_url' => '', 'router_path' => 'setting/agreement/edit', 'view_path' => 'setting/agreement_edit', - 'methods' => 'put', + 'methods' => '', 'sort' => '100', 'status' => '1', 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '获取协议信息', + 'menu_key' => 'get_system_agreement', + 'menu_short_name' => '获取协议信息', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/agreement/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '修改协议信息', + 'menu_key' => 'edit_system_agreement', + 'menu_short_name' => '修改协议信息', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/agreement/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '地图秘钥', 'menu_key' => 'map_setting', 'menu_short_name' => '地图秘钥', 'menu_type' => '1', - 'icon' => 'element-Message', + 'icon' => 'element Message', 'api_url' => 'sys/config/map', 'router_path' => 'setting/map', 'view_path' => 'setting/map', @@ -1578,13 +2233,29 @@ return [ 'sort' => '99', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '保存', + 'menu_key' => 'save_layout_setting', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/config/map', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '存储设置', 'menu_key' => 'setting_storage', 'menu_short_name' => '存储设置', 'menu_type' => '1', - 'icon' => 'element-FolderChecked', + 'icon' => 'element FolderChecked', 'api_url' => 'sys/storage', 'router_path' => 'setting/storage', 'view_path' => 'setting/storage', @@ -1592,20 +2263,66 @@ return [ 'sort' => '30', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '获取存储配置', + 'menu_key' => 'setting_storage_value', + 'menu_short_name' => '获取存储配置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/storage/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'get', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '存储设置修改', + 'menu_key' => 'edit_setting_storage', + 'menu_short_name' => '存储设置修改', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/storage/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ], [ 'menu_name' => '数据导出', 'menu_key' => 'setting_export', 'menu_short_name' => '数据导出', 'menu_type' => '1', - 'icon' => 'element-FolderChecked', - 'api_url' => '', + 'icon' => 'element FolderChecked', + 'api_url' => 'sys/export', 'router_path' => 'setting/export', 'view_path' => 'setting/export', 'methods' => 'get', 'sort' => '30', 'status' => '1', 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '删除报表', + 'menu_key' => 'delete_export', + 'menu_short_name' => '删除报表', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'sys/export/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] ] ] ], diff --git a/niucloud/app/dict/pay/PayDict.php b/niucloud/app/dict/pay/PayDict.php index b43c01d84..2d5ba147f 100644 --- a/niucloud/app/dict/pay/PayDict.php +++ b/niucloud/app/dict/pay/PayDict.php @@ -57,32 +57,24 @@ class PayDict 'name' => get_lang('dict_pay.type_wechatpay'), 'key' => self::WECHATPAY, 'icon' => self::WECHATPAY_ICON, + 'setting_component' => '/src/app/views/setting/components/pay-wechatpay.vue' ],//微信支付 self::ALIPAY => [ 'name' => get_lang('dict_pay.type_alipay'), 'key' => self::ALIPAY, 'icon' => self::ALIPAY_ICON, + 'setting_component' => '/src/app/views/setting/components/pay-alipay.vue' ],//支付宝支付 -// self::UNIPAY => [ -// 'name' => get_lang('dict_pay.type_unipay'), -// 'key' => self::UNIPAY, -// 'icon' => self::UNIPAY_ICON -// ],//银联支付 -// self::OFFLINEPAY => [ -// 'name' => get_lang('dict_pay.type_offline'), -// 'key' => self::OFFLINEPAY, -// 'icon' => self::OFFLINEPAY_ICON -// ],//线下支付 self::BALANCEPAY => [ 'name' => get_lang('dict_pay.type_balancepay'), 'key' => self::BALANCEPAY, 'icon' => self::BALANCEPAY_ICON, + 'setting_component' => '' ],//微信支付 -// self::ALIPAY => get_lang('dict_pay.type_alipay'),//支付宝支付 -// self::UNIPAY => get_lang('dict_pay.type_unipay'),//银联 -// self::OFFLINEPAY => get_lang('dict_pay.type_offline'),//线下支付 -// self::BALANCEPAY => get_lang('dict_pay.type_balancepay'),//余额支付 ]; + + $list = array_merge($list, ...event('PayType')); + if (!empty($types)) { foreach ($list as $k => $v) { if (!in_array($k, $types)) { diff --git a/niucloud/app/dict/poster/ComponentDict.php b/niucloud/app/dict/poster/ComponentDict.php index 423f23251..f8f206941 100644 --- a/niucloud/app/dict/poster/ComponentDict.php +++ b/niucloud/app/dict/poster/ComponentDict.php @@ -31,7 +31,7 @@ class ComponentDict 'Text' => [ 'title' => "文本", // 组件名称 'type' => 'text', // 组件类型,文本:text,image:图片,qrcode:二维码 - 'icon' => "iconfont-iconbiaoti", // 组件图标 + 'icon' => "iconfont iconbiaoti", // 组件图标 'path' => "text", // 组件预览,前缀 edit-,编辑组件属性,前缀 preview- 'uses' => 0, 'sort' => 10000, @@ -41,7 +41,7 @@ class ComponentDict 'Image' => [ 'title' => "图片", 'type' => 'image', - 'icon' => "iconfont-icontupian1", + 'icon' => "iconfont icontupian1", 'path' => "image", 'uses' => 0, 'sort' => 10001, @@ -51,7 +51,7 @@ class ComponentDict 'Qrcode' => [ 'title' => "二维码", 'type' => 'qrcode', - 'icon' => "iconfont-iconerweima", + 'icon' => "iconfont iconerweima", 'path' => "qrcode", 'uses' => 1, 'sort' => 10002, @@ -61,7 +61,7 @@ class ComponentDict 'HeadImg' => [ 'title' => "头像", 'type' => 'image', - 'icon' => "iconfont-icongeren", + 'icon' => "iconfont icongeren", 'path' => "headimg", 'uses' => 1, 'sort' => 10003, @@ -77,7 +77,7 @@ class ComponentDict 'NickName' => [ 'title' => "昵称", 'type' => 'text', - 'icon' => "iconfont-iconnicheng1", + 'icon' => "iconfont iconnicheng1", 'path' => "nickname", 'uses' => 1, 'sort' => 10004, @@ -93,7 +93,7 @@ class ComponentDict 'Draw' => [ 'title' => "绘画", 'type' => 'draw', - 'icon' => "iconfont-iconhuihua1", + 'icon' => "iconfont iconhuihua1", 'path' => "draw", 'uses' => 0, 'sort' => 10005, diff --git a/niucloud/app/dict/sys/CloudDict.php b/niucloud/app/dict/sys/CloudDict.php index ed58d0850..6d55988d9 100644 --- a/niucloud/app/dict/sys/CloudDict.php +++ b/niucloud/app/dict/sys/CloudDict.php @@ -20,14 +20,19 @@ class CloudDict const APPLET_UPLOAD_SUCCESS = 1; + const APPLET_AUDITING = 2; + const APPLET_UPLOAD_FAIL = -1; + const APPLET_AUDIT_FAIL = -2; public static function getAppletUploadSatus($status) { $status_list = [ self::APPLET_UPLOADING => get_lang('dict_cloud_applet.uploading'), self::APPLET_UPLOAD_SUCCESS => get_lang('dict_cloud_applet.upload_success'), - self::APPLET_UPLOAD_FAIL => get_lang('dict_cloud_applet.upload_fail') + self::APPLET_UPLOAD_FAIL => get_lang('dict_cloud_applet.upload_fail'), + self::APPLET_AUDITING => get_lang('dict_cloud_applet.auditing'), + self::APPLET_AUDIT_FAIL => get_lang('dict_cloud_applet.audit_fail'), ]; return $status_list[$status] ?? ''; } diff --git a/niucloud/app/dict/sys/ConfigKeyDict.php b/niucloud/app/dict/sys/ConfigKeyDict.php index 14c1370c0..e4a75174e 100644 --- a/niucloud/app/dict/sys/ConfigKeyDict.php +++ b/niucloud/app/dict/sys/ConfigKeyDict.php @@ -30,4 +30,9 @@ class ConfigKeyDict public const H5 = 'h5';//h5 -} \ No newline at end of file + public const WXOPLATFORM = 'WXOPLATFORM'; // 微信开放平台 + + public const WEAPP_AUTHORIZATION_INFO = 'weapp_authorization_info'; + + public const WECHAT_AUTHORIZATION_INFO = 'wechat_authorization_info'; +} diff --git a/niucloud/app/dict/sys/SmsDict.php b/niucloud/app/dict/sys/SmsDict.php index 0a4c518ad..d70babefc 100644 --- a/niucloud/app/dict/sys/SmsDict.php +++ b/niucloud/app/dict/sys/SmsDict.php @@ -38,7 +38,7 @@ class SmsDict public static function getType() { - return [ + $system = [ self::ALISMS => [ 'name' => '阿里云短信', //配置参数 @@ -46,7 +46,8 @@ class SmsDict 'sign' => '短信签名', 'app_key' => 'APP_KEY', 'secret_key' => 'SECRET_KEY' - ] + ], + 'component' => '/src/app/views/setting/components/sms-ali.vue', ], self::TENCENTSMS => [ 'name' => '腾讯云短信', @@ -56,10 +57,12 @@ class SmsDict 'app_id' => 'APP_ID', 'secret_id' => 'SECRET_ID', 'secret_key' => 'SECRET_KEY' - ] + ], + 'component' => '/src/app/views/setting/components/sms-tencent.vue', ], - ]; + $extend = event('SmsType'); + return array_merge($system, ...$extend); } //支持的短信场景 @@ -73,4 +76,4 @@ class SmsDict ]; } -} \ No newline at end of file +} diff --git a/niucloud/app/dict/sys/StorageDict.php b/niucloud/app/dict/sys/StorageDict.php index c715b10f4..c95254066 100644 --- a/niucloud/app/dict/sys/StorageDict.php +++ b/niucloud/app/dict/sys/StorageDict.php @@ -36,12 +36,13 @@ class StorageDict public static function getType() { - return [ + $system = [ self::LOCAL => [ 'name' => '本地存储', //配置参数 'params' => [ - ] + ], + 'component' => '/src/app/views/setting/components/storage-local.vue', ], self::QINIU => [ 'name' => '七牛云存储', @@ -52,7 +53,8 @@ class StorageDict 'access_key' => 'ACCESS_KEY', 'secret_key' => 'SECRET_KEY', 'domain' => '空间域名' - ] + ], + 'component' => '/src/app/views/setting/components/storage-qiniu.vue', ], self::ALI => [ @@ -64,7 +66,8 @@ class StorageDict 'secret_key' => 'ACCESS_KEY_SECRET', 'endpoint' => 'Endpoint', 'domain' => '空间域名' - ] + ], + 'component' => '/src/app/views/setting/components/storage-ali.vue', ], self::TENCENT => [ @@ -76,10 +79,13 @@ class StorageDict 'access_key' => 'SECRET_ID', 'secret_key' => 'SECRET_KEY', 'domain' => '空间域名' - ] + ], + 'component' => '/src/app/views/setting/components/storage-tencent.vue', ], ]; + $extend = event('StorageType'); + return array_merge($system, ...$extend); } -} \ No newline at end of file +} diff --git a/niucloud/app/dict/sys/WxOplatform.php b/niucloud/app/dict/sys/WxOplatform.php new file mode 100644 index 000000000..4225845af --- /dev/null +++ b/niucloud/app/dict/sys/WxOplatform.php @@ -0,0 +1,132 @@ + '消息管理', + 2 => '用户管理', + 3 => '账号服务', + 4 => '网页服务', + 6 => '微信多客服', + 7 => '群发与通知', + 8 => '微信卡券', + 9 => '微信扫一扫', + 11 => '素材管理', + 15 => '菜单管理', + 27 => '快速注册小程序', + 33 => '小程序关联管理', + 54 => '服务号对话管理', + 89 => '服务号订阅通知' + ]; + + /** + * 小程序必需权限 + */ + public const WEAPP_MUST_AUTHORITY = [ + 17 => '获取小程序码', + 18 => '小程序开发与数据分析', + 19 => '小程序客服管理', + 25 => '开放平台账号管理', + 30 => '小程序基本信息管理', + 31 => '小程序认证名称检测', + 36 => '微信卡路里管理', + 37 => '附近的小程序管理', + 40 => '小程序插件管理', + 45 => '微信物流服务', + 48 => '微信财政电子票据管理', + 49 => '小程序云开发管理', + 51 => '小程序即时配送', + 52 => '小程序直播管理', + 65 => '小程序广告管理', + 70 => '标准版交易组件商品管理', + 71 => '标准版交易组件订单物流与售后管理', + 73 => '标准版交易组件接入', + 76 => '小程序违规与交易投诉管理', + 81 => '试用小程序快速认证', + 84 => '标准版交易组件优惠券管理', + 85 => '自定义版交易组件管理', + 88 => '小程序链接管理', + 93 => '小程序联盟管理', + 99 => '云开发短信服务', + 105 => '城市服务', + 116 => '获取自定义版交易组件数据', + 118 => '硬件服务', + 119 => '小程序支付管理服务', + 120 => '小程序购物订单', + 129 => '视频号小店商品管理', + 130 => '视频号小店物流管理', + 131 => '视频号小店订单与售后管理', + 132 => '视频号小店优惠券管理', + 135 => '流量主代运营权限集', + 139 => '小程序运费险 ', + 142 => '小程序发货管理服务', + 144 => '小程序学生认证权限集', + 151 => '小程序交易保障', + 157 => '小程序虚拟支付管理权限', + 161 => '微信客服管理', + ]; + + /** + * 默认隐私协议内容 + */ + public const SETTING_LIST = [ + ['privacy_key' => 'UserInfo', 'privacy_text' => '用户信息'], + ['privacy_key' => 'Location', 'privacy_text' => '位置信息'], + ['privacy_key' => 'Address', 'privacy_text' => '地址'], + ['privacy_key' => 'Invoice', 'privacy_text' => '发票信息 '], + ['privacy_key' => 'RunData', 'privacy_text' => '微信运动数据'], + ['privacy_key' => 'Record', 'privacy_text' => '麦克风'], + ['privacy_key' => 'Album', 'privacy_text' => '选中的照片或视频信息'], + ['privacy_key' => 'Camera', 'privacy_text' => '摄像头'], + ['privacy_key' => 'PhoneNumber', 'privacy_text' => '手机号码 '], + ['privacy_key' => 'Contact', 'privacy_text' => '通讯录'], + ['privacy_key' => 'DeviceInfo', 'privacy_text' => '设备信息'], + ['privacy_key' => 'EXIDNumber', 'privacy_text' => '身份证号码'], + ['privacy_key' => 'EXOrderInfo', 'privacy_text' => '订单信息 '], + ['privacy_key' => 'EXUserPublishConten', 'privacy_text' => '发布内容 '], + ['privacy_key' => 'EXUserFollowAcct', 'privacy_text' => '所关注账号'], + ['privacy_key' => 'EXUserOpLog', 'privacy_text' => '操作日志 '], + ['privacy_key' => 'AlbumWriteOnly', 'privacy_text' => '相册'], + ['privacy_key' => 'LicensePlate ', 'privacy_text' => '车牌号'], + ['privacy_key' => 'BlueTooth', 'privacy_text' => '蓝牙'], + ['privacy_key' => 'CalendarWriteOnly', 'privacy_text' => '日历'], + ['privacy_key' => 'Email', 'privacy_text' => '邮箱'], + ['privacy_key' => 'MessageFile', 'privacy_text' => '选中的文件'], + ['privacy_key' => 'ChooseLocation', 'privacy_text' => '选择的位置信息'], + ['privacy_key' => 'Accelerometer', 'privacy_text' => '加速传感器 '], + ['privacy_key' => 'Compass', 'privacy_text' => '磁场传感器'], + ['privacy_key' => 'DeviceMotion ', 'privacy_text' => '方向传感器 '], + ['privacy_key' => 'Gyroscope', 'privacy_text' => '陀螺仪传感器'], + ['privacy_key' => 'Clipboard', 'privacy_text' => '剪切板'], + ]; + + /** + * 默认隐私协议内容 + */ + public const DEFAULT_SETTING_LIST = [ + ['privacy_key' => 'UserInfo', 'privacy_text' => '快捷维护用户信息'], // 用户信息 + ['privacy_key' => 'Location', 'privacy_text' => '用户获取附近门店'], // 位置信息 + ['privacy_key' => 'Address', 'privacy_text' => '快捷维护收货地址'], // 地址 + ['privacy_key' => 'Album', 'privacy_text' => '上传头像或者图片'], // 选中的照片或视频信息 + ['privacy_key' => 'Camera', 'privacy_text' => '调用摄像头扫描二维码'], // 摄像头 + ['privacy_key' => 'PhoneNumber', 'privacy_text' => '用户使用手机号注册'], // 手机号码 + ['privacy_key' => 'AlbumWriteOnly', 'privacy_text' => '获取相册中的图片'], // 相册 + ['privacy_key' => 'MessageFile', 'privacy_text' => '上传头像或者图片'], // 选中的文件 + ['privacy_key' => 'ChooseLocation', 'privacy_text' => '搜集您的位置信息'], // 选择的位置信息 + ['privacy_key' => 'Clipboard', 'privacy_text' => '快速获取订单号'], // 剪切板 + ]; +} diff --git a/niucloud/app/event.php b/niucloud/app/event.php index 140f91abd..d800b629b 100644 --- a/niucloud/app/event.php +++ b/niucloud/app/event.php @@ -103,6 +103,9 @@ $system_event = [ // 获取海报数据 'GetPosterData' => ['app\listener\system\Poster'], + + // 小程序授权变更事件 + 'WeappAuthChangeAfter' => ['app\listener\system\WeappAuthChangeAfter'] ], 'subscribe' => [ ], diff --git a/niucloud/app/install/source/database.sql b/niucloud/app/install/source/database.sql index ff614229d..c7c802490 100644 --- a/niucloud/app/install/source/database.sql +++ b/niucloud/app/install/source/database.sql @@ -252,7 +252,6 @@ CREATE TABLE `member_address` ( lng varchar(255) NOT NULL DEFAULT '' COMMENT '经度', lat varchar(255) NOT NULL DEFAULT '' COMMENT '纬度', is_default tinyint NOT NULL DEFAULT 0 COMMENT '是否是默认地址', - type varchar(30) NOT NULL DEFAULT '' COMMENT '地址类型 address 普通地址 location_address 定位地址', PRIMARY KEY (id) ) ENGINE = INNODB, @@ -946,6 +945,8 @@ CREATE TABLE `weapp_version` ( `update_time` int(11) NOT NULL DEFAULT 0, `fail_reason` text DEFAULT NULL, `task_key` varchar(20) NOT NULL DEFAULT '' COMMENT '上传任务key', + `from_type` VARCHAR(255) NOT NULL DEFAULT 'cloud_build', + `auditid` VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; @@ -1003,6 +1004,38 @@ CREATE TABLE `wechat_reply` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '公众号消息回调表' ROW_FORMAT = Dynamic; +DROP TABLE IF EXISTS `wx_oplatfrom_weapp_version`; +CREATE TABLE `wx_oplatfrom_weapp_version` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `site_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点套餐id', + `template_id` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '代码模板 ID', + `user_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '代码版本号', + `user_desc` VARCHAR(255) DEFAULT '' COMMENT '代码描述', + `task_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '上传任务key', + `status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态', + `fail_reason` TEXT DEFAULT NULL COMMENT '失败原因', + `version_no` INT(11) NOT NULL DEFAULT 0, + `create_time` INT(11) NOT NULL DEFAULT 0, + `update_time` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) +ENGINE = INNODB, +CHARACTER SET utf8mb4, +COLLATE utf8mb4_general_ci; + +DROP TABLE IF EXISTS `user_create_site_limit`; +CREATE TABLE `user_create_site_limit` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `group_id` INT(11) NOT NULL DEFAULT 0, + `uid` INT(11) NOT NULL DEFAULT 0, + `num` INT(11) NOT NULL DEFAULT 0, + `month` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) +ENGINE = INNODB, +CHARACTER SET utf8mb4, +COLLATE utf8mb4_general_ci; + INSERT INTO `site`(site_id, site_name, group_id, keywords, app_type, logo, `desc`, status, latitude, longitude, province_id, city_id, district_id, address, full_address, phone, business_hours, create_time, expire_time, front_end_name, front_end_logo, front_end_icon, icon, member_no, app, addons, initalled_addon, site_domain) VALUES (1, 'niucloud-admin', 0, '', 'admin', '', '', 1, '', '', 0, 0, 0, '', '', '', '', 0, 0, '', '', '', '', '0', '', '', '', ''); diff --git a/niucloud/app/job/wxoplatform/GetVersionUploadResult.php b/niucloud/app/job/wxoplatform/GetVersionUploadResult.php new file mode 100644 index 000000000..fb79631e7 --- /dev/null +++ b/niucloud/app/job/wxoplatform/GetVersionUploadResult.php @@ -0,0 +1,34 @@ + $site_id, 'event' => $event]); + return true; + } +} diff --git a/niucloud/app/job/wxoplatform/WeappCommit.php b/niucloud/app/job/wxoplatform/WeappCommit.php new file mode 100644 index 000000000..8a31cd41c --- /dev/null +++ b/niucloud/app/job/wxoplatform/WeappCommit.php @@ -0,0 +1,34 @@ +add($data); + return true; + } +} diff --git a/niucloud/app/job/wxoplatform/WechatAuthChangeAfter.php b/niucloud/app/job/wxoplatform/WechatAuthChangeAfter.php new file mode 100644 index 000000000..eb451958a --- /dev/null +++ b/niucloud/app/job/wxoplatform/WechatAuthChangeAfter.php @@ -0,0 +1,34 @@ + $site_id, 'event' => $event]); + return true; + } +} diff --git a/niucloud/app/lang/zh-cn/api.php b/niucloud/app/lang/zh-cn/api.php index 2d6be5065..934c46508 100644 --- a/niucloud/app/lang/zh-cn/api.php +++ b/niucloud/app/lang/zh-cn/api.php @@ -44,6 +44,7 @@ return [ 'ADDON_DIR_FAIL' => '插件文件操作失败', 'LAYOUT_NOT_EXIST' => '该布局不存在', 'ZIP_FILE_NOT_FOUND' => '找不到可用的压缩文件', + 'ZIP_ARCHIVE_NOT_INSTALL' => 'ZipArchive扩展未安装', 'DOWNLOAD_SUCCESS' => '下载成功', 'APP_NOT_ALLOW_UNINSTALL' => '该应用下存在站点卸载前请先删除相关站点', 'ADDON_INSTALL_FAIL' => '插件安装失败', @@ -192,6 +193,9 @@ return [ 'SITE_EXPIRE_NOT_ALLOW' => '站点已打烊,续费后可继续使用此项功能', 'SITE_CLOSE_NOT_ALLOW' => '站点已停止', 'SITE_GROUP_APP_NOT_EXIST' => '存在无效的应用', + 'NO_PERMISSION_TO_CREATE_SITE_GROUP' => '没有创建该站点套餐的权限', + 'SITE_GROUP_CREATE_SITE_EXCEEDS_LIMIT' => '该套餐的创建数量已达上限', + 'SITE_GROUP_NOT_EXIST' => '站点套餐不存在', //支付相关(todo 注意:7段不共享) 'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号', @@ -263,7 +267,7 @@ return [ //核销相关 'VERIFY_TYPE_ERROR' => '核销类型错误', - 'VERIFY_CODE_EXPIRED' => '核销码已过期', + 'VERIFY_CODE_EXPIRED' => '当前核销码已核销或已失效', 'VERIFIER_NOT_EXIST' => '核销员不存在', //签到相关 @@ -281,4 +285,10 @@ return [ 'EXPORT_NO_DATA' => '暂无可导出数据', 'DIRECTORY' => '目录', 'WAS_NOT_CREATED' => '创建失败', + + /********************************************************* 微信开放平台 **************************************/ + 'WECHAT_OPLATFORM_NOT_EXIST' => '未配置微信开放平台', + 'WEAPP_EXIST' => '该小程序已经授权给其他站点', + 'WECHAT_EXIST' => '该公众号已经授权给其他站点', + 'PLEASE_ADD_FIRST_SITE_GROUP' => '请先添加站点套餐' ]; diff --git a/niucloud/app/lang/zh-cn/dict.php b/niucloud/app/lang/zh-cn/dict.php index 319a75f63..975349bc1 100644 --- a/niucloud/app/lang/zh-cn/dict.php +++ b/niucloud/app/lang/zh-cn/dict.php @@ -234,7 +234,9 @@ return [ 'member_verify_index' => '核销台', 'diy_page' => '自定义页面', - 'diy_link' => '自定义链接' + 'diy_link' => '自定义链接', + 'diy_jump_other_applet' => '小程序跳转', + 'diy_make_phone_call' => '拨打电话' ], // 自定义海报 'dict_diy_poster'=>[ @@ -249,12 +251,11 @@ return [ //渠道 'dict_channel' => [ //渠道端口 - 'channel_wechat' => '公众号', - 'channel_weapp' => '微信小程序', + 'channel_pc' => 'PC', 'channel_h5' => 'H5', - 'channel_pc' => '电脑端', 'channel_app' => 'APP', - + 'channel_wechat' => '微信公众号', + 'channel_weapp' => '微信小程序', ], //会员提现 'dict_member_cash_out' => [ @@ -352,6 +353,9 @@ return [ 'uploading' => '上传中', 'upload_success' => '上传成功', 'upload_fail' => '上传失败', + 'auditing' => '审核中', + 'audit_success' => '审核通过', + 'audit_fail' => '审核失败' ], 'dict_wechat_media' => [ 'type_image' => '图片', diff --git a/niucloud/app/listener/member/MemberExportDataListener.php b/niucloud/app/listener/member/MemberExportDataListener.php index 336445bbc..4b5ddea60 100644 --- a/niucloud/app/listener/member/MemberExportDataListener.php +++ b/niucloud/app/listener/member/MemberExportDataListener.php @@ -26,14 +26,21 @@ class MemberExportDataListener $data = []; if ($param['type'] == 'member') { $model = new Member(); - $field = 'member_id, member_no, username, mobile, nickname, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time'; + $field = 'member_id, member_no, username, mobile, nickname, birthday, member_level, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time'; //查询导出数据 - $search_model = $model->where([['site_id', '=', $param['site_id']]])->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label', 'register_channel'], $param['where'])->field($field)->append(['register_channel_name', 'status_name']); + $search_model = $model->where([['site_id', '=', $param['site_id']]])->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label', 'register_channel'], $param['where']) + ->with(['memberLevelNameBind'])->field($field)->append(['register_channel_name', 'sex_name', 'status_name']); if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) { $data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray(); } else { $data = $search_model->select()->toArray(); } + foreach ($data as $key => $value) { + $data[$key]['username'] = !empty($value['username']) ? $value['username'] : '-'; + $data[$key]['mobile'] = $value['mobile']."\t"; + $data[$key]['create_time'] = !empty($value['create_time']) ? $value['create_time'] : '0000-00-00 00:00:00'; + $data[$key]['last_visit_time'] = !empty($value['last_visit_time']) ? $value['last_visit_time'] : '0000-00-00 00:00:00'; + } } return $data; } diff --git a/niucloud/app/listener/member/MemberExportTypeListener.php b/niucloud/app/listener/member/MemberExportTypeListener.php index 9bf5e341c..6e3b1cbdd 100644 --- a/niucloud/app/listener/member/MemberExportTypeListener.php +++ b/niucloud/app/listener/member/MemberExportTypeListener.php @@ -25,16 +25,17 @@ class MemberExportTypeListener 'member' => [ 'name' => '会员列表', 'column' => [ - 'member_id' => [ 'name' => '会员id'], - 'member_no' => [ 'name' => '会员编码'], - 'username' => [ 'name' => '用户名'], + 'username' => [ 'name' => '真实姓名'], + 'nickname' => [ 'name' => '会员昵称'], 'mobile' => [ 'name' => '手机号'], - 'nickname' => [ 'name' => '昵称'], + 'member_level_name' => [ 'name' => '会员等级'], + 'sex_name' => [ 'name' => '性别'], + 'birthday' => [ 'name' => '生日'], 'point' => [ 'name' => '积分'], 'balance' => [ 'name' => '余额'], - 'money' => [ 'name' => '余额(可提现)'], + 'money' => [ 'name' => '可提现余额'], 'growth' => [ 'name' => '成长值'], - 'commission' => [ 'name' => '当前佣金'], + 'commission' => [ 'name' => '佣金'], 'register_channel_name' => [ 'name' => '注册来源'], 'status_name' => [ 'name' => '用户状态'], 'create_time' => [ 'name' => '注册时间'], diff --git a/niucloud/app/listener/notice/Sms.php b/niucloud/app/listener/notice/Sms.php index 104ed9b88..d476fea24 100644 --- a/niucloud/app/listener/notice/Sms.php +++ b/niucloud/app/listener/notice/Sms.php @@ -22,7 +22,7 @@ class Sms //完全信任消息的设置, 不再依赖support_type if ($template['is_sms']) { $sms_id = $template['sms_id'];//发送模板id - $content = $template['sms_content']; + $content = $template['sms']['content']; $member_id = $to['member_id'] ?? 0; $uid = $to['uid'] ?? 0; if (!$mobile) { @@ -67,4 +67,4 @@ class Sms return true; } -} \ No newline at end of file +} diff --git a/niucloud/app/listener/system/BottomNavigationListener.php b/niucloud/app/listener/system/BottomNavigationListener.php index 8f365c986..813e94861 100644 --- a/niucloud/app/listener/system/BottomNavigationListener.php +++ b/niucloud/app/listener/system/BottomNavigationListener.php @@ -25,7 +25,7 @@ class BottomNavigationListener { $key = 'app'; - if (!empty($params) && $params[ 'key' ] != $key) return; + if (!empty($params) && !empty($params[ 'key' ]) && $params[ 'key' ] != $key) return; $addon_info = [ 'title' => '系统', diff --git a/niucloud/app/listener/system/WeappAuthChangeAfter.php b/niucloud/app/listener/system/WeappAuthChangeAfter.php new file mode 100644 index 000000000..2de06cb7f --- /dev/null +++ b/niucloud/app/listener/system/WeappAuthChangeAfter.php @@ -0,0 +1,41 @@ +siteId($data['site_id']); + + $service = new WeappVersionService(); + // 设置隐私协议 + $service->setPrivacySetting(); + // 设置服务器域名 + $service->setDomain(); + // 提交小程序代码 + $service->siteWeappCommit(); + } else if ($data['event'] == 'unauthorized') { + // 授权取消 + + } + } +} diff --git a/niucloud/app/model/diy/DiyRoute.php b/niucloud/app/model/diy/DiyRoute.php index 3f08276c8..92c6e4c38 100644 --- a/niucloud/app/model/diy/DiyRoute.php +++ b/niucloud/app/model/diy/DiyRoute.php @@ -56,7 +56,7 @@ class DiyRoute extends BaseModel public function searchTitleAttr($query, $value, $data) { if ($value) { - $query->where("title", 'like','%'.$value.'%'); + $query->where("title", 'like', '%' . $value . '%'); } } diff --git a/niucloud/app/model/member/MemberAccountLog.php b/niucloud/app/model/member/MemberAccountLog.php index c96369036..2f7469794 100644 --- a/niucloud/app/model/member/MemberAccountLog.php +++ b/niucloud/app/model/member/MemberAccountLog.php @@ -125,6 +125,32 @@ class MemberAccountLog extends BaseModel } } + /** + * 金额大于 + * @param $query + * @param $value + * @param $data + */ + public function searchAccountDataGtAttr($query, $value, $data) + { + if ($value !== '' && $value !== null) { + $query->where('account_data', '>',$value); + } + } + + /** + * 金额小于 + * @param $query + * @param $value + * @param $data + */ + public function searchAccountDataLtAttr($query, $value, $data) + { + if ($value !== '' && $value !== null) { + $query->where('account_data', '<',$value); + } + } + /** * 会员搜索(用于关联表查询) * @param $query diff --git a/niucloud/app/model/member/MemberAddress.php b/niucloud/app/model/member/MemberAddress.php index 16281e03d..bedd87f49 100644 --- a/niucloud/app/model/member/MemberAddress.php +++ b/niucloud/app/model/member/MemberAddress.php @@ -33,15 +33,4 @@ class MemberAddress extends BaseModel */ protected $name = 'member_address'; - /** - * 搜索器:会员收货地址地址类型 1 普通地址 2 定位地址 - * @param $value - * @param $data - */ - public function searchTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("type", $value); - } - } } diff --git a/niucloud/app/model/member/MemberCashOut.php b/niucloud/app/model/member/MemberCashOut.php index 54af2154a..a03818c21 100644 --- a/niucloud/app/model/member/MemberCashOut.php +++ b/niucloud/app/model/member/MemberCashOut.php @@ -145,7 +145,7 @@ class MemberCashOut extends BaseModel public function searchStatusAttr($query, $value, $data) { if ($value) { - $query->where('status', $value); + $query->where('member_cash_out.status', $value); } } diff --git a/niucloud/app/model/member/MemberLevel.php b/niucloud/app/model/member/MemberLevel.php index 38d9bdaed..c40fe2aeb 100644 --- a/niucloud/app/model/member/MemberLevel.php +++ b/niucloud/app/model/member/MemberLevel.php @@ -35,7 +35,8 @@ class MemberLevel extends BaseModel protected $type = [ 'level_benefits' => 'json', - 'level_gifts' => 'json' + 'level_gifts' => 'json', + 'style' => 'json' ]; /** diff --git a/niucloud/app/model/site/SiteGroup.php b/niucloud/app/model/site/SiteGroup.php index b0a056cfd..5a3b50aca 100644 --- a/niucloud/app/model/site/SiteGroup.php +++ b/niucloud/app/model/site/SiteGroup.php @@ -64,7 +64,7 @@ class SiteGroup extends BaseModel */ public function getAddonNameAttr($value, $data) { - if (empty($data['app'])) + if (empty($data['addon'])) return []; return (new Addon())->where([['key', 'in', $data['addon']]])->column('title'); } diff --git a/niucloud/app/model/sys/SysUser.php b/niucloud/app/model/sys/SysUser.php index 920aaed65..72b28b604 100644 --- a/niucloud/app/model/sys/SysUser.php +++ b/niucloud/app/model/sys/SysUser.php @@ -139,5 +139,22 @@ class SysUser extends BaseModel } } - + /** + * 创建时间搜索器 + * @param $query + * @param $value + * @param $data + */ + public function searchLastTimeAttr($query, $value, $data) + { + $start_time = empty($value[0]) ? 0 : strtotime($value[0]); + $end_time = empty($value[1]) ? 0 : strtotime($value[1]); + if ($start_time > 0 && $end_time > 0) { + $query->whereBetweenTime('sys_user.last_time', $start_time, $end_time); + } else if ($start_time > 0 && $end_time == 0) { + $query->where([['sys_user.last_time', '>=', $start_time]]); + } else if ($start_time == 0 && $end_time > 0) { + $query->where([['sys_user.last_time', '<=', $end_time]]); + } + } } diff --git a/niucloud/app/model/sys/SysUserRole.php b/niucloud/app/model/sys/SysUserRole.php index 205dbcf67..695b824a8 100644 --- a/niucloud/app/model/sys/SysUserRole.php +++ b/niucloud/app/model/sys/SysUserRole.php @@ -47,7 +47,7 @@ class SysUserRole extends BaseModel */ public function userinfo() { - return $this->hasOne(SysUser::class, 'uid', 'uid')->joinType('inner') + return $this->hasOne(SysUser::class, 'uid', 'uid')->joinType('right') ->withField('uid,username,head_img,real_name,last_ip,last_time,login_count,create_time') ->bind(['username', 'head_img', 'real_name', 'last_ip', 'last_time', 'login_count']); } @@ -60,7 +60,7 @@ class SysUserRole extends BaseModel { return $this->hasOne(Site::class, 'site_id', 'site_id')->joinType('inner') ->withField('site_id, site_name, app_type, status, expire_time') - ->bind(['site_name', 'app_type', 'status', 'expire_time', 'status_name', 'site_status_name'])->append(['status_name', 'site_status_name']); + ->bind(['site_name', 'app_type', 'expire_time', 'status_name', 'site_status_name'])->append(['status_name', 'site_status_name']); } /** diff --git a/niucloud/app/model/sys/UserCreateSiteLimit.php b/niucloud/app/model/sys/UserCreateSiteLimit.php new file mode 100644 index 000000000..c6458e916 --- /dev/null +++ b/niucloud/app/model/sys/UserCreateSiteLimit.php @@ -0,0 +1,38 @@ +hasOne(SiteGroup::class, 'group_id', 'group_id')->append(['app_name', 'addon_name']); + } +} diff --git a/niucloud/app/model/sys/WxOplatfromWeappVersion.php b/niucloud/app/model/sys/WxOplatfromWeappVersion.php new file mode 100644 index 000000000..b4dc8423b --- /dev/null +++ b/niucloud/app/model/sys/WxOplatfromWeappVersion.php @@ -0,0 +1,51 @@ +hasOne(SiteGroup::class, 'group_id', 'site_group_id')->bind(['site_group_name' => 'group_name']); + } + + /** + * 状态字段转化 + * @param $value + * @param $data + * @return mixed + */ + public function getStatusNameAttr($value, $data) + { + if (!isset($data['status']) || empty($data['status'])) return ''; + return CloudDict::getAppletUploadSatus($data['status']); + } +} diff --git a/niucloud/app/model/verify/Verify.php b/niucloud/app/model/verify/Verify.php index d4d8725fd..2edf89930 100644 --- a/niucloud/app/model/verify/Verify.php +++ b/niucloud/app/model/verify/Verify.php @@ -72,6 +72,19 @@ class Verify extends BaseModel $query->where('relate_tag', '=', $value); } } + /** + * 核销员 + * @param $query + * @param $value + * @param $data + * @return void + */ + public function searchVerifierMemberIdAttr($query, $value, $data) + { + if ($value) { + $query->where('verifier_member_id', '=', $value); + } + } /** * 核销类型搜索 diff --git a/niucloud/app/service/admin/auth/AuthService.php b/niucloud/app/service/admin/auth/AuthService.php index cea4269b0..9438b9405 100644 --- a/niucloud/app/service/admin/auth/AuthService.php +++ b/niucloud/app/service/admin/auth/AuthService.php @@ -12,6 +12,7 @@ namespace app\service\admin\auth; use app\dict\site\SiteDict; +use app\dict\sys\AppTypeDict; use app\model\sys\SysUserRole; use app\Request; use app\service\admin\site\SiteUserService; @@ -73,10 +74,18 @@ class AuthService extends BaseAdminService $menu_service = new MenuService(); $all_menu_list = $menu_service->getAllApiList($this->app_type); + //先判断当前访问的接口是否收到权限的限制 $method_menu_list = $all_menu_list[$method] ?? []; - if(!in_array($rule, $method_menu_list)) - return true; + if(!in_array($rule, $method_menu_list)) { + $other_menu_list = $menu_service->getAllApiList($this->app_type == AppTypeDict::ADMIN ? AppTypeDict::SITE : AppTypeDict::ADMIN); + $method_menu_list = $other_menu_list[$method] ?? []; + if(!in_array($rule, $method_menu_list)) { + return true; + } else { + throw new AuthException('NO_PERMISSION'); + } + } $auth_role_list = $this->getAuthApiList(); if(!empty($auth_role_list[$method]) && in_array($rule, $auth_role_list[$method])) diff --git a/niucloud/app/service/admin/auth/ConfigService.php b/niucloud/app/service/admin/auth/ConfigService.php index 017686faa..e5fd80e2a 100644 --- a/niucloud/app/service/admin/auth/ConfigService.php +++ b/niucloud/app/service/admin/auth/ConfigService.php @@ -12,10 +12,8 @@ namespace app\service\admin\auth; use app\dict\sys\ConfigKeyDict; -use app\model\sys\SysConfig; use app\service\core\sys\CoreConfigService; use core\base\BaseAdminService; -use think\Model; /** * 登录服务层 diff --git a/niucloud/app/service/admin/auth/LoginService.php b/niucloud/app/service/admin/auth/LoginService.php index 58477d653..4aadb6f1d 100644 --- a/niucloud/app/service/admin/auth/LoginService.php +++ b/niucloud/app/service/admin/auth/LoginService.php @@ -23,6 +23,7 @@ use core\exception\AuthException; use core\util\TokenAuth; use Exception; use Throwable; +use app\service\admin\home\AuthSiteService as HomeAuthSiteService; /** * 登录服务层 @@ -49,6 +50,8 @@ class LoginService extends BaseAdminService { if(!array_key_exists($app_type, AppTypeDict::getAppType())) throw new AuthException('APP_TYPE_NOT_EXIST'); + $this->site_id = $this->request->adminSiteId(); + $config = (new ConfigService())->getConfig(); switch($app_type){ case AppTypeDict::SITE: @@ -67,7 +70,11 @@ class LoginService extends BaseAdminService if ($userinfo->isEmpty()) return false; if (!check_password($password, $userinfo->password)) return false; + $this->request->uid($userinfo->uid); + $auth_site_service = (new HomeAuthSiteService()); + + $default_site_id = 0; if($app_type == AppTypeDict::ADMIN){ $default_site_id = $this->request->defaultSiteId(); $userrole = (new UserRoleService())->getUserRole($default_site_id, $userinfo->uid); @@ -77,7 +84,10 @@ class LoginService extends BaseAdminService $app_type = AppTypeDict::SITE; } } else if($app_type == AppTypeDict::SITE){ - $default_site_id = $this->site_id; + $site_ids = $auth_site_service->getSiteIds(); + if(!empty($site_ids)){ + $default_site_id = in_array($this->site_id, $site_ids) || AuthService::isSuperAdmin() ? $this->site_id : $site_ids[0]; + } } else { throw new AuthException('APP_TYPE_NOT_EXIST'); } @@ -98,22 +108,20 @@ class LoginService extends BaseAdminService 'userinfo' => [ 'uid' => $userinfo->uid, 'username' => $userinfo->username, - 'is_super_admin' => AuthService::isSuperAdmin() + 'is_super_admin' => AuthService::isSuperAdmin(), + 'head_img' => $userinfo->head_img ], 'site_id' => $default_site_id, 'site_info' => null, 'userrole' => $app_type == AppTypeDict::ADMIN ? $userrole : [] ]; if ($app_type == AppTypeDict::ADMIN || ($app_type == AppTypeDict::SITE && $data['site_id']) ) { - $data['site_info'] = (new SiteService())->getInfo($data['site_id']); + $this->request->siteId($data['site_id']); + $data['site_info'] = (new AuthSiteService())->getSiteInfo(); } if ($app_type == AppTypeDict::ADMIN && !$data['userinfo']['is_super_admin']) { - $data['userinfo']['site_ids'] = (new \app\service\admin\home\AuthSiteService())->getSiteIds(); + $data['userinfo']['site_ids'] = $auth_site_service->getSiteIds(); } - - // 获取站点布局 - $layout_config = (new CoreConfigService())->getConfig($data['site_id'], 'SITE_LAYOUT'); - $data['layout'] = empty($layout_config) ? 'default' : $layout_config['value']['key']; return $data; } diff --git a/niucloud/app/service/admin/diy/DiyConfigService.php b/niucloud/app/service/admin/diy/DiyConfigService.php index 916db8e49..4cdc13bfe 100644 --- a/niucloud/app/service/admin/diy/DiyConfigService.php +++ b/niucloud/app/service/admin/diy/DiyConfigService.php @@ -32,19 +32,19 @@ class DiyConfigService extends BaseAdminService */ public function getBottomList($params = []) { - $list = (new CoreDiyConfigService())->getBottomList($params); + $list = ( new CoreDiyConfigService() )->getBottomList($params); - $site_addon = (new CoreSiteService())->getSiteCache($this->site_id); + $site_addon = ( new CoreSiteService() )->getSiteCache($this->site_id); // 单应用,排除 系统 底部导航设置 if (count($site_addon[ 'apps' ]) == 1) { - foreach ($list as $k=>$v){ - if($v['key'] = 'app'){ - unset($list[$k]); + foreach ($list as $k => $v) { + if ($v[ 'key' ] = 'app') { + unset($list[ $k ]); break; } } - $list = array_values($list); + $list = array_values($list); } return $list; } @@ -56,7 +56,7 @@ class DiyConfigService extends BaseAdminService */ public function getBottomConfig($key) { - return (new CoreDiyConfigService())->getBottomConfig($this->site_id, $key); + return ( new CoreDiyConfigService() )->getBottomConfig($this->site_id, $key); } /** @@ -67,7 +67,7 @@ class DiyConfigService extends BaseAdminService */ public function setBottomConfig($data, $key) { - return (new CoreDiyConfigService())->setBottomConfig($this->site_id, $data, $key); + return ( new CoreDiyConfigService() )->setBottomConfig($this->site_id, $data, $key); } /** @@ -77,7 +77,7 @@ class DiyConfigService extends BaseAdminService */ public function setStartUpPageConfig($data) { - return (new CoreDiyConfigService())->setStartUpPageConfig($this->site_id, $data); + return ( new CoreDiyConfigService() )->setStartUpPageConfig($this->site_id, $data); } /** @@ -87,7 +87,7 @@ class DiyConfigService extends BaseAdminService */ public function getStartUpPageConfig($name) { - return (new CoreDiyConfigService())->getStartUpPageConfig($this->site_id, $name); + return ( new CoreDiyConfigService() )->getStartUpPageConfig($this->site_id, $name); } } diff --git a/niucloud/app/service/admin/diy/DiyRouteService.php b/niucloud/app/service/admin/diy/DiyRouteService.php index 72c2f2c7e..4ebe1e1ae 100644 --- a/niucloud/app/service/admin/diy/DiyRouteService.php +++ b/niucloud/app/service/admin/diy/DiyRouteService.php @@ -58,7 +58,7 @@ class DiyRouteService extends BaseAdminService $is_add = false; } - if (!empty($where[ 'addon_name' ]) && $where[ 'addon_name' ] != $v[ 'addon_info' ][ 'key' ]) { + if (!empty($v[ 'addon_info' ]) && !empty($where[ 'addon_name' ]) && $where[ 'addon_name' ] != $v[ 'addon_info' ][ 'key' ]) { $is_add = false; } diff --git a/niucloud/app/service/admin/diy/DiyService.php b/niucloud/app/service/admin/diy/DiyService.php index 79dc38ab6..7b7600dd4 100644 --- a/niucloud/app/service/admin/diy/DiyService.php +++ b/niucloud/app/service/admin/diy/DiyService.php @@ -17,7 +17,6 @@ use app\dict\diy\PagesDict; use app\dict\diy\TemplateDict; use app\model\diy\Diy; use app\service\admin\sys\SystemService; -use app\service\core\addon\CoreAddonService; use core\base\BaseAdminService; use core\exception\AdminException; use Exception; @@ -317,8 +316,6 @@ class DiyService extends BaseAdminService $data[ 'component' ] = $this->getComponentList($data[ 'type' ]); $data[ 'domain_url' ] = ( new SystemService() )->getUrl(); - // 查询已安装的有效的应用 - $data[ 'addon_list' ] = ( new CoreAddonService() )->getInstallAddonList(); return $data; } @@ -487,8 +484,8 @@ class DiyService extends BaseAdminService 'type' => $params[ 'type' ], // 页面类型标识 'name' => '', // 链接标识 'parent' => '', // 链接标识 - 'title' => $default_page_data[ 'title' ], // 模板名称 - 'cover' => $default_page_data[ 'cover' ], // 封面图 + 'title' => $default_page_data[ 'title' ] ?? '', // 模板名称 + 'cover' => $default_page_data[ 'cover' ] ?? '', // 封面图 'url' => '', // 自定义页面链接,实时预览效果 'page' => $template[ 'page' ], // 页面地址 'action' => $template[ 'action' ] // 是否存在操作,decorate 表示支持装修 @@ -538,6 +535,8 @@ class DiyService extends BaseAdminService // 如果没有预览图,并且没有地址,则赋值默认页面地址 if (empty($use_template[ 'cover' ]) && empty($use_template[ 'url' ])) { $use_template[ 'url' ] = $template[ 'page' ]; + } elseif (empty($use_template[ 'url' ])) { + $use_template[ 'url' ] = $template[ 'page' ]; } $template[ 'use_template' ] = $use_template; diff --git a/niucloud/app/service/admin/home/AuthSiteService.php b/niucloud/app/service/admin/home/AuthSiteService.php index 01341ac32..af49b40d5 100644 --- a/niucloud/app/service/admin/home/AuthSiteService.php +++ b/niucloud/app/service/admin/home/AuthSiteService.php @@ -15,12 +15,17 @@ namespace app\service\admin\home; use app\dict\sys\AppTypeDict; use app\dict\sys\MenuTypeDict; use app\model\site\Site; +use app\model\site\SiteGroup; use app\model\sys\SysMenu; use app\model\sys\SysUserRole; +use app\model\sys\UserCreateSiteLimit; use app\service\admin\auth\AuthService; +use app\service\admin\site\SiteGroupService; use app\service\admin\site\SiteService; +use app\service\admin\sys\ConfigService; use app\service\admin\sys\RoleService; use core\base\BaseAdminService; +use core\exception\CommonException; use core\exception\HomeException; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; @@ -66,7 +71,16 @@ class AuthSiteService extends BaseAdminService ]; if (!AuthService::isSuperAdmin()) $condition[] = ['site_id', 'in', $this->getSiteIds()]; $search_model = $this->model->where($condition)->withSearch([ 'create_time', 'expire_time', 'keywords', 'status', 'group_id', 'app' ], $where)->with(['groupName'])->field($field)->append([ 'status_name' ])->order('create_time desc'); - return $this->pageQuery($search_model); + + $theme_color = (new ConfigService())->getThemeColor(); + + return $this->pageQuery($search_model, function ($item) use ($theme_color) { + if (is_array($item['app']) && count($item['app']) == 1) { + $item['theme_color'] = $theme_color[ $item['app'][0] ] ?? ''; + } else { + $item['theme_color'] = $theme_color['system'] ?? ''; + } + }); } /** @@ -113,4 +127,52 @@ class AuthSiteService extends BaseAdminService $site_ids = $this->getSiteIds(); if(!in_array($site_id, $site_ids)) throw new HomeException('USER_ROLE_NOT_HAS_SITE');//无效的站点 } + + /** + * 获取可选择的店铺套餐 + * @return array + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ + public function getSiteGroup() { + if (AuthService::isSuperAdmin()) { + $site_group = (new SiteGroup())->field('group_id,group_name,app,addon')->append(['app_name', 'addon_name'])->select()->toArray(); + return array_map(function ($item){ + return [ + 'group_id' => $item['group_id'], + 'site_group' => $item + ]; + }, $site_group); + } else { + return (new UserCreateSiteLimit())->where([ ['uid', '=', $this->uid] ])->with(['site_group' => function($query) { + $query->field('group_id,group_name,app,addon'); + }])->select()->toArray(); + } + } + + /** + * 创建站点 + * @param array $data + * @return void + */ + public function createSite(array $data) { + if (!AuthService::isSuperAdmin()) { + $limit = (new UserCreateSiteLimit())->where([ ['uid', '=', $this->uid], ['group_id', '=', $data['group_id'] ] ])->findOrEmpty(); + if ($limit->isEmpty()) throw new CommonException('NO_PERMISSION_TO_CREATE_SITE_GROUP'); + + if (SiteGroupService::getUserSiteGroupSiteNum($this->uid, $data['group_id']) > ($limit['num'] - 1)) throw new CommonException('SITE_GROUP_CREATE_SITE_EXCEEDS_LIMIT'); + } else { + $limit = ['month' => 1]; + } + + (new SiteService())->add([ + 'site_name' => $data['site_name'], + 'uid' => $this->uid, + 'group_id' => $data['group_id'], + 'expire_time' => strtotime("+ {$limit['month']} month") + ]); + + return true; + } } diff --git a/niucloud/app/service/admin/notice/SmsService.php b/niucloud/app/service/admin/notice/SmsService.php index d6190fa50..1aef65c5a 100644 --- a/niucloud/app/service/admin/notice/SmsService.php +++ b/niucloud/app/service/admin/notice/SmsService.php @@ -54,6 +54,7 @@ class SmsService extends BaseAdminService 'value' => $config_type[$k][$k_param] ?? '' ]; } + $data['component'] = $v['component'] ?? ''; $list[] = $data; } return $list; @@ -125,4 +126,4 @@ class SmsService extends BaseAdminService } -} \ No newline at end of file +} diff --git a/niucloud/app/service/admin/site/SiteGroupService.php b/niucloud/app/service/admin/site/SiteGroupService.php index e672b39d9..4d6836c6e 100644 --- a/niucloud/app/service/admin/site/SiteGroupService.php +++ b/niucloud/app/service/admin/site/SiteGroupService.php @@ -25,6 +25,7 @@ use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; use think\facade\Cache; +use think\facade\Db; /** * 站点分组服务层 @@ -182,7 +183,7 @@ class SiteGroupService extends BaseAdminService $group = $this->model->findOrEmpty($group_id); $addon = []; if (!$group->isEmpty()) { - $addon = array_merge([ $group['app'] ], $group['addon']); + $addon = array_merge($group['app'], $group['addon']); } return $addon; }, @@ -204,4 +205,38 @@ class SiteGroupService extends BaseAdminService ]; return $this->add($data); } + + /** + * 查询店铺套餐以及用户创建的站点数量 + * @param $uid + * @return array + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ + public function getUserSiteGroupAll($uid) { + $field = 'group_id, group_name, group_desc, create_time, update_time, app'; + $list = $this->model->field($field)->select()->toArray(); + foreach ($list as &$item) { + $item['site_num'] = self::getUserSiteGroupSiteNum($uid, $item['group_id']); + } + return $list; + } + + /** + * 查询用户某个站点套餐的站点数量 + * @param $uid + * @param $group_id + * @return void + */ + public static function getUserSiteGroupSiteNum($uid, $group_id) { + return Db::name("sys_user_role")->alias('sur') + ->join('site s', 'sur.site_id = s.site_id') + ->where([ + ['sur.uid', '=', $uid], + ['sur.is_admin', '=', 1], + ['s.group_id', '=', $group_id] + ])->count(); + } + } diff --git a/niucloud/app/service/admin/site/SiteService.php b/niucloud/app/service/admin/site/SiteService.php index 3176b7fa3..9fdac469b 100644 --- a/niucloud/app/service/admin/site/SiteService.php +++ b/niucloud/app/service/admin/site/SiteService.php @@ -100,10 +100,8 @@ class SiteService extends BaseAdminService */ public function add(array $data) { - $user_service = new UserService(); - if ($user_service->checkUsername($data[ 'username' ])) throw new AdminException('USERNAME_REPEAT'); - $site_group = (new SiteGroup())->where([ ['group_id', '=', $data[ 'group_id' ] ] ])->field('app,addon')->findOrEmpty(); + if ($site_group->isEmpty()) throw new CommonException('SITE_GROUP_NOT_EXIST'); $data[ 'app_type' ] = 'site'; //添加站点 @@ -276,7 +274,7 @@ class SiteService extends BaseAdminService $is_admin = $user_role_info['is_admin'];//是否是超级管理员组 } - if ($app_type == AppTypeDict::ADMIN || $is_admin) { + if ($is_admin) { return ( new MenuService() )->getAllMenuList($app_type, $status, $is_tree, $is_button); } else { $user_role_ids = $user_role_info['role_ids']; diff --git a/niucloud/app/service/admin/site/SiteUserService.php b/niucloud/app/service/admin/site/SiteUserService.php index f5a6e2dc3..84ba4b12c 100644 --- a/niucloud/app/service/admin/site/SiteUserService.php +++ b/niucloud/app/service/admin/site/SiteUserService.php @@ -12,12 +12,17 @@ namespace app\service\admin\site; use app\dict\sys\UserDict; +use app\model\sys\SysRole; use app\model\sys\SysUser; use app\model\sys\SysUserRole; +use app\model\sys\UserCreateSiteLimit; +use app\service\admin\auth\LoginService; use app\service\admin\user\UserRoleService; use app\service\admin\user\UserService; use core\base\BaseAdminService; +use core\exception\AdminException; use Exception; +use think\facade\Db; /** * 站点用户服务层 @@ -40,38 +45,20 @@ class SiteUserService extends BaseAdminService */ public function getPage(array $where) { - $site_id = $this->site_id; - $field = 'id,SysUserRole.uid,site_id,role_ids,SysUserRole.create_time,is_admin,SysUserRole.status,count(site_id) as site_num'; - $order = 'SysUserRole.create_time desc'; - $search_model = (new SysUserRole()) - ->field($field) - ->order($order) - ->with('userinfo') - ->hasWhere('userinfo', function ($query) use ($where, $site_id) { - $condition = [ - ['SysUserRole.site_id', '>', 0 ] - ]; + $search_model = (new SysUserRole())->order('is_admin desc,id desc') + ->with('userinfo')->append(['status_name']) + ->hasWhere('userinfo', function ($query) use ($where) { + $condition = []; if (!empty($where['username'])) $condition[] = ['username', 'like', "%{$where['username']}%"]; - if (!empty($where['realname'])) $condition[] = ['realname', 'like', "%{$where['realname']}%"]; - - //最后登录时间 - if (!empty($where['last_time'])) { - $start_time = empty($where['last_time'][0]) ? 0 : strtotime($where['last_time'][0]); - $end_time = empty($where['last_time'][1]) ? 0 : strtotime($where['last_time'][1]); - if ($start_time > 0 && $end_time > 0) { - $condition[] = ['last_time', 'between', [$start_time, $end_time]]; - } else if ($start_time > 0 && $end_time == 0) { - $condition[] = ['last_time', '>=', $start_time]; - } else if ($start_time == 0 && $end_time > 0) { - $condition[] = ['last_time', '<=', $end_time]; - } - } $query->where($condition); - }) - ->group('SysUserRole.uid') - ->append(['status_name']); - - return $this->pageQuery($search_model); + })->where([ ['SysUserRole.site_id', '=', $this->site_id ] ]); + return $this->pageQuery($search_model, function ($item){ + if (!empty($item['role_ids'])) { + $item['role_array'] = (new SysRole())->where([ ['role_id', 'in', $item['role_ids'] ] ])->column('role_name'); + } else { + $item['role_array'] = []; + } + }); } /** @@ -81,15 +68,9 @@ class SiteUserService extends BaseAdminService */ public function getInfo(int $uid) { - $field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, delete_time, update_time'; - $info = $this->model->where([ ['uid', '=', $uid] ])->field($field)->with(['roles' => function($query) { - $query->field('uid, site_id, is_admin')->with('siteInfo'); - }])->findOrEmpty()->toArray(); - if (!empty($info)) { - $info['roles'] = array_values(array_filter(array_map(function ($item) { - if ($item['site_id']) return $item; - }, $info['roles']))); - } + $info = (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ]) + ->with('userinfo')->append(['status_name']) + ->findOrEmpty()->toArray(); return $info; } @@ -111,7 +92,20 @@ class SiteUserService extends BaseAdminService */ public function edit(int $uid, array $data) { - return (new UserService())->editSiteUser($uid, $data, $this->site_id); + Db::startTrans(); + try { + (new UserService())->edit($uid, $data); + + $role_ids = $data['role_ids'] ?? []; + //创建用户站点管理权限 + (new UserRoleService())->edit($this->site_id, $uid, $role_ids, $data['status'] ?? UserDict::ON); + + Db::commit(); + return true; + } catch ( Exception $e) { + Db::rollback(); + throw new AdminException($e->getMessage()); + } } /** @@ -152,7 +146,9 @@ class SiteUserService extends BaseAdminService * @return bool|true */ public function lock(int $uid){ - return (new UserService())->statusChange($uid, UserDict::OFF); + (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => UserDict::OFF]); + LoginService::clearToken($uid); + return true; } /** @@ -161,6 +157,8 @@ class SiteUserService extends BaseAdminService * @return bool|true */ public function unlock(int $uid){ - return (new UserService())->statusChange($uid, UserDict::ON); + (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => UserDict::ON]); + LoginService::clearToken($uid); + return true; } } diff --git a/niucloud/app/service/admin/stat/StatService.php b/niucloud/app/service/admin/stat/StatService.php index 9b919794a..766d2afcc 100644 --- a/niucloud/app/service/admin/stat/StatService.php +++ b/niucloud/app/service/admin/stat/StatService.php @@ -11,6 +11,7 @@ namespace app\service\admin\stat; +use app\model\member\Member; use app\model\site\Site; use app\service\admin\site\SiteGroupService; use app\service\admin\site\SiteService; @@ -83,7 +84,11 @@ class StatService extends BaseAdminService 'image' => 'static/resource/icon/index_icon/wework_qrcode.png', 'desc' => '更多内容请扫码加入' ] - ] + ], + 'member_count_stat' => [ + 'date' => [], + 'value' => [] + ], ]; $day_start_time = strtotime(date('Y-m-d')); @@ -95,6 +100,10 @@ class StatService extends BaseAdminService $data['today_data']['today_site_count'] = (new SiteService())->getCount(['create_time' => [$day_start_time, $day_end_time]]); $data['today_data']['norma_site_count'] = (new SiteService())->getCount(['status' => [1],'app_type' => ['site']]); $data['today_data']['expire_site_count'] = (new SiteService())->getCount(['status' => [2]]); + $data['today_data']['week_expire_site_count'] = (new Site())->where([ + ['status', '=', 1], + ['expire_time', 'BETWEEN', [time(), time() + 86400*7 ] ] + ])->count(); $data['system'] = (new SystemService())->getInfo(); $data['version'] = $data['system']['version'] ?? []; @@ -103,6 +112,9 @@ class StatService extends BaseAdminService $item_day = date('Y-m-d', strtotime('+' . $i - 7 . ' days', $time)); $data['site_stat']['date'][] = $item_day; $data['site_stat']['value'][] = (new Site())->where([['create_time','between',get_start_and_end_time_by_day($item_day)]])->count(); + + $data['member_count_stat']['date'][] = $item_day; + $data['member_count_stat']['value'][] = (new Member())->where([['create_time','between',get_start_and_end_time_by_day($item_day)]])->count(); } $man_count = (new CoreMemberService())->getCount(['sex' => '1']); $woman_count = (new CoreMemberService())->getCount(['sex' => '2']); diff --git a/niucloud/app/service/admin/sys/AttachmentService.php b/niucloud/app/service/admin/sys/AttachmentService.php index 4aabf68b3..4a4498228 100644 --- a/niucloud/app/service/admin/sys/AttachmentService.php +++ b/niucloud/app/service/admin/sys/AttachmentService.php @@ -291,7 +291,7 @@ class AttachmentService extends BaseAdminService foreach ($icon as $ck => $cv) { // 素材表中数据保持要一致 $icon[ $ck ][ 'att_id' ] = $cv[ 'icon_id' ]; - $icon[ $ck ][ 'url' ] = $v[ 'font_family' ] . '-' . $v[ 'css_prefix_text' ] . $cv[ 'font_class' ]; + $icon[ $ck ][ 'url' ] = $v[ 'font_family' ] . ' ' . $v[ 'css_prefix_text' ] . $cv[ 'font_class' ]; $icon[ $ck ][ 'real_name' ] = $cv[ 'name' ]; // 查询名称 diff --git a/niucloud/app/service/admin/sys/ConfigService.php b/niucloud/app/service/admin/sys/ConfigService.php index 41d6ea107..af02b537e 100644 --- a/niucloud/app/service/admin/sys/ConfigService.php +++ b/niucloud/app/service/admin/sys/ConfigService.php @@ -240,7 +240,7 @@ class ConfigService extends BaseAdminService } /** - * 设置开发者key + * 设置布局风格 * @param array $data * @return array */ @@ -252,4 +252,27 @@ class ConfigService extends BaseAdminService return ( new CoreConfigService() )->setConfig(0, "LAYOUT_SETTING", $config); } + /** + * 获取色调设置 + * @return array + */ + public function getThemeColor() + { + return ( new CoreConfigService() )->getConfigValue(0, "THEMECOLOR_SETTING"); + } + + /** + * 设置色调 + * @param array $data + * @return array + */ + public function setThemeColor(array $data) + { + $config_service = new CoreConfigService(); + $config = $config_service->getConfigValue(0, "THEMECOLOR_SETTING"); + $config[ $data[ 'key' ] ] = $data[ 'value' ]; + return ( new CoreConfigService() )->setConfig(0, "THEMECOLOR_SETTING", $config); + } + + } diff --git a/niucloud/app/service/admin/sys/MenuService.php b/niucloud/app/service/admin/sys/MenuService.php index 83201de18..5b0f99d3e 100644 --- a/niucloud/app/service/admin/sys/MenuService.php +++ b/niucloud/app/service/admin/sys/MenuService.php @@ -15,6 +15,7 @@ use app\dict\sys\MenuDict; use app\dict\sys\MenuTypeDict; use app\model\sys\SysMenu; use app\service\admin\addon\AddonService; +use app\service\admin\site\SiteService; use core\base\BaseAdminService; use core\dict\DictLoader; use core\exception\AdminException; @@ -193,20 +194,36 @@ class MenuService extends BaseAdminService */ public function getAllMenuList($app_type = '', $status = 'all', $is_tree = 0, $is_button = 0) { - $cache_name = 'menu_api_' .$app_type.'_'. $status . '_' . $is_tree . '_' . $is_button; + $site_id = $this->site_id; + $cache_name = 'site_menu_api_' .$app_type.'_'. $status . '_' . $is_tree . '_' . $is_button . '_' . $this->site_id; $menu_list = cache_remember( $cache_name, - function () use ($status, $is_tree, $is_button, $app_type) { + function () use ($status, $is_tree, $is_button, $app_type, $site_id) { $where = [ -// ['menu_type', 'in', [0,1]] ['app_type', '=', $app_type], + ['addon', 'in', array_merge([''], get_site_addons($site_id)) ] ]; if ($status != 'all') { $where[] = ['status', '=', $status]; } + + // 排除菜单 + $delete_menu_addon = []; + $addon_loader = new DictLoader("Menu"); + foreach (get_site_addons($site_id) as $addon) { + $delete_menu = $addon_loader->load(["addon" => $addon, "app_type" => $app_type])['delete'] ?? []; + if (!empty($delete_menu) && is_array($delete_menu)) $delete_menu_addon[] = $delete_menu; + } + if (!empty($delete_menu_addon)) { + $delete_intersect = array_intersect(...$delete_menu_addon); + if (!empty($delete_intersect)) { + $where[] = ['menu_key', 'not in', $delete_intersect]; + } + } + return $this->model->where($where)->order('sort desc')->select()->toArray(); }, - self::$cache_tag_name + [self::$cache_tag_name, SiteService::$cache_tag_name] ); foreach ($menu_list as &$v) { @@ -218,9 +235,7 @@ class MenuService extends BaseAdminService $v['menu_name'] = $lang_menu_name; } } - return $is_tree ? $this->menuToTree($menu_list, 'menu_key', 'parent_key', 'children', 'auth', '', $is_button) : $menu_list; - } diff --git a/niucloud/app/service/admin/sys/SystemService.php b/niucloud/app/service/admin/sys/SystemService.php index d8723661c..deb65ab00 100644 --- a/niucloud/app/service/admin/sys/SystemService.php +++ b/niucloud/app/service/admin/sys/SystemService.php @@ -179,15 +179,4 @@ class SystemService extends BaseAdminService } return false; } - - /** - * 设置布局 - * @param string $key - */ - public function setLayout(string $key) { - $layouts = array_column(event('SiteLayout'), 'key'); - if (!in_array($key, $layouts)) throw new CommonException('LAYOUT_NOT_EXIST'); - (new CoreConfigService())->setConfig($this->site_id, 'SITE_LAYOUT', [ 'key' => $key ]); - return true; - } } diff --git a/niucloud/app/service/admin/upgrade/UpgradeService.php b/niucloud/app/service/admin/upgrade/UpgradeService.php index 144663e23..f92f23f6a 100644 --- a/niucloud/app/service/admin/upgrade/UpgradeService.php +++ b/niucloud/app/service/admin/upgrade/UpgradeService.php @@ -368,6 +368,8 @@ class UpgradeService extends BaseAdminService dir_copy($code_dir . 'uni-app', $this->root_path . 'uni-app'); $addon_list = (new CoreAddonService())->getInstallAddonList(); + $depend_service = new CoreDependService(); + if (!empty($addon_list)) { foreach ($addon_list as $addon => $item) { @@ -384,6 +386,21 @@ class UpgradeService extends BaseAdminService // 编译 加载插件标题语言包 $this->compileLocale($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon); + + // 合并插件依赖 + $addon_uniapp_package = str_replace('/', DIRECTORY_SEPARATOR, project_path() . "niucloud/addon/{$addon}/package/uni-app-package.json"); + + if (file_exists($addon_uniapp_package)) { + $original = $depend_service->getNpmContent('uni-app'); + $new = $depend_service->jsonFileToArray($addon_uniapp_package); + + foreach ($new as $name => $value) { + $original[$name] = isset($original[$name]) && is_array($original[$name]) ? array_merge($original[$name], $new[$name]) : $new[$name]; + } + + $uniapp_package = $this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'package.json'; + $depend_service->writeArrayToJsonFile($original, $uniapp_package); + } } } return true; diff --git a/niucloud/app/service/admin/user/UserRoleService.php b/niucloud/app/service/admin/user/UserRoleService.php index 827e9ddb7..93c188c5c 100644 --- a/niucloud/app/service/admin/user/UserRoleService.php +++ b/niucloud/app/service/admin/user/UserRoleService.php @@ -12,6 +12,7 @@ namespace app\service\admin\user; +use app\dict\sys\UserDict; use app\model\sys\SysRole; use app\model\sys\SysUserRole; use app\service\admin\sys\RoleService; @@ -52,13 +53,16 @@ class UserRoleService extends BaseAdminService $role_data = array( 'uid' => $uid, 'is_admin' => $is_admin, - 'site_id' => $site_id == 0 ? $this->site_id : $site_id + 'site_id' => $site_id == 0 ? $this->site_id : $site_id, + 'status' => $data['status'] ?? UserDict::ON ); if(!$is_admin){ //校验权限越界 $role_data['role_ids'] = $data['role_ids'] ?? []; } $user_role_model->save($role_data); + Cache::delete('user_role_'.$uid.'_'.$site_id); + Cache::delete('user_role_list_' .$uid); return true; } @@ -69,7 +73,7 @@ class UserRoleService extends BaseAdminService * @param array $role_ids * @return bool */ - public function edit(int $site_id, int $uid, array $role_ids){ + public function edit(int $site_id, int $uid, array $role_ids, $status = UserDict::ON){ $user_role = $this->model->where([['uid', '=', $uid], ['site_id', '=', $site_id]])->findOrEmpty(); if ($user_role->isEmpty()) throw new AdminException('NO_SITE_USER_ROLE'); @@ -77,14 +81,15 @@ class UserRoleService extends BaseAdminService $is_admin = $user_role->is_admin; if($is_admin)//超级管理员不允许改动权限 throw new AdminException('ADMIN_NOT_ALLOW_EDIT_ROLE'); + $user_role->status = $status; if (!empty(array_diff_assoc($role_ids, $user_role->role_ids))) { //校验权限越界 - $user_role->save(['role_ids' => $role_ids]); - $cache_name = 'user_role_'.$uid.'_'.$site_id; - Cache::delete($cache_name); - return true; + $user_role->role_ids = $role_ids; } - return false; + Cache::delete('user_role_'.$uid.'_'.$site_id); + Cache::delete('user_role_list_' .$uid); + $user_role->save(); + return true; } /** diff --git a/niucloud/app/service/admin/user/UserService.php b/niucloud/app/service/admin/user/UserService.php index 2e1392979..03dbe4b1f 100644 --- a/niucloud/app/service/admin/user/UserService.php +++ b/niucloud/app/service/admin/user/UserService.php @@ -16,12 +16,15 @@ use app\dict\sys\AppTypeDict; use app\dict\sys\UserDict; use app\model\sys\SysUser; use app\model\sys\SysUserRole; +use app\model\sys\UserCreateSiteLimit; +use app\service\admin\auth\AuthService; use app\service\admin\auth\LoginService; use core\base\BaseAdminService; use core\exception\AdminException; use core\exception\CommonException; use Exception; use think\db\exception\DbException; +use think\facade\Cache; use think\facade\Db; use think\Model; @@ -45,7 +48,15 @@ class UserService extends BaseAdminService */ public function getPage(array $where) { - return $this->getPageList($this->model, $where, 'uid,username,head_img,real_name,last_ip,last_time,login_count,status', 'uid desc',['status_name']); + AuthService::isSuperAdmin(); + $super_admin_uid = Cache::get('super_admin_uid'); + + $field = 'uid,username,head_img,real_name,last_ip,last_time,login_count,status'; + $search_model = $this->model->withSearch([ 'username', 'real_name', 'last_time' ], $where)->field($field)->append([ 'status_name' ])->order('uid desc'); + return $this->pageQuery($search_model, function ($item) use ($super_admin_uid) { + $item['site_num'] = (new SysUserRole())->where([['uid', '=', $item['uid']], ['site_id', '<>', request()->defaultSiteId() ] ])->count(); + $item['is_super_admin'] = $super_admin_uid == $item['uid']; + }); } @@ -55,68 +66,26 @@ class UserService extends BaseAdminService * @return array */ public function getInfo(int $uid){ + AuthService::isSuperAdmin(); + $super_admin_uid = Cache::get('super_admin_uid'); + $where = array( ['uid', '=', $uid], ); - $field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, status, delete_time, update_time'; - $user = $this->model->where($where)->field($field)->append(['status_name'])->findOrEmpty(); - return $user->toArray(); - } - - /** - * 获取用户列表 - * @param array $where - * @return array - */ - public function getUserAdminPage(array $where) - { - $site_id = $this->site_id; - $field = 'id,SysUserRole.uid,site_id,role_ids,SysUserRole.create_time,is_admin,SysUserRole.status'; - $order = 'SysUserRole.create_time desc'; - $search_model = (new SysUserRole()) - ->field($field) - ->order($order) - ->with('userinfo') - ->hasWhere('userinfo', function ($query) use ($where, $site_id) { - $condition = [ - ['SysUserRole.site_id', '=', $site_id ] - ]; - if (!empty($where['username'])) $condition[] = ['username', 'like', "%{$where['username']}%"]; - if (!empty($where['realname'])) $condition[] = ['realname', 'like', "%{$where['realname']}%"]; - $query->where($condition); - }) - ->append(['status_name']); - - return $this->pageQuery($search_model, function ($item, $key) { - if (!empty($item->role_ids)) { - $item->role_array = (new UserRoleService())->getRoleByUserRoleIds($item->role_ids, $this->site_id); - } else { - $item->role_array = []; - } - }); - } - - /** - * 获取用户信息 - * @param int $uid - * @return array - */ - public function getUserAdminInfo(int $uid) - { - $field = 'id,uid,site_id,role_ids,create_time,is_admin,status'; - $info = (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id ] ]) - ->field($field) - ->with('userinfo') - ->findOrEmpty() - ->toArray(); + $field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, delete_time, update_time'; + $info = $this->model->where($where)->field($field)->findOrEmpty()->toArray(); if (!empty($info)) { - if (!empty($info['role_ids'])) { - $info['role_array'] = (new UserRoleService())->getRoleByUserRoleIds($info['role_ids'], $this->site_id); - } else { - $info['role_array'] = []; - } + $info['roles'] = (new SysUserRole())->where([['uid', '=', $info['uid']], ['site_id', '<>', request()->defaultSiteId() ] ]) + ->field('*') + ->with(['site_info' => function($query) { + $query->field('site_id, site_name, app_type, status, expire_time'); + }]) + ->select() + ->toArray(); + $info['is_super_admin'] = $super_admin_uid == $info['uid']; } + return $info; } @@ -127,15 +96,40 @@ class UserService extends BaseAdminService * @throws Exception */ public function add(array $data){ - $user_data = [ - 'username' => $data['username'], - 'head_img' => $data['head_img'], - 'status' => $data['status'], - 'real_name' => $data['real_name'], - 'password' => create_password($data['password']) - ]; - $user = $this->model->create($user_data); - return $user?->uid; + if ($this->checkUsername($data['username'])) throw new CommonException('USERNAME_REPEAT'); + + Db::startTrans(); + try { + $user_data = [ + 'username' => $data['username'], + 'head_img' => $data['head_img'], + 'status' => $data['status'], + 'real_name' => $data['real_name'], + 'password' => create_password($data['password']) + ]; + $user = $this->model->create($user_data); + + // 添加用户建站限制 + $create_site_limit = $data['create_site_limit'] ?? []; + if (!empty($create_site_limit)) { + $create_site_limit_save = []; + foreach ($create_site_limit as $item) { + $create_site_limit_save[] = [ + 'group_id' => $item['group_id'], + 'uid' => $user?->uid, + 'num' => $item['num'], + 'month' => $item['month'] + ]; + } + (new UserCreateSiteLimit())->saveAll($create_site_limit_save); + } + + Db::commit(); + return $user?->uid; + } catch (\Exception $e) { + Db::rollback(); + throw new AdminException($e->getMessage()); + } } /** @@ -162,7 +156,7 @@ class UserService extends BaseAdminService $role_ids = $data['role_ids'] ?? []; $is_admin = $data['is_admin'] ?? 0; //创建用户站点管理权限 - (new UserRoleService())->add($uid, ['role_ids' => $role_ids, 'is_admin' => $is_admin], $site_id); + (new UserRoleService())->add($uid, ['role_ids' => $role_ids, 'is_admin' => $is_admin, 'status' => $data['status'] ], $site_id); Db::commit(); return $uid; } catch ( Exception $e) { @@ -171,31 +165,6 @@ class UserService extends BaseAdminService } } - /** - * 更新对应站点用户 - * @param $uid - * @param $data - * @param $site_id - * @return true - */ - public function editSiteUser($uid, $data, $site_id) - { - Db::startTrans(); - try { - //添加用户 - $this->edit($uid, $data); - $role_ids = $data['role_ids'] ?? []; - $is_admin = $data['is_admin'] ?? 0; - //创建用户站点管理权限 - (new UserRoleService())->edit($site_id, $uid, $role_ids); - Db::commit(); - return true; - } catch ( Exception $e) { - Db::rollback(); - throw new AdminException($e->getMessage()); - } - } - /** * 检测用户名是否重复 * @param $username @@ -237,7 +206,6 @@ class UserService extends BaseAdminService ]; $is_off_status = false; if(isset($data['status'])){ - $this->statusChange($uid, $data['status']); if($data['status'] == UserDict::OFF) $is_off_status = true; } @@ -272,9 +240,7 @@ class UserService extends BaseAdminService * @return true */ public function statusChange($uid, $status) { - (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => $status]); - LoginService::clearToken($uid); - return true; + } /** @@ -306,7 +272,7 @@ class UserService extends BaseAdminService * @param array $where * @return array */ - public function getUserAllPage(array $where) + public function getUserAll(array $where) { $field = 'uid, username, head_img'; return $this->model->withSearch(['username', 'realname', 'create_time'], $where) @@ -315,4 +281,63 @@ class UserService extends BaseAdminService ->select() ->toArray(); } + + /** + * 获取用户站点创建限制 + * @param int $uid + * @return void + */ + public function getUserCreateSiteLimit(int $uid) { + return (new UserCreateSiteLimit())->where([ ['uid', '=', $uid] ])->select()->toArray(); + } + + /** + * 获取用户站点创建限制 + * @param int $uid + * @return void + */ + public function getUserCreateSiteLimitInfo(int $id) { + return (new UserCreateSiteLimit())->where([ ['id', '=', $id] ])->findOrEmpty()->toArray(); + } + + /** + * 添加用户站点创建限制 + * @param array $data + * @return void + */ + public function addUserCreateSiteLimit(array $data) { + (new UserCreateSiteLimit())->where(['uid' => $data['uid'], 'group_id' => $data['group_id']])->delete(); + + (new UserCreateSiteLimit())->save( [ + 'uid' => $data['uid'], + 'group_id' => $data['group_id'], + 'num' => $data['num'], + 'month' => $data['month'] + ]); + return true; + } + + /** + * 编辑用户站点创建限制 + * @param $id + * @param array $data + * @return true + */ + public function editUserCreateSiteLimit($id, array $data) { + (new UserCreateSiteLimit())->update( [ + 'num' => $data['num'], + 'month' => $data['month'] + ], ['id' => $id ]); + return true; + } + + /** + * 删除用户站点创建限制 + * @param $id + * @return true + */ + public function delUserCreateSiteLimit($id) { + (new UserCreateSiteLimit())->where(['id' => $id ])->delete(); + return true; + } } diff --git a/niucloud/app/service/admin/verify/VerifierService.php b/niucloud/app/service/admin/verify/VerifierService.php index 6364e9933..e779e0385 100644 --- a/niucloud/app/service/admin/verify/VerifierService.php +++ b/niucloud/app/service/admin/verify/VerifierService.php @@ -45,6 +45,18 @@ class VerifierService extends BaseAdminService }); } + /** + * 获取核销员表列表 + * @param array $where + * @return array + */ + public function getList(array $where = []) + { + return $this->model->where([['site_id', '=', $this->site_id]])->with(['member' => function ($query) { + $query->field('member_id, nickname, mobile, headimg'); + }])->field('*')->order('create_time desc')->select()->toArray(); + } + /** * 组合整理数据 * @param $data diff --git a/niucloud/app/service/admin/verify/VerifyService.php b/niucloud/app/service/admin/verify/VerifyService.php index 655f8f03c..a359216c9 100644 --- a/niucloud/app/service/admin/verify/VerifyService.php +++ b/niucloud/app/service/admin/verify/VerifyService.php @@ -34,7 +34,7 @@ class VerifyService extends BaseAdminService * @throws \think\db\exception\DbException */ public function getPage(array $where = []) { - $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['code', 'type', 'create_time'], $where) + $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['code', 'type', 'create_time', 'verifier_member_id'], $where) ->with(['member' => function($query){ $query->field('member_id, nickname, mobile, headimg'); }])->field('*')->order('create_time desc')->append(['type_name']); @@ -48,13 +48,17 @@ class VerifyService extends BaseAdminService * @return array */ public function getDetail(string $verify_code) { - return $this->model->where([ + $info = $this->model->where([ ['site_id', '=', $this->site_id], ['code', '=', $verify_code] ])->field('*') ->with(['member' => function($query){ $query->field('member_id, nickname, mobile, headimg'); }])->append(['type_name'])->findOrEmpty()->toArray(); + + $info['verify_info'] = event('VerifyInfo',$info); + return $info; + } } diff --git a/niucloud/app/service/admin/weapp/WeappVersionService.php b/niucloud/app/service/admin/weapp/WeappVersionService.php index 9ec9351c1..eb3e30636 100644 --- a/niucloud/app/service/admin/weapp/WeappVersionService.php +++ b/niucloud/app/service/admin/weapp/WeappVersionService.php @@ -11,8 +11,12 @@ namespace app\service\admin\weapp; +use app\dict\sys\CloudDict; use app\dict\sys\FileDict; +use app\service\core\site\CoreSiteService; use app\service\core\weapp\CoreWeappCloudService; +use app\service\core\weapp\CoreWeappConfigService; +use app\service\core\weapp\CoreWeappService; use core\base\BaseAdminService; use app\dict\sys\StorageDict; use app\service\core\upload\CoreUploadService; @@ -43,7 +47,14 @@ class WeappVersionService extends BaseAdminService $version_no += 1; $version = "1.0.{$version_no}"; - $upload_res = (new CoreWeappCloudService())->uploadWeapp([ + $upload_res = (new CoreWeappCloudService())->setConfig(function () { + $config = (new CoreWeappConfigService())->getWeappConfig($this->site_id); + return [ + 'app_id' => $config['app_id'], + 'upload_private_key' => $config['upload_private_key'], + 'addon' => (new CoreSiteService())->getAddonKeysBySiteId($this->site_id) + ]; + })->uploadWeapp([ 'site_id' => $this->site_id, 'version' => $version, 'desc' => $data['desc'] ?? '' @@ -62,7 +73,14 @@ class WeappVersionService extends BaseAdminService public function getPreviewImage() { try { - return (new CoreWeappCloudService())->getWeappPreviewImage(); + $version = $this->model->where([ ['site_id', '=', $this->site_id] ])->order('id desc')->findOrEmpty(); + if (!$version->isEmpty() || in_array($version['status'], [CloudDict::APPLET_UPLOAD_SUCCESS, CloudDict::APPLET_AUDITING])) { + if ($version['from_type'] == 'cloud_build') { + return (new CoreWeappCloudService())->getWeappPreviewImage(); + } else { + return image_to_base64((new CoreWeappService())->getWeappPreviewImage($this->site_id), true); + } + } } catch (\Exception $e) { return ''; } @@ -112,6 +130,18 @@ class WeappVersionService extends BaseAdminService * @return null */ public function getUploadLog(string $key) { - return (new CoreWeappCloudService())->getWeappCompileLog($key); + $build_log = (new CoreWeappCloudService())->getWeappCompileLog($key); + + if (isset($build_log['data']) && isset($build_log['data'][0]) && is_array($build_log['data'][0])) { + $last = end($build_log['data'][0]); + if ($last['code'] == 0) { + (new WeappVersion())->update(['status' => CloudDict::APPLET_UPLOAD_FAIL, 'fail_reason' => $last['msg'] ?? '', 'update_time' => time() ], ['task_key' => $key]); + return $build_log; + } + if ($last['percent'] == 100) { + (new WeappVersion())->update(['status' => CloudDict::APPLET_UPLOAD_SUCCESS, 'update_time' => time() ], ['task_key' => $key]); + } + } + return $build_log; } } diff --git a/niucloud/app/service/admin/wxoplatform/OplatformConfigService.php b/niucloud/app/service/admin/wxoplatform/OplatformConfigService.php new file mode 100644 index 000000000..948710cc0 --- /dev/null +++ b/niucloud/app/service/admin/wxoplatform/OplatformConfigService.php @@ -0,0 +1,51 @@ +getConfig(); + } + + /** + * 设置配置 + * @param array $data + * @return SysConfig|bool|Model + */ + public function setConfig(array $data){ + return (new CoreOplatformConfigService())->setConfig($data); + } + + /** + * 查询微信需要的静态信息 + * @return array + */ + public function getStaticInfo(){ + return (new CoreOplatformConfigService())->getStaticInfo(); + } +} diff --git a/niucloud/app/service/admin/wxoplatform/OplatformServerService.php b/niucloud/app/service/admin/wxoplatform/OplatformServerService.php new file mode 100644 index 000000000..26afee27f --- /dev/null +++ b/niucloud/app/service/admin/wxoplatform/OplatformServerService.php @@ -0,0 +1,111 @@ +getServer(); + + // 授权取消 + $server->handleUnauthorized(function($message, \Closure $next) { + $authorizer_appid = $message['AuthorizerAppid']; + + $site_id = CoreOplatformService::getSiteIdByAuthorizerAppid($authorizer_appid); + request()->siteId($site_id); + + (new OplatformService())->clearAuthorization($authorizer_appid); + return $next($message); + }); + + // 授权更新 + $server->handleAuthorizeUpdated(function($message, \Closure $next) { + $authorizer_appid = $message['AuthorizerAppid']; + $authorization_code = $message['AuthorizationCode']; + + $site_id = CoreOplatformService::getSiteIdByAuthorizerAppid($authorizer_appid); + request()->siteId($site_id); + + (new OplatformService())->authorization(['auth_code' => $authorization_code]); + + return $next($message); + }); + + return $server->serve(); + } + + /** + * + * @param $appid + * @return \Psr\Http\Message\ResponseInterface + * @throws \EasyWeChat\Kernel\Exceptions\BadRequestException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException + * @throws \ReflectionException + * @throws \Throwable + */ + public function message($appid) { + $app = CoreOplatformService::app(); + $server = $app->getServer(); + + $site_id = CoreOplatformService::getSiteIdByAuthorizerAppid($appid); + + $server->with(function($message, \Closure $next) { + switch ($message->Event) { + case 'weapp_audit_success': + $this->weappAuditSuccess($message); + break; + case 'weapp_audit_fail': + $this->weappAuditFail($message); + break; + } + return $next($message); + }); + + return $server->serve(); + } + + /** + * 小程序审核通过 + * @param $message + * @return true + */ + private function weappAuditSuccess($message) { + $site_id = CoreOplatformService::getSiteIdByAuthorizerAppid($message['ToUserName']); + CoreOplatformService::releaseWeapp($site_id); + (new WeappVersion())->where(['site_id' => $site_id, 'status' => CloudDict::APPLET_AUDITING ])->update(['status' => CloudDict::APPLET_UPLOAD_SUCCESS ]); + return true; + } + + /** + * 小程序审核未通过 + * @param $message + * @return true + */ + private function weappAuditFail($message) { + $site_id = CoreOplatformService::getSiteIdByAuthorizerAppid($message['ToUserName']); + (new WeappVersion())->where(['site_id' => $site_id, 'status' => CloudDict::APPLET_AUDITING ])->update(['status' => CloudDict::APPLET_AUDIT_FAIL, 'fail_reason' => $message['Reason'] ]); + return true; + } +} diff --git a/niucloud/app/service/admin/wxoplatform/OplatformService.php b/niucloud/app/service/admin/wxoplatform/OplatformService.php new file mode 100644 index 000000000..b68723b66 --- /dev/null +++ b/niucloud/app/service/admin/wxoplatform/OplatformService.php @@ -0,0 +1,156 @@ +createPreAuthorizationUrl((string)url('/site/wxoplatform/callback', [],'',true)); + } + + /** + * + * @param array $data + * @return void + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\HttpException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public function authorization(array $data) { + $app = CoreOplatformService::app(); + $authorization = $app->getAuthorization($data['auth_code'])->toArray(); + + // 授权账号信息 授权信息 + $result = CoreOplatformService::getAuthorizerInfo($app, $authorization['authorization_info']['authorizer_appid'])->toArray(); + $authorizer_info = $result['authorizer_info']; + $authorization_info = $result['authorization_info']; + $result['authorization_info']['auth_code'] = $data['auth_code']; + + // 小程序 + $qrcode_dir = 'file/image/'.$this->site_id.'/'.date('Ym').'/'.date('d'); + if (isset($authorizer_info['MiniProgramInfo'])) { + $this->weappCheck($authorizer_info, $authorization_info); + + $service = new CoreWeappConfigService(); + $service->setWeappConfig($this->site_id, [ + 'weapp_name' => $authorizer_info['nick_name'], + 'weapp_original' => $authorizer_info['user_name'], + 'app_id' => $authorization_info['authorizer_appid'], + 'qr_code' => (new CoreFetchService())->image($authorizer_info['qrcode_url'], $this->site_id, $qrcode_dir)['url'], + 'is_authorization' => 1 + ]); + $service->setWeappAuthorizationInfo($this->site_id, $result); + + // 授权成功之后调用 + WeappAuthChangeAfter::dispatch(['site_id' => $this->site_id, 'event' => 'authorized' ]); + } else { // 公众号 + $this->wechatCheck($authorizer_info, $authorization_info); + + $service = new CoreWechatConfigService(); + $service->setWechatConfig($this->site_id, [ + 'wechat_name' => $authorizer_info['nick_name'], + 'wechat_original' => $authorizer_info['user_name'], + 'app_id' => $authorization_info['authorizer_appid'], + 'qr_code' => (new CoreFetchService())->image($authorizer_info['qrcode_url'], $this->site_id, $qrcode_dir)['url'], + 'is_authorization' => 1 + ]); + $service->setWechatAuthorizationInfo($this->site_id, $result); + + // 授权成功之后调用 + WechatAuthChangeAfter::dispatch(['site_id' => $this->site_id, 'event' => 'authorized' ]); + } + return true; + } + + /** + * 清除授权 + * @param $app_id + * @return void + */ + public function clearAuthorization($app_id) { + (new SysConfig())->where([ ['value', 'like', "%{$app_id}%"], ['config_key', 'in', [ + ConfigKeyDict::WEAPP, ConfigKeyDict::WECHAT, ConfigKeyDict::WEAPP_AUTHORIZATION_INFO, ConfigKeyDict::WECHAT_AUTHORIZATION_INFO + ] ] ])->delete(); + + WechatAuthChangeAfter::dispatch(['site_id' => $this->site_id, 'event' => 'unauthorized']); + WeappAuthChangeAfter::dispatch(['site_id' => $this->site_id, 'event' => 'unauthorized']); + + return true; + } + + /** + * 授权的小程序检测 + * @param $authorizer_info + * @param $authorization_info + * @return void + */ + private function weappCheck($authorizer_info, $authorization_info) { + $is_exist = (new SysConfig())->where([ ['value', 'like', "%{$authorization_info['authorizer_appid']}%"], ['config_key', '=', ConfigKeyDict::WEAPP], ['site_id', '<>', $this->site_id] ])->count(); + if ($is_exist) throw new CommonException('WEAPP_EXIST'); + + if ($authorizer_info['service_type_info']['id'] != 0 || $authorizer_info['verify_type_info']['id'] == -1) throw new CommonException('请使用已认证的小程序进行授权'); + + // 授权的权限 + $authority = array_map(function ($item){ + return $item['funcscope_category']['id']; + }, $authorization_info['func_info']); + + foreach (WxOplatform::WEAPP_MUST_AUTHORITY as $k => $v) { + if (!in_array($k, $authority)) throw new CommonException("请将{$v}的权限授权给我们"); + } + } + + /** + * 授权的公众号检测 + * @param $authorizer_info + * @param $authorization_info + * @return void + */ + private function wechatCheck($authorizer_info, $authorization_info) { + $is_exist = (new SysConfig())->where([ ['value', 'like', "%{$authorization_info['authorizer_appid']}%"], ['config_key', '=', ConfigKeyDict::WECHAT], ['site_id', '<>', $this->site_id] ])->count(); + if ($is_exist) throw new CommonException('WECHAT_EXIST'); + + if ($authorizer_info['service_type_info']['id'] != 2 || $authorizer_info['verify_type_info']['id'] == -1) throw new CommonException('请使用已认证的服务号进行授权'); + + // 授权的权限 + $authority = array_map(function ($item){ + return $item['funcscope_category']['id']; + }, $authorization_info['func_info']); + + foreach (WxOplatform::WECHAT_MUST_AUTHORITY as $k => $v) { + if (!in_array($k, $authority)) throw new CommonException("请将{$v}的权限授权给我们"); + } + } +} diff --git a/niucloud/app/service/admin/wxoplatform/WeappVersionService.php b/niucloud/app/service/admin/wxoplatform/WeappVersionService.php new file mode 100644 index 000000000..16f615486 --- /dev/null +++ b/niucloud/app/service/admin/wxoplatform/WeappVersionService.php @@ -0,0 +1,343 @@ +model = new WxOplatfromWeappVersion(); + } + + /** + * 添加小程序版本 + * @param array $data + */ + public function add(array $data = []) + { + $site_group = (new SiteGroupService())->getAll(); + if (empty($site_group)) throw new CommonException('PLEASE_ADD_FIRST_SITE_GROUP'); + + $site_group_id = $data['site_group_id'] ?? $site_group[0]['group_id']; + $base_url = $data['base_url'] ?? cache_remember('base_url', function (){ + return (string)url('/', [], '', true); + }); + + $uploading = $this->model->where([ ['site_group_id', '=', $site_group_id ], ['status', '=', 0] ])->field('id')->findOrEmpty(); + if (!$uploading->isEmpty()) throw new CommonException('WEAPP_UPLOADING'); + + $version_no = $this->model->where([ ['site_group_id', '=', $site_group_id ] ])->order('id desc')->field('version_no')->findOrEmpty()->toArray()['version_no'] ?? 0; + $version_no += 1; + $version = "1.{$site_group_id}.{$version_no}"; + + $upload_res = (new CoreWeappCloudService())->setConfig(function () use ($site_group_id, $base_url) { + $config = (new CoreOplatformConfigService())->getConfig(); + $group_info = (new SiteGroupService())->getInfo($site_group_id); + return [ + 'app_id' => $config['develop_app_id'], + 'upload_private_key' => public_path() . $config['develop_upload_private_key'], + 'addon' => array_merge($group_info['app'], $group_info['addon']), + 'base_url' => $base_url + ]; + })->uploadWeapp([ + 'site_id' => $this->site_id, + 'version' => $version, + 'desc' => $data['desc'] ?? '' + ]); + + $res = $this->model->create([ + 'site_group_id' => $site_group_id, + 'user_version' => $version, + 'user_desc' => $data['desc'] ?? '', + 'version_no' => $version_no, + 'create_time' => time(), + 'task_key' => $upload_res['key'], + ]); + + // 获取小程序版本提交结果 + GetVersionUploadResult::dispatch(['task_key' => $upload_res['key']], secs: 10); + return $res->id; + } + + /** + * 获取最后一次提交记录 + * @return WxOplatfromWeappVersion|array|mixed|\think\Model + */ + public function getLastCommitRecord() { + return $this->model->order('id desc')->findOrEmpty(); + } + + /** + * 查询提交记录 + * @return array + * @throws \think\db\exception\DbException + */ + public function getPage() { + $search_model = $this->model->field('*')->append(['status_name']) + ->order('id desc') + ->with('site_group'); + return $this->pageQuery($search_model); + } + + /** + * 获取小程序版本提交结果 + * @param string $task_key + * @return void + */ + public static function getVersionUploadResult(string $task_key) { + $build_log = (new CoreWeappCloudService())->getWeappCompileLog($task_key); + + if (isset($build_log['data']) && isset($build_log['data'][0]) && is_array($build_log['data'][0])) { + $last = end($build_log['data'][0]); + if ($last['code'] == 0) { + (new WxOplatfromWeappVersion())->update(['status' => CloudDict::APPLET_UPLOAD_FAIL, 'fail_reason' => $last['msg'] ?? '', 'update_time' => time() ], ['task_key' => $task_key]); + return true; + } + if ($last['percent'] == 100) { + (new WxOplatfromWeappVersion())->update(['status' => CloudDict::APPLET_UPLOAD_SUCCESS, 'update_time' => time() ], ['task_key' => $task_key]); + VersionUploadSuccess::dispatch(['task_key' => $task_key]); + return true; + } + GetVersionUploadResult::dispatch(['task_key' => $task_key], secs: 10); + } + } + + /** + * 小程序模板上传成功之后 + * @param $task + * @return void + */ + public static function uploadSuccess(string $task_key) { + $version = (new WxOplatfromWeappVersion())->where(['task_key' => $task_key])->findOrEmpty(); + if ($version->isEmpty()) return true; + + $draft_list = CoreOplatformService::getTemplateDraftList()['draft_list'] ?? []; + + if (!empty($draft_list)) { + foreach ($draft_list as $draft_item) { + if ($draft_item['user_version'] == $version['user_version']) { + // 添加草稿到模板库 + CoreOplatformService::addToTemplate(['draft_id' => $draft_item['draft_id']]); + // 获取模板列表 + $template_list = CoreOplatformService::getTemplateList()['template_list'] ?? []; + + if (!empty($template_list)) { + foreach ($template_list as $template_item) { + if ($template_item['user_version'] == $version['user_version']) { + (new WxOplatfromWeappVersion())->update(['template_id' => $template_item['template_id'] ], ['task_key' => $task_key]); + + (new self())->getSiteGroupAuthWeapp($version['site_group_id']); + + // 删除之前的模板 + $prev = (new WxOplatfromWeappVersion())->where([ [ 'site_group_id', '=', $version['site_group_id'] ], ['id', '<', $version['id'] ] ])->order('id desc')->findOrEmpty(); + if (!$prev->isEmpty() && !empty($prev['template_id'])) { + CoreOplatformService::deleteTemplate($prev['template_id']); + } + } + } + } + break; + } + } + } + + $site_group = (new SiteGroup())->where([ ['group_id', '>', $version['site_group_id'] ] ])->order('group_id asc')->findOrEmpty(); + if (!$site_group->isEmpty()) { + WeappCommit::dispatch(['data' => ['site_group_id' => $site_group['group_id'], 'base_url' => Cache::get('base_url') ] ]); + } + } + + /** + * 查询站点下是否存在已授权的小程序 + * @param $site_group_id + * @return void + */ + private function getSiteGroupAuthWeapp($site_group_id) { + $site_ids = (new Site())->where([ ['group_id', '=', $site_group_id] ])->column('site_id'); + if (!empty($site_ids)) { + $auth_site_ids = (new SysConfig())->where([ ['site_id', 'in', $site_ids ], ['config_key', '=', 'weapp_authorization_info'] ])->column('site_id'); + if (!empty($auth_site_ids)) { + foreach ($auth_site_ids as $site_id) { + SiteWeappCommit::dispatch(['site_id' => $site_id, 'site_group_id' => $site_group_id]); + } + } + } + } + + /** + * 站点提交 + * @return true + */ + public function siteWeappCommit() { + $site_info = (new CoreSiteService())->getSiteCache($this->site_id); + self::weappCommit($this->site_id, $site_info['group_id']); + return true; + } + + /** + * 小程序提交版本 + * @param $site_id + * @param $site_group_id + * @return void + */ + public static function weappCommit($site_id, $site_group_id) { + $version = (new WxOplatfromWeappVersion())->where([ ['site_group_id', '=', $site_group_id], ['template_id', '<>', '' ] ])->order('id desc')->findOrEmpty(); + if ($version->isEmpty()) return true; + + $is_exist = (new WeappVersion())->where(['site_id' => $site_id, 'status' => CloudDict::APPLET_AUDITING ])->findOrEmpty(); + if (!$is_exist->isEmpty()) throw new CommonException('EXIST_AUDITING_VERSION'); + + $weapp_config = (new CoreWeappConfigService())->getWeappConfig($site_id); + + CoreOplatformService::commitWeapp($site_id, [ + 'template_id' => $version['template_id'], + 'user_version' => $version['user_version'], + 'user_desc' => $version['user_desc'], + 'ext_json' => json_encode([ + 'extAppid' => $weapp_config['app_id'], + 'entryPagePath' => 'app/pages/index/index', + 'ext' => [ + 'site_id' => $site_id + ], + 'directCommit' => true + ]) + ]); + + (new WeappVersion())->where(['site_id' => $site_id, 'version' => $version['user_version'] ])->delete(); + + $create_res = (new WeappVersion())->create([ + 'site_id' => $site_id, + 'version' => $version['user_version'], + 'version_no' => $version['version_no'], + 'desc' => $version['user_desc'], + 'status' => CloudDict::APPLET_AUDITING, + 'create_time' => time(), + 'from_type' => 'open_platform' + ]); + + SubmitAudit::dispatch(['site_id' => $site_id, 'id' => $create_res->id], secs: 120); + + return true; + } + + /** + * 提交审核 + * @param $site_id + * @param $id + * @return true + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function submitCommit($site_id, $id) { + $privacy_info = CoreOplatformService::getCodePrivacyInfo($site_id); + + if ($privacy_info['errcode'] == 0) { + $audit_res = CoreOplatformService::submitAudit($site_id, [ + 'item_list' => [ + + ] + ]); + $update_data = [ + 'status' => $audit_res['errcode'] == 0 ? CloudDict::APPLET_AUDITING : CloudDict::APPLET_AUDIT_FAIL, + 'fail_reason' => $audit_res['errcode'] == 0 ? '' : $audit_res['errmsg'], + 'auditid' => $audit_res['auditid'] ?? '' + ]; + } else { + if ($privacy_info['errcode'] == 61039) { + SubmitAudit::dispatch(['site_id' => $site_id, 'id' => $id], secs: 120); + return true; + } + $update_data = [ + 'status' => CloudDict::APPLET_AUDIT_FAIL, + 'fail_reason' => $privacy_info['errmsg'], + ]; + } + + (new WeappVersion())->update($update_data, [ 'id' => $id ]); + return true; + } + + /** + * 设置小程序隐私协议 + * @return void + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public function setPrivacySetting() { + CoreOplatformService::setPrivacySetting($this->site_id, [ + 'setting_list' => WxOplatform::DEFAULT_SETTING_LIST, + 'owner_setting' => [ + 'contact_qq' => '1515828903', + 'notice_method' => '弹窗' + ] + ]); + return true; + } + + public function setDomain() { + $domain = CoreOplatformService::getDomain($this->site_id); + + $requestdomain = $domain['requestdomain'] ?? []; + $wsrequestdomain = $domain['wsrequestdomain'] ?? []; + $uploaddomain = $domain['uploaddomain'] ?? []; + $downloaddomain = $domain['downloaddomain'] ?? []; + $udpdomain = $domain['udpdomain'] ?? []; + $tcpdomain = $domain['tcpdomain'] ?? []; + + $requestdomain = array_filter(array_unique(array_merge($requestdomain, [ (string)url('/', [], '', true) ]))); + + CoreOplatformService::setDomain($this->site_id, [ + 'requestdomain' => $requestdomain, + 'wsrequestdomain' => $wsrequestdomain, + 'uploaddomain' => $uploaddomain, + 'downloaddomain' => $downloaddomain, + 'udpdomain' => $udpdomain, + 'tcpdomain' => $tcpdomain, + ]); + return true; + } +} diff --git a/niucloud/app/service/api/diy/DiyConfigService.php b/niucloud/app/service/api/diy/DiyConfigService.php index cfc97a330..fae00cd3a 100644 --- a/niucloud/app/service/api/diy/DiyConfigService.php +++ b/niucloud/app/service/api/diy/DiyConfigService.php @@ -23,6 +23,30 @@ use core\base\BaseApiService; class DiyConfigService extends BaseApiService { + /** + * 获取底部导航列表 + * @param array $params + * @return array|mixed + */ + public function getBottomList($params = []) + { + $list = ( new CoreDiyConfigService() )->getBottomList($params); + + $site_addon = ( new CoreSiteService() )->getSiteCache($this->site_id); + + // 单应用,排除 系统 底部导航设置 + if (count($site_addon[ 'apps' ]) == 1) { + foreach ($list as $k => $v) { + if ($v[ 'key' ] = 'app') { + unset($list[ $k ]); + break; + } + } + $list = array_values($list); + } + return $list; + } + /** * 获取底部导航配置 * @param $key @@ -32,12 +56,12 @@ class DiyConfigService extends BaseApiService { // 检测当前站点是多应用还是单应用 if ($key == 'app') { - $site_addon = (new CoreSiteService())->getSiteCache($this->site_id); + $site_addon = ( new CoreSiteService() )->getSiteCache($this->site_id); if (count($site_addon[ 'apps' ]) == 1) { $key = $site_addon[ 'apps' ][ 0 ][ 'key' ]; } } - return (new CoreDiyConfigService())->getBottomConfig($this->site_id, $key); + return ( new CoreDiyConfigService() )->getBottomConfig($this->site_id, $key); } /** @@ -46,7 +70,7 @@ class DiyConfigService extends BaseApiService */ public function getStartUpPageConfig($type) { - return (new CoreDiyConfigService())->getStartUpPageConfig($this->site_id, $type); + return ( new CoreDiyConfigService() )->getStartUpPageConfig($this->site_id, $type); } } \ No newline at end of file diff --git a/niucloud/app/service/api/diy/DiyService.php b/niucloud/app/service/api/diy/DiyService.php index 1e640b14f..7e79f68f7 100644 --- a/niucloud/app/service/api/diy/DiyService.php +++ b/niucloud/app/service/api/diy/DiyService.php @@ -52,7 +52,7 @@ class DiyService extends BaseApiService } } - if (empty($params[ 'id' ]) && empty($params[ 'name' ]) && !empty($start_up_page) && !empty($page_template) && !empty($start_up_page[ 'page' ]) && $start_up_page[ 'page' ] != $page_template[ 'page' ]) { + if (empty($params[ 'id' ]) && !empty($start_up_page) && !empty($page_template) && !empty($start_up_page[ 'page' ]) && $start_up_page[ 'page' ] != $page_template[ 'page' ]) { $info = $start_up_page; return $info; } else { diff --git a/niucloud/app/service/api/login/AuthService.php b/niucloud/app/service/api/login/AuthService.php index b940bd345..730ba029a 100644 --- a/niucloud/app/service/api/login/AuthService.php +++ b/niucloud/app/service/api/login/AuthService.php @@ -78,7 +78,7 @@ class AuthService extends BaseApiService public function checkSite(Request $request){ $site_id = $request->apiSiteId();//todo 可以是依赖传值,也可以通过domain域名来获取site_id $site_info = (new CoreSiteService())->getSiteCache($site_id); - if(empty($site_info)) throw new AuthException('SITE_NOT_EXIST'); + if(empty($site_info)) throw new AuthException('SITE_NOT_EXIST', 403); $rule = strtolower(trim($request->rule()->getRule())); if($rule != 'site'){ if ($site_info['status'] == SiteDict::CLOSE || $site_info['expire_time'] < time()) throw new AuthException('SITE_CLOSE_NOT_ALLOW', 402); @@ -98,6 +98,7 @@ class AuthService extends BaseApiService if(empty($mobile)){ $result = (new CoreWeappAuthService())->getUserPhoneNumber($this->site_id, $mobile_code); if(empty($result)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST'); + if ($result[ 'errcode' ] != 0) throw new ApiException($result[ 'errmsg' ]); $phone_info = $result['phone_info']; $mobile = $phone_info['purePhoneNumber']; if(empty($mobile)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST'); diff --git a/niucloud/app/service/api/login/RegisterService.php b/niucloud/app/service/api/login/RegisterService.php index d280d70cd..8ed2fa624 100644 --- a/niucloud/app/service/api/login/RegisterService.php +++ b/niucloud/app/service/api/login/RegisterService.php @@ -95,7 +95,7 @@ class RegisterService extends BaseApiService $microtime = substr(microtime(true), strpos(microtime(true), '.') + 1); $chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $username = ''; - for ($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 2; $i++) { $username .= $chars[ random_int(0, (strlen($chars) - 1)) ]; } diff --git a/niucloud/app/service/api/member/AddressService.php b/niucloud/app/service/api/member/AddressService.php index 8bbc132e7..33424ca03 100644 --- a/niucloud/app/service/api/member/AddressService.php +++ b/niucloud/app/service/api/member/AddressService.php @@ -35,10 +35,10 @@ class AddressService extends BaseApiService */ public function getList(array $where = []) { - $field = 'id,member_id,name,mobile,address,address_name,full_address,is_default,type'; + $field = 'id,member_id,name,mobile,address,address_name,full_address,is_default,lng,lat'; $order = 'is_default desc, id desc'; - $list = $this->model->where([ ['site_id', '=', $this->site_id],['member_id', '=', $this->member_id ] ])->withSearch(["type"], $where)->field($field)->order($order)->select()->toArray(); + $list = $this->model->where([ ['site_id', '=', $this->site_id],['member_id', '=', $this->member_id ] ])->field($field)->order($order)->select()->toArray(); return $list; } @@ -49,7 +49,7 @@ class AddressService extends BaseApiService */ public function getInfo(int $id) { - $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,address_name,full_address,lng,lat,is_default,type'; + $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,address_name,full_address,lng,lat,is_default'; $info = $this->model->field($field)->where([ ['id', '=', $id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id ] ])->findOrEmpty()->toArray(); return $info; @@ -63,7 +63,7 @@ class AddressService extends BaseApiService public function add(array $data) { if ($data['is_default']) { - $this->model->where([ ['member_id', '=', $this->member_id ], ['type', '=', $data['type']] ])->update(['is_default' => 0]); + $this->model->where([ ['member_id', '=', $this->member_id ] ])->update(['is_default' => 0]); } $data['member_id'] = $this->member_id; $data['site_id'] = $this->site_id; @@ -80,7 +80,7 @@ class AddressService extends BaseApiService public function edit(int $id, array $data) { if ($data['is_default']) { - $this->model->where([ ['member_id', '=', $this->member_id ], ['type', '=', $data['type']] ])->update(['is_default' => 0]); + $this->model->where([ ['member_id', '=', $this->member_id ] ])->update(['is_default' => 0]); } $this->model->where([ ['id', '=', $id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id ] ])->update($data); return true; diff --git a/niucloud/app/service/api/member/MemberAccountService.php b/niucloud/app/service/api/member/MemberAccountService.php index 7b6e61b5b..617cff5bf 100644 --- a/niucloud/app/service/api/member/MemberAccountService.php +++ b/niucloud/app/service/api/member/MemberAccountService.php @@ -11,6 +11,8 @@ namespace app\service\api\member; +use app\dict\member\MemberAccountTypeDict; +use app\model\member\Member; use app\model\member\MemberAccountLog; use core\base\BaseApiService; use think\db\exception\DbException; @@ -38,9 +40,54 @@ class MemberAccountService extends BaseApiService { $where['member_id'] = $this->member_id; $field = 'id, member_id, site_id, account_type, account_data, from_type, related_id, create_time, memo'; - $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','account_type', 'from_type', 'create_time'],$where)->field($field)->order('create_time desc')->append(['from_type_name', 'account_type_name']); + $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','account_type', 'from_type', 'create_time','account_data_gt', 'account_data_lt'],$where)->field($field)->order('create_time desc')->append(['from_type_name', 'account_type_name']); return $this->pageQuery($search_model); } + + /** + * 会员余额流水列表(新) + * @param array $where + * @return array + */ + public function getPages(array $data = []) + { + + switch ($data['from_type']){ + case 'income': + $type_where = [ + ['account_type', 'in', [MemberAccountTypeDict::BALANCE,MemberAccountTypeDict::MONEY]], + ['account_data', '>', 0 ], + ['from_type', '<>', 'cash_out'] + ]; + break; + case 'disburse': + $type_where = [ + ['account_type', 'in', [MemberAccountTypeDict::BALANCE,MemberAccountTypeDict::MONEY]], + ['account_data', '<', 0 ], + ['from_type', '<>', 'cash_out'] + ]; + break; + case 'cash_out': + $type_where = [ + ['account_type', '=', MemberAccountTypeDict::MONEY], + ['from_type', '=', $data['from_type']] + ]; + break; + + default: + $type_where = [ + ['account_type', 'in', [MemberAccountTypeDict::BALANCE,MemberAccountTypeDict::MONEY]], + ]; + break; + } + + + $where['member_id'] = $this->member_id; + $field = 'id, member_id, site_id, account_type, account_data, account_sum, from_type, related_id, create_time, memo'; + $search_model = $this->model->where([['site_id', '=', $this->site_id]])->where($type_where)->withSearch(['member_id', 'create_time'],$where)->field($field)->order('create_time desc')->append(['from_type_name', 'account_type_name']); + return $this->pageQuery($search_model); + } + /** * 账户流水详情 * @param int $id @@ -64,4 +111,29 @@ class MemberAccountService extends BaseApiService return $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','account_type', 'from_type', 'create_time'],$where)->count(); } + /** + * 会员积分统计数量 + * @param array $where + * @return int + * @throws DbException + */ + public function getPointCount(){ + $data = [ + 'point' => 0, + 'point_get' => 0, + 'use'=> 0,//使用 + ]; + $info = (new Member())->where([['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->field('point,point_get')->findOrEmpty()->toArray(); + $data['point'] = $info['point'] ?? 0; + $data['point_get'] = $info['point_get'] ?? 0; + $data['use'] = abs($this->model->where([ + ['site_id', '=', $this->site_id], + ['member_id', '=', $this->member_id], + ['account_type', '=', MemberAccountTypeDict::POINT], + ['account_data', '<', 0] + ])->sum('account_data')); + + return $data; + } + } \ No newline at end of file diff --git a/niucloud/app/service/api/member/MemberLevelService.php b/niucloud/app/service/api/member/MemberLevelService.php index 706816b1d..61de81ffb 100644 --- a/niucloud/app/service/api/member/MemberLevelService.php +++ b/niucloud/app/service/api/member/MemberLevelService.php @@ -11,6 +11,7 @@ namespace app\service\api\member; +use app\dict\member\MemberLevelDict; use app\model\member\MemberLevel; use app\service\core\member\CoreMemberService; use core\base\BaseApiService; @@ -33,6 +34,7 @@ class MemberLevelService extends BaseApiService */ public function getList(){ $list = (new MemberLevel())->where([ ['site_id', '=', $this->site_id] ])->field('level_id,site_id,level_name,growth,remark,level_benefits,level_gifts')->order('growth asc')->select()->toArray(); + $level_style = MemberLevelDict::getStyle(); if (!empty($list)) { foreach ($list as $k => $item) { if (!empty($item['level_benefits'])) $list[$k]['level_benefits'] = array_filter(array_map(function ($item){ @@ -57,7 +59,14 @@ class MemberLevelService extends BaseApiService } } - $list[$k]['level_bg'] = '/static/resource/images/member/level/bg_'. ($k % 8 + 1) .'.png'; + $level_key = $k % 8 + 1; + $list[$k]['level_bg'] = '/static/resource/images/member/level/bg_'. $level_key .'.png'; + $list[$k]['member_bg'] = '/static/resource/images/member/level/member_'. $level_key .'.png'; + $list[$k]['level_icon'] = '/static/resource/images/member/level/level_icon'. $level_key .'.png'; + $list[$k]['level_tag'] = '/static/resource/images/member/level/level_'. $level_key .'.png'; + + $list[$k]['level_style'] = $level_style['level_'.$level_key] ?? []; + } } return $list; diff --git a/niucloud/app/service/api/member/MemberSignService.php b/niucloud/app/service/api/member/MemberSignService.php index 552c8d318..9898a93c4 100644 --- a/niucloud/app/service/api/member/MemberSignService.php +++ b/niucloud/app/service/api/member/MemberSignService.php @@ -167,7 +167,16 @@ class MemberSignService extends BaseApiService $result['title'] = get_lang('SIGN_SUCCESS'); $result['info'] = $continue_text.get_lang('GET_AWARD'); $result['awards'] = $awards_total; - return $result; + if ($awards_total) { + return $result; + } else { + return [ + 'title' => '', + 'info' => '', + 'awards' => [], + ]; + } + } catch (DbException $e) { Db::rollback(); throw new CommonException($e->getMessage()); @@ -330,6 +339,12 @@ class MemberSignService extends BaseApiService $is_use_coupon_day = false; $is_use_coupon_continue = false; +// foreach ($awards['day_award'] as $key => $value) { +// if ($value['is_use'] == 1) { +// $awards['day_award'][$key] = $value; +// } +// } + if (!empty($awards['day_award']['point'])) { if ($awards['day_award']['point']['is_use'] == 1) { $is_use_point_day = true; @@ -390,7 +405,7 @@ class MemberSignService extends BaseApiService 'coupon_list' => $coupon_list, ] ]; - return (new CoreMemberService())->getGiftContent($this->site_id, $awards_total); + return (new CoreMemberService())->getGiftContent($this->site_id, $awards_total, 'member_sign'); } /** @@ -403,14 +418,34 @@ class MemberSignService extends BaseApiService $today = $this->model->where([['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->whereDay('create_time')->findOrEmpty()->toArray(); $yesterday = $this->model->where([['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->whereDay('create_time', 'yesterday')->findOrEmpty()->toArray(); if (!empty($info['day_award'])) { - $day_award = (new CoreMemberService())->getGiftContent($this->site_id, $info['day_award']); + $day_award = (new CoreMemberService())->getGiftContent($this->site_id, $info['day_award'],'member_sign'); $info['day_award'] = $day_award; } if (!empty($info['continue_award'])) { foreach ($info['continue_award'] as $key => $value) { $gift = $value; unset($gift['continue_sign'], $gift['continue_tag'], $gift['receive_limit'], $gift['receive_num']); - $continue_award = (new CoreMemberService())->getGiftContent($this->site_id, $gift); + $gift_content = (new CoreMemberService())->getGiftContent($this->site_id, $gift, 'member_sign_continue'); + $gift_count = 0; + $content_text = ''; + $content_icon = ''; + foreach ($gift_content as $vv) { + if ($vv['is_use'] == 1) { + foreach ($vv['content'] as $v) { + $content_text = $content_text . ($gift_count == 0 ? '' : '+') . $v['text']; + $content_icon = $v['icon']; + $gift_count++; + } + } + } + if ($gift_count > 1) { + $continue_award['gift'] = ['total' => ['text' => $content_text, 'icon' => '/static/resource/images/member/sign/pack01.png']]; + } else if($gift_count == 1) { + $continue_award['gift'] = ['total' => ['text' => $content_text, 'icon' => $content_icon]]; + } else { + $continue_award['gift'] = []; + } + $continue_award['continue_sign'] = $value['continue_sign']; $info['continue_award'][$key] = $continue_award; } diff --git a/niucloud/app/service/api/pay/PayService.php b/niucloud/app/service/api/pay/PayService.php index aa7336cec..9d5a6ada0 100644 --- a/niucloud/app/service/api/pay/PayService.php +++ b/niucloud/app/service/api/pay/PayService.php @@ -45,19 +45,19 @@ class PayService extends BaseApiService * @throws DbException * @throws ModelNotFoundException */ - public function pay(string $type, string $trade_type, int $trade_id, string $return_url = '', string $quit_url = '', string $buyer_id = '', string $voucher = ''){ + public function pay(string $type, string $trade_type, int $trade_id, string $return_url = '', string $quit_url = '', string $buyer_id = '', string $voucher = '', string $openid = ''){ $member = (new CoreMemberService())->getInfoByMemberId($this->site_id, $this->member_id); switch ($this->channel) { case ChannelDict::WECHAT://公众号 - $openid = $member['wx_openid'] ?? ''; + $openid = $openid ? $openid : $member['wx_openid'] ?? ''; break; case ChannelDict::WEAPP://微信小程序 - $openid = $member['weapp_openid'] ?? ''; + $openid = $openid ? $openid : $member['weapp_openid'] ?? ''; break; } - return $this->core_pay_service->pay($this->site_id, $trade_type, $trade_id, $type, $this->channel, $openid ?? '', $return_url, $quit_url, $buyer_id, $voucher); + return $this->core_pay_service->pay($this->site_id, $trade_type, $trade_id, $type, $this->channel, $openid, $return_url, $quit_url, $buyer_id, $voucher); } /** @@ -105,4 +105,4 @@ class PayService extends BaseApiService public function getPayTypeByTrade(string $trade_type){ return $this->core_pay_service->getPayTypeByTrade($this->site_id, $trade_type, $this->channel); } -} \ No newline at end of file +} diff --git a/niucloud/app/service/api/sys/AreaService.php b/niucloud/app/service/api/sys/AreaService.php index 6ef4996c3..8d13713ed 100644 --- a/niucloud/app/service/api/sys/AreaService.php +++ b/niucloud/app/service/api/sys/AreaService.php @@ -14,6 +14,7 @@ namespace app\service\api\sys; use app\model\sys\SysArea; use app\service\admin\sys\ConfigService; use core\base\BaseApiService; +use core\exception\ApiException; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; @@ -197,15 +198,14 @@ class AreaService extends BaseApiService ]; } else { - return $res[ 'message' ]; + throw new ApiException($res[ 'message' ]); } } else { $error = curl_errno($curl); curl_close($curl); - return $error; + throw new ApiException($error); } - } } diff --git a/niucloud/app/service/api/weapp/WeappServeService.php b/niucloud/app/service/api/weapp/WeappServeService.php new file mode 100644 index 000000000..95ce598b8 --- /dev/null +++ b/niucloud/app/service/api/weapp/WeappServeService.php @@ -0,0 +1,41 @@ +serve($this->site_id); + } + +} diff --git a/niucloud/app/service/core/addon/CoreAddonDownloadService.php b/niucloud/app/service/core/addon/CoreAddonDownloadService.php index d76c3b461..2387ef6b1 100644 --- a/niucloud/app/service/core/addon/CoreAddonDownloadService.php +++ b/niucloud/app/service/core/addon/CoreAddonDownloadService.php @@ -43,6 +43,7 @@ class CoreAddonDownloadService extends CoreAddonBaseService */ public function download($app_key, $version) { + if (!extension_loaded('zip')) throw new AddonException('ZIP_ARCHIVE_NOT_INSTALL'); $app_path = $this->addon_path . $app_key . DIRECTORY_SEPARATOR; //先判断当前的应用在本地是否存在 // if(is_dir($app_path)) throw new NiucloudException(); diff --git a/niucloud/app/service/core/addon/WapTrait.php b/niucloud/app/service/core/addon/WapTrait.php index 5266a9c1f..80bf6810c 100644 --- a/niucloud/app/service/core/addon/WapTrait.php +++ b/niucloud/app/service/core/addon/WapTrait.php @@ -128,7 +128,8 @@ trait WapTrait $content .= " import topTabbar from '@/components/top-tabbar/top-tabbar.vue'\n"; $content .= " import useDiyStore from '@/app/stores/diy';\n"; - $content .= " import { ref, onMounted, nextTick, computed } from 'vue';\n"; + $content .= " import { ref, onMounted, nextTick, computed, watch } from 'vue';\n"; + $content .= " import { useRouter } from 'vue-router';\n"; $content .= " import { getLocation } from '@/utils/common';\n"; $content .= " import Sortable from 'sortablejs';\n"; $content .= " import { range } from 'lodash-es';\n"; @@ -136,7 +137,27 @@ trait WapTrait $content .= " import useConfigStore from '@/stores/config'\n\n"; $content .= " const props = defineProps(['data','pullDownRefreshCount']);\n"; - $content .= " const diyStore = useDiyStore();\n\n"; + $content .= " const diyStore = useDiyStore();\n"; + $content .= " const router = useRouter();\n\n"; + + $content .= " // 兼容轮播搜索组件-切换分类时,导致个人中心白屏 - start\n"; + $content .= " // #ifdef H5\n"; + $content .= " watch(() => router.currentRoute.value, (newRoute) => {\n"; + $content .= " if(newRoute.path != \"/addon/shop/pages/index\"){\n"; + $content .= " diyStore.topFixedStatus = 'home'\n"; + $content .= " }\n"; + $content .= " });\n\n"; + + $content .= " // #endif\n\n"; + + $content .= " // #ifdef MP\n"; + $content .= " wx.onAppRoute(function(res) {\n"; + $content .= " if(res.path != \"addon/shop/pages/index\"){\n"; + $content .= " diyStore.topFixedStatus = 'home'\n"; + $content .= " }\n"; + $content .= " });\n"; + $content .= " // #endif\n"; + $content .= " // 兼容轮播搜索组件-切换分类时,导致个人中心白屏 - end\n\n"; $content .= " const data = computed(() => {\n"; $content .= " if (diyStore.mode == 'decorate') {\n"; diff --git a/niucloud/app/service/core/diy/CoreDiyConfigService.php b/niucloud/app/service/core/diy/CoreDiyConfigService.php index 5d9d2e8e0..f6b33b30a 100644 --- a/niucloud/app/service/core/diy/CoreDiyConfigService.php +++ b/niucloud/app/service/core/diy/CoreDiyConfigService.php @@ -54,7 +54,7 @@ class CoreDiyConfigService extends BaseCoreService $default_config = $this->getBottomList([ 'key' => $key ])[ 0 ] ?? []; $config_key = ConfigKeyDict::DIY_BOTTOM . '_' . $key; - $info = (new CoreConfigService())->getConfig($site_id, $config_key)[ 'value' ] ?? []; + $info = ( new CoreConfigService() )->getConfig($site_id, $config_key)[ 'value' ] ?? []; if (!empty($default_config)) { if (!empty($info)) { @@ -79,7 +79,7 @@ class CoreDiyConfigService extends BaseCoreService */ public function setBottomConfig(int $site_id, array $data, string $key = 'app') { - return (new CoreConfigService())->setConfig($site_id, ConfigKeyDict::DIY_BOTTOM . '_' . $key, $data); + return ( new CoreConfigService() )->setConfig($site_id, ConfigKeyDict::DIY_BOTTOM . '_' . $key, $data); } /** @@ -90,7 +90,7 @@ class CoreDiyConfigService extends BaseCoreService */ public function setStartUpPageConfig(int $site_id, array $data) { - return (new CoreConfigService())->setConfig($site_id, 'START_UP_PAGE_' . strtoupper($data[ 'type' ]), $data); + return ( new CoreConfigService() )->setConfig($site_id, 'START_UP_PAGE_' . strtoupper($data[ 'type' ]), $data); } /** @@ -101,7 +101,7 @@ class CoreDiyConfigService extends BaseCoreService */ public function getStartUpPageConfig(int $site_id, string $type) { - $info = (new CoreConfigService())->getConfig($site_id, 'START_UP_PAGE_' . strtoupper($type))[ 'value' ] ?? []; + $info = ( new CoreConfigService() )->getConfig($site_id, 'START_UP_PAGE_' . strtoupper($type))[ 'value' ] ?? []; if (!empty($info)) { $info[ 'name' ] = isset($info[ 'name' ]) ? $info[ 'name' ] : ''; } diff --git a/niucloud/app/service/core/member/CoreMemberAddressService.php b/niucloud/app/service/core/member/CoreMemberAddressService.php index 0b8b25dec..428068ae5 100644 --- a/niucloud/app/service/core/member/CoreMemberAddressService.php +++ b/niucloud/app/service/core/member/CoreMemberAddressService.php @@ -12,12 +12,7 @@ namespace app\service\core\member; use app\model\member\MemberAddress; -use app\model\member\MemberLabel; use core\base\BaseCoreService; -use think\db\exception\DataNotFoundException; -use think\db\exception\DbException; -use think\db\exception\ModelNotFoundException; -use think\facade\Cache; /** * 会员标签服务层 @@ -39,9 +34,19 @@ class CoreMemberAddressService extends BaseCoreService * @param int $member_id * @return array */ - public function getDefaultAddressByMemberId(int $member_id, $type = 'address'){ - $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default,type'; - return $this->model->where([['member_id', '=', $member_id], ['type', '=', $type] ])->field($field)->order('is_default desc')->findOrEmpty()->toArray(); + public function getDefaultAddressByMemberId(int $member_id){ + $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default'; + return $this->model->where([['member_id', '=', $member_id]])->field($field)->order('is_default desc')->findOrEmpty()->toArray(); + } + + /** + * 获取会员存在经纬度的地址 + * @param int $member_id + * @return array + */ + public function getLngLatAddressByMemberId(int $member_id){ + $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default'; + return $this->model->where([['member_id', '=', $member_id], ['lng', '<>', ''], ['lat', '<>', '']])->field($field)->order('is_default desc, id desc')->findOrEmpty()->toArray(); } /** @@ -50,7 +55,7 @@ class CoreMemberAddressService extends BaseCoreService * @return array */ public function getMemberAddressById(int $id, int $member_id){ - $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default,type'; + $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default'; return $this->model->where([['id', '=', $id], ['member_id', '=', $member_id]])->field($field)->findOrEmpty()->toArray(); } } diff --git a/niucloud/app/service/core/pay/CorePayService.php b/niucloud/app/service/core/pay/CorePayService.php index 52ba0699f..5eb1f710a 100644 --- a/niucloud/app/service/core/pay/CorePayService.php +++ b/niucloud/app/service/core/pay/CorePayService.php @@ -369,8 +369,9 @@ class CorePayService extends BaseCoreService public function closeByTrade(int $site_id, string $trade_type, int $trade_id) { $pay = $this->findPayInfoByTrade($site_id, $trade_type, $trade_id); - if ($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); - if ($pay['status'] == PayDict::STATUS_FINISH) throw new PayException('DOCUMENT_IS_PAID');//当前单据已支付 +// if ($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); + if ($pay->isEmpty()) return true; +// if ($pay['status'] == PayDict::STATUS_FINISH) throw new PayException('DOCUMENT_IS_PAID');//当前单据已支付 if (!in_array($pay['status'], [ PayDict::STATUS_WAIT, PayDict::STATUS_ING diff --git a/niucloud/app/service/core/pay/CoreRefundService.php b/niucloud/app/service/core/pay/CoreRefundService.php index 599a54e56..bfd6b67ec 100644 --- a/niucloud/app/service/core/pay/CoreRefundService.php +++ b/niucloud/app/service/core/pay/CoreRefundService.php @@ -77,15 +77,17 @@ class CoreRefundService extends BaseCoreService if($refund->isEmpty()) throw new PayException('REFUND_NOT_EXIST'); $out_trade_no = $refund->out_trade_no; $money = $refund->money; + $pay = (new CorePayService())->findPayInfoByOutTradeNo($site_id, $out_trade_no); + if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');//单据不存在 try{ //存入退款方式 $refund->save(['refund_type' => $refund_type]); if($refund_type == RefundDict::BACK){ //判断成功的话,可以直接调用退款成功 - $pay_result = $this->pay_event->init($site_id, $refund->channel, $refund->type)->refund($out_trade_no, $money, $money, $refund_no, $voucher); + $pay_result = $this->pay_event->init($site_id, $refund->channel, $refund->type)->refund($out_trade_no, $money, $pay['money'], $refund_no, $voucher); $this->refundNotify($site_id, $out_trade_no, $refund->type, $pay_result); }else if($refund_type == RefundDict::OFFLINE){ - $pay_result = $this->pay_event->init($site_id, $refund->channel, PayDict::OFFLINEPAY)->refund($out_trade_no, $money, $money, $refund_no, $voucher); + $pay_result = $this->pay_event->init($site_id, $refund->channel, PayDict::OFFLINEPAY)->refund($out_trade_no, $money, $pay['money'], $refund_no, $voucher); $this->refundNotify($site_id, $out_trade_no, $refund->type, $pay_result, $main_type, $main_id); } diff --git a/niucloud/app/service/core/pay/CoreTransferService.php b/niucloud/app/service/core/pay/CoreTransferService.php index dca2fae39..6be8faa72 100644 --- a/niucloud/app/service/core/pay/CoreTransferService.php +++ b/niucloud/app/service/core/pay/CoreTransferService.php @@ -106,7 +106,7 @@ class CoreTransferService extends BaseCoreService $this->transferNotify($site_id, $transfer_no, $result); return true; }catch( Throwable $e){ - $this->fail($site_id, $transfer_no, $transfer_type, ['reason' => get_lang($e->getMessage())]); + $this->fail($site_id, $transfer_no, ['reason' => get_lang($e->getMessage())]); throw new PayException($e->getMessage()); } } @@ -255,4 +255,4 @@ class CoreTransferService extends BaseCoreService ); return true; } -} \ No newline at end of file +} diff --git a/niucloud/app/service/core/paytype/CoreBalanceService.php b/niucloud/app/service/core/paytype/CoreBalanceService.php index 19b771c38..892c0c869 100644 --- a/niucloud/app/service/core/paytype/CoreBalanceService.php +++ b/niucloud/app/service/core/paytype/CoreBalanceService.php @@ -40,27 +40,26 @@ class CoreBalanceService extends BaseCoreService } - public function pay($params){ - $out_trade_no = $params['out_trade_no'];//交易流水号 - $site_id = $params['site_id']; + public function pay($params) + { + $out_trade_no = $params[ 'out_trade_no' ];//交易流水号 + $site_id = $params[ 'site_id' ]; - $pay = (new CorePayService())->findPayInfoByOutTradeNo($site_id, $out_trade_no); + $pay = ( new CorePayService() )->findPayInfoByOutTradeNo($site_id, $out_trade_no); - $main_id = $pay['main_id']; - $main_type = $pay['main_type']; - $money = $params['money']; + $main_id = $pay[ 'main_id' ]; + $main_type = $pay[ 'main_type' ]; + $money = $params[ 'money' ]; - switch($main_type){ + switch ($main_type) { case 'member': //余额不足会抛出异常 - (new CoreMemberAccountService())->addLog($site_id, $main_id, MemberAccountTypeDict::BALANCE, - -$money, 'order', MemberAccountChangeTypeDict::getType('order')['name'] ?? '', $out_trade_no); + ( new CoreMemberAccountService() )->addLog($site_id, $main_id, MemberAccountTypeDict::BALANCE, -$money, 'order', MemberAccountChangeTypeDict::getType(MemberAccountTypeDict::BALANCE)[ 'order' ][ 'name' ] ?? '', $out_trade_no); break; case 'user': - break; } return [ @@ -82,27 +81,26 @@ class CoreBalanceService extends BaseCoreService * @param array $params * @return array */ - public function refund(array $params){ - $out_trade_no = $params['out_trade_no']; - $money = $params['money']; - $site_id = $params['site_id']; - $refund_no = $params['refund_no']; + public function refund(array $params) + { + $out_trade_no = $params[ 'out_trade_no' ]; + $money = $params[ 'money' ]; + $site_id = $params[ 'site_id' ]; + $refund_no = $params[ 'refund_no' ]; $core_pay_service = new CorePayService(); $pay = $core_pay_service->findPayInfoByOutTradeNo($site_id, $out_trade_no); - $main_id = $pay['main_id']; - $main_type = $pay['main_type']; + $main_id = $pay[ 'main_id' ]; + $main_type = $pay[ 'main_type' ]; - switch($main_type){ + switch ($main_type) { case 'member': - //余额不足会抛出异常 - (new CoreMemberAccountService())->addLog($site_id, $main_id, MemberAccountTypeDict::BALANCE, - $money, 'order_refund', MemberAccountChangeTypeDict::getType('order_refund')['name'] ?? '', $refund_no); + //余额不足会抛出异常 + ( new CoreMemberAccountService() )->addLog($site_id, $main_id, MemberAccountTypeDict::BALANCE, $money, 'order_refund', MemberAccountChangeTypeDict::getType(MemberAccountTypeDict::BALANCE)[ 'order_refund' ][ 'name' ] ?? '', $refund_no); break; case 'user': - break; } return [ @@ -119,9 +117,10 @@ class CoreBalanceService extends BaseCoreService * @param string|null $refund_no * @return Refund|array|mixed|Model */ - public function getRefund(?string $out_trade_no, ?string $refund_no = '') { - return (new Refund())->where([ - ['refund_no', '=', $refund_no], + public function getRefund(?string $out_trade_no, ?string $refund_no = '') + { + return ( new Refund() )->where([ + [ 'refund_no', '=', $refund_no ], ])->findOrEmpty(); } diff --git a/niucloud/app/service/core/poster/CorePosterService.php b/niucloud/app/service/core/poster/CorePosterService.php index 58df02ab5..2e17ac1ad 100644 --- a/niucloud/app/service/core/poster/CorePosterService.php +++ b/niucloud/app/service/core/poster/CorePosterService.php @@ -88,7 +88,7 @@ class CorePosterService extends BaseCoreService * @param bool $is_throw_exception * @return string|void */ - public function get(int $site_id, $id, $type, array $param = [], string $channel = '', bool $is_throw_exception = true) + public function get(int $site_id, $id, $type, array $param = [], $channel = '', $is_throw_exception = true) { $condition = [ [ 'site_id', '=', $site_id ], @@ -110,7 +110,7 @@ class CorePosterService extends BaseCoreService // 查询指定类型的海报模板 $template = $this->getTemplateList('', $type); if (!empty($template)) { - $poster = $template[ 0 ]['data']; + $poster = $template[ 0 ][ 'data' ]; } } else { $poster = $poster->toArray(); @@ -135,7 +135,7 @@ class CorePosterService extends BaseCoreService $dir = 'upload/poster/' . $site_id; $temp1 = md5(json_encode($poster)); $temp2 = md5(json_encode($poster_data)); - $file_path = 'poster' . $temp1 . '_' . $temp2 . '.png'; + $file_path = 'poster' . $temp1 . '_' . $temp2 .'_'.$channel. '.png'; $path = $dir . '/' . $file_path; //判断当前海报是否存在,存在直接返回地址,不存在的话则创建 @@ -204,6 +204,7 @@ class CorePosterService extends BaseCoreService } } } + if (!is_dir($dir) && !mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); } diff --git a/niucloud/app/service/core/sys/CoreExportService.php b/niucloud/app/service/core/sys/CoreExportService.php index d31a5378b..7507cea9f 100644 --- a/niucloud/app/service/core/sys/CoreExportService.php +++ b/niucloud/app/service/core/sys/CoreExportService.php @@ -13,11 +13,9 @@ namespace app\service\core\sys; use app\dict\sys\ExportDict; use app\model\sys\SysExport; -use app\service\admin\sys\ExportService; use core\base\BaseCoreService; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use think\facade\App; use think\facade\Log; /** diff --git a/niucloud/app/service/core/upload/CoreFetchService.php b/niucloud/app/service/core/upload/CoreFetchService.php index 00a580916..6a0482a75 100644 --- a/niucloud/app/service/core/upload/CoreFetchService.php +++ b/niucloud/app/service/core/upload/CoreFetchService.php @@ -39,8 +39,8 @@ class CoreFetchService extends CoreFileService { if(empty($url)) throw new UploadFileException('OSS_FILE_URL_NOT_EXIST'); $this->upload_driver = $this->driver($site_id, $storage_type); - [$link, $ext] = explode('.', $url); - $ext = empty($ext) ? $ext : 'jpg'; + [$ext, $link] = explode('.', strrev($url)); + $ext = empty($ext) ? strrev($ext) : 'jpg'; $file_path = $this->upload_driver->createFileName($link, $ext); $dir = $this->root_path .'/'. $file_dir.'/'.$file_path; diff --git a/niucloud/app/service/core/upload/CoreStorageService.php b/niucloud/app/service/core/upload/CoreStorageService.php index 9842e96a7..f67027e56 100644 --- a/niucloud/app/service/core/upload/CoreStorageService.php +++ b/niucloud/app/service/core/upload/CoreStorageService.php @@ -85,6 +85,7 @@ class CoreStorageService extends BaseCoreService $data['storage_type'] = $k; $data['is_use'] = $k == $config_type['default'] ? StorageDict::ON : StorageDict::OFF; $data['name'] = $v['name']; + $data['component'] = $v['component']; foreach ($v['params'] as $k_param => $v_param) { $data['params'][$k_param] = [ 'name' => $v_param, diff --git a/niucloud/app/service/core/verify/CoreVerifyService.php b/niucloud/app/service/core/verify/CoreVerifyService.php index 4750dc51a..e676afa3f 100644 --- a/niucloud/app/service/core/verify/CoreVerifyService.php +++ b/niucloud/app/service/core/verify/CoreVerifyService.php @@ -110,13 +110,13 @@ class CoreVerifyService extends BaseCoreService 'create_time' => time(), 'verifier_member_id' => $verify_member_id, ]; - + //核销 + event('Verify', $verify_data); //todo:相关核销业务回调 $model = new Verify(); $model->create($verify_data); //是核销码失效 $this->clearCode($verify_code); - //核销 - event('Verify', $verify_data); //todo:相关核销业务回调 + return true; } diff --git a/niucloud/app/service/core/weapp/CoreWeappAuthService.php b/niucloud/app/service/core/weapp/CoreWeappAuthService.php index 5d77bda1b..9d34a4df1 100644 --- a/niucloud/app/service/core/weapp/CoreWeappAuthService.php +++ b/niucloud/app/service/core/weapp/CoreWeappAuthService.php @@ -11,13 +11,10 @@ namespace app\service\core\weapp; +use app\service\core\wxoplatform\CoreOplatformService; use core\base\BaseCoreService; use EasyWeChat\Kernel\Exceptions\DecryptException; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; -use EasyWeChat\Kernel\Exceptions\InvalidConfigException; -use EasyWeChat\Kernel\Support\Collection; -use GuzzleHttp\Exception\GuzzleException; -use Psr\Http\Message\ResponseInterface; /** * 微信小程序服务提供 @@ -43,8 +40,13 @@ class CoreWeappAuthService extends BaseCoreService */ public function session(int $site_id, ?string $code) { - $utils = CoreWeappService::app($site_id)->getUtils(); - return $utils->codeToSession($code); + $config = (new CoreWeappConfigService())->getWeappConfig($site_id); + if ($config['is_authorization']) { + return CoreOplatformService::codeToSession($site_id, $code); + } else { + $utils = CoreWeappService::app($site_id)->getUtils(); + return $utils->codeToSession($code); + } } /** @@ -77,4 +79,4 @@ class CoreWeappAuthService extends BaseCoreService 'code' => (string)$code ]); } -} \ No newline at end of file +} diff --git a/niucloud/app/service/core/weapp/CoreWeappCloudService.php b/niucloud/app/service/core/weapp/CoreWeappCloudService.php index 56f04e5e1..2b192ac2d 100644 --- a/niucloud/app/service/core/weapp/CoreWeappCloudService.php +++ b/niucloud/app/service/core/weapp/CoreWeappCloudService.php @@ -16,9 +16,7 @@ use app\dict\sys\CloudDict; use app\model\addon\Addon; use app\model\weapp\WeappVersion; use app\service\core\addon\CoreAddonDevelopDownloadService; -use app\service\core\addon\CoreAddonService; use app\service\core\addon\WapTrait; -use app\service\core\diy\CoreDiyConfigService; use app\service\core\niucloud\CoreCloudBaseService; use app\service\core\site\CoreSiteService; use core\exception\CommonException; @@ -37,6 +35,13 @@ class CoreWeappCloudService extends CoreCloudBaseService private $addon_path; + private $config = [ + 'app_id' => '', + 'upload_private_key' => '', + 'addon' => [], + 'base_url' => '' + ]; + use WapTrait; public function __construct() @@ -44,6 +49,12 @@ class CoreWeappCloudService extends CoreCloudBaseService parent::__construct(); $this->root_path = dirname(root_path()) . DIRECTORY_SEPARATOR; $this->addon_path = root_path() . 'addon' . DIRECTORY_SEPARATOR; + $this->config['base_url'] = (string)url('/', [], '', true); + } + + public function setConfig($function) { + $this->config = array_merge($this->config, $function()); + return $this; } /** @@ -51,13 +62,12 @@ class CoreWeappCloudService extends CoreCloudBaseService * @param $addon */ public function uploadWeapp(array $data) { - if (!request()->isSsl()) throw new CommonException('CURR_SITE_IS_NOT_OPEN_SSL'); + if (strpos($this->config['base_url'], 'https://') === false) throw new CommonException('CURR_SITE_IS_NOT_OPEN_SSL'); + $this->site_id = $data['site_id'] ?? 0; - $this->site_id = $data['site_id']; - $config = (new CoreWeappConfigService())->getWeappConfig($data['site_id']); - if (empty($config['app_id'])) throw new CommonException('WEAPP_APPID_EMPTY'); - if (empty($config['upload_private_key'])) throw new CommonException('UPLOAD_KEY_EMPTY'); - if (!file_exists($config['upload_private_key'])) throw new CommonException('UPLOAD_KEY_NOT_EXIST'); + if (empty($this->config['app_id'])) throw new CommonException('WEAPP_APPID_EMPTY'); + if (empty($this->config['upload_private_key'])) throw new CommonException('UPLOAD_KEY_EMPTY'); + if (!file_exists($this->config['upload_private_key'])) throw new CommonException('UPLOAD_KEY_NOT_EXIST'); $compile_addon = (new Addon())->where([ ['compile', 'like', "%weapp%"] ])->field('key')->findOrEmpty(); // 上传任务key @@ -81,7 +91,7 @@ class CoreWeappCloudService extends CoreCloudBaseService dir_copy($compile_dir, $uni_dir); $this->weappCompileReplace($uni_dir); } - file_put_contents($package_dir . 'private.key', file_get_contents($config['upload_private_key'])); + file_put_contents($package_dir . 'private.key', file_get_contents($this->config['upload_private_key'])); // 将临时目录下文件生成压缩包 $zip_file = $temp_dir . DIRECTORY_SEPARATOR . 'weapp.zip'; @@ -90,7 +100,7 @@ class CoreWeappCloudService extends CoreCloudBaseService $query = [ 'compile' => $compile_addon->isEmpty() ? 0 : 1, 'authorize_code' => $this->auth_code, - 'appid' => $config['app_id'], + 'appid' => $this->config['app_id'], 'version' => $data['version'] ?? '', 'desc' => $data['desc'] ?? '', 'do' => 1, @@ -120,7 +130,7 @@ class CoreWeappCloudService extends CoreCloudBaseService * @return void */ private function handleUniapp(string $dir) { - $site_addon = (new CoreSiteService())->getAddonKeysBySiteId($this->site_id); + $site_addon = $this->config['addon']; $local_addon = (new Addon())->where([['status', '=', AddonDict::ON]])->column('key'); // 移除uniapp中该站点没有的插件 @@ -190,8 +200,8 @@ class CoreWeappCloudService extends CoreCloudBaseService */ private function weappEnvReplace(string $env_file) { $env = file_get_contents($env_file); - $env = str_replace("VITE_APP_BASE_URL=''", "VITE_APP_BASE_URL='" . (string)url('/api/', [], '', true) . "'", $env); - $env = str_replace("VITE_IMG_DOMAIN=''", "VITE_IMG_DOMAIN='" . (string)url('/', [], '', true) . "'", $env); + $env = str_replace("VITE_APP_BASE_URL=''", "VITE_APP_BASE_URL='" . $this->config['base_url'] . 'api/' . "'", $env); + $env = str_replace("VITE_IMG_DOMAIN=''", "VITE_IMG_DOMAIN='" . $this->config['base_url'] . "'", $env); $env = str_replace("VITE_SITE_ID = ''", "VITE_SITE_ID='" . $this->site_id . "'", $env); file_put_contents($env_file, $env); } @@ -205,14 +215,14 @@ class CoreWeappCloudService extends CoreCloudBaseService // 替换request.js $request_file = $path . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'request.js'; $content = file_get_contents($request_file); - $content = str_replace('{{$baseUrl}}', (string)url('/api/', [], '', true), $content); + $content = str_replace('{{$baseUrl}}', $this->config['base_url'] . 'api/', $content); $content = str_replace('{{$siteId}}', $this->site_id, $content); file_put_contents($request_file, $content); // 替换common.js $common_file = $path . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'common.js'; $content = file_get_contents($common_file); - $content = str_replace('{{$imgUrl}}', (string)url('/', [], '', true), $content); + $content = str_replace('{{$imgUrl}}', $this->config['base_url'], $content); file_put_contents($common_file, $content); } @@ -245,19 +255,7 @@ class CoreWeappCloudService extends CoreCloudBaseService 'authorize_code' => $this->auth_code, 'timestamp' => $timestamp ]; - $build_log = (new CloudService())->httpGet('cloud/get_weapp_logs?' . http_build_query($query)); - - if (isset($build_log['data']) && isset($build_log['data'][0]) && is_array($build_log['data'][0])) { - $last = end($build_log['data'][0]); - if ($last['code'] == 0) { - (new WeappVersion())->update(['status' => CloudDict::APPLET_UPLOAD_FAIL, 'fail_reason' => $last['msg'] ?? '', 'update_time' => time() ], ['task_key' => $timestamp]); - return $build_log; - } - if ($last['percent'] == 100) { - (new WeappVersion())->update(['status' => CloudDict::APPLET_UPLOAD_SUCCESS, 'update_time' => time() ], ['task_key' => $timestamp]); - } - } - return $build_log; + return (new CloudService())->httpGet('cloud/get_weapp_logs?' . http_build_query($query)); } /** diff --git a/niucloud/app/service/core/weapp/CoreWeappConfigService.php b/niucloud/app/service/core/weapp/CoreWeappConfigService.php index c1c837c65..99e83861b 100644 --- a/niucloud/app/service/core/weapp/CoreWeappConfigService.php +++ b/niucloud/app/service/core/weapp/CoreWeappConfigService.php @@ -40,7 +40,8 @@ class CoreWeappConfigService extends BaseCoreService 'token' => $info['token'] ?? '', 'encoding_aes_key' => $info['encoding_aes_key'] ?? '', 'encryption_type' => $info['encryption_type'] ?? 'not_encrypt',//加解密模式 not_encrypt 明文 compatible 兼容 safe 安全 - 'upload_private_key'=> $info['upload_private_key'] ?? '' + 'upload_private_key'=> $info['upload_private_key'] ?? '', + 'is_authorization' => $info['is_authorization'] ?? 0 ]; } @@ -51,6 +52,7 @@ class CoreWeappConfigService extends BaseCoreService * @return SysConfig|bool|Model */ public function setWeappConfig(int $site_id, array $data){ + $old = $this->getWeappConfig($site_id); $config = [ 'weapp_name' => $data['weapp_name'] ?? '',//小程序名称 'weapp_original' => $data['weapp_original'] ?? '',//原始ID @@ -60,10 +62,28 @@ class CoreWeappConfigService extends BaseCoreService 'token' => $data['token'] ?? '', 'encoding_aes_key' => $data['encoding_aes_key'] ?? '', 'encryption_type' => $data['encryption_type'] ?? 'not_encrypt',//加解密模式 not_encrypt 明文 compatible 兼容 safe 安全 - 'upload_private_key'=> $data['upload_private_key'] ?? '' + 'upload_private_key'=> $data['upload_private_key'] ?? '', + 'is_authorization' => $data['is_authorization'] ?? $old['is_authorization'] ]; return (new CoreConfigService())->setConfig($site_id, ConfigKeyDict::WEAPP, $config); } + /** + * 获取小程序授权信息 + * @param int $site_id + * @return mixed + */ + public function getWeappAuthorizationInfo(int $site_id) { + return (new CoreConfigService())->getConfigValue($site_id, ConfigKeyDict::WEAPP_AUTHORIZATION_INFO); + } + /** + * 设置小程序授权信息 + * @param int $site_id + * @param array $config + * @return SysConfig|bool|Model + */ + public function setWeappAuthorizationInfo(int $site_id, array $config) { + return (new CoreConfigService())->setConfig($site_id, ConfigKeyDict::WEAPP_AUTHORIZATION_INFO, $config); + } } diff --git a/niucloud/app/service/core/weapp/CoreWeappServeService.php b/niucloud/app/service/core/weapp/CoreWeappServeService.php new file mode 100644 index 000000000..b325334ae --- /dev/null +++ b/niucloud/app/service/core/weapp/CoreWeappServeService.php @@ -0,0 +1,49 @@ +getServer(); + $server->with(function($message, \Closure $next) use ($site_id){ + + }); + $response = $server->serve(); + return $response; + + } + +} diff --git a/niucloud/app/service/core/weapp/CoreWeappService.php b/niucloud/app/service/core/weapp/CoreWeappService.php index c5a077d7b..f8f39788c 100644 --- a/niucloud/app/service/core/weapp/CoreWeappService.php +++ b/niucloud/app/service/core/weapp/CoreWeappService.php @@ -11,6 +11,7 @@ namespace app\service\core\weapp; +use app\service\core\wxoplatform\CoreOplatformService; use core\base\BaseCoreService; use core\exception\CommonException; use core\exception\WechatException; @@ -35,36 +36,26 @@ class CoreWeappService extends BaseCoreService { $core_weapp_service = new CoreWeappConfigService(); $weapp_config = $core_weapp_service->getWeappConfig($site_id); - if(empty($weapp_config['app_id']) || empty($weapp_config['app_secret'])) - throw new WechatException('WEAPP_NOT_EXIST');//公众号未配置 - $config = array( - 'app_id' => $weapp_config['app_id'], - 'secret' => $weapp_config['app_secret'], - /** - * 接口请求相关配置,超时时间等,具体可用参数请参考: - * https://github.com/symfony/symfony/blob/5.3/src/Symfony/Contracts/HttpClient/HttpClientInterface.php - */ - 'http' => [ - 'throw' => true, // 状态码非 200、300 时是否抛出异常,默认为开启 - 'timeout' => 5.0, - // 'base_uri' => 'https://api.weixin.qq.com/', // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri + if ($weapp_config['is_authorization']) { + $authorization_info = $core_weapp_service->getWeappAuthorizationInfo($site_id)['authorization_info']; + return CoreOplatformService::app()->getMiniAppWithRefreshToken($weapp_config['app_id'], $authorization_info['authorizer_refresh_token']); + } else { + if(empty($weapp_config['app_id']) || empty($weapp_config['app_secret'])) throw new WechatException('WEAPP_NOT_EXIST');//公众号未配置 - 'retry' => true, // 使用默认重试配置 - // 'retry' => [ - // // 仅以下状态码重试 - // 'status_codes' => [429, 500] - // // 最大重试次数 - // 'max_retries' => 3, - // // 请求间隔 (毫秒) - // 'delay' => 1000, - // // 如果设置,每次重试的等待时间都会增加这个系数 - // // (例如. 首次:1000ms; 第二次: 3 * 1000ms; etc.) - // 'multiplier' => 3 - // ], - ], - ); - return new Application($config); + $config = array( + 'app_id' => $weapp_config['app_id'], + 'secret' => $weapp_config['app_secret'], + 'token' => $weapp_config['token'], + 'aes_key' => $weapp_config['encryption_type'] == 'not_encrypt' ? '' :$weapp_config['encoding_aes_key'],// 明文模式请勿填写 EncodingAESKey + 'http' => [ + 'throw' => true, // 状态码非 200、300 时是否抛出异常,默认为开启 + 'timeout' => 5.0, + 'retry' => true, // 使用默认重试配置 + ], + ); + return new Application($config); + } } @@ -109,4 +100,22 @@ class CoreWeappService extends BaseCoreService return $filepath; } -} \ No newline at end of file + /** + * 获取小程序体验码 + * @param $site_id + * @return void + */ + public function getWeappPreviewImage($site_id) { + $app = self::appApiClient($site_id); + $response = $app->get('/wxa/get_qrcode'); + if ($response->isFailed()) { + // 出错了,处理异常 + throw new CommonException('WECHAT_MINI_PROGRAM_CODE_GENERATION_FAILED'); + } + $dir = public_path() . "qrcode/{$site_id}/"; + mkdirs_or_notexist($dir); + $filepath = $dir . time().'.png'; + file_put_contents($filepath, $response->getContent()); + return $filepath; + } +} diff --git a/niucloud/app/service/core/weapp/CoreWeappTemplateService.php b/niucloud/app/service/core/weapp/CoreWeappTemplateService.php index fa13c559f..9038901e7 100644 --- a/niucloud/app/service/core/weapp/CoreWeappTemplateService.php +++ b/niucloud/app/service/core/weapp/CoreWeappTemplateService.php @@ -65,7 +65,7 @@ class CoreWeappTemplateService extends BaseCoreService return $api->postJson('wxaapi/newtmpl/addtemplate', [ 'tid' => $tid, 'kidList' => $kidList, - 'kidList' => $sceneDesc, + 'sceneDesc' => $sceneDesc, ]); } @@ -84,4 +84,4 @@ class CoreWeappTemplateService extends BaseCoreService ]); } -} \ No newline at end of file +} diff --git a/niucloud/app/service/core/wechat/CoreWechatApiService.php b/niucloud/app/service/core/wechat/CoreWechatApiService.php index b10c86c30..3d2d5a380 100644 --- a/niucloud/app/service/core/wechat/CoreWechatApiService.php +++ b/niucloud/app/service/core/wechat/CoreWechatApiService.php @@ -12,7 +12,6 @@ namespace app\service\core\wechat; use core\base\BaseCoreService; -use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use GuzzleHttp\Exception\GuzzleException; diff --git a/niucloud/app/service/core/wechat/CoreWechatConfigService.php b/niucloud/app/service/core/wechat/CoreWechatConfigService.php index 9b4c4a20e..e8c5a7f7b 100644 --- a/niucloud/app/service/core/wechat/CoreWechatConfigService.php +++ b/niucloud/app/service/core/wechat/CoreWechatConfigService.php @@ -42,6 +42,7 @@ class CoreWechatConfigService extends BaseCoreService 'token' => $info['token'] ?? '', 'encoding_aes_key' => $info['encoding_aes_key'] ?? '', 'encryption_type' => $info['encryption_type'] ?? 'not_encrypt',//加解密模式 not_encrypt 明文 compatible 兼容 safe 安全 + 'is_authorization' => $info['is_authorization'] ?? 0 ]; } @@ -52,6 +53,7 @@ class CoreWechatConfigService extends BaseCoreService * @return SysConfig|bool|Model */ public function setWechatConfig(int $site_id, array $data){ + $old = $this->getWechatConfig($site_id); $config = [ 'wechat_name' => $data['wechat_name'] ?? '',//公众号名称 'wechat_original' => $data['wechat_original'] ?? '',//原始ID @@ -61,6 +63,7 @@ class CoreWechatConfigService extends BaseCoreService 'token' => $data['token'] ?? '', 'encoding_aes_key' => $data['encoding_aes_key'] ?? '', 'encryption_type' => $data['encryption_type'] ?? '', + 'is_authorization' => $data['is_authorization'] ?? $old['is_authorization'] ]; return (new CoreConfigService())->setConfig($site_id, ConfigKeyDict::WECHAT, $config); } @@ -71,12 +74,7 @@ class CoreWechatConfigService extends BaseCoreService * @return array */ public function getWechatStaticInfo($site_id){ -// $domain = request()->domain(); $wap_domain = (new CoreSysConfigService())->getSceneDomain($site_id)['wap_url'] ?? ''; - $wap_domain_array = explode('/', $wap_domain); -// if(count($wap_domain_array) > 2){ -// $wap_domain = $wap_domain_array[0].'/'.$wap_domain_array[1].'/'.$wap_domain_array[2]; -// } return [ 'serve_url' => (string)url('/api/wechat/serve/'.$site_id, [],'',true), 'business_domain' => $wap_domain, @@ -85,4 +83,23 @@ class CoreWechatConfigService extends BaseCoreService 'encryption_type' => WechatDict::getEncryptionType() ]; } + + /** + * 获取小程序授权信息 + * @param int $site_id + * @return mixed + */ + public function getWechatAuthorizationInfo(int $site_id) { + return (new CoreConfigService())->getConfigValue($site_id, ConfigKeyDict::WECHAT_AUTHORIZATION_INFO); + } + + /** + * 设置小程序授权信息 + * @param int $site_id + * @param array $config + * @return SysConfig|bool|Model + */ + public function setWechatAuthorizationInfo(int $site_id, array $config) { + return (new CoreConfigService())->setConfig($site_id, ConfigKeyDict::WECHAT_AUTHORIZATION_INFO, $config); + } } diff --git a/niucloud/app/service/core/wechat/CoreWechatMessageService.php b/niucloud/app/service/core/wechat/CoreWechatMessageService.php index db0aecb26..18776a981 100644 --- a/niucloud/app/service/core/wechat/CoreWechatMessageService.php +++ b/niucloud/app/service/core/wechat/CoreWechatMessageService.php @@ -13,9 +13,7 @@ namespace app\service\core\wechat; use app\dict\channel\WechatDict; use app\service\core\scan\CoreScanService; -use Closure; use core\base\BaseCoreService; - use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; diff --git a/niucloud/app/service/core/wechat/CoreWechatReplyService.php b/niucloud/app/service/core/wechat/CoreWechatReplyService.php index 005a7ccea..dabf38a5d 100644 --- a/niucloud/app/service/core/wechat/CoreWechatReplyService.php +++ b/niucloud/app/service/core/wechat/CoreWechatReplyService.php @@ -16,7 +16,6 @@ use app\dict\channel\WechatDict; use app\model\wechat\WechatReply; use core\base\BaseCoreService; use core\exception\AdminException; -use EasyWeChat\Kernel\Messages\Text; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; diff --git a/niucloud/app/service/core/wechat/CoreWechatServeService.php b/niucloud/app/service/core/wechat/CoreWechatServeService.php index 415a38986..aab826d3f 100644 --- a/niucloud/app/service/core/wechat/CoreWechatServeService.php +++ b/niucloud/app/service/core/wechat/CoreWechatServeService.php @@ -15,12 +15,9 @@ use core\base\BaseCoreService; use EasyWeChat\Kernel\Exceptions\BadRequestException; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException; -use EasyWeChat\Kernel\Exceptions\RuntimeException; use Overtrue\Socialite\Contracts\UserInterface; -use Psr\Http\Message\ResponseInterface; use ReflectionException; use Symfony\Component\HttpFoundation\Response; -use Throwable; /** * 微信服务提供 @@ -116,7 +113,7 @@ class CoreWechatServeService extends BaseCoreService jsApiList: [], openTagList: [], debug: false, - );; + ); } /** @@ -142,7 +139,9 @@ class CoreWechatServeService extends BaseCoreService $param = [ 'expire_seconds' => $expire_seconds, 'action_name' => $type, - 'action_info' => $scene, + 'action_info' => [ + 'scene' => $scene + ], ]; return $api->postJson('cgi-bin/qrcode/create', $param); } diff --git a/niucloud/app/service/core/wechat/CoreWechatService.php b/niucloud/app/service/core/wechat/CoreWechatService.php index 157033878..5385718f1 100644 --- a/niucloud/app/service/core/wechat/CoreWechatService.php +++ b/niucloud/app/service/core/wechat/CoreWechatService.php @@ -11,10 +11,9 @@ namespace app\service\core\wechat; -use app\dict\channel\ReplyDict; +use app\service\core\wxoplatform\CoreOplatformService; use core\base\BaseCoreService; use core\exception\WechatException; -use EasyWeChat\Factory; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\OfficialAccount\Application; @@ -35,37 +34,25 @@ class CoreWechatService extends BaseCoreService { $core_wechat_service = new CoreWechatConfigService(); $wechat_config = $core_wechat_service->getWechatConfig($site_id); - if (empty($wechat_config['app_id']) || empty($wechat_config['app_secret'])) - throw new WechatException('WECHAT_NOT_EXIST');//公众号未配置 - $config = array( - 'app_id' => $wechat_config['app_id'], - 'secret' => $wechat_config['app_secret'], - 'token' => $wechat_config['token'], - 'aes_key' => $wechat_config['encoding_aes_key'],// 明文模式请勿填写 EncodingAESKey - /** - * 接口请求相关配置,超时时间等,具体可用参数请参考: - * https://github.com/symfony/symfony/blob/5.3/src/Symfony/Contracts/HttpClient/HttpClientInterface.php - */ - 'http' => [ - 'timeout' => 5.0, - // 'base_uri' => 'https://api.weixin.qq.com/', // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri + if ($wechat_config['is_authorization']) { + $authorization_info = $core_wechat_service->getWechatAuthorizationInfo($site_id)['authorization_info']; + return CoreOplatformService::app()->getOfficialAccountWithRefreshToken($wechat_config['app_id'], $authorization_info['authorizer_refresh_token']); + } else { + if (empty($wechat_config['app_id']) || empty($wechat_config['app_secret'])) throw new WechatException('WECHAT_NOT_EXIST');//公众号未配置 - 'retry' => true, // 使用默认重试配置 - // 'retry' => [ - // // 仅以下状态码重试 - // 'status_codes' => [429, 500] - // // 最大重试次数 - // 'max_retries' => 3, - // // 请求间隔 (毫秒) - // 'delay' => 1000, - // // 如果设置,每次重试的等待时间都会增加这个系数 - // // (例如. 首次:1000ms; 第二次: 3 * 1000ms; etc.) - // 'multiplier' => 3 - // ], - ], - ); - return new Application($config); + $config = array( + 'app_id' => $wechat_config['app_id'], + 'secret' => $wechat_config['app_secret'], + 'token' => $wechat_config['token'], + 'aes_key' => $wechat_config['encryption_type'] == 'not_encrypt' ? '' :$wechat_config['encoding_aes_key'],// 明文模式请勿填写 EncodingAESKey + 'http' => [ + 'timeout' => 5.0, + 'retry' => true, // 使用默认重试配置 + ] + ); + return new Application($config); + } } /** diff --git a/niucloud/app/service/core/wechat/CoreWechatTemplateService.php b/niucloud/app/service/core/wechat/CoreWechatTemplateService.php index 4692d290b..95d993569 100644 --- a/niucloud/app/service/core/wechat/CoreWechatTemplateService.php +++ b/niucloud/app/service/core/wechat/CoreWechatTemplateService.php @@ -15,7 +15,6 @@ use core\base\BaseCoreService; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use EasyWeChat\Kernel\Support\Collection; -use EasyWeChat\OfficialAccount\TemplateMessage\Client; use GuzzleHttp\Exception\GuzzleException; use Psr\Http\Message\ResponseInterface; diff --git a/niucloud/app/service/core/wxoplatform/CoreOplatformConfigService.php b/niucloud/app/service/core/wxoplatform/CoreOplatformConfigService.php new file mode 100644 index 000000000..e3ac3a781 --- /dev/null +++ b/niucloud/app/service/core/wxoplatform/CoreOplatformConfigService.php @@ -0,0 +1,78 @@ +getConfigValue(0, ConfigKeyDict::WXOPLATFORM); + return [ + 'app_id' => $info['app_id'] ?? '',// 开放平台账号的 appid + 'app_secret' => $info['app_secret'] ?? '',// 开放平台账号的 secret + 'token' => $info['token'] ?? '', // 开放平台账号的 token + 'aes_key' => $info['aes_key'] ?? '',// 明文模式请勿填写 EncodingAESKey + 'develop_app_id' => $info['develop_app_id'] ?? '', + 'develop_upload_private_key' => $info['develop_upload_private_key'] ?? '' + ]; + } + + /** + * 设置微信公众号配置 + * @param int $site_id + * @param array $data + * @return SysConfig|bool|Model + */ + public function setConfig(array $data){ + $config = [ + 'app_id' => $data['app_id'] ?? '',// 开放平台账号的 appid + 'app_secret' => $data['app_secret'] ?? '',// 开放平台账号的 secret + 'token' => $data['token'] ?? '', // 开放平台账号的 token + 'aes_key' => $data['aes_key'] ?? '',// 明文模式请勿填写 EncodingAESKey + 'develop_app_id' => $data['develop_app_id'] ?? '', + 'develop_upload_private_key' => $data['develop_upload_private_key'] ?? '' + ]; + return (new CoreConfigService())->setConfig(0, ConfigKeyDict::WXOPLATFORM, $config); + } + + + /** + *查询微信需要的静态信息 + * @return array + */ + public function getStaticInfo(){ + $wap_domain = (new CoreSysConfigService())->getSceneDomain(0)['wap_url'] ?? ''; + + return [ + 'auth_serve_url' => (string)url('/adminapi/wxoplatform/server',[],'', true), // 授权事件接收配置 + 'message_serve_url' => (string)url('/adminapi/wxoplatform/message/$APPID$', [],'',true), // 消息与事件接收配置 + 'auth_launch_domain' => parse_url(request()->domain())['host'] ?? '', // 授权发起页域名 + 'wechat_auth_domain' => parse_url($wap_domain)['host'] ?? '', // 公众号开发域名 + 'upload_ip' => gethostbyname('oss.niucloud.com') + ]; + } +} diff --git a/niucloud/app/service/core/wxoplatform/CoreOplatformService.php b/niucloud/app/service/core/wxoplatform/CoreOplatformService.php new file mode 100644 index 000000000..1abf1a176 --- /dev/null +++ b/niucloud/app/service/core/wxoplatform/CoreOplatformService.php @@ -0,0 +1,309 @@ +getConfig(); + if (empty($oplatform_config['app_id']) || empty($oplatform_config['app_secret'])) throw new CommonException('WECHAT_OPLATFORM_NOT_EXIST');//公众号未配置 + + $config = array( + 'app_id' => $oplatform_config['app_id'], + 'secret' => $oplatform_config['app_secret'], + 'token' => $oplatform_config['token'], + 'aes_key' => $oplatform_config['aes_key'],// 明文模式请勿填写 EncodingAESKey + 'http' => [ + 'timeout' => 5.0, + 'retry' => true, // 使用默认重试配置 + ] + ); + return new Application($config); + } + + public static function codeToSession($site_id, $js_code) { + $app = self::app(); + $weapp_config = (new CoreWeappConfigService())->getWeappAuthorizationInfo($site_id); + + return $app->getClient()->get('sns/component/jscode2session', [ + 'appid' => $weapp_config['authorization_info']['authorizer_appid'], + 'js_code' => $js_code, + 'grant_type' => $weapp_config['authorization_info']['auth_code'], + 'component_access_token' => $app->getComponentAccessToken(), + 'component_appid' => $app->getAccount()->getAppId() + ])->toArray(false); + } + + /** + * 获取站点id + * @param string $app_id + * @return int|mixed + */ + public static function getSiteIdByAuthorizerAppid(string $app_id) { + $data = (new SysConfig())->where([ ['value', 'like', "%{$app_id}%"], ['config_key', 'in', [ConfigKeyDict::WEAPP, ConfigKeyDict::WECHAT] ] ])->field('site_id')->findOrEmpty()->toArray(); + return $data['site_id'] ?? 0; + } + + /** + * @param $app + * @param $authorizer_appid + * @return mixed + */ + public static function getAuthorizerInfo($app, $authorizer_appid) { + $api = $app->getClient(); + + $response = $api->post('/cgi-bin/component/api_get_authorizer_info', [ + 'json' => [ + "component_appid" => $app->getAccount()->getAppId(), + "authorizer_appid" => $authorizer_appid + ] + ]); + + return $response; + } + + /** + * 获取草稿箱列表 + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function getTemplateDraftList() { + $app = self::app(); + return $app->getClient()->get('/wxa/gettemplatedraftlist')->toArray(); + } + + /** + * 获取模板列表(普通模板) + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function getTemplateList() { + $app = self::app(); + return $app->getClient()->get('/wxa/gettemplatelist', ['template_type' => 0])->toArray(); + } + + /** + * 添加草稿箱到模板库(普通模板) + * @param array $data + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function addToTemplate(array $data) { + $app = self::app(); + return $app->getClient()->post('/wxa/addtotemplate', [ + 'json' => [ + "draft_id" => $data['draft_id'], + "template_type" => 0 + ] + ])->toArray(); + } + + /** + * 删除模板 + * @param string $template_id + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function deleteTemplate(string $template_id) { + $app = self::app(); + return $app->getClient()->post('/wxa/deletetemplate', [ + 'json' => [ + "template_id" => $template_id + ] + ])->toArray(); + } + + /** + * 上传小程序代码 + * @param array $json + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function commitWeapp($site_id, array $json) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->post('/wxa/commit', [ + 'json' => $json + ])->toArray(); + } + + /** + * 提交审核 + * @param $site_id + * @param array $json + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function submitAudit($site_id, array $json) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->post('/wxa/submit_audit', [ + 'json' => $json + ])->toArray(); + } + + /** + * 发布小程序 + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function releaseWeapp($site_id) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->post('/wxa/release')->toArray(); + } + + /** + * 获取隐私接口检测结果 + * @param $site_id + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function getCodePrivacyInfo($site_id) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->get('/wxa/security/get_code_privacy_info')->toArray(); + } + + /** + * 设置隐私协议 + * @param $site_id + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function setPrivacySetting($site_id, $data) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->post('/cgi-bin/component/setprivacysetting', [ + 'json' => [ + 'privacy_ver' => $data['privacy_ver'] ?? 2, + 'setting_list' => $data['setting_list'], + 'owner_setting' => $data['owner_setting'], + 'sdk_privacy_info_list' => $data['sdk_privacy_info_list'] ?? [] + ] + ])->toArray(); + } + + /** + * 获取服务器域名 + * @param $site_id + * @param $data + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function getDomain($site_id) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->post('/wxa/modify_domain', [ + 'json' => [ + 'action' => 'get', + ] + ])->toArray(); + } + + /** + * 设置域名 + * @param $site_id + * @param $data + * @return array|mixed[] + * @throws \EasyWeChat\Kernel\Exceptions\BadResponseException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ + public static function setDomain($site_id, $data) { + $app = CoreWeappService::app($site_id); + return $app->getClient()->post('/wxa/modify_domain', [ + 'json' => [ + 'action' => 'set', + 'requestdomain' => $data['requestdomain'] ?? [], + 'wsrequestdomain' => $data['wsrequestdomain'] ?? [], + 'uploaddomain' => $data['uploaddomain'] ?? [], + 'downloaddomain' => $data['downloaddomain'] ?? [], + 'udpdomain' => $data['udpdomain'] ?? [], + 'tcpdomain' => $data['tcpdomain'] ?? [], + ] + ])->toArray(); + } +} diff --git a/niucloud/app/upgrade/v040/upgrade.sql b/niucloud/app/upgrade/v040/upgrade.sql new file mode 100644 index 000000000..908851c0a --- /dev/null +++ b/niucloud/app/upgrade/v040/upgrade.sql @@ -0,0 +1,38 @@ + +ALTER TABLE `weapp_version` ADD COLUMN `from_type` VARCHAR(255) NOT NULL DEFAULT 'cloud_build'; + +ALTER TABLE `weapp_version` ADD COLUMN `auditid` VARCHAR(255) NOT NULL DEFAULT ''; + +ALTER TABLE `member_address` DROP COLUMN `type`; + +DROP TABLE IF EXISTS `wx_oplatfrom_weapp_version`; +CREATE TABLE `wx_oplatfrom_weapp_version` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `site_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点套餐id', + `template_id` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '代码模板 ID', + `user_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '代码版本号', + `user_desc` VARCHAR(255) DEFAULT '' COMMENT '代码描述', + `task_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '上传任务key', + `status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态', + `fail_reason` TEXT DEFAULT NULL COMMENT '失败原因', + `version_no` INT(11) NOT NULL DEFAULT 0, + `create_time` INT(11) NOT NULL DEFAULT 0, + `update_time` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) +ENGINE = INNODB, +CHARACTER SET utf8mb4, +COLLATE utf8mb4_general_ci; + +DROP TABLE IF EXISTS `user_create_site_limit`; +CREATE TABLE `user_create_site_limit` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `group_id` INT(11) NOT NULL DEFAULT 0, + `uid` INT(11) NOT NULL DEFAULT 0, + `num` INT(11) NOT NULL DEFAULT 0, + `month` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) +ENGINE = INNODB, +CHARACTER SET utf8mb4, +COLLATE utf8mb4_general_ci; \ No newline at end of file diff --git a/niucloud/app/validate/channel/Weapp.php b/niucloud/app/validate/channel/Weapp.php index 64dc56a3d..3f6af57e9 100644 --- a/niucloud/app/validate/channel/Weapp.php +++ b/niucloud/app/validate/channel/Weapp.php @@ -34,8 +34,8 @@ class Weapp extends Validate ]; protected $scene = [ - 'set' => ['app_id', 'app_secret'], + 'set' => ['app_id'], ]; -} \ No newline at end of file +} diff --git a/niucloud/app/validate/channel/Wechat.php b/niucloud/app/validate/channel/Wechat.php index 585f27894..20b843ba0 100644 --- a/niucloud/app/validate/channel/Wechat.php +++ b/niucloud/app/validate/channel/Wechat.php @@ -23,8 +23,6 @@ class Wechat extends Validate protected $rule = [ 'app_id' => 'require', 'app_secret' => 'require',//防止key值重复 - - ]; protected $message = [ @@ -34,8 +32,8 @@ class Wechat extends Validate ]; protected $scene = [ - 'set' => ['app_id', 'app_secret'], + 'set' => ['app_id'], ]; -} \ No newline at end of file +} diff --git a/niucloud/app/validate/member/Address.php b/niucloud/app/validate/member/Address.php index 302f808c0..8c02151c9 100644 --- a/niucloud/app/validate/member/Address.php +++ b/niucloud/app/validate/member/Address.php @@ -28,7 +28,6 @@ class Address extends BaseValidate 'district_id' => 'require', 'address' => 'require', 'full_address' => 'require', - 'type' => 'require', ]; protected $message = [ @@ -36,12 +35,11 @@ class Address extends BaseValidate 'mobile.require' => ['common_validate.require', ['mobile']], 'address.require' => ['common_validate.require', ['address']], 'full_address.require' => ['common_validate.require', ['full_address']], - 'type.require' => ['common_validate.require', ['type']], ]; protected $scene = [ - "add" => ['name', 'mobile', 'address', 'full_address', 'lng', 'lat', 'type'], - "edit" => ['name', 'mobile', 'address', 'full_address', 'lng', 'lat', 'type'] + "add" => ['name', 'mobile', 'address', 'full_address', 'lng', 'lat'], + "edit" => ['name', 'mobile', 'address', 'full_address', 'lng', 'lat'] ]; } diff --git a/niucloud/config/pay.php b/niucloud/config/pay.php index 259a6f2c9..fa788a15c 100644 --- a/niucloud/config/pay.php +++ b/niucloud/config/pay.php @@ -9,7 +9,9 @@ // | Author: Niucloud Team // +---------------------------------------------------------------------- -return [ +use core\dict\DictLoader; + +$system = [ //默认驱动 'default' => 'wechatpay', //驱动 @@ -27,3 +29,5 @@ return [ ] ] ]; + +return (new DictLoader("Config"))->load(['data' => $system, 'name' => 'pay']); diff --git a/niucloud/config/sms.php b/niucloud/config/sms.php index b2217b8f2..1d44c1db5 100644 --- a/niucloud/config/sms.php +++ b/niucloud/config/sms.php @@ -9,7 +9,9 @@ // | Author: Niucloud Team // +---------------------------------------------------------------------- -return [ +use core\dict\DictLoader; + +$system = [ //默认驱动 'default' => 'aliyun', //驱动厂商列表及参数-短信 @@ -30,3 +32,5 @@ return [ ] ] ]; + +return (new DictLoader("Config"))->load(['data' => $system, 'name' => 'sms']); diff --git a/niucloud/config/upload.php b/niucloud/config/upload.php index 103162761..7c828cbb2 100644 --- a/niucloud/config/upload.php +++ b/niucloud/config/upload.php @@ -1,6 +1,8 @@ 'local',//默认驱动 'drivers' => [ //本地上传 @@ -84,3 +86,5 @@ return [ ] ]; + +return (new DictLoader("Config"))->load(['data' => $system, 'name' => 'upload']); diff --git a/niucloud/config/version.php b/niucloud/config/version.php index bafd1d1dc..251801150 100644 --- a/niucloud/config/version.php +++ b/niucloud/config/version.php @@ -1,6 +1,6 @@ '0.3.0', - 'code' => '202405180001' + 'version' => '0.4.0', + 'code' => '202406150001' ]; diff --git a/niucloud/core/dict/Config.php b/niucloud/core/dict/Config.php new file mode 100644 index 000000000..4997685ac --- /dev/null +++ b/niucloud/core/dict/Config.php @@ -0,0 +1,41 @@ +getAllLocalAddons(); + $config_files = []; + + foreach ($addons as $v) { + $config_path = $this->getAddonAppPath($v) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . $config . '.php'; + if (is_file($config_path)) { + $config_files[] = $config_path; + } + } + $files_data = $this->loadFiles($config_files); + + foreach ($files_data as $file_data) { + if(!empty($file_data)) + { + $system_config = empty($system_config) ? $file_data : array_merge2($system_config, $file_data); + } + + } + return $system_config; + } +} diff --git a/niucloud/core/dict/UniappComponent.php b/niucloud/core/dict/UniappComponent.php index 7a85099e1..2c946a838 100644 --- a/niucloud/core/dict/UniappComponent.php +++ b/niucloud/core/dict/UniappComponent.php @@ -22,7 +22,7 @@ class UniappComponent extends BaseDict */ public function load(array $data) { - $addons = (new SiteService())->getAddonKeysBySiteId(); + $addons = ( new SiteService() )->getAddonKeysBySiteId(); $components_files = []; foreach ($addons as $v) { diff --git a/niucloud/core/dict/UniappPages.php b/niucloud/core/dict/UniappPages.php index 08087654d..1aae03be6 100644 --- a/niucloud/core/dict/UniappPages.php +++ b/niucloud/core/dict/UniappPages.php @@ -26,7 +26,7 @@ class UniappPages extends BaseDict if (!empty($data[ 'addon' ])) { $addons = [ $data[ 'addon' ] ]; } else { - $addons = (new SiteService())->getAddonKeysBySiteId(); + $addons = ( new SiteService() )->getAddonKeysBySiteId(); } $page_files = []; diff --git a/niucloud/core/dict/UniappTemplate.php b/niucloud/core/dict/UniappTemplate.php index 5dddf6d6c..2133625d2 100644 --- a/niucloud/core/dict/UniappTemplate.php +++ b/niucloud/core/dict/UniappTemplate.php @@ -26,7 +26,7 @@ class UniappTemplate extends BaseDict if (!empty($params[ 'params' ][ 'addon' ])) { $addons = [ $params[ 'params' ][ 'addon' ] ]; } else { - $addons = (new SiteService())->getAddonKeysBySiteId(); + $addons = ( new SiteService() )->getAddonKeysBySiteId(); } $app_keys = []; // 应用插件key集合 diff --git a/niucloud/core/pay/Alipay.php b/niucloud/core/pay/Alipay.php index 2d411f567..0368a3303 100644 --- a/niucloud/core/pay/Alipay.php +++ b/niucloud/core/pay/Alipay.php @@ -6,7 +6,6 @@ use app\dict\pay\OnlinePayDict; use app\dict\pay\RefundDict; use app\dict\pay\TransferDict; use core\exception\PayException; -use Psr\Http\Message\MessageInterface; use Psr\Http\Message\ResponseInterface; use Throwable; use Yansongda\Pay\Exception\ContainerException; diff --git a/niucloud/core/pay/BasePay.php b/niucloud/core/pay/BasePay.php index a7fd471d1..439d083f7 100644 --- a/niucloud/core/pay/BasePay.php +++ b/niucloud/core/pay/BasePay.php @@ -2,7 +2,6 @@ namespace core\pay; -use core\exception\PayException; use core\loader\Storage; use GuzzleHttp\Psr7\Response; use Psr\Http\Message\MessageInterface; diff --git a/niucloud/core/poster/Poster.php b/niucloud/core/poster/Poster.php index 3344d6dd0..306242e3d 100644 --- a/niucloud/core/poster/Poster.php +++ b/niucloud/core/poster/Poster.php @@ -51,7 +51,7 @@ class Poster extends BasePoster switch ($type) { case 'text': $default_font = 'static' . DIRECTORY_SEPARATOR . 'font' . DIRECTORY_SEPARATOR . 'SourceHanSansCN-Regular.ttf'; - $editor->text($bg_image, $v[ 'value' ], $v[ 'fontSize' ]*(4/3), $v[ 'x' ] * 2, $v[ 'y' ] * 2, new Color($v[ 'fontColor' ]), $v[ 'fontFamily' ] ? : $default_font, $v[ 'angle' ]); + $editor->text($bg_image, $v[ 'value' ], round($v[ 'fontSize' ]*(4/3)), round($v[ 'x' ] * 2), round($v[ 'y' ] * 2), new Color($v[ 'fontColor' ]), $v[ 'fontFamily' ] ? : $default_font, $v[ 'angle' ]); break; case 'image': $image_name = 'image' . $k;