From e1d082e9848f1746bb3acac579860ae7a75b116c 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, 20 May 2023 18:31:32 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
niucloud/app/BaseController.php | 96 --
niucloud/app/ExceptionHandle.php | 12 +-
.../app/adminapi/controller/addon/Addon.php | 94 ++
.../app/adminapi/controller/addon/App.php | 31 +
.../app/adminapi/controller/aliapp/Config.php | 4 +-
.../adminapi/controller/article/Article.php | 14 +-
.../controller/article/ArticleCategory.php | 14 +-
.../app/adminapi/controller/auth/Auth.php | 12 +-
.../app/adminapi/controller/channel/H5.php | 6 +-
.../app/adminapi/controller/diy/Config.php | 4 +-
niucloud/app/adminapi/controller/diy/Diy.php | 19 +-
.../app/adminapi/controller/diy/DiyRoute.php | 42 +-
.../controller/generator/Generator.php | 20 +-
.../app/adminapi/controller/login/Captcha.php | 46 +
.../app/adminapi/controller/login/Config.php | 46 +
.../app/adminapi/controller/login/Login.php | 21 +-
.../adminapi/controller/member/Account.php | 69 +-
.../member/{Withdraw.php => CashOut.php} | 26 +-
.../app/adminapi/controller/member/Config.php | 16 +-
.../app/adminapi/controller/member/Member.php | 106 +-
.../controller/member/MemberLabel.php | 14 +-
.../Message.php => notice/Notice.php} | 30 +-
.../MessageLog.php => notice/NoticeLog.php} | 12 +-
.../controller/{message => notice}/SmsLog.php | 12 +-
.../adminapi/controller/order/Recharge.php | 10 +-
.../app/adminapi/controller/order/Refund.php | 57 +
.../app/adminapi/controller/pay/Config.php | 3 +-
.../adminapi/controller/pay/PayChannel.php | 90 ++
.../app/adminapi/controller/site/Site.php | 12 +-
.../adminapi/controller/site/SiteGroup.php | 12 +-
.../app/adminapi/controller/site/User.php | 19 +-
.../app/adminapi/controller/site/UserLog.php | 2 +-
.../app/adminapi/controller/stat/SiteStat.php | 2 +-
.../app/adminapi/controller/stat/Stat.php | 2 +-
.../app/adminapi/controller/sys/Agreement.php | 8 +-
niucloud/app/adminapi/controller/sys/App.php | 31 +
niucloud/app/adminapi/controller/sys/Area.php | 2 +-
.../adminapi/controller/sys/Attachment.php | 20 +-
.../app/adminapi/controller/sys/Channel.php | 2 +-
.../app/adminapi/controller/sys/Config.php | 4 +-
niucloud/app/adminapi/controller/sys/Cron.php | 2 +-
niucloud/app/adminapi/controller/sys/Menu.php | 14 +-
niucloud/app/adminapi/controller/sys/Role.php | 14 +-
.../app/adminapi/controller/sys/System.php | 19 +-
.../app/adminapi/controller/sys/Terminal.php | 37 +
.../adminapi/controller/upload/Storage.php | 10 +-
.../app/adminapi/controller/upload/Upload.php | 22 +-
.../app/adminapi/controller/user/User.php | 2 +-
.../app/adminapi/controller/weapp/Config.php | 4 +-
.../adminapi/controller/weapp/Template.php | 2 +-
.../app/adminapi/controller/wechat/Config.php | 17 +-
.../app/adminapi/controller/wechat/Menu.php | 8 +-
.../app/adminapi/controller/wechat/Reply.php | 14 +-
.../adminapi/controller/wechat/Template.php | 2 +-
niucloud/app/adminapi/middleware.php | 8 +
.../middleware/AllowCrossDomain.php | 30 +-
niucloud/app/adminapi/route/addon.php | 46 +
niucloud/app/adminapi/route/app.php | 6 +-
niucloud/app/adminapi/route/article.php | 4 +-
niucloud/app/adminapi/route/auth.php | 2 +-
niucloud/app/adminapi/route/diy.php | 5 +-
niucloud/app/adminapi/route/generator.php | 2 +-
niucloud/app/adminapi/route/member.php | 38 +-
.../route/{message.php => notice.php} | 26 +-
niucloud/app/adminapi/route/order.php | 2 +
niucloud/app/adminapi/route/pay.php | 11 +
niucloud/app/adminapi/route/refund.php | 33 +
niucloud/app/adminapi/route/route.php | 18 +-
niucloud/app/adminapi/route/site.php | 6 +-
niucloud/app/adminapi/route/sys.php | 23 +-
niucloud/app/adminapi/route/upload.php | 14 -
niucloud/app/adminapi/route/user.php | 2 -
niucloud/app/adminapi/route/wechat.php | 10 +-
.../api/controller/agreement/Agreement.php | 2 +-
.../app/api/controller/article/Article.php | 2 +-
.../controller/article/ArticleCategory.php | 2 +-
niucloud/app/api/controller/diy/Diy.php | 8 +-
niucloud/app/api/controller/login/Config.php | 3 +-
niucloud/app/api/controller/login/Login.php | 9 +-
.../app/api/controller/login/Register.php | 3 +-
.../app/api/controller/member/Account.php | 54 +-
.../api/controller/member/CashOutAccount.php | 92 ++
niucloud/app/api/controller/member/Member.php | 25 +-
.../{MemberWithdraw.php => MemberCashOut.php} | 56 +-
.../app/api/controller/order/Recharge.php | 19 +-
niucloud/app/api/controller/pay/Pay.php | 25 +-
niucloud/app/api/controller/sys/Config.php | 3 +-
niucloud/app/api/controller/sys/Index.php | 2 +-
niucloud/app/api/controller/sys/Scan.php | 2 +-
niucloud/app/api/controller/upload/Upload.php | 12 +-
niucloud/app/api/controller/weapp/Weapp.php | 3 +-
niucloud/app/api/controller/wechat/Serve.php | 2 +-
niucloud/app/api/controller/wechat/Wechat.php | 2 +-
niucloud/app/api/middleware.php | 8 +
.../app/api/middleware/AllowCrossDomain.php | 65 +
niucloud/app/api/middleware/ApiChannel.php | 7 +-
niucloud/app/api/middleware/ApiCheckToken.php | 13 +-
.../app/api/route/dispatch/BindDispatch.php | 3 -
niucloud/app/api/route/member.php | 49 +-
niucloud/app/api/route/order.php | 5 +-
niucloud/app/api/route/pay.php | 8 +-
niucloud/app/api/route/route.php | 2 +
niucloud/app/common.php | 90 +-
niucloud/app/enum/addon/AddonEnum.php | 51 +
.../cash_out/CashOutTypeEnum.php} | 14 +-
niucloud/app/enum/common/ChannelEnum.php | 43 +-
niucloud/app/enum/diy/ComponentBasicsEnum.php | 222 ---
niucloud/app/enum/diy/ComponentEnum.php | 217 +++
niucloud/app/enum/diy/LinkEnum.php | 12 +-
niucloud/app/enum/diy/PageEnum.php | 42 +-
.../enum/install/menu/plugin/admin/plugin.php | 3 -
.../enum/install/menu/plugin/site/plugin.php | 3 -
.../app/enum/install/menu/system/admin.php | 1250 -----------------
.../app/enum/install/menu/system/site.php | 1009 -------------
.../app/enum/member/MemberAccountEnum.php | 103 +-
...WithdrawEnum.php => MemberCashOutEnum.php} | 14 +-
.../MemberEnum.php} | 25 +-
.../member/MemberRegisterChannelEnum.php} | 25 +-
.../enum/member/MemberRegisterTypeEnum.php | 10 +-
niucloud/app/enum/member/fromtypes/system.php | 98 ++
niucloud/app/enum/menu/admin.php | 585 ++++++++
niucloud/app/enum/menu/site.php | 1190 ++++++++++++++++
niucloud/app/enum/notice/NoticeEnum.php | 73 +
.../NoticeTypeEnum.php} | 10 +-
niucloud/app/enum/notice/notice.php | 39 +
niucloud/app/enum/notice/sms.php | 14 +
niucloud/app/enum/notice/weapp.php | 12 +
niucloud/app/enum/notice/wechat.php | 13 +
niucloud/app/enum/order/OrderRefundEnum.php | 52 +
niucloud/app/enum/order/RechargeOrderEnum.php | 36 +
niucloud/app/enum/pay/PayChannelEnum.php | 46 +
niucloud/app/enum/pay/PayEnum.php | 6 +-
niucloud/app/enum/pay/RefundEnum.php | 54 +
niucloud/app/enum/pay/TransferEnum.php | 2 +-
niucloud/app/enum/sys/ConfigKeyEnum.php | 4 +-
niucloud/app/enum/sys/FileEnum.php | 17 +
niucloud/app/enum/sys/MessageEnum.php | 99 --
niucloud/app/event.php | 81 +-
niucloud/app/event/system.php | 44 -
.../app/install/controller/BaseInstall.php | 3 +-
niucloud/app/install/controller/Index.php | 5 +-
niucloud/app/install/source/database.sql | 453 ++++--
niucloud/app/install/view/index/step-1.html | 7 +-
niucloud/app/job/BaseJob.php | 82 --
niucloud/app/job/JobTrait.php | 73 -
.../Message.php => notice/Notice.php} | 32 +-
niucloud/app/job/pay/PayReturnTo.php | 19 +-
niucloud/app/job/sys/Cronexecute.php | 2 +-
niucloud/app/lang/en.php | 12 +-
niucloud/app/lang/en/system/api.php | 153 +-
niucloud/app/lang/en/system/enum.php | 2 +-
niucloud/app/lang/zh-cn.php | 16 +-
niucloud/app/lang/zh-cn/api.php | 191 +++
niucloud/app/lang/zh-cn/{system => }/enum.php | 71 +-
niucloud/app/lang/zh-cn/system/api.php | 169 ---
.../app/lang/zh-cn/{system => }/validate.php | 31 +-
.../job/QueueFailedLoggerListener.php} | 4 +-
...rAccount.php => MemberAccountListener.php} | 2 +-
...emberLogin.php => MemberLoginListener.php} | 2 +-
...egister.php => MemberRegisterListener.php} | 2 +-
niucloud/app/listener/notice/Sms.php | 71 +
niucloud/app/listener/notice/Weapp.php | 84 ++
niucloud/app/listener/notice/Wechat.php | 96 ++
.../notice_template/BaseNoticeTemplate.php | 18 +
.../notice_template/MemberVerifySuccess.php | 32 +
.../notice_template/RechargeSuccess.php | 47 +
.../listener/notice_template/VerifyCode.php | 31 +
.../{PayNotify.php => PayNotifyListener.php} | 2 +-
...{PaySuccess.php => PaySuccessListener.php} | 2 +-
...uccess.php => TransferSuccessListener.php} | 10 +-
.../scan/{Scan.php => ScanListener.php} | 2 +-
.../{AppInit.php => AppInitListener.php} | 5 +-
.../app/listener/system/AppManageListener.php | 52 +
niucloud/app/middleware.php | 2 +-
niucloud/app/model/addon/Addon.php | 65 +
.../addon/AddonLog.php} | 31 +-
niucloud/app/model/article/Article.php | 2 +-
.../app/model/article/ArticleCategory.php | 2 +-
niucloud/app/model/diy/Diy.php | 4 +-
niucloud/app/model/diy/DiyRoute.php | 16 +-
.../app/model/generator/GenerateColumn.php | 2 +-
.../app/model/generator/GenerateTable.php | 2 +-
niucloud/app/model/member/Member.php | 43 +-
.../app/model/member/MemberAccountLog.php | 2 +-
niucloud/app/model/member/MemberAddress.php | 2 +-
.../{MemberWithdraw.php => MemberCashOut.php} | 25 +-
.../app/model/member/MemberCashOutAccount.php | 62 +
niucloud/app/model/member/MemberLabel.php | 2 +-
niucloud/app/model/member/MemberLevel.php | 2 +-
niucloud/app/model/order/Order.php | 5 +-
niucloud/app/model/order/OrderItem.php | 11 +-
niucloud/app/model/order/OrderItemRefund.php | 137 ++
niucloud/app/model/order/OrderLog.php | 2 +-
niucloud/app/model/pay/Pay.php | 2 +-
niucloud/app/model/pay/PayChannel.php | 63 +
niucloud/app/model/pay/Refund.php | 66 +
niucloud/app/model/pay/Transfer.php | 3 +-
niucloud/app/model/site/Site.php | 20 +-
niucloud/app/model/site/SiteGroup.php | 2 +-
niucloud/app/model/sys/SysAgreement.php | 2 +-
niucloud/app/model/sys/SysArea.php | 2 +-
niucloud/app/model/sys/SysAttachment.php | 2 +-
.../app/model/sys/SysAttachmentCategory.php | 2 +-
niucloud/app/model/sys/SysConfig.php | 3 +-
niucloud/app/model/sys/SysCronTask.php | 2 +-
niucloud/app/model/sys/SysMenu.php | 3 +-
.../sys/{SysMessage.php => SysNotice.php} | 6 +-
.../{SysMessageLog.php => SysNoticeLog.php} | 15 +-
...sMessageSmsLog.php => SysNoticeSmsLog.php} | 9 +-
niucloud/app/model/sys/SysRole.php | 2 +-
niucloud/app/model/sys/SysUser.php | 3 +-
niucloud/app/model/sys/SysUserLog.php | 2 +-
niucloud/app/model/sys/SysUserRole.php | 2 +-
niucloud/app/model/wechat/WechatFans.php | 2 +-
niucloud/app/model/wechat/WechatMedia.php | 2 +-
niucloud/app/model/wechat/WechatReply.php | 2 +-
niucloud/app/service/BaseService.php | 134 --
.../app/service/admin/addon/AddonService.php | 100 ++
.../service/admin/addon/TerminalService.php | 341 +++++
.../admin/aliapp/AliappConfigService.php | 3 +-
.../admin/article/ArticleCategoryService.php | 4 +-
.../service/admin/article/ArticleService.php | 4 +-
.../app/service/admin/auth/AuthService.php | 16 +-
.../service/admin/auth/AuthSiteService.php | 2 +-
.../app/service/admin/auth/ConfigService.php | 67 +
.../app/service/admin/auth/LoginService.php | 62 +-
.../service/admin/captcha/CaptchaService.php | 51 +
.../app/service/admin/channel/H5Service.php | 4 +-
.../app/service/admin/cron/CronService.php | 5 +-
.../service/admin/diy/DiyConfigService.php | 2 +-
.../app/service/admin/diy/DiyRouteService.php | 59 +-
niucloud/app/service/admin/diy/DiyService.php | 63 +-
.../admin/file/StorageConfigService.php | 10 +-
.../admin/file/UploadConfigService.php | 4 +-
.../app/service/admin/file/UploadService.php | 67 +-
.../admin/generator/GenerateService.php | 14 +-
.../generator/core/AdminApiRouteGenerator.php | 2 +-
.../generator/core/ControllerGenerator.php | 4 +-
.../admin/generator/core/ModelGenerator.php | 2 +-
.../admin/generator/core/ServiceGenerator.php | 2 +-
.../generator/core/ValidateGenerator.php | 4 +-
.../admin/generator/core/WebApiGenerator.php | 2 +-
.../admin/generator/core/WebEditGenerator.php | 2 +-
.../generator/core/WebEditLangGenerator.php | 2 +-
.../generator/core/WebEditPageGenerator.php | 2 +-
.../generator/core/WebIndexGenerator.php | 2 +-
.../admin/generator/core/WebLangGenerator.php | 2 +-
.../service/admin/generator/vm/controller.vm | 12 +-
.../app/service/admin/generator/vm/model.vm | 2 +-
.../app/service/admin/generator/vm/service.vm | 4 +-
.../app/service/admin/generator/vm/web_api.vm | 2 +-
.../service/admin/generator/vm/web_edit.vm | 2 +-
.../admin/generator/vm/web_edit_page.vm | 2 +-
.../admin/install/InstallArticleService.php | 2 +-
.../admin/install/InstallDiyService.php | 37 +-
.../admin/install/InstallSystemService.php | 46 +-
.../admin/member/MemberAccountService.php | 33 +-
.../member/MemberCashOutConfigService.php | 38 +
...awService.php => MemberCashOutService.php} | 35 +-
.../admin/member/MemberConfigService.php | 13 +-
.../admin/member/MemberLabelService.php | 4 +-
.../service/admin/member/MemberService.php | 42 +-
.../member/MemberWithdrawConfigService.php | 46 -
.../NoticeLogService.php} | 23 +-
.../NoticeService.php} | 49 +-
.../NoticeSmsLogService.php} | 25 +-
.../admin/{message => notice}/SmsService.php | 12 +-
.../RechargeOrderRefundService.php} | 33 +-
.../admin/order/RechargeOrderService.php | 6 +-
.../app/service/admin/order/RefundService.php | 74 +
.../service/admin/pay/PayChannelService.php | 184 +++
.../service/admin/pay/PayConfigService.php | 3 +-
.../service/admin/site/SiteGroupService.php | 8 +-
.../app/service/admin/site/SiteService.php | 115 +-
.../service/admin/site/SiteUserService.php | 12 +-
.../app/service/admin/site/UserLogService.php | 3 +-
.../service/admin/stat/SiteStatService.php | 30 +-
.../app/service/admin/stat/StatService.php | 57 +-
.../service/admin/sys/AgreementService.php | 2 +-
niucloud/app/service/admin/sys/AppService.php | 67 +
.../app/service/admin/sys/AreaService.php | 2 +-
.../service/admin/sys/AttachmentService.php | 18 +-
.../app/service/admin/sys/ConfigService.php | 4 +-
.../app/service/admin/sys/MenuService.php | 12 +-
.../app/service/admin/sys/RoleService.php | 21 +-
.../app/service/admin/sys/SystemService.php | 73 +-
.../service/admin/user/UserRoleService.php | 15 +-
.../app/service/admin/user/UserService.php | 14 +-
.../admin/weapp/WeappConfigService.php | 6 +-
.../admin/weapp/WeappTemplateService.php | 39 +-
.../admin/wechat/WechatConfigService.php | 4 +-
.../admin/wechat/WechatEventService.php | 3 +-
.../admin/wechat/WechatFansService.php | 2 +-
.../admin/wechat/WechatMenuService.php | 7 +-
.../admin/wechat/WechatReplyService.php | 16 +-
.../admin/wechat/WechatTemplateService.php | 41 +-
.../api/agreement/AgreementService.php | 2 +-
.../api/article/ArticleCategoryService.php | 2 +-
.../service/api/article/ArticleService.php | 2 +-
.../service/api/captcha/CaptchaService.php | 10 +-
.../app/service/api/diy/DiyConfigService.php | 2 +-
.../app/service/api/diy/DiyRouteService.php | 23 +-
niucloud/app/service/api/diy/DiyService.php | 2 +-
.../app/service/api/login/AuthService.php | 20 +-
.../app/service/api/login/LoginService.php | 52 +-
.../app/service/api/login/RegisterService.php | 25 +-
.../api/member/MemberAccountService.php | 25 +-
.../member/MemberCashOutAccountService.php | 109 ++
...awService.php => MemberCashOutService.php} | 49 +-
.../api/member/MemberConfigService.php | 2 +-
.../member/MemberLogService.php} | 27 +-
.../app/service/api/member/MemberService.php | 16 +-
.../NoticeService.php} | 12 +-
.../api/order/RechargeOrderService.php | 49 +-
niucloud/app/service/api/pay/PayService.php | 6 +-
niucloud/app/service/api/scan/ScanService.php | 2 +-
.../SiteService.php} | 36 +-
.../app/service/api/sys/ConfigService.php | 5 +-
.../api/{file => upload}/Base64Service.php | 6 +-
.../api/{file => upload}/FetchService.php | 6 +-
.../api/{file => upload}/UploadService.php | 8 +-
.../service/api/weapp/WeappAuthService.php | 18 +-
.../service/api/wechat/WechatAuthService.php | 21 +-
.../service/api/wechat/WechatServeService.php | 2 +-
.../core/addon/CoreAddonBaseService.php | 92 ++
.../core/addon/CoreAddonConfigService.php | 340 +++++
.../core/addon/CoreAddonInstallService.php | 389 +++++
.../core/addon/CoreAddonLogService.php | 46 +
.../service/core/addon/CoreAddonService.php | 155 ++
.../service/core/addon/CoreDependService.php | 184 +++
niucloud/app/service/core/addon/WapTrait.php | 228 +++
.../core/aliapp/CoreAliappConfigService.php | 2 +-
.../core/captcha/CoreCaptchaImgService.php | 104 ++
.../core/captcha/CoreCaptchaService.php | 10 +-
.../service/core/channel/CoreH5Service.php | 9 +-
.../app/service/core/cron/CoreCronService.php | 12 +-
.../service/core/diy/CoreDiyConfigService.php | 2 +-
.../core/member/CoreMemberAccountService.php | 57 +-
.../CoreMemberCashOutAccountService.php | 35 +
.../core/member/CoreMemberCashOutService.php | 277 ++++
.../core/member/CoreMemberConfigService.php | 35 +-
.../core/member/CoreMemberLabelService.php | 2 +-
.../service/core/member/CoreMemberService.php | 26 +-
.../core/member/CoreMemberWithdrawService.php | 255 ----
.../app/service/core/menu/CoreMenuService.php | 147 ++
.../core/message/CoreMessageEventService.php | 249 ----
.../CoreNoticeLogService.php} | 22 +-
.../CoreNoticeService.php} | 74 +-
.../CoreNoticeSmsLogService.php} | 12 +-
.../{message => notice}/CoreSmsService.php | 31 +-
.../app/service/core/notice/NoticeService.php | 53 +
.../core/order/CoreOrderCreateService.php | 4 +-
.../core/order/CoreOrderRefundService.php | 89 ++
.../service/core/order/CoreOrderService.php | 50 +
.../recharge/CoreRechargeOrderService.php | 20 +-
.../recharge/CoreRechargeRefundService.php | 120 ++
.../core/pay/CorePayChannelService.php | 79 ++
.../service/core/pay/CorePayConfigService.php | 6 +-
.../service/core/pay/CorePayEventService.php | 132 +-
.../app/service/core/pay/CorePayService.php | 72 +-
.../service/core/pay/CoreRefundService.php | 98 ++
.../service/core/pay/CoreTransferService.php | 32 +-
.../core/paytype/CoreBalanceService.php | 54 +
.../app/service/core/scan/CoreScanService.php | 19 +-
.../app/service/core/site/CoreSiteService.php | 53 +
.../service/core/sys/CoreAgreementService.php | 10 +-
.../app/service/core/sys/CoreAreaService.php | 2 +-
.../core/sys/CoreAttachmentService.php | 18 +-
.../service/core/sys/CoreConfigService.php | 2 +-
.../service/core/sys/CoreSysConfigService.php | 3 +-
.../{file => upload}/CoreBase64Service.php | 6 +-
.../{file => upload}/CoreFetchService.php | 14 +-
.../core/{file => upload}/CoreFileService.php | 15 +-
.../{file => upload}/CoreStorageService.php | 6 +-
.../CoreUploadConfigService.php | 4 +-
.../{file => upload}/CoreUploadService.php | 98 +-
.../core/weapp/CoreWeappAuthService.php | 2 +-
.../core/weapp/CoreWeappConfigService.php | 2 +-
.../service/core/weapp/CoreWeappService.php | 6 +-
.../core/weapp/CoreWeappTemplateService.php | 2 +-
.../core/wechat/CoreWechatApiService.php | 2 +-
.../core/wechat/CoreWechatConfigService.php | 2 +-
.../core/wechat/CoreWechatFansService.php | 14 +-
.../core/wechat/CoreWechatMessageService.php | 5 +-
.../core/wechat/CoreWechatReplyService.php | 16 +-
.../core/wechat/CoreWechatServeService.php | 3 +-
.../service/core/wechat/CoreWechatService.php | 6 +-
.../core/wechat/CoreWechatTemplateService.php | 2 +-
niucloud/app/tags.php | 39 -
niucloud/app/task/CronTask.php | 42 -
niucloud/app/validate/article/Article.php | 2 +-
.../app/validate/article/ArticleCategory.php | 2 +-
niucloud/app/validate/diy/Diy.php | 2 +-
niucloud/app/validate/diy/DiyRoute.php | 2 +-
niucloud/app/validate/generator/Generator.php | 2 +-
niucloud/app/validate/member/CashOut.php | 55 +
.../app/validate/member/CashOutAccount.php | 48 +
.../{WithdrawConfig.php => CashOutConfig.php} | 16 +-
niucloud/app/validate/member/Member.php | 13 +-
niucloud/app/validate/member/MemberLabel.php | 2 +-
niucloud/app/validate/pay/PayTemplate.php | 86 ++
niucloud/app/validate/site/Site.php | 2 +-
niucloud/app/validate/site/SiteGroup.php | 2 +-
niucloud/app/validate/sys/Agreement.php | 2 +-
.../app/validate/sys/AttachmentCategory.php | 2 +-
niucloud/app/validate/sys/Menu.php | 2 +-
niucloud/app/validate/sys/Role.php | 2 +-
niucloud/app/validate/sys/User.php | 2 +-
niucloud/config/console.php | 2 -
niucloud/config/imgcaptcha.php | 27 +
.../WithdrawTypeEnum.php => config/pay.php} | 27 +-
niucloud/config/queue.php | 6 +-
niucloud/config/sms.php | 32 +
niucloud/config/terminal.php | 44 +
niucloud/config/trace.php | 2 +-
niucloud/config/upload.php | 58 +
416 files changed, 11144 insertions(+), 6180 deletions(-)
delete mode 100644 niucloud/app/BaseController.php
create mode 100644 niucloud/app/adminapi/controller/addon/Addon.php
create mode 100644 niucloud/app/adminapi/controller/addon/App.php
create mode 100644 niucloud/app/adminapi/controller/login/Captcha.php
create mode 100644 niucloud/app/adminapi/controller/login/Config.php
rename niucloud/app/adminapi/controller/member/{Withdraw.php => CashOut.php} (71%)
rename niucloud/app/adminapi/controller/{message/Message.php => notice/Notice.php} (78%)
rename niucloud/app/adminapi/controller/{message/MessageLog.php => notice/NoticeLog.php} (76%)
rename niucloud/app/adminapi/controller/{message => notice}/SmsLog.php (76%)
create mode 100644 niucloud/app/adminapi/controller/order/Refund.php
create mode 100644 niucloud/app/adminapi/controller/pay/PayChannel.php
create mode 100644 niucloud/app/adminapi/controller/sys/App.php
create mode 100644 niucloud/app/adminapi/controller/sys/Terminal.php
create mode 100644 niucloud/app/adminapi/middleware.php
rename niucloud/app/{ => adminapi}/middleware/AllowCrossDomain.php (61%)
create mode 100644 niucloud/app/adminapi/route/addon.php
rename niucloud/app/adminapi/route/{message.php => notice.php} (63%)
create mode 100644 niucloud/app/adminapi/route/refund.php
create mode 100644 niucloud/app/api/controller/member/CashOutAccount.php
rename niucloud/app/api/controller/member/{MemberWithdraw.php => MemberCashOut.php} (52%)
create mode 100644 niucloud/app/api/middleware.php
create mode 100644 niucloud/app/api/middleware/AllowCrossDomain.php
create mode 100644 niucloud/app/enum/addon/AddonEnum.php
rename niucloud/app/{model/BaseModel.php => enum/cash_out/CashOutTypeEnum.php} (80%)
delete mode 100644 niucloud/app/enum/diy/ComponentBasicsEnum.php
create mode 100644 niucloud/app/enum/diy/ComponentEnum.php
delete mode 100644 niucloud/app/enum/install/menu/plugin/admin/plugin.php
delete mode 100644 niucloud/app/enum/install/menu/plugin/site/plugin.php
delete mode 100644 niucloud/app/enum/install/menu/system/admin.php
delete mode 100644 niucloud/app/enum/install/menu/system/site.php
rename niucloud/app/enum/member/{MemberWithdrawEnum.php => MemberCashOutEnum.php} (73%)
rename niucloud/app/enum/{diy/ComponentTypeEnum.php => member/MemberEnum.php} (63%)
rename niucloud/app/{adminapi/controller/BaseAdminController.php => enum/member/MemberRegisterChannelEnum.php} (54%)
create mode 100644 niucloud/app/enum/member/fromtypes/system.php
create mode 100644 niucloud/app/enum/menu/admin.php
create mode 100644 niucloud/app/enum/menu/site.php
create mode 100644 niucloud/app/enum/notice/NoticeEnum.php
rename niucloud/app/enum/{sys/MessageTypeEnum.php => notice/NoticeTypeEnum.php} (75%)
create mode 100644 niucloud/app/enum/notice/notice.php
create mode 100644 niucloud/app/enum/notice/sms.php
create mode 100644 niucloud/app/enum/notice/weapp.php
create mode 100644 niucloud/app/enum/notice/wechat.php
create mode 100644 niucloud/app/enum/order/OrderRefundEnum.php
create mode 100644 niucloud/app/enum/pay/PayChannelEnum.php
create mode 100644 niucloud/app/enum/pay/RefundEnum.php
delete mode 100644 niucloud/app/enum/sys/MessageEnum.php
delete mode 100644 niucloud/app/event/system.php
delete mode 100644 niucloud/app/job/BaseJob.php
delete mode 100644 niucloud/app/job/JobTrait.php
rename niucloud/app/job/{message/Message.php => notice/Notice.php} (50%)
create mode 100644 niucloud/app/lang/zh-cn/api.php
rename niucloud/app/lang/zh-cn/{system => }/enum.php (75%)
delete mode 100644 niucloud/app/lang/zh-cn/system/api.php
rename niucloud/app/lang/zh-cn/{system => }/validate.php (85%)
rename niucloud/app/{behavior/QueueFailedLogger.php => listener/job/QueueFailedLoggerListener.php} (93%)
rename niucloud/app/listener/member/{MemberAccount.php => MemberAccountListener.php} (96%)
rename niucloud/app/listener/member/{MemberLogin.php => MemberLoginListener.php} (97%)
rename niucloud/app/listener/member/{MemberRegister.php => MemberRegisterListener.php} (96%)
create mode 100644 niucloud/app/listener/notice/Sms.php
create mode 100644 niucloud/app/listener/notice/Weapp.php
create mode 100644 niucloud/app/listener/notice/Wechat.php
create mode 100644 niucloud/app/listener/notice_template/BaseNoticeTemplate.php
create mode 100644 niucloud/app/listener/notice_template/MemberVerifySuccess.php
create mode 100644 niucloud/app/listener/notice_template/RechargeSuccess.php
create mode 100644 niucloud/app/listener/notice_template/VerifyCode.php
rename niucloud/app/listener/pay/{PayNotify.php => PayNotifyListener.php} (96%)
rename niucloud/app/listener/pay/{PaySuccess.php => PaySuccessListener.php} (97%)
rename niucloud/app/listener/pay/{TransferSuccess.php => TransferSuccessListener.php} (71%)
rename niucloud/app/listener/scan/{Scan.php => ScanListener.php} (98%)
rename niucloud/app/listener/system/{AppInit.php => AppInitListener.php} (89%)
create mode 100644 niucloud/app/listener/system/AppManageListener.php
create mode 100644 niucloud/app/model/addon/Addon.php
rename niucloud/app/{api/controller/BaseApiController.php => model/addon/AddonLog.php} (67%)
rename niucloud/app/model/member/{MemberWithdraw.php => MemberCashOut.php} (86%)
create mode 100644 niucloud/app/model/member/MemberCashOutAccount.php
create mode 100644 niucloud/app/model/order/OrderItemRefund.php
create mode 100644 niucloud/app/model/pay/PayChannel.php
create mode 100644 niucloud/app/model/pay/Refund.php
rename niucloud/app/model/sys/{SysMessage.php => SysNotice.php} (89%)
rename niucloud/app/model/sys/{SysMessageLog.php => SysNoticeLog.php} (88%)
rename niucloud/app/model/sys/{SysMessageSmsLog.php => SysNoticeSmsLog.php} (92%)
delete mode 100644 niucloud/app/service/BaseService.php
create mode 100644 niucloud/app/service/admin/addon/AddonService.php
create mode 100644 niucloud/app/service/admin/addon/TerminalService.php
create mode 100644 niucloud/app/service/admin/auth/ConfigService.php
create mode 100644 niucloud/app/service/admin/captcha/CaptchaService.php
create mode 100644 niucloud/app/service/admin/member/MemberCashOutConfigService.php
rename niucloud/app/service/admin/member/{MemberWithdrawService.php => MemberCashOutService.php} (52%)
delete mode 100644 niucloud/app/service/admin/member/MemberWithdrawConfigService.php
rename niucloud/app/service/admin/{message/MessageLogService.php => notice/NoticeLogService.php} (60%)
rename niucloud/app/service/admin/{message/MessageService.php => notice/NoticeService.php} (57%)
rename niucloud/app/service/admin/{message/MessageSmsLogService.php => notice/NoticeSmsLogService.php} (56%)
rename niucloud/app/service/admin/{message => notice}/SmsService.php (94%)
rename niucloud/app/service/admin/{BaseAdminService.php => order/RechargeOrderRefundService.php} (56%)
create mode 100644 niucloud/app/service/admin/order/RefundService.php
create mode 100644 niucloud/app/service/admin/pay/PayChannelService.php
create mode 100644 niucloud/app/service/admin/sys/AppService.php
create mode 100644 niucloud/app/service/api/member/MemberCashOutAccountService.php
rename niucloud/app/service/api/member/{MemberWithdrawService.php => MemberCashOutService.php} (53%)
rename niucloud/app/service/{core/BaseCoreService.php => api/member/MemberLogService.php} (62%)
rename niucloud/app/service/api/{message/MessageService.php => notice/NoticeService.php} (73%)
rename niucloud/app/service/api/{BaseApiService.php => site/SiteService.php} (56%)
rename niucloud/app/service/api/{file => upload}/Base64Service.php (90%)
rename niucloud/app/service/api/{file => upload}/FetchService.php (90%)
rename niucloud/app/service/api/{file => upload}/UploadService.php (93%)
create mode 100644 niucloud/app/service/core/addon/CoreAddonBaseService.php
create mode 100644 niucloud/app/service/core/addon/CoreAddonConfigService.php
create mode 100644 niucloud/app/service/core/addon/CoreAddonInstallService.php
create mode 100644 niucloud/app/service/core/addon/CoreAddonLogService.php
create mode 100644 niucloud/app/service/core/addon/CoreAddonService.php
create mode 100644 niucloud/app/service/core/addon/CoreDependService.php
create mode 100644 niucloud/app/service/core/addon/WapTrait.php
create mode 100644 niucloud/app/service/core/captcha/CoreCaptchaImgService.php
create mode 100644 niucloud/app/service/core/member/CoreMemberCashOutAccountService.php
create mode 100644 niucloud/app/service/core/member/CoreMemberCashOutService.php
delete mode 100644 niucloud/app/service/core/member/CoreMemberWithdrawService.php
create mode 100644 niucloud/app/service/core/menu/CoreMenuService.php
delete mode 100644 niucloud/app/service/core/message/CoreMessageEventService.php
rename niucloud/app/service/core/{message/CoreMessageLogService.php => notice/CoreNoticeLogService.php} (66%)
rename niucloud/app/service/core/{message/CoreMessageService.php => notice/CoreNoticeService.php} (63%)
rename niucloud/app/service/core/{message/CoreMessageSmsLogService.php => notice/CoreNoticeSmsLogService.php} (90%)
rename niucloud/app/service/core/{message => notice}/CoreSmsService.php (78%)
create mode 100644 niucloud/app/service/core/notice/NoticeService.php
create mode 100644 niucloud/app/service/core/order/CoreOrderRefundService.php
create mode 100644 niucloud/app/service/core/order/CoreOrderService.php
create mode 100644 niucloud/app/service/core/order/recharge/CoreRechargeRefundService.php
create mode 100644 niucloud/app/service/core/pay/CorePayChannelService.php
create mode 100644 niucloud/app/service/core/pay/CoreRefundService.php
create mode 100644 niucloud/app/service/core/paytype/CoreBalanceService.php
create mode 100644 niucloud/app/service/core/site/CoreSiteService.php
rename niucloud/app/service/core/{file => upload}/CoreBase64Service.php (90%)
rename niucloud/app/service/core/{file => upload}/CoreFetchService.php (86%)
rename niucloud/app/service/core/{file => upload}/CoreFileService.php (87%)
rename niucloud/app/service/core/{file => upload}/CoreStorageService.php (94%)
rename niucloud/app/service/core/{file => upload}/CoreUploadConfigService.php (96%)
rename niucloud/app/service/core/{file => upload}/CoreUploadService.php (53%)
delete mode 100644 niucloud/app/tags.php
delete mode 100644 niucloud/app/task/CronTask.php
create mode 100644 niucloud/app/validate/member/CashOut.php
create mode 100644 niucloud/app/validate/member/CashOutAccount.php
rename niucloud/app/validate/member/{WithdrawConfig.php => CashOutConfig.php} (72%)
create mode 100644 niucloud/app/validate/pay/PayTemplate.php
create mode 100644 niucloud/config/imgcaptcha.php
rename niucloud/{app/enum/withdraw/WithdrawTypeEnum.php => config/pay.php} (73%)
create mode 100644 niucloud/config/sms.php
create mode 100644 niucloud/config/terminal.php
create mode 100644 niucloud/config/upload.php
diff --git a/niucloud/app/BaseController.php b/niucloud/app/BaseController.php
deleted file mode 100644
index d704ef5f9..000000000
--- a/niucloud/app/BaseController.php
+++ /dev/null
@@ -1,96 +0,0 @@
-app = $app;
- $this->request = $this->app->request;
- // 控制器初始化
- $this->initialize();
- }
-
- // 初始化
- protected function initialize()
- {}
-
- /**
- * 验证数据
- * @access protected
- * @param array $data 数据
- * @param string|array $validate 验证器名或者验证规则数组
- * @param array $message 提示信息
- * @param bool $batch 是否批量验证
- * @return array|string|true
- * @throws ValidateException
- */
- protected function validate(array $data, $validate, array $message = [], bool $batch = false)
- {
- if (is_array($validate)) {
- $v = new Validate();
- $v->rule($validate);
- } else {
- if (strpos($validate, '.')) {
- // 支持场景
- [$validate, $scene] = explode('.', $validate);
- }
- $class = str_contains($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
- $v = new $class();
- if (!empty($scene)) {
- $v->scene($scene);
- }
- }
-
- $v->message($message);
-
- // 是否批量验证
- if ($batch || $this->batchValidate) {
- $v->batch(true);
- }
-
- return $v->failException(true)->check($data);
- }
-
-
-
-
-}
diff --git a/niucloud/app/ExceptionHandle.php b/niucloud/app/ExceptionHandle.php
index 2b765d1bf..a7a9337db 100644
--- a/niucloud/app/ExceptionHandle.php
+++ b/niucloud/app/ExceptionHandle.php
@@ -2,8 +2,8 @@
namespace app;
use app\enum\sys\AppTypeEnum;
-use extend\exception\AdminException;
-use extend\exception\AuthException;
+use core\exception\AdminException;
+use core\exception\AuthException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
@@ -90,7 +90,13 @@ class ExceptionHandle extends Handle
// 添加自定义异常处理机制
if ($e instanceof DbException) {
- return fail('数据获取失败', $massageData);
+ return fail('DATA_GET_FAIL', [
+ 'file' => $e->getFile(),
+ 'line' => $e->getLine(),
+ 'message' => $e->getMessage(),
+ 'trace' => $e->getTrace(),
+ 'previous' => $e->getPrevious(),
+ ]);
} elseif ($e instanceof ValidateException) {
return fail($e->getMessage(), []);
} else if($e instanceof UnexpectedValueException){
diff --git a/niucloud/app/adminapi/controller/addon/Addon.php b/niucloud/app/adminapi/controller/addon/Addon.php
new file mode 100644
index 000000000..48a61b8dc
--- /dev/null
+++ b/niucloud/app/adminapi/controller/addon/Addon.php
@@ -0,0 +1,94 @@
+getLocalAddonList());
+ }
+
+ /**
+ * 安装插件
+ * @param string $addon
+ */
+ public function install($addon)
+ {
+ ( new AddonService() )->install($addon);
+ return success('ADDON_INSTALL_SUCCESS');
+ }
+
+ /**
+ * 查询插件安装状态
+ * @param $addon
+ */
+ public function getInstallState($addon)
+ {
+ return success(( new AddonService() )->getInstallState($addon));
+ }
+
+ /**
+ * 卸载插件
+ * @param string $addon
+ */
+ public function uninstall($addon)
+ {
+ ( new AddonService() )->uninstall($addon);
+ return success('ADDON_UNINSTALL_SUCCESS');
+ }
+
+ /**
+ * 插件列表
+ * @return Response
+ */
+ public function lists()
+ {
+ $data = $this->request->params([
+ [ 'title', '' ],
+ ]);
+ return success(( new AddonService() )->getPage($data));
+ }
+
+ /**
+ * 插件详情
+ * @param int $id
+ */
+ public function info(int $id)
+ {
+ return success(( new AddonService() )->getInfo($id));
+ }
+
+ /**
+ * 设置插件状态
+ * @param int $id
+ * @param int $status
+ * @return Response
+ */
+ public function setStatus(int $id, int $status)
+ {
+ ( new AddonService() )->setStatus($id, $status);
+ return success('SET_SUCCESS');
+ }
+
+
+}
diff --git a/niucloud/app/adminapi/controller/addon/App.php b/niucloud/app/adminapi/controller/addon/App.php
new file mode 100644
index 000000000..6e98f6190
--- /dev/null
+++ b/niucloud/app/adminapi/controller/addon/App.php
@@ -0,0 +1,31 @@
+getAppList());
+ }
+
+
+
+}
diff --git a/niucloud/app/adminapi/controller/aliapp/Config.php b/niucloud/app/adminapi/controller/aliapp/Config.php
index 53049bc46..494c1b3a3 100644
--- a/niucloud/app/adminapi/controller/aliapp/Config.php
+++ b/niucloud/app/adminapi/controller/aliapp/Config.php
@@ -11,9 +11,9 @@
namespace app\adminapi\controller\aliapp;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\aliapp\AliappConfigService;
use app\service\admin\site\WebSiteConfigService;
+use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
@@ -43,7 +43,7 @@ class Config extends BaseAdminController
]);
// $this->validate($data, 'app\validate\channel\Aliapp.set');
(new AliappConfigService())->setAliappConfig($data);
- return success(100016);
+ return success('SET_SUCCESS');
}
/**
diff --git a/niucloud/app/adminapi/controller/article/Article.php b/niucloud/app/adminapi/controller/article/Article.php
index 7382d29f5..b0b532a43 100644
--- a/niucloud/app/adminapi/controller/article/Article.php
+++ b/niucloud/app/adminapi/controller/article/Article.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\article;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\article\ArticleService;
+use core\base\BaseAdminController;
use think\Response;
/**
@@ -66,7 +66,7 @@ class Article extends BaseAdminController
]);
$this->validate($data, 'app\validate\article\Article.add');
$id = ( new ArticleService() )->add($data);
- return success(100011, [ 'id' => $id ]);
+ return success('ADD_SUCCESS', [ 'id' => $id ]);
}
/**
@@ -74,7 +74,7 @@ class Article extends BaseAdminController
* @param int $id
* @return Response
*/
- public function update(int $id)
+ public function edit(int $id)
{
$data = $this->request->params([
[ 'title', '' ],
@@ -88,9 +88,9 @@ class Article extends BaseAdminController
[ 'is_show', 1 ],
[ 'sort', 0 ],
]);
- $this->validate($data, 'app\validate\article\Article.update');
- ( new ArticleService() )->update($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\article\Article.edit');
+ ( new ArticleService() )->edit($id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -101,7 +101,7 @@ class Article extends BaseAdminController
{
( new ArticleService() )->del($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
diff --git a/niucloud/app/adminapi/controller/article/ArticleCategory.php b/niucloud/app/adminapi/controller/article/ArticleCategory.php
index eb6481265..ac5c16519 100644
--- a/niucloud/app/adminapi/controller/article/ArticleCategory.php
+++ b/niucloud/app/adminapi/controller/article/ArticleCategory.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\article;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\article\ArticleCategoryService;
+use core\base\BaseAdminController;
use think\Response;
class ArticleCategory extends BaseAdminController
@@ -56,7 +56,7 @@ class ArticleCategory extends BaseAdminController
]);
$this->validate($data, 'app\validate\article\ArticleCategory.add');
$id = (new ArticleCategoryService())->add($data);
- return success(100011, ['id' => $id]);
+ return success('ADD_SUCCESS', ['id' => $id]);
}
/**
@@ -64,15 +64,15 @@ class ArticleCategory extends BaseAdminController
* @param int $category_id //分类id
* @return Response
*/
- public function update(int $category_id){
+ public function edit(int $category_id){
$data = $this->request->params([
['name', ''],
['is_show', 1],
['sort', 0],
]);
- $this->validate($data, 'app\validate\article\ArticleCategory.update');
- (new ArticleCategoryService())->update($category_id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\article\ArticleCategory.edit');
+ (new ArticleCategoryService())->edit($category_id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -81,7 +81,7 @@ class ArticleCategory extends BaseAdminController
*/
public function del(int $category_id){
(new ArticleCategoryService())->del($category_id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/auth/Auth.php b/niucloud/app/adminapi/controller/auth/Auth.php
index 3d9d75c74..acc3adc96 100644
--- a/niucloud/app/adminapi/controller/auth/Auth.php
+++ b/niucloud/app/adminapi/controller/auth/Auth.php
@@ -11,10 +11,9 @@
namespace app\adminapi\controller\auth;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\auth\AuthService;
use app\service\admin\auth\AuthSiteService;
-use app\service\admin\site\SiteUserService;
+use core\base\BaseAdminController;
class Auth extends BaseAdminController
@@ -48,23 +47,22 @@ class Auth extends BaseAdminController
]);
// $this->validate($data, 'app\validate\sys\User.modify');
(new AuthService())->modifyAuth($field, $data['value']);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
/**
* 更新用户
*/
- public function update(){
+ public function edit(){
$data = $this->request->params([
['real_name', ''],
['head_img', ''],
['password', ''],
['original_password', '']
]);
-// $this->validate($data, 'app\validate\sys\User.update');
- (new AuthService())->updateAuth($data);
- return success(100004);
+ (new AuthService())->editAuth($data);
+ return success('MODIFY_SUCCESS');
}
/**
diff --git a/niucloud/app/adminapi/controller/channel/H5.php b/niucloud/app/adminapi/controller/channel/H5.php
index d440d25dd..c047a08d4 100644
--- a/niucloud/app/adminapi/controller/channel/H5.php
+++ b/niucloud/app/adminapi/controller/channel/H5.php
@@ -11,11 +11,9 @@
namespace app\adminapi\controller\channel;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\channel\H5Service;
-use app\service\admin\file\UploadService;
use app\service\admin\site\WebSiteConfigService;
-use app\service\admin\wechat\WechatConfigService;
+use core\base\BaseAdminController;
use think\Response;
class H5 extends BaseAdminController
@@ -38,6 +36,6 @@ class H5 extends BaseAdminController
]);
(new H5Service())->setH5($data);
- return success(100016);
+ return success('SET_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/diy/Config.php b/niucloud/app/adminapi/controller/diy/Config.php
index c949133a1..7f568e7a4 100644
--- a/niucloud/app/adminapi/controller/diy/Config.php
+++ b/niucloud/app/adminapi/controller/diy/Config.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\diy;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\diy\DiyConfigService;
+use core\base\BaseAdminController;
/**
@@ -41,7 +41,7 @@ class Config extends BaseAdminController
[ 'menu', [] ]
]);
( new DiyConfigService() )->setBottomConfig($data[ 'menu' ]);
- return success(100000);
+ return success('SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/diy/Diy.php b/niucloud/app/adminapi/controller/diy/Diy.php
index 67879d92d..dd2597776 100644
--- a/niucloud/app/adminapi/controller/diy/Diy.php
+++ b/niucloud/app/adminapi/controller/diy/Diy.php
@@ -11,10 +11,9 @@
namespace app\adminapi\controller\diy;
-use app\adminapi\controller\BaseAdminController;
-use app\enum\diy\LinkEnum;
use app\enum\diy\PageEnum;
use app\service\admin\diy\DiyService;
+use core\base\BaseAdminController;
/**
@@ -63,7 +62,7 @@ class Diy extends BaseAdminController
$this->validate($data, 'app\validate\diy\Diy.add');
$id = ( new DiyService() )->add($data);
- return success(100011, [ 'id' => $id ]);
+ return success('ADD_SUCCESS', [ 'id' => $id ]);
}
/**
@@ -71,16 +70,16 @@ class Diy extends BaseAdminController
* @param $id 自定义页面id
* @return \think\Response
*/
- public function update($id)
+ public function edit($id)
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "value", "" ],
]);
- $this->validate($data, 'app\validate\diy\Diy.update');
- ( new DiyService() )->update($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\diy\Diy.edit');
+ ( new DiyService() )->edit($id, $data);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -91,7 +90,7 @@ class Diy extends BaseAdminController
public function del(int $id)
{
( new DiyService() )->del($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
@@ -103,7 +102,7 @@ class Diy extends BaseAdminController
public function setUse($id)
{
( new DiyService() )->setUse($id);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -155,7 +154,7 @@ class Diy extends BaseAdminController
[ "share", "" ],
]);
( new DiyService() )->modifyShare($id, $data);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/diy/DiyRoute.php b/niucloud/app/adminapi/controller/diy/DiyRoute.php
index 2861899b1..c718f4cf4 100644
--- a/niucloud/app/adminapi/controller/diy/DiyRoute.php
+++ b/niucloud/app/adminapi/controller/diy/DiyRoute.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\diy;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\diy\DiyRouteService;
+use core\base\BaseAdminController;
/**
@@ -30,11 +30,8 @@ class DiyRoute extends BaseAdminController
{
$data = $this->request->params([
[ "title", "" ],
- [ "name", "" ],
- [ "page", "" ],
- [ "sort", "" ]
]);
- return success(( new DiyRouteService() )->getPage($data));
+ return success(( new DiyRouteService() )->getList($data));
}
/**
@@ -47,6 +44,15 @@ class DiyRoute extends BaseAdminController
return success(( new DiyRouteService() )->getInfo($id));
}
+ /**
+ * 自定义路由表详情
+ * @param string $name
+ */
+ public function getInfoByName(string $name)
+ {
+ return success(( new DiyRouteService() )->getInfoByName($name));
+ }
+
/**
* 添加自定义路由表
* @return \think\Response
@@ -62,7 +68,7 @@ class DiyRoute extends BaseAdminController
]);
$this->validate($data, 'app\validate\diy\DiyRoute.add');
$id = ( new DiyRouteService() )->add($data);
- return success(100011, [ 'id' => $id ]);
+ return success('ADD_SUCCESS', [ 'id' => $id ]);
}
/**
@@ -70,7 +76,7 @@ class DiyRoute extends BaseAdminController
* @param $id 自定义路由表id
* @return \think\Response
*/
- public function update($id)
+ public function edit($id)
{
$data = $this->request->params([
[ "title", "" ],
@@ -79,9 +85,9 @@ class DiyRoute extends BaseAdminController
[ "share", "" ],
[ "is_share", "" ]
]);
- $this->validate($data, 'app\validate\diy\DiyRoute.update');
- ( new DiyRouteService() )->update($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\diy\DiyRoute.edit');
+ ( new DiyRouteService() )->edit($id, $data);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -92,20 +98,24 @@ class DiyRoute extends BaseAdminController
public function del(int $id)
{
( new DiyRouteService() )->del($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
* 修改页面分享内容
- * @param int $id
*/
- public function modifyShare(int $id)
+ public function modifyShare()
{
$data = $this->request->params([
- [ "share", "" ],
+ [ 'share', '' ],
+ [ 'title', '' ],
+ [ 'name', '' ],
+ [ 'page', '' ],
+ [ 'is_share', 0 ],
+ [ 'sort', 0 ]
]);
- ( new DiyRouteService() )->modifyShare($id, $data);
- return success(100004);
+ ( new DiyRouteService() )->modifyShare($data);
+ return success('MODIFY_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/generator/Generator.php b/niucloud/app/adminapi/controller/generator/Generator.php
index 782da50d6..de406e92a 100644
--- a/niucloud/app/adminapi/controller/generator/Generator.php
+++ b/niucloud/app/adminapi/controller/generator/Generator.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\generator;
-use app\BaseController;
use app\service\admin\generator\GenerateService;
+use core\base\BaseController;
use think\Response;
/**
@@ -55,9 +55,9 @@ class Generator extends BaseController
$data = $this->request->params([
[ "table_name", "" ],
], false);
- $this->validate($data, 'app\validate\generator\Generator.add');
+ $this->validate($data, 'app\validate\generator\generator.add');
$id = ( new GenerateService() )->add($data);
- return success(100011, [ 'id' => $id ]);
+ return success('ADD_SUCCESS', [ 'id' => $id ]);
}
/**
@@ -65,7 +65,7 @@ class Generator extends BaseController
* @param $id
* @return Response
*/
- public function update($id)
+ public function edit($id)
{
$data = $this->request->params([
[ "table_name", "" ],
@@ -75,9 +75,9 @@ class Generator extends BaseController
[ "edit_type", "1" ],
[ "table_column", "" ],
], false);
- $this->validate($data, 'app\validate\generator\Generator.update');
- ( new GenerateService() )->update($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\generator\generator.edit');
+ ( new GenerateService() )->edit($id, $data);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -88,7 +88,7 @@ class Generator extends BaseController
public function del(int $id)
{
( new GenerateService() )->del($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
@@ -102,7 +102,7 @@ class Generator extends BaseController
]);
$data = ( new GenerateService() )->generate($data);
- return success(100011, $data);
+ return success('ADD_SUCCESS', $data);
}
/**
@@ -116,7 +116,7 @@ class Generator extends BaseController
[ "comment", "" ],
]);
$list = ( new GenerateService() )->tableList($data);
- return success(100011, $list);
+ return success('ADD_SUCCESS', $list);
}
}
diff --git a/niucloud/app/adminapi/controller/login/Captcha.php b/niucloud/app/adminapi/controller/login/Captcha.php
new file mode 100644
index 000000000..bffc104da
--- /dev/null
+++ b/niucloud/app/adminapi/controller/login/Captcha.php
@@ -0,0 +1,46 @@
+create());
+ }
+
+ /**
+ * 一次校验验证码
+ * @return Response
+ */
+ public function check(){
+ return success((new CaptchaService())->check());
+ }
+
+ /**
+ * 二次校验验证码
+ * @return Response
+ */
+ public function verification(){
+ return success((new CaptchaService())->verification());
+ }
+
+}
diff --git a/niucloud/app/adminapi/controller/login/Config.php b/niucloud/app/adminapi/controller/login/Config.php
new file mode 100644
index 000000000..615a461d2
--- /dev/null
+++ b/niucloud/app/adminapi/controller/login/Config.php
@@ -0,0 +1,46 @@
+getConfig());
+ }
+
+ /**
+ * 注册与登录设置
+ * @return Response
+ */
+ public function setConfig()
+ {
+ $data = $this->request->params([
+ [ 'is_captcha', 0 ],
+ [ 'is_site_captcha', 0 ],
+ [ 'bg', '' ],
+ [ 'site_bg', '' ],
+ ]);
+ ( new ConfigService() )->setConfig($data);
+ return success('MODIFY_SUCCESS');
+ }
+}
diff --git a/niucloud/app/adminapi/controller/login/Login.php b/niucloud/app/adminapi/controller/login/Login.php
index bab5903b4..1aa47a756 100644
--- a/niucloud/app/adminapi/controller/login/Login.php
+++ b/niucloud/app/adminapi/controller/login/Login.php
@@ -11,8 +11,9 @@
namespace app\adminapi\controller\login;
-use app\adminapi\controller\BaseAdminController;
+use app\service\admin\auth\ConfigService;
use app\service\admin\auth\LoginService;
+use core\base\BaseAdminController;
use think\Response;
class Login extends BaseAdminController
@@ -21,7 +22,7 @@ class Login extends BaseAdminController
* 登录
* @return Response
*/
- public function login()
+ public function login($app_type)
{
$data = $this->request->params([
@@ -30,10 +31,10 @@ class Login extends BaseAdminController
]);
//参数验证
//验证码验证
- $result = ( new LoginService() )->login($data[ 'username' ], $data[ 'password' ]);
+ $result = ( new LoginService() )->login($data[ 'username' ], $data[ 'password' ], $app_type);
if (!$result) {
//账号密码错误...., 重置验证码
- return fail(101005);
+ return fail('USER_ERROR');
}
return success($result);
@@ -46,7 +47,17 @@ class Login extends BaseAdminController
public function logout()
{
( new LoginService )->logout();
- return success(102008);
+ return success('LOGOUT');
}
+
+
+ /**
+ * 获取登录设置
+ * @return Response
+ */
+ public function getConfig()
+ {
+ return success(( new ConfigService() )->getConfig());
+ }
}
diff --git a/niucloud/app/adminapi/controller/member/Account.php b/niucloud/app/adminapi/controller/member/Account.php
index 3ce830c11..bff428abd 100644
--- a/niucloud/app/adminapi/controller/member/Account.php
+++ b/niucloud/app/adminapi/controller/member/Account.php
@@ -11,8 +11,9 @@
namespace app\adminapi\controller\member;
-use app\adminapi\controller\BaseAdminController;
+use app\enum\member\MemberAccountEnum;
use app\service\admin\member\MemberAccountService;
+use core\base\BaseAdminController;
use think\Response;
class Account extends BaseAdminController
@@ -48,7 +49,7 @@ class Account extends BaseAdminController
}
/**
- * 零钱流水
+ * 可提现余额流水
* @return Response
*/
public function money()
@@ -73,7 +74,7 @@ class Account extends BaseAdminController
[ 'memo', '' ],
]);
$res = ( new MemberAccountService() )->adjustPoint($data);
- return success(100011, [ 'id' => $res ]);
+ return success('ADD_SUCCESS', [ 'id' => $res ]);
}
/**
@@ -87,7 +88,59 @@ class Account extends BaseAdminController
[ 'memo', '' ],
]);
$res = ( new MemberAccountService() )->adjustBalance($data);
- return success(100011, [ 'id' => $res ]);
+ return success('ADD_SUCCESS', [ 'id' => $res ]);
+ }
+
+ /**
+ * 零钱调整
+ * @return Response
+ */
+ public function adjustMoney()
+ {
+ $data = $this->request->params([
+ [ 'member_id', '' ],
+ [ 'account_data', 0 ],
+ [ 'memo', '' ],
+ ]);
+ $res = ( new MemberAccountService() )->adjustMoney($data);
+ return success('ADD_SUCCESS', [ 'id' => $res ]);
+ }
+
+ /**
+ * 会员佣金
+ * @return Response
+ */
+ public function commission()
+ {
+ $data = $this->request->params([
+ [ 'member_id', '' ],
+ [ 'from_type', '' ],
+ [ 'create_time', [] ],
+ ]);
+ $data[ 'account_type' ] = 'commission';
+ return success(( new MemberAccountService() )->getPage($data));
+ }
+
+ /**
+ * 会员余额统计(用于会员账户统计窗口)
+ */
+ public function sumBalance()
+ {
+ $data = $this->request->params([
+ [ 'member_id', '' ],
+ ]);
+ $member_account_service = new MemberAccountService();
+ if(empty($data['member_id']))
+ {
+
+ $balance_data = [
+ MemberAccountEnum::BALANCE => $member_account_service->getSumAccount(MemberAccountEnum::BALANCE),
+ MemberAccountEnum::MONEY => $member_account_service->getSumAccount(MemberAccountEnum::MONEY),
+ ];
+ return success($balance_data);
+ }else{
+ return success($member_account_service->getMemberAccountInfo($data['member_id']));
+ }
}
/**
@@ -100,5 +153,13 @@ class Account extends BaseAdminController
return success($res);
}
+ /**
+ * 账户类型
+ */
+ public function accountType()
+ {
+ return success(MemberAccountEnum::getType());
+ }
+
}
diff --git a/niucloud/app/adminapi/controller/member/Withdraw.php b/niucloud/app/adminapi/controller/member/CashOut.php
similarity index 71%
rename from niucloud/app/adminapi/controller/member/Withdraw.php
rename to niucloud/app/adminapi/controller/member/CashOut.php
index 5bc10f105..c0272185e 100644
--- a/niucloud/app/adminapi/controller/member/Withdraw.php
+++ b/niucloud/app/adminapi/controller/member/CashOut.php
@@ -11,12 +11,13 @@
namespace app\adminapi\controller\member;
-use app\adminapi\controller\BaseAdminController;
+use app\enum\member\MemberCashOutEnum;
use app\enum\pay\TransferEnum;
-use app\service\admin\member\MemberWithdrawService;
+use app\service\admin\member\MemberCashOutService;
+use core\base\BaseAdminController;
use think\Response;
-class Withdraw extends BaseAdminController
+class CashOut extends BaseAdminController
{
/**
* 提现列表
@@ -29,7 +30,7 @@ class Withdraw extends BaseAdminController
['status', ''],
['create_time', []],
]);
- return success((new MemberWithdrawService())->getPage($data));
+ return success((new MemberCashOutService())->getPage($data));
}
/**
@@ -39,7 +40,7 @@ class Withdraw extends BaseAdminController
*/
public function info(int $id)
{
- return success((new MemberWithdrawService())->getInfo($id));
+ return success((new MemberCashOutService())->getInfo($id));
}
public function audit($id, $action)
@@ -47,8 +48,8 @@ class Withdraw extends BaseAdminController
$data = $this->request->params([
['refuse_reason', ''],
]);
- (new MemberWithdrawService())->audit($id, $action, $data);
- return success(100000);
+ (new MemberCashOutService())->audit($id, $action, $data);
+ return success('SUCCESS');
}
/**
@@ -72,8 +73,15 @@ class Withdraw extends BaseAdminController
['transfer_remark', ''],
['transfer_type', '']
]);
- (new MemberWithdrawService())->transfer($id, $data);
- return success(100000);
+ (new MemberCashOutService())->transfer($id, $data);
+ return success('SUCCESS');
}
+ /**
+ * 状态
+ * @return Response
+ */
+ public function getStatusList(){
+ return success(MemberCashOutEnum::getStatus());
+ }
}
diff --git a/niucloud/app/adminapi/controller/member/Config.php b/niucloud/app/adminapi/controller/member/Config.php
index 559997486..736d660c1 100644
--- a/niucloud/app/adminapi/controller/member/Config.php
+++ b/niucloud/app/adminapi/controller/member/Config.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\member;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\member\MemberConfigService;
+use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
@@ -40,23 +40,23 @@ class Config extends BaseAdminController
]);
$this->validate($data, 'app\validate\member\LoginConfig.set');
( new MemberConfigService() )->setLoginConfig($data);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
/**
* 获取提现设置
* @return Response
*/
- public function getWithdrawConfig()
+ public function getCashOutConfig()
{
- return success(( new MemberConfigService() )->getWithdrawConfig());
+ return success(( new MemberConfigService() )->getCashOutConfig());
}
/**
* 提现设置
* @return Response
*/
- public function setWithdrawConfig()
+ public function setCashOutConfig()
{
$data = $this->request->params([
[ 'is_open', 0 ], //是否开启
@@ -66,9 +66,9 @@ class Config extends BaseAdminController
[ 'is_auto_transfer', 0 ], //是否自动转账
[ 'transfer_type', [] ] //转账方式
]);
- $this->validate($data, 'app\validate\member\WithdrawConfig.set');
- ( new MemberConfigService() )->setWithdrawConfig($data);
- return success(100016);
+ $this->validate($data, 'app\validate\member\CashOutConfig.set');
+ ( new MemberConfigService() )->setCashOutConfig($data);
+ return success('SET_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/member/Member.php b/niucloud/app/adminapi/controller/member/Member.php
index 60b8f8e05..fd3bca923 100644
--- a/niucloud/app/adminapi/controller/member/Member.php
+++ b/niucloud/app/adminapi/controller/member/Member.php
@@ -11,9 +11,11 @@
namespace app\adminapi\controller\member;
-use app\adminapi\controller\BaseAdminController;
+use app\enum\member\MemberEnum;
+use app\enum\member\MemberRegisterChannelEnum;
use app\enum\member\MemberRegisterTypeEnum;
use app\service\admin\member\MemberService;
+use core\base\BaseAdminController;
use think\Response;
class Member extends BaseAdminController
@@ -25,12 +27,13 @@ class Member extends BaseAdminController
public function lists()
{
$data = $this->request->params([
- [ 'keyword', '' ],
- [ 'register_type', '' ],
- [ 'create_time', [] ],
- [ 'member_label', 0 ],
+ ['keyword', ''],
+ ['register_type', ''],
+ ['register_channel', ''],
+ ['create_time', []],
+ ['member_label', 0],
]);
- return success(( new MemberService() )->getPage($data));
+ return success((new MemberService())->getPage($data));
}
/**
@@ -40,7 +43,7 @@ class Member extends BaseAdminController
*/
public function info(int $id)
{
- return success(( new MemberService() )->getInfo($id));
+ return success((new MemberService())->getInfo($id));
}
/**
@@ -50,18 +53,18 @@ class Member extends BaseAdminController
public function add()
{
$data = $this->request->params([
- [ 'nickname', '' ],
- [ 'mobile', '' ],
- [ 'username', '' ],
- [ 'password', '' ],
- [ 'headimg', '' ],
- [ 'member_label', [] ],
- [ 'sex', 0 ],
- [ 'birthday', '' ],
+ ['nickname', ''],
+ ['mobile', ''],
+ ['username', ''],
+ ['password', ''],
+ ['headimg', ''],
+ ['member_label', []],
+ ['sex', 0],
+ ['birthday', ''],
]);
$this->validate($data, 'app\validate\member\Member.add');
- $res = ( new MemberService() )->add($data);
- return success(100011, [ 'member_id' => $res ]);
+ $res = (new MemberService())->add($data);
+ return success('ADD_SUCCESS', ['member_id' => $res]);
}
/**
@@ -73,32 +76,32 @@ class Member extends BaseAdminController
public function modify($member_id, $field)
{
$data = $this->request->params([
- [ 'value', '' ],
- [ 'field', $field ],
+ ['value', ''],
+ ['field', $field],
]);
- $data[ $field ] = $data[ 'value' ];
+ $data[$field] = $data['value'];
$this->validate($data, 'app\validate\member\Member.modify');
- ( new MemberService() )->modify($member_id, $field, $data[ 'value' ]);
- return success(100004);
+ (new MemberService())->modify($member_id, $field, $data['value']);
+ return success('MODIFY_SUCCESS');
}
/**
* 更新
* @return Response
*/
- public function update($member_id)
+ public function edit($member_id)
{
$data = $this->request->params([
- [ 'nickname', '' ],
- [ 'headimg', '' ],
- [ 'password', '' ],
- [ 'member_label', [] ],
- [ 'sex', 0 ],
- [ 'birthday', '' ],
+ ['nickname', ''],
+ ['headimg', ''],
+ ['password', ''],
+ ['member_label', []],
+ ['sex', 0],
+ ['birthday', ''],
]);
- $this->validate($data, 'app\validate\member\Member.update');
- $res = ( new MemberService() )->update($member_id, $data);
- return success(100002);
+ $this->validate($data, 'app\validate\member\Member.edit');
+ $res = (new MemberService())->edit($member_id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -114,10 +117,43 @@ class Member extends BaseAdminController
* 会员列表
* @return Response
*/
- public function getMemberList(){
+ public function getMemberList()
+ {
$data = $this->request->params([
- [ 'keyword', '' ],
+ ['keyword', ''],
]);
- return success(( new MemberService() )->getList($data));
+ return success((new MemberService())->getList($data));
+ }
+
+ /**
+ * 获取会员注册渠道
+ * @return Response
+ */
+ public function getMemberRegisterChannelType()
+ {
+ return success(MemberRegisterChannelEnum::getType());
+ }
+
+ /**
+ * 设置会员的状态
+ * @param $status
+ * @return void
+ */
+ public function setStatus($status){
+ $data = $this->request->params([
+ ['member_ids', []],
+
+ ]);
+ $this->validate(['status' => $status], 'app\validate\member\Member.set_status');
+ (new MemberService())->setStatus($data['member_ids'], $status);
+ return success('EDIT_SUCCESS');
+ }
+
+ /**
+ * 获取状态枚举
+ * @return Response
+ */
+ public function getStatusList(){
+ return success(MemberEnum::getStatus());
}
}
diff --git a/niucloud/app/adminapi/controller/member/MemberLabel.php b/niucloud/app/adminapi/controller/member/MemberLabel.php
index 74db92913..f04370074 100644
--- a/niucloud/app/adminapi/controller/member/MemberLabel.php
+++ b/niucloud/app/adminapi/controller/member/MemberLabel.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\member;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\member\MemberLabelService;
+use core\base\BaseAdminController;
use think\Response;
class MemberLabel extends BaseAdminController
@@ -50,21 +50,21 @@ class MemberLabel extends BaseAdminController
]);
$this->validate($data, 'app\validate\member\MemberLabel.add');
$id = (new MemberLabelService())->add($data);
- return success(100011, ['label_id' => $id]);
+ return success('ADD_SUCCESS', ['label_id' => $id]);
}
/**
* 菜单或接口更新
*/
- public function update($id){
+ public function edit($id){
$data = $this->request->params([
['label_name', ''],
['memo', ''],
['sort', 0],
]);
- $this->validate($data, 'app\validate\member\MemberLabel.update');
- (new MemberLabelService())->update($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\member\MemberLabel.edit');
+ (new MemberLabelService())->edit($id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -74,7 +74,7 @@ class MemberLabel extends BaseAdminController
public function del(int $id){
(new MemberLabelService())->del($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
diff --git a/niucloud/app/adminapi/controller/message/Message.php b/niucloud/app/adminapi/controller/notice/Notice.php
similarity index 78%
rename from niucloud/app/adminapi/controller/message/Message.php
rename to niucloud/app/adminapi/controller/notice/Notice.php
index d8eff5700..57810a25c 100644
--- a/niucloud/app/adminapi/controller/message/Message.php
+++ b/niucloud/app/adminapi/controller/notice/Notice.php
@@ -9,16 +9,16 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\adminapi\controller\message;
+namespace app\adminapi\controller\notice;
-use app\adminapi\controller\BaseAdminController;
use app\enum\sys\SmsEnum;
-use app\service\admin\message\MessageService;
-use app\service\admin\message\SmsService;
-use extend\exception\AdminException;
+use app\service\admin\notice\NoticeService;
+use app\service\admin\notice\SmsService;
+use core\base\BaseAdminController;
+use core\exception\AdminException;
use think\Response;
-class Message extends BaseAdminController
+class Notice extends BaseAdminController
{
/**
@@ -27,27 +27,27 @@ class Message extends BaseAdminController
*/
public function lists()
{
- $res = (new MessageService())->getList();
+ $res = (new NoticeService())->getList();
return success($res);
}
public function info($key)
{
- $res = (new MessageService())->getInfo($key);
+ $res = (new NoticeService())->getInfo($key);
return success($res);
}
/**
* 消息启动与关闭
* @return Response
*/
- public function updateStatus()
+ public function editStatus()
{
$data = $this->request->params([
['key', ''],
['type', ''],
['status', 0],
]);
- (new MessageService())->updateMessageStatus($data['key'], $data['type'], $data['status']);
+ (new NoticeService())->editMessageStatus($data['key'], $data['type'], $data['status']);
return success();
}
@@ -75,11 +75,11 @@ class Message extends BaseAdminController
* 短信配置修改
* @return Response
*/
- public function updateSms($sms_type)
+ public function editSms($sms_type)
{
//参数获取
$sms_type_list = SmsEnum::getType();
- if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException(204002);
+ if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException('SMS_TYPE_NOT_EXIST');
//数据验证
$data = [
['is_use', 0]
@@ -105,7 +105,7 @@ class Message extends BaseAdminController
['receiver', ''],
]);
- $res = (new MessageService())->getLogPage($data);
+ $res = (new NoticeService())->getLogPage($data);
return success($res);
}
@@ -113,7 +113,7 @@ class Message extends BaseAdminController
* 消息修改
* @return Response
*/
- public function update()
+ public function edit()
{
$data = $this->request->params([
['key', ''],
@@ -123,7 +123,7 @@ class Message extends BaseAdminController
['wechat_first', ''],
['wechat_remark', ''],
]);
- (new MessageService())->update($data['key'], $data['type'], $data);
+ (new NoticeService())->edit($data['key'], $data['type'], $data);
return success();
}
diff --git a/niucloud/app/adminapi/controller/message/MessageLog.php b/niucloud/app/adminapi/controller/notice/NoticeLog.php
similarity index 76%
rename from niucloud/app/adminapi/controller/message/MessageLog.php
rename to niucloud/app/adminapi/controller/notice/NoticeLog.php
index 773991a12..138c3d4b4 100644
--- a/niucloud/app/adminapi/controller/message/MessageLog.php
+++ b/niucloud/app/adminapi/controller/notice/NoticeLog.php
@@ -9,13 +9,13 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\adminapi\controller\message;
+namespace app\adminapi\controller\notice;
-use app\adminapi\controller\BaseAdminController;
-use app\service\admin\message\MessageLogService;
+use app\service\admin\notice\NoticeLogService;
+use core\base\BaseAdminController;
use think\Response;
-class MessageLog extends BaseAdminController
+class NoticeLog extends BaseAdminController
{
/**
@@ -30,13 +30,13 @@ class MessageLog extends BaseAdminController
[ 'create_time', [] ]
]);
- $res = ( new MessageLogService() )->getPage($data);
+ $res = ( new NoticeLogService() )->getPage($data);
return success($res);
}
public function info($id)
{
- $res = ( new MessageLogService() )->getInfo($id);
+ $res = ( new NoticeLogService() )->getInfo($id);
return success($res);
}
diff --git a/niucloud/app/adminapi/controller/message/SmsLog.php b/niucloud/app/adminapi/controller/notice/SmsLog.php
similarity index 76%
rename from niucloud/app/adminapi/controller/message/SmsLog.php
rename to niucloud/app/adminapi/controller/notice/SmsLog.php
index 29f253b25..62666f2e1 100644
--- a/niucloud/app/adminapi/controller/message/SmsLog.php
+++ b/niucloud/app/adminapi/controller/notice/SmsLog.php
@@ -9,11 +9,11 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\adminapi\controller\message;
+namespace app\adminapi\controller\notice;
-use app\adminapi\controller\BaseAdminController;
-use app\service\admin\message\MessageLogService;
-use app\service\admin\message\MessageSmsLogService;
+use app\service\admin\notice\NoticeLogService;
+use app\service\admin\notice\NoticeSmsLogService;
+use core\base\BaseAdminController;
use think\Response;
class SmsLog extends BaseAdminController
@@ -31,13 +31,13 @@ class SmsLog extends BaseAdminController
[ 'key', '' ],
]);
- $res = ( new MessageSmsLogService() )->getPage($data);
+ $res = ( new NoticeSmsLogService() )->getPage($data);
return success($res);
}
public function info($id)
{
- $res = ( new MessageLogService() )->getInfo($id);
+ $res = ( new NoticeLogService() )->getInfo($id);
return success($res);
}
diff --git a/niucloud/app/adminapi/controller/order/Recharge.php b/niucloud/app/adminapi/controller/order/Recharge.php
index 4dec454ce..feda40cb8 100644
--- a/niucloud/app/adminapi/controller/order/Recharge.php
+++ b/niucloud/app/adminapi/controller/order/Recharge.php
@@ -11,8 +11,9 @@
namespace app\adminapi\controller\order;
-use app\adminapi\controller\BaseAdminController;
+use app\service\admin\order\RechargeOrderRefundService;
use app\service\admin\order\RechargeOrderService;
+use core\base\BaseAdminController;
use think\Response;
class Recharge extends BaseAdminController
@@ -47,4 +48,11 @@ class Recharge extends BaseAdminController
return success((new RechargeOrderService())->getStatus());
}
+ public function refund($order_id)
+ {
+ $res = (new RechargeOrderRefundService())->create($order_id);
+ if ($res === true) return success();
+ return fail($res);
+ }
+
}
diff --git a/niucloud/app/adminapi/controller/order/Refund.php b/niucloud/app/adminapi/controller/order/Refund.php
new file mode 100644
index 000000000..2d5ed8650
--- /dev/null
+++ b/niucloud/app/adminapi/controller/order/Refund.php
@@ -0,0 +1,57 @@
+request->params([
+ ['create_time', []],
+ ['member_id', ''],
+ ['refund_no', ''],
+ ['status', '']
+ ]);
+ return success((new RefundService())->getPage($data));
+ }
+
+ /**
+ * 退款详情
+ * @param int $order_id
+ * @return Response
+ */
+ public function detail(int $refund_id)
+ {
+ return success((new RefundService())->getDetail($refund_id));
+ }
+
+ /**
+ * 查询退款状态
+ * @param $type
+ * @return Response
+ */
+ public function status($type = 'recharge')
+ {
+ $data = $this->request->params([
+ ['type', 'recharge']
+ ]);
+ return success((new RefundService())->getStatus($data['type']));
+ }
+}
diff --git a/niucloud/app/adminapi/controller/pay/Config.php b/niucloud/app/adminapi/controller/pay/Config.php
index 9072eb3ef..7bd780227 100644
--- a/niucloud/app/adminapi/controller/pay/Config.php
+++ b/niucloud/app/adminapi/controller/pay/Config.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\pay;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\pay\PayConfigService;
+use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
@@ -60,4 +60,5 @@ class Config extends BaseAdminController
}
+
}
diff --git a/niucloud/app/adminapi/controller/pay/PayChannel.php b/niucloud/app/adminapi/controller/pay/PayChannel.php
new file mode 100644
index 000000000..12a48c458
--- /dev/null
+++ b/niucloud/app/adminapi/controller/pay/PayChannel.php
@@ -0,0 +1,90 @@
+request->params([
+ ['is_default', 0],
+ ['config', []],
+ ['status', 0]
+ ]);
+ $data['config']['type'] = $type;
+ $this->validate($data['config'], 'app\validate\pay\Pay.set');
+ (new PayChannelService())->set($channel, $type, $data);
+ return success('SET_SUCCESS');
+ }
+
+
+ /**
+ * 支付渠道列表
+ * @return Response
+ */
+ public function lists(){
+ return success((new PayChannelService())->getChannelList());
+ }
+
+ /**
+ * 通过渠道获取支付配置
+ * @param $channel
+ * @return Response
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public function getListByChannel($channel){
+ return success((new PayChannelService())->getListByChannel($channel));
+ }
+
+
+ /**
+ * 支付设置
+ * @return Response
+ */
+ public function setTransfer(){
+ $data = $this->request->params([
+ ['wechatpay_config', []],
+ ['alipay_config', []],
+ ]);
+ $this->validate(array_merge($data['wechatpay_config'], ['type' => PayEnum::WECHATPAY]), 'app\validate\pay\Pay.set');
+ $this->validate(array_merge($data['alipay_config'], ['type' => PayEnum::ALIPAY]), 'app\validate\pay\Pay.set');
+ (new PayChannelService())->setTransfer($data);
+ return success('SET_SUCCESS');
+ }
+
+ /**
+ * 多渠道支付设置
+ * @return Response
+ */
+ public function setAll(){
+ $data = $this->request->params([
+ ['config', []],
+ ]);
+// $this->validate(array_merge($data['wechatpay_config'], ['type' => PayEnum::WECHATPAY]), 'app\validate\pay\Pay.set');
+// $this->validate(array_merge($data['alipay_config'], ['type' => PayEnum::ALIPAY]), 'app\validate\pay\Pay.set');
+ (new PayChannelService())->setAll($data['config']);
+ return success('SET_SUCCESS');
+ }
+}
diff --git a/niucloud/app/adminapi/controller/site/Site.php b/niucloud/app/adminapi/controller/site/Site.php
index ff3eaa696..54cf399bc 100644
--- a/niucloud/app/adminapi/controller/site/Site.php
+++ b/niucloud/app/adminapi/controller/site/Site.php
@@ -11,10 +11,10 @@
namespace app\adminapi\controller\site;
-use app\adminapi\controller\BaseAdminController;
use app\enum\site\SiteEnum;
use app\service\admin\auth\AuthSiteService;
use app\service\admin\site\SiteService;
+use core\base\BaseAdminController;
use think\Response;
class Site extends BaseAdminController
@@ -60,22 +60,22 @@ class Site extends BaseAdminController
$this->validate($data, 'app\validate\site\Site.add');
$this->validate($data, 'app\validate\sys\User.add');
$site_id = (new SiteService())->add($data);
- return success(100011, ['site_id' => $site_id]);
+ return success('ADD_SUCCESS', ['site_id' => $site_id]);
}
/**
* 菜单或接口更新
*/
- public function update($id)
+ public function edit($id)
{
$data = $this->request->params([
['site_name', ''],
['group_id', 0],
['expire_time', 0]
]);
- $this->validate($data, 'app\validate\site\Site.update');
- (new SiteService())->update($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\site\Site.edit');
+ (new SiteService())->edit($id, $data);
+ return success('MODIFY_SUCCESS');
}
/**
diff --git a/niucloud/app/adminapi/controller/site/SiteGroup.php b/niucloud/app/adminapi/controller/site/SiteGroup.php
index 4834f9919..1a8a90a97 100644
--- a/niucloud/app/adminapi/controller/site/SiteGroup.php
+++ b/niucloud/app/adminapi/controller/site/SiteGroup.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\site;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\site\SiteGroupService;
+use core\base\BaseAdminController;
use think\Response;
/**
@@ -55,7 +55,7 @@ class SiteGroup extends BaseAdminController
]);
$this->validate($data, 'app\validate\site\SiteGroup.add');
$group_id = (new SiteGroupService())->add($data);
- return success(100011, ['group_id' => $group_id]);
+ return success('ADD_SUCCESS', ['group_id' => $group_id]);
}
/**
@@ -63,15 +63,15 @@ class SiteGroup extends BaseAdminController
* @param $group_id
* @return Response
*/
- public function update($group_id){
+ public function edit($group_id){
$data = $this->request->params([
['group_name', ''],
['group_desc', ''],
['group_roles', ''],
]);
$this->validate($data, 'app\validate\site\SiteGroup.add');
- (new SiteGroupService())->update($group_id, $data);
- return success(100004);
+ (new SiteGroupService())->edit($group_id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -82,7 +82,7 @@ class SiteGroup extends BaseAdminController
public function del($group_id){
(new SiteGroupService())->del($group_id);
- return success(100004);
+ return success('DELETE_SUCCESS');
}
/**
diff --git a/niucloud/app/adminapi/controller/site/User.php b/niucloud/app/adminapi/controller/site/User.php
index 2f4bb18f9..30576fffd 100644
--- a/niucloud/app/adminapi/controller/site/User.php
+++ b/niucloud/app/adminapi/controller/site/User.php
@@ -11,10 +11,10 @@
namespace app\adminapi\controller\site;
-use app\adminapi\controller\BaseAdminController;
use app\enum\sys\UserEnum;
use app\service\admin\site\SiteUserService;
use app\service\admin\user\UserService;
+use core\base\BaseAdminController;
use think\Response;
/**
@@ -60,14 +60,14 @@ class User extends BaseAdminController
]);
$this->validate($data, 'app\validate\sys\User.add');
$uid = (new SiteUserService())->add($data);
- return success(100011, ['uid' => $uid]);
+ return success('ADD_SUCCESS', ['uid' => $uid]);
}
/**
* 更新用户
*/
- public function update($uid){
+ public function edit($uid){
$data = $this->request->params([
['real_name', ''],
['head_img', ''],
@@ -75,9 +75,8 @@ class User extends BaseAdminController
['role_ids', []],
['password', '']
]);
-// $this->validate($data, 'app\validate\sys\User.update');
- (new SiteUserService())->update($uid, $data);
- return success(100004);
+ (new SiteUserService())->edit($uid, $data);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -94,7 +93,7 @@ class User extends BaseAdminController
$data[$field] = $data['value'];
// $this->validate($data, 'app\validate\sys\User.modify');
(new SiteUserService())->modify($uid, $field, $data['value']);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -103,7 +102,7 @@ class User extends BaseAdminController
*/
public function del($uid){
(new UserService())->del($uid);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
@@ -112,7 +111,7 @@ class User extends BaseAdminController
public function lock($uid){
(new SiteUserService())->lock($uid);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -121,7 +120,7 @@ class User extends BaseAdminController
public function unlock($uid){
(new SiteUserService())->unlock($uid);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
diff --git a/niucloud/app/adminapi/controller/site/UserLog.php b/niucloud/app/adminapi/controller/site/UserLog.php
index 25089ce8f..c66931b08 100644
--- a/niucloud/app/adminapi/controller/site/UserLog.php
+++ b/niucloud/app/adminapi/controller/site/UserLog.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\site;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\site\UserLogService;
+use core\base\BaseAdminController;
use think\Response;
class UserLog extends BaseAdminController
diff --git a/niucloud/app/adminapi/controller/stat/SiteStat.php b/niucloud/app/adminapi/controller/stat/SiteStat.php
index 85494f9b8..04957ede1 100644
--- a/niucloud/app/adminapi/controller/stat/SiteStat.php
+++ b/niucloud/app/adminapi/controller/stat/SiteStat.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\stat;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\stat\SiteStatService;
+use core\base\BaseAdminController;
/**
* 统计数据
diff --git a/niucloud/app/adminapi/controller/stat/Stat.php b/niucloud/app/adminapi/controller/stat/Stat.php
index 4937ad669..064c185f1 100644
--- a/niucloud/app/adminapi/controller/stat/Stat.php
+++ b/niucloud/app/adminapi/controller/stat/Stat.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\stat;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\stat\StatService;
+use core\base\BaseAdminController;
/**
* 统计数据
diff --git a/niucloud/app/adminapi/controller/sys/Agreement.php b/niucloud/app/adminapi/controller/sys/Agreement.php
index a52207687..8d2f738e5 100644
--- a/niucloud/app/adminapi/controller/sys/Agreement.php
+++ b/niucloud/app/adminapi/controller/sys/Agreement.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\sys\AgreementService;
+use core\base\BaseAdminController;
use think\Response;
/**
@@ -48,14 +48,14 @@ class Agreement extends BaseAdminController
* @param string $key
* @return Response
*/
- public function update(string $key){
+ public function edit(string $key){
$data = $this->request->params([
['title', ''],
['content', ''],
], false);
- $this->validate($data, 'app\validate\sys\Agreement.update');
+ $this->validate($data, 'app\validate\sys\Agreement.edit');
(new AgreementService())->setAgreement($key, $data['title'], $data['content']);
- return success(100004);
+ return success('EDIT_SUCCESS');
}
diff --git a/niucloud/app/adminapi/controller/sys/App.php b/niucloud/app/adminapi/controller/sys/App.php
new file mode 100644
index 000000000..d1b5c8005
--- /dev/null
+++ b/niucloud/app/adminapi/controller/sys/App.php
@@ -0,0 +1,31 @@
+getAppList());
+ }
+
+
+}
diff --git a/niucloud/app/adminapi/controller/sys/Area.php b/niucloud/app/adminapi/controller/sys/Area.php
index 898bc91a9..e2c8d172e 100644
--- a/niucloud/app/adminapi/controller/sys/Area.php
+++ b/niucloud/app/adminapi/controller/sys/Area.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\sys\AreaService;
+use core\base\BaseAdminController;
class Area extends BaseAdminController
{
diff --git a/niucloud/app/adminapi/controller/sys/Attachment.php b/niucloud/app/adminapi/controller/sys/Attachment.php
index 9f78c1cb9..95055648a 100644
--- a/niucloud/app/adminapi/controller/sys/Attachment.php
+++ b/niucloud/app/adminapi/controller/sys/Attachment.php
@@ -11,9 +11,9 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\enum\sys\FileEnum;
use app\service\admin\sys\AttachmentService;
+use core\base\BaseAdminController;
use think\Response;
class Attachment extends BaseAdminController
@@ -53,7 +53,7 @@ class Attachment extends BaseAdminController
['att_ids', []],
]);
(new AttachmentService())->delAll($data['att_ids']);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
@@ -68,7 +68,7 @@ class Attachment extends BaseAdminController
]);
$this->validate($data, 'app\validate\sys\AttachmentCategory.add');
(new AttachmentService())->addCategory($data);
- return success(100011);
+ return success('ADD_SUCCESS');
}
/**
@@ -87,14 +87,14 @@ class Attachment extends BaseAdminController
* 更新附件分组
* @return Response
*/
- public function updateCategory($id)
+ public function editCategory($id)
{
$data = $this->request->params([
['name', '']
]);
- $this->validate($data, 'app\validate\sys\AttachmentCategory.update');
- (new AttachmentService())->updateCategory($id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\sys\AttachmentCategory.edit');
+ (new AttachmentService())->editCategory($id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -105,7 +105,7 @@ class Attachment extends BaseAdminController
public function deleteCategory($id)
{
(new AttachmentService())->delCategory($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
/**
@@ -118,7 +118,7 @@ class Attachment extends BaseAdminController
['cate_id', '']
]);
(new AttachmentService())->modifyCategory($att_id, $data['cate_id']);
- return success(100000);
+ return success('SUCCESS');
}
/**
@@ -133,7 +133,7 @@ class Attachment extends BaseAdminController
['att_ids', []]
]);
(new AttachmentService())->batchModifyCategory($data['att_ids'], $data['cate_id']);
- return success(100000);
+ return success('SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/sys/Channel.php b/niucloud/app/adminapi/controller/sys/Channel.php
index 685252202..b9a8bae82 100644
--- a/niucloud/app/adminapi/controller/sys/Channel.php
+++ b/niucloud/app/adminapi/controller/sys/Channel.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\enum\common\ChannelEnum;
+use core\base\BaseAdminController;
class Channel extends BaseAdminController
{
diff --git a/niucloud/app/adminapi/controller/sys/Config.php b/niucloud/app/adminapi/controller/sys/Config.php
index 13e9af97d..07a5dfa29 100644
--- a/niucloud/app/adminapi/controller/sys/Config.php
+++ b/niucloud/app/adminapi/controller/sys/Config.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\sys\ConfigService;
+use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
@@ -45,7 +45,7 @@ class Config extends BaseAdminController
["phone",""],
["business_hours",""],
]);
- $this->validate($data, 'app\validate\site\site.update');
+ $this->validate($data, 'app\validate\site\site.edit');
(new ConfigService())->setWebSite($data);
return success();
}
diff --git a/niucloud/app/adminapi/controller/sys/Cron.php b/niucloud/app/adminapi/controller/sys/Cron.php
index 1a4e0440f..345f8d4bc 100644
--- a/niucloud/app/adminapi/controller/sys/Cron.php
+++ b/niucloud/app/adminapi/controller/sys/Cron.php
@@ -11,9 +11,9 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\enum\sys\CronEnum;
use app\service\admin\cron\CronService;
+use core\base\BaseAdminController;
/**
* 自动任务
diff --git a/niucloud/app/adminapi/controller/sys/Menu.php b/niucloud/app/adminapi/controller/sys/Menu.php
index ab4fc96bf..a58d6c863 100644
--- a/niucloud/app/adminapi/controller/sys/Menu.php
+++ b/niucloud/app/adminapi/controller/sys/Menu.php
@@ -11,12 +11,12 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\enum\sys\MenuEnum;
use app\enum\sys\MenuTypeEnum;
use app\enum\sys\MethodEnum;
use app\service\admin\install\InstallSystemService;
use app\service\admin\sys\MenuService;
+use core\base\BaseAdminController;
use think\Exception;
use think\Response;
@@ -65,13 +65,13 @@ class Menu extends BaseAdminController
]);
$this->validate($data, 'app\validate\sys\Menu.add');
(new MenuService())->add($data);
- return success(100011);
+ return success('ADD_SUCCESS');
}
/**
* 菜单或接口更新
*/
- public function update($menu_key){
+ public function edit($menu_key){
$data = $this->request->params([
['menu_name', ''],
['parent_key', ''],
@@ -89,8 +89,8 @@ class Menu extends BaseAdminController
['is_show', 0],
]);
$this->validate($data, 'app\validate\sys\Menu.edit');
- (new MenuService())->update($menu_key, $data);
- return success(100004);
+ (new MenuService())->edit($menu_key, $data);
+ return success('EDIT_SUCCESS');
}
@@ -118,11 +118,11 @@ class Menu extends BaseAdminController
*/
public function del($menu_key){
(new MenuService())->del($menu_key);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
public function refreshMenu(){
(new InstallSystemService())->install();
- return success(100019);
+ return success('REFRESH_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/sys/Role.php b/niucloud/app/adminapi/controller/sys/Role.php
index 7a21dd1d0..7561c997b 100644
--- a/niucloud/app/adminapi/controller/sys/Role.php
+++ b/niucloud/app/adminapi/controller/sys/Role.php
@@ -11,9 +11,9 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\enum\sys\RoleStatusEnum;
use app\service\admin\sys\RoleService;
+use core\base\BaseAdminController;
use think\Response;
class Role extends BaseAdminController
@@ -55,22 +55,22 @@ class Role extends BaseAdminController
]);
$this->validate($data, 'app\validate\sys\Role.add');
(new RoleService())->add($data);
- return success(100011);
+ return success('ADD_SUCCESS');
}
/**
* 更新用户组
*/
- public function update($role_id){
+ public function edit($role_id){
$data = $this->request->params([
['role_name', ''],
['rules', []],
['status', RoleStatusEnum::ON],
]);
- $this->validate($data, 'app\validate\sys\Role.update');
- (new RoleService())->update($role_id, $data);
- return success(100004);
+ $this->validate($data, 'app\validate\sys\Role.edit');
+ (new RoleService())->edit($role_id, $data);
+ return success('EDIT_SUCCESS');
}
@@ -80,7 +80,7 @@ class Role extends BaseAdminController
*/
public function del($role_id){
(new RoleService())->del($role_id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/sys/System.php b/niucloud/app/adminapi/controller/sys/System.php
index bc595bc24..563393b03 100644
--- a/niucloud/app/adminapi/controller/sys/System.php
+++ b/niucloud/app/adminapi/controller/sys/System.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\sys;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\sys\SystemService;
+use core\base\BaseAdminController;
/**
* 系统信息查询
@@ -30,4 +30,21 @@ class System extends BaseAdminController
return success((new SystemService())->getInfo());
}
+ /**
+ * 获取当前url配置
+ * @return array|mixed
+ */
+ public function url()
+ {
+ return success((new SystemService())->getUrl());
+ }
+
+ /**
+ * 获取系统环境配置
+ * @return \think\Response
+ */
+ public function getSystemInfo(){
+ return success((new SystemService())->getSystemInfo());
+ }
+
}
diff --git a/niucloud/app/adminapi/controller/sys/Terminal.php b/niucloud/app/adminapi/controller/sys/Terminal.php
new file mode 100644
index 000000000..0791fe271
--- /dev/null
+++ b/niucloud/app/adminapi/controller/sys/Terminal.php
@@ -0,0 +1,37 @@
+request->params([
+ ['commands', []],
+ ]);
+ TerminalService::instance()->exec($commands);
+ }
+
+}
diff --git a/niucloud/app/adminapi/controller/upload/Storage.php b/niucloud/app/adminapi/controller/upload/Storage.php
index 81875333d..7d26bff6a 100644
--- a/niucloud/app/adminapi/controller/upload/Storage.php
+++ b/niucloud/app/adminapi/controller/upload/Storage.php
@@ -11,12 +11,10 @@
namespace app\adminapi\controller\upload;
-use app\adminapi\controller\BaseAdminController;
use app\adminapi\controller\sys\AdminException;
use app\enum\sys\StorageEnum;
use app\service\admin\file\StorageConfigService;
-use app\service\admin\file\UploadConfigService;
-use app\service\admin\file\UploadService;
+use core\base\BaseAdminController;
use think\Response;
class Storage extends BaseAdminController
@@ -46,11 +44,11 @@ class Storage extends BaseAdminController
* 存储设置修改
* @return Response
*/
- public function updateStorage($storage_type)
+ public function editStorage($storage_type)
{
//参数获取
$storage_type_list = StorageEnum::getType();
- if (!array_key_exists($storage_type, $storage_type_list)) throw new AdminException(203005);
+ if (!array_key_exists($storage_type, $storage_type_list)) throw new AdminException('OSS_TYPE_NOT_EXIST');
//数据验证
$data = [
['is_use', 0]
@@ -61,7 +59,7 @@ class Storage extends BaseAdminController
$request_data = $this->request->params($data);
(new StorageConfigService())->setStorageConfig($storage_type, $request_data);
- return success(100016);
+ return success('SET_SUCCESS');
}
diff --git a/niucloud/app/adminapi/controller/upload/Upload.php b/niucloud/app/adminapi/controller/upload/Upload.php
index 4980adbc2..9ac08a497 100644
--- a/niucloud/app/adminapi/controller/upload/Upload.php
+++ b/niucloud/app/adminapi/controller/upload/Upload.php
@@ -11,11 +11,10 @@
namespace app\adminapi\controller\upload;
-use app\adminapi\controller\BaseAdminController;
use app\adminapi\controller\sys\AdminException;
-use app\enum\sys\StorageEnum;
use app\service\admin\file\UploadConfigService;
use app\service\admin\file\UploadService;
+use core\base\BaseAdminController;
use think\Response;
class Upload extends BaseAdminController
@@ -53,12 +52,12 @@ class Upload extends BaseAdminController
* 文件上传(默认不上云)
* @return Response
*/
- public function document(){
+ public function document($type){
$data = $this->request->params([
['file', 'file'],
], true);
$upload_service = new UploadService();
- return success($upload_service->document($data['file'], true));
+ return success($upload_service->document($data['file'], $type, true));
}
@@ -78,7 +77,7 @@ class Upload extends BaseAdminController
]
);
(new UploadConfigService())->setUploadConfig($data);
- return success(100016);
+ return success('SET_SUCCESS');
}
/**
@@ -90,17 +89,4 @@ class Upload extends BaseAdminController
return success((new UploadConfigService())->getUploadConfig());
}
- /**
- * 证书上传
- * @param $type
- * @return void
- */
- public function cert($type){
- $data = $this->request->params([
- ['file', 'file'],
- ], true);
- $upload_service = new UploadService();
- return success($upload_service->cert($data['file'], $type));
- }
-
}
diff --git a/niucloud/app/adminapi/controller/user/User.php b/niucloud/app/adminapi/controller/user/User.php
index 9244ec260..2cb42fb04 100644
--- a/niucloud/app/adminapi/controller/user/User.php
+++ b/niucloud/app/adminapi/controller/user/User.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\user;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\user\UserService;
+use core\base\BaseAdminController;
use think\Response;
class User extends BaseAdminController
diff --git a/niucloud/app/adminapi/controller/weapp/Config.php b/niucloud/app/adminapi/controller/weapp/Config.php
index 276ff8fb1..aef4327c7 100644
--- a/niucloud/app/adminapi/controller/weapp/Config.php
+++ b/niucloud/app/adminapi/controller/weapp/Config.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\weapp;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\weapp\WeappConfigService;
+use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
@@ -42,7 +42,7 @@ class Config extends BaseAdminController
]);
$this->validate($data, 'app\validate\channel\Weapp.set');
(new WeappConfigService())->setWeappConfig($data);
- return success(100016);
+ return success('SET_SUCCESS');
}
diff --git a/niucloud/app/adminapi/controller/weapp/Template.php b/niucloud/app/adminapi/controller/weapp/Template.php
index 1f0b65fc0..332d73794 100644
--- a/niucloud/app/adminapi/controller/weapp/Template.php
+++ b/niucloud/app/adminapi/controller/weapp/Template.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\weapp;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\weapp\WeappTemplateService;
+use core\base\BaseAdminController;
/**
* 微信小程序订阅消息
diff --git a/niucloud/app/adminapi/controller/wechat/Config.php b/niucloud/app/adminapi/controller/wechat/Config.php
index c46511e3d..e0cb4352b 100644
--- a/niucloud/app/adminapi/controller/wechat/Config.php
+++ b/niucloud/app/adminapi/controller/wechat/Config.php
@@ -11,10 +11,9 @@
namespace app\adminapi\controller\wechat;
-use app\adminapi\controller\BaseAdminController;
-use app\service\admin\file\UploadService;
use app\service\admin\site\WebSiteConfigService;
use app\service\admin\wechat\WechatConfigService;
+use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
@@ -44,7 +43,7 @@ class Config extends BaseAdminController
]);
$this->validate($data, 'app\validate\channel\Wechat.set');
(new WechatConfigService())->setWechatConfig($data);
- return success(100016);
+ return success('SET_SUCCESS');
}
/**
@@ -55,16 +54,4 @@ class Config extends BaseAdminController
return success((new WechatConfigService())->getWechatStaticInfo());
}
- /**
- * 文件上传(默认不上云)
- * @return Response
- */
- public function document(){
- $data = $this->request->params([
- ['file', 'file'],
- ], true);
- $upload_service = new UploadService();
- return success($upload_service->document($data['file'], true));
- }
-
}
diff --git a/niucloud/app/adminapi/controller/wechat/Menu.php b/niucloud/app/adminapi/controller/wechat/Menu.php
index df3f8bf2b..e79bb6795 100644
--- a/niucloud/app/adminapi/controller/wechat/Menu.php
+++ b/niucloud/app/adminapi/controller/wechat/Menu.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\wechat;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\wechat\WechatMenuService;
+use core\base\BaseAdminController;
/**
* 微信公众号管理菜单
@@ -33,12 +33,12 @@ class Menu extends BaseAdminController
* 设置菜单
* @return void
*/
- public function update(){
+ public function edit(){
$wechat_menu_service = new WechatMenuService();
$data = $this->request->params([
['button', []]
]);
- $wechat_menu_service->update($data['button']);
- return success(100004);
+ $wechat_menu_service->edit($data['button']);
+ return success('EDIT_SUCCESS');
}
}
diff --git a/niucloud/app/adminapi/controller/wechat/Reply.php b/niucloud/app/adminapi/controller/wechat/Reply.php
index b94602b9d..9dc92ab98 100644
--- a/niucloud/app/adminapi/controller/wechat/Reply.php
+++ b/niucloud/app/adminapi/controller/wechat/Reply.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\wechat;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\wechat\WechatReplyService;
+use core\base\BaseAdminController;
use think\Response;
/**
@@ -60,7 +60,7 @@ class Reply extends BaseAdminController
* 更新关键词回复
* @return void
*/
- public function updateKeyword($id){
+ public function editKeyword($id){
$wechat_reply_service = new WechatReplyService();
$data = $this->request->params([
['name', ''],
@@ -71,7 +71,7 @@ class Reply extends BaseAdminController
['status', 0],
['sort', ''],
]);
- return success($wechat_reply_service->updateKeyword($id, $data));
+ return success($wechat_reply_service->editKeyword($id, $data));
}
/**
@@ -96,14 +96,14 @@ class Reply extends BaseAdminController
* 更新默认回复
* @return Response
*/
- public function updateDefault(){
+ public function editDefault(){
$data = $this->request->params([
['content_type', ''],
['content', ''],
['status', 0],
]);
$wechat_reply_service = new WechatReplyService();
- return success($wechat_reply_service->updateDefault($data));
+ return success($wechat_reply_service->editDefault($data));
}
/**
@@ -119,14 +119,14 @@ class Reply extends BaseAdminController
* 更新关注回复
* @return Response
*/
- public function updateSubscribe(){
+ public function editSubscribe(){
$data = $this->request->params([
['content_type', ''],
['content', ''],
['status', 0],
]);
$wechat_reply_service = new WechatReplyService();
- return success($wechat_reply_service->updateSubscribe($data));
+ return success($wechat_reply_service->editSubscribe($data));
}
diff --git a/niucloud/app/adminapi/controller/wechat/Template.php b/niucloud/app/adminapi/controller/wechat/Template.php
index 304ad4368..bf51b8af5 100644
--- a/niucloud/app/adminapi/controller/wechat/Template.php
+++ b/niucloud/app/adminapi/controller/wechat/Template.php
@@ -11,8 +11,8 @@
namespace app\adminapi\controller\wechat;
-use app\adminapi\controller\BaseAdminController;
use app\service\admin\wechat\WechatTemplateService;
+use core\base\BaseAdminController;
/**
* 微信公众号管理菜单
diff --git a/niucloud/app/adminapi/middleware.php b/niucloud/app/adminapi/middleware.php
new file mode 100644
index 000000000..e1d10f252
--- /dev/null
+++ b/niucloud/app/adminapi/middleware.php
@@ -0,0 +1,8 @@
+domain())),"/"),
+ ];
+ if(env('system.admin_domain')){
+ $allow_origin[] = rtrim(str_replace('https://','',str_replace('http://','',env('system.admin_domain'))),"/");
+ }
+ $referer = $request->header('referer');
+ $origin = '';
+ if(!empty($referer)){
+ $referer = parse_url($referer);
+ $referer = $referer['host'] ?? '';
+ $origin = rtrim(str_replace('https://','',str_replace('http://','',$referer)),"/");
+ }
+// $origin = $request->header('origin');
+ if(env('app_debug') || ($origin && in_array($origin, $allow_origin))){
+// header('Access-Control-Allow-Origin: ' . $origin);
+ header('Access-Control-Allow-Origin: *');
+ }else{
+ header('Access-Control-Allow-Origin: *');
+ throw new AdminException('SERVER_CROSS_REQUEST_FAIL');
+ }
+
return $next($request);
}
}
diff --git a/niucloud/app/adminapi/route/addon.php b/niucloud/app/adminapi/route/addon.php
new file mode 100644
index 000000000..770cebf7f
--- /dev/null
+++ b/niucloud/app/adminapi/route/addon.php
@@ -0,0 +1,46 @@
+middleware([
+ AdminCheckToken::class,
+ AdminCheckRole::class,
+ AdminLog::class
+]);;
diff --git a/niucloud/app/adminapi/route/app.php b/niucloud/app/adminapi/route/app.php
index 22a3a0719..976c72f99 100644
--- a/niucloud/app/adminapi/route/app.php
+++ b/niucloud/app/adminapi/route/app.php
@@ -14,5 +14,7 @@ use think\facade\Route;
$is_demo = env('system.is_demo', 0);
if($is_demo&& !\think\facade\Request::isGet())
{
- throw new \extend\exception\CommonException("演示数据不能进行修改");
-}
\ No newline at end of file
+ //加载插件路由
+ throw new \core\exception\CommonException("演示数据不能进行修改");
+}
+
diff --git a/niucloud/app/adminapi/route/article.php b/niucloud/app/adminapi/route/article.php
index d57d5cdda..0bfac07ad 100644
--- a/niucloud/app/adminapi/route/article.php
+++ b/niucloud/app/adminapi/route/article.php
@@ -28,7 +28,7 @@ Route::group('article', function () {
//添加文章
Route::post('article', 'article.Article/add');
//编辑文章
- Route::put('article/:id', 'article.Article/update');
+ Route::put('article/:id', 'article.Article/edit');
//删除文章
Route::delete('article/:id', 'article.Article/del');
/***************************************************** 文章分类管理 ****************************************************/
@@ -41,7 +41,7 @@ Route::group('article', function () {
//添加文章分类
Route::post('category', 'article.ArticleCategory/add');
//编辑文章分类
- Route::put('category/:id', 'article.ArticleCategory/update');
+ Route::put('category/:id', 'article.ArticleCategory/edit');
//删除文章分类
Route::delete('category/:category_id', 'article.ArticleCategory/del');
diff --git a/niucloud/app/adminapi/route/auth.php b/niucloud/app/adminapi/route/auth.php
index c0be7550b..2afce3892 100644
--- a/niucloud/app/adminapi/route/auth.php
+++ b/niucloud/app/adminapi/route/auth.php
@@ -29,7 +29,7 @@ Route::group('auth', function () {
//授权用户菜单
Route::put('modify/:field', 'auth.Auth/modify');
//授权用户菜单
- Route::put('update', 'auth.Auth/update');
+ Route::put('edit', 'auth.Auth/edit');
//授权站点信息
Route::get('site', 'auth.Auth/site');
diff --git a/niucloud/app/adminapi/route/diy.php b/niucloud/app/adminapi/route/diy.php
index 75849778e..3cb0f8e2d 100644
--- a/niucloud/app/adminapi/route/diy.php
+++ b/niucloud/app/adminapi/route/diy.php
@@ -31,7 +31,7 @@ Route::group('diy', function() {
Route::post('diy', 'diy.Diy/add');
//编辑自定义页面
- Route::put('diy/:id', 'diy.Diy/update');
+ Route::put('diy/:id', 'diy.Diy/edit');
//删除自定义页面
Route::delete('diy/:id', 'diy.Diy/del');
@@ -51,6 +51,9 @@ Route::group('diy', function() {
// 自定义路由列表
Route::get('route', 'diy.DiyRoute/lists');
+ // 获取自定义路由分享内容
+ Route::get('route/info', 'diy.DiyRoute/getInfoByName');
+
// 编辑自定义路由分享内容
Route::put('route/share', 'diy.DiyRoute/modifyShare');
diff --git a/niucloud/app/adminapi/route/generator.php b/niucloud/app/adminapi/route/generator.php
index 3d7d76bdc..58678218c 100644
--- a/niucloud/app/adminapi/route/generator.php
+++ b/niucloud/app/adminapi/route/generator.php
@@ -29,7 +29,7 @@ Route::group('generator', function () {
//添加代码生成
Route::post('generator', 'generator.generator/add');
//编辑代码生成
- Route::put('generator/:id', 'generator.generator/update');
+ Route::put('generator/:id', 'generator.generator/edit');
//删除代码生成
Route::delete('generator/:id', 'generator.generator/del');
//代码生成
diff --git a/niucloud/app/adminapi/route/member.php b/niucloud/app/adminapi/route/member.php
index db74576f7..2b2fee8f3 100644
--- a/niucloud/app/adminapi/route/member.php
+++ b/niucloud/app/adminapi/route/member.php
@@ -27,12 +27,18 @@ Route::group('member', function () {
//会员添加
Route::post('member', 'member.Member/add');
//会员添加
- Route::put('member/:member_id', 'member.Member/update');//会员添加
+ Route::put('member/:member_id', 'member.Member/edit');//会员添加
Route::put('member/modify/:member_id/:field', 'member.Member/modify');
- //会员使用场景
+ //会员注册方式
Route::get('registertype', 'member.Member/getMemberRegisterType');
+ //会员注册渠道
+ Route::get('register/channel', 'member.Member/getMemberRegisterChannelType');
//会员列表(不分页)
Route::get('member/list', 'member.Member/getMemberList');
+ //获取会员状态枚举
+ Route::get('status/list', 'member.Member/getStatusList');
+ //会员设置状态
+ Route::put('setstatus/:status', 'member.Member/setStatus');
/***************************************************** 会员标签 ****************************************************/
//会员标签列表
Route::get('label', 'member.MemberLabel/lists');
@@ -41,44 +47,54 @@ Route::group('member', function () {
//会员标签添加
Route::post('label', 'member.MemberLabel/add');
//会员标签编辑
- Route::put('label/:id', 'member.MemberLabel/update');
+ Route::put('label/:id', 'member.MemberLabel/edit');
//会员标签删除
Route::delete('label/:id', 'member.MemberLabel/del');
//会员标签
Route::get('label/all', 'member.MemberLabel/getAll');
/***************************************************** 会员账户 ****************************************************/
+ //会员账户类型变动方式
+ Route::get('account/type', 'member.Account/accountType');
//会员积分流水
Route::get('account/point', 'member.Account/point');
//会员余额流水
Route::get('account/balance', 'member.Account/balance');
- //会员零钱流水
+ //会员可提现余额流水
Route::get('account/money', 'member.Account/money');
+ //会员佣金流水
+ Route::get('account/commission', 'member.Account/commission');
//会员积分调整
Route::post('account/point', 'member.Account/adjustPoint');
//会员余额调整
Route::post('account/balance', 'member.Account/adjustBalance');
+ //会员零钱调整
+ Route::post('account/money', 'member.Account/adjustMoney');
//会员账户类型变动方式
Route::get('account/change_type/:account_type', 'member.Account/changeType');
+ //会员账户类型变动方式
+ Route::get('account/sum_balance', 'member.Account/sumBalance');
/***************************************************** 会员相关设置**************************************************/
//获取注册与登录设置
Route::get('config/login', 'member.Config/getLoginConfig');
//更新注册与登录设置
Route::post('config/login', 'member.Config/setLoginConfig');
//获取会员提现设置
- Route::get('config/withdraw', 'member.Config/getWithdrawConfig');
+ Route::get('config/cash_out', 'member.Config/getCashOutConfig');
//更新提现设置
- Route::post('config/withdraw', 'member.Config/setWithdrawConfig');
+ Route::post('config/cash_out', 'member.Config/setCashOutConfig');
/***************************************************** 会员体现**************************************************/
//会员提现列表
- Route::get('withdraw', 'member.Withdraw/lists');
+ Route::get('cash_out', 'member.CashOut/lists');
//会员提现详情
- Route::get('withdraw/:id', 'member.Withdraw/info');
+ Route::get('cash_out/:id', 'member.CashOut/info');
//会员提现审核
- Route::put('withdraw/audit/:id/:action', 'member.Withdraw/audit');
+ Route::put('cash_out/audit/:id/:action', 'member.CashOut/audit');
//转账方式
- Route::get('withdraw/transfertype', 'member.Withdraw/getTransferType');
+ Route::get('cash_out/transfertype', 'member.CashOut/getTransferType');
//转账方式
- Route::put('withdraw/transfer/:id', 'member.Withdraw/transfer');
+ Route::put('cash_out/transfer/:id', 'member.CashOut/transfer');
+ //提现状态
+ Route::get('cash_out/status', 'member.CashOut/getStatusList');
})->middleware([
AdminCheckToken::class,
diff --git a/niucloud/app/adminapi/route/message.php b/niucloud/app/adminapi/route/notice.php
similarity index 63%
rename from niucloud/app/adminapi/route/message.php
rename to niucloud/app/adminapi/route/notice.php
index 57b79b98c..5002c482e 100644
--- a/niucloud/app/adminapi/route/message.php
+++ b/niucloud/app/adminapi/route/notice.php
@@ -17,35 +17,35 @@ use think\facade\Route;
/**
* 消息模块 相关路由
*/
-Route::group('message', function () {
+Route::group('notice', function () {
/***************************************************** 消息管理 ****************************************************/
//消息列表
- Route::get('message', 'message.Message/lists');
+ Route::get('notice', 'notice.Notice/lists');
//消息详情
- Route::get('message/:key', 'message.Message/info');
+ Route::get('notice/:key', 'notice.Notice/info');
//消息启动与关闭
- Route::post('message/updatestatus', 'message.Message/updateStatus');
+ Route::post('notice/editstatus', 'notice.Notice/editStatus');
//短信配置列表
- Route::get('message/sms', 'message.Message/smsList');
+ Route::get('notice/sms', 'notice.Notice/smsList');
//短信配置详情
- Route::get('message/sms/:sms_type', 'message.Message/smsConfig');
+ Route::get('notice/sms/:sms_type', 'notice.Notice/smsConfig');
//短信配置修改
- Route::put('message/sms/:sms_type', 'message.Message/updateSms');
+ Route::put('notice/sms/:sms_type', 'notice.Notice/editSms');
//消息发送记录
- Route::get('message/log', 'message.Message/getLogList');
+ Route::get('notice/log', 'notice.Notice/getLogList');
//消息修改
- Route::post('message/update', 'message.Message/update');
+ Route::post('notice/edit', 'notice.Notice/edit');
//消息发送记录
- Route::get('log', 'message.MessageLog/lists');
+ Route::get('log', 'notice.NoticeLog/lists');
//消息发送记录详情
- Route::get('log/:id', 'message.MessageLog/info');
+ Route::get('log/:id', 'notice.NoticeLog/info');
//短信发送记录
- Route::get('sms/log', 'message.SmsLog/lists');
+ Route::get('sms/log', 'notice.SmsLog/lists');
//短信发送记录详情
- Route::get('sms/log/:id', 'message.SmsLog/info');
+ Route::get('sms/log/:id', 'notice.SmsLog/info');
})->middleware([
AdminCheckToken::class,
diff --git a/niucloud/app/adminapi/route/order.php b/niucloud/app/adminapi/route/order.php
index 5060b667b..e8cba6220 100644
--- a/niucloud/app/adminapi/route/order.php
+++ b/niucloud/app/adminapi/route/order.php
@@ -26,6 +26,8 @@ Route::group('order', function () {
Route::get('recharge/:order_id', 'order.Recharge/detail');
//订单状态
Route::get('recharge/status', 'order.Recharge/status');
+ // 订单发起退款
+ Route::get('recharge/refund/:order_id', 'order.Recharge/refund');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
diff --git a/niucloud/app/adminapi/route/pay.php b/niucloud/app/adminapi/route/pay.php
index 81eb8a9f2..90081e081 100644
--- a/niucloud/app/adminapi/route/pay.php
+++ b/niucloud/app/adminapi/route/pay.php
@@ -26,6 +26,17 @@ Route::group('pay', function () {
Route::get('config/:type', 'pay.Config/get');
//获取支付方式列表
Route::get('lists', 'pay.Config/lists');
+ /***************************************************** 支付渠道 *************************************************/
+ //渠道列表
+ Route::get('channel/lists', 'pay.PayChannel/lists');
+ //渠道设置
+ Route::post('channel/set/:channel/:type', 'pay.PayChannel/set');
+ //通过渠道获取支付配置
+ Route::get('channel/lists/:channel', 'pay.PayChannel/getListByChannel');
+ //转账设置
+ Route::post('channel/set/transfer', 'pay.PayChannel/setTransfer');
+ //多渠道设置
+ Route::post('channel/set/all', 'pay.PayChannel/setAll');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
diff --git a/niucloud/app/adminapi/route/refund.php b/niucloud/app/adminapi/route/refund.php
new file mode 100644
index 000000000..dd207231d
--- /dev/null
+++ b/niucloud/app/adminapi/route/refund.php
@@ -0,0 +1,33 @@
+middleware([
+ AdminCheckToken::class,
+ AdminCheckRole::class,
+ AdminLog::class
+]);
\ No newline at end of file
diff --git a/niucloud/app/adminapi/route/route.php b/niucloud/app/adminapi/route/route.php
index 412bdf188..50fc4333d 100644
--- a/niucloud/app/adminapi/route/route.php
+++ b/niucloud/app/adminapi/route/route.php
@@ -11,11 +11,23 @@
use think\facade\Route;
-
/**
* 路由
*/
Route::group(function () {
//用户登录
- Route::get('login', 'login.login/login');
-});
\ No newline at end of file
+ Route::get('login/:app_type', 'login.Login/login');
+
+ //登录注册设置
+ Route::get('login/config', 'login.Config/getConfig');
+
+ //生成验证码
+ Route::get('captcha/create', 'login.Captcha/create');
+ //一次校验验证码
+ Route::get('captcha/check', 'login.Captcha/check');
+
+ Route::get('terminal', 'sys.Terminal/exec');
+});
+
+//加载插件路由
+(new \core\addon\AddonLoader("Route"))->load(['app_type' => 'adminapi']);
\ No newline at end of file
diff --git a/niucloud/app/adminapi/route/site.php b/niucloud/app/adminapi/route/site.php
index fe9416546..7d66dbaf0 100644
--- a/niucloud/app/adminapi/route/site.php
+++ b/niucloud/app/adminapi/route/site.php
@@ -28,7 +28,7 @@ Route::group('site', function () {
//添加站点
Route::post('site', 'site.Site/add');
//更新站点
- Route::put('site/:id', 'site.Site/update');
+ Route::put('site/:id', 'site.Site/edit');
//站点状态
Route::get('statuslist', 'site.Site/getStatuList');
/***************************************************** 站点分组 *************************************************/
@@ -39,7 +39,7 @@ Route::group('site', function () {
//站点分组新增
Route::post('group', 'site.SiteGroup/add');
//站点分组编辑
- Route::put('group/:group_id', 'site.SiteGroup/update');
+ Route::put('group/:group_id', 'site.SiteGroup/edit');
//站点分组删除
Route::delete('group/:group_id', 'site.SiteGroup/del');
//获取所有分组
@@ -56,7 +56,7 @@ Route::group('site', function () {
//站点用户解锁
Route::put('user/unlock/:uid', 'site.User/unlock');
//站点编辑用户
- Route::put('user/:uid', 'site.User/update');
+ Route::put('user/:uid', 'site.User/edit');
//站点修改用户属性
Route::put('user/:uid/:field', 'site.User/modify');
/***************************************************** 操作日志 **************************************************/
diff --git a/niucloud/app/adminapi/route/sys.php b/niucloud/app/adminapi/route/sys.php
index 1c005a638..640ffbb1c 100644
--- a/niucloud/app/adminapi/route/sys.php
+++ b/niucloud/app/adminapi/route/sys.php
@@ -22,6 +22,7 @@ Route::group('sys', function () {
/***************************************************** 系统整体信息 *************************************************/
//系统信息
Route::get('info', 'sys.System/info');
+ Route::get('url', 'sys.System/url');
/***************************************************** 用户组 ****************************************************/
//用户组列表
Route::get('role', 'sys.Role/lists');
@@ -32,14 +33,14 @@ Route::group('sys', function () {
//用户组新增
Route::post('role', 'sys.Role/add');
//编辑用户组
- Route::put('role/:role_id', 'sys.Role/update');
+ Route::put('role/:role_id', 'sys.Role/edit');
//删除用户组
Route::delete('role/:role_id', 'sys.Role/del');
/***************************************************** 菜单 ****************************************************/
//菜单新增
Route::post('menu', 'sys.Menu/add');
//菜单更新
- Route::put('menu/:menu_key', 'sys.Menu/update');
+ Route::put('menu/:menu_key', 'sys.Menu/edit');
//菜单列表
Route::get('menu/:app_type', 'sys.Menu/lists');
//删除单个菜单
@@ -64,14 +65,17 @@ Route::group('sys', function () {
//版权设置
Route::put('config/copyright', 'sys.Config/setCopyright');
-
+ //登录注册设置
+ Route::get('config/login', 'login.Config/getConfig');
+ //登录注册设置
+ Route::put('config/login', 'login.Config/setConfig');
/***************************************************** 图片上传 ****************************************************/
//附件图片上传
Route::post('image', 'upload.Upload/image');
//附件视频上传
Route::post('video', 'upload.Upload/video');
//附件上传
- Route::post('document', 'upload.Upload/document');
+ Route::post('document/:type', 'upload.Upload/document');
//附件列表
Route::get('attachment', 'sys.Attachment/lists');
//附件列表
@@ -86,7 +90,7 @@ Route::group('sys', function () {
//附件组新增
Route::post('attachment/category', 'sys.Attachment/addCategory');
//附件组更新
- Route::put('attachment/category/:id', 'sys.Attachment/updateCategory');
+ Route::put('attachment/category/:id', 'sys.Attachment/editCategory');
//附件组列表
Route::get('attachment/category', 'sys.Attachment/categoryLists');
//删除单个附件组
@@ -96,7 +100,7 @@ Route::group('sys', function () {
//存储详情
Route::get('storage/:storage_type', 'upload.Storage/storageConfig');
//存储修改
- Route::put('storage/:storage_type', 'upload.Storage/updateStorage');
+ Route::put('storage/:storage_type', 'upload.Storage/editStorage');
//上传设置
Route::put('upload/config', 'upload.Upload/setUploadConfig');
//获取上传设置
@@ -107,7 +111,7 @@ Route::group('sys', function () {
//消息详情
Route::get('agreement/:key', 'sys.Agreement/info');
//短信配置修改
- Route::put('agreement/:key', 'sys.Agreement/update');
+ Route::put('agreement/:key', 'sys.Agreement/edit');
// 刷新菜单
Route::put('menu/refresh', 'sys.Menu/refreshMenu');
/***************************************************** 地区管理 ****************************************************/
@@ -127,6 +131,11 @@ Route::group('sys', function () {
Route::get('channel', 'sys.Channel/getChannelType');
//场景域名
Route::get('scene_domain', 'sys.Config/getSceneDomain');
+ /***************************************************** 系统环境 ****************************************************/
+ Route::get('system', 'sys.System/getSystemInfo');
+ /***************************************************** 应用管理 ****************************************************/
+ Route::get('applist', 'sys.App/getAppList');
+
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
diff --git a/niucloud/app/adminapi/route/upload.php b/niucloud/app/adminapi/route/upload.php
index b87ae3aff..3b0c234af 100644
--- a/niucloud/app/adminapi/route/upload.php
+++ b/niucloud/app/adminapi/route/upload.php
@@ -14,17 +14,3 @@ use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
use think\facade\Route;
-
-/**
- * 路由
- */
-Route::group('upload', function () {
- /***************************************************** 上传 ****************************************************/
- //证书上传
- Route::post('cert/:type', 'upload.Upload/cert');
-
-})->middleware([
- AdminCheckToken::class,
- AdminCheckRole::class,
- AdminLog::class
-]);
\ No newline at end of file
diff --git a/niucloud/app/adminapi/route/user.php b/niucloud/app/adminapi/route/user.php
index 7ee8b9959..636a5f5f4 100644
--- a/niucloud/app/adminapi/route/user.php
+++ b/niucloud/app/adminapi/route/user.php
@@ -25,8 +25,6 @@ Route::group('user', function () {
//用户详情
Route::get('user/:uid', 'user.user/info');
-
-
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
diff --git a/niucloud/app/adminapi/route/wechat.php b/niucloud/app/adminapi/route/wechat.php
index ed816c85b..1145ab793 100644
--- a/niucloud/app/adminapi/route/wechat.php
+++ b/niucloud/app/adminapi/route/wechat.php
@@ -33,7 +33,7 @@ Route::group('wechat', function () {
//获取微信菜单
Route::get('menu', 'wechat.Menu/info');
//设置微信菜单
- Route::put('menu', 'wechat.Menu/update');
+ Route::put('menu', 'wechat.Menu/edit');
/***************************************************** 关键词回复 ****************************************************/
//关键词回复详情
Route::get('reply/keywords/lists', 'wechat.Reply/keyword');
@@ -42,26 +42,26 @@ Route::group('wechat', function () {
//新增关键词回复
Route::post('reply/keywords', 'wechat.Reply/addKeyword');
//更新关键词回复
- Route::put('reply/keywords/:id', 'wechat.Reply/updateKeyword');
+ Route::put('reply/keywords/:id', 'wechat.Reply/editKeyword');
//删除关键词回复
Route::delete('reply/keywords/:id', 'wechat.Reply/deleteKeyword');
/***************************************************** 默认回复 ****************************************************/
//默认回复
Route::get('reply/default', 'wechat.Reply/default');
//更新默认默认回复
- Route::put('reply/default', 'wechat.Reply/updateDefault');
+ Route::put('reply/default', 'wechat.Reply/editDefault');
/***************************************************** 关注回复 ****************************************************/
//关注回复
Route::get('reply/subscribe', 'wechat.Reply/subscribe');
//更新关注回复
- Route::put('reply/subscribe', 'wechat.Reply/updateSubscribe');
+ Route::put('reply/subscribe', 'wechat.Reply/editSubscribe');
/***************************************************** 图文素材回复 ****************************************************/
//图文素材列表
Route::get('media', 'wechat.Media/lists');
//新增图文素材
Route::post('media', 'wechat.Media/add');
//更新图文素材
- Route::put('media/:id', 'wechat.Media/update');
+ Route::put('media/:id', 'wechat.Media/edit');
/***************************************************** 消息模板 ****************************************************/
//同步全部消息模板
Route::put('template/sync', 'wechat.Template/sync');
diff --git a/niucloud/app/api/controller/agreement/Agreement.php b/niucloud/app/api/controller/agreement/Agreement.php
index da31722bd..3810a8f47 100644
--- a/niucloud/app/api/controller/agreement/Agreement.php
+++ b/niucloud/app/api/controller/agreement/Agreement.php
@@ -11,8 +11,8 @@
namespace app\api\controller\agreement;
-use app\api\controller\BaseApiController;
use app\service\api\agreement\AgreementService;
+use core\base\BaseApiController;
/**
* 协议控制器
diff --git a/niucloud/app/api/controller/article/Article.php b/niucloud/app/api/controller/article/Article.php
index c2fc9e16a..27bbaada4 100644
--- a/niucloud/app/api/controller/article/Article.php
+++ b/niucloud/app/api/controller/article/Article.php
@@ -11,8 +11,8 @@
namespace app\api\controller\article;
-use app\api\controller\BaseApiController;
use app\service\api\article\ArticleService;
+use core\base\BaseApiController;
use think\Response;
/**
diff --git a/niucloud/app/api/controller/article/ArticleCategory.php b/niucloud/app/api/controller/article/ArticleCategory.php
index ddc14191d..45177a853 100644
--- a/niucloud/app/api/controller/article/ArticleCategory.php
+++ b/niucloud/app/api/controller/article/ArticleCategory.php
@@ -11,8 +11,8 @@
namespace app\api\controller\article;
-use app\api\controller\BaseApiController;
use app\service\api\article\ArticleCategoryService;
+use core\base\BaseApiController;
use think\Response;
/**
diff --git a/niucloud/app/api/controller/diy/Diy.php b/niucloud/app/api/controller/diy/Diy.php
index 6451f8b11..6313a2f47 100644
--- a/niucloud/app/api/controller/diy/Diy.php
+++ b/niucloud/app/api/controller/diy/Diy.php
@@ -11,10 +11,10 @@
namespace app\api\controller\diy;
-use app\api\controller\BaseApiController;
+use app\service\api\diy\DiyConfigService;
use app\service\api\diy\DiyRouteService;
use app\service\api\diy\DiyService;
-use app\service\api\diy\DiyConfigService;
+use core\base\BaseApiController;
use think\Response;
class Diy extends BaseApiController
@@ -48,10 +48,10 @@ class Diy extends BaseApiController
*/
public function share()
{
- $params = $this->request->params([
+ $data = $this->request->params([
[ 'route', '' ],
[ 'params', '' ]
]);
- return success(( new DiyRouteService() )->getShare($params));
+ return success(( new DiyRouteService() )->getShare($data));
}
}
diff --git a/niucloud/app/api/controller/login/Config.php b/niucloud/app/api/controller/login/Config.php
index ebb6d33b6..414aa1c55 100644
--- a/niucloud/app/api/controller/login/Config.php
+++ b/niucloud/app/api/controller/login/Config.php
@@ -11,9 +11,8 @@
namespace app\api\controller\login;
-use app\BaseController;
-use app\service\api\login\LoginService;
use app\service\api\member\MemberConfigService;
+use core\base\BaseController;
use think\Response;
class Config extends BaseController
diff --git a/niucloud/app/api/controller/login/Login.php b/niucloud/app/api/controller/login/Login.php
index e1c3f72db..d7874550c 100644
--- a/niucloud/app/api/controller/login/Login.php
+++ b/niucloud/app/api/controller/login/Login.php
@@ -11,10 +11,9 @@
namespace app\api\controller\login;
-use app\BaseController;
use app\service\api\captcha\CaptchaService;
use app\service\api\login\LoginService;
-use app\service\api\scan\ScanService;
+use core\base\BaseController;
use think\Response;
class Login extends BaseController
@@ -34,7 +33,7 @@ class Login extends BaseController
$result = (new LoginService())->account($data['username'], $data['password']);
if(!$result){
//账号密码错误...., 重置验证码
- return fail(301003);
+ return fail('ACCOUNT_OR_PASSWORD_ERROR');
}
return success($result);
@@ -46,7 +45,7 @@ class Login extends BaseController
*/
public function logout(){
(new LoginService)->logout();
- return success(301006);
+ return success('MEMBER_LOGOUT');
}
/**
@@ -91,6 +90,6 @@ class Login extends BaseController
//参数验证
$this->validate($data, 'app\validate\member\Member.reset_password');
(new LoginService())->resetPassword($data['mobile'], $data['password']);
- return success(301017);
+ return success('PASSWORD_RESET_SUCCESS');
}
}
diff --git a/niucloud/app/api/controller/login/Register.php b/niucloud/app/api/controller/login/Register.php
index 11e4a2a8c..5ba403e2b 100644
--- a/niucloud/app/api/controller/login/Register.php
+++ b/niucloud/app/api/controller/login/Register.php
@@ -11,9 +11,8 @@
namespace app\api\controller\login;
-use app\BaseController;
-use app\service\api\login\LoginService;
use app\service\api\login\RegisterService;
+use core\base\BaseController;
use think\Response;
class Register extends BaseController
diff --git a/niucloud/app/api/controller/member/Account.php b/niucloud/app/api/controller/member/Account.php
index ca7366386..aea6a477a 100644
--- a/niucloud/app/api/controller/member/Account.php
+++ b/niucloud/app/api/controller/member/Account.php
@@ -11,8 +11,9 @@
namespace app\api\controller\member;
-use app\api\controller\BaseApiController;
+use app\enum\member\MemberAccountEnum;
use app\service\api\member\MemberAccountService;
+use core\base\BaseApiController;
use think\Response;
/**
@@ -28,8 +29,9 @@ class Account extends BaseApiController
*/
public function point(){
$data = $this->request->params([
+ ['from_type', '']
]);
- $data[] = ['account_type', '=', 'point'];
+ $data['account_type'] = MemberAccountEnum::POINT;
return success((new MemberAccountService())->getPage($data));
}
@@ -39,10 +41,56 @@ class Account extends BaseApiController
*/
public function balance(){
$data = $this->request->params([
+ ['from_type', '']
]);
- $data[] = ['account_type', '=', 'balance'];
+ $data['account_type'] = MemberAccountEnum::BALANCE;
return success((new MemberAccountService())->getPage($data));
}
+ /**
+ * 零钱流水
+ * @return Response
+ */
+ public function money(){
+ $data = $this->request->params([
+ ['from_type', '']
+ ]);
+ $data['account_type'] = MemberAccountEnum::MONEY;
+ return success((new MemberAccountService())->getPage($data));
+ }
+
+ /**
+ * 账户记录数量
+ * @return Response
+ */
+ public function count(){
+ $data = $this->request->params([
+ ['from_type', ''],
+ ['account_type', '']
+ ]);
+ return success(data:(new MemberAccountService())->getCount($data));
+ }
+
+ /**
+ * 佣金流水
+ * @return Response
+ */
+ public function commission(){
+ $data = $this->request->params([
+ ['from_type', '']
+ ]);
+ $data['account_type'] = MemberAccountEnum::COMMISSION;
+ return success((new MemberAccountService())->getPage($data));
+ }
+
+ /**
+ * 账户来源
+ * @param $account_type
+ * @return Response
+ */
+ public function getFromType($account_type){
+
+ return success(MemberAccountEnum::getFromType($account_type));
+ }
}
diff --git a/niucloud/app/api/controller/member/CashOutAccount.php b/niucloud/app/api/controller/member/CashOutAccount.php
new file mode 100644
index 000000000..9a32248fd
--- /dev/null
+++ b/niucloud/app/api/controller/member/CashOutAccount.php
@@ -0,0 +1,92 @@
+request->params([
+ ['account_type', '']
+ ]);
+ return success((new MemberCashOutAccountService())->getPage($data));
+ }
+
+ /**
+ * 提现账户信息
+ * @param int $account_id
+ * @return \think\Response
+ */
+ public function info(int $account_id){
+ return success((new MemberCashOutAccountService())->getInfo($account_id));
+ }
+
+ /**
+ * 查询首条提现账户按账户类型
+ * @return void
+ */
+ public function firstInfo(){
+ $data = $this->request->params([
+ ['account_type', '']
+ ]);
+ return success((new MemberCashOutAccountService())->getFirstInfo($data));
+ }
+
+ /**
+ * 添加提现账号
+ * @return void
+ */
+ public function add(){
+ $data = $this->request->params([
+ ['account_type', ''],
+ ['bank_name', ''],
+ ['realname', ''],
+ ['account_no', '']
+ ]);
+ $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit');
+ $id = (new MemberCashOutAccountService())->add($data);
+ return success('ADD_SUCCESS', [ 'id' => $id ]);
+ }
+
+ /**
+ * 编辑提现账号
+ * @param int $account_id
+ * @return void
+ */
+ public function edit(int $account_id){
+ $data = $this->request->params([
+ ['account_type', ''],
+ ['bank_name', ''],
+ ['realname', ''],
+ ['account_no', '']
+ ]);
+ $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit');
+ (new MemberCashOutAccountService())->edit($account_id, $data);
+ return success('EDIT_SUCCESS');
+ }
+
+ /**
+ * 删除提现账号
+ * @param int $account_id
+ * @return \think\Response
+ */
+ public function del(int $account_id){
+ (new MemberCashOutAccountService())->del($account_id);
+ return success('DELETE_SUCCESS');
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/api/controller/member/Member.php b/niucloud/app/api/controller/member/Member.php
index c6ddb5afb..dd2eea787 100644
--- a/niucloud/app/api/controller/member/Member.php
+++ b/niucloud/app/api/controller/member/Member.php
@@ -11,9 +11,10 @@
namespace app\api\controller\member;
-use app\api\controller\BaseApiController;
use app\service\api\login\AuthService;
+use app\service\api\member\MemberLogService;
use app\service\api\member\MemberService;
+use core\base\BaseApiController;
use think\Response;
class Member extends BaseApiController
@@ -49,19 +50,19 @@ class Member extends BaseApiController
$data[$field] = $data['value'];
$this->validate($data, 'app\validate\member\Member.modify');
(new MemberService())->modify($field, $data['value']);
- return success(100004);
+ return success('MODIFY_SUCCESS');
}
/**
* 编辑会员
* @return Response
*/
- public function update(){
+ public function edit(){
$data = $this->request->params([
['data', []],
]);
- (new MemberService())->update($data['data']);
- return success(100004);
+ (new MemberService())->edit($data['data']);
+ return success('MODIFY_SUCCESS');
}
/**
@@ -75,4 +76,18 @@ class Member extends BaseApiController
]);
return success((new AuthService())->bindMobile($data['mobile'], $data['mobile_code']));
}
+
+ /**
+ * 会员日志
+ * @return Response
+ */
+ public function log(){
+ $data = $this->request->params([
+ ['route', ''],
+ ['params', ''],
+ ['pre_route', '']
+ ]);
+ (new MemberLogService())->log($data);
+ return success('SUCCESS');
+ }
}
diff --git a/niucloud/app/api/controller/member/MemberWithdraw.php b/niucloud/app/api/controller/member/MemberCashOut.php
similarity index 52%
rename from niucloud/app/api/controller/member/MemberWithdraw.php
rename to niucloud/app/api/controller/member/MemberCashOut.php
index 27cde20b8..5cd2dd872 100644
--- a/niucloud/app/api/controller/member/MemberWithdraw.php
+++ b/niucloud/app/api/controller/member/MemberCashOut.php
@@ -11,41 +11,46 @@
namespace app\api\controller\member;
-use app\api\controller\BaseApiController;
+use app\enum\member\MemberAccountEnum;
use app\enum\pay\TransferEnum;
-use app\service\api\login\AuthService;
-use app\service\api\member\MemberService;
-use app\service\api\member\MemberWithdrawService;
+use app\service\api\member\MemberCashOutService;
+use core\base\BaseApiController;
use think\Response;
-class MemberWithdraw extends BaseApiController
+class MemberCashOut extends BaseApiController
{
/**
* 会员提现列表
* @return Response
*/
- public function lists(){
- $data = $this->request->params([
- ['status', ''],
- ]);
- return success((new MemberWithdrawService())->getPage($data));
+ public function lists()
+ {
+ $data = array_filter($this->request->params([
+ [ 'status', '' ],
+ [ 'account_type', '' ]
+ ]), function($value){
+ return $value !== '';
+ });
+ return success(( new MemberCashOutService() )->getPage($data));
}
/**
* 提现详情
* @return Response
*/
- public function info($id){
- return success((new MemberWithdrawService())->getInfo($id));
+ public function info($id)
+ {
+ return success(( new MemberCashOutService() )->getInfo($id));
}
/**
* 提现配置
* @return Response
*/
- public function config(){
- return success((new MemberWithdrawService())->getWithdrawConfig());
+ public function config()
+ {
+ return success(( new MemberCashOutService() )->getCashOutConfig());
}
/**
@@ -58,19 +63,19 @@ class MemberWithdraw extends BaseApiController
}
/**
- * 绑定手机号
+ * 申请提现
* @return void
*/
- public function apply(){
+ public function apply()
+ {
$data = $this->request->params([
- ['apply_money', 0],
- ['transfer_type', ''],
- ['transfer_realname', ''],
- ['transfer_mobile', ''],
- ['transfer_bank', ''],
- ['transfer_account', ''],
+ [ 'apply_money', 0 ],
+ [ 'account_type', MemberAccountEnum::MONEY ],
+ [ 'transfer_type', '' ],
+ [ 'account_id', 0 ]
]);
- return success((new MemberWithdrawService())->apply($data));
+ $this->validate($data, 'app\validate\member\CashOut.apply');
+ return success(( new MemberCashOutService() )->apply($data));
}
/**
@@ -78,8 +83,9 @@ class MemberWithdraw extends BaseApiController
* @param $id
* @return Response
*/
- public function cancel($id){
- return success((new MemberWithdrawService())->cancel($id));
+ public function cancel($id)
+ {
+ return success(( new MemberCashOutService() )->cancel($id));
}
}
diff --git a/niucloud/app/api/controller/order/Recharge.php b/niucloud/app/api/controller/order/Recharge.php
index cebb55445..b1d76d878 100644
--- a/niucloud/app/api/controller/order/Recharge.php
+++ b/niucloud/app/api/controller/order/Recharge.php
@@ -11,8 +11,8 @@
namespace app\api\controller\order;
-use app\api\controller\BaseApiController;
use app\service\api\order\RechargeOrderService;
+use core\base\BaseApiController;
use think\Response;
class Recharge extends BaseApiController
@@ -32,4 +32,21 @@ class Recharge extends BaseApiController
return success($res);
}
+ public function lists(){
+ $data = $this->request->params([
+ ['order_status', '']
+ ]);
+ $res = (new RechargeOrderService())->getPage($data);
+ return success($res);
+ }
+
+ /**
+ * 查询充值订单详情
+ * @param int $order_id
+ * @return Response
+ */
+ public function detail(int $order_id){
+ $res = (new RechargeOrderService())->getDetail($order_id);
+ return success($res);
+ }
}
diff --git a/niucloud/app/api/controller/pay/Pay.php b/niucloud/app/api/controller/pay/Pay.php
index ba90be9d1..e041225cc 100644
--- a/niucloud/app/api/controller/pay/Pay.php
+++ b/niucloud/app/api/controller/pay/Pay.php
@@ -11,9 +11,8 @@
namespace app\api\controller\pay;
-use app\api\controller\BaseApiController;
use app\service\api\pay\PayService;
-use app\service\core\pay\CorePayService;
+use core\base\BaseApiController;
/**
* 微信服务端通信以及网页授权
@@ -25,15 +24,17 @@ class Pay extends BaseApiController
* 接收消息并推送
* @return void
*/
- public function notify($type, $site_id, $action){
- return (new PayService())->notify($type, $action);
+ public function notify($site_id, $channel, $type, $action)
+ {
+ return (new PayService())->notify($channel, $type, $action);
}
/**
* 去支付
* @return \think\Response
*/
- public function pay(){
+ public function pay()
+ {
$data = $this->request->params([
['type', ''],
@@ -42,20 +43,14 @@ class Pay extends BaseApiController
['buyer_id', ''],
['return_url', '']
]);
- return success(100000,(new PayService())->pay($data['type'], $data['out_trade_no'], $data['return_url'], $data['quit_url'], $data['buyer_id']));
+
+ return success('SUCCESS',(new PayService())->pay($data['type'], $data['out_trade_no'], $data['return_url'], $data['quit_url'], $data['buyer_id']));
}
- public function info($out_trade_no){
+ public function info($out_trade_no)
+ {
return success((new PayService())->getInfoByOutTradeNo($out_trade_no));
}
-
-
- public function test(){
- $data = $this->request->params(
- [['out_trade_no', '']]
- );
- dd((new CorePayService())->returnTo(1, $data['out_trade_no']));
- }
}
diff --git a/niucloud/app/api/controller/sys/Config.php b/niucloud/app/api/controller/sys/Config.php
index b3ea19f6b..8f7ff49d7 100644
--- a/niucloud/app/api/controller/sys/Config.php
+++ b/niucloud/app/api/controller/sys/Config.php
@@ -11,9 +11,8 @@
namespace app\api\controller\sys;
-use app\api\controller\BaseApiController;
use app\service\api\sys\ConfigService;
-use app\service\api\scan\ScanService;
+use core\base\BaseApiController;
use think\Response;
class Config extends BaseApiController
diff --git a/niucloud/app/api/controller/sys/Index.php b/niucloud/app/api/controller/sys/Index.php
index f291ccefa..9080fd93f 100644
--- a/niucloud/app/api/controller/sys/Index.php
+++ b/niucloud/app/api/controller/sys/Index.php
@@ -11,7 +11,7 @@
namespace app\controller;
-use app\BaseController;
+use core\base\BaseController;
use think\facade\App;
class Index extends BaseController
diff --git a/niucloud/app/api/controller/sys/Scan.php b/niucloud/app/api/controller/sys/Scan.php
index e37b990e2..ef638d3cc 100644
--- a/niucloud/app/api/controller/sys/Scan.php
+++ b/niucloud/app/api/controller/sys/Scan.php
@@ -11,8 +11,8 @@
namespace app\api\controller\sys;
-use app\api\controller\BaseApiController;
use app\service\api\scan\ScanService;
+use core\base\BaseApiController;
use think\Response;
class Scan extends BaseApiController
diff --git a/niucloud/app/api/controller/upload/Upload.php b/niucloud/app/api/controller/upload/Upload.php
index 3017196f4..de37b02af 100644
--- a/niucloud/app/api/controller/upload/Upload.php
+++ b/niucloud/app/api/controller/upload/Upload.php
@@ -11,14 +11,10 @@
namespace app\api\controller\upload;
-use app\api\controller\BaseApiController;
-use app\BaseController;
-use app\service\api\file\Base64Service;
-use app\service\api\file\FetchService;
-use app\service\api\file\UploadService;
-use app\service\api\weapp\WeappAuthService;
-use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use think\Response;
+use app\service\api\upload\Base64Service;
+use app\service\api\upload\FetchService;
+use app\service\api\upload\UploadService;
+use core\base\BaseApiController;
class Upload extends BaseApiController
{
diff --git a/niucloud/app/api/controller/weapp/Weapp.php b/niucloud/app/api/controller/weapp/Weapp.php
index 828b47418..e72eaab29 100644
--- a/niucloud/app/api/controller/weapp/Weapp.php
+++ b/niucloud/app/api/controller/weapp/Weapp.php
@@ -11,9 +11,8 @@
namespace app\api\controller\weapp;
-use app\api\controller\BaseApiController;
-use app\BaseController;
use app\service\api\weapp\WeappAuthService;
+use core\base\BaseApiController;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use think\Response;
diff --git a/niucloud/app/api/controller/wechat/Serve.php b/niucloud/app/api/controller/wechat/Serve.php
index 4485bda1a..b82b26759 100644
--- a/niucloud/app/api/controller/wechat/Serve.php
+++ b/niucloud/app/api/controller/wechat/Serve.php
@@ -11,8 +11,8 @@
namespace app\api\controller\wechat;
-use app\BaseController;
use app\service\api\wechat\WechatServeService;
+use core\base\BaseController;
/**
* 微信服务端通信以及网页授权
diff --git a/niucloud/app/api/controller/wechat/Wechat.php b/niucloud/app/api/controller/wechat/Wechat.php
index 9d548c66d..ab9e3536b 100644
--- a/niucloud/app/api/controller/wechat/Wechat.php
+++ b/niucloud/app/api/controller/wechat/Wechat.php
@@ -11,8 +11,8 @@
namespace app\api\controller\wechat;
-use app\BaseController;
use app\service\api\wechat\WechatAuthService;
+use core\base\BaseController;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use think\Response;
diff --git a/niucloud/app/api/middleware.php b/niucloud/app/api/middleware.php
new file mode 100644
index 000000000..afcb39f0b
--- /dev/null
+++ b/niucloud/app/api/middleware.php
@@ -0,0 +1,8 @@
+domain())),"/"),
+ ];
+ if(env('system.wap_domain')){
+ $allow_origin[] = rtrim(str_replace('https://','',str_replace('http://','',env('system.wap_domain'))),"/");
+ }
+ if(env('system.web_domain')){
+ $allow_origin[] = rtrim(str_replace('https://','',str_replace('http://','',env('system.web_domain'))),"/");
+ }
+ $referer = $request->header('referer');
+ $origin = '';
+ if(!empty($referer)){
+ $referer = parse_url($referer);
+ $referer = $referer['host'] ?? '';
+ $origin = rtrim(str_replace('https://','',str_replace('http://','',$referer)),"/");
+ }
+
+// $origin = $request->header('origin');
+ if(env('app_debug') || ($origin && in_array($origin, $allow_origin))){
+ header('Access-Control-Allow-Origin: *');
+// header('Access-Control-Allow-Origin: ' . $origin);
+ }else{
+ header('Access-Control-Allow-Origin: *');
+ throw new ApiException('SERVER_CROSS_REQUEST_FAIL');
+ }
+ return $next($request);
+ }
+}
diff --git a/niucloud/app/api/middleware/ApiChannel.php b/niucloud/app/api/middleware/ApiChannel.php
index 57f749aab..b55af86c2 100644
--- a/niucloud/app/api/middleware/ApiChannel.php
+++ b/niucloud/app/api/middleware/ApiChannel.php
@@ -12,7 +12,6 @@
namespace app\api\middleware;
use app\Request;
-use app\services\user\UserAuthServices;
use Closure;
use Exception;
@@ -27,7 +26,7 @@ class ApiChannel
/**
* @param Request $request
* @param Closure $next
- * @param bool $exception 是否把错误抛出
+ * @param bool $exception 是否把错误抛出
* @return mixed
* @throws Exception
*/
@@ -36,8 +35,8 @@ class ApiChannel
//微信或支付宝
if (preg_match('~micromessenger~i', $request->header('user-agent')) || preg_match('~alipay~i', $request->header('user-agent'))) {
$site_id = $request->param('site_id', -1);
- if($site_id != -1){
- $request->pushHeader([system_name('api_site_id_name') => $request->param('site_id')]);
+ if ($site_id != -1) {
+ $request->pushHeader([ system_name('api_site_id_name') => $request->param('site_id') ]);
}
}
return $next($request);
diff --git a/niucloud/app/api/middleware/ApiCheckToken.php b/niucloud/app/api/middleware/ApiCheckToken.php
index 26ff19f88..ff785fd2b 100644
--- a/niucloud/app/api/middleware/ApiCheckToken.php
+++ b/niucloud/app/api/middleware/ApiCheckToken.php
@@ -15,10 +15,9 @@ use app\enum\sys\AppTypeEnum;
use app\Request;
use app\service\api\login\AuthService;
use app\service\api\login\LoginService;
-use app\services\user\UserAuthServices;
use Closure;
use Exception;
-use extend\exception\AuthException;
+use core\exception\AuthException;
/**
@@ -31,7 +30,7 @@ class ApiCheckToken
/**
* @param Request $request
* @param Closure $next
- * @param bool $exception 是否把错误抛出
+ * @param bool $exception 是否把错误抛出
* @return mixed
* @throws Exception
*/
@@ -41,17 +40,17 @@ class ApiCheckToken
//通过配置来设置系统header参数
try {
$token = $request->apiToken();
- $token_info = (new LoginService())->parseToken($token);
+ $token_info = ( new LoginService() )->parseToken($token);
} catch (AuthException $e) {
//是否将登录错误抛出
if ($exception)
return fail($e->getMessage());
}
- if(!empty($token_info)){
- $request->memberId($token_info['member_id']);
+ if (!empty($token_info)) {
+ $request->memberId($token_info[ 'member_id' ]);
}
//校验会员和站点
- (new AuthService())->checkSiteAuth($request);
+ ( new AuthService() )->checkSiteAuth($request);
return $next($request);
}
}
diff --git a/niucloud/app/api/route/dispatch/BindDispatch.php b/niucloud/app/api/route/dispatch/BindDispatch.php
index 3a5eafe1b..82fd6eee3 100644
--- a/niucloud/app/api/route/dispatch/BindDispatch.php
+++ b/niucloud/app/api/route/dispatch/BindDispatch.php
@@ -3,10 +3,7 @@
namespace app\api\route\dispatch;
use app\enum\member\MemberLoginTypeEnum;
-use app\enum\common\ChannelEnum;
use think\App;
-use think\helper\Str;
-use think\route\Dispatch;
use think\route\dispatch\Controller;
class BindDispatch extends Controller
diff --git a/niucloud/app/api/route/member.php b/niucloud/app/api/route/member.php
index aac8981cc..209c550d4 100644
--- a/niucloud/app/api/route/member.php
+++ b/niucloud/app/api/route/member.php
@@ -18,7 +18,7 @@ use think\facade\Route;
/**
* 会员个人信息管理
*/
-Route::group('member', function () {
+Route::group('member', function() {
/***************************************************** 会员管理 ****************************************************/
//会员个人详情
@@ -28,7 +28,7 @@ Route::group('member', function () {
//会员信息修改
Route::put('modify/:field', 'member.Member/modify');
//会员信息编辑
- Route::put('update', 'member.Member/update');
+ Route::put('edit', 'member.Member/edit');
//绑定手机号
Route::put('mobile', 'member.Member/mobile');
@@ -37,19 +37,50 @@ Route::group('member', function () {
Route::get('account/point', 'member.Account/point');
//会员余额流水
Route::get('account/balance', 'member.Account/balance');
- /***************************************************** 会员提现 ****************************************************/Route::get('account/point', 'member.Account/point');
+ //会员零钱流水
+ Route::get('account/money', 'member.Account/money');
+ //会员零钱流水
+ Route::get('account/count', 'member.Account/count');
+ //会员佣金流水
+ Route::get('account/commission', 'member.Account/commission');
+ //账户来源
+ Route::get('account/fromtype/:account_type', 'member.Account/getFromType');
+ /***************************************************** 会员提现 ****************************************************/
+ Route::get('account/point', 'member.Account/point');
//会员提现列表
- Route::get('withdraw', 'member.MemberWithdraw/lists');
+ Route::get('cash_out', 'member.MemberCashOut/lists');
//会员提现详情
- Route::get('withdraw/:id', 'member.MemberWithdraw/info');
+ Route::get('cash_out/:id', 'member.MemberCashOut/info');
//提现配置
- Route::get('withdraw/config', 'member.MemberWithdraw/config');
+ Route::get('cash_out/config', 'member.MemberCashOut/config');
//提现转账方式
- Route::get('withdraw/transfertype', 'member.MemberWithdraw/getTransferType');
+ Route::get('cash_out/transfertype', 'member.MemberCashOut/getTransferType');
//提现申请
- Route::post('withdraw/apply', 'member.MemberWithdraw/apply');
+ Route::post('cash_out/apply', 'member.MemberCashOut/apply');
//撤销提现申请
- Route::put('withdraw/cancel/:id', 'member.MemberWithdraw/cancel');
+ Route::put('cash_out/cancel/:id', 'member.MemberCashOut/cancel');
+ // 提现账号列表
+ Route::get('cashout_account', 'member.CashOutAccount/lists');
+ // 提现账号详情
+ Route::get('cashout_account/:account_id', 'member.CashOutAccount/info');
+ // 首条提现账号详情
+ Route::get('cashout_account/firstinfo', 'member.CashOutAccount/firstInfo');
+ // 添加提现账号
+ Route::post('cashout_account', 'member.CashOutAccount/add');
+ // 编辑提现账号
+ Route::put('cashout_account/:account_id', 'member.CashOutAccount/edit');
+ // 删除提现账号
+ Route::delete('cashout_account/:account_id', 'member.CashOutAccount/del');
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, true)
+ ->middleware(ApiLog::class);
+
+
+Route::group('member', function() {
+
+ /***************************************************** 会员管理 ****************************************************/
+ //会员日志
+ Route::post('log', 'member.Member/log');
+})->middleware(ApiChannel::class)
+ ->middleware(ApiCheckToken::class)
->middleware(ApiLog::class);
\ No newline at end of file
diff --git a/niucloud/app/api/route/order.php b/niucloud/app/api/route/order.php
index c05addf66..d9d60aad3 100644
--- a/niucloud/app/api/route/order.php
+++ b/niucloud/app/api/route/order.php
@@ -23,7 +23,10 @@ Route::group('order', function () {
/***************************************************** 充值订单相关 *************************************************/
//充值订单创建
Route::post('recharge', 'order.Recharge/create');
-
+ // 充值订单列表
+ Route::get('recharge', 'order.Recharge/lists');
+ // 充值订单详情
+ Route::get('recharge/:order_id', 'order.Recharge/detail');
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, true)
->middleware(ApiLog::class);
\ No newline at end of file
diff --git a/niucloud/app/api/route/pay.php b/niucloud/app/api/route/pay.php
index ca8de085d..65b555be3 100644
--- a/niucloud/app/api/route/pay.php
+++ b/niucloud/app/api/route/pay.php
@@ -15,16 +15,10 @@ use app\api\middleware\ApiLog;
use think\facade\Route;
//支付异步回调
-Route::any('pay/notify/:type/:site_id/:action', 'pay.Pay/notify')
+Route::any('pay/notify/:site_id/:channel/:type/:action', 'pay.Pay/notify')
->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class)
->middleware(ApiLog::class);
-
-
-
-Route::any('pay/test', 'pay.Pay/test')->middleware(ApiChannel::class)
- ->middleware(ApiCheckToken::class)
- ->middleware(ApiLog::class);
/**
* 路由
*/
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index b316121aa..08f5e2ca1 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -76,3 +76,5 @@ Route::group(function () {
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class)
->middleware(ApiLog::class);
+//加载插件路由
+(new \core\addon\AddonLoader("Route"))->load(['app_type' => 'api']);
\ No newline at end of file
diff --git a/niucloud/app/common.php b/niucloud/app/common.php
index 4e14f04a7..33543a618 100644
--- a/niucloud/app/common.php
+++ b/niucloud/app/common.php
@@ -12,11 +12,11 @@ use think\facade\Cache;
* @param int $msg
* @param array $
*/
-function success($msg = 100000, array|string|null $data = [], int $code = 200, int $http_code = 200): Response
+function success($msg = 'SUCCESS', array|string|null $data = [], int $code = 1, int $http_code = 200): Response
{
if (is_array($msg)) {
$data = $msg;
- $msg = 100000;
+ $msg = 'SUCCESS';
}
return Response::create(['data' => $data, 'msg' => get_lang($msg), 'code' => $code], 'json', $http_code);
@@ -25,11 +25,11 @@ function success($msg = 100000, array|string|null $data = [], int $code = 200, i
/**
* 接口操作失败,返回信息
*/
-function fail($msg = 100005, ?array $data = [], int $code = 400, int $http_code = 200): Response
+function fail($msg = 'FAIL', ?array $data = [], int $code = 0, int $http_code = 200): Response
{
if (is_array($msg)) {
$data = $msg;
- $msg = 100005;
+ $msg = 'FAIL';
}
return Response::create(['data' => $data, 'msg' => get_lang($msg), 'code' => $code], 'json', $http_code);
}
@@ -238,6 +238,14 @@ function get_date_by_time(?int $time = null)
return date('Y-m-d h:i:s', time());
}
+function get_start_and_end_time_by_day($day = '')
+{
+ $date = $day ?: date('Y-m-d', time());
+ $day_start_time = strtotime($date);
+ //当天结束之间
+ $day_end_time = $day_start_time + 86400;
+ return [$day_start_time, $day_end_time];
+}
/**
* 路径转链接
@@ -268,15 +276,29 @@ function url_to_path($url)
* @param $queue
* @return void
*/
-function create_queue($job, $data = '', $delay = 0, $queue = null)
+function create_job($job, $data = '', $delay = 0, $queue = null)
{
if ($delay > 0) {
- Queue::later($delay, $job, $data, $queue);
+ $is_success = Queue::later($delay, $job, $data, $queue);
} else {
- Queue::push($job, $data, $queue);
+ $is_success = Queue::push($job, $data, $queue);
+ }
+ if ($is_success !== false) {
+ return true;
+ } else {
+ return false;
}
}
+/**
+ * 获取插件对应资源文件(插件安装后获取)
+ * @param $addon //插件名称
+ * @param $file_name //文件名称(包含resource文件路径)
+ */
+function addon_resource($addon, $file_name)
+{
+ return "addon/". $addon. "/". $file_name;
+}
/**
* 判断 文件/目录 是否可写(取代系统自带的 is_writeable 函数)
*
@@ -406,12 +428,16 @@ function array_merge2(array $array1, array $array2)
if (array_key_exists($array2_k, $array1)) {
foreach ($array2_v as $array2_kk => $array2_vv) {
if (array_key_exists($array2_kk, $array1[$array2_k])) {
- $array1[$array2_k][$array2_kk] = array_merge($array1[$array2_k][$array2_kk], $array2_vv);
- } else
+ if (gettype($array2_vv) == 'array') {
+ $array1[$array2_k][$array2_kk] = array_merge($array1[$array2_k][$array2_kk], $array2_vv);
+ }
+ } else {
$array1[$array2_k][$array2_kk] = $array2_vv;
+ }
}
- } else
+ } else {
$array1[$array2_k] = $array2_v;
+ }
}
return $array1;
}
@@ -442,9 +468,10 @@ function get_files_by_dir($dir)
* 文件夹文件拷贝
* @param string $src 来源文件夹
* @param string $dst 目的地文件夹
+ * @param array $files 文件夹集合
* @return bool
*/
-function dir_copy(string $src = '', string $dst = '')
+function dir_copy(string $src = '', string $dst = '', &$files = [])
{
if (empty($src) || empty($dst)) {
return false;
@@ -454,9 +481,10 @@ function dir_copy(string $src = '', string $dst = '')
while (false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src . '/' . $file)) {
- dir_copy($src . '/' . $file, $dst . '/' . $file);
+ dir_copy($src . '/' . $file, $dst . '/' . $file, $files);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
+ $files[] = $dst . '/' . $file;
}
}
}
@@ -475,8 +503,8 @@ function dir_remove(string $dst = '', array $dirs = [])
if (empty($dirs) || empty($dst)) {
return false;
}
- foreach($dirs as $v){
- @unlink($dst.$v);
+ foreach ($dirs as $v) {
+ @unlink($dst . $v);
}
return true;
}
@@ -493,7 +521,7 @@ function dir_mkdir($path = '', $mode = 0777, $recursive = true)
{
clearstatcache();
if (!is_dir($path)) {
- mkdir($path, $mode, $recursive);
+ @mkdir($path, $mode, $recursive);
return chmod($path, $mode);
}
return true;
@@ -591,7 +619,37 @@ function search_dir($path, &$data, $search = '')
$fp->close();
}
if (is_file($path)) {
- if($search) $path = str_replace($search, '', $path);
+ if ($search) $path = str_replace($search, '', $path);
$data[] = $path;
}
+}
+
+function remove_empty_dir($dirs)
+{
+
+}
+
+/**
+ * 获取文件地图
+ * @param $path
+ * @param array $arr
+ * @return array
+ */
+function getFileMap($path, $arr = [])
+{
+ if (is_dir($path)) {
+ $dir = scandir($path);
+ foreach ($dir as $file_path) {
+ if ($file_path != '.' && $file_path != '..') {
+ $temp_path = $path . '/' . $file_path;
+ if (is_dir($temp_path)) {
+ $arr[$temp_path] = $file_path;
+ $arr = getFileMap($temp_path, $arr);
+ } else {
+ $arr[$temp_path] = $file_path;
+ }
+ }
+ }
+ return $arr;
+ }
}
\ No newline at end of file
diff --git a/niucloud/app/enum/addon/AddonEnum.php b/niucloud/app/enum/addon/AddonEnum.php
new file mode 100644
index 000000000..b16a9f8eb
--- /dev/null
+++ b/niucloud/app/enum/addon/AddonEnum.php
@@ -0,0 +1,51 @@
+ get_lang('enum_addon.install'),
+ self::UNINSTALL => get_lang('enum_addon.uninstall'),
+ self::UPDATE => get_lang('enum_addon.update'),
+ ];
+ }
+
+ /**
+ * 状态
+ * @return array
+ */
+ public static function getStatus(){
+ return [
+ self::ON => get_lang('enum_addon.status_on'),//展示
+ self::OFF => get_lang('enum_addon.status_off'),//隐藏
+ ];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/model/BaseModel.php b/niucloud/app/enum/cash_out/CashOutTypeEnum.php
similarity index 80%
rename from niucloud/app/model/BaseModel.php
rename to niucloud/app/enum/cash_out/CashOutTypeEnum.php
index c58b58235..c1846d5db 100644
--- a/niucloud/app/model/BaseModel.php
+++ b/niucloud/app/enum/cash_out/CashOutTypeEnum.php
@@ -9,17 +9,17 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\model;
+namespace app\enum\cash_out;
-use think\Model;
-
/**
- * 基础模型
- * Class BaseModel
- * @package app\model
+ * 提现类型
*/
-class BaseModel extends Model
+class CashOutTypeEnum
{
+ //会员零钱提现
+ const MEMBER_CASH_OUT = 'member_cash_out';
+
+
}
\ No newline at end of file
diff --git a/niucloud/app/enum/common/ChannelEnum.php b/niucloud/app/enum/common/ChannelEnum.php
index 87c09538b..4e5bba7ee 100644
--- a/niucloud/app/enum/common/ChannelEnum.php
+++ b/niucloud/app/enum/common/ChannelEnum.php
@@ -12,7 +12,7 @@
namespace app\enum\common;
use app\enum\pay\PayEnum;
-use extend\exception\PayException;
+use core\exception\PayException;
/**
* 渠道枚举类
@@ -46,45 +46,4 @@ class ChannelEnum
}
return $data[$type] ?? '';
}
-
- /**
- * 使用场景对支付方式的影响
- * @param $channel
- * @return array
- */
- public static function getAllowPayType($channel){
- $list = array(
- self::WEAPP => [
- PayEnum::WECHATPAY,
- PayEnum::OFFLINEPAY,
- PayEnum::BALANCEPAY,
- ],
- self::WECHAT => [
- PayEnum::WECHATPAY,
- PayEnum::BALANCEPAY,
- PayEnum::OFFLINEPAY,
- ],
- self::H5 => [
- PayEnum::WECHATPAY,
- PayEnum::ALIPAY,
- PayEnum::OFFLINEPAY,
- PayEnum::BALANCEPAY,
- ],
- self::PC => [
- PayEnum::WECHATPAY,
- PayEnum::ALIPAY,
- PayEnum::OFFLINEPAY,
- PayEnum::BALANCEPAY,
- ],
- self::APP => [
- PayEnum::WECHATPAY,
- PayEnum::ALIPAY,
- PayEnum::OFFLINEPAY,
- PayEnum::BALANCEPAY,
- ],
- );
-
- return $list[$channel] ?? [];
- }
-
}
\ No newline at end of file
diff --git a/niucloud/app/enum/diy/ComponentBasicsEnum.php b/niucloud/app/enum/diy/ComponentBasicsEnum.php
deleted file mode 100644
index 024063c61..000000000
--- a/niucloud/app/enum/diy/ComponentBasicsEnum.php
+++ /dev/null
@@ -1,222 +0,0 @@
- 'Text',
- 'title' => '标题',
- 'type' => ComponentTypeEnum::BASICS,
- 'icon' => 'iconfont-iconbiaoti',
- 'path' => 'edit-text', // 编辑组件属性
- 'support_page' => [], // 支持页面
- 'max_count' => 0, // 最大添加数量
- 'sort' => 10001,
- 'value' => [
- "style" => "style-1",
- "styleName" => "风格1",
- "text" => "标题栏",
- "link" => [
- "name" => ""
- ],
- "textColor" => "#303133",
- "fontSize" => 16,
- "fontWeight" => "normal",
- "textAlign" => "left",
- "subTitle" => [
- "text" => "副标题",
- "color" => "#999999",
- "fontSize" => 14,
- "control" => false,
- "fontWeight" => "normal"
- ],
- "more" => [
- "text" => "查看更多",
- "control" => false,
- "isShow" => true,
- "link" => [
- "name" => ""
- ],
- "color" => "#999999"
- ]
- ]
- ],
- [
- 'name' => 'ImageAds',
- 'title' => '图片广告',
- 'type' => ComponentTypeEnum::BASICS,
- 'icon' => 'iconfont-icontupianguanggao1',
- 'path' => 'edit-image-ads', // 编辑组件属性
- 'support_page' => [], // 支持页面
- 'max_count' => 0, // 最大添加数量
- 'sort' => 10002,
- 'value' => [
- "list" => [
- [
- "link" => [
- "name" => ""
- ],
- "imageUrl" => "",
- "imgWidth" => 0,
- "imgHeight" => 0
- ]
- ]
- ]
- ],
- [
- 'name' => 'GraphicNav',
- 'title' => '图文导航',
- 'type' => ComponentTypeEnum::BASICS,
- 'icon' => 'iconfont-icontuwendaohang2',
- 'path' => 'edit-graphic-nav',
- 'support_page' => [],
- 'max_count' => 0,
- 'sort' => 10003,
- 'value' => [
- "layout" => "horizontal",
- "navTitle" => "",
- "mode" => "graphic",
- "type" => "img",
- "showStyle" => "fixed",
- "rowCount" => 4,
- "pageCount" => 2,
- "carousel" => [
- "type" => "circle",
- "color" => "#FFFFFF"
- ],
- "imageSize" => 40,
- "aroundRadius" => 25,
- "font" => [
- "size" => 14,
- "weight" => "normal",
- "color" => "#303133"
- ],
- "list" => [
- [
- "title" => "",
- "link" => [
- "name" => ""
- ],
- "imageUrl" => "",
- "label" => [
- "control" => false,
- "text" => "热门",
- "textColor" => "#FFFFFF",
- "bgColorStart" => "#F83287",
- "bgColorEnd" => "#FE3423"
- ]
- ],
- [
- "title" => "",
- "link" => [
- "name" => ""
- ],
- "imageUrl" => "",
- "label" => [
- "control" => false,
- "text" => "热门",
- "textColor" => "#FFFFFF",
- "bgColorStart" => "#F83287",
- "bgColorEnd" => "#FE3423"
- ]
- ],
- [
- "title" => "",
- "link" => [
- "name" => ""
- ],
- "imageUrl" => "",
- "label" => [
- "control" => false,
- "text" => "热门",
- "textColor" => "#FFFFFF",
- "bgColorStart" => "#F83287",
- "bgColorEnd" => "#FE3423"
- ]
- ],
- [
- "title" => "",
- "link" => [
- "name" => ""
- ],
- "imageUrl" => "",
- "label" => [
- "control" => false,
- "text" => "热门",
- "textColor" => "#FFFFFF",
- "bgColorStart" => "#F83287",
- "bgColorEnd" => "#FE3423"
- ]
- ]
- ],
- ]
- ],
- [
- 'name' => 'Article',
- 'title' => '文章',
- 'type' => ComponentTypeEnum::BASICS,
- 'icon' => 'iconfont-iconwenzhang',
- 'path' => 'edit-article',
- 'support_page' => [],
- 'max_count' => 0,
- 'sort' => 10004,
- 'value' => [
- 'sources' => 'initial',
- 'count' => 8,
- 'articleIds' => []
- ],
- ],
- [
- 'name' => 'HorzBlank',
- 'title' => '辅助空白',
- 'type' => ComponentTypeEnum::BASICS,
- 'icon' => 'iconfont-iconfuzhukongbai1',
- 'path' => 'edit-horz-blank',
- 'support_page' => [],
- 'max_count' => 0,
- 'sort' => 10005,
- 'value' => [
- 'height' => 20
- ],
- ],
- [
- 'name' => 'MemberInfo',
- 'title' => '会员信息',
- 'type' => ComponentTypeEnum::BASICS,
- 'icon' => 'iconfont-iconhuiyuanzhongxin',
- 'path' => 'edit-member-info',
- 'support_page' => [ PageEnum::MEMBER_INDEX ],
- 'max_count' => 0,
- 'sort' => 10006,
- 'value' => [
- 'height' => 20
- ],
- ],
-
- ];
- }
-
-}
\ No newline at end of file
diff --git a/niucloud/app/enum/diy/ComponentEnum.php b/niucloud/app/enum/diy/ComponentEnum.php
new file mode 100644
index 000000000..43c756081
--- /dev/null
+++ b/niucloud/app/enum/diy/ComponentEnum.php
@@ -0,0 +1,217 @@
+ [
+ 'title' => get_lang('enum_diy.component_type_basics'),
+ 'list' => [
+ 'Text' => [
+ 'title' => '标题',
+ 'icon' => 'iconfont-iconbiaoti',
+ 'path' => 'edit-text', // 编辑组件属性
+ 'support_page' => [], // 支持页面
+ 'max_count' => 0, // 最大添加数量
+ 'sort' => 10001,
+ 'value' => [
+ "style" => "style-1",
+ "styleName" => "风格1",
+ "text" => "标题栏",
+ "link" => [
+ "name" => ""
+ ],
+ "textColor" => "#303133",
+ "fontSize" => 16,
+ "fontWeight" => "normal",
+ "textAlign" => "left",
+ "subTitle" => [
+ "text" => "副标题",
+ "color" => "#999999",
+ "fontSize" => 14,
+ "control" => false,
+ "fontWeight" => "normal"
+ ],
+ "more" => [
+ "text" => "查看更多",
+ "control" => false,
+ "isShow" => true,
+ "link" => [
+ "name" => ""
+ ],
+ "color" => "#999999"
+ ]
+ ]
+ ],
+ 'ImageAds' => [
+ 'title' => '图片广告',
+ 'icon' => 'iconfont-icontupianguanggao1',
+ 'path' => 'edit-image-ads', // 编辑组件属性
+ 'support_page' => [], // 支持页面
+ 'max_count' => 0, // 最大添加数量
+ 'sort' => 10002,
+ 'value' => [
+ "list" => [
+ [
+ "link" => [
+ "name" => ""
+ ],
+ "imageUrl" => "",
+ "imgWidth" => 0,
+ "imgHeight" => 0
+ ]
+ ]
+ ]
+ ],
+ 'GraphicNav' => [
+ 'title' => '图文导航',
+ 'icon' => 'iconfont-icontuwendaohang2',
+ 'path' => 'edit-graphic-nav',
+ 'support_page' => [],
+ 'max_count' => 0,
+ 'sort' => 10003,
+ 'value' => [
+ "layout" => "horizontal",
+ "navTitle" => "",
+ "mode" => "graphic",
+ "type" => "img",
+ "showStyle" => "fixed",
+ "rowCount" => 4,
+ "pageCount" => 2,
+ "carousel" => [
+ "type" => "circle",
+ "color" => "#FFFFFF"
+ ],
+ "imageSize" => 40,
+ "aroundRadius" => 25,
+ "font" => [
+ "size" => 14,
+ "weight" => "normal",
+ "color" => "#303133"
+ ],
+ "list" => [
+ [
+ "title" => "",
+ "link" => [
+ "name" => ""
+ ],
+ "imageUrl" => "",
+ "label" => [
+ "control" => false,
+ "text" => "热门",
+ "textColor" => "#FFFFFF",
+ "bgColorStart" => "#F83287",
+ "bgColorEnd" => "#FE3423"
+ ]
+ ],
+ [
+ "title" => "",
+ "link" => [
+ "name" => ""
+ ],
+ "imageUrl" => "",
+ "label" => [
+ "control" => false,
+ "text" => "热门",
+ "textColor" => "#FFFFFF",
+ "bgColorStart" => "#F83287",
+ "bgColorEnd" => "#FE3423"
+ ]
+ ],
+ [
+ "title" => "",
+ "link" => [
+ "name" => ""
+ ],
+ "imageUrl" => "",
+ "label" => [
+ "control" => false,
+ "text" => "热门",
+ "textColor" => "#FFFFFF",
+ "bgColorStart" => "#F83287",
+ "bgColorEnd" => "#FE3423"
+ ]
+ ],
+ [
+ "title" => "",
+ "link" => [
+ "name" => ""
+ ],
+ "imageUrl" => "",
+ "label" => [
+ "control" => false,
+ "text" => "热门",
+ "textColor" => "#FFFFFF",
+ "bgColorStart" => "#F83287",
+ "bgColorEnd" => "#FE3423"
+ ]
+ ]
+ ],
+ ]
+ ],
+ 'Article' => [
+ 'title' => '文章',
+ 'icon' => 'iconfont-iconwenzhang',
+ 'path' => 'edit-article',
+ 'support_page' => [],
+ 'max_count' => 0,
+ 'sort' => 10004,
+ 'value' => [
+ 'sources' => 'initial',
+ 'count' => 8,
+ 'articleIds' => []
+ ],
+ ],
+ 'HorzBlank' => [
+ 'title' => '辅助空白',
+ 'icon' => 'iconfont-iconfuzhukongbai1',
+ 'path' => 'edit-horz-blank',
+ 'support_page' => [],
+ 'max_count' => 0,
+ 'sort' => 10005,
+ 'value' => [
+ 'height' => 20
+ ],
+ ],
+ 'MemberInfo' => [
+ 'title' => '会员信息',
+ 'icon' => 'iconfont-iconhuiyuanzhongxin',
+ 'path' => 'edit-member-info',
+ 'support_page' => [ 'DIY_MEMBER_INDEX' ],
+ 'max_count' => 0,
+ 'sort' => 10006,
+ 'value' => [
+ 'height' => 20
+ ],
+ ],
+ ],
+ ],
+ ];
+ return (new AddonLoader("UniappComponent"))->load($system_components);
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/enum/diy/LinkEnum.php b/niucloud/app/enum/diy/LinkEnum.php
index bd0bd5c4c..dca6371a6 100644
--- a/niucloud/app/enum/diy/LinkEnum.php
+++ b/niucloud/app/enum/diy/LinkEnum.php
@@ -11,6 +11,8 @@
namespace app\enum\diy;
+use core\addon\AddonLoader;
+
/**
* 自定义链接
* Class PageEnum
@@ -24,7 +26,7 @@ class LinkEnum
*/
public static function getLink()
{
- $data = [
+ $system_links = [
[
'name' => 'SYSTEM_LINK',
'title' => get_lang('enum_diy.system_link'),
@@ -72,6 +74,12 @@ class LinkEnum
'url' => '/pages/member/point',
'is_share' => 0
],
+ [
+ 'name' => 'MEMBER_COMMISSION',
+ 'title' => get_lang('enum_diy.member_my_commission'),
+ 'url' => '/pages/member/commission',
+ 'is_share' => 0
+ ]
]
],
[
@@ -87,7 +95,7 @@ class LinkEnum
'child_list' => []
]
];
- return $data;
+ return (new AddonLoader("UniappLink"))->load($system_links);;
}
}
\ No newline at end of file
diff --git a/niucloud/app/enum/diy/PageEnum.php b/niucloud/app/enum/diy/PageEnum.php
index 173d87266..43702bc59 100644
--- a/niucloud/app/enum/diy/PageEnum.php
+++ b/niucloud/app/enum/diy/PageEnum.php
@@ -11,6 +11,8 @@
namespace app\enum\diy;
+use core\addon\AddonLoader;
+
/**
* 自定义页面类型
* Class PageEnum
@@ -18,45 +20,33 @@ namespace app\enum\diy;
*/
class PageEnum
{
- // 首页
- const INDEX = 'DIY_INDEX';
- const INDEX_PAGE = 'pages/index/index';
-
- // 个人中心
- const MEMBER_INDEX = 'DIY_MEMBER_INDEX';
- const MEMBER_PAGE = 'pages/member/index';
-
- // 自定义页面
- const DIY_PAGE = 'DIY_PAGE';
- const DIY_PAGE_PAGE = 'pages/index/diy';
/**
* 获取页面类型
* @param string $type
+ * @return array|string
*/
public static function getPageType($type = '')
{
- $data = [
- self::INDEX => [
- 'type' => self::INDEX,
- 'type_name' => get_lang('enum_diy.page_index'),
- 'page' => self::INDEX_PAGE,
+ $system_pages = [
+ 'DIY_INDEX' => [
+ 'title' => get_lang('enum_diy.page_index'),
+ 'page' => 'pages/index/index',
],
- self::MEMBER_INDEX => [
- 'type' => self::MEMBER_INDEX,
- 'type_name' => get_lang('enum_diy.page_member_index'),
- 'page' => self::MEMBER_PAGE,
+ 'DIY_MEMBER_INDEX' => [
+ 'title' => get_lang('enum_diy.page_member_index'),
+ 'page' => 'pages/member/index',
],
- self::DIY_PAGE => [
- 'type' => self::DIY_PAGE,
- 'type_name' => get_lang('enum_diy.page_diy'),
- 'page' => self::DIY_PAGE_PAGE,
+ 'DIY_PAGE' => [
+ 'title' => get_lang('enum_diy.page_diy'),
+ 'page' => 'pages/index/diy',
]
];
+ $pages = (new AddonLoader("UniappPages"))->load($system_pages);
if (empty($type)) {
- return $data;
+ return $pages;
}
- return $data[ $type ] ?? '';
+ return $pages[ $type ] ?? '';
}
}
\ No newline at end of file
diff --git a/niucloud/app/enum/install/menu/plugin/admin/plugin.php b/niucloud/app/enum/install/menu/plugin/admin/plugin.php
deleted file mode 100644
index 8a15df37e..000000000
--- a/niucloud/app/enum/install/menu/plugin/admin/plugin.php
+++ /dev/null
@@ -1,3 +0,0 @@
- '控制台',
- 'menu_key' => 'overview',
- 'menu_type' => 1,
- 'icon' => 'element-Monitor',
- 'api_url' => '',
- 'router_path' => 'index',
- 'view_path' => 'index/index',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '装修管理',
- 'menu_key' => 'diy',
- 'menu_type' => 0,
- 'icon' => 'element-Brush',
- 'api_url' => '',
- 'router_path' => 'diy',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '首页装修',
- 'menu_key' => 'diy_page_index',
- 'menu_type' => 1,
- 'icon' => 'element-House',
- 'api_url' => '',
- 'router_path' => 'index',
- 'view_path' => 'diy/index',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '个人中心',
- 'menu_key' => 'diy_page_member',
- 'menu_type' => 1,
- 'icon' => 'element-ScaleToOriginal',
- 'api_url' => '',
- 'router_path' => 'member',
- 'view_path' => 'diy/member',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '保存',
- 'menu_key' => 'diy_page_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '页面管理',
- 'menu_key' => 'diy_page_list',
- 'menu_type' => 1,
- 'icon' => 'iconfont-icondianpuzhuangxiu',
- 'api_url' => '',
- 'router_path' => 'list',
- 'view_path' => 'diy/list',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '底部导航',
- 'menu_key' => 'diy_bottom',
- 'menu_type' => 1,
- 'icon' => 'iconfont-icondibudaohang',
- 'api_url' => '',
- 'router_path' => 'tabbar',
- 'view_path' => 'diy/tabbar',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '保存',
- 'menu_key' => 'diy_tabbar_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '素材管理',
- 'menu_key' => 'attachment',
- 'menu_type' => 1,
- 'icon' => 'element-Files',
- 'api_url' => '',
- 'router_path' => 'attachment',
- 'view_path' => 'tools/attachment',
- 'methods' => '',
- 'sort' => 50,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ],
- ],
- [
- 'menu_name' => '装修管理',
- 'menu_key' => 'decorate',
- 'menu_type' => 0,
- 'icon' => 'element-Brush',
- 'api_url' => '',
- 'router_path' => 'decorate',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '装修',
- 'menu_key' => 'page_decorate',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'edit',
- 'view_path' => 'diy/edit',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '文章管理',
- 'menu_key' => 'article',
- 'menu_type' => 0,
- 'icon' => 'element-Tickets',
- 'api_url' => '',
- 'router_path' => 'article',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '文章列表',
- 'menu_key' => 'article_list',
- 'menu_type' => 1,
- 'icon' => 'element-ChatDotSquare',
- 'api_url' => '',
- 'router_path' => 'list',
- 'view_path' => 'article/list',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '文章添加/编辑',
- 'menu_key' => 'article_edit',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'edit',
- 'view_path' => 'article/edit',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '文章栏目',
- 'menu_key' => 'article_category',
- 'menu_type' => 1,
- 'icon' => 'element-CollectionTag',
- 'api_url' => '',
- 'router_path' => 'category',
- 'view_path' => 'article/category',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '会员管理',
- 'menu_key' => 'member',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconjiaoseyonghu',
- 'api_url' => '',
- 'router_path' => 'member',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' =>
- [
- [
- 'menu_name' => '会员列表',
- 'menu_key' => 'member_list',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconhuiyuanliebiao',
- 'api_url' => '',
- 'router_path' => 'member',
- 'view_path' => 'member/member',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
-
- 'menu_name' => '编辑',
- 'menu_key' => 'member_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '会员详情',
- 'menu_key' => 'member_info',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'detail',
- 'view_path' => 'member/member_detail',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员标签',
- 'menu_key' => 'member_label',
- 'menu_type' => 1,
- 'icon' => 'element-CollectionTag',
- 'api_url' => '',
- 'router_path' => 'label',
- 'view_path' => 'member/label',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
-
- 'menu_name' => '编辑标签',
- 'menu_key' => 'member_label_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
-
- 'menu_name' => '添加标签',
- 'menu_key' => 'member_label_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
-
- 'menu_name' => '删除标签',
- 'menu_key' => 'member_label_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '会员积分',
- 'menu_key' => 'member_point',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconjifen-xianxing',
- 'api_url' => '',
- 'router_path' => 'point',
- 'view_path' => 'member/point',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员余额',
- 'menu_key' => 'member_balance',
- 'menu_type' => 1,
- 'icon' => 'element-Money',
- 'api_url' => '',
- 'router_path' => 'balance',
- 'view_path' => 'member/balance',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员零钱',
- 'menu_key' => 'member_money',
- 'menu_type' => 1,
- 'icon' => 'element-Money',
- 'api_url' => '',
- 'router_path' => 'money',
- 'view_path' => 'member/money',
- 'methods' => '',
- 'sort' => 59,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '财务管理',
- 'menu_key' => 'finance',
- 'menu_type' => 0,
- 'icon' => 'element-Box',
- 'api_url' => '',
- 'router_path' => 'finance',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '会员充值',
- 'menu_key' => 'recharge_list',
- 'menu_type' => 1,
- 'icon' => 'element-Help',
- 'api_url' => '',
- 'router_path' => 'recharge',
- 'view_path' => 'finance/recharge/list',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '充值详情',
- 'menu_key' => 'recharge_order_info',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'finance/detail',
- 'view_path' => 'finance/recharge/detail',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员提现',
- 'menu_key' => 'withdrawal_list',
- 'menu_type' => 1,
- 'icon' => 'element-Postcard',
- 'api_url' => '',
- 'router_path' => 'withdrawal',
- 'view_path' => 'finance/withdrawal',
- 'methods' => '',
- 'sort' => 99,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
-
- [
-
- 'menu_name' => '渠道管理',
- 'menu_key' => 'channel',
- 'menu_type' => 0,
- 'icon' => 'element-DataBoard',
- 'api_url' => '',
- 'router_path' => 'channel',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 50,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '微信公众号',
- 'menu_key' => 'channel_wechat',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconweixingongzhonghao1',
- 'api_url' => '',
- 'router_path' => 'wechat',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '公众号配置',
- 'menu_key' => 'wechat_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'config',
- 'view_path' => 'channel/wechat/config',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '自定义菜单',
- 'menu_key' => 'wechat_menu',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'menu',
- 'view_path' => 'channel/wechat/menu',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '模板消息',
- 'menu_key' => 'wechat_template_message',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'message',
- 'view_path' => 'channel/wechat/template',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '微信小程序',
- 'menu_key' => 'channel_weapp',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconxiaochengxushezhi',
- 'api_url' => '',
- 'router_path' => 'weapp',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '小程序配置',
- 'menu_key' => 'weapp_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'config',
- 'view_path' => 'channel/weapp/config',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '订阅消息',
- 'menu_key' => 'weapp_template_message',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'message',
- 'view_path' => 'channel/weapp/template',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ]
- ]
- ],
- [
- 'menu_name' => '权限管理',
- 'menu_key' => 'auth',
- 'menu_type' => 0,
- 'icon' => 'element-Lock',
- 'api_url' => '',
- 'router_path' => 'auth',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 40,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '菜单管理',
- 'menu_key' => 'menu_list',
- 'menu_type' => 1,
- 'icon' => 'element-Operation',
- 'api_url' => '',
- 'router_path' => 'menu',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '平台菜单',
- 'menu_key' => 'auth_menu',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'admin',
- 'view_path' => 'auth/menu',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '新增',
- 'menu_key' => 'auth_menu_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '编辑',
- 'menu_key' => 'auth_menu_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '删除',
- 'menu_key' => 'auth_menu_del',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '详情',
- 'menu_key' => 'auth_menu_info',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '站点菜单',
- 'menu_key' => 'auth_site_menu',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'site',
- 'view_path' => 'auth/site_menu',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '新增',
- 'menu_key' => 'auth_site_menu_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '编辑',
- 'menu_key' => 'auth_site_menu_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '删除',
- 'menu_key' => 'auth_site_menu_del',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '详情',
- 'menu_key' => 'auth_site_menu_info',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ]
- ]
- ],
- [
-
- 'menu_name' => '管理员',
- 'menu_key' => 'auth_user',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconyonghu',
- 'api_url' => '',
- 'router_path' => 'user',
- 'view_path' => 'auth/user',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '新增',
- 'menu_key' => 'auth_user_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '编辑',
- 'menu_key' => 'auth_user_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '删除',
- 'menu_key' => 'auth_user_del',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '详情',
- 'menu_key' => 'auth_user_info',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => 'sys/user/',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => 'get',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '角色管理',
- 'menu_key' => 'auth_role',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconhuiyuanliebiao',
- 'api_url' => '',
- 'router_path' => 'role',
- 'view_path' => 'auth/role',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '新增',
- 'menu_key' => 'auth_role_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '编辑',
- 'menu_key' => 'auth_role_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '删除',
- 'menu_key' => 'auth_role_del',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '操作日志',
- 'menu_key' => 'auth_log',
- 'menu_type' => 1,
- 'icon' => 'element-Document',
- 'api_url' => '',
- 'router_path' => 'log',
- 'view_path' => 'auth/log',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '站点管理',
- 'menu_key' => 'site',
- 'menu_type' => 0,
- 'icon' => 'element-Memo',
- 'api_url' => '',
- 'router_path' => 'site',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 30,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '站点列表',
- 'menu_key' => 'site_list',
- 'menu_type' => 1,
- 'icon' => 'element-OfficeBuilding',
- 'api_url' => '',
- 'router_path' => 'list',
- 'view_path' => 'site/list',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '站点详情',
- 'menu_key' => 'site_info',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'info',
- 'view_path' => 'site/info',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '站点套餐',
- 'menu_key' => 'site_group',
- 'menu_type' => 1,
- 'icon' => 'element-PriceTag',
- 'api_url' => '',
- 'router_path' => 'group',
- 'view_path' => 'site/group',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '站点用户',
- 'menu_key' => 'site_user',
- 'menu_type' => 1,
- 'icon' => 'element-User',
- 'api_url' => '',
- 'router_path' => 'user',
- 'view_path' => 'site/user',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '系统设置',
- 'menu_key' => 'setting',
- 'menu_type' => 0,
- 'icon' => 'element-Setting',
- 'api_url' => '',
- 'router_path' => 'setting',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 20,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '网站设置',
- 'menu_key' => 'setting_system',
- 'menu_type' => 1,
- 'icon' => 'element-Basketball',
- 'api_url' => '',
- 'router_path' => 'system',
- 'view_path' => 'setting/system',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '版权设置',
- 'menu_key' => 'setting_copyright',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconbanquan1',
- 'api_url' => '',
- 'router_path' => 'copyright',
- 'view_path' => 'setting/copyright',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '协议管理',
- 'menu_key' => 'system_agreement',
- 'menu_type' => 1,
- 'icon' => 'element-Notebook',
- 'api_url' => '',
- 'router_path' => 'agreement',
- 'view_path' => 'setting/agreement',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
-
- ]
- ],
- [
- 'menu_name' => '协议编辑',
- 'menu_key' => 'system_agreement_edit',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'agreement/edit',
- 'view_path' => 'setting/agreement_edit',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '注册登录',
- 'menu_key' => 'setting_login_register',
- 'menu_type' => 1,
- 'icon' => 'iconfont-icondenglu',
- 'api_url' => '',
- 'router_path' => 'login',
- 'view_path' => 'setting/login',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '支付设置',
- 'menu_key' => 'setting_pay',
- 'menu_type' => 1,
- 'icon' => 'element-Wallet',
- 'api_url' => '',
- 'router_path' => 'pay',
- 'view_path' => 'setting/pay',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '微信支付',
- 'menu_key' => 'setting_wechatpay',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'wechatpay',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '支付宝支付',
- 'menu_key' => 'setting_alipay',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'alipay',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '提现设置',
- 'menu_key' => 'withdrawal_config',
- 'menu_type' => 1,
- 'icon' => 'element-Postcard',
- 'api_url' => '',
- 'router_path' => 'withdrawal',
- 'view_path' => 'setting/withdrawal',
- 'methods' => '',
- 'sort' => 59,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '消息管理',
- 'menu_key' => 'setting_message',
- 'menu_type' => 1,
- 'icon' => 'element-ChatLineSquare',
- 'api_url' => '',
- 'router_path' => 'message',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 50,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '消息模板',
- 'menu_key' => 'setting_message_template',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'template',
- 'view_path' => 'setting/message',
- 'methods' => '',
- 'sort' => 10,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '发送记录',
- 'menu_key' => 'setting_message_records',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'records',
- 'view_path' => 'setting/message_records',
- 'methods' => '',
- 'sort' => 9,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '短信设置',
- 'menu_key' => 'setting_sms',
- 'menu_type' => 1,
- 'icon' => 'element-Message',
- 'api_url' => '',
- 'router_path' => 'sms',
- 'view_path' => 'setting/sms',
- 'methods' => '',
- 'sort' => 40,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '存储设置',
- 'menu_key' => 'setting_storage',
- 'menu_type' => 1,
- 'icon' => 'element-FolderChecked',
- 'api_url' => '',
- 'router_path' => 'storage',
- 'view_path' => 'setting/storage',
- 'methods' => '',
- 'sort' => 30,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '定时任务',
- 'menu_key' => 'system_cron',
- 'menu_type' => 1,
- 'icon' => 'element-SetUp',
- 'api_url' => '',
- 'router_path' => 'cron',
- 'view_path' => 'setting/cron',
- 'methods' => '',
- 'sort' => 20,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '开发工具',
- 'menu_key' => 'tool',
- 'menu_type' => 0,
- 'icon' => 'element-Edit',
- 'api_url' => '',
- 'router_path' => 'tools',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 10,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '代码生成',
- 'menu_key' => 'code',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconyuandaima',
- 'api_url' => '',
- 'router_path' => 'code',
- 'view_path' => 'tools/code/index',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '应用市场',
- 'menu_key' => 'app_store',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconyingyongshichang',
- 'api_url' => '',
- 'router_path' => 'app_store',
- 'view_path' => 'tools/app/index',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '数据表编辑',
- 'menu_key' => 'code_edit',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'code/edit',
- 'view_path' => 'tools/code/edit',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- ]
- ]
- ];
\ No newline at end of file
diff --git a/niucloud/app/enum/install/menu/system/site.php b/niucloud/app/enum/install/menu/system/site.php
deleted file mode 100644
index bf80cd1f6..000000000
--- a/niucloud/app/enum/install/menu/system/site.php
+++ /dev/null
@@ -1,1009 +0,0 @@
- '控制台',
- 'menu_key' => 'overview',
- 'menu_type' => 1,
- 'icon' => 'element-Monitor',
- 'api_url' => '',
- 'router_path' => 'siteindex',
- 'view_path' => 'index/site_index',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '装修管理',
- 'menu_key' => 'diy',
- 'menu_type' => 0,
- 'icon' => 'element-Brush',
- 'api_url' => '',
- 'router_path' => 'diy',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '首页装修',
- 'menu_key' => 'diy_page_index',
- 'menu_type' => 1,
- 'icon' => 'element-House',
- 'api_url' => '',
- 'router_path' => 'index',
- 'view_path' => 'diy/index',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '个人中心',
- 'menu_key' => 'diy_page_member',
- 'menu_type' => 1,
- 'icon' => 'element-ScaleToOriginal',
- 'api_url' => '',
- 'router_path' => 'member',
- 'view_path' => 'diy/member',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '保存',
- 'menu_key' => 'diy_page_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '页面管理',
- 'menu_key' => 'diy_page_list',
- 'menu_type' => 1,
- 'icon' => 'iconfont-icondianpuzhuangxiu',
- 'api_url' => '',
- 'router_path' => 'list',
- 'view_path' => 'diy/list',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '底部导航',
- 'menu_key' => 'diy_bottom',
- 'menu_type' => 1,
- 'icon' => 'iconfont-icondibudaohang',
- 'api_url' => '',
- 'router_path' => 'tabbar',
- 'view_path' => 'diy/tabbar',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' =>
- [
- [
- 'menu_name' => '保存',
- 'menu_key' => 'diy_tabbar_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '素材管理',
- 'menu_key' => 'attachment',
- 'menu_type' => 1,
- 'icon' => 'element-Files',
- 'api_url' => '',
- 'router_path' => 'attachment',
- 'view_path' => 'tools/attachment',
- 'methods' => '',
- 'sort' => 50,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '页面装修',
- 'menu_key' => 'decorate',
- 'menu_type' => 0,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'decorate',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 21,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '装修',
- 'menu_key' => 'page_decorate',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'edit',
- 'view_path' => 'diy/edit',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
-
- 'menu_name' => '文章管理',
- 'menu_key' => 'article',
- 'menu_type' => 0,
- 'icon' => 'element-Tickets',
- 'api_url' => '',
- 'router_path' => 'article',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '文章列表',
- 'menu_key' => 'article_list',
- 'menu_type' => 1,
- 'icon' => 'element-ChatDotSquare',
- 'api_url' => '',
- 'router_path' => 'list',
- 'view_path' => 'article/list',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '文章添加/编辑',
- 'menu_key' => 'article_edit',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'edit',
- 'view_path' => 'article/edit',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '文章栏目',
- 'menu_key' => 'article_category',
- 'menu_type' => 1,
- 'icon' => 'element-CollectionTag',
- 'api_url' => '',
- 'router_path' => 'category',
- 'view_path' => 'article/category',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '会员管理',
- 'menu_key' => 'member',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconjiaoseyonghu',
- 'api_url' => '',
- 'router_path' => 'member',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' =>
- [
- [
- 'menu_name' => '会员列表',
- 'menu_key' => 'member_list',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconhuiyuanliebiao',
- 'api_url' => '',
- 'router_path' => 'member',
- 'view_path' => 'member/member',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
-
- 'menu_name' => '编辑',
- 'menu_key' => 'member_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '会员详情',
- 'menu_key' => 'member_info',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'detail',
- 'view_path' => 'member/member_detail',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员标签',
- 'menu_key' => 'member_label',
- 'menu_type' => 1,
- 'icon' => 'element-CollectionTag',
- 'api_url' => '',
- 'router_path' => 'label',
- 'view_path' => 'member/label',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
-
- 'menu_name' => '编辑标签',
- 'menu_key' => 'member_label_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
-
- 'menu_name' => '添加标签',
- 'menu_key' => 'member_label_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
-
- 'menu_name' => '删除标签',
- 'menu_key' => 'member_label_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '会员积分',
- 'menu_key' => 'member_point',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconjifen-xianxing',
- 'api_url' => '',
- 'router_path' => 'point',
- 'view_path' => 'member/point',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员余额',
- 'menu_key' => 'member_balance',
- 'menu_type' => 1,
- 'icon' => 'element-Money',
- 'api_url' => '',
- 'router_path' => 'balance',
- 'view_path' => 'member/balance',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员零钱',
- 'menu_key' => 'member_money',
- 'menu_type' => 1,
- 'icon' => 'element-Money',
- 'api_url' => '',
- 'router_path' => 'money',
- 'view_path' => 'member/money',
- 'methods' => '',
- 'sort' => 59,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '财务管理',
- 'menu_key' => 'finance',
- 'menu_type' => 0,
- 'icon' => 'element-Box',
- 'api_url' => '',
- 'router_path' => 'finance',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '会员充值',
- 'menu_key' => 'recharge_list',
- 'menu_type' => 1,
- 'icon' => 'element-Help',
- 'api_url' => '',
- 'router_path' => 'recharge',
- 'view_path' => 'finance/recharge/list',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '充值详情',
- 'menu_key' => 'recharge_order_info',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'finance/detail',
- 'view_path' => 'finance/recharge/detail',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '会员提现',
- 'menu_key' => 'withdrawal_list',
- 'menu_type' => 1,
- 'icon' => 'element-Postcard',
- 'api_url' => '',
- 'router_path' => 'withdrawal',
- 'view_path' => 'finance/withdrawal',
- 'methods' => '',
- 'sort' => 99,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
-
- 'menu_name' => '渠道管理',
- 'menu_key' => 'channel',
- 'menu_type' => 0,
- 'icon' => 'element-DataBoard',
- 'api_url' => '',
- 'router_path' => 'channel',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 50,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '电脑端',
- 'menu_key' => 'channel_pc',
- 'menu_type' => 0,
- 'icon' => 'iconfont-icondesktop',
- 'api_url' => '',
- 'router_path' => 'pc',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 110,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '电脑端配置',
- 'menu_key' => 'pc_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'config',
- 'view_path' => 'channel/pc/config',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => 'H5',
- 'menu_key' => 'channel_h5',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconh5e',
- 'api_url' => '',
- 'router_path' => 'h5',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => 'H5端配置',
- 'menu_key' => 'h5_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'config',
- 'view_path' => 'channel/h5/config',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '微信公众号',
- 'menu_key' => 'channel_wechat',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconweixingongzhonghao1',
- 'api_url' => '',
- 'router_path' => 'wechat',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '公众号配置',
- 'menu_key' => 'wechat_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'config',
- 'view_path' => 'channel/wechat/config',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '自定义菜单',
- 'menu_key' => 'wechat_menu',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'menu',
- 'view_path' => 'channel/wechat/menu',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '模板消息',
- 'menu_key' => 'wechat_template_message',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'message',
- 'view_path' => 'channel/wechat/template',
- 'methods' => '',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '微信小程序',
- 'menu_key' => 'channel_weapp',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconxiaochengxushezhi',
- 'api_url' => '',
- 'router_path' => 'weapp',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '小程序配置',
- 'menu_key' => 'weapp_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'config',
- 'view_path' => 'channel/weapp/config',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '订阅消息',
- 'menu_key' => 'weapp_template_message',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'message',
- 'view_path' => 'channel/weapp/template',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '支付宝小程序',
- 'menu_key' => 'channel_aliapp',
- 'menu_type' => 0,
- 'icon' => 'iconfont-iconzhifubao',
- 'api_url' => 'aliapp/config',
- 'router_path' => 'aliapp',
- 'view_path' => '',
- 'methods' => 'get',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '支付宝配置',
- 'menu_key' => 'aliapp_config',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => 'aliapp/config',
- 'router_path' => 'config',
- 'view_path' => 'channel/aliapp/config',
- 'methods' => 'put',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- ]
- ],
- [
- 'menu_name' => '权限管理',
- 'menu_key' => 'auth',
- 'menu_type' => 0,
- 'icon' => 'element-Lock',
- 'api_url' => '',
- 'router_path' => 'auth',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 40,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
-
- 'menu_name' => '管理员',
- 'menu_key' => 'auth_user',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconyonghu',
- 'api_url' => '',
- 'router_path' => 'user',
- 'view_path' => 'auth/user',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '新增',
- 'menu_key' => 'auth_user_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '编辑',
- 'menu_key' => 'auth_user_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '删除',
- 'menu_key' => 'auth_user_del',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '详情',
- 'menu_key' => 'auth_user_info',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => 'sys/user/',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => 'get',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ],
- ],
- [
- 'menu_name' => '角色管理',
- 'menu_key' => 'auth_role',
- 'menu_type' => 1,
- 'icon' => 'iconfont-iconhuiyuanliebiao',
- 'api_url' => '',
- 'router_path' => 'role',
- 'view_path' => 'auth/role',
- 'methods' => '',
- 'sort' => 90,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '新增',
- 'menu_key' => 'auth_role_add',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '编辑',
- 'menu_key' => 'auth_role_update',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '删除',
- 'menu_key' => 'auth_role_del',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => '',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 1,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
- [
- 'menu_name' => '操作日志',
- 'menu_key' => 'auth_log',
- 'menu_type' => 1,
- 'icon' => 'element-Document',
- 'api_url' => '',
- 'router_path' => 'log',
- 'view_path' => 'auth/log',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ],
-
- [
- 'menu_name' => '系统设置',
- 'menu_key' => 'setting',
- 'menu_type' => 0,
- 'icon' => 'element-Setting',
- 'api_url' => '',
- 'router_path' => 'setting',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 30,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '网站设置',
- 'menu_key' => 'setting_system',
- 'menu_type' => 1,
- 'icon' => 'element-Basketball',
- 'api_url' => '',
- 'router_path' => 'system',
- 'view_path' => 'setting/system',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '协议管理',
- 'menu_key' => 'system_agreement',
- 'menu_type' => 1,
- 'icon' => 'element-Notebook',
- 'api_url' => '',
- 'router_path' => 'agreement',
- 'view_path' => 'setting/agreement',
- 'methods' => '',
- 'sort' => 80,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
-
- ]
- ],
- [
- 'menu_name' => '协议编辑',
- 'menu_key' => 'system_agreement_edit',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'agreement/edit',
- 'view_path' => 'setting/agreement_edit',
- 'methods' => '',
- 'sort' => 100,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '注册登录',
- 'menu_key' => 'setting_login_register',
- 'menu_type' => 1,
- 'icon' => 'iconfont-icondenglu',
- 'api_url' => 'member/config/login',
- 'router_path' => 'login',
- 'view_path' => 'setting/login',
- 'methods' => 'get',
- 'sort' => 70,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '支付设置',
- 'menu_key' => 'setting_pay',
- 'menu_type' => 1,
- 'icon' => 'element-Wallet',
- 'api_url' => 'pay/lists',
- 'router_path' => 'pay',
- 'view_path' => 'setting/pay',
- 'methods' => 'get',
- 'sort' => 60,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '微信支付',
- 'menu_key' => 'setting_wechatpay',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'wechatpay',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '支付宝支付',
- 'menu_key' => 'setting_alipay',
- 'menu_type' => 2,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'alipay',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 0,
- 'status' => 1,
- 'is_show' => 0,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '提现设置',
- 'menu_key' => 'withdrawal_config',
- 'menu_type' => 1,
- 'icon' => 'element-Postcard',
- 'api_url' => '',
- 'router_path' => 'withdrawal',
- 'view_path' => 'setting/withdrawal',
- 'methods' => '',
- 'sort' => 59,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '消息管理',
- 'menu_key' => 'setting_message',
- 'menu_type' => 1,
- 'icon' => 'element-ChatLineSquare',
- 'api_url' => '',
- 'router_path' => 'message',
- 'view_path' => '',
- 'methods' => '',
- 'sort' => 50,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- 'children' => [
- [
- 'menu_name' => '消息模板',
- 'menu_key' => 'setting_message_template',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'template',
- 'view_path' => 'setting/message',
- 'methods' => '',
- 'sort' => 10,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- [
- 'menu_name' => '发送记录',
- 'menu_key' => 'setting_message_records',
- 'menu_type' => 1,
- 'icon' => '',
- 'api_url' => '',
- 'router_path' => 'records',
- 'view_path' => 'setting/message_records',
- 'methods' => '',
- 'sort' => 9,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ]
- ]
- ],
- [
- 'menu_name' => '短信设置',
- 'menu_key' => 'setting_sms',
- 'menu_type' => 1,
- 'icon' => 'element-Message',
- 'api_url' => '',
- 'router_path' => 'sms',
- 'view_path' => 'setting/sms',
- 'methods' => '',
- 'sort' => 40,
- 'status' => 1,
- 'is_show' => 1,
- 'en_menu_name' => '',
- ],
- ]
- ]
- ];
\ No newline at end of file
diff --git a/niucloud/app/enum/member/MemberAccountEnum.php b/niucloud/app/enum/member/MemberAccountEnum.php
index 7db9e49c2..0edb05676 100644
--- a/niucloud/app/enum/member/MemberAccountEnum.php
+++ b/niucloud/app/enum/member/MemberAccountEnum.php
@@ -11,6 +11,8 @@
namespace app\enum\member;
+use core\util\ConfigUtil;
+
/**
* 会员账户类型
* Class MemberAccountEnum
@@ -19,12 +21,15 @@ namespace app\enum\member;
class MemberAccountEnum
{
//会员积分
- const POINT = 'point';
+ const POINT = 'point';
//会员余额
- const BALANCE = 'balance';
+ const BALANCE = 'balance';
- //会员零钱
- const MONEY = 'money';
+ //会员可提现余额
+ const MONEY = 'money';
+
+ //会员佣金
+ const COMMISSION = 'commission';
//账户增加
const INC = 'inc';
@@ -38,84 +43,32 @@ class MemberAccountEnum
self::POINT => get_lang('enum_member.account_point'),
self::BALANCE => get_lang('enum_member.account_balance'),
self::MONEY => get_lang('enum_member.account_money'),
+ self::COMMISSION => get_lang('enum_member.account_commission'),
];
if (empty($type)) {
return $data;
}
- return $data[$type] ?? '';
+ return $data[ $type ] ?? '';
}
-
- public static function getFromType($type = ''){
-
- $data = [
- self::POINT => [
- //调整
- 'adjust' => [
- //名称
- 'name' => get_lang('enum_member.account_point_adjust'),
- //是否增加
- self::INC => 1,
- //是否减少
- self::DEC => 1,
- ],
- //充值赠送
- 'recharge_give' => [
- //名称
- 'name' => get_lang('enum_member.account_point_recharge_give'),
- //是否增加
- self::INC => 1,
- //是否减少
- self::DEC => 0,
- ],
-
- ],
- self::BALANCE => [
- //调整
- 'adjust' => [
- //名称
- 'name' => get_lang('enum_member.account_balance_adjust'),
- //是否增加
- self::INC => 1,
- //是否减少
- self::DEC => 1,
- ],
- //充值
- 'recharge' => [
- //名称
- 'name' => get_lang('enum_member.account_balance_recharge'),
- //是否增加
- self::INC => 1,
- //是否减少
- self::DEC => 0,
- ],
- ],
- self::MONEY => [
-
- //活动奖励
- 'award' => [
- //名称
- 'name' => get_lang('enum_member.account_money_award'),
- //是否增加
- self::INC => 1,
- //是否减少
- self::DEC => 0,
- ],
- //提现
- 'withdraw' => [
- //名称
- 'name' => get_lang('enum_member.account_money_withdraw'),
- //是否增加
- self::INC => 1,
- //是否减少
- self::DEC => 0,
- ],
- ],
- ];
- if (empty($type)) {
- return $data;
+ /**
+ * 获取账户变动方式
+ * @param string $type
+ * @return array|mixed|string
+ */
+ public static function getFromType($type = '')
+ {
+ $type_util = new ConfigUtil(root_path() . str_replace('/', DIRECTORY_SEPARATOR, "app/enum/member/fromtypes"));
+ $file_data = $type_util->loadFiles();
+ $types = [];
+ foreach ($file_data as $data) {
+ $types = empty($types) ? $data : array_merge2($types, $data);
}
- return $data[$type] ?? '';
+
+ if (empty($type)) {
+ return $types;
+ }
+ return $types[ $type ] ?? '';
}
}
\ No newline at end of file
diff --git a/niucloud/app/enum/member/MemberWithdrawEnum.php b/niucloud/app/enum/member/MemberCashOutEnum.php
similarity index 73%
rename from niucloud/app/enum/member/MemberWithdrawEnum.php
rename to niucloud/app/enum/member/MemberCashOutEnum.php
index 777e144ff..1274cd179 100644
--- a/niucloud/app/enum/member/MemberWithdrawEnum.php
+++ b/niucloud/app/enum/member/MemberCashOutEnum.php
@@ -16,7 +16,7 @@ namespace app\enum\member;
* Class MemberAccountEnum
* @package app\enum\member
*/
-class MemberWithdrawEnum
+class MemberCashOutEnum
{
const WAIT_AUDIT = 1;//待审核
const WAIT_TRANSFER = 2;//待转账
@@ -25,16 +25,16 @@ class MemberWithdrawEnum
const CANCEL = -2;//已取消
/**
- * 用户状态
+ * 提现状态
* @return array
*/
public static function getStatus(){
return [
- self::WAIT_AUDIT => get_lang('enum_member_withdraw.status_wait_audit'),//待审核
- self::WAIT_TRANSFER => get_lang('enum_member_withdraw.status_wait_transfer'),//待转账
- self::TRANSFERED => get_lang('enum_member_withdraw.status_transfered'),//已转账
- self::REFUSE => get_lang('enum_member_withdraw.status_refuse'),//已拒绝
- self::CANCEL => get_lang('enum_member_withdraw.status_cancel'),//已取消
+ self::WAIT_AUDIT => get_lang('enum_member_cash_out.status_wait_audit'),//待审核
+ self::WAIT_TRANSFER => get_lang('enum_member_cash_out.status_wait_transfer'),//待转账
+ self::TRANSFERED => get_lang('enum_member_cash_out.status_transfered'),//已转账
+ self::REFUSE => get_lang('enum_member_cash_out.status_refuse'),//已拒绝
+ self::CANCEL => get_lang('enum_member_cash_out.status_cancel'),//已取消
];
}
diff --git a/niucloud/app/enum/diy/ComponentTypeEnum.php b/niucloud/app/enum/member/MemberEnum.php
similarity index 63%
rename from niucloud/app/enum/diy/ComponentTypeEnum.php
rename to niucloud/app/enum/member/MemberEnum.php
index 3e3ad03c5..a658cdbdb 100644
--- a/niucloud/app/enum/diy/ComponentTypeEnum.php
+++ b/niucloud/app/enum/member/MemberEnum.php
@@ -9,27 +9,28 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\enum\diy;
+namespace app\enum\member;
+
+use app\enum\common\ChannelEnum;
/**
- * 自定义组件类型
- * Class ComponentTypeEnum
- * @package app\enum\sys
+ * 会员信息枚举类
+ * Class MemberEnum
*/
-class ComponentTypeEnum
+class MemberEnum extends ChannelEnum
{
- // 基础组件
- const BASICS = 'BASICS';
+
+ const ON = 1;
+ const OFF = 0;
/**
- * 获取组件类型
+ * 会员状态
* @return array
*/
- public static function getType()
- {
+ public static function getStatus(){
return [
- self::BASICS => get_lang('enum_diy.component_type_basics'),
+ self::ON => get_lang('enum_member.status_on'),//正常
+ self::OFF => get_lang('enum_member.status_off'),//无效
];
}
-
}
\ No newline at end of file
diff --git a/niucloud/app/adminapi/controller/BaseAdminController.php b/niucloud/app/enum/member/MemberRegisterChannelEnum.php
similarity index 54%
rename from niucloud/app/adminapi/controller/BaseAdminController.php
rename to niucloud/app/enum/member/MemberRegisterChannelEnum.php
index 5f817fd09..40612f96e 100644
--- a/niucloud/app/adminapi/controller/BaseAdminController.php
+++ b/niucloud/app/enum/member/MemberRegisterChannelEnum.php
@@ -9,24 +9,27 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-declare (strict_types=1);
+namespace app\enum\member;
-namespace app\adminapi\controller;
-
-use app\BaseController;
-use think\App;
+use app\enum\common\ChannelEnum;
/**
- * 管理端控制器基类
- * Class BaseAdminController
- * @package app\adminapi\controller
+ * 会员注册渠道枚举类
+ * Class MemberRegisterChannelEnum
*/
-class BaseAdminController extends BaseController
+class MemberRegisterChannelEnum extends ChannelEnum
{
+ //手动添加
+ const MANUAL = 'manual';
- public function initialize()
- {
+ public static function getType($type = ''){
+ $data = ChannelEnum::getType($type);
+ $data[self::MANUAL] = get_lang('enum_member.register_manual');//手动添加
+ if(empty($type)){
+ return $data;
+ }
+ return $data[$type] ?? '';
}
}
\ No newline at end of file
diff --git a/niucloud/app/enum/member/MemberRegisterTypeEnum.php b/niucloud/app/enum/member/MemberRegisterTypeEnum.php
index f77014f17..d8ad32741 100644
--- a/niucloud/app/enum/member/MemberRegisterTypeEnum.php
+++ b/niucloud/app/enum/member/MemberRegisterTypeEnum.php
@@ -22,12 +22,7 @@ class MemberRegisterTypeEnum
const WEAPP = 'weapp';
//微信公众号
const WECHAT = 'wechat';
- //手机端H5
- const H5 = 'h5';
- //电脑端PC
- const PC = 'pc';
- //app端
- const APP = 'app';
+
//用户名密码注册登录
const USERNAME = 'username';
//手机验证码登录
@@ -39,9 +34,6 @@ class MemberRegisterTypeEnum
$data = [
self::WEAPP => get_lang('enum_member.register_weapp'),//微信小程序
self::WECHAT => get_lang('enum_member.register_wechat'),//'微信公众号',
- self::H5 => get_lang('enum_member.register_h5'),//'手机H5',
- self::PC => get_lang('enum_member.register_pc'),//'电脑PC',
- self::APP => get_lang('enum_member.register_app'),//'手机app',
self::MANUAL => get_lang('enum_member.register_manual'),//'手动添加',
self::USERNAME => get_lang('enum_member.register_username'),//用户名密码登录
self::MOBILE => get_lang('enum_member.register_mobile'),//手机号验证码登录,
diff --git a/niucloud/app/enum/member/fromtypes/system.php b/niucloud/app/enum/member/fromtypes/system.php
new file mode 100644
index 000000000..319a86ce5
--- /dev/null
+++ b/niucloud/app/enum/member/fromtypes/system.php
@@ -0,0 +1,98 @@
+ [
+ //调整
+ 'adjust' => [
+ //名称
+ 'name' => get_lang('enum_member.account_point_adjust'),
+ //是否增加
+ MemberAccountEnum::INC => 1,
+ //是否减少
+ MemberAccountEnum::DEC => 1,
+ ],
+ //充值赠送
+ 'recharge_give' => [
+ //名称
+ 'name' => get_lang('enum_member.account_point_recharge_give'),
+ //是否增加
+ MemberAccountEnum::INC => 1,
+ //是否减少
+ MemberAccountEnum::DEC => 0,
+ ],
+
+ ],
+ MemberAccountEnum::BALANCE => [
+ //调整
+ 'adjust' => [
+ //名称
+ 'name' => get_lang('enum_member.account_balance_adjust'),
+ //是否增加
+ MemberAccountEnum::INC => 1,
+ //是否减少
+ MemberAccountEnum::DEC => 1,
+ ],
+ //充值
+ 'recharge' => [
+ //名称
+ 'name' => get_lang('enum_member.account_balance_recharge'),
+ //是否增加
+ MemberAccountEnum::INC => 1,
+ //是否减少
+ MemberAccountEnum::DEC => 0,
+ ],
+ 'recharge_refund' => [
+ //名称
+ 'name' => get_lang('enum_member.account_balance_recharge_refund'),
+ //是否增加
+ MemberAccountEnum::INC => 0,
+ //是否减少
+ MemberAccountEnum::DEC => 1,
+ ]
+ ],
+ MemberAccountEnum::MONEY => [
+
+ //活动奖励
+ 'award' => [
+ //名称
+ 'name' => get_lang('enum_member.account_money_award'),
+ //是否增加
+ MemberAccountEnum::INC => 1,
+ //是否减少
+ MemberAccountEnum::DEC => 0,
+ ],
+ //提现
+ 'cash_out' => [
+ //名称
+ 'name' => get_lang('enum_member.account_money_cash_out'),
+ //是否增加
+ MemberAccountEnum::INC => 0,
+ //是否减少
+ MemberAccountEnum::DEC => 1,
+ ],
+ ],
+ //会员佣金
+ MemberAccountEnum::COMMISSION => [
+
+ //活动奖励
+ 'award' => [
+ //名称
+ 'name' => get_lang('enum_member.account_commission_award'),
+ //是否增加
+ MemberAccountEnum::INC => 1,
+ //是否减少
+ MemberAccountEnum::DEC => 0,
+ ],
+ //提现
+ 'cash_out' => [
+ //名称
+ 'name' => get_lang('enum_member.account_commission_cash_out'),
+ //是否增加
+ MemberAccountEnum::INC => 0,
+ //是否减少
+ MemberAccountEnum::DEC => 1,
+ ],
+ ]
+];
\ No newline at end of file
diff --git a/niucloud/app/enum/menu/admin.php b/niucloud/app/enum/menu/admin.php
new file mode 100644
index 000000000..75efab6f2
--- /dev/null
+++ b/niucloud/app/enum/menu/admin.php
@@ -0,0 +1,585 @@
+ '控制台',
+ 'menu_key' => 'overview',
+ 'menu_type' => 1,
+ 'icon' => 'element-Monitor',
+ 'api_url' => '',
+ 'router_path' => 'index',
+ 'view_path' => 'index/index',
+ 'methods' => '',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '站点管理',
+ 'menu_key' => 'site',
+ 'menu_type' => 0,
+ 'icon' => 'element-Memo',
+ 'api_url' => '',
+ 'router_path' => 'site',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 50,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '站点列表',
+ 'menu_key' => 'site_list',
+ 'menu_type' => 1,
+ 'icon' => 'element-OfficeBuilding',
+ 'api_url' => 'site/site',
+ 'router_path' => 'list',
+ 'view_path' => 'site/list',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '站点详情',
+ 'menu_key' => 'site_info',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'site/site/',
+ 'router_path' => 'info',
+ 'view_path' => 'site/info',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '站点套餐',
+ 'menu_key' => 'site_group',
+ 'menu_type' => 1,
+ 'icon' => 'element-PriceTag',
+ 'api_url' => 'site/group',
+ 'router_path' => 'group',
+ 'view_path' => 'site/group',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '站点用户',
+ 'menu_key' => 'site_user',
+ 'menu_type' => 1,
+ 'icon' => 'element-User',
+ 'api_url' => 'user/user',
+ 'router_path' => 'user',
+ 'view_path' => 'site/user',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+ 'menu_name' => '权限管理',
+ 'menu_key' => 'auth',
+ 'menu_type' => 0,
+ 'icon' => 'element-Lock',
+ 'api_url' => '',
+ 'router_path' => 'auth',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 40,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '菜单管理',
+ 'menu_key' => 'menu_list',
+ 'menu_type' => 1,
+ 'icon' => 'element-Operation',
+ 'api_url' => '',
+ 'router_path' => 'menu',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '平台菜单',
+ 'menu_key' => 'auth_menu',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'sys/menu',
+ 'router_path' => 'admin',
+ 'view_path' => 'auth/menu',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '新增',
+ 'menu_key' => 'auth_menu_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '编辑',
+ 'menu_key' => 'auth_menu_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '删除',
+ 'menu_key' => 'auth_menu_del',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '详情',
+ 'menu_key' => 'auth_menu_info',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ],
+ ],
+ [
+ 'menu_name' => '站点菜单',
+ 'menu_key' => 'auth_site_menu',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'sys/menu',
+ 'router_path' => 'site',
+ 'view_path' => 'auth/site_menu',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '新增',
+ 'menu_key' => 'auth_site_menu_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '编辑',
+ 'menu_key' => 'auth_site_menu_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '删除',
+ 'menu_key' => 'auth_site_menu_del',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '详情',
+ 'menu_key' => 'auth_site_menu_info',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/menu/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ],
+ ]
+ ]
+ ],
+ [
+
+ 'menu_name' => '管理员',
+ 'menu_key' => 'auth_user',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconyonghu',
+ 'api_url' => 'site/user',
+ 'router_path' => 'user',
+ 'view_path' => 'auth/user',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '新增',
+ 'menu_key' => 'auth_user_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'site/user',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '编辑',
+ 'menu_key' => 'auth_user_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'site/user/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '删除',
+ 'menu_key' => 'auth_user_del',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'site/user/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '详情',
+ 'menu_key' => 'auth_user_info',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/user/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ],
+ ],
+ [
+ 'menu_name' => '角色管理',
+ 'menu_key' => 'auth_role',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconhuiyuanliebiao',
+ 'api_url' => 'sys/role',
+ 'router_path' => 'role',
+ 'view_path' => 'auth/role',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '新增',
+ 'menu_key' => 'auth_role_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/role',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '编辑',
+ 'menu_key' => 'auth_role_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/role/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '删除',
+ 'menu_key' => 'auth_role_del',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/role/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '操作日志',
+ 'menu_key' => 'auth_log',
+ 'menu_type' => 1,
+ 'icon' => 'element-Document',
+ 'api_url' => 'sys/log',
+ 'router_path' => 'log',
+ 'view_path' => 'auth/log',
+ 'methods' => 'get',
+ 'sort' => 60,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+
+ [
+ 'menu_name' => '系统设置',
+ 'menu_key' => 'setting',
+ 'menu_type' => 0,
+ 'icon' => 'element-Setting',
+ 'api_url' => '',
+ 'router_path' => 'setting',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 20,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '网站设置',
+ 'menu_key' => 'setting_system',
+ 'menu_type' => 1,
+ 'icon' => 'element-Basketball',
+ 'api_url' => 'sys/config/website',
+ 'router_path' => 'system',
+ 'view_path' => 'setting/system',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '版权设置',
+ 'menu_key' => 'setting_copyright',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconbanquan1',
+ 'api_url' => 'sys/config/copyright',
+ 'router_path' => 'copyright',
+ 'view_path' => 'setting/copyright',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '登录设置',
+ 'menu_key' => 'setting_login',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconzhuceshezhi',
+ 'api_url' => 'sys/config/login',
+ 'router_path' => 'adminlogin',
+ 'view_path' => 'setting/adminlogin',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '存储设置',
+ 'menu_key' => 'setting_storage',
+ 'menu_type' => 1,
+ 'icon' => 'element-FolderChecked',
+ 'api_url' => 'sys/storage',
+ 'router_path' => 'storage',
+ 'view_path' => 'setting/storage',
+ 'methods' => 'get',
+ 'sort' => 30,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+ 'menu_name' => '开发工具',
+ 'menu_key' => 'tool',
+ 'menu_type' => 0,
+ 'icon' => 'element-Edit',
+ 'api_url' => '',
+ 'router_path' => 'tools',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 10,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '代码生成',
+ 'menu_key' => 'code',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconyuandaima',
+ 'api_url' => 'generator/generator',
+ 'router_path' => 'code',
+ 'view_path' => 'tools/code/index',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '应用市场',
+ 'menu_key' => 'app_store',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconyingyongshichang',
+ 'api_url' => 'addon/local',
+ 'router_path' => 'app_store',
+ 'view_path' => 'tools/app/index',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '数据表编辑',
+ 'menu_key' => 'code_edit',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => '',
+ 'router_path' => 'code/edit',
+ 'view_path' => 'tools/code/edit',
+ 'methods' => '',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '定时任务',
+ 'menu_key' => 'system_cron',
+ 'menu_type' => 1,
+ 'icon' => 'element-SetUp',
+ 'api_url' => 'sys/cron',
+ 'router_path' => 'cron',
+ 'view_path' => 'tools/cron',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '更新缓存',
+ 'menu_key' => 'tools_Update_cache',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-icongengxinhuancun',
+ 'api_url' => '',
+ 'router_path' => 'update',
+ 'view_path' => 'tools/updatecache',
+ 'methods' => '',
+ 'sort' => 60,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '环境检测',
+ 'menu_key' => 'iconfont-iconsixingjiance',
+ 'menu_type' => 1,
+ 'icon' => 'element-SetUp',
+ 'api_url' => '',
+ 'router_path' => 'detection',
+ 'view_path' => 'tools/detection',
+ 'methods' => '',
+ 'sort' => 50,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ]
+ ];
\ No newline at end of file
diff --git a/niucloud/app/enum/menu/site.php b/niucloud/app/enum/menu/site.php
new file mode 100644
index 000000000..8e68c669b
--- /dev/null
+++ b/niucloud/app/enum/menu/site.php
@@ -0,0 +1,1190 @@
+ '控制台',
+ 'menu_key' => 'overview',
+ 'menu_type' => 1,
+ 'icon' => 'element-Monitor',
+ 'api_url' => '',
+ 'router_path' => 'siteindex',
+ 'view_path' => 'index/site_index',
+ 'methods' => '',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '装修管理',
+ 'menu_key' => 'diy',
+ 'menu_type' => 0,
+ 'icon' => 'element-Brush',
+ 'api_url' => '',
+ 'router_path' => 'diy',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '首页装修',
+ 'menu_key' => 'diy_page_index',
+ 'menu_type' => 1,
+ 'icon' => 'element-House',
+ 'api_url' => '',
+ 'router_path' => 'index',
+ 'view_path' => 'diy/index',
+ 'methods' => '',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '个人中心',
+ 'menu_key' => 'diy_page_member',
+ 'menu_type' => 1,
+ 'icon' => 'element-ScaleToOriginal',
+ 'api_url' => '',
+ 'router_path' => 'member',
+ 'view_path' => 'diy/member',
+ 'methods' => '',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '保存',
+ 'menu_key' => 'diy_page_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'diy/diy',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '页面管理',
+ 'menu_key' => 'diy_page_list',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-icondianpuzhuangxiu',
+ 'api_url' => 'diy/diy',
+ 'router_path' => 'list',
+ 'view_path' => 'diy/list',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '底部导航',
+ 'menu_key' => 'diy_bottom',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-icondibudaohang',
+ 'api_url' => 'diy/bottom',
+ 'router_path' => 'tabbar',
+ 'view_path' => 'diy/tabbar',
+ 'methods' => 'get',
+ 'sort' => 60,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' =>
+ [
+ [
+ 'menu_name' => '保存',
+ 'menu_key' => 'diy_tabbar_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'diy/bottom',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ],
+ ],
+ [
+ 'menu_name' => '素材管理',
+ 'menu_key' => 'attachment',
+ 'menu_type' => 1,
+ 'icon' => 'element-Files',
+ 'api_url' => 'sys/attachment',
+ 'router_path' => 'attachment',
+ 'view_path' => 'tools/attachment',
+ 'methods' => 'get',
+ 'sort' => 50,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+ 'menu_name' => '页面装修',
+ 'menu_key' => 'decorate',
+ 'menu_type' => 0,
+ 'icon' => '',
+ 'api_url' => '',
+ 'router_path' => 'decorate',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 21,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '装修',
+ 'menu_key' => 'page_decorate',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'diy/diy/',
+ 'router_path' => 'edit',
+ 'view_path' => 'diy/edit',
+ 'methods' => 'put',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+
+ 'menu_name' => '文章管理',
+ 'menu_key' => 'article',
+ 'menu_type' => 0,
+ 'icon' => 'element-Tickets',
+ 'api_url' => '',
+ 'router_path' => 'article',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '文章列表',
+ 'menu_key' => 'article_list',
+ 'menu_type' => 1,
+ 'icon' => 'element-ChatDotSquare',
+ 'api_url' => 'article/article',
+ 'router_path' => 'list',
+ 'view_path' => 'article/list',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '文章添加/编辑',
+ 'menu_key' => 'article_edit',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'article/article',
+ 'router_path' => 'edit',
+ 'view_path' => 'article/edit',
+ 'methods' => 'post',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '文章栏目',
+ 'menu_key' => 'article_category',
+ 'menu_type' => 1,
+ 'icon' => 'element-CollectionTag',
+ 'api_url' => 'article/category',
+ 'router_path' => 'category',
+ 'view_path' => 'article/category',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '会员管理',
+ 'menu_key' => 'member',
+ 'menu_type' => 0,
+ 'icon' => 'iconfont-iconjiaoseyonghu',
+ 'api_url' => '',
+ 'router_path' => 'member',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' =>
+ [
+ [
+ 'menu_name' => '会员列表',
+ 'menu_key' => 'member_list',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconhuiyuanliebiao',
+ 'api_url' => 'member/member',
+ 'router_path' => 'member',
+ 'view_path' => 'member/member',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+
+ 'menu_name' => '编辑',
+ 'menu_key' => 'member_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'member/modify//',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '会员详情',
+ 'menu_key' => 'member_info',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'member/member/',
+ 'router_path' => 'detail',
+ 'view_path' => 'member/member_detail',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '会员标签',
+ 'menu_key' => 'member_label',
+ 'menu_type' => 1,
+ 'icon' => 'element-CollectionTag',
+ 'api_url' => 'member/label',
+ 'router_path' => 'label',
+ 'view_path' => 'member/label',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+
+ 'menu_name' => '编辑标签',
+ 'menu_key' => 'member_label_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'member/label/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+
+ 'menu_name' => '添加标签',
+ 'menu_key' => 'member_label_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'member/label',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+
+ 'menu_name' => '删除标签',
+ 'menu_key' => 'member_label_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'member/label/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '会员积分',
+ 'menu_key' => 'member_point',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconjifen-xianxing',
+ 'api_url' => 'member/account/point',
+ 'router_path' => 'point',
+ 'view_path' => 'member/point',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '会员余额',
+ 'menu_key' => 'member_balance',
+ 'menu_type' => 1,
+ 'icon' => 'element-Money',
+ 'api_url' => 'member/account/balance',
+ 'router_path' => 'balance',
+ 'view_path' => 'member/balance',
+ 'methods' => 'get',
+ 'sort' => 60,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '会员佣金',
+ 'menu_key' => 'member_commission',
+ 'menu_type' => 1,
+ 'icon' => 'element-Money',
+ 'api_url' => 'member/account/commission',
+ 'router_path' => 'commission',
+ 'view_path' => 'member/commission',
+ 'methods' => 'get',
+ 'sort' => 59,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ],
+ ],
+ [
+ 'menu_name' => '财务管理',
+ 'menu_key' => 'finance',
+ 'menu_type' => 0,
+ 'icon' => 'element-Box',
+ 'api_url' => '',
+ 'router_path' => 'finance',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 60,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '会员充值',
+ 'menu_key' => 'recharge_list',
+ 'menu_type' => 1,
+ 'icon' => 'element-Help',
+ 'api_url' => 'order/recharge',
+ 'router_path' => 'recharge',
+ 'view_path' => 'finance/recharge/list',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '退款',
+ 'menu_key' => 'refund',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'order/refund/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '充值详情',
+ 'menu_key' => 'recharge_order_info',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'order/recharge/',
+ 'router_path' => 'recharge/detail',
+ 'view_path' => 'finance/recharge/detail',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '会员提现',
+ 'menu_key' => 'cash_out_list',
+ 'menu_type' => 1,
+ 'icon' => 'element-Postcard',
+ 'api_url' => 'member/cash_out',
+ 'router_path' => 'cash_out',
+ 'view_path' => 'finance/cash_out',
+ 'methods' => 'get',
+ 'sort' => 99,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '退款记录',
+ 'menu_key' => 'refund_list',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-icontuikuanjilu',
+ 'api_url' => 'order/refund',
+ 'router_path' => 'refund',
+ 'view_path' => 'order/refund',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '退款详情',
+ 'menu_key' => 'refund',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'order/refund/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+
+ ]
+ ]
+ ]
+ ],
+ [
+
+ 'menu_name' => '应用管理',
+ 'menu_key' => 'addon',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconmanage-apply',
+ 'api_url' => 'addon/list',
+ 'router_path' => 'app',
+ 'view_path' => 'app/index',
+ 'methods' => 'get',
+ 'sort' => 55,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => []
+ ],
+ [
+
+ 'menu_name' => '渠道管理',
+ 'menu_key' => 'channel',
+ 'menu_type' => 0,
+ 'icon' => 'element-DataBoard',
+ 'api_url' => '',
+ 'router_path' => 'channel',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 50,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '电脑端',
+ 'menu_key' => 'channel_pc',
+ 'menu_type' => 0,
+ 'icon' => 'iconfont-icondesktop',
+ 'api_url' => '',
+ 'router_path' => 'pc',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '电脑端配置',
+ 'menu_key' => 'pc_config',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => '',
+ 'router_path' => 'config',
+ 'view_path' => 'channel/pc/config',
+ 'methods' => '',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => 'H5',
+ 'menu_key' => 'channel_h5',
+ 'menu_type' => 0,
+ 'icon' => 'iconfont-iconh5e',
+ 'api_url' => 'channel/h5/config',
+ 'router_path' => 'h5',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 110,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => 'H5端配置',
+ 'menu_key' => 'h5_config',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'channel/h5/config',
+ 'router_path' => 'config',
+ 'view_path' => 'channel/h5/config',
+ 'methods' => 'put',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '微信公众号',
+ 'menu_key' => 'channel_wechat',
+ 'menu_type' => 0,
+ 'icon' => 'iconfont-iconweixingongzhonghao1',
+ 'api_url' => '',
+ 'router_path' => 'wechat',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '公众号配置',
+ 'menu_key' => 'wechat_config',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'wechat/config',
+ 'router_path' => 'config',
+ 'view_path' => 'channel/wechat/config',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '自定义菜单',
+ 'menu_key' => 'wechat_menu',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'wechat/menu',
+ 'router_path' => 'menu',
+ 'view_path' => 'channel/wechat/menu',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '模板消息',
+ 'menu_key' => 'wechat_template_message',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'wechat/template',
+ 'router_path' => 'message',
+ 'view_path' => 'channel/wechat/template',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+ 'menu_name' => '微信小程序',
+ 'menu_key' => 'channel_weapp',
+ 'menu_type' => 0,
+ 'icon' => 'iconfont-iconxiaochengxushezhi',
+ 'api_url' => '',
+ 'router_path' => 'weapp',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '小程序配置',
+ 'menu_key' => 'weapp_config',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'weapp/config',
+ 'router_path' => 'config',
+ 'view_path' => 'channel/weapp/config',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '订阅消息',
+ 'menu_key' => 'weapp_template_message',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'weapp/template',
+ 'router_path' => 'message',
+ 'view_path' => 'channel/weapp/template',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+ 'menu_name' => '支付宝小程序',
+ 'menu_key' => 'channel_aliapp',
+ 'menu_type' => 0,
+ 'icon' => 'iconfont-iconzhifubao',
+ 'api_url' => 'aliapp/config',
+ 'router_path' => 'aliapp',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '支付宝配置',
+ 'menu_key' => 'aliapp_config',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'aliapp/config',
+ 'router_path' => 'config',
+ 'view_path' => 'channel/aliapp/config',
+ 'methods' => 'put',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '权限管理',
+ 'menu_key' => 'auth',
+ 'menu_type' => 0,
+ 'icon' => 'element-Lock',
+ 'api_url' => '',
+ 'router_path' => 'auth',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 40,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+
+ 'menu_name' => '管理员',
+ 'menu_key' => 'auth_user',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconyonghu',
+ 'api_url' => 'site/user',
+ 'router_path' => 'user',
+ 'view_path' => 'auth/user',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '新增',
+ 'menu_key' => 'auth_user_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'site/user',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '编辑',
+ 'menu_key' => 'auth_user_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'site/user/',
+ 'router_path' => '',
+ 'view_path' => 'put',
+ 'methods' => '',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '删除',
+ 'menu_key' => 'auth_user_del',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'site/user/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '详情',
+ 'menu_key' => 'auth_user_info',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/user/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 0,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ],
+ ],
+ [
+ 'menu_name' => '角色管理',
+ 'menu_key' => 'auth_role',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-iconhuiyuanliebiao',
+ 'api_url' => 'sys/role',
+ 'router_path' => 'role',
+ 'view_path' => 'auth/role',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '新增',
+ 'menu_key' => 'auth_role_add',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/role',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '编辑',
+ 'menu_key' => 'auth_role_update',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/role/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'put',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '删除',
+ 'menu_key' => 'auth_role_del',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'sys/role/',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'delete',
+ 'sort' => 1,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '操作日志',
+ 'menu_key' => 'auth_log',
+ 'menu_type' => 1,
+ 'icon' => 'element-Document',
+ 'api_url' => 'sys/log',
+ 'router_path' => 'log',
+ 'view_path' => 'auth/log',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+
+ [
+ 'menu_name' => '系统设置',
+ 'menu_key' => 'setting',
+ 'menu_type' => 0,
+ 'icon' => 'element-Setting',
+ 'api_url' => '',
+ 'router_path' => 'setting',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 30,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '网站设置',
+ 'menu_key' => 'setting_system',
+ 'menu_type' => 1,
+ 'icon' => 'element-Basketball',
+ 'api_url' => 'sys/config/website',
+ 'router_path' => 'system',
+ 'view_path' => 'setting/system',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '协议管理',
+ 'menu_key' => 'system_agreement',
+ 'menu_type' => 1,
+ 'icon' => 'element-Notebook',
+ 'api_url' => 'sys/agreement',
+ 'router_path' => 'agreement',
+ 'view_path' => 'setting/agreement',
+ 'methods' => 'get',
+ 'sort' => 80,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+
+ ]
+ ],
+ [
+ 'menu_name' => '协议编辑',
+ 'menu_key' => 'system_agreement_edit',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'sys/agreement/',
+ 'router_path' => 'agreement/edit',
+ 'view_path' => 'setting/agreement_edit',
+ 'methods' => 'put',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 0,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '注册登录',
+ 'menu_key' => 'setting_login_register',
+ 'menu_type' => 1,
+ 'icon' => 'iconfont-icondenglu',
+ 'api_url' => 'member/config/login',
+ 'router_path' => 'login',
+ 'view_path' => 'setting/login',
+ 'methods' => 'get',
+ 'sort' => 70,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '支付管理',
+ 'menu_key' => 'setting_pay',
+ 'menu_type' => 1,
+ 'icon' => 'element-Wallet',
+ 'api_url' => '',
+ 'router_path' => 'pay',
+ 'view_path' => '',
+ 'methods' => 'get',
+ 'sort' => 60,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '支付设置',
+ 'menu_key' => 'setting_pay_channel',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'pay/channel/lists',
+ 'router_path' => 'channel',
+ 'view_path' => 'setting/pay',
+ 'methods' => 'get',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '设置',
+ 'menu_key' => 'setting_pay_channel_set',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'pay/channel/set//',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 100,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+ [
+ 'menu_name' => '打款设置',
+ 'menu_key' => 'setting_pay_transfer',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'pay/transfer',
+ 'router_path' => 'transfer',
+ 'view_path' => 'setting/transfer',
+ 'methods' => 'get',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '设置',
+ 'menu_key' => 'setting_pay_transfer_set',
+ 'menu_type' => 2,
+ 'icon' => '',
+ 'api_url' => 'pay/transfer',
+ 'router_path' => '',
+ 'view_path' => '',
+ 'methods' => 'post',
+ 'sort' => 90,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ ]
+ ],
+// [
+// 'menu_name' => '微信支付',
+// 'menu_key' => 'setting_wechatpay',
+// 'menu_type' => 2,
+// 'icon' => '',
+// 'api_url' => '',
+// 'router_path' => 'wechatpay',
+// 'view_path' => '',
+// 'methods' => '',
+// 'sort' => 0,
+// 'status' => 1,
+// 'is_show' => 0,
+// 'en_menu_name' => '',
+// ],
+// [
+// 'menu_name' => '支付宝支付',
+// 'menu_key' => 'setting_alipay',
+// 'menu_type' => 2,
+// 'icon' => '',
+// 'api_url' => '',
+// 'router_path' => 'alipay',
+// 'view_path' => '',
+// 'methods' => '',
+// 'sort' => 0,
+// 'status' => 1,
+// 'is_show' => 0,
+// 'en_menu_name' => '',
+// ],
+// [
+// 'menu_name' => '获取支付配置',
+// 'menu_key' => 'set_pay_config',
+// 'menu_type' => 2,
+// 'icon' => '',
+// 'api_url' => 'pay/config/',
+// 'router_path' => '',
+// 'view_path' => '',
+// 'methods' => 'get',
+// 'sort' => 0,
+// 'status' => 1,
+// 'is_show' => 0,
+// 'en_menu_name' => '',
+// ],
+// [
+// 'menu_name' => '配置支付',
+// 'menu_key' => 'set_pay_config',
+// 'menu_type' => 2,
+// 'icon' => '',
+// 'api_url' => 'pay/config/',
+// 'router_path' => '',
+// 'view_path' => '',
+// 'methods' => 'put',
+// 'sort' => 0,
+// 'status' => 1,
+// 'is_show' => 0,
+// 'en_menu_name' => '',
+// ],
+ ]
+ ],
+ [
+ 'menu_name' => '提现设置',
+ 'menu_key' => 'cash_out_config',
+ 'menu_type' => 1,
+ 'icon' => 'element-Postcard',
+ 'api_url' => 'member/config/cash_out',
+ 'router_path' => 'cash_out',
+ 'view_path' => 'setting/cash_out',
+ 'methods' => 'post',
+ 'sort' => 59,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '消息管理',
+ 'menu_key' => 'setting_notice',
+ 'menu_type' => 1,
+ 'icon' => 'element-ChatLineSquare',
+ 'api_url' => '',
+ 'router_path' => 'notice',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 50,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '消息模板',
+ 'menu_key' => 'setting_notice_template',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'notice/notice',
+ 'router_path' => 'template',
+ 'view_path' => 'setting/notice',
+ 'methods' => 'get',
+ 'sort' => 10,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '发送记录',
+ 'menu_key' => 'setting_notice_records',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'notice/notice/log',
+ 'router_path' => 'records',
+ 'view_path' => 'setting/notice_records',
+ 'methods' => 'get',
+ 'sort' => 9,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ [
+ 'menu_name' => '短信管理',
+ 'menu_key' => 'sms_notice',
+ 'menu_type' => 0,
+ 'icon' => 'element-Message',
+ 'api_url' => '',
+ 'router_path' => 'sms',
+ 'view_path' => '',
+ 'methods' => '',
+ 'sort' => 40,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ 'children' => [
+ [
+ 'menu_name' => '短信设置',
+ 'menu_key' => 'sms_setting',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'notice/sms',
+ 'router_path' => 'setting',
+ 'view_path' => 'setting/sms',
+ 'methods' => 'get',
+ 'sort' => 12,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ],
+ [
+ 'menu_name' => '发送记录',
+ 'menu_key' => 'sms_notice_records',
+ 'menu_type' => 1,
+ 'icon' => '',
+ 'api_url' => 'notice/sms/log',
+ 'router_path' => 'records',
+ 'view_path' => 'setting/sms_records',
+ 'methods' => 'get',
+ 'sort' => 11,
+ 'status' => 1,
+ 'is_show' => 1,
+ 'en_menu_name' => '',
+ ]
+ ]
+ ],
+ ]
+ ]
+ ];
\ No newline at end of file
diff --git a/niucloud/app/enum/notice/NoticeEnum.php b/niucloud/app/enum/notice/NoticeEnum.php
new file mode 100644
index 000000000..331ac3cc8
--- /dev/null
+++ b/niucloud/app/enum/notice/NoticeEnum.php
@@ -0,0 +1,73 @@
+load(['type' => 'notice']);
+// $wechat_notice = $addon_load->load(['type' => NoticeTypeEnum::WECHAT]);
+// $weapp_notice = $addon_load->load(['type' => NoticeTypeEnum::WEAPP]);
+// $sms_notice = $addon_load->load(['type' => NoticeTypeEnum::SMS]);
+ $notice_type = NoticeTypeEnum::getType();
+ foreach($notice_type as $k => $v){
+ $var_name = $k.'_notice';
+ $$var_name = $addon_load->load(['type' => $k]);
+ }
+
+ foreach ($notice as $k => $v)
+ {
+ $support_type = [];
+// if(array_key_exists($k, $wechat_notice))
+// {
+// $notice[$k]['wechat'] = $wechat_notice[$k];
+// $support_type[] = 'wechat';
+// }
+// if(array_key_exists($k, $weapp_notice))
+// {
+// $notice[$k]['weapp'] = $weapp_notice[$k];
+// $support_type[] = 'weapp';
+// }
+// if(array_key_exists($k, $sms_notice))
+// {
+// $notice[$k]['sms'] = $sms_notice[$k];
+// $support_type[] = 'sms';
+// }
+
+ foreach($notice_type as $notice_type_k => $notice_type_v){
+ $var_name = $notice_type_k.'_notice';
+ if(array_key_exists($k, $$var_name))
+ {
+ $notice[$k][$notice_type_k] = $$var_name[$k];
+ $support_type[] = $notice_type_k;
+ }
+ }
+ $notice[$k]['support_type'] = $support_type;
+ }
+ if(!empty($key))
+ {
+ return $notice[$key] ?? [];
+ }
+ return $notice;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/enum/sys/MessageTypeEnum.php b/niucloud/app/enum/notice/NoticeTypeEnum.php
similarity index 75%
rename from niucloud/app/enum/sys/MessageTypeEnum.php
rename to niucloud/app/enum/notice/NoticeTypeEnum.php
index 1f57103d5..763d6e6ab 100644
--- a/niucloud/app/enum/sys/MessageTypeEnum.php
+++ b/niucloud/app/enum/notice/NoticeTypeEnum.php
@@ -9,9 +9,9 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\enum\sys;
+namespace app\enum\notice;
-class MessageTypeEnum
+class NoticeTypeEnum
{
//短信
const SMS = 'sms';
@@ -27,9 +27,9 @@ class MessageTypeEnum
*/
public static function getType(){
return [
- self::SMS => get_lang('enum_message.type_sms'),//短信
- self::WECHAT => get_lang('enum_message.type_wechat'),//微信公众号
- self::WEAPP => get_lang('enum_message.type_weapp'),//微信小程序
+ self::SMS => get_lang('enum_notice.type_sms'),//短信
+ self::WECHAT => get_lang('enum_notice.type_wechat'),//微信公众号
+ self::WEAPP => get_lang('enum_notice.type_weapp'),//微信小程序
];
}
diff --git a/niucloud/app/enum/notice/notice.php b/niucloud/app/enum/notice/notice.php
new file mode 100644
index 000000000..be602baee
--- /dev/null
+++ b/niucloud/app/enum/notice/notice.php
@@ -0,0 +1,39 @@
+ [
+ 'key' => 'verify_code',
+ 'receiver_type' => 1,
+ 'name' => '手机验证码',
+ 'title' => '管理端验证码登录',
+ 'async' => false,
+ 'variable' =>[
+ 'code' => '验证码'
+ ],
+ ],
+ //手机验证码,站点应用发送
+ 'member_verify_code' => [
+ 'key' => 'member_verify_code',
+ 'receiver_type' => 2,
+ 'name' => '手机验证码',
+ 'title' => '前端验证码登录,注册,手机验证',
+ 'async' => false,
+ 'variable' =>[
+ 'code' => '验证码'
+ ],
+ ],
+ //充值成功通知,站点端发送
+ 'recharge_success' => [
+ 'key' => 'recharge_success',
+ 'receiver_type' => 2,
+ 'name' => '充值成功通知',
+ 'title' => '会员充值成功后发送',
+ 'async' => true,
+ 'variable' =>[
+ 'price' => '充值金额',
+ 'balance' => '充值后账户',
+ 'time' => '充值时间',
+ 'trade_no' => '交易单号'
+ ],
+ ]
+
+];
\ No newline at end of file
diff --git a/niucloud/app/enum/notice/sms.php b/niucloud/app/enum/notice/sms.php
new file mode 100644
index 000000000..53c651307
--- /dev/null
+++ b/niucloud/app/enum/notice/sms.php
@@ -0,0 +1,14 @@
+ [
+ 'content' => '您的手机验证码{code},请不要轻易告诉其他人'
+ ],
+ 'member_verify_code' => [
+ 'content' => '您的手机验证码{code},请不要轻易告诉其他人',
+ ],
+ 'recharge_success' => [
+ 'content' => '您充值金额¥{price}, 充值后金额¥{balance}',
+ ]
+
+];
\ No newline at end of file
diff --git a/niucloud/app/enum/notice/weapp.php b/niucloud/app/enum/notice/weapp.php
new file mode 100644
index 000000000..6040cbcd8
--- /dev/null
+++ b/niucloud/app/enum/notice/weapp.php
@@ -0,0 +1,12 @@
+ [
+ 'temp_key' => '755',
+ 'content' => [
+ ['交易单号', '{trade_no}', 'keyword1'],
+ ['充值金额', '{price}', 'keyword2'],
+ ['账户余额', '{balance}', 'keyword3'],
+ ['充值时间', '{time}', 'keyword4'],
+ ],
+ ]
+];
\ No newline at end of file
diff --git a/niucloud/app/enum/notice/wechat.php b/niucloud/app/enum/notice/wechat.php
new file mode 100644
index 000000000..544480ef2
--- /dev/null
+++ b/niucloud/app/enum/notice/wechat.php
@@ -0,0 +1,13 @@
+ [
+ 'temp_key' => 'OPENTM414089457',
+ 'first' => '',
+ 'content' => [
+ ['充值时间', '{time}', 'keyword1'],
+ ['充值金额', '{price}', 'keyword2'],
+ ['充值状态', '充值成功', 'keyword3']
+ ],
+ 'remark' => ''
+ ]
+];
\ No newline at end of file
diff --git a/niucloud/app/enum/order/OrderRefundEnum.php b/niucloud/app/enum/order/OrderRefundEnum.php
new file mode 100644
index 000000000..8f1c21b1b
--- /dev/null
+++ b/niucloud/app/enum/order/OrderRefundEnum.php
@@ -0,0 +1,52 @@
+ [
+ 'name' => get_lang('enum_refund.wait'),
+ 'key' => self::WAIT,
+ ],
+ self::WAIT_TRANSFER => [
+ 'name' => get_lang('enum_refund.wait_transfer'),
+ 'key' => self::WAIT,
+ ],
+ self::SUCCESS => [
+ 'name' => get_lang('enum_refund.success'),
+ 'key' => self::WAIT,
+ ],
+ ];
+ foreach($list as $k => $v){
+ if(!empty($status) && !in_array($k, $status)) unset($list[$k]);
+ }
+ return $list;
+ }
+
+
+}
\ No newline at end of file
diff --git a/niucloud/app/enum/order/RechargeOrderEnum.php b/niucloud/app/enum/order/RechargeOrderEnum.php
index 85ac36e25..6a5b34eb4 100644
--- a/niucloud/app/enum/order/RechargeOrderEnum.php
+++ b/niucloud/app/enum/order/RechargeOrderEnum.php
@@ -30,6 +30,15 @@ class RechargeOrderEnum
//已关闭
const CLOSE = -1;
+ // 退款相关状态
+ // 未申请
+ const NOT_APPLAY = 0;
+ // 退款中
+ const REFUNDING = 1;
+ // 退款完成
+ const REFUND_COMPLETED = 2;
+ // 退款失败
+ const REFUND_FAIL = -1;
/**
* 当前订单支持的支付方式
@@ -102,4 +111,31 @@ class RechargeOrderEnum
return $data[$status] ?? '';
}
+ /**
+ * 获取退款状态
+ * @param int|string $status
+ * @return array|array[]|string
+ */
+ public static function getRefundStatus(int|string $status = '') {
+ $data = [
+ self::REFUNDING => [
+ 'name' => get_lang('enum_order_refund.refunding'),
+ 'status' => self::REFUNDING
+ ],
+ self::REFUND_COMPLETED => [
+ 'name' => get_lang('enum_order_refund.refund_complete'),
+ 'status' => self::REFUND_COMPLETED
+ ],
+ self::REFUND_FAIL => [
+ 'name' => get_lang('enum_order_refund.refund_fail'),
+ 'status' => self::REFUND_FAIL
+ ]
+ ];
+
+ if ($status == '') {
+ return $data;
+ }
+ return $data[$status] ?? '';
+ }
+
}
\ No newline at end of file
diff --git a/niucloud/app/enum/pay/PayChannelEnum.php b/niucloud/app/enum/pay/PayChannelEnum.php
new file mode 100644
index 000000000..a46772f62
--- /dev/null
+++ b/niucloud/app/enum/pay/PayChannelEnum.php
@@ -0,0 +1,46 @@
+ $v){
+// if($k == PayEnum::BALANCEPAY){
+// $pay_type[$k]['is_template'] = false;
+// }else{
+// $pay_type[$k]['is_template'] = true;
+// }
+// }
+ foreach($channel as $k => $v){
+ $list[$k] = [
+ 'name' => $v,
+ 'key' => $k,
+ 'pay_type' => $pay_type
+ ];
+ }
+ return $list;
+ }
+
+
+}
\ No newline at end of file
diff --git a/niucloud/app/enum/pay/PayEnum.php b/niucloud/app/enum/pay/PayEnum.php
index 5be3dc4e0..54cc55f77 100644
--- a/niucloud/app/enum/pay/PayEnum.php
+++ b/niucloud/app/enum/pay/PayEnum.php
@@ -50,12 +50,12 @@ class PayEnum
self::WECHATPAY => [
'name' => get_lang('enum_pay.type_wechatpay'),
'key' => self::WECHATPAY,
- 'icon' => self::WECHATPAY_ICON
+ 'icon' => self::WECHATPAY_ICON,
],//微信支付
self::ALIPAY => [
'name' => get_lang('enum_pay.type_alipay'),
'key' => self::ALIPAY,
- 'icon' => self::ALIPAY_ICON
+ 'icon' => self::ALIPAY_ICON,
],//支付宝支付
// self::UNIPAY => [
// 'name' => get_lang('enum_pay.type_unipay'),
@@ -70,7 +70,7 @@ class PayEnum
self::BALANCEPAY => [
'name' => get_lang('enum_pay.type_balancepay'),
'key' => self::BALANCEPAY,
- 'icon' => self::BALANCEPAY_ICON
+ 'icon' => self::BALANCEPAY_ICON,
],//微信支付
// self::ALIPAY => get_lang('enum_pay.type_alipay'),//支付宝支付
// self::UNIPAY => get_lang('enum_pay.type_unipay'),//银联
diff --git a/niucloud/app/enum/pay/RefundEnum.php b/niucloud/app/enum/pay/RefundEnum.php
new file mode 100644
index 000000000..1d3f384e2
--- /dev/null
+++ b/niucloud/app/enum/pay/RefundEnum.php
@@ -0,0 +1,54 @@
+ get_lang('enum_pay_refund.status_wait'),
+ self::DEALING => get_lang('enum_pay_refund.status_dealing'),
+ self::SUCCESS => get_lang('enum_pay_refund.status_success'),
+ self::FAIL => get_lang('enum_pay_refund.status_fail'),
+ ];
+ return $list;
+ }
+
+ /**
+ * 获取退款方式
+ * @return array
+ */
+ public static function getType(){
+ return [
+ self::WECHATPAY => get_lang('enum_pay_refund.wechatpay'),
+ self::ALIPAY => get_lang('enum_pay_refund.alipay'),
+ self::OFFLINE => get_lang('enum_pay_refund.offline'),
+ self::BALANCE => get_lang('enum_pay_refund.balance')
+ ];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/enum/pay/TransferEnum.php b/niucloud/app/enum/pay/TransferEnum.php
index 83f9e2126..e8f491bdc 100644
--- a/niucloud/app/enum/pay/TransferEnum.php
+++ b/niucloud/app/enum/pay/TransferEnum.php
@@ -56,7 +56,7 @@ class TransferEnum
self::ALIPAY => [
'name' => get_lang('enum_transfer.type_ali'),
'key' => self::ALIPAY,
- 'is_online' => true
+ 'is_online' => false
],//支付宝
self::BANK => [
'name' => get_lang('enum_transfer.type_bank'),
diff --git a/niucloud/app/enum/sys/ConfigKeyEnum.php b/niucloud/app/enum/sys/ConfigKeyEnum.php
index f42d32a43..bb5aea9f8 100644
--- a/niucloud/app/enum/sys/ConfigKeyEnum.php
+++ b/niucloud/app/enum/sys/ConfigKeyEnum.php
@@ -23,9 +23,9 @@ class ConfigKeyEnum
const UPLOAD = 'upload';//上传配置
const DIY_BOTTOM = 'diy_bottom';//底部导航配置
- const MEMBER_WITHDRAW = 'member_withdraw';//会员提现
-
+ const MEMBER_CASH_OUT = 'member_cash_out';//会员提现
+ const ADMIN_LOGIN = 'admin_login';//管理端登录注册设置
const ALIAPP = 'aliapp';//支付宝小程序
const H5 = 'h5';//h5
diff --git a/niucloud/app/enum/sys/FileEnum.php b/niucloud/app/enum/sys/FileEnum.php
index 16392ad1c..4fc692b9e 100644
--- a/niucloud/app/enum/sys/FileEnum.php
+++ b/niucloud/app/enum/sys/FileEnum.php
@@ -47,4 +47,21 @@ class FileEnum
self::QCLOUD => get_lang('enum_file.storage_type_qcloud'),//腾讯云
];
}
+
+
+ const WECHAT = 'wechat';//微信支付
+
+
+ /**
+ * 获取上传的场景
+ * @return array
+ */
+ public static function getSceneType(){
+ return [
+ self::WECHAT,//微信相关上传
+ self::ALIYUN,//阿里云相关上传
+ self::IMAGE,//图片上传
+ self::VIDEO,//视频上传
+ ];
+ }
}
\ No newline at end of file
diff --git a/niucloud/app/enum/sys/MessageEnum.php b/niucloud/app/enum/sys/MessageEnum.php
deleted file mode 100644
index 933368185..000000000
--- a/niucloud/app/enum/sys/MessageEnum.php
+++ /dev/null
@@ -1,99 +0,0 @@
- [
- 'key' => 'verify_code',
- 'app_type' => 'admin',
- 'name' => '手机验证码',
- 'title' => '管理端验证码登录',
- 'variable' =>[
- 'code' => '验证码'
- ],
- 'support_type' => ['sms'],
- 'receiver_type' => 2,
- 'sms_default_content' => '您的手机验证码{code},请不要轻易告诉其他人',
- 'wechat_json' => '',
- 'weapp_json' => ''
- ],
- //手机验证码,站点应用发送
- 'member_verify_code' => [
- 'key' => 'member_verify_code',
- 'app_type' => 'site',
- 'name' => '手机验证码',
- 'title' => '前端验证码登录,注册,手机验证',
- 'variable' =>[
- 'code' => '验证码'
- ],
- 'support_type' => ['sms'],
- 'receiver_type' => 1,
- 'sms_default_content' => '您的手机验证码{code},请不要轻易告诉其他人',
- 'wechat_json' => '',
- 'weapp_json' => ''
- ],
- //充值成功通知,站点端发送
- 'recharge_success' => [
- 'key' => 'recharge_success',
- 'app_type' => 'site',
- 'name' => '充值成功通知',
- 'title' => '会员充值成功后发送',
- 'variable' =>[
- 'price' => '充值金额',
- 'balance' => '充值后账户',
- 'time' => '充值时间',
- 'trade_no' => '交易单号'
- ],
- 'support_type' => ['sms','wechat','weapp'],
- 'receiver_type' => 1,
- 'sms_default_content' => '您充值金额¥{price}, 充值后金额¥{balance}',
- 'wechat_json' => [
- 'temp_key' => 'OPENTM414089457',
- 'first' => '',
- 'content' => [
- ['充值时间', '{time}'],
- ['充值金额', '{price}'],
- ['充值状态', '充值成功']
- ],
- 'remark' => ''
- ],
- 'weapp_json' => [
- 'temp_key' => '755',
- 'content' => [
- ['交易单号', '{trade_no}'],
- ['充值金额', '{price}'],
- ['账户余额', '{balance}'],
- ['充值时间', '{time}'],
- ],
- ]
- ]
- ];
- if(empty($key))
- {
- return $message;
- }else
- return $message[$key];
- }
-
-}
\ No newline at end of file
diff --git a/niucloud/app/event.php b/niucloud/app/event.php
index 94bd52ba9..8fb1c1ba6 100644
--- a/niucloud/app/event.php
+++ b/niucloud/app/event.php
@@ -1,20 +1,67 @@
loadFiles();
-$events = [];
-foreach ($files as $file)
-{
- $event = include $file;
- $events = empty($events) ? $event : array_merge2($events, $event);
-}
+$system_event = [
+ //文件执行序列号
+ 'file_sort' => 1,
+ 'bind' => [
+ ],
-return $events;
+ 'listen' => [
+
+ /**
+ * 系统事件
+ */
+ 'AppInit' => [ 'app\listener\system\AppInitListener' ],
+ 'HttpRun' => [],
+ 'HttpEnd' => [],
+ 'LogLevel' => [],
+ 'LogWrite' => [],
+ /**
+ * 会员相关事件
+ */
+
+ //会员注册事件
+ 'memberRegister' => [ 'app\listener\member\MemberRegisterListener' ],
+ //会员登录事件
+ 'memberLogin' => [ 'app\listener\member\MemberLoginListener' ],
+ //会员账户变化事件
+ 'memberAccount' => [ 'app\listener\member\MemberAccountListener' ],
+ //扫码事件
+ 'scan' => [ 'app\listener\scan\ScanListener' ],
+
+ /**
+ * 消息相关事件
+ */
+
+ /**
+ * 支付相关事件
+ */
+ 'PaySuccess' => [ 'app\listener\pay\PaySuccessListener' ],
+ 'TransferSuccess' => [ 'app\listener\pay\TransferSuccessListener' ],
+
+ // 任务失败统一回调,有四种定义方式
+ 'queue_failed'=> [
+ ['app\listener\job\QueueFailedLoggerListener', 'report'],
+ ],
+ 'appManage' => [
+ 'app\listener\system\AppManageListener'
+ ],
+
+ //消息模板数据内容
+ 'noticeData' => [
+ 'app\listener\notice_template\VerifyCode',//手机验证码
+ 'app\listener\notice_template\MemberVerifySuccess',//
+ 'app\listener\notice_template\RechargeSuccess',
+ ],
+ //全场景消息发送
+ 'notice' => [
+ 'app\listener\notice\Sms',//短信
+ 'app\listener\notice\Wechat',//公众号模板消息
+ 'app\listener\notice\Weapp',//小程序订阅消息
+ ]
+ ],
+
+ 'subscribe' => [
+ ],
+];
+return (new \core\addon\AddonLoader("Event"))->load($system_event);
diff --git a/niucloud/app/event/system.php b/niucloud/app/event/system.php
deleted file mode 100644
index b479eea1e..000000000
--- a/niucloud/app/event/system.php
+++ /dev/null
@@ -1,44 +0,0 @@
- [
- ],
-
- 'listen' => [
-
- /**
- * 系统事件
- */
- 'AppInit' => ['app\listener\system\AppInit'],
- 'HttpRun' => [],
- 'HttpEnd' => [],
- 'LogLevel' => [],
- 'LogWrite' => [],
- /**
- * 会员相关事件
- */
-
- //会员注册事件
- 'memberRegister' => ['app\listener\member\MemberRegister'],
- //会员登录事件
- 'memberLogin' => ['app\listener\member\MemberLogin'],
- //会员账户变化事件
- 'memberAccount' => ['app\listener\member\MemberAccount'],
- //扫码事件
- 'scan' => ['app\listener\scan\Scan'],
-
- /**
- * 消息相关事件
- */
-
- /**
- * 支付相关事件
- */
- 'PaySuccess' => ['app\listener\pay\PaySuccess'],
- 'TransferSuccess' => ['app\listener\pay\TransferSuccess'],
-
- ],
-
- 'subscribe' => [
- ],
-];
diff --git a/niucloud/app/install/controller/BaseInstall.php b/niucloud/app/install/controller/BaseInstall.php
index 61c55b7a1..b717e3955 100644
--- a/niucloud/app/install/controller/BaseInstall.php
+++ b/niucloud/app/install/controller/BaseInstall.php
@@ -2,8 +2,7 @@
namespace app\install\controller;
-use app\BaseController;
-use extend\exception\CommonException;
+use core\base\BaseController;
use think\App;
use think\facade\View;
diff --git a/niucloud/app/install/controller/Index.php b/niucloud/app/install/controller/Index.php
index a5170fd1c..52529906a 100644
--- a/niucloud/app/install/controller/Index.php
+++ b/niucloud/app/install/controller/Index.php
@@ -55,6 +55,7 @@ class Index extends BaseInstall
$root_path = str_replace("\\", DIRECTORY_SEPARATOR, dirname(dirname(dirname(dirname(__FILE__)))));
$root_path = str_replace("../", DIRECTORY_SEPARATOR, $root_path);
$dirs_list = [
+ [ "path" => $root_path . DIRECTORY_SEPARATOR, "path_name" => "niucloud/", "name" => "网站目录" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".env", "path_name" => "niucloud/.env", "name" => "env" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".example.env", "path_name" => "niucloud/.example_env", "name" => "env" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/runtime", "name" => "runtime" ],
@@ -464,8 +465,8 @@ class Index extends BaseInstall
if ($data[ 1 ] == 'error') {
Cache::set('install_status', -1);
}
- $time = microtime(true) * 10000;
- $data[] = date('Y-m-d H:i:s', $time / 10000);
+ $time = @(int)microtime(true);
+ $data[] = date('Y-m-d H:i:s', $time);
$install_data = Cache::get('install_data') ?? [];
$install_data[] = $data;
Cache::set('install_data', $install_data);
diff --git a/niucloud/app/install/source/database.sql b/niucloud/app/install/source/database.sql
index 9a3340852..5abf5f482 100644
--- a/niucloud/app/install/source/database.sql
+++ b/niucloud/app/install/source/database.sql
@@ -1,6 +1,10 @@
SET NAMES 'utf8';
+DROP TABLE IF EXISTS addon;
+
+DROP TABLE IF EXISTS addon_log;
+
DROP TABLE IF EXISTS article;
DROP TABLE IF EXISTS article_category;
@@ -13,26 +17,38 @@ DROP TABLE IF EXISTS generate_column;
DROP TABLE IF EXISTS generate_table;
+DROP TABLE IF EXISTS jobs;
+
+DROP TABLE IF EXISTS jobs_failed;
+
DROP TABLE IF EXISTS member;
DROP TABLE IF EXISTS member_account_log;
DROP TABLE IF EXISTS member_address;
+DROP TABLE IF EXISTS member_cash_out;
+
+DROP TABLE IF EXISTS member_cash_out_account;
+
DROP TABLE IF EXISTS member_label;
DROP TABLE IF EXISTS member_level;
-DROP TABLE IF EXISTS member_withdraw;
-
-DROP TABLE IF EXISTS `order`;
+DROP TABLE IF EXISTS order;
DROP TABLE IF EXISTS order_item;
+DROP TABLE IF EXISTS order_item_refund;
+
DROP TABLE IF EXISTS order_log;
DROP TABLE IF EXISTS pay;
+DROP TABLE IF EXISTS pay_channel;
+
+DROP TABLE IF EXISTS pay_refund;
+
DROP TABLE IF EXISTS pay_transfer;
DROP TABLE IF EXISTS site;
@@ -53,11 +69,11 @@ DROP TABLE IF EXISTS sys_cron_task;
DROP TABLE IF EXISTS sys_menu;
-DROP TABLE IF EXISTS sys_message;
+DROP TABLE IF EXISTS sys_notice;
-DROP TABLE IF EXISTS sys_message_log;
+DROP TABLE IF EXISTS sys_notice_log;
-DROP TABLE IF EXISTS sys_message_sms_log;
+DROP TABLE IF EXISTS sys_notice_sms_log;
DROP TABLE IF EXISTS sys_role;
@@ -80,11 +96,11 @@ CREATE TABLE wechat_reply (
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
keyword varchar(64) NOT NULL DEFAULT '' COMMENT '关键词',
reply_type tinyint(4) NOT NULL COMMENT '回复类型 subscribe-关注回复 keyword-关键字回复 default-默认回复',
- matching_type tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '匹配方式:1-全匹配;2-模糊匹配',
- content_type tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '内容类型:1-文本',
+ matching_type tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '匹配方式:1-全匹配;2-模糊匹配',
+ content_type tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '内容类型:1-文本',
content text NOT NULL COMMENT '回复内容',
- status tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '启动状态:1-启动;0-关闭',
- sort int(10) UNSIGNED NOT NULL DEFAULT 50 COMMENT '排序',
+ status tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '启动状态:1-启动;0-关闭',
+ sort int(11) UNSIGNED NOT NULL DEFAULT 50 COMMENT '排序',
create_time int(11) NOT NULL COMMENT '创建时间',
update_time int(11) NOT NULL COMMENT '更新时间',
delete_time int(11) NOT NULL COMMENT '删除时间',
@@ -175,12 +191,12 @@ CREATE TABLE sys_user_log (
id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '管理员操作记录ID',
ip varchar(16) NOT NULL DEFAULT '' COMMENT '登录IP',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
- uid int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员id',
+ uid int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员id',
username varchar(64) NOT NULL DEFAULT '' COMMENT '管理员姓名',
url varchar(128) NOT NULL DEFAULT '' COMMENT '链接',
params text DEFAULT NULL COMMENT '参数',
type varchar(32) NOT NULL DEFAULT '' COMMENT '请求方式',
- create_time int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作时间',
+ create_time int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作时间',
PRIMARY KEY (id)
)
ENGINE = INNODB,
@@ -197,17 +213,17 @@ ALTER TABLE sys_user_log ADD INDEX uid (uid);
CREATE TABLE sys_user (
- uid smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '系统用户ID',
+ uid smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '系统用户ID',
username varchar(255) NOT NULL DEFAULT '' COMMENT '用户账号',
head_img varchar(255) NOT NULL DEFAULT '',
password varchar(100) NOT NULL DEFAULT '' COMMENT '用户密码',
real_name varchar(16) NOT NULL DEFAULT '' COMMENT '实际姓名',
last_ip varchar(16) NOT NULL DEFAULT '' COMMENT '最后一次登录ip',
- last_time int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后一次登录时间',
- create_time int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间',
- login_count int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录次数',
- status tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '后台管理员状态 1有效0无效',
- is_del tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
+ last_time int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后一次登录时间',
+ create_time int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间',
+ login_count int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录次数',
+ status tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '后台管理员状态 1有效0无效',
+ is_del tinyint(4) UNSIGNED NOT NULL DEFAULT 0,
delete_time tinyint(4) NOT NULL DEFAULT 0 COMMENT '删除时间',
update_time int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (uid),
@@ -232,11 +248,11 @@ ALTER TABLE sys_user ADD INDEX username (username (191));
CREATE TABLE sys_role (
- role_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '角色id',
+ role_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '角色id',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
role_name varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
rules text DEFAULT NULL COMMENT '角色权限(menus_id)',
- status tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态',
+ status tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态',
create_time int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
update_time int(11) NOT NULL DEFAULT 0 COMMENT '最后修改时间',
PRIMARY KEY (role_id)
@@ -252,21 +268,21 @@ ALTER TABLE sys_role ADD INDEX site_id (site_id);
ALTER TABLE sys_role ADD INDEX status (status);
-CREATE TABLE sys_message_sms_log (
- id int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
- site_id int(11) NOT NULL DEFAULT 1,
- mobile varchar(11) NOT NULL DEFAULT '' COMMENT '手机号码',
- sms_type varchar(32) NOT NULL DEFAULT '' COMMENT '发送关键字(注册、找回密码)',
- `key` varchar(32) NOT NULL DEFAULT '' COMMENT '发送关键字(注册、找回密码)',
- template_id varchar(50) NOT NULL DEFAULT '',
- content varchar(255) NOT NULL DEFAULT '' COMMENT '发送内容',
- params varchar(255) NOT NULL DEFAULT '' COMMENT '数据参数',
- status varchar(32) NOT NULL DEFAULT 'sending' COMMENT '发送状态:sending-发送中;success-发送成功;fail-发送失败',
- result text DEFAULT NULL COMMENT '短信结果',
- create_time int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
- send_time int(11) NOT NULL DEFAULT 0 COMMENT '发送时间',
- update_time int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
- delete_time int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
+CREATE TABLE sys_notice_sms_log (
+ id INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
+ site_id INT(11) NOT NULL DEFAULT 1,
+ mobile VARCHAR(11) NOT NULL DEFAULT '' COMMENT '手机号码',
+ sms_type VARCHAR(32) NOT NULL DEFAULT '' COMMENT '发送关键字(注册、找回密码)',
+ `key` VARCHAR(32) NOT NULL DEFAULT '' COMMENT '发送关键字(注册、找回密码)',
+ template_id VARCHAR(50) NOT NULL DEFAULT '',
+ content VARCHAR(255) NOT NULL DEFAULT '' COMMENT '发送内容',
+ params VARCHAR(255) NOT NULL DEFAULT '' COMMENT '数据参数',
+ status VARCHAR(32) NOT NULL DEFAULT 'sending' COMMENT '发送状态:sending-发送中;success-发送成功;fail-发送失败',
+ result TEXT DEFAULT NULL COMMENT '短信结果',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ send_time INT(11) NOT NULL DEFAULT 0 COMMENT '发送时间',
+ update_time INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
+ delete_time INT(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (id)
)
ENGINE = INNODB,
@@ -275,64 +291,61 @@ COLLATE utf8mb4_general_ci,
COMMENT = '短信发送表';
-CREATE TABLE sys_message_log (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '通知记录ID',
- site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
- `key` varchar(255) DEFAULT '' COMMENT '消息key',
- message_type varchar(50) DEFAULT 'sms' COMMENT '消息类型(sms,wechat.weapp)',
- uid int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '通知的用户id',
- member_id int(11) NOT NULL DEFAULT 0 COMMENT '消息的会员id',
- nickname varchar(255) NOT NULL DEFAULT '' COMMENT '接收人用户昵称或姓名',
- receiver varchar(255) NOT NULL DEFAULT '' COMMENT '接收人(对应手机号,openid)',
- content text DEFAULT NULL COMMENT '消息数据',
- is_click tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '点击次数',
- is_visit tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '访问次数',
- visit_time int(11) NOT NULL DEFAULT 0 COMMENT '访问时间',
- create_time int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '消息时间',
- result varchar(1000) NOT NULL DEFAULT '' COMMENT '结果',
- params text DEFAULT NULL,
+CREATE TABLE sys_notice_log (
+ id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '通知记录ID',
+ site_id INT(11) NOT NULL DEFAULT 1 COMMENT '站点id',
+ `key` VARCHAR(255) DEFAULT '' COMMENT '消息key',
+ notice_type VARCHAR(50) DEFAULT 'sms' COMMENT '消息类型(sms,wechat.weapp)',
+ uid INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '通知的用户id',
+ member_id INT(11) NOT NULL DEFAULT 0 COMMENT '消息的会员id',
+ nickname VARCHAR(255) NOT NULL DEFAULT '' COMMENT '接收人用户昵称或姓名',
+ receiver VARCHAR(255) NOT NULL DEFAULT '' COMMENT '接收人(对应手机号,openid)',
+ content TEXT DEFAULT NULL COMMENT '消息数据',
+ is_click TINYINT(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '点击次数',
+ is_visit TINYINT(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '访问次数',
+ visit_time INT(11) NOT NULL DEFAULT 0 COMMENT '访问时间',
+ create_time INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '消息时间',
+ result VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '结果',
+ params TEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci,
-COMMENT = '通知记录表',
-ROW_FORMAT = COMPACT;
+COMMENT = '通知记录表';
-ALTER TABLE sys_message_log ADD INDEX member_id (member_id);
+ALTER TABLE sys_notice_log ADD INDEX member_id(member_id);
-ALTER TABLE sys_message_log ADD INDEX message_key (`key` (191));
+ALTER TABLE sys_notice_log ADD INDEX message_key(`key`(191));
-ALTER TABLE sys_message_log ADD INDEX uid (uid);
+ALTER TABLE sys_notice_log ADD INDEX uid(uid);
-CREATE TABLE sys_message (
- id int(11) NOT NULL AUTO_INCREMENT,
- site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点ID',
- `key` varchar(50) NOT NULL DEFAULT '' COMMENT '标识',
- sms_content text DEFAULT NULL COMMENT '短信配置参数',
- is_wechat tinyint(4) NOT NULL DEFAULT 0 COMMENT '公众号模板消息(0:关闭,1:开启)',
- is_weapp tinyint(4) NOT NULL DEFAULT 0 COMMENT '小程序订阅消息(0:关闭,1:开启)',
- is_sms tinyint(4) NOT NULL DEFAULT 0 COMMENT '发送短信(0:关闭,1:开启)',
- wechat_template_id varchar(255) NOT NULL DEFAULT '' COMMENT '微信模版消息id',
- weapp_template_id varchar(255) NOT NULL DEFAULT '' COMMENT '微信小程序订阅消息id',
- sms_id varchar(255) NOT NULL DEFAULT '' COMMENT '短信id(对应短信配置)',
- create_time int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
- wechat_first varchar(255) NOT NULL DEFAULT '' COMMENT '微信头部',
- wechat_remark varchar(255) NOT NULL DEFAULT '' COMMENT '微信说明',
+CREATE TABLE sys_notice (
+ id INT(11) NOT NULL AUTO_INCREMENT,
+ site_id INT(11) NOT NULL DEFAULT 1 COMMENT '站点ID',
+ `key` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '标识',
+ sms_content TEXT DEFAULT NULL COMMENT '短信配置参数',
+ is_wechat TINYINT(4) NOT NULL DEFAULT 0 COMMENT '公众号模板消息(0:关闭,1:开启)',
+ is_weapp TINYINT(4) NOT NULL DEFAULT 0 COMMENT '小程序订阅消息(0:关闭,1:开启)',
+ is_sms TINYINT(4) NOT NULL DEFAULT 0 COMMENT '发送短信(0:关闭,1:开启)',
+ wechat_template_id VARCHAR(255) NOT NULL DEFAULT '' COMMENT '微信模版消息id',
+ weapp_template_id VARCHAR(255) NOT NULL DEFAULT '' COMMENT '微信小程序订阅消息id',
+ sms_id VARCHAR(255) NOT NULL DEFAULT '' COMMENT '短信id(对应短信配置)',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
+ wechat_first VARCHAR(255) NOT NULL DEFAULT '' COMMENT '微信头部',
+ wechat_remark VARCHAR(255) NOT NULL DEFAULT '' COMMENT '微信说明',
PRIMARY KEY (id)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci,
-COMMENT = '通知模型',
-ROW_FORMAT = COMPACT;
-
-ALTER TABLE sys_message ADD INDEX message_key (`key`, site_id);
+COMMENT = '通知模型';
+ALTER TABLE sys_notice ADD INDEX message_key(`key`, site_id);
CREATE TABLE sys_menu (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
app_type varchar(255) NOT NULL DEFAULT 'admin' COMMENT '应用类型',
menu_name varchar(32) NOT NULL DEFAULT '' COMMENT '菜单名称',
menu_key varchar(255) NOT NULL DEFAULT '' COMMENT '菜单标识(菜单输入,接口自动生成)',
@@ -344,11 +357,12 @@ CREATE TABLE sys_menu (
view_path varchar(255) NOT NULL DEFAULT '' COMMENT '菜单文件地址',
methods varchar(10) NOT NULL DEFAULT '' COMMENT '提交方式POST GET PUT DELETE',
sort tinyint(4) NOT NULL DEFAULT 1 COMMENT '排序',
- status tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '正常,禁用(禁用后不允许访问)',
+ status tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '正常,禁用(禁用后不允许访问)',
is_show tinyint(4) NOT NULL DEFAULT 1 COMMENT '是否显示',
create_time int(11) NOT NULL DEFAULT 0,
en_menu_name varchar(255) NOT NULL DEFAULT '' COMMENT '菜单英文名',
delete_time int(11) NOT NULL DEFAULT 0,
+ addon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '所属插件',
PRIMARY KEY (id)
)
ENGINE = INNODB,
@@ -391,13 +405,14 @@ COMMENT = ' 系统任务';
CREATE TABLE sys_config (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
config_key varchar(255) NOT NULL DEFAULT '' COMMENT '配置项关键字',
value text DEFAULT NULL COMMENT '配置值json',
status tinyint(4) NOT NULL DEFAULT 1 COMMENT '是否启用 1启用 0不启用',
create_time int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
update_time int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
+ addon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '所属插件',
PRIMARY KEY (id)
)
ENGINE = INNODB,
@@ -461,7 +476,7 @@ ALTER TABLE sys_attachment ADD INDEX site_id (site_id);
CREATE TABLE sys_area (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
pid int(11) NOT NULL DEFAULT 0 COMMENT '父级',
name varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
shortname varchar(30) NOT NULL DEFAULT '' COMMENT '简称',
@@ -4137,7 +4152,7 @@ INSERT INTO sys_area VALUES
CREATE TABLE sys_agreement (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
agreement_key varchar(255) NOT NULL DEFAULT '' COMMENT '协议关键字',
title varchar(255) NOT NULL DEFAULT '' COMMENT '协议标题',
@@ -4245,8 +4260,46 @@ ALTER TABLE pay_transfer ADD INDEX member_withdraw_site_id (site_id, main_id);
ALTER TABLE pay_transfer ADD INDEX member_withdraw_status (transfer_status);
+CREATE TABLE pay_refund (
+ id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
+ site_id INT(11) NOT NULL DEFAULT 1 COMMENT '站点id',
+ refund_no VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '退款单号',
+ out_trade_no VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '支付流水号',
+ type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '支付方式',
+ channel VARCHAR(50) NOT NULL DEFAULT '' COMMENT '支付渠道',
+ money DECIMAL(10, 2) NOT NULL COMMENT '支付金额',
+ reason VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '退款原因',
+ status VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '支付状态(0.待退款 1. 退款中中 2. 已退款 -1已关闭)',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ refund_time INT(11) NOT NULL DEFAULT 0 COMMENT '支付时间',
+ close_time INT(11) NOT NULL DEFAULT 0 COMMENT '关闭时间',
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '支付记录表';
+
+
+CREATE TABLE pay_channel (
+ id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
+ site_id INT(11) NOT NULL DEFAULT 1 COMMENT '站点id',
+ type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '支付类型',
+ channel VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '支付渠道',
+ config TEXT NOT NULL COMMENT '支付配置',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ update_time INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
+ status INT(11) NOT NULL DEFAULT 0 COMMENT '是否启用',
+ sort INT(11) NOT NULL DEFAULT 0 COMMENT '排序',
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '支付渠道配置表';
+
CREATE TABLE pay (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
main_id int(11) NOT NULL DEFAULT 0 COMMENT '支付会员id',
out_trade_no varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
@@ -4263,6 +4316,7 @@ CREATE TABLE pay (
type varchar(255) NOT NULL DEFAULT '' COMMENT '支付方式',
mch_id varchar(50) NOT NULL DEFAULT '' COMMENT '商户收款账号',
main_type varchar(255) NOT NULL DEFAULT '',
+ channel varchar(50) NOT NULL DEFAULT '' COMMENT '支付渠道',
PRIMARY KEY (id)
)
ENGINE = INNODB,
@@ -4294,20 +4348,41 @@ COMMENT = '订单操作记录表',
ROW_FORMAT = COMPACT;
+CREATE TABLE order_item_refund (
+ refund_id INT(11) NOT NULL AUTO_INCREMENT,
+ order_item_id INT(11) NOT NULL DEFAULT 0 COMMENT '订单id',
+ order_id INT(11) NOT NULL DEFAULT 0 COMMENT '订单id',
+ site_id INT(11) NOT NULL DEFAULT 1 COMMENT '站点id',
+ member_id INT(11) NOT NULL DEFAULT 0 COMMENT '会员id',
+ num DECIMAL(10, 3) NOT NULL DEFAULT 0.000 COMMENT '退货数量',
+ money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '总退款',
+ refund_no VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '退款单号',
+ status INT(11) NOT NULL DEFAULT 0 COMMENT '退款状态',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ audit_time INT(11) NOT NULL DEFAULT 0 COMMENT '审核时间',
+ transfer_time INT(11) NOT NULL DEFAULT 0 COMMENT '转账时间',
+ item_type VARCHAR(255) NOT NULL DEFAULT '' COMMENT '项目类型',
+ PRIMARY KEY (refund_id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '订单退款表';
+
CREATE TABLE order_item (
order_item_id int(11) NOT NULL AUTO_INCREMENT,
order_id int(11) NOT NULL DEFAULT 0 COMMENT '订单id',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
member_id int(11) NOT NULL DEFAULT 0 COMMENT '购买会员id',
item_id int(11) NOT NULL DEFAULT 0 COMMENT '项目id',
- item_type varchar(255) NOT NULL DEFAULT '0' COMMENT '项目类型',
+ item_type VARCHAR(255) NOT NULL DEFAULT '' COMMENT '项目类型',
item_name varchar(400) NOT NULL DEFAULT '' COMMENT '项目名称',
item_image varchar(2000) NOT NULL DEFAULT '' COMMENT '项目图片',
price decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '项目单价',
num decimal(10, 3) NOT NULL DEFAULT 0.000 COMMENT '购买数量',
item_money decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '项目总价',
is_refund int(11) NOT NULL DEFAULT 0 COMMENT '是否退款',
- refund_id int(11) NOT NULL DEFAULT 0 COMMENT '退款id',
+ refund_no VARCHAR(255) NOT NULL DEFAULT '' COMMENT '退款编号',
refund_status int(11) NOT NULL DEFAULT 0 COMMENT '退款状态',
create_time int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (order_item_id)
@@ -4351,53 +4426,8 @@ COMMENT = '订单表',
ROW_FORMAT = COMPACT;
-CREATE TABLE member_withdraw (
- id int(11) NOT NULL AUTO_INCREMENT,
- site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
- withdraw_no varchar(50) NOT NULL DEFAULT '' COMMENT '提现交易号',
- member_id int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
- transfer_type varchar(20) NOT NULL DEFAULT '0' COMMENT '转账提现类型',
- transfer_realname varchar(50) NOT NULL DEFAULT '' COMMENT '联系人名称',
- transfer_mobile varchar(11) NOT NULL DEFAULT '' COMMENT '手机号',
- transfer_bank varchar(255) NOT NULL DEFAULT '' COMMENT '银行名称',
- transfer_account varchar(255) NOT NULL DEFAULT '' COMMENT '收款账号',
- transfer_voucher varchar(255) NOT NULL DEFAULT '' COMMENT '凭证',
- transfer_remark varchar(255) NOT NULL DEFAULT '' COMMENT '凭证说明',
- transfer_fail_reason varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因',
- transfer_status varchar(20) NOT NULL DEFAULT '' COMMENT '转账状态',
- transfer_time int(11) NOT NULL DEFAULT 0 COMMENT '转账时间',
- apply_money decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现申请金额',
- rate decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现手续费比率',
- service_money decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现手续费',
- money decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现到账金额',
- audit_time int(11) NOT NULL DEFAULT 0 COMMENT '审核时间',
- status int(11) NOT NULL DEFAULT 0 COMMENT '状态0待审核1.待转账2已转账 -1拒绝',
- remark varchar(100) NOT NULL DEFAULT '' COMMENT '备注',
- create_time int(11) NOT NULL DEFAULT 0 COMMENT '申请时间',
- refuse_reason varchar(100) NOT NULL DEFAULT '' COMMENT '拒绝理由',
- update_time int(11) NOT NULL DEFAULT 0,
- transfer_no varchar(50) NOT NULL DEFAULT '' COMMENT '转账单号',
- cancel_time int(11) NOT NULL DEFAULT 0 COMMENT '取消时间',
- PRIMARY KEY (id)
-)
-ENGINE = INNODB,
-CHARACTER SET utf8mb4,
-COLLATE utf8mb4_general_ci,
-COMMENT = '会员提现表';
-
-ALTER TABLE member_withdraw ADD INDEX member_withdraw_apply_time (create_time);
-
-ALTER TABLE member_withdraw ADD INDEX member_withdraw_audit_time (audit_time);
-
-ALTER TABLE member_withdraw ADD INDEX member_withdraw_site_id (site_id, member_id);
-
-ALTER TABLE member_withdraw ADD INDEX member_withdraw_status (status);
-
-ALTER TABLE member_withdraw ADD INDEX member_withdraw_withdraw_no (withdraw_no);
-
-
CREATE TABLE member_level (
- level_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '会员等级',
+ level_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '会员等级',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
level_name varchar(50) NOT NULL DEFAULT '' COMMENT '等级名称',
growth decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '所需成长值',
@@ -4419,7 +4449,7 @@ ALTER TABLE member_level ADD INDEX status (status);
CREATE TABLE member_label (
- label_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签id',
+ label_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签id',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
label_name varchar(50) NOT NULL DEFAULT '' COMMENT '标签名称',
memo varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
@@ -4440,8 +4470,70 @@ ALTER TABLE member_label ADD INDEX site_id (site_id);
ALTER TABLE member_label ADD INDEX sort (sort);
+CREATE TABLE member_cash_out_account (
+ account_id INT(11) NOT NULL AUTO_INCREMENT,
+ site_id INT(11) NOT NULL COMMENT '站点id',
+ member_id INT(11) NOT NULL COMMENT '会员id',
+ account_type VARCHAR(255) NOT NULL DEFAULT '' COMMENT '账户类型',
+ bank_name VARCHAR(255) NOT NULL DEFAULT '' COMMENT '银行名称',
+ realname VARCHAR(255) NOT NULL DEFAULT '' COMMENT '真实名称',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ update_time INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
+ account_no VARCHAR(255) NOT NULL DEFAULT '' COMMENT '提现账户',
+ PRIMARY KEY (account_id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '会员提现账户';
+
+
+CREATE TABLE member_cash_out (
+ id INT(11) NOT NULL AUTO_INCREMENT,
+ site_id INT(11) NOT NULL DEFAULT 1 COMMENT '站点id',
+ cash_out_no VARCHAR(50) NOT NULL DEFAULT '' COMMENT '提现交易号',
+ member_id INT(11) NOT NULL DEFAULT 0 COMMENT '会员id',
+ account_type VARCHAR(255) NOT NULL DEFAULT 'money' COMMENT '提现账户类型',
+ transfer_type VARCHAR(20) NOT NULL DEFAULT '0' COMMENT '转账提现类型',
+ transfer_realname VARCHAR(50) NOT NULL DEFAULT '' COMMENT '联系人名称',
+ transfer_mobile VARCHAR(11) NOT NULL DEFAULT '' COMMENT '手机号',
+ transfer_bank VARCHAR(255) NOT NULL DEFAULT '' COMMENT '银行名称',
+ transfer_account VARCHAR(255) NOT NULL DEFAULT '' COMMENT '收款账号',
+ transfer_fail_reason VARCHAR(255) NOT NULL DEFAULT '' COMMENT '失败原因',
+ transfer_status VARCHAR(20) NOT NULL DEFAULT '' COMMENT '转账状态',
+ transfer_time INT(11) NOT NULL DEFAULT 0 COMMENT '转账时间',
+ apply_money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现申请金额',
+ rate DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现手续费比率',
+ service_money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现手续费',
+ money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现到账金额',
+ audit_time INT(11) NOT NULL DEFAULT 0 COMMENT '审核时间',
+ status INT(11) NOT NULL DEFAULT 0 COMMENT '状态1待审核2.待转账3已转账 -1拒绝 -2 已取消',
+ remark VARCHAR(100) NOT NULL DEFAULT '' COMMENT '备注',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '申请时间',
+ refuse_reason VARCHAR(100) NOT NULL DEFAULT '' COMMENT '拒绝理由',
+ update_time INT(11) NOT NULL DEFAULT 0,
+ transfer_no VARCHAR(50) NOT NULL DEFAULT '' COMMENT '转账单号',
+ cancel_time INT(11) NOT NULL DEFAULT 0 COMMENT '取消时间',
+ final_transfer_type VARCHAR(255) NOT NULL DEFAULT '' COMMENT '转账方式',
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '会员提现表';
+
+ALTER TABLE member_cash_out ADD INDEX member_withdraw_apply_time(create_time);
+
+ALTER TABLE member_cash_out ADD INDEX member_withdraw_audit_time(audit_time);
+
+ALTER TABLE member_cash_out ADD INDEX member_withdraw_site_id(site_id, member_id);
+
+ALTER TABLE member_cash_out ADD INDEX member_withdraw_status(status);
+
+ALTER TABLE member_cash_out ADD INDEX member_withdraw_withdraw_no(cash_out_no);
+
CREATE TABLE member_address (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
member_id int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
name varchar(255) NOT NULL DEFAULT '' COMMENT '用户姓名',
@@ -4469,7 +4561,7 @@ ALTER TABLE member_address ADD INDEX IDX_member_address (member_id, site_id);
CREATE TABLE member_account_log (
- id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
member_id int(11) NOT NULL DEFAULT 0 COMMENT '用户id',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
account_type varchar(255) NOT NULL DEFAULT 'point' COMMENT '账户类型',
@@ -4496,7 +4588,7 @@ ALTER TABLE member_account_log ADD INDEX member_id (member_id);
CREATE TABLE member (
- member_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
+ member_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
pid int(11) NOT NULL DEFAULT 0 COMMENT '推广会员id',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点id',
username varchar(255) DEFAULT '' COMMENT '会员用户名',
@@ -4528,11 +4620,14 @@ CREATE TABLE member (
point_get int(11) NOT NULL DEFAULT 0 COMMENT '累计获取积分',
balance decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '可用余额',
balance_get decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '累计获取余额',
- money decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '可用零钱',
- money_get decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '累计获取零钱',
- money_withdrawing decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现中零钱',
+ money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '可用余额(可提现)',
+ money_get DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '累计获取余额(可提现)',
+ money_cash_outing DECIMAL(10, 2) NOT NULL COMMENT '提现中余额(可提现)',
growth int(11) NOT NULL DEFAULT 0 COMMENT '成长值',
growth_get int(11) NOT NULL DEFAULT 0 COMMENT '累计获得成长值',
+ commission DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '当前佣金',
+ commission_get DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '佣金获取',
+ commission_cash_outing DECIMAL(10, 2) NOT NULL COMMENT '提现中佣金',
is_member tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否是会员',
member_time int(11) NOT NULL DEFAULT 0 COMMENT '成为会员时间',
is_del tinyint(4) NOT NULL DEFAULT 0 COMMENT '0正常 1已删除',
@@ -4542,7 +4637,7 @@ CREATE TABLE member (
address varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
location varchar(255) NOT NULL DEFAULT '' COMMENT '定位地址',
delete_time int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
- update_time int(11) NOT NULL DEFAULT 0,
+ update_time INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
PRIMARY KEY (member_id)
)
ENGINE = INNODB,
@@ -4566,6 +4661,36 @@ ALTER TABLE member ADD INDEX wx_openid (wx_openid (191));
ALTER TABLE member ADD INDEX wx_unionid (wx_unionid (191));
+CREATE TABLE jobs_failed (
+ id INT(11) NOT NULL AUTO_INCREMENT,
+ `connection` TEXT NOT NULL,
+ queue TEXT NOT NULL,
+ payload LONGTEXT NOT NULL,
+ exception LONGTEXT NOT NULL,
+ fail_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '消息队列任务失败记录表';
+
+CREATE TABLE jobs (
+ id INT(11) NOT NULL AUTO_INCREMENT,
+ queue VARCHAR(255) NOT NULL,
+ payload LONGTEXT NOT NULL,
+ attempts TINYINT(4) UNSIGNED NOT NULL,
+ reserved TINYINT(4) UNSIGNED NOT NULL,
+ reserve_time INT(11) UNSIGNED DEFAULT NULL,
+ available_time INT(11) UNSIGNED NOT NULL,
+ create_time INT(11) UNSIGNED NOT NULL,
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '消息队列任务表';
+
CREATE TABLE generate_table (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
table_name varchar(255) NOT NULL DEFAULT '' COMMENT '表名',
@@ -4588,13 +4713,13 @@ CREATE TABLE generate_column (
column_name varchar(100) NOT NULL DEFAULT '' COMMENT '字段名称',
column_comment varchar(300) NOT NULL DEFAULT '' COMMENT '字段描述',
column_type varchar(100) NOT NULL DEFAULT '' COMMENT '字段类型',
- is_required tinyint(4) DEFAULT 0 COMMENT '是否必填 0-非必填 1-必填',
- is_pk tinyint(4) DEFAULT 0 COMMENT '是否为主键 0-不是 1-是',
- is_insert tinyint(4) DEFAULT 0 COMMENT '是否为插入字段 0-不是 1-是',
- is_update tinyint(4) DEFAULT 0 COMMENT '是否为更新字段 0-不是 1-是',
- is_lists tinyint(4) DEFAULT 1 COMMENT '是否为列表字段 0-不是 1-是',
- is_query tinyint(4) DEFAULT 1 COMMENT '是否为查询字段 0-不是 1-是',
- is_search tinyint(4) DEFAULT 1 COMMENT '是否搜索字段',
+ is_required tinyint(1) DEFAULT 0 COMMENT '是否必填 0-非必填 1-必填',
+ is_pk tinyint(1) DEFAULT 0 COMMENT '是否为主键 0-不是 1-是',
+ is_insert tinyint(1) DEFAULT 0 COMMENT '是否为插入字段 0-不是 1-是',
+ is_update tinyint(1) DEFAULT 0 COMMENT '是否为更新字段 0-不是 1-是',
+ is_lists tinyint(1) DEFAULT 1 COMMENT '是否为列表字段 0-不是 1-是',
+ is_query tinyint(1) DEFAULT 1 COMMENT '是否为查询字段 0-不是 1-是',
+ is_search tinyint(1) DEFAULT 1 COMMENT '是否搜索字段',
query_type varchar(100) DEFAULT '=' COMMENT '查询类型',
view_type varchar(100) DEFAULT 'input' COMMENT '显示类型',
dict_type varchar(255) DEFAULT '' COMMENT '字典类型',
@@ -4620,8 +4745,8 @@ CREATE TABLE diy_route (
PRIMARY KEY (id)
)
ENGINE = INNODB,
-CHARACTER SET utf8,
-COLLATE utf8_general_ci,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
COMMENT = '自定义路由';
@@ -4671,7 +4796,7 @@ ALTER TABLE article_category ADD INDEX sort (sort);
CREATE TABLE article (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '文章id',
- category_id int(11) NOT NULL DEFAULT 0 COMMENT '文章分类',
+ category_id int(11) NOT NULL COMMENT '文章分类',
site_id int(11) NOT NULL DEFAULT 1 COMMENT '站点ID',
title varchar(255) NOT NULL COMMENT '文章标题',
intro varchar(255) NOT NULL DEFAULT '' COMMENT '简介',
@@ -4702,6 +4827,42 @@ ALTER TABLE article ADD INDEX IDX_article_site_id (site_id);
ALTER TABLE article ADD INDEX IDX_ns_article_sort (sort);
+
+CREATE TABLE addon_log (
+ id INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ action VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '操作类型 install 安装 uninstall 卸载 update 更新',
+ `key` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '插件标识',
+ from_version VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '升级前的版本号',
+ to_version VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '升级后的版本号',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '插件日志表';
+
+CREATE TABLE addon (
+ id INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ title VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '插件名称',
+ icon VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '插件图标',
+ `key` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '插件标识',
+ `desc` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件描述',
+ status TINYINT(4) NOT NULL DEFAULT 1 COMMENT '状态',
+ author VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '作者',
+ version VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '版本号',
+ create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
+ install_time INT(11) NOT NULL DEFAULT 0 COMMENT '安装时间',
+ update_time INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci,
+COMMENT = '插件表';
+
+ALTER TABLE addon ADD UNIQUE INDEX UK_title(title);
+
INSERT INTO sys_user_role VALUES
(1, 1, 1, '', 0, 1);
diff --git a/niucloud/app/install/view/index/step-1.html b/niucloud/app/install/view/index/step-1.html
index fc675ff45..363dc466e 100644
--- a/niucloud/app/install/view/index/step-1.html
+++ b/niucloud/app/install/view/index/step-1.html
@@ -36,17 +36,18 @@
5、应用金额以最终结算价格为准,已售出的应用不做任何差价补偿。
6、如果用户利用特殊手段以低价或者免费获得付费应用,niucloud官方有权对应用进行回收。
7、niucloud-admin付费应用一旦完成交易下载源码,不得以任何形式和理由进行退款,请在购买前仔细阅读本协议。
- 8、基于niucloud-admin框架进行应用的开发,必须保留框架版权信息,并且要进行声明。
+ 8、基于niucloud-admin框架进行应用的开发,必须保留框架版权信息。
四、知识产权声明
- - 1、niucloud-admin框架应用源代码所有权和著作权归niucloud官方所有,基于niucloud-admin框架开发的应用,所有权和著作权归应用开发商所有。但必须声明是基于niucloud-admin框架开发。否则官方有权要求做出赔偿并下架应用。
+ - 1、niucloud-admin框架应用源代码所有权和著作权归niucloud官方所有,基于niucloud-admin框架开发的应用,所有权和著作权归应用开发商所有。
- 2、niucloud-admin框架所依托的代码、文字、图片等著作权、专利权及其他知识产权均归niucloud官方所有,除另外有特别声明。
- 五、有限担保和免责声明
+
+ 五、有限担保和免责声明
本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。
用户出于自愿而使用本软件,您必须了解使用本软件的风险,在尚未购买产品技术服务之前,我们不承诺对免费用户提供任何形式的技术支持、使用担保,也不承担任何因使用本软件而产生问题的相关责任。
diff --git a/niucloud/app/job/BaseJob.php b/niucloud/app/job/BaseJob.php
deleted file mode 100644
index fb658bfc2..000000000
--- a/niucloud/app/job/BaseJob.php
+++ /dev/null
@@ -1,82 +0,0 @@
-checkJob($data)){
- $job->delete();
- return;
- }
- //执行业务处理
- if($this->doJob($data)){
- $job->delete();//任务执行成功后删除
-// print('dismiss job has been down and deleted');
- }else{
- //检查任务重试次数
- if($job->attempts() > self::MAX_TIMES){
-// print('dismiss job has been retried more that 3 times');
- $job->delete();
- }
- }
- }
- /**
- * 消息在到达消费者时可能已经不需要执行了
- * @param array|mixed $data 发布任务时自定义的数据
- * @return boolean 任务执行的结果
- */
- protected function checkJob($data)
- {
- return true;
- }
- /**
- * 根据消息中的数据进行实际的业务处理
- */
- protected function doJob($data)
- {
- // 实际业务流程处理
- return true;
- }
-
- /**
- * 失败后的解决方案或提示
- * @param $data
- * @return void
- */
- public function failed($data){
-
- //todo 可以在这儿给系统管理员发送邮件短信...来提醒
- // ...任务达到最大重试次数后,失败了
-
- print('Warning: Job failed after max retries. job data is :'.var_export($data,true)."\n");
- }
-
-}
diff --git a/niucloud/app/job/JobTrait.php b/niucloud/app/job/JobTrait.php
deleted file mode 100644
index 8394bd9a7..000000000
--- a/niucloud/app/job/JobTrait.php
+++ /dev/null
@@ -1,73 +0,0 @@
-checkJob($data)){
- $job->delete();
- return;
- }
- //执行业务处理
- if($this->doJob($data)){
- $job->delete();//任务执行成功后删除
-// print('dismiss job has been down and deleted');
- }else{
- //检查任务重试次数
- if($job->attempts() > self::MAX_TIMES){
-// print('dismiss job has been retried more that 3 times');
- $job->delete();
- }
- }
- }
- /**
- * 消息在到达消费者时可能已经不需要执行了
- * @param array|mixed $data 发布任务时自定义的数据
- * @return boolean 任务执行的结果
- */
- protected function checkJob($data)
- {
- return true;
- }
-
- /**
- * 失败后的解决方案或提示
- * @param $data
- * @return void
- */
- public function failed($data){
-
- //todo 可以在这儿给系统管理员发送邮件短信...来提醒
- // ...任务达到最大重试次数后,失败了
-
- print('Warning: Job failed after max retries. job data is :'.var_export($data,true)."\n");
- }
-
-}
diff --git a/niucloud/app/job/message/Message.php b/niucloud/app/job/notice/Notice.php
similarity index 50%
rename from niucloud/app/job/message/Message.php
rename to niucloud/app/job/notice/Notice.php
index 99b6bafd7..6ad6f7962 100644
--- a/niucloud/app/job/message/Message.php
+++ b/niucloud/app/job/notice/Notice.php
@@ -9,19 +9,17 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\job\message;
+namespace app\job\notice;
-use app\job\BaseJob;
use app\model\system\Cron;
-use app\service\core\message\CoreMessageEventService;
-use app\service\core\cron\CoreCronService;
-use extend\exception\MessageException;
-use think\queue\Job;
+use app\service\core\notice\CoreNoticeEventService;
+use core\base\BaseJob;
+use core\exception\NoticeException;
/**
- * 队列异步调用定时任务
+ * 消息发送任务
*/
-class Message extends BaseJob
+class Notice extends BaseJob
{
@@ -30,19 +28,13 @@ class Message extends BaseJob
* @param $data
* @return true
*/
- protected function doJob($data)
+ protected function doJob($site_id, $key, $data, $template)
{
- try{
- (new CoreMessageEventService(false))->event($data);
- }catch(MessageException $e){
- print($e->getMessage());
- return false;
- }
- // 实际业务流程处理
+ //通过业务获取模板变量属于以及发送对象
+ $result = event('noticeData', ['site_id' => $site_id, 'key' => $key, 'data' => $data, 'template' => $template]);
+ $notice_data = array_values(array_filter($result))[0] ?? [];
+ if(empty($notice_data)) throw new NoticeException();
+ event('notice', ['site_id' => $site_id, 'key' => $key, 'to' => $notice_data['to'], 'vars' => $notice_data['vars'], 'template' => $template]);
return true;
}
-
-
-
-
}
diff --git a/niucloud/app/job/pay/PayReturnTo.php b/niucloud/app/job/pay/PayReturnTo.php
index 9b4be4464..ba4f50099 100644
--- a/niucloud/app/job/pay/PayReturnTo.php
+++ b/niucloud/app/job/pay/PayReturnTo.php
@@ -11,14 +11,10 @@
namespace app\job\pay;
-use app\job\BaseJob;
-use app\job\JobTrait;
use app\model\system\Cron;
-use app\service\core\cron\CoreCronService;
use app\service\core\pay\CorePayService;
-use extend\exception\PayException;
+use core\base\BaseJob;
use think\facade\Log;
-use think\queue\Job;
/**
* 队列异步调用支付定时未支付恢复
@@ -26,7 +22,6 @@ use think\queue\Job;
class PayReturnTo extends BaseJob
{
-// use JobTrait;
/**
* 消费
* @param $data
@@ -34,15 +29,9 @@ class PayReturnTo extends BaseJob
*/
protected function doJob($data)
{
- try{
- Log::write('pay_log_'.json_encode($data));
- $res = (new CorePayService())->returnTo($data['site_id'], $data['out_trade_no']);
-// return $res;
- }catch(\Throwable $e){
- print($e->getMessage());
-// return false;
- }
- // 实际业务流程处理
+
+ Log::write('pay_log_'.json_encode($data));
+ $res = (new CorePayService())->returnTo($data['site_id'], $data['out_trade_no']);
return true;
}
diff --git a/niucloud/app/job/sys/Cronexecute.php b/niucloud/app/job/sys/Cronexecute.php
index 8809b7459..9a08738c7 100644
--- a/niucloud/app/job/sys/Cronexecute.php
+++ b/niucloud/app/job/sys/Cronexecute.php
@@ -11,9 +11,9 @@
namespace app\job\sys;
-use app\job\BaseJob;
use app\model\system\Cron;
use app\service\core\cron\CoreCronService;
+use core\base\BaseJob;
use think\queue\Job;
/**
diff --git a/niucloud/app/lang/en.php b/niucloud/app/lang/en.php
index eb9591028..b389a5004 100644
--- a/niucloud/app/lang/en.php
+++ b/niucloud/app/lang/en.php
@@ -18,14 +18,4 @@
* 扩展开发相关plugin
*
*/
-use extend\util\ConfigUtil;
-
-/**
- * 初始化语言
- */
-$lang_data = [
-
-];
-$config_util = new ConfigUtil(root_path().str_replace('/', DIRECTORY_SEPARATOR, "app/lang/en"), $lang_data, true);
-$lang = $config_util->loadConfig();
-return $lang;
+return (new \core\addon\AddonLoader("Lang"))->load(["lang_type" =>"en"]);
diff --git a/niucloud/app/lang/en/system/api.php b/niucloud/app/lang/en/system/api.php
index 37eaf38f4..c05b08bb9 100644
--- a/niucloud/app/lang/en/system/api.php
+++ b/niucloud/app/lang/en/system/api.php
@@ -11,116 +11,115 @@
return [
//系统常用
- 100000 => 'success',
- 100001 => 'save success',
- 100002 => 'update success',
- 100003 => 'delete success',
- 100004 => 'refresh success',
- 100005 => 'fail',
- 100006 => 'save fail',
- 100007 => 'update fail',
- 100008 => 'delete fail',
- 100009 => 'refresh fail',
- 100010 => 'add fail',
- 100011 => 'add success',
- 100012 => 'upload fail',
- 100013 => 'file delete fail',
- 100014 => 'data is not exit',
- 100015 => 'download fail',
- 100016 => 'set success',
- 100017 => 'agreement type is not exit',
- 100018 => 'cloumn is not exit',
- 100019 => 'refresh success',
- 100020 => 'captcha fail',
+ 'SUCCESS' => 'success',
+ 'EDIT_SUCCESS' => 'update success',
+ 'DELETE_SUCCESS' => 'delete success',
+ 'MODIFY_SUCCESS' => 'modify success',
+ 'FAIL' => 'fail',
+ 'SAVE_FAIL' => 'save fail',
+ 'EDIT_FAIL' => 'update fail',
+ 'DELETE_FAIL' => 'delete fail',
+ 'MODIFY_FAIL' => 'refresh fail',
+ 'ADD_FAIL' => 'add fail',
+ 'ADD_SUCCESS' => 'add success',
+ 'UPLOAD_FAIL' => 'upload fail',
+ 'ATTACHMENT_DELETE_FAIL' => 'file delete fail',
+ 'DATA_NOT_EXIST' => 'data is not exit',
+ 'DOWNLOAD_FAIL' => 'download fail',
+ 'SET_SUCCESS' => 'set success',
+ 'AGREEMENT_TYPE_NOT_EXIST' => 'agreement type is not exit',
+ 'FIELD_NOT_FOUND' => 'cloumn is not exit',
+ 'REFRESH_SUCCESS' => 'refresh success',
+ 'CAPTCHA_ERROR' => 'captcha fail',
//登录注册重置账号....
- 101000 => 'login success',
- 101001 => 'place login',
- 101002 => 'login expire',
- 101003 => 'login expire',
- 101004 => 'account is not auth',
- 101005 => 'account or password error',
- 102006 => 'you do not have auth',
- 102007 => 'site is not exit',
- 102008 => 'logout',
- 102009 => 'password error',
- 102010 => 'mobile login is not open',
+ 'LOGIN_SUCCESS' => 'login success',
+ 'MUST_LOGIN' => 'place login',
+ 'LOGIN_EXPIRE' => 'login expire',
+ 'LOGIN_STATE_ERROR' => 'login expire',
+ 'USER_LOCK' => 'account is not auth',
+ 'USER_ERROR' => 'account or password error',
+ 'NO_SITE_PERMISSION' => 'you do not have auth',
+ 'SITE_NOT_EXIST' => 'site is not exit',
+ 'LOGOUT' => 'logout',
+ 'OLD_PASSWORD_ERROR' => 'password error',
+ 'MOBILE_LOGIN_UNOPENED' => 'mobile login is not open',
//用户组权限
- 102000 => 'you do not have auth',
+ 'NO_PERMISSION' => 'you do not have auth',
//菜单管理
- 200001 => '菜单不存在',
- 200002 => '存在子级菜单的目录或菜单不允许删除',
+ 'MENU_NOT_EXIST' => '菜单不存在',
+ 'MENU_NOT_ALLOW_DELETE' => '存在子级菜单的目录或菜单不允许删除',
//用户管理
- 201001 => '用户不存在',
- 201002 => '用户不存在关联权限',
- 201003 => '超级管理员不允许改动权限',
- 201004 => '用户名重复',
+ 'USER_NOT_EXIST' => '用户不存在',
+ 'NO_SITE_USER_ROLE' => '用户不存在关联权限',
+ 'ADMIN_NOT_ALLOW_EDIT_ROLE' => '超级管理员不允许改动权限',
+ 'USERNAME_REPEAT' => '用户名重复',
//角色管理
- 202001 => '角色不存在',
- 202002 => '存在管理员使用当前角色,不允许删除',
+ 'USER_ROLE_NOT_EXIST' => '角色不存在',
+ 'USER_ROLE_NOT_ALLOW_DELETE' => '存在管理员使用当前角色,不允许删除',
//素材管理
- 203001 => '附件组不存在',
- 203002 => '当前分组,不允许删除',
- 203003 => '附件不存在',
- 203004 => '附件组中存在图片不允许删除',
- 203005 => '云存储类型不存在',
- 203006 => '获取不到网址指向的文件',
- 203007 => '请选择要删除的图片',
- 203008 => '不是有效的证书类型',
+ 'ATTACHMENT_GROUP_NOT_EXIST' => '附件组不存在',
+ 'ATTACHMENT_GROUP_NOT_ALLOW_DELETE' => '当前分组,不允许删除',
+ 'ATTACHMENT_NOE_EXIST' => '附件不存在',
+ 'ATTACHMENT_GROUP_HAS_IMAGE' => '附件组中存在图片不允许删除',
+ 'OSS_TYPE_NOT_EXIST' => '云存储类型不存在',
+ 'URL_FILE_NOT_EXIST' => '获取不到网址指向的文件',
+ 'PLEACE_SELECT_IMAGE' => '请选择要删除的图片',
+ 'CERT_TYPE_ERROR' => '不是有效的证书类型',
//消息管理
- 204001 => '消息类型不存在',
- 204002 => '短信类型不存在',
- 204003 => '短信驱动不存在',
- 204004 => '没有启用的短信',
- 204005 => '短信没有启用',
- 204006 => '微信模板消息没有启用',
- 204007 => '微信小程序订阅没有启用',
- 204008 => '没有启用的短信方式',
- 204009 => '消息模板不存在',
- 204010 => '微信消息模板缺少模板编号',
+ 'NOTICE_TYPE_NOT_EXIST' => '消息类型不存在',
+ 'SMS_TYPE_NOT_EXIST' => '短信类型不存在',
+ 'SMS_DRIVER_NOT_EXIST' => '短信驱动不存在',
+ 'NO_SMS_DRIVER_OPEN' => '没有启用的短信',
+ 'SMS_DRIVER_NOT_OPEN' => '短信没有启用',
+ 'WECHAT_TEMPLATE_NOTICE_NOT_OPEN' => '微信模板消息没有启用',
+ 'WEAPP_TEMPLATE_NOTICE_NOT_OPEN' => '微信小程序订阅没有启用',
+ 'SMS_TYPE_NOT_OPEN' => '没有启用的短信方式',
+ 'NOTICE_TEMPLATE_NOT_EXIST' => '消息模板不存在',
+ 'WECHAT_TEMPLATE_NEED_NO' => '微信消息模板缺少模板编号',
//会员相关
- 301001 => '手机号已存在',
- 301002 => '账户余额不足',
- 301003 => '账号或密码错误',
- 301004 => '账号被锁定',
- 301005 => '账号不存在',
- 301006 => '账号退出',
- 301007 => '账户类型不存在',
- 301008 => '账号已存在',
- 301009 => '无效的注册渠道',
- 301010 => '未开始账号登录注册',
- 301011 => '未开启第三方登录注册',
- 301012 => '手机号必须填写',
- 301013 => '手机验证码有误',
+ 'MOBILE_IS_EXIST' => '手机号已存在',
+ 'ACCOUNT_INSUFFICIENT' => '账户余额不足',
+ 'ACCOUNT_OR_PASSWORD_ERROR' => '账号或密码错误',
+ 'MEMBER_LOCK' => '账号被锁定',
+ 'MEMBER_NOT_EXIST' => '账号不存在',
+ 'MEMBER_LOGOUT' => '账号退出',
+ 'MEMBER_TYPE_NOT_EXIST' => '账户类型不存在',
+ 'MEMBER_IS_EXIST' => '账号已存在',
+ 'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道',
+ 'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开始账号登录注册',
+ 'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册',
+ 'MOBILE_NEEDED' => '手机号必须填写',
+ 'MOBILE_CAPTCHA_ERROR' => '手机验证码有误',
//渠道相关 占用 4******
//微信
- 400000 => '微信公众号未配置完善',
- 400001 => '关键词回复不存在',
- 400002 => '微信授信信息不存在',
+ 'WECHAT_NOT_EXIST' => '微信公众号未配置完善',
+ 'KEYWORDS_NOT_EXIST' => '关键词回复不存在',
+ 'WECHAT_EMPOWER_NOT_EXIST' => '微信授信信息不存在',
//小程序
- 410000 => '微信小程序未配置完善',
+ 'WEAPP_NOT_EXIST' => '微信小程序未配置完善',
//支付相关
500000 => '你选择的支付方式未启用',
//站点相关
- 600001 => '站点分组已存在站点,请调整站点后重试',
+ 'SITE_GROUP_IS_EXIST' => '站点分组已存在站点,请调整站点后重试',
];
diff --git a/niucloud/app/lang/en/system/enum.php b/niucloud/app/lang/en/system/enum.php
index b5e7c8a5c..fe6025413 100644
--- a/niucloud/app/lang/en/system/enum.php
+++ b/niucloud/app/lang/en/system/enum.php
@@ -43,7 +43,7 @@ return [
'status_experience' => 'experience',
'status_expire' => 'expire'
],
- 'enum_message' => [
+ 'enum_notice' => [
'type_sms' => 'sms',
'type_wechat' => 'wechat',
'type_weapp' => 'weapp',
diff --git a/niucloud/app/lang/zh-cn.php b/niucloud/app/lang/zh-cn.php
index 75999adc0..bcf182573 100644
--- a/niucloud/app/lang/zh-cn.php
+++ b/niucloud/app/lang/zh-cn.php
@@ -11,21 +11,11 @@
/**
* 语言包说明:
* 系统相关system:
- * 返回值语言文件: exception.php
+ * 返回值语言文件: api.php
* 枚举相关文件:enum.php
* 验证语言文件:validate.php
*
- * 扩展开发相关plugin
+ * 扩展开发相关addon
*
*/
-
-use extend\util\ConfigUtil;
-
-/**
- * 初始化语言
- */
-$lang_data = [
-];
-$config_util = new ConfigUtil(root_path().str_replace('/', DIRECTORY_SEPARATOR, "app/lang/zh-cn"), $lang_data, true);
-$lang = $config_util->loadConfig();
-return $lang;
+return (new \core\addon\AddonLoader("Lang"))->load(["lang_type" =>"zh-cn"]);
diff --git a/niucloud/app/lang/zh-cn/api.php b/niucloud/app/lang/zh-cn/api.php
new file mode 100644
index 000000000..9240674d7
--- /dev/null
+++ b/niucloud/app/lang/zh-cn/api.php
@@ -0,0 +1,191 @@
+ '操作成功',
+ 'EDIT_SUCCESS' => '编辑成功',
+ 'DELETE_SUCCESS' => '删除成功',
+ 'MODIFY_SUCCESS' => '更新成功',
+ 'FAIL' => '操作失败',
+ 'SAVE_FAIL' => '保存失败',
+ 'EDIT_FAIL' => '修改失败',
+ 'DELETE_FAIL' => '删除失败',
+ 'MODIFY_FAIL' => '更新失败',
+ 'ADD_FAIL' => '添加失败',
+ 'ADD_SUCCESS' => '添加成功',
+ 'UPLOAD_FAIL' => '上传失败',
+ 'ATTACHMENT_DELETE_FAIL' => '附件删除失败',
+ 'DATA_NOT_EXIST' => '数据不存在',
+ 'DOWNLOAD_FAIL' => '下载失败',
+ 'SET_SUCCESS' => '设置成功',
+ 'AGREEMENT_TYPE_NOT_EXIST' => '协议类型不存在',
+ 'FIELD_NOT_FOUND' => '找不到要修改的字段',
+ 'REFRESH_SUCCESS' => '刷新成功',
+ 'CAPTCHA_ERROR' => '验证码有误',
+ 'ADDON_INSTALL_SUCCESS' => '插件安装成功',
+ 'ADDON_UNINSTALL_SUCCESS' => '插件卸载成功',
+ 'DATA_GET_FAIL' => '数据获取失败',
+ 'SERVER_CROSS_REQUEST_FAIL' => '服务器跨域请求异常',
+
+
+ //登录注册重置账号....
+
+ 'LOGIN_SUCCESS' => '登录成功',
+ 'MUST_LOGIN' => '请登录',
+ 'LOGIN_EXPIRE' => '登录过期,请重新登录',
+ 'LOGIN_STATE_ERROR' => '登录状态有误,请重新登录',
+ 'USER_LOCK' => '账号被限制',
+ 'USER_ERROR' => '账号或密码错误',
+ 'NO_SITE_PERMISSION' => '您没有当前站点的访问权限',
+ 'SITE_NOT_EXIST' => '站点不存在',
+ 'LOGOUT' => '登陆退出',
+ 'OLD_PASSWORD_ERROR' => '原始密码不正确',
+ 'MOBILE_LOGIN_UNOPENED' => '手机号登录注册未开启',
+ 'SITE_USER_CAN_NOT_LOGIN_IN_ADMIN' => '站点用户无法在平台端进行登录',
+ 'ADMIN_USER_CAN_NOT_LOGIN_IN_SITE' => '平台用户无法在站点端进行登录',
+ 'APP_TYPE_NOT_EXIST' => '无效的登录端口',
+
+ //用户组权限
+
+ 'NO_PERMISSION' => '您没有访问权限',
+
+ //插件安装相关
+ 'REPEAT_INSTALL' => '当前插件已安装,不能重复安装',
+ 'NOT_UNINSTALL' => '当前插件未安装,不能进行卸载操作',
+
+ //菜单管理
+ 'MENU_NOT_EXIST' => '菜单不存在',
+ 'MENU_NOT_ALLOW_DELETE' => '存在子级菜单的目录或菜单不允许删除',
+
+ //用户管理
+ 'USER_NOT_EXIST' => '用户不存在',
+ 'NO_SITE_USER_ROLE' => '用户不存在关联权限',
+ 'ADMIN_NOT_ALLOW_EDIT_ROLE' => '超级管理员不允许改动权限',
+ 'USERNAME_REPEAT' => '用户名重复',
+
+
+ //角色管理
+ 'USER_ROLE_NOT_EXIST' => '角色不存在',
+ 'USER_ROLE_NOT_ALLOW_DELETE' => '存在管理员使用当前角色,不允许删除',
+
+ //素材管理
+ 'ATTACHMENT_GROUP_NOT_EXIST' => '附件组不存在',
+ 'ATTACHMENT_GROUP_NOT_ALLOW_DELETE' => '当前分组,不允许删除',
+ 'ATTACHMENT_NOE_EXIST' => '附件不存在',
+ 'ATTACHMENT_GROUP_HAS_IMAGE' => '附件组中存在图片不允许删除',
+ 'OSS_TYPE_NOT_EXIST' => '云存储类型不存在',
+ 'URL_FILE_NOT_EXIST' => '获取不到网址指向的文件',
+ 'PLEACE_SELECT_IMAGE' => '请选择要删除的图片',
+ 'CERT_TYPE_ERROR' => '不是有效的上传类型',
+ 'OSS_FILE_URL_NOT_EXIST' => '远程资源文件地址不能为空',
+ 'BASE_IMAGE_FILE_NOT_EXIST' => 'base图片资源不能为空',
+ 'UPLOAD_TYPE_NOT_SUPPORT' => '不支持的上传类型',
+
+
+ //消息管理
+ 'NOTICE_TYPE_NOT_EXIST' => '消息类型不存在',
+ 'SMS_TYPE_NOT_EXIST' => '短信类型不存在',
+ 'SMS_DRIVER_NOT_EXIST' => '短信驱动不存在',
+ 'NO_SMS_DRIVER_OPEN' => '没有启用的短信',
+ 'SMS_DRIVER_NOT_OPEN' => '短信没有启用',
+ 'WECHAT_TEMPLATE_NOTICE_NOT_OPEN' => '微信模板消息没有启用',
+ 'WEAPP_TEMPLATE_NOTICE_NOT_OPEN' => '微信小程序订阅没有启用',
+ 'SMS_TYPE_NOT_OPEN' => '没有启用的短信方式',
+ 'NOTICE_TEMPLATE_NOT_EXIST' => '消息模板不存在',
+ 'WECHAT_TEMPLATE_NEED_NO' => '微信消息模板缺少模板编号',
+ 'NOTICE_NOT_OPEN_SMS' => '当前消息未开启短信发送',
+ 'NOTICE_SMS_EMPTY' => '手机号为空',
+
+ //会员相关
+ 'MOBILE_IS_EXIST' => '当前手机号已绑定账号',
+ 'ACCOUNT_INSUFFICIENT' => '账户余额不足',
+ 'ACCOUNT_OR_PASSWORD_ERROR' => '账号或密码错误',
+ 'MEMBER_LOCK' => '账号被锁定',
+ 'MEMBER_NOT_EXIST' => '账号不存在',
+ 'MEMBER_LOGOUT' => '账号退出',
+ 'MEMBER_TYPE_NOT_EXIST' => '账户类型不存在',
+ 'MEMBER_IS_EXIST' => '账号已存在',
+ 'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道',
+ 'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开始账号登录注册',
+ 'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册',
+ 'MOBILE_NEEDED' => '手机号必须填写',
+ 'MOBILE_CAPTCHA_ERROR' => '手机验证码有误',
+ 'MEMBER_IS_BIND_AUTH' => '当前账号已绑定授权',
+ 'MEMBER_MOBILE_CAPTCHA_ERROR' => '无效的短信验证码',
+ 'AUTH_LOGIN_TAG_NOT_EXIST' => '第三方授权标识不能为空',
+ 'PASSWORD_RESET_SUCCESS' => '密码重置成功',
+ 'MOBILE_NOT_BIND_MEMBER' => '当前填写的手机号没有绑定此账号',
+ 'MOBILE_NOT_EXIST_MEMBER' => '当前填写的手机号不存在账号',
+ 'MOBILE_IS_BIND_MEMBER' => '当前账号已绑定手机号',
+ 'QRCODE_EXPIRE' => '登录二维码失效',
+
+ //会员提现
+ 'CASHOUT_NOT_OPEN' => '会员提现业务未开启',
+ 'CASHOUT_TYPE_NOT_OPEN' => '当前会员提现方式未启用',
+ 'CASHOUT_LOG_NOT_EXIST' => '提现记录不存在',
+ 'CASHOUT_AUDITED' => '当前提现记录已被审核',
+ 'TRANSFER_TYPE_NOT_EXIST' => '存在未定义的转账方式',
+ 'CASHOUT_IS_REFUSE' => '提现被拒绝,返还零钱',
+ 'MEMBER_APPLY_CASHOUT' => '会员申请提现,扣除零钱',
+ 'CASHOUT_MONEY_TOO_LITTLE' => '会员提现金额不能小于最低提现金额',
+ 'CASHOUT_STATUS_NOT_IN_WAIT_TRANSFER' => '当前提现申请未处于待转账状态',
+ 'CASHOUT_STATUS_NOT_IN_WAIT_AUDIT' => '当前提现申请未处于待审核状态',
+ 'MEMBER_CASHOUT_TRANSFER' => '会员提现转账',
+ 'CASH_OUT_ACCOUNT_NOT_EXIST' => '提现账户不存在',
+
+
+ //渠道相关 占用 4******
+ //微信
+ 'WECHAT_NOT_EXIST' => '微信公众号未配置完善',
+ 'KEYWORDS_NOT_EXIST' => '关键词回复不存在',
+ 'WECHAT_EMPOWER_NOT_EXIST' => '微信授权信息不存在',
+ 'SCAN_SUCCESS' => '扫码成功',
+ //小程序
+ 'WEAPP_NOT_EXIST' => '微信小程序未配置完善',
+ 'WEAPP_EMPOWER_NOT_EXIST' => '微信小程序授信信息不存在',
+ 'WEAPP_EMPOWER_TEL_NOT_EXIST' => '微信小程序授信手机号不存在',
+
+ //支付相关
+
+ //站点相关
+ 'SITE_GROUP_IS_EXIST' => '当前套餐存在站点,请调整站点对应套餐后重试',
+
+
+ //支付相关(todo 注意:7段不共享)
+ 'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号',
+ 'PAYMENT_METHOD_NOT_SUPPORT' => '您选择到支付方式不受业务支持',
+ 'PAYMENT_LOCK' => '支付中,请稍后再试',
+ 'PAY_SUCCESS' => '当前支付已完成',
+ 'PAY_IS_REMOVE' => '当前支付已取消',
+ 'PAYMENT_METHOD_NOT_EXIST' => '你选择的支付方式未启用',
+ 'PAYMENT_METHOD_NOT_SCENE'=> '你选择的支付方式不适用于当前场景',
+ 'TREAT_PAYMENT_IS_OPEN' => '只有待支付时可以关闭',
+ 'TRANFER_STATUS_NOT_IN_WAIT_TANSFER' => '当前转账未处于待转账状态',
+ 'TRANSFER_ORDER_INVALID' => '无效的转账单据',
+ 'TRANFER_CONFIG_ERROR' => '参数有误或未开通转账业务',
+ 'IS_PAY_REMOVE_NOT_RESETTING' => '已支付和已取消的单据不可以重置',
+ 'DOCUMENT_IS_PAY_REMOVE' => '当前单据已支付或已取消',
+ 'PATMENT_METHOD_INVALID' => '无效的支付方式',
+ 'CHANNEL_MARK_INVALID' => '无效的渠道标识',
+ 'TEMPLATE_NOT_EXIST' => '模板不存在',
+ 'IS_EXIST_TEMPLATE_NOT_MODIFY' => '已存在的支付模板不支持修改支付类型',
+
+ //订单相关 8***
+ 'ORDER_NOT_EXIST' => '订单不存在',
+ 'ORDER_CLOSED' => '订单已关闭',
+
+ // 退款相关
+ 'NOT_ALLOW_APPLY_REFUND' => '当前订单不允许退款',
+ 'ITEM_REFUND_NOT_EXIST' => '退款单不存在',
+ 'REFUND_STATUS_ABNORMAL' => '退款单状态异常',
+ 'NO_REFUNDABLE_AMOUNT' => '会员账户金额为0不允许进行退款'
+];
diff --git a/niucloud/app/lang/zh-cn/system/enum.php b/niucloud/app/lang/zh-cn/enum.php
similarity index 75%
rename from niucloud/app/lang/zh-cn/system/enum.php
rename to niucloud/app/lang/zh-cn/enum.php
index 4021cc777..37e395c74 100644
--- a/niucloud/app/lang/zh-cn/system/enum.php
+++ b/niucloud/app/lang/zh-cn/enum.php
@@ -28,7 +28,7 @@ return [
'enum_user' => [
//用户状态
'status_on' => '正常',
- 'status_off' => '停用'
+ 'status_off' => '锁定'
],
'enum_role' => [
//角色状态
@@ -43,7 +43,7 @@ return [
'status_experience' => '体验期',
'status_expire' => '已到期'
],
- 'enum_message' => [
+ 'enum_notice' => [
'type_sms' => '短信',
'type_wechat' => '微信公众号',
'type_weapp' => '微信小程序',
@@ -68,17 +68,18 @@ return [
],
'enum_member' => [
//会员端口
- 'register_wechat' => '微信公众号',
+ 'register_wechat' => '公众号',
'register_weapp' => '微信小程序',
- 'register_h5' => '手机端H5',
- 'register_pc' => '电脑端PC',
- 'register_app' => '手机端APP',
- 'register_manual' => '手动添加',
+ 'register_h5' => 'H5',
+ 'register_pc' => '电脑端',
+ 'register_app' => 'APP',
+ 'register_manual' => '商家添加',
'register_username' => '用户名密码注册',
'register_mobile' => '手机验证码注册',
'account_point' => '积分',
'account_balance' => '余额',
- 'account_money' => '零钱',
+ 'account_money' => '可提现余额',
+ 'account_commission' => '佣金',
'login_username' => '用户名密码登录',
'login_mobile' => '手机验证码登录',
'login_wechat' => '微信公众号授权登录',
@@ -88,14 +89,25 @@ return [
'account_balance_adjust' => '余额调整',
'account_balance_recharge' => '余额充值',
'account_money_award' => '活动奖励',
- 'account_money_withdraw' => '提现',
-
+ 'account_money_cash_out' => '余额提现',
+ 'account_money_adjust' => '零钱调整',
+ 'account_commission_award' => '活动奖励',
+ 'account_commission_cash_out' => '佣金提现',
+ 'status_on' => '正常',
+ 'status_off' => '锁定',
+ 'account_balance_recharge_refund' => '充值订单退款'
],
'enum_order' => [
//订单类型
'order_type_recharge' => '充值订单',
'trade_type_recharge' => '会员充值',
+ ],
+ 'enum_refund' => [
+ //订单类型
+ 'order_type_recharge' => '充值订单',
+ 'trade_type_recharge' => '会员充值',
+
],
//微信回复
'enum_wechat_reply' => [
@@ -170,7 +182,8 @@ return [
'member_index' => '个人中心',
'member_my_balance' => '我的余额',
'member_my_point' => '我的积分',
- 'member_my_personal'=>'个人资料',
+ 'member_my_commission' => '我的佣金',
+ 'member_my_personal' => '个人资料',
'diy_page' => '自定义页面',
'diy_link' => '自定义链接'
@@ -184,15 +197,15 @@ return [
//渠道
'enum_channel' => [
//渠道端口
- 'channel_wechat' => '微信公众号',
+ 'channel_wechat' => '公众号',
'channel_weapp' => '微信小程序',
- 'channel_h5' => '手机端H5',
- 'channel_pc' => '电脑端PC',
- 'channel_app' => '手机端APP',
+ 'channel_h5' => 'H5',
+ 'channel_pc' => '电脑端',
+ 'channel_app' => 'APP',
],
//会员提现
- 'enum_member_withdraw' => [
+ 'enum_member_cash_out' => [
//状态
'status_wait_audit' => '待审核',
'status_wait_transfer' => '待转账',
@@ -201,4 +214,30 @@ return [
'status_cancel' => '已取消'
],
+ //插件操作
+ 'enum_addon' => [
+ //状态
+ 'install' => '安装',
+ 'uninstall' => '卸载',
+ 'update' => '更新',
+ 'status_on' => '启用',
+ 'status_off' => '关闭',
+ ],
+ // 退款支付状态
+ 'enum_pay_refund' => [
+ 'success' => '退款成功',
+ 'dealing' => '退款中',
+ 'wait' => '待退款',
+ 'fail' => '退款失败',
+ 'wechatpay' => '微信原路退款',
+ 'alipay' => '支付宝原路退款',
+ 'unipay' => '银联原路退款',
+ 'offline' => '线下退款',
+ 'balance' => '退款到余额',
+ ],
+ 'enum_order_refund' => [
+ 'refunding' => '退款中',
+ 'refund_complete' => '退款完成',
+ 'refund_fail' => '退款失败'
+ ]
];
diff --git a/niucloud/app/lang/zh-cn/system/api.php b/niucloud/app/lang/zh-cn/system/api.php
deleted file mode 100644
index 1f4c1c5d7..000000000
--- a/niucloud/app/lang/zh-cn/system/api.php
+++ /dev/null
@@ -1,169 +0,0 @@
- '操作成功',
- 100001 => '保存成功',
- 100002 => '修改成功',
- 100003 => '删除成功',
- 100004 => '更新成功',
- 100005 => '操作失败',
- 100006 => '保存失败',
- 100007 => '修改失败',
- 100008 => '删除失败',
- 100009 => '更新失败',
- 100010 => '添加失败',
- 100011 => '添加成功',
- 100012 => '上传失败',
- 100013 => '附件删除失败',
- 100014 => '数据不存在',
- 100015 => '下载失败',
- 100016 => '设置成功',
- 100017 => '协议类型不存在',
- 100018 => '找不到要修改的字段',
- 100019 => '刷新成功',
- 100020 => '验证码有误',
-
-
- //登录注册重置账号....
-
- 101000 => '登录成功',
- 101001 => '请登录',
- 101002 => '登录过期,请重新登录',
- 101003 => '登录状态有误,请重新登录',
- 101004 => '账号被限制',
- 101005 => '账号或密码错误',
- 102006 => '您没有当前站点的访问权限',
- 102007 => '站点不存在',
- 102008 => '登陆退出',
- 102009 => '原始密码不正确',
- 102010 => '手机号登录注册未开启',
-
- //用户组权限
-
- 102000 => '您没有访问权限',
-
-
-
- //菜单管理
- 200001 => '菜单不存在',
- 200002 => '存在子级菜单的目录或菜单不允许删除',
-
- //用户管理
- 201001 => '用户不存在',
- 201002 => '用户不存在关联权限',
- 201003 => '超级管理员不允许改动权限',
- 201004 => '用户名重复',
-
-
- //角色管理
- 202001 => '角色不存在',
- 202002 => '存在管理员使用当前角色,不允许删除',
-
- //素材管理
- 203001 => '附件组不存在',
- 203002 => '当前分组,不允许删除',
- 203003 => '附件不存在',
- 203004 => '附件组中存在图片不允许删除',
- 203005 => '云存储类型不存在',
- 203006 => '获取不到网址指向的文件',
- 203007 => '请选择要删除的图片',
- 203008 => '不是有效的证书类型',
- 203009 => '远程资源文件地址不能为空',
- 203010 => 'base图片资源不能为空',
-
-
- //消息管理
- 204001 => '消息类型不存在',
- 204002 => '短信类型不存在',
- 204003 => '短信驱动不存在',
- 204004 => '没有启用的短信',
- 204005 => '短信没有启用',
- 204006 => '微信模板消息没有启用',
- 204007 => '微信小程序订阅没有启用',
- 204008 => '没有启用的短信方式',
- 204009 => '消息模板不存在',
- 204010 => '微信消息模板缺少模板编号',
- 204011 => '当前消息未开启短信发送',
-
- //会员相关
- 301001 => '手机号已存在',
- 301002 => '账户余额不足',
- 301003 => '账号或密码错误',
- 301004 => '账号被锁定',
- 301005 => '账号不存在',
- 301006 => '账号退出',
- 301007 => '账户类型不存在',
- 301008 => '账号已存在',
- 301009 => '无效的注册渠道',
- 301010 => '未开始账号登录注册',
- 301011 => '未开启第三方登录注册',
- 301012 => '手机号必须填写',
- 301013 => '手机验证码有误',
- 301014 => '当前账号已绑定授权',
- 301015 => '无效的短信验证码',
- 301016 => '第三方授权标识不能为空',
- 301017 => '密码重置成功',
- 301018 => '当前填写的手机号没有绑定此账号',
- 301019 => '当前填写的手机号不存在账号',
- 301020 => '当前账号已绑定手机号',
- 301021 => '登录二维码失效',
-
- //会员提现
- 302001 => '会员提现业务未开启',
- 302002 => '会员提现金额不能小于系统所配置的最低提现金额',
- 302003 => '当前会员提现方式未启用',
- 302004 => '提现记录不存在',
- 302005 => '当前提现记录已被审核',
- 302006 => '存在未定义的转账方式',
- 302007 => '提现被拒绝,返还零钱',
- 302008 => '会员申请提现,扣除零钱',
- 302009 => '会员提现金额不能小于最低提现金额',
- 302010 => '当前提现申请未处于待转账状态',
- 302011 => '当前提现申请未处于待审核状态',
- 302012 => '会员提现转账',
-
-
- //渠道相关 占用 4******
- //微信
- 400000 => '微信公众号未配置完善',
- 400001 => '关键词回复不存在',
- 400002 => '微信授权信息不存在',
- 400003 => '扫码成功',
- //小程序
- 410000 => '微信小程序未配置完善',
- 410001 => '微信小程序授信信息不存在',
- 410002 => '微信小程序授信手机号不存在',
-
- //支付相关
-
- //站点相关
- 600001 => '站点分组已存在站点,请调整站点后重试',
-
-
- //支付相关(todo 注意:7段不共享)
- 700000 => '无效的支付交易号',
- 700001 => '您选择到支付方式不受业务支持',
- 700002 => '支付中,请稍后再试',
- 700003 => '当前支付已完成',
- 700004 => '当前支付已取消',
- 700005 => '你选择的支付方式未启用',
- 700006 => '你选择的支付方式不适用于当前场景',
- 700007 => '只有待支付时可以关闭',
- 700008 => '当前转账未处于待转账状态',
- 700009 => '无效的转账单据',
- 700010 => '参数有误或未开通转账业务',
-
- //订单相关 8***
- 800000 => '订单不存在',
-
-];
diff --git a/niucloud/app/lang/zh-cn/system/validate.php b/niucloud/app/lang/zh-cn/validate.php
similarity index 85%
rename from niucloud/app/lang/zh-cn/system/validate.php
rename to niucloud/app/lang/zh-cn/validate.php
index 4bae85ca8..d477c9540 100644
--- a/niucloud/app/lang/zh-cn/system/validate.php
+++ b/niucloud/app/lang/zh-cn/validate.php
@@ -77,11 +77,13 @@ return [
'is_auth_register_between' => '第三方自动注册参数必须是0或1',
'is_bind_mobile_number' => '强制绑定手机参数必须是整数',
'is_bind_mobile_between' => '强制绑定手机参数必须是0或1',
- 'withdraw_is_open_in' => '是否启用必须是0或者1',
- 'withdraw_min_min' => '最小提现金额必须是正数',
- 'withdraw_rate_between' => '提现手续费必须是0到100之间',
- 'withdraw_is_auto_verify_in' => '是否启用审核必须是0或1',
- 'withdraw_is_auto_transfer_in' => '是否启用转账必须是0或1'
+ 'cash_out_is_open_in' => '是否启用必须是0或者1',
+ 'cash_out_min_min' => '最小提现金额必须是正数',
+ 'cash_out_rate_between' => '提现手续费必须是0到100之间',
+ 'cash_out_is_auto_verify_in' => '是否启用审核必须是0或1',
+ 'cash_out_is_auto_transfer_in' => '是否启用转账必须是0或1',
+ 'status_require' => '会员状态必须填写',
+ 'not_exit_status' => '不存在的会员状态'
],
'validate_article' => [
'title_require' => '文章标题必须填写',
@@ -116,7 +118,9 @@ return [
'mch_secret_key_requireif' => '请填写商户秘钥',
'mch_secret_cert_requiremch_secret_cert_requireif' => '请填写商户私钥',
'mch_public_cert_path_requireif' => '请填写商户公钥证书路径',
+
'not_exit_pay_type' => '不存在的支付类型',
+ 'name_require' => '模板名称不能为空',
],
'validate_agreement' => [
'title_require' => '协议标题必须填写',
@@ -140,12 +144,25 @@ return [
'appsecret_require' => 'appsecret必须填写',
],
//会员提现配置
- 'validate_member_withdraw_config' => [
+ 'validate_member_cash_out_config' => [
'transfer_type_require' => '至少需选择一种转账方式',
],
// 自定义
'validate_diy' => [
'type_not_exist' => '不存在的页面类型',
],
-
+ // 会员提现账号
+ 'validate_member_cash_out_account' => [
+ 'not_support_transfer_type' => '不支持的提现方式',
+ 'bank_name_require' => '银行名称必须填写',
+ 'account_no_require' => '账号必须填写',
+ 'realname_require' => '真实姓名必须填写',
+ ],
+ // 会员提现
+ 'validate_member_cash_out' => [
+ 'apply_money_min' => '提现金额需大于0元',
+ 'not_support_account_type' => '该账户不支持提现',
+ 'not_support_transfer_type' => '不支持该提现方式',
+ 'account_id_require' => '请选择提现账户'
+ ]
];
diff --git a/niucloud/app/behavior/QueueFailedLogger.php b/niucloud/app/listener/job/QueueFailedLoggerListener.php
similarity index 93%
rename from niucloud/app/behavior/QueueFailedLogger.php
rename to niucloud/app/listener/job/QueueFailedLoggerListener.php
index 49d179d59..2940060a9 100644
--- a/niucloud/app/behavior/QueueFailedLogger.php
+++ b/niucloud/app/listener/job/QueueFailedLoggerListener.php
@@ -1,8 +1,8 @@
0) {//查询openid
+ $info = (new CoreMemberService())->getInfoByMemberId($site_id, $member_id);
+ $mobile = $info['mobile'] ?? '';
+ $nickname = $info['nickname'] ?? '';
+ }
+ }
+ if (empty($mobile)) throw new NoticeException('NOTICE_SMS_EMPTY');//没有手机号不能发送短信
+ $core_sms_service = new CoreSmsService();
+ //消息日志
+ $log_data = array(
+ 'key' => $key,
+ 'message_type' => NoticeTypeEnum::SMS,
+ 'uid' => $uid ?? 0,
+ 'member_id' => $member_id ?? 0,
+ 'nickname' => $nickname ?? '',
+ 'receiver' => $mobile,
+ 'params' => $data,
+ 'content' => $content,
+ 'result' => ''
+ );
+ $core_sms_service->send($site_id, $mobile, $vars, $key, $sms_id, $content);
+ (new CoreNoticeLogService())->add($site_id, $log_data);
+ } catch ( NoticeException $e ) {
+ $log_data['result'] = $e->getMessage();
+ (new CoreNoticeLogService())->add($site_id, $log_data);
+ //这儿决定要不要抛出
+ if (!$template['async']) {
+ throw new NoticeException($e->getMessage());
+ }
+ }
+ } else {
+ if (!$template['async']) {
+ throw new NoticeException('NOTICE_NOT_OPEN_SMS');
+ }
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/notice/Weapp.php b/niucloud/app/listener/notice/Weapp.php
new file mode 100644
index 000000000..2a3833697
--- /dev/null
+++ b/niucloud/app/listener/notice/Weapp.php
@@ -0,0 +1,84 @@
+ 0){//查询openid
+ $info = (new CoreMemberService())->getInfoByMemberId($site_id, $member_id);
+ $openid = $info['weapp_openid'] ?? '';
+ $nickname = $info['nickname'] ?? '';
+ }
+ if(!empty($openid)) {
+ $weapp_template_id = $template['weapp_template_id'];
+ $weapp_json = $template['weapp'];
+ $weapp_content = $weapp_json['content'];
+ $weapp_data = [];
+ foreach($weapp_content as $k => $v){
+ $search_content = $v[1];
+ foreach($vars as $item_k => $item_v){
+ $search_content = str_replace('{'.$item_k.'}', $item_v, $search_content);
+ }
+ $weapp_data[$v[2]]['value'] = $search_content;
+ }
+ $url = '';
+ if(!empty($url)){
+ //todo 拼装h5端的链接
+ $url = $vars['__weapp_page'];
+ }
+ $log_data = array(
+ 'key' => $key,
+ 'message_type' => NoticeTypeEnum::WEAPP,
+ 'uid' => $data['uid'] ?? 0,
+ 'member_id' => $member_id,
+ 'nickname' => $nickname ?? '',
+ 'receiver' => $openid,
+ 'params' => $data,
+ 'content' => $weapp_json
+ );
+ try {
+ (new TemplateLoader(NoticeTypeEnum::WEAPP, ['site_id' => $site_id]))->send(
+ [
+ 'template_id' => $weapp_template_id,
+ 'data' => $weapp_data,
+ 'openid' => $openid,
+ 'page' => $url,
+ ]);
+ (new CoreNoticeLogService())->add($site_id, $log_data);
+ } catch ( NoticeException $e ) {
+ $log_data['result'] = $e->getMessage();
+ (new CoreNoticeLogService())->add($site_id, $log_data);
+ //这儿决定要不要抛出
+ if (!$template['async']) {
+ throw new NoticeException($e->getMessage());
+ }
+ }
+ }
+ }else {
+ if (!$template['async']) {
+ throw new NoticeException('WEAPP_TEMPLATE_NOTICE_NOT_OPEN');
+ }
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/notice/Wechat.php b/niucloud/app/listener/notice/Wechat.php
new file mode 100644
index 000000000..2bdcd2ea3
--- /dev/null
+++ b/niucloud/app/listener/notice/Wechat.php
@@ -0,0 +1,96 @@
+ 0){//查询openid
+ $info = (new CoreMemberService())->getInfoByMemberId($site_id, $member_id);
+ $openid = $info['wx_openid'] ?? '';
+ $nickname = $info['nickname'] ?? '';
+ }
+ //或者还有用户的
+ if(!empty($openid)){
+ $wechat_template_id = $template['wechat_template_id'];
+ $wechat_json = $template['wechat'];
+ $wechat_content = $wechat_json['content'];
+ $wechat_data = [];
+ foreach($wechat_content as $k => $v){
+ $search_content = $v[1];
+ foreach($vars as $item_k => $item_v){
+ $search_content = str_replace('{'.$item_k.'}', $item_v, $search_content);
+ }
+ $wechat_data[$v[2]] = $search_content;
+ }
+ $first = $wechat_json['wechat_first'] ?? '';
+ $remark = $wechat_json['wechat_remark'] ?? '';
+ if(!empty($first)) $vars['first'] = $first;
+ if(!empty($remark)) $vars['remark'] = $remark;
+ $url = '';
+ if(!empty($url)){
+ //todo 拼装h5端的链接
+ $url = $vars['__wechat_page'];
+ }
+ //消息日志
+ $log_data = array(
+ 'key' => $key,
+ 'message_type' => NoticeTypeEnum::WECHAT,
+ 'uid' => $data['uid'] ?? 0,
+ 'member_id' => $member_id,
+ 'nickname' => $nickname ?? '',
+ 'receiver' => $openid,
+ 'params' => $vars,
+ 'content' => $wechat_json
+ );
+
+ try{
+ (new TemplateLoader(NoticeTypeEnum::WECHAT, ['site_id' => $site_id]))->send(
+ [
+ 'template_id' => $wechat_template_id,
+ 'first' => $remark,
+ 'remark' => $remark,
+ 'data' => $wechat_data,
+ 'openid' => $openid,
+ 'url' => $url,
+ 'miniprogram' => $miniprogram ?? '',
+ ]);
+ (new CoreNoticeLogService())->add($site_id, $log_data);
+ }catch(NoticeException $e){
+ $log_data['result'] = $e->getMessage();
+ (new CoreNoticeLogService())->add($site_id, $log_data);
+ //这儿决定要不要抛出
+ if(!$template['async']){
+ throw new NoticeException($e->getMessage());
+ }
+ }
+ }
+ }else {
+ if (!$template['async']) {
+ throw new NoticeException('WECHAT_TEMPLATE_NOTICE_NOT_OPEN');
+ }
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/notice_template/BaseNoticeTemplate.php b/niucloud/app/listener/notice_template/BaseNoticeTemplate.php
new file mode 100644
index 000000000..1a74f9464
--- /dev/null
+++ b/niucloud/app/listener/notice_template/BaseNoticeTemplate.php
@@ -0,0 +1,18 @@
+ $vars,
+ 'to' => $to,
+ ];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/notice_template/MemberVerifySuccess.php b/niucloud/app/listener/notice_template/MemberVerifySuccess.php
new file mode 100644
index 000000000..3fdfd7dbf
--- /dev/null
+++ b/niucloud/app/listener/notice_template/MemberVerifySuccess.php
@@ -0,0 +1,32 @@
+key == $data['key']) {
+ return $this->toReturn(
+ [
+ 'code' => $data['code'],
+ ],
+ [
+ 'mobile' => $data['mobile'],
+ ]
+ );
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/notice_template/RechargeSuccess.php b/niucloud/app/listener/notice_template/RechargeSuccess.php
new file mode 100644
index 000000000..f8a581664
--- /dev/null
+++ b/niucloud/app/listener/notice_template/RechargeSuccess.php
@@ -0,0 +1,47 @@
+key == $params['key']) {
+ $data = $params['data'];
+ $site_id = $params['site_id'];
+ $order_id = $data['order_id'];
+
+ $core_order_service = new CoreOrderService();
+ $order = $core_order_service->getOrderInfo($site_id, $order_id);
+ if (!empty($order)){
+ $member = (new CoreMemberService())->getInfoByMemberId($site_id, $order['member_id']);
+ //通过订单id查询订单信息
+ return $this->toReturn(
+ [
+ '__wechat_page' => '',//模板消息链接
+ '__miniprogram' => '',//模板消息小程序
+ '__weapp_page' => '',//小程序链接
+ 'balance' => $member['balance'],//充值后的余额
+ 'price' => $order['order_item_money'],//订单项总价
+ 'time' => $order['create_time'],//创建时间
+ 'trade_no' => $order['out_trade_no'],//交易流水号
+ ],
+ [
+ 'member_id' => $order['member_id'],
+ ]
+ );
+ }
+
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/notice_template/VerifyCode.php b/niucloud/app/listener/notice_template/VerifyCode.php
new file mode 100644
index 000000000..eb1e04b1f
--- /dev/null
+++ b/niucloud/app/listener/notice_template/VerifyCode.php
@@ -0,0 +1,31 @@
+ '验证码'
+// );
+ private $key = 'verify_code';
+// private $title = '';
+// public $name = '';
+ public function handle(array $params)
+ {
+ if ($this->key == $params['key']){
+ $data = $params['data'];
+ return $this->toReturn(
+ [
+ 'code' => $data['code'],
+ ],
+ [
+ 'mobile' => $data['mobile'],
+ ]
+ );
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/listener/pay/PayNotify.php b/niucloud/app/listener/pay/PayNotifyListener.php
similarity index 96%
rename from niucloud/app/listener/pay/PayNotify.php
rename to niucloud/app/listener/pay/PayNotifyListener.php
index bc2bc3bf7..48111aa20 100644
--- a/niucloud/app/listener/pay/PayNotify.php
+++ b/niucloud/app/listener/pay/PayNotifyListener.php
@@ -16,7 +16,7 @@ namespace app\listener\pay;
* Class PayNotify
* @package app\listener\pay
*/
-class PayNotify
+class PayNotifyListener
{
public function handle($member)
{
diff --git a/niucloud/app/listener/pay/PaySuccess.php b/niucloud/app/listener/pay/PaySuccessListener.php
similarity index 97%
rename from niucloud/app/listener/pay/PaySuccess.php
rename to niucloud/app/listener/pay/PaySuccessListener.php
index abe96a23f..691bb93d3 100644
--- a/niucloud/app/listener/pay/PaySuccess.php
+++ b/niucloud/app/listener/pay/PaySuccessListener.php
@@ -17,7 +17,7 @@ namespace app\listener\pay;
* Class PayNotify
* @package app\listener\pay
*/
-class PaySuccess
+class PaySuccessListener
{
public function handle(array $pay_info)
{
diff --git a/niucloud/app/listener/pay/TransferSuccess.php b/niucloud/app/listener/pay/TransferSuccessListener.php
similarity index 71%
rename from niucloud/app/listener/pay/TransferSuccess.php
rename to niucloud/app/listener/pay/TransferSuccessListener.php
index 098cae26f..fe94a6a0c 100644
--- a/niucloud/app/listener/pay/TransferSuccess.php
+++ b/niucloud/app/listener/pay/TransferSuccessListener.php
@@ -11,20 +11,20 @@
namespace app\listener\pay;
-use app\enum\withdraw\WithdrawTypeEnum;
-use app\service\core\member\CoreMemberWithdrawService;
+use app\enum\cash_out\CashOutTypeEnum;
+use app\service\core\member\CoreMemberCashOutService;
/**
* 转账事件
*/
-class TransferSuccess
+class TransferSuccessListener
{
public function handle(array $info)
{
//会员零钱提现
- if($info['trade_type'] == WithdrawTypeEnum::MEMBER_WITHDRAW)
+ if($info['trade_type'] == CashOutTypeEnum::MEMBER_CASH_OUT)
{
- return (new CoreMemberWithdrawService())->transferFinish($info['site_id'], $info['transfer_no']);
+ return (new CoreMemberCashOutService())->transferFinish($info['site_id'], $info['transfer_no']);
}
}
}
\ No newline at end of file
diff --git a/niucloud/app/listener/scan/Scan.php b/niucloud/app/listener/scan/ScanListener.php
similarity index 98%
rename from niucloud/app/listener/scan/Scan.php
rename to niucloud/app/listener/scan/ScanListener.php
index 4dfdf6f02..7daadd631 100644
--- a/niucloud/app/listener/scan/Scan.php
+++ b/niucloud/app/listener/scan/ScanListener.php
@@ -20,7 +20,7 @@ use app\service\core\order\recharge\CoreRechargeOrderService;
* Class PayNotify
* @package app\listener\pay
*/
-class Scan
+class ScanListener
{
public function handle(array $data)
{
diff --git a/niucloud/app/listener/system/AppInit.php b/niucloud/app/listener/system/AppInitListener.php
similarity index 89%
rename from niucloud/app/listener/system/AppInit.php
rename to niucloud/app/listener/system/AppInitListener.php
index 7af218dd1..c67890738 100644
--- a/niucloud/app/listener/system/AppInit.php
+++ b/niucloud/app/listener/system/AppInitListener.php
@@ -16,10 +16,11 @@ namespace app\listener\system;
* Class AppInit
* @package app\listener\system
*/
-class AppInit
+class AppInitListener
{
- public function handle($member)
+ public function handle()
{
+ //加载插件语言包
return ;
}
}
\ No newline at end of file
diff --git a/niucloud/app/listener/system/AppManageListener.php b/niucloud/app/listener/system/AppManageListener.php
new file mode 100644
index 000000000..e9c20af7f
--- /dev/null
+++ b/niucloud/app/listener/system/AppManageListener.php
@@ -0,0 +1,52 @@
+[
+
+ [
+ "key" => "basic",
+ "name" => "系统应用"
+ ]
+ ],
+ [
+ "addon" => "",
+ "title" => "消息管理",
+ "category" => "basic",
+ "desc" => "消息管理",
+ "icon" => "static/resource/images/app/message_icon.png",
+ "cover" => "static/resource/images/app/message_cover.png",
+ "url" => "/setting/message/template"
+ ],
+ [
+ "addon" => "",
+ "title" => "会员充值",
+ "category" => "basic",
+ "desc" => "会员充值",
+ "icon" => "static/resource/images/app/recharge_icon.png",
+ "cover" => "static/resource/images/app/recharge_cover.png",
+ "url" => "/finance/recharge"
+ ],
+ ];
+ return $data;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/middleware.php b/niucloud/app/middleware.php
index 66f057bb6..f4e70c63b 100644
--- a/niucloud/app/middleware.php
+++ b/niucloud/app/middleware.php
@@ -9,7 +9,7 @@ return [
// 多语言加载
LoadLangPack::class,
//跨域请求中间件
- AllowCrossDomain::class,
+// AllowCrossDomain::class,
// Session初始化
// \think\middleware\SessionInit::class
];
diff --git a/niucloud/app/model/addon/Addon.php b/niucloud/app/model/addon/Addon.php
new file mode 100644
index 000000000..ae8d740c8
--- /dev/null
+++ b/niucloud/app/model/addon/Addon.php
@@ -0,0 +1,65 @@
+ 'timestamp',
+ ];
+ /**
+ * 数据表主键
+ * @var string
+ */
+ protected $pk = 'id';
+
+ /**
+ * 模型名称
+ * @var string
+ */
+ protected $name = 'addon';
+
+
+ /**
+ * 状态名称
+ * @param $value
+ * @param $data
+ * @return mixed|string
+ */
+ public function getStatusNameAttr($value, $data)
+ {
+ return AddonEnum::getStatus()[ $data[ 'status' ] ?? '' ] ?? '';
+ }
+ /**
+ * 插件名称搜索器
+ * @param $value
+ * @param $data
+ */
+ public function searchTitleAttr($query, $value, $data)
+ {
+ if ($value) {
+ $query->whereLike('title', '%'.$value.'%');
+ }
+ }
+
+
+
+
+}
diff --git a/niucloud/app/api/controller/BaseApiController.php b/niucloud/app/model/addon/AddonLog.php
similarity index 67%
rename from niucloud/app/api/controller/BaseApiController.php
rename to niucloud/app/model/addon/AddonLog.php
index f74d71944..a7f4d6a7a 100644
--- a/niucloud/app/api/controller/BaseApiController.php
+++ b/niucloud/app/model/addon/AddonLog.php
@@ -9,24 +9,23 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-declare (strict_types=1);
+namespace app\model\addon;
-namespace app\api\controller;
-
-use app\BaseController;
-use think\App;
+use core\base\BaseModel;
/**
- * api基础控制器
- * Class BaseApiController
- * @package app\api\controller
+ * 插件日志模型
*/
-class BaseApiController extends BaseController
+class AddonLog extends BaseModel
{
-
- public function initialize()
- {
-
- }
-
-}
\ No newline at end of file
+ /**
+ * 数据表主键
+ * @var string
+ */
+ protected $pk = 'id';
+ /**
+ * 模型名称
+ * @var string
+ */
+ protected $name = 'addon_log';
+}
diff --git a/niucloud/app/model/article/Article.php b/niucloud/app/model/article/Article.php
index a6159d28a..6e6a0057f 100644
--- a/niucloud/app/model/article/Article.php
+++ b/niucloud/app/model/article/Article.php
@@ -11,7 +11,7 @@
namespace app\model\article;
-use app\model\BaseModel;
+use core\base\BaseModel;
use think\db\Query;
use think\model\relation\HasOne;
diff --git a/niucloud/app/model/article/ArticleCategory.php b/niucloud/app/model/article/ArticleCategory.php
index 4ad942858..30d5e2206 100644
--- a/niucloud/app/model/article/ArticleCategory.php
+++ b/niucloud/app/model/article/ArticleCategory.php
@@ -11,7 +11,7 @@
namespace app\model\article;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 文章栏目模型
diff --git a/niucloud/app/model/diy/Diy.php b/niucloud/app/model/diy/Diy.php
index 23a64eaab..9c622afe8 100644
--- a/niucloud/app/model/diy/Diy.php
+++ b/niucloud/app/model/diy/Diy.php
@@ -12,7 +12,7 @@
namespace app\model\diy;
use app\enum\diy\PageEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
@@ -47,7 +47,7 @@ class Diy extends BaseModel
*/
public function getTypeNameAttr($value, $data)
{
- return PageEnum::getPageType($data[ 'type' ] ?? '')[ 'type_name' ] ?? '';
+ return PageEnum::getPageType($data[ 'type' ] ?? '')[ 'title' ] ?? '';
}
/**
diff --git a/niucloud/app/model/diy/DiyRoute.php b/niucloud/app/model/diy/DiyRoute.php
index 29bbe603e..66a8dc936 100644
--- a/niucloud/app/model/diy/DiyRoute.php
+++ b/niucloud/app/model/diy/DiyRoute.php
@@ -11,7 +11,7 @@
namespace app\model\diy;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
@@ -105,18 +105,4 @@ class DiyRoute extends BaseModel
}
}
-
- /**
- * 搜索器:自定义路由表排序
- * @param $value
- * @param $data
- */
- public function searchSortAttr($query, $value, $data)
- {
- if ($value) {
- $query->where("sort", $value);
- }
- }
-
-
}
diff --git a/niucloud/app/model/generator/GenerateColumn.php b/niucloud/app/model/generator/GenerateColumn.php
index 7e4929e19..61f6d986f 100644
--- a/niucloud/app/model/generator/GenerateColumn.php
+++ b/niucloud/app/model/generator/GenerateColumn.php
@@ -11,7 +11,7 @@
namespace app\model\generator;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
diff --git a/niucloud/app/model/generator/GenerateTable.php b/niucloud/app/model/generator/GenerateTable.php
index 810854a42..73898ae20 100644
--- a/niucloud/app/model/generator/GenerateTable.php
+++ b/niucloud/app/model/generator/GenerateTable.php
@@ -11,7 +11,7 @@
namespace app\model\generator;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
diff --git a/niucloud/app/model/member/Member.php b/niucloud/app/model/member/Member.php
index ed660b302..e1419c645 100644
--- a/niucloud/app/model/member/Member.php
+++ b/niucloud/app/model/member/Member.php
@@ -13,9 +13,11 @@ namespace app\model\member;
use app\enum\common\ChannelEnum;
use app\enum\common\CommonEnum;
+use app\enum\member\MemberEnum;
use app\enum\member\MemberLoginTypeEnum;
+use app\enum\member\MemberRegisterChannelEnum;
use app\enum\member\MemberRegisterTypeEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
use think\db\Query;
use think\model\concern\SoftDelete;
@@ -29,6 +31,11 @@ class Member extends BaseModel
use SoftDelete;
+ protected $type = [
+ 'last_visit_time' => 'timestamp',
+ 'login_time' => 'timestamp',
+ 'last_consum_time' => 'timestamp',
+ ];
/**
* 数据表主键
* @var string
@@ -58,6 +65,15 @@ class Member extends BaseModel
// 设置JSON数据返回数组
protected $jsonAssoc = true;
+ /**
+ * 状态字段转化
+ * @param $value
+ * @return mixed
+ */
+ public function getStatusNameAttr($value, $data)
+ {
+ return MemberEnum::getStatus()[$data['status'] ?? ''] ?? '';
+ }
/**
* 注册来源字段转化
* @param $value
@@ -65,7 +81,7 @@ class Member extends BaseModel
*/
public function getRegisterChannelNameAttr($value, $data)
{
- return ChannelEnum::getType()[ $data[ 'register_channel' ] ?? '' ] ?? '';
+ return MemberRegisterChannelEnum::getType()[ $data[ 'register_channel' ] ?? '' ] ?? '';
}
/**
@@ -109,17 +125,6 @@ class Member extends BaseModel
return CommonEnum::getSexType()[ $data[ 'sex' ] ?? '' ] ?? '';
}
- /**
- * 手机号加密
- * @param $value
- * @param $data
- * @return mixed|string
- */
- public function getMobileAttr($value, $data)
- {
- return $data[ 'mobile' ] ? substr($data[ 'mobile' ], 0, 3) . '****' . substr($data[ 'mobile' ], 7) : '';
- }
-
/**
* 是否删除搜索器
* @param $value
@@ -155,6 +160,18 @@ class Member extends BaseModel
$query->where('register_type', '=', $value);
}
}
+ /**
+ * 注册渠道搜索
+ * @param $query
+ * @param $value
+ * @param $data
+ */
+ public function searchRegisterChannelAttr($query, $value, $data)
+ {
+ if ($value) {
+ $query->where('register_channel', '=', $value);
+ }
+ }
/**
* 标签筛选
diff --git a/niucloud/app/model/member/MemberAccountLog.php b/niucloud/app/model/member/MemberAccountLog.php
index 47aec5817..4073b031d 100644
--- a/niucloud/app/model/member/MemberAccountLog.php
+++ b/niucloud/app/model/member/MemberAccountLog.php
@@ -12,7 +12,7 @@
namespace app\model\member;
use app\enum\member\MemberAccountEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 会员账户流水(账单)模型
diff --git a/niucloud/app/model/member/MemberAddress.php b/niucloud/app/model/member/MemberAddress.php
index c568295eb..152ac415f 100644
--- a/niucloud/app/model/member/MemberAddress.php
+++ b/niucloud/app/model/member/MemberAddress.php
@@ -11,7 +11,7 @@
namespace app\model\member;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 会员收货地址模型
diff --git a/niucloud/app/model/member/MemberWithdraw.php b/niucloud/app/model/member/MemberCashOut.php
similarity index 86%
rename from niucloud/app/model/member/MemberWithdraw.php
rename to niucloud/app/model/member/MemberCashOut.php
index 317a3bed1..5cdf39ffb 100644
--- a/niucloud/app/model/member/MemberWithdraw.php
+++ b/niucloud/app/model/member/MemberCashOut.php
@@ -11,17 +11,16 @@
namespace app\model\member;
-use app\enum\member\MemberWithdrawEnum;
+use app\enum\member\MemberAccountEnum;
+use app\enum\member\MemberCashOutEnum;
use app\enum\pay\TransferEnum;
-use app\model\BaseModel;
use app\model\pay\Transfer;
+use core\base\BaseModel;
/**
* 会员提现
- * Class MemberWithdraw
- * @package app\model\member
*/
-class MemberWithdraw extends BaseModel
+class MemberCashOut extends BaseModel
{
/**
@@ -34,7 +33,7 @@ class MemberWithdraw extends BaseModel
* 模型名称
* @var string
*/
- protected $name = 'member_withdraw';
+ protected $name = 'member_cash_out';
/**
* 会员信息
@@ -56,6 +55,16 @@ class MemberWithdraw extends BaseModel
return $this->hasOne(Transfer::class, 'transfer_no', 'transfer_no')->joinType('left')
->withField('transfer_no, transfer_type, transfer_realname, transfer_mobile, transfer_bank, transfer_account, transfer_voucher, transfer_remark, transfer_fail_reason, transfer_status')->append(['transfer_status_name', 'transfer_type_name']);
}
+
+ /**
+ * 账户类型名称
+ * @param $value
+ * @param $data
+ * @return mixed|string
+ */
+ public function getAccountTypeNameAttr($value, $data){
+ return MemberAccountEnum::getType()[ $data[ 'account_type' ] ?? '' ] ?? '';
+ }
/**
* 提现状态名称
* @param $value
@@ -63,7 +72,7 @@ class MemberWithdraw extends BaseModel
* @return mixed|string
*/
public function getStatusNameAttr($value, $data){
- return MemberWithdrawEnum::MemberWithdrawEnum()[ $data[ 'status' ] ?? '' ] ?? '';
+ return MemberCashOutEnum::getStatus()[ $data[ 'status' ] ?? '' ] ?? '';
}
/**
* 转账方式名称
@@ -73,7 +82,7 @@ class MemberWithdraw extends BaseModel
*/
public function getTransferTypeNameAttr($value, $data)
{
- return TransferEnum::getTransferType()[ $data[ 'transfer_type' ] ?? '' ] ?? '';
+ return TransferEnum::getTransferType()[ $data[ 'transfer_type' ] ?? '' ]['name'] ?? '';
}
/**
diff --git a/niucloud/app/model/member/MemberCashOutAccount.php b/niucloud/app/model/member/MemberCashOutAccount.php
new file mode 100644
index 000000000..3928d4923
--- /dev/null
+++ b/niucloud/app/model/member/MemberCashOutAccount.php
@@ -0,0 +1,62 @@
+ 0 && $end_time > 0){
+ $query->whereBetweenTime('create_time', $start_time, $end_time);
+ }else if($start_time > 0 && $end_time == 0){
+ $query->where([['create_time', '>=', $start_time]]);
+ }else if($start_time == 0 && $end_time > 0){
+ $query->where([['create_time', '<=', $end_time]]);
+ }
+ }
+
+}
diff --git a/niucloud/app/model/member/MemberLabel.php b/niucloud/app/model/member/MemberLabel.php
index d02192378..be08889bf 100644
--- a/niucloud/app/model/member/MemberLabel.php
+++ b/niucloud/app/model/member/MemberLabel.php
@@ -11,7 +11,7 @@
namespace app\model\member;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 会员标签模型
diff --git a/niucloud/app/model/member/MemberLevel.php b/niucloud/app/model/member/MemberLevel.php
index 1b477814a..847c8fa19 100644
--- a/niucloud/app/model/member/MemberLevel.php
+++ b/niucloud/app/model/member/MemberLevel.php
@@ -11,7 +11,7 @@
namespace app\model\member;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 会员等级模型
diff --git a/niucloud/app/model/order/Order.php b/niucloud/app/model/order/Order.php
index 472600295..5514abcb1 100644
--- a/niucloud/app/model/order/Order.php
+++ b/niucloud/app/model/order/Order.php
@@ -12,11 +12,8 @@
namespace app\model\order;
use app\enum\common\ChannelEnum;
-use app\enum\order\OrderTypeEnum;
-use app\enum\order\RechargeOrderEnum;
-use app\model\BaseModel;
use app\model\member\Member;
-use think\db\Query;
+use core\base\BaseModel;
/**
* 订单模型
diff --git a/niucloud/app/model/order/OrderItem.php b/niucloud/app/model/order/OrderItem.php
index a8d8b7b67..cc1b697a5 100644
--- a/niucloud/app/model/order/OrderItem.php
+++ b/niucloud/app/model/order/OrderItem.php
@@ -11,7 +11,7 @@
namespace app\model\order;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 订单项目模型
@@ -44,8 +44,13 @@ class OrderItem extends BaseModel
{
return number_format($data['num'], 0);
}
-
}
-
+ /**
+ * 关联订单主表
+ * @return void
+ */
+ public function ordermain(){
+ return $this->hasOne(Order::class, 'order_id')->joinType('inner');
+ }
}
diff --git a/niucloud/app/model/order/OrderItemRefund.php b/niucloud/app/model/order/OrderItemRefund.php
new file mode 100644
index 000000000..b12947d8f
--- /dev/null
+++ b/niucloud/app/model/order/OrderItemRefund.php
@@ -0,0 +1,137 @@
+ 'timestamp',
+ 'audit_time' => 'timestamp',
+ 'transfer_time' => 'timestamp',
+ ];
+
+ /**
+ * 数据表主键
+ * @var string
+ */
+ protected $pk = 'refund_id';
+
+ /**
+ * 模型名称
+ * @var string
+ */
+ protected $name = 'order_item_refund';
+
+ /**
+ * 退款状态字段处理
+ * @param $value
+ * @return mixed
+ */
+ public function getStatusNameAttr($value, $data)
+ {
+ $class = "\\app\\enum\\order\\" . ucfirst($data['item_type']). "OrderEnum";
+ if (!class_exists($class)) return '';
+ return $class::getRefundStatus()[$data['status'] ?? '']['name'] ?? '';
+ }
+
+ /**
+ *
+ * @return \think\model\relation\HasOne
+ */
+ public function item() {
+ return $this->hasOne(OrderItem::class, 'order_item_id', 'order_item_id')->joinType('inner');
+ }
+
+ /**
+ * 订单会员
+ * @return \think\model\relation\HasOne
+ */
+ public function member()
+ {
+ return $this->hasOne(Member::class,'member_id', 'member_id');
+ }
+
+ /**
+ * 关联退款支付记录表
+ * @return \think\model\relation\HasOne
+ */
+ public function payrefund(){
+ return $this->hasOne(Refund::class,'refund_no', 'refund_no');
+ }
+
+ /**
+ * 会员id搜索
+ * @param $query
+ * @param $value
+ * @param $data
+ */
+ public function searchRefundNoAttr($query, $value, $data)
+ {
+ if ($value) {
+ $query->where('refund_no', '=', $value);
+ }
+ }
+
+ /**
+ * 会员id搜索
+ * @param $query
+ * @param $value
+ * @param $data
+ */
+ public function searchMemberIdAttr($query, $value, $data)
+ {
+ if ($value) {
+ $query->where('member_id', '=', $value);
+ }
+ }
+
+ /**
+ * 退款状态
+ * @param $query
+ * @param $value
+ * @param $data
+ */
+ public function searchStatusAttr($query, $value, $data)
+ {
+ if ($value != '') {
+ $query->where('status', '=', $value);
+ }
+ }
+
+ /**
+ * 创建时间搜索器
+ * @param $value
+ */
+ public function searchCreateTimeAttr($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('create_time', $start_time, $end_time);
+ }else if($start_time > 0 && $end_time == 0){
+ $query->where([['create_time', '>=', $start_time]]);
+ }else if($start_time == 0 && $end_time > 0){
+ $query->where([['create_time', '<=', $end_time]]);
+ }
+ }
+}
diff --git a/niucloud/app/model/order/OrderLog.php b/niucloud/app/model/order/OrderLog.php
index 24c54a319..c08d5e2ed 100644
--- a/niucloud/app/model/order/OrderLog.php
+++ b/niucloud/app/model/order/OrderLog.php
@@ -11,7 +11,7 @@
namespace app\model\order;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 订单操作日志表
diff --git a/niucloud/app/model/pay/Pay.php b/niucloud/app/model/pay/Pay.php
index 74ec968cf..d30e004e8 100644
--- a/niucloud/app/model/pay/Pay.php
+++ b/niucloud/app/model/pay/Pay.php
@@ -13,7 +13,7 @@ namespace app\model\pay;
use app\enum\order\OrderTypeEnum;
use app\enum\pay\PayEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 订单模型
diff --git a/niucloud/app/model/pay/PayChannel.php b/niucloud/app/model/pay/PayChannel.php
new file mode 100644
index 000000000..58fb2b66b
--- /dev/null
+++ b/niucloud/app/model/pay/PayChannel.php
@@ -0,0 +1,63 @@
+ 'timestamp',
+ 'refund_time' => 'timestamp',
+ 'close_time' => 'timestamp',
+ ];
+
+ /**
+ * 状态字段转化
+ * @param $value
+ * @return mixed
+ */
+ public function getStatusNameAttr($value, $data)
+ {
+ return RefundEnum::getStatus()[$data['status'] ?? ''] ?? '';
+ }
+
+ /**
+ * 支付方式字段转化
+ * @param $value
+ * @return mixed
+ */
+ public function getTypeNameAttr($value, $data)
+ {
+ return RefundEnum::getType()[$data['type'] ?? ''] ?? '';
+ }
+
+}
diff --git a/niucloud/app/model/pay/Transfer.php b/niucloud/app/model/pay/Transfer.php
index 84db30e5d..8a1b02741 100644
--- a/niucloud/app/model/pay/Transfer.php
+++ b/niucloud/app/model/pay/Transfer.php
@@ -11,9 +11,8 @@
namespace app\model\pay;
-use app\enum\pay\PayEnum;
use app\enum\pay\TransferEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 订单模型
diff --git a/niucloud/app/model/site/Site.php b/niucloud/app/model/site/Site.php
index 961018641..712ce8d9f 100644
--- a/niucloud/app/model/site/Site.php
+++ b/niucloud/app/model/site/Site.php
@@ -12,7 +12,8 @@
namespace app\model\site;
use app\enum\site\SiteEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
+use think\db\Query;
/**
* 站点模型
@@ -96,7 +97,22 @@ class Site extends BaseModel
}
-
+ /**
+ * 创建时间搜索器
+ * @param $value
+ */
+ public function searchCreateTimeAttr(Query $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('create_time', $start_time, $end_time);
+ } else if ($start_time > 0 && $end_time == 0) {
+ $query->where([ [ 'create_time', '>=', $start_time ] ]);
+ } else if ($start_time == 0 && $end_time > 0) {
+ $query->where([ [ 'create_time', '<=', $end_time ] ]);
+ }
+ }
}
diff --git a/niucloud/app/model/site/SiteGroup.php b/niucloud/app/model/site/SiteGroup.php
index 5995112ec..a721f1d47 100644
--- a/niucloud/app/model/site/SiteGroup.php
+++ b/niucloud/app/model/site/SiteGroup.php
@@ -11,7 +11,7 @@
namespace app\model\site;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 站点分组模型
diff --git a/niucloud/app/model/sys/SysAgreement.php b/niucloud/app/model/sys/SysAgreement.php
index 4a1f741e5..f744b34a6 100644
--- a/niucloud/app/model/sys/SysAgreement.php
+++ b/niucloud/app/model/sys/SysAgreement.php
@@ -12,7 +12,7 @@
namespace app\model\sys;
use app\enum\sys\AgreementEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 系统协议模型
diff --git a/niucloud/app/model/sys/SysArea.php b/niucloud/app/model/sys/SysArea.php
index c6217355e..50b69901a 100644
--- a/niucloud/app/model/sys/SysArea.php
+++ b/niucloud/app/model/sys/SysArea.php
@@ -11,7 +11,7 @@
namespace app\model\sys;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 地址模型
diff --git a/niucloud/app/model/sys/SysAttachment.php b/niucloud/app/model/sys/SysAttachment.php
index 3cb210a35..ca99ae06c 100644
--- a/niucloud/app/model/sys/SysAttachment.php
+++ b/niucloud/app/model/sys/SysAttachment.php
@@ -11,7 +11,7 @@
namespace app\model\sys;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 系统文件模型
diff --git a/niucloud/app/model/sys/SysAttachmentCategory.php b/niucloud/app/model/sys/SysAttachmentCategory.php
index b4fee65a1..948ef688e 100644
--- a/niucloud/app/model/sys/SysAttachmentCategory.php
+++ b/niucloud/app/model/sys/SysAttachmentCategory.php
@@ -11,7 +11,7 @@
namespace app\model\sys;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 附件分类模型
diff --git a/niucloud/app/model/sys/SysConfig.php b/niucloud/app/model/sys/SysConfig.php
index 33a1af44f..e65891e5e 100644
--- a/niucloud/app/model/sys/SysConfig.php
+++ b/niucloud/app/model/sys/SysConfig.php
@@ -11,7 +11,8 @@
namespace app\model\sys;
-use app\model\BaseModel;
+use core\base\BaseModel;
+
/**
* 系统设置模型
* Class SysConfig
diff --git a/niucloud/app/model/sys/SysCronTask.php b/niucloud/app/model/sys/SysCronTask.php
index d2ad4ae89..885599fa0 100644
--- a/niucloud/app/model/sys/SysCronTask.php
+++ b/niucloud/app/model/sys/SysCronTask.php
@@ -12,7 +12,7 @@
namespace app\model\sys;
use app\enum\sys\CronEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
use think\db\Query;
/**
diff --git a/niucloud/app/model/sys/SysMenu.php b/niucloud/app/model/sys/SysMenu.php
index 9f5a3d304..11337e4cb 100644
--- a/niucloud/app/model/sys/SysMenu.php
+++ b/niucloud/app/model/sys/SysMenu.php
@@ -13,8 +13,7 @@ namespace app\model\sys;
use app\enum\sys\MenuEnum;
use app\enum\sys\MenuTypeEnum;
-use app\model\BaseModel;
-use think\model\concern\SoftDelete;
+use core\base\BaseModel;
/**
* 菜单模型
diff --git a/niucloud/app/model/sys/SysMessage.php b/niucloud/app/model/sys/SysNotice.php
similarity index 89%
rename from niucloud/app/model/sys/SysMessage.php
rename to niucloud/app/model/sys/SysNotice.php
index eecd0c3cc..7cce34163 100644
--- a/niucloud/app/model/sys/SysMessage.php
+++ b/niucloud/app/model/sys/SysNotice.php
@@ -12,14 +12,14 @@
namespace app\model\sys;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 系统消息模型
* Class SysMessage
* @package app\model\sys
*/
-class SysMessage extends BaseModel
+class SysNotice extends BaseModel
{
/**
@@ -32,7 +32,7 @@ class SysMessage extends BaseModel
* 模型名称
* @var string
*/
- protected $name = 'sys_message';
+ protected $name = 'sys_notice';
}
diff --git a/niucloud/app/model/sys/SysMessageLog.php b/niucloud/app/model/sys/SysNoticeLog.php
similarity index 88%
rename from niucloud/app/model/sys/SysMessageLog.php
rename to niucloud/app/model/sys/SysNoticeLog.php
index 0177959dc..78be21be6 100644
--- a/niucloud/app/model/sys/SysMessageLog.php
+++ b/niucloud/app/model/sys/SysNoticeLog.php
@@ -11,9 +11,8 @@
namespace app\model\sys;
-use app\enum\sys\MessageEnum;
-use app\enum\sys\MessageTypeEnum;
-use app\model\BaseModel;
+use app\enum\notice\NoticeTypeEnum;
+use core\base\BaseModel;
use think\db\Query;
/**
@@ -21,7 +20,7 @@ use think\db\Query;
* Class SysMessageLog
* @package app\model\sys
*/
-class SysMessageLog extends BaseModel
+class SysNoticeLog extends BaseModel
{
/**
@@ -34,7 +33,7 @@ class SysMessageLog extends BaseModel
* 模型名称
* @var string
*/
- protected $name = 'sys_message_log';
+ protected $name = 'sys_notice_log';
protected $type = [
'send_time' => 'timestamp',
@@ -67,7 +66,7 @@ class SysMessageLog extends BaseModel
*/
public function getNameAttr($value,$data)
{
- $temp = MessageEnum::getMessage()[$data['key'] ?? ''] ?? '';
+ $temp = \app\enum\notice\NoticeEnum::getNotice()[$data['key'] ?? ''] ?? '';
return $temp['name'] ?? '';
}
@@ -77,9 +76,9 @@ class SysMessageLog extends BaseModel
* @param $data
* @return string
*/
- public function getMessageTypeNameAttr($value,$data)
+ public function getNoticeTypeNameAttr($value,$data)
{
- $temp = MessageTypeEnum::getType()[$data['message_type'] ?? ''] ?? '';
+ $temp = NoticeTypeEnum::getType()[$data['notice_type'] ?? ''] ?? '';
return $temp['name'] ?? '';
}
/**
diff --git a/niucloud/app/model/sys/SysMessageSmsLog.php b/niucloud/app/model/sys/SysNoticeSmsLog.php
similarity index 92%
rename from niucloud/app/model/sys/SysMessageSmsLog.php
rename to niucloud/app/model/sys/SysNoticeSmsLog.php
index cab05c2d0..7f880ce84 100644
--- a/niucloud/app/model/sys/SysMessageSmsLog.php
+++ b/niucloud/app/model/sys/SysNoticeSmsLog.php
@@ -11,16 +11,15 @@
namespace app\model\sys;
-use app\enum\sys\MessageEnum;
use app\enum\sys\SmsEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 系统短信消息发送记录
* Class SysMessageLog
* @package app\model\sys
*/
-class SysMessageSmsLog extends BaseModel
+class SysNoticeSmsLog extends BaseModel
{
/**
@@ -33,7 +32,7 @@ class SysMessageSmsLog extends BaseModel
* 模型名称
* @var string
*/
- protected $name = 'sys_message_sms_log';
+ protected $name = 'sys_notice_sms_log';
protected $type = [
'send_time' => 'timestamp',
@@ -66,7 +65,7 @@ class SysMessageSmsLog extends BaseModel
*/
public function getNameAttr($value,$data)
{
- $temp = MessageEnum::getMessage()[$data['key'] ?? ''];
+ $temp = \app\enum\notice\NoticeEnum::getNotice()[$data['key'] ?? ''];
return $temp['name'] ?? '';
}
diff --git a/niucloud/app/model/sys/SysRole.php b/niucloud/app/model/sys/SysRole.php
index 1fcab825f..33eab4be1 100644
--- a/niucloud/app/model/sys/SysRole.php
+++ b/niucloud/app/model/sys/SysRole.php
@@ -12,7 +12,7 @@
namespace app\model\sys;
use app\enum\sys\RoleStatusEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 系统角色模型
diff --git a/niucloud/app/model/sys/SysUser.php b/niucloud/app/model/sys/SysUser.php
index 7aa453e62..582ebd75f 100644
--- a/niucloud/app/model/sys/SysUser.php
+++ b/niucloud/app/model/sys/SysUser.php
@@ -12,8 +12,7 @@
namespace app\model\sys;
use app\enum\sys\UserEnum;
-use app\model\BaseModel;
-use think\db\Query;
+use core\base\BaseModel;
use think\model\concern\SoftDelete;
/**
diff --git a/niucloud/app/model/sys/SysUserLog.php b/niucloud/app/model/sys/SysUserLog.php
index 4fc7ac72b..761f345e8 100644
--- a/niucloud/app/model/sys/SysUserLog.php
+++ b/niucloud/app/model/sys/SysUserLog.php
@@ -11,7 +11,7 @@
namespace app\model\sys;
-use app\model\BaseModel;
+use core\base\BaseModel;
use think\db\Query;
/**
diff --git a/niucloud/app/model/sys/SysUserRole.php b/niucloud/app/model/sys/SysUserRole.php
index ebb0e63ab..5b344e545 100644
--- a/niucloud/app/model/sys/SysUserRole.php
+++ b/niucloud/app/model/sys/SysUserRole.php
@@ -11,8 +11,8 @@
namespace app\model\sys;
-use app\model\BaseModel;
use app\model\site\Site;
+use core\base\BaseModel;
/**
* 用户角色模型
diff --git a/niucloud/app/model/wechat/WechatFans.php b/niucloud/app/model/wechat/WechatFans.php
index e8f1e906f..1a379f9da 100644
--- a/niucloud/app/model/wechat/WechatFans.php
+++ b/niucloud/app/model/wechat/WechatFans.php
@@ -11,7 +11,7 @@
namespace app\model\wechat;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 微信粉丝模型
diff --git a/niucloud/app/model/wechat/WechatMedia.php b/niucloud/app/model/wechat/WechatMedia.php
index 33c07582f..852631cef 100644
--- a/niucloud/app/model/wechat/WechatMedia.php
+++ b/niucloud/app/model/wechat/WechatMedia.php
@@ -11,7 +11,7 @@
namespace app\model\wechat;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 微信素材管理
diff --git a/niucloud/app/model/wechat/WechatReply.php b/niucloud/app/model/wechat/WechatReply.php
index 69a3cbc91..df0f1a275 100644
--- a/niucloud/app/model/wechat/WechatReply.php
+++ b/niucloud/app/model/wechat/WechatReply.php
@@ -12,7 +12,7 @@
namespace app\model\wechat;
use app\enum\channel\ReplyEnum;
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
* 微信回复模型
diff --git a/niucloud/app/service/BaseService.php b/niucloud/app/service/BaseService.php
deleted file mode 100644
index 5918c4d8d..000000000
--- a/niucloud/app/service/BaseService.php
+++ /dev/null
@@ -1,134 +0,0 @@
-request = request();
- }
- /**
- * 分页列表参数(页码和每页多少条)
- * @return mixed
- */
- public function getPageParam(){
-
- $page = request()->params([
- ['page', 1],
- ['limit', 15]
- ]);
- validate(Page::class)
- ->check($page);
- return $page;
- }
-
- /**
- * 分页列表
- * @param array $where
- * @param string $field
- * @param string $order
- * @param int $page
- * @param int $limit
- * @param null $with //数组可以是数组 function($query) use ($with){$query->with($with);}
- * @param null $each //闭包匿名函数 function($item, $key){$item['nickname'] = 'think';return $item;}
- * @return mixed
- */
- public function getPageList(Model $model, array $where, string $field = '*', string $order = '', array $append = [], $with = null, $each = null){
- $page_params = $this->getPageParam();
- $page = $page_params['page'];
- $limit = $page_params['limit'];
-
- $list = $model->where($where)->when($append, function($query) use ($append){
- $query->append($append);
- })->when($with, function ($query) use($with){
- $query->with($with);
- })->field($field)->order($order)->paginate([
- 'list_rows' => $limit,
- 'page' => $page,
- ]);
- if(!empty($each)){
- $list = $list->each($each);
- }
- return $list->toArray();
- }
-
- /**
- * 分页数据查询,传入model(查询后结果)
- * @param $model BaseModel
- * @param $each
- * @return mixed
- */
- public function pageQuery($model, $each = null)
- {
- $page_params = $this->getPageParam();
- $page = $page_params['page'];
- $limit = $page_params['limit'];
- $list = $model->paginate([
- 'list_rows' => $limit,
- 'page' => $page,
- ]);
- if(!empty($each)){
- $list = $list->each($each);
- }
- return $list->toArray();
- }
-
- /**
- * 分页视图列表查询
- * @param Model $model
- * @param array $where
- * @param string $field
- * @param string $order
- * @param array $append
- * @param null $with
- * @param null $each
- * @return array
- * @throws \think\db\exception\DbException
- */
- public function getPageViewList(Model $model, array $where, string $field = '*', string $order = '', array $append = [], $with = null, $each = null){
- $page_params = $this->getPageParam();
- $page = $page_params['page'];
- $limit = $page_params['limit'];
-
- $list = $model->where($where)->when($append, function($query) use ($append){
- $query->append($append);
- })->when($with, function ($query) use($with){
- $query->withJoin($with);
- })->field($field)->order($order)->paginate([
- 'list_rows' => $limit,
- 'page' => $page,
- ]);
- if(!empty($each)){
- $list = $list->each($each);
- }
- return $list->toArray();
- }
-
-}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/addon/AddonService.php b/niucloud/app/service/admin/addon/AddonService.php
new file mode 100644
index 000000000..d3cc8342e
--- /dev/null
+++ b/niucloud/app/service/admin/addon/AddonService.php
@@ -0,0 +1,100 @@
+getLocalAddonList();
+ }
+
+ /**
+ * 安装插件
+ * @param string $addon
+ * @return true
+ */
+ public function install(string $addon)
+ {
+ return CoreAddonInstallService::instance($addon)->install();
+ }
+
+ /**
+ * 获取插件安装状态
+ * @param string $addon
+ * @return mixed
+ */
+ public function getInstallState(string $addon)
+ {
+ return CoreAddonInstallService::instance($addon)->getInstallState();
+ }
+
+ /**
+ * 卸载插件
+ * @param string $addon
+ * @return true
+ */
+ public function uninstall(string $addon)
+ {
+ return CoreAddonInstallService::instance($addon)->uninstall();
+ }
+
+ /**
+ * 获取插件列表
+ * @param array $where
+ * @param string $order
+ */
+ public function getPage(array $where = [])
+ {
+ return (new CoreAddonService())->getPage($where);
+ }
+
+ /**
+ * 获取插件信息
+ * @param int $id
+ */
+ public function getInfo(int $id)
+ {
+ return (new CoreAddonService())->getInfo($id);
+ }
+
+ /**
+ * 设置插件状态
+ * @param int $id
+ * @param int $status
+ * @return null
+ */
+ public function setStatus(int $id, int $status){
+ return (new CoreAddonService())->setStatus($id, $status);
+ }
+
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/addon/TerminalService.php b/niucloud/app/service/admin/addon/TerminalService.php
new file mode 100644
index 000000000..c8db550af
--- /dev/null
+++ b/niucloud/app/service/admin/addon/TerminalService.php
@@ -0,0 +1,341 @@
+ 'command-link-success',
+ // 执行成功
+ 'exec-success' => 'command-exec-success',
+ // 执行完成
+ 'exec-completed' => 'command-exec-completed',
+ // 执行出错
+ 'exec-error' => 'command-exec-error',
+ ];
+
+
+
+ /**
+ * 初始化
+ */
+ public static function instance()
+ {
+ if (is_null(self::$instance)) {
+ self::$instance = new static();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * 构造函数
+ */
+ public function __construct()
+ {
+ // 初始化日志文件
+ $outputDir = root_path() . 'runtime' . DIRECTORY_SEPARATOR . 'terminal';
+ $this->outputFile = $outputDir . DIRECTORY_SEPARATOR . 'exec.log';
+ if (!is_dir($outputDir)) {
+ mkdir($outputDir, 0755, true);
+ }
+ file_put_contents($this->outputFile, '');
+
+ /**
+ * 命令执行结果输出到文件而不是管道
+ * 因为输出到管道时有延迟,而文件虽然需要频繁读取和对比内容,但是输出实时的
+ */
+ $this->descriptorsPec = [0 => ['pipe', 'r'], 1 => ['file', $this->outputFile, 'w'], 2 => ['file', $this->outputFile, 'w']];
+ }
+
+ /**
+ * 获取命令
+ * @param string $key 命令key
+ * @return array|false
+ */
+ public static function getCommand(string $key)
+ {
+ if (!$key) {
+ return false;
+ }
+
+ $commands = Config::get('terminal.commands');
+ if (stripos($key, '.')) {
+ $key = explode('.', $key);
+ if (!array_key_exists($key[0], $commands) || !is_array($commands[$key[0]]) || !array_key_exists($key[1], $commands[$key[0]])) {
+ return false;
+ }
+ $command = $commands[$key[0]][$key[1]];
+ } else {
+ if (!array_key_exists($key, $commands)) {
+ return false;
+ }
+ $command = $commands[$key];
+ }
+ if (!is_array($command)) {
+ $command = [
+ 'cwd' => dirname(root_path()) . DIRECTORY_SEPARATOR,
+ 'command' => $command,
+ ];
+ } else {
+ $command = [
+ 'cwd' => dirname(root_path()) . DIRECTORY_SEPARATOR . $command['cwd'],
+ 'command' => $command['command'],
+ ];
+ }
+ $command['cwd'] = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $command['cwd']);
+ return $command;
+ }
+
+ public function exec(array $commands = [])
+ {
+ header('Content-Type: text/event-stream');
+ header('Cache-Control: no-cache');
+
+ if (ob_get_level()) ob_end_clean();
+ if (!ob_get_level()) ob_start();
+
+ $command = self::getCommand($this->commandKey);
+ if (!$command) {
+ $this->execError('The command was not allowed to be executed', true);
+ }
+
+ $this->beforeExecution();
+ $this->outputFlag('link-success');
+ $this->output('> ' . $command['command'], false);
+
+ $this->process = proc_open($command['command'], $this->descriptorsPec, $this->pipes, $command['cwd']);
+ if (!is_resource($this->process)) {
+ $this->execError('Failed to execute', true);
+ }
+ while ($this->getProcStatus()) {
+ $contents = file_get_contents($this->outputFile);
+ if (strlen($contents) && $this->outputContent != $contents) {
+ $newOutput = str_replace($this->outputContent, '', $contents);
+ if (preg_match('/\r\n|\r|\n/', $newOutput)) {
+ $this->output($newOutput);
+ $this->outputContent = $contents;
+ }
+ }
+ usleep(500000);
+ }
+ foreach ($this->pipes as $pipe) {
+ fclose($pipe);
+ }
+ proc_close($this->process);
+ $this->outputFlag('exec-completed');
+ }
+
+ public function getProcStatus(): bool
+ {
+ $status = proc_get_status($this->process);
+ if ($status['running']) {
+ $this->procStatus = 1;
+ return true;
+ } elseif ($this->procStatus === 1) {
+ $this->procStatus = 0;
+ $this->output('exitcode: ' . $status['exitcode']);
+ if ($status['exitcode'] === 0) {
+ if ($this->successCallback()) {
+ $this->outputFlag('exec-success');
+ } else {
+ $this->output('Error: Command execution succeeded, but callback execution failed');
+ $this->outputFlag('exec-error');
+ }
+ } else {
+ $this->outputFlag('exec-error');
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 输出 EventSource 数据
+ * @param string $data
+ * @param bool $callback
+ */
+ public function output(string $data, bool $callback = true)
+ {
+ $data = self::outputFilter($data);
+ $data = [
+ 'data' => $data,
+ 'uuid' => $this->uuid,
+ 'extend' => $this->extend,
+ 'key' => $this->commandKey,
+ ];
+ $data = json_encode($data, JSON_UNESCAPED_UNICODE);
+ if ($data) {
+ echo 'data: ' . $data . "\n\n";
+ if ($callback) $this->outputCallback($data);
+ @ob_flush();// 刷新浏览器缓冲区
+ }
+ }
+
+ /**
+ * 输出状态标记
+ * @param string $flag
+ */
+ public function outputFlag(string $flag)
+ {
+ $this->output($this->flag[$flag], false);
+ }
+
+ /**
+ * 输出后回调
+ */
+ public function outputCallback($data)
+ {
+
+ }
+
+ /**
+ * 成功后回调
+ * @return bool
+ */
+ public function successCallback(): bool
+ {
+ if (stripos($this->commandKey, '.')) {
+ $commandKeyArr = explode('.', $this->commandKey);
+ $commandPKey = $commandKeyArr[0] ?? '';
+ } else {
+ $commandPKey = $this->commandKey;
+ }
+ return true;
+ }
+
+ /**
+ * 执行前埋点
+ */
+ public function beforeExecution()
+ {
+/* if ($this->commandKey == 'test.pnpm') {
+ @unlink(root_path() . 'public' . DIRECTORY_SEPARATOR . 'npm-install-test' . DIRECTORY_SEPARATOR . 'pnpm-lock.yaml');
+ } elseif ($this->commandKey == 'web-install.pnpm') {
+ @unlink(root_path() . 'web' . DIRECTORY_SEPARATOR . 'pnpm-lock.yaml');
+ }*/
+ }
+
+ /**
+ * 输出过滤
+ */
+ public static function outputFilter($str)
+ {
+ $str = trim($str);
+ $preg = '/\[(.*?)m/i';
+ $str = preg_replace($preg, '', $str);
+ $str = str_replace(["\r\n", "\r", "\n"], "", $str);
+ return mb_convert_encoding($str, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5');
+ }
+
+ /**
+ * 执行错误
+ */
+ public function execError($error, $break = false)
+ {
+ $this->output('Error:' . $error);
+ $this->outputFlag('exec-error');
+ if ($break) $this->break();
+ }
+
+ /**
+ * 退出执行
+ */
+ public function break()
+ {
+ throw new CommonException(Response::create()->contentType('text/event-stream'));
+ }
+
+ /**
+ * 执行一个命令并以字符串的方式返回执行输出
+ * 代替 exec 使用,这样就只需要解除 proc_open 的函数禁用了
+ * @param $commandKey
+ * @return string | bool
+ */
+ public static function getOutputFromProc($commandKey)
+ {
+ if (!function_exists('proc_open') || !function_exists('proc_close')) {
+ return false;
+ }
+ $command = self::getCommand($commandKey);
+ if (!$command) {
+ return false;
+ }
+ $descriptorsPec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']];
+ $process = proc_open($command['command'], $descriptorsPec, $pipes, null, null);
+ if (is_resource($process)) {
+ $info = stream_get_contents($pipes[1]);
+ $info .= stream_get_contents($pipes[2]);
+ fclose($pipes[1]);
+ fclose($pipes[2]);
+ proc_close($process);
+ return self::outputFilter($info);
+ }
+ return '';
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/aliapp/AliappConfigService.php b/niucloud/app/service/admin/aliapp/AliappConfigService.php
index b10cf28c7..34c95d5cd 100644
--- a/niucloud/app/service/admin/aliapp/AliappConfigService.php
+++ b/niucloud/app/service/admin/aliapp/AliappConfigService.php
@@ -11,9 +11,8 @@
namespace app\service\admin\aliapp;
-use app\service\admin\BaseAdminService;
-
use app\service\core\aliapp\CoreAliappConfigService;
+use core\base\BaseAdminService;
/**
* 支付宝小程序设置
diff --git a/niucloud/app/service/admin/article/ArticleCategoryService.php b/niucloud/app/service/admin/article/ArticleCategoryService.php
index 49b14bd5a..406c1c62e 100644
--- a/niucloud/app/service/admin/article/ArticleCategoryService.php
+++ b/niucloud/app/service/admin/article/ArticleCategoryService.php
@@ -12,7 +12,7 @@
namespace app\service\admin\article;
use app\model\article\ArticleCategory;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 文章分类(栏目)服务层
@@ -83,7 +83,7 @@ class ArticleCategoryService extends BaseAdminService
* @param int $id
* @param array $data
*/
- public function update(int $id, array $data)
+ public function edit(int $id, array $data)
{
$data['update_time'] = time();
$this->model->where([['category_id', '=', $id], ['site_id', '=', $this->site_id]])->update($data);
diff --git a/niucloud/app/service/admin/article/ArticleService.php b/niucloud/app/service/admin/article/ArticleService.php
index ed48a0ad2..81fd60e92 100644
--- a/niucloud/app/service/admin/article/ArticleService.php
+++ b/niucloud/app/service/admin/article/ArticleService.php
@@ -12,7 +12,7 @@
namespace app\service\admin\article;
use app\model\article\Article;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 文章服务层
@@ -73,7 +73,7 @@ class ArticleService extends BaseAdminService
* @param int $id
* @param array $data
*/
- public function update(int $id, array $data)
+ public function edit(int $id, array $data)
{
$data[ 'update_time' ] = time();
$this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ])->update($data);
diff --git a/niucloud/app/service/admin/auth/AuthService.php b/niucloud/app/service/admin/auth/AuthService.php
index a5c5a4091..6713cceef 100644
--- a/niucloud/app/service/admin/auth/AuthService.php
+++ b/niucloud/app/service/admin/auth/AuthService.php
@@ -12,15 +12,15 @@
namespace app\service\admin\auth;
use app\Request;
-use app\service\admin\BaseAdminService;
use app\service\admin\site\SiteService;
use app\service\admin\site\SiteUserService;
use app\service\admin\sys\MenuService;
use app\service\admin\sys\RoleService;
use app\service\admin\user\UserRoleService;
use app\service\admin\user\UserService;
+use core\base\BaseAdminService;
+use core\exception\AuthException;
use Exception;
-use extend\exception\AuthException;
/**
* 用户服务层
@@ -38,7 +38,7 @@ class AuthService extends BaseAdminService
//没有当前站点的信息
if(!$this->getAuthRole($site_id))
{
- throw new AuthException(102006);
+ throw new AuthException('NO_SITE_PERMISSION');
}
//查询站点信息并返回
@@ -47,7 +47,7 @@ class AuthService extends BaseAdminService
//站点不存在
if(empty($site_info))
{
- throw new AuthException(102007);
+ throw new AuthException('SITE_NOT_EXIST');
}
$request->siteId($site_id);
$request->appType($site_info['app_type']);
@@ -77,7 +77,7 @@ class AuthService extends BaseAdminService
if(!empty($auth_role_list[$method]) && in_array($rule, $auth_role_list[$method]))
return true;
- throw new Exception(102000);
+ throw new Exception('NO_PERMISSION');
}
@@ -157,15 +157,15 @@ class AuthService extends BaseAdminService
* @param array $data
* @return true
*/
- public function updateAuth(array $data){
+ public function editAuth(array $data){
if(!empty($data['password'])){
//检测原始密码是否正确
$user = (new UserService())->find($this->uid);
if(!check_password($data['original_password'], $user->password))
- throw new AuthException(102009);
+ throw new AuthException('OLD_PASSWORD_ERROR');
}
- return (new UserService())->update($this->uid, $data);
+ return (new UserService())->edit($this->uid, $data);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/auth/AuthSiteService.php b/niucloud/app/service/admin/auth/AuthSiteService.php
index 49dc4e495..6ff51200e 100644
--- a/niucloud/app/service/admin/auth/AuthSiteService.php
+++ b/niucloud/app/service/admin/auth/AuthSiteService.php
@@ -13,8 +13,8 @@ namespace app\service\admin\auth;
use app\model\site\Site;
-use app\service\admin\BaseAdminService;
use app\service\admin\site\SiteService;
+use core\base\BaseAdminService;
use think\facade\Cache;
/**
diff --git a/niucloud/app/service/admin/auth/ConfigService.php b/niucloud/app/service/admin/auth/ConfigService.php
new file mode 100644
index 000000000..e8a467c3e
--- /dev/null
+++ b/niucloud/app/service/admin/auth/ConfigService.php
@@ -0,0 +1,67 @@
+getConfig($this->request->defaultSiteId(), ConfigKeyEnum::ADMIN_LOGIN)['value'] ?? [];
+ $config = [
+ 'is_captcha' => $info['is_captcha'] ?? 0,//是否启用验证码
+ 'is_site_captcha' => $info['is_site_captcha'] ?? 0,//是否启用站点验证码
+ 'bg' => $info['bg'] ?? '',//平台登录端 背景
+ 'site_bg' => $info['site_bg'] ?? '',//站点登录端 背景
+ ];
+ return $config;
+ }
+
+ /**
+ * 注册与登录设置
+ * @param $site_id
+ * @param $data
+ * @return SysConfig|bool|Model
+ */
+ public function setConfig(array $data)
+ {
+ $config = [
+ 'is_captcha' => $data['is_captcha'] ?? 0,//是否启用验证码
+ 'is_site_captcha' => $data['is_site_captcha'] ?? 0,//是否启用站点验证码
+ 'bg' => $data['bg'] ?? '',//平台登录端 背景
+ 'site_bg' => $data['site_bg'] ?? '',//站点登录端 背景
+ ];
+ (new CoreConfigService())->setConfig($this->site_id, ConfigKeyEnum::ADMIN_LOGIN, $config);
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/auth/LoginService.php b/niucloud/app/service/admin/auth/LoginService.php
index b492f2b38..69260ad45 100644
--- a/niucloud/app/service/admin/auth/LoginService.php
+++ b/niucloud/app/service/admin/auth/LoginService.php
@@ -12,15 +12,15 @@
namespace app\service\admin\auth;
use app\enum\sys\AppTypeEnum;
-use app\model\site\Site;
use app\model\sys\SysUser;
-use app\service\admin\BaseAdminService;
+use app\service\admin\captcha\CaptchaService;
use app\service\admin\site\SiteService;
use app\service\admin\user\UserRoleService;
use app\service\admin\user\UserService;
+use core\base\BaseAdminService;
+use core\exception\AuthException;
+use core\util\TokenAuth;
use Exception;
-use extend\exception\AuthException;
-use extend\util\TokenUtil;
/**
* 登录服务层
@@ -43,24 +43,52 @@ class LoginService extends BaseAdminService
* @return array|bool
* @throws AuthException
*/
- public function login(string $username, string $password)
+ public function login(string $username, string $password, string $app_type)
{
+
+ if(!in_array($app_type, array_keys(AppTypeEnum::getAppType()))) throw new AuthException('APP_TYPE_NOT_EXIST');
+
+ $config = (new ConfigService())->getConfig();
+ switch($app_type){
+ case AppTypeEnum::SITE:
+ $is_captcha = $config['is_site_captcha'];
+ break;
+ case AppTypeEnum::ADMIN:
+ $is_captcha = $config['is_captcha'];
+ break;
+ }
+ if($is_captcha == 1){
+ (new CaptchaService())->verification();
+ }
+
$user_service = new UserService();
$userinfo = $user_service->getUserInfoByUsername($username);
if (empty($userinfo)) return false;
if (!check_password($password, $userinfo->password)) return false;
if (!$userinfo->status) {
- throw new AuthException(101004);
+ throw new AuthException('USER_LOCK');
}
+
+ if($app_type == AppTypeEnum::ADMIN){
+ $default_site_id = $this->request->defaultSiteId();
+ $userrole = (new UserRoleService())->getUserRole($default_site_id, $userinfo->uid);
+ if(empty($userrole)) throw new AuthException('SITE_USER_CAN_NOT_LOGIN_IN_ADMIN');
+ }else if($app_type == AppTypeEnum::SITE){
+ $default_site_id = (new UserRoleService())->getUserDefaultSiteId($userinfo->uid);
+ if(!($default_site_id > 0)){
+ if(empty($userrole)) throw new AuthException('ADMIN_USER_CAN_NOT_LOGIN_IN_SITE');
+ }
+ }
//修改用户登录信息
$userinfo->last_time = time();
$userinfo->last_ip = app('request')->ip();
$userinfo->login_count++;
$userinfo->save();
//创建token
- $token_info = $this->createToken($userinfo);
+ $token_info = $this->createToken($userinfo, $app_type);
+
//查询权限以及菜单
$data = [
'token' => $token_info['token'],
@@ -69,7 +97,7 @@ class LoginService extends BaseAdminService
'uid' => $userinfo->uid,
'username' => $userinfo->username,
],
- 'site_id' => (new UserRoleService())->getUserDefaultSiteId($userinfo->uid),
+ 'site_id' => $default_site_id,
];
$data['site_info'] = (new SiteService())->getInfo($data['site_id']);
return $data;
@@ -90,10 +118,10 @@ class LoginService extends BaseAdminService
* @param $userinfo
* @return array
*/
- public function createToken(SysUser $userinfo)
+ public function createToken(SysUser $userinfo, string $app_type)
{
$expire_time = env('system.admin_token_expire_time') ?? 3600;
- $token_info = TokenUtil::createToken($userinfo->uid, 'admin', ['uid' => $userinfo->uid, 'username' => $userinfo->username], $expire_time);
+ $token_info = TokenAuth::createToken($userinfo->uid, AppTypeEnum::ADMIN, ['uid' => $userinfo->uid, 'username' => $userinfo->username], $expire_time);
return $token_info;
}
@@ -105,10 +133,10 @@ class LoginService extends BaseAdminService
public static function clearToken(int $uid, ?string $type = '', ?string $token = '')
{
if (empty($type)) {
- TokenUtil::clearToken($uid, 'admin', $token);//清除平台管理端的token
- TokenUtil::clearToken($uid, 'site', $token);//清除站点管理端的token
+ TokenAuth::clearToken($uid, AppTypeEnum::ADMIN, $token);//清除平台管理端的token
+// TokenAuth::clearToken($uid, AppTypeEnum::SITE, $token);//清除站点管理端的token
} else {
- TokenUtil::clearToken($uid, $type, $token);
+ TokenAuth::clearToken($uid, $type, $token);
}
}
@@ -123,21 +151,21 @@ class LoginService extends BaseAdminService
{
if (empty($token)) {
//定义专属于授权认证机制的错误响应, 定义专属语言包
- throw new AuthException(101001, 401);
+ throw new AuthException('MUST_LOGIN', 401);
}
//暴力操作,截停所有异常覆盖为token失效
try {
- $token_info = TokenUtil::parseToken($token, AppTypeEnum::ADMIN);
+ $token_info = TokenAuth::parseToken($token, AppTypeEnum::ADMIN);
} catch ( \Throwable $e ) {
// if(env('app_debug', false)){
// throw new AuthException($e->getMessage(), 401);
// }else{
- throw new AuthException(101002, 401);
+ throw new AuthException('LOGIN_EXPIRE', 401);
// }
}
if (!$token_info) {
- throw new AuthException(101001, 401);
+ throw new AuthException('MUST_LOGIN', 401);
}
//验证有效次数或过期时间
return $token_info;
diff --git a/niucloud/app/service/admin/captcha/CaptchaService.php b/niucloud/app/service/admin/captcha/CaptchaService.php
new file mode 100644
index 000000000..248557ebe
--- /dev/null
+++ b/niucloud/app/service/admin/captcha/CaptchaService.php
@@ -0,0 +1,51 @@
+create();
+ }
+
+ /**
+ * 核验验证码
+ * @return true
+ */
+ public function check(){
+ return (new CoreCaptchaImgService())->check();
+ }
+
+ public function verification(){
+ return (new CoreCaptchaImgService())->verification();
+ }
+
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/channel/H5Service.php b/niucloud/app/service/admin/channel/H5Service.php
index 55a4c8955..d068771ea 100644
--- a/niucloud/app/service/admin/channel/H5Service.php
+++ b/niucloud/app/service/admin/channel/H5Service.php
@@ -12,11 +12,9 @@
namespace app\service\admin\channel;
use app\enum\sys\ConfigKeyEnum;
-use app\service\admin\BaseAdminService;
-use app\service\admin\site\SiteService;
use app\service\core\channel\CoreH5Service;
use app\service\core\sys\CoreConfigService;
-use app\service\core\sys\CoreSysConfigService;
+use core\base\BaseAdminService;
/**
* 配置服务层
diff --git a/niucloud/app/service/admin/cron/CronService.php b/niucloud/app/service/admin/cron/CronService.php
index d73865f53..82c7d80c9 100644
--- a/niucloud/app/service/admin/cron/CronService.php
+++ b/niucloud/app/service/admin/cron/CronService.php
@@ -11,11 +11,8 @@
namespace app\service\admin\cron;
-use app\model\site\Site;
-use app\model\site\SiteGroup;
-use app\service\admin\BaseAdminService;
use app\service\core\cron\CoreCronService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
/**
* 自动任务服务层
diff --git a/niucloud/app/service/admin/diy/DiyConfigService.php b/niucloud/app/service/admin/diy/DiyConfigService.php
index 6bcf7a7db..7a374d725 100644
--- a/niucloud/app/service/admin/diy/DiyConfigService.php
+++ b/niucloud/app/service/admin/diy/DiyConfigService.php
@@ -11,8 +11,8 @@
namespace app\service\admin\diy;
-use app\service\admin\BaseAdminService;
use app\service\core\diy\CoreDiyConfigService;
+use core\base\BaseAdminService;
/**
* 自定义页面相关配置服务层
diff --git a/niucloud/app/service/admin/diy/DiyRouteService.php b/niucloud/app/service/admin/diy/DiyRouteService.php
index 221f35c86..de2608cfe 100644
--- a/niucloud/app/service/admin/diy/DiyRouteService.php
+++ b/niucloud/app/service/admin/diy/DiyRouteService.php
@@ -11,8 +11,9 @@
namespace app\service\admin\diy;
+use app\enum\diy\LinkEnum;
use app\model\diy\DiyRoute;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 自定义路由表服务层
@@ -28,6 +29,36 @@ class DiyRouteService extends BaseAdminService
$this->model = new DiyRoute();
}
+ /**
+ * 获取自定义路由列表
+ * @param array $where
+ * @return array
+ */
+ public function getList(array $where = [])
+ {
+ $link = LinkEnum::getLink();
+ $diy_route_list = [];
+ $sort = 0;
+ foreach ($link as $k => $v) {
+ if (!empty($v[ 'child_list' ])) {
+ foreach ($v[ 'child_list' ] as $ck => $cv) {
+ if (!empty($cv[ 'url' ])) {
+ if (empty($where[ 'title' ]) || ( !empty($where[ 'title' ]) && strpos($cv[ 'title' ], $where[ 'title' ]) !== false )) {
+ $diy_route_list[] = [
+ 'title' => $cv[ 'title' ],
+ 'name' => $cv[ 'name' ],
+ 'page' => $cv[ 'url' ],
+ 'is_share' => $cv[ 'is_share' ],
+ 'sort' => ++$sort
+ ];
+ }
+ }
+ }
+ }
+ }
+ return $diy_route_list;
+ }
+
/**
* 获取自定义路由表列表
* @param array $where
@@ -57,6 +88,18 @@ class DiyRouteService extends BaseAdminService
return $info;
}
+ /**
+ * 获取自定义路由表信息
+ * @param string $name
+ * @return array
+ */
+ public function getInfoByName(string $name)
+ {
+ $field = 'id,title,name,page,share,is_share,sort';
+ $info = $this->model->field($field)->where([ [ 'name', '=', $name ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray();
+ return $info;
+ }
+
/**
* 添加自定义路由表
* @param array $data
@@ -67,7 +110,6 @@ class DiyRouteService extends BaseAdminService
$data[ 'site_id' ] = $this->site_id;
$res = $this->model->create($data);
return $res->id;
-
}
/**
@@ -76,7 +118,7 @@ class DiyRouteService extends BaseAdminService
* @param array $data
* @return bool
*/
- public function update(int $id, array $data)
+ public function edit(int $id, array $data)
{
$this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ])->update($data);
return true;
@@ -95,13 +137,18 @@ class DiyRouteService extends BaseAdminService
/**
* 修改分享内容
- * @param int $id
* @param $data
* @return bool
*/
- public function modifyShare(int $id, $data)
+ public function modifyShare($data)
{
- $this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ])->update([ 'share' => $data[ 'share' ] ]);
+ $field = 'id';
+ $info = $this->model->field($field)->where([ [ 'name', '=', $data[ 'name' ] ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray();
+ if (!empty($info)) {
+ $this->model->where([ [ 'id', '=', $info[ 'id' ] ], [ 'site_id', '=', $this->site_id ] ])->update([ 'share' => $data[ 'share' ] ]);
+ } else {
+ $this->model->create($data);
+ }
return true;
}
diff --git a/niucloud/app/service/admin/diy/DiyService.php b/niucloud/app/service/admin/diy/DiyService.php
index 655d082e0..1250cf897 100644
--- a/niucloud/app/service/admin/diy/DiyService.php
+++ b/niucloud/app/service/admin/diy/DiyService.php
@@ -11,12 +11,12 @@
namespace app\service\admin\diy;
-use app\enum\diy\ComponentBasicsEnum;
-use app\enum\diy\ComponentTypeEnum;
+use app\enum\diy\ComponentEnum;
use app\enum\diy\LinkEnum;
use app\enum\diy\PageEnum;
use app\model\diy\Diy;
-use app\service\admin\BaseAdminService;
+use app\service\admin\sys\SystemService;
+use core\base\BaseAdminService;
use Exception;
use think\facade\Db;
@@ -113,7 +113,7 @@ class DiyService extends BaseAdminService
* @param array $data
* @return bool
*/
- public function update(int $id, array $data)
+ public function edit(int $id, array $data)
{
$data[ 'update_time' ] = time();
$this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ])->update($data);
@@ -175,7 +175,7 @@ class DiyService extends BaseAdminService
if (!empty($data)) {
if (isset($page_type[ $data[ 'type' ] ])) {
$page = $page_type[ $data[ 'type' ] ];
- $data[ 'type_name' ] = $page[ 'type_name' ];
+ $data[ 'type_name' ] = $page[ 'title' ];
$data[ 'page' ] = $page[ 'page' ];
}
} else {
@@ -186,9 +186,9 @@ class DiyService extends BaseAdminService
$page_route = '';
if (isset($page_type[ $params[ 'type' ] ])) {
$page = $page_type[ $params[ 'type' ] ];
- $name = $page[ 'type' ] == 'DIY_PAGE' ? 'DIY_PAGE_RANDOM_' . $time : $page[ 'type' ];
- $type = $page[ 'type' ];
- $type_name = $page[ 'type_name' ];
+ $name = $params[ 'type' ] == 'DIY_PAGE' ? 'DIY_PAGE_RANDOM_' . $time : $params[ 'type' ];
+ $type = $params[ 'type' ];
+ $type_name = $page[ 'title' ];
$page_route = $page[ 'page' ];
}
$data = [
@@ -202,13 +202,14 @@ class DiyService extends BaseAdminService
if (isset($page_type[ $params[ 'name' ] ])) {
$page = $page_type[ $params[ 'name' ] ];
- $data[ 'name' ] = $page[ 'type' ];
- $data[ 'title' ] = $page[ 'type_name' ];
- $data[ 'type_name' ] = $page[ 'type_name' ];
+ $data[ 'name' ] = $params[ 'type' ];
+ $data[ 'title' ] = $page[ 'title' ];
+ $data[ 'type_name' ] = $page[ 'title' ];
$data[ 'page' ] = $page[ 'page' ];
}
}
$data[ 'component' ] = $this->getComponentList($data[ 'name' ]);
+ $data[ 'domain_url' ] = ( new SystemService() )->getUrl();
return $data;
}
@@ -219,35 +220,25 @@ class DiyService extends BaseAdminService
*/
public function getComponentList(string $name = '')
{
- $type_list = ComponentTypeEnum::getType();
- $diy_view_utils = [];
- foreach ($type_list as $k => $v) {
- $value = [
- 'type' => $k,
- 'type_name' => $v,
- 'list' => []
- ];
- if ($k == 'BASICS') {
- $list = ComponentBasicsEnum::getComponent();
- if (!empty($list)) {
- $sort_arr = [];
- foreach ($list as $ck => $cv) {
- // 查询组件支持的页面
- if (count($cv[ 'support_page' ]) == 0 || in_array($name, $cv[ 'support_page' ])) {
- $sort_arr [] = $cv[ 'sort' ];
- unset($cv[ 'sort' ]);
- unset($cv[ 'support_page' ]);
- $value[ 'list' ][] = $cv;
- }
- }
-
- array_multisort($sort_arr, SORT_ASC, $value[ 'list' ]); //排序,根据num 排序
+ $data = ComponentEnum::getComponent();
+ foreach ($data as $k => $v) {
+ // 查询组件支持的页面
+ $sort_arr = [];
+ foreach ($v[ 'list' ] as $ck => $cv) {
+ $support_page = $cv[ 'support_page' ];
+ if (!( count($support_page) == 0 || in_array($name, $support_page) )) {
+ unset($data[ $k ][ 'list' ][ $ck ]);
+ continue;
}
+
+ $sort_arr [] = $cv[ 'sort' ];
+ unset($data[ $k ][ 'list' ][ $ck ][ 'sort' ]);
+ unset($data[ $k ][ 'list' ][ $ck ][ 'support_page' ]);
}
- $diy_view_utils[] = $value;
+ array_multisort($sort_arr, SORT_ASC, $data[ $k ][ 'list' ]); //排序,根据 sort 排序
}
- return $diy_view_utils;
+ return $data;
}
/**
diff --git a/niucloud/app/service/admin/file/StorageConfigService.php b/niucloud/app/service/admin/file/StorageConfigService.php
index 81d1cc3d9..121317c77 100644
--- a/niucloud/app/service/admin/file/StorageConfigService.php
+++ b/niucloud/app/service/admin/file/StorageConfigService.php
@@ -12,10 +12,10 @@
namespace app\service\admin\file;
use app\enum\sys\StorageEnum;
-use app\service\admin\BaseAdminService;
-use app\service\core\file\CoreStorageService;
+use app\service\core\upload\CoreStorageService;
use app\service\core\sys\CoreConfigService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\Response;
/**
@@ -47,7 +47,7 @@ class StorageConfigService extends BaseAdminService
public function getStorageConfig(string $storage_type)
{
$storage_type_list = StorageEnum::getType();
- if(!array_key_exists($storage_type, $storage_type_list)) throw new AdminException(203005);
+ if(!array_key_exists($storage_type, $storage_type_list)) throw new AdminException('OSS_TYPE_NOT_EXIST');
$info = (new CoreConfigService())->getConfig($this->site_id, 'STORAGE');
if(empty($info))
{
@@ -80,7 +80,7 @@ class StorageConfigService extends BaseAdminService
public function setStorageConfig(string $storage_type, array $data)
{
$storage_type_list = StorageEnum::getType();
- if(!array_key_exists($storage_type, $storage_type_list)) throw new AdminException(203005);
+ if(!array_key_exists($storage_type, $storage_type_list)) throw new AdminException('OSS_TYPE_NOT_EXIST');
$info = (new CoreConfigService())->getConfig($this->site_id, 'STORAGE');
if(empty($info))
{
diff --git a/niucloud/app/service/admin/file/UploadConfigService.php b/niucloud/app/service/admin/file/UploadConfigService.php
index 9ae3c7450..bb18ec8a4 100644
--- a/niucloud/app/service/admin/file/UploadConfigService.php
+++ b/niucloud/app/service/admin/file/UploadConfigService.php
@@ -12,8 +12,8 @@
namespace app\service\admin\file;
use app\model\sys\SysConfig;
-use app\service\admin\BaseAdminService;
-use app\service\core\file\CoreUploadConfigService;
+use app\service\core\upload\CoreUploadConfigService;
+use core\base\BaseAdminService;
use think\Model;
use think\Response;
diff --git a/niucloud/app/service/admin/file/UploadService.php b/niucloud/app/service/admin/file/UploadService.php
index 32df58744..91b608f50 100644
--- a/niucloud/app/service/admin/file/UploadService.php
+++ b/niucloud/app/service/admin/file/UploadService.php
@@ -11,10 +11,10 @@
namespace app\service\admin\file;
-use app\enum\channel\CertEnum;
-use app\service\admin\BaseAdminService;
-use app\service\core\file\CoreUploadService;
-use extend\exception\UploadFileException;
+use app\enum\sys\FileEnum;
+use app\service\core\upload\CoreUploadService;
+use core\base\BaseAdminService;
+use core\exception\UploadFileException;
/**
* 用户服务层
@@ -57,60 +57,11 @@ class UploadService extends BaseAdminService
* @param bool $is_local
* @return array
*/
- public function document($file,bool $is_local = false){
- $dir = $this->root_path.'/'.'document'.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');
+ public function document($file, string $type,bool $is_local = false){
+ if(!in_array($type, FileEnum::getSceneType()))
+ throw new UploadFileException('CERT_TYPE_ERROR');
+ $dir = $this->root_path.'/document/'.$type.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');
$core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $this->site_id, $dir, $is_local);
+ return $core_upload_service->document($file, $this->site_id, $type, $dir, true, true);
}
-
-
- /**
- * 微信相关证书
- * @param $file
- * @param bool $is_local
- * @return array
- */
- public function cert($file, string $type){
- if(!in_array($type, CertEnum::getCertType()))
- throw new UploadFileException(203008);
- $dir = $this->root_path.'/cert/'.$type.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');
- $core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $this->site_id, $dir, true, false);
- }
-
- /**
- * 小程序证书
- * @param $file
- * @return array
- */
- public function weapp($file){
- $dir = $this->root_path.'/cert/'.'weapp'.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');
- $core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $this->site_id, $dir, true, false);
- }
-
-
- /**
- * 微信支付相关证书
- * @param $file
- * @return array
- */
- public function wechatpay($file){
- $dir = $this->root_path.'/cert/'.'wechatpay'.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');
- $core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $this->site_id, $dir, true, false);
- }
-
- /**
- * 阿里云相关证书
- * @param $file
- * @return array
- */
- public function aliyun($file){
- $dir = $this->root_path.'/cert/'.'aliyun'.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');
- $core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $this->site_id, $dir, true, false);
- }
-
-
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/generator/GenerateService.php b/niucloud/app/service/admin/generator/GenerateService.php
index ffb3642c0..0d86c2713 100644
--- a/niucloud/app/service/admin/generator/GenerateService.php
+++ b/niucloud/app/service/admin/generator/GenerateService.php
@@ -11,17 +11,17 @@
namespace app\service\admin\generator;
-use think\facade\Db;
-use think\Model;
-use think\model\relation\HasOne;
use app\model\generator\GenerateColumn;
use app\model\generator\GenerateTable;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use Exception;
-use extend\exception\AdminException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
+use think\facade\Db;
+use think\Model;
+use think\model\relation\HasOne;
/**
@@ -81,7 +81,7 @@ class GenerateService extends BaseAdminService
$tables = Db::query($sql);
$table_info = $tables[0] ?? [];
- if(empty($table_info)) throw new AdminException(100014);
+ if(empty($table_info)) throw new AdminException('DATA_NOT_EXIST');
$table_name = str_replace($tablePrefix, '', $table_info['Name']);
$fields = Db::name($table_name)->getFields();
@@ -140,7 +140,7 @@ class GenerateService extends BaseAdminService
* @param array $params
* @return bool
*/
- public function update(int $id, array $params)
+ public function edit(int $id, array $params)
{
Db::startTrans();
try {
diff --git a/niucloud/app/service/admin/generator/core/AdminApiRouteGenerator.php b/niucloud/app/service/admin/generator/core/AdminApiRouteGenerator.php
index 9d28c924e..f37a68059 100644
--- a/niucloud/app/service/admin/generator/core/AdminApiRouteGenerator.php
+++ b/niucloud/app/service/admin/generator/core/AdminApiRouteGenerator.php
@@ -117,7 +117,7 @@ class AdminApiRouteGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'php/app/adminapi/route/';
+ $dir = $this->outDir . 'niucloud/app/adminapi/route/';
$this->checkDir($dir);
return $dir;
}
diff --git a/niucloud/app/service/admin/generator/core/ControllerGenerator.php b/niucloud/app/service/admin/generator/core/ControllerGenerator.php
index 63e96d031..92e7d3d62 100644
--- a/niucloud/app/service/admin/generator/core/ControllerGenerator.php
+++ b/niucloud/app/service/admin/generator/core/ControllerGenerator.php
@@ -155,7 +155,7 @@ class ControllerGenerator extends BaseGenerator
*/
public function getUse()
{
- $tpl = "use app\\adminapi\\controller\\BaseAdminController;" . PHP_EOL;
+ $tpl = "use core\\base\\BaseAdminController;" . PHP_EOL;
if (!empty($this->moduleName)) {
$tpl .= "use app\\service\\admin\\" . $this->moduleName . "\\" . $this->getUCaseName() . "Service;" . PHP_EOL ;
} else {
@@ -212,7 +212,7 @@ class ControllerGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'php/app/adminapi/controller/';
+ $dir = $this->outDir . 'niucloud/app/adminapi/controller/';
$this->checkDir($dir);
if (!empty($this->moduleName)) {
$dir .= $this->moduleName . '/';
diff --git a/niucloud/app/service/admin/generator/core/ModelGenerator.php b/niucloud/app/service/admin/generator/core/ModelGenerator.php
index 73e7ae511..330a7e46d 100644
--- a/niucloud/app/service/admin/generator/core/ModelGenerator.php
+++ b/niucloud/app/service/admin/generator/core/ModelGenerator.php
@@ -178,7 +178,7 @@ class ModelGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'php/app/model/';
+ $dir = $this->outDir . 'niucloud/app/model/';
$this->checkDir($dir);
if (!empty($this->moduleName)) {
$dir .= $this->moduleName . '/';
diff --git a/niucloud/app/service/admin/generator/core/ServiceGenerator.php b/niucloud/app/service/admin/generator/core/ServiceGenerator.php
index 0568bd05e..fd07d4e50 100644
--- a/niucloud/app/service/admin/generator/core/ServiceGenerator.php
+++ b/niucloud/app/service/admin/generator/core/ServiceGenerator.php
@@ -154,7 +154,7 @@ class ServiceGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'php/app/service/admin/';
+ $dir = $this->outDir . 'niucloud/app/service/admin/';
$this->checkDir($dir);
if (!empty($this->moduleName)) {
$dir .= $this->moduleName . '/';
diff --git a/niucloud/app/service/admin/generator/core/ValidateGenerator.php b/niucloud/app/service/admin/generator/core/ValidateGenerator.php
index d719f8e0f..3a93ccafb 100644
--- a/niucloud/app/service/admin/generator/core/ValidateGenerator.php
+++ b/niucloud/app/service/admin/generator/core/ValidateGenerator.php
@@ -98,7 +98,7 @@ class ValidateGenerator extends BaseGenerator
}
$content .= '"add" => ['.implode(',', $add_arr).'],'.PHP_EOL;
- $content .= '"update" => ['.implode(',', $update_arr).']';
+ $content .= '"edit" => ['.implode(',', $update_arr).']';
$content = $this->setBlankSpace($content, " ");
return '['.PHP_EOL.$content.PHP_EOL.' ]';
}
@@ -163,7 +163,7 @@ class ValidateGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'php/app/validate/';
+ $dir = $this->outDir . 'niucloud/app/validate/';
$this->checkDir($dir);
if (!empty($this->moduleName)) {
$dir .= $this->moduleName . '/';
diff --git a/niucloud/app/service/admin/generator/core/WebApiGenerator.php b/niucloud/app/service/admin/generator/core/WebApiGenerator.php
index dd83e7a8c..49c2162c8 100644
--- a/niucloud/app/service/admin/generator/core/WebApiGenerator.php
+++ b/niucloud/app/service/admin/generator/core/WebApiGenerator.php
@@ -73,7 +73,7 @@ class WebApiGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'vue/src/api/';
+ $dir = $this->outDir . 'admin/src/api/';
$this->checkDir($dir);
return $dir;
}
diff --git a/niucloud/app/service/admin/generator/core/WebEditGenerator.php b/niucloud/app/service/admin/generator/core/WebEditGenerator.php
index b6c3b98f4..2f76c04f4 100644
--- a/niucloud/app/service/admin/generator/core/WebEditGenerator.php
+++ b/niucloud/app/service/admin/generator/core/WebEditGenerator.php
@@ -239,7 +239,7 @@ class WebEditGenerator extends BaseGenerator
if($this->table['edit_type'] != 1) {
return '';
}
- $dir = $this->outDir . 'vue/src/views/' . $this->moduleName . '/';
+ $dir = $this->outDir . 'admin/src/views/' . $this->moduleName . '/';
$dir .= 'components/';
$this->checkDir($dir);
diff --git a/niucloud/app/service/admin/generator/core/WebEditLangGenerator.php b/niucloud/app/service/admin/generator/core/WebEditLangGenerator.php
index be825c9fc..51695d371 100644
--- a/niucloud/app/service/admin/generator/core/WebEditLangGenerator.php
+++ b/niucloud/app/service/admin/generator/core/WebEditLangGenerator.php
@@ -92,7 +92,7 @@ class WebEditLangGenerator extends BaseGenerator
if($this->table['edit_type'] != 2) {
return '';
}
- $dir = $this->outDir . 'vue/src/lang/zh-cn/';
+ $dir = $this->outDir . 'admin/src/lang/zh-cn/';
$this->checkDir($dir);
return $dir;
}
diff --git a/niucloud/app/service/admin/generator/core/WebEditPageGenerator.php b/niucloud/app/service/admin/generator/core/WebEditPageGenerator.php
index 2bc7b7aec..0dfbd7796 100644
--- a/niucloud/app/service/admin/generator/core/WebEditPageGenerator.php
+++ b/niucloud/app/service/admin/generator/core/WebEditPageGenerator.php
@@ -245,7 +245,7 @@ class WebEditPageGenerator extends BaseGenerator
if($this->table['edit_type'] != 2) {
return '';
}
- $dir = $this->outDir . 'vue/src/views/' . $this->moduleName . '/';
+ $dir = $this->outDir . 'admin/src/views/' . $this->moduleName . '/';
$this->checkDir($dir);
diff --git a/niucloud/app/service/admin/generator/core/WebIndexGenerator.php b/niucloud/app/service/admin/generator/core/WebIndexGenerator.php
index 73591b86b..577953972 100644
--- a/niucloud/app/service/admin/generator/core/WebIndexGenerator.php
+++ b/niucloud/app/service/admin/generator/core/WebIndexGenerator.php
@@ -312,7 +312,7 @@ class WebIndexGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'vue/src/views/' . $this->moduleName . '/';
+ $dir = $this->outDir . 'admin/src/views/' . $this->moduleName . '/';
$this->checkDir($dir);
return $dir;
diff --git a/niucloud/app/service/admin/generator/core/WebLangGenerator.php b/niucloud/app/service/admin/generator/core/WebLangGenerator.php
index 4d1c0ca94..7f3def4eb 100644
--- a/niucloud/app/service/admin/generator/core/WebLangGenerator.php
+++ b/niucloud/app/service/admin/generator/core/WebLangGenerator.php
@@ -87,7 +87,7 @@ class WebLangGenerator extends BaseGenerator
*/
public function getRuntimeOutDir()
{
- $dir = $this->outDir . 'vue/src/lang/zh-cn/';
+ $dir = $this->outDir . 'admin/src/lang/zh-cn/';
$this->checkDir($dir);
return $dir;
}
diff --git a/niucloud/app/service/admin/generator/vm/controller.vm b/niucloud/app/service/admin/generator/vm/controller.vm
index a23114762..b965bb004 100644
--- a/niucloud/app/service/admin/generator/vm/controller.vm
+++ b/niucloud/app/service/admin/generator/vm/controller.vm
@@ -48,7 +48,7 @@ class {UCASE_CLASS_NAME} extends BaseAdminController
$data = $this->request->params({ADD_FILED_NOTE});
$this->validate($data, '{VALIDATE}.add');
$id = (new {UCASE_NAME}Service())->add($data);
- return success(100011, ['id' => $id]);
+ return success('ADD_SUCCESS', ['id' => $id]);
}
/**
@@ -56,11 +56,11 @@ class {UCASE_CLASS_NAME} extends BaseAdminController
* @param $id {NOTES}id
* @return \think\Response
*/
- public function update($id){
+ public function edit($id){
$data = $this->request->params({EDIT_FILED_NOTE});
- $this->validate($data, '{VALIDATE}.update');
- (new {UCASE_NAME}Service())->update($id, $data);
- return success(100004);
+ $this->validate($data, '{VALIDATE}.edit');
+ (new {UCASE_NAME}Service())->edit($id, $data);
+ return success('EDIT_SUCCESS');
}
/**
@@ -70,7 +70,7 @@ class {UCASE_CLASS_NAME} extends BaseAdminController
*/
public function del(int $id){
(new {UCASE_NAME}Service())->del($id);
- return success(100003);
+ return success('DELETE_SUCCESS');
}
diff --git a/niucloud/app/service/admin/generator/vm/model.vm b/niucloud/app/service/admin/generator/vm/model.vm
index 3a42b3f51..f70ba1dc3 100644
--- a/niucloud/app/service/admin/generator/vm/model.vm
+++ b/niucloud/app/service/admin/generator/vm/model.vm
@@ -11,7 +11,7 @@
{NAMESPACE}
-use app\model\BaseModel;
+use core\base\BaseModel;
/**
diff --git a/niucloud/app/service/admin/generator/vm/service.vm b/niucloud/app/service/admin/generator/vm/service.vm
index dea745ca5..1ac64ff39 100644
--- a/niucloud/app/service/admin/generator/vm/service.vm
+++ b/niucloud/app/service/admin/generator/vm/service.vm
@@ -12,7 +12,7 @@
{NAMESPACE}
{USE}
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* {NOTES}服务层
@@ -75,7 +75,7 @@ class {UCASE_NAME}Service extends BaseAdminService
* @param array $data
* @return bool
*/
- public function update(int $id, array $data)
+ public function edit(int $id, array $data)
{
$this->model->where([['{PK}', '=', $id], ['site_id', '=', $this->site_id]])->update($data);
diff --git a/niucloud/app/service/admin/generator/vm/web_api.vm b/niucloud/app/service/admin/generator/vm/web_api.vm
index 2da958821..abc6bd53b 100644
--- a/niucloud/app/service/admin/generator/vm/web_api.vm
+++ b/niucloud/app/service/admin/generator/vm/web_api.vm
@@ -35,7 +35,7 @@ export function add{UCASE_NAME}(params: Record) {
* @param params
* @returns
*/
-export function update{UCASE_NAME}(params: Record) {
+export function edit{UCASE_NAME}(params: Record) {
return request.put(`{MODULE_NAME}/{LCASE_CLASS_NAME}/${params.{PK}}`, params, { showErrorMessage: true, showSuccessMessage: true })
}
diff --git a/niucloud/app/service/admin/generator/vm/web_edit.vm b/niucloud/app/service/admin/generator/vm/web_edit.vm
index 423c7c5b6..c4c56b8ae 100644
--- a/niucloud/app/service/admin/generator/vm/web_edit.vm
+++ b/niucloud/app/service/admin/generator/vm/web_edit.vm
@@ -20,7 +20,7 @@
import { ref, reactive, computed } from 'vue'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
-import { add{UCASE_NAME}, update{UCASE_NAME}, get{UCASE_NAME}Info } from '@/api/{MODULE_NAME}'
+import { add{UCASE_NAME}, edit{UCASE_NAME}, get{UCASE_NAME}Info } from '@/api/{MODULE_NAME}'
let showDialog = ref(false)
const loading = ref(false)
diff --git a/niucloud/app/service/admin/generator/vm/web_edit_page.vm b/niucloud/app/service/admin/generator/vm/web_edit_page.vm
index 317ef5b27..021d59ef1 100644
--- a/niucloud/app/service/admin/generator/vm/web_edit_page.vm
+++ b/niucloud/app/service/admin/generator/vm/web_edit_page.vm
@@ -18,7 +18,7 @@
import { ref, reactive, computed } from 'vue'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
-import { get{UCASE_NAME}Info,add{UCASE_NAME},update{UCASE_NAME} } from '@/api/{MODULE_NAME}';
+import { get{UCASE_NAME}Info,add{UCASE_NAME},edit{UCASE_NAME} } from '@/api/{MODULE_NAME}';
import { useRoute } from 'vue-router'
const router = useRoute()
diff --git a/niucloud/app/service/admin/install/InstallArticleService.php b/niucloud/app/service/admin/install/InstallArticleService.php
index 1273b91f5..6f2ec419e 100644
--- a/niucloud/app/service/admin/install/InstallArticleService.php
+++ b/niucloud/app/service/admin/install/InstallArticleService.php
@@ -13,7 +13,7 @@ namespace app\service\admin\install;
use app\model\article\Article;
use app\model\article\ArticleCategory;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 系统安装
diff --git a/niucloud/app/service/admin/install/InstallDiyService.php b/niucloud/app/service/admin/install/InstallDiyService.php
index a1ab92564..0364d6614 100644
--- a/niucloud/app/service/admin/install/InstallDiyService.php
+++ b/niucloud/app/service/admin/install/InstallDiyService.php
@@ -11,10 +11,8 @@
namespace app\service\admin\install;
-use app\enum\diy\LinkEnum;
use app\model\diy\Diy;
-use app\model\diy\DiyRoute;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 系统安装
@@ -38,31 +36,6 @@ class InstallDiyService extends BaseAdminService
*/
public function installDiy(array $params = [])
{
- $link = LinkEnum::getLink();
-
- $diy_route_list = [];
- $sort = 0;
- foreach ($link as $k => $v) {
- if (!empty($v[ 'child_list' ])) {
- foreach ($v[ 'child_list' ] as $ck => $cv) {
- if (!empty($cv[ 'url' ])) {
- $diy_route_list[] = [
- 'title' => $cv[ 'title' ],
- 'name' => $cv[ 'name' ],
- 'page' => $cv[ 'url' ],
- 'is_share' => $cv[ 'is_share' ],
- 'sort' => $sort
- ];
- $sort++;
- }
- }
- }
- }
-
- $diy_route = new DiyRoute();
-// $diy_route->where([ [ 'id', '>', 0 ] ])->delete();
- $diy_route->replace()->insertAll($diy_route_list);
-
$diy = new Diy();
$page_data = [
@@ -241,14 +214,6 @@ class InstallDiyService extends BaseAdminService
"maxCount" => 0,
"height" => 20
],
- [
- "path" => "edit-horz-blank",
- "id" => "39dehg9v8u00",
- "componentName" => "HorzBlank",
- "componentTitle" => "辅助空白",
- "maxCount" => 0,
- "height" => 20
- ],
[
"path" => "edit-graphic-nav",
"id" => "62b7d7hl4ok",
diff --git a/niucloud/app/service/admin/install/InstallSystemService.php b/niucloud/app/service/admin/install/InstallSystemService.php
index 7b39e5f22..ae2104216 100644
--- a/niucloud/app/service/admin/install/InstallSystemService.php
+++ b/niucloud/app/service/admin/install/InstallSystemService.php
@@ -11,13 +11,11 @@
namespace app\service\admin\install;
-use app\enum\install\InstallAdminMenuEnum;
-use app\enum\install\InstallSiteMenuEnum;
use app\enum\sys\AppTypeEnum;
use app\model\sys\SysMenu;
-use app\service\admin\BaseAdminService;
use app\service\admin\sys\MenuService;
-use extend\util\ConfigUtil;
+use app\service\core\menu\CoreMenuService;
+use core\base\BaseAdminService;
use think\facade\Cache;
/**
@@ -46,13 +44,14 @@ class InstallSystemService extends BaseAdminService
{
$sys_menu = new SysMenu();
- //平台菜单
+ //系统菜单
$admin_menus = $this->loadMenu(AppTypeEnum::ADMIN);
$site_menus = $this->loadMenu(AppTypeEnum::SITE);
$menus = array_merge($admin_menus, $site_menus);
- $sys_menu->where([['id', '>', 0]])->delete();
+ $sys_menu->where([ [ 'id', '>', 0 ] ])->delete();
$sys_menu->replace()->insertAll($menus);
-
+ //插件菜单
+ (new CoreMenuService())->refreshAllAddonMenu();
// 清除缓存
Cache::tag(MenuService::$cache_tag_name)->clear();
return true;
@@ -65,11 +64,8 @@ class InstallSystemService extends BaseAdminService
public function loadMenu($app_type)
{
//加载系统
- $system_tree = include root_path().str_replace('/', DIRECTORY_SEPARATOR, "app/enum/install/menu/system/".$app_type.".php");
- //加载扩展插件菜单
- $config_util = new ConfigUtil(root_path().str_replace('/', DIRECTORY_SEPARATOR, "app/enum/install/menu/plugin/".$app_type), $system_tree);
- $tree = $config_util->loadConfig();
- $this->menuTreeToList($tree, '',$app_type);
+ $system_tree = include root_path() . str_replace('/', DIRECTORY_SEPARATOR, "app/enum/menu/" . $app_type . ".php");
+ $this->menuTreeToList($system_tree, '', $app_type);
$menu_list = $this->menu_list;
$this->menu_list = [];
return $menu_list;
@@ -86,27 +82,27 @@ class InstallSystemService extends BaseAdminService
if (is_array($tree)) {
foreach ($tree as $key => $value) {
$item = [
- 'menu_name' => $value['menu_name'],
- 'menu_key' => $value['menu_key'],
+ 'menu_name' => $value[ 'menu_name' ],
+ 'menu_key' => $value[ 'menu_key' ],
'app_type' => $app_type,
- 'parent_key' => $value['parent_key'] ?? $parent_key,
- 'menu_type' => $value['menu_type'],
- 'icon' => $value['icon'] ?? '',
- 'api_url' => $value['api_url'] ?? '',
- 'router_path' => $value['router_path'] ?? '',
- 'view_path' => $value['view_path'] ?? '',
- 'methods' => $value['methods'] ?? '',
- 'sort' => $value['sort'] ?? '',
+ 'parent_key' => $value[ 'parent_key' ] ?? $parent_key,
+ 'menu_type' => $value[ 'menu_type' ],
+ 'icon' => $value[ 'icon' ] ?? '',
+ 'api_url' => $value[ 'api_url' ] ?? '',
+ 'router_path' => $value[ 'router_path' ] ?? '',
+ 'view_path' => $value[ 'view_path' ] ?? '',
+ 'methods' => $value[ 'methods' ] ?? '',
+ 'sort' => $value[ 'sort' ] ?? '',
'status' => 1,
- 'is_show' => $value['is_show'] ?? 1,
- 'en_menu_name' => $value['en_menu_name'] ?? '',
+ 'is_show' => $value[ 'is_show' ] ?? 1,
+ 'en_menu_name' => $value[ 'en_menu_name' ] ?? '',
];
$refer = $value;
if (isset($refer[ 'children' ])) {
unset($refer[ 'children' ]);
array_push($this->menu_list, $item);
$p_key = $refer[ 'menu_key' ];
- $this->menuTreeToList($value[ 'children' ],$p_key, $app_type);
+ $this->menuTreeToList($value[ 'children' ], $p_key, $app_type);
} else {
array_push($this->menu_list, $item);
}
diff --git a/niucloud/app/service/admin/member/MemberAccountService.php b/niucloud/app/service/admin/member/MemberAccountService.php
index 6520810b2..35f2474ed 100644
--- a/niucloud/app/service/admin/member/MemberAccountService.php
+++ b/niucloud/app/service/admin/member/MemberAccountService.php
@@ -12,10 +12,11 @@
namespace app\service\admin\member;
use app\enum\member\MemberAccountEnum;
+use app\model\member\Member;
use app\model\member\MemberAccountLog;
-use app\service\admin\BaseAdminService;
use app\service\core\member\CoreMemberAccountService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
/**
* 会员账户流水服务层(会员个人账户通过会员服务层查询)
@@ -77,6 +78,11 @@ class MemberAccountService extends BaseAdminService
return $res;
}
+ public function adjustMoney(array $data)
+ {
+ $res = (new CoreMemberAccountService())->addLog($this->site_id, $data['member_id'], MemberAccountEnum::MONEY, $data['account_data'], 'adjust', $data['memo'], 0);
+ return $res;
+ }
/**
* 获取账户类型的变动方式
* @param $account_type
@@ -84,13 +90,32 @@ class MemberAccountService extends BaseAdminService
*/
public function getFromType($account_type)
{
- if(!array_key_exists($account_type, MemberAccountEnum::getType())) throw new AdminException(301007);
+ if(!array_key_exists($account_type, MemberAccountEnum::getType())) throw new AdminException('MEMBER_TYPE_NOT_EXIST');
$res = MemberAccountEnum::getFromType($account_type);
return $res;
}
+ /**
+ * 获取账户数据和
+ * @param string $account_type (注意查询对应账户)
+ */
+ public function getSumAccount(string $account_type)
+ {
+ $sum = $this->model->where([['site_id', '=', $this->site_id], ['account_type', '=', $account_type]])->sum('account_data');
+ return $sum;
+ }
+ /**
+ * 会员账户详情
+ * @param int $member_id
+ * @return array
+ */
+ public function getMemberAccountInfo(int $member_id)
+ {
+ $field = 'point, point_get, balance, balance_get, growth, growth_get, money, money_get, commission, commission_get';
+ return (new Member())->where([['member_id', '=', $member_id], ['site_id', '=', $this->site_id]])->field($field)->findOrEmpty()->toArray();
+ }
+
-
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/member/MemberCashOutConfigService.php b/niucloud/app/service/admin/member/MemberCashOutConfigService.php
new file mode 100644
index 000000000..064758b67
--- /dev/null
+++ b/niucloud/app/service/admin/member/MemberCashOutConfigService.php
@@ -0,0 +1,38 @@
+model = new MemberCashOut();
+ }
+
+
+ public function getConfig(){
+ return (new CoreMemberCashOutConfigService())->getMemberCashOutConfig($this->site_id);
+ }
+
+ public function setConfig(array $data){
+ (new CoreMemberCashOutConfigService())->setMemberCashOutConfig($this->site_id, $data);
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/member/MemberWithdrawService.php b/niucloud/app/service/admin/member/MemberCashOutService.php
similarity index 52%
rename from niucloud/app/service/admin/member/MemberWithdrawService.php
rename to niucloud/app/service/admin/member/MemberCashOutService.php
index c0ab95569..05b8e276c 100644
--- a/niucloud/app/service/admin/member/MemberWithdrawService.php
+++ b/niucloud/app/service/admin/member/MemberCashOutService.php
@@ -11,28 +11,19 @@
namespace app\service\admin\member;
-use app\enum\member\MemberAccountEnum;
-use app\enum\member\MemberWithdrawEnum;
-use app\model\member\MemberAccountLog;
-use app\model\member\MemberWithdraw;
-use app\service\admin\BaseAdminService;
-use app\service\core\member\CoreMemberAccountService;
-use app\service\core\member\CoreMemberService;
-use app\service\core\member\CoreMemberWithdrawService;
-use extend\exception\AdminException;
-use extend\exception\ApiException;
+use app\model\member\MemberCashOut;
+use app\service\core\member\CoreMemberCashOutService;
+use core\base\BaseAdminService;
/**
* 会员提现服务层
- * Class MemberWithdrawService
- * @package app\service\admin\member
*/
-class MemberWithdrawService extends BaseAdminService
+class MemberCashOutService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
- $this->model = new MemberWithdraw();
+ $this->model = new MemberCashOut();
}
/**
@@ -43,8 +34,8 @@ class MemberWithdrawService extends BaseAdminService
public function getPage(array $where = [])
{
- $field = 'id,site_id,withdraw_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_voucher,transfer_remark,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason,transfer_no';
- $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','status', 'create_time'],$where)->with(['memberInfo', 'transfer'])->field($field)->order('create_time desc');
+ $field = 'id,site_id,cash_out_no,member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason,transfer_no';
+ $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','status', 'create_time'],$where)->with(['memberInfo', 'transfer'])->field($field)->order('create_time desc')->append(['status_name', 'transfer_status_name', 'transfer_type_name', 'account_type_name']);
$list = $this->pageQuery($search_model);
return $list;
}
@@ -56,8 +47,8 @@ class MemberWithdrawService extends BaseAdminService
*/
public function getInfo(int $id)
{
- $field = 'id,site_id,withdraw_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_voucher,transfer_remark,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason,transfer_no';
- return $this->model->where([['id', '=', $id], ['site_id', '=', $this->site_id]])->with(['memberInfo', 'transfer'])->field($field)->findOrEmpty()->toArray();
+ $field = 'id,site_id,cash_out_no,member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason,transfer_no';
+ return $this->model->where([['id', '=', $id], ['site_id', '=', $this->site_id]])->with(['memberInfo', 'transfer'])->field($field)->append(['status_name', 'transfer_status_name', 'transfer_type_name', 'account_type_name'])->findOrEmpty()->toArray();
}
/**
@@ -66,8 +57,8 @@ class MemberWithdrawService extends BaseAdminService
* @return void
*/
public function audit(int $id, string $action, $data){
- $core_member_withdraw_service = new CoreMemberWithdrawService();
- return $core_member_withdraw_service->audit($this->site_id, $id, $action, $data);
+ $core_member_cash_out_service = new CoreMemberCashOutService();
+ return $core_member_cash_out_service->audit($this->site_id, $id, $action, $data);
}
@@ -78,8 +69,8 @@ class MemberWithdrawService extends BaseAdminService
* @return true
*/
public function transfer(int $id, array $data){
- $core_member_withdraw_service = new CoreMemberWithdrawService();
- return $core_member_withdraw_service->transfer($this->site_id, $id, $data);
+ $core_member_cash_out_service = new CoreMemberCashOutService();
+ return $core_member_cash_out_service->transfer($this->site_id, $id, $data);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/member/MemberConfigService.php b/niucloud/app/service/admin/member/MemberConfigService.php
index 766626186..4ff58ea49 100644
--- a/niucloud/app/service/admin/member/MemberConfigService.php
+++ b/niucloud/app/service/admin/member/MemberConfigService.php
@@ -11,11 +11,8 @@
namespace app\service\admin\member;
-use app\model\member\Member;
-use app\service\admin\BaseAdminService;
use app\service\core\member\CoreMemberConfigService;
-use extend\exception\AdminException;
-use think\db\exception\DbException;
+use core\base\BaseAdminService;
/**
* 会员设置
@@ -42,16 +39,16 @@ class MemberConfigService extends BaseAdminService
/**
* 获取提现设置
*/
- public function getWithdrawConfig(){
+ public function getCashOutConfig(){
- return (new CoreMemberConfigService())->getWithdrawConfig($this->site_id);
+ return (new CoreMemberConfigService())->getCashOutConfig($this->site_id);
}
/**
* 提现设置
* @param $data
*/
- public function setWithdrawConfig(array $data){
- return (new CoreMemberConfigService())->setWithdrawConfig($this->site_id, $data);
+ public function setCashOutConfig(array $data){
+ return (new CoreMemberConfigService())->setCashOutConfig($this->site_id, $data);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/member/MemberLabelService.php b/niucloud/app/service/admin/member/MemberLabelService.php
index e1ab9565f..dd2715ae6 100644
--- a/niucloud/app/service/admin/member/MemberLabelService.php
+++ b/niucloud/app/service/admin/member/MemberLabelService.php
@@ -12,8 +12,8 @@
namespace app\service\admin\member;
use app\model\member\MemberLabel;
-use app\service\admin\BaseAdminService;
use app\service\core\member\CoreMemberLabelService;
+use core\base\BaseAdminService;
/**
* 会员标签
@@ -86,7 +86,7 @@ class MemberLabelService extends BaseAdminService
* @param int $label_id
* @param array $data
*/
- public function update(int $label_id, array $data)
+ public function edit(int $label_id, array $data)
{
$data['update_time'] = time();
$this->model->where([['label_id', '=', $label_id], ['site_id', '=', $this->site_id]])->save($data);
diff --git a/niucloud/app/service/admin/member/MemberService.php b/niucloud/app/service/admin/member/MemberService.php
index ecf63e087..6ce30f987 100644
--- a/niucloud/app/service/admin/member/MemberService.php
+++ b/niucloud/app/service/admin/member/MemberService.php
@@ -11,12 +11,12 @@
namespace app\service\admin\member;
-use app\enum\common\ChannelEnum;
+use app\enum\member\MemberRegisterChannelEnum;
use app\enum\member\MemberRegisterTypeEnum;
use app\model\member\Member;
-use app\service\admin\BaseAdminService;
use app\service\core\member\CoreMemberService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\db\exception\DbException;
/**
@@ -40,8 +40,8 @@ class MemberService extends BaseAdminService
public function getPage(array $where = [])
{
- $field = 'member_id, site_id, username, mobile, password, register_channel, register_type, nickname, headimg, member_level, member_label, wx_openid, weapp_openid, wx_unionid, ali_openid, douyin_openid, login_ip, login_type, login_channel, login_count, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, point_get, balance, balance_get, growth, growth_get, is_member, member_time, is_del, province_id, city_id, district_id, address, location, delete_time, money, money_get';
- $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label'],$where)->field($field)->order('member_id desc')->append(['register_channel_name', 'register_type_name', 'sex_name', 'login_channel_name', 'login_type_name']);
+ $field = 'member_id, site_id, username, mobile, password, register_channel, register_type, nickname, headimg, member_level, member_label, wx_openid, weapp_openid, wx_unionid, ali_openid, douyin_openid, login_ip, login_type, login_channel, login_count, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, point_get, balance, balance_get, growth, growth_get, is_member, member_time, is_del, province_id, city_id, district_id, address, location, delete_time, money, money_get, commission, commission_get, commission_cash_outing';
+ $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label', 'register_channel'],$where)->field($field)->order('member_id desc')->append(['register_channel_name', 'register_type_name', 'sex_name', 'login_channel_name', 'login_type_name', 'status_name']);
$data = $this->pageQuery($search_model, function ($item, $key) {
$item = $this->makeUp($item);
});
@@ -68,8 +68,8 @@ class MemberService extends BaseAdminService
*/
public function getInfo(int $member_id)
{
- $field = 'member_id, site_id, username, mobile, password, register_channel, register_type, nickname, headimg, member_level, member_label, wx_openid, weapp_openid, wx_unionid, ali_openid, douyin_openid, login_ip, login_type, login_channel, login_count, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, point_get, balance, balance_get, growth, growth_get, is_member, member_time, is_del, province_id, city_id, district_id, address, location, delete_time, money, money_get';
- return $this->makeUp($this->model->where([['member_id', '=', $member_id], ['site_id', '=', $this->site_id]])->field($field)->append(['register_channel_name', 'register_type_name', 'sex_name', 'login_channel_name', 'login_type_name'])->findOrEmpty()->toArray());
+ $field = 'member_id, site_id, username, mobile, password, register_channel, register_type, nickname, headimg, member_level, member_label, wx_openid, weapp_openid, wx_unionid, ali_openid, douyin_openid, login_ip, login_type, login_channel, login_count, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, point_get, balance, balance_get, growth, growth_get, is_member, member_time, is_del, province_id, city_id, district_id, address, location, delete_time, money, money_get, commission, commission_get, commission_cash_outing';
+ return $this->makeUp($this->model->where([['member_id', '=', $member_id], ['site_id', '=', $this->site_id]])->field($field)->append(['register_channel_name', 'register_type_name', 'sex_name', 'login_channel_name', 'login_type_name', 'status_name'])->findOrEmpty()->toArray());
}
/**
@@ -82,17 +82,17 @@ class MemberService extends BaseAdminService
//检测手机是否重复
if(!empty($data['mobile'])){
if(!$this->model->where([['site_id', '=', $this->site_id], ['mobile', '=', $data['mobile']]])->findOrEmpty()->isEmpty())
- throw new AdminException(301001);
+ throw new AdminException('MOBILE_IS_EXIST');
}
if(!empty($data['username'])){
if(!$this->model->where([['site_id', '=', $this->site_id], ['username', '=', $data['username']]])->findOrEmpty()->isEmpty())
- throw new AdminException(301008);
+ throw new AdminException('MEMBER_IS_EXIST');
}
$data['site_id'] = $this->site_id;
$password_hash = create_password($data['password']);
$data['password'] = $password_hash;
$data['register_type'] = MemberRegisterTypeEnum::MANUAL;
- $data['register_channel'] = ChannelEnum::PC;//todo 公共化渠道
+ $data['register_channel'] = MemberRegisterChannelEnum::MANUAL;//todo 公共化渠道
$member = $this->model->create($data);
$data['member_id'] = $member->member_id;
event("memberRegister", $data);
@@ -105,7 +105,7 @@ class MemberService extends BaseAdminService
* @param array $data
* @return true
*/
- public function update(int $member_id, array $data)
+ public function edit(int $member_id, array $data)
{
$where = array(
['site_id', '=', $this->site_id],
@@ -154,7 +154,21 @@ class MemberService extends BaseAdminService
return $this->model->where($where)->count();
}
-
-
-
+ /**
+ * 设置状态
+ * @param array $member_ids
+ * @param int $status
+ * @return true
+ */
+ public function setStatus(array $member_ids, int $status){
+ $where = array(
+ ['site_id', '=', $this->site_id],
+ ['member_id', 'in', $member_ids],
+ );
+ $data = array(
+ 'status' => $status
+ );
+ $this->model->where($where)->update($data);
+ return true;
+ }
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/member/MemberWithdrawConfigService.php b/niucloud/app/service/admin/member/MemberWithdrawConfigService.php
deleted file mode 100644
index 906aa567e..000000000
--- a/niucloud/app/service/admin/member/MemberWithdrawConfigService.php
+++ /dev/null
@@ -1,46 +0,0 @@
-model = new MemberWithdraw();
- }
-
-
- public function getConfig(){
- return (new CoreMemberWithdrawConfigService())->getMemberWithdrawConfig($this->site_id);
- }
-
- public function setConfig(array $data){
- (new CoreMemberWithdrawConfigService())->setMemberWithdrawConfig($this->site_id, $data);
- return true;
- }
-}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/message/MessageLogService.php b/niucloud/app/service/admin/notice/NoticeLogService.php
similarity index 60%
rename from niucloud/app/service/admin/message/MessageLogService.php
rename to niucloud/app/service/admin/notice/NoticeLogService.php
index b12f8db7b..3584453ea 100644
--- a/niucloud/app/service/admin/message/MessageLogService.php
+++ b/niucloud/app/service/admin/notice/NoticeLogService.php
@@ -9,28 +9,21 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\admin\message;
+namespace app\service\admin\notice;
-use app\enum\sys\MessageEnum;
-use app\enum\sys\MessageTypeEnum;
-use app\model\sys\SysMessage;
-use app\model\sys\SysMessageLog;
-use app\service\admin\BaseAdminService;
-use app\service\core\message\CoreMessageLogService;
-use app\service\core\message\CoreMessageService;
-use extend\exception\AdminException;
+use app\model\sys\SysNoticeLog;
+use app\service\core\notice\CoreNoticeLogService;
+use core\base\BaseAdminService;
/**
* 消息管理服务层
- * Class MessageService
- * @package app\service\admin\message
*/
-class MessageLogService extends BaseAdminService
+class NoticeLogService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
- $this->model = new SysMessageLog();
+ $this->model = new SysNoticeLog();
}
/**
@@ -40,7 +33,7 @@ class MessageLogService extends BaseAdminService
*/
public function getPage($where)
{
- return (new CoreMessageLogService())->getPage($this->site_id, $where);
+ return (new CoreNoticeLogService())->getPage($this->site_id, $where);
}
/**
@@ -50,6 +43,6 @@ class MessageLogService extends BaseAdminService
*/
public function getInfo(string $id)
{
- return (new CoreMessageLogService())->getInfo($this->site_id, $id);
+ return (new CoreNoticeLogService())->getInfo($this->site_id, $id);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/message/MessageService.php b/niucloud/app/service/admin/notice/NoticeService.php
similarity index 57%
rename from niucloud/app/service/admin/message/MessageService.php
rename to niucloud/app/service/admin/notice/NoticeService.php
index b48d50fbf..e76a54715 100644
--- a/niucloud/app/service/admin/message/MessageService.php
+++ b/niucloud/app/service/admin/notice/NoticeService.php
@@ -9,27 +9,24 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\admin\message;
+namespace app\service\admin\notice;
-use app\enum\sys\MessageEnum;
-use app\enum\sys\MessageTypeEnum;
-use app\model\sys\SysMessage;
-use app\model\sys\SysMessageLog;
-use app\service\admin\BaseAdminService;
-use app\service\core\message\CoreMessageService;
-use extend\exception\AdminException;
+use app\enum\notice\NoticeEnum;
+use app\enum\notice\NoticeTypeEnum;
+use app\model\sys\SysNotice;
+use app\service\core\notice\CoreNoticeService;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
/**
* 消息管理服务层
- * Class MessageService
- * @package app\service\admin\message
*/
-class MessageService extends BaseAdminService
+class NoticeService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
- $this->model = new SysMessage();
+ $this->model = new SysNotice();
}
/**
@@ -38,7 +35,7 @@ class MessageService extends BaseAdminService
*/
public function getList()
{
- return (new CoreMessageService())->getList($this->site_id);
+ return (new CoreNoticeService())->getList($this->site_id);
}
/**
@@ -47,7 +44,7 @@ class MessageService extends BaseAdminService
*/
public function getInfo(string $key)
{
- return (new CoreMessageService())->getInfo($this->site_id, $key);
+ return (new CoreNoticeService())->getInfo($this->site_id, $key);
}
/**
@@ -61,7 +58,7 @@ class MessageService extends BaseAdminService
$data = array(
$field_type => $value
);
- return (new CoreMessageService())->update($this->site_id, $key, $data);
+ return (new CoreNoticeService())->edit($this->site_id, $key, $data);
}
/**
@@ -71,11 +68,11 @@ class MessageService extends BaseAdminService
* @param int $status
* @return \think\Response
*/
- public function updateMessageStatus(string $key, string $type, int $status)
+ public function editMessageStatus(string $key, string $type, int $status)
{
- if(!array_key_exists($type, MessageTypeEnum::getType())) throw new AdminException(204001);
- if(!array_key_exists($key, MessageEnum::getMessage())) return fail(204001);
- return (new CoreMessageService())->update($this->site_id, $key, ['is_'.$type => $status]);
+ if(!array_key_exists($type, NoticeTypeEnum::getType())) throw new AdminException('NOTICE_TYPE_NOT_EXIST');
+ if(!array_key_exists($key, NoticeEnum::getNotice())) return fail('NOTICE_TYPE_NOT_EXIST');
+ return (new CoreNoticeService())->edit($this->site_id, $key, ['is_'.$type => $status]);
}
/**
@@ -85,24 +82,24 @@ class MessageService extends BaseAdminService
* @param array $data
* @return \think\Response
*/
- public function update(string $key, string $type, array $data)
+ public function edit(string $key, string $type, array $data)
{
- if(!array_key_exists($type, MessageTypeEnum::getType())) throw new AdminException(204001);
- if(!array_key_exists($key, MessageEnum::getMessage())) return fail(204001);
+ if(!array_key_exists($type, NoticeTypeEnum::getType())) throw new AdminException('NOTICE_TYPE_NOT_EXIST');
+ if(!array_key_exists($key, NoticeEnum::getNotice())) return fail('NOTICE_TYPE_NOT_EXIST');
$save_data = ['is_'.$type => $data['status']];
switch ($type)
{
- case MessageTypeEnum::SMS:
+ case NoticeTypeEnum::SMS:
$save_data['sms_id'] = $data['sms_id'] ?? '';
break;
- case MessageTypeEnum::WECHAT:
+ case NoticeTypeEnum::WECHAT:
$save_data['wechat_first'] = $data['wechat_first'] ?? '';
$save_data['wechat_remark'] = $data['wechat_remark'] ?? '';
break;
- case MessageTypeEnum::WEAPP:
+ case NoticeTypeEnum::WEAPP:
break;
}
- return (new CoreMessageService())->update($this->site_id, $key, $save_data);
+ return (new CoreNoticeService())->edit($this->site_id, $key, $save_data);
}
diff --git a/niucloud/app/service/admin/message/MessageSmsLogService.php b/niucloud/app/service/admin/notice/NoticeSmsLogService.php
similarity index 56%
rename from niucloud/app/service/admin/message/MessageSmsLogService.php
rename to niucloud/app/service/admin/notice/NoticeSmsLogService.php
index 91e24fba6..16aee5514 100644
--- a/niucloud/app/service/admin/message/MessageSmsLogService.php
+++ b/niucloud/app/service/admin/notice/NoticeSmsLogService.php
@@ -9,29 +9,22 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\admin\message;
+namespace app\service\admin\notice;
-use app\enum\sys\MessageEnum;
-use app\enum\sys\MessageTypeEnum;
-use app\model\sys\SysMessage;
-use app\model\sys\SysMessageLog;
-use app\service\admin\BaseAdminService;
-use app\service\core\message\CoreMessageLogService;
-use app\service\core\message\CoreMessageService;
-use app\service\core\message\CoreMessageSmsLogService;
-use extend\exception\AdminException;
+use app\model\sys\SysNoticeLog;
+use app\service\core\notice\CoreNoticeLogService;
+use app\service\core\notice\CoreNoticeSmsLogService;
+use core\base\BaseAdminService;
/**
* 消息管理服务层
- * Class MessageService
- * @package app\service\admin\message
*/
-class MessageSmsLogService extends BaseAdminService
+class NoticeSmsLogService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
- $this->model = new SysMessageLog();
+ $this->model = new SysNoticeLog();
}
/**
@@ -40,7 +33,7 @@ class MessageSmsLogService extends BaseAdminService
*/
public function getPage($where)
{
- return (new CoreMessageSmsLogService())->getPage($this->site_id, $where);
+ return (new CoreNoticeSmsLogService())->getPage($this->site_id, $where);
}
/**
@@ -49,6 +42,6 @@ class MessageSmsLogService extends BaseAdminService
*/
public function getInfo(string $key)
{
- return (new CoreMessageLogService())->getInfo($this->site_id, $key);
+ return (new CoreNoticeLogService())->getInfo($this->site_id, $key);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/message/SmsService.php b/niucloud/app/service/admin/notice/SmsService.php
similarity index 94%
rename from niucloud/app/service/admin/message/SmsService.php
rename to niucloud/app/service/admin/notice/SmsService.php
index 2b219adf6..0ef864e85 100644
--- a/niucloud/app/service/admin/message/SmsService.php
+++ b/niucloud/app/service/admin/notice/SmsService.php
@@ -9,19 +9,17 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\admin\message;
+namespace app\service\admin\notice;
use app\enum\sys\SmsEnum;
-use app\service\admin\BaseAdminService;
use app\service\core\sys\CoreConfigService;
use app\service\core\sys\CoreMessage;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\Response;
/**
* 短信配置服务层
- * Class SmsService
- * @package app\service\admin\message
*/
class SmsService extends BaseAdminService
{
@@ -70,7 +68,7 @@ class SmsService extends BaseAdminService
public function getConfig(string $sms_type)
{
$sms_type_list = SmsEnum::getType();
- if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException(204002);
+ if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException('SMS_TYPE_NOT_EXIST');
$info = (new CoreConfigService())->getConfig($this->site_id, 'SMS');
if(empty($info))
{
@@ -103,7 +101,7 @@ class SmsService extends BaseAdminService
public function setConfig(string $sms_type, array $data)
{
$sms_type_list = SmsEnum::getType();
- if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException(204002);
+ if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException('SMS_TYPE_NOT_EXIST');
$info = (new CoreConfigService())->getConfig($this->site_id, 'SMS');
if(empty($info))
{
diff --git a/niucloud/app/service/admin/BaseAdminService.php b/niucloud/app/service/admin/order/RechargeOrderRefundService.php
similarity index 56%
rename from niucloud/app/service/admin/BaseAdminService.php
rename to niucloud/app/service/admin/order/RechargeOrderRefundService.php
index d5cacec4b..c69180726 100644
--- a/niucloud/app/service/admin/BaseAdminService.php
+++ b/niucloud/app/service/admin/order/RechargeOrderRefundService.php
@@ -9,30 +9,29 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\admin;
+namespace app\service\admin\order;
-use app\model\BaseModel;
-use app\service\BaseService;
+use app\service\core\order\recharge\CoreRechargeRefundService;
+use core\base\BaseAdminService;
/**
- * 后台基础服务层
- * Class BaseAdminService
- * @package app\service\admin
+ * 充值订单
+ * Class RechargeOrderService
+ * @package app\service\admin\order
*/
-class BaseAdminService extends BaseService
+class RechargeOrderRefundService extends BaseAdminService
{
-
- protected $site_id;
- protected $username;
- protected $uid;
-
- protected $app_type;
public function __construct()
{
parent::__construct();
- $this->app_type = $this->request->appType();
- $this->site_id = $this->request->siteId();
- $this->username = $this->request->username();
- $this->uid = $this->request->uid();
+ }
+
+ public function create($order_id) {
+ try {
+ (new CoreRechargeRefundService())->create($this->site_id, $order_id);
+ return true;
+ } catch (\Exception $e) {
+ return $e->getMessage();
+ }
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/order/RechargeOrderService.php b/niucloud/app/service/admin/order/RechargeOrderService.php
index cc787ce89..cbfaa7f61 100644
--- a/niucloud/app/service/admin/order/RechargeOrderService.php
+++ b/niucloud/app/service/admin/order/RechargeOrderService.php
@@ -13,7 +13,7 @@ namespace app\service\admin\order;
use app\enum\order\RechargeOrderEnum;
use app\model\order\Order;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 充值订单
@@ -39,7 +39,7 @@ class RechargeOrderService extends BaseAdminService
$order = 'create_time desc';
$where['order_type'] = 'recharge';
$search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['order_from', 'order_status', 'order_type', 'member_id', 'out_trade_no', 'create_time'], $where)->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_id, refund_status, create_time');
+ $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
}, 'member' => function($query) {
$query->field('member_id, nickname, mobile, headimg');
}])->order($order)->append(['order_status_info', 'order_from_name']);
@@ -55,7 +55,7 @@ class RechargeOrderService extends BaseAdminService
{
$field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
$detail = $this->model->where([['order_type', '=', 'recharge'], ['site_id', '=', $this->site_id], ['order_id', '=', $order_id]])->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_id, refund_status, create_time');
+ $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
}, 'member' => function($query) {
$query->field('member_id, nickname, mobile, headimg');
}])->append(['order_status_info', 'order_from_name'])->findOrEmpty()->toArray();
diff --git a/niucloud/app/service/admin/order/RefundService.php b/niucloud/app/service/admin/order/RefundService.php
new file mode 100644
index 000000000..84e3dc6d0
--- /dev/null
+++ b/niucloud/app/service/admin/order/RefundService.php
@@ -0,0 +1,74 @@
+model = new OrderItemRefund();
+ }
+
+ /**
+ * 查询退款列表
+ * @param array $where
+ * @return mixed
+ */
+ public function getPage(array $where) {
+ $field = 'refund_id,num,money,refund_no,status,create_time,audit_time,transfer_time,item_type,order_item_id, order_id,member_id';
+ $order = 'create_time desc';
+ $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['status', 'member_id', 'refund_no', 'create_time'], $where)->field($field)->with(['item' => function($query) {
+ $query->field('order_item_id, item_name, item_image');
+ }, 'member' => function($query) {
+ $query->field('member_id, nickname, mobile, headimg');
+ }, 'payrefund' => function($query) {
+ $query->field('refund_no');
+ }])->order($order)->append(['status_name', 'payrefund.type_name']);
+ return $this->pageQuery($search_model);
+ }
+
+ /**
+ * 查询退款详情
+ * @param int $refund_id
+ * @return void
+ */
+ public function getDetail(int $refund_id) {
+ $field = 'refund_id,num,money,refund_no,status,create_time,audit_time,transfer_time,item_type,order_item_id, order_id,member_id';
+ $detail = $this->model->where([ ['site_id', '=', $this->site_id], ['refund_id', '=', $refund_id]])->field($field)->with(['item' => function($query) {
+ $query->field('order_item_id, item_name, item_image');
+ }, 'member' => function($query) {
+ $query->field('member_id, nickname, mobile, headimg');
+ }, 'payrefund' => function($query) {
+ $query->field('refund_no');
+ }])->append(['status_name', 'payrefund.type_name'])->findOrEmpty()->toArray();
+ return $detail;
+ }
+
+ /**
+ * 获取退款状态
+ * @return void
+ */
+ public function getStatus($type){
+ $class = "\\app\\enum\\order\\" . ucfirst($type). "OrderEnum";
+ if (!class_exists($class)) return [];
+ return $class::getRefundStatus();
+ }
+}
diff --git a/niucloud/app/service/admin/pay/PayChannelService.php b/niucloud/app/service/admin/pay/PayChannelService.php
new file mode 100644
index 000000000..f09669f74
--- /dev/null
+++ b/niucloud/app/service/admin/pay/PayChannelService.php
@@ -0,0 +1,184 @@
+model = new PayChannel();
+ $this->core_pay_channel_service = new CorePayChannelService();
+ }
+
+ /**
+ * 添加模板
+ * @param array $data
+ */
+ public function set(string $channel, string $type, array $data)
+ {
+ $where = array(
+ 'type' => $type,
+ 'channel' => $channel
+ );
+ if (!in_array($type, array_keys(PayEnum::getPayType()))) throw new PayException('PATMENT_METHOD_INVALID');
+ if ($channel != 'transfer') {
+ if (!in_array($channel, array_keys(ChannelEnum::getType()))) throw new PayException('CHANNEL_MARK_INVALID');
+ }
+ $pay_channel = $this->core_pay_channel_service->find($this->site_id, $where);
+ if ($pay_channel->isEmpty()) {
+ $data['channel'] = $channel;
+ $data['type'] = $type;
+ $data['site_id'] = $this->site_id;
+ $data['config'] = $this->getConfigByPayType($data['config'], $type);
+ $res = $this->model->create($data);
+ } else {
+ $data['config'] = $this->getConfigByPayType($data['config'], $type);
+ $pay_channel->save($data);
+ }
+ return true;
+ }
+
+ /**
+ * 用于后端支付渠道
+ * @return void
+ */
+ public function getChannelList()
+ {
+ $channel_list = PayChannelEnum::getPayChannel();
+ $where = array(
+ 'site_id' => $this->site_id,
+ );
+ $pay_channel_list_temp = $this->model->where($where)->field('type, channel, config, sort, status')->select()->toArray();
+
+ $pay_channel_list = [];
+ foreach ($pay_channel_list_temp as $v) {
+ $pay_channel_list[$v['channel']][$v['type']] = $v;
+ }
+ foreach ($channel_list as $k => $v) {
+ $temp_item = $pay_channel_list[$k] ?? [];
+ foreach ($v['pay_type'] as $item_k => $item_v) {
+ $temp_v_item = $temp_item[$item_k] ?? ['status' => 0, 'config' => [], 'sort' => 0];
+ $item_v['config'] = $temp_v_item['config'];
+ $item_v['status'] = $temp_v_item['status'];
+ $item_v['sort'] = $temp_v_item['sort'];
+ $channel_list[$k]['pay_type'][$item_k] = $item_v;
+ }
+ $temp_pay_type = array_values($channel_list[$k]['pay_type']);
+ $sort = array_column($temp_pay_type, 'sort');
+ array_multisort($sort, SORT_ASC, $temp_pay_type);
+ $channel_list[$k]['pay_type'] = $temp_pay_type;
+ }
+ return $channel_list;
+ }
+
+ /**
+ * 通过渠道获取配置
+ * @param string $channel
+ * @return array
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public function getListByChannel(string $channel)
+ {
+ $where = array(
+ 'site_id' => $this->site_id,
+ 'channel' => $channel
+ );
+ return $this->model->where($where)->field('type, channel, config, sort, status')->select()->toArray();
+ }
+
+ /**
+ * 通过支付方式获取配置格式
+ * @param $data
+ * @param $type
+ * @return array
+ */
+ public function getConfigByPayType($data, $type)
+ {
+ $config = [];
+ switch ($type) {
+ case PayEnum::WECHATPAY:
+ $config = [
+ 'mch_id' => $data['mch_id'] ?? '',//商户号
+ 'mch_secret_key' => $data['mch_secret_key'] ?? '',//商户秘钥 现在默认认为是v3版
+ 'mch_secret_cert' => $data['mch_secret_cert'] ?? '',//商户私钥 字符串或路径
+ 'mch_public_cert_path' => $data['mch_public_cert_path'] ?? '',//商户公钥证书路径
+ ];
+ break;
+ case PayEnum::ALIPAY:
+ $config = [
+ 'app_id' => $data['app_id'] ?? '',// 必填-支付宝分配的 app_id
+ 'app_secret_cert' => $data['app_secret_cert'] ?? '',// 必填-应用私钥 字符串或路径
+ 'app_public_cert_path' => $data['app_public_cert_path'] ?? '',//必填-应用公钥证书 路径
+ 'alipay_public_cert_path' => $data['alipay_public_cert_path'] ?? '',//必填-支付宝公钥证书 路径
+ 'alipay_root_cert_path' => $data['alipay_root_cert_path'] ?? '',// 必填-支付宝根证书 路径
+ ];
+ break;
+ }
+// $config['status'] = $data['status'] ?? '0';//是否启用
+ return $config;
+ }
+
+ /**
+ * 设置打款设置
+ * @param $data
+ * @return true
+ */
+ public function setTransfer($data)
+ {
+ $wechatpay_config = $data['wechatpay_config'];
+ $alipay_config = $data['alipay_config'];
+ $this->set('transfer', PayEnum::WECHATPAY, [
+ 'config' => $wechatpay_config,
+ 'status' => 1,
+ ]);
+ $this->set('transfer', PayEnum::ALIPAY, [
+ 'config' => $alipay_config,
+ 'status' => 1,
+ ]);
+ return true;
+ }
+
+ public function setAll($data){
+ foreach($data as $k => $v){
+ $temp_v = $v['pay_type'];
+ foreach($temp_v as $item_k => $item){
+ $this->set($k, $item['key'], [
+ 'config' => $item['config'] ?? [],
+ 'status' => $item['status'] ?? 0,
+ 'sort' => $item['sort'] ?? 0,
+ ]);
+ }
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/pay/PayConfigService.php b/niucloud/app/service/admin/pay/PayConfigService.php
index 8cbd7b455..d6755443c 100644
--- a/niucloud/app/service/admin/pay/PayConfigService.php
+++ b/niucloud/app/service/admin/pay/PayConfigService.php
@@ -11,9 +11,8 @@
namespace app\service\admin\pay;
-use app\service\admin\BaseAdminService;
-
use app\service\core\pay\CorePayConfigService;
+use core\base\BaseAdminService;
/**
* 支付配置服务层
diff --git a/niucloud/app/service/admin/site/SiteGroupService.php b/niucloud/app/service/admin/site/SiteGroupService.php
index 8a31ec641..f15df1e50 100644
--- a/niucloud/app/service/admin/site/SiteGroupService.php
+++ b/niucloud/app/service/admin/site/SiteGroupService.php
@@ -13,9 +13,9 @@ namespace app\service\admin\site;
use app\model\site\Site;
use app\model\site\SiteGroup;
-use app\service\admin\BaseAdminService;
use app\service\admin\sys\MenuService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\facade\Cache;
/**
@@ -86,7 +86,7 @@ class SiteGroupService extends BaseAdminService
* @param array $data
* @return SiteGroup
*/
- public function update(int $group_id, array $data){
+ public function edit(int $group_id, array $data){
$this->model->update($data, [['group_id', '=', $group_id]]);
//删除缓存
$cache_name = self::$cache_name . $group_id;
@@ -104,7 +104,7 @@ class SiteGroupService extends BaseAdminService
$count = (new Site())->where([['group_id', '=', $group_id]])->count();
if($count > 0)
{
- throw new AdminException(600001);
+ throw new AdminException('SITE_GROUP_IS_EXIST');
}
$res = $this->model->where([['group_id', '=', $group_id]])->delete();
diff --git a/niucloud/app/service/admin/site/SiteService.php b/niucloud/app/service/admin/site/SiteService.php
index 4a0d110be..d07597810 100644
--- a/niucloud/app/service/admin/site/SiteService.php
+++ b/niucloud/app/service/admin/site/SiteService.php
@@ -13,11 +13,13 @@ namespace app\service\admin\site;
use app\enum\sys\AppTypeEnum;
use app\model\site\Site;
-use app\service\admin\BaseAdminService;
+use app\service\admin\install\InstallArticleService;
+use app\service\admin\install\InstallDiyService;
use app\service\admin\sys\MenuService;
use app\service\admin\user\UserService;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use Exception;
-use extend\exception\AdminException;
use think\facade\Cache;
use think\facade\Db;
@@ -29,6 +31,7 @@ use think\facade\Db;
class SiteService extends BaseAdminService
{
public static $cache_tag_name = 'site_cash';
+
public function __construct()
{
parent::__construct();
@@ -45,7 +48,7 @@ class SiteService extends BaseAdminService
{
$field = 'site_id, site_name, app_type, keywords, logo, `desc`, status, latitude, longitude, province_id, city_id,
district_id, address, full_address, phone, business_hours, create_time, expire_time, group_id';
- $search_model = $this->model->where([['app_type', '<>', 'admin']])->withSearch(['keywords','status', 'group_id'],$where)->with('groupName')->field($field)->append(['status_name'])->order('create_time desc');
+ $search_model = $this->model->where([ [ 'app_type', '<>', 'admin' ] ])->withSearch([ 'keywords', 'status', 'group_id' ], $where)->with('groupName')->field($field)->append([ 'status_name' ])->order('create_time desc');
$list = $this->pageQuery($search_model);
return $list;
}
@@ -59,7 +62,7 @@ class SiteService extends BaseAdminService
{
$field = 'site_id, site_name, app_type, keywords, logo, `desc`, status, latitude, longitude, province_id, city_id,
district_id, address, full_address, phone, business_hours, create_time, expire_time, group_id';
- return $this->model->where([['site_id', '=', $site_id]])->with('groupName')->field($field)->append(['status_name'])->findOrEmpty()->toArray();
+ return $this->model->where([ [ 'site_id', '=', $site_id ] ])->with('groupName')->field($field)->append([ 'status_name' ])->findOrEmpty()->toArray();
}
@@ -72,15 +75,15 @@ class SiteService extends BaseAdminService
public function add(array $data)
{
$user_service = new UserService();
- if($user_service->checkUsername($data['username'])) throw new AdminException(201004);
- $data['app_type'] = 'site';
+ if ($user_service->checkUsername($data[ 'username' ])) throw new AdminException('USERNAME_REPEAT');
+ $data[ 'app_type' ] = 'site';
//添加站点
$data_site = [
- 'site_name' => $data['site_name'],
- 'app_type' => $data['app_type'],
- 'group_id' => $data['group_id'],
+ 'site_name' => $data[ 'site_name' ],
+ 'app_type' => $data[ 'app_type' ],
+ 'group_id' => $data[ 'group_id' ],
'create_time' => time(),
- 'expire_time' => $data['expire_time']
+ 'expire_time' => $data[ 'expire_time' ]
];
Db::startTrans();
try {
@@ -88,18 +91,24 @@ class SiteService extends BaseAdminService
$site_id = $site->site_id;
//添加用户
$data_user = [
- 'username' => $data['username'],
- 'head_img' => $data['head_img'] ?? '',
- 'status' => $data['status'] ?? 1,
- 'real_name' => $data['real_name'] ?? '',
- 'password' => $data['password'],
+ 'username' => $data[ 'username' ],
+ 'head_img' => $data[ 'head_img' ] ?? '',
+ 'status' => $data[ 'status' ] ?? 1,
+ 'real_name' => $data[ 'real_name' ] ?? '',
+ 'password' => $data[ 'password' ],
'role_ids' => '',
'is_admin' => 1
];
- (new UserService())->addSiteUser($data_user, $site_id);
+ ( new UserService() )->addSiteUser($data_user, $site_id);
+
+ // 初始化自定义页面数据
+ ( new InstallDiyService() )->install([ 'site_id' => $site_id ]);
+
+ // 初始化文章数据
+ ( new InstallArticleService() )->install([ 'site_id' => $site_id ]);
Db::commit();
return $site_id;
- } catch ( Exception $e) {
+ } catch (Exception $e) {
Db::rollback();
throw new Exception($e->getMessage());
}
@@ -111,8 +120,9 @@ class SiteService extends BaseAdminService
* @param array $data
* @return bool
*/
- public function update(int $site_id, array $data){
- $this->model->update($data, [['site_id', '=', $site_id]]);
+ public function edit(int $site_id, array $data)
+ {
+ $this->model->update($data, [ [ 'site_id', '=', $site_id ] ]);
Cache::tag(self::$cache_tag_name)->clear();
return true;
}
@@ -123,8 +133,9 @@ class SiteService extends BaseAdminService
* @return int
* @throws \think\db\exception\DbException
*/
- public function getCount(array $where = []){
- return $this->model->where($where)->count();
+ public function getCount(array $where = [])
+ {
+ return $this->model->where($where)->withSearch([ 'create_time', 'group_id' ], $where)->count();
}
@@ -132,14 +143,18 @@ class SiteService extends BaseAdminService
* 获取授权当前站点信息(用做缓存)
* @return mixed
*/
- public function getSiteCache(int $site_id){
+ public function getSiteCache(int $site_id)
+ {
$cache_name = 'site_info_cache';
- return Cache::tag(self::$cache_tag_name.$site_id)->remember($cache_name.$site_id, function () use ($site_id) {
+ return Cache::tag(self::$cache_tag_name . $site_id)->remember($cache_name . $site_id, function() use ($site_id) {
$where = [
- ['site_id', '=', $site_id],
+ [ 'site_id', '=', $site_id ],
];
- $menu_list = $this->model->where($where)->field('app_type,site_name,logo,group_id, status, expire_time')->findOrEmpty()->append(['status_name'])->toArray();
- return $menu_list;
+ $site = $this->model->where($where)->field('app_type,site_name,logo,group_id, status, expire_time')->findOrEmpty();
+ if (!$site->isEmpty()) {
+ $site->append([ 'status_name' ]);
+ }
+ return $site->toArray();
});
}
@@ -149,19 +164,20 @@ class SiteService extends BaseAdminService
* @param int $site_id
* @return mixed
*/
- public function getMenuList(int $site_id, $is_tree, $status){
+ public function getMenuList(int $site_id, $is_tree, $status)
+ {
$site_info = $this->getSiteCache($site_id);
- if(empty($site_info))
+ if (empty($site_info))
return [];
- $app_type = $site_info['app_type'];
- if($app_type == AppTypeEnum::ADMIN){
- return (new MenuService())->getAllMenuList($app_type, $status, $is_tree, 1);
- }else{
- $group_id = $site_info['group_id'] ?? 0;
- if($group_id > 0){
- $menu_keys = (new SiteGroupService())->getMenuIdsByGroupId($group_id);
- return (new MenuService())->getMenuListByMenuKeys($menu_keys, $this->app_type, $is_tree);
- }else{
+ $app_type = $site_info[ 'app_type' ];
+ if ($app_type == AppTypeEnum::ADMIN) {
+ return ( new MenuService() )->getAllMenuList($app_type, $status, $is_tree, 1);
+ } else {
+ $group_id = $site_info[ 'group_id' ] ?? 0;
+ if ($group_id > 0) {
+ $menu_keys = ( new SiteGroupService() )->getMenuIdsByGroupId($group_id);
+ return ( new MenuService() )->getMenuListByMenuKeys($menu_keys, $this->app_type, $is_tree);
+ } else {
return [];
}
}
@@ -174,19 +190,20 @@ class SiteService extends BaseAdminService
* @param int $site_id
* @return mixed
*/
- public function getApiList(int $site_id, $status){
+ public function getApiList(int $site_id, $status)
+ {
$site_info = $this->getSiteCache($site_id);
- if(empty($site_info))
+ if (empty($site_info))
return [];
- $app_type = $site_info['app_type'];
- if($app_type == AppTypeEnum::ADMIN){
- return (new MenuService())->getAllApiList($app_type, $status);
- }else{
- $group_id = $site_info['group_id'] ?? 0;
- if($group_id > 0){
- $menu_keys = (new SiteGroupService())->getMenuIdsByGroupId($group_id);
- return (new MenuService())->getApiListByMenuKeys($menu_keys, $app_type);
- }else{
+ $app_type = $site_info[ 'app_type' ];
+ if ($app_type == AppTypeEnum::ADMIN) {
+ return ( new MenuService() )->getAllApiList($app_type, $status);
+ } else {
+ $group_id = $site_info[ 'group_id' ] ?? 0;
+ if ($group_id > 0) {
+ $menu_keys = ( new SiteGroupService() )->getMenuIdsByGroupId($group_id);
+ return ( new MenuService() )->getApiListByMenuKeys($menu_keys, $app_type);
+ } else {
return [];
}
}
@@ -200,7 +217,7 @@ class SiteService extends BaseAdminService
public function getExpireTime(int $site_id)
{
$field = 'expire_time';
- return $this->model->where([['site_id', '=', $site_id]])->field($field)->findOrEmpty()->toArray();
+ return $this->model->where([ [ 'site_id', '=', $site_id ] ])->field($field)->findOrEmpty()->toArray();
}
diff --git a/niucloud/app/service/admin/site/SiteUserService.php b/niucloud/app/service/admin/site/SiteUserService.php
index a8bff73b5..7a2a5eea3 100644
--- a/niucloud/app/service/admin/site/SiteUserService.php
+++ b/niucloud/app/service/admin/site/SiteUserService.php
@@ -14,9 +14,9 @@ namespace app\service\admin\site;
use app\enum\sys\UserEnum;
use app\model\sys\SysUser;
use app\model\sys\SysUserRole;
-use app\service\admin\BaseAdminService;
use app\service\admin\user\UserRoleService;
use app\service\admin\user\UserService;
+use core\base\BaseAdminService;
use Exception;
/**
@@ -105,9 +105,9 @@ class SiteUserService extends BaseAdminService
* @param int $uid
* @param array $data
*/
- public function update(int $uid, array $data)
+ public function edit(int $uid, array $data)
{
- return (new UserService())->updateSiteUser($uid, $data, $this->site_id);
+ return (new UserService())->editSiteUser($uid, $data, $this->site_id);
}
/**
@@ -124,7 +124,7 @@ class SiteUserService extends BaseAdminService
'real_name' => 'real_name',
'head_img' => 'head_img',
};
- return (new UserService())->update($uid, [$field_name => $data]);
+ return (new UserService())->edit($uid, [$field_name => $data]);
}
/**
@@ -148,7 +148,7 @@ class SiteUserService extends BaseAdminService
* @return bool|true
*/
public function lock(int $uid){
- return (new UserService())->update($uid, ['status' => UserEnum::OFF]);
+ return (new UserService())->edit($uid, ['status' => UserEnum::OFF]);
}
/**
@@ -157,6 +157,6 @@ class SiteUserService extends BaseAdminService
* @return bool|true
*/
public function unlock(int $uid){
- return (new UserService())->update($uid, ['status' => UserEnum::ON]);
+ return (new UserService())->edit($uid, ['status' => UserEnum::ON]);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/site/UserLogService.php b/niucloud/app/service/admin/site/UserLogService.php
index 10d21db7c..c62d5bf24 100644
--- a/niucloud/app/service/admin/site/UserLogService.php
+++ b/niucloud/app/service/admin/site/UserLogService.php
@@ -14,8 +14,7 @@ namespace app\service\admin\site;
use app\model\sys\SysUserLog;
-
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
use Exception;
/**
diff --git a/niucloud/app/service/admin/stat/SiteStatService.php b/niucloud/app/service/admin/stat/SiteStatService.php
index b31b623f9..bfe9dc111 100644
--- a/niucloud/app/service/admin/stat/SiteStatService.php
+++ b/niucloud/app/service/admin/stat/SiteStatService.php
@@ -11,11 +11,13 @@
namespace app\service\admin\stat;
-use app\service\admin\BaseAdminService;
+use app\model\order\Order;
use app\service\admin\member\MemberService;
use app\service\admin\site\SiteService;
use app\service\admin\sys\SystemService;
-use think\db\exception\DbException;
+use app\service\core\member\CoreMemberService;
+use Carbon\Carbon;
+use core\base\BaseAdminService;
/**
@@ -70,19 +72,39 @@ class SiteStatService extends BaseAdminService
]
]
];
- $data['today_data']['total_member_count'] = (new MemberService())->getCount();
+ $data['today_data']['total_member_count'] = (new MemberService())->getCount([['create_time', '>=', Carbon::today()->timestamp]]);
+ $data['today_data']['total_order_money'] = $this->orderMoney(Carbon::today()->timestamp, time());
+ $data['today_data']['total_visit_count'] = (new MemberService())->getCount([['last_visit_time', '>=', Carbon::today()->timestamp]]);
+ $data['today_data']['today_member_visit_count'] = (new CoreMemberService())->getCount(['site_id' => $this->site_id,'last_visit_time' => get_start_and_end_time_by_day()]);
$data['system'] = (new SystemService())->getInfo();
$data['version'] = $data['system']['version'] ?? [];
$time = time();
for ($i=1; $i<=7; $i++) $data['visit_stat']['date'][] = date('Y-m-d', strtotime( '+' . $i-7 .' days', $time));
+ $member_count = (new MemberService())->getCount();
$man_count = (new MemberService())->getCount([ ['sex', '=', '1'] ]);
$woman_count = (new MemberService())->getCount([ ['sex', '=', '2'] ]);
- $data['member_stat']['value'] = [$man_count, $woman_count, (int)($data['today_data']['total_member_count'] - $man_count - $woman_count)];
+ $data['member_stat']['value'] = [$man_count, $woman_count, (int)($member_count - $man_count - $woman_count)];
$data['site_info'] = (new SiteService())->getInfo($this->site_id);
return $data;
}
+ /**
+ * 订单金额
+ * @param $start_time
+ * @param $end_time
+ */
+ public function orderMoney($start_time, $end_time)
+ {
+ $where[] = [
+ ['site_id', '=', $this->site_id],
+ ['order_status', '=', 10],
+ ['create_time', 'between', [$start_time, $end_time]]
+ ];
+ $money = (new Order())->where($where)->sum('order_money');
+ return $money;
+ }
+
diff --git a/niucloud/app/service/admin/stat/StatService.php b/niucloud/app/service/admin/stat/StatService.php
index 968e8b36c..63fbabe1d 100644
--- a/niucloud/app/service/admin/stat/StatService.php
+++ b/niucloud/app/service/admin/stat/StatService.php
@@ -11,11 +11,12 @@
namespace app\service\admin\stat;
-use app\service\admin\BaseAdminService;
-use app\service\admin\member\MemberService;
+use app\service\admin\site\SiteGroupService;
use app\service\admin\site\SiteService;
use app\service\admin\sys\SystemService;
-use think\db\exception\DbException;
+use app\service\core\addon\CoreAddonService;
+use app\service\core\member\CoreMemberService;
+use core\base\BaseAdminService;
/**
@@ -35,7 +36,8 @@ class StatService extends BaseAdminService
* 获取统计数据
* @return int[]
*/
- public function getIndexData(){
+ public function getIndexData()
+ {
$data = [
'today_data' => [
'member_count' => 1,
@@ -47,12 +49,20 @@ class StatService extends BaseAdminService
],
'system' => [],
'version' => [],
- 'visit_stat' => [
+// 'visit_stat' => [
+// 'date' => [],
+// 'value' => [980, 1323, 882, 762, 865, 923, 1105]
+// ],
+ 'site_stat' => [
'date' => [],
- 'value' => [980,1323,882,762,865,923,1105]
+ 'value' => []
],
'member_stat' => [
- 'type' => ['男','女','未知'],
+ 'type' => ['男', '女', '未知'],
+ 'value' => []
+ ],
+ 'site_group_stat' => [
+ 'type' => [],
'value' => []
],
'about' => [
@@ -68,17 +78,40 @@ class StatService extends BaseAdminService
]
]
];
- $data['today_data']['total_member_count'] = (new MemberService())->getCount();
+
+ $day_start_time = strtotime(date('Y-m-d', time()));
+ //当天结束之间
+ $day_end_time = $day_start_time + 86400;
+ $data['today_data']['total_member_count'] = (new CoreMemberService())->getCount();
+ $data['today_data']['today_member_count'] = (new CoreMemberService())->getCount(['create_time' => get_start_and_end_time_by_day()]);
$data['today_data']['total_site_count'] = (new SiteService())->getCount();
+ $data['today_data']['today_site_count'] = (new SiteService())->getCount(['create_time' => [$day_start_time, $day_end_time]]);
+
$data['system'] = (new SystemService())->getInfo();
$data['version'] = $data['system']['version'] ?? [];
$time = time();
- for ($i=1; $i<=7; $i++) $data['visit_stat']['date'][] = date('Y-m-d', strtotime( '+' . $i-7 .' days', $time));
-
- $man_count = (new MemberService())->getCount([ ['sex', '=', '1'] ]);
- $woman_count = (new MemberService())->getCount([ ['sex', '=', '2'] ]);
+ for ($i = 1; $i <= 7; $i++){
+ $item_day = date('Y-m-d', strtotime('+' . $i - 7 . ' days', $time));
+ $data['site_stat']['date'][] = $item_day;
+ $data['site_stat']['value'][] = (new SiteService())->getCount(['create_time' => get_start_and_end_time_by_day($item_day)]);
+ }
+ $man_count = (new CoreMemberService())->getCount(['sex' => '1']);
+ $woman_count = (new CoreMemberService())->getCount(['sex' => '2']);
$data['member_stat']['value'] = [$man_count, $woman_count, (int)($data['today_data']['total_member_count'] - $man_count - $woman_count)];
+ $site_group_list = (new SiteGroupService())->getAll();
+
+ if(!empty($site_group_list)){
+ foreach($site_group_list as $v){
+ $data['site_group_stat']['type'][] = $v['group_name'];
+ $data['site_group_stat']['value'][] = (new SiteService())->getCount(['group_id' => $v['group_id']]);
+ }
+ }
+ $app = [
+ 'app_count' => (new CoreAddonService())->getLocalAddonCount(),
+ 'app_installed_count' => (new CoreAddonService())->getCount(),
+ ];
+ $data['app'] = $app;
return $data;
}
diff --git a/niucloud/app/service/admin/sys/AgreementService.php b/niucloud/app/service/admin/sys/AgreementService.php
index 9b3eaa907..96a2b5d7a 100644
--- a/niucloud/app/service/admin/sys/AgreementService.php
+++ b/niucloud/app/service/admin/sys/AgreementService.php
@@ -13,8 +13,8 @@ namespace app\service\admin\sys;
use app\enum\sys\AgreementEnum;
-use app\service\admin\BaseAdminService;
use app\service\core\sys\CoreAgreementService;
+use core\base\BaseAdminService;
/**
* 协议服务类
diff --git a/niucloud/app/service/admin/sys/AppService.php b/niucloud/app/service/admin/sys/AppService.php
new file mode 100644
index 000000000..2c858148f
--- /dev/null
+++ b/niucloud/app/service/admin/sys/AppService.php
@@ -0,0 +1,67 @@
+ $v)
+ {
+ if(isset($v['category']))
+ {
+ $category_list = empty($category_list) ? $v['category'] : array_merge($category_list, $v['category']);
+ unset($v['category']);
+ }
+
+ $list = empty($list) ? $v : array_merge($list, $v);
+ }
+
+ foreach ($category_list as $k_category => $category)
+ {
+ $category_list[$k_category]['app_list'] = [];
+ foreach ($list as $k => $app)
+ {
+ $app_category = $app['category'] ?? "basic";
+
+ if($app_category == $category['key'])
+ {
+ $category_list[$k_category]['app_list'][] = $app;
+ }
+
+ }
+ }
+
+ return $category_list;
+ }
+
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/sys/AreaService.php b/niucloud/app/service/admin/sys/AreaService.php
index 3d320e8fc..a0a9506e7 100644
--- a/niucloud/app/service/admin/sys/AreaService.php
+++ b/niucloud/app/service/admin/sys/AreaService.php
@@ -12,7 +12,7 @@
namespace app\service\admin\sys;
use app\model\sys\SysArea;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
use think\facade\Cache;
/**
diff --git a/niucloud/app/service/admin/sys/AttachmentService.php b/niucloud/app/service/admin/sys/AttachmentService.php
index 70ab16d96..a03915e41 100644
--- a/niucloud/app/service/admin/sys/AttachmentService.php
+++ b/niucloud/app/service/admin/sys/AttachmentService.php
@@ -13,9 +13,9 @@ namespace app\service\admin\sys;
use app\model\sys\SysAttachment;
use app\model\sys\SysAttachmentCategory;
-use app\service\admin\BaseAdminService;
use app\service\core\sys\CoreAttachmentService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
/**
* 附件服务层
@@ -50,9 +50,9 @@ class AttachmentService extends BaseAdminService
* @param array $data
* @param $where
*/
- public function update(int $att_id, array $data)
+ public function edit(int $att_id, array $data)
{
- return $this->core_attachment_service->update($this->site_id, $att_id, $data);
+ return $this->core_attachment_service->edit($this->site_id, $att_id, $data);
}
/**
@@ -140,7 +140,7 @@ class AttachmentService extends BaseAdminService
$category_model = new SysAttachmentCategory();
$attachment = $category_model->create($data);
if (!$attachment->id)
- throw new AdminException(100010);//创建失败
+ throw new AdminException('ADD_FAIL');//创建失败
return $attachment->att_id;
}
@@ -158,7 +158,7 @@ class AttachmentService extends BaseAdminService
$category_model = new SysAttachmentCategory();
$category = $category_model->where($where)->findOrEmpty();
if ($category->isEmpty())
- throw new AdminException(203001);
+ throw new AdminException('ATTACHMENT_GROUP_NOT_EXIST');
return $category;
}
@@ -167,14 +167,14 @@ class AttachmentService extends BaseAdminService
* @param array $data
* @param $where
*/
- public function updateCategory(int $id, array $data)
+ public function editCategory(int $id, array $data)
{
$where = array(
['site_id', '=', $this->site_id],
['id', '=', $id]
);
$category_model = new SysAttachmentCategory();
- $res = $category_model->update($data, $where);
+ $res = $category_model->edit($data, $where);
return $res;
}
@@ -188,7 +188,7 @@ class AttachmentService extends BaseAdminService
//查询是否有下级菜单或按钮
$category = $this->findCategory($this->site_id, $id);
if ($this->model->where([['cate_id', '=', $id]])->count() > 0)
- throw new AdminException(203004);
+ throw new AdminException('ATTACHMENT_GROUP_HAS_IMAGE');
//下级存在图片不能删除
$res = $category->delete();
diff --git a/niucloud/app/service/admin/sys/ConfigService.php b/niucloud/app/service/admin/sys/ConfigService.php
index c2cc66dce..437010de8 100644
--- a/niucloud/app/service/admin/sys/ConfigService.php
+++ b/niucloud/app/service/admin/sys/ConfigService.php
@@ -11,10 +11,10 @@
namespace app\service\admin\sys;
-use app\service\admin\BaseAdminService;
use app\service\admin\site\SiteService;
use app\service\core\sys\CoreConfigService;
use app\service\core\sys\CoreSysConfigService;
+use core\base\BaseAdminService;
/**
* 配置服务层
@@ -78,7 +78,7 @@ class ConfigService extends BaseAdminService
public function setWebSite($data)
{
- return (new SiteService())->update($this->site_id, $data);
+ return (new SiteService())->edit($this->site_id, $data);
}
/**
diff --git a/niucloud/app/service/admin/sys/MenuService.php b/niucloud/app/service/admin/sys/MenuService.php
index 9d5be9b28..1c1ea1aed 100644
--- a/niucloud/app/service/admin/sys/MenuService.php
+++ b/niucloud/app/service/admin/sys/MenuService.php
@@ -13,8 +13,8 @@ namespace app\service\admin\sys;
use app\enum\sys\MenuTypeEnum;
use app\model\sys\SysMenu;
-use app\service\admin\BaseAdminService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\Exception;
use think\facade\Cache;
@@ -43,7 +43,7 @@ class MenuService extends BaseAdminService
if(!$menu->isEmpty()) throw new AdminException('validate_menu.exit_menu_key');//创建失败
$res = $this->model->create($data);
- if(!$res) throw new AdminException(100010);//创建失败
+ if(!$res) throw new AdminException('ADD_FAIL');//创建失败
Cache::tag(self::$cache_tag_name)->clear();
return $res;
@@ -56,7 +56,7 @@ class MenuService extends BaseAdminService
* @param array $data
* @return SysMenu
*/
- public function update(string $menu_key, array $data)
+ public function edit(string $menu_key, array $data)
{
$where = array(
['menu_key', '=', $menu_key]
@@ -88,7 +88,7 @@ class MenuService extends BaseAdminService
}
$menu = $this->model->where($where)->findOrEmpty();
if ($menu->isEmpty())
- throw new AdminException(200001);
+ throw new AdminException('MENU_NOT_EXIST');
return $menu;
}
/**
@@ -100,7 +100,7 @@ class MenuService extends BaseAdminService
//查询是否有下级菜单或按钮
$menu = $this->find($menu_key);
if($this->model::where([['parent_key', '=', $menu_key]])->count() > 0)
- throw new AdminException(200002);
+ throw new AdminException('MENU_NOT_ALLOW_DELETE');
$res = $menu->delete();
Cache::tag(self::$cache_tag_name)->clear();
diff --git a/niucloud/app/service/admin/sys/RoleService.php b/niucloud/app/service/admin/sys/RoleService.php
index 8dde015df..61a5ab3da 100644
--- a/niucloud/app/service/admin/sys/RoleService.php
+++ b/niucloud/app/service/admin/sys/RoleService.php
@@ -14,8 +14,8 @@ namespace app\service\admin\sys;
use app\enum\sys\RoleStatusEnum;
use app\model\sys\SysRole;
use app\model\sys\SysUserRole;
-use app\service\admin\BaseAdminService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\facade\Cache;
/**
@@ -87,7 +87,7 @@ class RoleService extends BaseAdminService
* @param int $role_id
* @param array $data
*/
- public function update(int $role_id, array $data){
+ public function edit(int $role_id, array $data){
$where = array(
['role_id', '=', $role_id],
['site_id', '=', $this->site_id],
@@ -110,7 +110,7 @@ class RoleService extends BaseAdminService
);
$role = $this->model->where($where)->findOrEmpty();
if ($role->isEmpty())
- throw new AdminException(202001);
+ throw new AdminException('USER_ROLE_NOT_EXIST');
return $role;
}
@@ -123,7 +123,7 @@ class RoleService extends BaseAdminService
public function del(int $role_id){
$role = $this->find($this->site_id, $role_id);
if(SysUserRole::where([['role_ids', 'like',['%"'.$role_id.'"%']]])->count() > 0)
- throw new AdminException(202002);
+ throw new AdminException('USER_ROLE_NOT_ALLOW_DELETE');
$res = $role->delete();
Cache::tag(self::$cache_tag_name.$this->site_id)->clear();
return $res;
@@ -155,8 +155,15 @@ class RoleService extends BaseAdminService
sort($role_ids);
$cache_name = 'user_role_'.$site_id.'_'.md5(implode('_', $role_ids));
return Cache::tag([MenuService::$cache_tag_name, self::$cache_tag_name.$site_id])->remember($cache_name, function() use($role_ids) {
- $rules = $this->model::where([['role_id', 'IN', $role_ids], ['status', '=', RoleStatusEnum::ON]])->column('rules');
- return array_unique(explode(',', implode(',', $rules)));
+ $rules = $this->model::where([['role_id', 'IN', $role_ids], ['status', '=', RoleStatusEnum::ON]])->field('rules')->select()->toArray();
+ if(!empty($rules)){
+ $temp = [];
+ foreach($rules as $k => $v){
+ $temp = array_merge($temp, $v['rules']);
+ }
+ return array_unique($temp);
+ }
+ return [];
});
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/sys/SystemService.php b/niucloud/app/service/admin/sys/SystemService.php
index a1993556e..06318a8b0 100644
--- a/niucloud/app/service/admin/sys/SystemService.php
+++ b/niucloud/app/service/admin/sys/SystemService.php
@@ -11,7 +11,8 @@
namespace app\service\admin\sys;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
+use think\facade\Db;
/**
* 系统信息服务层
@@ -33,11 +34,77 @@ class SystemService extends BaseAdminService
{
$data = [
'os' => PHP_OS,
- 'environment' => $_SERVER['SERVER_SOFTWARE'],
- 'php_v' =>PHP_VERSION,
+ 'environment' => $_SERVER[ 'SERVER_SOFTWARE' ],
+ 'php_v' => PHP_VERSION,
'version' => config('version')
];
return $data;
}
+ /**
+ * 获取域名配置
+ */
+ public function getUrl()
+ {
+ $site_tag = $this->site_id == 30 ? '' : '/s' . $this->site_id;
+ $data = [
+ 'wap_url' => ( !empty(env("system.wap_domain")) ? env("system.wap_domain") : request()->domain() ) . "/wap" . $site_tag,
+ 'web_url' => ( !empty(env("system.web_domain")) ? env("system.web_domain") : request()->domain() ) . "/web" . $site_tag,
+ ];
+ return $data;
+ }
+
+ /**
+ * 获取系统信息
+ * @return void
+ */
+ public function getSystemInfo(){
+ $server = [];
+ $server[] = [ "name" => "服务器操作系统", "server" => PHP_OS ];
+ $server[] = [ "name" => "服务器web环境", "server" => PHP_SAPI ];
+ $server[] = [ "name" => "PHP版本", "server" => phpversion() ];
+
+ //环境权限
+ $system_variables = [];
+ //pdo
+ $pdo = extension_loaded('pdo') && extension_loaded('pdo_mysql');
+ $system_variables[] = [ "name" => "pdo", "need" => "开启", "status" => $pdo ];
+ //curl
+ $curl = extension_loaded('curl') && function_exists('curl_init');
+ $system_variables[] = [ "name" => "curl", "need" => "开启", "status" => $curl ];
+ //openssl
+ $openssl = extension_loaded('openssl');
+ $system_variables[] = [ "name" => "openssl", "need" => "开启", "status" => $openssl ];
+ //gd
+ $gd = extension_loaded('gd');
+ $system_variables[] = [ "name" => "GD库", "need" => "开启", "status" => $gd ];
+ //fileinfo
+ $fileinfo = extension_loaded('fileinfo');
+ $system_variables[] = [ "name" => "fileinfo", "need" => "开启", "status" => $fileinfo ];
+ //目录权限
+ $root_path = str_replace("\\", DIRECTORY_SEPARATOR, dirname(dirname(dirname(dirname(dirname(__FILE__))))));
+ $root_path = str_replace("../", DIRECTORY_SEPARATOR, $root_path);
+
+ $dirs_list = [
+ [ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime'.DIRECTORY_SEPARATOR, "demand" => "可读可写", "path_name" => "/runtime", "name" => "runtime" ],
+ [ "path" => $root_path . DIRECTORY_SEPARATOR . 'public'.DIRECTORY_SEPARATOR.'upload'.DIRECTORY_SEPARATOR, "demand" => "可读可写", "path_name" => "/public/upload", "name" => "upload" ],
+ ];
+ //目录 可读 可写检测
+ foreach ($dirs_list as $k => $v) {
+ $is_readable = is_readable($v[ "path" ]);
+ $is_write = is_write($v[ "path" ]);
+ $dirs_list[ $k ][ "is_readable" ] = $is_readable;
+ $dirs_list[ $k ][ "is_write" ] = $is_write;
+ }
+
+ //获取环境版本
+ $server_version = [];
+ $row = (array)Db::query("select VERSION() as verson");
+ $server_version[] = [ "name" => "PHP版本", "demand" => "大于等于8.0.0", "server" => phpversion() ];
+ $server_version[] = [ "name" => "mysql版本", "demand" => "大于等于5.7", "server" => $row[0]['verson']];
+
+ $data = ["server" => $server, "dirs_list" => $dirs_list, 'system_variables' => $system_variables, 'server_version' => $server_version];
+ return $data;
+ }
+
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/user/UserRoleService.php b/niucloud/app/service/admin/user/UserRoleService.php
index 8584e491c..d00a69613 100644
--- a/niucloud/app/service/admin/user/UserRoleService.php
+++ b/niucloud/app/service/admin/user/UserRoleService.php
@@ -14,9 +14,9 @@ namespace app\service\admin\user;
use app\model\sys\SysRole;
use app\model\sys\SysUserRole;
-use app\service\admin\BaseAdminService;
use app\service\admin\sys\RoleService;
-use extend\exception\AdminException;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use think\facade\Cache;
/**
@@ -64,14 +64,14 @@ class UserRoleService extends BaseAdminService
* @param array $role_ids
* @return bool
*/
- public function update(int $site_id, int $uid, array $role_ids){
+ public function edit(int $site_id, int $uid, array $role_ids){
$user_role = $this->model->where([['uid', '=', $uid], ['site_id', '=', $site_id]])->findOrEmpty();
if ($user_role->isEmpty())
- throw new AdminException(201002);
+ throw new AdminException('NO_SITE_USER_ROLE');
$is_admin = $user_role->is_admin;
if($is_admin)//超级管理员不允许改动权限
- throw new AdminException(201003);
+ throw new AdminException('ADMIN_NOT_ALLOW_EDIT_ROLE');
if (!empty(array_diff_assoc($role_ids, $user_role->role_ids))) {
//校验权限越界
$user_role->save(['role_ids' => $role_ids]);
@@ -101,13 +101,14 @@ class UserRoleService extends BaseAdminService
}
/**
- * 获取用户默认站点
+ * 获取用户默认站点(切勿用于平台管理端)
* @param int $uid
* @return SysUserRole|array|mixed|\think\Model
*/
public function getUserDefaultSiteId(int $uid){
$user_role_model = new SysUserRole();
- return $user_role_model->where([['uid', '=', $uid]])->findOrEmpty()?->site_id;
+ $default_site_id = $this->request->defaultSiteId();
+ return $user_role_model->where([['uid', '=', $uid], ['site_id', '<>', $default_site_id]])->findOrEmpty()?->site_id;
}
/**
diff --git a/niucloud/app/service/admin/user/UserService.php b/niucloud/app/service/admin/user/UserService.php
index f7716db6d..22ad39675 100644
--- a/niucloud/app/service/admin/user/UserService.php
+++ b/niucloud/app/service/admin/user/UserService.php
@@ -15,9 +15,9 @@ namespace app\service\admin\user;
use app\enum\sys\UserEnum;
use app\model\sys\SysUser;
use app\service\admin\auth\LoginService;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
+use core\exception\AdminException;
use Exception;
-use extend\exception\AdminException;
use think\facade\Db;
/**
@@ -141,16 +141,16 @@ class UserService extends BaseAdminService
* @param $site_id
* @return true
*/
- public function updateSiteUser($uid, $data, $site_id)
+ public function editSiteUser($uid, $data, $site_id)
{
Db::startTrans();
try {
//添加用户
- $this->update($uid, $data);
+ $this->edit($uid, $data);
$role_ids = $data['role_ids'] ?? [];
$is_admin = $data['is_admin'] ?? 0;
//创建用户站点管理权限
- (new UserRoleService())->update($site_id, $uid, $role_ids);
+ (new UserRoleService())->edit($site_id, $uid, $role_ids);
Db::commit();
return true;
} catch ( Exception $e) {
@@ -184,7 +184,7 @@ class UserService extends BaseAdminService
$user = $this->model->findOrEmpty($uid);
if ($user->isEmpty())
- throw new AdminException(201001);
+ throw new AdminException('USER_NOT_EXIST');
return $user;
}
@@ -194,7 +194,7 @@ class UserService extends BaseAdminService
* @param array $data
* @return true
*/
- public function update(int $uid, array $data){
+ public function edit(int $uid, array $data){
$user = $this->find($uid);
$user_data = [
];
diff --git a/niucloud/app/service/admin/weapp/WeappConfigService.php b/niucloud/app/service/admin/weapp/WeappConfigService.php
index f256efb8d..99f9492c0 100644
--- a/niucloud/app/service/admin/weapp/WeappConfigService.php
+++ b/niucloud/app/service/admin/weapp/WeappConfigService.php
@@ -11,12 +11,8 @@
namespace app\service\admin\weapp;
-use app\enum\channel\WechatEnum;
-use app\Request;
-use app\service\admin\BaseAdminService;
-
use app\service\core\weapp\CoreWeappConfigService;
-use app\service\core\wechat\CoreWechatConfigService;
+use core\base\BaseAdminService;
/**
* 微信小程序设置
diff --git a/niucloud/app/service/admin/weapp/WeappTemplateService.php b/niucloud/app/service/admin/weapp/WeappTemplateService.php
index d125f207d..53e6073bd 100644
--- a/niucloud/app/service/admin/weapp/WeappTemplateService.php
+++ b/niucloud/app/service/admin/weapp/WeappTemplateService.php
@@ -11,13 +11,13 @@
namespace app\service\admin\weapp;
-use app\service\admin\BaseAdminService;
-use app\service\admin\message\MessageService;
-use app\service\core\message\CoreMessageService;
-use app\service\core\weapp\CoreWeappTemplateService;
-use app\service\core\wechat\CoreWechatTemplateService;
+use app\enum\notice\NoticeTypeEnum;
+use app\service\admin\notice\NoticeService;
+use app\service\core\notice\CoreNoticeService;
+use core\base\BaseAdminService;
+use core\exception\NoticeException;
+use core\template\TemplateLoader;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use extend\exception\MessageException;
/**
* easywechat主体提供
@@ -34,11 +34,11 @@ class WeappTemplateService extends BaseAdminService
public function getList()
{
$site_id = $this->site_id;
- $core_message_service = new CoreMessageService();
- $list = $core_message_service->getList($site_id);
+ $core_notice_service = new CoreNoticeService();
+ $list = $core_notice_service->getList($site_id);
$template = [];
foreach ($list as $k => $v){
- if(in_array('weapp', $v['support_type'])) $template[] = $v;
+ if(in_array(NoticeTypeEnum::WEAPP, $v['support_type'])) $template[] = $v;
}
return $template;
}
@@ -49,9 +49,9 @@ class WeappTemplateService extends BaseAdminService
*/
public function syncAll(array $keys = []){
$site_id = $this->site_id;
- $core_message_service = new CoreMessageService();
- $list = $core_message_service->getList($site_id, $keys);
- if(empty($list)) throw new MessageException(204009);
+ $core_notice_service = new CoreNoticeService();
+ $list = $core_notice_service->getList($site_id, $keys);
+ if(empty($list)) throw new NoticeException('NOTICE_TEMPLATE_NOT_EXIST');
foreach($list as $v){
$this->syncItem($v);
@@ -70,21 +70,24 @@ class WeappTemplateService extends BaseAdminService
$key = $item['key'];
$weapp_json = $item['wechat_json'];
$temp_key = $weapp_json['temp_key'] ?? '';
- if(empty($temp_key)) $error = 204010;
+ if(empty($temp_key)) $error = 'WECHAT_TEMPLATE_NEED_NO';
$weapp_template_id = $item['weapp_template_id'];
//删除原来的消息模板
- (new CoreWeappTemplateService())->deleteTemplate($this->site_id, $weapp_template_id);
+ $template_loader = (new TemplateLoader(NoticeTypeEnum::WEAPP, ['site_id' => $this->site_id]));
+ $template_loader->delete(['template_id' => $weapp_template_id ]);
+// (new CoreWeappTemplateService())->deleteTemplate($this->site_id, $weapp_template_id);
//新的消息模板
$tid = $weapp_json['tid'] ?? '';
$kid_list = $weapp_json['kid_list'] ?? [];
$scene_desc = $weapp_json['scene_desc'] ?? '';
- $res = (new CoreWeappTemplateService())->addTemplate($this->site_id, $tid, $kid_list, $scene_desc);
- $message_service = new MessageService();
+// $res = (new CoreWeappTemplateService())->addTemplate($this->site_id, $tid, $kid_list, $scene_desc);
+ $res = $template_loader->add(['tid' => $tid, 'kid_list' => $kid_list, 'scene_desc' => $scene_desc ]);
+ $notice_service = new NoticeService();
if (isset($res[ 'errcode' ]) && $res[ 'errcode' ] == 0) {
//修改
- $message_service->modify($key, 'weapp_template_id', $res[ 'priTmplId' ]);
+ $notice_service->modify($key, 'weapp_template_id', $res[ 'priTmplId' ]);
} else {
- throw new MessageException($res[ 'errmsg' ]);
+ throw new NoticeException($res[ 'errmsg' ]);
}
return true;
}
diff --git a/niucloud/app/service/admin/wechat/WechatConfigService.php b/niucloud/app/service/admin/wechat/WechatConfigService.php
index 277f6f169..08acb089b 100644
--- a/niucloud/app/service/admin/wechat/WechatConfigService.php
+++ b/niucloud/app/service/admin/wechat/WechatConfigService.php
@@ -11,10 +11,8 @@
namespace app\service\admin\wechat;
-use app\enum\channel\WechatEnum;
-use app\service\admin\BaseAdminService;
-
use app\service\core\wechat\CoreWechatConfigService;
+use core\base\BaseAdminService;
/**
* 微信配置模型
diff --git a/niucloud/app/service/admin/wechat/WechatEventService.php b/niucloud/app/service/admin/wechat/WechatEventService.php
index 83902c947..871a4a967 100644
--- a/niucloud/app/service/admin/wechat/WechatEventService.php
+++ b/niucloud/app/service/admin/wechat/WechatEventService.php
@@ -12,9 +12,8 @@
namespace app\service\admin\wechat;
use app\enum\channel\WechatEnum;
-use app\service\admin\BaseAdminService;
-
use Closure;
+use core\base\BaseAdminService;
/**
* 微信事件中间件类(用于中间件注册)
diff --git a/niucloud/app/service/admin/wechat/WechatFansService.php b/niucloud/app/service/admin/wechat/WechatFansService.php
index d4fa13276..ef735f856 100644
--- a/niucloud/app/service/admin/wechat/WechatFansService.php
+++ b/niucloud/app/service/admin/wechat/WechatFansService.php
@@ -11,7 +11,7 @@
namespace app\service\admin\wechat;
-use app\service\admin\BaseAdminService;
+use core\base\BaseAdminService;
/**
* 微信粉丝
diff --git a/niucloud/app/service/admin/wechat/WechatMenuService.php b/niucloud/app/service/admin/wechat/WechatMenuService.php
index 65756b8e1..5a6f32a3e 100644
--- a/niucloud/app/service/admin/wechat/WechatMenuService.php
+++ b/niucloud/app/service/admin/wechat/WechatMenuService.php
@@ -12,12 +12,11 @@
namespace app\service\admin\wechat;
use app\model\sys\SysConfig;
-use app\service\admin\BaseAdminService;
-
use app\service\core\sys\CoreConfigService;
use app\service\core\wechat\CoreWechatApiService;
+use core\base\BaseAdminService;
+use core\exception\WechatException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use extend\exception\WechatException;
use think\Model;
/**
@@ -44,7 +43,7 @@ class WechatMenuService extends BaseAdminService
* @return SysConfig|bool|Model
* @throws InvalidArgumentException
*/
- public function update(array $data){
+ public function edit(array $data){
$core_wechat_api_service = new CoreWechatApiService();
$menu_result = $core_wechat_api_service->menuCreate($this->site_id, $data);
if(!empty($menu_result['errcode']) && $menu_result['errcode'] != 0)
diff --git a/niucloud/app/service/admin/wechat/WechatReplyService.php b/niucloud/app/service/admin/wechat/WechatReplyService.php
index c319d46f1..8a168d7e8 100644
--- a/niucloud/app/service/admin/wechat/WechatReplyService.php
+++ b/niucloud/app/service/admin/wechat/WechatReplyService.php
@@ -12,10 +12,8 @@
namespace app\service\admin\wechat;
use app\model\wechat\WechatReply;
-use app\service\admin\BaseAdminService;
-
-
use app\service\core\wechat\CoreWechatReplyService;
+use core\base\BaseAdminService;
/**
@@ -64,8 +62,8 @@ class WechatReplyService extends BaseAdminService
* @param $data
* @return void
*/
- public function updateKeyword(int $id, array $data){
- return $this->core_wechat_reply_service->updateKeyword($this->site_id, $id, $data);
+ public function editKeyword(int $id, array $data){
+ return $this->core_wechat_reply_service->editKeyword($this->site_id, $id, $data);
}
/**
@@ -89,8 +87,8 @@ class WechatReplyService extends BaseAdminService
* @param $data
* @return void
*/
- public function updateDefault(array $data){
- return $this->core_wechat_reply_service->updateDefault($this->site_id, $data);
+ public function editDefault(array $data){
+ return $this->core_wechat_reply_service->editDefault($this->site_id, $data);
}
@@ -108,7 +106,7 @@ class WechatReplyService extends BaseAdminService
* @param $data
* @return void
*/
- public function updateSubscribe(array $data){
- return $this->core_wechat_reply_service->updateSubscribe($this->site_id, $data);
+ public function editSubscribe(array $data){
+ return $this->core_wechat_reply_service->editSubscribe($this->site_id, $data);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/wechat/WechatTemplateService.php b/niucloud/app/service/admin/wechat/WechatTemplateService.php
index 174b285df..6da5b3fda 100644
--- a/niucloud/app/service/admin/wechat/WechatTemplateService.php
+++ b/niucloud/app/service/admin/wechat/WechatTemplateService.php
@@ -11,16 +11,14 @@
namespace app\service\admin\wechat;
-use app\service\admin\BaseAdminService;
-use app\service\admin\message\MessageService;
-use app\service\core\BaseCoreService;
-use app\service\core\message\CoreMessageService;
-use app\service\core\wechat\CoreWechatService;
+use app\enum\notice\NoticeTypeEnum;
+use app\service\admin\notice\NoticeService;
+use app\service\core\notice\CoreNoticeService;
use app\service\core\wechat\CoreWechatTemplateService;
-use EasyWeChat\Factory;
+use core\base\BaseAdminService;
+use core\exception\NoticeException;
+use core\template\TemplateLoader;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use extend\exception\MessageException;
-use extend\exception\WechatException;
/**
* easywechat主体提供
@@ -38,9 +36,9 @@ class WechatTemplateService extends BaseAdminService
*/
public function syncAll(array $keys = []){
$site_id = $this->site_id;
- $core_message_service = new CoreMessageService();
- $list = $core_message_service->getList($site_id, $keys);
- if(empty($list)) throw new MessageException(204009);
+ $core_notice_service = new CoreNoticeService();
+ $list = $core_notice_service->getList($site_id, $keys);
+ if(empty($list)) throw new NoticeException('NOTICE_TEMPLATE_NOT_EXIST');
foreach($list as $v){
$this->syncItem($v);
@@ -59,18 +57,21 @@ class WechatTemplateService extends BaseAdminService
$key = $item['key'];
$wechat_json = $item['wechat_json'];
$temp_key = $wechat_json['temp_key'] ?? '';
- if(empty($temp_key)) $error = 204010;
+ if(empty($temp_key)) $error = 'WECHAT_TEMPLATE_NEED_NO';
$wechat_template_id = $item['wechat_template_id'];
//删除原来的消息模板
- (new CoreWechatTemplateService())->deletePrivateTemplate($this->site_id, $wechat_template_id);
+// (new CoreWechatTemplateService())->deletePrivateTemplate($this->site_id, $wechat_template_id);
+ $template_loader = new TemplateLoader('wechat', ['site_id' => $this->site_id]);
+ $template_loader->delete(['templateId' => $wechat_template_id]);
//新的消息模板
- $res = (new CoreWechatTemplateService())->addTemplate($this->site_id, $temp_key);
- $message_service = new MessageService();
+// $res = (new CoreWechatTemplateService())->addTemplate($this->site_id, $temp_key);
+ $res = $template_loader->add(['shortId' => $temp_key]);
+ $notice_service = new NoticeService();
if (isset($res[ 'errcode' ]) && $res[ 'errcode' ] == 0) {
//修改
- $message_service->modify($key, 'wechat_template_id', $res[ 'template_id' ]);
+ $notice_service->modify($key, 'wechat_template_id', $res[ 'template_id' ]);
} else {
- throw new MessageException($res[ 'errmsg' ]);
+ throw new NoticeException($res[ 'errmsg' ]);
}
return true;
}
@@ -82,11 +83,11 @@ class WechatTemplateService extends BaseAdminService
public function getList()
{
$site_id = $this->site_id;
- $core_message_service = new CoreMessageService();
- $list = $core_message_service->getList($site_id);
+ $core_notice_service = new CoreNoticeService();
+ $list = $core_notice_service->getList($site_id);
$template = [];
foreach ($list as $k => $v){
- if(in_array('wechat', $v['support_type'])) $template[] = $v;
+ if(in_array(NoticeTypeEnum::WECHAT, $v['support_type'])) $template[] = $v;
}
return $template;
}
diff --git a/niucloud/app/service/api/agreement/AgreementService.php b/niucloud/app/service/api/agreement/AgreementService.php
index 4b04675c1..c04c1217f 100644
--- a/niucloud/app/service/api/agreement/AgreementService.php
+++ b/niucloud/app/service/api/agreement/AgreementService.php
@@ -12,8 +12,8 @@
namespace app\service\api\agreement;
-use app\service\api\BaseApiService;
use app\service\core\sys\CoreAgreementService;
+use core\base\BaseApiService;
/**
* 协议服务类
diff --git a/niucloud/app/service/api/article/ArticleCategoryService.php b/niucloud/app/service/api/article/ArticleCategoryService.php
index 4de574609..ee2531c22 100644
--- a/niucloud/app/service/api/article/ArticleCategoryService.php
+++ b/niucloud/app/service/api/article/ArticleCategoryService.php
@@ -12,7 +12,7 @@
namespace app\service\api\article;
use app\model\article\ArticleCategory;
-use app\service\api\BaseApiService;
+use core\base\BaseApiService;
/**
* 文章分类(栏目)服务层
diff --git a/niucloud/app/service/api/article/ArticleService.php b/niucloud/app/service/api/article/ArticleService.php
index 8de93a030..c99438cba 100644
--- a/niucloud/app/service/api/article/ArticleService.php
+++ b/niucloud/app/service/api/article/ArticleService.php
@@ -12,7 +12,7 @@
namespace app\service\api\article;
use app\model\article\Article;
-use app\service\api\BaseApiService;
+use core\base\BaseApiService;
/**
* 文章服务层
diff --git a/niucloud/app/service/api/captcha/CaptchaService.php b/niucloud/app/service/api/captcha/CaptchaService.php
index 143a48814..e4a7022b2 100644
--- a/niucloud/app/service/api/captcha/CaptchaService.php
+++ b/niucloud/app/service/api/captcha/CaptchaService.php
@@ -11,13 +11,11 @@
namespace app\service\api\captcha;
-use app\service\api\BaseApiService;
use app\service\core\captcha\CoreCaptchaService;
+use core\base\BaseApiService;
/**
- * 文章服务层
- * Class ArticleService
- * @package app\service\api\article
+ * 验证码服务层
*/
class CaptchaService extends BaseApiService
{
@@ -34,7 +32,7 @@ class CaptchaService extends BaseApiService
* @return array|null
*/
public function create(?array $data = []){
- return (new CoreCaptchaService())->create($this->site_id);
+ return (new CoreCaptchaService())->create(0);
}
/**
@@ -42,7 +40,7 @@ class CaptchaService extends BaseApiService
* @return true
*/
public function check(){
- return (new CoreCaptchaService())->check($this->site_id);
+ return (new CoreCaptchaService())->check(0);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/diy/DiyConfigService.php b/niucloud/app/service/api/diy/DiyConfigService.php
index 48c4a701b..5b26bc6fa 100644
--- a/niucloud/app/service/api/diy/DiyConfigService.php
+++ b/niucloud/app/service/api/diy/DiyConfigService.php
@@ -11,8 +11,8 @@
namespace app\service\api\diy;
-use app\service\api\BaseApiService;
use app\service\core\diy\CoreDiyConfigService;
+use core\base\BaseApiService;
/**
* 自定义页面相关配置服务层
diff --git a/niucloud/app/service/api/diy/DiyRouteService.php b/niucloud/app/service/api/diy/DiyRouteService.php
index 3e1418751..e60a7edc7 100644
--- a/niucloud/app/service/api/diy/DiyRouteService.php
+++ b/niucloud/app/service/api/diy/DiyRouteService.php
@@ -12,7 +12,7 @@
namespace app\service\api\diy;
use app\model\diy\DiyRoute;
-use app\service\api\BaseApiService;
+use core\base\BaseApiService;
/**
* 自定义路由表服务层
@@ -30,13 +30,13 @@ class DiyRouteService extends BaseApiService
/**
* 获取页面分享信息
- * @param array $params
+ * @param array $data
* @return array|void
*/
- public function getShare(array $params = [])
+ public function getShare(array $data = [])
{
$field = 'id,title,name,page,share,is_share';
- $info = $this->model->field($field)->where([ [ 'page', '=', $params[ 'route' ] ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray();
+ $info = $this->model->field($field)->where([ [ 'page', '=', $data[ 'route' ] ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray();
$share = [];
if (!empty($info[ 'share' ])) {
$share = json_decode($info[ 'share' ], true);
@@ -44,19 +44,20 @@ class DiyRouteService extends BaseApiService
$share[ 'query' ] = '';
$query = [];
- if (!empty($params[ 'params' ])) {
- $param = explode(',', $params[ 'params' ]);
- foreach ($param as $k => $v) {
- $query[] = $v;
- }
+ if (!empty($data[ 'params' ])) {
+ $query = json_decode($data[ 'params' ], true);
}
if ($this->member_id > 0) {
- $query[] = 'mid=' . $this->member_id;
+ $query[ 'mid' ] = $this->member_id;
}
if (!empty($query)) {
- $share[ 'query' ] = implode('&', $query);
+ $str = [];
+ foreach ($query as $k => $v) {
+ $str[] = $k . '=' . $v;
+ }
+ $share[ 'query' ] = implode('&', $str);
}
$share[ 'url' ] = $share[ 'route' ] . ( $share[ 'query' ] ? '?' . $share[ 'query' ] : '' );
diff --git a/niucloud/app/service/api/diy/DiyService.php b/niucloud/app/service/api/diy/DiyService.php
index a7bac69a6..a03e91f92 100644
--- a/niucloud/app/service/api/diy/DiyService.php
+++ b/niucloud/app/service/api/diy/DiyService.php
@@ -12,7 +12,7 @@
namespace app\service\api\diy;
use app\model\diy\Diy;
-use app\service\api\BaseApiService;
+use core\base\BaseApiService;
/**
* 自定义页面服务层
diff --git a/niucloud/app/service/api/login/AuthService.php b/niucloud/app/service/api/login/AuthService.php
index 5c5ed41be..b835695e8 100644
--- a/niucloud/app/service/api/login/AuthService.php
+++ b/niucloud/app/service/api/login/AuthService.php
@@ -13,9 +13,10 @@ namespace app\service\api\login;
use app\model\member\Member;
use app\Request;
-use app\service\api\BaseApiService;
use app\service\api\member\MemberService;
-use extend\exception\AuthException;
+use app\service\core\site\CoreSiteService;
+use core\base\BaseApiService;
+use core\exception\AuthException;
/**
* 登录服务层
@@ -33,12 +34,13 @@ class AuthService extends BaseApiService
public function checkSiteAuth(Request $request){
$site_id = $request->apiSiteId();//todo 可以是依赖传值,也可以通过domain域名来获取site_id
+ if(empty((new CoreSiteService())->getSiteCache($site_id))) throw new AuthException('SITE_NOT_EXIST');
//如果登录信息非法就报错
if($this->member_id > 0){
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['member_id' => $this->member_id, 'site_id' => $site_id]);
if($member_info->isEmpty())
- throw new AuthException(301005);
+ throw new AuthException('MEMBER_NOT_EXIST');
}
$request->siteId($site_id);
@@ -54,22 +56,22 @@ class AuthService extends BaseApiService
if(empty($mobile)){
$result = (new CoreWeappAuthService())->getUserPhoneNumber($this->site_id, $mobile_code);
- if(empty($result)) throw new ApiException(400002);
+ if(empty($result)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$phone_info = $result['phone_info'];
$mobile = $phone_info['purePhoneNumber'];
- if(empty($mobile)) throw new ApiException(400002);
+ if(empty($mobile)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
}
$member_service = new MemberService();
$member = $member_service->findMemberInfo(['member_id' => $this->member_id, 'site_id' => $this->site_id]);
- if($member->isEmpty()) throw new AuthException(301005);
+ if($member->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');
$o_mobile = $member['mobile'];//原始手机号
- if(!empty($o_mobile)) throw new AuthException(301020);
+ if(!empty($o_mobile)) throw new AuthException('MOBILE_IS_BIND_MEMBER');
$mobile_member = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]);
- if(!$mobile_member->isEmpty()) throw new AuthException(301001);
+ if(!$mobile_member->isEmpty()) throw new AuthException('MOBILE_IS_EXIST');
- if(empty($mobile)) throw new AuthException(301012);//必须填写
+ if(empty($mobile)) throw new AuthException('MOBILE_NEEDED');//必须填写
//todo 校验手机号验证码
(new LoginService())->checkMobileCode($mobile);
$member->save([
diff --git a/niucloud/app/service/api/login/LoginService.php b/niucloud/app/service/api/login/LoginService.php
index 9764544e3..902f9d206 100644
--- a/niucloud/app/service/api/login/LoginService.php
+++ b/niucloud/app/service/api/login/LoginService.php
@@ -15,15 +15,15 @@ use app\enum\member\MemberLoginTypeEnum;
use app\enum\sys\AppTypeEnum;
use app\enum\sys\SmsEnum;
use app\model\member\Member;
-use app\service\api\BaseApiService;
use app\service\api\captcha\CaptchaService;
use app\service\api\member\MemberConfigService;
use app\service\api\member\MemberService;
-use app\service\api\message\MessageService;
+use app\service\api\notice\NoticeService;
+use core\base\BaseApiService;
+use core\exception\ApiException;
+use core\exception\AuthException;
+use core\util\TokenAuth;
use Exception;
-use extend\exception\ApiException;
-use extend\exception\AuthException;
-use extend\util\TokenUtil;
use think\facade\Cache;
use think\facade\Log;
@@ -53,7 +53,7 @@ class LoginService extends BaseApiService
}
/**
- * 陆操作
+ * 登录操作
* @param Member $member_info
* @param string $type 登录的操作终端类型
* @return array
@@ -62,7 +62,7 @@ class LoginService extends BaseApiService
{
//绑定第三方授权
$this->bingOpenid($member_info);
- if (!$member_info->status) throw new ApiException(301004);
+ if (!$member_info->status) throw new ApiException('MEMBER_LOCK');
$member_info->login_time = time();
$member_info->login_ip = $this->request->ip();
$member_info->login_channel = $this->channel;
@@ -89,7 +89,7 @@ class LoginService extends BaseApiService
{
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['username' => $username, 'site_id' => $this->site_id]);
- if ($member_info->isEmpty()) throw new AuthException(301005);//账号不存在
+ if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
if (!check_password($password, $member_info->password)) return false;//密码与账号不匹配
return $this->login($member_info, MemberLoginTypeEnum::USERNAME);
}
@@ -106,10 +106,10 @@ class LoginService extends BaseApiService
//登录注册配置
$config = (new MemberConfigService())->getLoginConfig();
$is_mobile = $config['is_mobile'];
- if($is_mobile != 1) throw new AuthException(102010);
+ if($is_mobile != 1) throw new AuthException('MOBILE_LOGIN_UNOPENED');
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]);
- if ($member_info->isEmpty()) throw new AuthException(301005);//账号不存在
+ if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
return $this->login($member_info, MemberLoginTypeEnum::MOBILE);
}
@@ -121,7 +121,7 @@ class LoginService extends BaseApiService
public function createToken($member_info): ?array
{
$expire_time = env('system.api_token_expire_time') ?? 3600;//todo 不一定和管理端合用这个token时限
- $token_info = TokenUtil::createToken($member_info->member_id, AppTypeEnum::API, ['member_id' => $member_info->member_id, 'username' => $member_info->username, 'site_id' => $member_info->site_id], $expire_time);
+ $token_info = TokenAuth::createToken($member_info->member_id, AppTypeEnum::API, ['member_id' => $member_info->member_id, 'username' => $member_info->username, 'site_id' => $member_info->site_id], $expire_time);
return $token_info;
}
@@ -140,7 +140,7 @@ class LoginService extends BaseApiService
*/
public static function clearToken(int $member_id, ?string $token = ''): ?bool
{
- TokenUtil::clearToken($member_id, AppTypeEnum::API, $token);
+ TokenAuth::clearToken($member_id, AppTypeEnum::API, $token);
return true;
}
@@ -155,21 +155,21 @@ class LoginService extends BaseApiService
if(empty($token))
{
//定义专属于授权认证机制的错误响应, 定义专属语言包
- throw new AuthException(101001, 401);
+ throw new AuthException('MUST_LOGIN', 401);
}
try {
- $token_info = TokenUtil::parseToken($token, AppTypeEnum::API);
+ $token_info = TokenAuth::parseToken($token, AppTypeEnum::API);
} catch ( \Throwable $e ) {
// if(env('app_debug', false)){
// throw new AuthException($e->getMessage(), 401);
// }else{
- throw new AuthException(101002, 401);
+ throw new AuthException('LOGIN_EXPIRE', 401);
// }
}
if(!$token_info)
{
- throw new AuthException(101001, 401);
+ throw new AuthException('MUST_LOGIN', 401);
}
//验证有效次数或过期时间
return $token_info;
@@ -184,11 +184,11 @@ class LoginService extends BaseApiService
*/
public function sendMobileCode($mobile, string $type = ''){
(new CaptchaService())->check();
- if(empty($mobile)) throw new AuthException(301012);
+ if(empty($mobile)) throw new AuthException('MOBILE_NEEDED');
//发送
- if(!in_array($type, SmsEnum::SCENE_TYPE)) throw new AuthException(301015);
+ if(!in_array($type, SmsEnum::SCENE_TYPE)) throw new AuthException('MEMBER_MOBILE_CAPTCHA_ERROR');
$code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);// 生成4位随机数,左侧补0
- (new MessageService())->send('member_verify_code', ['code' => $code, 'mobile' => $mobile], false);
+ (new NoticeService())->send('member_verify_code', ['code' => $code, 'mobile' => $mobile]);
//将验证码存入缓存
$key = md5(uniqid(null, true));
$cache_tag_name = "mobile_key".$mobile.$type;
@@ -213,16 +213,16 @@ class LoginService extends BaseApiService
* @return void
*/
public function checkMobileCode(string|int $mobile){
- if(empty($mobile)) throw new AuthException(301012);
+ if(empty($mobile)) throw new AuthException('MOBILE_NEEDED');
$mobile_key = request()->param('mobile_key', '');
$mobile_code = request()->param('mobile_code', '');
- if(empty($mobile_key) || empty($mobile_code)) throw new AuthException(301013);
+ if(empty($mobile_key) || empty($mobile_code)) throw new AuthException('MOBILE_CAPTCHA_ERROR');
$cache = Cache::get($mobile_key);
- if(empty($cache)) throw new AuthException(301013);
+ if(empty($cache)) throw new AuthException('MOBILE_CAPTCHA_ERROR');
$temp_mobile = $cache['mobile'];
$temp_code = $cache['code'];
$temp_type = $cache['type'];
- if($temp_mobile != $mobile || $temp_code != $mobile_code) throw new AuthException(301013);
+ if($temp_mobile != $mobile || $temp_code != $mobile_code) throw new AuthException('MOBILE_CAPTCHA_ERROR');
$this->clearMobileCode($temp_mobile, $temp_type);
return true;
@@ -256,7 +256,7 @@ class LoginService extends BaseApiService
$member->save();
}else{
if( $member->$openid_field != $open_id){
- throw new AuthException(301014);
+ throw new AuthException('MEMBER_IS_BIND_AUTH');
}
}
}
@@ -277,13 +277,13 @@ class LoginService extends BaseApiService
//校验手机验证码
$this->checkMobileCode($mobile);
$member_info = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]);
- if ($member_info->isEmpty()) throw new AuthException(301019);//账号不存在
+ if ($member_info->isEmpty()) throw new AuthException('MOBILE_NOT_EXIST_MEMBER');//账号不存在
//todo 需要考虑一下,新的密码和原密码一样能否通过验证
$password_hash = create_password($password);
$data = array(
'password' => $password_hash,
);
- return $member_service->updateByFind($member_info, $data);
+ return $member_service->editByFind($member_info, $data);
}
public function loginScanCode(){
diff --git a/niucloud/app/service/api/login/RegisterService.php b/niucloud/app/service/api/login/RegisterService.php
index 26419b1fb..f8a0acc96 100644
--- a/niucloud/app/service/api/login/RegisterService.php
+++ b/niucloud/app/service/api/login/RegisterService.php
@@ -14,11 +14,11 @@ namespace app\service\api\login;
use app\enum\member\MemberLoginTypeEnum;
use app\enum\member\MemberRegisterTypeEnum;
use app\model\member\Member;
-use app\service\api\BaseApiService;
use app\service\api\captcha\CaptchaService;
use app\service\api\member\MemberConfigService;
use app\service\api\member\MemberService;
-use extend\exception\AuthException;
+use core\base\BaseApiService;
+use core\exception\AuthException;
/**
* 登录服务层
@@ -42,7 +42,7 @@ class RegisterService extends BaseApiService
{
//校验注册方式
if(empty(MemberRegisterTypeEnum::getType()[$type]))
- throw new AuthException(301009);
+ throw new AuthException('REG_CHANNEL_NOT_EXIST');
$data = $this->bindByMobile($mobile, $data, $type, $is_verify_mobile);
$member_service = new MemberService();
if(!is_array($data)){
@@ -53,6 +53,7 @@ class RegisterService extends BaseApiService
}
$data['register_channel'] = $this->channel;
$data['register_type'] = $type;
+ $data['site_id'] = $this->site_id;
$pid = $this->request->get('pid');
if($pid > 0){
$p_member_info = $member_service->findMemberInfo(['member_id' => $pid, 'site_id' => $this->site_id]);
@@ -63,7 +64,7 @@ class RegisterService extends BaseApiService
event('memberRegister', $data);
}
$member_info = $member_service->findMemberInfo(['member_id' => $member_id, 'site_id' => $this->site_id]);
- if ($member_info->isEmpty()) throw new AuthException(301005);//账号已存在
+ if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号已存在
$result = (new LoginService())->login($member_info, $type);
return $result;
}
@@ -98,10 +99,10 @@ class RegisterService extends BaseApiService
$config = (new MemberConfigService())->getLoginConfig();
$is_username = $config['is_username'];
//未开启账号密码登录注册
- if($is_username != 1) throw new AuthException(301010);
+ if($is_username != 1) throw new AuthException('MEMBER_USERNAME_LOGIN_NOT_OPEN');
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['username' => $username, 'site_id' => $this->site_id]);
- if (!$member_info->isEmpty()) throw new AuthException(301008);//账号已存在
+ if (!$member_info->isEmpty()) throw new AuthException('MEMBER_IS_EXIST');//账号已存在
$password_hash = create_password($password);
$data = array(
@@ -122,10 +123,10 @@ class RegisterService extends BaseApiService
$config = (new MemberConfigService())->getLoginConfig();
$is_mobile = $config['is_mobile'];
//未开启账号密码登录注册
- if($is_mobile != 1) throw new AuthException(301010);
+ if($is_mobile != 1) throw new AuthException('MEMBER_USERNAME_LOGIN_NOT_OPEN');
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]);
- if (!$member_info->isEmpty()) throw new AuthException(301008);//账号已存在
+ if (!$member_info->isEmpty()) throw new AuthException('MEMBER_IS_EXIST');//账号已存在
$data = array(
'mobile' => $mobile,
@@ -141,7 +142,7 @@ class RegisterService extends BaseApiService
public function checkAuth(){
$config = (new MemberConfigService())->getLoginConfig();
$is_auth_register = $config['is_auth_register'];
- if($is_auth_register != 1) throw new AuthException(301011);//手机号已存在
+ if($is_auth_register != 1) throw new AuthException('AUTH_LOGIN_NOT_OPEN');//手机号已存在
return true;
}
@@ -164,7 +165,7 @@ class RegisterService extends BaseApiService
MemberLoginTypeEnum::WEAPP => 'weapp_openid',
};
if($type == MemberLoginTypeEnum::MOBILE || $is_bind_mobile == 1){
- if(empty($mobile)) throw new AuthException(301012);//必须填写
+ if(empty($mobile)) throw new AuthException('MOBILE_NEEDED');//必须填写
//todo 校验手机号验证码
if($is_verify){
(new LoginService())->checkMobileCode($mobile);
@@ -174,9 +175,9 @@ class RegisterService extends BaseApiService
$member = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]);
if(!$member->isEmpty()){
if($type == MemberLoginTypeEnum::MOBILE){
- throw new AuthException(301001);//手机号注册时发现手机号已存在账号
+ throw new AuthException('MOBILE_IS_EXIST');//手机号注册时发现手机号已存在账号
} else{
- if($member->$with_field != '') throw new AuthException(301001);//手机号已存在
+ if($member->$with_field != '') throw new AuthException('MOBILE_IS_EXIST');//手机号已存在
foreach($data as $k => $v){
$member->$k = $v;
}
diff --git a/niucloud/app/service/api/member/MemberAccountService.php b/niucloud/app/service/api/member/MemberAccountService.php
index 9fcbe223f..babecd302 100644
--- a/niucloud/app/service/api/member/MemberAccountService.php
+++ b/niucloud/app/service/api/member/MemberAccountService.php
@@ -12,7 +12,7 @@
namespace app\service\api\member;
use app\model\member\MemberAccountLog;
-use app\service\api\BaseApiService;
+use core\base\BaseApiService;
/**
* 会员账户流水服务层(会员个人账户通过会员服务层查询)
@@ -21,6 +21,7 @@ use app\service\api\BaseApiService;
*/
class MemberAccountService extends BaseApiService
{
+
public function __construct()
{
parent::__construct();
@@ -34,11 +35,12 @@ class MemberAccountService extends BaseApiService
*/
public function getPage(array $where = [])
{
- $where[] = [['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]];
+ $where['member_id'] = $this->member_id;
$field = 'id, member_id, site_id, account_type, account_data, from_type, related_id, create_time, memo';
- return $this->getPageList($this->model, $where, $field, 'create_time desc', ['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'],$where)->field($field)->order('create_time desc')->append(['from_type_name', 'account_type_name']);
+ $list = $this->pageQuery($search_model);
+ return $list;
}
-
/**
* 账户流水详情
* @param int $id
@@ -47,6 +49,19 @@ class MemberAccountService extends BaseApiService
public function getInfo(int $id)
{
$field = 'id, member_id, site_id, account_type, account_data, from_type, related_id, create_time, memo';
- return $this->model->where([['id', '=', $id], ['site_id', '=', $this->site_id]])->field($field)->append(['from_type_name', 'account_type_name'])->findOrEmpty()->toArray();
+ return $this->model->where([['id', '=', $id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->field($field)->append(['from_type_name', 'account_type_name'])->findOrEmpty()->toArray();
}
+
+ /**
+ * 会员账户统计数量
+ * @param array $where
+ * @return int
+ * @throws \think\db\exception\DbException
+ */
+ public function getCount(array $where = []){
+ $where['member_id'] = $this->member_id;
+
+ return $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','account_type', 'from_type', 'create_time'],$where)->count();
+ }
+
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/member/MemberCashOutAccountService.php b/niucloud/app/service/api/member/MemberCashOutAccountService.php
new file mode 100644
index 000000000..d90a3b138
--- /dev/null
+++ b/niucloud/app/service/api/member/MemberCashOutAccountService.php
@@ -0,0 +1,109 @@
+model = new MemberCashOutAccount();
+ }
+
+ /**
+ * 会员提现账户列表
+ * @param array $where
+ * @return mixed
+ */
+ public function getPage(array $where = [])
+ {
+ $where['member_id'] = $this->member_id;
+ $where['site_id'] = $this->site_id;
+ $field = 'account_id,site_id,member_id,account_type,bank_name,realname,account_no';
+ $search_model = $this->model->where($where)->field($field)->order('create_time desc');
+
+ $list = $this->pageQuery($search_model);
+ return $list;
+ }
+
+ /**
+ * 提现账户详情
+ * @param int $account_id
+ * @return array
+ */
+ public function getInfo(int $account_id)
+ {
+ $field = 'account_id,site_id,member_id,account_type,bank_name,realname,account_no';
+ return $this->model->where([['account_id', '=', $account_id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->toArray();
+ }
+
+ /**
+ * 获取首条信息
+ * @param array $where
+ * @return array
+ */
+ public function getFirstInfo(array $where, $order_field = 'create_time', string $order = 'desc'){
+ $where[] = ['site_id', '=', $this->site_id];
+ $where[] = ['member_id', '=', $this->member_id];
+ $field = 'account_id,site_id,member_id,account_type,bank_name,realname,account_no';
+ return $this->model->where($where)->order($order_field, $order)->field($field)->findOrEmpty()->toArray();
+ }
+
+ /**
+ * 添加提现账号
+ * @param array $data
+ * @return void
+ */
+ public function add(array $data)
+ {
+ $data['site_id'] = $this->site_id;
+ $data['member_id'] = $this->member_id;
+ $data['create_time'] = time();
+ $res = $this->model->create($data);
+ return $res->account_id;
+ }
+
+ /**
+ * 修改提现账户
+ * @param int $account_id
+ * @param array $data
+ * @return true
+ */
+ public function edit(int $account_id, array $data)
+ {
+ $data['update_time'] = time();
+ $this->model->update($data, [ [ 'site_id', '=', $this->site_id ], [ 'member_id', '=', $this->member_id ], ['account_id', '=', $account_id] ]);
+ return true;
+ }
+
+ /**
+ * 删除
+ * @param int $uid
+ * @return mixed
+ */
+ public function del(int $account_id)
+ {
+ $where = [
+ ['member_id', '=', $this->member_id],
+ ['site_id', '=', $this->site_id],
+ ['account_id', '=', $account_id]
+ ];
+ $this->model->where($where)->delete();
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/api/member/MemberWithdrawService.php b/niucloud/app/service/api/member/MemberCashOutService.php
similarity index 53%
rename from niucloud/app/service/api/member/MemberWithdrawService.php
rename to niucloud/app/service/api/member/MemberCashOutService.php
index 30a31956d..9a1c72bfd 100644
--- a/niucloud/app/service/api/member/MemberWithdrawService.php
+++ b/niucloud/app/service/api/member/MemberCashOutService.php
@@ -11,27 +11,23 @@
namespace app\service\api\member;
-use app\enum\member\MemberWithdrawEnum;
-use app\model\member\MemberWithdraw;
-use app\service\api\BaseApiService;
-use app\service\core\member\CoreMemberAccountService;
+use app\enum\member\MemberCashOutEnum;
+use app\model\member\MemberCashOut;
+use app\service\core\member\CoreMemberCashOutService;
use app\service\core\member\CoreMemberConfigService;
-use app\service\core\member\CoreMemberService;
-use app\service\core\member\CoreMemberWithdrawService;
-use extend\exception\ApiException;
-use extend\exception\CommonException;
+use core\base\BaseApiService;
+use core\exception\ApiException;
+use core\exception\CommonException;
/**
* 会员提现服务层
- * Class MemberWithdrawService
- * @package app\service\admin\member
*/
-class MemberWithdrawService extends BaseApiService
+class MemberCashOutService extends BaseApiService
{
public function __construct()
{
parent::__construct();
- $this->model = new MemberWithdraw();
+ $this->model = new MemberCashOut();
}
/**
@@ -42,8 +38,9 @@ class MemberWithdrawService extends BaseApiService
public function getPage(array $where = [])
{
$where['member_id'] = $this->member_id;
- $field = 'id,site_id,withdraw_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_voucher,transfer_remark,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason';
- $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['member_id','status', 'create_time'],$where)->with(['memberInfo', 'transfer'])->field($field)->order('create_time desc');
+ $where['site_id'] = $this->site_id;
+ $field = 'id,site_id,cash_out_no,member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason';
+ $search_model = $this->model->where($where)->withSearch(['member_id','status', 'create_time'],$where)->with(['memberInfo', 'transfer'])->field($field)->append(['account_type_name', 'transfer_type_name', 'status_name', 'transfer_status_name'])->order('create_time desc');
$list = $this->pageQuery($search_model);
return $list;
@@ -56,8 +53,8 @@ class MemberWithdrawService extends BaseApiService
*/
public function getInfo(int $id)
{
- $field = 'id,site_id,withdraw_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_voucher,transfer_remark,transfer_fail_reason,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason';
- return $this->model->where([['id', '=', $id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->with(['memberInfo', 'transfer'])->field($field)->findOrEmpty()->toArray();
+ $field = 'id,site_id,cash_out_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason';
+ return $this->model->where([['id', '=', $id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->with(['memberInfo', 'transfer'])->field($field)->append(['account_type_name', 'transfer_type_name', 'status_name', 'transfer_status_name'])->findOrEmpty()->toArray();
}
@@ -68,7 +65,7 @@ class MemberWithdrawService extends BaseApiService
*/
public function apply(array $data){
- return (new CoreMemberWithdrawService())->apply($this->site_id, $this->member_id, $data);
+ return (new CoreMemberCashOutService())->apply($this->site_id, $this->member_id, $data);
}
@@ -80,20 +77,22 @@ class MemberWithdrawService extends BaseApiService
* @return true
*/
public function cancel(int $id){
- $withdraw = $this->model->where([
+ $cash_out = $this->model->where([
['site_id', '=', $this->site_id],
['id', '=', $id],
['member_id', '=', $this->member_id],
])->findOrEmpty();
- if($withdraw->isEmpty()) throw new ApiException(302004);
- if($withdraw['status'] != MemberWithdrawEnum::WAIT_AUDIT) throw new CommonException(302011);
- $withdraw->save(
+
+ if($cash_out->isEmpty()) throw new ApiException('RECHARGE_LOG_NOT_EXIST');
+ if($cash_out['status'] != MemberCashOutEnum::WAIT_AUDIT) throw new CommonException('CASHOUT_STATUS_NOT_IN_WAIT_AUDIT');
+ $cash_out->save(
+
[
'cancel_time' => time(),
- 'status' => MemberWithdrawEnum::CANCEL
+ 'status' => MemberCashOutEnum::CANCEL
]
);
- (new CoreMemberConfigService())->returnMember($this->site_id, $withdraw);
+ (new CoreMemberConfigService())->returnMember($this->site_id, $cash_out);
return true;
}
@@ -101,8 +100,8 @@ class MemberWithdrawService extends BaseApiService
* 获取提现配置
* @return array
*/
- public function getWithdrawConfig(){
- return (new CoreMemberConfigService())->getWithdrawConfig($this->site_id);
+ public function getCashOutConfig(){
+ return (new CoreMemberConfigService())->getCashOutConfig($this->site_id);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/member/MemberConfigService.php b/niucloud/app/service/api/member/MemberConfigService.php
index fb41f8730..24026a02e 100644
--- a/niucloud/app/service/api/member/MemberConfigService.php
+++ b/niucloud/app/service/api/member/MemberConfigService.php
@@ -11,8 +11,8 @@
namespace app\service\api\member;
-use app\service\api\BaseApiService;
use app\service\core\member\CoreMemberConfigService;
+use core\base\BaseApiService;
/**
* 会员配置服务层
diff --git a/niucloud/app/service/core/BaseCoreService.php b/niucloud/app/service/api/member/MemberLogService.php
similarity index 62%
rename from niucloud/app/service/core/BaseCoreService.php
rename to niucloud/app/service/api/member/MemberLogService.php
index cff986f27..87b3fedc0 100644
--- a/niucloud/app/service/core/BaseCoreService.php
+++ b/niucloud/app/service/api/member/MemberLogService.php
@@ -9,21 +9,32 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core;
+namespace app\service\api\member;
-use app\service\BaseService;
+use core\base\BaseApiService;
/**
- * 系统基础服务层
- * Class BaseCoreService
- * @package app\service\core
+ * 会员日志服务层
+ * Class MemberService
+ * @package app\service\api\member
*/
-class BaseCoreService extends BaseService
+class MemberLogService extends BaseApiService
{
-
-
public function __construct()
{
parent::__construct();
+
}
+
+ /**
+ * 会员日志
+ * @param array $data
+ * @return true
+ */
+ public function log(array $data){
+ (new MemberService())->edit(['last_visit_time' => time()]);
+ return true;
+ }
+
+
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/member/MemberService.php b/niucloud/app/service/api/member/MemberService.php
index 4fc08aee4..927ea2a73 100644
--- a/niucloud/app/service/api/member/MemberService.php
+++ b/niucloud/app/service/api/member/MemberService.php
@@ -12,9 +12,9 @@
namespace app\service\api\member;
use app\model\member\Member;
-use app\service\api\BaseApiService;
use app\service\core\member\CoreMemberService;
-use extend\exception\ApiException;
+use core\base\BaseApiService;
+use core\exception\ApiException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
@@ -48,12 +48,12 @@ class MemberService extends BaseApiService
* @param array $data
* @return true
*/
- public function update(array $data)
+ public function edit(array $data)
{
$member = $this->findMemberInfo(['member_id' => $this->member_id, 'site_id' => $this->site_id]);
- if($member->isEmpty()) throw new ApiException(301005);
- $member->allowField(['nickname', 'headimg', 'birthday', 'sex'])->save($data);
+ if($member->isEmpty()) throw new ApiException('MEMBER_NOT_EXIST');
+ $member->allowField(['nickname', 'headimg', 'birthday', 'sex', 'last_visit_time'])->save($data);
return true;
}
@@ -66,7 +66,7 @@ class MemberService extends BaseApiService
*/
public function getInfo()
{
- $field = 'member_id, site_id, username, mobile, register_channel, nickname, headimg, member_level, member_label, login_ip, login_type, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, balance, growth, is_member, member_time, is_del, province_id, city_id, district_id, address, location, money, money_get';
+ $field = 'member_id, site_id, username, mobile, register_channel, nickname, headimg, member_level, member_label, login_ip, login_type, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, balance, growth, is_member, member_time, is_del, province_id, city_id, district_id, address, location, money, money_get, wx_openid, weapp_openid, commission, commission_get, commission_cash_outing';
return $this->model->where([['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->append(['sex_name'])->toArray();
}
@@ -75,7 +75,7 @@ class MemberService extends BaseApiService
*/
public function center()
{
- $field = 'member_id, site_id, username, mobile, register_channel, nickname, headimg, member_level, member_label, login_ip, login_type, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, balance, growth, is_member, member_time, is_del, province_id, city_id, district_id, address, location, money, money_get';
+ $field = 'member_id, site_id, username, mobile, register_channel, nickname, headimg, member_level, member_label, login_ip, login_type, login_time, create_time, last_visit_time, last_consum_time, sex, status, birthday, point, balance, growth, is_member, member_time, is_del, province_id, city_id, district_id, address, location, money, money_get, commission, commission_get, commission_cash_outing';
return $this->model->where([['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->append(['sex_name'])->toArray();
}
@@ -116,7 +116,7 @@ class MemberService extends BaseApiService
* @param $data
* @return void
*/
- public function updateByFind($member, $data){
+ public function editByFind($member, $data){
return $member->save($data);
}
/**
diff --git a/niucloud/app/service/api/message/MessageService.php b/niucloud/app/service/api/notice/NoticeService.php
similarity index 73%
rename from niucloud/app/service/api/message/MessageService.php
rename to niucloud/app/service/api/notice/NoticeService.php
index 4a7699304..2f7b274be 100644
--- a/niucloud/app/service/api/message/MessageService.php
+++ b/niucloud/app/service/api/notice/NoticeService.php
@@ -9,17 +9,17 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\api\message;
+namespace app\service\api\notice;
-use app\service\api\BaseApiService;
-use app\service\core\message\CoreMessageService;
+use app\service\core\notice\CoreNoticeService;
+use core\base\BaseApiService;
/**
* 登录服务层
* Class BaseService
* @package app\service
*/
-class MessageService extends BaseApiService
+class NoticeService extends BaseApiService
{
public function __construct()
@@ -34,8 +34,8 @@ class MessageService extends BaseApiService
* @param bool $is_delay 是否延时
* @return bool
*/
- public function send($key, $data, bool $is_delay = true)
+ public function send($key, $data)
{
- return ( new CoreMessageService() )->send($this->site_id, $key, $data, $is_delay);
+ return ( new \app\service\core\notice\NoticeService() )->send($this->site_id, $key, $data);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/order/RechargeOrderService.php b/niucloud/app/service/api/order/RechargeOrderService.php
index ef5460193..679e0a5cb 100644
--- a/niucloud/app/service/api/order/RechargeOrderService.php
+++ b/niucloud/app/service/api/order/RechargeOrderService.php
@@ -11,8 +11,10 @@
namespace app\service\api\order;
-use app\service\api\BaseApiService;
+use app\enum\order\RechargeOrderEnum;
+use app\model\order\Order;
use app\service\core\order\recharge\CoreRechargeOrderService;
+use core\base\BaseApiService;
/**
*充值订单服务层
@@ -21,6 +23,12 @@ use app\service\core\order\recharge\CoreRechargeOrderService;
*/
class RechargeOrderService extends BaseApiService
{
+ public function __construct()
+ {
+ parent::__construct();
+ $this->model = new Order();
+ }
+
/**
* 会员充值
* @param $data //['order_from' => 'h5', 'ip' => '127.0.0.1', 'member_message' => '','recharge_money' => 12.00]
@@ -33,4 +41,43 @@ class RechargeOrderService extends BaseApiService
return (new CoreRechargeOrderService())->create($data);
}
+
+ /**
+ * 充值订单分页列表
+ * @param array $where
+ * @return mixed
+ */
+ public function getPage(array $where)
+ {
+ $field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
+ $order = 'create_time desc';
+ $where['order_type'] = 'recharge';
+ $search_model = $this->model->where([ ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id] ])->withSearch(['order_status'], $where)->field($field)->with(['item' => function($query) {
+ $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
+ }])->order($order)->append(['order_status_info', 'order_from_name']);
+ return $this->pageQuery($search_model);
+ }
+
+ /**
+ * 充值订单详情
+ * @param array $where
+ * @return mixed
+ */
+ public function getDetail(int $order_id)
+ {
+ $field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
+ $detail = $this->model->where([['order_type', '=', 'recharge'], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id], ['order_id', '=', $order_id]])->field($field)->with(['item' => function($query) {
+ $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
+ }])->append(['order_status_info', 'order_from_name'])->findOrEmpty()->toArray();
+ return $detail;
+ }
+
+ /**
+ * 充值订单状态
+ * @return array|array[]|string
+ */
+ public function getStatus()
+ {
+ return RechargeOrderEnum::getStatus();
+ }
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/pay/PayService.php b/niucloud/app/service/api/pay/PayService.php
index bb515c874..81d12b088 100644
--- a/niucloud/app/service/api/pay/PayService.php
+++ b/niucloud/app/service/api/pay/PayService.php
@@ -12,9 +12,9 @@
namespace app\service\api\pay;
use app\enum\common\ChannelEnum;
-use app\service\api\BaseApiService;
use app\service\core\member\CoreMemberService;
use app\service\core\pay\CorePayService;
+use core\base\BaseApiService;
use Yansongda\Supports\Collection;
/**
@@ -107,8 +107,8 @@ class PayService extends BaseApiService
* @param $type
* @return void
*/
- public function notify(string $type, string $action){
- return $this->core_pay_service->notify($this->site_id, $type, $action);
+ public function notify(string $channel, string $type, string $action){
+ return $this->core_pay_service->notify($this->site_id, $channel, $type, $action);
}
/**
diff --git a/niucloud/app/service/api/scan/ScanService.php b/niucloud/app/service/api/scan/ScanService.php
index f8e06f6ce..2511f9249 100644
--- a/niucloud/app/service/api/scan/ScanService.php
+++ b/niucloud/app/service/api/scan/ScanService.php
@@ -11,8 +11,8 @@
namespace app\service\api\scan;
-use app\service\api\BaseApiService;
use app\service\core\scan\CoreScanService;
+use core\base\BaseApiService;
/**
diff --git a/niucloud/app/service/api/BaseApiService.php b/niucloud/app/service/api/site/SiteService.php
similarity index 56%
rename from niucloud/app/service/api/BaseApiService.php
rename to niucloud/app/service/api/site/SiteService.php
index 5b91caf7b..c1af9c8b4 100644
--- a/niucloud/app/service/api/BaseApiService.php
+++ b/niucloud/app/service/api/site/SiteService.php
@@ -9,27 +9,35 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\api;
+namespace app\service\api\site;
-use app\service\BaseService;
+use app\model\site\Site;
+use app\service\core\site\CoreSiteService;
+use core\base\BaseApiService;
/**
- * 手机前端基础服务层
- * Class BaseApiService
- * @package app\service\api
+ * 站点服务层
+ * Class Site
+ * @package app\service\admin\site
*/
-class BaseApiService extends BaseService
+class SiteService extends BaseApiService
{
-
- protected $site_id;
- protected $member_id;
- protected $channel;
-
+ public static $cache_tag_name = 'site_cash';
public function __construct()
{
parent::__construct();
- $this->site_id = $this->request->siteId();
- $this->member_id = $this->request->memberId();
- $this->channel = $this->request->getChannel();
+ $this->model = new Site();
}
+
+
+
+ /**
+ * 获取授权当前站点信息(用做缓存)
+ * @return mixed
+ */
+ public function getSiteCache(){
+
+ return (new CoreSiteService())->getSiteCache($this->site_id);
+ }
+
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/sys/ConfigService.php b/niucloud/app/service/api/sys/ConfigService.php
index 37a03c8de..d240ba838 100644
--- a/niucloud/app/service/api/sys/ConfigService.php
+++ b/niucloud/app/service/api/sys/ConfigService.php
@@ -11,11 +11,8 @@
namespace app\service\api\sys;
-use app\service\admin\BaseAdminService;
-use app\service\admin\site\SiteService;
-use app\service\api\BaseApiService;
-use app\service\core\sys\CoreConfigService;
use app\service\core\sys\CoreSysConfigService;
+use core\base\BaseApiService;
/**
* 配置服务层
diff --git a/niucloud/app/service/api/file/Base64Service.php b/niucloud/app/service/api/upload/Base64Service.php
similarity index 90%
rename from niucloud/app/service/api/file/Base64Service.php
rename to niucloud/app/service/api/upload/Base64Service.php
index d15b2af43..669d0c56b 100644
--- a/niucloud/app/service/api/file/Base64Service.php
+++ b/niucloud/app/service/api/upload/Base64Service.php
@@ -9,10 +9,10 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\api\file;
+namespace app\service\api\upload;
-use app\service\api\BaseApiService;
-use app\service\core\file\CoreBase64Service;
+use app\service\core\upload\CoreBase64Service;
+use core\base\BaseApiService;
/**
* 用户服务层
diff --git a/niucloud/app/service/api/file/FetchService.php b/niucloud/app/service/api/upload/FetchService.php
similarity index 90%
rename from niucloud/app/service/api/file/FetchService.php
rename to niucloud/app/service/api/upload/FetchService.php
index 72043ae2e..5a64bdb1c 100644
--- a/niucloud/app/service/api/file/FetchService.php
+++ b/niucloud/app/service/api/upload/FetchService.php
@@ -9,10 +9,10 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\api\file;
+namespace app\service\api\upload;
-use app\service\api\BaseApiService;
-use app\service\core\file\CoreFetchService;
+use app\service\core\upload\CoreFetchService;
+use core\base\BaseApiService;
/**
* 用户服务层
diff --git a/niucloud/app/service/api/file/UploadService.php b/niucloud/app/service/api/upload/UploadService.php
similarity index 93%
rename from niucloud/app/service/api/file/UploadService.php
rename to niucloud/app/service/api/upload/UploadService.php
index dc8dec63d..b9b02f258 100644
--- a/niucloud/app/service/api/file/UploadService.php
+++ b/niucloud/app/service/api/upload/UploadService.php
@@ -9,10 +9,10 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\api\file;
+namespace app\service\api\upload;
-use app\service\api\BaseApiService;
-use app\service\core\file\CoreUploadService;
+use app\service\core\upload\CoreUploadService;
+use core\base\BaseApiService;
/**
* 用户服务层
@@ -60,6 +60,6 @@ class UploadService extends BaseApiService
{
$dir = $this->root_path . '/' . 'document' . '/' . $this->site_id . '/' . date('Ym') . '/' . date('d');
$core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $this->site_id, $dir, $is_local);
+ return $core_upload_service->document($file, $this->site_id, '', $dir, $is_local);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/api/weapp/WeappAuthService.php b/niucloud/app/service/api/weapp/WeappAuthService.php
index 7edce86ef..d0aac20de 100644
--- a/niucloud/app/service/api/weapp/WeappAuthService.php
+++ b/niucloud/app/service/api/weapp/WeappAuthService.php
@@ -13,15 +13,15 @@ namespace app\service\api\weapp;
use app\enum\member\MemberLoginTypeEnum;
use app\enum\member\MemberRegisterTypeEnum;
-use app\service\api\BaseApiService;
use app\service\api\login\LoginService;
use app\service\api\login\RegisterService;
use app\service\api\member\MemberConfigService;
use app\service\api\member\MemberService;
use app\service\core\weapp\CoreWeappAuthService;
+use core\base\BaseApiService;
+use core\exception\ApiException;
+use core\exception\AuthException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use extend\exception\ApiException;
-use extend\exception\AuthException;
/**
@@ -51,11 +51,11 @@ class WeappAuthService extends BaseApiService
// $iv = $this->request->param('iv', '');
// $encrypted_data = $this->request->param('encrypted_data', '');
$result = $this->core_weapp_serve_service->session($this->site_id, $code);
-// if(empty($result)) throw new ApiException(400002);
+// if(empty($result)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
// $userinfo = $this->core_weapp_serve_service->decryptData($result['session_key'], $iv, $encrypted_data);
$openid = $result['openid'] ?? '';//对应微信的 openid
$unionid = $result['unionid'] ?? '' ;//对应微信的 unionid
- if(empty($openid)) throw new ApiException(400002);
+ if(empty($openid)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
//todo 这儿还可能会获取用户昵称 头像 性别 ....用以更新会员信息
// $nickname = $userinfo['nickName'] ?? '';//对应微信的 nickname
// $avatar = $userinfo['avatarUrl'] ?? '';//对应微信的 头像地址
@@ -115,17 +115,17 @@ class WeappAuthService extends BaseApiService
*/
public function register(string $openid, string|int $mobile, string $mobile_code){
- if(empty($openid)) throw new AuthException(301016);
+ if(empty($openid)) throw new AuthException('AUTH_LOGIN_TAG_NOT_EXIST');
//todo openid可能还需要合法性验证
$config = (new MemberConfigService())->getLoginConfig();
$is_bind_mobile = $config['is_bind_mobile'];
if($is_bind_mobile == 1){
if(empty($mobile)){
$result = $this->core_weapp_serve_service->getUserPhoneNumber($this->site_id, $mobile_code);
- if(empty($result)) throw new ApiException(400002);
+ if(empty($result)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$phone_info = $result['phone_info'];
$mobile = $phone_info['purePhoneNumber'];
- if(empty($mobile)) throw new ApiException(400002);
+ if(empty($mobile)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$is_verify_mobile = false;
}else{
$is_verify_mobile = true;
@@ -134,7 +134,7 @@ class WeappAuthService extends BaseApiService
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['weapp_openid' => $openid, 'site_id' => $this->site_id]);
- if(!$member_info->isEmpty()) throw new AuthException(301008);//账号已存在, 不能在注册
+ if(!$member_info->isEmpty()) throw new AuthException('MEMBER_IS_EXIST');//账号已存在, 不能在注册
$register_service = new RegisterService();
$result = $register_service->register($mobile ?? '',
[
diff --git a/niucloud/app/service/api/wechat/WechatAuthService.php b/niucloud/app/service/api/wechat/WechatAuthService.php
index 3c9f5c19c..c9d94b387 100644
--- a/niucloud/app/service/api/wechat/WechatAuthService.php
+++ b/niucloud/app/service/api/wechat/WechatAuthService.php
@@ -15,18 +15,17 @@ namespace app\service\api\wechat;
use app\enum\member\MemberLoginTypeEnum;
use app\enum\member\MemberRegisterTypeEnum;
use app\enum\scan\ScanEnum;
-use app\service\api\BaseApiService;
use app\service\api\login\LoginService;
use app\service\api\login\RegisterService;
use app\service\api\member\MemberConfigService;
use app\service\api\member\MemberService;
use app\service\core\scan\CoreScanService;
-use app\service\core\sys\CoreSysConfigService;
use app\service\core\wechat\CoreWechatFansService;
use app\service\core\wechat\CoreWechatServeService;
+use core\base\BaseApiService;
+use core\exception\ApiException;
+use core\exception\AuthException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use extend\exception\ApiException;
-use extend\exception\AuthException;
/**
@@ -67,9 +66,9 @@ class WechatAuthService extends BaseApiService
public function userFromCode(string $code)
{
$userinfo = $this->core_wechat_serve_service->userFromCode($this->site_id, $code);
- if (empty($userinfo)) throw new ApiException(400002);
+ if (empty($userinfo)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$token_response = $userinfo->getTokenResponse();
- if (empty($token_response)) throw new ApiException(400002);
+ if (empty($token_response)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$scope = $token_response['scope'];
if ($scope == 'snsapi_base') {//静默授权
$openid = $token_response['openid'] ?? '';
@@ -78,7 +77,7 @@ class WechatAuthService extends BaseApiService
$nickname = $userinfo->getNickname();//对应微信的 nickname
$avatar = $userinfo->getAvatar();//对应微信的 头像地址
}
- if (empty($openid)) throw new ApiException(400002);
+ if (empty($openid)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
//todo 这儿还可能会获取用户昵称 头像 性别 ....用以更新会员信息
return [$avatar ?? '', $nickname ?? '', $openid];
//todo 业务落地
@@ -133,11 +132,11 @@ class WechatAuthService extends BaseApiService
//更新粉丝
$core_wechat_fans_service = new CoreWechatFansService();
//这儿或许可以异步
- $core_wechat_fans_service->update($this->site_id, $openid, ['avatar' => $avatar, 'nickname' => $nickname]);
+ $core_wechat_fans_service->edit($this->site_id, $openid, ['avatar' => $avatar, 'nickname' => $nickname]);
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['wx_openid' => $openid, 'site_id' => $this->site_id]);
- if ($member_info->isEmpty()) throw new AuthException(301005);//账号不存在
- $member_service->updateByFind($member_info, ['headimg' => $avatar, 'nickname' => $nickname]);
+ if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
+ $member_service->editByFind($member_info, ['headimg' => $avatar, 'nickname' => $nickname]);
return true;
}
@@ -151,7 +150,7 @@ class WechatAuthService extends BaseApiService
{
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['wx_openid' => $openid, 'site_id' => $this->site_id]);
- if (!$member_info->isEmpty()) throw new AuthException(301008);//账号已存在, 不能在注册
+ if (!$member_info->isEmpty()) throw new AuthException('MEMBER_IS_EXIST');//账号已存在, 不能在注册
$register_service = new RegisterService();
$result = $register_service->register($mobile,
[
diff --git a/niucloud/app/service/api/wechat/WechatServeService.php b/niucloud/app/service/api/wechat/WechatServeService.php
index 6e4983ce5..dfb3de938 100644
--- a/niucloud/app/service/api/wechat/WechatServeService.php
+++ b/niucloud/app/service/api/wechat/WechatServeService.php
@@ -11,8 +11,8 @@
namespace app\service\api\wechat;
-use app\service\api\BaseApiService;
use app\service\core\wechat\CoreWechatServeService;
+use core\base\BaseApiService;
use EasyWeChat\Kernel\Exceptions\BadRequestException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
diff --git a/niucloud/app/service/core/addon/CoreAddonBaseService.php b/niucloud/app/service/core/addon/CoreAddonBaseService.php
new file mode 100644
index 000000000..24a51a14c
--- /dev/null
+++ b/niucloud/app/service/core/addon/CoreAddonBaseService.php
@@ -0,0 +1,92 @@
+root_path = dirname(root_path()) . DIRECTORY_SEPARATOR;
+ $this->addon_path = root_path() . 'addon' . DIRECTORY_SEPARATOR;
+ }
+
+ /**
+ * 获取插件基础配置信息
+ * @param string $addon
+ * @return array|mixed
+ */
+ public function getAddonConfig(string $addon)
+ {
+ $path = $this->addon_path . $addon . DIRECTORY_SEPARATOR . 'info.json';
+ if (is_file($path)) {
+ $json_string = file_get_contents($path);
+ // 用参数true把JSON字符串强制转成PHP数组
+ $info = json_decode($json_string, true);
+ $info['icon'] = '';
+ }
+ return $info ?? [];
+ }
+
+ /**
+ * 获取插件配置文件目录
+ * @param string $addon
+ * @return string
+ */
+ public function getAddonConfigPath(string $addon)
+ {
+ return $this->addon_path . $addon . DIRECTORY_SEPARATOR . 'config'. DIRECTORY_SEPARATOR;
+ }
+
+ /**
+ * 读取json文件转化成数组返回
+ * @param $json_file_path //json文件目录
+ */
+ protected function jsonFileToArray(string $json_file_path)
+ {
+ if (file_exists($json_file_path)) {
+ $content_json = @file_get_contents($json_file_path);
+ $content_array = json_decode($content_json, true);
+ return $content_array;
+ }else
+ return [];
+ }
+
+ /**
+ * 读取json文件转化成数组返回
+ * @param $json_file_path //json文件目录
+ */
+ protected function writeArrayToJsonFile(array $content, string $file_path)
+ {
+ $content_json = json_encode($content, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
+ $result = @file_put_contents($file_path, $content_json);
+ if (!$result) {
+ throw new CommonException($file_path.'文件不存在或者权限不足');
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/addon/CoreAddonConfigService.php b/niucloud/app/service/core/addon/CoreAddonConfigService.php
new file mode 100644
index 000000000..1b196aa21
--- /dev/null
+++ b/niucloud/app/service/core/addon/CoreAddonConfigService.php
@@ -0,0 +1,340 @@
+remember($cache_name, function () {
+ $list = Db::name("addon")->column("key");
+ return $list;
+ });
+ }
+
+ /**
+ * 加载语言包
+ * @param $lang_type
+ */
+ public function loadAddonLang($lang_type)
+ {
+
+ $addons = $this->getLocalAddons();
+ $lang_files = [];
+
+ foreach ($addons as $k => $v)
+ {
+ $lang_path = $this->getAddonConfigPath($v)."lang". DIRECTORY_SEPARATOR. $lang_type.DIRECTORY_SEPARATOR;
+
+ $api_path = $lang_path."api.php";
+ $enum_path = $lang_path."enum.php";
+ $validate_path = $lang_path."validate.php";
+ if(is_file($api_path))
+ {
+ $lang_files[] = $api_path;
+
+ }
+ if(is_file($enum_path))
+ {
+ $lang_files[] = $enum_path;
+ }
+ if(is_file($validate_path))
+ {
+ $lang_files[] = $validate_path;
+ }
+ }
+ $files_data = $this->loadFiles($lang_files);
+ $lang = [];
+ foreach ($files_data as $data) {
+ $lang = array_merge($lang, $data);
+ }
+ return $lang;
+ }
+
+ /**
+ * 加载插件事件
+ * @return array|mixed
+ */
+ public function loadAddonEvent($system_event)
+ {
+
+ $addons = $this->getLocalAddons();
+ $event_files = [];
+
+ foreach ($addons as $k => $v)
+ {
+ $event_path = $this->getAddonConfigPath($v)."event.php";
+ if(is_file($event_path))
+ {
+ $event_files[] = $event_path;
+ }
+ }
+ $files_data = $this->loadFiles($event_files);
+
+ $files_data[1] = $system_event;
+
+ $events = [];
+ foreach ($files_data as $data) {
+ $events = empty($events) ? $data : array_merge2($events, $data);
+ }
+ return $events;
+
+ }
+
+ /**
+ * 加载插件路由
+ * @param $app_type
+ */
+ public function loadAddonRoute($app_type)
+ {
+ $addons = $this->getLocalAddons();
+
+ foreach ($addons as $k => $v)
+ {
+ $route_path = $this->getAddonConfigPath($v)."route".DIRECTORY_SEPARATOR. $app_type. ".php";
+ if(is_file($route_path))
+ {
+ include $route_path;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 加载整合插件components数据
+ * @param array $system_components //系统components数据
+ * @return array
+ */
+ public function loadAddonUniappComponent($system_components = [])
+ {
+ $addons = $this->getLocalAddons();
+ $components_files = [];
+ foreach ($addons as $k => $v)
+ {
+ $components_path = $this->getAddonConfigPath($v). "diy". DIRECTORY_SEPARATOR. "components.php";
+ if(is_file($components_path))
+ {
+ $components_files[] = $components_path;
+ }
+ }
+ $components_files_data = $this->loadFiles($components_files);
+ $components = $system_components;
+ foreach ($components_files_data as $file_data)
+ {
+ $components = empty($components) ? $file_data : array_merge2($components, $file_data);
+ }
+ return $components;
+ }
+
+ /**
+ * 加载整合插件uniapp link数据
+ * @param array $system_links //系统link数据
+ * return array
+ */
+ public function loadAddonUniappLink($system_links = [])
+ {
+ $addons = $this->getLocalAddons();
+ $link_files = [];
+ foreach ($addons as $k => $v)
+ {
+ $link_path = $this->getAddonConfigPath($v). "diy". DIRECTORY_SEPARATOR. "links.php";
+ if(is_file($link_path))
+ {
+ $link_files[] = $link_path;
+ }
+ }
+ $link_files_data = $this->loadFiles($link_files);
+ $links = $system_links;
+ foreach ($link_files_data as $file_data)
+ {
+ if(empty($links))
+ {
+ $links = $file_data;
+ }else
+ $links = array_merge($links, $file_data);
+ }
+ return $links;
+ }
+
+ /**
+ * 加载整合插件uniapp pages数据
+ * @param array $system_pages //系统page数据
+ * return array
+ */
+ public function loadAddonUniappPages($system_pages = [])
+ {
+ $addons = $this->getLocalAddons();
+ $page_files = [];
+ foreach ($addons as $k => $v)
+ {
+ $page_path = $this->getAddonConfigPath($v). "diy". DIRECTORY_SEPARATOR. "pages.php";
+ if(is_file($page_path))
+ {
+ $page_files[] = $page_path;
+ }
+ }
+ $page_files_data = $this->loadFiles($page_files);
+ $pages = $system_pages;
+ foreach ($page_files_data as $file_data)
+ {
+ if(empty($pages))
+ {
+ $pages = $file_data;
+ }else
+ $pages = array_merge($pages, $file_data);
+ }
+ return $pages;
+ }
+ /**
+ * 加载插件菜单返回数组
+ * @param $addon
+ * @param $app_type
+ * @return array|mixed
+ */
+ private function loadAddonMenu($addon, $app_type)
+ {
+ $menu_path = $this->getAddonConfigPath($addon)."menu".DIRECTORY_SEPARATOR. $app_type. ".php";
+ if(is_file($menu_path))
+ {
+ return include $menu_path;
+ }
+ return [];
+ }
+
+ /**
+ * 安装或者刷新插件菜单
+ * @param $addon
+ * @return bool
+ */
+ public function refreshAddonMenu($addon)
+ {
+ $addon_admin_tree = $this->loadAddonMenu($addon, "admin");
+ $menu = [];
+ $menu_service = new CoreMenuService();
+ if(!empty($addon_admin_tree))
+ {
+ $menu = $menu_service->loadMenu($addon_admin_tree, "admin", $addon);
+ }
+ $addon_site_tree = $this->loadAddonMenu($addon, "site");
+ if(!empty($addon_site_tree))
+ {
+ $site_menu = $menu_service->loadMenu($addon_site_tree, "site", $addon);
+ $menu = array_merge($menu, $site_menu);
+ }
+ $menu_service->deleteByAddon($addon);
+ $menu_service->install($menu);
+ return true;
+
+ }
+
+ /**
+ * 刷新所有插件菜单
+ */
+ public function refreshAllAddonMenu()
+ {
+
+ $addons = $this->getLocalAddons();
+ foreach ($addons as $k => $v)
+ {
+ $this->refreshAddonMenu($v);
+ }
+ return true;
+ }
+
+ /**
+ * 加载整体消息模板
+ * @param $type //模板类型 template weapp, wechat,sms
+ * @return array|mixed
+ */
+ public function loadNotice($type)
+ {
+ $template_files = [];
+ $system_path = root_path(). "app". DIRECTORY_SEPARATOR. "enum". DIRECTORY_SEPARATOR. "notice". DIRECTORY_SEPARATOR. $type. ".php";
+ if(is_file($system_path))
+ {
+ $template_files[] = $system_path;
+ }
+ $addons = $this->getLocalAddons();
+ foreach ($addons as $k => $v)
+ {
+ $template_path = $this->getAddonConfigPath($v). "notice". DIRECTORY_SEPARATOR. $type. ".php";
+ if(is_file($template_path))
+ {
+ $template_files[] = $template_path;
+ }
+ }
+
+ $template_files_data = $this->loadFiles($template_files);
+
+ $template_data_array = [];
+ foreach ($template_files_data as $file_data)
+ {
+ if(empty($template_data_array))
+ {
+ $template_data_array = $file_data;
+ }else
+ $template_data_array = array_merge($template_data_array, $file_data);
+ }
+ return $template_data_array;
+
+ }
+
+ /**
+ * 加载文件数据
+ * @param $files
+ * @return array
+ */
+ private function loadFiles($files)
+ {
+ $default_sort = 100000;
+ $files_data = [];
+ if (!empty($files)) {
+ foreach ($files as $file) {
+ $config = include $file;
+ if (!empty($config)) {
+ if (isset($config[ 'file_sort' ])) {
+ $sort = $config[ 'file_sort' ];
+ unset($config[ 'file_sort' ]);
+ $sort = $sort * 10;
+ while (array_key_exists($sort, $files_data)) {
+ $sort++;
+ }
+ $files_data[ $sort ] = $config;
+ } else {
+ $files_data[ $default_sort ] = $config;
+ $default_sort++;
+ }
+ }
+ }
+ }
+ ksort($files_data);
+ return $files_data;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/addon/CoreAddonInstallService.php b/niucloud/app/service/core/addon/CoreAddonInstallService.php
new file mode 100644
index 000000000..082499e0e
--- /dev/null
+++ b/niucloud/app/service/core/addon/CoreAddonInstallService.php
@@ -0,0 +1,389 @@
+ [],
+ 'admin' => [],
+ 'web' => [],
+ 'wap' => [],
+ 'resource' => []
+ ];
+ //安装流程
+ private $flow_path = [
+ 'file',
+ 'sql',
+ 'menu',
+ 'diy',
+ ''
+ ];
+ private $addon;
+ private $install_addon_path;//待安装的插件目录
+
+ //对象实例
+ protected static $instance;
+
+ //状态关键字
+ const WAIT_INSTALL = 'wait_install';
+
+ const DIR_INSTALLED = 'dir_installed';
+
+ const SQL_INSTALLED = 'sql_installed';
+
+ const MENU_INSTALLED = 'menu_installed';
+
+ const WAIT_DEPEND = 'wait_depend';
+
+ const INSTALL_SUCCESS = 'install_success';
+
+ const INSTALL_FAIL = 'install_fail';
+
+ private $state;
+ /**
+ * 初始化实例
+ * @param string $uid
+ * @return static
+ */
+ public static function instance(string $addon)
+ {
+ if (is_null(self::$instance)) {
+ self::$instance = new static($addon);
+ }
+ return self::$instance;
+ }
+
+
+ public function __construct($addon)
+ {
+ parent::__construct();
+ $this->addon = $addon;
+ $this->install_addon_path = $this->addon_path. $addon. DIRECTORY_SEPARATOR;
+ }
+ /**
+ * 插件安装
+ * @return true
+ */
+ public function install()
+ {
+ $core_addon_service = new CoreAddonService();
+ if (!empty($core_addon_service->getInfoByKey($this->addon))) throw new AddonException('REPEAT_INSTALL');
+ $dir = $this->addon_path . $this->addon . DIRECTORY_SEPARATOR;
+ //安装文件
+ if (!$this->installDir()) throw new AddonException();
+ if (!$this->installSql()) throw new AddonException();
+
+ // 安装菜单
+ $this->installMenu();
+
+ // 安装wap
+ $this->installWap();
+
+ $install_data = $this->getAddonConfig($this->addon);
+ $install_data[ 'icon' ] = $dir . 'icon.png';
+ $core_addon_service->set($install_data);
+ //清理缓存
+ Cache::tag(self::$cache_tag_name)->clear();
+ //执行命令
+ //执行插件安装方法
+ $class = "addon\\".$this->addon."\\".Str::studly($this->addon);
+ if(class_exists($class))
+ {
+ (new $class())->install();
+ }
+ //组装依赖文件
+ (new CoreDependService())->installDepend($this->addon);
+
+ $this->state = self::WAIT_DEPEND;
+ //执行命令行
+ //命令行实例
+ //4条命令行
+
+
+ return true;
+ }
+
+ public function getInstallState()
+ {
+ return $this->state;
+ }
+
+ /**
+ * 安装迁移复制文件
+ * @param $dir
+ * @return bool
+ */
+ public function installDir()
+ {
+ $from_admin_dir = $this->install_addon_path."admin". DIRECTORY_SEPARATOR;
+ $from_web_dir = $this->install_addon_path."web". DIRECTORY_SEPARATOR;
+ $from_wap_dir = $this->install_addon_path."uni-app". DIRECTORY_SEPARATOR;
+ $from_resource_dir = $this->install_addon_path."resource". DIRECTORY_SEPARATOR;
+ // 放入的文件
+ $to_admin_dir = $this->root_path ."admin". DIRECTORY_SEPARATOR;
+ $to_web_dir = $this->root_path ."web". DIRECTORY_SEPARATOR;
+ $to_wap_dir = $this->root_path . "uni-app". DIRECTORY_SEPARATOR;
+ $to_resource_dir = public_path() . "addon". DIRECTORY_SEPARATOR. $this->addon. DIRECTORY_SEPARATOR;
+
+ // 安装admin管理端
+ if(file_exists($from_admin_dir))
+ {
+ dir_copy($from_admin_dir, $to_admin_dir, $this->files[ 'admin' ]);
+ }
+
+ // 安装电脑端
+ if(file_exists($from_web_dir))
+ {
+ dir_copy($from_web_dir, $to_web_dir, $this->files[ 'web' ]);
+ }
+
+ // 安装手机端
+ if(file_exists($from_wap_dir))
+ {
+ dir_copy($from_wap_dir, $to_wap_dir, $this->files[ 'wap' ]);
+ }
+
+ //安装资源文件
+ if(file_exists($from_resource_dir))
+ {
+ dir_copy($from_resource_dir, $to_resource_dir, $this->files[ 'resource' ]);
+ }
+ $this->state = self::DIR_INSTALLED;
+ return true;
+ }
+
+ public function installSql()
+ {
+ $sql = $this->install_addon_path . 'sql' . DIRECTORY_SEPARATOR . 'install.sql';
+ $this->executeSql($sql);
+ $this->state = self::SQL_INSTALLED;
+ return true;
+ }
+
+ /**
+ * 执行sql
+ * @param string $sql_file
+ * @return bool
+ */
+ public static function executeSql(string $sql_file) : bool
+ {
+ if (is_file($sql_file)) {
+ $sql = file_get_contents($sql_file);
+ // 执行sql
+ $sql_arr = parse_sql($sql);
+ if (!empty($sql_arr)) {
+ $prefix = config('database.connections.mysql.prefix');
+ Db::startTrans();
+ try {
+ foreach ($sql_arr as $sql_line) {
+ $sql_line = trim($sql_line);
+ if (!empty($sql_line)) {
+ $sql_line = str_ireplace('{{prefix}}', $prefix, $sql_line);
+ $sql_line = str_ireplace('INSERT INTO ', 'INSERT IGNORE INTO ', $sql_line);
+ Db::execute($sql_line);
+ }
+ }
+ Db::commit();
+ // 返回订单信息
+ return true;
+ } catch (PDOException $e) {
+ Db::rollback();
+ throw new AddonException($e->getMessage());
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 卸载插件
+ * @return true
+ */
+ public function uninstall()
+ {
+ //执行插件卸载方法
+ $class = "addon\\".$this->addon."\\".Str::studly($this->addon);
+ if(class_exists($class))
+ {
+ (new $class())->uninstall();
+ }
+ $core_addon_service = new CoreAddonService();
+ if (empty($core_addon_service->getInfoByKey($this->addon))) throw new AddonException('NOT_UNINSTALL');
+ if (!$this->uninstallSql()) throw new AddonException();
+ if (!$this->uninstallDir()) throw new AddonException();
+ // 卸载菜单
+ $this->uninstallMenu();
+
+ // 卸载wap
+ $this->uninstallWap();
+
+ $core_addon_service = new CoreAddonService();
+ $core_addon_service->delByKey($this->addon);
+
+ //清理缓存
+ Cache::tag(self::$cache_tag_name)->clear();
+ return true;
+ }
+
+ /**
+ * 卸载插件
+ * @param $dir
+ * @return true
+ */
+ public function uninstallDir()
+ {
+ $from_admin_dir = $this->install_addon_path."admin". DIRECTORY_SEPARATOR;
+ $from_web_dir = $this->install_addon_path."web". DIRECTORY_SEPARATOR;
+ $from_wap_dir = $this->install_addon_path."uni-app". DIRECTORY_SEPARATOR;
+ $from_resource_dir = $this->install_addon_path."resource". DIRECTORY_SEPARATOR;
+
+
+ search_dir($from_admin_dir, $from_admin_dirs, $from_admin_dir);
+ search_dir($from_web_dir, $from_web_dirs, $from_web_dir);
+ search_dir($from_wap_dir, $from_wap_dirs, $from_wap_dir);
+ search_dir($from_resource_dir, $from_resource_dirs, $from_resource_dir);
+
+ // 将要删除的根目录
+ $to_admin_dir = $this->root_path ."admin". DIRECTORY_SEPARATOR;
+ $to_web_dir = $this->root_path ."web". DIRECTORY_SEPARATOR;
+ $to_wap_dir = $this->root_path . "uni-app". DIRECTORY_SEPARATOR;
+ $to_resource_dir = public_path() . "addon". DIRECTORY_SEPARATOR. $this->addon. DIRECTORY_SEPARATOR;
+
+ // 卸载admin管理端
+ if(file_exists($from_admin_dir))
+ {
+ dir_remove($to_admin_dir, $from_admin_dirs ?? []);
+ }
+
+ // 卸载pc端
+ if(file_exists($from_web_dir))
+ {
+ dir_remove($to_web_dir, $from_web_dirs ?? []);
+ }
+
+ // 卸载手机端
+ if(file_exists($from_wap_dir))
+ {
+ dir_remove($to_wap_dir, $from_wap_dirs ?? []);
+ }
+
+ //删除资源文件
+ if(file_exists($from_resource_dir))
+ {
+ dir_remove($to_resource_dir, $from_resource_dirs ?? []);
+ rmdir($to_resource_dir);
+ }
+
+ //todo 卸载插件目录涉及到的空文件
+ return true;
+ }
+
+ /**
+ * 卸载数据库
+ * @param $dir
+ * @return true
+ */
+ public function uninstallSql()
+ {
+ $sql = $this->install_addon_path . 'sql' . DIRECTORY_SEPARATOR . 'uninstall.sql';
+ $this->executeSql($sql);
+ return true;
+ }
+
+ /**
+ * 安装插件菜单
+ * @return true
+ */
+ public function installMenu()
+ {
+ (new CoreMenuService)->refreshAddonMenu($this->addon);
+ Cache::tag(MenuService::$cache_tag_name)->clear();
+ $this->state = self::MENU_INSTALLED;
+
+ return true;
+ }
+
+ /**
+ * 卸载菜单
+ * @return true
+ */
+ public function uninstallMenu()
+ {
+ $core_menu_service = new CoreMenuService();
+ $core_menu_service->deleteByAddon($this->addon);
+ Cache::tag(MenuService::$cache_tag_name)->clear();
+ return true;
+ }
+
+ /**
+ * 添加uniapp pages
+ */
+ public function installUniappPages()
+ {
+ $addon_pages_array = $this->jsonFileToArray($this->getAddonConfigPath($this->addon). 'uni-app-pages.json');
+ $pages_array = $this->jsonFileToArray($this->root_path . "uni-app". DIRECTORY_SEPARATOR. "pages.json");
+ $pages_array['pages'] = array_merge($pages_array['pages'], $addon_pages_array['pages']);
+ return $this->writeArrayToJsonFile($pages_array, $this->root_path . "uni-app". DIRECTORY_SEPARATOR. "pages.json");
+ }
+ /**
+ * 安装手机端
+ * @return void
+ */
+ public function installWap()
+ {
+ // 编译 diy-group 自定义组件代码文件
+ $this->compileDiyComponentsCode($this->install_addon_path. "uni-app". DIRECTORY_SEPARATOR);
+
+ // 编译 pages.json 页面路由代码文件
+ $this->compileRoutesCode($this->install_addon_path . "uni-app". DIRECTORY_SEPARATOR);
+ }
+
+ /**
+ * 卸载手机端
+ * @return void
+ */
+ public function uninstallWap()
+ {
+ // 编译 diy-group 自定义组件代码文件
+ $this->compileDiyComponentsCode($this->root_path . "uni-app". DIRECTORY_SEPARATOR);
+
+ // 编译 pages.json 页面路由代码文件
+ $this->compileRoutesCode($this->root_path . "uni-app". DIRECTORY_SEPARATOR);
+ }
+
+ public function download()
+ {
+
+ }
+
+ public function edit()
+ {
+
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/addon/CoreAddonLogService.php b/niucloud/app/service/core/addon/CoreAddonLogService.php
new file mode 100644
index 000000000..8d69195ed
--- /dev/null
+++ b/niucloud/app/service/core/addon/CoreAddonLogService.php
@@ -0,0 +1,46 @@
+model = new AddonLog();
+ }
+
+ /**
+ * 新增插件日志
+ * @param array $params
+ * @return true
+ */
+ public function add(array $params){
+ $data = array(
+ 'type' => $params['type'],
+ 'key' => $params['key'],
+ 'from_version' => $params['from_version'],
+ 'to_version' => $params['to_version'],
+ );
+ $this->model->create($data);
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/addon/CoreAddonService.php b/niucloud/app/service/core/addon/CoreAddonService.php
new file mode 100644
index 000000000..1de4c06d4
--- /dev/null
+++ b/niucloud/app/service/core/addon/CoreAddonService.php
@@ -0,0 +1,155 @@
+model = new Addon();
+ }
+
+ /**
+ * 获取已下载的插件
+ * @return array
+ */
+ public function getLocalAddonList()
+ {
+ $files = get_files_by_dir($this->addon_path);
+ $list = [];
+ if(!empty($files)){
+ $install_addon_list = $this->model->append(['status_name'])->column('title, icon, key, desc, status, author, version, install_time, update_time', 'key');
+ foreach($files as $path) {
+ $data = $this->getAddonConfig($path);
+ $key = $data['key'];
+ $data['install_info'] = $install_addon_list[$key] ?? [];
+ $list[] = $data;
+ }
+ }
+ return $list;
+ }
+
+ /**
+ * 已下载的插件数量
+ * @return int
+ */
+ public function getLocalAddonCount()
+ {
+ $files = get_files_by_dir($this->addon_path);
+ return count($files);
+ }
+
+ /**
+ * 获取已安装插件数量
+ * @param array $where
+ * @return int
+ * @throws \think\db\exception\DbException
+ */
+ public function getCount(array $where = []){
+
+ return $this->model->where($where)->count();
+ }
+ /**
+ * 安装的插件分页
+ * @param array $where
+ * @return mixed
+ */
+ public function getPage(array $where){
+ $field = 'id, title, key, desc, version, status, icon, create_time, install_time';
+ $search_model = $this->model->where([])->withSearch(['title'],$where)->field($field)->order('id desc');
+ $data = $this->pageQuery($search_model);
+ return $data;
+ }
+
+ /**
+ * 插件详情
+ * @param int $id
+ * @return array
+ */
+ public function getInfo(int $id){
+ return $this->model->where([['id', '=', $id]])->findOrEmpty()->toArray();
+ }
+
+ /**
+ * 设置插件(安装或更新)
+ * @param array $params
+ * @return true
+ */
+ public function set(array $params){
+ $title = $params['title'];
+ $key = $params['key'];
+ $addon = $this->model->where([
+ ['key', '=', $key],
+ ])->findOrEmpty();
+ $version = $params['version'];//版本号
+ $desc = $params['desc'];
+ $icon = $params['icon'];
+ $data = array(
+ 'title' => $title,
+ 'version' => $version,
+ 'status' => 1,
+ 'desc' => $desc,
+ 'icon' => $icon,
+ 'key' => $key
+ );
+ if($addon->isEmpty()){
+ $data['install_time'] = time();
+ $this->model->create($data);
+ }else{
+ $data['update_time'] = time();
+ $addon->save($data);
+ }
+ return true;
+ }
+
+ /**
+ * 通过key查询插件
+ * @param string $key
+ * @return array
+ */
+ public function getInfoByKey(string $key){
+ return $this->model->where([['key', '=', $key]])->findOrEmpty()->toArray();
+ }
+ /**
+ * 通过插件名删除插件
+ * @param string $key
+ * @return true
+ */
+ public function delByKey(string $key){
+ $this->model->where([['key', '=', $key]])->delete();
+ return true;
+ }
+
+ /**
+ * 修改插件状态
+ * @param int $id
+ * @param int $status
+ * @return void
+ */
+ public function setStatus(int $id, int $status){
+ $this->model->where([['id', '=', $id]])->update(['status' => $status]);
+ return true;
+ }
+
+ public function getAppList(){
+ return event('addon', []);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/addon/CoreDependService.php b/niucloud/app/service/core/addon/CoreDependService.php
new file mode 100644
index 000000000..ffa3f31b5
--- /dev/null
+++ b/niucloud/app/service/core/addon/CoreDependService.php
@@ -0,0 +1,184 @@
+server_composer_file = $this->root_path. 'niucloud'. DIRECTORY_SEPARATOR. 'composer.json';
+ $this->admin_npm_file = $this->root_path. 'admin'. DIRECTORY_SEPARATOR. 'package.json';
+ $this->web_npm_file = $this->root_path. 'web'. DIRECTORY_SEPARATOR. 'package.json';
+ $this->wap_npm_file = $this->root_path. 'uni-app'. DIRECTORY_SEPARATOR. 'package.json';
+ }
+
+ /**
+ * 获取插件更新后的composer以及package
+ * @param $addon
+ * @return bool
+ */
+ public function installDepend($addon)
+ {
+ //composer文件扩展
+ $composer_content = $this->getComposerContent();
+ $addon_composer_content = $this->getAddonComposerContent($addon);
+ if(isset($addon_composer_content['require']))
+ {
+ $composer_content['require'] = array_merge($composer_content['require'], $addon_composer_content['require']);
+ }
+
+ if(isset($addon_composer_content['require_dev']))
+ {
+ $composer_content['require_dev'] = array_merge($composer_content['require_dev'], $addon_composer_content['require_dev']);
+ }
+ $this->setComposerContent($composer_content);
+ //admin-package文件扩展
+ $admin_package_array = $this->getNpmContent('admin');
+ $addon_admin_package_array = $this->getAddonNpmContent($addon, 'admin');
+ if(isset($addon_admin_package_array['dependencies']))
+ {
+ $admin_package_array['dependencies'] = array_merge($admin_package_array['dependencies'], $addon_admin_package_array['dependencies']);
+ }
+
+ if(isset($addon_admin_package_array['devDependencies']))
+ {
+ $admin_package_array['devDependencies'] = array_merge($admin_package_array['devDependencies'], $addon_admin_package_array['devDependencies']);
+ }
+ $this->setNpmContent($admin_package_array, 'admin');
+
+ //web-package文件扩展
+ $web_package_array = $this->getNpmContent('web');
+ $addon_web_package_array = $this->getAddonNpmContent($addon, 'web');
+ if(isset($addon_web_package_array['dependencies']))
+ {
+ $web_package_array['dependencies'] = array_merge($web_package_array['dependencies'], $addon_web_package_array['dependencies']);
+ }
+
+ if(isset($addon_web_package_array['devDependencies']))
+ {
+ $web_package_array['devDependencies'] = array_merge($web_package_array['devDependencies'], $addon_web_package_array['devDependencies']);
+ }
+ $this->setNpmContent($web_package_array, 'web');
+
+ //uni-app-package文件扩展
+ $wap_package_array = $this->getNpmContent('uni-app');
+ $addon_wap_package_array = $this->getAddonNpmContent($addon, 'wap');
+ if(isset($addon_wap_package_array['dependencies']))
+ {
+ $wap_package_array['dependencies'] = array_merge($wap_package_array['dependencies'], $addon_wap_package_array['dependencies']);
+ }
+
+ if(isset($addon_wap_package_array['devDependencies']))
+ {
+ $wap_package_array['devDependencies'] = array_merge($wap_package_array['devDependencies'], $addon_wap_package_array['devDependencies']);
+ }
+ $this->setNpmContent($wap_package_array, 'wap');
+ return true;
+ }
+
+ /**
+ * 获取composer的内容
+ * @return mixed
+ */
+ public function getComposerContent()
+ {
+ return $this->jsonFileToArray($this->server_composer_file);
+ }
+
+ /**
+ * 获取插件的composer内容
+ * @param $addon
+ * @return array|mixed
+ */
+ public function getAddonComposerContent(string $addon)
+ {
+ $composer_path = $this->getAddonConfigPath($addon). 'composer.json';
+ return $this->jsonFileToArray($composer_path);
+ }
+
+ /**
+ * 更新composer内容
+ * @param array $content
+ * @return bool
+ */
+ public function setComposerContent(array $content)
+ {
+ return $this->writeArrayToJsonFile($content, $this->server_composer_file);
+ }
+
+ /**
+ * 获取npm文件内容
+ * @param $type //端口类型:admin wap web
+ */
+ public function getNpmContent(string $type)
+ {
+ if($type == 'admin')
+ {
+ $file_path = $this->admin_npm_file;
+ }elseif($type == 'web')
+ {
+ $file_path = $this->web_npm_file;
+ }else{
+ $file_path = $this->wap_npm_file;
+ }
+ return $this->jsonFileToArray($file_path);
+ }
+
+ /**
+ * 获取插件npm内容
+ * @param string $addon
+ * @param string $type 'admin wep uni-app'
+ * @return array|mixed
+ */
+ public function getAddonNpmContent(string $addon, string $type)
+ {
+ if($type == 'admin')
+ {
+ $file_path = $this->getAddonConfigPath($addon).'admin-package.json';
+ }elseif($type == 'web')
+ {
+ $file_path = $this->getAddonConfigPath($addon).'web-package.json';
+ }else{
+ $file_path = $this->getAddonConfigPath($addon).'uni-app-package.json';
+ }
+ return $this->jsonFileToArray($file_path);
+ }
+
+ /**
+ * 更新npm内容
+ * @param array $content
+ * @return bool
+ */
+ public function setNpmContent(array $content, string $type)
+ {
+ if($type == 'admin')
+ {
+ $file_path = $this->admin_npm_file;
+ }elseif($type == 'web')
+ {
+ $file_path = $this->web_npm_file;
+ }else{
+ $file_path = $this->wap_npm_file;
+ }
+ return $this->writeArrayToJsonFile($content, $file_path);
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/addon/WapTrait.php b/niucloud/app/service/core/addon/WapTrait.php
new file mode 100644
index 000000000..cfd31e25f
--- /dev/null
+++ b/niucloud/app/service/core/addon/WapTrait.php
@@ -0,0 +1,228 @@
+\n";
+ $content .= " \n";
+ $content .= " \n";
+
+ $root_path = $compile_path . str_replace('/', DIRECTORY_SEPARATOR,'/components/diy/extend'); // 扩展组件根目录
+ $file_arr = getFileMap($root_path);
+
+ if (!empty($file_arr)) {
+ foreach ($file_arr as $ck => $cv) {
+ if (strpos($cv, 'index.vue') !== false) {
+
+ $path = str_replace($root_path . DIRECTORY_SEPARATOR, '', $ck);
+ $path = str_replace(DIRECTORY_SEPARATOR.'index.vue', '', $path);
+
+ // 获取自定义组件 key 关键词
+ $name_arr = explode('-', $path);
+ foreach ($name_arr as $k => $v) {
+ // 首字母大写
+ $name_arr[ $k ] = strtoupper(substr($v, 0, 1)) . substr($v, 1);
+ }
+ $name = implode('', $name_arr);
+ $file_name = 'diy-core-' . $path;
+
+ $content .= " \n";
+ $content .= " <$file_name :component=\"props.component\" :index=\"props.index\">{$file_name}>\n";
+ $content .= " \n";
+ }
+ }
+ }
+
+ $content .= " \n";
+ $content .= "\n";
+
+ $content .= "\n";
+ $content .= "\n";
+
+ // 找到页面路由文件 pages.json,写入内容
+ $res = file_put_contents($compile_path . str_replace('/', DIRECTORY_SEPARATOR, '/components/diy/comp-extend/index.vue'), $content);
+ return $res;
+ }
+
+ /**
+ * 编译 pages.json 页面路由代码文件
+ * @param $compile_path
+ * @return bool|int
+ */
+ public function compileRoutesCode($compile_path)
+ {
+
+ $package = [ 'pages' ]; // 主包
+
+ // 特殊页面,隐藏导航栏
+ $special_page = [
+ 'pages/index/index',
+ 'pages/member/index',
+ 'pages/pay/result',
+ 'pages/pay/browser'
+ ];
+
+ // 需要登录的页面
+ $need_login_page = [
+ 'pages/member/info',
+ 'pages/setting/index',
+ 'pages/member/personal',
+ 'pages/member/point',
+ 'pages/member/balance'
+ ];
+
+ $route_arr = []; // 路由集合
+
+ foreach ($package as $k => $v) {
+ $file_arr = getFileMap($compile_path . DIRECTORY_SEPARATOR . $v);
+ if (!empty($file_arr)) {
+ foreach ($file_arr as $ck => $cv) {
+ if (strpos($cv, '.vue') !== false) {
+ $route = str_replace($compile_path . DIRECTORY_SEPARATOR, '', $ck);
+ $route = str_replace('.vue', '', $route);
+ $route_arr[ $v ][] = $route;
+ }
+ }
+ }
+ }
+
+ // 排序
+ foreach ($package as $k => $v) {
+ sort($route_arr[ $v ], SORT_STRING);
+ }
+
+ // 获取首页下标
+ $index_page = array_search('pages/index/index', $route_arr[ 'pages' ]);
+ $index_route = $route_arr[ 'pages' ][ $index_page ];
+
+ // 将首页设为启动页
+ $route_arr[ 'pages' ][ $index_page ] = $route_arr[ 'pages' ][ 0 ];
+ $route_arr[ 'pages' ][ 0 ] = $index_route;
+
+ $content = "{\n";
+
+ // 主包
+ $content .= " \"pages\" : [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages\n";
+ foreach ($route_arr[ 'pages' ] as $k => $v) {
+ $content .= " {\n";
+ $content .= " \"path\": \"{$v}\",\n";
+ $content .= " \"style\": {\n";
+
+ if (in_array($v, $special_page)) {
+ $content .= " \"navigationStyle\": \"custom\",\n";
+ } else {
+ $content .= " // #ifdef H5\n";
+ $content .= " \"navigationStyle\": \"custom\",\n";
+ $content .= " // #endif\n";
+ }
+
+ $content .= " \"navigationBarTitleText\": \"%" . str_replace('/', '.', $v) . "%\"\n";
+
+ // 控制登录的页面
+ if (in_array($v, $need_login_page)) {
+ $content .= " },\n";
+ $content .= " \"needLogin\": true\n";
+ } else {
+ $content .= " }\n";
+ }
+
+ // 最后一个不能加逗号,
+ if (( count($route_arr[ 'pages' ]) - 1 ) == $k) {
+ $content .= " }\n";
+ } else {
+ $content .= " },\n";
+ }
+
+ }
+ $content .= " ],\n";
+
+ // globalStyle
+ $content .= " \"globalStyle\": {\n";
+ $content .= " \"navigationBarTextStyle\": \"black\",\n";
+ $content .= " \"navigationBarTitleText\": \"\",\n";
+ $content .= " \"navigationBarBackgroundColor\": \"#ffffff\",\n";
+ $content .= " \"backgroundColor\": \"#F8F8F8\",\n";
+ $content .= " \"backgroundColorTop\": \"#F8F8F8\",\n";
+ $content .= " \"backgroundColorBottom\": \"#F8F8F8\"\n";
+ $content .= " },\n";
+
+ // tabBar
+ $content .= " \"tabBar\": {\n";
+ $content .= " \"list\": [\n";
+
+ $content .= " {\n";
+ $content .= " \"pagePath\": \"pages/index/index\"\n";
+ $content .= " },\n";
+
+ $content .= " {\n";
+ $content .= " \"pagePath\": \"pages/article/list\"\n";
+ $content .= " },\n";
+
+ $content .= " {\n";
+ $content .= " \"pagePath\": \"pages/member/index\"\n";
+ $content .= " }\n";
+
+ $content .= " ]\n";
+
+ $content .= " },\n";
+
+ $content .= " \"uniIdRouter\": {},\n";
+
+ // easycom
+ $content .= " \"easycom\": {\n";
+ $content .= " \"custom\": {\n";
+ $content .= " \"^u-(.*)\": \"uview-plus/components/u-$1/u-$1.vue\",\n";
+ $content .= " \"diy-system-(\W.*)\": \"@/components/diy/system/$1/index.vue\",\n";
+ $content .= " \"diy-core-(\W.*)\": \"@/components/diy/core/$1/index.vue\",\n";
+ $content .= " \"diy-(\\W.*)\": \"@/components/diy/$1/index.vue\"\n";
+ $content .= " }\n";
+ $content .= " }\n";
+
+ $content .= "}\n";
+
+ // 找到页面路由文件 pages.json,写入内容
+ $res = file_put_contents($compile_path . DIRECTORY_SEPARATOR. 'pages.json', $content);
+ return $res;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/aliapp/CoreAliappConfigService.php b/niucloud/app/service/core/aliapp/CoreAliappConfigService.php
index 05990de6e..2a94a21cc 100644
--- a/niucloud/app/service/core/aliapp/CoreAliappConfigService.php
+++ b/niucloud/app/service/core/aliapp/CoreAliappConfigService.php
@@ -13,8 +13,8 @@ namespace app\service\core\aliapp;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
+use core\base\BaseCoreService;
use think\Model;
/**
diff --git a/niucloud/app/service/core/captcha/CoreCaptchaImgService.php b/niucloud/app/service/core/captcha/CoreCaptchaImgService.php
new file mode 100644
index 000000000..7130ef631
--- /dev/null
+++ b/niucloud/app/service/core/captcha/CoreCaptchaImgService.php
@@ -0,0 +1,104 @@
+getCaptchaService($captcha_type);
+ return $service->get();
+ }
+
+ /**
+ * 一次验证验证码
+ * @param Request $request
+ * @return true
+ */
+ public function check(){
+ try {
+ [$captcha_key, $captcha_code] = $this->validate();
+ $service = $this->getCaptchaService();
+ $service->check($captcha_key, $captcha_code);
+ return true;
+ } catch (\Exception $e) {
+ throw new CaptchaException('CAPTCHA_ERROR');
+ }
+ }
+
+ /**
+ * 一次验证验证码
+ * @param Request $request
+ * @return true
+ */
+ public function verification(){
+ try {
+ [$captcha_key, $captcha_code] = $this->validate();
+ $service = $this->getCaptchaService();
+ $service->verificationByEncryptCode($captcha_code);
+ return true;
+ } catch (ParamException $e) {
+ throw new CaptchaException('CAPTCHA_ERROR');
+ }
+ }
+
+ /**
+ * 验证验证码参数
+ * @return true
+ */
+ protected function validate(){
+ $captcha_key = request()->param('captcha_key', '');
+ $captcha_code = request()->param('captcha_code', '');
+ if(empty($captcha_code)) throw new CaptchaException('CAPTCHA_ERROR');
+ return [$captcha_key, $captcha_code];
+ }
+ protected function getCaptchaService($captcha_type = 'blockPuzzle')
+ {
+ $config = config('imgcaptcha');
+ switch ($captcha_type) {
+ case 'clickWord':
+ $service = new ClickWordCaptchaService($config);
+ break;
+ case 'blockPuzzle':
+ $service = new BlockPuzzleCaptchaService($config);
+ break;
+ default:
+ throw new AuthException('');
+ }
+ return $service;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/captcha/CoreCaptchaService.php b/niucloud/app/service/core/captcha/CoreCaptchaService.php
index bddeb99b4..465779bd9 100644
--- a/niucloud/app/service/core/captcha/CoreCaptchaService.php
+++ b/niucloud/app/service/core/captcha/CoreCaptchaService.php
@@ -12,8 +12,8 @@
namespace app\service\core\captcha;
use app\Request;
-use app\service\core\BaseCoreService;
-use extend\exception\CaptchaException;
+use core\base\BaseCoreService;
+use core\exception\CaptchaException;
use think\captcha\facade\Captcha;
use think\facade\Cache;
@@ -55,11 +55,11 @@ class CoreCaptchaService extends BaseCoreService
public function check(){
$captcha_key = request()->param('captcha_key', '');
$captcha_code = request()->param('captcha_code', '');
- if(empty($captcha_key) || empty($captcha_code)) throw new CaptchaException(100020);
+ if(empty($captcha_key) || empty($captcha_code)) throw new CaptchaException('CAPTCHA_ERROR');
$captcha = Cache::pull($captcha_key);
- if (empty($captcha)) throw new CaptchaException(100020);
+ if (empty($captcha)) throw new CaptchaException('CAPTCHA_ERROR');
- if ($captcha_code != $captcha) throw new CaptchaException(100020);
+ if ($captcha_code != $captcha) throw new CaptchaException('CAPTCHA_ERROR');
return true;
}
diff --git a/niucloud/app/service/core/channel/CoreH5Service.php b/niucloud/app/service/core/channel/CoreH5Service.php
index 4585f4e2e..3f4580564 100644
--- a/niucloud/app/service/core/channel/CoreH5Service.php
+++ b/niucloud/app/service/core/channel/CoreH5Service.php
@@ -13,15 +13,8 @@ namespace app\service\core\channel;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysAttachment;
-use app\service\core\BaseCoreService;
-use app\service\core\file\CoreStorageService;
use app\service\core\sys\CoreConfigService;
-use extend\driver\file\FileDriver;
-use extend\exception\AdminException;
-use extend\exception\UploadFileException;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
+use core\base\BaseCoreService;
/**
* 素材管理服务层
diff --git a/niucloud/app/service/core/cron/CoreCronService.php b/niucloud/app/service/core/cron/CoreCronService.php
index fae21faf3..c5d1e5262 100644
--- a/niucloud/app/service/core/cron/CoreCronService.php
+++ b/niucloud/app/service/core/cron/CoreCronService.php
@@ -12,7 +12,7 @@
namespace app\service\core\cron;
use app\model\sys\SysCronTask;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
/**
* 计划任务服务层
@@ -50,7 +50,7 @@ class CoreCronService extends BaseCoreService
* @param $data
* @return SysCronTask
*/
- public function update(int $site_id, int $id, array $data){
+ public function edit(int $site_id, int $id, array $data){
$where = array(
['site_id', '=', $site_id],
['id', '=', $id]
@@ -71,14 +71,14 @@ class CoreCronService extends BaseCoreService
);
$list = self::$model->where($where)->select()->toArray();
if(!empty($list)){
- $job_handler_classname = 'sys\CronTaskJob';
+ $job_handler_classname = 'app\job\sys\Cronexecute';
foreach($list as $k => $v){
$next_time = $v['next_time'];
if($next_time < $now){
- create_queue($job_handler_classname, $v ?? []);
+ create_job($job_handler_classname, $v ?? []);
}else{
- create_queue($job_handler_classname, $v ?? [], $next_time - time());
+ create_job($job_handler_classname, $v ?? [], $next_time - time());
}
}
}
@@ -126,7 +126,7 @@ class CoreCronService extends BaseCoreService
}else{
$update_data['delete_time'] = $now;
}
- $this->update($site_id, $id, $update_data);
+ $this->edit($site_id, $id, $update_data);
}
diff --git a/niucloud/app/service/core/diy/CoreDiyConfigService.php b/niucloud/app/service/core/diy/CoreDiyConfigService.php
index 8ca9b9aed..fc7c9cb96 100644
--- a/niucloud/app/service/core/diy/CoreDiyConfigService.php
+++ b/niucloud/app/service/core/diy/CoreDiyConfigService.php
@@ -13,8 +13,8 @@ namespace app\service\core\diy;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
+use core\base\BaseCoreService;
use think\Model;
/**
diff --git a/niucloud/app/service/core/member/CoreMemberAccountService.php b/niucloud/app/service/core/member/CoreMemberAccountService.php
index 312a9ac9b..1b4c5333d 100644
--- a/niucloud/app/service/core/member/CoreMemberAccountService.php
+++ b/niucloud/app/service/core/member/CoreMemberAccountService.php
@@ -13,8 +13,8 @@ namespace app\service\core\member;
use app\model\member\Member;
use app\model\member\MemberAccountLog;
-use app\service\core\BaseCoreService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
use think\facade\Db;
/**
@@ -27,34 +27,35 @@ class CoreMemberAccountService extends BaseCoreService
public function addLog(int $site_id, int $member_id, string $account_type, $account_data, string $from_type, string $memo, $related_id = 0)
{
+ $member_model = new Member();
+ $member_account_log_model = new MemberAccountLog();
+ //账户检测
+ $member_info = $member_model->where([
+ [ 'member_id', '=', $member_id ],
+ [ 'site_id', '=', $site_id ]
+ ])->field($account_type .','.$account_type."_get" .', username, mobile, nickname')->lock(true)->find();
+ if(empty($member_info)) throw new CommonException('MEMBER_NOT_EXIST');;
+ $account_new_data = round((float) $member_info[ $account_type ] + (float) $account_data, 2);
+
+ if ($account_new_data < 0) {
+ throw new CommonException('ACCOUNT_INSUFFICIENT');
+ }
+
+ $data = array (
+ 'site_id' => $site_id,
+ 'member_id' => $member_id,
+ 'account_type' => $account_type,
+ 'account_data' => $account_data,
+ 'from_type' => $from_type,
+ 'create_time' => time(),
+ 'nickname' => $member_info[ 'nickname' ],
+ 'mobile' => $member_info[ 'mobile' ],
+ 'memo' => $memo,
+ 'related_id'=>$related_id,
+ );
+
Db::startTrans();
try {
- $member_model = new Member();
- $member_account_log_model = new MemberAccountLog();
- //账户检测
- $member_info = $member_model->where([
- [ 'member_id', '=', $member_id ],
- [ 'site_id', '=', $site_id ]
- ])->field($account_type .','.$account_type."_get" .', username, mobile, nickname')->lock(true)->find();
- if(empty($member_info)) throw new CommonException(301005);;
- $account_new_data = round((float) $member_info[ $account_type ] + (float) $account_data, 2);
-
- if ($account_new_data < 0) {
- throw new CommonException(301002);
- }
-
- $data = array (
- 'site_id' => $site_id,
- 'member_id' => $member_id,
- 'account_type' => $account_type,
- 'account_data' => $account_data,
- 'from_type' => $from_type,
- 'create_time' => time(),
- 'nickname' => $member_info[ 'nickname' ],
- 'mobile' => $member_info[ 'mobile' ],
- 'memo' => $memo,
- 'related_id'=>$related_id,
- );
$res = $member_account_log_model->create($data);
//账户更新
diff --git a/niucloud/app/service/core/member/CoreMemberCashOutAccountService.php b/niucloud/app/service/core/member/CoreMemberCashOutAccountService.php
new file mode 100644
index 000000000..897bd4d6c
--- /dev/null
+++ b/niucloud/app/service/core/member/CoreMemberCashOutAccountService.php
@@ -0,0 +1,35 @@
+model = new MemberCashOutAccount();
+ }
+
+ public function getInfo(int $account_id, int $site_id, int $member_id){
+ $field = 'account_id,site_id,member_id,account_type,bank_name,realname,account_no';
+ return $this->model->where([['account_id', '=', $account_id], ['site_id', '=', $site_id], ['member_id', '=', $member_id]])->field($field)->findOrEmpty()->toArray();
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/member/CoreMemberCashOutService.php b/niucloud/app/service/core/member/CoreMemberCashOutService.php
new file mode 100644
index 000000000..e8ae698fd
--- /dev/null
+++ b/niucloud/app/service/core/member/CoreMemberCashOutService.php
@@ -0,0 +1,277 @@
+model = new MemberCashOut();
+ }
+
+ /**
+ * 获取对象
+ * @param int $site_id
+ * @param int $id
+ * @return MemberCashOut|array|mixed|\think\Model
+ */
+ public function find(int $site_id, int $id){
+ return $this->model->where([
+ ['site_id', '=', $site_id],
+ ['id', '=', $id],
+ ])->findOrEmpty();
+ }
+
+ /**
+ * @param int $id
+ * @param $data
+ * @return void
+ */
+ public function audit(int $site_id, int $id, string $action, $data = []){
+
+ $cash_out = $this->find($site_id, $id);
+ if($cash_out->isEmpty()) throw new CommonException('CASHOUT_LOG_NOT_EXIST');
+ if($cash_out['status'] != MemberCashOutEnum::WAIT_AUDIT) throw new CommonException('CASHOUT_STATUS_NOT_IN_WAIT_AUDIT');
+ switch($action){
+ case 'agree'://同意
+ $this->agree($site_id, $cash_out, $data);
+ break;
+ case 'refuse'://拒绝
+ $this->refuse($site_id, $cash_out, $data);
+ break;
+ }
+ return true;
+ }
+
+ /**
+ * 审核通过
+ * @param MemberCashOut $cash_out
+ * @param $data
+ * @return true
+ */
+ public function agree(int $site_id, MemberCashOut $cash_out, array $data = []){
+ $cash_out->save([
+ 'audit_time' => time(),
+ 'status' => MemberCashOutEnum::WAIT_TRANSFER
+ ]);
+ $config = (new CoreMemberConfigService())->getCashOutConfig($site_id);
+ if($config['is_auto_transfer']){
+ try {
+ $this->transfer($site_id, $cash_out['id']);
+ } catch (\Throwable $e) {
+
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 拒绝
+ * @param MemberCashOut $cash_out
+ * @param $data
+ * @return true
+ */
+ public function refuse(int $site_id, MemberCashOut $cash_out, array $data){
+ $cash_out->save([
+ 'audit_time' => time(),
+ 'status' => MemberCashOutEnum::REFUSE,
+ 'refuse_reason' => $data['refuse_reason']
+ ]);
+ $this->returnMember($site_id, $cash_out);
+ return true;
+ }
+
+ /**
+ * 转账
+ * @param int $site_id
+ * @param int $id
+ * @param array $data
+ * @return true
+ */
+ public function transfer(int $site_id, int $id, array $data = []){
+ $transfer_type = $data['transfer_type'] ?? '';
+
+ $cash_out = $this->find($site_id, $id);
+ if($cash_out->isEmpty()) throw new CommonException('RECHARGE_LOG_NOT_EXIST');
+ if($cash_out['status'] != MemberCashOutEnum::WAIT_TRANSFER) throw new CommonException('CASHOUT_STATUS_NOT_IN_WAIT_TRANSFER');
+ $transfer_no = $cash_out['transfer_no'];
+ if(!$transfer_no){
+ $transfer_no = (new CoreTransferService())->create($site_id, PayEnum::MEMBER, $cash_out['member_id'], $cash_out['money'], CashOutTypeEnum::MEMBER_CASH_OUT, get_lang('MEMBER_CASHOUT_TRANSFER'));
+ $cash_out->save(
+ [
+ 'transfer_no' => $transfer_no
+ ]
+ );
+ }
+
+ if($transfer_type != TransferEnum::OFFLINE){
+ $data['transfer_type'] = $cash_out['transfer_type'];
+ $data['transfer_realname'] = $cash_out['transfer_realname'];
+ $data['transfer_mobile'] = $cash_out['transfer_mobile'];
+ $data['transfer_bank'] = $cash_out['transfer_bank'];
+ $data['transfer_account'] = $cash_out['transfer_account'];
+ if($transfer_type == TransferEnum::WECHAT){
+ $member = (new CoreMemberService())->find($site_id, $cash_out['member_id']);
+ $data['openid'] = $member['wx_openid'];
+ }
+ }else{
+ $transfer_type = $cash_out['transfer_type'];
+ }
+ $result = (new CoreTransferService())->transfer($site_id, $transfer_no, $transfer_type, $data);
+ return true;
+
+ }
+
+
+ /**
+ * 提现转账完成
+ * @param $site_id
+ * @param $transfer_no
+ * @return void
+ */
+ public function transferFinish($site_id, $transfer_no){
+ $cash_out = $this->model->where(
+ [
+ ['site_id', '=', $site_id],
+ ['transfer_no', '=', $transfer_no]
+ ]
+ )->findOrEmpty();
+
+ if($cash_out->isEmpty()) throw new CommonException('RECHARGE_LOG_NOT_EXIST');
+ if($cash_out['status'] != MemberCashOutEnum::WAIT_TRANSFER) throw new CommonException('CASHOUT_STATUS_NOT_IN_WAIT_TRANSFER');
+ $cash_out->save([
+ 'status' => MemberCashOutEnum::TRANSFERED,
+ 'transfer_time' => time()
+ ]);
+ return true;
+ }
+
+ /**
+ * 申请提现
+ * @param $data
+ * @return true
+ */
+ public function apply(int $site_id, int $member_id, array $data){
+ $core_member_service = new CoreMemberService();
+ $member = $core_member_service->find($site_id, $member_id);
+
+ if($member->isEmpty()) throw new CommonException('MEMBER_NOT_EXIST');
+ $config = (new CoreMemberConfigService())->getCashOutConfig($site_id);
+ $is_open = $config['is_open'];
+ if($is_open == 0) throw new CommonException('CASHOUT_NOT_OPEN');
+ $apply_money = $data['apply_money'];
+ if($apply_money < $config['min']) throw new CommonException('CASHOUT_MONEY_TOO_LITTLE');
+ $transfer_type = $data['transfer_type'];
+ if(!in_array($transfer_type, $config['transfer_type'])) throw new CommonException('CASHOUT_TYPE_NOT_OPEN');
+ $service_money = format_round_money($apply_money * $config['rate']/100);
+ $min = $config['min'];
+ if($apply_money < $min) throw new CommonException('CASHOUT_MONEY_TOO_LITTLE');
+// $apply_money, $transfer_type, $transfer_realname, $transfer_mobile, $transfer_bank, $transfer_account
+ $money = $apply_money - $service_money;
+ $account_type = $data['account_type'] ?? MemberAccountEnum::MONEY;
+
+ $cash_out_account = [];
+ if ($transfer_type != TransferEnum::WECHAT) {
+ $cash_out_account = (new CoreMemberCashOutAccountService())->getInfo($data['account_id'], $site_id, $member_id);
+ if (empty($cash_out_account)) throw new CommonException('CASH_OUT_ACCOUNT_NOT_EXIST');
+ }
+
+ Db::startTrans();
+ try {
+ $data = array(
+ 'member_id' => $member_id,
+ 'site_id' => $site_id,
+ 'status' => MemberCashOutEnum::WAIT_AUDIT,
+ 'account_type' => $account_type,
+ 'apply_money' => $apply_money,
+ 'service_money' => $service_money,
+ 'money' => $money,
+ 'transfer_type' => $transfer_type,
+ 'transfer_realname' => $cash_out_account['realname'] ?? '',
+ 'transfer_mobile' => $member['mobile'] ?? '',
+ 'transfer_bank' => $cash_out_account['bank_name'] ?? '',
+ 'transfer_account' => $cash_out_account['account_no'] ?? '',
+ 'rate' => $config['rate'],
+ );
+ $cash_out = $this->model->create($data);
+ //扣除对应账户金额
+ $member_account_service = new CoreMemberAccountService();
+
+ $member_account_service->addLog($site_id, $member_id, $account_type, -$apply_money, 'cash_out', get_lang('MEMBER_APPLY_CASHOUT'), $cash_out->id);
+ $member->save(
+ [
+ $account_type.'_cash_outing' => $member[$account_type.'_cash_outing'] + $apply_money
+ ]
+ );
+ if ($config['is_auto_verify']) {
+ $core_member_cash_out_service = new CoreMemberCashOutService();
+ $core_member_cash_out_service->audit($site_id, $cash_out->id, 'agree');
+ }
+ Db::commit();
+ }catch ( \Exception $e) {
+ Db::rollback();
+ throw new CommonException($e->getMessage());
+ }
+ return true;
+ }
+
+ /**
+ * 当前可用的转账方式
+ * @param $site_id
+ * @return array|array[]
+ */
+ public function getTransferType($site_id){
+ $config = (new CoreMemberConfigService())->getCashOutConfig($site_id);
+ return TransferEnum::getTransferType($config['transfer_type'], false);
+ }
+
+
+
+ /**
+ * 返还用户的对应账户
+ * @param int $site_id
+ * @param MemberCashOut $cash_out
+ * @return true
+ */
+ public function returnMember(int $site_id, MemberCashOut $cash_out){
+ $core_member_account_service = new CoreMemberAccountService();
+
+ $core_member_account_service->addLog($site_id, $cash_out->member_id, $cash_out->account_type, $cash_out->apply_money, 'cash_out', get_lang('CASHOUT_IS_REFUSE'), $cash_out->id);
+ $core_member_service = new CoreMemberService();
+ $member = $core_member_service->find($site_id, $cash_out->member_id);
+ if($member->isEmpty()) throw new CommonException('MEMBER_NOT_EXIST');
+ $member->save(
+ [
+ $cash_out->account_type.'_cash_outing' => $member[$cash_out->account_type.'_cash_outing'] - $cash_out->apply_money
+ ]
+ );
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/member/CoreMemberConfigService.php b/niucloud/app/service/core/member/CoreMemberConfigService.php
index 8cc5c557d..1e471a044 100644
--- a/niucloud/app/service/core/member/CoreMemberConfigService.php
+++ b/niucloud/app/service/core/member/CoreMemberConfigService.php
@@ -14,9 +14,9 @@ namespace app\service\core\member;
use app\enum\pay\TransferEnum;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
use think\Model;
/**
@@ -65,21 +65,17 @@ class CoreMemberConfigService extends BaseCoreService
* @param int $site_id
* @return array
*/
- public function getWithdrawConfig(int $site_id){
- $config = (new CoreConfigService())->getConfig($site_id, ConfigKeyEnum::MEMBER_WITHDRAW)['value'] ?? [];
- if(empty($config)){
- $config = [
- 'is_open' => 0,//是否启用提现
- 'transfer_type' => [],//提现方式
- 'min' => '0',//最低提现金额
+ public function getCashOutConfig(int $site_id){
+ $config = (new CoreConfigService())->getConfig($site_id, ConfigKeyEnum::MEMBER_CASH_OUT)['value'] ?? [];
+ return [
+ 'is_open' => $config['is_open'] ?? '0',//是否启用提现
+ 'transfer_type' => $config['transfer_type'] ?? [],//提现方式
+ 'min' => $config['min'] ?? '0',//最低提现金额
// 'max' => '0',//最高提现金额
- 'rate' => '0',//手续费比率
-
- 'is_auto_verify' => '0', //是否自动审核
- 'is_auto_transfer' => '0', //是否自动转账
- ];
- }
- return $config;
+ 'rate' => $config['rate'] ?? '0',//手续费比率
+ 'is_auto_verify' => $config['is_auto_verify'] ?? '0', //是否自动审核
+ 'is_auto_transfer' => $config['is_auto_transfer'] ?? '0', //是否自动转账
+ ];
}
/**
@@ -88,10 +84,10 @@ class CoreMemberConfigService extends BaseCoreService
* @param $data
* @return SysConfig|bool|Model
*/
- public function setWithdrawConfig(int $site_id, array $data){
+ public function setCashOutConfig(int $site_id, array $data){
//校验转账方式是否合法
$transfer_type_list = array_keys(TransferEnum::getTransferType());
- if(array_diff(array_diff($data['transfer_type'], $transfer_type_list), $transfer_type_list)) throw new CommonException(302006);
+ if(array_diff(array_diff($data['transfer_type'], $transfer_type_list), $transfer_type_list)) throw new CommonException('TRANSFER_TYPE_NOT_EXIST');
$config = [
'is_open' => $data['is_open'],//是否启用提现
'transfer_type' => $data['transfer_type'] ?? [],//提现方式
@@ -101,8 +97,9 @@ class CoreMemberConfigService extends BaseCoreService
// 'max' => $data['max'] ?? '',//最高提现金额
'rate' => $data['rate'] ?? '',//手续费比率
];
- (new CoreConfigService())->setConfig($site_id, ConfigKeyEnum::MEMBER_WITHDRAW, $config);
+ (new CoreConfigService())->setConfig($site_id, ConfigKeyEnum::MEMBER_CASH_OUT, $config);
return true;
}
+
}
\ No newline at end of file
diff --git a/niucloud/app/service/core/member/CoreMemberLabelService.php b/niucloud/app/service/core/member/CoreMemberLabelService.php
index 92cee4158..8303e4ccd 100644
--- a/niucloud/app/service/core/member/CoreMemberLabelService.php
+++ b/niucloud/app/service/core/member/CoreMemberLabelService.php
@@ -12,7 +12,7 @@
namespace app\service\core\member;
use app\model\member\MemberLabel;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
use think\facade\Cache;
/**
diff --git a/niucloud/app/service/core/member/CoreMemberService.php b/niucloud/app/service/core/member/CoreMemberService.php
index 8d17e7389..61f46986c 100644
--- a/niucloud/app/service/core/member/CoreMemberService.php
+++ b/niucloud/app/service/core/member/CoreMemberService.php
@@ -12,7 +12,8 @@
namespace app\service\core\member;
use app\model\member\Member;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
+use think\db\exception\DbException;
/**
* 会员信息服务层
@@ -42,7 +43,7 @@ class CoreMemberService extends BaseCoreService
'headimg' => 'headimg',
'member_label' => 'member_label',
'birthday' => 'birthday',
- 'sex' => 'sex'
+ 'sex' => 'sex',
};
$where = array(
['site_id', '=', $site_id],
@@ -79,4 +80,25 @@ class CoreMemberService extends BaseCoreService
return $this->model->where($where)->findOrEmpty();
}
+ /**
+ * 会员数量
+ * @return int
+ * @throws DbException
+ */
+ public function getCount(array $where = []){
+ $condition = array();
+ if(!empty($where['site_id'])){
+ $condition[] = ['site_id', '=', $where['site_id']];
+ }
+ if(!empty($where['create_time'])){
+ $condition[] = ['create_time', 'between', $where['create_time']];
+ }
+ if(!empty($where['sex'])){
+ $condition[] = ['sex', '=', $where['sex']];
+ }
+ if(!empty($where['last_visit_time'])){
+ $condition[] = ['last_visit_time', 'between', $where['last_visit_time']];
+ }
+ return $this->model->where($condition)->count();
+ }
}
\ No newline at end of file
diff --git a/niucloud/app/service/core/member/CoreMemberWithdrawService.php b/niucloud/app/service/core/member/CoreMemberWithdrawService.php
deleted file mode 100644
index 236a62f3f..000000000
--- a/niucloud/app/service/core/member/CoreMemberWithdrawService.php
+++ /dev/null
@@ -1,255 +0,0 @@
-model = new MemberWithdraw();
- }
-
- /**
- * 获取对象
- * @param int $site_id
- * @param int $id
- * @return MemberWithdraw|array|mixed|\think\Model
- */
- public function find(int $site_id, int $id){
- return $this->model->where([
- ['site_id', '=', $site_id],
- ['id', '=', $id],
- ])->findOrEmpty();
- }
-
- /**
- * @param int $id
- * @param $data
- * @return void
- */
- public function audit(int $site_id, int $id, string $action, $data = []){
- $withdraw = $this->find($site_id, $id);
- if($withdraw->isEmpty()) throw new CommonException(302004);
- if($withdraw['status'] != MemberWithdrawEnum::WAIT_AUDIT) throw new CommonException(302011);
- switch($action){
- case 'agree'://同意
- $this->agree($site_id, $withdraw, $data);
- break;
- case 'refuse'://拒绝
- $this->refuse($site_id, $withdraw, $data);
- break;
- }
- return true;
- }
-
- /**
- * 审核通过
- * @param MemberWithdraw $withdraw
- * @param $data
- * @return true
- */
- public function agree(int $site_id, MemberWithdraw $withdraw, array $data = []){
- $withdraw->save([
- 'audit_time' => time(),
- 'status' => MemberWithdrawEnum::WAIT_TRANSFER
- ]);
- $config = (new CoreMemberConfigService())->getWithdrawConfig($site_id);
- if($config['is_auto_transfer']){
- try {
- $this->transfer($site_id, $withdraw['id']);
- } catch (\Throwable $e) {
-
- }
- }
- return true;
- }
-
- /**
- * 拒绝
- * @param MemberWithdraw $withdraw
- * @param $data
- * @return true
- */
- public function refuse(int $site_id, MemberWithdraw $withdraw, array $data){
- $withdraw->save([
- 'audit_time' => time(),
- 'status' => MemberWithdrawEnum::WAIT_TRANSFER,
- 'refuse_reason' => $data['refuse_reason']
- ]);
- $this->returnMember($site_id, $withdraw);
- return true;
- }
-
- /**
- * 转账
- * @param int $site_id
- * @param int $id
- * @param array $data
- * @return true
- */
- public function transfer(int $site_id, int $id, array $data = []){
- $transfer_type = $data['transfer_type'] ?? '';
- $withdraw = $this->find($site_id, $id);
- if($withdraw->isEmpty()) throw new CommonException(302004);
- if($withdraw['status'] != MemberWithdrawEnum::WAIT_TRANSFER) throw new CommonException(302010);
- $transfer_no = $withdraw['transfer_no'];
- if(!$transfer_no){
- $transfer_no = (new CoreTransferService())->create($site_id, PayEnum::MEMBER, $withdraw['member_id'], $withdraw['money'], WithdrawTypeEnum::MEMBER_WITHDRAW, get_lang(302012));
- $withdraw->save(
- [
- 'transfer_no' => $transfer_no
- ]
- );
- }
-
- if(empty($transfer_type)){
- $transfer_type = $withdraw['transfer_type'];
- }
- if($transfer_type != TransferEnum::OFFLINE){
- $data['transfer_type'] = $withdraw['transfer_type'];
- $data['transfer_realname'] = $withdraw['transfer_realname'];
- $data['transfer_mobile'] = $withdraw['transfer_mobile'];
- $data['transfer_bank'] = $withdraw['transfer_bank'];
- $data['transfer_account'] = $withdraw['transfer_account'];
- if($transfer_type == TransferEnum::WECHAT){
- $member = (new CoreMemberService())->find($site_id, $withdraw['member_id']);
- $data['openid'] = $member['wx_openid'];
- }
- }
- $result = (new CoreTransferService())->transfer($site_id, $transfer_no, $transfer_type, $data);
- return true;
-
- }
-
-
- /**
- * 提现转账完成
- * @param $site_id
- * @param $transfer_no
- * @return void
- */
- public function transferFinish($site_id, $transfer_no){
- $withdraw = $this->model->where(
- [
- ['site_id', '=', $site_id],
- ['transfer_no', '=', $transfer_no]
- ]
- )->findOrEmpty();
- if($withdraw->isEmpty()) throw new CommonException(302004);
- if($withdraw['status'] != MemberWithdrawEnum::WAIT_TRANSFER) throw new CommonException(302010);
- $withdraw->save([
- 'status' => MemberWithdrawEnum::TRANSFERED,
- 'transfer_time' => time()
- ]);
- return true;
- }
-
- /**
- * 申请提现
- * @param $data
- * @return true
- */
- public function apply(int $site_id, int $member_id, array $data){
- $core_member_service = new CoreMemberService();
- $member = $core_member_service->find($site_id, $member_id);
- if($member->isEmpty()) throw new CommonException(301005);
- $config = (new CoreMemberConfigService())->getWithdrawConfig($site_id);
- $is_open = $config['is_open'];
- if($is_open == 0) throw new CommonException(302001);
- $apply_money = $data['apply_money'];
- if($apply_money < $config['min']) throw new CommonException(302002);
- $transfer_type = $data['transfer_type'];
- if(!in_array($transfer_type, $config['transfer_type'])) throw new CommonException(302003);
- $service_money = format_round_money($apply_money * $config['rate']/100);
- $min = $config['min'];
- if($apply_money < $min) throw new CommonException(302009);
-// $apply_money, $transfer_type, $transfer_realname, $transfer_mobile, $transfer_bank, $transfer_account
- $money = $apply_money - $service_money;
- $data = array(
- 'member_id' => $member_id,
- 'site_id' => $site_id,
- 'status' => MemberWithdrawEnum::WAIT_AUDIT,
- 'apply_money' => $apply_money,
- 'service_money' => $service_money,
- 'money' => $money,
- 'transfer_type' => $transfer_type,
- 'transfer_realname' => $data['transfer_realname'] ?? '',
- 'transfer_mobile' => $data['transfer_mobile'] ?? '',
- 'transfer_bank' => $data['transfer_bank'] ?? '',
- 'transfer_account' => $data['transfer_account'] ?? '',
- 'rate' => $config['rate'],
- );
- $withdraw = $this->model->create($data);
- //扣除可提现零钱
- $member_account_service = new CoreMemberAccountService();
- $member_account_service->addLog($site_id, $member_id, 'money', $apply_money, 'withdraw', get_lang(302008), $withdraw->id);
- $member->save(
- [
- 'money_withdrawing' => $member['money_withdrawing'] + $apply_money
- ]
- );
- if($config['is_auto_verify']){
- $core_member_withdraw_service = new CoreMemberWithdrawService();
- $core_member_withdraw_service->audit($site_id, $withdraw->id, 'agree');
- }
- return true;
- }
-
- /**
- * 当前可用的转账方式
- * @param $site_id
- * @return array|array[]
- */
- public function getTransferType($site_id){
- $config = (new CoreMemberConfigService())->getWithdrawConfig($site_id);
- return TransferEnum::getTransferType($config['transfer_type'], false);
- }
-
-
-
- /**
- * 返还用户的可提现零钱
- * @param int $site_id
- * @param MemberWithdraw $withdraw
- * @return true
- */
- public function returnMember(int $site_id, MemberWithdraw $withdraw){
- $core_member_account_service = new CoreMemberAccountService();
- $core_member_account_service->addLog($site_id, $withdraw->member_id, 'money', -$withdraw->apply_money, 'withdraw', get_lang(302007), $withdraw->id);
- $core_member_service = new CoreMemberService();
- $member = $core_member_service->find($site_id, $withdraw->member_id);
- if($member->isEmpty()) throw new CommonException(301005);
- $member->save(
- [
- 'money_withdrawing' => $member['money_withdrawing'] + $withdraw->apply_money
- ]
- );
- return true;
- }
-}
\ No newline at end of file
diff --git a/niucloud/app/service/core/menu/CoreMenuService.php b/niucloud/app/service/core/menu/CoreMenuService.php
new file mode 100644
index 000000000..bdbf30c88
--- /dev/null
+++ b/niucloud/app/service/core/menu/CoreMenuService.php
@@ -0,0 +1,147 @@
+model = new SysMenu();
+ }
+ /**
+ * 安装菜单
+ * @param array $menu_list
+ * @return true
+ */
+ public function install(array $menu_list)
+ {
+ $this->model->replace()->insertAll($menu_list);
+ // 清除缓存
+ Cache::tag(MenuService::$cache_tag_name)->clear();
+ return true;
+ }
+
+ /**
+ * 加载菜单
+ * @return array
+ */
+ public function loadMenu(array $menu_tree, string $app_type, string $addon = '')
+ {
+ //加载系统
+ $menu_list = [];
+ $this->menuTreeToList($menu_tree, '',$app_type, $addon, $menu_list);
+ return $menu_list;
+ }
+
+ /**
+ * 菜单数转为列表
+ * @param array $tree
+ * @param string $parent_key
+ * @param string $app_type
+ */
+ private function menuTreeToList(array $tree, string $parent_key = '', string $app_type = AppTypeEnum::ADMIN, string $addon = '', array &$menu_list= [])
+ {
+ if (is_array($tree)) {
+ foreach ($tree as $key => $value) {
+ $item = [
+ 'menu_name' => $value['menu_name'],
+ 'menu_key' => $value['menu_key'],
+ 'app_type' => $app_type,
+ 'addon' => $addon,
+ 'parent_key' => $value['parent_key'] ?? $parent_key,
+ 'menu_type' => $value['menu_type'],
+ 'icon' => $value['icon'] ?? '',
+ 'api_url' => $value['api_url'] ?? '',
+ 'router_path' => $value['router_path'] ?? '',
+ 'view_path' => $value['view_path'] ?? '',
+ 'methods' => $value['methods'] ?? '',
+ 'sort' => $value['sort'] ?? '',
+ 'status' => 1,
+ 'is_show' => $value['is_show'] ?? 1,
+ 'en_menu_name' => $value['en_menu_name'] ?? '',
+ ];
+ $refer = $value;
+ if (isset($refer[ 'children' ])) {
+ unset($refer[ 'children' ]);
+ array_push($menu_list, $item);
+ $p_key = $refer[ 'menu_key' ];
+ $this->menuTreeToList($value[ 'children' ],$p_key, $app_type, $menu_list);
+ } else {
+ array_push($menu_list, $item);
+ }
+ }
+ }
+ }
+
+ /**
+ * 删除插件菜单
+ * @param string $addon
+ * @return true
+ */
+ public function deleteByAddon(string $addon){
+ $this->model->where([['addon', '=', $addon]])->delete();
+ return true;
+ }
+
+ /**
+ * 安装或者刷新插件菜单
+ * @param $addon
+ * @return bool
+ */
+ public function refreshAddonMenu($addon)
+ {
+ $addon_loader = new AddonLoader("Menu");
+ $addon_admin_tree = $addon_loader->load(["addon" => $addon, "app_type" => "admin"]);
+ $menu = [];
+ if(!empty($addon_admin_tree))
+ {
+ $menu = $this->loadMenu($addon_admin_tree, "admin", $addon);
+ }
+ $addon_site_tree = $addon_loader->load(["addon" => $addon, "app_type" => "site"]);
+ if(!empty($addon_site_tree))
+ {
+ $site_menu = $this->loadMenu($addon_site_tree, "site", $addon);
+ $menu = array_merge($menu, $site_menu);
+ }
+ $this->deleteByAddon($addon);
+ $this->install($menu);
+ return true;
+
+ }
+
+ /**
+ * 刷新所有插件菜单
+ */
+ public function refreshAllAddonMenu()
+ {
+
+ $addons = (new Addon())->field("title")->select()->toArray();
+ foreach ($addons as $k => $v)
+ {
+ $this->refreshAddonMenu($v["title"]);
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/message/CoreMessageEventService.php b/niucloud/app/service/core/message/CoreMessageEventService.php
deleted file mode 100644
index 79becd269..000000000
--- a/niucloud/app/service/core/message/CoreMessageEventService.php
+++ /dev/null
@@ -1,249 +0,0 @@
-model = new SysMessage();
- }
-
- public function event($data){
- $site_id = $data['site_id'];
- $key = $data['key'];
- $message = (new CoreMessageService())->getInfo($site_id, $key);
-
-
- switch($key){
- case 'verify_code'://用户手机验证码
- //手机发送
- $mobile = $data['mobile'];
- $params = array(
- 'code' => $data['code']
- );
- $data['params'] = $params;
- $this->sms($site_id, $mobile, $params, $message, $data);
- break;
- case 'member_verify_code'://会员手机验证码
- //手机发送
- $mobile = $data['mobile'];
- $params = array(
- 'code' => $data['code']
- );
-
- $this->sms($site_id, $mobile, $params, $message, $data);
- break;
- case 'recharge_success'://充值成功通知
- //查询到充值订单
- $order = [];
- //手机发送
- $mobile = $data['mobile'];
- $params = array(
- 'price' => $order['price'],//
- 'balance' => $order['balance'],
- 'time' => $order['create_time'],
- 'trade_no' => $order['trade_no'],
- );
- $this->sms($site_id, $mobile, $params, $message, $data);
-
-
- $wechat_data = [
- 'keyword1' => $order['create_time'],
- 'keyword2' => $order['order_money'],
- 'keyword3' => $order['order_status_name'],
- ];
- $url = '/pages/member/index..............';
- $this->wechat($site_id, $wechat_data, $data, $message, $url);
- break;
- }
- return true;
- }
-
- /**
- * 短信发送
- * @param $site_id
- * @param $mobile
- * @param $data
- * @param $message
- * @return void
- */
- public function sms($site_id, $mobile, $params, $message, $data){
- //完全信任消息的设置, 不再依赖support_type
- if($message['is_sms']) {
- $member_id = $data['member_id'] ?? 0;
- $uid = $data['uid'] ?? 0;
- $core_sms_service = new CoreSmsService();
-
-
- //消息日志
- $log_data = array(
- 'key' => $message['key'],
- 'message_type' => MessageTypeEnum::SMS,
- 'uid' => $uid,
- 'member_id' => $member_id,
- 'nickname' => $nickname ?? '',
- 'receiver' => $mobile,
- 'params' => $data,
- 'content' => $message['sms_content'],
- 'result' => ''
- );
-
- try{
- $core_sms_service->send($site_id, $mobile, $params, $message['key'], $message['sms_id'], $message['sms_content']);
- (new CoreMessageLogService())->add($site_id, $log_data);
- }catch(MessageException $e){
- $log_data['result'] = $e->getMessage();
- (new CoreMessageLogService())->add($site_id, $log_data);
- //这儿决定要不要抛出
- if($this->is_throw){
- throw new MessageException($e->getMessage());
- }
- }
-
- }else{
- if($this->is_throw){
- throw new MessageException(204011);
- }
- }
- return true;
- }
-
- /**
- * 微信公众号,模板消息
- * @param $site_id
- * @param $mobile
- * @param $data
- * @param $message
- * @return void
- */
- public function wechat($site_id, $message_data, $data, $message, $url = ''){
- //完全信任消息的设置, 不再依赖support_type
- if($message['is_wechat']){
- $member_id = $data['member_id'] ?? 0;
- //会员的
- if($member_id > 0){//查询openid
- $info = (new CoreMemberService())->getInfoByMemberId($site_id, $member_id);
- $openid = $info['wx_openid'] ?? 0;
- $nickname = $info['nickname'] ?? '';
- }
- //或者还有用户的
-
- if(!empty($openid)){
- $wechat_template_id = $message['wechat_template_id'];
- $first = $message['wechat_first'] ?? '';
- $remark = $message['wechat_remark'] ?? '';
- if(!empty($first)) $message_data['first'] = $first;
- if(!empty($remark)) $message_data['remark'] = $remark;
-
- if(!empty($url)){
- //todo 拼装h5端的链接
-
- }
-
-
- //消息日志
- $log_data = array(
- 'key' => $message['key'],
- 'message_type' => MessageTypeEnum::WECHAT,
- 'uid' => $data['uid'] ?? 0,
- 'member_id' => $member_id,
- 'nickname' => $nickname ?? '',
- 'receiver' => $openid,
- 'params' => $message_data,
- 'content' => $message['wechat_json']
- );
-
- try{
- (new CoreWechatTemplateService())->send($site_id, $openid, $wechat_template_id, $message_data, $first, $remark);
- (new CoreMessageLogService())->add($site_id, $log_data);
- }catch(MessageException $e){
- $log_data['result'] = $e->getMessage();
- (new CoreMessageLogService())->add($site_id, $log_data);
- //这儿决定要不要抛出
- if($this->is_throw){
- throw new MessageException($e->getMessage());
- }
- }
-
- }
- }
- return true;
-
- }
- /**
- * 微信小程序订阅消息
- * @param $site_id
- * @param $mobile
- * @param $data
- * @param $message
- * @return void
- */
- public function weapp($site_id, $data, $message, $url = ''){
- //完全信任消息的设置, 不再依赖support_type
- if(!$message['is_weapp']) {
- $member_id = $data['member_id'] ?? 0;
- if($member_id > 0){//查询openid
- $info = (new CoreMemberService())->getInfoByMemberId($site_id, $member_id);
- $openid = $info['weapp_template_id'] ?? 0;
- $nickname = $info['nickname'] ?? '';
- }
- if(!empty($openid)) {
- $weapp_template_id = $message['weapp_template_id'];
-
- if(!empty($url)){
- //todo 拼装h5端的链接
-
- }
- $log_data = array(
- 'key' => $message['key'],
- 'message_type' => MessageTypeEnum::WEAPP,
- 'uid' => $data['uid'] ?? 0,
- 'member_id' => $member_id,
- 'nickname' => $nickname ?? '',
- 'receiver' => $openid,
- 'params' => $data,
- 'content' => $message['weapp_json']
- );
- try {
- (new CoreWeappTemplateService())->send($site_id, $weapp_template_id, $openid, $data, $url);
- (new CoreMessageLogService())->add($site_id, $log_data);
- } catch ( MessageException $e ) {
- $log_data['result'] = $e->getMessage();
- (new CoreMessageLogService())->add($site_id, $log_data);
- //这儿决定要不要抛出
- if ($this->is_throw) {
- throw new MessageException($e->getMessage());
- }
- }
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/niucloud/app/service/core/message/CoreMessageLogService.php b/niucloud/app/service/core/notice/CoreNoticeLogService.php
similarity index 66%
rename from niucloud/app/service/core/message/CoreMessageLogService.php
rename to niucloud/app/service/core/notice/CoreNoticeLogService.php
index 16c67f6c5..06cbb98b2 100644
--- a/niucloud/app/service/core/message/CoreMessageLogService.php
+++ b/niucloud/app/service/core/notice/CoreNoticeLogService.php
@@ -9,23 +9,23 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\message;
+namespace app\service\core\notice;
-use app\model\sys\SysMessageLog;
-use app\service\core\BaseCoreService;
+use app\model\sys\SysNoticeLog;
+use core\base\BaseCoreService;
/**
* 短信配置服务层
* Class SmsService
* @package app\service\admin\message
*/
-class CoreMessageLogService extends BaseCoreService
+class CoreNoticeLogService extends BaseCoreService
{
public function __construct()
{
parent::__construct();
- $this->model = new SysMessageLog();
+ $this->model = new SysNoticeLog();
}
/**
@@ -36,19 +36,19 @@ class CoreMessageLogService extends BaseCoreService
*/
public function add(int $site_id, array $data){
$data['site_id'] = $site_id;
- $message_log = $this->model->create($data);
- return $message_log?->id;
+ $notice_log = $this->model->create($data);
+ return $notice_log?->id;
}
public function getPage(int $site_id, array $where){
- $field = 'id, site_id, key, message_type, uid, member_id, nickname, receiver, is_click, is_visit, visit_time, create_time, params, content';
- $search_model = $this->model->where([['site_id', '=', $site_id]])->withSearch(['key','receiver', 'create_time'], $where)->field($field)->order('create_time desc')->append(['name', 'message_type_name']);
+ $field = 'id, site_id, key, notice_type, uid, member_id, nickname, receiver, is_click, is_visit, visit_time, create_time, params, content';
+ $search_model = $this->model->where([['site_id', '=', $site_id]])->withSearch(['key','receiver', 'create_time'], $where)->field($field)->order('create_time desc')->append(['name', 'notice_type_name']);
return $this->pageQuery($search_model);
}
public function getInfo(int $site_id, int $id){
- $field = 'id, site_id, key, message_type, uid, member_id, nickname, receiver, is_click, is_visit, visit_time, create_time, params, content';
- return $this->model->where([['site_id', '=', $site_id], ['id', '=', $id]])->field($field)->findOrEmpty()->append(['name', 'message_type_name'])->toArray();
+ $field = 'id, site_id, key, notice_type, uid, member_id, nickname, receiver, is_click, is_visit, visit_time, create_time, params, content';
+ return $this->model->where([['site_id', '=', $site_id], ['id', '=', $id]])->field($field)->findOrEmpty()->append(['name', 'notice_type_name'])->toArray();
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/core/message/CoreMessageService.php b/niucloud/app/service/core/notice/CoreNoticeService.php
similarity index 63%
rename from niucloud/app/service/core/message/CoreMessageService.php
rename to niucloud/app/service/core/notice/CoreNoticeService.php
index 0e8522117..a45ac7cea 100644
--- a/niucloud/app/service/core/message/CoreMessageService.php
+++ b/niucloud/app/service/core/notice/CoreNoticeService.php
@@ -9,13 +9,14 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\message;
+namespace app\service\core\notice;
-use app\enum\sys\MessageEnum;
-use app\model\sys\SysMessage;
-use app\service\core\BaseCoreService;
-use extend\exception\MessageException;
+use app\enum\notice\NoticeEnum;
+use app\job\notice\Message;
+use app\model\sys\SysNotice;
+use core\base\BaseCoreService;
+use core\exception\NoticeException;
/**
@@ -23,39 +24,15 @@ use extend\exception\MessageException;
* Class SmsService
* @package app\service\admin\message
*/
-class CoreMessageService extends BaseCoreService
+class CoreNoticeService extends BaseCoreService
{
public function __construct()
{
parent::__construct();
- $this->model = new SysMessage();
+ $this->model = new SysNotice();
}
- /**
- * 发送消息
- * @param $site_id
- * @param $key
- * @param $data
- * @param bool $is_delay 是否延时
- * @return bool
- */
- public function send($site_id, $key, $data, bool $is_delay = true, bool $is_throw = true){
-
-
- $message_data = array(
- 'site_id' => $site_id,
- 'key' => $key,
- );
- $message_data = array_merge($data, $message_data);
- if($is_delay){ //异步
- create_queue('message\message', $message_data);
- }else{
- (new CoreMessageEventService($is_throw))->event($message_data);
- }
-
- return true;
- }
/**
@@ -70,16 +47,16 @@ class CoreMessageService extends BaseCoreService
$list_key = array_column($list, 'key');
$list = array_combine($list_key, $list);
}
- $message = MessageEnum::getMessage();
- foreach ($message as $k => $v)
+ $notice = NoticeEnum::getNotice();
+ foreach ($notice as $k => $v)
{
if(!empty($keys) && !in_array($v['key'], $keys)){
- unset($message[$k]);
+ unset($notice[$k]);
continue;
}
if(array_key_exists($k, $list))
{
- $message[$k] = array_merge($v, $list[$k]);
+ $notice[$k] = array_merge($v, $list[$k]);
}else{
$data = [
'site_id' => $site_id,
@@ -93,11 +70,10 @@ class CoreMessageService extends BaseCoreService
'wechat_first' => '',
'wechat_remark' => ''
];
- $message[$k] = array_merge($v, $data);
-
+ $notice[$k] = array_merge($v, $data);
}
}
- return $message;
+ return $notice;
}
/**
@@ -106,11 +82,11 @@ class CoreMessageService extends BaseCoreService
*/
public function getInfo(int $site_id, string $key)
{
- if(!array_key_exists($key, MessageEnum::getMessage())) throw new MessageException(204001);
+ if(!array_key_exists($key, NoticeEnum::getNotice())) throw new NoticeException('NOTICE_TYPE_NOT_EXIST');
$info = $this->model->where([['site_id', '=', $site_id], ['key', '=', $key]])->findOrEmpty()->toArray();
if(!empty($info))
{
- $message = array_merge(MessageEnum::getMessage($key), $info);
+ $notice = array_merge(NoticeEnum::getNotice($key), $info);
}else{
$data = [
'site_id' => $site_id,
@@ -124,10 +100,10 @@ class CoreMessageService extends BaseCoreService
'wechat_first' => '',
'wechat_remark' => ''
];
- $message = array_merge(MessageEnum::getMessage($key), $data);
+ $notice = array_merge(NoticeEnum::getNotice($key), $data);
}
- return $message;
+ return $notice;
}
public function find(int $site_id, string $key)
@@ -142,21 +118,21 @@ class CoreMessageService extends BaseCoreService
* @param array $data
* @return bool
*/
- public function update(int $site_id, string $key, array $data)
+ public function edit(int $site_id, string $key, array $data)
{
- $message = $this->find($site_id, $key);
- if($message->isEmpty()){
- $message_template = MessageEnum::getMessage($key);
- $wechat_json = $message_template['wechat_json'] ?? [];
+ $notice = $this->find($site_id, $key);
+ if($notice->isEmpty()){
+ $notice_template = NoticeEnum::getNotice($key);
+ $wechat_json = $notice_template['wechat_json'] ?? [];
$this->model->create(array_merge([
'site_id' => $site_id,
'key' => $key,
- 'sms_content' => $message_template['sms_default_content'] ?? '',
+ 'sms_content' => $notice_template['sms_default_content'] ?? '',
'wechat_first' => $data['wechat_first'] ?? ($wechat_json['first'] ?? ''),
'wechat_remark' => $data['wechat_remark'] ?? ($wechat_json['remark'] ?? ''),
], $data));
}else{
- $message->save($data);
+ $notice->save($data);
}
return true;
diff --git a/niucloud/app/service/core/message/CoreMessageSmsLogService.php b/niucloud/app/service/core/notice/CoreNoticeSmsLogService.php
similarity index 90%
rename from niucloud/app/service/core/message/CoreMessageSmsLogService.php
rename to niucloud/app/service/core/notice/CoreNoticeSmsLogService.php
index 8f044e843..c3a7bc399 100644
--- a/niucloud/app/service/core/message/CoreMessageSmsLogService.php
+++ b/niucloud/app/service/core/notice/CoreNoticeSmsLogService.php
@@ -9,22 +9,22 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\message;
+namespace app\service\core\notice;
-use app\model\sys\SysMessageSmsLog;
-use app\service\core\BaseCoreService;
+use app\model\sys\SysNoticeSmsLog;
+use core\base\BaseCoreService;
/**
* 短信配置服务层
* Class SmsService
* @package app\service\admin\message
*/
-class CoreMessageSmsLogService extends BaseCoreService
+class CoreNoticeSmsLogService extends BaseCoreService
{
public function __construct()
{
parent::__construct();
- $this->model = new SysMessageSmsLog();
+ $this->model = new SysNoticeSmsLog();
}
/**
@@ -75,7 +75,7 @@ class CoreMessageSmsLogService extends BaseCoreService
* @param int $id
* @param array $data
*/
- public function update(int $site_id, int $id, array $data)
+ public function edit(int $site_id, int $id, array $data)
{
$data['update_time'] = time();
$this->model->where([['id', '=', $id], ['site_id', '=', $site_id]])->update($data);
diff --git a/niucloud/app/service/core/message/CoreSmsService.php b/niucloud/app/service/core/notice/CoreSmsService.php
similarity index 78%
rename from niucloud/app/service/core/message/CoreSmsService.php
rename to niucloud/app/service/core/notice/CoreSmsService.php
index add79f849..495bffb38 100644
--- a/niucloud/app/service/core/message/CoreSmsService.php
+++ b/niucloud/app/service/core/notice/CoreSmsService.php
@@ -9,13 +9,14 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\message;
+namespace app\service\core\notice;
use app\enum\sys\SmsEnum;
-use extend\driver\sms\SmsDriver;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
-use extend\exception\MessageException;
+use core\base\BaseCoreService;
+use core\sms\SmsDriver;
+use core\exception\NoticeException;
+use core\sms\SmsLoader;
/**
* 短信配置服务层
@@ -34,10 +35,10 @@ class CoreSmsService extends BaseCoreService
//查询配置
$config = $this->getDefaultSmsConfig($site_id);
$sms_type = $config['sms_type'];
- if(empty($sms_type)) throw new MessageException(204008);
+ if(empty($sms_type)) throw new NoticeException('SMS_TYPE_NOT_OPEN');
//创建
- $core_message_sms_log_service = new CoreMessageSmsLogService();
- $log_id = $core_message_sms_log_service->add($site_id, [
+ $core_notice_sms_log_service = new CoreNoticeSmsLogService();
+ $log_id = $core_notice_sms_log_service->add($site_id, [
'mobile' => $mobile,
'sms_type' => $sms_type,
'key' => $key,
@@ -46,24 +47,22 @@ class CoreSmsService extends BaseCoreService
'params' => $params,
'status' => SmsEnum::SENDING
]);
- $sms_driver = (new SmsDriver($config));
+
+ $sms_driver = new SmsLoader($sms_type, $config);
$params = $this->makeUp($params, $content, $sms_type);
- $result = $sms_driver->send($mobile, [
- 'params' => $params,
- 'template_id' => $template_id
- ]);
+ $result = $sms_driver->send($mobile, $template_id, $params);
if (!$result) {
//失败修改短信记录
$error = $sms_driver->getError();
- $core_message_sms_log_service->update($site_id, $log_id, [
+ $core_notice_sms_log_service->edit($site_id, $log_id, [
'status' => SmsEnum::FAIL,
'result' => $sms_driver->getError()
]);
- throw new MessageException($error);
+ throw new NoticeException($error);
}
//成功修改短信记录
- $core_message_sms_log_service->update($site_id, $log_id, [
+ $core_notice_sms_log_service->edit($site_id, $log_id, [
'status' => SmsEnum::SUCCESS,
'result' => $result
]);
@@ -95,7 +94,7 @@ class CoreSmsService extends BaseCoreService
{
$info = (new CoreConfigService())->getConfig($site_id, 'SMS')['value'] ?? [];
if (empty($info))
- throw new MessageException(204004);
+ throw new NoticeException('NO_SMS_DRIVER_OPEN');
$sms_type = $info['default'] ?? '';
$config = array(
diff --git a/niucloud/app/service/core/notice/NoticeService.php b/niucloud/app/service/core/notice/NoticeService.php
new file mode 100644
index 000000000..37bf9901c
--- /dev/null
+++ b/niucloud/app/service/core/notice/NoticeService.php
@@ -0,0 +1,53 @@
+model = new SysNotice();
+
+ }
+
+ /**
+ * 消息发送
+ * @param $site_id
+ * @param $key
+ * @param $data
+ * @return false|mixed
+ */
+ public static function send($site_id, $key, $data){
+
+ $template = (new CoreNoticeService())->getInfo($site_id, $key);
+ if(empty($template)) return false;
+
+ return Notice::invoke(['site_id' => $site_id, 'key' => $key, 'data' => $data, 'template' => $template], is_open:$template['async']);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/order/CoreOrderCreateService.php b/niucloud/app/service/core/order/CoreOrderCreateService.php
index 8273f3f5b..3301a17ea 100644
--- a/niucloud/app/service/core/order/CoreOrderCreateService.php
+++ b/niucloud/app/service/core/order/CoreOrderCreateService.php
@@ -14,9 +14,9 @@ namespace app\service\core\order;
use app\enum\pay\PayEnum;
use app\model\order\Order;
use app\model\order\OrderItem;
-use app\service\core\BaseCoreService;
use app\service\core\pay\CorePayService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
use think\facade\Cache;
use think\facade\Db;
diff --git a/niucloud/app/service/core/order/CoreOrderRefundService.php b/niucloud/app/service/core/order/CoreOrderRefundService.php
new file mode 100644
index 000000000..d8be9e490
--- /dev/null
+++ b/niucloud/app/service/core/order/CoreOrderRefundService.php
@@ -0,0 +1,89 @@
+model = new OrderItemRefund();
+ }
+
+ /**
+ * 退款创建
+ * @param array $data
+ */
+ public function create(array $data)
+ {
+ $refund_no = (new CoreRefundService())->create($data['site_id'], $data['out_trade_no'], $data['money'], $data['reason'] ?? '');
+
+ $create = $this->model->create([
+ 'order_item_id' => $data['order_item_id'],
+ 'order_id' => $data['order_id'],
+ 'site_id' => $data['site_id'],
+ 'member_id' => $data['member_id'],
+ 'num' => $data['num'],
+ 'money' => $data['money'],
+ 'refund_no' => $refund_no,
+ 'item_type' => $data['item_type'],
+ 'create_time' => time()
+ ]);
+
+ return [
+ 'refund_no' => $refund_no,
+ 'refund_id' => $create->refund_id
+ ];
+ }
+
+
+
+ /**
+ * 退款转账完成
+ * @param string $refund_no
+ * @return void
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public function refundComplete(string $refund_no) {
+ $model = $this->model->where([ ['refund_no', '=', $refund_no] ])->find();
+ if ($model->isEmpty()) throw new CommonException('ITEM_REFUND_NOT_EXIST');
+
+ Db::startTrans();
+ try {
+ event('refundComplete', $model->toArray());
+ Db::commit();
+ return true;
+ } catch(\Exception $e) {
+ Db::rollback();
+ throw new CommonException($e->getMessage());
+ }
+ }
+}
+
diff --git a/niucloud/app/service/core/order/CoreOrderService.php b/niucloud/app/service/core/order/CoreOrderService.php
new file mode 100644
index 000000000..d4feb639a
--- /dev/null
+++ b/niucloud/app/service/core/order/CoreOrderService.php
@@ -0,0 +1,50 @@
+model = new Order();
+ }
+
+ /**
+ * 获取订单信息
+ * @param int $site_id
+ * @param int $order_id
+ * @return Order|array|mixed|\think\Model
+ */
+ public function getOrderInfo(int $site_id, int $order_id){
+ return $this->model->where([
+ ['site_id', '=', $site_id],
+ ['order_id', '=', $order_id]
+ ])->field('*')->findOrEmpty()->toArray();
+ }
+
+}
+
diff --git a/niucloud/app/service/core/order/recharge/CoreRechargeOrderService.php b/niucloud/app/service/core/order/recharge/CoreRechargeOrderService.php
index 9fd092ad5..1926949bc 100644
--- a/niucloud/app/service/core/order/recharge/CoreRechargeOrderService.php
+++ b/niucloud/app/service/core/order/recharge/CoreRechargeOrderService.php
@@ -13,10 +13,10 @@ namespace app\service\core\order\recharge;
use app\enum\order\RechargeOrderEnum;
use app\model\order\Order;
-use app\service\core\BaseCoreService;
use app\service\core\member\CoreMemberAccountService;
use app\service\core\order\CoreOrderCreateService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
/**
* 充值订单流程
@@ -49,6 +49,7 @@ class CoreRechargeOrderService extends BaseCoreService
];
$order_items = [
[
+ 'site_id' => $data['site_id'],
'member_id' => $data['member_id'],
'item_id' => 0,
'item_type' => 'recharge', //项目类型 recharge, goods
@@ -74,10 +75,11 @@ class CoreRechargeOrderService extends BaseCoreService
$order_model = new Order();
$order_info = $order_model->where([['site_id', '=', $pay_info['site_id']], ['out_trade_no', '=', $pay_info['out_trade_no']]])->findOrEmpty()->toArray();
if (empty($order_info))
- throw new CommonException(800000);
+ throw new CommonException('ORDER_NOT_EXIST');
$order_data = [
'pay_time' => time(),
'order_status' => RechargeOrderEnum::FINISH,
+ 'is_enable_refund' => 1 // 是否允许退款
];
$order_model->where([['site_id', '=', $pay_info['site_id']], ['out_trade_no', '=', $pay_info['out_trade_no']]])->update($order_data);
//会员余额
@@ -89,6 +91,18 @@ class CoreRechargeOrderService extends BaseCoreService
}
}
+ /**
+ * 关闭订单
+ * @param $order_id
+ * @return void
+ */
+ public function close(int $site_id, int $order_id){
+ $order = (new Order())->where([ ['site_id', '=', $site_id ],['order_id', '=', $order_id ], ])->find();
+ if ($order->isEmpty()) throw new CommonException('ORDER_NOT_EXIST');
+ if ($order->order_status == RechargeOrderEnum::CLOSE) throw new CommonException('ORDER_CLOSED');
+ $order->save(['order_status' => RechargeOrderEnum::CLOSE]);
+ return true;
+ }
}
diff --git a/niucloud/app/service/core/order/recharge/CoreRechargeRefundService.php b/niucloud/app/service/core/order/recharge/CoreRechargeRefundService.php
new file mode 100644
index 000000000..a490379bb
--- /dev/null
+++ b/niucloud/app/service/core/order/recharge/CoreRechargeRefundService.php
@@ -0,0 +1,120 @@
+where([ ['site_id', '=', $site_id], ['order_id', '=', $order_id], ['item_type', '=', $this->order_type ] ])->with('ordermain')->find();
+ $order = $order_model->toArray();
+
+ if (empty($order)) throw new CommonException('ORDER_NOT_EXIST');
+ if (!$order['ordermain']['is_enable_refund'] || $order['ordermain']['order_status'] != RechargeOrderEnum::FINISH || $order['refund_status'] != RechargeOrderEnum::NOT_APPLAY) throw new CommonException('NOT_ALLOW_APPLY_REFUND');
+
+ // 查询会员账户余额
+ $member_info = (new Member())->where([
+ [ 'member_id', '=', $order['member_id'] ],
+ [ 'site_id', '=', $order['site_id'] ]
+ ])->field('balance')->find();
+
+ if ($member_info['balance'] == 0) throw new CommonException('NO_REFUNDABLE_AMOUNT');
+
+ $order['out_trade_no'] = $order['ordermain']['out_trade_no'];
+ $order['money'] = $order['item_money'] > $member_info['balance'] ? $member_info['balance'] : $order['item_money'];
+
+ $creat_res = (new CoreOrderRefundService())->create($order);
+
+ $order_model->save([
+ 'refund_no' => $creat_res['refund_no'],
+ 'refund_status' => RechargeOrderEnum::REFUNDING
+ ]);
+ $order_model->ordermain->save([
+ 'refund_status' => RechargeOrderEnum::REFUNDING
+ ]);
+
+ (new OrderItemRefund())->update(['status' => RechargeOrderEnum::REFUNDING], [ ['refund_no', '=', $creat_res['refund_no'] ] ]);
+
+ // 执行退款
+ $this->refund($order, $creat_res['refund_no']);
+
+ Db::commit();
+
+ return true;
+ } catch (\Exception $e) {
+ Db::rollback();
+ throw new CommonException($e->getMessage());
+ }
+ }
+
+ /**
+ * 退款
+ * @param array $order
+ * @param string $refund_no
+ * @return void
+ */
+ public function refund(array $order, string $refund_no){
+ (new CoreMemberAccountService())->addLog($order['site_id'], $order['member_id'], 'balance', -$order['money'], 'recharge_refund', '充值订单退款', $order['order_id']);
+ // 调用支付退款
+// (new CoreRefundService())->refund($order['site_id'], $refund_no);
+ }
+
+ /**
+ * 退款完成
+ * @return void
+ */
+ public function refundComplete($refund_no){
+ $model = (new OrderItemRefund())->where([ ['refund_no', '=', $refund_no ] ])->find();
+ if ($model->isEmpty()) throw new CommonException('ORDER_NOT_EXIST');
+ if ($model->status != RechargeOrderEnum::REFUNDING) throw new CommonException('REFUND_STATUS_ABNORMAL');
+
+ Db::startTrans();
+ try {
+ $model->save(['status' => RechargeOrderEnum::REFUND_COMPLETED]);
+ $model->item()->save([ 'refund_status' => RechargeOrderEnum::REFUND_COMPLETED ]);
+ (new Order())->update(['refund_status' => RechargeOrderEnum::REFUND_COMPLETED], [ ['order_id', '=', $model->order_id ] ]);
+ (new CoreRechargeOrderService())->close($model->site_id, $model->order_id);
+ Db::commit();
+ return true;
+ } catch (\Exception $e) {
+ Db::rollback();
+ throw new CommonException($e->getMessage());
+ }
+ }
+}
+
diff --git a/niucloud/app/service/core/pay/CorePayChannelService.php b/niucloud/app/service/core/pay/CorePayChannelService.php
new file mode 100644
index 000000000..a7c6507c2
--- /dev/null
+++ b/niucloud/app/service/core/pay/CorePayChannelService.php
@@ -0,0 +1,79 @@
+model = new PayChannel();
+
+ }
+
+ /**
+ * 查询实例
+ * @param array $where
+ * @return PayChannel|array|mixed|Model
+ */
+ public function find(int $site_id, array $where){
+ $where['site_id'] = $site_id;
+ return $this->model->where($where)->findOrEmpty();
+ }
+ /**
+ * 通过渠道获取支持的支付方式(专属用于支付业务)
+ * @param int $site_id
+ * @param string $channel
+ * @param array $pay_type_list 外部业务支付类型限制
+ * @return array
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public function getAllowPayTypeByCahnnel(int $site_id, string $channel, array $pay_type_limit_list = []){
+ $channel_pay_list = $this->model->where([['site_id', '=', $site_id], ['channel', '=', $channel], ['status', '=', 1]])->field('type')->order('sort asc')->select()->toArray();
+ if(!empty($channel_pay_list)){
+ $temp_channel_pay_list = array_column($channel_pay_list, 'type');
+ if($pay_type_limit_list) $temp_channel_pay_list = array_intersect($temp_channel_pay_list, $pay_type_limit_list);
+ $pay_type_list = PayEnum::getPayType($temp_channel_pay_list);
+ $allow_pay_type_list = [];
+ foreach($channel_pay_list as $v){
+ $allow_pay_type_list[] = $pay_type_list[$v['type']];
+ }
+ }
+ return $allow_pay_type ?? [];
+
+ }
+
+ /**
+ * 通过渠道和支付方式获取支付配置
+ * @param int $site_id
+ * @param string $channel
+ * @param string $type
+ * @return array|mixed
+ */
+ public function getConfigByChannelAndType(int $site_id, string $channel, string $type){
+ $pay_channel = $this->model->where([['site_id', '=', $site_id], ['channel', '=', $channel], ['type', '=', $type]])->field('config')->findOrEmpty();
+ if(!$pay_channel->isEmpty()) return $pay_channel->config;
+ return [];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/pay/CorePayConfigService.php b/niucloud/app/service/core/pay/CorePayConfigService.php
index e6e8b45f6..190bc23c5 100644
--- a/niucloud/app/service/core/pay/CorePayConfigService.php
+++ b/niucloud/app/service/core/pay/CorePayConfigService.php
@@ -14,11 +14,11 @@ namespace app\service\core\pay;
use app\enum\pay\PayEnum;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
use app\service\core\weapp\CoreWeappConfigService;
use app\service\core\wechat\CoreWechatConfigService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
use think\Model;
@@ -166,7 +166,7 @@ class CorePayConfigService extends BaseCoreService
break;
}
if($config['status'] != PayEnum::ON)
- throw new CommonException(700005);
+ throw new CommonException('PAYMENT_METHOD_NOT_EXIST');
return $config;
}
diff --git a/niucloud/app/service/core/pay/CorePayEventService.php b/niucloud/app/service/core/pay/CorePayEventService.php
index dbb73f191..d15de8d56 100644
--- a/niucloud/app/service/core/pay/CorePayEventService.php
+++ b/niucloud/app/service/core/pay/CorePayEventService.php
@@ -14,9 +14,10 @@ namespace app\service\core\pay;
use app\enum\common\ChannelEnum;
use app\enum\pay\PayEnum;
use app\enum\pay\TransferEnum;
-use app\service\core\BaseCoreService;
-use extend\driver\pay\PayDriver;
-use extend\exception\PayException;
+use core\base\BaseCoreService;
+use core\exception\PayException;
+use core\pay\PayDriver;
+use core\pay\PayLoader;
use Yansongda\Supports\Collection;
/**
@@ -27,87 +28,111 @@ use Yansongda\Supports\Collection;
class CorePayEventService extends BaseCoreService
{
+ private $site_id;//站点id
+ private $config;//支付配置
+ private $type;//支付类型
+ private $channel;//支付渠道 (特殊点,转账也算是一种)
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+
+ /**
+ * 支付引擎外置触点初始化
+ * @param int $site_id
+ * @param string $channel
+ * @param string $type
+ * @return $this
+ */
+ public function init(int $site_id, string $channel = '', string $type = ''){
+ $this->site_id = $site_id;
+ $this->channel = $channel;
+ $this->type = $type;
+ $this->config = (new CorePayChannelService())->getConfigByChannelAndType($this->site_id, $this->channel, $this->type);
+ return $this;
+ }
/**
* 获取实例化应用
* @param $site_id
- * @return PayDriver
+ * @return \core\pay\PayDriver
*/
- public function app(int $site_id, string $type, string $action = '')
+ public function app(string $action = 'query')
{
- $notify_url = (string)url("/api/pay/notify/$type/$site_id/$action", [], '', true);//异步回调通知地址
- $config = (new CorePayConfigService)->getPayConfigByType($site_id, $type);
- $config['notify_url'] = $notify_url;
- return new PayDriver($config, $type);
-
+ $notify_url = (string)url("/api/pay/notify/$this->site_id/$this->channel/$this->type/$action", [], '', true);//异步回调通知地址
+ $this->config['notify_url'] = $notify_url;
+ return new PayLoader($this->type, $this->config);
}
+
/**
* 去支付
- * @param $site_id
- * @param $type
* @param $out_trade_no
* @param $money
* @param $boby
- * @param $channel
* @param $refund_url
* @param $quit_url
* @param $buyer_id
* @return mixed
*/
- public function pay(int $site_id, string $type, string $out_trade_no, float $money, string $boby, string $channel, string $refund_url = '', string $quit_url = '', string $buyer_id = '', string $openid = '')
+ public function pay(string $out_trade_no, float $money, string $boby, string $refund_url = '', string $quit_url = '', string $buyer_id = '', string $openid = '')
{
- $pay_scene = '';
+ $pay_fun = '';
$params = array(
'out_trade_no' => $out_trade_no,
'money' => $money,
'boby' => $boby,
- 'channel' => $channel,
+ 'channel' => $this->channel,
'refund_url' => $refund_url,
'quit_url' => $quit_url,
'buyer_id' => $buyer_id,
'openid' => $openid
);
- switch($type){
+ switch($this->type){
case PayEnum::WECHATPAY:
$params['money'] = $params['money'] * 100;
- switch ($channel) {
+ switch ($this->channel) {
case ChannelEnum::H5://h5
- $pay_scene = 'wap';
+ $pay_fun = 'wap';
break;
case ChannelEnum::WECHAT://公众号
- $pay_scene = 'mp';
+ $pay_fun = 'mp';
break;
case ChannelEnum::WEAPP://微信小程序
- $pay_scene = 'mini';
+ $pay_fun = 'mini';
break;
case ChannelEnum::PC://pc
- $pay_scene = 'scan';//扫码支付
+ $pay_fun = 'scan';//扫码支付
break;
- case ChannelEnum::APP://pc
- $pay_scene = 'app';
+ case ChannelEnum::APP://app
+ $pay_fun = 'app';
break;
}
break;
case PayEnum::ALIPAY:
- switch ($channel) {
+ switch ($this->channel) {
case ChannelEnum::H5://h5
- $pay_scene = 'wap';
+ $pay_fun = 'wap';
break;
case ChannelEnum::PC://pc
- $pay_scene = 'web';
+ $pay_fun = 'web';
break;
- case ChannelEnum::APP://pc
- $pay_scene = 'app';
+ case ChannelEnum::APP://app
+ $pay_fun = 'app';
+ break;
+ case ChannelEnum::WECHAT://wap
+ $pay_fun = 'wap';
break;
}
}
- if(empty($pay_scene)) throw new PayException(700006);
- return $this->app($site_id, $type, 'pay')->$pay_scene($params);
+ if(empty($pay_fun)) throw new PayException('PAYMENT_METHOD_NOT_SCENE');
+ return $this->app('pay')->$pay_fun($params);
}
@@ -122,9 +147,9 @@ class CorePayEventService extends BaseCoreService
* @param $to_name
* @return mixed|Collection
*/
- public function transfer(int $site_id, string $type, float $money, string $transfer_no,string $to_no, string $to_name, string $remark, array $transfer_list = [], string $to_type = '', string $product_code = '', string $scene = '')
+ public function transfer(float $money, string $transfer_no,string $to_no, string $to_name, string $remark, array $transfer_list = [], string $to_type = '', string $product_code = '', string $scene = '')
{
- $transfer_type = TransferEnum::getPayTypeByTransfer($type);
+ $transfer_type = TransferEnum::getPayTypeByTransfer($this->type);
switch($transfer_type){
case PayEnum::WECHATPAY:
$money = $money * 100;
@@ -132,7 +157,7 @@ class CorePayEventService extends BaseCoreService
case PayEnum::ALIPAY:
}
- return $this->app($site_id, $transfer_type)->transfer([
+ return $this->app('transfer')->transfer([
'transfer_no' => $transfer_no,
'money' => $money,
'product_code' => $product_code,
@@ -147,14 +172,12 @@ class CorePayEventService extends BaseCoreService
/**
* 关闭支付
- * @param int $site_id
- * @param string $type
* @param string $out_trade_no
* @return null
*/
- public function close(int $site_id, string $type, string $out_trade_no)
+ public function close(string $out_trade_no)
{
- return $this->app($site_id, $type)->close($out_trade_no);
+ return $this->app('close')->close($out_trade_no);
}
/**
@@ -164,57 +187,54 @@ class CorePayEventService extends BaseCoreService
* @param $money
* @return void
*/
- public function refund(int $site_id, string $type, string $out_trade_no, float $money)
+ public function refund(string $out_trade_no, float $money, float $total, string $refund_no)
{
- return $this->app($site_id, $type, 'refund')->refund($out_trade_no, $money);
+ return $this->app('refund')->refund([
+ 'out_trade_no' => $out_trade_no,
+ 'out_trade_no' => $money,
+ 'out_trade_no' => $total,
+ 'out_trade_no' => $refund_no
+ ]);
}
/**
* 支付异步通知
- * @param $site_id
- * @param $type
* @return void
*/
- public function notify(int $site_id, string $type, Callable $callback)
+ public function notify(Callable $callback)
{
- return $this->app($site_id, $type)->notify($callback);
+ return $this->app()->notify($callback);
}
/**
* 查询普通支付订单
- * @param $site_id
- * @param $type
* @param $out_trade_no
* @return null
*/
- public function getOrder(int $site_id, string $type, string $out_trade_no)
+ public function getOrder(string $out_trade_no)
{
- return $this->app($site_id, $type, __FUNCTION__)->getOrder($out_trade_no);
+ return $this->app()->getOrder(['out_trade_no' => $out_trade_no]);
}
/**
* 查询退款订单
- * @param $site_id
- * @param $type
* @param $out_trade_no
* @param $refund_no
* @return null
*/
- public function getRefund(int $site_id, string $type, string $out_trade_no, string $refund_no)
+ public function getRefund(string $out_trade_no, string $refund_no)
{
- return $this->app($site_id, $type)->getRefund($out_trade_no, $refund_no);
+ return $this->app()->getRefund($out_trade_no, $refund_no);
}
/**
* 查询转账订单
- * @param $site_id
- * @param $type
* @param $transfer_no
* @return null
*/
- public function getTransfer(int $site_id, string $type, string $transfer_no)
+ public function getTransfer(string $transfer_no)
{
- return $this->app($site_id, $type)->getTransfer($transfer_no);
+ return $this->app()->getTransfer($transfer_no);
}
diff --git a/niucloud/app/service/core/pay/CorePayService.php b/niucloud/app/service/core/pay/CorePayService.php
index bd48a9ddf..96e4b52fc 100644
--- a/niucloud/app/service/core/pay/CorePayService.php
+++ b/niucloud/app/service/core/pay/CorePayService.php
@@ -11,17 +11,15 @@
namespace app\service\core\pay;
-use app\enum\common\ChannelEnum;
use app\enum\order\OrderTypeEnum;
use app\enum\pay\OnlinePayEnum;
use app\enum\pay\PayEnum;
use app\job\pay\PayReturnTo;
use app\model\pay\Pay;
-use app\service\core\BaseCoreService;
-use app\service\core\member\CoreMemberService;
-use extend\exception\PayException;
-use think\facade\Log;
+use core\base\BaseCoreService;
+use core\exception\PayException;
use think\facade\Db;
+use think\facade\Log;
/**
* 支付服务层
@@ -90,7 +88,7 @@ class CorePayService extends BaseCoreService
$pay = $this->model->where($where)->append(['pay_type_list', 'type_name', 'status_name'])->findOrEmpty()->toArray();
if(!empty($pay)){
//todo 校验场景控制支付方式
- $pay['pay_type_list'] = array_values((new CorePayConfigService())->getPayList($site_id, array_intersect(ChannelEnum::getAllowPayType($channel), $pay['pay_type_list'])));
+ $pay['pay_type_list'] = array_values((new CorePayChannelService())->getAllowPayTypeByCahnnel($site_id, $channel, $pay['pay_type_list']));
}
return $pay;
}
@@ -106,28 +104,28 @@ class CorePayService extends BaseCoreService
*/
public function pay($site_id, $out_trade_no, $type, $channel, string $openid, string $return_url = '', string $quit_url = '', string $buyer_id = ''){
$pay = $this->findPayInfoByOutTradeNo($site_id, $out_trade_no);
- if($pay->isEmpty()) throw new PayException(700000);
- if($pay['status'] == PayEnum::STATUS_ING) throw new PayException(700002);
- if($pay['status'] == PayEnum::STATUS_ED) throw new PayException(700003);
- if($pay['status'] == PayEnum::STATUS_CALCLE) throw new PayException(700004);
+ if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');
+ if($pay['status'] == PayEnum::STATUS_ING) throw new PayException('PAYMENT_LOCK');
+ if($pay['status'] == PayEnum::STATUS_ED) throw new PayException('PAY_SUCCESS');
+ if($pay['status'] == PayEnum::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');
$money = $pay['money'];
$body = $pay['body'];
$trade_type = $pay['trade_type'];
$allow_type = OrderTypeEnum::getAllowPayType($trade_type);//当前支付允许使用的支付方式
if(!in_array($type, $allow_type)){
- throw new PayException(700001);//业务不支持
+ throw new PayException('PAYMENT_METHOD_NOT_SUPPORT');//业务不支持
}
- if(!in_array($type, ChannelEnum::getAllowPayType($channel))) throw new PayException(700006);//场景不支持
-
- $pay_result = $this->pay_event->pay($site_id, $type, $out_trade_no, $money, $body, $channel, $return_url, $quit_url, $buyer_id, $openid ?? '');
- //将支付设置为支付中
+ if(!in_array($type, array_keys((new CorePayChannelService())->getAllowPayTypeByCahnnel($site_id, $channel)))) throw new PayException('PAYMENT_METHOD_NOT_SCENE');//场景不支持
+ $pay_result = $this->pay_event->init($site_id, $channel, $type)->pay($out_trade_no, $money, $body, $return_url, $quit_url, $buyer_id, $openid ?? '');
+// 将支付设置为支付中
$pay->save(
[
'type' => $type,
- 'status' => PayEnum::STATUS_ING
+ 'status' => PayEnum::STATUS_ING,
+ 'channel' => $channel
]
);
- create_queue(PayReturnTo::class, ['site_id' => $site_id, 'out_trade_no' => $out_trade_no], 15);
+ PayReturnTo::invoke(['site_id' => $site_id, 'out_trade_no' => $out_trade_no], secs:15);
return $pay_result;
}
@@ -156,7 +154,8 @@ class CorePayService extends BaseCoreService
if($close){
$data = array(
'status' => PayEnum::STATUS_WAIT,
- 'type' => ''
+ 'type' => '',
+ 'channel' => ''
);
$pay->save($data);
}
@@ -172,13 +171,14 @@ class CorePayService extends BaseCoreService
*/
public function close(int $site_id, string $out_trade_no){
$pay = $this->findPayInfoByOutTradeNo($site_id, $out_trade_no);
- if($pay->isEmpty()) throw new PayException(700000);
- if($pay['status'] != PayEnum::STATUS_ING) throw new PayException(700007);
- if(empty($pay->type)) throw new PayException(700007);
+ if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');
+ if($pay['status'] != PayEnum::STATUS_ING) throw new PayException('TREAT_PAYMENT_IS_OPEN');
+ if(empty($pay->type)) throw new PayException('TREAT_PAYMENT_IS_OPEN');
//尝试取消或关闭第三方支付
- $close = $this->pay_event->close($site_id, $pay->type, $out_trade_no);
+
+ $close = $this->pay_event->init($site_id, $pay->channel, $pay->type)->close($out_trade_no);
if(!$close){//有问题查询第三方订单详情
- $order = $this->pay_event->getOrder($site_id, $pay->type, $out_trade_no);
+ $order = $this->pay_event->init($site_id, $pay->channel, $pay->type)->getOrder($out_trade_no);
if(empty($order))
return true;
if(!empty($order) && $order['status'] == OnlinePayEnum::SUCCESS){//如果已支付,就将支付调整为已支付
@@ -206,7 +206,7 @@ class CorePayService extends BaseCoreService
'out_trade_no' => $out_trade_no
);
$this->model->create($data);
- return $out_trade_no;
+ return $refund_no;
}
public function refund($site_id, $refund_no){
@@ -223,9 +223,9 @@ class CorePayService extends BaseCoreService
public function finish(int $site_id, $out_trade_no, string $type, array $params = []){
$pay = $this->findPayInfoByOutTradeNo($site_id, $out_trade_no);
- if($pay->isEmpty()) throw new PayException(700000);
- if($pay['status'] == PayEnum::STATUS_ED) throw new PayException(700003);
- if($pay['status'] == PayEnum::STATUS_CALCLE) throw new PayException(700004);
+ if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');
+ if($pay['status'] == PayEnum::STATUS_ED) throw new PayException('PAY_SUCCESS');
+ if($pay['status'] == PayEnum::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');
$trade_type = $pay->trade_type;
$data = array(
'pay_time' => time(),
@@ -264,7 +264,7 @@ class CorePayService extends BaseCoreService
* @param string $type
* @return null
*/
- public function notify(int $site_id, string $type, string $action){
+ public function notify(int $site_id, string $channel, string $type, string $action){
Log::write('pay__'.$site_id.'_'.$type.'_'.$action);
$callback = function($out_trade_no, $params) use($site_id,$type, $action){
try {
@@ -282,7 +282,7 @@ class CorePayService extends BaseCoreService
return false;
}
};
- return $this->pay_event->notify($site_id, $type, $callback);
+ return $this->pay_event->init($site_id, $channel, $type)->init($site_id, $channel, $type)->notify($callback);
// return true;
}
@@ -296,13 +296,13 @@ class CorePayService extends BaseCoreService
*/
public function cancel(int $site_id, string $out_trade_no){
$pay = $this->findPayInfoByOutTradeNo($site_id, $out_trade_no);
- if($pay->isEmpty()) throw new PayException(700000);
- if($pay['status'] == PayEnum::STATUS_ED) throw new PayException(700003);//已支付不能取消
- if($pay['status'] == PayEnum::STATUS_CALCLE) throw new PayException(700004);//已取消不能重复取消
+ if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');
+ if($pay['status'] == PayEnum::STATUS_ED) throw new PayException('PAY_SUCCESS');//已支付不能取消
+ if($pay['status'] == PayEnum::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');//已取消不能重复取消
$type = $pay->type;
if($pay['status'] == PayEnum::STATUS_ING){
//尝试关闭相关支付
- $result = $this->pay_event->close($site_id, $type, $out_trade_no);
+ $result = $this->pay_event->init($site_id, $pay->channel, $type)->close($out_trade_no);
if($result){
}else{//根据返回值来进行下一步操作 支付已完成就将支付完成
@@ -314,14 +314,14 @@ class CorePayService extends BaseCoreService
public function reset(int $site_id, string $out_trade_no, float $money){
$pay = $this->findPayInfoByOutTradeNo($site_id, $out_trade_no);
- if($pay->isEmpty()) throw new PayException(700000);
+ if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');
if(!in_array($pay['status'], [
PayEnum::STATUS_WAIT,
PayEnum::STATUS_ING
- ])) throw new PayException(700011);//只有待支付可以重置支付
+ ])) throw new PayException('IS_PAY_REMOVE_NOT_RESETTING');//只有待支付可以重置支付
if($pay['status'] == PayEnum::STATUS_ING){
if(!$this->returnTo($site_id, $pay)){
- throw new PayException(700012);
+ throw new PayException('DOCUMENT_IS_PAY_REMOVE');
}
}
$out_trade_no = create_no('pay', $pay['main_id']);
diff --git a/niucloud/app/service/core/pay/CoreRefundService.php b/niucloud/app/service/core/pay/CoreRefundService.php
new file mode 100644
index 000000000..2ed3aa873
--- /dev/null
+++ b/niucloud/app/service/core/pay/CoreRefundService.php
@@ -0,0 +1,98 @@
+model = new Refund();
+ $this->pay_event = new CorePayEventService();
+ }
+
+ /**
+ * 创建支付单据
+ * @param $site_id
+ * @param string $out_trade_no
+ * @param float $money
+ * @return string|null
+ */
+ public function create(int $site_id, string $out_trade_no, float $money, string $reason = ''){
+ //通过交易流水号获取支付单据
+ $pay = (new CorePayService())->findPayInfoByOutTradeNo($site_id, $out_trade_no);
+ if($pay->isEmpty()) throw new PayException();//单据不存在
+ //校验当前数据是否存在
+ //存在就修改,不存在就创建
+ $refund_no = create_no('refund', $pay->id);
+ $data = array(
+ 'site_id' => $site_id,
+ 'money' => $money,
+ 'type' => $pay->type,//支付方式
+ 'channel' => $pay->channel,//渠道
+ 'out_trade_no' => $out_trade_no,
+ 'refund_no' => $refund_no,
+ 'status' => 0,
+ 'reason' => $reason
+ );
+ $this->model->create($data);
+ return $refund_no;
+ }
+
+ /**
+ * 退款
+ * @param int $site_id
+ * @param string $out_trade_no
+ * @param float $money
+ * @return void
+ */
+ public function refund(int $site_id, string $refund_no){
+ $refund = $this->findByRefundNo($site_id, $refund_no);
+ if($refund->isEmpty()) throw new PayException();
+ $out_trade_no = $refund->out_trade_no;
+ $money = $refund->money;
+ $this->pay_event->init($site_id, $refund->channel, $refund->type)->refund($out_trade_no, $money, $refund_no);
+
+ //判断成功的话,可以直接调用退款成功
+ }
+
+ /**
+ * 获取退款单据
+ * @param int $site_id
+ * @param string $refund_no
+ * @return void
+ */
+ public function findByRefundNo(int $site_id, string $refund_no){
+ return $this->model->where([
+ ['site_id', '=', $site_id],
+ ['refund_no', '=', $refund_no],
+ ])->findOrEmpty();
+ }
+
+ /**
+ * 退款完成
+ * @return void
+ */
+ public function refundSuccess(){
+
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/pay/CoreTransferService.php b/niucloud/app/service/core/pay/CoreTransferService.php
index 2486aea2d..b62ae1cc0 100644
--- a/niucloud/app/service/core/pay/CoreTransferService.php
+++ b/niucloud/app/service/core/pay/CoreTransferService.php
@@ -11,18 +11,11 @@
namespace app\service\core\pay;
-use app\enum\common\ChannelEnum;
-use app\enum\order\OrderTypeEnum;
-use app\enum\pay\OnlinePayEnum;
-use app\enum\pay\PayEnum;
use app\enum\pay\TransferEnum;
-use app\job\pay\PayReturnTo;
use app\model\pay\Pay;
use app\model\pay\Transfer;
-use app\service\core\BaseCoreService;
-use app\service\core\member\CoreMemberService;
-use extend\exception\PayException;
-use think\facade\Log;
+use core\base\BaseCoreService;
+use core\exception\PayException;
use think\facade\Db;
/**
@@ -59,14 +52,10 @@ class CoreTransferService extends BaseCoreService
'transfer_no' => $transfer_no,
'main_id' => $main_id,
'main_type' => $main_type,
-
'transfer_status' => TransferEnum::WAIT,
-
'remark' => $remark,
);
$this->model->create($transfer_data);
-
-
return $transfer_no;
}
@@ -81,8 +70,8 @@ class CoreTransferService extends BaseCoreService
public function transfer(int $site_id, string $transfer_no, string $transfer_type, array $data){
$transfer = $this->findTransferByTransferNo($site_id, $transfer_no);
- if($transfer->isEmpty()) throw new PayException(700009);
- if(!in_array($transfer['transfer_status'], [TransferEnum::WAIT, TransferEnum::FAIL])) throw new PayException(700008);
+ if($transfer->isEmpty()) throw new PayException('TRANSFER_ORDER_INVALID');
+ if(!in_array($transfer['transfer_status'], [TransferEnum::WAIT, TransferEnum::FAIL])) throw new PayException('TRANFER_STATUS_NOT_IN_WAIT_TANSFER');
$transfer_account = $data['transfer_account'] ?? '';
$transfer_realname = $data['transfer_realname'] ?? '';
@@ -94,7 +83,8 @@ class CoreTransferService extends BaseCoreService
'transfer_bank' => $data['transfer_bank'] ?? '',//转账银行
'transfer_account' => $transfer_account,//转账账号
'openid' => $data['openid'] ?? '',
-
+ 'transfer_voucher' => $data['transfer_voucher'] ?? '',
+ 'transfer_remark' => $data['transfer_remark'] ?? '',
);
$transfer->save($transfer_data);
@@ -106,7 +96,7 @@ class CoreTransferService extends BaseCoreService
$params = [];
if(TransferEnum::getTransferType()[$transfer_type]['is_online']){
try {
- $result = $this->pay_event->transfer($site_id, $transfer_type, $transfer['money'], $transfer_no, $transfer_account, $transfer_realname, $transfer['remark']);
+ $result = $this->pay_event->init($site_id, 'transfer', $transfer_type)->transfer($transfer['money'], $transfer_no, $transfer_account, $transfer_realname, $transfer['remark']);
$params['batch_id'] = $result['batch_id'];
$params['out_batch_no'] = $result['out_batch_no'];
}catch(\Throwable $e){
@@ -144,8 +134,8 @@ class CoreTransferService extends BaseCoreService
public function success(int $site_id, string $transfer_no, string $transfer_type, array $params = []){
$transfer = $this->findTransferByTransferNo($site_id, $transfer_no);
- if($transfer->isEmpty()) throw new PayException(700009);
- if(!in_array($transfer['transfer_status'], [TransferEnum::WAIT, TransferEnum::FAIL])) throw new PayException(700008);
+ if($transfer->isEmpty()) throw new PayException('TRANSFER_ORDER_INVALID');
+ if(!in_array($transfer['transfer_status'], [TransferEnum::WAIT, TransferEnum::FAIL])) throw new PayException('TRANFER_STATUS_NOT_IN_WAIT_TANSFER');
$trade_type = $transfer->trade_type;
$data = array(
@@ -185,8 +175,8 @@ class CoreTransferService extends BaseCoreService
public function fail(int $site_id, string $transfer_no, string $transfer_type, array $params = []){
$transfer = $this->findTransferByTransferNo($site_id, $transfer_no);
- if($transfer->isEmpty()) throw new PayException(700009);
- if(!in_array($transfer['transfer_status'], [TransferEnum::WAIT, TransferEnum::FAIL])) throw new PayException(700008);
+ if($transfer->isEmpty()) throw new PayException('TRANSFER_ORDER_INVALID');
+ if(!in_array($transfer['transfer_status'], [TransferEnum::WAIT, TransferEnum::FAIL])) throw new PayException('TRANFER_STATUS_NOT_IN_WAIT_TANSFER');
$data = array(
'transfer_time' => time(),
'transfer_status' => TransferEnum::FAIL,
diff --git a/niucloud/app/service/core/paytype/CoreBalanceService.php b/niucloud/app/service/core/paytype/CoreBalanceService.php
new file mode 100644
index 000000000..61336d1ec
--- /dev/null
+++ b/niucloud/app/service/core/paytype/CoreBalanceService.php
@@ -0,0 +1,54 @@
+
+ //业务主体id
+ //查询一下余额是否足够
+ //生成账户变动记录,
+// if($member_id > 0){
+//
+// }
+ //可能会锁定一部分余额
+
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/scan/CoreScanService.php b/niucloud/app/service/core/scan/CoreScanService.php
index d9db0f0bd..5ce22ea1d 100644
--- a/niucloud/app/service/core/scan/CoreScanService.php
+++ b/niucloud/app/service/core/scan/CoreScanService.php
@@ -11,22 +11,9 @@
namespace app\service\core\scan;
-use app\enum\member\MemberLoginTypeEnum;
use app\enum\scan\ScanEnum;
-use app\enum\sys\AppTypeEnum;
-use app\enum\sys\SmsEnum;
-use app\model\member\Member;
-use app\service\api\BaseApiService;
-use app\service\api\captcha\CaptchaService;
-use app\service\api\member\MemberConfigService;
-use app\service\api\member\MemberService;
-use app\service\api\message\MessageService;
-use app\service\core\BaseCoreService;
-use Exception;
-use extend\exception\ApiException;
-use extend\exception\AuthException;
-use extend\exception\CommonException;
-use extend\util\TokenUtil;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
use think\facade\Cache;
use think\facade\Log;
@@ -90,7 +77,7 @@ class CoreScanService extends BaseCoreService
public function checkScan(int $site_id, string $key){
$cache_name = self::$cache_name.$key;
$cache = Cache::get($cache_name);
- if(empty($cache)) throw new CommonException(301021);
+ if(empty($cache)) throw new CommonException('QRCODE_EXPIRE');
return $cache;
}
diff --git a/niucloud/app/service/core/site/CoreSiteService.php b/niucloud/app/service/core/site/CoreSiteService.php
new file mode 100644
index 000000000..b852583f7
--- /dev/null
+++ b/niucloud/app/service/core/site/CoreSiteService.php
@@ -0,0 +1,53 @@
+model = new Site();
+ }
+
+
+
+ /**
+ * 获取授权当前站点信息(用做缓存)
+ * @return mixed
+ */
+ public function getSiteCache(int $site_id){
+ $cache_name = 'site_info_cache';
+ return Cache::tag(self::$cache_tag_name.$site_id)->remember($cache_name.$site_id, function () use ($site_id) {
+ $where = [
+ ['site_id', '=', $site_id],
+ ];
+ $site = $this->model->where($where)->field('app_type,site_name,logo,group_id, status, expire_time')->findOrEmpty();
+ if(!$site->isEmpty()){
+ $site->append(['status_name']);
+ }
+ return $site->toArray();
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/service/core/sys/CoreAgreementService.php b/niucloud/app/service/core/sys/CoreAgreementService.php
index d1560897d..7e0bc9206 100644
--- a/niucloud/app/service/core/sys/CoreAgreementService.php
+++ b/niucloud/app/service/core/sys/CoreAgreementService.php
@@ -13,8 +13,8 @@ namespace app\service\core\sys;
use app\enum\sys\AgreementEnum;
use app\model\sys\SysAgreement;
-use app\service\core\BaseCoreService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
/**
* 配置服务层
@@ -37,7 +37,7 @@ class CoreAgreementService extends BaseCoreService
*/
public function getAgreement(int $site_id, string $key)
{
- if(!array_key_exists($key, AgreementEnum::getType())) throw new CommonException(100017);
+ if(!array_key_exists($key, AgreementEnum::getType())) throw new CommonException('AGREEMENT_TYPE_NOT_EXIST');
$where = array(
['agreement_key', '=', $key],
['site_id', '=', $site_id]
@@ -60,7 +60,7 @@ class CoreAgreementService extends BaseCoreService
public function find(int $site_id, string $key)
{
- if(!array_key_exists($key, AgreementEnum::getType())) throw new CommonException(100017);
+ if(!array_key_exists($key, AgreementEnum::getType())) throw new CommonException('AGREEMENT_TYPE_NOT_EXIST');
$where = array(
['agreement_key', '=', $key],
['site_id', '=', $site_id]
@@ -78,7 +78,7 @@ class CoreAgreementService extends BaseCoreService
*/
public function setAgreement(int $site_id, string $key, string $title, string $content)
{
- if(!array_key_exists($key, AgreementEnum::getType())) throw new CommonException(100017);
+ if(!array_key_exists($key, AgreementEnum::getType())) throw new CommonException('AGREEMENT_TYPE_NOT_EXIST');
$where = array(
['agreement_key', '=', $key],
['site_id', '=', $site_id]
diff --git a/niucloud/app/service/core/sys/CoreAreaService.php b/niucloud/app/service/core/sys/CoreAreaService.php
index 685f4c1e0..4dc5f75da 100644
--- a/niucloud/app/service/core/sys/CoreAreaService.php
+++ b/niucloud/app/service/core/sys/CoreAreaService.php
@@ -12,7 +12,7 @@
namespace app\service\core\sys;
use app\model\sys\SysArea;
-use app\service\core\BaseCoreService;
+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/sys/CoreAttachmentService.php b/niucloud/app/service/core/sys/CoreAttachmentService.php
index c5bcdd3e1..394a9ef4f 100644
--- a/niucloud/app/service/core/sys/CoreAttachmentService.php
+++ b/niucloud/app/service/core/sys/CoreAttachmentService.php
@@ -12,11 +12,11 @@
namespace app\service\core\sys;
use app\model\sys\SysAttachment;
-use app\service\core\BaseCoreService;
-use app\service\core\file\CoreStorageService;
-use extend\driver\file\FileDriver;
-use extend\exception\AdminException;
-use extend\exception\UploadFileException;
+use app\service\core\upload\CoreStorageService;
+use core\base\BaseCoreService;
+use core\exception\AdminException;
+use core\exception\UploadFileException;
+use core\upload\FileDriver;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
@@ -42,7 +42,7 @@ class CoreAttachmentService extends BaseCoreService
$data['site_id'] = $site_id;
$attachment = $this->model->create($data);
if(!$attachment->att_id)
- throw new AdminException(100010);//创建失败
+ throw new AdminException('ADD_FAIL');//创建失败
return $attachment->att_id;
}
@@ -58,7 +58,7 @@ class CoreAttachmentService extends BaseCoreService
);
$user = $this->model->where($where)->findOrEmpty();
if ($user->isEmpty())
- throw new AdminException(201001);
+ throw new AdminException('USER_NOT_EXIST');
return $user;
}
@@ -86,7 +86,7 @@ class CoreAttachmentService extends BaseCoreService
* @param array $data
* @param $where
*/
- public function update(int $site_id, int $att_id, array $data){
+ public function edit(int $site_id, int $att_id, array $data){
$where = array(
['site_id', '=', $site_id],
['att_id', '=', $att_id]
@@ -123,7 +123,7 @@ class CoreAttachmentService extends BaseCoreService
$core_attachment_service = new CoreAttachmentService();
$list = $core_attachment_service->getList($site_id, compact('att_ids'));
if(empty($list))
- throw new UploadFileException(203007);
+ throw new UploadFileException('PLEACE_SELECT_IMAGE');
$ids = array_column($list, 'att_id');
foreach($list as $v){
diff --git a/niucloud/app/service/core/sys/CoreConfigService.php b/niucloud/app/service/core/sys/CoreConfigService.php
index e4645b3ca..8d27ebbc9 100644
--- a/niucloud/app/service/core/sys/CoreConfigService.php
+++ b/niucloud/app/service/core/sys/CoreConfigService.php
@@ -12,7 +12,7 @@
namespace app\service\core\sys;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
/**
* 配置服务层
diff --git a/niucloud/app/service/core/sys/CoreSysConfigService.php b/niucloud/app/service/core/sys/CoreSysConfigService.php
index a4cd648f7..e1c2dc93e 100644
--- a/niucloud/app/service/core/sys/CoreSysConfigService.php
+++ b/niucloud/app/service/core/sys/CoreSysConfigService.php
@@ -11,8 +11,7 @@
namespace app\service\core\sys;
-use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
/**
* 配置服务层
diff --git a/niucloud/app/service/core/file/CoreBase64Service.php b/niucloud/app/service/core/upload/CoreBase64Service.php
similarity index 90%
rename from niucloud/app/service/core/file/CoreBase64Service.php
rename to niucloud/app/service/core/upload/CoreBase64Service.php
index bc3b47fed..dc1bdcab5 100644
--- a/niucloud/app/service/core/file/CoreBase64Service.php
+++ b/niucloud/app/service/core/upload/CoreBase64Service.php
@@ -9,9 +9,9 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\file;
+namespace app\service\core\upload;
-use extend\exception\UploadFileException;
+use core\exception\UploadFileException;
/**
* 上传服务层
@@ -36,7 +36,7 @@ class CoreBase64Service extends CoreFileService
*/
public function image(string $content, int $site_id, string $file_dir)
{
- if (empty($content)) throw new UploadFileException(203010);
+ if (empty($content)) throw new UploadFileException('BASE_IMAGE_FILE_NOT_EXIST');
$this->upload_driver = $this->driver($site_id);
$file_path = $this->upload_driver->createFileName(time(), 'jpg');
diff --git a/niucloud/app/service/core/file/CoreFetchService.php b/niucloud/app/service/core/upload/CoreFetchService.php
similarity index 86%
rename from niucloud/app/service/core/file/CoreFetchService.php
rename to niucloud/app/service/core/upload/CoreFetchService.php
index ad1dbc53f..f70982624 100644
--- a/niucloud/app/service/core/file/CoreFetchService.php
+++ b/niucloud/app/service/core/upload/CoreFetchService.php
@@ -9,9 +9,9 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\file;
+namespace app\service\core\upload;
-use extend\exception\UploadFileException;
+use core\exception\UploadFileException;
/**
* 上传服务层
@@ -25,17 +25,17 @@ class CoreFetchService extends CoreFileService
{
parent::__construct($is_attachment);
}
+
/**
* 图片上传
- * @param $site_id
- * @param $cate_id
- * @param $app_type
- * @param $file_path
+ * @param string $url
+ * @param int $site_id
+ * @param string $file_dir
* @return array
*/
public function image(string $url, int $site_id, string $file_dir)
{
- if(empty($url)) throw new UploadFileException(203009);
+ if(empty($url)) throw new UploadFileException('OSS_FILE_URL_NOT_EXIST');
$this->upload_driver = $this->driver($site_id);
[$link, $ext] = explode('.', $url);
$ext = empty($ext) ? $ext : 'jpg';
diff --git a/niucloud/app/service/core/file/CoreFileService.php b/niucloud/app/service/core/upload/CoreFileService.php
similarity index 87%
rename from niucloud/app/service/core/file/CoreFileService.php
rename to niucloud/app/service/core/upload/CoreFileService.php
index 17d07c4ac..7a97cdb19 100644
--- a/niucloud/app/service/core/file/CoreFileService.php
+++ b/niucloud/app/service/core/upload/CoreFileService.php
@@ -9,11 +9,12 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\file;
+namespace app\service\core\upload;
use app\enum\sys\FileEnum;
-use app\service\core\BaseCoreService;
-use extend\driver\file\FileDriver;
+use core\base\BaseCoreService;
+use core\upload\FileDriver;
+use core\upload\UploadLoader;
/**
* 上传服务层
@@ -42,14 +43,14 @@ class CoreFileService extends BaseCoreService
* @return FileDriver
*/
public function driver(int $site_id, bool $is_local = false){
- if(!$is_local){
+ if($is_local){
+ self::$storage_type = FileEnum::LOCAL;
+ }else{
$core_storage_service = new CoreStorageService();
$storage_config = $core_storage_service->getDefaultStorage($this->request->defaultSiteId());
self::$storage_type = $storage_config['storage_type'];
- }else{
- self::$storage_type = FileEnum::LOCAL;
}
//查询启用的上传方式
- return new FileDriver($storage_config ?? [], self::$storage_type);
+ return new UploadLoader(self::$storage_type, $storage_config ?? []);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/core/file/CoreStorageService.php b/niucloud/app/service/core/upload/CoreStorageService.php
similarity index 94%
rename from niucloud/app/service/core/file/CoreStorageService.php
rename to niucloud/app/service/core/upload/CoreStorageService.php
index 84216bafa..702050674 100644
--- a/niucloud/app/service/core/file/CoreStorageService.php
+++ b/niucloud/app/service/core/upload/CoreStorageService.php
@@ -9,16 +9,14 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\file;
+namespace app\service\core\upload;
use app\enum\sys\StorageEnum;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
+use core\base\BaseCoreService;
/**
* 上传服务层
- * Class CoreStorageService
- * @package app\service\core\file
*/
class CoreStorageService extends BaseCoreService
{
diff --git a/niucloud/app/service/core/file/CoreUploadConfigService.php b/niucloud/app/service/core/upload/CoreUploadConfigService.php
similarity index 96%
rename from niucloud/app/service/core/file/CoreUploadConfigService.php
rename to niucloud/app/service/core/upload/CoreUploadConfigService.php
index 10ba5bfd7..2fb901630 100644
--- a/niucloud/app/service/core/file/CoreUploadConfigService.php
+++ b/niucloud/app/service/core/upload/CoreUploadConfigService.php
@@ -9,12 +9,12 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\file;
+namespace app\service\core\upload;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
+use core\base\BaseCoreService;
use think\Model;
/**
diff --git a/niucloud/app/service/core/file/CoreUploadService.php b/niucloud/app/service/core/upload/CoreUploadService.php
similarity index 53%
rename from niucloud/app/service/core/file/CoreUploadService.php
rename to niucloud/app/service/core/upload/CoreUploadService.php
index bfd41eef6..ffb9329ba 100644
--- a/niucloud/app/service/core/file/CoreUploadService.php
+++ b/niucloud/app/service/core/upload/CoreUploadService.php
@@ -9,11 +9,11 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\service\core\file;
+namespace app\service\core\upload;
use app\enum\sys\FileEnum;
use app\service\core\sys\CoreAttachmentService;
-use extend\exception\UploadFileException;
+use core\exception\UploadFileException;
/**
* 上传服务层
@@ -39,7 +39,7 @@ class CoreUploadService extends CoreFileService
public function image(string $file, int $site_id, string $file_dir, int $cate_id = 0)
{
//校验上传设置
- $this->checkFile($site_id, $file, FileEnum::IMAGE);
+// $this->checkFile($site_id, $file, FileEnum::IMAGE);
//实例化上传引擎
$this->upload_driver = $this->driver($site_id);
//读取上传附件的信息用于后续得校验和数据写入
@@ -59,7 +59,7 @@ class CoreUploadService extends CoreFileService
{
//校验上传设置
- $this->checkFile($site_id, $file, FileEnum::VIDEO);
+// $this->checkFile($site_id, $file, FileEnum::VIDEO);
//实例化上传引擎
$this->upload_driver = $this->driver($site_id);
//读取上传附件的信息用于后续得校验和数据写入
@@ -78,10 +78,10 @@ class CoreUploadService extends CoreFileService
* @param bool $is_rename 是否重命名
* @return array
*/
- public function document(string $file, int $site_id, string $file_dir, bool $is_local = false, bool $is_rename = true)
+ public function document(string $file, int $site_id, string $type, string $file_dir, bool $is_local = false, bool $is_rename = true)
{
//校验上传设置(todo 文件暂时不校验,后补安全性校验)
- $this->checkFile($site_id, $file, FileEnum::DOCUMENT);
+// $this->checkFile($site_id, $file, $type ?: FileEnum::DOCUMENT);
//实例化上传引擎
$this->upload_driver = $this->driver($site_id, $is_local);
@@ -89,91 +89,13 @@ class CoreUploadService extends CoreFileService
//读取上传附件的信息用于后续得校验和数据写入
$this->upload_driver->read($file, $is_rename);
- return $this->after($site_id, $file_dir, FileEnum::DOCUMENT);
+ return $this->after($site_id, $file_dir, $type);
}
- /**
- * 根据上传文件的类型来校验文件是否符合配置
- * @param int $site_id
- * @param string $file
- * @param string $att_type
- * @return void
- */
- public function checkFile(int $site_id, string $file, string $att_type)
- {
- $file_obj = request()->file($file);
- if (empty($file_obj))
- throw new UploadFileException(100012);
-// $config = array(
-// 'image_ext' => ['gif', 'jpg'],//允许的后缀
-// 'video_ext' => ['gif', 'jpg'],//允许的后缀
-//// 'image' => [
-//// 'width' => 540,
-//// 'height' => 737,
-//// ],
-// 'file_size' => 1,//大小
-// 'file_mime' => []
-// );
- $core_upload_config_service = new CoreUploadConfigService();
- $config= $core_upload_config_service->getUploadConfig($site_id);
- $config['file_ext'] = match ($att_type) {
- FileEnum::IMAGE => $config['image_ext'] ?? [],
- FileEnum::VIDEO => $config['video_ext'] ?? [],
- FileEnum::DOCUMENT => $config['document_ext'] ?? [],
- default => [],
- };
- $config['file_size'] = match ($att_type) {
- FileEnum::IMAGE => $config['image_size'] ?? 0,
- FileEnum::VIDEO => $config['video_size'] ?? 0,
- FileEnum::DOCUMENT => $config['document_size'] ?? [],
- default => 0,
- };
- $rule = [];
- $file_size = $config['file_size'] ?? 0;
- if ($file_size > 0) {
- $rule[] = 'fileSize:' . $file_size * 1024 * 1024;
- }
- $file_ext = $config['file_ext'] ?? [];
- if (!empty($file_ext)) {
- $rule[] = 'fileExt:' . implode(',', $file_ext);
- }
- //验证上传文件类型
- $file_mime = $config['file_mime'] ?? [];
- if (!empty($file_mime)) {
- $rule[] = 'fileMime:' . implode(',', $file_mime);
- }
-
-
- $image_config = $config['image'] ?? [];
- if (!empty($image_config)) {
- $image_width = $image_config['width'] ?? 0;
- $image_height = $image_config['height'] ?? 0;
- $image_type = $image_config['type'] ?? [];
- $image_rule = '';
- if ($image_width > 0 && $image_height > 0) {
- $image_rule = 'image:' . $image_width . ',' . $image_height;
- }
- if (!empty($image_type)) {
- if (empty($image_rule)) {
- $image_rule = 'image:';
- } else {
- $image_rule .= ',';
- }
- $image_rule .= implode(',', $image_type);
- }
- if (!empty($image_type)) {
- $rule[] = $image_rule;
- }
- }
- if (!empty($rule)) {
- validate([$file => implode('|', $rule)])->check([$file => $file_obj]);
- }
-
- }
/**
- * 上传后续
+ * 上传
* @param int $site_id
* @param string $file_dir
* @param $type
@@ -186,10 +108,10 @@ class CoreUploadService extends CoreFileService
$dir = $this->root_path .'/'. $file_dir;
//执行上传
- $this->upload_driver->upload($dir);
+ $this->upload_driver->setType($type)->setValidate(config('upload.rules')[$type])->upload($dir);
$file_name = $this->upload_driver->getFileName();
- $full_path = $this->upload_driver->getFullPath();
+ $full_path = $this->upload_driver->getFullPath($dir);
$core_attachment_service = new CoreAttachmentService();
$url = $this->upload_driver->getUrl($full_path);
if($this->is_attachment){
diff --git a/niucloud/app/service/core/weapp/CoreWeappAuthService.php b/niucloud/app/service/core/weapp/CoreWeappAuthService.php
index e6933a50d..1c8549803 100644
--- a/niucloud/app/service/core/weapp/CoreWeappAuthService.php
+++ b/niucloud/app/service/core/weapp/CoreWeappAuthService.php
@@ -11,7 +11,7 @@
namespace app\service\core\weapp;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
diff --git a/niucloud/app/service/core/weapp/CoreWeappConfigService.php b/niucloud/app/service/core/weapp/CoreWeappConfigService.php
index 2ef6d5fdb..33a548ac0 100644
--- a/niucloud/app/service/core/weapp/CoreWeappConfigService.php
+++ b/niucloud/app/service/core/weapp/CoreWeappConfigService.php
@@ -13,8 +13,8 @@ namespace app\service\core\weapp;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
+use core\base\BaseCoreService;
use think\Model;
/**
diff --git a/niucloud/app/service/core/weapp/CoreWeappService.php b/niucloud/app/service/core/weapp/CoreWeappService.php
index 74f5d9af0..b14da6a0b 100644
--- a/niucloud/app/service/core/weapp/CoreWeappService.php
+++ b/niucloud/app/service/core/weapp/CoreWeappService.php
@@ -11,9 +11,9 @@
namespace app\service\core\weapp;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
+use core\exception\WechatException;
use EasyWeChat\Factory;
-use extend\exception\WechatException;
/**
@@ -33,7 +33,7 @@ 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(410000);//公众号未配置
+ throw new WechatException('WEAPP_NOT_EXIST');//公众号未配置
$config = array(
'app_id' => $weapp_config['app_id'],
'secret' => $weapp_config['app_secret'],
diff --git a/niucloud/app/service/core/weapp/CoreWeappTemplateService.php b/niucloud/app/service/core/weapp/CoreWeappTemplateService.php
index 5c77243f8..72dd6db95 100644
--- a/niucloud/app/service/core/weapp/CoreWeappTemplateService.php
+++ b/niucloud/app/service/core/weapp/CoreWeappTemplateService.php
@@ -11,7 +11,7 @@
namespace app\service\core\weapp;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
diff --git a/niucloud/app/service/core/wechat/CoreWechatApiService.php b/niucloud/app/service/core/wechat/CoreWechatApiService.php
index 1871d5605..e0dd808ab 100644
--- a/niucloud/app/service/core/wechat/CoreWechatApiService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatApiService.php
@@ -11,7 +11,7 @@
namespace app\service\core\wechat;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
/**
diff --git a/niucloud/app/service/core/wechat/CoreWechatConfigService.php b/niucloud/app/service/core/wechat/CoreWechatConfigService.php
index 50625a95f..0e86d0160 100644
--- a/niucloud/app/service/core/wechat/CoreWechatConfigService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatConfigService.php
@@ -14,9 +14,9 @@ namespace app\service\core\wechat;
use app\enum\channel\WechatEnum;
use app\enum\sys\ConfigKeyEnum;
use app\model\sys\SysConfig;
-use app\service\core\BaseCoreService;
use app\service\core\sys\CoreConfigService;
use app\service\core\sys\CoreSysConfigService;
+use core\base\BaseCoreService;
use think\Model;
/**
diff --git a/niucloud/app/service/core/wechat/CoreWechatFansService.php b/niucloud/app/service/core/wechat/CoreWechatFansService.php
index 5c5ba3600..669d02c5b 100644
--- a/niucloud/app/service/core/wechat/CoreWechatFansService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatFansService.php
@@ -12,8 +12,8 @@
namespace app\service\core\wechat;
use app\model\wechat\WechatFans;
-use app\service\core\BaseCoreService;
-use extend\exception\CommonException;
+use core\base\BaseCoreService;
+use core\exception\CommonException;
/**
* 微信粉丝
@@ -58,7 +58,7 @@ class CoreWechatFansService extends BaseCoreService
* @param $data
* @return void
*/
- public function update(int $site_id, string $open_id, array $data)
+ public function edit(int $site_id, string $open_id, array $data)
{
$condition = [
['site_id', '=', $site_id],
@@ -68,7 +68,7 @@ class CoreWechatFansService extends BaseCoreService
$core_wechat_api_service = new CoreWechatApiService();
$userinfo = $core_wechat_api_service->userInfo($site_id, $open_id);
if (empty($userinfo))
- throw new CommonException(400002);
+ throw new CommonException('WECHAT_EMPOWER_NOT_EXIST');
$save_data = array(
'site_id' => $site_id,
@@ -103,7 +103,7 @@ class CoreWechatFansService extends BaseCoreService
}
// todo qr_scene qr_scene_str 这两个二维码自定义开发功能
if (!$fans->isEmpty()) {
- $fans->update($save_data);
+ $fans->edit($save_data);
} else {
$this->model->create($save_data);
}
@@ -131,7 +131,7 @@ class CoreWechatFansService extends BaseCoreService
'subscribe_scene' => $user_info['subscribe_scene'],
'language' => $user_info['language'],
);
- $this->update($site_id, $from_user_name, $data);
+ $this->edit($site_id, $from_user_name, $data);
return true;
}
@@ -147,7 +147,7 @@ class CoreWechatFansService extends BaseCoreService
'subscribe' => 0,
'unsubscribe_time' => time(),
);
- $this->update($site_id, $from_user_name, $data);
+ $this->edit($site_id, $from_user_name, $data);
return true;
}
diff --git a/niucloud/app/service/core/wechat/CoreWechatMessageService.php b/niucloud/app/service/core/wechat/CoreWechatMessageService.php
index e2432ea5a..bb0a92362 100644
--- a/niucloud/app/service/core/wechat/CoreWechatMessageService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatMessageService.php
@@ -12,11 +12,10 @@
namespace app\service\core\wechat;
use app\enum\channel\WechatEnum;
-use app\service\core\BaseCoreService;
use app\service\core\scan\CoreScanService;
use Closure;
+use core\base\BaseCoreService;
use EasyWeChat\Kernel\Messages\Text;
-use think\facade\Log;
/**
* 微信事件中间件类(用于中间件注册)
@@ -95,7 +94,7 @@ class CoreWechatMessageService extends BaseCoreService
$key = str_replace('qrscene_', '', $message['EventKey']);
$core_scan_service = new CoreScanService();
$core_scan_service->actionByScan($site_id, $key, ['openid' => $message['FromUserName']]);
- return get_lang(400003);
+ return get_lang('SCAN_SUCCESS');
}
/**
diff --git a/niucloud/app/service/core/wechat/CoreWechatReplyService.php b/niucloud/app/service/core/wechat/CoreWechatReplyService.php
index 911db934e..325e41270 100644
--- a/niucloud/app/service/core/wechat/CoreWechatReplyService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatReplyService.php
@@ -14,9 +14,9 @@ namespace app\service\core\wechat;
use app\enum\channel\ReplyEnum;
use app\enum\channel\WechatEnum;
use app\model\wechat\WechatReply;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
+use core\exception\AdminException;
use EasyWeChat\Kernel\Messages\Text;
-use extend\exception\AdminException;
use think\Model;
@@ -123,7 +123,7 @@ class CoreWechatReplyService extends BaseCoreService
* @param $data
* @return void
*/
- public function updateKeyword(int $site_id, int $id, array $data)
+ public function editKeyword(int $site_id, int $id, array $data)
{
$where = [
['site_id', '=', $site_id],
@@ -146,7 +146,7 @@ class CoreWechatReplyService extends BaseCoreService
);
$reply = $this->find($where);
if ($reply->isEmpty())
- throw new AdminException(400001);
+ throw new AdminException('KEYWORDS_NOT_EXIST');
return $reply->delete();
}
@@ -183,7 +183,7 @@ class CoreWechatReplyService extends BaseCoreService
* @param $data
* @return void
*/
- public function updateDefault(int $site_id, array $data)
+ public function editDefault(int $site_id, array $data)
{
$where = [
['site_id', '=', $site_id],
@@ -196,7 +196,7 @@ class CoreWechatReplyService extends BaseCoreService
$data['site_id'] = $site_id;
return $this->model->create($data);
} else {
- return $reply->update($data);
+ return $reply->edit($data);
}
}
@@ -221,7 +221,7 @@ class CoreWechatReplyService extends BaseCoreService
* @param $data
* @return void
*/
- public function updateSubscribe(int $site_id, array $data)
+ public function editSubscribe(int $site_id, array $data)
{
$where = [
['site_id', '=', $site_id],
@@ -234,7 +234,7 @@ class CoreWechatReplyService extends BaseCoreService
$data['site_id'] = $site_id;
return $this->model->create($data);
} else {
- return $reply->update($data);
+ return $reply->edit($data);
}
diff --git a/niucloud/app/service/core/wechat/CoreWechatServeService.php b/niucloud/app/service/core/wechat/CoreWechatServeService.php
index 6d3290bec..5132a2e49 100644
--- a/niucloud/app/service/core/wechat/CoreWechatServeService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatServeService.php
@@ -11,11 +11,10 @@
namespace app\service\core\wechat;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
use EasyWeChat\Kernel\Exceptions\BadRequestException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
-use extend\exception\WechatException;
use Overtrue\Socialite\Contracts\UserInterface;
use Psr\Http\Message\ResponseInterface;
use ReflectionException;
diff --git a/niucloud/app/service/core/wechat/CoreWechatService.php b/niucloud/app/service/core/wechat/CoreWechatService.php
index 0c1a7de2b..981332c4b 100644
--- a/niucloud/app/service/core/wechat/CoreWechatService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatService.php
@@ -11,10 +11,10 @@
namespace app\service\core\wechat;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
+use core\exception\WechatException;
use EasyWeChat\Factory;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
-use extend\exception\WechatException;
/**
* easywechat主体提供
@@ -34,7 +34,7 @@ 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(400000);//公众号未配置
+ throw new WechatException('WECHAT_NOT_EXIST');//公众号未配置
$config = array(
'app_id' => $wechat_config['app_id'],
'secret' => $wechat_config['app_secret'],
diff --git a/niucloud/app/service/core/wechat/CoreWechatTemplateService.php b/niucloud/app/service/core/wechat/CoreWechatTemplateService.php
index 698422a82..1b85ad222 100644
--- a/niucloud/app/service/core/wechat/CoreWechatTemplateService.php
+++ b/niucloud/app/service/core/wechat/CoreWechatTemplateService.php
@@ -11,7 +11,7 @@
namespace app\service\core\wechat;
-use app\service\core\BaseCoreService;
+use core\base\BaseCoreService;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
/**
diff --git a/niucloud/app/tags.php b/niucloud/app/tags.php
deleted file mode 100644
index 63ef7de52..000000000
--- a/niucloud/app/tags.php
+++ /dev/null
@@ -1,39 +0,0 @@
- [],
- // 应用开始
- 'app_begin' => [],
- // 模块初始化
- 'module_init' => [],
- // 操作开始执行
- 'action_begin' => [],
- // 视图内容过滤
- 'view_filter' => [],
- // 日志写入
- 'log_write' => [],
- // 应用结束
- 'app_end' => [],
-
- // 任务失败统一回调,有四种定义方式
- 'queue_failed'=> [
- ['app\behavior\QueueFailedLogger', 'report'],
- // 数组形式,[ 'ClassName' , 'methodName']
-// ['app\behavior\QueueFailedLogger', 'report'],
-
- // 字符串(静态方法),'StaicClassName::methodName'
- // 'MyQueueFailedLogger::logAllFailedQueues'
-
- // 字符串(对象方法),'ClassName',此时需在对应的ClassName类中添加一个名为 queueFailed 的方法
- // 'application\\behavior\\MyQueueFailedLogger'
-
- // 闭包形式
- /*
- function( &$jobObject , $extra){
- // var_dump($jobObject);
- return true;
- }
- */
- ]
-];
\ No newline at end of file
diff --git a/niucloud/app/task/CronTask.php b/niucloud/app/task/CronTask.php
deleted file mode 100644
index ef65736c8..000000000
--- a/niucloud/app/task/CronTask.php
+++ /dev/null
@@ -1,42 +0,0 @@
-everyMinute(); //设置任务的周期,每天执行一次,更多的方法可以查看源代码,都有注释
- }
-
- /**
- * 执行任务
- * @return mixed
- */
- protected function execute()
- {
- //...具体的任务执行
- CoreCronService::execute();
- Log::write('当前时间:'.date('Y-m-d H:i:s'));
- //todo 这儿可以写一些返回值来美化格式
- }
-}
diff --git a/niucloud/app/validate/article/Article.php b/niucloud/app/validate/article/Article.php
index 38a75a317..f88701514 100644
--- a/niucloud/app/validate/article/Article.php
+++ b/niucloud/app/validate/article/Article.php
@@ -54,6 +54,6 @@ class Article extends Validate
protected $scene = [
'add' => ['title','intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'],
- 'update' => ['title','intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'],
+ 'edit' => ['title','intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'],
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/article/ArticleCategory.php b/niucloud/app/validate/article/ArticleCategory.php
index 92ee87abd..0e8a9379e 100644
--- a/niucloud/app/validate/article/ArticleCategory.php
+++ b/niucloud/app/validate/article/ArticleCategory.php
@@ -40,6 +40,6 @@ class ArticleCategory extends Validate
protected $scene = [
'add' => ['name', 'is_show', 'sort'],
- 'update' => ['name', 'is_show', 'sort'],
+ 'edit' => ['name', 'is_show', 'sort'],
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/diy/Diy.php b/niucloud/app/validate/diy/Diy.php
index 5ea0cab54..7a25bc92d 100644
--- a/niucloud/app/validate/diy/Diy.php
+++ b/niucloud/app/validate/diy/Diy.php
@@ -33,7 +33,7 @@ class Diy extends \think\Validate
protected $scene = [
"add" => [ 'title', 'name', 'type', 'value', 'is_default' ],
- "update" => [ 'title', 'name', 'value', 'is_default' ],
+ "edit" => [ 'title', 'name', 'value', 'is_default' ],
];
/**
diff --git a/niucloud/app/validate/diy/DiyRoute.php b/niucloud/app/validate/diy/DiyRoute.php
index 8536e4b6a..138946229 100644
--- a/niucloud/app/validate/diy/DiyRoute.php
+++ b/niucloud/app/validate/diy/DiyRoute.php
@@ -30,7 +30,7 @@ class DiyRoute extends \think\Validate
protected $scene = [
"add" => [ 'title', 'name', 'page' ],
- "update" => [ 'title', 'name', 'page' ]
+ "edit" => [ 'title', 'name', 'page' ]
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/generator/Generator.php b/niucloud/app/validate/generator/Generator.php
index b56ce5695..6a02659c6 100644
--- a/niucloud/app/validate/generator/Generator.php
+++ b/niucloud/app/validate/generator/Generator.php
@@ -37,7 +37,7 @@ class Generator extends Validate
protected $scene = [
'add' => ['table_name'],
- "update" => ['table_name','table_content','class_name', 'module_name', 'table_column'],
+ "edit" => ['table_name','table_content','class_name', 'module_name', 'table_column'],
"create" => ['id'],
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/member/CashOut.php b/niucloud/app/validate/member/CashOut.php
new file mode 100644
index 000000000..ced6980b7
--- /dev/null
+++ b/niucloud/app/validate/member/CashOut.php
@@ -0,0 +1,55 @@
+ 'min:0.01', // 提现金额
+ 'account_type' => "checkAccountType",
+ 'transfer_type' => 'checkTransferType',
+ 'account_id' => 'checkAccountId'
+ ];
+
+ protected $message = [
+ 'apply_money.min' => 'validate_member_cash_out.apply_money_min',
+ ];
+
+ protected $scene = [
+ 'apply' => ['apply_money', 'account_type', 'transfer_type', 'account_id'],
+ ];
+
+ protected function checkAccountId($value, $rule, $data = []) {
+ if ($data['transfer_type'] == TransferEnum::WECHAT) {
+ return true;
+ } else {
+ return !empty($value) ? true : 'validate_member_cash_out.account_id_require';
+ }
+ }
+
+ protected function checkTransferType($value){
+ $transfer_type = array_keys(TransferEnum::getTransferType());
+ return in_array($value, $transfer_type) ? true : 'validate_member_cash_out.not_support_transfer_type';
+ }
+
+ protected function checkAccountType($value) {
+ $account_type = [ MemberAccountEnum::MONEY, MemberAccountEnum::COMMISSION ];
+ return in_array($value, $account_type) ? true : 'validate_member_cash_out.not_support_account_type';
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/validate/member/CashOutAccount.php b/niucloud/app/validate/member/CashOutAccount.php
new file mode 100644
index 000000000..b0f927df8
--- /dev/null
+++ b/niucloud/app/validate/member/CashOutAccount.php
@@ -0,0 +1,48 @@
+ 'checkAccountType',
+ 'bank_name' => 'checkBankName',
+ 'account_no' => 'require',
+ 'realname' => 'require'
+ ];
+
+ protected $message = [
+ 'account_type.require' => 'validate_member_cash_out_account.account_type_require',
+ 'account_no.require' => 'validate_member_cash_out_account.account_no_require',
+ 'realname.require' => 'validate_member_cash_out_account.realname_require',
+ ];
+
+ protected $scene = [
+ 'addOrEdit' => ['account_type', 'bank_name', 'account_no', 'realname'],
+ ];
+
+ protected function checkBankName($value, $rule, $data = [])
+ {
+ return $data['account_type'] != 'bank' || !empty($value) ? true : 'validate_member_cash_out_account.bank_name_require';
+ }
+
+ protected function checkAccountType($value){
+ $transfer_type = array_keys(TransferEnum::getTransferType());
+ return in_array($value, $transfer_type) ? true : 'validate_member_cash_out_account.not_support_transfer_type';
+ }
+}
\ No newline at end of file
diff --git a/niucloud/app/validate/member/WithdrawConfig.php b/niucloud/app/validate/member/CashOutConfig.php
similarity index 72%
rename from niucloud/app/validate/member/WithdrawConfig.php
rename to niucloud/app/validate/member/CashOutConfig.php
index 73d3834e4..695242fb3 100644
--- a/niucloud/app/validate/member/WithdrawConfig.php
+++ b/niucloud/app/validate/member/CashOutConfig.php
@@ -15,10 +15,8 @@ use think\Validate;
/**
* 提现设置验证类
- * Class WithdrawConfig
- * @package app\validate\member
*/
-class WithdrawConfig extends Validate
+class CashOutConfig extends Validate
{
@@ -32,12 +30,12 @@ class WithdrawConfig extends Validate
];
protected $message = [
- 'is_open.in' => 'validate_member.withdraw_is_open_in',
- 'min.min' => 'validate_member.withdraw_min_min',
- 'rate.between' => 'validate_member.withdraw_rate_between',
- 'is_auto_verify.in' => 'validate_member.withdraw_is_auto_verify_in',
- 'is_auto_transfer.in' => 'validate_member.withdraw_is_auto_transfer_in',
- 'transfer_type.require' => 'validate_member_withdraw_config.transfer_type_require',
+ 'is_open.in' => 'validate_member.cash_out_is_open_in',
+ 'min.min' => 'validate_member.cash_out_min_min',
+ 'rate.between' => 'validate_member.cash_out_rate_between',
+ 'is_auto_verify.in' => 'validate_member.cash_out_is_auto_verify_in',
+ 'is_auto_transfer.in' => 'validate_member.cash_out_is_auto_transfer_in',
+ 'transfer_type.require' => 'validate_member_cash_out_config.transfer_type_require',
];
protected $scene = [
diff --git a/niucloud/app/validate/member/Member.php b/niucloud/app/validate/member/Member.php
index 940d6d2ef..775f968f0 100644
--- a/niucloud/app/validate/member/Member.php
+++ b/niucloud/app/validate/member/Member.php
@@ -12,6 +12,7 @@
namespace app\validate\member;
use app\enum\common\CommonEnum;
+use app\enum\member\MemberEnum;
use think\Validate;
/**
@@ -30,6 +31,7 @@ class Member extends Validate
'birthday' => 'date',
'username' => 'require',
'password' => 'require',
+ 'status' => 'require|checkStatus',
];
protected $message = [
@@ -42,14 +44,18 @@ class Member extends Validate
'username.require' => 'validate_member.username_require',
'username.unique' => 'validate_member.username_is_exist',
'password.require' => 'validate_member.password_require',
+
+ 'status.require' => 'validate_member.status_require',
+
];
protected $scene = [
'add' => ['nickname', 'birthday', 'username', 'password'],
- 'update' => ['nickname', 'sex', 'birthday'],
+ 'edit' => ['nickname', 'sex', 'birthday'],
'modify' => ['nickname', 'sex', 'birthday'],
'account_register' => ['username', 'password', 'mobile'],
'reset_password' => ['password', 'mobile'],
+ 'set_status' => ['status']
];
/**
@@ -63,4 +69,9 @@ class Member extends Validate
{
return isset(CommonEnum::getSexType()[$value]) ? true : get_lang("validate_member.sex_bot_exist");
}
+
+ protected function checkStatus($value, $rule, $data = [])
+ {
+ return isset(MemberEnum::getStatus()[$value]) ? true : get_lang("validate_member.not_exit_status");
+ }
}
\ No newline at end of file
diff --git a/niucloud/app/validate/member/MemberLabel.php b/niucloud/app/validate/member/MemberLabel.php
index 476d12869..4670742a0 100644
--- a/niucloud/app/validate/member/MemberLabel.php
+++ b/niucloud/app/validate/member/MemberLabel.php
@@ -38,6 +38,6 @@ class MemberLabel extends Validate
protected $scene = [
'add' => ['label_name', 'memo', 'sort'],
- 'update' => ['label_name', 'memo', 'sort'],
+ 'edit' => ['label_name', 'memo', 'sort'],
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/pay/PayTemplate.php b/niucloud/app/validate/pay/PayTemplate.php
new file mode 100644
index 000000000..ce4bef959
--- /dev/null
+++ b/niucloud/app/validate/pay/PayTemplate.php
@@ -0,0 +1,86 @@
+ 'require',
+ //支付宝
+ 'app_id' => 'requireIf:type,'.PayEnum::ALIPAY,
+ 'app_secret_cert' => 'requireIf:type,'.PayEnum::ALIPAY,
+ 'app_public_cert_path' => 'requireIf:type,'.PayEnum::ALIPAY,
+ 'alipay_public_cert_path' => 'requireIf:type,'.PayEnum::ALIPAY,
+ 'alipay_root_cert_path' => 'requireIf:type,'.PayEnum::ALIPAY,
+
+ //微信
+ 'mch_id' => 'requireIf:type,'.PayEnum::WECHATPAY,
+ 'mch_secret_key' => 'requireIf:type,'.PayEnum::WECHATPAY,
+ 'mch_secret_cert' => 'requireIf:type,'.PayEnum::WECHATPAY,
+ 'mch_public_cert_path' => 'requireIf:type,'.PayEnum::WECHATPAY,
+
+ //支付方式
+ 'type' => 'require|checkPayType',
+ ];
+
+ protected $message = [
+ 'app_id.requireIf' => 'validate_pay.app_id_requireif',
+ 'app_secret_cert.requireIf' => 'validate_pay.app_secret_cert_requireif',
+ 'app_public_cert_path.requireIf' => 'validate_pay.app_public_cert_path_requireif',
+ 'alipay_public_cert_path.requireIf' => 'validate_pay.alipay_public_cert_path_requireif',
+ 'alipay_root_cert_path.requireIf' => 'validate_pay.alipay_root_cert_path_requireif',
+
+ 'mch_id.requireIf' => 'validate_pay.mch_id_requireif',
+ 'mch_secret_key.requireIf' => 'validate_pay.mch_secret_key_requireif',
+ 'mch_secret_cert.requireIf' => 'validate_pay.mch_secret_cert_requireif',
+ 'mch_public_cert_path.requireIf' => 'validate_pay.mch_public_cert_path_requireif',
+
+ 'name.require' => 'validate_pay.name_require'
+ ];
+
+ protected $scene = [
+ 'add' => [
+ 'app_id', 'app_secret_cert', 'app_public_cert_path', 'alipay_public_cert_path', 'alipay_root_cert_path',
+ 'mch_id','mch_secret_key','mch_secret_cert','mch_public_cert_path',
+ 'type', 'name'
+ ],
+ 'edit' => [
+ 'app_id', 'app_secret_cert', 'app_public_cert_path', 'alipay_public_cert_path', 'alipay_root_cert_path',
+ 'mch_id','mch_secret_key','mch_secret_cert','mch_public_cert_path',
+ 'name'
+ ],
+ ];
+
+ /**
+ * 自定义验证 支付类型
+ * @param $value
+ * @param $rule
+ * @param array $data
+ * @return bool|string
+ */
+ protected function checkPayType($value, $rule, $data = [])
+ {
+ return isset( PayEnum::getPayType()[$value]) ? true : get_lang('validate_pay.not_exit_pay_type');
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/app/validate/site/Site.php b/niucloud/app/validate/site/Site.php
index 4cb793540..ac83ec13f 100644
--- a/niucloud/app/validate/site/Site.php
+++ b/niucloud/app/validate/site/Site.php
@@ -40,6 +40,6 @@ class Site extends Validate
protected $scene = [
'add' => ['site_name', 'group_id', 'expire_time'],
- "update" => ['site_name']
+ "edit" => ['site_name']
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/site/SiteGroup.php b/niucloud/app/validate/site/SiteGroup.php
index f4a2d11f0..66508c6a4 100644
--- a/niucloud/app/validate/site/SiteGroup.php
+++ b/niucloud/app/validate/site/SiteGroup.php
@@ -36,6 +36,6 @@ class SiteGroup extends Validate
protected $scene = [
'add' => ['group_name', 'group_roles'],
- 'update' => ['group_name', 'group_roles'],
+ 'edit' => ['group_name', 'group_roles'],
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/sys/Agreement.php b/niucloud/app/validate/sys/Agreement.php
index c110565da..119b75000 100644
--- a/niucloud/app/validate/sys/Agreement.php
+++ b/niucloud/app/validate/sys/Agreement.php
@@ -35,7 +35,7 @@ class Agreement extends Validate
];
protected $scene = [
- 'update' => ['title', 'content'],
+ 'edit' => ['title', 'content'],
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/sys/AttachmentCategory.php b/niucloud/app/validate/sys/AttachmentCategory.php
index 62c8d5cf5..b16acf9ba 100644
--- a/niucloud/app/validate/sys/AttachmentCategory.php
+++ b/niucloud/app/validate/sys/AttachmentCategory.php
@@ -34,7 +34,7 @@ class AttachmentCategory extends Validate
protected $scene = [
'add' => ['name', 'type'],
- 'update' => ['name'],
+ 'edit' => ['name'],
];
/**
diff --git a/niucloud/app/validate/sys/Menu.php b/niucloud/app/validate/sys/Menu.php
index 2fc9e9366..3e175f431 100644
--- a/niucloud/app/validate/sys/Menu.php
+++ b/niucloud/app/validate/sys/Menu.php
@@ -45,7 +45,7 @@ class Menu extends Validate
protected $scene = [
'add' => ['menu_name', 'menu_type', 'menu_key', 'router_path', 'view_path', 'methods'],
- 'update' => ['menu_name', 'menu_type', 'router_path', 'view_path', 'methods'],//更新得时候因为key中有上下级关系,所以menu_key字段是不能更新得
+ 'edit' => ['menu_name', 'menu_type', 'router_path', 'view_path', 'methods'],//更新得时候因为key中有上下级关系,所以menu_key字段是不能更新得
];
/**
diff --git a/niucloud/app/validate/sys/Role.php b/niucloud/app/validate/sys/Role.php
index b052f70f6..a91260af9 100644
--- a/niucloud/app/validate/sys/Role.php
+++ b/niucloud/app/validate/sys/Role.php
@@ -33,6 +33,6 @@ class Role extends Validate
protected $scene = [
'add' => ['role_name'],
- 'update' => ['role_name']
+ 'edit' => ['role_name']
];
}
\ No newline at end of file
diff --git a/niucloud/app/validate/sys/User.php b/niucloud/app/validate/sys/User.php
index 8f20b4798..74147d45d 100644
--- a/niucloud/app/validate/sys/User.php
+++ b/niucloud/app/validate/sys/User.php
@@ -40,7 +40,7 @@ class User extends Validate
protected $scene = [
'add' => ['username','password'],
- 'update' => [],
+ 'edit' => [],
'modify' => []
];
}
\ No newline at end of file
diff --git a/niucloud/config/console.php b/niucloud/config/console.php
index 2b334fffc..a56c5372f 100644
--- a/niucloud/config/console.php
+++ b/niucloud/config/console.php
@@ -5,8 +5,6 @@
return [
// 指令定义
'commands' => [
- // 定时任务
- 'crontab' => 'app\command\CronTab',
//消息队列 自定义命令
'queue:work' => 'think\queue\command\Work',
'queue:restart' => 'think\queue\command\Restart',
diff --git a/niucloud/config/imgcaptcha.php b/niucloud/config/imgcaptcha.php
new file mode 100644
index 000000000..727ca3eb3
--- /dev/null
+++ b/niucloud/config/imgcaptcha.php
@@ -0,0 +1,27 @@
+ '', //自定义字体包路径, 不填使用默认值
+ //文字验证码
+ 'click_world' => [
+ 'backgrounds' => []
+ ],
+ //滑动验证码
+ 'block_puzzle' => [
+ 'backgrounds' => [], //背景图片路径, 不填使用默认值
+ 'templates' => [], //模板图
+ 'offset' => 10, //容错偏移量
+ ],
+ //水印
+ 'watermark' => [
+ 'fontsize' => 12,
+ 'color' => '#ffffff',
+ 'text' => ''
+ ],
+ 'cache' => [
+ 'constructor' => [\think\facade\Cache::class, 'instance']
+ ]
+];
diff --git a/niucloud/app/enum/withdraw/WithdrawTypeEnum.php b/niucloud/config/pay.php
similarity index 73%
rename from niucloud/app/enum/withdraw/WithdrawTypeEnum.php
rename to niucloud/config/pay.php
index 2d4b56d18..a75c0c8ed 100644
--- a/niucloud/app/enum/withdraw/WithdrawTypeEnum.php
+++ b/niucloud/config/pay.php
@@ -9,19 +9,14 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
-namespace app\enum\withdraw;
-
-
-/**
- * 提现类型
- * Class WithdrawTypeEnum
- * @package app\enum\member
- */
-class WithdrawTypeEnum
-{
- //会员零钱提现
- const MEMBER_WITHDRAW = 'member_withdraw';
-
-
-
-}
\ No newline at end of file
+return [
+ //默认驱动
+ 'default' => 'wechatpay',
+ //驱动
+ 'drivers' => [
+ //微信
+ 'wechatpay' => [],
+ //支付宝
+ 'alipay' => [],
+ ]
+];
diff --git a/niucloud/config/queue.php b/niucloud/config/queue.php
index 12344aa8d..0e82f3194 100644
--- a/niucloud/config/queue.php
+++ b/niucloud/config/queue.php
@@ -10,7 +10,7 @@
// +----------------------------------------------------------------------
return [
- 'default' => 'redis',
+ 'default' => 'database',
'connections' => [
'sync' => [
'type' => 'sync',
@@ -47,7 +47,7 @@ return [
],
],
'failed' => [
- 'type' => 'none',
- 'table' => 'failed_jobs',
+ 'type' => 'none',// none 不记录失败任务 database 将失败任务迁移到失败任务表
+ 'table' => 'jobs_failed',
],
];
diff --git a/niucloud/config/sms.php b/niucloud/config/sms.php
new file mode 100644
index 000000000..68c4efd5c
--- /dev/null
+++ b/niucloud/config/sms.php
@@ -0,0 +1,32 @@
+ 'aliyun',
+ //驱动厂商列表及参数-短信
+ 'drivers' => [
+ //阿里云
+ 'aliyun' => [
+ 'driver' => 'core\sms\Aliyun', //反射类的名字
+ 'app_key' => '',
+ 'secret_key' => '',
+ 'sign' => '',
+ ],
+ //腾讯云
+ 'tencent' => [
+ 'secret_id' => '',
+ 'secret_key' => '',
+ 'sign' => '',
+ 'app_id' => '',
+ ]
+ ]
+];
diff --git a/niucloud/config/terminal.php b/niucloud/config/terminal.php
new file mode 100644
index 000000000..77b6fdb5f
--- /dev/null
+++ b/niucloud/config/terminal.php
@@ -0,0 +1,44 @@
+ [
+
+ // 查看版本的命令
+ 'version' => [
+ 'npm' => 'npm -v',
+ 'node' => 'node -v',
+ ],
+ 'npm-admin' => [
+ 'cwd' => 'admin',
+ 'command' => 'npm install',
+ ],
+
+ 'npm-web' => [
+ 'cwd' => 'web',
+ 'command' => 'npm install',
+ ],
+
+ 'npm-uni-app' => [
+ 'cwd' => 'uni-app',
+ 'command' => 'npm install',
+ ],
+
+ 'composer-install' => [
+ 'cwd' => 'niucloud',
+ 'command' => 'composer update',
+ ],
+ // 切换到国内镜像
+ 'set-mirror' => [
+ //切换到淘宝镜像
+ 'npm' => 'npm config set registry https://registry.npmjs.org',
+ //切换到阿里云镜像
+ 'composer' => 'composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/',
+ ],
+ ],
+];
+
diff --git a/niucloud/config/trace.php b/niucloud/config/trace.php
index fad2392d9..0b2ee6d11 100644
--- a/niucloud/config/trace.php
+++ b/niucloud/config/trace.php
@@ -4,7 +4,7 @@
// +----------------------------------------------------------------------
return [
// 内置Html和Console两种方式 支持扩展
- 'type' => 'Html',
+ 'type' => env('app_trace_type', 'Html'),
// 读取的日志通道名
'channel' => '',
];
diff --git a/niucloud/config/upload.php b/niucloud/config/upload.php
new file mode 100644
index 000000000..8b99b2569
--- /dev/null
+++ b/niucloud/config/upload.php
@@ -0,0 +1,58 @@
+ 'local',//默认驱动
+ 'drivers' => [
+ //本地上传
+ 'local' => [],
+ //七牛云
+ 'qiniu' => [
+ 'access_key' => '',
+ 'secret_key' => '',
+ 'bucket' => ''
+ ],
+ //阿里云
+ 'aliyun' => [
+ 'access_key' => '',
+ 'secret_key' => '',
+ 'endpoint' => '',
+ 'bucket' => ''
+ ],
+ //腾讯云
+ 'qcloud' => [
+ 'access_key' => '',
+ 'secret_key' => '',
+ 'region' => '',
+ 'bucket' => ''
+ ],
+ ],
+ // 默认规则
+ 'rules' => [
+ 'image' => [
+ 'ext' => ['jpg', 'jpeg', 'webp', 'png', 'gif'],
+ 'mime' => [ 'image/jpeg','image/gif','image/png','image/webp'],
+ 'size' => 2097152
+ ],
+ 'video' => [
+ 'ext' => ['mp4'],
+ 'mime' => [ 'video/mp4'],
+ 'size' => 2097152
+ ],
+ 'wechat' => [
+ 'ext' => ['pem'],
+ 'mime' => [
+ 'application/x-x509-ca-cert',
+ 'application/octet-stream'
+ ],
+ 'size' => 2097152
+ ],
+ 'aliyun' => [
+ 'ext' => ['crt'],
+ 'mime' => [
+ 'application/x-x509-ca-cert',
+ 'application/octet-stream'
+ ],
+ 'size' => 2097152
+ ],
+ ]
+];