From 2e643290e4a8450e6e357f4f12347080118176eb 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: Fri, 17 Jan 2025 19:44:10 +0800 Subject: [PATCH] up --- niucloud/app/ExceptionHandle.php | 8 +- niucloud/app/adminapi/controller/diy/Diy.php | 37 + .../app/adminapi/controller/diy/DiyForm.php | 370 +++++ .../adminapi/controller/member/CashOut.php | 22 + .../app/adminapi/controller/site/Site.php | 88 +- niucloud/app/adminapi/route/diy.php | 79 + niucloud/app/adminapi/route/member.php | 4 + niucloud/app/adminapi/route/site.php | 2 + niucloud/app/api/controller/diy/DiyForm.php | 38 +- niucloud/app/api/controller/login/Login.php | 5 +- .../api/controller/member/CashOutAccount.php | 6 +- niucloud/app/api/controller/member/Member.php | 65 +- .../api/controller/member/MemberCashOut.php | 3 +- niucloud/app/api/controller/sys/Config.php | 2 + niucloud/app/api/controller/upload/Upload.php | 12 + niucloud/app/api/controller/weapp/Weapp.php | 10 +- niucloud/app/api/route/diy.php | 20 +- niucloud/app/api/route/file.php | 17 +- niucloud/app/api/route/member.php | 3 + niucloud/app/common.php | 40 + niucloud/app/dict/diy_form/ComponentDict.php | 1300 +++++++++++++++++ niucloud/app/dict/diy_form/ConfigDict.php | 51 + niucloud/app/dict/diy_form/TemplateDict.php | 785 ++++++++++ niucloud/app/dict/diy_form/TypeDict.php | 70 + .../app/dict/member/MemberCashOutDict.php | 2 + niucloud/app/dict/menu/admin.php | 64 +- niucloud/app/dict/menu/site.php | 339 +++-- niucloud/app/dict/pay/PayChannelDict.php | 10 +- niucloud/app/dict/pay/TransferDict.php | 14 +- niucloud/app/dict/schedule/schedule.php | 12 + niucloud/app/dict/sys/WxOplatform.php | 1 - niucloud/app/event.php | 17 +- niucloud/app/install/source/database.sql | 148 +- niucloud/app/job/sys/ExportJob.php | 2 +- .../app/job/transfer/schedule/CheckFinish.php | 38 + niucloud/app/lang/zh-cn/api.php | 17 +- niucloud/app/lang/zh-cn/dict.php | 7 +- .../DiyFormRecordsExportDataListener.php | 76 + .../DiyFormRecordsExportTypeListener.php | 51 + ...DiyFormRecordsMemberExportDataListener.php | 46 + ...DiyFormRecordsMemberExportTypeListener.php | 34 + niucloud/app/listener/notice/Sms.php | 40 +- .../listener/system/AddSiteAfterListener.php | 41 +- .../app/listener/system/ShowAppListener.php | 54 + niucloud/app/model/diy/DiyTheme.php | 44 + niucloud/app/model/diy_form/DiyForm.php | 196 +++ niucloud/app/model/diy_form/DiyFormFields.php | 159 ++ .../app/model/diy_form/DiyFormRecords.php | 144 ++ .../model/diy_form/DiyFormRecordsFields.php | 218 +++ .../model/diy_form/DiyFormSubmitConfig.php | 61 + .../app/model/diy_form/DiyFormWriteConfig.php | 61 + niucloud/app/model/member/Member.php | 1 + niucloud/app/model/member/MemberCashOut.php | 6 + niucloud/app/model/pay/Transfer.php | 6 + niucloud/app/service/admin/diy/DiyService.php | 112 ++ .../service/admin/diy_form/DiyFormConfig.php | 78 + .../admin/diy_form/DiyFormRecordsService.php | 139 ++ .../service/admin/diy_form/DiyFormService.php | 636 ++++++++ .../admin/install/InstallSystemService.php | 3 +- .../admin/member/MemberCashOutService.php | 26 +- .../admin/member/MemberSignService.php | 11 +- .../service/admin/pay/PayChannelService.php | 4 +- .../app/service/admin/site/SiteService.php | 65 +- .../app/service/admin/sys/AreaService.php | 4 +- .../service/admin/upgrade/UpgradeService.php | 10 +- niucloud/app/service/api/diy/DiyService.php | 36 + .../service/api/diy_form/DiyFormService.php | 320 ++++ .../app/service/api/login/AuthService.php | 25 + .../app/service/api/login/LoginService.php | 129 +- .../app/service/api/login/RegisterService.php | 1 + .../member/MemberCashOutAccountService.php | 2 +- .../api/member/MemberCashOutService.php | 2 +- .../api/member/MemberConfigService.php | 3 +- .../service/api/weapp/WeappAuthService.php | 102 +- .../service/api/wechat/WechatAuthService.php | 38 +- .../core/addon/CoreAddonInstallService.php | 6 - niucloud/app/service/core/addon/WapTrait.php | 120 +- .../app/service/core/diy/CoreDiyService.php | 100 ++ .../diy_form/CoreDiyFormConfigService.php | 315 ++++ .../diy_form/CoreDiyFormRecordsService.php | 238 +++ .../core/member/CoreMemberAccountService.php | 4 +- .../CoreMemberCashOutAccountService.php | 2 +- .../core/member/CoreMemberCashOutService.php | 468 +++--- .../service/core/pay/CorePayEventService.php | 6 +- .../service/core/pay/CoreTransferService.php | 25 +- .../service/core/poster/CorePosterService.php | 6 +- .../app/service/core/site/CoreSiteService.php | 5 +- .../service/core/sys/CoreConfigService.php | 24 +- .../service/core/sys/CoreExportService.php | 11 +- .../core/weapp/CoreWeappCloudService.php | 3 +- niucloud/app/upgrade/v100/Upgrade.php | 103 ++ niucloud/app/upgrade/v100/upgrade.sql | 158 ++ niucloud/app/validate/diy/DiyForm.php | 2 +- niucloud/config/version.php | 4 +- niucloud/core/dict/DiyFormComponent.php | 41 + niucloud/core/dict/DiyFormTemplate.php | 41 + niucloud/core/dict/DiyFormType.php | 41 + niucloud/core/dict/UniappLink.php | 1 + niucloud/core/pay/Wechatpay.php | 90 +- 99 files changed, 7742 insertions(+), 764 deletions(-) create mode 100644 niucloud/app/adminapi/controller/diy/DiyForm.php create mode 100644 niucloud/app/dict/diy_form/ComponentDict.php create mode 100644 niucloud/app/dict/diy_form/ConfigDict.php create mode 100644 niucloud/app/dict/diy_form/TemplateDict.php create mode 100644 niucloud/app/dict/diy_form/TypeDict.php create mode 100644 niucloud/app/job/transfer/schedule/CheckFinish.php create mode 100644 niucloud/app/listener/diy_form_export/DiyFormRecordsExportDataListener.php create mode 100644 niucloud/app/listener/diy_form_export/DiyFormRecordsExportTypeListener.php create mode 100644 niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportDataListener.php create mode 100644 niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportTypeListener.php create mode 100644 niucloud/app/listener/system/ShowAppListener.php create mode 100644 niucloud/app/model/diy/DiyTheme.php create mode 100644 niucloud/app/model/diy_form/DiyForm.php create mode 100644 niucloud/app/model/diy_form/DiyFormFields.php create mode 100644 niucloud/app/model/diy_form/DiyFormRecords.php create mode 100644 niucloud/app/model/diy_form/DiyFormRecordsFields.php create mode 100644 niucloud/app/model/diy_form/DiyFormSubmitConfig.php create mode 100644 niucloud/app/model/diy_form/DiyFormWriteConfig.php create mode 100644 niucloud/app/service/admin/diy_form/DiyFormConfig.php create mode 100644 niucloud/app/service/admin/diy_form/DiyFormRecordsService.php create mode 100644 niucloud/app/service/admin/diy_form/DiyFormService.php create mode 100644 niucloud/app/service/api/diy_form/DiyFormService.php create mode 100644 niucloud/app/service/core/diy/CoreDiyService.php create mode 100644 niucloud/app/service/core/diy_form/CoreDiyFormConfigService.php create mode 100644 niucloud/app/service/core/diy_form/CoreDiyFormRecordsService.php create mode 100644 niucloud/app/upgrade/v100/Upgrade.php create mode 100644 niucloud/app/upgrade/v100/upgrade.sql create mode 100644 niucloud/core/dict/DiyFormComponent.php create mode 100644 niucloud/core/dict/DiyFormTemplate.php create mode 100644 niucloud/core/dict/DiyFormType.php diff --git a/niucloud/app/ExceptionHandle.php b/niucloud/app/ExceptionHandle.php index c768dc9d6..da5eb4900 100644 --- a/niucloud/app/ExceptionHandle.php +++ b/niucloud/app/ExceptionHandle.php @@ -10,6 +10,7 @@ use think\db\exception\ModelNotFoundException; use think\exception\Handle; use think\exception\HttpException; use think\exception\HttpResponseException; +use think\exception\RouteNotFoundException; use think\exception\ValidateException; use think\facade\Log; use think\Response; @@ -92,6 +93,9 @@ class ExceptionHandle extends Handle if (strpos($e->getMessage(), 'open_basedir') !== false) { return fail('OPEN_BASEDIR_ERROR'); } + if (strpos($e->getMessage(), 'Allowed memory size of') !== false) { + return fail('PHP_SCRIPT_RUNNING_OUT_OF_MEMORY'); + } if ($e instanceof DbException) { return fail(get_lang('DATA_GET_FAIL').':'.$e->getMessage(), [ 'file' => $e->getFile(), @@ -108,7 +112,9 @@ class ExceptionHandle extends Handle return fail($e->getMessage(), [], $e->getCode() ?: 400); }else if($e instanceof ServerException){ return fail($e->getMessage(), http_code:$e->getCode()); - }else { + } else if ($e instanceof RouteNotFoundException) { + return fail('当前访问路由未定义或不匹配 路由地址:' . request()->baseUrl()); + } else { return fail($e->getMessage(), $massageData); } } diff --git a/niucloud/app/adminapi/controller/diy/Diy.php b/niucloud/app/adminapi/controller/diy/Diy.php index 4fa291d79..b6f960fd9 100644 --- a/niucloud/app/adminapi/controller/diy/Diy.php +++ b/niucloud/app/adminapi/controller/diy/Diy.php @@ -268,4 +268,41 @@ class Diy extends BaseAdminController $id = ( new DiyService() )->copy($params); return success('ADD_SUCCESS', [ 'id' => $id ]); } + + /** + * 获取自定义主题配色 + * @return Response + */ + public function getDiyTheme() + { + return success(( new DiyService() )->getDiyTheme()); + } + + /** + * 添加主题配色 + * @return Response + */ + public function setDiyTheme() + { + $data = $this->request->params([ + [ 'id', '' ], + [ 'key', '' ], + [ 'mode', '' ], + [ 'color_mark', '' ], + [ 'color_name', '' ], + [ 'diy_value', '' ], + [ 'value', '' ], + ]); + ( new DiyService() )->setDiyTheme($data); + return success('ADD_SUCCESS'); + } + + /** + * 设置主题配色 + * @return Response + */ + public function getDefaultThemeColor() + { + return success(( new DiyService() )->getDefaultThemeColor()); + } } diff --git a/niucloud/app/adminapi/controller/diy/DiyForm.php b/niucloud/app/adminapi/controller/diy/DiyForm.php new file mode 100644 index 000000000..010d10bec --- /dev/null +++ b/niucloud/app/adminapi/controller/diy/DiyForm.php @@ -0,0 +1,370 @@ +request->params([ + [ "title", "" ], + [ "type", "" ], + [ 'addon', '' ] + ]); + return success(( new DiyFormService() )->getPage($data)); + } + + /** + * @notes 获取万能表单列表 + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ + public function lists() + { + $data = $this->request->params([ + [ "title", "" ], + [ 'status', 0 ], + [ "type", "" ], + [ 'addon', '' ] + ]); + return success(( new DiyFormService() )->getList($data)); + } + + /** + * 万能表单详情 + * @param int $id + * @return Response + */ + public function info(int $id) + { + return success(( new DiyFormService() )->getInfo($id)); + } + + /** + * 添加万能表单 + * @return Response + */ + public function add() + { + $data = $this->request->params([ + [ "title", "" ], + [ "page_title", "" ], + [ "type", "" ], + [ "value", [] ], + [ 'template', '' ], + ]); + $this->validate($data, 'app\validate\diy\DiyForm.add'); + $id = ( new DiyFormService() )->add($data); + return success('ADD_SUCCESS', [ 'id' => $id ]); + } + + /** + * 万能表单编辑 + * @param $id + * @return Response + */ + public function edit($id) + { + $data = $this->request->params([ + [ "title", "" ], + [ "page_title", "" ], + [ "value", [] ], + [ 'template', '' ], + ]); + + $this->validate($data, 'app\validate\diy\DiyForm.edit'); + ( new DiyFormService() )->edit($id, $data); + return success('MODIFY_SUCCESS'); + } + + /** + * 万能表单删除 + * @return Response + */ + public function del() + { + $params = $this->request->params([ + [ 'form_ids', [] ] + ]); + ( new DiyFormService() )->del($params[ 'form_ids' ]); + return success('DELETE_SUCCESS'); + } + + /** + * 获取万能表单初始化数据 + * @return Response + * @throws DbException + */ + public function getInit() + { + $params = $this->request->params([ + [ 'form_id', "" ], + [ "type", "" ], + [ "title", "" ], + ]); + $diy_service = new DiyFormService(); + return success($diy_service->getInit($params)); + } + + /** + * 获取万能表单模板 + * @return Response + */ + public function getTemplate() + { + $params = $this->request->params([ + [ 'type', '' ], + [ 'template_key', '' ], + ]); + $diy_service = new DiyFormService(); + return success($diy_service->getTemplate($params)); + } + + /** + * 修改页面分享内容 + * @return Response + */ + public function modifyShare() + { + $data = $this->request->params([ + [ "form_id", "" ], + [ "share", "" ], + ]); + ( new DiyFormService() )->modifyShare($data); + return success('MODIFY_SUCCESS'); + } + + /** + * 获取模板页面(存在的应用插件列表) + * @return Response + */ + public function getApps() + { + return success(( new DiyFormService() )->getApps()); + } + + /** + * 复制模版 todo 靠后 + * @return Response + */ + public function copy() + { + $params = $this->request->params([ + [ 'form_id', '' ], + ]); + $form_id = ( new DiyFormService() )->copy($params); + return success('ADD_SUCCESS', [ 'form_id' => $form_id ]); + } + + /** + * 获取模板页面(存在的应用插件列表) + * @return Response + */ + public function getFormType() + { + return success(( new DiyFormService() )->getFormType()); + } + + /** + * 修改状态 + * @return \think\Response + */ + public function modifyStatus() + { + $data = $this->request->params([ + [ 'form_id', '' ], + [ 'status', 1 ], + ]); + ( new DiyFormService() )->modifyStatus($data); + return success('SUCCESS'); + } + + /** + * 获取使用记录 + * @return Response + */ + public function getRecordPages() + { + $data = $this->request->params([ + [ "form_id", 0 ], + [ "keyword", "" ], + [ "create_time", "" ], + ]); + return success(( new DiyFormService() )->getRecordPages($data)); + } + + /** + * 获取使用记录详情 + * @param int $record_id + * @return Response + */ + public function getRecordInfo(int $record_id) + { + return success(( new DiyFormService() )->getRecordInfo($record_id)); + } + + /** + * 使用记录删除 + * @return Response + */ + public function delRecord() + { + $data = $this->request->params([ + [ "form_id", 0 ], + [ 'record_id', 0 ], + ]); + ( new DiyFormService() )->delRecord($data); + return success('DELETE_SUCCESS'); + } + + /** + * 获取万能表单字段记录 + * @return Response + */ + public function getFieldsList() + { + $data = $this->request->params([ + [ "form_id", 0 ], + [ 'order', '' ], + [ 'sort', '' ] + ]); + return success(( new DiyFormService() )->getFieldsList($data)); + } + + /** + * 获取表单填写配置 + * @param $form_id int 所属万能表单id + * @return Response + */ + public function getWriteConfig($form_id) + { + return success(( new DiyFormConfig() )->getWriteConfig($form_id)); + } + + /** + * 编辑表单填写配置 + * @return Response + */ + public function editWriteConfig() + { + $data = $this->request->params([ + [ 'id', 0 ], + [ 'form_id', 0 ], // 所属万能表单id + [ 'write_way', '' ], // 填写方式,no_limit:不限制,scan:仅限微信扫一扫,url:仅限链接进入 + [ 'join_member_type', '' ], // 参与会员,all_member:所有会员参与,selected_member_level:指定会员等级,selected_member_label:指定会员标签 + [ 'level_ids', [] ], // 会员等级id集合 + [ 'label_ids', [] ], // 会员标签id集合 + [ 'member_write_type', '' ], // 每人可填写次数,no_limit:不限制,diy:自定义 + [ 'member_write_rule', [] ], // 每人可填写次数自定义规则 + [ 'form_write_type', '' ], // 表单可填写数量,no_limit:不限制,diy:自定义 + [ 'form_write_rule', [] ], // 表单可填写总数自定义规则 + [ 'time_limit_type', '' ], // 填写时间限制类型,no_limit:不限制, specify_time:指定开始结束时间,open_day_time:设置每日开启时间 + [ 'time_limit_rule', [] ], // 填写时间限制规则 + [ 'is_allow_update_content', 0 ], // 是否允许修改自己填写的内容,0:否,1:是 + [ 'write_instruction', '' ], // 表单填写须知 + ]); + ( new DiyFormConfig() )->editWriteConfig($data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取表单提交成功 也配置 + * @param $form_id int 所属万能表单id + * @return Response + */ + public function getSubmitConfig($form_id) + { + return success(( new DiyFormConfig() )->getSubmitConfig($form_id)); + } + + /** + * 编辑表单提交成功页配置 + * @return Response + */ + public function editSubmitConfig() + { + $data = $this->request->params([ + [ 'id', 0 ], + [ 'form_id', 0 ], // 所属万能表单id + [ 'submit_after_action', '' ], // 填表人提交后操作,text:文字信息,voucher:核销凭证 + [ 'tips_type', '' ], // 提示内容类型,default:默认提示,diy:自定义提示 + [ 'tips_text', '' ], // 自定义提示内容 + [ 'time_limit_type', [] ], // 核销凭证有效期限制类型,no_limit:不限制,specify_time:指定固定开始结束时间,submission_time:按提交时间设置有效期 + [ 'time_limit_rule', '' ], // 核销凭证时间限制规则,json格式 todo 结构待定 + [ 'voucher_content_rule', [] ], // 核销凭证内容,json格式 todo 结构待定 + [ 'success_after_action', '' ], // 填写成功后续操作 + ]); + ( new DiyFormConfig() )->editSubmitConfig($data); + return success('EDIT_SUCCESS'); + } + + // todo 查询表单详情 + + /** + * 获取万能表单填表人统计列表 + * @return Response + */ + public function memberStatPages() + { + $data = $this->request->params([ + [ "form_id", 0 ], + [ "keyword", '' ], + ]); + return success(( new DiyFormRecordsService() )->getPage($data)); + } + + /** + * 获取万能表单字段统计列表 + * @return Response + */ + public function fieldStatList() + { + $data = $this->request->params([ + [ "form_id", 0 ], + ]); + return success(( new DiyFormRecordsService() )->getFieldStatList($data)); + } + + /** + * 获取万能表单微信小程序二维码 + * @return Response + */ + public function getQrcode() + { + $data = $this->request->params([ + [ "form_id", '' ], + ]); + return success(( new DiyFormService() )->getQrcode($data[ 'form_id' ])); + } + +} diff --git a/niucloud/app/adminapi/controller/member/CashOut.php b/niucloud/app/adminapi/controller/member/CashOut.php index eccb0700a..3c975765f 100644 --- a/niucloud/app/adminapi/controller/member/CashOut.php +++ b/niucloud/app/adminapi/controller/member/CashOut.php @@ -82,6 +82,19 @@ class CashOut extends BaseAdminController return success(); } + /** + * 备注转账信息 + * @param $id + * @return Response + */ + public function remark($id) + { + $data = $this->request->params([ + ['remark', ''], + ]); + (new MemberCashOutService())->remark($id, $data); + return success(); + } /** * 状态 * @return Response @@ -98,4 +111,13 @@ class CashOut extends BaseAdminController { return success((new MemberCashOutService())->stat()); } + + /** + * 校验数组是否 + * @return void + */ + public function checkTransferStatus($id){ + (new MemberCashOutService())->checkTransferStatus($id); + return success(); + } } diff --git a/niucloud/app/adminapi/controller/site/Site.php b/niucloud/app/adminapi/controller/site/Site.php index 0546bbc0b..9980c5fdb 100644 --- a/niucloud/app/adminapi/controller/site/Site.php +++ b/niucloud/app/adminapi/controller/site/Site.php @@ -26,15 +26,15 @@ class Site extends BaseAdminController public function lists() { $data = $this->request->params([ - ['keywords', ''], - ['status', ""], - ['group_id', 0], - ['create_time', []], - ['expire_time', []], - ['app', ''], - ['site_domain', ''] + [ 'keywords', '' ], + [ 'status', "" ], + [ 'group_id', 0 ], + [ 'create_time', [] ], + [ 'expire_time', [] ], + [ 'app', '' ], + [ 'site_domain', '' ] ]); - return success((new SiteService())->getPage($data)); + return success(( new SiteService() )->getPage($data)); } /** @@ -44,7 +44,7 @@ class Site extends BaseAdminController */ public function info(int $id) { - return success((new SiteService())->getInfo($id)); + return success(( new SiteService() )->getInfo($id)); } /** @@ -55,19 +55,19 @@ class Site extends BaseAdminController public function add() { $data = $this->request->params([ - ['site_name', ''], - ['uid', 0], - ['username', ''], - ['real_name', ''], - ['password', ''], - ['group_id', 0], - ['expire_time', 0], - ['site_domain', ''], + [ 'site_name', '' ], + [ 'uid', 0 ], + [ 'username', '' ], + [ 'real_name', '' ], + [ 'password', '' ], + [ 'group_id', 0 ], + [ 'expire_time', 0 ], + [ 'site_domain', '' ], ]); $this->validate($data, 'app\validate\site\Site.add'); - if (empty($data['uid'])) $this->validate($data, 'app\validate\sys\User.add'); - $site_id = (new SiteService())->add($data); - return success('ADD_SUCCESS', ['site_id' => $site_id]); + if (empty($data[ 'uid' ])) $this->validate($data, 'app\validate\sys\User.add'); + $site_id = ( new SiteService() )->add($data); + return success('ADD_SUCCESS', [ 'site_id' => $site_id ]); } /** @@ -85,7 +85,7 @@ class Site extends BaseAdminController */ public function menu() { - return success((new AuthSiteService())->getMenuList(1, 1, 'all', 0)); + return success(( new AuthSiteService() )->getMenuList(1, 1, 'all', 0)); } /** @@ -94,9 +94,9 @@ class Site extends BaseAdminController public function closeSite($id) { $data = $this->request->params([ - ['status', SiteDict::CLOSE], + [ 'status', SiteDict::CLOSE ], ]); - (new SiteService())->edit($id, $data); + ( new SiteService() )->edit($id, $data); return success(); } @@ -106,17 +106,17 @@ class Site extends BaseAdminController public function edit($id) { $data = $this->request->params([ - ['site_name', ''], - ['uid', 0], - ['username', ''], - ['real_name', ''], - ['password', ''], - ['group_id',0], - ['expire_time', 0], - ['site_domain', ''], + [ 'site_name', '' ], + [ 'uid', 0 ], + [ 'username', '' ], + [ 'real_name', '' ], + [ 'password', '' ], + [ 'group_id', 0 ], + [ 'expire_time', 0 ], + [ 'site_domain', '' ], ]); - $this->validate(array_merge($data, ['site_id' => $id]), 'app\validate\site\Site.edit'); - (new SiteService())->edit($id, $data); + $this->validate(array_merge($data, [ 'site_id' => $id ]), 'app\validate\site\Site.edit'); + ( new SiteService() )->edit($id, $data); return success('MODIFY_SUCCESS'); } @@ -125,8 +125,9 @@ class Site extends BaseAdminController * @param $id * @return Response */ - public function del($id) { - (new SiteService())->del($id); + public function del($id) + { + ( new SiteService() )->del($id); return success('DELETE_SUCCESS'); } @@ -136,9 +137,9 @@ class Site extends BaseAdminController public function openSite($id) { $data = $this->request->params([ - ['status', SiteDict::ON], + [ 'status', SiteDict::ON ], ]); - (new SiteService())->edit($id, $data); + ( new SiteService() )->edit($id, $data); return success(); } @@ -151,12 +152,19 @@ class Site extends BaseAdminController * 获取站点拥有的应用 * @return Response */ - public function addons() { + public function addons() + { $data = $this->request->params([ - ['title', ''], + [ 'title', '' ], ]); - $data = (new SiteService())->getSiteAddons($data); + $data = ( new SiteService() )->getSiteAddons($data); return success(data:$data); } + public function showApp() + { + return success(( new SiteService() )->getShowAppTools()); + } + + } diff --git a/niucloud/app/adminapi/route/diy.php b/niucloud/app/adminapi/route/diy.php index d767ec2e1..ec73ea2a0 100644 --- a/niucloud/app/adminapi/route/diy.php +++ b/niucloud/app/adminapi/route/diy.php @@ -84,6 +84,15 @@ Route::group('diy', function() { // 复制模版 Route::post('copy', 'diy.Diy/copy'); + // 获取自定义主题配色 + Route::get('theme', 'diy.Diy/getDiyTheme'); + + // 设置主题配色 + Route::post('theme', 'diy.Diy/setDiyTheme'); + + // 获取默认主题配色 + Route::get('theme/color', 'diy.Diy/getDefaultThemeColor'); + /***************************************************** 配置相关 *****************************************************/ // 底部导航列表 @@ -95,6 +104,76 @@ Route::group('diy', function() { // 设置底部导航 Route::post('bottom', 'diy.Config/setBottomConfig'); + /***************************************************** 万能表单管理 ****************************************************/ + + // 万能表单分页列表 + Route::get('form', 'diy.DiyForm/pages'); + + // 万能表单列表 + Route::get('form/list', 'diy.DiyForm/lists'); + + // 万能表单类型 + Route::get('form/type', 'diy.DiyForm/getFormType'); + + // 添加万能表单 + Route::post('form', 'diy.DiyForm/add'); + + // 编辑万能表单 + Route::put('form/:id', 'diy.DiyForm/edit'); + + // 万能表单详情 + Route::get('form/:id', 'diy.DiyForm/info'); + + // 删除万能表单 + Route::put('form/delete', 'diy.DiyForm/del'); + + // 获取万能表单微信小程序二维码 + Route::get('form/qrcode', 'diy.DiyForm/getQrcode'); + + // 页面初始化数据 + Route::get('form/init', 'diy.DiyForm/getInit'); + + // 获取页面模板 + Route::get('form/template', 'diy.DiyForm/getTemplate'); + + // 获取万能表单填写配置 + Route::get('form/write/:form_id', 'diy.DiyForm/getWriteConfig'); + + // 编辑万能表单填写配置 + Route::put('form/write', 'diy.DiyForm/editWriteConfig'); + + // 获取万能表单填写配置 + Route::get('form/submit/:form_id', 'diy.DiyForm/getSubmitConfig'); + + // 编辑万能表单填写配置 + Route::put('form/submit', 'diy.DiyForm/editSubmitConfig'); + + // 编辑万能表单分享内容 + Route::put('form/share', 'diy.DiyForm/modifyShare'); + + // 复制模版 + Route::post('form/copy', 'diy.DiyForm/copy'); + + // 修改万能表单状态 + Route::put('form/status', 'diy.DiyForm/modifyStatus'); + + //获取填写记录列表 + Route::get('form/records', 'diy.DiyForm/getRecordPages'); + + //获取填写记录详情 + Route::get('form/records/:record_id', 'diy.DiyForm/getRecordInfo'); + + //删除填写记录 + Route::put('form/records/delete', 'diy.DiyForm/delRecord'); + + //获取万能表单字段记录 + Route::get('form/fields/list', 'diy.DiyForm/getFieldsList'); + + //获取填表人统计列表 + Route::get('form/records/member/stat', 'diy.DiyForm/memberStatPages'); + + //获取字段统计列表 + Route::get('form/records/field/stat', 'diy.DiyForm/fieldStatList'); })->middleware([ AdminCheckToken::class, diff --git a/niucloud/app/adminapi/route/member.php b/niucloud/app/adminapi/route/member.php index 8e01bcfef..12314df7f 100644 --- a/niucloud/app/adminapi/route/member.php +++ b/niucloud/app/adminapi/route/member.php @@ -120,6 +120,10 @@ Route::group('member', function() { Route::get('cash_out/:id', 'member.CashOut/info'); //会员提现审核 Route::put('cash_out/audit/:id/:action', 'member.CashOut/audit'); + //会员提现备注 + Route::put('cash_out/remark/:id', 'member.CashOut/remark'); + //校验会员提现转账状态 + Route::put('cash_out/check/:id', 'member.CashOut/checkTransferStatus'); //转账方式 Route::get('cash_out/transfertype', 'member.CashOut/getTransferType'); //转账方式 diff --git a/niucloud/app/adminapi/route/site.php b/niucloud/app/adminapi/route/site.php index a05a6a9ff..4cdd45331 100644 --- a/niucloud/app/adminapi/route/site.php +++ b/niucloud/app/adminapi/route/site.php @@ -87,6 +87,8 @@ Route::group('site', function () { Route::get('account/type', 'site.SiteAccount/accountType'); // 获取店铺包含的插件 Route::get('addons', 'site.Site/addons'); + // 获取应用列表 + Route::get('showapp', 'site.Site/showApp'); })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/api/controller/diy/DiyForm.php b/niucloud/app/api/controller/diy/DiyForm.php index abd870a7d..eb9f08edd 100644 --- a/niucloud/app/api/controller/diy/DiyForm.php +++ b/niucloud/app/api/controller/diy/DiyForm.php @@ -18,17 +18,19 @@ use think\Response; class DiyForm extends BaseApiController { /** - * 系统表单详情 - * @param int $id + * 万能表单详情 * @return Response */ - public function info(int $id) + public function info() { - return success(( new DiyFormService() )->getInfo($id)); + $data = $this->request->params([ + [ 'form_id', '' ], + ]); + return success(( new DiyFormService() )->getInfo($data[ 'form_id' ])); } /** - * 添加使用记录 + * 提交填表记录 * @return Response */ public function addRecord() @@ -38,6 +40,30 @@ class DiyForm extends BaseApiController [ 'value', [] ], [ 'relate_id', '' ], ]); - return success(( new DiyFormService())->addRecord($data)); + return success('SUCCESS', ( new DiyFormService() )->addRecord($data)); + } + + /** + * 获取表单填写结果信息 + * @return Response + */ + public function getResult() + { + $data = $this->request->params([ + [ 'record_id', '' ], + ]); + return success('SUCCESS', ( new DiyFormService() )->getResult($data)); + } + + /** + * 获取表单填写记录 + * @return Response + */ + public function getRecord() + { + $data = $this->request->params([ + [ 'record_id', '' ], + ]); + return success('SUCCESS', ( new DiyFormService() )->getFormRecordInfo($data)); } } diff --git a/niucloud/app/api/controller/login/Login.php b/niucloud/app/api/controller/login/Login.php index ea355839e..3883074bb 100644 --- a/niucloud/app/api/controller/login/Login.php +++ b/niucloud/app/api/controller/login/Login.php @@ -84,10 +84,13 @@ class Login extends BaseController { $data = $this->request->params([ [ 'mobile', '' ], + [ 'nickname', '' ], + [ 'headimg', '' ], + [ 'mobile', '' ] ]); //校验登录注册配置 ( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::MOBILE); - return success(( new LoginService() )->mobile($data[ 'mobile' ])); + return success(( new LoginService() )->mobile($data)); } /** diff --git a/niucloud/app/api/controller/member/CashOutAccount.php b/niucloud/app/api/controller/member/CashOutAccount.php index f2b510c6d..394359cbc 100644 --- a/niucloud/app/api/controller/member/CashOutAccount.php +++ b/niucloud/app/api/controller/member/CashOutAccount.php @@ -57,7 +57,8 @@ class CashOutAccount extends BaseApiController ['account_type', ''], ['bank_name', ''], ['realname', ''], - ['account_no', ''] + ['account_no', ''], + ['transfer_payment_code', ''] ]); $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit'); $id = (new MemberCashOutAccountService())->add($data); @@ -74,7 +75,8 @@ class CashOutAccount extends BaseApiController ['account_type', ''], ['bank_name', ''], ['realname', ''], - ['account_no', ''] + ['account_no', ''], + ['transfer_payment_code', ''] ]); $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit'); (new MemberCashOutAccountService())->edit($account_id, $data); diff --git a/niucloud/app/api/controller/member/Member.php b/niucloud/app/api/controller/member/Member.php index bdb468d06..3f378e4dd 100644 --- a/niucloud/app/api/controller/member/Member.php +++ b/niucloud/app/api/controller/member/Member.php @@ -24,16 +24,18 @@ class Member extends BaseApiController * 会员信息 * @return Response */ - public function info(){ - return success((new MemberService())->getInfo()); + public function info() + { + return success(( new MemberService() )->getInfo()); } /** * 会员中心 * @return Response */ - public function center(){ - return success((new MemberService())->center()); + public function center() + { + return success(( new MemberService() )->center()); } /** @@ -41,14 +43,15 @@ class Member extends BaseApiController * @param $field * @return Response */ - public function modify($field){ + public function modify($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($field, $data['value']); + ( new MemberService() )->modify($field, $data[ 'value' ]); return success('MODIFY_SUCCESS'); } @@ -56,11 +59,12 @@ class Member extends BaseApiController * 编辑会员 * @return Response */ - public function edit(){ + public function edit() + { $data = $this->request->params([ - ['data', []], + [ 'data', [] ], ]); - (new MemberService())->edit($data['data']); + ( new MemberService() )->edit($data[ 'data' ]); return success('MODIFY_SUCCESS'); } @@ -68,32 +72,47 @@ class Member extends BaseApiController * 绑定手机号 * @return Response */ - public function mobile(){ + public function mobile() + { $data = $this->request->params([ - ['mobile', ''], - ['mobile_code', ''], + [ 'mobile', '' ], + [ 'mobile_code', '' ], ]); - return success((new AuthService())->bindMobile($data['mobile'], $data['mobile_code'])); + return success(( new AuthService() )->bindMobile($data[ 'mobile' ], $data[ 'mobile_code' ])); } /** * 会员日志 * @return Response */ - public function log(){ + public function log() + { $data = $this->request->params([ - ['route', ''], - ['params', ''], - ['pre_route', ''] + [ 'route', '' ], + [ 'params', '' ], + [ 'pre_route', '' ] ]); - (new MemberLogService())->log($data); + ( new MemberLogService() )->log($data); return success(); } /** * 获取会员码 */ - public function qrcode(){ - return success((new MemberService())->getQrcode()); + public function qrcode() + { + return success(( new MemberService() )->getQrcode()); + } + + /** + * 获取手机号 + * @return Response + */ + public function getMobile() + { + $data = $this->request->params([ + [ 'mobile_code', '' ], + ]); + return success(( new AuthService() )->getMobile($data[ 'mobile_code' ])); } } diff --git a/niucloud/app/api/controller/member/MemberCashOut.php b/niucloud/app/api/controller/member/MemberCashOut.php index 07feb211e..b0fc996db 100644 --- a/niucloud/app/api/controller/member/MemberCashOut.php +++ b/niucloud/app/api/controller/member/MemberCashOut.php @@ -72,7 +72,8 @@ class MemberCashOut extends BaseApiController [ 'apply_money', 0 ], [ 'account_type', MemberAccountTypeDict::MONEY ], [ 'transfer_type', '' ], - [ 'account_id', 0 ] + [ 'account_id', 0 ], + [ 'transfer_payee', []] ,//收款方信息 ]); $this->validate($data, 'app\validate\member\CashOut.apply'); return success(data:( new MemberCashOutService() )->apply($data)); diff --git a/niucloud/app/api/controller/sys/Config.php b/niucloud/app/api/controller/sys/Config.php index bd25d902c..5ca44483e 100644 --- a/niucloud/app/api/controller/sys/Config.php +++ b/niucloud/app/api/controller/sys/Config.php @@ -12,6 +12,7 @@ namespace app\api\controller\sys; use app\service\api\diy\DiyConfigService; +use app\service\api\diy\DiyService; use app\service\api\member\MemberConfigService; use app\service\api\member\MemberLevelService; use app\service\api\member\MemberService; @@ -87,6 +88,7 @@ class Config extends BaseApiController $res[ 'site_info' ] = ( new SiteService() )->getSiteCache(); $res[ 'member_level' ] = ( new MemberLevelService() )->getList(); $res[ 'login_config' ] = ( new MemberConfigService() )->getLoginConfig($data[ 'url' ]); + $res[ 'theme_list' ] = ( new DiyService() )->getDiyTheme(); ( new MemberService() )->initMemberData(); diff --git a/niucloud/app/api/controller/upload/Upload.php b/niucloud/app/api/controller/upload/Upload.php index 4b7f1c646..d21f37fb5 100644 --- a/niucloud/app/api/controller/upload/Upload.php +++ b/niucloud/app/api/controller/upload/Upload.php @@ -32,6 +32,18 @@ class Upload extends BaseApiController return success($upload_service->image($data['file'])); } + /** + * 视频上传 + * @return Response + */ + public function video(){ + $data = $this->request->params([ + ['file', 'file'], + ]); + $upload_service = new UploadService(); + return success($upload_service->video($data['file'])); + } + /** * 远程图片拉取 * @return Response diff --git a/niucloud/app/api/controller/weapp/Weapp.php b/niucloud/app/api/controller/weapp/Weapp.php index fcf515789..74249daea 100644 --- a/niucloud/app/api/controller/weapp/Weapp.php +++ b/niucloud/app/api/controller/weapp/Weapp.php @@ -26,9 +26,15 @@ class Weapp extends BaseApiController */ public function login() { - $data = $this->request->params([ [ 'code', '' ] ]); + $data = $this->request->params([ + [ 'code', '' ], + [ 'nickname', '' ], + [ 'headimg', '' ], + [ 'mobile', '' ], + [ 'mobile_code', '' ] + ]); $weapp_auth_service = new WeappAuthService(); - return success($weapp_auth_service->login($data[ 'code' ])); + return success($weapp_auth_service->login($data)); } /** diff --git a/niucloud/app/api/route/diy.php b/niucloud/app/api/route/diy.php index eefc90195..b3679dfcb 100644 --- a/niucloud/app/api/route/diy.php +++ b/niucloud/app/api/route/diy.php @@ -28,20 +28,26 @@ Route::group('diy', function() { Route::get('share', 'diy.Diy/share'); + // 万能表单详情 + Route::get('form', 'diy.DiyForm/info'); + })->middleware(ApiLog::class) ->middleware(ApiCheckToken::class, false); - /** - * 自定义页面 + * 自定义表单 */ Route::group('diy', function() { - // 系统表单详情 - Route::get('form/:id', 'diy.DiyForm/info'); - //添加使用记录 - Route::post('form/records', 'diy.DiyForm/addRecord'); + // 提交填表记录 + Route::post('form/record', 'diy.DiyForm/addRecord'); + + // 获取表单填写结果信息 + Route::get('form/result', 'diy.DiyForm/getResult'); + + // 获取填表记录 + Route::get('form/record', 'diy.DiyForm/getRecord'); })->middleware(ApiLog::class) - ->middleware(ApiCheckToken::class,true); + ->middleware(ApiCheckToken::class, true); diff --git a/niucloud/app/api/route/file.php b/niucloud/app/api/route/file.php index ba77c2f15..d8f35fb04 100644 --- a/niucloud/app/api/route/file.php +++ b/niucloud/app/api/route/file.php @@ -18,16 +18,27 @@ use think\facade\Route; /** * 会员个人信息管理 */ -Route::group('file', function () { +Route::group('file', function() { /***************************************************** 会员管理 ****************************************************/ //上传图片 Route::post('image', 'upload.Upload/image'); + //上传视频 + Route::post('video', 'upload.Upload/video'); //拉取图片 Route::post('image/fetch', 'upload.Upload/imageFetch'); + +})->middleware(ApiChannel::class) + ->middleware(ApiCheckToken::class, true) + ->middleware(ApiLog::class); + +/** + * 会员个人信息管理 + */ +Route::group('file', function() { + //base64图片 Route::post('image/base64', 'upload.Upload/imageBase64'); })->middleware(ApiChannel::class) - ->middleware(ApiCheckToken::class, true) - ->middleware(ApiLog::class); \ No newline at end of file + ->middleware(ApiLog::class); diff --git a/niucloud/app/api/route/member.php b/niucloud/app/api/route/member.php index 83e7fb005..b88ac5cbf 100644 --- a/niucloud/app/api/route/member.php +++ b/niucloud/app/api/route/member.php @@ -116,6 +116,9 @@ Route::group('member', function () { //会员日志 Route::post('log', 'member.Member/log'); + // 获取手机号 + Route::put('getMobile', 'member.Member/getMobile'); + /***************************************************** 会员等级 **************************************************/ Route::get('level', 'member.Level/lists'); })->middleware(ApiChannel::class) diff --git a/niucloud/app/common.php b/niucloud/app/common.php index 377b68629..914c9802e 100644 --- a/niucloud/app/common.php +++ b/niucloud/app/common.php @@ -978,3 +978,43 @@ function is_special_character($str) return false; } } + +/** + * 时间格式转换 + * @param $time + * @return string + */ +function get_last_time($time = null) +{ + $text = ''; + $time = $time === null || $time > time() ? time() : intval($time); + $t = time() - $time; //时间差 (秒) + $y = date('Y', $time) - date('Y', time());//是否跨年 + switch ($t) { + case 0: + $text = '刚刚'; + break; + case $t < 60: + $text = $t . '秒前'; // 一分钟内 + break; + case $t < 60 * 60: + $text = floor($t / 60) . '分钟前'; //一小时内 + break; + case $t < 60 * 60 * 24: + $text = floor($t / ( 60 * 60 )) . '小时前'; // 一天内 + break; + case $t < 60 * 60 * 24 * 3: + $text = floor($time / ( 60 * 60 * 24 )) == 1 ? '昨天' . date('H:i', $time) : '前天' . date('H:i', $time); //昨天和前天 + break; + case $t < 60 * 60 * 24 * 30: + $text = date('m-d H:i', $time); //一个月内 + break; + case $t < 60 * 60 * 24 * 365 && $y == 0: + $text = date('m-d', $time); //一年内 + break; + default: + $text = date('Y-m-d', $time); //一年以前 + break; + } + return $text; +} diff --git a/niucloud/app/dict/diy_form/ComponentDict.php b/niucloud/app/dict/diy_form/ComponentDict.php new file mode 100644 index 000000000..db3cc0580 --- /dev/null +++ b/niucloud/app/dict/diy_form/ComponentDict.php @@ -0,0 +1,1300 @@ + [ + 'title' => get_lang('dict_diy_form.component_type_form'), + 'support' => [], // 支持的插件 + 'list' => [ + 'FormSubmit' => [ + 'title' => '表单提交', + 'icon' => 'iconfont icona-biaodantijiaopc30', + 'path' => 'edit-form-submit', // 编辑组件属性名称 + 'uses' => 1, // 最大添加数量 + 'support' => [], // 支持的表单类型 + 'sort' => 10001, + 'position' => 'bottom_fixed', // 组件置顶标识,不能拖拽,可选值:fixed、top_fixed、right_fixed、bottom_fixed、left_fixed + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 50,// 元素上圆角 + "bottomElementRounded" => 50, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 0, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + /* + * 按钮位置 + * follow_content:跟随内容(当表单内容多时,需要滚动到页面最底部才会展示提交按钮,适合必填项比较多的情况使用) + * hover_screen_bottom:悬浮屏幕底部(提交按钮悬浮在屏幕底部,方便填表人快速提交) + */ + 'btnPosition' => 'follow_content', + // 提交按钮 + 'submitBtn' => [ + 'text' => '提交', // 按钮文本内容 + 'color' => '#ffffff', // 文字颜色 + 'bgColor' => '#409EFF', // 背景色 + ], + // 重置按钮 + 'resetBtn' => [ + 'control' => true, // 是否展示开关 + 'text' => '重置', // 按钮文本内容 + 'color' => '', // 文字颜色 + 'bgColor' => '', // 背景色 + ], + ] + ], + 'FormInput' => [ + 'title' => '单行文本', + 'icon' => 'iconfont icona-danhangwenben-1pc30', + 'path' => 'edit-form-input', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10002, + 'position' => '', // 组件置顶标识,不能拖拽,可选值:fixed、top_fixed、right_fixed、bottom_fixed、left_fixed + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '单行文本', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 +// 'detailComponent' => '/src/app/views/diy_form/components/detail-form-render.vue', // 用于详情展示,后台会返回默认,特殊组件可以重写组件 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + ] + ], + 'FormTextarea' => [ + 'title' => '多行文本', + 'icon' => 'iconfont icona-duohangwenben-1pc30', + 'path' => 'edit-form-textarea', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10003, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '多行文本', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + "rowCount" => 4, // 显示行数 + ] + ], + 'FormNumber' => [ + 'title' => '数字', + 'icon' => 'iconfont icona-shuzipc30-1', + 'path' => 'edit-form-number', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10004, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '数字', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + 'unit' => '', // 单位,最多8位数 + 'formatLimit' => [], // 格式限制,support_negative_number:支持输入负数,number_scope:限制填写范围,support_decimal:支持输入小数(多选) + 'numberScope' => [ + 'min' => 0, + 'max' => 0 + ] + ] + ], + 'FormRadio' => [ + 'title' => '单选项', + 'icon' => 'iconfont icona-duihaopc30', + 'path' => 'edit-form-radio', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10005, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '单选项', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => [], // 默认值 存储数据类型不同,各组件自行处理 + 'value' => [], // 字段值 存储数据类型不同,各组件自行处理 + ], + "fontSize" => 14, + "fontWeight" => "normal", + 'style' => 'style-1', // 展示样式 style-1:默认,list:列表,style-3:下拉选择 + 'options' => [ + [ + 'id' => unique_random(12), // 唯一值,用于排序 + 'text' => '选项1' + ], + [ + 'id' => unique_random(12), // 唯一值,用于排序 + 'text' => '选项2' + ], + ], + // 逻辑规则 + 'logicalRule' => [ + [ + 'triggerOptionId' => '', // 触发单选项id + // 执行事件,存储组件对象 + 'execEvent' => [ + [ + 'id' => '', // 组件唯一id,例如:5fu1fk9c6cs0 + 'componentName' => '', // 组件标识,例如:FormInput + 'componentTitle' => '', // 组件名称,例如:单行文本 + ] + ], + ] + ] + ], + // 渲染值 + 'render' => function($data) { + if (!empty($data)) { + $data = json_decode($data, true); + if (!empty($data)) { + return $data[ 0 ][ 'text' ]; + } + } + return ''; + }, + // 转换类型 + 'convert' => function($data) { + $data = json_decode($data, true); + return $data; + } + ], + 'FormCheckbox' => [ + 'title' => '多选项', + 'icon' => 'iconfont icona-duoxuanxiangpc301', + 'path' => 'edit-form-checkbox', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10006, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + 'field' => [ + 'name' => '多选项', // 字段名称 + // 字段说明,可以修改颜色、大小,【表单的公共属性,考虑在 template中定义】 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => [], // 默认值 存储数据类型不同,各组件自行处理 + 'value' => [], // 字段值 存储数据类型不同,各组件自行处理 + ], + "fontSize" => 14, + "fontWeight" => "normal", + 'style' => 'style-1', // 展示样式 style-1:默认,style-2:列表,style-3:下拉选择 + 'options' => [ + [ + 'id' => unique_random(12), // 唯一值,用于排序 + 'text' => '选项1' + ], + [ + 'id' => unique_random(12), // 唯一值,用于排序 + 'text' => '选项2' + ], + ], + // 可选数量 + 'selectableNum' => [ + 'min' => 0, // 最少选择 N 项 + 'max' => 0 // 最多选择 N 项 + ] + ], + // 渲染值 + 'render' => function($data) { + if (!empty($data)) { + $data = json_decode($data, true); + $value = []; + foreach ($data as $k => $v) { + $value[] = $v[ 'text' ]; + } + return implode(',', $value); + } + return ''; + }, + // 转换类型 + 'convert' => function($data) { + $data = json_decode($data, true); + return $data; + } + ], + // 'FormWechatName' => [ + // 'title' => '微信名', + // 'icon' => 'iconfont iconbiaotipc', + // 'path' => 'edit-form-wechat-name', // 编辑组件属性名称 + // 'uses' => 1, // 最大添加数量 + // 'sort' => 10007, + // // 组件属性 + // 'template' => [ + // "textColor" => "#303133", // 文字颜色 + // 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + // 'pageEndBgColor' => '', // 底部背景颜色(结束) + // 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + // 'componentBgUrl' => '', // 组件背景图片 + // 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + // "componentStartBgColor" => '', // 组件背景颜色(开始) + // "componentEndBgColor" => '', // 组件背景颜色(结束) + // "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + // "topRounded" => 0, // 组件上圆角 + // "bottomRounded" => 0, // 组件下圆角 + // "elementBgColor" => '', // 元素背景颜色 + // "topElementRounded" => 0,// 元素上圆角 + // "bottomElementRounded" => 0, // 元素下圆角 + // "margin" => [ + // "top" => 10, // 上边距 + // "bottom" => 10, // 下边距 + // "both" => 10 // 左右边距 + // ], + // ], + // 'value' => [ + // // 表单的公共属性 + // 'field' => [ + // 'name' => '微信名', // 字段名称 + // // 字段说明,支持修改颜色、大小 + // 'remark' => [ + // 'text' => '', + // 'color' => '#999999', + // "fontSize" => 14, + // ], + // 'required' => false, // 是否必填 true:是,false:否 + // 'unique' => false, // 内容不可重复提交 true:是,false:否 + // 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + // 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + // 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + // ], + // "fontSize" => 14, + // "fontWeight" => "normal", + // ] + // ], + 'FormMobile' => [ + 'title' => '手机号', + 'icon' => 'iconfont icona-shoujipc30', + 'path' => 'edit-form-mobile', // 编辑组件属性名称 + 'uses' => 1, // 最大添加数量 + 'sort' => 10008, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '手机号', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + ] + ], + 'FormEmail' => [ + 'title' => '邮箱', + 'icon' => 'iconfont icona-youxiangpc30', + 'path' => 'edit-form-email', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10009, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '邮箱', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + ] + ], + 'FormIdentity' => [ + 'title' => '身份证号', + 'icon' => 'iconfont icona-shenfenzhengpc30', + 'path' => 'edit-form-identity', // 编辑组件属性名称 + 'uses' => 1, // 最大添加数量 + 'sort' => 10010, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '身份证号', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + ] + ], + // 'FormTable' => [ + // 'title' => '表格', + // 'icon' => 'iconfont iconbiaotipc', + // 'path' => 'edit-form-table', // 编辑组件属性名称 + // 'uses' => 0, // 最大添加数量 + // 'sort' => 10011, + // // 组件属性 + // 'template' => [ + // "textColor" => "#303133", // 文字颜色 + // 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + // 'pageEndBgColor' => '', // 底部背景颜色(结束) + // 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + // 'componentBgUrl' => '', // 组件背景图片 + // 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + // "componentStartBgColor" => '', // 组件背景颜色(开始) + // "componentEndBgColor" => '', // 组件背景颜色(结束) + // "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + // "topRounded" => 0, // 组件上圆角 + // "bottomRounded" => 0, // 组件下圆角 + // "elementBgColor" => '', // 元素背景颜色 + // "topElementRounded" => 0,// 元素上圆角 + // "bottomElementRounded" => 0, // 元素下圆角 + // "margin" => [ + // "top" => 10, // 上边距 + // "bottom" => 10, // 下边距 + // "both" => 10 // 左右边距 + // ], + // ], + // 'value' => [ + // // 表单的公共属性 + // 'field' => [ + // 'name' => '表格', // 字段名称 + // // 字段说明,支持修改颜色、大小 + // 'remark' => [ + // 'text' => '', + // 'color' => '#999999', + // "fontSize" => 14, + // ], + // 'required' => false, // 是否必填 true:是,false:否 + // 'unique' => false, // 内容不可重复提交 true:是,false:否 + // 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + // 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 'detailComponent' => '/src/app/views/diy_form/components/detail-form-table.vue', // 用于详情展示 + // 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + // 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + // ], + // "fontSize" => 14, + // "fontWeight" => "normal", + // // 列设置 + // 'columnList' => [ + // [ + // 'id' => '', // 唯一值,用于排序 + // 'type' => 'text', // 类型,text:文本,number:数字,radio:单选项,checkbox:多选项,todo,不同类型,结构也不一样,这个组件要在前端处理 + // 'name' => '', // 字段名称 + // 'value' => '选项1' // 字段值 + // ], + // ], + // 'autoIncrementControl' => false, // 是否开启自增(展示按钮),添加多个 + // // 填写限制(开启自增才展示) + // 'writeLimit' => [ + // 'default' => 2, // 默认展示 N 项 + // 'min' => 0, // 最少填写 N 项 + // 'max' => 0 // 最多填写 N 项 + // ], + // 'btnText' => '新增一组' + // ] + // ], + 'FormDate' => [ + 'title' => '日期', + 'icon' => 'iconfont icona-riqipc30', + 'path' => 'edit-form-date', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10012, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '日期', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => [ // 默认值 存储数据类型不同,各组件自行处理 + 'date' => '', // 例:2024-12-27 + 'timestamp' => 0, // 例:1735290511 + ], + 'value' => [ // 字段值 存储数据类型不同,各组件自行处理 + 'date' => '', // 例:2024-12-27 + 'timestamp' => 0, // 例:1735290511 + ] + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + 'dateFormat' => 'YYYY年M月D日', // 日期格式,YYYY年M月D日、YYYY-MM-DD、YYYY/MM/DD、YYYY-MM-DD HH:mm、HH:mm + 'dateWay' => "current", // 默认值方式,current:当前日期,diy:指定日期 todo 在做的过程中可能会再调整字段名称 + 'defaultControl' => true, + ], + // 渲染值 + 'render' => function($data) { + if (!empty($data)) { + $data = json_decode($data, true); + return "{$data['date']}"; + } + return ''; + }, + // 转换类型 + 'convert' => function($data) { + $data = json_decode($data, true); + return $data; + } + ], + 'FormDateScope' => [ + 'title' => '日期范围', + 'icon' => 'iconfont icona-riqifanweipc30', + 'path' => 'edit-form-date-scope', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10013, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + 'field' => [ + 'name' => '日期范围', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 默认值 存储数据类型不同,各组件自行处理 + 'default' => [ + // todo 在做的过程中可能会再调整字段名称 + 'start' => [ + 'date' => '', // 例:2024-12-27 + 'timestamp' => 0, // 例:1735290511 + ], + 'end' => [ + 'date' => '', // 例:2025-01-03 + 'timestamp' => 0, // 例:1735895311 + ], + ], + // 字段值 存储数据类型不同,各组件自行处理 + 'value' => [ + 'start' => [ + 'date' => '', // 例:2024-12-27 + 'timestamp' => 0, // 例:1735290511 + ], + 'end' => [ + 'date' => '', // 例:2025-01-03 + 'timestamp' => 0, // 例:1735895311 + ], + ], + ], + "fontSize" => 14, + "fontWeight" => "normal", + 'dateFormat' => 'YYYY年M月D日', // 日期格式,YYYY年M月D日、YYYY-MM-DD、YYYY/MM/DD、YYYY-MM-DD HH:mm + 'start' => [ + 'placeholder' => '请选择起始日期', + 'dateWay' => "current", // 默认值方式,current:当前日期,diy:指定日期 todo 在做的过程中可能会再调整字段名称 + 'defaultControl' => true, + ], + 'end' => [ + 'placeholder' => '请选择结束日期', + 'dateWay' => "current", // 默认值方式,current:当前日期,diy:指定日期 todo 在做的过程中可能会再调整字段名称 + 'defaultControl' => true, + ], + ], + // 渲染值 + 'render' => function($data) { + if (!empty($data)) { + $data = json_decode($data, true); + return "{$data['start']['date']}-{$data['end']['date']}"; + } + return ''; + }, + // 转换类型 + 'convert' => function($data) { + $data = json_decode($data, true); + return $data; + } + ], + 'FormTime' => [ + 'title' => '时间', + 'icon' => 'iconfont icona-shijianpc30-1', + 'path' => 'edit-form-time', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10014, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '时间', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + ], + 'placeholder' => '请输入', // 提示语 + "fontSize" => 14, + "fontWeight" => "normal", + 'timeWay' => "current", // 默认值方式,current:当前时间,diy:指定时间 todo 在做的过程中可能会再调整字段名称 + 'defaultControl' => true, + ] + ], + 'FormTimeScope' => [ + 'title' => '时间范围', + 'icon' => 'iconfont icona-shijianfanweipc30', + 'path' => 'edit-form-time-scope', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10015, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + 'field' => [ + 'name' => '时间范围', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 默认值 存储数据类型不同,各组件自行处理 + 'default' => [ + 'start' => [ + 'date' => '', // 例:09:00 + 'timestamp' => 0, // 例:32400 + ], + 'end' => [ + 'date' => '', // 例:18:30 + 'timestamp' => 0, // 66600 + ] + ], + // 字段值 存储数据类型不同,各组件自行处理 + 'value' => [ + 'start' => [ + 'date' => '', // 例:09:00 + 'timestamp' => 0, // 例:32400 + ], + 'end' => [ + 'date' => '', // 例:18:30 + 'timestamp' => 0, // 66600 + ] + ] + ], + "fontSize" => 14, + "fontWeight" => "normal", + 'start' => [ + 'placeholder' => '请选择起始时间', + 'timeWay' => "current", // 默认值方式,current:当前时间,diy:指定时间 todo 在做的过程中可能会再调整字段名称 + 'defaultControl' => true, + ], + 'end' => [ + 'placeholder' => '请选择结束时间', + 'timeWay' => "current", // 默认值方式,current:当前时间,diy:指定时间 todo 在做的过程中可能会再调整字段名称 + 'defaultControl' => true, + ], + ], + // 渲染值 + 'render' => function($data) { + if (!empty($data)) { + $data = json_decode($data, true); + return "{$data['start']['date']}-{$data['end']['date']}"; + } + return ''; + }, + // 转换类型 + 'convert' => function($data) { + $data = json_decode($data, true); + return $data; + } + ], + // 'FormLocation' => [ + // 'title' => '定位', + // 'icon' => 'iconfont iconbiaotipc', + // 'path' => 'edit-form-location', // 编辑组件属性名称 + // 'uses' => 1, // 最大添加数量 + // 'sort' => 10016, + // // 组件属性 + // 'template' => [ + // "textColor" => "#303133", // 文字颜色 + // 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + // 'pageEndBgColor' => '', // 底部背景颜色(结束) + // 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + // 'componentBgUrl' => '', // 组件背景图片 + // 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + // "componentStartBgColor" => '', // 组件背景颜色(开始) + // "componentEndBgColor" => '', // 组件背景颜色(结束) + // "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + // "topRounded" => 0, // 组件上圆角 + // "bottomRounded" => 0, // 组件下圆角 + // "elementBgColor" => '', // 元素背景颜色 + // "topElementRounded" => 0,// 元素上圆角 + // "bottomElementRounded" => 0, // 元素下圆角 + // "margin" => [ + // "top" => 10, // 上边距 + // "bottom" => 10, // 下边距 + // "both" => 10 // 左右边距 + // ], + // ], + // 'value' => [ + // // 表单的公共属性 + // 'field' => [ + // 'name' => '定位', // 字段名称 + // // 字段说明,支持修改颜色、大小 + // 'remark' => [ + // 'text' => '', + // 'color' => '#999999', + // "fontSize" => 14, + // ], + // 'required' => false, // 是否必填 true:是,false:否 + // 'unique' => false, // 内容不可重复提交 true:是,false:否 + // 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + // 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + // 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + // ], + // 'placeholder' => '请输入', // 提示语 + // "fontSize" => 14, + // "fontWeight" => "normal", + // 'mode' => 'authorized_wechat_location', // 获取方式,authorized_wechat_location:授权微信定位,open_choose_location:手动选择定位 + // ] + // ], + // 'FormAddress' => [ + // 'title' => '地址', + // 'icon' => 'iconfont iconbiaotipc', + // 'path' => 'edit-form-address', // 编辑组件属性名称 + // 'uses' => 0, // 最大添加数量 + // 'sort' => 10017, + // // 组件属性 + // 'template' => [ + // "textColor" => "#303133", // 文字颜色 + // 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + // 'pageEndBgColor' => '', // 底部背景颜色(结束) + // 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + // 'componentBgUrl' => '', // 组件背景图片 + // 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + // "componentStartBgColor" => '', // 组件背景颜色(开始) + // "componentEndBgColor" => '', // 组件背景颜色(结束) + // "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + // "topRounded" => 0, // 组件上圆角 + // "bottomRounded" => 0, // 组件下圆角 + // "elementBgColor" => '', // 元素背景颜色 + // "topElementRounded" => 0,// 元素上圆角 + // "bottomElementRounded" => 0, // 元素下圆角 + // "margin" => [ + // "top" => 10, // 上边距 + // "bottom" => 10, // 下边距 + // "both" => 10 // 左右边距 + // ], + // ], + // 'value' => [ + // // 表单的公共属性 + // 'field' => [ + // 'name' => '地址', // 字段名称 + // // 字段说明,支持修改颜色、大小 + // 'remark' => [ + // 'text' => '', + // 'color' => '#999999', + // "fontSize" => 14, + // ], + // 'required' => false, // 是否必填 true:是,false:否 + // 'unique' => false, // 内容不可重复提交 true:是,false:否 + // 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + // 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 todo 设置默认省/市/区/街道 + // 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + // ], + // 'placeholder' => '请输入', // 提示语 + // "fontSize" => 14, + // "fontWeight" => "normal", + // 'addressFormat' => 'province/city/district/address', // 地址格式 + // ] + // ], + 'FormImage' => [ + 'title' => '图片', + 'icon' => 'iconfont icona-tupianpc30', + 'path' => 'edit-form-image', // 编辑组件属性名称 + 'uses' => 0, // 最大添加数量 + 'sort' => 10018, + // 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 8, // 上边距 + "bottom" => 8, // 下边距 + "both" => 10 // 左右边距 + ], + ], + 'value' => [ + // 表单的公共属性 + 'field' => [ + 'name' => '图片', // 字段名称 + // 字段说明,支持修改颜色、大小 + 'remark' => [ + 'text' => '', + 'color' => '#999999', + "fontSize" => 14, + ], + 'required' => false, // 是否必填 true:是,false:否 + 'unique' => false, // 内容不可重复提交 true:是,false:否 + 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + 'detailComponent' => '/src/app/views/diy_form/components/detail-form-image.vue', // 用于详情展示 + 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + 'value' => [], // 字段值 存储数据类型不同,各组件自行处理 + ], + "fontSize" => 14, + "fontWeight" => "normal", + /** + * 上传方式 + * select_from_album:从相册选择 + * take_pictures:拍照上传(可用于防作假) + * 请选择拍照方式:快速拍照模式(支持连拍,支持闪光灯拍照)、微信拍照模式(每次只能拍摄1张) + * is_album_upload 相册 + * is_photo_upload 拍照 + * is_chat_upload 微信 + * open_continuous 开放的连续 + */ + // 'uploadMode' => [ 'take_pictures', 'select_from_album' ], // 上传方式 + 'uploadMode' => [ 'take_pictures', 'select_from_album' ], // 上传方式 + 'limit' => 9, // 限制上传数量 + ], + // 渲染值 + 'render' => function($data) { + if (!empty($data)) { + $data = json_decode($data, true); + $value = []; + foreach ($data as $k => $v) { + $value[] = str_starts_with($v, 'http') ? $v : request()->domain() . '/' . $v; + } + return implode(',', $value); + } + return ''; + }, + // 转换类型 + 'convert' => function($data) { + $data = json_decode($data, true); + return $data; + } + ], + // 'FormVideo' => [ + // 'title' => '视频', + // 'icon' => 'iconfont iconbiaotipc', + // 'path' => 'edit-form-video', // 编辑组件属性名称 + // 'uses' => 0, // 最大添加数量 + // 'sort' => 10019, + // // 组件属性 + // 'template' => [ + // "textColor" => "#303133", // 文字颜色 + // 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + // 'pageEndBgColor' => '', // 底部背景颜色(结束) + // 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + // 'componentBgUrl' => '', // 组件背景图片 + // 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + // "componentStartBgColor" => '', // 组件背景颜色(开始) + // "componentEndBgColor" => '', // 组件背景颜色(结束) + // "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + // "topRounded" => 0, // 组件上圆角 + // "bottomRounded" => 0, // 组件下圆角 + // "elementBgColor" => '', // 元素背景颜色 + // "topElementRounded" => 0,// 元素上圆角 + // "bottomElementRounded" => 0, // 元素下圆角 + // "margin" => [ + // "top" => 10, // 上边距 + // "bottom" => 10, // 下边距 + // "both" => 10 // 左右边距 + // ], + // ], + // 'value' => [ + // // 表单的公共属性 + // 'field' => [ + // 'name' => '视频', // 字段名称 + // // 字段说明,支持修改颜色、大小 + // 'remark' => [ + // 'text' => '', + // 'color' => '#999999', + // "fontSize" => 14, + // ], + // 'required' => false, // 是否必填 true:是,false:否 + // 'unique' => false, // 内容不可重复提交 true:是,false:否 + // 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + // 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 'detailComponent' => '/src/app/views/diy_form/components/detail-form-video.vue', // 用于详情展示 + // 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + // 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + // ], + // "fontSize" => 14, + // "fontWeight" => "normal", + // /** + // * 上传方式 + // * shoot_and_album:拍摄和相册 + // * shoot_only:只允许拍摄 + // */ + // 'uploadMode' => 'shoot_and_album', // 上传方式 + // ] + // ], + // 'FormFile' => [ + // 'title' => '文件', + // 'icon' => 'iconfont iconbiaotipc', + // 'path' => 'edit-form-file', // 编辑组件属性名称 + // 'uses' => 0, // 最大添加数量 + // 'sort' => 10020, + // // 组件属性 + // 'template' => [ + // "textColor" => "#303133", // 文字颜色 + // 'pageStartBgColor' => '#FFFFFF', // 底部背景颜色(开始) + // 'pageEndBgColor' => '', // 底部背景颜色(结束) + // 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + // 'componentBgUrl' => '', // 组件背景图片 + // 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + // "componentStartBgColor" => '', // 组件背景颜色(开始) + // "componentEndBgColor" => '', // 组件背景颜色(结束) + // "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + // "topRounded" => 0, // 组件上圆角 + // "bottomRounded" => 0, // 组件下圆角 + // "elementBgColor" => '', // 元素背景颜色 + // "topElementRounded" => 0,// 元素上圆角 + // "bottomElementRounded" => 0, // 元素下圆角 + // "margin" => [ + // "top" => 10, // 上边距 + // "bottom" => 10, // 下边距 + // "both" => 10 // 左右边距 + // ], + // ], + // 'value' => [ + // // 表单的公共属性 + // 'field' => [ + // 'name' => '文件', // 字段名称 + // // 字段说明,支持修改颜色、大小 + // 'remark' => [ + // 'text' => '', + // 'color' => '#999999', + // "fontSize" => 14, + // ], + // 'required' => false, // 是否必填 true:是,false:否 + // 'unique' => false, // 内容不可重复提交 true:是,false:否 + // 'autofill' => false, // 自动填充上次填写的内容 true:开启,false:关闭 + // 'privacyProtection' => false, // 隐私保护 true:开启,false:关闭,隐藏逻辑各组件自行处理 + // 'detailComponent' => '/src/app/views/diy_form/components/detail-form-file.vue', // 用于详情展示 + // 'default' => '', // 默认值 存储数据类型不同,各组件自行处理 + // 'value' => '', // 字段值 存储数据类型不同,各组件自行处理 + // ], + // "fontSize" => 14, + // "fontWeight" => "normal", + // 'limitUploadSize' => 30720, // 限制上传大小,30MB + // ] + // ], + ], + ], + ]; + $list = ( new DictLoader("DiyFormComponent") )->load($system_components); + if (!empty($params[ 'component_name' ])) { + $component = []; + foreach ($list as $k => $v) { + $is_ok = false; + foreach ($v[ 'list' ] as $ck => $cv) { + if ($ck == $params[ 'component_name' ]) { + $is_ok = true; + $component = $cv; + break; + } + } + if ($is_ok) { + break; + } + } + return $component; + } else { + return $list; + } + } + +} diff --git a/niucloud/app/dict/diy_form/ConfigDict.php b/niucloud/app/dict/diy_form/ConfigDict.php new file mode 100644 index 000000000..da8491b92 --- /dev/null +++ b/niucloud/app/dict/diy_form/ConfigDict.php @@ -0,0 +1,51 @@ +load([]); + $template = self::template(); + $data = array_merge($other_template_data, $template); + if (!empty($params) && !empty($params[ 'type' ])) { + if (!empty($params[ 'template_key' ])) { + return $data[ $params[ 'type' ] ][ $params[ 'template_key' ] ] ?? []; + } + return $data[ $params[ 'type' ] ] ?? []; + } + + return $data; + } + + public static function template() + { + $data = [ + "DIY_FORM" => [ + 'active_sign_up' => [ // 页面标识 + "title" => "活动报名", // 页面名称 + 'cover' => '', // 页面封面图 + 'preview' => '', // 页面预览图 + 'desc' => '适用于活动宣传,收集报名信息,快速统计报名总人数', // 页面描述 + 'containField' => '共8个字段,包含8个字段:姓名、手机号、身份证号、邮箱、日期、报名职位、特长优点、入职时长', // 包含字段 + // 页面数据源 + "data" => [ + "global" => [ + "title" => "活动报名", + "completeLayout" => "style-1", + "completeAlign" => "left", + "borderControl" => true, + "pageStartBgColor" => "rgba(255, 255, 255, 1)", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "bgUrl" => "", + "bgHeightScale" => 100, + "imgWidth" => "", + "imgHeight" => "", + "topStatusBar" => [ + "isShow" => true, + "bgColor" => "#ffffff", + "rollBgColor" => "#ffffff", + "style" => "style-1", + "styleName" => "风格1", + "textColor" => "#333333", + "rollTextColor" => "#333333", + "textAlign" => "center", + "inputPlaceholder" => "请输入搜索关键词", + "imgUrl" => "", + "link" => [ + "name" => "" + ] + ], + "bottomTabBarSwitch" => true, + "popWindow" => [ + "imgUrl" => "", + "imgWidth" => "", + "imgHeight" => "", + "count" => -1, + "show" => 0, + "link" => [ + "name" => "" + ] + ], + "template" => [ + "textColor" => "#303133", + "pageStartBgColor" => "", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 0, + "bottom" => 0, + "both" => 0 + ], + "isHidden" => false + ] + ], + "value" => [ + [ + "path" => "edit-image-ads", + "uses" => 0, + "componentType" => "diy", + "id" => "36vpa1zz5mw0", + "componentName" => "ImageAds", + "componentTitle" => "图片广告", + "ignore" => [ + "componentBgUrl" + ], + "imageHeight" => 150, + "isSameScreen" => false, + "list" => [ + [ + "link" => [ + "name" => "" + ], + "imageUrl" => "static/resource/images/diy_form/diy_form_active_sign_up_banner.png", + "imgWidth" => 750, + "imgHeight" => 300, + "id" => "4wk5whtbi0m0", + "width" => 375, + "height" => 150 + ] + ], + "textColor" => "#303133", + "pageStartBgColor" => "", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 0, + "bottom" => 0, + "both" => 0 + ], + "isHidden" => false, + "pageStyle" => "padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;" + ], + [ + "path" => "edit-form-input", + "uses" => 0, + "position" => "", + "componentType" => "diy_form", + "id" => "46wkksoz5ew0", + "componentName" => "FormInput", + "componentTitle" => "单行文本", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "姓名", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => true, + "unique" => false, + "autofill" => false, + "privacyProtection" => false, + "default" => "", + "value" => "" + ], + "placeholder" => "请输入姓名", + "fontSize" => 14, + "fontWeight" => "bold", + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 15, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:30rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-mobile", + "uses" => 1, + "componentType" => "diy_form", + "id" => "6tsdwql8ds00", + "componentName" => "FormMobile", + "componentTitle" => "手机号", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "手机号", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => false, + "unique" => true, + "autofill" => false, + "privacyProtection" => true, + "default" => "", + "value" => "" + ], + "placeholder" => "请输入手机号", + "fontSize" => 14, + "fontWeight" => "bold", + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-identity", + "uses" => 1, + "componentType" => "diy_form", + "id" => "4hy63cm1lj80", + "componentName" => "FormIdentity", + "componentTitle" => "身份证号", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "身份证号", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => false, + "unique" => true, + "autofill" => false, + "privacyProtection" => false, + "default" => "", + "value" => "" + ], + "placeholder" => "请输入身份证号", + "fontSize" => 14, + "fontWeight" => "bold", + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-email", + "uses" => 0, + "componentType" => "diy_form", + "id" => "13f2w3r9h9vg", + "componentName" => "FormEmail", + "componentTitle" => "邮箱", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "邮箱", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => false, + "unique" => false, + "autofill" => false, + "privacyProtection" => false, + "default" => "", + "value" => "" + ], + "placeholder" => "请输入邮箱", + "fontSize" => 14, + "fontWeight" => "bold", + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-date", + "uses" => 0, + "componentType" => "diy_form", + "id" => "7dc7gd9hh400", + "componentName" => "FormDate", + "componentTitle" => "日期", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "日期", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => true, + "unique" => false, + "autofill" => false, + "privacyProtection" => false, + "default" => [ + "date" => "2025-01-11", + "timestamp" => 1736564405.243 + ], + "value" => [ + "date" => "2025-01-11 11=>02", + "timestamp" => 1736564520 + ] + ], + "placeholder" => "请选择日期", + "fontSize" => 14, + "fontWeight" => "bold", + "dateFormat" => "YYYY-MM-DD HH:mm", + "dateWay" => "current", + "defaultControl" => true, + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-radio", + "uses" => 0, + "componentType" => "diy_form", + "id" => "3z2yq22p9xc0", + "componentName" => "FormRadio", + "componentTitle" => "单选项", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "报名职位", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => true, + "unique" => false, + "autofill" => false, + "privacyProtection" => false, + "default" => [], + "value" => [] + ], + "fontSize" => 14, + "fontWeight" => "bold", + "style" => "style-2", + "options" => [ + [ + "id" => "fzjmiaochnsd", + "text" => "前台" + ], + [ + "id" => "mabstfflrdpj", + "text" => "收银" + ], + [ + "id" => "1ogre1qndmrk", + "text" => "后厨" + ], + [ + "id" => "1mv5qku9wihs", + "text" => "财务" + ], + [ + "id" => "qfdjp035qsw", + "text" => "经理" + ] + ], + "logicalRule" => [ + [ + "triggerOptionId" => "", + "execEvent" => [ + [ + "id" => "", + "componentName" => "", + "componentTitle" => "" + ] + ] + ] + ], + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-textarea", + "uses" => 0, + "componentType" => "diy_form", + "id" => "39m5zel59cw0", + "componentName" => "FormTextarea", + "componentTitle" => "多行文本", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "特长优点", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => false, + "unique" => false, + "autofill" => false, + "privacyProtection" => false, + "default" => "", + "value" => "" + ], + "placeholder" => "请输入特长优点", + "fontSize" => 14, + "fontWeight" => "bold", + "rowCount" => 4, + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-date-scope", + "uses" => 0, + "convert" => [], + "componentType" => "diy_form", + "id" => "mj9fl99x02o", + "componentName" => "FormDateScope", + "componentTitle" => "日期范围", + "ignore" => [ + "componentBgUrl" + ], + "field" => [ + "name" => "入职时长", + "remark" => [ + "text" => "", + "color" => "#999999", + "fontSize" => 14 + ], + "required" => false, + "unique" => false, + "autofill" => false, + "privacyProtection" => false, + "default" => [ + "start" => [ + "date" => "2025-01-11", + "timestamp" => 1736585705 + ], + "end" => [ + "date" => "2025-01-18", + "timestamp" => 1737190505 + ] + ], + "value" => [ + "start" => [ + "date" => "2025/01/11", + "timestamp" => 1736524800 + ], + "end" => [ + "date" => "2025/01/11", + "timestamp" => 1736524800 + ] + ] + ], + "fontSize" => 14, + "fontWeight" => "bold", + "dateFormat" => "YYYY/MM/DD", + "start" => [ + "placeholder" => "请选择起始日期", + "dateWay" => "diy", + "defaultControl" => true + ], + "end" => [ + "placeholder" => "请选择结束日期", + "dateWay" => "diy", + "defaultControl" => true + ], + "textColor" => "#303133", + "pageStartBgColor" => "#FFFFFF", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 0, + "bottomElementRounded" => 0, + "margin" => [ + "top" => 5, + "bottom" => 10, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;" + ], + [ + "path" => "edit-form-submit", + "uses" => 1, + "position" => "bottom_fixed", + "componentType" => "diy_form", + "id" => "38b02iygfzc0", + "componentName" => "FormSubmit", + "componentTitle" => "表单提交", + "ignore" => [ + "componentBgUrl" + ], + "btnPosition" => "follow_content", + "submitBtn" => [ + "text" => "提交", + "color" => "#ffffff", + "bgColor" => "#409EFF" + ], + "resetBtn" => [ + "control" => true, + "text" => "重置", + "color" => "", + "bgColor" => "" + ], + "textColor" => "#303133", + "pageStartBgColor" => "", + "pageEndBgColor" => "", + "pageGradientAngle" => "to bottom", + "componentBgUrl" => "", + "componentBgAlpha" => 2, + "componentStartBgColor" => "", + "componentEndBgColor" => "", + "componentGradientAngle" => "to bottom", + "topRounded" => 0, + "bottomRounded" => 0, + "elementBgColor" => "", + "topElementRounded" => 50, + "bottomElementRounded" => 50, + "margin" => [ + "top" => 5, + "bottom" => 5, + "both" => 25 + ], + "isHidden" => false, + "pageStyle" => "padding-top:10rpx;padding-bottom:10rpx;padding-right:20rpx;padding-left:20rpx;" + ] + ] + ] + + ], + ], + // todo 靠后完善 +// 'SIGN_REGISTRATION' => [ +// 'active_sign_up' => [ // 页面标识 +// "title" => "活动报名", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '适用于活动宣传,收集报名信息,快速统计报名总人数', // 页面描述 +// 'containField' => '共2个字段,包含2个字段:姓名、手机号', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// 'attendance_clock_in' => [ // 页面标识 +// "title" => "考勤打卡", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '无需额外设备,员工直接使用微信扫码完成考勤打卡,管理员可随时查看考勤汇总数据,导出后进行工作考核', // 页面描述 +// 'containField' => '包含5个字段:打卡类型、姓名、手机号、定位、备注', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// 'meeting_sign_up' => [ // 页面标识 +// "title" => "会议报名", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '填表人报名后获取核销凭证,活动现场出示,主办方可核销', // 页面描述 +// 'containField' => '包含4个字段:姓名、手机号、公司名称、职务', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// 'service_reservation' => [ // 页面标识 +// "title" => "服务预约", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '扫码填写预约报名信息,管理者可及时查看预约情况', // 页面描述 +// 'containField' => '共5个字段,包含5个字段:姓名、联系方式、预约日期、预约时间、备注', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// 'person_registration' => [ // 页面标识 +// "title" => "人员信息登记", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '适用于员工、学生、居民和访客等各类人员的信息收集场景', // 页面描述 +// 'containField' => '包含8个字段:姓名、手机号、性别、身份证号、出生日期、民族、籍贯、家庭地址', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// ], +// 'LEAVE_MESSAGE_SUGGESTION' => [ +// 'feedback_collection' => [ // 页面标识 +// "title" => "反馈意见收集", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '反馈人扫码即可随时随地进行留言建议,管理人可以审核内容,在线回复', // 页面描述 +// 'containField' => '共5个字段,包含5个字段:您要反馈哪方面的问题?、详细描述、相关图片、反馈人、手机号', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// 'Satisfaction_level_questionnaire' => [ // 页面标识 +// "title" => "满意度调查问卷", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '通过满意度调研表单制作一个满意度调研二维码,所有人扫码即可填写,代替原有纸质方式;所有的评价都将汇总在管理后台,可以统一导出进行统计,了解整体的服务质量', // 页面描述 +// 'containField' => '包含12个字段:1. 商场温度舒适度、2. 电梯及扶梯是否运行正常、3. 商场地面、墙面及天花板清洁、4. 卫生间地面、台盆及镜面清洁、5. 卫生间客用品是否缺失、6. 卫生间有无异味、7. 保洁员工仪容仪表及工作态度、8. 安保员工仪容仪表及工作态度、9. 车场停车费扫码付费便捷度、姓名、联系方式、图文描述', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// ], +// 'WRITE_OFF_VOUCHER' => [ +// 'gift_receive_reservation' => [ // 页面标识 +// "title" => "礼品领取预约", // 页面名称 +// 'cover' => '', // 页面封面图 +// 'preview' => '', // 页面预览图 +// 'desc' => '客户线上填写信息并选择礼品,完成后获取二维码凭证。在现场,出示该凭证领取礼品,工作人员扫描凭证进行核销', // 页面描述 +// 'containField' => '包含3个字段:姓名、手机、礼品选择', // 包含字段 +// // 页面数据源 +// "data" => [ +// "global" => [], +// "value" => [] +// ] +// ], +// ], + ]; + return $data; + } + +} diff --git a/niucloud/app/dict/diy_form/TypeDict.php b/niucloud/app/dict/diy_form/TypeDict.php new file mode 100644 index 000000000..90e9d3544 --- /dev/null +++ b/niucloud/app/dict/diy_form/TypeDict.php @@ -0,0 +1,70 @@ + [ + 'title' => get_lang('dict_diy_form.type_diy_form'), + 'preview' => 'static/resource/images/diy_form/diy_from_preview.jpg', // 预览图 + 'sort' => 10001, + 'addon' => '' + ], + //签到报名登记 todo 靠后完善 +// 'SIGN_REGISTRATION' => [ +// 'title' => get_lang('dict_diy_form.type_sign_registration'), +// 'preview' => 'static/resource/images/diy_form/diy_from_preview.png', +// 'sort' => 10002, +// 'addon' => '' +// ], + //留言建议 todo 靠后完善 +// 'LEAVE_MESSAGE_SUGGESTION' => [ +// 'title' => get_lang('dict_diy_form.type_leave_message_suggestion'), +// 'preview' => 'static/resource/images/diy_form/diy_from_preview.png', +// 'sort' => 10003, +// 'addon' => '' +// ], + //核销凭证 todo 靠后完善 +// 'WRITE_OFF_VOUCHER' => [ +// 'title' => get_lang('dict_diy_form.type_write_off_voucher'), +// 'preview' => 'static/resource/images/diy_form/diy_from_preview.png', +// 'sort' => 10004, +// 'addon' => '' +// ], + ]; + + $data = ( new DictLoader("DiyFormType") )->load($system_pages); + + if (!empty($params) && !empty($params[ 'type' ])) { + return $data[ $params[ 'type' ] ]; + } + + return $data; + + } + +} diff --git a/niucloud/app/dict/member/MemberCashOutDict.php b/niucloud/app/dict/member/MemberCashOutDict.php index 582b2b62f..02414b69d 100644 --- a/niucloud/app/dict/member/MemberCashOutDict.php +++ b/niucloud/app/dict/member/MemberCashOutDict.php @@ -20,6 +20,7 @@ class MemberCashOutDict { public const WAIT_AUDIT = 1;//待审核 public const WAIT_TRANSFER = 2;//待转账 + public const TRANSFER_ING = 4;//转账中 public const TRANSFERED = 3;//已转账 public const REFUSE = -1;//已拒绝 public const CANCEL = -2;//已取消 @@ -33,6 +34,7 @@ class MemberCashOutDict return [ self::WAIT_AUDIT => get_lang('dict_member_cash_out.status_wait_audit'),//待审核 self::WAIT_TRANSFER => get_lang('dict_member_cash_out.status_wait_transfer'),//待转账 + self::TRANSFER_ING => get_lang('dict_member_cash_out.status_transfer_ing'),//转账中 self::TRANSFERED => get_lang('dict_member_cash_out.status_transfered'),//已转账 self::REFUSE => get_lang('dict_member_cash_out.status_refuse'),//已拒绝 self::CANCEL => get_lang('dict_member_cash_out.status_cancel'),//已取消 diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index 078941620..b40ce9a28 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -6,7 +6,7 @@ return [ 'menu_short_name' => '首页', 'parent_key' => '', 'menu_type' => '1', - 'icon' => 'element Monitor', + 'icon' => 'iconfont iconshouye2', 'api_url' => '', 'router_path' => 'index', 'view_path' => 'index/index', @@ -37,7 +37,7 @@ return [ 'menu_short_name' => '配置', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element Setting', + 'icon' => 'iconfont iconshezhi11', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -51,7 +51,7 @@ return [ 'menu_key' => 'website_setting', 'menu_short_name' => '网站设置', 'menu_type' => '0', - 'icon' => 'iconfont iconwangzhan1', + 'icon' => 'iconfont iconwangzhanshezhi', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -65,7 +65,7 @@ return [ 'menu_key' => 'base_setting', 'menu_short_name' => '基础设置', 'menu_type' => '1', - 'icon' => 'element Basketball', + 'icon' => 'iconfont iconjichushezhi1', 'api_url' => 'sys/config/website', 'router_path' => 'setting/website/system', 'view_path' => 'setting/system', @@ -95,7 +95,7 @@ return [ 'menu_key' => 'setting_copyright', 'menu_short_name' => '版权设置', 'menu_type' => '1', - 'icon' => 'iconfont iconbanquan1', + 'icon' => 'iconfont iconbanquanshezhi', 'api_url' => 'sys/config/copyright', 'router_path' => 'setting/website/copyright', 'view_path' => 'setting/copyright', @@ -127,7 +127,7 @@ return [ 'menu_key' => 'auth', 'menu_short_name' => '权限设置', 'menu_type' => '0', - 'icon' => 'iconfont iconquanxianguanli', + 'icon' => 'iconfont iconquanxianshezhi', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -141,7 +141,7 @@ return [ 'menu_key' => 'auth_list', 'menu_short_name' => '管理员', 'menu_type' => '1', - 'icon' => 'element Lock', + 'icon' => 'iconfont iconguanliyuan', 'api_url' => 'site/user', 'router_path' => 'setting/auth/user', 'view_path' => 'auth/user', @@ -255,7 +255,7 @@ return [ 'menu_key' => 'auth_role', 'menu_short_name' => '管理员角色', 'menu_type' => '1', - 'icon' => 'iconfont iconhuiyuanliebiao', + 'icon' => 'iconfont iconguanliyuanjiaose', 'api_url' => 'sys/role', 'router_path' => 'setting/auth/role', 'view_path' => 'auth/role', @@ -313,7 +313,7 @@ return [ 'menu_key' => 'auth_log', 'menu_short_name' => '操作日志', 'menu_type' => '1', - 'icon' => 'element Document', + 'icon' => 'iconfont iconcaozuorizhi', 'api_url' => 'sys/log', 'router_path' => 'setting/auth/log', 'view_path' => 'auth/log', @@ -329,7 +329,7 @@ return [ 'menu_key' => 'setting_storage', 'menu_short_name' => '存储设置', 'menu_type' => '1', - 'icon' => 'element FolderChecked', + 'icon' => 'iconfont iconcunchushezhi', 'api_url' => 'sys/storage', 'router_path' => 'setting/storage', 'view_path' => 'setting/storage', @@ -373,7 +373,7 @@ return [ 'menu_key' => 'setting_login', 'menu_short_name' => '登录设置', 'menu_type' => '1', - 'icon' => 'iconfont iconzhuceshezhi', + 'icon' => 'iconfont icondenglushezhi', 'api_url' => 'sys/config/login', 'router_path' => 'setting/adminlogin', 'view_path' => 'setting/adminlogin', @@ -403,7 +403,7 @@ return [ 'menu_key' => 'wx_oplatform', 'menu_short_name' => '微信开放平台', 'menu_type' => '0', - 'icon' => 'iconfont iconweixin', + 'icon' => 'iconfont iconweixinkaifangpingtai', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -417,7 +417,7 @@ return [ 'menu_key' => 'setting_oplatform', 'menu_short_name' => '开放平台配置', 'menu_type' => '1', - 'icon' => 'iconfont iconweixin', + 'icon' => 'iconfont iconkaifangpingtaipeizhi', 'api_url' => 'wxoplatform/config', 'router_path' => 'setting/oplatform', 'view_path' => 'wxoplatform/setting', @@ -447,7 +447,7 @@ return [ 'menu_key' => 'oplatform_weapp_version', 'menu_short_name' => '小程序同步', 'menu_type' => '1', - 'icon' => 'iconfont iconweixin', + 'icon' => 'iconfont iconxiaochengxutongbu', 'api_url' => 'wxoplatform/weapp/commit', 'router_path' => 'wxoplatform/weapp_version', 'view_path' => 'wxoplatform/weapp_version', @@ -479,7 +479,7 @@ return [ 'menu_key' => 'attachment', 'menu_short_name' => '素材管理', 'menu_type' => '1', - 'icon' => 'element Files', + 'icon' => 'iconfont iconsucaiguanli1', 'api_url' => 'sys/attachment', 'router_path' => 'setting/attachment', 'view_path' => 'tools/attachment', @@ -579,7 +579,7 @@ return [ 'menu_key' => 'map_setting', 'menu_short_name' => '地图设置', 'menu_type' => '1', - 'icon' => 'element Message', + 'icon' => 'iconfont iconditu2', 'api_url' => 'sys/config/map', 'router_path' => 'setting/map', 'view_path' => 'setting/map', @@ -609,7 +609,7 @@ return [ 'menu_key' => 'layout_setting', 'menu_short_name' => '布局设置', 'menu_type' => '1', - 'icon' => 'element Message', + 'icon' => 'iconfont iconbujushezhi', 'api_url' => 'sys/config/layout', 'router_path' => 'setting/layout', 'view_path' => 'setting/layout', @@ -642,7 +642,7 @@ return [ 'menu_short_name' => '站点', 'parent_key' => '', 'menu_type' => '0', - 'icon' => 'element Memo', + 'icon' => 'iconfont iconzhandianguanli', 'api_url' => '', 'router_path' => '', 'view_path' => '', @@ -656,7 +656,7 @@ return [ 'menu_key' => 'site_list', 'menu_short_name' => '站点列表', 'menu_type' => '1', - 'icon' => 'element OfficeBuilding', + 'icon' => 'iconfont iconzhandianliebiao', 'api_url' => 'site/site', 'router_path' => 'site/list', 'view_path' => 'site/list', @@ -770,7 +770,7 @@ return [ 'menu_key' => 'site_group', 'menu_short_name' => '站点套餐', 'menu_type' => '1', - 'icon' => 'element PriceTag', + 'icon' => 'iconfont iconzhandiantaocan', 'api_url' => 'site/group', 'router_path' => 'site/group', 'view_path' => 'site/group', @@ -846,7 +846,7 @@ return [ 'menu_key' => 'site_user_list', 'menu_short_name' => '用户', 'menu_type' => '1', - 'icon' => 'iconfont iconhuiyuanzhongxin', + 'icon' => 'iconfont iconyonghu1', 'api_url' => 'user/user', 'router_path' => 'site/user', 'view_path' => 'site/user', @@ -961,7 +961,7 @@ return [ 'menu_short_name' => '应用', 'parent_key' => '', 'menu_type' => '1', - 'icon' => 'element ShoppingBag', + 'icon' => 'iconfont iconyingyong2', 'api_url' => 'addon/local', 'router_path' => 'app_manage/app_store', 'view_path' => 'index/store', @@ -1061,7 +1061,7 @@ return [ 'menu_key' => 'app_manage_tool', 'menu_short_name' => '开发', 'menu_type' => '1', - 'icon' => 'iconfont iconchajian1', + 'icon' => 'iconfont icona-kaifa1', 'api_url' => '', 'router_path' => 'app_manage/tools', 'view_path' => 'index/tools', @@ -1090,7 +1090,7 @@ return [ 'menu_key' => 'addon_develop', 'menu_short_name' => '插件开发', 'menu_type' => '1', - 'icon' => 'iconfont iconchajiankaifa', + 'icon' => 'iconfont iconchajiankaifa1', 'api_url' => '', 'router_path' => 'tools/addon', 'view_path' => 'tools/addon/index', @@ -1134,7 +1134,7 @@ return [ 'menu_key' => 'code', 'menu_short_name' => '代码生成', 'menu_type' => '1', - 'icon' => 'iconfont icondaimashengcheng', + 'icon' => 'iconfont icondaimashengcheng1', 'api_url' => 'generator/generator', 'router_path' => 'tools/code', 'view_path' => 'tools/code/index', @@ -1264,7 +1264,7 @@ return [ 'menu_key' => 'sys_dict_dict_dict_list', 'menu_short_name' => '数据字典', 'menu_type' => '1', - 'icon' => 'iconfont iconwenzhangguanli1', + 'icon' => 'iconfont iconshujuzidian', 'api_url' => 'dict/post/post', 'router_path' => 'tools/list', 'view_path' => 'dict/list', @@ -1322,7 +1322,7 @@ return [ 'menu_key' => 'tools_check_environment', 'menu_short_name' => '环境检测', 'menu_type' => '1', - 'icon' => 'iconfont iconhuanjingjiance', + 'icon' => 'iconfont iconhuanjingjiance1', 'api_url' => '', 'router_path' => 'tools/detection', 'view_path' => 'tools/detection', @@ -1336,7 +1336,7 @@ return [ 'menu_key' => 'platform_menu', 'menu_short_name' => '平台菜单', 'menu_type' => '1', - 'icon' => '', + 'icon' => 'iconfont iconpingtaicaidan', 'api_url' => 'sys/menu', 'router_path' => 'tools/admin_menu', 'view_path' => 'auth/menu', @@ -1408,7 +1408,7 @@ return [ 'menu_key' => 'site_menu', 'menu_short_name' => '站点菜单', 'menu_type' => '1', - 'icon' => '', + 'icon' => 'iconfont iconzhandiancaidan', 'api_url' => 'sys/menu', 'router_path' => 'tools/site_menu', 'view_path' => 'auth/site_menu', @@ -1480,7 +1480,7 @@ return [ 'menu_key' => 'tools_schedule', 'menu_short_name' => '计划任务', 'menu_type' => '1', - 'icon' => 'iconfont iconjihuarenwu', + 'icon' => 'iconfont iconjihuarenwu1', 'api_url' => 'sys/schedule/list', 'router_path' => 'tools/schedule', 'view_path' => 'tools/schedule', @@ -1566,7 +1566,7 @@ return [ 'menu_key' => 'app_auth', 'menu_short_name' => '授权信息', 'menu_type' => '1', - 'icon' => 'iconfont iconshouquanxinxi2', + 'icon' => 'iconfont iconshouquanxinxi', 'api_url' => '', 'router_path' => 'tools/authorize', 'view_path' => 'app/authorize', @@ -1610,7 +1610,7 @@ return [ 'menu_key' => 'developer_token', 'menu_short_name' => '开发者key', 'menu_type' => '1', - 'icon' => 'iconfont iconshouquanxinxi2', + 'icon' => 'iconfont iconkaifazhekey', 'api_url' => 'sys/config/developer_token', 'router_path' => 'tools/developer_token', 'view_path' => 'setting/developer_token', diff --git a/niucloud/app/dict/menu/site.php b/niucloud/app/dict/menu/site.php index 08263512a..93fff7b2c 100644 --- a/niucloud/app/dict/menu/site.php +++ b/niucloud/app/dict/menu/site.php @@ -289,6 +289,48 @@ return [ 'status' => '1', 'is_show' => '0', ], + [ + 'menu_name' => '主题风格', + 'menu_key' => 'diy_theme_style', + 'menu_short_name' => '主题风格', + 'menu_type' => '1', + 'icon' => 'element Files', + 'api_url' => '', + 'router_path' => 'diy/theme_style', + 'view_path' => 'diy/theme_style', + 'methods' => 'get', + 'sort' => '92', + 'status' => '1', + 'is_show' => '1' + ], + [ + 'menu_name' => '数据列表', + 'menu_key' => 'diy_form_record_list', + 'menu_short_name' => '数据列表', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => 'diy_form/records', + 'router_path' => 'diy_form/records', + 'view_path' => 'diy_form/records', + 'methods' => 'get', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], + [ + 'menu_name' => '保存', + 'menu_key' => 'diy_form_update', + 'menu_short_name' => '保存', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'diy_form', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], ], ], [ @@ -2161,6 +2203,122 @@ return [ ], ], ], + [ + 'menu_name' => '小票打印', + 'menu_key' => 'printer_management', + 'menu_short_name' => '小票打印', + 'menu_type' => '1', + 'icon' => 'element FolderChecked', + 'api_url' => 'printer', + 'router_path' => 'printer/list', + 'view_path' => 'printer/list', + 'methods' => 'get', + 'sort' => '30', + 'status' => '1', + 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '删除打印机', + 'menu_key' => 'delete_printer', + 'menu_short_name' => '删除打印机', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'printer/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + [ + 'menu_name' => '添加打印机', + 'menu_key' => 'printer_add', + 'menu_short_name' => '添加打印机', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => 'printer', + 'router_path' => 'printer/add', + 'view_path' => 'printer/edit', + 'methods' => 'post', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], + [ + 'menu_name' => '编辑打印机', + 'menu_key' => 'printer_edit', + 'menu_short_name' => '添加打印机', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => 'printer/', + 'router_path' => 'printer/edit', + 'view_path' => 'printer/edit', + 'methods' => 'put', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], + [ + 'menu_name' => '小票打印模板', + 'menu_key' => 'printer_template_management', + 'menu_short_name' => '小票打印模板', + 'menu_type' => '1', + 'icon' => 'element FolderChecked', + 'api_url' => 'printer/template', + 'router_path' => 'printer/template/list', + 'view_path' => 'printer/template_list', + 'methods' => 'get', + 'sort' => '96', + 'status' => '1', + 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '删除打印模板', + 'menu_key' => 'delete_printer_template', + 'menu_short_name' => '删除打印模板', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'printer/template/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + [ + 'menu_name' => '添加打印模板', + 'menu_key' => 'printer_template_add', + 'menu_short_name' => '添加打印模板', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => 'printer/template', + 'router_path' => 'printer/template/add', + 'view_path' => 'printer/template_edit', + 'methods' => 'post', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], + [ + 'menu_name' => '编辑打印模板', + 'menu_key' => 'printer_template_edit', + 'menu_short_name' => '编辑打印模板', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => 'printer/template/', + 'router_path' => 'printer/template/edit', + 'view_path' => 'printer/template_edit', + 'methods' => 'put', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], [ 'menu_name' => '系统工具', 'menu_key' => 'setting_tool', @@ -2171,7 +2329,7 @@ return [ 'router_path' => '', 'view_path' => '', 'methods' => '', - 'sort' => '30', + 'sort' => '20', 'status' => '1', 'is_show' => '1', 'children' => [ @@ -2337,122 +2495,6 @@ return [ ] ] ], - [ - 'menu_name' => '小票打印', - 'menu_key' => 'printer_management', - 'menu_short_name' => '小票打印', - 'menu_type' => '1', - 'icon' => 'element FolderChecked', - 'api_url' => 'printer', - 'router_path' => 'printer/list', - 'view_path' => 'printer/list', - 'methods' => 'get', - 'sort' => '97', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '删除打印机', - 'menu_key' => 'delete_printer', - 'menu_short_name' => '删除打印机', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'printer/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - ] - ] - ], - [ - 'menu_name' => '添加打印机', - 'menu_key' => 'printer_add', - 'menu_short_name' => '添加打印机', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'printer', - 'router_path' => 'printer/add', - 'view_path' => 'printer/edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑打印机', - 'menu_key' => 'printer_edit', - 'menu_short_name' => '添加打印机', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'printer/', - 'router_path' => 'printer/edit', - 'view_path' => 'printer/edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '小票打印模板', - 'menu_key' => 'printer_template_management', - 'menu_short_name' => '小票打印模板', - 'menu_type' => '1', - 'icon' => 'element FolderChecked', - 'api_url' => 'printer/template', - 'router_path' => 'printer/template/list', - 'view_path' => 'printer/template_list', - 'methods' => 'get', - 'sort' => '96', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '删除打印模板', - 'menu_key' => 'delete_printer_template', - 'menu_short_name' => '删除打印模板', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'printer/template/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - ] - ] - ], - [ - 'menu_name' => '添加打印模板', - 'menu_key' => 'printer_template_add', - 'menu_short_name' => '添加打印模板', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'printer/template', - 'router_path' => 'printer/template/add', - 'view_path' => 'printer/template_edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑打印模板', - 'menu_key' => 'printer_template_edit', - 'menu_short_name' => '编辑打印模板', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'printer/template/', - 'router_path' => 'printer/template/edit', - 'view_path' => 'printer/template_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], ] ], @@ -2487,6 +2529,20 @@ return [ 'status' => '1', 'is_show' => '0', ], + [ + 'menu_name' => '表单装修', + 'menu_key' => 'form_page_decorate', + 'menu_short_name' => '表单装修', + 'menu_type' => '1', + 'icon' => '', + 'api_url' => '', // diy/diy/ + 'router_path' => 'decorate/form/edit', + 'view_path' => 'diy_form/edit', + 'methods' => 'put', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + ], ], ], [ @@ -2519,5 +2575,54 @@ return [ 'is_show' => '0', ], ], + ], + [ + 'menu_name' => '万能表单', + 'menu_key' => 'diy_form', + 'menu_short_name' => '万能表单', + 'menu_type' => '0', + 'icon' => 'element Files', + 'api_url' => '', + 'router_path' => '', + 'view_path' => '', + 'methods' => '', + 'sort' => '0', + 'status' => '1', + 'is_show' => '1', + 'menu_attr' => 'diy_form', + 'children' => [ + [ + 'menu_name' => '表单列表', + 'menu_key' => 'diy_form_list', + 'menu_short_name' => '表单列表', + 'menu_type' => '1', + 'icon' => 'element Files', + 'api_url' => 'diy_form', + 'router_path' => 'diy_form/list', + 'view_path' => 'diy_form/list', + 'methods' => 'get', + 'sort' => '0', + 'status' => '1', + 'is_show' => '1', + 'menu_attr' => 'diy_form', + 'children' => [ + [ + 'menu_name' => '分享设置', + 'menu_key' => 'save_diy_form_share', + 'menu_short_name' => '分享设置', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'diy_form/share', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + 'menu_attr' => 'diy_form', + ], + ], + ], + ] ] ]; diff --git a/niucloud/app/dict/pay/PayChannelDict.php b/niucloud/app/dict/pay/PayChannelDict.php index 0ab7ecd67..74ef8d57e 100644 --- a/niucloud/app/dict/pay/PayChannelDict.php +++ b/niucloud/app/dict/pay/PayChannelDict.php @@ -33,13 +33,19 @@ class PayChannelDict // } // } foreach ($channel as $k => $v) { - $list[$k] = [ + $temp_pay_type = $pay_type; + $list[ $k ] = [ 'name' => $v, 'key' => $k, 'pay_type' => $pay_type ]; + // PC端暂不支持 帮付 + if ($k == ChannelDict::PC) { + unset($temp_pay_type[ PayDict::FRIENDSPAY ]); + $list[ $k ][ 'pay_type' ] = $temp_pay_type; + } } return $list; } -} \ No newline at end of file +} diff --git a/niucloud/app/dict/pay/TransferDict.php b/niucloud/app/dict/pay/TransferDict.php index d92d9754e..8126a5b73 100644 --- a/niucloud/app/dict/pay/TransferDict.php +++ b/niucloud/app/dict/pay/TransferDict.php @@ -14,14 +14,17 @@ namespace app\dict\pay; class TransferDict { - public const WECHAT = 'wechatpay';//微信支付 + public const WECHAT = 'wechatpay';//微信零钱 - public const ALIPAY = 'alipay';//支付宝支付 + public const ALIPAY = 'alipay';//支付宝支付 (默认收款码) public const OFFLINE = 'offline';//线下转账 public const BANK = 'bank';//银行卡转账 + + public const WECHAT_CODE = 'wechat_code';//微信收款码(线下转账) + //转账状态 public const SUCCESS = 'success';//转账成功 @@ -43,7 +46,7 @@ class TransferDict } /** - * 支付类型 + * 转账类型 * @return array */ public static function getTransferType(array $types = [], $is_all = true) @@ -64,6 +67,11 @@ class TransferDict 'key' => self::BANK, 'is_online' => false ],//银行卡 + self::WECHAT_CODE => [ + 'name' => get_lang('dict_transfer.type_wechat_code'), + 'key' => self::WECHAT_CODE, + 'is_online' => false + ],//微信收款码(线下转账) ]; if ($is_all) { $list[self::OFFLINE] = [ diff --git a/niucloud/app/dict/schedule/schedule.php b/niucloud/app/dict/schedule/schedule.php index 046b89892..63c71e46c 100644 --- a/niucloud/app/dict/schedule/schedule.php +++ b/niucloud/app/dict/schedule/schedule.php @@ -25,6 +25,18 @@ return [ 'class' => 'app\job\schedule\SiteExpireClose', 'function' => '' ], + + [ + 'key' => 'transfer_check_finish', + 'name' => '检验在线转账是否处理完毕', + 'desc' => '', + 'time' => [ + 'type' => 'min', + 'min' => 5 + ], + 'class' => 'app\job\transfer\schedule\CheckFinish', + 'function' => '' + ], // [ // 'key' => 'site_stat', // 'name' => '站点统计', diff --git a/niucloud/app/dict/sys/WxOplatform.php b/niucloud/app/dict/sys/WxOplatform.php index 4225845af..c16a34658 100644 --- a/niucloud/app/dict/sys/WxOplatform.php +++ b/niucloud/app/dict/sys/WxOplatform.php @@ -43,7 +43,6 @@ class WxOplatform 25 => '开放平台账号管理', 30 => '小程序基本信息管理', 31 => '小程序认证名称检测', - 36 => '微信卡路里管理', 37 => '附近的小程序管理', 40 => '小程序插件管理', 45 => '微信物流服务', diff --git a/niucloud/app/event.php b/niucloud/app/event.php index c6f30e855..f43eb8e90 100644 --- a/niucloud/app/event.php +++ b/niucloud/app/event.php @@ -92,11 +92,23 @@ $system_event = [ 'ExportDataType' => [ //会员导出 'app\listener\member_export\MemberExportTypeListener', + //表单填写明细导出 + 'app\listener\diy_form_export\DiyFormRecordsExportTypeListener', + //表单填表人统计导出 + 'app\listener\diy_form_export\DiyFormRecordsMemberExportTypeListener', + //表单字段统计导出 +// 'app\listener\diy_form_export\DiyFormRecordsFieldsExportTypeListener', ], //导出数据源 'ExportData' => [ //会员导出 'app\listener\member_export\MemberExportDataListener', + //表单填写明细导出 + 'app\listener\diy_form_export\DiyFormRecordsExportDataListener', + //表单填表人统计导出 + 'app\listener\diy_form_export\DiyFormRecordsMemberExportDataListener', + //表单字段统计导出 +// 'app\listener\diy_form_export\DiyFormRecordsFieldsExportDataListener', ], //统计执行 'StatExecute' => [], @@ -108,7 +120,10 @@ $system_event = [ 'GetPosterData' => [ 'app\listener\system\Poster' ], // 小程序授权变更事件 - 'WeappAuthChangeAfter' => [ 'app\listener\system\WeappAuthChangeAfter' ] + 'WeappAuthChangeAfter' => [ 'app\listener\system\WeappAuthChangeAfter' ], + 'ShowApp' => [ + 'app\listener\system\ShowAppListener' + ] ], 'subscribe' => [ ], diff --git a/niucloud/app/install/source/database.sql b/niucloud/app/install/source/database.sql index eb013d6c6..37f487b85 100644 --- a/niucloud/app/install/source/database.sql +++ b/niucloud/app/install/source/database.sql @@ -67,6 +67,124 @@ CREATE TABLE `applet_version` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本表' ROW_FORMAT = Dynamic; +DROP TABLE IF EXISTS `diy_form`; +CREATE TABLE `diy_form` ( + `form_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '表单id', + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `page_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '表单名称(用于后台展示)', + `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '表单名称(用于前台展示)', + `type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '表单类型', + `status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态(0,关闭,1:开启)', + `template` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '模板名称', + `value` LONGTEXT DEFAULT NULL COMMENT '表单数据,json格式,包含展示组件', + `addon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '所属插件标识', + `share` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '分享内容', + `write_num` INT(11) NOT NULL DEFAULT 0 COMMENT '表单填写总数量', + `remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注说明', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', + PRIMARY KEY (`form_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单表'; + + +DROP TABLE IF EXISTS `diy_form_fields`; +CREATE TABLE `diy_form_fields` ( + `field_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '字段id', + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id', + `field_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段唯一标识', + `field_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段类型', + `field_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段名称', + `field_remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段说明', + `field_default` TEXT DEFAULT NULL COMMENT '字段默认值', + `write_num` INT(11) NOT NULL DEFAULT 0 COMMENT '字段填写总数量', + `field_required` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否必填 0:否 1:是', + `field_hidden` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否隐藏 0:否 1:是', + `field_unique` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段内容防重复 0:否 1:是', + `privacy_protection` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '隐私保护 0:关闭 1:开启', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', + PRIMARY KEY (`field_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单字段表'; + + +DROP TABLE IF EXISTS `diy_form_records`; +CREATE TABLE `diy_form_records` ( + `record_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '表单填写记录id', + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id', + `value` LONGTEXT DEFAULT NULL COMMENT '填写的表单数据', + `member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '填写人会员id', + `relate_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联业务id', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + PRIMARY KEY (`record_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单填写记录表'; + + +DROP TABLE IF EXISTS `diy_form_records_fields`; +CREATE TABLE `diy_form_records_fields` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id', + `form_field_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联表单字段id', + `record_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联表单填写记录id', + `member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '填写会员id', + `field_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段唯一标识', + `field_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段类型', + `field_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段名称', + `field_value` LONGTEXT NOT NULL COMMENT '字段值,根据类型展示对应效果', + `field_required` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否必填 0:否 1:是', + `field_hidden` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否隐藏 0:否 1:是', + `field_unique` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段内容防重复 0:否 1:是', + `privacy_protection` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '隐私保护 0:关闭 1:开启', + `update_num` INT(11) NOT NULL DEFAULT 0 COMMENT '字段修改次数', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单填写字段表'; + + +DROP TABLE IF EXISTS `diy_form_submit_config`; +CREATE TABLE `diy_form_submit_config` ( + `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id', + `submit_after_action` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '填表人提交后操作,text:文字信息,voucher:核销凭证', + `tips_type` VARCHAR(255) NOT NULL COMMENT '提示内容类型,default:默认提示,diy:自定义提示', + `tips_text` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '自定义提示内容', + `time_limit_type` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '核销凭证有效期限制类型,no_limit:不限制,specify_time:指定固定开始结束时间,submission_time:按提交时间设置有效期', + `time_limit_rule` TEXT DEFAULT NULL COMMENT '核销凭证时间限制规则,json格式', + `voucher_content_rule` TEXT DEFAULT NULL COMMENT '核销凭证内容,json格式', + `success_after_action` TEXT DEFAULT NULL COMMENT '填写成功后续操作', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单提交页配置表'; + + +DROP TABLE IF EXISTS `diy_form_write_config`; +CREATE TABLE `diy_form_write_config` ( + `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id', + `write_way` VARCHAR(255) NOT NULL COMMENT '填写方式,no_limit:不限制,scan:仅限微信扫一扫,url:仅限链接进入', + `join_member_type` VARCHAR(255) NOT NULL DEFAULT 'all_member' COMMENT '参与会员,all_member:所有会员参与,selected_member_level:指定会员等级,selected_member_label:指定会员标签', + `level_ids` TEXT DEFAULT NULL COMMENT '会员等级id集合', + `label_ids` TEXT DEFAULT NULL COMMENT '会员标签id集合', + `member_write_type` VARCHAR(255) NOT NULL COMMENT '每人可填写次数,no_limit:不限制,diy:自定义', + `member_write_rule` TEXT NOT NULL COMMENT '每人可填写次数自定义规则', + `form_write_type` VARCHAR(255) NOT NULL COMMENT '表单可填写数量,no_limit:不限制,diy:自定义', + `form_write_rule` TEXT NOT NULL COMMENT '表单可填写总数自定义规则', + `time_limit_type` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '填写时间限制类型,no_limit:不限制, specify_time:指定开始结束时间,open_day_time:设置每日开启时间', + `time_limit_rule` TEXT NOT NULL COMMENT '填写时间限制规则', + `is_allow_update_content` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否允许修改自己填写的内容,0:否,1:是', + `write_instruction` TEXT DEFAULT NULL COMMENT '表单填写须知', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单填写配置表'; + + DROP TABLE IF EXISTS `diy_page`; CREATE TABLE `diy_page` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -102,6 +220,24 @@ CREATE TABLE `diy_route` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义路由' ROW_FORMAT = Dynamic; +DROP TABLE IF EXISTS `diy_theme`; +CREATE TABLE `diy_theme` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `site_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点id', + `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '标题', + `type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '插件类型app,addon', + `addon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '所属应用,app:系统,shop:商城、o2o:上门服务', + `color_mark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '颜色标识', + `color_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '颜色名称', + `mode` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '模式,default:默认【跟随系统】,diy:自定义配色', + `value` TEXT DEFAULT NULL COMMENT '配色', + `diy_value` TEXT DEFAULT NULL COMMENT '自定义配色', + `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='自定义主题配色表'; + + DROP TABLE IF EXISTS `generate_column`; CREATE TABLE `generate_column` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', @@ -282,6 +418,8 @@ CREATE TABLE `member_cash_out` ( `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_payee` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '转账收款方(json),主要用于对接在线的打款方式', + `transfer_payment_code` VARCHAR(500) 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 '转账时间', @@ -313,6 +451,7 @@ CREATE TABLE `member_cash_out_account` ( `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 '提现账户', + `transfer_payment_code` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '收款码', PRIMARY KEY (`account_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员提现账户' ROW_FORMAT = Dynamic; @@ -446,15 +585,18 @@ CREATE TABLE `pay_transfer` ( `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_payment_code` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '收款码图片', + `transfer_fail_reason` varchar(2000) NOT NULL DEFAULT '' COMMENT '失败原因', `transfer_status` varchar(20) NOT NULL DEFAULT '' COMMENT '转账状态', `money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '转账金额', `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '申请时间', `transfer_time` int(11) NOT NULL DEFAULT 0 COMMENT '转账时间', `update_time` int(11) NOT NULL DEFAULT 0, `openid` varchar(50) NOT NULL DEFAULT '', - `remark` varchar(255) NOT NULL, + `remark` varchar(255) NOT NULL DEFAULT '', `batch_id` varchar(500) NOT NULL DEFAULT '' COMMENT '转账批次id', + `transfer_payee` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '在线转账数据(json)', + `out_batch_no` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '扩展数据,主要用于记录接收到线上打款的业务数据编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '转账表' ROW_FORMAT = Dynamic; @@ -1052,7 +1194,7 @@ INSERT INTO `site`(site_id, site_name, group_id, keywords, app_type, logo, `desc UPDATE `site` SET site_id = 0 WHERE site_id = 1; -INSERT INTO `sys_user` VALUES ('1', '', '', '', '', '', '0', '0', '0', '1', '0', '0', '0'); +-- INSERT INTO `sys_user` VALUES ('1', '', '', '', '', '', '0', '0', '0', '1', '0', '0', '0'); INSERT INTO `sys_user_role` VALUES ('1', '1', '0', '', '0', '1', '1', '0'); diff --git a/niucloud/app/job/sys/ExportJob.php b/niucloud/app/job/sys/ExportJob.php index ec9ea9d17..7e36599b7 100644 --- a/niucloud/app/job/sys/ExportJob.php +++ b/niucloud/app/job/sys/ExportJob.php @@ -22,7 +22,7 @@ class ExportJob extends BaseJob public function doJob($site_id, $type, $where, $page) { //获取导出数据列 - $data_column = (new CoreExportService())->getExportDataColumn($type); + $data_column = (new CoreExportService())->getExportDataColumn($site_id, $type, $where); //获取导出数据源 $data = (new CoreExportService())->getExportData($site_id, $type, $where, $page); (new CoreExportService())->export($site_id, $type, $data_column, $data); diff --git a/niucloud/app/job/transfer/schedule/CheckFinish.php b/niucloud/app/job/transfer/schedule/CheckFinish.php new file mode 100644 index 000000000..9262d3b05 --- /dev/null +++ b/niucloud/app/job/transfer/schedule/CheckFinish.php @@ -0,0 +1,38 @@ + TransferDict::DEALING, + 'transfer_type' => TransferDict::WECHAT + ]; + $list = (new Transfer())->where($condition)->select(); + $core_transfer_service = new CoreTransferService(); + foreach($list as $item){ + $core_transfer_service->check($item['site_id'], $item->toArray()); + } + return true; + } +} diff --git a/niucloud/app/lang/zh-cn/api.php b/niucloud/app/lang/zh-cn/api.php index 60839357f..0f4d760f1 100644 --- a/niucloud/app/lang/zh-cn/api.php +++ b/niucloud/app/lang/zh-cn/api.php @@ -57,6 +57,7 @@ return [ 'ADDON_KEY_IS_EXIST' => '已存在相同插件标识的应用', 'ADDON_IS_INSTALLED_NOT_ALLOW_DEL' => '已安装的插件不允许删除', 'ADDON_ZIP_ERROR' => '插件压缩失败', + 'PHP_SCRIPT_RUNNING_OUT_OF_MEMORY' => 'PHP脚本运行内存不足, 具体操作方法点击查看相关手册', //登录注册重置账号.... 'LOGIN_SUCCESS' => '登录成功', @@ -180,12 +181,18 @@ return [ 'MEMBER_CASHOUT_TRANSFER' => '会员提现转账', 'CASH_OUT_ACCOUNT_NOT_EXIST' => '提现账户不存在', + 'CASH_OUT_ACCOUNT_NOT_FOUND_VALUE' => '转账到微信零钱缺少参数', + //DIY 'PAGE_NOT_EXIST' => '页面不存在', + 'APP_COLOR_NOT_EXIST' => '系统配色不存在', - //系统表单 - 'DIY_FORM_NOT_EXIT' => '表单不存在', + //万能表单 + 'DIY_FORM_NOT_EXIST' => '表单不存在', + 'DIY_FORM_NOT_OPEN' => '该表单已关闭', 'DIY_FORM_EXCEEDING_LIMIT' => '已达提交次数上限', + 'ON_STATUS_PROHIBIT_DELETE' => '启用状态下禁止删除', + 'DIY_FORM_TYPE_NOT_EXIST' => '表单类型不存在', //渠道相关 占用 4****** //微信 @@ -214,6 +221,7 @@ return [ //支付相关(todo 注意:7段不共享) 'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号', 'PAYMENT_METHOD_NOT_SUPPORT' => '您选择到支付方式不受业务支持', + 'WECHAT_TRANSFER_CONFIG_NOT_EXIST' => '微信零钱打款设置未配置完善', 'PAYMENT_LOCK' => '支付中,请稍后再试', 'PAY_SUCCESS' => '当前支付已完成', 'PAY_IS_REMOVE' => '当前支付已取消', @@ -298,7 +306,10 @@ return [ 'SIGN_AWARD' => '签到奖励', 'GET_AWARD' => '恭喜您获得以下奖励', 'WILL_GET_AWARD' => '您将获得以下奖励', - 'SIGN_PERIOD_GREATER_THAN' => '签到周期必须大于0天', + 'SIGN_PERIOD_CANNOT_EMPTY' => '签到周期不能为空', + 'SIGN_PERIOD_BETWEEN_2_365_DAYS' => '签到周期为2-365天', + 'CONTINUE_SIGN_BETWEEN_2_365_DAYS' => '连签天数为2-365天', + 'CONTINUE_SIGN_CANNOT_GREATER_THAN_SIGN_PERIOD' => '连签天数不能大于签到周期', //导出相关 'EXPORT_SUCCESS' => '导出成功', diff --git a/niucloud/app/lang/zh-cn/dict.php b/niucloud/app/lang/zh-cn/dict.php index bfc8a4814..a5d229c98 100644 --- a/niucloud/app/lang/zh-cn/dict.php +++ b/niucloud/app/lang/zh-cn/dict.php @@ -198,10 +198,11 @@ return [ ], //转账相关 'dict_transfer' => [ - 'type_wechat' => '微信', + 'type_wechat' => '微信零钱', 'type_ali' => '支付宝', 'type_bank' => '银行卡', 'type_offline' => '线下转账', + 'type_wechat_code' => '微信',//微信线下打款 'status_wait' => '待转账', 'status_dealing' => '处理中', @@ -261,6 +262,9 @@ return [ 'dict_diy_form' => [ 'component_type_form' => '表单组件', 'type_diy_form' => '自定义表单', + 'type_sign_registration' => '签到报名登记', + 'type_leave_message_suggestion' => '留言建议', + 'type_write_off_voucher' => '核销凭证', ], //短信相关 'dict_sms' => [ @@ -282,6 +286,7 @@ return [ //状态 'status_wait_audit' => '待审核', 'status_wait_transfer' => '待转账', + 'status_transfer_ing' => '转账中', 'status_transfered' => '已转账', 'status_refuse' => '已拒绝', 'status_cancel' => '已取消' diff --git a/niucloud/app/listener/diy_form_export/DiyFormRecordsExportDataListener.php b/niucloud/app/listener/diy_form_export/DiyFormRecordsExportDataListener.php new file mode 100644 index 000000000..db9f49616 --- /dev/null +++ b/niucloud/app/listener/diy_form_export/DiyFormRecordsExportDataListener.php @@ -0,0 +1,76 @@ +where([ + [ 'diy_form_records.site_id', '=', $param[ 'site_id' ] ], + [ 'form_id', '=', $param[ 'where' ] [ 'form_id' ] ] + ])->field($field)->withSearch([ 'create_time' ], $param[ 'where' ]) + ->withJoin([ + 'member' => function($query) use ($member_where) { + $query->where($member_where); + } + ])->with([ + // 关联填写字段列表 + 'recordsFieldList' => function($query) { + $query->field('id, form_id, form_field_id, record_id, member_id, field_key, field_type, field_name, field_value, update_num, update_time')->append([ 'render_value' ]); + }, + 'form' + ]) + ->order($order); + if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) { + $data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray(); + } else { + $data = $search_model->select()->toArray(); + } + + $field_key_list = ( new DiyFormFields() )->where([ + [ 'form_id', '=', $param['where']['form_id'] ], + [ 'site_id', '=', $param['site_id'] ] + ])->column('field_key'); + + foreach ($data as $key => $value) { + $data[$key]['page_title'] = $value[ 'form' ]['page_title'] ?? ''; + $data[$key]['type_name'] = $value[ 'form' ]['type_name'] ?? ''; + $data[$key]['nickname'] = $value[ 'member' ]['nickname'] ?? ''; + $data[$key]['mobile'] = $value[ 'member' ]['mobile']."\t" ?? ''; + $list_key = array_column($value[ 'recordsFieldList' ], null, 'field_key'); + foreach ($field_key_list as $field_key) { + $data[$key][$field_key] = !empty($list_key[$field_key]) ? $list_key[$field_key]['render_value']."\t" : ''; + } + } + } + return $data; + } +} \ No newline at end of file diff --git a/niucloud/app/listener/diy_form_export/DiyFormRecordsExportTypeListener.php b/niucloud/app/listener/diy_form_export/DiyFormRecordsExportTypeListener.php new file mode 100644 index 000000000..cdba7c693 --- /dev/null +++ b/niucloud/app/listener/diy_form_export/DiyFormRecordsExportTypeListener.php @@ -0,0 +1,51 @@ + [ 'name' => '记录编号' ], + 'create_time' => [ 'name' => '填表时间' ], + 'page_title' => [ 'name' => '表单名称' ], + 'type_name' => [ 'name' => '表单类型' ], + 'form_id' => [ 'name' => '表单编号' ], + 'nickname' => [ 'name' => '填表人名称' ], + 'mobile' => [ 'name' => '填表人手机号' ], + ]; + if (!empty($param['where']['form_id'])) { + $field_list = ( new DiyFormFields() )->where([ + [ 'form_id', '=', $param['where']['form_id'] ], + [ 'site_id', '=', $param['site_id'] ] + ])->field('field_key,field_name')->select()->toArray(); + foreach ($field_list as $key => $value) { + $column[$value['field_key']] = [ 'name' => $value['field_name'] ]; + } + } + return [ + 'diy_form_records' => [ + 'name' => '表单填写明细', + 'column' => $column, + ] + ]; + } +} \ No newline at end of file diff --git a/niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportDataListener.php b/niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportDataListener.php new file mode 100644 index 000000000..9266a0737 --- /dev/null +++ b/niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportDataListener.php @@ -0,0 +1,46 @@ +where([ [ 'diy_form_records.site_id', '=', $param[ 'site_id' ] ] ])->withSearch([ 'form_id' ], $param[ 'where' ]) + ->withJoin(['member' => function ($query) use ($param) { + $query->where([ [ 'nickname|mobile', 'like', "%" . $param[ 'where' ]['keyword'] . "%" ] ]); + }])->field($field)->group('diy_form_records.member_id')->order($order); + if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) { + $data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray(); + } else { + $data = $search_model->select()->toArray(); + } + foreach ($data as $key => $value) { + $data[$key]['nickname'] = $value[ 'member' ]['nickname'] ?? ''; + } + } + return $data; + } +} \ No newline at end of file diff --git a/niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportTypeListener.php b/niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportTypeListener.php new file mode 100644 index 000000000..1e5101310 --- /dev/null +++ b/niucloud/app/listener/diy_form_export/DiyFormRecordsMemberExportTypeListener.php @@ -0,0 +1,34 @@ + [ + 'name' => '填表人统计列表', + 'column' => [ + 'nickname' => [ 'name' => '填表人名称' ], + 'write_count' => [ 'name' => '总计' ] + ] + ] + ]; + } +} \ No newline at end of file diff --git a/niucloud/app/listener/notice/Sms.php b/niucloud/app/listener/notice/Sms.php index d476fea24..e8a433eec 100644 --- a/niucloud/app/listener/notice/Sms.php +++ b/niucloud/app/listener/notice/Sms.php @@ -13,24 +13,24 @@ class Sms public function handle(array $data) { - $site_id = $data['site_id']; - $template = $data['template'];//模板 - $vars = $data['vars'];//模板变量 - $key = $data['key']; - $to = $data['to'];//发送对象主题 - $mobile = $to['mobile'] ?? ''; + $site_id = $data[ 'site_id' ]; + $template = $data[ 'template' ];//模板 + $vars = $data[ 'vars' ];//模板变量 + $key = $data[ 'key' ]; + $to = $data[ 'to' ];//发送对象主题 + $mobile = $to[ 'mobile' ] ?? ''; //完全信任消息的设置, 不再依赖support_type - if ($template['is_sms']) { - $sms_id = $template['sms_id'];//发送模板id - $content = $template['sms']['content']; - $member_id = $to['member_id'] ?? 0; - $uid = $to['uid'] ?? 0; + if ($template[ 'is_sms' ]) { + $sms_id = $template[ 'sms_id' ];//发送模板id + $content = $template[ 'sms' ][ 'content' ]; + $member_id = $to[ 'member_id' ] ?? 0; + $uid = $to[ 'uid' ] ?? 0; if (!$mobile) { //会员的 if ($member_id > 0) {//查询openid - $info = (new CoreMemberService())->getInfoByMemberId($site_id, $member_id); - $mobile = $info['mobile'] ?? ''; - $nickname = $info['nickname'] ?? ''; + $info = ( new CoreMemberService() )->getInfoByMemberId($site_id, $member_id); + $mobile = $info[ 'mobile' ] ?? ''; + $nickname = $info[ 'nickname' ] ?? ''; } } @@ -50,17 +50,17 @@ class Sms '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); + ( 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']) { + if (!$template[ 'async' ]) { throw new NoticeException($e->getMessage()); } } } else { - if (!$template['async']) { + if (!$template[ 'async' ]) { throw new NoticeException('NOTICE_NOT_OPEN_SMS'); } } diff --git a/niucloud/app/listener/system/AddSiteAfterListener.php b/niucloud/app/listener/system/AddSiteAfterListener.php index 337afe61c..cf41bb909 100644 --- a/niucloud/app/listener/system/AddSiteAfterListener.php +++ b/niucloud/app/listener/system/AddSiteAfterListener.php @@ -488,6 +488,19 @@ class AddSiteAfterListener 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... 'cate_id' => $category_id, // 素材分类id 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $category_id . 'nav_sow_community.png', // 附件名称 + 'real_name' => '种草社区', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_sow_community.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_sow_community.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '24576', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $category_id, // 素材分类id + 'create_time' => time() ] ]; $exist_attachment_list = $attachment_model->where([ @@ -509,23 +522,21 @@ class AddSiteAfterListener $attachment_model->insertAll($attachment_list); } - $poster_model = new Poster(); - $poster_count = $poster_model->where([ + $poster = new CorePosterService(); + // 存在则删除 + $poster->del([ [ 'site_id', '=', $site_id ], [ 'type', '=', 'friendspay' ] - ])->count(); - if ($poster_count == 0) { - // 创建默认找朋友帮忙付海报 - $poster = new CorePosterService(); - $template = $poster->getTemplateList('', 'friendspay')[ 0 ]; - $poster->add($site_id, '', [ - 'name' => $template[ 'name' ], - 'type' => $template[ 'type' ], - 'value' => $template[ 'data' ], - 'status' => 1, - 'is_default' => 1 - ]); - } + ]); + // 创建默认找朋友帮忙付海报 + $template = $poster->getTemplateList('', 'friendspay')[ 0 ]; + $poster->add($site_id, '', [ + 'name' => $template[ 'name' ], + 'type' => $template[ 'type' ], + 'value' => $template[ 'data' ], + 'status' => 1, + 'is_default' => 1 + ]); return true; } diff --git a/niucloud/app/listener/system/ShowAppListener.php b/niucloud/app/listener/system/ShowAppListener.php new file mode 100644 index 000000000..f67b65f3b --- /dev/null +++ b/niucloud/app/listener/system/ShowAppListener.php @@ -0,0 +1,54 @@ + [ + + ], + // 工具 + 'tool' => [ + [ + 'title' => '万能表单', + 'desc' => '适用于各种应用场景,满足多样化的业务需求', + 'icon' => 'static/resource/images/diy_form/icon.png', + 'key' => 'diy_form', + 'url' => '/diy_form/list', + ], +// [ +// 'title' => '万能a表单', +// 'desc' => '万能a表单', +// 'icon' => 'static/resource/images/diy_form/icon.png', +// 'key' => 'diy_faorm', +// 'url' => '/diy_faorm/list', +// ] + ], + // 营销 + 'promotion' => [ + + ] + ]; + } +} diff --git a/niucloud/app/model/diy/DiyTheme.php b/niucloud/app/model/diy/DiyTheme.php new file mode 100644 index 000000000..c5672c574 --- /dev/null +++ b/niucloud/app/model/diy/DiyTheme.php @@ -0,0 +1,44 @@ + 'timestamp', + 'update_time' => 'timestamp', + ]; + + /** + * 数据表主键 + * @var string + */ + protected $pk = 'form_id'; + + /** + * 模型名称 + * @var string + */ + protected $name = 'diy_form'; + + // 设置json类型字段 + protected $json = [ 'value', 'share' ]; + + // 设置JSON数据返回数组 + protected $jsonAssoc = true; + + /** + * 状态字段转化 + * @param $value + * @param $data + * @return mixed + */ + public function getTypeNameAttr($value, $data) + { + if (!empty($data[ 'type' ])) { + return TypeDict::getType([ 'key' => [ $data[ 'type' ] ] ])[ $data[ 'type' ] ][ 'title' ] ?? ''; + } + return ''; + } + + /** + * 状态字段转化:所属插件名称 + * @param $value + * @param $data + * @return array + */ + public function getAddonNameAttr($value, $data) + { + if (empty($data[ 'addon' ])) { + return []; + } + return ( new Addon() )->where([ [ 'key', '=', $data[ 'addon' ] ] ])->column('title'); + } + + /** + * 状态字段转化 + * @param $value + * @param $data + * @return mixed + */ + public function getShareAttr($value, $data) + { + if (empty($data[ 'share' ])) { + $data[ 'share' ] = [ + 'wechat' => [ + 'title' => $data[ 'title' ], + 'desc' => '', + 'url' => '' + ], + 'weapp' => [ + 'title' => $data[ 'title' ], + 'url' => '' + ] + ]; + } + return $data[ 'share' ] ?? ''; + } + + /** + * 搜索器:表单id + * @param $query + * @param $value + * @param $data + */ + public function searchFormIdAttr($query, $value, $data) + { + if ($value) { + $query->where("form_id", $value); + } + } + + /** + * 搜索器:表单名称 + * @param $query + * @param $value + * @param $data + */ + public function searchTitleAttr($query, $value, $data) + { + if ($value != '') { + $query->where("title|page_title", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); + } + } + + /** + * 搜索器:表单类型 + * @param $query + * @param $value + * @param $data + */ + public function searchTypeAttr($query, $value, $data) + { + if ($value) { + $query->where("type", $value); + } + } + + /** + * 搜索器:所属插件标识 + * @param $query + * @param $value + * @param $data + */ + public function searchAddonAttr($query, $value, $data) + { + if ($value) { + $query->where("addon", $value); + } + } + + /** + * 搜索器:状态 + * @param $query + * @param $value + * @param $data + */ + public function searchStatusAttr($query, $value, $data) + { + if ($value !== '') { + $query->where("status", $value); + } + } + + /** + * + * @return HasOne + */ + public function writeConfig() + { + return $this->hasOne(DiyFormWriteConfig::class, 'form_id', 'form_id'); + } + + /** + * + * @return HasOne + */ + public function submitConfig() + { + return $this->hasOne(DiyFormSubmitConfig::class, 'form_id', 'form_id'); + } + + /** + * + * @return hasMany + */ + public function formField() + { + return $this->hasMany(DiyFormFields::class, 'form_id', 'form_id'); + } + +} diff --git a/niucloud/app/model/diy_form/DiyFormFields.php b/niucloud/app/model/diy_form/DiyFormFields.php new file mode 100644 index 000000000..f3f034773 --- /dev/null +++ b/niucloud/app/model/diy_form/DiyFormFields.php @@ -0,0 +1,159 @@ + 'timestamp', + 'update_time' => 'timestamp', + ]; + + /** + * 数据表主键 + * @var string + */ + protected $pk = 'field_id'; + + /** + * 模型名称 + * @var string + */ + protected $name = 'diy_form_fields'; + + /** + * 搜索器:字段id + * @param $query + * @param $value + * @param $data + */ + public function searchFieldIdAttr($query, $value, $data) + { + if ($value) { + $query->where("field_id", $value); + } + } + + /** + * 搜索器:表单id + * @param $query + * @param $value + * @param $data + */ + public function searchFormIdAttr($query, $value, $data) + { + if ($value) { + $query->where("form_id", $value); + } + } + + /** + * 搜索器:字段唯一标识 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldKeyAttr($query, $value, $data) + { + if ($value) { + $query->where("field_key", $value); + } + } + + /** + * 搜索器:字段类型 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldTypeAttr($query, $value, $data) + { + if ($value) { + $query->where("field_type", $value); + } + } + + /** + * 搜索器:字段名称 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldNameAttr($query, $value, $data) + { + if ($value) { + $query->where("field_name", 'like', '%' . $value . '%'); + } + } + + /** + * 搜索器:字段是否必填 0:否 1:是 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldRequiredAttr($query, $value, $data) + { + if ($value) { + $query->where("field_required", $value); + } + } + + /** + * 搜索器:字段是否隐藏 0:否 1:是 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldHiddenAttr($query, $value, $data) + { + if ($value) { + $query->where("field_hidden", $value); + } + } + + /** + * 搜索器:字段内容防重复 0:否 1:是 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldUniqueAttr($query, $value, $data) + { + if ($value) { + $query->where("field_unique", $value); + } + } + + /** + * 搜索器:隐私保护 0:关闭 1:开启 + * @param $query + * @param $value + * @param $data + */ + public function searchPrivacyProtectionAttr($query, $value, $data) + { + if ($value) { + $query->where("privacy_protection", $value); + } + } + +} diff --git a/niucloud/app/model/diy_form/DiyFormRecords.php b/niucloud/app/model/diy_form/DiyFormRecords.php new file mode 100644 index 000000000..ff067206a --- /dev/null +++ b/niucloud/app/model/diy_form/DiyFormRecords.php @@ -0,0 +1,144 @@ + 'timestamp', + 'update_time' => 'timestamp', + ]; + + /** + * 数据表主键 + * @var string + */ + protected $pk = 'record_id'; + + /** + * 模型名称 + * @var string + */ + protected $name = 'diy_form_records'; + + // 设置json类型字段 + protected $json = [ 'value' ]; + + // 设置JSON数据返回数组 + protected $jsonAssoc = true; + + /** + * 搜索器:记录id + * @param $query + * @param $value + * @param $data + */ + public function searchRecordIdAttr($query, $value, $data) + { + if ($value) { + $query->where("record_id", $value); + } + } + + /** + * 搜索器:关联表单id + * @param $query + * @param $value + * @param $data + */ + public function searchFormIdAttr($query, $value, $data) + { + if ($value) { + $query->where("form_id", $value); + } + } + + /** + * 搜索器:创建时间 + * @param $query + * @param $value + * @param $data + */ + 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('diy_form_records.create_time', $start_time, $end_time); + } else if ($start_time > 0 && $end_time == 0) { + $query->where([ [ 'diy_form_records.create_time', '>=', $start_time ] ]); + } else if ($start_time == 0 && $end_time > 0) { + $query->where([ [ 'diy_form_records.create_time', '<=', $end_time ] ]); + } + } + + /** + * 会员关联 + * @return HasOne + */ + public function member() + { + return $this->hasOne(Member::class, 'member_id', 'member_id')->joinType('left') + ->withField('member_id,member_no, username, mobile, nickname, headimg'); + } + + /** + * 关联表单字段列表 + * @return \think\model\relation\HasMany + */ + public function formFieldList() + { + return $this->hasMany(DiyFormFields::class, 'form_id', 'form_id'); + } + + /** + * 关联填写字段列表 + * @return \think\model\relation\HasMany + */ + public function recordsFieldList() + { + return $this->hasMany(DiyFormRecordsFields::class, 'record_id', 'record_id'); + } + + /** + * 关联表单提交页配置 + * @return HasOne + */ + public function submitConfig() + { + return $this->hasOne(DiyFormSubmitConfig::class, 'form_id', 'form_id')->joinType('left') + ->withField('id,form_id,submit_after_action,tips_type,tips_text,success_after_action'); + } + + /** + * 表单关联 + * @return HasOne + */ + public function form() + { + return $this->hasOne(DiyForm::class, 'form_id', 'form_id')->joinType('left') + ->withField('form_id,page_title,type')->append([ 'type_name' ]); + } + +} diff --git a/niucloud/app/model/diy_form/DiyFormRecordsFields.php b/niucloud/app/model/diy_form/DiyFormRecordsFields.php new file mode 100644 index 000000000..f7aa9b094 --- /dev/null +++ b/niucloud/app/model/diy_form/DiyFormRecordsFields.php @@ -0,0 +1,218 @@ + 'timestamp', + 'update_time' => 'timestamp', + ]; + + /** + * 数据表主键 + * @var string + */ + protected $pk = 'id'; + + /** + * 模型名称 + * @var string + */ + protected $name = 'diy_form_records_fields'; + + /** + * 状态字段转化 + * @param $value + * @param $data + * @return mixed + */ + public function getRenderValueAttr($value, $data) + { + if (!empty($data[ 'field_value' ])) { + $component = ComponentDict::getComponent([ + 'component_name' => $data[ 'field_type' ] + ]); + $render_value = $data[ 'field_value' ]; // 默认渲染值 + if (isset($component[ 'render' ])) { + $render = $component[ 'render' ]; + if ($render instanceof \Closure) { + $render_value = $render($data[ 'field_value' ]); + } + } + return $render_value; + } + return ''; + } + + /** + * 状态字段转化 + * @param $value + * @param $data + * @return mixed + */ + public function getHandleFieldValueAttr($value, $data) + { + if (!empty($data[ 'field_value' ])) { + $component = ComponentDict::getComponent([ + 'component_name' => $data[ 'field_type' ] + ]); + $render_value = $data[ 'field_value' ]; // 默认渲染值 + if (isset($component[ 'convert' ])) { + $render = $component[ 'convert' ]; + if ($render instanceof \Closure) { + $render_value = $render($data[ 'field_value' ]); + } + } + return $render_value; + } + return ''; + } + + + /** + * 状态字段转化 + * @param $value + * @param $data + * @return mixed + */ + public function getDetailComponentAttr($value, $data) + { + if (!empty($data[ 'field_key' ])) { + $detail_component = ''; + $component = ComponentDict::getComponent([ 'component_name' => $data[ 'field_type' ] ]); + if (!empty($component)) { + $detail_component = $component[ 'value' ][ 'field' ][ 'detailComponent' ] ?? ''; + } + if (empty($detail_component)) { + $detail_component = '/src/app/views/diy_form/components/detail-form-render.vue'; + } + return $detail_component; + } + return ''; + } + + /** + * 搜索器:表单id + * @param $query + * @param $value + * @param $data + */ + public function searchFormIdAttr($query, $value, $data) + { + if ($value) { + $query->where("form_id", $value); + } + } + + /** + * 搜索器:字段唯一标识 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldKeyAttr($query, $value, $data) + { + if ($value) { + $query->where("field_key", $value); + } + } + + /** + * 搜索器:字段类型 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldTypeAttr($query, $value, $data) + { + if ($value) { + $query->where("field_type", $value); + } + } + + /** + * 搜索器:字段名称 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldNameAttr($query, $value, $data) + { + if ($value) { + $query->where("field_name", 'like', '%' . $value . '%'); + } + } + + /** + * 搜索器:字段是否必填 0:否 1:是 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldRequiredAttr($query, $value, $data) + { + if ($value) { + $query->where("field_required", $value); + } + } + + /** + * 搜索器:字段是否隐藏 0:否 1:是 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldHiddenAttr($query, $value, $data) + { + if ($value) { + $query->where("field_hidden", $value); + } + } + + /** + * 搜索器:字段内容防重复 0:否 1:是 + * @param $query + * @param $value + * @param $data + */ + public function searchFieldUniqueAttr($query, $value, $data) + { + if ($value) { + $query->where("field_unique", $value); + } + } + + /** + * 搜索器:隐私保护 0:关闭 1:开启 + * @param $query + * @param $value + * @param $data + */ + public function searchPrivacyProtectionAttr($query, $value, $data) + { + if ($value) { + $query->where("privacy_protection", $value); + } + } + +} diff --git a/niucloud/app/model/diy_form/DiyFormSubmitConfig.php b/niucloud/app/model/diy_form/DiyFormSubmitConfig.php new file mode 100644 index 000000000..a1eee022f --- /dev/null +++ b/niucloud/app/model/diy_form/DiyFormSubmitConfig.php @@ -0,0 +1,61 @@ + 'timestamp', + 'update_time' => 'timestamp', + ]; + + // 设置json类型字段 + protected $json = [ 'time_limit_rule', 'voucher_content_rule', 'success_after_action' ]; + + // 设置JSON数据返回数组 + protected $jsonAssoc = true; + + /** + * 数据表主键 + * @var string + */ + protected $pk = 'id'; + + /** + * 模型名称 + * @var string + */ + protected $name = 'diy_form_submit_config'; + + /** + * 搜索器:表单id + * @param $query + * @param $value + * @param $data + */ + public function searchFormIdAttr($query, $value, $data) + { + if ($value) { + $query->where("form_id", $value); + } + } + +} diff --git a/niucloud/app/model/diy_form/DiyFormWriteConfig.php b/niucloud/app/model/diy_form/DiyFormWriteConfig.php new file mode 100644 index 000000000..a4ce17338 --- /dev/null +++ b/niucloud/app/model/diy_form/DiyFormWriteConfig.php @@ -0,0 +1,61 @@ + 'timestamp', + 'update_time' => 'timestamp', + ]; + + // 设置json类型字段 + protected $json = [ 'level_ids', 'label_ids', 'member_write_rule', 'form_write_rule', 'time_limit_rule' ]; + + // 设置JSON数据返回数组 + protected $jsonAssoc = true; + + /** + * 数据表主键 + * @var string + */ + protected $pk = 'id'; + + /** + * 模型名称 + * @var string + */ + protected $name = 'diy_form_write_config'; + + /** + * 搜索器:表单id + * @param $query + * @param $value + * @param $data + */ + public function searchFormIdAttr($query, $value, $data) + { + if ($value) { + $query->where("form_id", $value); + } + } + +} diff --git a/niucloud/app/model/member/Member.php b/niucloud/app/model/member/Member.php index afa6cd793..7b0cb364b 100644 --- a/niucloud/app/model/member/Member.php +++ b/niucloud/app/model/member/Member.php @@ -268,4 +268,5 @@ class Member extends BaseModel { return $this->hasOne(MemberLevel::class, 'level_id', 'member_level')->bind([ 'member_level_name' => 'level_name' ]); } + } diff --git a/niucloud/app/model/member/MemberCashOut.php b/niucloud/app/model/member/MemberCashOut.php index 0daa209b9..8ce9aa552 100644 --- a/niucloud/app/model/member/MemberCashOut.php +++ b/niucloud/app/model/member/MemberCashOut.php @@ -40,6 +40,12 @@ class MemberCashOut extends BaseModel 'transfer_time' => 'timestamp', ]; + // 设置json类型字段 + protected $json = [ 'transfer_payee' ]; + + // 设置JSON数据返回数组 + protected $jsonAssoc = true; + /** * 会员信息 * @return HasOne diff --git a/niucloud/app/model/pay/Transfer.php b/niucloud/app/model/pay/Transfer.php index 6426fef8c..621a4cb7b 100644 --- a/niucloud/app/model/pay/Transfer.php +++ b/niucloud/app/model/pay/Transfer.php @@ -41,6 +41,12 @@ class Transfer extends BaseModel 'finish_time' => 'timestamp', ]; + // 设置json类型字段 + protected $json = [ 'transfer_payee' ]; + + // 设置JSON数据返回数组 + protected $jsonAssoc = true; + /** * 状态字段转化 * @param $value diff --git a/niucloud/app/service/admin/diy/DiyService.php b/niucloud/app/service/admin/diy/DiyService.php index 4b09b548f..d0e911480 100644 --- a/niucloud/app/service/admin/diy/DiyService.php +++ b/niucloud/app/service/admin/diy/DiyService.php @@ -16,9 +16,13 @@ use app\dict\diy\LinkDict; use app\dict\diy\PagesDict; use app\dict\diy\TemplateDict; use app\dict\sys\FileDict; +use app\model\addon\Addon; use app\model\diy\Diy; +use app\model\diy\DiyTheme; use app\service\admin\sys\SystemService; use app\service\core\diy\CoreDiyConfigService; +use app\service\core\diy\CoreDiyService; +use app\service\core\site\CoreSiteService; use core\base\BaseAdminService; use core\exception\AdminException; use Exception; @@ -26,6 +30,7 @@ use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; use think\facade\Db; +use think\facade\Log; /** * 自定义页面服务层 @@ -809,4 +814,111 @@ class DiyService extends BaseAdminService return $res->id; } + /** + * 获取自定义主题配色 + * @return array + */ + public function getDiyTheme() + { + $site_addon = ( new CoreSiteService() )->getSiteCache($this->site_id); + $theme_data = ( new DiyTheme() )->where([['site_id', '=', $this->site_id], ['type', '=', 'app']])->column('id,color_mark,color_name,diy_value,value,title,mode','addon'); + $defaultColor = ( new CoreDiyService() )->getDefaultColor(); + $app_theme['app'] = [ + 'id' => $theme_data['app']['id'] ?? '', + 'icon' => '', + 'addon_title' => '系统', + 'mode' => 'diy', + 'title' => $theme_data['app']['title'] ?? '系统主色调', + 'color_mark' => $theme_data['app']['color_mark'] ?? $defaultColor['name'], + 'color_name' => $theme_data['app']['color_name'] ?? $defaultColor['title'], + 'value' => $theme_data['app']['value'] ?? $defaultColor['theme'], + 'diy_value' => $theme_data['app']['diy_value'] ?? '', + ]; + $data = []; + foreach ($site_addon[ 'apps' ] as $value){ + $default_theme_data = array_values(array_filter(event('ThemeColor', [ 'key' => $value['key']])))[0] ?? []; + $data[$value['key']]['id'] = $theme_data[$value['key']]['id'] ?? ''; + $data[$value['key']]['icon'] = $value['icon'] ?? ''; + $data[$value['key']]['mode'] = $theme_data[$value['key']]['mode'] ?? 'diy'; + $data[$value['key']]['addon_title'] = $value['title'] ?? ''; + $data[$value['key']]['title'] = $theme_data[$value['key']]['title'] ?? $value['title'].'主色调'; + $data[$value['key']]['color_mark'] = $theme_data[$value['key']]['color_mark'] ?? ($default_theme_data ? $default_theme_data[ 'name' ] : $defaultColor['name']); + $data[$value['key']]['color_name'] = $theme_data[$value['key']]['color_name'] ?? ($default_theme_data ? $default_theme_data[ 'title' ] : $defaultColor['title']); + $data[$value['key']]['value'] = $theme_data[$value['key']]['value'] ?? ($default_theme_data ? $default_theme_data[ 'theme' ] : $defaultColor['theme']); + $data[$value['key']]['diy_value'] = $theme_data[$value['key']]['diy_value'] ?? ''; + } + if (count($site_addon[ 'apps' ]) > 1) { + $data = array_merge($app_theme,$data); + } + + return $data; + } + + /** + * 设置主题配色 + * @param array $data + * @return bool + */ + public function setDiyTheme($data) + { + $diy_theme_model = new (new DiyTheme()); + + $addon_data = (new addon())->where([['support_app', '=', $data['key']]])->select()->toArray(); + $addon_save_data = []; + if (!empty($addon_data)){ + foreach ($addon_data as $value){ + $addon_save_data[] = [ + 'site_id' => $this->site_id, + 'type' => 'addon', + 'addon' => $value['key'], + 'color_mark' => $data['color_mark'], + 'color_name' => $data['color_name'], + 'mode' => $data['mode'], + 'value' => $data['value'], + 'diy_value' => $data['diy_value'], + 'update_time' => time(), + ]; + } + } + + try { + Db::startTrans(); + if(!empty($data['id'])){ + $data['update_time'] = time(); + unset($data['key']); + $diy_theme_model->where([['id', '=', $data['id']], ['site_id', '=', $this->site_id]])->update($data); + if (!empty($addon_save_data)){ + foreach ($addon_save_data as $value){ + $diy_theme_model->where([['addon', '=', $value['addon']], ['site_id', '=', $this->site_id]])->update($value); + } + } + }else{ + $data['site_id'] = $this->site_id; + $data['type'] = 'app'; + $data['addon'] = $data['key']; + $data['crete_time'] = time(); + unset($data['id'],$data['key']); + array_unshift($addon_save_data, $data); + foreach ($addon_save_data as $value){ + unset($value['update_time']); + $diy_theme_model->create($value); + } + } + Db::commit(); + return true; + } catch (Exception $e) { + Db::rollback(); + throw new AdminException($e->getMessage()); + } + } + + /** + * 获取默认主题配色 + * @return array + */ + public function getDefaultThemeColor() + { + return ( new CoreDiyService() )->getDefaultThemeColor(); + } + } diff --git a/niucloud/app/service/admin/diy_form/DiyFormConfig.php b/niucloud/app/service/admin/diy_form/DiyFormConfig.php new file mode 100644 index 000000000..5be0c0348 --- /dev/null +++ b/niucloud/app/service/admin/diy_form/DiyFormConfig.php @@ -0,0 +1,78 @@ +site_id; + return ( new CoreDiyFormConfigService() )->editWriteConfig($data); + } + + /** + * 获取表单填写配置 + * @param $form_id + * @return mixed + */ + public function getWriteConfig($form_id) + { + $data = [ + 'site_id' => $this->site_id, + 'form_id' => $form_id + ]; + return ( new CoreDiyFormConfigService() )->getWriteConfig($data); + } + + /** + * 编辑提交配置 + * @param array $data + * @return mixed + */ + public function editSubmitConfig($data) + { + $data[ 'site_id' ] = $this->site_id; + return ( new CoreDiyFormConfigService() )->editSubmitConfig($data); + } + + /** + * 获取表单提交成功页配置 + * @param $form_id + * @return mixed + */ + public function getSubmitConfig($form_id) + { + $data = [ + 'site_id' => $this->site_id, + 'form_id' => $form_id + ]; + return ( new CoreDiyFormConfigService() )->getSubmitConfig($data); + } +} diff --git a/niucloud/app/service/admin/diy_form/DiyFormRecordsService.php b/niucloud/app/service/admin/diy_form/DiyFormRecordsService.php new file mode 100644 index 000000000..2baeb268f --- /dev/null +++ b/niucloud/app/service/admin/diy_form/DiyFormRecordsService.php @@ -0,0 +1,139 @@ +model = new DiyFormRecords(); + } + + /** + * 获取万能表单填表人统计列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 'form_id, diy_form_records.member_id, count(*) as write_count'; + $search_model = $this->model->where([ [ 'diy_form_records.site_id', '=', $this->site_id ] ])->withSearch([ 'form_id' ], $where) + ->withJoin([ 'member' => function($query) use ($where) { + $query->where([ [ 'nickname|mobile', 'like', "%" . $where[ 'keyword' ] . "%" ] ]); + } ])->field($field)->group('diy_form_records.member_id'); + return $this->pageQuery($search_model); + } + + /** + * 获取万能表单字段统计列表 + * @param array $where + * @return array + */ + public function getFieldStatList(array $where = []) + { + $field_list = ( new DiyFormService() )->getFieldsList($where, 'field_id, field_key, field_type, field_name'); + $simple_field_list = array_filter($field_list, function($v) { return !in_array($v[ 'field_type' ], [ 'FormRadio', 'FormCheckbox', 'FormDateScope', 'FormTimeScope', 'FormImage' ]); }); + $json_field_list = array_filter($field_list, function($v) { return in_array($v[ 'field_type' ], [ 'FormRadio', 'FormCheckbox', 'FormDateScope', 'FormTimeScope' ]); }); + + $records_field_model = new DiyFormRecordsFields(); + foreach ($simple_field_list as $k => &$v) { + $value_list = $records_field_model->field('form_id, field_key, field_type, field_value, count(*) as write_count')->where([ + [ 'site_id', '=', $this->site_id ], + [ 'field_key', '=', $v[ 'field_key' ] ], + [ 'field_type', '=', $v[ 'field_type' ] ] + ])->withSearch([ 'form_id' ], $where)->group('field_value')->append([ 'render_value' ])->select()->toArray(); + $total_count = $records_field_model->where([ + [ 'site_id', '=', $this->site_id ], + [ 'field_key', '=', $v[ 'field_key' ] ], + [ 'field_type', '=', $v[ 'field_type' ] ] + ])->withSearch([ 'form_id' ], $where)->count(); + if ($total_count > 0) { + $total_percent = 100; + foreach ($value_list as $k1 => &$v1) { + if ($k1 == count($value_list) - 1) { + $item_percent = $total_percent; + } else { + $item_percent = round($v1['write_count'] / $total_count * 100, 2); + } + $v1['write_percent'] = floatval($item_percent); + $total_percent = bcsub($total_percent, $item_percent, 2); + } + } + $v[ 'value_list' ] = $value_list; + } + foreach ($json_field_list as $k => &$v) { + $field_list = $records_field_model->field('form_id, field_key, field_type, field_value')->where([ + [ 'site_id', '=', $this->site_id ], + [ 'field_key', '=', $v[ 'field_key' ] ], + [ 'field_type', '=', $v[ 'field_type' ] ] + ])->withSearch([ 'form_id' ], $where)->append([ 'render_value' ])->select()->toArray(); + + $total_count = 0; + $value_list = []; + foreach ($field_list as $k1 => &$v1) { + if ($v1[ 'field_type' ] != 'FormCheckbox') { + $key = $v1[ 'field_key' ] . '_' . $v1[ 'render_value' ]; + if (isset($value_list[ $key ])) { + $value_list[ $key ][ 'write_count' ] = $value_list[ $key ][ 'write_count' ] + 1; + $total_count++; + } else { + // 如果不存在,则初始化为1 + $value_list[ $key ] = $v1; + $value_list[ $key ][ 'write_count' ] = 1; + $total_count++; + } + } else { + $value_arr = explode(',', $v1[ 'render_value' ]); + foreach ($value_arr as $k2 => $v2) { + $key = $v1[ 'field_key' ] . '_' . $v2; + if (isset($value_list[ $key ])) { + $value_list[ $key ][ 'write_count' ] = $value_list[ $key ][ 'write_count' ] + 1; + $total_count++; + } else { + $value_list[ $key ] = $v1; + $value_list[ $key ][ 'render_value' ] = $v2; + $value_list[ $key ][ 'write_count' ] = 1; + $total_count++; + } + } + } + } + if ($total_count > 0) { + $value_list = array_values($value_list); + $total_percent = 100; + foreach ($value_list as $k1 => &$v1) { + if ($k1 == count($value_list) - 1) { + $item_percent = $total_percent; + } else { + $item_percent = round($v1['write_count'] / $total_count * 100, 2); + } + $v1['write_percent'] = floatval($item_percent); + $total_percent = bcsub($total_percent, $item_percent, 2); + } + } + $v[ 'value_list' ] = $value_list; + } + return array_merge($simple_field_list, $json_field_list); + } + +} diff --git a/niucloud/app/service/admin/diy_form/DiyFormService.php b/niucloud/app/service/admin/diy_form/DiyFormService.php new file mode 100644 index 000000000..052973402 --- /dev/null +++ b/niucloud/app/service/admin/diy_form/DiyFormService.php @@ -0,0 +1,636 @@ +model = new DiyForm(); + } + + /** + * 获取万能表单分页列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $where[] = [ 'site_id', '=', $this->site_id ]; + $field = 'form_id, page_title, title, type, status, addon, share, write_num, remark, update_time'; + $order = "form_id desc"; + + $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ "title", "type", 'addon' ], $where)->field($field)->order($order)->append([ 'type_name', 'addon_name' ]); + return $this->pageQuery($search_model); + } + + /** + * 获取万能表单列表 + * @param array $where + * @param string $field + * @return array + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ + public function getList(array $where = [], $field = 'form_id, page_title, title, type, status, addon, share, write_num, remark, update_time') + { + $order = "form_id desc"; + return $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ "title", "type", 'addon', 'status' ], $where)->field($field)->order($order)->append([ 'type_name', 'addon_name' ])->select()->toArray(); + } + + /** + * 获取万能表单信息 + * @param int $form_id + * @param string $field + * @return mixed + */ + public function getInfo(int $form_id, $field = 'form_id, page_title, title, type, status, value, addon, share, write_num,template') + { + return $this->model->field($field)->where([ [ 'form_id', '=', $form_id ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray(); + } + + /** + * 获取万能表单数量 + * @param array $where + * @return mixed + */ + public function getCount(array $where = []) + { + return $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'type' ], $where)->count(); + } + + /** + * 添加万能表单 + * @param array $data + * @return mixed + */ + public function add(array $data) + { + Db::startTrans(); + try { + if (empty($data[ 'site_id' ])) { + $data[ 'site_id' ] = $this->site_id; + } + $data[ 'status' ] = 1; // 默认为开启状态 + $data[ 'create_time' ] = time(); + $data[ 'update_time' ] = time(); + $data[ 'addon' ] = TypeDict::getType([ 'type' => $data[ 'type' ] ])[ 'addon' ] ?? ''; + $res = $this->model->create($data); + + $diy_form_fields = []; + if (!empty($data[ 'value' ])) { + + $value = json_decode($data[ 'value' ], true); + foreach ($value[ 'value' ] as $component) { + // 过滤非表单组件和表单提交按钮组件 + if ($component[ 'componentType' ] != 'diy_form' || $component[ 'componentName' ] == 'FormSubmit') { + continue; + } + + if (isset($component[ 'field' ][ 'default' ]) && is_array($component[ 'field' ][ 'default' ])) { + $component[ 'field' ][ 'default' ] = json_encode($component[ 'field' ][ 'default' ]); + } + + $diy_form_fields[] = [ + 'site_id' => $this->site_id, + 'form_id' => $res->form_id, // 所属万能表单id + 'field_key' => $component[ 'id' ], // 字段唯一标识 + 'field_type' => $component[ 'componentName' ], // 字段类型 + 'field_name' => $component[ 'field' ][ 'name' ] ?? '', // 字段名称 + 'field_remark' => $component[ 'field' ][ 'remark' ][ 'text' ] ?? '', // 字段说明 + 'field_default' => $component[ 'field' ][ 'default' ] ?? '', // 字段默认值 + 'field_required' => $component[ 'field' ][ 'required' ], // 字段是否必填 0:否 1:是 + 'field_hidden' => $component[ 'isHidden' ], // 字段是否隐藏 0:否 1:是 + 'field_unique' => $component[ 'field' ][ 'unique' ], // 字段内容防重复 0:否 1:是 + 'privacy_protection' => $component[ 'field' ][ 'privacyProtection' ], // 隐私保护 0:关闭 1:开启 + 'create_time' => time(), + 'update_time' => time() + ]; + } + } + $form_fields_model = new DiyFormFields(); + $form_fields_model->insertAll($diy_form_fields); + + // 初始化表单填写配置 + ( new CoreDiyFormConfigService() )->addWriteConfig([ 'site_id' => $this->site_id, 'form_id' => $res->form_id ]); + + // 初始化表单提交成功页配置 + ( new CoreDiyFormConfigService() )->addSubmitConfig([ 'site_id' => $this->site_id, 'form_id' => $res->form_id ]); + Db::commit(); + return $res->id; + } catch (\Exception $e) { + Db::rollback(); + throw new CommonException($e->getMessage()); + } + } + + /** + * 编辑万能表单 + * @param int $form_id + * @param array $data + * @return bool + */ + public function edit(int $form_id, array $data) + { + + Db::startTrans(); + try { + $data[ 'update_time' ] = time(); + if (empty($data[ 'site_id' ])) { + $data[ 'site_id' ] = $this->site_id; + } + + // 更新万能表单 + $this->model->where([ [ 'site_id', '=', $data[ 'site_id' ] ], [ 'form_id', '=', $form_id ] ])->update($data); + + // 更新万能表单字段信息 + $form_fields_model = new DiyFormFields(); + + if (!empty($data[ 'value' ])) { + $value = json_decode($data[ 'value' ], true); + + if (!empty($value[ 'value' ])) { + $form_fields_add = $form_fields_update = $form_fields_delete_ids = []; + + $form_component = []; // 存储表单组件集合 + $form_fields_list = $form_fields_model->where([ [ 'site_id', '=', $this->site_id ], [ 'form_id', '=', $form_id ] ])->column('field_id', 'field_key'); + + foreach ($value[ 'value' ] as $component) { + // 过滤非表单组件和表单提交按钮组件 + if ($component[ 'componentType' ] != 'diy_form' || $component[ 'componentName' ] == 'FormSubmit') { + continue; + } + + if (isset($component[ 'field' ][ 'default' ]) && is_array($component[ 'field' ][ 'default' ])) { + $component[ 'field' ][ 'default' ] = json_encode($component[ 'field' ][ 'default' ]); + } + + $form_component[] = $component; + if (isset($form_fields_list[ $component[ 'id' ] ])) { + $form_fields_update = [ + 'field_id' => $form_fields_list[ $component[ 'id' ] ], + 'field_name' => $component[ 'field' ][ 'name' ] ?? '', // 字段名称 + 'field_remark' => $component[ 'field' ][ 'remark' ][ 'text' ] ?? '', // 字段说明 + 'field_default' => $component[ 'field' ][ 'default' ] ?? '', // 字段默认值 + 'field_required' => $component[ 'field' ][ 'required' ], // 字段是否必填 0:否 1:是 + 'field_hidden' => $component[ 'isHidden' ], // 字段是否隐藏 0:否 1:是 + 'field_unique' => $component[ 'field' ][ 'unique' ], // 字段内容防重复 0:否 1:是 + 'privacy_protection' => $component[ 'field' ][ 'privacyProtection' ], // 隐私保护 0:关闭 1:开启 + 'update_time' => time() + ]; + // 更新万能表单字段 + $form_fields_model->where([ + [ 'site_id', '=', $this->site_id ], + [ 'field_id', '=', $form_fields_list[ $component[ 'id' ] ] ] + ])->update($form_fields_update); + } else { + $form_fields_add[] = [ + 'site_id' => $this->site_id, + 'form_id' => $form_id, + 'field_key' => $component[ 'id' ], // 字段唯一标识 + 'field_type' => $component[ 'componentName' ], // 字段类型 + 'field_name' => $component[ 'field' ][ 'name' ] ?? '', // 字段名称 + 'field_remark' => $component[ 'field' ][ 'remark' ][ 'text' ] ?? '', // 字段说明 + 'field_default' => $component[ 'field' ][ 'default' ] ?? '', // 字段默认值 + 'field_required' => $component[ 'field' ][ 'required' ], // 字段是否必填 0:否 1:是 + 'field_hidden' => $component[ 'isHidden' ], // 字段是否隐藏 0:否 1:是 + 'field_unique' => $component[ 'field' ][ 'unique' ], // 字段内容防重复 0:否 1:是 + 'privacy_protection' => $component[ 'field' ][ 'privacyProtection' ], // 隐私保护 0:关闭 1:开启 + 'create_time' => time(), + 'update_time' => time() + ]; + } + } + + $field_key_list = array_column($form_component, 'id'); + $form_fields_delete_ids = array_diff(array_keys($form_fields_list), $field_key_list); + + // 添加万能表单字段 + if (!empty($form_fields_add)) { + $form_fields_model->insertAll($form_fields_add); + } + + // 删除万能表单字段 + if (!empty($form_fields_delete_ids)) { + $form_fields_model->where([ [ 'site_id', '=', $data[ 'site_id' ] ], [ 'form_id', '=', $form_id ], [ 'field_key', 'in', $form_fields_delete_ids ] ])->delete(); + } + + } else { + // 未找到表单组件,则全部清空 + $form_fields_model->where([ [ 'site_id', '=', $data[ 'site_id' ] ], [ 'form_id', '=', $form_id ] ])->delete(); + } + } + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + throw new CommonException($e->getMessage()); + } + } + + /** + * 删除万能表单 + * @param array $form_ids + * @return bool + */ + public function del(array $form_ids) + { + $where = [ + [ 'site_id', '=', $this->site_id ], + [ 'form_id', 'in', $form_ids ] + ]; + + $status_count = $this->model->where($where)->where([ [ 'status', '=', 1 ] ])->count(); + + if ($status_count > 0) throw new AdminException('ON_STATUS_PROHIBIT_DELETE'); + + $form_fields_model = new DiyFormFields(); + $form_records_model = new DiyFormRecords(); + $form_records_fields_model = new DiyFormRecordsFields(); + $form_submit_config_model = new DiyFormSubmitConfig(); + $form_write_config_model = new DiyFormWriteConfig(); + + Db::startTrans(); + try { + //删除万能表单表 + $this->model->where($where)->delete(); + + //删除万能表单字段表 + $form_fields_model->where($where)->delete(); + + //删除万能表单填写记录 + $form_records_model->where($where)->delete(); + + //删除万能表单填写字段 + $form_records_fields_model->where($where)->delete(); + + //删除万能表单提交页配置 + $form_submit_config_model->where($where)->delete(); + + //删除万能表单填写配置 + $form_write_config_model->where($where)->delete(); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + throw new CommonException($e->getMessage()); + } + } + + /** + * 页面加载初始化 + * @param array $params + * @return array + * @throws DbException + */ + public function getInit(array $params = []) + { + $time = time(); + $data = []; + if (!empty($params[ 'form_id' ])) { + $data = $this->getInfo($params[ 'form_id' ]); + } + + if (!empty($data)) { + $current_type = TypeDict::getType([ 'type' => $data[ 'type' ] ]); + $type_name = $current_type[ 'title' ]; + $data[ 'type_name' ] = $type_name; + } else { + if (!isset($params[ 'type' ]) || empty($params[ 'type' ])) throw new AdminException('DIY_FORM_TYPE_NOT_EXIST'); + $type = $params[ 'type' ]; + + // 新页面赋值 + $page_title = $params[ 'title' ] ? : '表单页面' . $time; // 页面标题(用于前台展示) + + $current_type = TypeDict::getType([ 'type' => $params[ 'type' ] ]); + $type_name = $current_type[ 'title' ]; + $title = $type_name; + $value = ''; + + $data = [ + 'page_title' => $page_title, // 页面名称(用于后台展示) + 'title' => $title, // 页面标题(用于前台展示) + 'type' => $type, + 'type_name' => $type_name, + 'value' => $value, + ]; + + } + + $data[ 'component' ] = $this->getComponentList($data[ 'type' ]); + $data[ 'domain_url' ] = ( new SystemService() )->getUrl(); + return $data; + } + + /** + * 修改分享内容 + * @param $data + * @return bool + */ + public function modifyShare($data) + { + $this->model->where([ [ 'site_id', '=', $this->site_id ], [ 'form_id', '=', $data[ 'form_id' ] ] ])->update([ 'share' => $data[ 'share' ] ]); + return true; + } + + /** + * 获取组件列表(表单组件+自定义装修的组件) + * @param string $type 支持表单类型 + * @return array + */ + public function getComponentList(string $type = '') + { + $componentType = function(&$component_list, $type) { + if (!empty($component_list)) { + foreach ($component_list as $k => &$value) { + if (!empty($value[ 'list' ])) { + foreach ($value[ 'list' ] as $ck => &$v) { + $v[ 'componentType' ] = $type; + } + } + } + } + }; + + $form_component_list = DiyFormComponentDict::getComponent(); + foreach ($form_component_list as $k => $v) { + // 查询组件支持的表单类型 + $sort_arr = []; + foreach ($v[ 'list' ] as $ck => $cv) { + $support = $cv[ 'support' ] ?? []; + if (!( count($support) == 0 || in_array($type, $support) )) { + unset($form_component_list[ $k ][ 'list' ][ $ck ]); + continue; + } + + $sort_arr [] = $cv[ 'sort' ]; + unset($form_component_list[ $k ][ 'list' ][ $ck ][ 'sort' ], $form_component_list[ $k ][ 'list' ][ $ck ][ 'support' ]); + } + array_multisort($sort_arr, SORT_ASC, $form_component_list[ $k ][ 'list' ]); //排序,根据 sort 排序 + } + $componentType($form_component_list, 'diy_form'); + + $diy_service = new DiyService(); + $diy_component_list = $diy_service->getComponentList(); + $componentType($diy_component_list, 'diy'); + + $data = array_merge($form_component_list, $diy_component_list); + return $data; + } + + /** + * 获取万能表单模板数据 + * @param $type + * @param $name + * @return array + */ + public function getPageData($type, $name) + { + $pages = PagesDict::getPages([ 'type' => $type ]); + return $pages[ $name ] ?? []; + } + + /** + * 复制万能表单 + * @param array $param + * @return mixed + */ + public function copy($param) + { + $info = $this->model + ->withoutfield('create_time,update_time') + ->with([ + 'writeConfig' => function($query) { + $query->withoutfield('id,create_time,update_time'); + }, + 'submitConfig' => function($query) { + $query->withoutfield('id,create_time,update_time'); + }, + 'formField' => function($query) { + $query->withoutfield('field_id,create_time,update_time'); + } ]) + ->where([ [ 'form_id', '=', $param[ 'form_id' ] ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray(); + if (empty($info)) throw new AdminException('DIY_FORM_NOT_EXIST'); + unset($info[ 'form_id' ]); + $info[ 'page_title' ] = $info[ 'page_title' ] . '_副本'; + $info[ 'status' ] = 0; + $info[ 'share' ] = ''; + $info[ 'write_num' ] = 0; + $info[ 'create_time' ] = time(); + $info[ 'update_time' ] = time(); + + Db::startTrans(); + try { + $res = $this->model->create($info); + $form_id = $res->form_id; + if (!empty($info[ 'formField' ])) { + $form_field_list = array_map(function($item) use ($form_id) { + $item[ 'form_id' ] = $form_id; + $item[ 'write_num' ] = 0; + $item[ 'create_time' ] = time(); + $item[ 'update_time' ] = time(); + return $item; + }, $info[ 'formField' ]); + + ( new DiyFormFields() )->saveALl($form_field_list); + unset($info[ 'formField' ]); + } + if (!empty($info[ 'writeConfig' ])) { + $info[ 'writeConfig' ][ 'form_id' ] = $form_id; + ( new CoreDiyFormConfigService() )->addWriteConfig($info[ 'writeConfig' ]); + } + if (!empty($info[ 'submitConfig' ])) { + $info[ 'submitConfig' ][ 'form_id' ] = $form_id; + ( new CoreDiyFormConfigService() )->addSubmitConfig($info[ 'submitConfig' ]); + } + Db::commit(); + return $form_id; + } catch (\Exception $e) { + Db::rollback(); + throw new CommonException($e->getMessage()); + } + } + + /** + * 获取页面模板 + * @param array $params + * @return array + */ + public function getTemplate($params = []) + { + $page_template = TemplateDict::getTemplate($params); + return $page_template; + } + + /** + * 获取万能表单类型 + * @return array|null + */ + public function getFormType() + { + $type_list = TypeDict::getType(); + return $type_list; + } + + /** + * 修改状态 + * @param $data + * @return Bool + */ + public function modifyStatus($data) + { + return $this->model->where([ + [ 'form_id', '=', $data[ 'form_id' ] ], + [ 'site_id', '=', $this->site_id ] + ])->update([ 'status' => $data[ 'status' ] ]); + } + + /** + * 获取使用记录 + * @param array $data + * @return array|null + */ + public function getRecordPages($data) + { + $data[ 'site_id' ] = $this->site_id; + return ( new CoreDiyFormRecordsService() )->getPage($data); + } + + /** + * 获取使用记录 + * @param int $record_id + * @return array|null + */ + public function getRecordInfo(int $record_id) + { + $data[ 'site_id' ] = $this->site_id; + $data[ 'record_id' ] = $record_id; + return ( new CoreDiyFormRecordsService() )->getInfo($data); + } + + /** + * 删除填写记录 + * @param $params + * @return bool + */ + public function delRecord($params) + { + Db::startTrans(); + try { + + // 减少填写数量 + $this->model->where([ [ 'form_id', '=', $params[ 'form_id' ] ] ])->dec('write_num', 1)->update(); + + $form_records_model = new DiyFormRecords(); + $form_records_model->where([ + [ 'site_id', '=', $this->site_id ], + [ 'record_id', '=', $params[ 'record_id' ] ] + ])->delete(); + + $form_records_fields_model = new DiyFormRecordsFields(); + // 删除万能表单填写字段 + $form_records_fields_model->where([ + [ 'site_id', '=', $this->site_id ], + [ 'record_id', '=', $params[ 'record_id' ] ] + ])->delete(); + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + throw new CommonException($e->getMessage()); + } + + } + + /** + * 获取万能表单字段列表 + * @param array $where + * @param string $field + * @param string $order + * @return mixed + */ + public function getFieldsList($where = [], $field = 'field_id, form_id, field_key, field_type, field_name, field_remark, write_num, field_required, field_hidden, field_unique, privacy_protection, create_time, update_time') + { + $order = "update_time desc"; + if (!empty($where[ 'order' ])) { + $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; + } + return ( new DiyFormFields() )->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'form_id' ], $where)->field($field)->order($order)->select()->toArray(); + } + + /** + * 获取万能表单微信小程序二维码 + * @param $form_id + * @return array + */ + public function getQrcode($form_id) + { + if (empty($form_id)) { + throw new AdminException('缺少参考form_id'); + } + + $page = 'app/pages/index/diy_form'; + + $data = [ + [ + 'key' => 'form_id', + 'value' => $form_id + ], + ]; + $dir = 'upload/' . $this->site_id . '/diy_form_qrcode'; + + $path = ''; + try { + $path = qrcode('', $page, $data, $this->site_id, $dir, 'weapp'); + } catch (\Exception $e) { + Log::write('万能表单微信小程序二维码生成error' . $e->getMessage() . $e->getFile() . $e->getLine()); + } + + return [ + 'path' => $path + ]; + } + +} diff --git a/niucloud/app/service/admin/install/InstallSystemService.php b/niucloud/app/service/admin/install/InstallSystemService.php index d58ac434f..aaf293297 100644 --- a/niucloud/app/service/admin/install/InstallSystemService.php +++ b/niucloud/app/service/admin/install/InstallSystemService.php @@ -97,7 +97,8 @@ class InstallSystemService extends BaseAdminService 'methods' => $value[ 'methods' ] ?? '', 'sort' => $value[ 'sort' ] ?? '', 'status' => 1, - 'is_show' => $value[ 'is_show' ] ?? 1 + 'is_show' => $value[ 'is_show' ] ?? 1, + 'menu_attr' => $value['menu_attr'] ?? '' ]; $refer = $value; if (isset($refer[ 'children' ])) { diff --git a/niucloud/app/service/admin/member/MemberCashOutService.php b/niucloud/app/service/admin/member/MemberCashOutService.php index 7498170e3..211eb384d 100644 --- a/niucloud/app/service/admin/member/MemberCashOutService.php +++ b/niucloud/app/service/admin/member/MemberCashOutService.php @@ -35,11 +35,11 @@ class MemberCashOutService extends BaseAdminService public function getPage(array $where = []) { - $field = 'id,member_cash_out.site_id,cash_out_no,member_cash_out.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,member_cash_out.money,audit_time,member_cash_out.status,remark,member_cash_out.create_time,refuse_reason,transfer_no'; + $field = 'id,member_cash_out.site_id,cash_out_no,member_cash_out.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,member_cash_out.money,audit_time,member_cash_out.status,remark,member_cash_out.create_time,refuse_reason,transfer_no, transfer_payment_code'; $member_where = []; if(!empty($where['keywords'])) { - $member_where = [['member.member_no|member.nickname|member.mobile', '=', $where['keywords']]]; + $member_where = [['member.member_no|member.nickname|member.mobile|member.username', '=', $where['keywords']]]; } $search_model = $this->model->where([['member_cash_out.site_id', '=', $this->site_id]]) ->withSearch(['member_id','status', 'join_create_time' => 'create_time', 'audit_time', 'transfer_time', 'transfer_type', 'cash_out_no'],$where)->with(['transfer']) @@ -55,7 +55,7 @@ class MemberCashOutService extends BaseAdminService */ public function getInfo(int $id) { - $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'; + $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, transfer_payment_code'; 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(); } @@ -82,6 +82,16 @@ class MemberCashOutService extends BaseAdminService return $core_member_cash_out_service->transfer($this->site_id, $id, $data); } + /** + * 备注 + * @param int $id + * @param array $data + * @return true + */ + public function remark(int $id, array $data){ + $core_member_cash_out_service = new CoreMemberCashOutService(); + return $core_member_cash_out_service->remark($this->site_id, $id, $data); + } /** * 统计数据 * @return array @@ -98,4 +108,14 @@ class MemberCashOutService extends BaseAdminService return $stat; } + /** + * 检测实际的转账状态 + * @param int $id + * @return true + */ + public function checkTransferStatus(int $id){ + $core_member_cash_out_service = new CoreMemberCashOutService(); + return $core_member_cash_out_service->checkTransferStatus($this->site_id, $id); + } + } \ No newline at end of file diff --git a/niucloud/app/service/admin/member/MemberSignService.php b/niucloud/app/service/admin/member/MemberSignService.php index a96a28652..f73a9a42c 100644 --- a/niucloud/app/service/admin/member/MemberSignService.php +++ b/niucloud/app/service/admin/member/MemberSignService.php @@ -15,7 +15,7 @@ use app\model\member\MemberSign; use app\service\core\member\CoreMemberService; use app\service\core\sys\CoreConfigService; use core\base\BaseAdminService; -use core\exception\CommonException; +use core\exception\AdminException; /** * 会员签到服务层 @@ -84,7 +84,14 @@ class MemberSignService extends BaseAdminService */ public function setSign(array $value) { - if ($value[ 'sign_period' ] <= 0) throw new CommonException('SIGN_PERIOD_GREATER_THAN'); + if (empty($value[ 'sign_period' ])) throw new AdminException('SIGN_PERIOD_CANNOT_EMPTY'); + if ($value[ 'sign_period' ] < 2 || $value[ 'sign_period' ] > 365) throw new AdminException('SIGN_PERIOD_BETWEEN_2_365_DAYS'); + if (!empty($value[ 'continue_award' ])) { + foreach ($value[ 'continue_award' ] as $v) { + if ($v[ 'continue_sign' ] < 2 || $v[ 'continue_sign' ] > 365) throw new AdminException('CONTINUE_SIGN_BETWEEN_2_365_DAYS'); + if ($v[ 'continue_sign' ] > $value[ 'sign_period' ]) throw new AdminException('CONTINUE_SIGN_CANNOT_GREATER_THAN_SIGN_PERIOD'); + } + } $data = [ 'is_use' => $value[ 'is_use' ], //是否开启 'sign_period' => $value[ 'sign_period' ], // 签到周期 diff --git a/niucloud/app/service/admin/pay/PayChannelService.php b/niucloud/app/service/admin/pay/PayChannelService.php index 2041364d9..cc66583cd 100644 --- a/niucloud/app/service/admin/pay/PayChannelService.php +++ b/niucloud/app/service/admin/pay/PayChannelService.php @@ -199,7 +199,9 @@ class PayChannelService extends BaseAdminService 'pay_explain_switch' => $data[ 'pay_explain_switch' ] ?? 1,// 帮付说明开关, 1开启,0关闭 'pay_explain_title' => $data[ 'pay_explain_title' ] ?? get_lang('dict_pay_config.pay_explain_title'),// 帮付说明标题 'pay_explain_content' => $data[ 'pay_explain_content' ] ?? get_lang('dict_pay_config.pay_explain_content'),// 帮付说明内容 - 'pay_info_switch' => $data[ 'pay_info_switch' ] ?? 1// 订单信息, 1开启,0关闭 + 'pay_info_switch' => $data[ 'pay_info_switch' ] ?? 1,// 订单信息, 1开启,0关闭 + 'pay_wechat_share_image' => $data[ 'pay_wechat_share_image' ] ?? '/static/resource/images/pay/pay_wechat_share_image.png',// 默认分享图片(公众号) + 'pay_weapp_share_image' => $data[ 'pay_weapp_share_image' ] ?? '/static/resource/images/pay/pay_weapp_share_image.png'// 默认分享图片(小程序) ]; break; default: diff --git a/niucloud/app/service/admin/site/SiteService.php b/niucloud/app/service/admin/site/SiteService.php index 9c4df9760..1a5628c4e 100644 --- a/niucloud/app/service/admin/site/SiteService.php +++ b/niucloud/app/service/admin/site/SiteService.php @@ -88,7 +88,7 @@ class SiteService extends BaseAdminService if (!empty($info)) { $site_addons = ( new CoreSiteService() )->getAddonKeysBySiteId($site_id); $info[ 'site_addons' ] = ( new Addon() )->where([ [ 'key', 'in', $site_addons ] ])->field('key,title,desc,icon,type')->select()->toArray(); - $info['uid'] = ( new SysUserRole() )->where([ [ 'site_id', '=', $site_id ], [ 'is_admin', '=', 1 ] ])->value('uid'); + $info[ 'uid' ] = ( new SysUserRole() )->where([ [ 'site_id', '=', $site_id ], [ 'is_admin', '=', 1 ] ])->value('uid'); } return $info; } @@ -190,9 +190,9 @@ class SiteService extends BaseAdminService $data[ 'status' ] = strtotime($data[ 'expire_time' ]) > time() ? SiteDict::ON : SiteDict::EXPIRE; } - if (isset($data['uid'])){ + if (isset($data[ 'uid' ])) { if ($data[ 'uid' ] > 0) { - ( new UserRoleService() )->editAdmin($site_id,$data['uid']); + ( new UserRoleService() )->editAdmin($site_id, $data[ 'uid' ]); } else { //添加用户 $data_user = [ @@ -205,7 +205,7 @@ class SiteService extends BaseAdminService 'is_admin' => 1 ]; $data[ 'uid' ] = ( new UserService() )->add($data_user); - ( new UserRoleService() )->editAdmin($site_id,$data['uid']); + ( new UserRoleService() )->editAdmin($site_id, $data[ 'uid' ]); } } @@ -392,4 +392,61 @@ class SiteService extends BaseAdminService $site_addon = ( new CoreSiteService() )->getAddonKeysBySiteId($this->site_id); return $site_addon; } + + /** + * 查询应用列表,todo 完善 + * @return array + */ + public function getShowAppTools() + { + $list = [ + 'addon' => [ + 'title' => '运营工具', + 'list' => [] + ], + 'tool' => [ + 'title' => '系统工具', + 'list' => [] + ], +// 'promotion' => [ +// 'title' => '营销活动', +// 'list' => [] +// ] + ]; + + $apps = event('ShowApp'); + + $keys = []; + foreach ($apps as $v) { + foreach ($v as $ck => $cv) { + if (!empty($cv)) { + foreach ($cv as $addon_k => $addon_v) { + if (in_array($addon_v[ 'key' ], $keys)) { + continue; + } + $list[ $ck ][ 'list' ][] = $addon_v; + $keys[] = $addon_v[ 'key' ]; + } + } + + } + + } + + $site_addons = $this->getSiteAddons([]); + if (!empty($site_addons)) { + foreach ($site_addons as $k => $v) { + if (!in_array($v[ 'key' ], $keys)) { + $list[ 'addon' ][ 'list' ][] = [ + 'title' => $v[ 'title' ], + 'desc' => $v[ 'desc' ], + 'icon' => $v[ 'icon' ], + 'key' => $v[ 'key' ] + ]; + } + } + } + + return $list; + } } diff --git a/niucloud/app/service/admin/sys/AreaService.php b/niucloud/app/service/admin/sys/AreaService.php index 3378c78e6..04d5f9853 100644 --- a/niucloud/app/service/admin/sys/AreaService.php +++ b/niucloud/app/service/admin/sys/AreaService.php @@ -87,7 +87,9 @@ class AreaService extends BaseAdminService while ($area['level'] > 1) { $area = $this->model->where([ ['id', '=', $area['pid'] ] ])->field('id,level,pid,name')->findOrEmpty(); - $tree[ $level[ $area['level'] ] ] = $area->toArray(); + if (!$area->isEmpty()) { + $tree[ $level[ $area[ 'level' ] ] ] = $area->toArray(); + } } } return $tree; diff --git a/niucloud/app/service/admin/upgrade/UpgradeService.php b/niucloud/app/service/admin/upgrade/UpgradeService.php index e267cc8cc..128f8c417 100644 --- a/niucloud/app/service/admin/upgrade/UpgradeService.php +++ b/niucloud/app/service/admin/upgrade/UpgradeService.php @@ -269,7 +269,9 @@ class UpgradeService extends BaseAdminService // 覆盖文件 if (is_dir($code_dir . $version_no)) { - dir_copy($code_dir . $version_no, $to_dir); + // 忽略环境变量文件 + $exclude_files = ['.env.development', '.env.production', '.env', '.env.dev', '.env.product']; + dir_copy($code_dir . $version_no, $to_dir, exclude_files:$exclude_files); if ($addon != AddonDict::FRAMEWORK_KEY) { (new CoreAddonInstallService($addon))->installDir(); } @@ -367,7 +369,8 @@ class UpgradeService extends BaseAdminService */ public function handleUniapp() { $code_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'download' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR; - dir_copy($code_dir . 'uni-app', $this->root_path . 'uni-app'); + $exclude_files = ['.env.development', '.env.production', 'manifest.json']; + dir_copy($code_dir . 'uni-app', $this->root_path . 'uni-app', exclude_files:$exclude_files); $addon_list = (new CoreAddonService())->getInstallAddonList(); $depend_service = new CoreDependService(); @@ -380,9 +383,6 @@ class UpgradeService extends BaseAdminService // 编译 diy-group 自定义组件代码文件 $this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon); - // 编译 fixed-group 固定模板组件代码文件 - $this->compileFixedComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon); - // 编译 pages.json 页面路由代码文件 $this->installPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR); diff --git a/niucloud/app/service/api/diy/DiyService.php b/niucloud/app/service/api/diy/DiyService.php index f91ac5789..f45049daa 100644 --- a/niucloud/app/service/api/diy/DiyService.php +++ b/niucloud/app/service/api/diy/DiyService.php @@ -15,6 +15,9 @@ use app\dict\diy\PagesDict; use app\dict\diy\TemplateDict; use app\dict\sys\FileDict; use app\model\diy\Diy; +use app\model\diy\DiyTheme; +use app\service\core\diy\CoreDiyService; +use app\service\core\site\CoreSiteService; use core\base\BaseApiService; /** @@ -149,4 +152,37 @@ class DiyService extends BaseApiService return $data; } + /** + * 获取自定义主题配色 + * @return array + */ + public function getDiyTheme() + { + $site_addon = ( new CoreSiteService() )->getSiteCache($this->site_id); + $addon_list = array_merge($site_addon['apps'],$site_addon['site_addons']); + $theme_data = (new DiyTheme())->where([['site_id', '=', $this->site_id]])->column('id,color_name,color_mark,value,diy_value,title','addon'); + $defaultColor = ( new CoreDiyService() )->getDefaultColor(); + $app_theme['app'] = [ + 'color_name' => $theme_data['app']['color_name'] ?? $defaultColor['name'], + 'color_mark' => $theme_data['app']['color_mark'] ?? $defaultColor['title'], + 'value' => $theme_data['app']['value'] ?? $defaultColor['theme'], + 'diy_value' => $theme_data['app']['diy_value'] ?? '', + ]; + $data = []; + foreach ($addon_list as $key=>$value){ + if (isset($value['support_app']) && empty($value['support_app']) && $value['type'] == 'addon'){ + continue; + } + $default_theme_data = array_values(array_filter(event('ThemeColor', [ 'key' => $value['key']])))[0] ?? []; + $data[$value['key']]['color_mark'] = $theme_data[$value['key']]['color_mark'] ?? ($default_theme_data ? $default_theme_data[ 'name' ] : $defaultColor['name']); + $data[$value['key']]['color_name'] = $theme_data[$value['key']]['color_name'] ?? ($default_theme_data ? $default_theme_data[ 'title' ] : $defaultColor['title']); + $data[$value['key']]['value'] = $theme_data[$value['key']]['value'] ?? ($default_theme_data ? $default_theme_data[ 'theme' ] : $defaultColor['theme']); + $data[$value['key']]['diy_value'] = $theme_data[$value['key']]['diy_value'] ?? ''; + } + if (count($site_addon[ 'apps' ]) > 1) { + $data = array_merge($app_theme,$data); + } + return $data; + } + } diff --git a/niucloud/app/service/api/diy_form/DiyFormService.php b/niucloud/app/service/api/diy_form/DiyFormService.php new file mode 100644 index 000000000..4a2f39c1b --- /dev/null +++ b/niucloud/app/service/api/diy_form/DiyFormService.php @@ -0,0 +1,320 @@ +model = new DiyForm(); + } + + /** + * 获取万能表单信息 + * @param int $form_id + * @param string $field + * @return mixed + */ + public function getInfo(int $form_id, $field = 'form_id, page_title, title, type, status, value, share, remark') + { + $write_config = ( new DiyFormWriteConfig() )->where([ + [ 'form_id', '=', $form_id ], + [ 'site_id', '=', $this->site_id ] + ])->findOrEmpty()->toArray(); + $error = []; + $info = $this->model->field($field)->where([ [ 'form_id', '=', $form_id ], [ 'status', '=', 1 ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray(); + if (!empty($info)) { + if (!empty($info[ 'value' ][ 'value' ])) { + foreach ($info[ 'value' ][ 'value' ] as $k => $v) { + if ($v[ 'isHidden' ]) { + unset($info[ 'value' ][ 'value' ][ $k ]); // 过滤隐藏的组件 + } + } + $info[ 'value' ][ 'value' ] = array_values($info[ 'value' ][ 'value' ]); + } + if (!empty($write_config) && !empty($this->member_id)) { + if ($error_msg = $this->checkMemberCanJoinOrNot($this->member_id, $write_config)) { + $error[] = $error_msg; + } + if ($error_msg = $this->checkFormWriteTime($write_config)) { + $error[] = $error_msg; + } + if ($error_msg = $this->checkFormWriteLimitNum($form_id, $write_config)) { + $error[] = $error_msg; + } + if ($error_msg = $this->checkMemberWriteLimitNum($this->member_id, $form_id, $write_config)) { + $error[] = $error_msg; + } + } + } else { + $error[] = [ + 'title' => '当前表单无法查看', + 'type' => '表单状态', + 'desc' => '该表单已关闭' + ]; + } + $info[ 'error' ] = $error; + return $info; + } + + /** + * 判断当前会员是否可以填写表单 + * @param int $member_id + * @param array $config + * @return array + */ + public function checkMemberCanJoinOrNot($member_id, $config) + { + $member_info = ( new Member() )->where([ [ 'member_id', '=', $member_id ], [ 'site_id', '=', $this->site_id ] ])->field('member_level,member_label')->findOrEmpty()->toArray(); + if (empty($member_info)) throw new ApiException('MEMBER_NOT_EXIST'); + $error = []; + switch ($config[ 'join_member_type' ]) { + case 'all_member': + break; + case 'selected_member_level': + if (!in_array($member_info[ 'member_level' ], $config[ 'level_ids' ])) { + $level_names = ( new MemberLevel() )->where([ [ 'level_id', 'in', $config[ 'level_ids' ] ], [ 'site_id', '=', $this->site_id ] ])->column('level_name'); + $error = [ + 'title' => '当前表单无法查看', + 'type' => '允许填写用户', + 'desc' => '该表单已设置仅限“' . implode('、', $level_names) . '等级”的用户填写' + ]; + } + break; + case 'selected_member_label': + if (empty($member_info[ 'member_label' ])) $member_info[ 'member_label' ] = []; + if (empty(array_intersect($member_info[ 'member_label' ], $config[ 'label_ids' ]))) { + $label_names = ( new MemberLabel() )->where([ [ 'label_id', 'in', $config[ 'label_ids' ] ], [ 'site_id', '=', $this->site_id ] ])->column('label_name'); + $error = [ + 'title' => '当前表单无法查看', + 'type' => '允许填写用户', + 'desc' => '该表单已设置仅限“' . implode('、', $label_names) . '标签”的用户填写' + ]; + } + break; + } + return $error; + } + + /** + * 检查会员填写表单次数限制 + * @return array + */ + public function checkMemberWriteLimitNum($member_id, $form_id, $config) + { + $form_records_model = new DiyFormRecords(); + $error = []; + switch ($config[ 'member_write_type' ]) { + case 'no_limit': + break; + case 'diy': + $member_write_rule = $config[ 'member_write_rule' ]; + switch ($member_write_rule[ 'time_unit' ]) { + case 'day': + $time_text = '天'; + break; + case 'week': + $time_text = '周'; + break; + case 'month': + $time_text = '月'; + break; + case 'year': + $time_text = '年'; + break; + } + $count = $form_records_model->where([ + [ 'form_id', '=', $form_id ], + [ 'site_id', '=', $this->site_id ], + [ 'member_id', '=', $member_id ] + ])->whereTime('create_time', '-' . $member_write_rule[ 'time_value' ] . ' ' . $member_write_rule[ 'time_unit' ])->count(); + if ($count >= $member_write_rule[ 'num' ]) { + $error = [ + 'title' => '您的填写次数已达上限', + 'type' => '允许填写次数(每人)', + 'desc' => '该表单已设置“每人每' . $member_write_rule[ 'time_value' ] . $time_text . '可填写' . $member_write_rule[ 'num' ] . '次”' + ]; + } + break; + } + return $error; + } + + /** + * 检查表单填写次数限制 + * @return array + */ + public function checkFormWriteLimitNum($form_id, $config) + { + $form_records_model = new DiyFormRecords(); + $error = []; + switch ($config[ 'form_write_type' ]) { + case 'no_limit': + break; + case 'diy': + $form_write_rule = $config[ 'form_write_rule' ]; + switch ($form_write_rule[ 'time_unit' ]) { + case 'day': + $time_text = '天'; + break; + case 'week': + $time_text = '周'; + break; + case 'month': + $time_text = '月'; + break; + case 'year': + $time_text = '年'; + break; + } + $count = $form_records_model->where([ + [ 'form_id', '=', $form_id ], + [ 'site_id', '=', $this->site_id ] + ])->whereTime('create_time', '-' . $form_write_rule[ 'time_value' ] . ' ' . $form_write_rule[ 'time_unit' ])->count(); + if ($count >= $form_write_rule[ 'num' ]) { + $error = [ + 'title' => '表单总填写次数已达上限', + 'type' => '允许填写次数(总)', + 'desc' => '该表单已设置“每' . $form_write_rule[ 'time_value' ] . $time_text . '可填写' . $form_write_rule[ 'num' ] . '次”' + ]; + } + break; + } + return $error; + } + + /** + * 检查表单填写时间限制 + * @param array $config + * @return array + */ + public function checkFormWriteTime($config) + { + $error = []; + switch ($config[ 'time_limit_type' ]) { + case 'no_limit': + break; + case 'specify_time': + $specify_time = $config[ 'time_limit_rule' ][ 'specify_time' ] ?? []; + if (!empty($specify_time)) { + if (time() < $specify_time[ 0 ] || time() > $specify_time[ 1 ]) { + $error = [ + 'title' => '当前时间无法查看', + 'type' => '允许查看时间', + 'desc' => '该表单已设置“' . date('Y-m-d H:i:s', $specify_time[ 0 ]) . '-' . date('Y-m-d H:i:s', $specify_time[ 1 ]) . '”可查看' + ]; + } + } + break; + case 'open_day_time': + $open_day_time = $config[ 'time_limit_rule' ][ 'open_day_time' ] ?? []; + if (!empty($open_day_time)) { + $start_time = strtotime(date('Y-m-d', time())) + $open_day_time[ 0 ]; + $end_time = strtotime(date('Y-m-d', time())) + $open_day_time[ 1 ]; + if (time() < $start_time || time() > $end_time) { + $error = [ + 'title' => '当前时间无法查看', + 'type' => '允许查看时间', + 'desc' => '该表单已设置“每天' . date('H:i', $start_time) . '-' . date('H:i', $end_time) . '”可查看' + ]; + } + } + break; + } + return $error; + } + + /** + * 提交填表记录 + * @param array $data + * @return array + */ + public function addRecord(array $data = []) + { + $data[ 'site_id' ] = $this->site_id; + $data[ 'member_id' ] = $this->member_id; + + $info = $this->model->field('status')->where([ [ 'form_id', '=', $data[ 'form_id' ] ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray(); + if (empty($info)) throw new ApiException('DIY_FORM_NOT_EXIST'); + if ($info[ 'status' ] == 0) throw new ApiException('DIY_FORM_NOT_OPEN'); + + $write_config = ( new DiyFormWriteConfig() )->where([ + [ 'form_id', '=', $data[ 'form_id' ] ], + [ 'site_id', '=', $this->site_id ] + ])->findOrEmpty()->toArray(); + if (!empty($write_config)) { + if ($error_msg = $this->checkMemberCanJoinOrNot($this->member_id, $write_config)) { + throw new ApiException($error_msg[ 'desc' ]); + } + if ($error_msg = $this->checkFormWriteTime($write_config)) { + throw new ApiException($error_msg[ 'desc' ]); + } + if ($error_msg = $this->checkFormWriteLimitNum($data[ 'form_id' ], $write_config)) { + throw new ApiException($error_msg[ 'desc' ]); + } + if ($error_msg = $this->checkMemberWriteLimitNum($this->member_id, $data[ 'form_id' ], $write_config)) { + throw new ApiException($error_msg[ 'desc' ]); + } + } + return ( new CoreDiyFormRecordsService() )->add($data); + } + + /** + * 获取表单填写结果信息 + * @param array $params + * @return mixed + */ + public function getResult($params = []) + { + $diy_form_records_model = new DiyFormRecords(); + $field = 'record_id,form_id,create_time'; + return $diy_form_records_model->field($field)->where([ [ 'site_id', '=', $this->site_id ], [ 'record_id', '=', $params[ 'record_id' ] ], [ 'member_id', '=', $this->member_id ] ])->with([ 'submitConfig' ])->findOrEmpty()->toArray(); + } + + /** + * 获取表单填写记录,循环diy-group,每个表单组件实现各自的渲染处理 + * @param array $params + * @return mixed + */ + public function getFormRecordInfo($params = []) + { + $diy_form_records_model = new DiyFormRecords(); + $field = 'record_id,form_id,create_time'; + $info = $diy_form_records_model->field($field)->where([ [ 'site_id', '=', $this->site_id ], [ 'record_id', '=', $params[ 'record_id' ] ], [ 'member_id', '=', $this->member_id ] ]) + ->with([ + // 关联填写字段列表 + 'recordsFieldList' => function($query) { + $query->field('id, form_id, form_field_id, record_id, field_key, field_type, field_name, field_value, field_required, field_unique, privacy_protection, update_num, update_time')->append([ 'handle_field_value', 'render_value' ]); + } + ])->findOrEmpty()->toArray(); + + return $info; + } + +} diff --git a/niucloud/app/service/api/login/AuthService.php b/niucloud/app/service/api/login/AuthService.php index e6b898aba..ddf93cd65 100644 --- a/niucloud/app/service/api/login/AuthService.php +++ b/niucloud/app/service/api/login/AuthService.php @@ -130,4 +130,29 @@ class AuthService extends BaseApiService ]; } + /** + * 获取手机号 + * @param string $mobile_code + * @return array + */ + public function getMobile(string $mobile_code) + { + + $result = ( new CoreWeappAuthService() )->getUserPhoneNumber($this->site_id, $mobile_code); + if (empty($result)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST'); + if ($result[ 'errcode' ] != 0) throw new ApiException($result[ 'errmsg' ]); + $phone_info = $result[ 'phone_info' ]; + $mobile = $phone_info[ 'purePhoneNumber' ]; + if (empty($mobile)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST'); + + $member_service = new MemberService(); + + $mobile_member = $member_service->findMemberInfo([ 'mobile' => $mobile, 'site_id' => $this->site_id ]); + if (!$mobile_member->isEmpty()) throw new AuthException('MOBILE_IS_EXIST'); + + return [ + 'mobile' => $mobile + ]; + } + } diff --git a/niucloud/app/service/api/login/LoginService.php b/niucloud/app/service/api/login/LoginService.php index 126ffbd24..b1c2de714 100644 --- a/niucloud/app/service/api/login/LoginService.php +++ b/niucloud/app/service/api/login/LoginService.php @@ -75,8 +75,8 @@ class LoginService extends BaseApiService $token_info = $this->createToken($member_info); event("MemberLogin", $member_info); return [ - 'token' => $token_info['token'], - 'expires_time' => $token_info['params']['exp'], + 'token' => $token_info[ 'token' ], + 'expires_time' => $token_info[ 'params' ][ 'exp' ], 'mobile' => $member_info->mobile ]; } @@ -90,7 +90,7 @@ class LoginService extends BaseApiService public function account(string $username, string $password) { $member_service = new MemberService(); - $member_info = $member_service->findMemberInfo(['username|mobile' => $username, 'site_id' => $this->site_id]); + $member_info = $member_service->findMemberInfo([ 'username|mobile' => $username, 'site_id' => $this->site_id ]); if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在 if (!check_password($password, $member_info->password)) return false;//密码与账号不匹配 return $this->login($member_info, MemberLoginTypeDict::USERNAME); @@ -98,26 +98,29 @@ class LoginService extends BaseApiService /** * 手机号登录 - * @param string $mobile + * @param array $params * @return array */ - public function mobile(string $mobile){ + public function mobile($params) + { //校验手机验证码 - $this->checkMobileCode($mobile); + $this->checkMobileCode($params[ 'mobile' ]); //登录注册配置 - $config = (new MemberConfigService())->getLoginConfig(); - $is_mobile = $config['is_mobile']; + $config = ( new MemberConfigService() )->getLoginConfig(); + $is_mobile = $config[ 'is_mobile' ]; $is_bind_mobile = $config[ 'is_bind_mobile' ]; if ($is_mobile != 1 && $is_bind_mobile != 1) throw new AuthException('MOBILE_LOGIN_UNOPENED'); $member_service = new MemberService(); - $member_info = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]); + $member_info = $member_service->findMemberInfo([ 'mobile' => $params[ 'mobile' ], 'site_id' => $this->site_id ]); if ($member_info->isEmpty()) { //开启强制绑定手机号,登录会自动注册并绑定手机号 if ($is_bind_mobile == 1) { - $data = array ( - 'mobile' => $mobile, + $data = array( + 'mobile' => $params[ 'mobile' ], + 'nickname' => $params[ 'nickname' ], + 'headimg' => $params[ 'headimg' ] ); - return (new RegisterService())->register($mobile, $data, MemberRegisterTypeDict::MOBILE, false); + return ( new RegisterService() )->register($params[ 'mobile' ], $data, MemberRegisterTypeDict::MOBILE, false); } else { throw new AuthException('MEMBER_NOT_EXIST');//账号不存在 } @@ -130,16 +133,16 @@ class LoginService extends BaseApiService * @param $member_info * @return array|null */ - public function createToken($member_info): ?array + public function createToken($member_info) : ?array { $expire_time = env('system.api_token_expire_time') ?? 3600;//todo 不一定和管理端合用这个token时限 - return TokenAuth::createToken($member_info->member_id, AppTypeDict::API, ['member_id' => $member_info->member_id, 'username' => $member_info->username, 'site_id' => $member_info->site_id], $expire_time); + return TokenAuth::createToken($member_info->member_id, AppTypeDict::API, [ 'member_id' => $member_info->member_id, 'username' => $member_info->username, 'site_id' => $member_info->site_id ], $expire_time); } /** * 登陆退出(当前账户) */ - public function logout(): ?bool + public function logout() : ?bool { self::clearToken($this->member_id, $this->request->apiToken()); return true; @@ -151,7 +154,7 @@ class LoginService extends BaseApiService * @param string|null $token * @return bool|null */ - public static function clearToken(int $member_id, ?string $token = ''): ?bool + public static function clearToken(int $member_id, ?string $token = '') : ?bool { TokenAuth::clearToken($member_id, AppTypeDict::API, $token); return true; @@ -162,24 +165,23 @@ class LoginService extends BaseApiService * @param string|null $token * @return array */ - public function parseToken(?string $token){ - if(empty($token)) - { + public function parseToken(?string $token) + { + if (empty($token)) { //定义专属于授权认证机制的错误响应, 定义专属语言包 throw new AuthException('MUST_LOGIN', 401); } try { $token_info = TokenAuth::parseToken($token, AppTypeDict::API); - } catch ( Throwable $e ) { + } catch (Throwable $e) { // if(env('app_debug', false)){ // throw new AuthException($e->getMessage(), 401); // }else{ - throw new AuthException('LOGIN_EXPIRE', 401); + throw new AuthException('LOGIN_EXPIRE', 401); // } } - if(!$token_info) - { + if (!$token_info) { throw new AuthException('MUST_LOGIN', 401); } //验证有效次数或过期时间 @@ -189,31 +191,34 @@ class LoginService extends BaseApiService /** * 手机发送验证码 * @param $mobile - * @param string $type 发送短信的业务场景 + * @param string $type 发送短信的业务场景 * @return array * @throws Exception */ - public function sendMobileCode($mobile, string $type = ''){ - (new CaptchaService())->check(); - if(empty($mobile)) throw new AuthException('MOBILE_NEEDED'); + public function sendMobileCode($mobile, string $type = '') + { + ( new CaptchaService() )->check(); + if (empty($mobile)) throw new AuthException('MOBILE_NEEDED'); //发送 - if(!in_array($type, SmsDict::SCENE_TYPE)) throw new AuthException('MEMBER_MOBILE_CAPTCHA_ERROR'); + if (!in_array($type, SmsDict::SCENE_TYPE)) throw new AuthException('MEMBER_MOBILE_CAPTCHA_ERROR'); $code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);// 生成4位随机数,左侧补0 - (new NoticeService())->send('member_verify_code', ['code' => $code, 'mobile' => $mobile]); +// ( new NoticeService() )->send('member_verify_code', [ 'code' => $code, 'mobile' => $mobile ]); //将验证码存入缓存 $key = md5(uniqid('', true)); - $cache_tag_name = "mobile_key".$mobile.$type; + $cache_tag_name = "mobile_key" . $mobile . $type; $this->clearMobileCode($mobile, $type); - Cache::tag($cache_tag_name)->set($key, [ 'mobile' => $mobile, 'code' => $code, 'type' => $type], 600); - return ['key' => $key]; + Cache::tag($cache_tag_name)->set($key, [ 'mobile' => $mobile, 'code' => $code, 'type' => $type ], 600); + return [ 'key' => $key ]; } - public function getMobileCodeCacheName(){ + public function getMobileCodeCacheName() + { } - public function clearMobileCode($mobile, $type){ - $cache_tag_name = "mobile_key".$mobile.$type; + public function clearMobileCode($mobile, $type) + { + $cache_tag_name = "mobile_key" . $mobile . $type; Cache::tag($cache_tag_name)->clear(); } @@ -222,17 +227,18 @@ class LoginService extends BaseApiService * @param string $mobile * @return true */ - public function checkMobileCode(string $mobile){ - if(empty($mobile)) throw new AuthException('MOBILE_NEEDED'); + public function checkMobileCode(string $mobile) + { + 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('MOBILE_CAPTCHA_ERROR'); + if (empty($mobile_key) || empty($mobile_code)) throw new AuthException('MOBILE_CAPTCHA_ERROR'); $cache = Cache::get($mobile_key); - 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('MOBILE_CAPTCHA_ERROR'); + 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('MOBILE_CAPTCHA_ERROR'); $this->clearMobileCode($temp_mobile, $temp_type); return true; @@ -243,27 +249,28 @@ class LoginService extends BaseApiService * @param $member * @return true */ - public function bingOpenid($member){ + public function bingOpenid($member) + { $open_id = $this->request->param('openid'); - if(!empty($open_id)){ - Log::write('channel_1'.$this->channel); - if(!empty($this->channel)){ + if (!empty($open_id)) { + Log::write('channel_1' . $this->channel); + if (!empty($this->channel)) { $openid_field = match($this->channel){ - 'wechat' => 'wx_openid', + 'wechat' => 'wx_openid', 'weapp' => 'weapp_openid', default => '' }; - if(!empty($openid_field)){ - if(!$member->isEmpty()){ - if(empty($member->$openid_field)){ + if (!empty($openid_field)) { + if (!$member->isEmpty()) { + if (empty($member->$openid_field)) { //todo 定义当前第三方授权方没有退出登录功能,故这儿不做openid是否存在账号验证 // $member_service = new MemberService(); // $open_member = $member_service->findMemberInfo([$openid_field => $open_id, 'site_id' => $this->site_id]); $member->$openid_field = $open_id; $member->save(); - }else{ - if( $member->$openid_field != $open_id){ + } else { + if ($member->$openid_field != $open_id) { throw new AuthException('MEMBER_IS_BIND_AUTH'); } } @@ -279,11 +286,12 @@ class LoginService extends BaseApiService * @param string $mobile * @param string $password */ - public function resetPassword(string $mobile, string $password){ + public function resetPassword(string $mobile, string $password) + { $member_service = new MemberService(); //校验手机验证码 $this->checkMobileCode($mobile); - $member_info = $member_service->findMemberInfo(['mobile' => $mobile, 'site_id' => $this->site_id]); + $member_info = $member_service->findMemberInfo([ 'mobile' => $mobile, 'site_id' => $this->site_id ]); if ($member_info->isEmpty()) throw new AuthException('MOBILE_NOT_EXIST_MEMBER');//账号不存在 //todo 需要考虑一下,新的密码和原密码一样能否通过验证 $password_hash = create_password($password); @@ -291,19 +299,22 @@ class LoginService extends BaseApiService 'password' => $password_hash, ); $member_service->editByFind($member_info, $data); - self::clearToken($member_info['member_id'], $this->request->apiToken()); + self::clearToken($member_info[ 'member_id' ], $this->request->apiToken()); return true; } - public function loginScanCode(){ + public function loginScanCode() + { } - public function loginByScanCode(){ + public function loginByScanCode() + { } - public function checkScanCode(){ + public function checkScanCode() + { } diff --git a/niucloud/app/service/api/login/RegisterService.php b/niucloud/app/service/api/login/RegisterService.php index c1ecd55db..579bcf975 100644 --- a/niucloud/app/service/api/login/RegisterService.php +++ b/niucloud/app/service/api/login/RegisterService.php @@ -11,6 +11,7 @@ namespace app\service\api\login; +use app\dict\common\ChannelDict; use app\dict\member\MemberLoginTypeDict; use app\dict\member\MemberRegisterTypeDict; use app\job\member\SetMemberNoJob; diff --git a/niucloud/app/service/api/member/MemberCashOutAccountService.php b/niucloud/app/service/api/member/MemberCashOutAccountService.php index a0f5db700..85bcabbaf 100644 --- a/niucloud/app/service/api/member/MemberCashOutAccountService.php +++ b/niucloud/app/service/api/member/MemberCashOutAccountService.php @@ -47,7 +47,7 @@ class MemberCashOutAccountService extends BaseApiService */ public function getInfo(int $account_id) { - $field = 'account_id,site_id,member_id,account_type,bank_name,realname,account_no'; + $field = 'account_id,site_id,member_id,account_type,bank_name,realname,account_no, transfer_payment_code'; return $this->model->where([['account_id', '=', $account_id], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->toArray(); } diff --git a/niucloud/app/service/api/member/MemberCashOutService.php b/niucloud/app/service/api/member/MemberCashOutService.php index 7c2e074cc..f5ae798c5 100644 --- a/niucloud/app/service/api/member/MemberCashOutService.php +++ b/niucloud/app/service/api/member/MemberCashOutService.php @@ -52,7 +52,7 @@ class MemberCashOutService extends BaseApiService */ public function getInfo(int $id) { - $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'; + $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, transfer_no, transfer_payee, transfer_payment_code'; 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(); } diff --git a/niucloud/app/service/api/member/MemberConfigService.php b/niucloud/app/service/api/member/MemberConfigService.php index de2c5a2d9..a9ecbd839 100644 --- a/niucloud/app/service/api/member/MemberConfigService.php +++ b/niucloud/app/service/api/member/MemberConfigService.php @@ -37,9 +37,10 @@ class MemberConfigService extends BaseApiService } catch (\Exception $e) { $res[ 'is_auth_register' ] = 0; $res[ 'is_force_access_user_info' ] = 0; + $res[ 'is_bind_mobile' ] = 0; } } return $res; } -} \ 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 9010d79e2..8cab07f4e 100644 --- a/niucloud/app/service/api/weapp/WeappAuthService.php +++ b/niucloud/app/service/api/weapp/WeappAuthService.php @@ -22,11 +22,9 @@ use core\base\BaseApiService; use core\exception\ApiException; use core\exception\AuthException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException; -use GuzzleHttp\Exception\GuzzleException; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; -use think\Model; /** @@ -76,10 +74,16 @@ class WeappAuthService extends BaseApiService /** * 登录 - * @param string $code + * @param $data * @return array + * @throws DataNotFoundException + * @throws DbException + * @throws InvalidConfigException + * @throws ModelNotFoundException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface */ - public function login(string $code) + public function login($data) { [ @@ -88,7 +92,7 @@ class WeappAuthService extends BaseApiService // $avatar, // $nickname, // $sex - ] = $this->getUserInfoByCode($code); + ] = $this->getUserInfoByCode($data[ 'code' ]); $member_service = new MemberService(); $member_info = $member_service->findMemberInfo([ 'weapp_openid' => $openid, 'site_id' => $this->site_id ]); @@ -98,23 +102,74 @@ class WeappAuthService extends BaseApiService $member_info->weapp_openid = $openid; } } + + $config = ( new MemberConfigService() )->getLoginConfig(); + $is_auth_register = $config[ 'is_auth_register' ]; + $is_force_access_user_info = $config[ 'is_force_access_user_info' ]; + $is_bind_mobile = $config[ 'is_bind_mobile' ]; + if ($member_info->isEmpty()) { -// $config = ( new MemberConfigService() )->getLoginConfig(); -// $is_auth_register = $config[ 'is_auth_register' ]; - // 去掉强制绑定手机号判断,否则开启强制绑定的情况下小程序第三方注册无法注册 - // 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册 - return $this->register($openid, wx_unionid: $unionid); -// if ($is_auth_register == 1) { -// } else { -// return [ 'openid' => $openid, 'unionid' => $unionid ]; -// } + + // 开启自动注册会员 + if ($is_auth_register) { + + // 开启强制获取会员信息并且开启强制绑定手机号,必须获取全部信息才能进行注册 + if ($is_force_access_user_info && $is_bind_mobile) { + if (!empty($data[ 'nickname' ]) && !empty($data[ 'headimg' ]) && !empty($data[ 'mobile' ])) { + return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid, $data[ 'nickname' ], $data[ 'headimg' ]); + } else { + return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存 + } + } else if ($is_force_access_user_info) { + // 开启强制获取会员信息时,必须获取到昵称和头像才能进行注册 + if (!empty($data[ 'nickname' ]) && !empty($data[ 'headimg' ])) { + return $this->register($openid, '', '', $unionid, $data[ 'nickname' ], $data[ 'headimg' ]); + } else { + return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存 + } + } else if ($is_bind_mobile) { + // 开启强制绑定手机号,必须获取手机号才能进行注册 + if (!empty($data[ 'mobile' ]) || !empty($data[ 'mobile_code' ])) { + return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid); + } else { + return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存 + } + } else if (!$is_force_access_user_info && !$is_bind_mobile) { + // 关闭强制获取用户信息、并且关闭强制绑定手机号的情况下允许注册 + return $this->register($openid, '', '', $unionid); + } + + } else { + // 关闭自动注册,但是开启了强制绑定手机号,必须获取手机号才能进行注册 + if ($is_bind_mobile) { + if (!empty($data[ 'mobile' ]) || !empty($data[ 'mobile_code' ])) { + return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid); + } else { + return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存 + } + } + } } else { - //可能会更新用户和粉丝表 + // 可能会更新用户和粉丝表 $login_service = new LoginService(); + // 开启自动注册会员,获取到昵称和头像进行修改 + if ($is_auth_register) { + if ($is_force_access_user_info) { + if (!empty($data[ 'nickname' ])) { + $member_info[ 'nickname' ] = $data[ 'nickname' ]; + } + if (!empty($data[ 'headimg' ])) { + $member_info[ 'headimg' ] = $data[ 'headimg' ]; + } + } + if ($is_bind_mobile) { +// if (!empty($data[ 'mobile' ])) { +// $member_info[ 'mobile' ] = $data[ 'mobile' ]; +// } + } + } return $login_service->login($member_info, MemberLoginTypeDict::WEAPP); } - //todo 业务落地 - } /** @@ -122,14 +177,17 @@ class WeappAuthService extends BaseApiService * @param string $openid * @param string $mobile * @param string $mobile_code + * @param string $wx_unionid + * @param string $nickname + * @param string $headimg * @return array * @throws DataNotFoundException * @throws DbException - * @throws GuzzleException - * @throws InvalidConfigException * @throws ModelNotFoundException + * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface */ - public function register(string $openid, string $mobile = '', string $mobile_code = '', string $wx_unionid = '') + public function register(string $openid, string $mobile = '', string $mobile_code = '', string $wx_unionid = '', $nickname = '', $headimg = '') { if (empty($openid)) throw new AuthException('AUTH_LOGIN_TAG_NOT_EXIST'); @@ -158,7 +216,9 @@ class WeappAuthService extends BaseApiService return $register_service->register($mobile ?? '', [ 'weapp_openid' => $openid, - 'wx_unionid' => $wx_unionid + 'wx_unionid' => $wx_unionid, + 'nickname' => $nickname, + 'headimg' => $headimg, ], MemberRegisterTypeDict::WEAPP, $is_verify_mobile ?? false diff --git a/niucloud/app/service/api/wechat/WechatAuthService.php b/niucloud/app/service/api/wechat/WechatAuthService.php index f707a40ee..c6be98af2 100644 --- a/niucloud/app/service/api/wechat/WechatAuthService.php +++ b/niucloud/app/service/api/wechat/WechatAuthService.php @@ -122,17 +122,35 @@ class WechatAuthService extends BaseApiService } } if ($member_info->isEmpty()) { -// $config = ( new MemberConfigService() )->getLoginConfig(); -// $is_auth_register = $config[ 'is_auth_register' ]; - // 去掉强制绑定手机号判断,否则开启强制绑定的情况下公众号第三方注册无法注册 - // 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册 - return $this->register($openid, '', $nickname, $avatar, $unionid); -// if ($is_auth_register == 1) { -// } else { -// return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ]; -// } + $config = ( new MemberConfigService() )->getLoginConfig(); + $is_auth_register = $config[ 'is_auth_register' ]; + $is_force_access_user_info = $config[ 'is_force_access_user_info' ]; + $is_bind_mobile = $config[ 'is_bind_mobile' ]; + + // 开启自动注册会员 + if ($is_auth_register) { + + // 开启强制获取会员信息并且开启强制绑定手机号,必须获取手机号才能进行注册,由于公众号无法主动获取,所以不能注册 + if ($is_force_access_user_info && $is_bind_mobile) { + return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ]; + } else if ($is_force_access_user_info) { + // 开启强制获取会员信息时,必须获取到昵称和头像才能进行注册 + if (!empty($nickname) && !empty($avatar)) { + return $this->register($openid, '', $nickname, $avatar, $unionid); // 获取到昵称和头像,然后进行注册 + } else { + return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ]; + } + } else if ($is_bind_mobile) { + // 开启强制绑定手机号,必须获取手机号才能进行注册,由于公众号无法主动获取,所以不能注册 + return [ 'openid' => $openid, 'unionid' => $unionid ]; + } else if (!$is_force_access_user_info && !$is_bind_mobile) { + // 关闭强制获取用户信息、并且关闭强制绑定手机号的情况下允许注册 + return $this->register($openid, '', $nickname, $avatar, $unionid); + } + + } } else { - //可能会更新用户和粉丝表 + // 可能会更新用户和粉丝表 $login_service = new LoginService(); // 若用户头像为空,那么从微信获取头像和昵称,然后进行更新 if (empty($member_info->headimg)) { diff --git a/niucloud/app/service/core/addon/CoreAddonInstallService.php b/niucloud/app/service/core/addon/CoreAddonInstallService.php index c421b8bd2..de1b346a2 100644 --- a/niucloud/app/service/core/addon/CoreAddonInstallService.php +++ b/niucloud/app/service/core/addon/CoreAddonInstallService.php @@ -653,9 +653,6 @@ class CoreAddonInstallService extends CoreAddonBaseService // 编译 diy-group 自定义组件代码文件 $this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon); - // 编译 fixed-group 固定模板组件代码文件 - $this->compileFixedComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon); - // 编译 pages.json 页面路由代码文件 $this->uninstallPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR); @@ -685,9 +682,6 @@ class CoreAddonInstallService extends CoreAddonBaseService // 编译 diy-group 自定义组件代码文件 $this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon); - // 编译 fixed-group 固定模板组件代码文件 - $this->compileFixedComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon); - // 编译 pages.json 页面路由代码文件 $this->installPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR); diff --git a/niucloud/app/service/core/addon/WapTrait.php b/niucloud/app/service/core/addon/WapTrait.php index c1d8120cb..062990cb3 100644 --- a/niucloud/app/service/core/addon/WapTrait.php +++ b/niucloud/app/service/core/addon/WapTrait.php @@ -63,7 +63,7 @@ trait WapTrait $file_name = 'diy-' . $path; $content .= " \n"; } } @@ -101,7 +101,7 @@ trait WapTrait $file_name = 'diy-' . $path; $content .= " \n"; $addon_import_content .= " import diy{$name} from '@/addon/" . $v . "/components/diy/{$path}/index.vue';\n"; @@ -113,7 +113,7 @@ trait WapTrait $content .= " \n"; $content .= " \n"; - $content .= "