From 59eb34976a591cb2ae7fcd635f522dbb8e34efa6 Mon Sep 17 00:00:00 2001 From: MiFaZhan Date: Fri, 23 Oct 2026 14:46:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=9D=E5=A7=8B=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iotlcm-admin-svr:管理后台服务。 - Go module:iotlcm → git.5iot.com/iotlcm-public/iotlcm-admin-svr(729 文件) - 凭据与地址脱敏:JWT signingKey(含代码里的 MustGet 默认值)、 MySQL DSN、Redis 口令、告警邮件发件人邮箱全部改为占位; 私网 IP → 文档地址段;库名 xiujie_admin → iotlcm - 真实手机号/邮箱 → 合法 11 位编造号 / example.com - 移除内部资产:CI 触发器、过时 DDL(sql/db_iotlcm.sql)、 私有依赖 go get 行、明文 registry 登录口令 - 启动 banner 统一 IOTLCM 方块字 + 社区惯例署名 - Dockerfile 改用公共基础镜像 - 拼错的 RADEME.md → README.md,README 重写 - 需要真实数据库的用例改为可用 IOTLCM_TEST_WITH_DB=1 显式启用 - 补 Apache-2.0 LICENSE,LF 行尾 + .gitattributes 数据库 schema 不随本仓发布(生产 DDL 已过时),README 已说明。 --- .gitattributes | 14 + .gitignore | 116 ++ LICENSE | 201 ++ README.md | 100 + docs/agent-role-template-deployment.md | 14 + docs/agent-role-template.md | 15 + server/Makefile | 7 + server/api/agent/agent.go | 61 + server/api/agent/v1/agent_dept.go | 67 + server/api/agent/v1/agent_menu.go | 16 + server/api/agent/v1/agent_role.go | 44 + server/api/agent/v1/agent_scope.go | 16 + server/api/agent/v1/agent_user.go | 61 + server/api/agent/v1/tagententerprise.go | 59 + server/api/agent/v1/tapi.go | 59 + server/api/agent/v1/tapigroup.go | 55 + server/api/agent/v1/tapiresource.go | 55 + server/api/agent/v1/tcustwithdrawaccount.go | 67 + server/api/common/common.go | 122 ++ server/api/common/v1/batchexecutionlog.go | 37 + server/api/common/v1/batchmain.go | 88 + server/api/common/v1/tagentbalance.go | 114 ++ server/api/common/v1/tbalancedetail.go | 59 + .../api/common/v1/tconsumeaccountmonthbill.go | 79 + server/api/common/v1/tcreditdetail.go | 59 + server/api/common/v1/tdivisioncode.go | 59 + server/api/common/v1/tfinanceapply.go | 59 + server/api/common/v1/tfinanceauditrecord.go | 59 + server/api/common/v1/tfincommissiondetail.go | 79 + .../api/common/v1/tfinwithdrawablechange.go | 59 + server/api/common/v1/tmessagelog.go | 59 + server/api/common/v1/tnotifylog.go | 59 + .../api/common/v1/tprofitaccountmonthbill.go | 99 + server/api/common/v1/twocommunication.go | 66 + server/api/common/v1/twomain.go | 94 + server/api/common/v1/tworecord.go | 59 + server/api/common/v1/upload.go | 29 + server/api/gen/testdemo/testdemo.go | 19 + server/api/gen/testdemo/v1/testdemo.go | 59 + server/api/gen_codes/gen_codes.go | 25 + server/api/gen_codes/v1/gen_table.go | 112 ++ server/api/home/home.go | 19 + server/api/home/v1/home.go | 53 + server/api/iot/iot.go | 195 ++ server/api/iot/v1/full_sync_monitor.go | 85 + server/api/iot/v1/full_sync_replay.go | 30 + server/api/iot/v1/simwarningconfig.go | 56 + server/api/iot/v1/tflowpackageconfig.go | 59 + server/api/iot/v1/torder.go | 70 + server/api/iot/v1/tsimcardallocate.go | 49 + server/api/iot/v1/tsimcardbindpkg.go | 136 ++ server/api/iot/v1/tsimcardcancel.go | 31 + server/api/iot/v1/tsimcardcancellation.go | 25 + server/api/iot/v1/tsimcardchange.go | 76 + server/api/iot/v1/tsimcarddatacut.go | 31 + server/api/iot/v1/tsimcarddatastart.go | 31 + server/api/iot/v1/tsimcarddatastop.go | 31 + server/api/iot/v1/tsimcardinbound.go | 40 + server/api/iot/v1/tsimcardinfo.go | 99 + server/api/iot/v1/tsimcardoutbound.go | 76 + server/api/iot/v1/tsimcardrenew.go | 49 + server/api/iot/v1/tsimcardrestart.go | 31 + server/api/iot/v1/tsimcardstart.go | 31 + server/api/iot/v1/tsimcardstock.go | 59 + server/api/iot/v1/tsimcardstop.go | 31 + server/api/iot/v1/tsimcardtrafficcutoff.go | 72 + server/api/iot/v1/tsimcardunsub.go | 40 + server/api/iot/v1/tsimchannels.go | 74 + server/api/iot/v1/tsimchanneltemplate.go | 59 + server/api/iot/v1/tsimdiagnose.go | 33 + server/api/iot/v1/tsimflowpackageinfo.go | 94 + .../api/iot/v1/tsimflowpackageinfo_options.go | 16 + server/api/iot/v1/tsimflowpackageprice.go | 71 + server/api/iot/v1/tsimflowpool.go | 78 + server/api/iot/v1/tsimpackagecategory.go | 59 + server/api/iot/v1/tsimpoolbindpackage.go | 116 ++ server/api/iot/v1/tsimpoolwarnconfig.go | 59 + server/api/iot/v1/tsimupstreampackage.go | 59 + server/api/iot/v1/tsimwarningconfig.go | 48 + server/api/monitor/monitor.go | 16 + server/api/monitor/v1/cache.go | 33 + server/api/pay/pay.go | 19 + server/api/pay/v1/alipay.go | 52 + server/api/system/system.go | 151 ++ server/api/system/v1/auth.go | 93 + server/api/system/v1/captcha.go | 18 + server/api/system/v1/client.go | 68 + server/api/system/v1/config.go | 59 + server/api/system/v1/dept.go | 83 + server/api/system/v1/dict.go | 108 ++ server/api/system/v1/job.go | 83 + server/api/system/v1/logininfor.go | 32 + server/api/system/v1/menu.go | 127 ++ server/api/system/v1/notice.go | 59 + server/api/system/v1/online.go | 33 + server/api/system/v1/oper_log.go | 25 + server/api/system/v1/oss.go | 43 + server/api/system/v1/oss_config.go | 54 + server/api/system/v1/post.go | 68 + server/api/system/v1/qrcode.go | 83 + server/api/system/v1/role.go | 69 + server/api/system/v1/social.go | 34 + server/api/system/v1/sysnoticeuser.go | 75 + server/api/system/v1/tenant.go | 135 ++ server/api/system/v1/ttplatformsetting.go | 77 + server/api/system/v1/user.go | 202 ++ server/api/trade/trade.go | 15 + server/api/trade/v1/recharge.go | 15 + server/api/workerdiagnostic/v1/diagnostic.go | 14 + .../api/workerdiagnostic/workerdiagnostic.go | 15 + server/build/Dockerfile | 45 + server/build/build_config.yaml | 127 ++ server/config/config.yaml | 272 +++ server/config/config_default.yaml | 218 +++ server/go.mod | 99 + server/go.sum | 297 +++ server/hack/config.yaml | 19 + server/hack/hack-cli.mk | 20 + server/hack/hack.mk | 107 ++ server/internal/cmd/cmd.go | 10 + server/internal/cmd/global.go | 61 + server/internal/cmd/http.go | 57 + server/internal/cmd/initfuunc.go | 46 + server/internal/cmd/inithttp/inithttp.go | 59 + server/internal/cmd/monitor.go | 74 + server/internal/cmd/shutdown.go | 58 + server/internal/consts/batch.go | 228 +++ server/internal/consts/bcache.go | 10 + server/internal/consts/code.go | 41 + server/internal/consts/config.go | 21 + server/internal/consts/consts.go | 10 + server/internal/consts/db.go | 6 + server/internal/consts/event.go | 55 + server/internal/consts/http.go | 14 + server/internal/consts/mcache.go | 15 + server/internal/consts/package_duration.go | 42 + server/internal/consts/queue.go | 46 + server/internal/consts/sim_card_lifecycle.go | 34 + server/internal/consts/system.go | 146 ++ server/internal/consts/v3api.go | 90 + server/internal/consts/warning.go | 6 + server/internal/consts/websocket.go | 23 + .../internal/controller/agent/agent_dept.go | 67 + .../internal/controller/agent/agent_menu.go | 16 + server/internal/controller/agent/agent_new.go | 13 + .../internal/controller/agent/agent_role.go | 42 + .../internal/controller/agent/agent_user.go | 59 + .../controller/agent/t_agent_enterprise.go | 57 + server/internal/controller/agent/t_api.go | 57 + .../internal/controller/agent/t_api_group.go | 60 + .../controller/agent/t_api_resource.go | 69 + .../agent/t_cust_withdraw_account.go | 63 + server/internal/controller/common/common.go | 5 + .../internal/controller/common/common_new.go | 15 + .../common/common_v1_batchExecutionLog.go | 53 + .../controller/common/common_v1_batchMain.go | 108 ++ .../common/common_v1_tagentbalance.go | 122 ++ .../common/common_v1_tbalancedetail.go | 63 + .../common_v1_tconsumeaccountmonth_bill.go | 87 + .../common/common_v1_tcreditdetail.go | 63 + .../common/common_v1_tfinanceapply.go | 58 + .../common/common_v1_tfinanceauditrecord.go | 58 + .../common/common_v1_tfincommissiondetail.go | 87 + .../common_v1_tfinwithdrawablechange.go | 63 + .../common/common_v1_tmessagelog.go | 57 + .../controller/common/common_v1_tnotifylog.go | 57 + .../common_v1_tprofitaccountmonth_bill.go | 111 ++ .../common/common_v1_twocommunication.go | 64 + .../controller/common/common_v1_twomain.go | 84 + .../controller/common/common_v1_tworecord.go | 59 + .../controller/common/common_v1_upload.go | 30 + .../controller/common/t_division_code.go | 63 + server/internal/controller/gen/test_demo.go | 69 + .../controller/gen/testdemo/testdemo.go | 5 + .../controller/gen/testdemo/testdemo_new.go | 15 + .../gen/testdemo/testdemo_v1_testdemo.go | 26 + .../controller/gen_codes/gen_codes.go | 5 + .../controller/gen_codes/gen_codes_new.go | 15 + .../gen_codes/gen_codes_v1_gen_table.go | 127 ++ server/internal/controller/home/home.go | 5 + server/internal/controller/home/home_new.go | 15 + .../internal/controller/home/home_v1_home.go | 51 + .../controller/iot/full_sync_monitor.go | 281 +++ .../iot/full_sync_monitor_channels_test.go | 144 ++ .../controller/iot/full_sync_replay.go | 45 + server/internal/controller/iot/iot.go | 5 + server/internal/controller/iot/iot_new.go | 13 + .../controller/iot/iot_v1_simwarningconfig.go | 90 + ...iot_v1_t_sim_card_data_cut_excel_submit.go | 16 + ...t_v1_t_sim_card_data_cut_excel_template.go | 13 + ...iot_v1_t_sim_card_data_cut_input_submit.go | 16 + ...t_v1_t_sim_card_data_start_excel_submit.go | 16 + ...v1_t_sim_card_data_start_excel_template.go | 13 + ...t_v1_t_sim_card_data_start_input_submit.go | 16 + ...ot_v1_t_sim_card_data_stop_excel_submit.go | 16 + ..._v1_t_sim_card_data_stop_excel_template.go | 13 + ...ot_v1_t_sim_card_data_stop_input_submit.go | 16 + .../iot_v1_t_sim_card_restart_excel_submit.go | 16 + ...ot_v1_t_sim_card_restart_excel_template.go | 13 + .../iot_v1_t_sim_card_restart_input_submit.go | 16 + .../iot_v1_t_sim_card_start_excel_submit.go | 16 + .../iot_v1_t_sim_card_start_excel_template.go | 13 + .../iot_v1_t_sim_card_start_input_submit.go | 16 + .../iot_v1_t_sim_card_stop_excel_submit.go | 16 + .../iot_v1_t_sim_card_stop_excel_template.go | 13 + .../iot_v1_t_sim_card_stop_input_submit.go | 16 + .../iot/iot_v1_tflowpackageconfig.go | 58 + .../internal/controller/iot/iot_v1_torder.go | 78 + .../controller/iot/iot_v1_tsimcardallocate.go | 45 + .../controller/iot/iot_v1_tsimcardbindpkg.go | 168 ++ .../controller/iot/iot_v1_tsimcardcancel.go | 29 + .../iot/iot_v1_tsimcardcancellation.go | 31 + .../controller/iot/iot_v1_tsimcardchange.go | 70 + .../controller/iot/iot_v1_tsimcardoutbound.go | 83 + .../controller/iot/iot_v1_tsimcardrenew.go | 58 + .../iot/iot_v1_tsimcardtrafficcutoff.go | 66 + .../controller/iot/iot_v1_tsimcardunsub.go | 46 + .../iot/iot_v1_tsimflowpackageprice.go | 53 + .../iot/iot_v1_tsimpoolbindpackage.go | 131 ++ server/internal/controller/iot/t_order.go | 9 + .../controller/iot/t_sim_card_inbound.go | 46 + .../controller/iot/t_sim_card_info.go | 106 ++ .../controller/iot/t_sim_card_status_queue.go | 17 + .../controller/iot/t_sim_card_stock.go | 63 + .../controller/iot/t_sim_channel_template.go | 63 + .../internal/controller/iot/t_sim_channels.go | 76 + .../internal/controller/iot/t_sim_diagnose.go | 27 + .../controller/iot/t_sim_flow_package_info.go | 112 ++ .../iot/t_sim_flow_package_price.go | 54 + .../controller/iot/t_sim_flow_pool.go | 88 + .../controller/iot/t_sim_package_category.go | 63 + .../controller/iot/t_sim_pool_warn_config.go | 64 + .../controller/iot/t_sim_upstream_package.go | 63 + server/internal/controller/monitor/monitor.go | 5 + .../controller/monitor/monitor_new.go | 15 + .../controller/monitor/monitor_v1_cache.go | 70 + server/internal/controller/pay/pay.go | 1 + server/internal/controller/pay/pay_new.go | 9 + .../internal/controller/pay/pay_v1_alipay.go | 53 + .../simwarning/sim_warning_config.go | 60 + .../controller/system/sys_notice_user.go | 75 + server/internal/controller/system/system.go | 5 + .../internal/controller/system/system_new.go | 15 + .../controller/system/system_v1_auth.go | 113 ++ .../controller/system/system_v1_captcha.go | 17 + .../controller/system/system_v1_client.go | 75 + .../controller/system/system_v1_config.go | 63 + .../controller/system/system_v1_dept.go | 80 + .../controller/system/system_v1_dict.go | 123 ++ .../controller/system/system_v1_job.go | 118 ++ .../controller/system/system_v1_logininfor.go | 33 + .../controller/system/system_v1_menu.go | 65 + .../controller/system/system_v1_notice.go | 59 + .../controller/system/system_v1_online.go | 36 + .../controller/system/system_v1_oper_log.go | 25 + .../controller/system/system_v1_oss.go | 43 + .../controller/system/system_v1_oss_config.go | 61 + .../controller/system/system_v1_post.go | 67 + .../controller/system/system_v1_qrcode.go | 94 + .../controller/system/system_v1_role.go | 69 + .../controller/system/system_v1_social.go | 34 + .../controller/system/system_v1_tenant.go | 141 ++ .../system/system_v1_ttplatformsetting.go | 65 + .../controller/system/system_v1_user.go | 297 +++ server/internal/controller/trade/trade.go | 5 + server/internal/controller/trade/trade_new.go | 15 + .../controller/trade/trade_v1_recharge.go | 14 + .../workerdiagnostic/worker_diagnostic.go | 28 + .../workerdiagnostic/workerdiagnostic.go | 5 + .../workerdiagnostic/workerdiagnostic_new.go | 15 + .../workerdiagnostic_v1_diagnostic.go | 14 + server/internal/dao/batch_detail.go | 22 + server/internal/dao/batch_main.go | 22 + server/internal/dao/internal/batch_detail.go | 109 ++ server/internal/dao/internal/batch_main.go | 139 ++ server/internal/dao/internal/sys_client.go | 109 ++ server/internal/dao/internal/sys_config.go | 101 + server/internal/dao/internal/sys_dept.go | 125 ++ server/internal/dao/internal/sys_dict_data.go | 107 ++ server/internal/dao/internal/sys_dict_type.go | 99 + server/internal/dao/internal/sys_gen_table.go | 111 ++ server/internal/dao/internal/sys_job.go | 111 ++ .../internal/dao/internal/sys_logininfor.go | 101 + server/internal/dao/internal/sys_menu.go | 121 ++ server/internal/dao/internal/sys_notice.go | 107 ++ .../internal/dao/internal/sys_notice_user.go | 107 ++ server/internal/dao/internal/sys_oper_log.go | 113 ++ server/internal/dao/internal/sys_oss.go | 111 ++ .../internal/dao/internal/sys_oss_config.go | 117 ++ server/internal/dao/internal/sys_post.go | 109 ++ server/internal/dao/internal/sys_role.go | 119 ++ server/internal/dao/internal/sys_role_dept.go | 83 + server/internal/dao/internal/sys_role_menu.go | 85 + server/internal/dao/internal/sys_social.go | 137 ++ server/internal/dao/internal/sys_tenant.go | 125 ++ .../dao/internal/sys_tenant_package.go | 103 ++ server/internal/dao/internal/sys_user.go | 127 ++ .../internal/dao/internal/sys_user_online.go | 105 ++ server/internal/dao/internal/sys_user_post.go | 83 + server/internal/dao/internal/sys_user_role.go | 83 + .../internal/dao/internal/t_agent_balance.go | 111 ++ .../dao/internal/t_agent_enterprise.go | 109 ++ server/internal/dao/internal/t_api.go | 105 ++ server/internal/dao/internal/t_api_group.go | 99 + .../dao/internal/t_api_group_resource.go | 81 + .../internal/dao/internal/t_api_resource.go | 105 ++ .../internal/dao/internal/t_balance_detail.go | 117 ++ .../internal/t_consume_account_month_bill.go | 133 ++ .../internal/dao/internal/t_credit_detail.go | 113 ++ .../dao/internal/t_cust_withdraw_account.go | 107 ++ .../dao/internal/t_dept_flow_daily.go | 103 ++ .../internal/dao/internal/t_division_code.go | 89 + .../dao/internal/t_fin_commission_detail.go | 115 ++ .../dao/internal/t_fin_withdrawable_change.go | 119 ++ .../internal/dao/internal/t_finance_apply.go | 125 ++ .../dao/internal/t_finance_audit_record.go | 105 ++ .../dao/internal/t_flow_package_config.go | 99 + server/internal/dao/internal/t_message_log.go | 107 ++ server/internal/dao/internal/t_notify_log.go | 99 + server/internal/dao/internal/t_order.go | 183 ++ server/internal/dao/internal/t_order_item.go | 141 ++ .../dao/internal/t_package_customer.go | 101 + .../internal/t_profit_account_month_bill.go | 125 ++ .../dao/internal/t_resource_batch_download.go | 141 ++ .../dao/internal/t_sim_bind_package_logs.go | 127 ++ .../dao/internal/t_sim_card_bind_pkg.go | 127 ++ .../dao/internal/t_sim_card_cancellation.go | 191 ++ .../internal/dao/internal/t_sim_card_info.go | 189 ++ .../internal/dao/internal/t_sim_card_stock.go | 103 ++ .../dao/internal/t_sim_channel_template.go | 103 ++ .../internal/dao/internal/t_sim_channels.go | 141 ++ .../dao/internal/t_sim_flow_package_info.go | 143 ++ .../dao/internal/t_sim_flow_package_price.go | 111 ++ .../internal/dao/internal/t_sim_flow_pool.go | 117 ++ .../dao/internal/t_sim_package_category.go | 99 + server/internal/dao/internal/t_sim_pool.go | 117 ++ .../dao/internal/t_sim_pool_bind_package.go | 125 ++ .../dao/internal/t_sim_pool_warn_config.go | 109 ++ .../dao/internal/t_sim_upstream_package.go | 99 + .../dao/internal/t_tplatform_setting.go | 111 ++ .../internal/dao/internal/t_user_message.go | 97 + server/internal/dao/internal/t_warn_config.go | 123 ++ server/internal/dao/internal/t_warn_log.go | 125 ++ server/internal/dao/internal/t_wo_audit.go | 117 ++ .../dao/internal/t_wo_communication.go | 113 ++ server/internal/dao/internal/t_wo_main.go | 137 ++ server/internal/dao/internal/t_wo_record.go | 107 ++ server/internal/dao/internal/test_demo.go | 107 ++ server/internal/dao/sys_client.go | 27 + server/internal/dao/sys_config.go | 27 + server/internal/dao/sys_dept.go | 27 + server/internal/dao/sys_dict_data.go | 27 + server/internal/dao/sys_dict_type.go | 27 + server/internal/dao/sys_gen_table.go | 27 + server/internal/dao/sys_job.go | 22 + server/internal/dao/sys_logininfor.go | 27 + server/internal/dao/sys_menu.go | 27 + server/internal/dao/sys_notice.go | 27 + server/internal/dao/sys_notice_user.go | 22 + server/internal/dao/sys_oper_log.go | 27 + server/internal/dao/sys_oss.go | 27 + server/internal/dao/sys_oss_config.go | 27 + server/internal/dao/sys_post.go | 27 + server/internal/dao/sys_role.go | 27 + server/internal/dao/sys_role_dept.go | 27 + server/internal/dao/sys_role_menu.go | 27 + server/internal/dao/sys_social.go | 27 + server/internal/dao/sys_tenant.go | 27 + server/internal/dao/sys_tenant_package.go | 27 + server/internal/dao/sys_user.go | 27 + server/internal/dao/sys_user_online.go | 27 + server/internal/dao/sys_user_post.go | 27 + server/internal/dao/sys_user_role.go | 27 + server/internal/dao/t_agent_balance.go | 22 + server/internal/dao/t_agent_enterprise.go | 22 + server/internal/dao/t_api.go | 22 + server/internal/dao/t_api_group.go | 22 + server/internal/dao/t_api_group_resource.go | 22 + server/internal/dao/t_api_resource.go | 22 + server/internal/dao/t_balance_detail.go | 22 + .../dao/t_consume_account_month_bill.go | 22 + server/internal/dao/t_credit_detail.go | 22 + .../internal/dao/t_cust_withdraw_account.go | 22 + server/internal/dao/t_dept_flow_daily.go | 22 + server/internal/dao/t_division_code.go | 22 + .../internal/dao/t_fin_commission_detail.go | 22 + .../internal/dao/t_fin_withdrawable_change.go | 22 + server/internal/dao/t_finance_apply.go | 19 + server/internal/dao/t_finance_audit_record.go | 19 + server/internal/dao/t_flow_package_config.go | 22 + server/internal/dao/t_message_log.go | 22 + server/internal/dao/t_notify_log.go | 22 + server/internal/dao/t_order.go | 22 + server/internal/dao/t_order_item.go | 22 + server/internal/dao/t_package_customer.go | 22 + .../dao/t_profit_account_month_bill.go | 22 + .../internal/dao/t_resource_batch_download.go | 22 + .../internal/dao/t_sim_bind_package_logs.go | 22 + server/internal/dao/t_sim_card_bind_pkg.go | 22 + .../internal/dao/t_sim_card_cancellation.go | 22 + server/internal/dao/t_sim_card_info.go | 22 + server/internal/dao/t_sim_card_stock.go | 22 + server/internal/dao/t_sim_channel_template.go | 22 + server/internal/dao/t_sim_channels.go | 22 + .../internal/dao/t_sim_flow_package_info.go | 22 + .../internal/dao/t_sim_flow_package_price.go | 22 + server/internal/dao/t_sim_flow_pool.go | 22 + server/internal/dao/t_sim_package_category.go | 22 + server/internal/dao/t_sim_pool.go | 22 + .../internal/dao/t_sim_pool_bind_package.go | 22 + server/internal/dao/t_sim_pool_warn_config.go | 22 + server/internal/dao/t_sim_upstream_package.go | 22 + server/internal/dao/t_tplatform_setting.go | 22 + server/internal/dao/t_user_message.go | 22 + server/internal/dao/t_warn_config.go | 22 + server/internal/dao/t_warn_log.go | 22 + server/internal/dao/t_wo_audit.go | 22 + server/internal/dao/t_wo_communication.go | 22 + server/internal/dao/t_wo_main.go | 22 + server/internal/dao/t_wo_record.go | 22 + server/internal/dao/test_demo.go | 22 + server/internal/library/addons/addons.go | 16 + .../internal/library/allocationunits/units.go | 141 ++ server/internal/library/batchimport/async.go | 204 +++ .../internal/library/batchimport/batch_no.go | 117 ++ server/internal/library/batchimport/runner.go | 635 +++++++ server/internal/library/batchimport/types.go | 93 + server/internal/library/batchimport/upload.go | 66 + .../internal/library/batchinput/excel/csv.go | 78 + .../library/batchinput/excel/parser.go | 248 +++ .../internal/library/batchinput/excel/row.go | 15 + .../library/batchinput/excel/schema.go | 33 + .../library/batchinput/excel/validator.go | 99 + .../library/batchinput/excel/value.go | 220 +++ .../library/batchinput/numrange/range.go | 131 ++ .../internal/library/batchinput/text/lines.go | 59 + .../library/batchmetadata/metadata.go | 52 + server/internal/library/bcache/bcache.go | 6 + .../library/bcache/bcache_system_auth.go | 77 + server/internal/library/bcache/mfa.go | 30 + server/internal/library/cache/cache.go | 60 + server/internal/library/cache/file/file.go | 440 +++++ server/internal/library/contexts/contexts.go | 199 ++ server/internal/library/event/event.go | 75 + server/internal/library/mcache/mcache.go | 56 + .../library/mcache/mcache_access_list.go | 65 + .../library/mcache/mcache_system_config.go | 77 + .../library/mcache/mcache_system_dept.go | 49 + .../library/mcache/mcache_system_user.go | 58 + server/internal/library/rabbitmq/confirmed.go | 53 + server/internal/library/rabbitmq/rabbitmq.go | 259 +++ .../internal/library/rolepolicy/template.go | 189 ++ server/internal/library/rolesync/sync.go | 30 + server/internal/library/tdengine/tdengine.go | 205 +++ server/internal/library/utils/utils.go | 613 +++++++ server/internal/library/websocket/client.go | 156 ++ .../library/websocket/client_manager.go | 384 ++++ .../internal/library/websocket/controller.go | 125 ++ server/internal/library/websocket/init.go | 63 + server/internal/library/websocket/model.go | 39 + server/internal/library/websocket/router.go | 62 + server/internal/library/worker/options.go | 225 +++ server/internal/library/worker/work_proces.go | 84 + server/internal/library/worker/worker.go | 307 ++++ .../library/xgen/gen_consts/gen_codes.go | 86 + .../library/xgen/gen_consts/gen_config.go | 87 + .../internal/library/xgen/gen_dao/gen_dao.go | 63 + .../library/xgen/gen_model/gen_codes.go | 146 ++ .../library/xgen/gen_model/gen_config.go | 126 ++ .../library/xgen/gen_model/gen_view.go | 138 ++ .../library/xgen/gen_view/gen_column.go | 253 +++ .../xgen/gen_view/gen_column_default.go | 341 ++++ .../library/xgen/gen_view/gen_column_map.go | 339 ++++ .../library/xgen/gen_view/gen_curd.go | 960 ++++++++++ .../library/xgen/gen_view/gen_curd_input.go | 409 +++++ .../library/xgen/gen_view/gen_curd_logic.go | 316 ++++ .../library/xgen/gen_view/gen_curd_model.go | 854 +++++++++ .../xgen/gen_view/gen_curd_web_edit.go | 219 +++ .../xgen/gen_view/gen_curd_web_index.go | 179 ++ .../xgen/gen_view/gen_curd_web_model.go | 97 + .../xgen/gen_view/gen_curd_web_view.go | 79 + .../library/xgen/gen_view/gen_util.go | 334 ++++ .../library/xgen/gen_view/gohtml/consts.go | 12 + .../library/xgen/gen_view/gohtml/doc.go | 6 + .../library/xgen/gen_view/gohtml/element.go | 12 + .../library/xgen/gen_view/gohtml/formatter.go | 41 + .../xgen/gen_view/gohtml/html_document.go | 59 + .../library/xgen/gen_view/gohtml/parser.go | 133 ++ .../xgen/gen_view/gohtml/tag_element.go | 150 ++ .../xgen/gen_view/gohtml/text_element.go | 48 + .../library/xgen/gen_view/gohtml/utils.go | 106 ++ .../library/xgen/gen_view/gohtml/writer.go | 38 + server/internal/library/xgen/xgen_curd.go | 471 +++++ server/internal/library/xgen/xgen_init.go | 19 + server/internal/library/xgorm/dao.go | 197 ++ server/internal/library/xgorm/dao_tree.go | 195 ++ .../library/xgorm/gorm_model/gorm_tree.go | 14 + .../library/xgorm/handler/filter_auth.go | 224 +++ .../library/xgorm/handler/force_cache.go | 13 + .../internal/library/xgorm/handler/handler.go | 40 + .../internal/library/xgorm/handler/tenant.go | 27 + server/internal/library/xgorm/hook/member.go | 118 ++ server/internal/logic/agent/agent_base.go | 145 ++ server/internal/logic/agent/agent_dept.go | 1017 +++++++++++ .../logic/agent/agent_dept_passrole_test.go | 185 ++ server/internal/logic/agent/agent_menu.go | 222 +++ server/internal/logic/agent/agent_role.go | 586 ++++++ .../internal/logic/agent/agent_role_queue.go | 83 + .../logic/agent/agent_role_save_test.go | 127 ++ server/internal/logic/agent/agent_scope.go | 25 + server/internal/logic/agent/agent_template.go | 113 ++ server/internal/logic/agent/agent_user.go | 340 ++++ .../logic/agent/t_agent_enterprise.go | 170 ++ server/internal/logic/agent/t_api.go | 169 ++ server/internal/logic/agent/t_api_group.go | 239 +++ server/internal/logic/agent/t_api_resource.go | 239 +++ .../logic/agent/t_cust_withdraw_account.go | 182 ++ server/internal/logic/cardflow/sql_expr.go | 124 ++ .../logic/common/batch_execution_log.go | 637 +++++++ server/internal/logic/common/batch_main.go | 667 +++++++ .../internal/logic/common/batch_visibility.go | 24 + .../internal/logic/common/t_agent_balance.go | 837 +++++++++ .../internal/logic/common/t_balance_detail.go | 250 +++ .../common/t_consume_account_month_bill.go | 458 +++++ .../internal/logic/common/t_credit_detail.go | 165 ++ .../internal/logic/common/t_division_code.go | 156 ++ .../logic/common/t_fin_commission_detail.go | 435 +++++ .../logic/common/t_fin_withdrawable_change.go | 289 +++ .../internal/logic/common/t_finance_apply.go | 263 +++ .../logic/common/t_finance_audit_record.go | 212 +++ server/internal/logic/common/t_message_log.go | 323 ++++ server/internal/logic/common/t_notify_log.go | 264 +++ .../common/t_profit_account_month_bill.go | 695 +++++++ .../logic/common/t_wo_communication.go | 307 ++++ server/internal/logic/common/t_wo_main.go | 600 ++++++ server/internal/logic/common/t_wo_record.go | 238 +++ .../logic/common/work_order_notice.go | 26 + server/internal/logic/gen/test_demo.go | 174 ++ .../internal/logic/gen_codes/gen_selects.go | 6 + .../internal/logic/gen_codes/sys_gen_table.go | 218 +++ server/internal/logic/home/home.go | 248 +++ server/internal/logic/imei.go | 3 + server/internal/logic/imeiqueue/queue.go | 65 + .../internal/logic/iot/card_channel_assoc.go | 258 +++ .../internal/logic/iot/card_dept_display.go | 100 + .../logic/iot/cardpackage/card_update.go | 50 + .../internal/logic/iot/cardpackage/renew.go | 418 +++++ .../logic/iot/cardpackage/repository.go | 245 +++ .../logic/iot/cardpackage/subscribe.go | 544 ++++++ .../logic/iot/cardpackage/terminate.go | 244 +++ .../internal/logic/iot/cardpackage/types.go | 130 ++ .../logic/iot/package_price_effective.go | 271 +++ .../logic/iot/packageduration/policy.go | 214 +++ .../logic/iot/packageprice/effective.go | 288 +++ server/internal/logic/iot/sim_status_queue.go | 56 + .../iot/simcardbatch/addpackage/async.go | 359 ++++ .../iot/simcardbatch/addpackage/parser.go | 152 ++ .../iot/simcardbatch/addpackage/prepare.go | 353 ++++ .../addpackage/prepare_processor.go | 71 + .../iot/simcardbatch/addpackage/processor.go | 142 ++ .../iot/simcardbatch/addpackage/submitter.go | 139 ++ .../iot/simcardbatch/addpackage/types.go | 160 ++ .../logic/iot/simcardbatch/allocate/parser.go | 81 + .../iot/simcardbatch/allocate/processor.go | 117 ++ .../iot/simcardbatch/allocate/splitter.go | 609 +++++++ .../iot/simcardbatch/allocate/submitter.go | 155 ++ .../logic/iot/simcardbatch/allocate/types.go | 81 + .../logic/iot/simcardbatch/cancel/parser.go | 91 + .../iot/simcardbatch/cancel/processor.go | 77 + .../iot/simcardbatch/cancel/submitter.go | 141 ++ .../logic/iot/simcardbatch/cancel/types.go | 81 + .../logic/iot/simcardbatch/change/async.go | 187 ++ .../logic/iot/simcardbatch/change/complete.go | 515 ++++++ .../simcardbatch/change/excel_processor.go | 41 + .../logic/iot/simcardbatch/change/input.go | 17 + .../logic/iot/simcardbatch/change/parser.go | 164 ++ .../simcardbatch/change/prepare_processor.go | 107 ++ .../iot/simcardbatch/change/processor.go | 329 ++++ .../logic/iot/simcardbatch/change/range.go | 32 + .../iot/simcardbatch/change/repository.go | 251 +++ .../logic/iot/simcardbatch/change/types.go | 133 ++ .../logic/iot/simcardbatch/change/utils.go | 50 + .../logic/iot/simcardbatch/common/batch.go | 121 ++ .../simcardbatch/common/cardsource/input.go | 102 ++ .../simcardbatch/common/cardsource/range.go | 56 + .../logic/iot/simcardbatch/datacut/errors.go | 11 + .../logic/iot/simcardbatch/datacut/parser.go | 157 ++ .../iot/simcardbatch/datacut/processor.go | 62 + .../iot/simcardbatch/datacut/submitter.go | 97 + .../logic/iot/simcardbatch/datacut/types.go | 81 + .../logic/iot/simcardbatch/datacut/utils.go | 23 + .../iot/simcardbatch/dataswitch/errors.go | 11 + .../iot/simcardbatch/dataswitch/parser.go | 195 ++ .../iot/simcardbatch/dataswitch/processor.go | 70 + .../iot/simcardbatch/dataswitch/submitter.go | 91 + .../iot/simcardbatch/dataswitch/types.go | 112 ++ .../iot/simcardbatch/dataswitch/utils.go | 7 + .../iot/simcardbatch/inbound/excel_schema.go | 28 + .../logic/iot/simcardbatch/inbound/pending.go | 316 ++++ .../iot/simcardbatch/lifecycle/dispatcher.go | 34 + .../iot/simcardbatch/lifecycle/executor.go | 246 +++ .../iot/simcardbatch/lifecycle/operation.go | 87 + .../iot/simcardbatch/lifecycle/parser.go | 92 + .../iot/simcardbatch/lifecycle/processor.go | 87 + .../iot/simcardbatch/lifecycle/repository.go | 418 +++++ .../iot/simcardbatch/lifecycle/submitter.go | 91 + .../logic/iot/simcardbatch/lifecycle/types.go | 107 ++ .../logic/iot/simcardbatch/outbound/async.go | 274 +++ .../iot/simcardbatch/outbound/complete.go | 777 ++++++++ .../logic/iot/simcardbatch/outbound/input.go | 17 + .../logic/iot/simcardbatch/outbound/parser.go | 344 ++++ .../iot/simcardbatch/outbound/preview.go | 178 ++ .../iot/simcardbatch/outbound/processor.go | 401 ++++ .../logic/iot/simcardbatch/outbound/queue.go | 20 + .../logic/iot/simcardbatch/outbound/range.go | 126 ++ .../iot/simcardbatch/outbound/repository.go | 204 +++ .../logic/iot/simcardbatch/outbound/types.go | 129 ++ .../logic/iot/simcardbatch/outbound/utils.go | 27 + .../logic/iot/simcardbatch/renew/async.go | 231 +++ .../logic/iot/simcardbatch/renew/complete.go | 320 ++++ .../iot/simcardbatch/renew/excel_processor.go | 101 + .../logic/iot/simcardbatch/renew/identity.go | 189 ++ .../logic/iot/simcardbatch/renew/input.go | 59 + .../logic/iot/simcardbatch/renew/parser.go | 194 ++ .../logic/iot/simcardbatch/renew/payment.go | 1041 +++++++++++ .../simcardbatch/renew/prepare_processor.go | 175 ++ .../logic/iot/simcardbatch/renew/processor.go | 558 ++++++ .../iot/simcardbatch/renew/repository.go | 299 +++ .../logic/iot/simcardbatch/renew/types.go | 99 + .../logic/iot/simcardbatch/renew/utils.go | 27 + .../trafficcutoffconfig/parser.go | 82 + .../trafficcutoffconfig/processor.go | 176 ++ .../trafficcutoffconfig/submitter.go | 146 ++ .../simcardbatch/trafficcutoffconfig/types.go | 90 + .../logic/iot/simcardbatch/unsub/input.go | 17 + .../logic/iot/simcardbatch/unsub/parser.go | 50 + .../logic/iot/simcardbatch/unsub/pending.go | 230 +++ .../logic/iot/simcardbatch/unsub/processor.go | 148 ++ .../logic/iot/simcardbatch/unsub/range.go | 32 + .../iot/simcardbatch/unsub/repository.go | 83 + .../logic/iot/simcardbatch/unsub/types.go | 61 + .../simcardbatch/warningconfig/email_code.go | 385 ++++ .../iot/simcardbatch/warningconfig/input.go | 99 + .../iot/simcardbatch/warningconfig/parser.go | 62 + .../simcardbatch/warningconfig/processor.go | 433 +++++ .../iot/simcardbatch/warningconfig/range.go | 32 + .../iot/simcardbatch/warningconfig/schema.go | 219 +++ .../simcardbatch/warningconfig/submitter.go | 221 +++ .../iot/simcardbatch/warningconfig/types.go | 117 ++ .../logic/iot/stock_business_fields.go | 492 +++++ .../internal/logic/iot/t_add_package_async.go | 312 ++++ .../logic/iot/t_flow_package_config.go | 503 +++++ server/internal/logic/iot/t_order.go | 477 +++++ .../internal/logic/iot/t_sim_card_allocate.go | 1041 +++++++++++ .../internal/logic/iot/t_sim_card_bind_pkg.go | 667 +++++++ .../internal/logic/iot/t_sim_card_cancel.go | 63 + .../logic/iot/t_sim_card_cancellation.go | 255 +++ .../internal/logic/iot/t_sim_card_change.go | 1093 +++++++++++ .../internal/logic/iot/t_sim_card_data_cut.go | 63 + .../logic/iot/t_sim_card_data_switch.go | 141 ++ .../internal/logic/iot/t_sim_card_inbound.go | 104 ++ server/internal/logic/iot/t_sim_card_info.go | 953 ++++++++++ .../logic/iot/t_sim_card_info_test.go | 315 ++++ .../internal/logic/iot/t_sim_card_outbound.go | 454 +++++ server/internal/logic/iot/t_sim_card_renew.go | 1596 ++++++++++++++++ .../logic/iot/t_sim_card_renew_excel.go | 158 ++ .../logic/iot/t_sim_card_renew_payment.go | 421 +++++ .../logic/iot/t_sim_card_renew_price_test.go | 80 + .../internal/logic/iot/t_sim_card_restart.go | 51 + server/internal/logic/iot/t_sim_card_start.go | 51 + server/internal/logic/iot/t_sim_card_stock.go | 219 +++ server/internal/logic/iot/t_sim_card_stop.go | 94 + .../logic/iot/t_sim_card_traffic_cutoff.go | 257 +++ server/internal/logic/iot/t_sim_card_unsub.go | 118 ++ .../logic/iot/t_sim_channel_template.go | 239 +++ server/internal/logic/iot/t_sim_channels.go | 844 +++++++++ server/internal/logic/iot/t_sim_diagnose.go | 1624 +++++++++++++++++ .../logic/iot/t_sim_diagnose_legacy.go | 82 + .../logic/iot/t_sim_diagnose_network_block.go | 31 + .../logic/iot/t_sim_flow_package_info.go | 707 +++++++ .../logic/iot/t_sim_flow_package_price.go | 870 +++++++++ server/internal/logic/iot/t_sim_flow_pool.go | 464 +++++ .../logic/iot/t_sim_package_category.go | 226 +++ .../logic/iot/t_sim_pool_bind_package.go | 458 +++++ .../logic/iot/t_sim_pool_warn_config.go | 165 ++ .../logic/iot/t_sim_upstream_package.go | 178 ++ .../logic/iot/t_sim_warning_config.go | 121 ++ server/internal/logic/logic.go | 28 + server/internal/logic/memorydb/memorydb.go | 175 ++ .../internal/logic/memorydb/memorydb_test.go | 104 ++ server/internal/logic/memorydb/sys_config.go | 200 ++ server/internal/logic/memorydb/sys_dept.go | 211 +++ .../internal/logic/memorydb/sys_dict_data.go | 202 ++ .../internal/logic/memorydb/sys_dict_type.go | 198 ++ server/internal/logic/memorydb/sys_menu.go | 207 +++ server/internal/logic/memorydb/sys_post.go | 202 ++ server/internal/logic/memorydb/sys_role.go | 213 +++ server/internal/logic/memorydb/sys_tenant.go | 213 +++ .../internal/logic/middleware/middleware.go | 307 ++++ .../internal/logic/monitor/monitor_server.go | 151 ++ .../logic/packagecustomer/publisher.go | 61 + server/internal/logic/packagecustomer/sync.go | 143 ++ .../packagelifecycle/package_lifecycle.go | 1150 ++++++++++++ server/internal/logic/pay/alipay.go | 437 +++++ server/internal/logic/simstatusqueue/queue.go | 82 + .../internal/logic/simwarning/auto_action.go | 212 +++ server/internal/logic/simwarning/config.go | 700 +++++++ server/internal/logic/simwarning/dedupe.go | 151 ++ .../logic/simwarning/expire_candidate.go | 622 +++++++ .../logic/simwarning/expire_config.go | 43 + .../internal/logic/simwarning/log_writer.go | 131 ++ server/internal/logic/simwarning/notify.go | 108 ++ server/internal/logic/simwarning/rules.go | 379 ++++ server/internal/logic/simwarning/scanner.go | 472 +++++ server/internal/logic/simwarning/types.go | 105 ++ server/internal/logic/simwarning/warn_type.go | 49 + .../internal/logic/smsgateway/smsgateway.go | 249 +++ server/internal/logic/system/sys_auth.go | 731 ++++++++ server/internal/logic/system/sys_captcha.go | 61 + server/internal/logic/system/sys_client.go | 138 ++ server/internal/logic/system/sys_config.go | 292 +++ server/internal/logic/system/sys_dept.go | 681 +++++++ server/internal/logic/system/sys_dict_data.go | 225 +++ server/internal/logic/system/sys_dict_type.go | 185 ++ server/internal/logic/system/sys_job.go | 383 ++++ .../internal/logic/system/sys_logininfor.go | 97 + server/internal/logic/system/sys_menu.go | 508 ++++++ .../system/sys_menu_document_center_test.go | 53 + server/internal/logic/system/sys_notice.go | 350 ++++ .../internal/logic/system/sys_notice_user.go | 193 ++ server/internal/logic/system/sys_oper_log.go | 159 ++ server/internal/logic/system/sys_oss.go | 981 ++++++++++ .../internal/logic/system/sys_oss_config.go | 168 ++ server/internal/logic/system/sys_post.go | 214 +++ server/internal/logic/system/sys_qrcode.go | 829 +++++++++ .../logic/system/sys_qrcode_timeout_test.go | 83 + server/internal/logic/system/sys_role.go | 601 ++++++ server/internal/logic/system/sys_social.go | 83 + server/internal/logic/system/sys_tenant.go | 502 +++++ .../logic/system/sys_tenant_package.go | 140 ++ server/internal/logic/system/sys_user.go | 1282 +++++++++++++ .../internal/logic/system/sys_user_online.go | 140 ++ .../logic/system/t_tplatform_setting.go | 206 +++ server/internal/logic/trade/trade.go | 208 +++ server/internal/logic/trafficcutoff/batch.go | 111 ++ server/internal/logic/trafficcutoff/dedupe.go | 48 + server/internal/logic/trafficcutoff/notify.go | 64 + .../internal/logic/trafficcutoff/scanner.go | 244 +++ server/internal/logic/trafficcutoff/types.go | 56 + .../logic/trafficcutoff/types_test.go | 95 + .../logic/trafficusage/history_sync.go | 72 + .../logic/trafficusage/history_sync_test.go | 41 + .../logic/trafficusage/traffic_usage.go | 748 ++++++++ .../trafficusage/traffic_usage_card_query.go | 37 + .../logic/trafficusage/traffic_usage_daily.go | 268 +++ .../trafficusage/traffic_usage_monthly.go | 329 ++++ .../logic/trafficusage/traffic_usage_pool.go | 156 ++ .../logic/upstream/diagnosis_response.go | 42 + .../logic/upstream/sim_data_diagnosis.go | 355 ++++ .../internal/logic/upstream/upstream_chan.go | 918 ++++++++++ .../internal/logic/warningnotify/aggregate.go | 256 +++ .../internal/logic/warningnotify/content.go | 429 +++++ .../logic/warningnotify/email_sender.go | 269 +++ .../warningnotify/message_center_sender.go | 558 ++++++ server/internal/logic/warningnotify/sender.go | 113 ++ .../logic/warningnotify/sms_sender.go | 371 ++++ .../logic/warningnotify/smspb/common.pb.go | 205 +++ .../logic/warningnotify/smspb/notice.pb.go | 196 ++ .../warningnotify/smspb/notice_grpc.pb.go | 121 ++ server/internal/logic/warningnotify/types.go | 66 + .../logic/warningnotify/wechat_sender.go | 666 +++++++ server/internal/model/agent_dept.go | 82 + server/internal/model/agent_role.go | 62 + server/internal/model/agent_user.go | 67 + server/internal/model/alipay.go | 118 ++ server/internal/model/batch_detail_list.go | 71 + server/internal/model/batch_execution_log.go | 87 + server/internal/model/batch_main.go | 257 +++ server/internal/model/bcache_model.go | 15 + server/internal/model/channel_refresh.go | 10 + server/internal/model/context.go | 26 + server/internal/model/do/batch_detail.go | 32 + server/internal/model/do/batch_main.go | 47 + server/internal/model/do/sys_client.go | 31 + server/internal/model/do/sys_config.go | 27 + server/internal/model/do/sys_dept.go | 39 + server/internal/model/do/sys_dict_data.go | 30 + server/internal/model/do/sys_dict_type.go | 26 + server/internal/model/do/sys_gen_table.go | 32 + server/internal/model/do/sys_job.go | 32 + server/internal/model/do/sys_logininfor.go | 27 + server/internal/model/do/sys_menu.go | 37 + server/internal/model/do/sys_notice.go | 30 + server/internal/model/do/sys_notice_user.go | 30 + server/internal/model/do/sys_oper_log.go | 33 + server/internal/model/do/sys_oss.go | 32 + server/internal/model/do/sys_oss_config.go | 35 + server/internal/model/do/sys_post.go | 31 + server/internal/model/do/sys_role.go | 36 + server/internal/model/do/sys_role_dept.go | 17 + server/internal/model/do/sys_role_menu.go | 18 + server/internal/model/do/sys_social.go | 45 + server/internal/model/do/sys_tenant.go | 39 + .../internal/model/do/sys_tenant_package.go | 28 + server/internal/model/do/sys_user.go | 40 + server/internal/model/do/sys_user_online.go | 29 + server/internal/model/do/sys_user_post.go | 17 + server/internal/model/do/sys_user_role.go | 17 + server/internal/model/do/t_agent_balance.go | 32 + .../internal/model/do/t_agent_enterprise.go | 31 + server/internal/model/do/t_api.go | 29 + server/internal/model/do/t_api_group.go | 26 + .../internal/model/do/t_api_group_resource.go | 16 + server/internal/model/do/t_api_resource.go | 29 + server/internal/model/do/t_balance_detail.go | 35 + .../model/do/t_consume_account_month_bill.go | 43 + server/internal/model/do/t_credit_detail.go | 33 + .../model/do/t_cust_withdraw_account.go | 30 + server/internal/model/do/t_dept_flow_daily.go | 28 + server/internal/model/do/t_division_code.go | 20 + .../model/do/t_fin_commission_detail.go | 35 + .../model/do/t_fin_withdrawable_change.go | 36 + server/internal/model/do/t_finance_apply.go | 40 + .../model/do/t_finance_audit_record.go | 29 + .../model/do/t_flow_package_config.go | 27 + server/internal/model/do/t_message_log.go | 31 + server/internal/model/do/t_notify_log.go | 26 + server/internal/model/do/t_order.go | 68 + server/internal/model/do/t_order_item.go | 47 + .../internal/model/do/t_package_customer.go | 27 + .../model/do/t_profit_account_month_bill.go | 39 + .../model/do/t_resource_batch_download.go | 48 + .../model/do/t_sim_bind_package_logs.go | 40 + .../internal/model/do/t_sim_card_bind_pkg.go | 40 + .../model/do/t_sim_card_cancellation.go | 72 + server/internal/model/do/t_sim_card_info.go | 71 + server/internal/model/do/t_sim_card_stock.go | 28 + .../do/t_sim_card_traffic_cutoff_extension.go | 13 + .../model/do/t_sim_channel_template.go | 28 + server/internal/model/do/t_sim_channels.go | 47 + .../model/do/t_sim_flow_package_info.go | 49 + .../model/do/t_sim_flow_package_price.go | 32 + server/internal/model/do/t_sim_flow_pool.go | 36 + .../model/do/t_sim_package_category.go | 26 + .../model/do/t_sim_pool_bind_package.go | 39 + .../model/do/t_sim_pool_warn_config.go | 31 + .../model/do/t_sim_upstream_package.go | 26 + .../internal/model/do/t_tplatform_setting.go | 32 + server/internal/model/do/t_user_message.go | 25 + server/internal/model/do/t_warn_config.go | 38 + server/internal/model/do/t_warn_log.go | 39 + server/internal/model/do/t_wo_audit.go | 35 + .../internal/model/do/t_wo_communication.go | 34 + server/internal/model/do/t_wo_main.go | 45 + server/internal/model/do/t_wo_record.go | 30 + server/internal/model/do/test_demo.go | 30 + server/internal/model/entity/batch_detail.go | 30 + server/internal/model/entity/batch_main.go | 45 + server/internal/model/entity/sys_client.go | 29 + server/internal/model/entity/sys_config.go | 25 + server/internal/model/entity/sys_dept.go | 37 + server/internal/model/entity/sys_dict_data.go | 28 + server/internal/model/entity/sys_dict_type.go | 24 + server/internal/model/entity/sys_gen_table.go | 30 + server/internal/model/entity/sys_job.go | 30 + .../internal/model/entity/sys_logininfor.go | 25 + server/internal/model/entity/sys_menu.go | 35 + server/internal/model/entity/sys_notice.go | 28 + .../internal/model/entity/sys_notice_user.go | 28 + server/internal/model/entity/sys_oper_log.go | 31 + server/internal/model/entity/sys_oss.go | 30 + .../internal/model/entity/sys_oss_config.go | 33 + server/internal/model/entity/sys_post.go | 29 + server/internal/model/entity/sys_role.go | 34 + server/internal/model/entity/sys_role_dept.go | 12 + server/internal/model/entity/sys_role_menu.go | 13 + server/internal/model/entity/sys_social.go | 43 + server/internal/model/entity/sys_tenant.go | 37 + .../model/entity/sys_tenant_package.go | 26 + server/internal/model/entity/sys_user.go | 38 + .../internal/model/entity/sys_user_online.go | 27 + server/internal/model/entity/sys_user_post.go | 12 + server/internal/model/entity/sys_user_role.go | 12 + .../internal/model/entity/t_agent_balance.go | 30 + .../model/entity/t_agent_enterprise.go | 29 + server/internal/model/entity/t_api.go | 27 + server/internal/model/entity/t_api_group.go | 24 + .../model/entity/t_api_group_resource.go | 11 + .../internal/model/entity/t_api_resource.go | 27 + .../internal/model/entity/t_balance_detail.go | 33 + .../entity/t_consume_account_month_bill.go | 41 + .../internal/model/entity/t_credit_detail.go | 31 + .../model/entity/t_cust_withdraw_account.go | 28 + .../model/entity/t_dept_flow_daily.go | 26 + .../internal/model/entity/t_division_code.go | 15 + .../model/entity/t_fin_commission_detail.go | 33 + .../model/entity/t_fin_withdrawable_change.go | 34 + .../internal/model/entity/t_finance_apply.go | 38 + .../model/entity/t_finance_audit_record.go | 27 + .../model/entity/t_flow_package_config.go | 25 + server/internal/model/entity/t_message_log.go | 29 + server/internal/model/entity/t_notify_log.go | 24 + server/internal/model/entity/t_order.go | 66 + server/internal/model/entity/t_order_item.go | 45 + .../model/entity/t_package_customer.go | 25 + .../entity/t_profit_account_month_bill.go | 37 + .../model/entity/t_resource_batch_download.go | 46 + .../model/entity/t_sim_bind_package_logs.go | 38 + .../model/entity/t_sim_card_bind_pkg.go | 38 + .../model/entity/t_sim_card_cancellation.go | 70 + .../internal/model/entity/t_sim_card_info.go | 69 + .../internal/model/entity/t_sim_card_stock.go | 26 + .../model/entity/t_sim_channel_template.go | 26 + .../internal/model/entity/t_sim_channels.go | 45 + .../model/entity/t_sim_flow_package_info.go | 47 + .../model/entity/t_sim_flow_package_price.go | 30 + .../internal/model/entity/t_sim_flow_pool.go | 34 + .../model/entity/t_sim_package_category.go | 24 + .../model/entity/t_sim_pool_bind_package.go | 37 + .../model/entity/t_sim_pool_warn_config.go | 29 + .../model/entity/t_sim_upstream_package.go | 24 + .../model/entity/t_tplatform_setting.go | 30 + .../internal/model/entity/t_user_message.go | 23 + server/internal/model/entity/t_warn_config.go | 36 + server/internal/model/entity/t_warn_log.go | 37 + server/internal/model/entity/t_wo_audit.go | 33 + .../model/entity/t_wo_communication.go | 32 + server/internal/model/entity/t_wo_main.go | 43 + server/internal/model/entity/t_wo_record.go | 28 + server/internal/model/entity/test_demo.go | 28 + server/internal/model/genin/test_demo.go | 129 ++ server/internal/model/home.go | 34 + server/internal/model/imei_sync.go | 15 + server/internal/model/monitor_server.go | 36 + server/internal/model/mybytes.go | 52 + .../internal/model/package_customer_sync.go | 9 + server/internal/model/qrcode.go | 85 + server/internal/model/request/common.go | 20 + server/internal/model/response/common.go | 12 + server/internal/model/sim_diag.go | 26 + server/internal/model/sim_status_sync.go | 26 + server/internal/model/sim_warning_config.go | 86 + server/internal/model/sync_scope.go | 149 ++ server/internal/model/sync_scope_test.go | 141 ++ server/internal/model/sys_auth.go | 38 + server/internal/model/sys_client.go | 93 + server/internal/model/sys_config.go | 83 + server/internal/model/sys_dept.go | 138 ++ server/internal/model/sys_dict.go | 177 ++ server/internal/model/sys_gen_table.go | 127 ++ server/internal/model/sys_job.go | 81 + server/internal/model/sys_logininfor.go | 61 + server/internal/model/sys_menu.go | 125 ++ server/internal/model/sys_notice.go | 97 + server/internal/model/sys_notice_user.go | 201 ++ server/internal/model/sys_oper_log.go | 64 + server/internal/model/sys_oss.go | 112 ++ server/internal/model/sys_oss_config.go | 98 + server/internal/model/sys_post.go | 111 ++ server/internal/model/sys_role.go | 128 ++ server/internal/model/sys_social.go | 73 + server/internal/model/sys_tenant.go | 119 ++ server/internal/model/sys_tenant_package.go | 73 + server/internal/model/sys_user.go | 234 +++ server/internal/model/sys_user_online.go | 71 + server/internal/model/t_agent_balance.go | 271 +++ server/internal/model/t_agent_enterprise.go | 156 ++ server/internal/model/t_api.go | 147 ++ server/internal/model/t_api_group.go | 154 ++ server/internal/model/t_api_resource.go | 185 ++ server/internal/model/t_balance_detail.go | 213 +++ .../model/t_consume_account_month_bill.go | 246 +++ server/internal/model/t_credit_detail.go | 163 ++ .../internal/model/t_cust_withdraw_account.go | 178 ++ server/internal/model/t_division_code.go | 110 ++ .../internal/model/t_fin_commission_detail.go | 219 +++ .../model/t_fin_withdrawable_change.go | 219 +++ server/internal/model/t_finance_apply.go | 265 +++ .../internal/model/t_finance_audit_record.go | 162 ++ .../internal/model/t_flow_package_config.go | 133 ++ server/internal/model/t_message_log.go | 153 ++ server/internal/model/t_notify_log.go | 132 ++ server/internal/model/t_order.go | 372 ++++ .../model/t_profit_account_month_bill.go | 253 +++ server/internal/model/t_sim_card_allocate.go | 52 + server/internal/model/t_sim_card_bind_pkg.go | 245 +++ .../model/t_sim_card_bind_pkg_addpackage.go | 99 + .../internal/model/t_sim_card_cancellation.go | 57 + server/internal/model/t_sim_card_change.go | 185 ++ server/internal/model/t_sim_card_inbound.go | 89 + server/internal/model/t_sim_card_info.go | 395 ++++ server/internal/model/t_sim_card_lifecycle.go | 58 + server/internal/model/t_sim_card_outbound.go | 144 ++ server/internal/model/t_sim_card_renew.go | 221 +++ server/internal/model/t_sim_card_stock.go | 155 ++ .../model/t_sim_card_traffic_cutoff.go | 70 + server/internal/model/t_sim_card_unsub.go | 38 + .../internal/model/t_sim_channel_template.go | 139 ++ .../internal/model/t_sim_channel_testing.go | 129 ++ server/internal/model/t_sim_channels.go | 258 +++ server/internal/model/t_sim_diagnose.go | 113 ++ .../internal/model/t_sim_flow_package_info.go | 265 +++ .../model/t_sim_flow_package_info_options.go | 6 + .../model/t_sim_flow_package_price.go | 168 ++ server/internal/model/t_sim_flow_pool.go | 212 +++ .../internal/model/t_sim_package_category.go | 131 ++ .../internal/model/t_sim_pool_bind_package.go | 198 ++ .../t_sim_pool_bind_package_addpackage.go | 45 + .../internal/model/t_sim_pool_warn_config.go | 153 ++ server/internal/model/t_sim_warning_config.go | 54 + server/internal/model/t_tplatform_setting.go | 195 ++ server/internal/model/t_upstream_package.go | 131 ++ server/internal/model/t_wo_communication.go | 181 ++ server/internal/model/t_wo_main.go | 289 +++ server/internal/model/t_wo_record.go | 169 ++ server/internal/model/traffic_usage.go | 91 + server/internal/model/traffic_usage_sync.go | 76 + server/internal/model/upstream_chan.go | 307 ++++ server/internal/model/work_order_queue.go | 7 + server/internal/model/worker_diagnostic.go | 9 + server/internal/packed/packed.go | 6 + server/internal/packed/response/response.go | 81 + server/internal/queues/base.go | 57 + .../httpqueues/broadcast_db_chg_queue.go | 51 + .../queues/httpqueues/sys_opt_log_queue.go | 52 + server/internal/router/agent.go | 28 + server/internal/router/common.go | 27 + server/internal/router/gen.go | 18 + server/internal/router/gen_codes.go | 26 + server/internal/router/genrouter/init.go | 31 + server/internal/router/genrouter/test_demo.go | 13 + server/internal/router/home.go | 21 + server/internal/router/iot.go | 30 + server/internal/router/monitor.go | 42 + server/internal/router/pay.go | 21 + server/internal/router/router.go | 128 ++ server/internal/router/system.go | 28 + server/internal/router/trade.go | 17 + server/internal/service/agent.go | 267 +++ server/internal/service/common.go | 522 ++++++ .../internal/service/fullsyncretry/client.go | 305 ++++ server/internal/service/gen.go | 46 + server/internal/service/gen_codes.go | 56 + server/internal/service/home.go | 41 + server/internal/service/imeiqueue.go | 29 + server/internal/service/iot.go | 756 ++++++++ server/internal/service/memorydb.go | 202 ++ server/internal/service/middleware.go | 39 + server/internal/service/monitor.go | 44 + server/internal/service/packagecustomer.go | 8 + server/internal/service/packagelifecycle.go | 24 + server/internal/service/pay.go | 30 + server/internal/service/simstatus_queue.go | 29 + server/internal/service/simwarning.go | 37 + server/internal/service/system.go | 673 +++++++ server/internal/service/trade.go | 28 + server/internal/service/trafficcutoff.go | 24 + server/internal/service/trafficusage.go | 147 ++ server/internal/service/upstream.go | 65 + server/internal/service/warningnotify.go | 8 + .../workerdiagnostic/worker_diagnostic.go | 49 + server/internal/tasks/account_month_bill.go | 110 ++ server/internal/tasks/base.go | 17 + server/internal/tasks/clear_data.go | 32 + server/internal/tasks/flow_pool.go | 41 + server/internal/tasks/imei_queue.go | 26 + server/internal/tasks/job_lock.go | 183 ++ server/internal/tasks/package_lifecycle.go | 26 + server/internal/tasks/sim_status_queue.go | 20 + server/internal/tasks/sim_warning.go | 81 + server/internal/tasks/task_log.go | 19 + server/internal/tasks/tasks.go | 395 ++++ server/internal/tasks/traffic_cutoff.go | 25 + server/internal/tasks/traffic_pool_usage.go | 19 + server/internal/tasks/traffic_usage_daily.go | 30 + .../internal/tasks/traffic_usage_monthly.go | 51 + server/main.go | 39 + .../generate/default/curd/api.go.template | 101 + .../default/curd/controller.go.template | 119 ++ .../generate/default/curd/input.go.template | 169 ++ .../generate/default/curd/logic.go.template | 259 +++ .../generate/default/curd/router.go.template | 14 + .../generate/default/curd/source.sql.template | 74 + .../generate/default/curd/web.api.ts.template | 58 + .../default/curd/web.edit.vue.template | 119 ++ .../default/curd/web.index.vue.template | 207 +++ .../default/curd/web.model.ts.template | 58 + .../default/curd/web.view.vue.template | 41 + .../20260920_card_channel_assoc_chan_key.sql | 4 + ...260920_traffic_cutoff_cross_month_hold.sql | 4 + .../migrations/20260921_agent_role_source.sql | 5 + .../20260922_agent_role_source_repair.sql | 26 + .../20260922_traffic_cutoff_scan_indexes.sql | 6 + .../20260923_batch_source_type_scheduled.sql | 40 + .../20261009_batch_execution_metadata.sql | 12 + server/resource/public/public.txt | 0 .../SWC20260803113132HEFV8YD6-import.xlsx | Bin 0 -> 6281 bytes .../upload/2025-03-14/d8fqgc4iypz4hjdjh4.png | Bin 0 -> 23625 bytes .../storage/data/full_sync_monitor_menu.sql | 32 + server/storage/data/xiu_admin.sql | 1309 +++++++++++++ server/utility/convert/convert.go | 92 + server/utility/excel/excel.go | 138 ++ server/utility/external_request.go | 110 ++ server/utility/external_request_test.go | 144 ++ server/utility/gfredis/conn.go | 11 + server/utility/gfredis/gfredis.go | 150 ++ server/utility/gfredis/hash.go | 51 + server/utility/gfredis/key.go | 16 + server/utility/gfredis/list.go | 37 + server/utility/gfredis/string.go | 42 + server/utility/gfredis/subpub.go | 18 + server/utility/gfredis/zset.go | 21 + server/utility/hash/crc16.go | 100 + server/utility/hash/sum16.go | 31 + server/utility/iot_excelize/batch_result.go | 92 + server/utility/iot_excelize/export_builder.go | 137 ++ server/utility/iot_excelize/import_reader.go | 202 ++ server/utility/iot_excelize/local_storage.go | 89 + server/utility/iot_excelize/schema.go | 111 ++ server/utility/iot_excelize/style.go | 53 + server/utility/iot_excelize/types.go | 49 + server/utility/iot_excelize/writer.go | 47 + server/utility/ip_lookup.go | 164 ++ server/utility/ip_lookup_test.go | 219 +++ server/utility/queue/memory_queue.go | 127 ++ server/utility/queue/queue.go | 177 ++ server/utility/queue/redis_broadcast.go | 173 ++ server/utility/queue/redis_queue.go | 153 ++ server/utility/tree/tree.go | 109 ++ server/utility/utility.go | 240 +++ server/utility/uuid32/uuid32.go | 15 + server/utility/version/version.go | 45 + 1132 files changed, 138197 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 docs/agent-role-template-deployment.md create mode 100644 docs/agent-role-template.md create mode 100644 server/Makefile create mode 100644 server/api/agent/agent.go create mode 100644 server/api/agent/v1/agent_dept.go create mode 100644 server/api/agent/v1/agent_menu.go create mode 100644 server/api/agent/v1/agent_role.go create mode 100644 server/api/agent/v1/agent_scope.go create mode 100644 server/api/agent/v1/agent_user.go create mode 100644 server/api/agent/v1/tagententerprise.go create mode 100644 server/api/agent/v1/tapi.go create mode 100644 server/api/agent/v1/tapigroup.go create mode 100644 server/api/agent/v1/tapiresource.go create mode 100644 server/api/agent/v1/tcustwithdrawaccount.go create mode 100644 server/api/common/common.go create mode 100644 server/api/common/v1/batchexecutionlog.go create mode 100644 server/api/common/v1/batchmain.go create mode 100644 server/api/common/v1/tagentbalance.go create mode 100644 server/api/common/v1/tbalancedetail.go create mode 100644 server/api/common/v1/tconsumeaccountmonthbill.go create mode 100644 server/api/common/v1/tcreditdetail.go create mode 100644 server/api/common/v1/tdivisioncode.go create mode 100644 server/api/common/v1/tfinanceapply.go create mode 100644 server/api/common/v1/tfinanceauditrecord.go create mode 100644 server/api/common/v1/tfincommissiondetail.go create mode 100644 server/api/common/v1/tfinwithdrawablechange.go create mode 100644 server/api/common/v1/tmessagelog.go create mode 100644 server/api/common/v1/tnotifylog.go create mode 100644 server/api/common/v1/tprofitaccountmonthbill.go create mode 100644 server/api/common/v1/twocommunication.go create mode 100644 server/api/common/v1/twomain.go create mode 100644 server/api/common/v1/tworecord.go create mode 100644 server/api/common/v1/upload.go create mode 100644 server/api/gen/testdemo/testdemo.go create mode 100644 server/api/gen/testdemo/v1/testdemo.go create mode 100644 server/api/gen_codes/gen_codes.go create mode 100644 server/api/gen_codes/v1/gen_table.go create mode 100644 server/api/home/home.go create mode 100644 server/api/home/v1/home.go create mode 100644 server/api/iot/iot.go create mode 100644 server/api/iot/v1/full_sync_monitor.go create mode 100644 server/api/iot/v1/full_sync_replay.go create mode 100644 server/api/iot/v1/simwarningconfig.go create mode 100644 server/api/iot/v1/tflowpackageconfig.go create mode 100644 server/api/iot/v1/torder.go create mode 100644 server/api/iot/v1/tsimcardallocate.go create mode 100644 server/api/iot/v1/tsimcardbindpkg.go create mode 100644 server/api/iot/v1/tsimcardcancel.go create mode 100644 server/api/iot/v1/tsimcardcancellation.go create mode 100644 server/api/iot/v1/tsimcardchange.go create mode 100644 server/api/iot/v1/tsimcarddatacut.go create mode 100644 server/api/iot/v1/tsimcarddatastart.go create mode 100644 server/api/iot/v1/tsimcarddatastop.go create mode 100644 server/api/iot/v1/tsimcardinbound.go create mode 100644 server/api/iot/v1/tsimcardinfo.go create mode 100644 server/api/iot/v1/tsimcardoutbound.go create mode 100644 server/api/iot/v1/tsimcardrenew.go create mode 100644 server/api/iot/v1/tsimcardrestart.go create mode 100644 server/api/iot/v1/tsimcardstart.go create mode 100644 server/api/iot/v1/tsimcardstock.go create mode 100644 server/api/iot/v1/tsimcardstop.go create mode 100644 server/api/iot/v1/tsimcardtrafficcutoff.go create mode 100644 server/api/iot/v1/tsimcardunsub.go create mode 100644 server/api/iot/v1/tsimchannels.go create mode 100644 server/api/iot/v1/tsimchanneltemplate.go create mode 100644 server/api/iot/v1/tsimdiagnose.go create mode 100644 server/api/iot/v1/tsimflowpackageinfo.go create mode 100644 server/api/iot/v1/tsimflowpackageinfo_options.go create mode 100644 server/api/iot/v1/tsimflowpackageprice.go create mode 100644 server/api/iot/v1/tsimflowpool.go create mode 100644 server/api/iot/v1/tsimpackagecategory.go create mode 100644 server/api/iot/v1/tsimpoolbindpackage.go create mode 100644 server/api/iot/v1/tsimpoolwarnconfig.go create mode 100644 server/api/iot/v1/tsimupstreampackage.go create mode 100644 server/api/iot/v1/tsimwarningconfig.go create mode 100644 server/api/monitor/monitor.go create mode 100644 server/api/monitor/v1/cache.go create mode 100644 server/api/pay/pay.go create mode 100644 server/api/pay/v1/alipay.go create mode 100644 server/api/system/system.go create mode 100644 server/api/system/v1/auth.go create mode 100644 server/api/system/v1/captcha.go create mode 100644 server/api/system/v1/client.go create mode 100644 server/api/system/v1/config.go create mode 100644 server/api/system/v1/dept.go create mode 100644 server/api/system/v1/dict.go create mode 100644 server/api/system/v1/job.go create mode 100644 server/api/system/v1/logininfor.go create mode 100644 server/api/system/v1/menu.go create mode 100644 server/api/system/v1/notice.go create mode 100644 server/api/system/v1/online.go create mode 100644 server/api/system/v1/oper_log.go create mode 100644 server/api/system/v1/oss.go create mode 100644 server/api/system/v1/oss_config.go create mode 100644 server/api/system/v1/post.go create mode 100644 server/api/system/v1/qrcode.go create mode 100644 server/api/system/v1/role.go create mode 100644 server/api/system/v1/social.go create mode 100644 server/api/system/v1/sysnoticeuser.go create mode 100644 server/api/system/v1/tenant.go create mode 100644 server/api/system/v1/ttplatformsetting.go create mode 100644 server/api/system/v1/user.go create mode 100644 server/api/trade/trade.go create mode 100644 server/api/trade/v1/recharge.go create mode 100644 server/api/workerdiagnostic/v1/diagnostic.go create mode 100644 server/api/workerdiagnostic/workerdiagnostic.go create mode 100644 server/build/Dockerfile create mode 100644 server/build/build_config.yaml create mode 100644 server/config/config.yaml create mode 100644 server/config/config_default.yaml create mode 100644 server/go.mod create mode 100644 server/go.sum create mode 100644 server/hack/config.yaml create mode 100644 server/hack/hack-cli.mk create mode 100644 server/hack/hack.mk create mode 100644 server/internal/cmd/cmd.go create mode 100644 server/internal/cmd/global.go create mode 100644 server/internal/cmd/http.go create mode 100644 server/internal/cmd/initfuunc.go create mode 100644 server/internal/cmd/inithttp/inithttp.go create mode 100644 server/internal/cmd/monitor.go create mode 100644 server/internal/cmd/shutdown.go create mode 100644 server/internal/consts/batch.go create mode 100644 server/internal/consts/bcache.go create mode 100644 server/internal/consts/code.go create mode 100644 server/internal/consts/config.go create mode 100644 server/internal/consts/consts.go create mode 100644 server/internal/consts/db.go create mode 100644 server/internal/consts/event.go create mode 100644 server/internal/consts/http.go create mode 100644 server/internal/consts/mcache.go create mode 100644 server/internal/consts/package_duration.go create mode 100644 server/internal/consts/queue.go create mode 100644 server/internal/consts/sim_card_lifecycle.go create mode 100644 server/internal/consts/system.go create mode 100644 server/internal/consts/v3api.go create mode 100644 server/internal/consts/warning.go create mode 100644 server/internal/consts/websocket.go create mode 100644 server/internal/controller/agent/agent_dept.go create mode 100644 server/internal/controller/agent/agent_menu.go create mode 100644 server/internal/controller/agent/agent_new.go create mode 100644 server/internal/controller/agent/agent_role.go create mode 100644 server/internal/controller/agent/agent_user.go create mode 100644 server/internal/controller/agent/t_agent_enterprise.go create mode 100644 server/internal/controller/agent/t_api.go create mode 100644 server/internal/controller/agent/t_api_group.go create mode 100644 server/internal/controller/agent/t_api_resource.go create mode 100644 server/internal/controller/agent/t_cust_withdraw_account.go create mode 100644 server/internal/controller/common/common.go create mode 100644 server/internal/controller/common/common_new.go create mode 100644 server/internal/controller/common/common_v1_batchExecutionLog.go create mode 100644 server/internal/controller/common/common_v1_batchMain.go create mode 100644 server/internal/controller/common/common_v1_tagentbalance.go create mode 100644 server/internal/controller/common/common_v1_tbalancedetail.go create mode 100644 server/internal/controller/common/common_v1_tconsumeaccountmonth_bill.go create mode 100644 server/internal/controller/common/common_v1_tcreditdetail.go create mode 100644 server/internal/controller/common/common_v1_tfinanceapply.go create mode 100644 server/internal/controller/common/common_v1_tfinanceauditrecord.go create mode 100644 server/internal/controller/common/common_v1_tfincommissiondetail.go create mode 100644 server/internal/controller/common/common_v1_tfinwithdrawablechange.go create mode 100644 server/internal/controller/common/common_v1_tmessagelog.go create mode 100644 server/internal/controller/common/common_v1_tnotifylog.go create mode 100644 server/internal/controller/common/common_v1_tprofitaccountmonth_bill.go create mode 100644 server/internal/controller/common/common_v1_twocommunication.go create mode 100644 server/internal/controller/common/common_v1_twomain.go create mode 100644 server/internal/controller/common/common_v1_tworecord.go create mode 100644 server/internal/controller/common/common_v1_upload.go create mode 100644 server/internal/controller/common/t_division_code.go create mode 100644 server/internal/controller/gen/test_demo.go create mode 100644 server/internal/controller/gen/testdemo/testdemo.go create mode 100644 server/internal/controller/gen/testdemo/testdemo_new.go create mode 100644 server/internal/controller/gen/testdemo/testdemo_v1_testdemo.go create mode 100644 server/internal/controller/gen_codes/gen_codes.go create mode 100644 server/internal/controller/gen_codes/gen_codes_new.go create mode 100644 server/internal/controller/gen_codes/gen_codes_v1_gen_table.go create mode 100644 server/internal/controller/home/home.go create mode 100644 server/internal/controller/home/home_new.go create mode 100644 server/internal/controller/home/home_v1_home.go create mode 100644 server/internal/controller/iot/full_sync_monitor.go create mode 100644 server/internal/controller/iot/full_sync_monitor_channels_test.go create mode 100644 server/internal/controller/iot/full_sync_replay.go create mode 100644 server/internal/controller/iot/iot.go create mode 100644 server/internal/controller/iot/iot_new.go create mode 100644 server/internal/controller/iot/iot_v1_simwarningconfig.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_template.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_cut_input_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_template.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_start_input_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_template.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_data_stop_input_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_template.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_restart_input_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_start_excel_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_start_excel_template.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_start_input_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_submit.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_template.go create mode 100644 server/internal/controller/iot/iot_v1_t_sim_card_stop_input_submit.go create mode 100644 server/internal/controller/iot/iot_v1_tflowpackageconfig.go create mode 100644 server/internal/controller/iot/iot_v1_torder.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardallocate.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardbindpkg.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardcancel.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardcancellation.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardchange.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardoutbound.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardrenew.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardtrafficcutoff.go create mode 100644 server/internal/controller/iot/iot_v1_tsimcardunsub.go create mode 100644 server/internal/controller/iot/iot_v1_tsimflowpackageprice.go create mode 100644 server/internal/controller/iot/iot_v1_tsimpoolbindpackage.go create mode 100644 server/internal/controller/iot/t_order.go create mode 100644 server/internal/controller/iot/t_sim_card_inbound.go create mode 100644 server/internal/controller/iot/t_sim_card_info.go create mode 100644 server/internal/controller/iot/t_sim_card_status_queue.go create mode 100644 server/internal/controller/iot/t_sim_card_stock.go create mode 100644 server/internal/controller/iot/t_sim_channel_template.go create mode 100644 server/internal/controller/iot/t_sim_channels.go create mode 100644 server/internal/controller/iot/t_sim_diagnose.go create mode 100644 server/internal/controller/iot/t_sim_flow_package_info.go create mode 100644 server/internal/controller/iot/t_sim_flow_package_price.go create mode 100644 server/internal/controller/iot/t_sim_flow_pool.go create mode 100644 server/internal/controller/iot/t_sim_package_category.go create mode 100644 server/internal/controller/iot/t_sim_pool_warn_config.go create mode 100644 server/internal/controller/iot/t_sim_upstream_package.go create mode 100644 server/internal/controller/monitor/monitor.go create mode 100644 server/internal/controller/monitor/monitor_new.go create mode 100644 server/internal/controller/monitor/monitor_v1_cache.go create mode 100644 server/internal/controller/pay/pay.go create mode 100644 server/internal/controller/pay/pay_new.go create mode 100644 server/internal/controller/pay/pay_v1_alipay.go create mode 100644 server/internal/controller/simwarning/sim_warning_config.go create mode 100644 server/internal/controller/system/sys_notice_user.go create mode 100644 server/internal/controller/system/system.go create mode 100644 server/internal/controller/system/system_new.go create mode 100644 server/internal/controller/system/system_v1_auth.go create mode 100644 server/internal/controller/system/system_v1_captcha.go create mode 100644 server/internal/controller/system/system_v1_client.go create mode 100644 server/internal/controller/system/system_v1_config.go create mode 100644 server/internal/controller/system/system_v1_dept.go create mode 100644 server/internal/controller/system/system_v1_dict.go create mode 100644 server/internal/controller/system/system_v1_job.go create mode 100644 server/internal/controller/system/system_v1_logininfor.go create mode 100644 server/internal/controller/system/system_v1_menu.go create mode 100644 server/internal/controller/system/system_v1_notice.go create mode 100644 server/internal/controller/system/system_v1_online.go create mode 100644 server/internal/controller/system/system_v1_oper_log.go create mode 100644 server/internal/controller/system/system_v1_oss.go create mode 100644 server/internal/controller/system/system_v1_oss_config.go create mode 100644 server/internal/controller/system/system_v1_post.go create mode 100644 server/internal/controller/system/system_v1_qrcode.go create mode 100644 server/internal/controller/system/system_v1_role.go create mode 100644 server/internal/controller/system/system_v1_social.go create mode 100644 server/internal/controller/system/system_v1_tenant.go create mode 100644 server/internal/controller/system/system_v1_ttplatformsetting.go create mode 100644 server/internal/controller/system/system_v1_user.go create mode 100644 server/internal/controller/trade/trade.go create mode 100644 server/internal/controller/trade/trade_new.go create mode 100644 server/internal/controller/trade/trade_v1_recharge.go create mode 100644 server/internal/controller/workerdiagnostic/worker_diagnostic.go create mode 100644 server/internal/controller/workerdiagnostic/workerdiagnostic.go create mode 100644 server/internal/controller/workerdiagnostic/workerdiagnostic_new.go create mode 100644 server/internal/controller/workerdiagnostic/workerdiagnostic_v1_diagnostic.go create mode 100644 server/internal/dao/batch_detail.go create mode 100644 server/internal/dao/batch_main.go create mode 100644 server/internal/dao/internal/batch_detail.go create mode 100644 server/internal/dao/internal/batch_main.go create mode 100644 server/internal/dao/internal/sys_client.go create mode 100644 server/internal/dao/internal/sys_config.go create mode 100644 server/internal/dao/internal/sys_dept.go create mode 100644 server/internal/dao/internal/sys_dict_data.go create mode 100644 server/internal/dao/internal/sys_dict_type.go create mode 100644 server/internal/dao/internal/sys_gen_table.go create mode 100644 server/internal/dao/internal/sys_job.go create mode 100644 server/internal/dao/internal/sys_logininfor.go create mode 100644 server/internal/dao/internal/sys_menu.go create mode 100644 server/internal/dao/internal/sys_notice.go create mode 100644 server/internal/dao/internal/sys_notice_user.go create mode 100644 server/internal/dao/internal/sys_oper_log.go create mode 100644 server/internal/dao/internal/sys_oss.go create mode 100644 server/internal/dao/internal/sys_oss_config.go create mode 100644 server/internal/dao/internal/sys_post.go create mode 100644 server/internal/dao/internal/sys_role.go create mode 100644 server/internal/dao/internal/sys_role_dept.go create mode 100644 server/internal/dao/internal/sys_role_menu.go create mode 100644 server/internal/dao/internal/sys_social.go create mode 100644 server/internal/dao/internal/sys_tenant.go create mode 100644 server/internal/dao/internal/sys_tenant_package.go create mode 100644 server/internal/dao/internal/sys_user.go create mode 100644 server/internal/dao/internal/sys_user_online.go create mode 100644 server/internal/dao/internal/sys_user_post.go create mode 100644 server/internal/dao/internal/sys_user_role.go create mode 100644 server/internal/dao/internal/t_agent_balance.go create mode 100644 server/internal/dao/internal/t_agent_enterprise.go create mode 100644 server/internal/dao/internal/t_api.go create mode 100644 server/internal/dao/internal/t_api_group.go create mode 100644 server/internal/dao/internal/t_api_group_resource.go create mode 100644 server/internal/dao/internal/t_api_resource.go create mode 100644 server/internal/dao/internal/t_balance_detail.go create mode 100644 server/internal/dao/internal/t_consume_account_month_bill.go create mode 100644 server/internal/dao/internal/t_credit_detail.go create mode 100644 server/internal/dao/internal/t_cust_withdraw_account.go create mode 100644 server/internal/dao/internal/t_dept_flow_daily.go create mode 100644 server/internal/dao/internal/t_division_code.go create mode 100644 server/internal/dao/internal/t_fin_commission_detail.go create mode 100644 server/internal/dao/internal/t_fin_withdrawable_change.go create mode 100644 server/internal/dao/internal/t_finance_apply.go create mode 100644 server/internal/dao/internal/t_finance_audit_record.go create mode 100644 server/internal/dao/internal/t_flow_package_config.go create mode 100644 server/internal/dao/internal/t_message_log.go create mode 100644 server/internal/dao/internal/t_notify_log.go create mode 100644 server/internal/dao/internal/t_order.go create mode 100644 server/internal/dao/internal/t_order_item.go create mode 100644 server/internal/dao/internal/t_package_customer.go create mode 100644 server/internal/dao/internal/t_profit_account_month_bill.go create mode 100644 server/internal/dao/internal/t_resource_batch_download.go create mode 100644 server/internal/dao/internal/t_sim_bind_package_logs.go create mode 100644 server/internal/dao/internal/t_sim_card_bind_pkg.go create mode 100644 server/internal/dao/internal/t_sim_card_cancellation.go create mode 100644 server/internal/dao/internal/t_sim_card_info.go create mode 100644 server/internal/dao/internal/t_sim_card_stock.go create mode 100644 server/internal/dao/internal/t_sim_channel_template.go create mode 100644 server/internal/dao/internal/t_sim_channels.go create mode 100644 server/internal/dao/internal/t_sim_flow_package_info.go create mode 100644 server/internal/dao/internal/t_sim_flow_package_price.go create mode 100644 server/internal/dao/internal/t_sim_flow_pool.go create mode 100644 server/internal/dao/internal/t_sim_package_category.go create mode 100644 server/internal/dao/internal/t_sim_pool.go create mode 100644 server/internal/dao/internal/t_sim_pool_bind_package.go create mode 100644 server/internal/dao/internal/t_sim_pool_warn_config.go create mode 100644 server/internal/dao/internal/t_sim_upstream_package.go create mode 100644 server/internal/dao/internal/t_tplatform_setting.go create mode 100644 server/internal/dao/internal/t_user_message.go create mode 100644 server/internal/dao/internal/t_warn_config.go create mode 100644 server/internal/dao/internal/t_warn_log.go create mode 100644 server/internal/dao/internal/t_wo_audit.go create mode 100644 server/internal/dao/internal/t_wo_communication.go create mode 100644 server/internal/dao/internal/t_wo_main.go create mode 100644 server/internal/dao/internal/t_wo_record.go create mode 100644 server/internal/dao/internal/test_demo.go create mode 100644 server/internal/dao/sys_client.go create mode 100644 server/internal/dao/sys_config.go create mode 100644 server/internal/dao/sys_dept.go create mode 100644 server/internal/dao/sys_dict_data.go create mode 100644 server/internal/dao/sys_dict_type.go create mode 100644 server/internal/dao/sys_gen_table.go create mode 100644 server/internal/dao/sys_job.go create mode 100644 server/internal/dao/sys_logininfor.go create mode 100644 server/internal/dao/sys_menu.go create mode 100644 server/internal/dao/sys_notice.go create mode 100644 server/internal/dao/sys_notice_user.go create mode 100644 server/internal/dao/sys_oper_log.go create mode 100644 server/internal/dao/sys_oss.go create mode 100644 server/internal/dao/sys_oss_config.go create mode 100644 server/internal/dao/sys_post.go create mode 100644 server/internal/dao/sys_role.go create mode 100644 server/internal/dao/sys_role_dept.go create mode 100644 server/internal/dao/sys_role_menu.go create mode 100644 server/internal/dao/sys_social.go create mode 100644 server/internal/dao/sys_tenant.go create mode 100644 server/internal/dao/sys_tenant_package.go create mode 100644 server/internal/dao/sys_user.go create mode 100644 server/internal/dao/sys_user_online.go create mode 100644 server/internal/dao/sys_user_post.go create mode 100644 server/internal/dao/sys_user_role.go create mode 100644 server/internal/dao/t_agent_balance.go create mode 100644 server/internal/dao/t_agent_enterprise.go create mode 100644 server/internal/dao/t_api.go create mode 100644 server/internal/dao/t_api_group.go create mode 100644 server/internal/dao/t_api_group_resource.go create mode 100644 server/internal/dao/t_api_resource.go create mode 100644 server/internal/dao/t_balance_detail.go create mode 100644 server/internal/dao/t_consume_account_month_bill.go create mode 100644 server/internal/dao/t_credit_detail.go create mode 100644 server/internal/dao/t_cust_withdraw_account.go create mode 100644 server/internal/dao/t_dept_flow_daily.go create mode 100644 server/internal/dao/t_division_code.go create mode 100644 server/internal/dao/t_fin_commission_detail.go create mode 100644 server/internal/dao/t_fin_withdrawable_change.go create mode 100644 server/internal/dao/t_finance_apply.go create mode 100644 server/internal/dao/t_finance_audit_record.go create mode 100644 server/internal/dao/t_flow_package_config.go create mode 100644 server/internal/dao/t_message_log.go create mode 100644 server/internal/dao/t_notify_log.go create mode 100644 server/internal/dao/t_order.go create mode 100644 server/internal/dao/t_order_item.go create mode 100644 server/internal/dao/t_package_customer.go create mode 100644 server/internal/dao/t_profit_account_month_bill.go create mode 100644 server/internal/dao/t_resource_batch_download.go create mode 100644 server/internal/dao/t_sim_bind_package_logs.go create mode 100644 server/internal/dao/t_sim_card_bind_pkg.go create mode 100644 server/internal/dao/t_sim_card_cancellation.go create mode 100644 server/internal/dao/t_sim_card_info.go create mode 100644 server/internal/dao/t_sim_card_stock.go create mode 100644 server/internal/dao/t_sim_channel_template.go create mode 100644 server/internal/dao/t_sim_channels.go create mode 100644 server/internal/dao/t_sim_flow_package_info.go create mode 100644 server/internal/dao/t_sim_flow_package_price.go create mode 100644 server/internal/dao/t_sim_flow_pool.go create mode 100644 server/internal/dao/t_sim_package_category.go create mode 100644 server/internal/dao/t_sim_pool.go create mode 100644 server/internal/dao/t_sim_pool_bind_package.go create mode 100644 server/internal/dao/t_sim_pool_warn_config.go create mode 100644 server/internal/dao/t_sim_upstream_package.go create mode 100644 server/internal/dao/t_tplatform_setting.go create mode 100644 server/internal/dao/t_user_message.go create mode 100644 server/internal/dao/t_warn_config.go create mode 100644 server/internal/dao/t_warn_log.go create mode 100644 server/internal/dao/t_wo_audit.go create mode 100644 server/internal/dao/t_wo_communication.go create mode 100644 server/internal/dao/t_wo_main.go create mode 100644 server/internal/dao/t_wo_record.go create mode 100644 server/internal/dao/test_demo.go create mode 100644 server/internal/library/addons/addons.go create mode 100644 server/internal/library/allocationunits/units.go create mode 100644 server/internal/library/batchimport/async.go create mode 100644 server/internal/library/batchimport/batch_no.go create mode 100644 server/internal/library/batchimport/runner.go create mode 100644 server/internal/library/batchimport/types.go create mode 100644 server/internal/library/batchimport/upload.go create mode 100644 server/internal/library/batchinput/excel/csv.go create mode 100644 server/internal/library/batchinput/excel/parser.go create mode 100644 server/internal/library/batchinput/excel/row.go create mode 100644 server/internal/library/batchinput/excel/schema.go create mode 100644 server/internal/library/batchinput/excel/validator.go create mode 100644 server/internal/library/batchinput/excel/value.go create mode 100644 server/internal/library/batchinput/numrange/range.go create mode 100644 server/internal/library/batchinput/text/lines.go create mode 100644 server/internal/library/batchmetadata/metadata.go create mode 100644 server/internal/library/bcache/bcache.go create mode 100644 server/internal/library/bcache/bcache_system_auth.go create mode 100644 server/internal/library/bcache/mfa.go create mode 100644 server/internal/library/cache/cache.go create mode 100644 server/internal/library/cache/file/file.go create mode 100644 server/internal/library/contexts/contexts.go create mode 100644 server/internal/library/event/event.go create mode 100644 server/internal/library/mcache/mcache.go create mode 100644 server/internal/library/mcache/mcache_access_list.go create mode 100644 server/internal/library/mcache/mcache_system_config.go create mode 100644 server/internal/library/mcache/mcache_system_dept.go create mode 100644 server/internal/library/mcache/mcache_system_user.go create mode 100644 server/internal/library/rabbitmq/confirmed.go create mode 100644 server/internal/library/rabbitmq/rabbitmq.go create mode 100644 server/internal/library/rolepolicy/template.go create mode 100644 server/internal/library/rolesync/sync.go create mode 100644 server/internal/library/tdengine/tdengine.go create mode 100644 server/internal/library/utils/utils.go create mode 100644 server/internal/library/websocket/client.go create mode 100644 server/internal/library/websocket/client_manager.go create mode 100644 server/internal/library/websocket/controller.go create mode 100644 server/internal/library/websocket/init.go create mode 100644 server/internal/library/websocket/model.go create mode 100644 server/internal/library/websocket/router.go create mode 100644 server/internal/library/worker/options.go create mode 100644 server/internal/library/worker/work_proces.go create mode 100644 server/internal/library/worker/worker.go create mode 100644 server/internal/library/xgen/gen_consts/gen_codes.go create mode 100644 server/internal/library/xgen/gen_consts/gen_config.go create mode 100644 server/internal/library/xgen/gen_dao/gen_dao.go create mode 100644 server/internal/library/xgen/gen_model/gen_codes.go create mode 100644 server/internal/library/xgen/gen_model/gen_config.go create mode 100644 server/internal/library/xgen/gen_model/gen_view.go create mode 100644 server/internal/library/xgen/gen_view/gen_column.go create mode 100644 server/internal/library/xgen/gen_view/gen_column_default.go create mode 100644 server/internal/library/xgen/gen_view/gen_column_map.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_input.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_logic.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_model.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_web_edit.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_web_index.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_web_model.go create mode 100644 server/internal/library/xgen/gen_view/gen_curd_web_view.go create mode 100644 server/internal/library/xgen/gen_view/gen_util.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/consts.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/doc.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/element.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/formatter.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/html_document.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/parser.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/tag_element.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/text_element.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/utils.go create mode 100644 server/internal/library/xgen/gen_view/gohtml/writer.go create mode 100644 server/internal/library/xgen/xgen_curd.go create mode 100644 server/internal/library/xgen/xgen_init.go create mode 100644 server/internal/library/xgorm/dao.go create mode 100644 server/internal/library/xgorm/dao_tree.go create mode 100644 server/internal/library/xgorm/gorm_model/gorm_tree.go create mode 100644 server/internal/library/xgorm/handler/filter_auth.go create mode 100644 server/internal/library/xgorm/handler/force_cache.go create mode 100644 server/internal/library/xgorm/handler/handler.go create mode 100644 server/internal/library/xgorm/handler/tenant.go create mode 100644 server/internal/library/xgorm/hook/member.go create mode 100644 server/internal/logic/agent/agent_base.go create mode 100644 server/internal/logic/agent/agent_dept.go create mode 100644 server/internal/logic/agent/agent_dept_passrole_test.go create mode 100644 server/internal/logic/agent/agent_menu.go create mode 100644 server/internal/logic/agent/agent_role.go create mode 100644 server/internal/logic/agent/agent_role_queue.go create mode 100644 server/internal/logic/agent/agent_role_save_test.go create mode 100644 server/internal/logic/agent/agent_scope.go create mode 100644 server/internal/logic/agent/agent_template.go create mode 100644 server/internal/logic/agent/agent_user.go create mode 100644 server/internal/logic/agent/t_agent_enterprise.go create mode 100644 server/internal/logic/agent/t_api.go create mode 100644 server/internal/logic/agent/t_api_group.go create mode 100644 server/internal/logic/agent/t_api_resource.go create mode 100644 server/internal/logic/agent/t_cust_withdraw_account.go create mode 100644 server/internal/logic/cardflow/sql_expr.go create mode 100644 server/internal/logic/common/batch_execution_log.go create mode 100644 server/internal/logic/common/batch_main.go create mode 100644 server/internal/logic/common/batch_visibility.go create mode 100644 server/internal/logic/common/t_agent_balance.go create mode 100644 server/internal/logic/common/t_balance_detail.go create mode 100644 server/internal/logic/common/t_consume_account_month_bill.go create mode 100644 server/internal/logic/common/t_credit_detail.go create mode 100644 server/internal/logic/common/t_division_code.go create mode 100644 server/internal/logic/common/t_fin_commission_detail.go create mode 100644 server/internal/logic/common/t_fin_withdrawable_change.go create mode 100644 server/internal/logic/common/t_finance_apply.go create mode 100644 server/internal/logic/common/t_finance_audit_record.go create mode 100644 server/internal/logic/common/t_message_log.go create mode 100644 server/internal/logic/common/t_notify_log.go create mode 100644 server/internal/logic/common/t_profit_account_month_bill.go create mode 100644 server/internal/logic/common/t_wo_communication.go create mode 100644 server/internal/logic/common/t_wo_main.go create mode 100644 server/internal/logic/common/t_wo_record.go create mode 100644 server/internal/logic/common/work_order_notice.go create mode 100644 server/internal/logic/gen/test_demo.go create mode 100644 server/internal/logic/gen_codes/gen_selects.go create mode 100644 server/internal/logic/gen_codes/sys_gen_table.go create mode 100644 server/internal/logic/home/home.go create mode 100644 server/internal/logic/imei.go create mode 100644 server/internal/logic/imeiqueue/queue.go create mode 100644 server/internal/logic/iot/card_channel_assoc.go create mode 100644 server/internal/logic/iot/card_dept_display.go create mode 100644 server/internal/logic/iot/cardpackage/card_update.go create mode 100644 server/internal/logic/iot/cardpackage/renew.go create mode 100644 server/internal/logic/iot/cardpackage/repository.go create mode 100644 server/internal/logic/iot/cardpackage/subscribe.go create mode 100644 server/internal/logic/iot/cardpackage/terminate.go create mode 100644 server/internal/logic/iot/cardpackage/types.go create mode 100644 server/internal/logic/iot/package_price_effective.go create mode 100644 server/internal/logic/iot/packageduration/policy.go create mode 100644 server/internal/logic/iot/packageprice/effective.go create mode 100644 server/internal/logic/iot/sim_status_queue.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/async.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/prepare.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/prepare_processor.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/addpackage/types.go create mode 100644 server/internal/logic/iot/simcardbatch/allocate/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/allocate/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/allocate/splitter.go create mode 100644 server/internal/logic/iot/simcardbatch/allocate/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/allocate/types.go create mode 100644 server/internal/logic/iot/simcardbatch/cancel/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/cancel/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/cancel/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/cancel/types.go create mode 100644 server/internal/logic/iot/simcardbatch/change/async.go create mode 100644 server/internal/logic/iot/simcardbatch/change/complete.go create mode 100644 server/internal/logic/iot/simcardbatch/change/excel_processor.go create mode 100644 server/internal/logic/iot/simcardbatch/change/input.go create mode 100644 server/internal/logic/iot/simcardbatch/change/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/change/prepare_processor.go create mode 100644 server/internal/logic/iot/simcardbatch/change/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/change/range.go create mode 100644 server/internal/logic/iot/simcardbatch/change/repository.go create mode 100644 server/internal/logic/iot/simcardbatch/change/types.go create mode 100644 server/internal/logic/iot/simcardbatch/change/utils.go create mode 100644 server/internal/logic/iot/simcardbatch/common/batch.go create mode 100644 server/internal/logic/iot/simcardbatch/common/cardsource/input.go create mode 100644 server/internal/logic/iot/simcardbatch/common/cardsource/range.go create mode 100644 server/internal/logic/iot/simcardbatch/datacut/errors.go create mode 100644 server/internal/logic/iot/simcardbatch/datacut/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/datacut/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/datacut/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/datacut/types.go create mode 100644 server/internal/logic/iot/simcardbatch/datacut/utils.go create mode 100644 server/internal/logic/iot/simcardbatch/dataswitch/errors.go create mode 100644 server/internal/logic/iot/simcardbatch/dataswitch/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/dataswitch/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/dataswitch/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/dataswitch/types.go create mode 100644 server/internal/logic/iot/simcardbatch/dataswitch/utils.go create mode 100644 server/internal/logic/iot/simcardbatch/inbound/excel_schema.go create mode 100644 server/internal/logic/iot/simcardbatch/inbound/pending.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/dispatcher.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/executor.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/operation.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/repository.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/lifecycle/types.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/async.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/complete.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/input.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/preview.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/queue.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/range.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/repository.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/types.go create mode 100644 server/internal/logic/iot/simcardbatch/outbound/utils.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/async.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/complete.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/excel_processor.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/identity.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/input.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/payment.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/prepare_processor.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/repository.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/types.go create mode 100644 server/internal/logic/iot/simcardbatch/renew/utils.go create mode 100644 server/internal/logic/iot/simcardbatch/trafficcutoffconfig/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/trafficcutoffconfig/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/trafficcutoffconfig/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/trafficcutoffconfig/types.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/input.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/pending.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/range.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/repository.go create mode 100644 server/internal/logic/iot/simcardbatch/unsub/types.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/email_code.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/input.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/parser.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/processor.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/range.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/schema.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/submitter.go create mode 100644 server/internal/logic/iot/simcardbatch/warningconfig/types.go create mode 100644 server/internal/logic/iot/stock_business_fields.go create mode 100644 server/internal/logic/iot/t_add_package_async.go create mode 100644 server/internal/logic/iot/t_flow_package_config.go create mode 100644 server/internal/logic/iot/t_order.go create mode 100644 server/internal/logic/iot/t_sim_card_allocate.go create mode 100644 server/internal/logic/iot/t_sim_card_bind_pkg.go create mode 100644 server/internal/logic/iot/t_sim_card_cancel.go create mode 100644 server/internal/logic/iot/t_sim_card_cancellation.go create mode 100644 server/internal/logic/iot/t_sim_card_change.go create mode 100644 server/internal/logic/iot/t_sim_card_data_cut.go create mode 100644 server/internal/logic/iot/t_sim_card_data_switch.go create mode 100644 server/internal/logic/iot/t_sim_card_inbound.go create mode 100644 server/internal/logic/iot/t_sim_card_info.go create mode 100644 server/internal/logic/iot/t_sim_card_info_test.go create mode 100644 server/internal/logic/iot/t_sim_card_outbound.go create mode 100644 server/internal/logic/iot/t_sim_card_renew.go create mode 100644 server/internal/logic/iot/t_sim_card_renew_excel.go create mode 100644 server/internal/logic/iot/t_sim_card_renew_payment.go create mode 100644 server/internal/logic/iot/t_sim_card_renew_price_test.go create mode 100644 server/internal/logic/iot/t_sim_card_restart.go create mode 100644 server/internal/logic/iot/t_sim_card_start.go create mode 100644 server/internal/logic/iot/t_sim_card_stock.go create mode 100644 server/internal/logic/iot/t_sim_card_stop.go create mode 100644 server/internal/logic/iot/t_sim_card_traffic_cutoff.go create mode 100644 server/internal/logic/iot/t_sim_card_unsub.go create mode 100644 server/internal/logic/iot/t_sim_channel_template.go create mode 100644 server/internal/logic/iot/t_sim_channels.go create mode 100644 server/internal/logic/iot/t_sim_diagnose.go create mode 100644 server/internal/logic/iot/t_sim_diagnose_legacy.go create mode 100644 server/internal/logic/iot/t_sim_diagnose_network_block.go create mode 100644 server/internal/logic/iot/t_sim_flow_package_info.go create mode 100644 server/internal/logic/iot/t_sim_flow_package_price.go create mode 100644 server/internal/logic/iot/t_sim_flow_pool.go create mode 100644 server/internal/logic/iot/t_sim_package_category.go create mode 100644 server/internal/logic/iot/t_sim_pool_bind_package.go create mode 100644 server/internal/logic/iot/t_sim_pool_warn_config.go create mode 100644 server/internal/logic/iot/t_sim_upstream_package.go create mode 100644 server/internal/logic/iot/t_sim_warning_config.go create mode 100644 server/internal/logic/logic.go create mode 100644 server/internal/logic/memorydb/memorydb.go create mode 100644 server/internal/logic/memorydb/memorydb_test.go create mode 100644 server/internal/logic/memorydb/sys_config.go create mode 100644 server/internal/logic/memorydb/sys_dept.go create mode 100644 server/internal/logic/memorydb/sys_dict_data.go create mode 100644 server/internal/logic/memorydb/sys_dict_type.go create mode 100644 server/internal/logic/memorydb/sys_menu.go create mode 100644 server/internal/logic/memorydb/sys_post.go create mode 100644 server/internal/logic/memorydb/sys_role.go create mode 100644 server/internal/logic/memorydb/sys_tenant.go create mode 100644 server/internal/logic/middleware/middleware.go create mode 100644 server/internal/logic/monitor/monitor_server.go create mode 100644 server/internal/logic/packagecustomer/publisher.go create mode 100644 server/internal/logic/packagecustomer/sync.go create mode 100644 server/internal/logic/packagelifecycle/package_lifecycle.go create mode 100644 server/internal/logic/pay/alipay.go create mode 100644 server/internal/logic/simstatusqueue/queue.go create mode 100644 server/internal/logic/simwarning/auto_action.go create mode 100644 server/internal/logic/simwarning/config.go create mode 100644 server/internal/logic/simwarning/dedupe.go create mode 100644 server/internal/logic/simwarning/expire_candidate.go create mode 100644 server/internal/logic/simwarning/expire_config.go create mode 100644 server/internal/logic/simwarning/log_writer.go create mode 100644 server/internal/logic/simwarning/notify.go create mode 100644 server/internal/logic/simwarning/rules.go create mode 100644 server/internal/logic/simwarning/scanner.go create mode 100644 server/internal/logic/simwarning/types.go create mode 100644 server/internal/logic/simwarning/warn_type.go create mode 100644 server/internal/logic/smsgateway/smsgateway.go create mode 100644 server/internal/logic/system/sys_auth.go create mode 100644 server/internal/logic/system/sys_captcha.go create mode 100644 server/internal/logic/system/sys_client.go create mode 100644 server/internal/logic/system/sys_config.go create mode 100644 server/internal/logic/system/sys_dept.go create mode 100644 server/internal/logic/system/sys_dict_data.go create mode 100644 server/internal/logic/system/sys_dict_type.go create mode 100644 server/internal/logic/system/sys_job.go create mode 100644 server/internal/logic/system/sys_logininfor.go create mode 100644 server/internal/logic/system/sys_menu.go create mode 100644 server/internal/logic/system/sys_menu_document_center_test.go create mode 100644 server/internal/logic/system/sys_notice.go create mode 100644 server/internal/logic/system/sys_notice_user.go create mode 100644 server/internal/logic/system/sys_oper_log.go create mode 100644 server/internal/logic/system/sys_oss.go create mode 100644 server/internal/logic/system/sys_oss_config.go create mode 100644 server/internal/logic/system/sys_post.go create mode 100644 server/internal/logic/system/sys_qrcode.go create mode 100644 server/internal/logic/system/sys_qrcode_timeout_test.go create mode 100644 server/internal/logic/system/sys_role.go create mode 100644 server/internal/logic/system/sys_social.go create mode 100644 server/internal/logic/system/sys_tenant.go create mode 100644 server/internal/logic/system/sys_tenant_package.go create mode 100644 server/internal/logic/system/sys_user.go create mode 100644 server/internal/logic/system/sys_user_online.go create mode 100644 server/internal/logic/system/t_tplatform_setting.go create mode 100644 server/internal/logic/trade/trade.go create mode 100644 server/internal/logic/trafficcutoff/batch.go create mode 100644 server/internal/logic/trafficcutoff/dedupe.go create mode 100644 server/internal/logic/trafficcutoff/notify.go create mode 100644 server/internal/logic/trafficcutoff/scanner.go create mode 100644 server/internal/logic/trafficcutoff/types.go create mode 100644 server/internal/logic/trafficcutoff/types_test.go create mode 100644 server/internal/logic/trafficusage/history_sync.go create mode 100644 server/internal/logic/trafficusage/history_sync_test.go create mode 100644 server/internal/logic/trafficusage/traffic_usage.go create mode 100644 server/internal/logic/trafficusage/traffic_usage_card_query.go create mode 100644 server/internal/logic/trafficusage/traffic_usage_daily.go create mode 100644 server/internal/logic/trafficusage/traffic_usage_monthly.go create mode 100644 server/internal/logic/trafficusage/traffic_usage_pool.go create mode 100644 server/internal/logic/upstream/diagnosis_response.go create mode 100644 server/internal/logic/upstream/sim_data_diagnosis.go create mode 100644 server/internal/logic/upstream/upstream_chan.go create mode 100644 server/internal/logic/warningnotify/aggregate.go create mode 100644 server/internal/logic/warningnotify/content.go create mode 100644 server/internal/logic/warningnotify/email_sender.go create mode 100644 server/internal/logic/warningnotify/message_center_sender.go create mode 100644 server/internal/logic/warningnotify/sender.go create mode 100644 server/internal/logic/warningnotify/sms_sender.go create mode 100644 server/internal/logic/warningnotify/smspb/common.pb.go create mode 100644 server/internal/logic/warningnotify/smspb/notice.pb.go create mode 100644 server/internal/logic/warningnotify/smspb/notice_grpc.pb.go create mode 100644 server/internal/logic/warningnotify/types.go create mode 100644 server/internal/logic/warningnotify/wechat_sender.go create mode 100644 server/internal/model/agent_dept.go create mode 100644 server/internal/model/agent_role.go create mode 100644 server/internal/model/agent_user.go create mode 100644 server/internal/model/alipay.go create mode 100644 server/internal/model/batch_detail_list.go create mode 100644 server/internal/model/batch_execution_log.go create mode 100644 server/internal/model/batch_main.go create mode 100644 server/internal/model/bcache_model.go create mode 100644 server/internal/model/channel_refresh.go create mode 100644 server/internal/model/context.go create mode 100644 server/internal/model/do/batch_detail.go create mode 100644 server/internal/model/do/batch_main.go create mode 100644 server/internal/model/do/sys_client.go create mode 100644 server/internal/model/do/sys_config.go create mode 100644 server/internal/model/do/sys_dept.go create mode 100644 server/internal/model/do/sys_dict_data.go create mode 100644 server/internal/model/do/sys_dict_type.go create mode 100644 server/internal/model/do/sys_gen_table.go create mode 100644 server/internal/model/do/sys_job.go create mode 100644 server/internal/model/do/sys_logininfor.go create mode 100644 server/internal/model/do/sys_menu.go create mode 100644 server/internal/model/do/sys_notice.go create mode 100644 server/internal/model/do/sys_notice_user.go create mode 100644 server/internal/model/do/sys_oper_log.go create mode 100644 server/internal/model/do/sys_oss.go create mode 100644 server/internal/model/do/sys_oss_config.go create mode 100644 server/internal/model/do/sys_post.go create mode 100644 server/internal/model/do/sys_role.go create mode 100644 server/internal/model/do/sys_role_dept.go create mode 100644 server/internal/model/do/sys_role_menu.go create mode 100644 server/internal/model/do/sys_social.go create mode 100644 server/internal/model/do/sys_tenant.go create mode 100644 server/internal/model/do/sys_tenant_package.go create mode 100644 server/internal/model/do/sys_user.go create mode 100644 server/internal/model/do/sys_user_online.go create mode 100644 server/internal/model/do/sys_user_post.go create mode 100644 server/internal/model/do/sys_user_role.go create mode 100644 server/internal/model/do/t_agent_balance.go create mode 100644 server/internal/model/do/t_agent_enterprise.go create mode 100644 server/internal/model/do/t_api.go create mode 100644 server/internal/model/do/t_api_group.go create mode 100644 server/internal/model/do/t_api_group_resource.go create mode 100644 server/internal/model/do/t_api_resource.go create mode 100644 server/internal/model/do/t_balance_detail.go create mode 100644 server/internal/model/do/t_consume_account_month_bill.go create mode 100644 server/internal/model/do/t_credit_detail.go create mode 100644 server/internal/model/do/t_cust_withdraw_account.go create mode 100644 server/internal/model/do/t_dept_flow_daily.go create mode 100644 server/internal/model/do/t_division_code.go create mode 100644 server/internal/model/do/t_fin_commission_detail.go create mode 100644 server/internal/model/do/t_fin_withdrawable_change.go create mode 100644 server/internal/model/do/t_finance_apply.go create mode 100644 server/internal/model/do/t_finance_audit_record.go create mode 100644 server/internal/model/do/t_flow_package_config.go create mode 100644 server/internal/model/do/t_message_log.go create mode 100644 server/internal/model/do/t_notify_log.go create mode 100644 server/internal/model/do/t_order.go create mode 100644 server/internal/model/do/t_order_item.go create mode 100644 server/internal/model/do/t_package_customer.go create mode 100644 server/internal/model/do/t_profit_account_month_bill.go create mode 100644 server/internal/model/do/t_resource_batch_download.go create mode 100644 server/internal/model/do/t_sim_bind_package_logs.go create mode 100644 server/internal/model/do/t_sim_card_bind_pkg.go create mode 100644 server/internal/model/do/t_sim_card_cancellation.go create mode 100644 server/internal/model/do/t_sim_card_info.go create mode 100644 server/internal/model/do/t_sim_card_stock.go create mode 100644 server/internal/model/do/t_sim_card_traffic_cutoff_extension.go create mode 100644 server/internal/model/do/t_sim_channel_template.go create mode 100644 server/internal/model/do/t_sim_channels.go create mode 100644 server/internal/model/do/t_sim_flow_package_info.go create mode 100644 server/internal/model/do/t_sim_flow_package_price.go create mode 100644 server/internal/model/do/t_sim_flow_pool.go create mode 100644 server/internal/model/do/t_sim_package_category.go create mode 100644 server/internal/model/do/t_sim_pool_bind_package.go create mode 100644 server/internal/model/do/t_sim_pool_warn_config.go create mode 100644 server/internal/model/do/t_sim_upstream_package.go create mode 100644 server/internal/model/do/t_tplatform_setting.go create mode 100644 server/internal/model/do/t_user_message.go create mode 100644 server/internal/model/do/t_warn_config.go create mode 100644 server/internal/model/do/t_warn_log.go create mode 100644 server/internal/model/do/t_wo_audit.go create mode 100644 server/internal/model/do/t_wo_communication.go create mode 100644 server/internal/model/do/t_wo_main.go create mode 100644 server/internal/model/do/t_wo_record.go create mode 100644 server/internal/model/do/test_demo.go create mode 100644 server/internal/model/entity/batch_detail.go create mode 100644 server/internal/model/entity/batch_main.go create mode 100644 server/internal/model/entity/sys_client.go create mode 100644 server/internal/model/entity/sys_config.go create mode 100644 server/internal/model/entity/sys_dept.go create mode 100644 server/internal/model/entity/sys_dict_data.go create mode 100644 server/internal/model/entity/sys_dict_type.go create mode 100644 server/internal/model/entity/sys_gen_table.go create mode 100644 server/internal/model/entity/sys_job.go create mode 100644 server/internal/model/entity/sys_logininfor.go create mode 100644 server/internal/model/entity/sys_menu.go create mode 100644 server/internal/model/entity/sys_notice.go create mode 100644 server/internal/model/entity/sys_notice_user.go create mode 100644 server/internal/model/entity/sys_oper_log.go create mode 100644 server/internal/model/entity/sys_oss.go create mode 100644 server/internal/model/entity/sys_oss_config.go create mode 100644 server/internal/model/entity/sys_post.go create mode 100644 server/internal/model/entity/sys_role.go create mode 100644 server/internal/model/entity/sys_role_dept.go create mode 100644 server/internal/model/entity/sys_role_menu.go create mode 100644 server/internal/model/entity/sys_social.go create mode 100644 server/internal/model/entity/sys_tenant.go create mode 100644 server/internal/model/entity/sys_tenant_package.go create mode 100644 server/internal/model/entity/sys_user.go create mode 100644 server/internal/model/entity/sys_user_online.go create mode 100644 server/internal/model/entity/sys_user_post.go create mode 100644 server/internal/model/entity/sys_user_role.go create mode 100644 server/internal/model/entity/t_agent_balance.go create mode 100644 server/internal/model/entity/t_agent_enterprise.go create mode 100644 server/internal/model/entity/t_api.go create mode 100644 server/internal/model/entity/t_api_group.go create mode 100644 server/internal/model/entity/t_api_group_resource.go create mode 100644 server/internal/model/entity/t_api_resource.go create mode 100644 server/internal/model/entity/t_balance_detail.go create mode 100644 server/internal/model/entity/t_consume_account_month_bill.go create mode 100644 server/internal/model/entity/t_credit_detail.go create mode 100644 server/internal/model/entity/t_cust_withdraw_account.go create mode 100644 server/internal/model/entity/t_dept_flow_daily.go create mode 100644 server/internal/model/entity/t_division_code.go create mode 100644 server/internal/model/entity/t_fin_commission_detail.go create mode 100644 server/internal/model/entity/t_fin_withdrawable_change.go create mode 100644 server/internal/model/entity/t_finance_apply.go create mode 100644 server/internal/model/entity/t_finance_audit_record.go create mode 100644 server/internal/model/entity/t_flow_package_config.go create mode 100644 server/internal/model/entity/t_message_log.go create mode 100644 server/internal/model/entity/t_notify_log.go create mode 100644 server/internal/model/entity/t_order.go create mode 100644 server/internal/model/entity/t_order_item.go create mode 100644 server/internal/model/entity/t_package_customer.go create mode 100644 server/internal/model/entity/t_profit_account_month_bill.go create mode 100644 server/internal/model/entity/t_resource_batch_download.go create mode 100644 server/internal/model/entity/t_sim_bind_package_logs.go create mode 100644 server/internal/model/entity/t_sim_card_bind_pkg.go create mode 100644 server/internal/model/entity/t_sim_card_cancellation.go create mode 100644 server/internal/model/entity/t_sim_card_info.go create mode 100644 server/internal/model/entity/t_sim_card_stock.go create mode 100644 server/internal/model/entity/t_sim_channel_template.go create mode 100644 server/internal/model/entity/t_sim_channels.go create mode 100644 server/internal/model/entity/t_sim_flow_package_info.go create mode 100644 server/internal/model/entity/t_sim_flow_package_price.go create mode 100644 server/internal/model/entity/t_sim_flow_pool.go create mode 100644 server/internal/model/entity/t_sim_package_category.go create mode 100644 server/internal/model/entity/t_sim_pool_bind_package.go create mode 100644 server/internal/model/entity/t_sim_pool_warn_config.go create mode 100644 server/internal/model/entity/t_sim_upstream_package.go create mode 100644 server/internal/model/entity/t_tplatform_setting.go create mode 100644 server/internal/model/entity/t_user_message.go create mode 100644 server/internal/model/entity/t_warn_config.go create mode 100644 server/internal/model/entity/t_warn_log.go create mode 100644 server/internal/model/entity/t_wo_audit.go create mode 100644 server/internal/model/entity/t_wo_communication.go create mode 100644 server/internal/model/entity/t_wo_main.go create mode 100644 server/internal/model/entity/t_wo_record.go create mode 100644 server/internal/model/entity/test_demo.go create mode 100644 server/internal/model/genin/test_demo.go create mode 100644 server/internal/model/home.go create mode 100644 server/internal/model/imei_sync.go create mode 100644 server/internal/model/monitor_server.go create mode 100644 server/internal/model/mybytes.go create mode 100644 server/internal/model/package_customer_sync.go create mode 100644 server/internal/model/qrcode.go create mode 100644 server/internal/model/request/common.go create mode 100644 server/internal/model/response/common.go create mode 100644 server/internal/model/sim_diag.go create mode 100644 server/internal/model/sim_status_sync.go create mode 100644 server/internal/model/sim_warning_config.go create mode 100644 server/internal/model/sync_scope.go create mode 100644 server/internal/model/sync_scope_test.go create mode 100644 server/internal/model/sys_auth.go create mode 100644 server/internal/model/sys_client.go create mode 100644 server/internal/model/sys_config.go create mode 100644 server/internal/model/sys_dept.go create mode 100644 server/internal/model/sys_dict.go create mode 100644 server/internal/model/sys_gen_table.go create mode 100644 server/internal/model/sys_job.go create mode 100644 server/internal/model/sys_logininfor.go create mode 100644 server/internal/model/sys_menu.go create mode 100644 server/internal/model/sys_notice.go create mode 100644 server/internal/model/sys_notice_user.go create mode 100644 server/internal/model/sys_oper_log.go create mode 100644 server/internal/model/sys_oss.go create mode 100644 server/internal/model/sys_oss_config.go create mode 100644 server/internal/model/sys_post.go create mode 100644 server/internal/model/sys_role.go create mode 100644 server/internal/model/sys_social.go create mode 100644 server/internal/model/sys_tenant.go create mode 100644 server/internal/model/sys_tenant_package.go create mode 100644 server/internal/model/sys_user.go create mode 100644 server/internal/model/sys_user_online.go create mode 100644 server/internal/model/t_agent_balance.go create mode 100644 server/internal/model/t_agent_enterprise.go create mode 100644 server/internal/model/t_api.go create mode 100644 server/internal/model/t_api_group.go create mode 100644 server/internal/model/t_api_resource.go create mode 100644 server/internal/model/t_balance_detail.go create mode 100644 server/internal/model/t_consume_account_month_bill.go create mode 100644 server/internal/model/t_credit_detail.go create mode 100644 server/internal/model/t_cust_withdraw_account.go create mode 100644 server/internal/model/t_division_code.go create mode 100644 server/internal/model/t_fin_commission_detail.go create mode 100644 server/internal/model/t_fin_withdrawable_change.go create mode 100644 server/internal/model/t_finance_apply.go create mode 100644 server/internal/model/t_finance_audit_record.go create mode 100644 server/internal/model/t_flow_package_config.go create mode 100644 server/internal/model/t_message_log.go create mode 100644 server/internal/model/t_notify_log.go create mode 100644 server/internal/model/t_order.go create mode 100644 server/internal/model/t_profit_account_month_bill.go create mode 100644 server/internal/model/t_sim_card_allocate.go create mode 100644 server/internal/model/t_sim_card_bind_pkg.go create mode 100644 server/internal/model/t_sim_card_bind_pkg_addpackage.go create mode 100644 server/internal/model/t_sim_card_cancellation.go create mode 100644 server/internal/model/t_sim_card_change.go create mode 100644 server/internal/model/t_sim_card_inbound.go create mode 100644 server/internal/model/t_sim_card_info.go create mode 100644 server/internal/model/t_sim_card_lifecycle.go create mode 100644 server/internal/model/t_sim_card_outbound.go create mode 100644 server/internal/model/t_sim_card_renew.go create mode 100644 server/internal/model/t_sim_card_stock.go create mode 100644 server/internal/model/t_sim_card_traffic_cutoff.go create mode 100644 server/internal/model/t_sim_card_unsub.go create mode 100644 server/internal/model/t_sim_channel_template.go create mode 100644 server/internal/model/t_sim_channel_testing.go create mode 100644 server/internal/model/t_sim_channels.go create mode 100644 server/internal/model/t_sim_diagnose.go create mode 100644 server/internal/model/t_sim_flow_package_info.go create mode 100644 server/internal/model/t_sim_flow_package_info_options.go create mode 100644 server/internal/model/t_sim_flow_package_price.go create mode 100644 server/internal/model/t_sim_flow_pool.go create mode 100644 server/internal/model/t_sim_package_category.go create mode 100644 server/internal/model/t_sim_pool_bind_package.go create mode 100644 server/internal/model/t_sim_pool_bind_package_addpackage.go create mode 100644 server/internal/model/t_sim_pool_warn_config.go create mode 100644 server/internal/model/t_sim_warning_config.go create mode 100644 server/internal/model/t_tplatform_setting.go create mode 100644 server/internal/model/t_upstream_package.go create mode 100644 server/internal/model/t_wo_communication.go create mode 100644 server/internal/model/t_wo_main.go create mode 100644 server/internal/model/t_wo_record.go create mode 100644 server/internal/model/traffic_usage.go create mode 100644 server/internal/model/traffic_usage_sync.go create mode 100644 server/internal/model/upstream_chan.go create mode 100644 server/internal/model/work_order_queue.go create mode 100644 server/internal/model/worker_diagnostic.go create mode 100644 server/internal/packed/packed.go create mode 100644 server/internal/packed/response/response.go create mode 100644 server/internal/queues/base.go create mode 100644 server/internal/queues/httpqueues/broadcast_db_chg_queue.go create mode 100644 server/internal/queues/httpqueues/sys_opt_log_queue.go create mode 100644 server/internal/router/agent.go create mode 100644 server/internal/router/common.go create mode 100644 server/internal/router/gen.go create mode 100644 server/internal/router/gen_codes.go create mode 100644 server/internal/router/genrouter/init.go create mode 100644 server/internal/router/genrouter/test_demo.go create mode 100644 server/internal/router/home.go create mode 100644 server/internal/router/iot.go create mode 100644 server/internal/router/monitor.go create mode 100644 server/internal/router/pay.go create mode 100644 server/internal/router/router.go create mode 100644 server/internal/router/system.go create mode 100644 server/internal/router/trade.go create mode 100644 server/internal/service/agent.go create mode 100644 server/internal/service/common.go create mode 100644 server/internal/service/fullsyncretry/client.go create mode 100644 server/internal/service/gen.go create mode 100644 server/internal/service/gen_codes.go create mode 100644 server/internal/service/home.go create mode 100644 server/internal/service/imeiqueue.go create mode 100644 server/internal/service/iot.go create mode 100644 server/internal/service/memorydb.go create mode 100644 server/internal/service/middleware.go create mode 100644 server/internal/service/monitor.go create mode 100644 server/internal/service/packagecustomer.go create mode 100644 server/internal/service/packagelifecycle.go create mode 100644 server/internal/service/pay.go create mode 100644 server/internal/service/simstatus_queue.go create mode 100644 server/internal/service/simwarning.go create mode 100644 server/internal/service/system.go create mode 100644 server/internal/service/trade.go create mode 100644 server/internal/service/trafficcutoff.go create mode 100644 server/internal/service/trafficusage.go create mode 100644 server/internal/service/upstream.go create mode 100644 server/internal/service/warningnotify.go create mode 100644 server/internal/service/workerdiagnostic/worker_diagnostic.go create mode 100644 server/internal/tasks/account_month_bill.go create mode 100644 server/internal/tasks/base.go create mode 100644 server/internal/tasks/clear_data.go create mode 100644 server/internal/tasks/flow_pool.go create mode 100644 server/internal/tasks/imei_queue.go create mode 100644 server/internal/tasks/job_lock.go create mode 100644 server/internal/tasks/package_lifecycle.go create mode 100644 server/internal/tasks/sim_status_queue.go create mode 100644 server/internal/tasks/sim_warning.go create mode 100644 server/internal/tasks/task_log.go create mode 100644 server/internal/tasks/tasks.go create mode 100644 server/internal/tasks/traffic_cutoff.go create mode 100644 server/internal/tasks/traffic_pool_usage.go create mode 100644 server/internal/tasks/traffic_usage_daily.go create mode 100644 server/internal/tasks/traffic_usage_monthly.go create mode 100644 server/main.go create mode 100644 server/resource/generate/default/curd/api.go.template create mode 100644 server/resource/generate/default/curd/controller.go.template create mode 100644 server/resource/generate/default/curd/input.go.template create mode 100644 server/resource/generate/default/curd/logic.go.template create mode 100644 server/resource/generate/default/curd/router.go.template create mode 100644 server/resource/generate/default/curd/source.sql.template create mode 100644 server/resource/generate/default/curd/web.api.ts.template create mode 100644 server/resource/generate/default/curd/web.edit.vue.template create mode 100644 server/resource/generate/default/curd/web.index.vue.template create mode 100644 server/resource/generate/default/curd/web.model.ts.template create mode 100644 server/resource/generate/default/curd/web.view.vue.template create mode 100644 server/resource/migrations/20260920_card_channel_assoc_chan_key.sql create mode 100644 server/resource/migrations/20260920_traffic_cutoff_cross_month_hold.sql create mode 100644 server/resource/migrations/20260921_agent_role_source.sql create mode 100644 server/resource/migrations/20260922_agent_role_source_repair.sql create mode 100644 server/resource/migrations/20260922_traffic_cutoff_scan_indexes.sql create mode 100644 server/resource/migrations/20260923_batch_source_type_scheduled.sql create mode 100644 server/resource/migrations/20261009_batch_execution_metadata.sql create mode 100644 server/resource/public/public.txt create mode 100644 server/resource/upload/000000/user/file/20260803/sim-warning-config/import/SWC20260803113132HEFV8YD6-import.xlsx create mode 100644 server/resource/upload/2025-03-14/d8fqgc4iypz4hjdjh4.png create mode 100644 server/storage/data/full_sync_monitor_menu.sql create mode 100644 server/storage/data/xiu_admin.sql create mode 100644 server/utility/convert/convert.go create mode 100644 server/utility/excel/excel.go create mode 100644 server/utility/external_request.go create mode 100644 server/utility/external_request_test.go create mode 100644 server/utility/gfredis/conn.go create mode 100644 server/utility/gfredis/gfredis.go create mode 100644 server/utility/gfredis/hash.go create mode 100644 server/utility/gfredis/key.go create mode 100644 server/utility/gfredis/list.go create mode 100644 server/utility/gfredis/string.go create mode 100644 server/utility/gfredis/subpub.go create mode 100644 server/utility/gfredis/zset.go create mode 100644 server/utility/hash/crc16.go create mode 100644 server/utility/hash/sum16.go create mode 100644 server/utility/iot_excelize/batch_result.go create mode 100644 server/utility/iot_excelize/export_builder.go create mode 100644 server/utility/iot_excelize/import_reader.go create mode 100644 server/utility/iot_excelize/local_storage.go create mode 100644 server/utility/iot_excelize/schema.go create mode 100644 server/utility/iot_excelize/style.go create mode 100644 server/utility/iot_excelize/types.go create mode 100644 server/utility/iot_excelize/writer.go create mode 100644 server/utility/ip_lookup.go create mode 100644 server/utility/ip_lookup_test.go create mode 100644 server/utility/queue/memory_queue.go create mode 100644 server/utility/queue/queue.go create mode 100644 server/utility/queue/redis_broadcast.go create mode 100644 server/utility/queue/redis_queue.go create mode 100644 server/utility/tree/tree.go create mode 100644 server/utility/utility.go create mode 100644 server/utility/uuid32/uuid32.go create mode 100644 server/utility/version/version.go diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..33f3c22 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# 统一使用 LF,避免跨平台协作时产生整文件 diff +* text=auto eol=lf + +# 二进制文件不做行尾转换 +*.png binary +*.jpg binary +*.gif binary +*.ico binary +*.woff binary +*.woff2 binary +*.ttf binary +*.pdf binary +*.exe binary +*.xlsx binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..353d5c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,116 @@ +node_modules +.DS_Store +dist +dist-ssr +dist.zip +dist.tar +dist.war +.nitro +.output +*-dist.zip +*-dist.tar +*-dist.war +coverage +*.local +**/.vitepress/cache +.cache +.turbo +.temp +dev-dist +.stylelintcache +yarn.lock +package-lock.json +.VSCodeCounter +**/backend-mock/data + +# local env files +.env.local +.env.*.local +.eslintcache +.vscode +.vscode/* + + +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* +vite.config.mts.* +vite.config.mjs.* +vite.config.js.* +vite.config.ts.* + +# Editor directories and files +.idea +# .vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +.history +**/.gitkeep +vue/** +vue/**/.github +vue/apps/backend-mock +vue/.github +vue/docs +vue/.vscode +vue/.gitignore +vue/.gitconfig +vue/.gitkeep +vue/.DS_Store +vue/node_modules +vue/dist +vue/dist-ssr +vue/coverage +vue/dev-dist +vue/dev-dist-ssr +vue/dev-dist.zip +vue/dev-dist.tar +vue/dev-dist.war +vue/.changeset +server/.gitattributes +server/.gitignore +server/.idea +server/.vscode +server/.DS_Store +server/bin +server/manifest +server/output +server/docs/ +server/temp +server/temp.yaml +server/bin + +dump.rdb +*.exe +*.exe~ +*.yaml +test/* +*test.* +!server/internal/logic/system/sys_menu_document_center_test.go +!server/internal/logic/trafficusage/history_sync_test.go +!server/internal/logic/iot/t_sim_card_info_test.go +!server/internal/logic/iot/t_sim_card_renew_price_test.go +!server/internal/logic/trafficcutoff/types_test.go +!server/utility/ip_lookup_test.go +!server/utility/external_request_test.go +!server/internal/model/sync_scope_test.go +!server/internal/controller/iot/full_sync_monitor_channels_test.go +!server/internal/logic/system/sys_qrcode_timeout_test.go +!server/internal/logic/memorydb/memorydb_test.go +server/*.tar +*.tar +vue +!server/internal/logic/agent/agent_dept_passrole_test.go +!server/internal/logic/agent/agent_role_save_test.go + +# 开源版:配置文件以占位值入库(不含真实凭据),保证 clone 后可直接 go test +!server/config/config.yaml +!server/config/config_default.yaml +!server/build/build_config.yaml +!server/hack/config.yaml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a753068 --- /dev/null +++ b/README.md @@ -0,0 +1,100 @@ +# iotlcm-admin-svr + +iotLCM 物联网卡全生命周期管理平台的**管理后台服务** —— 承载客户门户、卡信息管理、通信管理、资费管理、告警工单、统计分析与系统治理。 + +配套前端:[iotlcm-admin-ui](https://git.5iot.com/iotlcm-public/iotlcm-admin-ui)。 + +## 特性 + +- **卡资产管理**:卡信息、库存、安装、达量断网、批量开停复机 +- **通信管理**:卡 / 模组 / 设备三域管理,通道与模板治理 +- **资费与交易**:套餐、订单、账单、余额账户与结算批次 +- **告警与工单**:报警、待办、故障、工单与规则引擎 +- **账号治理**:组织、用户、角色、权限与 API 凭证 +- **异步协作**:耗时操作投递到 RabbitMQ,由 [iotlcm-worker-svr](https://git.5iot.com/iotlcm-public/iotlcm-worker-svr) 执行 +- **定时任务**:`sys_job` 表驱动的调度(流量同步、状态同步、账单等) + +## 技术栈 + +- Go 1.25 + GoFrame v2 +- MySQL(业务库)、Redis(缓存与队列)、RabbitMQ(异步任务) +- JWT(会话与接口鉴权) + +## 快速开始 + +```bash +cd server +go mod tidy +go run . +``` + +默认监听 `:8199`。接口文档: + +```text +http://127.0.0.1:8199/api.json # OpenAPI 契约 +http://127.0.0.1:8199/swagger # SwaggerUI +``` + +## 配置 + +配置文件在 `server/config/config.yaml`(运行时)与 `server/config/config_default.yaml`(默认值)。**公开版里的凭据与地址全部是占位符**: + +| 配置项 | 占位 | 说明 | +| --- | --- | --- | +| `jwt.signingKey` | `${JWT_SIGNING_KEY}` | 令牌签发密钥 | +| `database.default.link` | `${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)` | 业务库 | +| `redis.default.address` / `pass` | `${REDIS_ADDR}` / `${REDIS_PASSWORD}` | 缓存 | + +> ⚠️ **部署注意**:`jwt.signingKey` 若使用示例值,登录态与接口令牌将无法跨服务校验。正式部署务必通过环境变量注入真实密钥。 + +## 初始化数据 + +`server/storage/data/xiu_admin.sql` 是**框架基座初始化数据**(系统菜单、字典、角色、示例管理员),是运行起点的必要输入。 + +> **数据库 schema 不随本仓发布** —— 生产库的完整 DDL 已过时(见《项目清单》决策)。请按需自建表结构,或参考 [iotlcm-docs](https://git.5iot.com/iotlcm-public/iotlcm-docs) 中的接口契约。 + +## 目录结构 + +```text +iotlcm-admin-svr/ +├── server/ +│ ├── api/ # API 契约(system / iot / agent 等) +│ ├── internal/ +│ │ ├── controller/ # 控制器 +│ │ ├── logic/ # 业务逻辑 +│ │ ├── service/ # 服务接口 +│ │ ├── model/ consts/ # 模型与常量 +│ │ ├── dao/ # 数据访问 +│ │ └── library/ # 公共库 +│ ├── utility/ # 工具(含启动 banner) +│ ├── config/ # 配置 +│ ├── build/ # Dockerfile 与镜像内配置 +│ └── storage/data/ # 初始化数据 +└── docs/ # 补充说明 +``` + +## 容器化构建 + +```bash +cd server +docker build -f build/Dockerfile -t iotlcm-admin-svr:latest . +``` + +镜像内不含任何凭据;`config/config.yaml` 以只读方式挂载覆盖。 + +## 测试 + +```bash +cd server +go test ./... +``` + +## 相关项目 + +- [iotlcm-admin-ui](https://git.5iot.com/iotlcm-public/iotlcm-admin-ui) —— 管理前端 +- [iotlcm-openapi](https://git.5iot.com/iotlcm-public/iotlcm-openapi) —— 对外 API 网关 +- [iotlcm-worker-svr](https://git.5iot.com/iotlcm-public/iotlcm-worker-svr) —— 异步执行 + +## License + +[Apache License 2.0](./LICENSE) diff --git a/docs/agent-role-template-deployment.md b/docs/agent-role-template-deployment.md new file mode 100644 index 0000000..2fb90a8 --- /dev/null +++ b/docs/agent-role-template-deployment.md @@ -0,0 +1,14 @@ +# 代理模板上线配置 + +本次无需数据库结构迁移,不执行来源字段、索引或 outbox 建表脚本。没有新增菜单或手动定时任务。 + +1. 开发环境保持 sys_config:tenant_id=000000,config_key=agent.role.template.role_id,config_value=82。其他环境核对真实模板 ID,不能直接复制开发环境 ID。 +2. 模板为平台企业100的代理商角色82,在企业管理的角色管理维护。启用且数据范围为本机构及下级,按钮采用角色默认范围。 +3. 核对直属企业 sys_dept.dept_role 与管理员 sys_user_role:对应角色存在、未删除、属于该企业,并确认账号绑定。不要将所有企业绑定到角色82。 +4. 部署新版后端,通过页面保存参数或模板触发同步。无需执行来源字段修复脚本。 + +已查到需核对的关联:企业117原角色67、147原角色91、175原角色88、187原角色94、188原角色95、190原角色96、191原角色98,均为失效关联。现存候选分别为101、58、102、103、104、105、106;核对账号绑定后才可修复,不盲目替换。 + +保存后直接同步各直属企业。某个企业失败不影响其他企业,接口报告失败,日志查看 agent template sync child failed 或 agent role sync child failed。修复后重新保存模板重试。模板已提交但同步失败时不会撤销已成功同步的企业;进程异常导致未完成同步,需要人工重新保存。 + +上线验收包括:三级企业、上级撤权、下级自建角色、旧登录账号、直接接口调用、单家关联异常、模板切换和重复同步。真实页面和多实例并发需另行验收。本次不修改实际数据库或运行服务。 diff --git a/docs/agent-role-template.md b/docs/agent-role-template.md new file mode 100644 index 0000000..a08abed --- /dev/null +++ b/docs/agent-role-template.md @@ -0,0 +1,15 @@ +# 代理角色模板 + +使用现有 sys_config、sys_role、sys_role_menu、sys_dept、sys_user_role 表,不新增字段、索引或任务表。 + +平台参数:tenant_id=000000,config_key=agent.role.template.role_id,config_value 为本平台企业的模板角色 ID。开发环境使用 82。模板在企业管理的角色管理维护,正常启用、is_pass=1、数据范围为本机构及下级(4),按钮不允许全部或自定义数据范围。每个企业只能有一个下发模板。 + +模板修改提交后直接同步直属企业,按 sys_dept.parent_id 定位直属客户、dept_role 定位该企业实际默认角色。通过 created_dept 和上下级关系识别下发角色,不依赖 source_role_id 或 source_dept_id。平台模板切换限定同一企业,旧任务读取当前配置。下级企业维护自己的客户模板,不直接继承平台对孙级的新增授权。 + +同步保留角色 ID 和账号绑定,每家企业独立事务。单家失败不阻塞其他企业,接口报告同步失败,日志记录失败企业。保存成功和同步成功分开处理;失败时模板可能已保存,修复角色关联后重新保存可幂等重试。不会凭空修复账号绑定。 + +接口鉴权读取当前权限并与上级企业和平台模板取交集,不依赖长期用户权限缓存。没有有效角色或模板参数无效时拒绝授权。业务角色授权记录不会主动删除,模板恢复权限后仍保留授权的角色可能重新获得权限。前端按钮更新需刷新,后端执行当前鉴权。 + +采用提交后直接同步,不保证模板保存和全体客户同步原子完成。进程在提交后、同步完成前退出时,需要重新保存触发补偿;没有数据库持久化任务,不承诺自动恢复丢失任务。原有角色同步队列保留兼容重试和旧消息处理,不新增队列配置或定时任务。 + +正式上线前验证三级企业、参数切换、权限收回、旧登录账号、单家无效角色、重复同步和真实并发请求。同步随直属企业数量增加会延长请求耗时,需结合实际规模验证 API 超时与数据库负载。 diff --git a/server/Makefile b/server/Makefile new file mode 100644 index 0000000..2a6e6e9 --- /dev/null +++ b/server/Makefile @@ -0,0 +1,7 @@ +ROOT_DIR = $(shell pwd) +NAMESPACE = "default" +DEPLOY_NAME = "template-single" +DOCKER_NAME = "template-single" + +include ./hack/hack-cli.mk +include ./hack/hack.mk \ No newline at end of file diff --git a/server/api/agent/agent.go b/server/api/agent/agent.go new file mode 100644 index 0000000..74c4a08 --- /dev/null +++ b/server/api/agent/agent.go @@ -0,0 +1,61 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package agent + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" +) + +type IAgentV1 interface { + DeptList(ctx context.Context, req *v1.DeptListReq) (res *v1.DeptListRes, err error) + DeptView(ctx context.Context, req *v1.DeptViewReq) (res *v1.DeptViewRes, err error) + DeptSave(ctx context.Context, req *v1.DeptSaveReq) (res *v1.DeptSaveRes, err error) + DeptDelete(ctx context.Context, req *v1.DeptDeleteReq) (res *v1.DeptDeleteRes, err error) + DeptResetPassword(ctx context.Context, req *v1.DeptResetPasswordReq) (res *v1.DeptResetPasswordRes, err error) + GetDeptApiInfo(ctx context.Context, req *v1.GetDeptApiInfoReq) (res *v1.GetDeptApiInfoRes, err error) + SubCompany(ctx context.Context, req *v1.SubCompanyReq) (res *v1.SubCompanyRes, err error) + MenuTree(ctx context.Context, req *v1.MenuTreeReq) (res *v1.MenuTreeRes, err error) + RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) + RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error) + RoleSave(ctx context.Context, req *v1.RoleSaveReq) (res *v1.RoleSaveRes, err error) + RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) + Scope(ctx context.Context, req *v1.ScopeReq) (res *v1.ScopeRes, err error) + UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error) + UserView(ctx context.Context, req *v1.UserViewReq) (res *v1.UserViewRes, err error) + UserAdd(ctx context.Context, req *v1.UserAddReq) (res *v1.UserAddRes, err error) + UserUpdate(ctx context.Context, req *v1.UserUpdateReq) (res *v1.UserUpdateRes, err error) + UserDelete(ctx context.Context, req *v1.UserDeleteReq) (res *v1.UserDeleteRes, err error) + UserResetPassword(ctx context.Context, req *v1.UserResetPasswordReq) (res *v1.UserResetPasswordRes, err error) + TAgentEnterpriseList(ctx context.Context, req *v1.TAgentEnterpriseListReq) (res *v1.TAgentEnterpriseListRes, err error) + TAgentEnterpriseExport(ctx context.Context, req *v1.TAgentEnterpriseExportReq) (res *v1.TAgentEnterpriseExportRes, err error) + TAgentEnterpriseView(ctx context.Context, req *v1.TAgentEnterpriseViewReq) (res *v1.TAgentEnterpriseViewRes, err error) + TAgentEnterpriseEdit(ctx context.Context, req *v1.TAgentEnterpriseEditReq) (res *v1.TAgentEnterpriseEditRes, err error) + TAgentEnterpriseDelete(ctx context.Context, req *v1.TAgentEnterpriseDeleteReq) (res *v1.TAgentEnterpriseDeleteRes, err error) + TApiList(ctx context.Context, req *v1.TApiListReq) (res *v1.TApiListRes, err error) + TApiExport(ctx context.Context, req *v1.TApiExportReq) (res *v1.TApiExportRes, err error) + TApiView(ctx context.Context, req *v1.TApiViewReq) (res *v1.TApiViewRes, err error) + TApiEdit(ctx context.Context, req *v1.TApiEditReq) (res *v1.TApiEditRes, err error) + TApiDelete(ctx context.Context, req *v1.TApiDeleteReq) (res *v1.TApiDeleteRes, err error) + TApiGroupList(ctx context.Context, req *v1.TApiGroupListReq) (res *v1.TApiGroupListRes, err error) + TApiGroupExport(ctx context.Context, req *v1.TApiGroupExportReq) (res *v1.TApiGroupExportRes, err error) + TApiGroupView(ctx context.Context, req *v1.TApiGroupViewReq) (res *v1.TApiGroupViewRes, err error) + TApiGroupEdit(ctx context.Context, req *v1.TApiGroupEditReq) (res *v1.TApiGroupEditRes, err error) + TApiGroupDelete(ctx context.Context, req *v1.TApiGroupDeleteReq) (res *v1.TApiGroupDeleteRes, err error) + TApiGroupStatus(ctx context.Context, req *v1.TApiGroupStatusReq) (res *v1.TApiGroupStatusRes, err error) + TApiResourceList(ctx context.Context, req *v1.TApiResourceListReq) (res *v1.TApiResourceListRes, err error) + TApiResourceExport(ctx context.Context, req *v1.TApiResourceExportReq) (res *v1.TApiResourceExportRes, err error) + TApiResourceView(ctx context.Context, req *v1.TApiResourceViewReq) (res *v1.TApiResourceViewRes, err error) + TApiResourceEdit(ctx context.Context, req *v1.TApiResourceEditReq) (res *v1.TApiResourceEditRes, err error) + TApiResourceDelete(ctx context.Context, req *v1.TApiResourceDeleteReq) (res *v1.TApiResourceDeleteRes, err error) + TApiResourceStatus(ctx context.Context, req *v1.TApiResourceStatusReq) (res *v1.TApiResourceStatusRes, err error) + TCustWithdrawAccountList(ctx context.Context, req *v1.TCustWithdrawAccountListReq) (res *v1.TCustWithdrawAccountListRes, err error) + TCustWithdrawAccountExport(ctx context.Context, req *v1.TCustWithdrawAccountExportReq) (res *v1.TCustWithdrawAccountExportRes, err error) + TCustWithdrawAccountView(ctx context.Context, req *v1.TCustWithdrawAccountViewReq) (res *v1.TCustWithdrawAccountViewRes, err error) + TCustWithdrawAccountEdit(ctx context.Context, req *v1.TCustWithdrawAccountEditReq) (res *v1.TCustWithdrawAccountEditRes, err error) + TCustWithdrawAccountDelete(ctx context.Context, req *v1.TCustWithdrawAccountDeleteReq) (res *v1.TCustWithdrawAccountDeleteRes, err error) + TCustWithdrawAccountStatus(ctx context.Context, req *v1.TCustWithdrawAccountStatusReq) (res *v1.TCustWithdrawAccountStatusRes, err error) +} diff --git a/server/api/agent/v1/agent_dept.go b/server/api/agent/v1/agent_dept.go new file mode 100644 index 0000000..019e9a0 --- /dev/null +++ b/server/api/agent/v1/agent_dept.go @@ -0,0 +1,67 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type DeptListReq struct { + g.Meta `path:"/dept/list" method:"get" tags:"代理商组织管理" summary:"代理商组织列表" x-check-permission:"cpm:agent:dept:list"` + model.AgentDeptListParam +} + +type DeptListRes struct { + response.PageResult + Data []*model.AgentEnterpriseCustomerModel `json:"items"` +} + +type DeptViewReq struct { + g.Meta `path:"/dept/view" method:"get" tags:"代理商组织管理" summary:"代理商组织详情" x-check-permission:"cpm:agent:dept:query"` + DeptId int64 `json:"deptId"` +} + +type DeptViewRes struct { + model.AgentEnterpriseCustomerModel +} + +type DeptSaveReq struct { + g.Meta `path:"/dept/save" method:"post" tags:"代理商组织管理" summary:"保存代理商组织" x-check-permission:"cpm:agent:dept:edit"` + model.AgentDeptSaveParam +} + +type DeptSaveRes struct { + DeptId int64 `json:"deptId"` +} + +type DeptDeleteReq struct { + g.Meta `path:"/dept/delete" method:"post" tags:"代理商组织管理" summary:"删除代理商组织" x-check-permission:"cpm:agent:dept:remove"` + DeptId int64 `json:"deptId"` +} + +type DeptDeleteRes struct{} + +type DeptResetPasswordReq struct { + g.Meta `path:"/dept/resetPassword" method:"post" tags:"代理商企业客户管理" summary:"重置企业客户默认用户密码" x-check-permission:"cpm:agent:dept:edit"` + DeptId int64 `json:"deptId"` + Password string `json:"password"` +} + +type DeptResetPasswordRes struct{} + +type GetDeptApiInfoReq struct { + g.Meta `path:"/dept/apiInfo" method:"get" tags:"代理商组织管理" summary:"获取代理商组织API信息" x-check-permission:"cpm:agent:dept:apiInfo"` +} + +type GetDeptApiInfoRes struct { + model.AgentDeptApiModel +} + +type SubCompanyReq struct { + g.Meta `path:"/dept/subCompany" method:"get" tags:"代理商组织管理" summary:"获取直属下级"` +} + +type SubCompanyRes struct { + Data []*model.SysDeptTreeModel `json:"items"` +} diff --git a/server/api/agent/v1/agent_menu.go b/server/api/agent/v1/agent_menu.go new file mode 100644 index 0000000..ce9de13 --- /dev/null +++ b/server/api/agent/v1/agent_menu.go @@ -0,0 +1,16 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type MenuTreeReq struct { + g.Meta `path:"/menu/tree" method:"get" tags:"代理商菜单权限" summary:"可分配菜单树" x-check-permission:"cpm:agent:role:query"` +} + +type MenuTreeRes struct { + Items []*model.SysMenuTreeModel `json:"items"` + MenuIds []int64 `json:"menuIds"` +} diff --git a/server/api/agent/v1/agent_role.go b/server/api/agent/v1/agent_role.go new file mode 100644 index 0000000..6846010 --- /dev/null +++ b/server/api/agent/v1/agent_role.go @@ -0,0 +1,44 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type RoleListReq struct { + g.Meta `path:"/role/list" method:"get" tags:"代理商角色权限" summary:"角色权限列表" x-check-permission:"cpm:agent:role:list"` + model.AgentRoleListParam +} + +type RoleListRes struct { + response.PageResult + Data []*model.AgentRoleListModel `json:"items"` +} + +type RoleViewReq struct { + g.Meta `path:"/role/view" method:"get" tags:"代理商角色权限" summary:"角色权限详情" x-check-permission:"cpm:agent:role:query"` + RoleId int64 `json:"roleId"` +} + +type RoleViewRes struct { + model.AgentRoleViewModel +} + +type RoleSaveReq struct { + g.Meta `path:"/role/save" method:"post" tags:"代理商角色权限" summary:"保存角色权限" x-check-permission:"cpm:agent:role:edit"` + model.AgentRoleSaveParam +} + +type RoleSaveRes struct { + RoleId int64 `json:"roleId"` +} + +type RoleDeleteReq struct { + g.Meta `path:"/role/delete" method:"post" tags:"代理商角色权限" summary:"删除角色权限" x-check-permission:"cpm:agent:role:remove"` + RoleId int64 `json:"roleId"` + RoleIds []int64 `json:"roleIds"` +} + +type RoleDeleteRes struct{} diff --git a/server/api/agent/v1/agent_scope.go b/server/api/agent/v1/agent_scope.go new file mode 100644 index 0000000..d38e9db --- /dev/null +++ b/server/api/agent/v1/agent_scope.go @@ -0,0 +1,16 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + + "github.com/gogf/gf/v2/frame/g" +) + +type ScopeReq struct { + g.Meta `path:"/scope" method:"get" tags:"代理商数据范围" summary:"代理商组织范围" x-check-permission:"cpm:agent:dept:list"` +} + +type ScopeRes struct { + DeptIds []int64 `json:"deptIds"` + request.PageInfo +} diff --git a/server/api/agent/v1/agent_user.go b/server/api/agent/v1/agent_user.go new file mode 100644 index 0000000..b9e67e4 --- /dev/null +++ b/server/api/agent/v1/agent_user.go @@ -0,0 +1,61 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type UserListReq struct { + g.Meta `path:"/user/list" method:"get" tags:"代理商用户管理" summary:"下级用户列表" x-check-permission:"cpm:agent:user:list"` + model.AgentUserListParam +} + +type UserListRes struct { + response.PageResult + Data []*model.AgentUserListModel `json:"items"` +} + +type UserViewReq struct { + g.Meta `path:"/user/view" method:"get" tags:"代理商用户管理" summary:"下级用户详情" x-check-permission:"cpm:agent:user:query"` + UserId int64 `json:"userId"` +} + +type UserViewRes struct { + model.AgentUserViewModel +} + +type UserAddReq struct { + g.Meta `path:"/user/add" method:"post" tags:"代理商用户管理" summary:"新增下级用户" x-check-permission:"cpm:agent:user:add"` + model.SysUserAddModel +} + +type UserAddRes struct { + Data *model.AgentUserViewModel `json:"data"` +} + +type UserUpdateReq struct { + g.Meta `path:"/user/update" method:"post" tags:"代理商用户管理" summary:"修改下级用户" x-check-permission:"cpm:agent:user:edit"` + model.SysUserUpdateModel +} + +type UserUpdateRes struct { + Data *model.AgentUserViewModel `json:"data"` +} + +type UserDeleteReq struct { + g.Meta `path:"/user/delete" method:"post" tags:"代理商用户管理" summary:"删除下级用户" x-check-permission:"cpm:agent:user:remove"` + UserId int64 `json:"userId"` + UserIds []int64 `json:"userIds"` +} + +type UserDeleteRes struct{} + +type UserResetPasswordReq struct { + g.Meta `path:"/user/resetPassword" method:"post" tags:"代理商用户管理" summary:"重置下级用户密码" x-check-permission:"cpm:agent:user:resetPwd"` + UserId int64 `json:"userId"` + Password string `json:"password"` +} + +type UserResetPasswordRes struct{} diff --git a/server/api/agent/v1/tagententerprise.go b/server/api/agent/v1/tagententerprise.go new file mode 100644 index 0000000..074011e --- /dev/null +++ b/server/api/agent/v1/tagententerprise.go @@ -0,0 +1,59 @@ +// Package tagententerprise +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tagententerprise + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询企业客户单位信息列表 +type TAgentEnterpriseListReq struct { + g.Meta `path:"/tAgentEnterprise/list" method:"get" tags:"企业客户单位信息" summary:"获取企业客户单位信息列表" x-check-permission:"cpm:agent:tAgentEnterprise:list"` + model.TAgentEnterpriseListParam +} + +type TAgentEnterpriseListRes struct { + response.PageResult + Items []*model.TAgentEnterpriseListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出企业客户单位信息列表 +type TAgentEnterpriseExportReq struct { + g.Meta `path:"/tAgentEnterprise/export" method:"post" tags:"企业客户单位信息" summary:"导出企业客户单位信息列表" x-check-permission:"cpm:agent:tAgentEnterprise:export"` + model.TAgentEnterpriseListParam +} + +type TAgentEnterpriseExportRes struct{} + +// ViewReq 获取企业客户单位信息指定信息 +type TAgentEnterpriseViewReq struct { + g.Meta `path:"/tAgentEnterprise/view" method:"get" tags:"企业客户单位信息" summary:"获取企业客户单位信息指定信息" x-check-permission:"cpm:agent:tAgentEnterprise:view"` + model.TAgentEnterpriseViewParam +} + +type TAgentEnterpriseViewRes struct { + *model.TAgentEnterpriseViewModel +} + +// EditReq 修改/新增企业客户单位信息 +type TAgentEnterpriseEditReq struct { + g.Meta `path:"/tAgentEnterprise/edit" method:"post" tags:"企业客户单位信息" summary:"修改/新增企业客户单位信息" x-check-permission:"cpm:agent:tAgentEnterprise:edit"` + model.TAgentEnterpriseEditParam +} + +type TAgentEnterpriseEditRes struct{} + +// DeleteReq 删除企业客户单位信息 +type TAgentEnterpriseDeleteReq struct { + g.Meta `path:"/tAgentEnterprise/delete" method:"post" tags:"企业客户单位信息" summary:"删除企业客户单位信息" x-check-permission:"cpm:agent:tAgentEnterprise:delete"` + model.TAgentEnterpriseDeleteParam +} + +type TAgentEnterpriseDeleteRes struct{} diff --git a/server/api/agent/v1/tapi.go b/server/api/agent/v1/tapi.go new file mode 100644 index 0000000..6a61b6c --- /dev/null +++ b/server/api/agent/v1/tapi.go @@ -0,0 +1,59 @@ +// Package tapi +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tapi + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询API凭证管理列表 +type TApiListReq struct { + g.Meta `path:"/tApi/list" method:"get" tags:"API凭证管理" summary:"获取API凭证管理列表" x-check-permission:"cpm:agent:tApi:list"` + model.TApiListParam +} + +type TApiListRes struct { + response.PageResult + Items []*model.TApiListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出API凭证管理列表 +type TApiExportReq struct { + g.Meta `path:"/tApi/export" method:"post" tags:"API凭证管理" summary:"导出API凭证管理列表" x-check-permission:"cpm:agent:tApi:export"` + model.TApiListParam +} + +type TApiExportRes struct{} + +// ViewReq 获取API凭证管理指定信息 +type TApiViewReq struct { + g.Meta `path:"/tApi/view" method:"get" tags:"API凭证管理" summary:"获取API凭证管理指定信息" x-check-permission:"cpm:agent:tApi:view"` + model.TApiViewParam +} + +type TApiViewRes struct { + *model.TApiViewModel +} + +// EditReq 修改/新增API凭证管理 +type TApiEditReq struct { + g.Meta `path:"/tApi/edit" method:"post" tags:"API凭证管理" summary:"修改/新增API凭证管理" x-check-permission:"cpm:agent:tApi:edit"` + model.TApiEditParam +} + +type TApiEditRes struct{} + +// DeleteReq 删除API凭证管理 +type TApiDeleteReq struct { + g.Meta `path:"/tApi/delete" method:"post" tags:"API凭证管理" summary:"删除API凭证管理" x-check-permission:"cpm:agent:tApi:delete"` + model.TApiDeleteParam +} + +type TApiDeleteRes struct{} diff --git a/server/api/agent/v1/tapigroup.go b/server/api/agent/v1/tapigroup.go new file mode 100644 index 0000000..03c99b1 --- /dev/null +++ b/server/api/agent/v1/tapigroup.go @@ -0,0 +1,55 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TApiGroupListReq struct { + g.Meta `path:"/tApiGroup/list" method:"get" tags:"open-api-group" summary:"list open api groups" x-check-permission:"cpm:agent:tApiGroup:list,cpm:gen:tApiGroup:list"` + model.TApiGroupListParam +} + +type TApiGroupListRes struct { + response.PageResult + Items []*model.TApiGroupListModel `json:"items" dc:"items"` +} + +type TApiGroupExportReq struct { + g.Meta `path:"/tApiGroup/export" method:"post" tags:"open-api-group" summary:"export open api groups" x-check-permission:"cpm:agent:tApiGroup:export,cpm:gen:tApiGroup:export"` + model.TApiGroupListParam +} + +type TApiGroupExportRes struct{} + +type TApiGroupViewReq struct { + g.Meta `path:"/tApiGroup/view" method:"get" tags:"open-api-group" summary:"view open api group" x-check-permission:"cpm:agent:tApiGroup:view,cpm:gen:tApiGroup:view"` + model.TApiGroupViewParam +} + +type TApiGroupViewRes struct { + *model.TApiGroupViewModel +} + +type TApiGroupEditReq struct { + g.Meta `path:"/tApiGroup/edit" method:"post" tags:"open-api-group" summary:"edit open api group" x-check-permission:"cpm:agent:tApiGroup:edit,cpm:gen:tApiGroup:edit"` + model.TApiGroupEditParam +} + +type TApiGroupEditRes struct{} + +type TApiGroupDeleteReq struct { + g.Meta `path:"/tApiGroup/delete" method:"post" tags:"open-api-group" summary:"delete open api group" x-check-permission:"cpm:agent:tApiGroup:delete,cpm:gen:tApiGroup:delete"` + model.TApiGroupDeleteParam +} + +type TApiGroupDeleteRes struct{} + +type TApiGroupStatusReq struct { + g.Meta `path:"/tApiGroup/status" method:"post" tags:"open-api-group" summary:"update open api group status" x-check-permission:"cpm:agent:tApiGroup:status,cpm:gen:tApiGroup:status"` + model.TApiGroupStatusParam +} + +type TApiGroupStatusRes struct{} diff --git a/server/api/agent/v1/tapiresource.go b/server/api/agent/v1/tapiresource.go new file mode 100644 index 0000000..b652c48 --- /dev/null +++ b/server/api/agent/v1/tapiresource.go @@ -0,0 +1,55 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TApiResourceListReq struct { + g.Meta `path:"/tApiResource/list" method:"get" tags:"open-api-resource" summary:"list open api resources" x-check-permission:"cpm:agent:tApiResource:list,cpm:gen:tApiResource:list"` + model.TApiResourceListParam +} + +type TApiResourceListRes struct { + response.PageResult + Items []*model.TApiResourceListModel `json:"items" dc:"items"` +} + +type TApiResourceExportReq struct { + g.Meta `path:"/tApiResource/export" method:"post" tags:"open-api-resource" summary:"export open api resources" x-check-permission:"cpm:agent:tApiResource:export,cpm:gen:tApiResource:export"` + model.TApiResourceListParam +} + +type TApiResourceExportRes struct{} + +type TApiResourceViewReq struct { + g.Meta `path:"/tApiResource/view" method:"get" tags:"open-api-resource" summary:"view open api resource" x-check-permission:"cpm:agent:tApiResource:view,cpm:gen:tApiResource:view"` + model.TApiResourceViewParam +} + +type TApiResourceViewRes struct { + *model.TApiResourceViewModel +} + +type TApiResourceEditReq struct { + g.Meta `path:"/tApiResource/edit" method:"post" tags:"open-api-resource" summary:"edit open api resource" x-check-permission:"cpm:agent:tApiResource:edit,cpm:gen:tApiResource:edit"` + model.TApiResourceEditParam +} + +type TApiResourceEditRes struct{} + +type TApiResourceDeleteReq struct { + g.Meta `path:"/tApiResource/delete" method:"post" tags:"open-api-resource" summary:"delete open api resource" x-check-permission:"cpm:agent:tApiResource:delete,cpm:gen:tApiResource:delete"` + model.TApiResourceDeleteParam +} + +type TApiResourceDeleteRes struct{} + +type TApiResourceStatusReq struct { + g.Meta `path:"/tApiResource/status" method:"post" tags:"open-api-resource" summary:"update open api resource status" x-check-permission:"cpm:agent:tApiResource:status,cpm:gen:tApiResource:status"` + model.TApiResourceStatusParam +} + +type TApiResourceStatusRes struct{} diff --git a/server/api/agent/v1/tcustwithdrawaccount.go b/server/api/agent/v1/tcustwithdrawaccount.go new file mode 100644 index 0000000..fb0602a --- /dev/null +++ b/server/api/agent/v1/tcustwithdrawaccount.go @@ -0,0 +1,67 @@ +// Package tcustwithdrawaccount +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tcustwithdrawaccount + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询客户提现账户表列表 +type TCustWithdrawAccountListReq struct { + g.Meta `path:"/tCustWithdrawAccount/list" method:"get" tags:"客户提现账户表" summary:"获取客户提现账户表列表" x-check-permission:"cpm:agent:tCustWithdrawAccount:list"` + model.TCustWithdrawAccountListParam +} + +type TCustWithdrawAccountListRes struct { + response.PageResult + Items []*model.TCustWithdrawAccountListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出客户提现账户表列表 +type TCustWithdrawAccountExportReq struct { + g.Meta `path:"/tCustWithdrawAccount/export" method:"post" tags:"客户提现账户表" summary:"导出客户提现账户表列表" x-check-permission:"cpm:agent:tCustWithdrawAccount:export"` + model.TCustWithdrawAccountListParam +} + +type TCustWithdrawAccountExportRes struct{} + +// ViewReq 获取客户提现账户表指定信息 +type TCustWithdrawAccountViewReq struct { + g.Meta `path:"/tCustWithdrawAccount/view" method:"get" tags:"客户提现账户表" summary:"获取客户提现账户表指定信息" x-check-permission:"cpm:agent:tCustWithdrawAccount:view"` + model.TCustWithdrawAccountViewParam +} + +type TCustWithdrawAccountViewRes struct { + *model.TCustWithdrawAccountViewModel +} + +// EditReq 修改/新增客户提现账户表 +type TCustWithdrawAccountEditReq struct { + g.Meta `path:"/tCustWithdrawAccount/edit" method:"post" tags:"客户提现账户表" summary:"修改/新增客户提现账户表" x-check-permission:"cpm:agent:tCustWithdrawAccount:edit"` + model.TCustWithdrawAccountEditParam +} + +type TCustWithdrawAccountEditRes struct{} + +// DeleteReq 删除客户提现账户表 +type TCustWithdrawAccountDeleteReq struct { + g.Meta `path:"/tCustWithdrawAccount/delete" method:"post" tags:"客户提现账户表" summary:"删除客户提现账户表" x-check-permission:"cpm:agent:tCustWithdrawAccount:delete"` + model.TCustWithdrawAccountDeleteParam +} + +type TCustWithdrawAccountDeleteRes struct{} + +// StatusReq 更新客户提现账户表状态 +type TCustWithdrawAccountStatusReq struct { + g.Meta `path:"/tCustWithdrawAccount/status" method:"post" tags:"客户提现账户表" summary:"更新客户提现账户表状态" x-check-permission:"cpm:agent:tCustWithdrawAccount:status"` + model.TCustWithdrawAccountStatusParam +} + +type TCustWithdrawAccountStatusRes struct{} diff --git a/server/api/common/common.go b/server/api/common/common.go new file mode 100644 index 0000000..2b62547 --- /dev/null +++ b/server/api/common/common.go @@ -0,0 +1,122 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package common + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" +) + +type ICommonV1 interface { + BatchExecutionLogList(ctx context.Context, req *v1.BatchExecutionLogListReq) (res *v1.BatchExecutionLogListRes, err error) + BatchExecutionLogSummary(ctx context.Context, req *v1.BatchExecutionLogSummaryReq) (res *v1.BatchExecutionLogSummaryRes, err error) + BatchExecutionLogDetailList(ctx context.Context, req *v1.BatchExecutionLogDetailListReq) (res *v1.BatchExecutionLogDetailListRes, err error) + BatchMainList(ctx context.Context, req *v1.BatchMainListReq) (res *v1.BatchMainListRes, err error) + BatchMainSuccessList(ctx context.Context, req *v1.BatchMainSuccessListReq) (res *v1.BatchMainSuccessListRes, err error) + BatchMainCards(ctx context.Context, req *v1.BatchMainCardsReq) (res *v1.BatchMainCardsRes, err error) + BatchMainExport(ctx context.Context, req *v1.BatchMainExportReq) (res *v1.BatchMainExportRes, err error) + BatchMainView(ctx context.Context, req *v1.BatchMainViewReq) (res *v1.BatchMainViewRes, err error) + BatchMainEdit(ctx context.Context, req *v1.BatchMainEditReq) (res *v1.BatchMainEditRes, err error) + BatchMainDelete(ctx context.Context, req *v1.BatchMainDeleteReq) (res *v1.BatchMainDeleteRes, err error) + BatchMainRequeue(ctx context.Context, req *v1.BatchMainRequeueReq) (res *v1.BatchMainRequeueRes, err error) + TAgentBalanceList(ctx context.Context, req *v1.TAgentBalanceListReq) (res *v1.TAgentBalanceListRes, err error) + TAgentBalanceExport(ctx context.Context, req *v1.TAgentBalanceExportReq) (res *v1.TAgentBalanceExportRes, err error) + TAgentBalanceView(ctx context.Context, req *v1.TAgentBalanceViewReq) (res *v1.TAgentBalanceViewRes, err error) + TAgentBalanceEdit(ctx context.Context, req *v1.TAgentBalanceEditReq) (res *v1.TAgentBalanceEditRes, err error) + TAgentBalanceDelete(ctx context.Context, req *v1.TAgentBalanceDeleteReq) (res *v1.TAgentBalanceDeleteRes, err error) + TAgentBalanceStatus(ctx context.Context, req *v1.TAgentBalanceStatusReq) (res *v1.TAgentBalanceStatusRes, err error) + TAgentBalanceAccountTrend(ctx context.Context, req *v1.TAgentBalanceAccountTrendReq) (res *v1.TAgentBalanceAccountTrendRes, err error) + TAgentBalanceGetAccountBalance(ctx context.Context, req *v1.TAgentBalanceGetAccountBalanceReq) (res *v1.TAgentBalanceGetAccountBalanceRes, err error) + TAgentBalanceBalanceTransferApply(ctx context.Context, req *v1.TAgentBalanceBalanceTransferApplyReq) (res *v1.TAgentBalanceBalanceTransferApplyRes, err error) + TAgentBalanceBalanceTransferAudit(ctx context.Context, req *v1.TAgentBalanceBalanceTransferAuditReq) (res *v1.TAgentBalanceBalanceTransferAuditRes, err error) + TAgentBalanceSettleCommission(ctx context.Context, req *v1.TAgentBalanceSettleCommissionReq) (res *v1.TAgentBalanceSettleCommissionRes, err error) + TBalanceDetailList(ctx context.Context, req *v1.TBalanceDetailListReq) (res *v1.TBalanceDetailListRes, err error) + TBalanceDetailExport(ctx context.Context, req *v1.TBalanceDetailExportReq) (res *v1.TBalanceDetailExportRes, err error) + TBalanceDetailView(ctx context.Context, req *v1.TBalanceDetailViewReq) (res *v1.TBalanceDetailViewRes, err error) + TBalanceDetailEdit(ctx context.Context, req *v1.TBalanceDetailEditReq) (res *v1.TBalanceDetailEditRes, err error) + TBalanceDetailDelete(ctx context.Context, req *v1.TBalanceDetailDeleteReq) (res *v1.TBalanceDetailDeleteRes, err error) + TConsumeAccountMonthBillList(ctx context.Context, req *v1.TConsumeAccountMonthBillListReq) (res *v1.TConsumeAccountMonthBillListRes, err error) + TConsumeAccountMonthBillExport(ctx context.Context, req *v1.TConsumeAccountMonthBillExportReq) (res *v1.TConsumeAccountMonthBillExportRes, err error) + TConsumeAccountMonthBillView(ctx context.Context, req *v1.TConsumeAccountMonthBillViewReq) (res *v1.TConsumeAccountMonthBillViewRes, err error) + TConsumeAccountMonthBillEdit(ctx context.Context, req *v1.TConsumeAccountMonthBillEditReq) (res *v1.TConsumeAccountMonthBillEditRes, err error) + TConsumeAccountMonthBillDelete(ctx context.Context, req *v1.TConsumeAccountMonthBillDeleteReq) (res *v1.TConsumeAccountMonthBillDeleteRes, err error) + TConsumeAccountMonthBillSettle(ctx context.Context, req *v1.TConsumeAccountMonthBillSettleReq) (res *v1.TConsumeAccountMonthBillSettleRes, err error) + TConsumeAccountMonthBillGetConsumptionBillSummary(ctx context.Context, req *v1.TConsumeAccountMonthBillGetConsumptionBillSummaryReq) (res *v1.TConsumeAccountMonthBillGetConsumptionBillSummaryRes, err error) + TCreditDetailList(ctx context.Context, req *v1.TCreditDetailListReq) (res *v1.TCreditDetailListRes, err error) + TCreditDetailExport(ctx context.Context, req *v1.TCreditDetailExportReq) (res *v1.TCreditDetailExportRes, err error) + TCreditDetailView(ctx context.Context, req *v1.TCreditDetailViewReq) (res *v1.TCreditDetailViewRes, err error) + TCreditDetailEdit(ctx context.Context, req *v1.TCreditDetailEditReq) (res *v1.TCreditDetailEditRes, err error) + TCreditDetailDelete(ctx context.Context, req *v1.TCreditDetailDeleteReq) (res *v1.TCreditDetailDeleteRes, err error) + TDivisionCodeList(ctx context.Context, req *v1.TDivisionCodeListReq) (res *v1.TDivisionCodeListRes, err error) + TDivisionCodeExport(ctx context.Context, req *v1.TDivisionCodeExportReq) (res *v1.TDivisionCodeExportRes, err error) + TDivisionCodeView(ctx context.Context, req *v1.TDivisionCodeViewReq) (res *v1.TDivisionCodeViewRes, err error) + TDivisionCodeEdit(ctx context.Context, req *v1.TDivisionCodeEditReq) (res *v1.TDivisionCodeEditRes, err error) + TDivisionCodeDelete(ctx context.Context, req *v1.TDivisionCodeDeleteReq) (res *v1.TDivisionCodeDeleteRes, err error) + TFinanceApplyList(ctx context.Context, req *v1.TFinanceApplyListReq) (res *v1.TFinanceApplyListRes, err error) + TFinanceApplyExport(ctx context.Context, req *v1.TFinanceApplyExportReq) (res *v1.TFinanceApplyExportRes, err error) + TFinanceApplyView(ctx context.Context, req *v1.TFinanceApplyViewReq) (res *v1.TFinanceApplyViewRes, err error) + TFinanceApplyEdit(ctx context.Context, req *v1.TFinanceApplyEditReq) (res *v1.TFinanceApplyEditRes, err error) + TFinanceApplyDelete(ctx context.Context, req *v1.TFinanceApplyDeleteReq) (res *v1.TFinanceApplyDeleteRes, err error) + TFinanceAuditRecordList(ctx context.Context, req *v1.TFinanceAuditRecordListReq) (res *v1.TFinanceAuditRecordListRes, err error) + TFinanceAuditRecordExport(ctx context.Context, req *v1.TFinanceAuditRecordExportReq) (res *v1.TFinanceAuditRecordExportRes, err error) + TFinanceAuditRecordView(ctx context.Context, req *v1.TFinanceAuditRecordViewReq) (res *v1.TFinanceAuditRecordViewRes, err error) + TFinanceAuditRecordEdit(ctx context.Context, req *v1.TFinanceAuditRecordEditReq) (res *v1.TFinanceAuditRecordEditRes, err error) + TFinanceAuditRecordDelete(ctx context.Context, req *v1.TFinanceAuditRecordDeleteReq) (res *v1.TFinanceAuditRecordDeleteRes, err error) + TFinCommissionDetailList(ctx context.Context, req *v1.TFinCommissionDetailListReq) (res *v1.TFinCommissionDetailListRes, err error) + TFinCommissionDetailExport(ctx context.Context, req *v1.TFinCommissionDetailExportReq) (res *v1.TFinCommissionDetailExportRes, err error) + TFinCommissionDetailView(ctx context.Context, req *v1.TFinCommissionDetailViewReq) (res *v1.TFinCommissionDetailViewRes, err error) + TFinCommissionDetailEdit(ctx context.Context, req *v1.TFinCommissionDetailEditReq) (res *v1.TFinCommissionDetailEditRes, err error) + TFinCommissionDetailDelete(ctx context.Context, req *v1.TFinCommissionDetailDeleteReq) (res *v1.TFinCommissionDetailDeleteRes, err error) + TFinCommissionDetailGetCommissionOverview(ctx context.Context, req *v1.TFinCommissionDetailGetCommissionOverviewReq) (res *v1.TFinCommissionDetailGetCommissionOverviewRes, err error) + TFinCommissionDetailGetLevelSummary(ctx context.Context, req *v1.TFinCommissionDetailGetLevelSummaryReq) (res *v1.TFinCommissionDetailGetLevelSummaryRes, err error) + TFinWithdrawableChangeList(ctx context.Context, req *v1.TFinWithdrawableChangeListReq) (res *v1.TFinWithdrawableChangeListRes, err error) + TFinWithdrawableChangeExport(ctx context.Context, req *v1.TFinWithdrawableChangeExportReq) (res *v1.TFinWithdrawableChangeExportRes, err error) + TFinWithdrawableChangeView(ctx context.Context, req *v1.TFinWithdrawableChangeViewReq) (res *v1.TFinWithdrawableChangeViewRes, err error) + TFinWithdrawableChangeEdit(ctx context.Context, req *v1.TFinWithdrawableChangeEditReq) (res *v1.TFinWithdrawableChangeEditRes, err error) + TFinWithdrawableChangeDelete(ctx context.Context, req *v1.TFinWithdrawableChangeDeleteReq) (res *v1.TFinWithdrawableChangeDeleteRes, err error) + TMessageLogList(ctx context.Context, req *v1.TMessageLogListReq) (res *v1.TMessageLogListRes, err error) + TMessageLogExport(ctx context.Context, req *v1.TMessageLogExportReq) (res *v1.TMessageLogExportRes, err error) + TMessageLogView(ctx context.Context, req *v1.TMessageLogViewReq) (res *v1.TMessageLogViewRes, err error) + TMessageLogEdit(ctx context.Context, req *v1.TMessageLogEditReq) (res *v1.TMessageLogEditRes, err error) + TMessageLogDelete(ctx context.Context, req *v1.TMessageLogDeleteReq) (res *v1.TMessageLogDeleteRes, err error) + TNotifyLogList(ctx context.Context, req *v1.TNotifyLogListReq) (res *v1.TNotifyLogListRes, err error) + TNotifyLogExport(ctx context.Context, req *v1.TNotifyLogExportReq) (res *v1.TNotifyLogExportRes, err error) + TNotifyLogView(ctx context.Context, req *v1.TNotifyLogViewReq) (res *v1.TNotifyLogViewRes, err error) + TNotifyLogEdit(ctx context.Context, req *v1.TNotifyLogEditReq) (res *v1.TNotifyLogEditRes, err error) + TNotifyLogDelete(ctx context.Context, req *v1.TNotifyLogDeleteReq) (res *v1.TNotifyLogDeleteRes, err error) + TProfitAccountMonthBillList(ctx context.Context, req *v1.TProfitAccountMonthBillListReq) (res *v1.TProfitAccountMonthBillListRes, err error) + TProfitAccountMonthBillExport(ctx context.Context, req *v1.TProfitAccountMonthBillExportReq) (res *v1.TProfitAccountMonthBillExportRes, err error) + TProfitAccountMonthBillView(ctx context.Context, req *v1.TProfitAccountMonthBillViewReq) (res *v1.TProfitAccountMonthBillViewRes, err error) + TProfitAccountMonthBillEdit(ctx context.Context, req *v1.TProfitAccountMonthBillEditReq) (res *v1.TProfitAccountMonthBillEditRes, err error) + TProfitAccountMonthBillDelete(ctx context.Context, req *v1.TProfitAccountMonthBillDeleteReq) (res *v1.TProfitAccountMonthBillDeleteRes, err error) + TProfitAccountMonthBillSettle(ctx context.Context, req *v1.TProfitAccountMonthBillSettleReq) (res *v1.TProfitAccountMonthBillSettleRes, err error) + TProfitAccountMonthBillGetProfitBillSummary(ctx context.Context, req *v1.TProfitAccountMonthBillGetProfitBillSummaryReq) (res *v1.TProfitAccountMonthBillGetProfitBillSummaryRes, err error) + TProfitAccountMonthBillGetCoreFinancialData(ctx context.Context, req *v1.TProfitAccountMonthBillGetCoreFinancialDataReq) (res *v1.TProfitAccountMonthBillGetCoreFinancialDataRes, err error) + TProfitAccountMonthBillGetFinancialTrend(ctx context.Context, req *v1.TProfitAccountMonthBillGetFinancialTrendReq) (res *v1.TProfitAccountMonthBillGetFinancialTrendRes, err error) + TWoCommunicationList(ctx context.Context, req *v1.TWoCommunicationListReq) (res *v1.TWoCommunicationListRes, err error) + TWoCommunicationExport(ctx context.Context, req *v1.TWoCommunicationExportReq) (res *v1.TWoCommunicationExportRes, err error) + TWoCommunicationView(ctx context.Context, req *v1.TWoCommunicationViewReq) (res *v1.TWoCommunicationViewRes, err error) + TWoCommunicationEdit(ctx context.Context, req *v1.TWoCommunicationEditReq) (res *v1.TWoCommunicationEditRes, err error) + TWoCommunicationMessage(ctx context.Context, req *v1.TWoCommunicationMessageReq) (res *v1.TWoCommunicationMessageRes, err error) + TWoCommunicationDelete(ctx context.Context, req *v1.TWoCommunicationDeleteReq) (res *v1.TWoCommunicationDeleteRes, err error) + TWoMainList(ctx context.Context, req *v1.TWoMainListReq) (res *v1.TWoMainListRes, err error) + TWoMainExport(ctx context.Context, req *v1.TWoMainExportReq) (res *v1.TWoMainExportRes, err error) + TWoMainView(ctx context.Context, req *v1.TWoMainViewReq) (res *v1.TWoMainViewRes, err error) + TWoMainEdit(ctx context.Context, req *v1.TWoMainEditReq) (res *v1.TWoMainEditRes, err error) + TWoMainTransfer(ctx context.Context, req *v1.TWoMainTransferReq) (res *v1.TWoMainTransferRes, err error) + TWoMainResolve(ctx context.Context, req *v1.TWoMainResolveReq) (res *v1.TWoMainResolveRes, err error) + TWoMainCancel(ctx context.Context, req *v1.TWoMainCancelReq) (res *v1.TWoMainCancelRes, err error) + TWoMainClose(ctx context.Context, req *v1.TWoMainCloseReq) (res *v1.TWoMainCloseRes, err error) + TWoMainEvaluate(ctx context.Context, req *v1.TWoMainEvaluateReq) (res *v1.TWoMainEvaluateRes, err error) + TWoMainDelete(ctx context.Context, req *v1.TWoMainDeleteReq) (res *v1.TWoMainDeleteRes, err error) + TWoRecordList(ctx context.Context, req *v1.TWoRecordListReq) (res *v1.TWoRecordListRes, err error) + TWoRecordExport(ctx context.Context, req *v1.TWoRecordExportReq) (res *v1.TWoRecordExportRes, err error) + TWoRecordView(ctx context.Context, req *v1.TWoRecordViewReq) (res *v1.TWoRecordViewRes, err error) + TWoRecordEdit(ctx context.Context, req *v1.TWoRecordEditReq) (res *v1.TWoRecordEditRes, err error) + TWoRecordDelete(ctx context.Context, req *v1.TWoRecordDeleteReq) (res *v1.TWoRecordDeleteRes, err error) + SysOssUpload(ctx context.Context, req *v1.SysOssUploadReq) (res *v1.SysOssUploadRes, err error) + SysOssDownload(ctx context.Context, req *v1.SysOssDownloadReq) (res *v1.SysOssDownloadRes, err error) +} diff --git a/server/api/common/v1/batchexecutionlog.go b/server/api/common/v1/batchexecutionlog.go new file mode 100644 index 0000000..f8b9588 --- /dev/null +++ b/server/api/common/v1/batchexecutionlog.go @@ -0,0 +1,37 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type BatchExecutionLogListReq struct { + g.Meta `path:"/batchExecutionLog/list" method:"get" tags:"执行日志" summary:"获取执行日志列表" x-check-permission:"cpm:common:batchExecutionLog:list"` + model.BatchExecutionLogListParam +} + +type BatchExecutionLogListRes struct { + response.PageResult + Items []*model.BatchExecutionLogListModel `json:"items" dc:"数据列表"` +} + +type BatchExecutionLogSummaryReq struct { + g.Meta `path:"/batchExecutionLog/summary" method:"get" tags:"执行日志" summary:"获取执行日志概要" x-check-permission:"cpm:common:batchExecutionLog:summary"` + model.BatchExecutionLogDetailParam +} + +type BatchExecutionLogSummaryRes struct { + *model.BatchExecutionLogDetailModel +} + +type BatchExecutionLogDetailListReq struct { + g.Meta `path:"/batchExecutionLog/detailList" method:"get" tags:"执行日志" summary:"获取执行日志明细列表" x-check-permission:"cpm:common:batchExecutionLog:detailList"` + model.BatchDetailListParam +} + +type BatchExecutionLogDetailListRes struct { + response.PageResult + Items []*model.BatchDetailListModel `json:"items" dc:"数据列表"` +} diff --git a/server/api/common/v1/batchmain.go b/server/api/common/v1/batchmain.go new file mode 100644 index 0000000..049651a --- /dev/null +++ b/server/api/common/v1/batchmain.go @@ -0,0 +1,88 @@ +// Package batchmain +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //batchmain + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询批次主表列表 +type BatchMainListReq struct { + g.Meta `path:"/batchMain/list" method:"get" tags:"批次主表" summary:"获取批次主表列表" x-check-permission:"cpm:common:batchMain:list"` + model.BatchMainListParam +} + +type BatchMainListRes struct { + response.PageResult + Items []*model.BatchMainListModel `json:"items" dc:"数据列表"` +} + +type BatchMainSuccessListReq struct { + g.Meta `path:"/batchMain/successList" method:"get" tags:"批次主表" summary:"获取成功批次列表" x-check-permission:"cpm:common:batchMain:successList"` + model.BatchMainSuccessListParam +} + +type BatchMainSuccessListRes struct { + response.PageResult + Items []*model.BatchMainSuccessListModel `json:"items" dc:"数据列表"` +} + +type BatchMainCardsReq struct { + g.Meta `path:"/batchMain/cards" method:"get" tags:"批次主表" summary:"批次卡清单" x-check-permission:"cpm:common:batchMain:cards"` + model.BatchCardListParam +} + +type BatchMainCardsRes struct { + response.PageResult + Items []*model.BatchCardListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出批次主表列表 +type BatchMainExportReq struct { + g.Meta `path:"/batchMain/export" method:"post" tags:"批次主表" summary:"导出批次主表列表" x-check-permission:"cpm:common:batchMain:export"` + model.BatchMainListParam +} + +type BatchMainExportRes struct{} + +// ViewReq 获取批次主表指定信息 +type BatchMainViewReq struct { + g.Meta `path:"/batchMain/view" method:"get" tags:"批次主表" summary:"获取批次主表指定信息" x-check-permission:"cpm:common:batchMain:view"` + model.BatchMainViewParam +} + +type BatchMainViewRes struct { + *model.BatchMainViewModel +} + +// EditReq 修改/新增批次主表 +type BatchMainEditReq struct { + g.Meta `path:"/batchMain/edit" method:"post" tags:"批次主表" summary:"修改/新增批次主表" x-check-permission:"cpm:common:batchMain:edit"` + model.BatchMainEditParam +} + +type BatchMainEditRes struct{} + +// DeleteReq 删除批次主表 +type BatchMainDeleteReq struct { + g.Meta `path:"/batchMain/delete" method:"post" tags:"批次主表" summary:"删除批次主表" x-check-permission:"cpm:common:batchMain:delete"` + model.BatchMainDeleteParam +} + +type BatchMainDeleteRes struct{} + +type BatchMainRequeueReq struct { + g.Meta `path:"/batchMain/requeue" method:"post" tags:"批次主表" summary:"安全重投批次执行消息" x-check-permission:"cpm:common:batchMain:requeue"` + model.BatchMainRequeueParam +} + +type BatchMainRequeueRes struct { + *model.BatchMainRequeueModel +} diff --git a/server/api/common/v1/tagentbalance.go b/server/api/common/v1/tagentbalance.go new file mode 100644 index 0000000..8ca468e --- /dev/null +++ b/server/api/common/v1/tagentbalance.go @@ -0,0 +1,114 @@ +// Package tagentbalance +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tagentbalance + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询企业客户财务信息列表 +type TAgentBalanceListReq struct { + g.Meta `path:"/tAgentBalance/list" method:"get" tags:"企业客户财务信息" summary:"获取企业客户财务信息列表" x-check-permission:"cpm:gen:tAgentBalance:list"` + model.TAgentBalanceListParam +} + +type TAgentBalanceListRes struct { + response.PageResult + Items []*model.TAgentBalanceListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出企业客户财务信息列表 +type TAgentBalanceExportReq struct { + g.Meta `path:"/tAgentBalance/export" method:"post" tags:"企业客户财务信息" summary:"导出企业客户财务信息列表" x-check-permission:"cpm:common:tAgentBalance:export"` + model.TAgentBalanceListParam +} + +type TAgentBalanceExportRes struct{} + +// ViewReq 获取企业客户财务信息指定信息 +type TAgentBalanceViewReq struct { + g.Meta `path:"/tAgentBalance/view" method:"get" tags:"企业客户财务信息" summary:"获取企业客户财务信息指定信息" x-check-permission:"cpm:common:tAgentBalance:view"` + model.TAgentBalanceViewParam +} + +type TAgentBalanceViewRes struct { + *model.TAgentBalanceViewModel +} + +// EditReq 修改/新增企业客户财务信息 +type TAgentBalanceEditReq struct { + g.Meta `path:"/tAgentBalance/edit" method:"post" tags:"企业客户财务信息" summary:"修改/新增企业客户财务信息" x-check-permission:"cpm:common:tAgentBalance:edit"` + model.TAgentBalanceEditParam +} + +type TAgentBalanceEditRes struct{} + +// DeleteReq 删除企业客户财务信息 +type TAgentBalanceDeleteReq struct { + g.Meta `path:"/tAgentBalance/delete" method:"post" tags:"企业客户财务信息" summary:"删除企业客户财务信息" x-check-permission:"cpm:common:tAgentBalance:delete"` + model.TAgentBalanceDeleteParam +} + +type TAgentBalanceDeleteRes struct{} + +// StatusReq 更新企业客户财务信息状态 +type TAgentBalanceStatusReq struct { + g.Meta `path:"/tAgentBalance/status" method:"post" tags:"企业客户财务信息" summary:"更新企业客户财务信息状态" x-check-permission:"cpm:common:tAgentBalance:status"` + model.TAgentBalanceStatusParam +} + +type TAgentBalanceStatusRes struct{} + +type TAgentBalanceAccountTrendReq struct { + g.Meta `path:"/tAgentBalance/accountTrend" method:"get" tags:"企业客户财务信息" summary:"获取账户总览折线图" x-check-permission:"cpm:common:tAgentBalance:accountTrend"` + model.TAgentBalanceTrendParam +} + +type TAgentBalanceAccountTrendRes struct { + *model.TAgentBalanceChartData +} + +type TAgentBalanceGetAccountBalanceReq struct { + g.Meta `path:"/tAgentBalance/getAccountBalance" method:"get" tags:"企业客户财务信息" summary:"获取当前登录企业账户余额" x-check-permission:"cpm:common:tAgentBalance:getAccountBalance"` + model.TAgentBalanceTrendParam +} + +type TAgentBalanceGetAccountBalanceRes struct { + *model.TAgentBalanceChartData +} + +// BalanceTransferApplyReq 发起余额转可提现申请 +type TAgentBalanceBalanceTransferApplyReq struct { + g.Meta `path:"/tAgentBalance/balanceTransferApply" method:"post" tags:"企业客户财务信息" summary:"发起余额转可提现申请" x-check-permission:"cpm:common:tAgentBalance:balanceTransferApply"` + model.TAgentBalanceTransferApplyParam +} + +type TAgentBalanceBalanceTransferApplyRes struct { + *model.TAgentBalanceTransferApplyModel `json:"data,omitempty"` +} + +// BalanceTransferAuditReq 审核余额转可提现申请 +type TAgentBalanceBalanceTransferAuditReq struct { + g.Meta `path:"/tAgentBalance/balanceTransferAudit" method:"post" tags:"企业客户财务信息" summary:"审核余额转可提现申请" x-check-permission:"cpm:common:tAgentBalance:balanceTransferAudit"` + model.TAgentBalanceTransferAuditParam +} + +type TAgentBalanceBalanceTransferAuditRes struct{} + +// TAgentBalanceSettleCommissionReq 按账期区间结算分润 +type TAgentBalanceSettleCommissionReq struct { + g.Meta `path:"/tAgentBalance/settleCommission" method:"post" tags:"企业客户财务信息" summary:"按账期区间结算分润" x-check-permission:"cpm:common:tAgentBalance:settleCommission"` + StartPeriod string `json:"startPeriod" v:"required#开始账期不能为空" dc:"开始账期,格式YYYY-MM"` + EndPeriod string `json:"endPeriod" v:"required#结束账期不能为空" dc:"结束账期,格式YYYY-MM"` +} + +type TAgentBalanceSettleCommissionRes struct { + *model.TAgentBalanceCommissionSettlementResult +} diff --git a/server/api/common/v1/tbalancedetail.go b/server/api/common/v1/tbalancedetail.go new file mode 100644 index 0000000..35feba1 --- /dev/null +++ b/server/api/common/v1/tbalancedetail.go @@ -0,0 +1,59 @@ +// Package tbalancedetail +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tbalancedetail + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询余额明细表列表 +type TBalanceDetailListReq struct { + g.Meta `path:"/tBalanceDetail/list" method:"get" tags:"余额明细表" summary:"获取余额明细表列表" x-check-permission:"cpm:common:tBalanceDetail:list"` + model.TBalanceDetailListParam +} + +type TBalanceDetailListRes struct { + response.PageResult + Items []*model.TBalanceDetailListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出余额明细表列表 +type TBalanceDetailExportReq struct { + g.Meta `path:"/tBalanceDetail/export" method:"post" tags:"余额明细表" summary:"导出余额明细表列表" x-check-permission:"cpm:common:tBalanceDetail:export"` + model.TBalanceDetailListParam +} + +type TBalanceDetailExportRes struct{} + +// ViewReq 获取余额明细表指定信息 +type TBalanceDetailViewReq struct { + g.Meta `path:"/tBalanceDetail/view" method:"get" tags:"余额明细表" summary:"获取余额明细表指定信息" x-check-permission:"cpm:common:tBalanceDetail:view"` + model.TBalanceDetailViewParam +} + +type TBalanceDetailViewRes struct { + *model.TBalanceDetailViewModel +} + +// EditReq 修改/新增余额明细表 +type TBalanceDetailEditReq struct { + g.Meta `path:"/tBalanceDetail/edit" method:"post" tags:"余额明细表" summary:"修改/新增余额明细表" x-check-permission:"cpm:common:tBalanceDetail:edit"` + model.TBalanceDetailEditParam +} + +type TBalanceDetailEditRes struct{} + +// DeleteReq 删除余额明细表 +type TBalanceDetailDeleteReq struct { + g.Meta `path:"/tBalanceDetail/delete" method:"post" tags:"余额明细表" summary:"删除余额明细表" x-check-permission:"cpm:common:tBalanceDetail:delete"` + model.TBalanceDetailDeleteParam +} + +type TBalanceDetailDeleteRes struct{} diff --git a/server/api/common/v1/tconsumeaccountmonthbill.go b/server/api/common/v1/tconsumeaccountmonthbill.go new file mode 100644 index 0000000..041d810 --- /dev/null +++ b/server/api/common/v1/tconsumeaccountmonthbill.go @@ -0,0 +1,79 @@ +// Package tconsumeaccountmonthbill +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tconsumeaccountmonthbill + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询消费账户月账单表列表 +type TConsumeAccountMonthBillListReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/list" method:"get" tags:"消费账户月账单表" summary:"获取消费账户月账单表列表" x-check-permission:"cpm:common:tConsumeAccountMonthBill:list"` + model.TConsumeAccountMonthBillListParam +} + +type TConsumeAccountMonthBillListRes struct { + response.PageResult + Items []*model.TConsumeAccountMonthBillListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出消费账户月账单表列表 +type TConsumeAccountMonthBillExportReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/export" method:"post" tags:"消费账户月账单表" summary:"导出消费账户月账单表列表" x-check-permission:"cpm:common:tConsumeAccountMonthBill:export"` + model.TConsumeAccountMonthBillListParam +} + +type TConsumeAccountMonthBillExportRes struct{} + +// ViewReq 获取消费账户月账单表指定信息 +type TConsumeAccountMonthBillViewReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/view" method:"get" tags:"消费账户月账单表" summary:"获取消费账户月账单表指定信息" x-check-permission:"cpm:common:tConsumeAccountMonthBill:view"` + model.TConsumeAccountMonthBillViewParam +} + +type TConsumeAccountMonthBillViewRes struct { + *model.TConsumeAccountMonthBillViewModel +} + +// EditReq 修改/新增消费账户月账单表 +type TConsumeAccountMonthBillEditReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/edit" method:"post" tags:"消费账户月账单表" summary:"修改/新增消费账户月账单表" x-check-permission:"cpm:common:tConsumeAccountMonthBill:edit"` + model.TConsumeAccountMonthBillEditParam +} + +type TConsumeAccountMonthBillEditRes struct{} + +// DeleteReq 删除消费账户月账单表 +type TConsumeAccountMonthBillDeleteReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/delete" method:"post" tags:"消费账户月账单表" summary:"删除消费账户月账单表" x-check-permission:"cpm:common:tConsumeAccountMonthBill:delete"` + model.TConsumeAccountMonthBillDeleteParam +} + +type TConsumeAccountMonthBillDeleteRes struct{} + +// SettleReq 按账期统计消费账户月账单 +type TConsumeAccountMonthBillSettleReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/settle" method:"post" tags:"消费账户月账单表" summary:"统计并写入消费账户月账单" x-permission:"cpm:common:tConsumeAccountMonthBill:settle"` + model.TConsumeAccountMonthBillSettleParam +} + +type TConsumeAccountMonthBillSettleRes struct { + *model.TConsumeAccountMonthBillSettleResult +} + +// GetConsumptionBillSummaryReq 获取上月消费账单汇总信息 +type TConsumeAccountMonthBillGetConsumptionBillSummaryReq struct { + g.Meta `path:"/tConsumeAccountMonthBill/getConsumptionBillSummary" method:"get" tags:"消费账户月账单表" summary:"获取上月消费账单汇总信息" x-permission:"cpm:common:tConsumeAccountMonthBill:getConsumptionBillSummary"` + Month string `json:"month" v:"required|length:7,7" dc:"账期,格式:YYYY-MM"` +} + +type TConsumeAccountMonthBillGetConsumptionBillSummaryRes struct { + *model.TConsumptionBillSummaryModel +} diff --git a/server/api/common/v1/tcreditdetail.go b/server/api/common/v1/tcreditdetail.go new file mode 100644 index 0000000..a0897c7 --- /dev/null +++ b/server/api/common/v1/tcreditdetail.go @@ -0,0 +1,59 @@ +// Package tcreditdetail +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tcreditdetail + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询信用额度明细表列表 +type TCreditDetailListReq struct { + g.Meta `path:"/tCreditDetail/list" method:"get" tags:"信用额度明细表" summary:"获取信用额度明细表列表" x-check-permission:"cpm:common:tCreditDetail:list"` + model.TCreditDetailListParam +} + +type TCreditDetailListRes struct { + response.PageResult + Items []*model.TCreditDetailListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出信用额度明细表列表 +type TCreditDetailExportReq struct { + g.Meta `path:"/tCreditDetail/export" method:"post" tags:"信用额度明细表" summary:"导出信用额度明细表列表" x-check-permission:"cpm:common:tCreditDetail:export"` + model.TCreditDetailListParam +} + +type TCreditDetailExportRes struct{} + +// ViewReq 获取信用额度明细表指定信息 +type TCreditDetailViewReq struct { + g.Meta `path:"/tCreditDetail/view" method:"get" tags:"信用额度明细表" summary:"获取信用额度明细表指定信息" x-check-permission:"cpm:common:tCreditDetail:view"` + model.TCreditDetailViewParam +} + +type TCreditDetailViewRes struct { + *model.TCreditDetailViewModel +} + +// EditReq 修改/新增信用额度明细表 +type TCreditDetailEditReq struct { + g.Meta `path:"/tCreditDetail/edit" method:"post" tags:"信用额度明细表" summary:"修改/新增信用额度明细表" x-check-permission:"cpm:common:tCreditDetail:edit"` + model.TCreditDetailEditParam +} + +type TCreditDetailEditRes struct{} + +// DeleteReq 删除信用额度明细表 +type TCreditDetailDeleteReq struct { + g.Meta `path:"/tCreditDetail/delete" method:"post" tags:"信用额度明细表" summary:"删除信用额度明细表" x-check-permission:"cpm:common:tCreditDetail:delete"` + model.TCreditDetailDeleteParam +} + +type TCreditDetailDeleteRes struct{} diff --git a/server/api/common/v1/tdivisioncode.go b/server/api/common/v1/tdivisioncode.go new file mode 100644 index 0000000..a83682d --- /dev/null +++ b/server/api/common/v1/tdivisioncode.go @@ -0,0 +1,59 @@ +// Package tdivisioncode +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @Autoioterate Version +package v1 //tdivisioncode + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询村级行政区划表列表 +type TDivisionCodeListReq struct { + g.Meta `path:"/tDivisionCode/list" method:"get" tags:"村级行政区划表" summary:"获取村级行政区划表列表" x-check-permission:"cpm:iot:tDivisionCode:list"` + model.TDivisionCodeListParam +} + +type TDivisionCodeListRes struct { + response.PageResult + Items []*model.TDivisionCodeListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出村级行政区划表列表 +type TDivisionCodeExportReq struct { + g.Meta `path:"/tDivisionCode/export" method:"post" tags:"村级行政区划表" summary:"导出村级行政区划表列表" x-check-permission:"cpm:iot:tDivisionCode:export"` + model.TDivisionCodeListParam +} + +type TDivisionCodeExportRes struct{} + +// ViewReq 获取村级行政区划表指定信息 +type TDivisionCodeViewReq struct { + g.Meta `path:"/tDivisionCode/view" method:"get" tags:"村级行政区划表" summary:"获取村级行政区划表指定信息" x-check-permission:"cpm:iot:tDivisionCode:view"` + model.TDivisionCodeViewParam +} + +type TDivisionCodeViewRes struct { + *model.TDivisionCodeViewModel +} + +// EditReq 修改/新增村级行政区划表 +type TDivisionCodeEditReq struct { + g.Meta `path:"/tDivisionCode/edit" method:"post" tags:"村级行政区划表" summary:"修改/新增村级行政区划表" x-check-permission:"cpm:iot:tDivisionCode:edit"` + model.TDivisionCodeEditParam +} + +type TDivisionCodeEditRes struct{} + +// DeleteReq 删除村级行政区划表 +type TDivisionCodeDeleteReq struct { + g.Meta `path:"/tDivisionCode/delete" method:"post" tags:"村级行政区划表" summary:"删除村级行政区划表" x-check-permission:"cpm:iot:tDivisionCode:delete"` + model.TDivisionCodeDeleteParam +} + +type TDivisionCodeDeleteRes struct{} diff --git a/server/api/common/v1/tfinanceapply.go b/server/api/common/v1/tfinanceapply.go new file mode 100644 index 0000000..667f142 --- /dev/null +++ b/server/api/common/v1/tfinanceapply.go @@ -0,0 +1,59 @@ +// Package tfinanceapply +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tfinanceapply + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询财务申请表列表 +type TFinanceApplyListReq struct { + g.Meta `path:"/tFinanceApply/list" method:"get" tags:"财务申请表" summary:"获取财务申请表列表" x-check-permission:"cpm:gen:tFinanceApply:list"` + model.TFinanceApplyListParam +} + +type TFinanceApplyListRes struct { + response.PageResult + Items []*model.TFinanceApplyListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出财务申请表列表 +type TFinanceApplyExportReq struct { + g.Meta `path:"/tFinanceApply/export" method:"post" tags:"财务申请表" summary:"导出财务申请表列表" x-check-permission:"cpm:common:tFinanceApply:export"` + model.TFinanceApplyListParam +} + +type TFinanceApplyExportRes struct{} + +// ViewReq 获取财务申请表指定信息 +type TFinanceApplyViewReq struct { + g.Meta `path:"/tFinanceApply/view" method:"get" tags:"财务申请表" summary:"获取财务申请表指定信息" x-check-permission:"cpm:common:tFinanceApply:view"` + model.TFinanceApplyViewParam +} + +type TFinanceApplyViewRes struct { + *model.TFinanceApplyViewModel +} + +// EditReq 修改/新增财务申请表 +type TFinanceApplyEditReq struct { + g.Meta `path:"/tFinanceApply/edit" method:"post" tags:"财务申请表" summary:"修改/新增财务申请表" x-check-permission:"cpm:common:tFinanceApply:edit"` + model.TFinanceApplyEditParam +} + +type TFinanceApplyEditRes struct{} + +// DeleteReq 删除财务申请表 +type TFinanceApplyDeleteReq struct { + g.Meta `path:"/tFinanceApply/delete" method:"post" tags:"财务申请表" summary:"删除财务申请表" x-check-permission:"cpm:common:tFinanceApply:delete"` + model.TFinanceApplyDeleteParam +} + +type TFinanceApplyDeleteRes struct{} diff --git a/server/api/common/v1/tfinanceauditrecord.go b/server/api/common/v1/tfinanceauditrecord.go new file mode 100644 index 0000000..6a3a721 --- /dev/null +++ b/server/api/common/v1/tfinanceauditrecord.go @@ -0,0 +1,59 @@ +// Package tfinanceauditrecord +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tfinanceauditrecord + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询财务审核记录表列表 +type TFinanceAuditRecordListReq struct { + g.Meta `path:"/tFinanceAuditRecord/list" method:"get" tags:"财务审核记录表" summary:"获取财务审核记录表列表" x-check-permission:"cpm:gen:tFinanceAuditRecord:list"` + model.TFinanceAuditRecordListParam +} + +type TFinanceAuditRecordListRes struct { + response.PageResult + Items []*model.TFinanceAuditRecordListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出财务审核记录表列表 +type TFinanceAuditRecordExportReq struct { + g.Meta `path:"/tFinanceAuditRecord/export" method:"post" tags:"财务审核记录表" summary:"导出财务审核记录表列表" x-check-permission:"cpm:common:tFinanceAuditRecord:export"` + model.TFinanceAuditRecordListParam +} + +type TFinanceAuditRecordExportRes struct{} + +// ViewReq 获取财务审核记录表指定信息 +type TFinanceAuditRecordViewReq struct { + g.Meta `path:"/tFinanceAuditRecord/view" method:"get" tags:"财务审核记录表" summary:"获取财务审核记录表指定信息" x-check-permission:"cpm:common:tFinanceAuditRecord:view"` + model.TFinanceAuditRecordViewParam +} + +type TFinanceAuditRecordViewRes struct { + *model.TFinanceAuditRecordViewModel +} + +// EditReq 修改/新增财务审核记录表 +type TFinanceAuditRecordEditReq struct { + g.Meta `path:"/tFinanceAuditRecord/edit" method:"post" tags:"财务审核记录表" summary:"修改/新增财务审核记录表" x-check-permission:"cpm:common:tFinanceAuditRecord:edit"` + model.TFinanceAuditRecordEditParam +} + +type TFinanceAuditRecordEditRes struct{} + +// DeleteReq 删除财务审核记录表 +type TFinanceAuditRecordDeleteReq struct { + g.Meta `path:"/tFinanceAuditRecord/delete" method:"post" tags:"财务审核记录表" summary:"删除财务审核记录表" x-check-permission:"cpm:common:tFinanceAuditRecord:delete"` + model.TFinanceAuditRecordDeleteParam +} + +type TFinanceAuditRecordDeleteRes struct{} diff --git a/server/api/common/v1/tfincommissiondetail.go b/server/api/common/v1/tfincommissiondetail.go new file mode 100644 index 0000000..9ebb1f8 --- /dev/null +++ b/server/api/common/v1/tfincommissiondetail.go @@ -0,0 +1,79 @@ +// Package tfincommissiondetail +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tfincommissiondetail + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询分润明细表列表 +type TFinCommissionDetailListReq struct { + g.Meta `path:"/tFinCommissionDetail/list" method:"get" tags:"分润明细表" summary:"获取分润明细表列表" x-check-permission:"cpm:common:tFinCommissionDetail:list"` + model.TFinCommissionDetailListParam +} + +type TFinCommissionDetailListRes struct { + response.PageResult + Items []*model.TFinCommissionDetailListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出分润明细表列表 +type TFinCommissionDetailExportReq struct { + g.Meta `path:"/tFinCommissionDetail/export" method:"post" tags:"分润明细表" summary:"导出分润明细表列表" x-check-permission:"cpm:common:tFinCommissionDetail:export"` + model.TFinCommissionDetailListParam +} + +type TFinCommissionDetailExportRes struct{} + +// ViewReq 获取分润明细表指定信息 +type TFinCommissionDetailViewReq struct { + g.Meta `path:"/tFinCommissionDetail/view" method:"get" tags:"分润明细表" summary:"获取分润明细表指定信息" x-check-permission:"cpm:common:tFinCommissionDetail:view"` + model.TFinCommissionDetailViewParam +} + +type TFinCommissionDetailViewRes struct { + *model.TFinCommissionDetailViewModel +} + +// EditReq 修改/新增分润明细表 +type TFinCommissionDetailEditReq struct { + g.Meta `path:"/tFinCommissionDetail/edit" method:"post" tags:"分润明细表" summary:"修改/新增分润明细表" x-check-permission:"cpm:common:tFinCommissionDetail:edit"` + model.TFinCommissionDetailEditParam +} + +type TFinCommissionDetailEditRes struct{} + +// DeleteReq 删除分润明细表 +type TFinCommissionDetailDeleteReq struct { + g.Meta `path:"/tFinCommissionDetail/delete" method:"post" tags:"分润明细表" summary:"删除分润明细表" x-check-permission:"cpm:common:tFinCommissionDetail:delete"` + model.TFinCommissionDetailDeleteParam +} + +type TFinCommissionDetailDeleteRes struct{} + +// GetCommissionOverviewReq 获取分层分润概览 +type TFinCommissionDetailGetCommissionOverviewReq struct { + g.Meta `path:"/tFinCommissionDetail/getCommissionOverview" method:"get" tags:"分润明细表" summary:"获取分层分润概览" x-check-permission:"cpm:common:tFinCommissionDetail:getCommissionOverview"` + model.TCommissionOverviewParam +} + +type TFinCommissionDetailGetCommissionOverviewRes struct { + *model.TCommissionOverviewModel +} + +// GetLevelSummaryReq 获取层级汇总表 +type TFinCommissionDetailGetLevelSummaryReq struct { + g.Meta `path:"/tFinCommissionDetail/getLevelSummary" method:"get" tags:"分润明细表" summary:"获取层级汇总表" x-permission:"cpm:common:tFinCommissionDetail:getLevelSummary"` + model.TLevelSummaryParam +} + +type TFinCommissionDetailGetLevelSummaryRes struct { + *model.TLevelSummaryModel +} diff --git a/server/api/common/v1/tfinwithdrawablechange.go b/server/api/common/v1/tfinwithdrawablechange.go new file mode 100644 index 0000000..7b78bc5 --- /dev/null +++ b/server/api/common/v1/tfinwithdrawablechange.go @@ -0,0 +1,59 @@ +// Package tfinwithdrawablechange +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tfinwithdrawablechange + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询可提现变动明细表列表 +type TFinWithdrawableChangeListReq struct { + g.Meta `path:"/tFinWithdrawableChange/list" method:"get" tags:"可提现变动明细表" summary:"获取可提现变动明细表列表" x-check-permission:"cpm:common:tFinWithdrawableChange:list"` + model.TFinWithdrawableChangeListParam +} + +type TFinWithdrawableChangeListRes struct { + response.PageResult + Items []*model.TFinWithdrawableChangeListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出可提现变动明细表列表 +type TFinWithdrawableChangeExportReq struct { + g.Meta `path:"/tFinWithdrawableChange/export" method:"post" tags:"可提现变动明细表" summary:"导出可提现变动明细表列表" x-check-permission:"cpm:common:tFinWithdrawableChange:export"` + model.TFinWithdrawableChangeListParam +} + +type TFinWithdrawableChangeExportRes struct{} + +// ViewReq 获取可提现变动明细表指定信息 +type TFinWithdrawableChangeViewReq struct { + g.Meta `path:"/tFinWithdrawableChange/view" method:"get" tags:"可提现变动明细表" summary:"获取可提现变动明细表指定信息" x-check-permission:"cpm:common:tFinWithdrawableChange:view"` + model.TFinWithdrawableChangeViewParam +} + +type TFinWithdrawableChangeViewRes struct { + *model.TFinWithdrawableChangeViewModel +} + +// EditReq 修改/新增可提现变动明细表 +type TFinWithdrawableChangeEditReq struct { + g.Meta `path:"/tFinWithdrawableChange/edit" method:"post" tags:"可提现变动明细表" summary:"修改/新增可提现变动明细表" x-check-permission:"cpm:common:tFinWithdrawableChange:edit"` + model.TFinWithdrawableChangeEditParam +} + +type TFinWithdrawableChangeEditRes struct{} + +// DeleteReq 删除可提现变动明细表 +type TFinWithdrawableChangeDeleteReq struct { + g.Meta `path:"/tFinWithdrawableChange/delete" method:"post" tags:"可提现变动明细表" summary:"删除可提现变动明细表" x-check-permission:"cpm:common:tFinWithdrawableChange:delete"` + model.TFinWithdrawableChangeDeleteParam +} + +type TFinWithdrawableChangeDeleteRes struct{} diff --git a/server/api/common/v1/tmessagelog.go b/server/api/common/v1/tmessagelog.go new file mode 100644 index 0000000..1f1f956 --- /dev/null +++ b/server/api/common/v1/tmessagelog.go @@ -0,0 +1,59 @@ +// Package tmessagelog +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tmessagelog + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询消息日志列表 +type TMessageLogListReq struct { + g.Meta `path:"/tMessageLog/list" method:"get" tags:"消息日志" summary:"获取消息日志列表" x-check-permission:"cpm:common:tMessageLog:list"` + model.TMessageLogListParam +} + +type TMessageLogListRes struct { + response.PageResult + Items []*model.TMessageLogListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出消息日志列表 +type TMessageLogExportReq struct { + g.Meta `path:"/tMessageLog/export" method:"post" tags:"消息日志" summary:"导出消息日志列表" x-check-permission:"cpm:common:tMessageLog:export"` + model.TMessageLogListParam +} + +type TMessageLogExportRes struct{} + +// ViewReq 获取消息日志指定信息 +type TMessageLogViewReq struct { + g.Meta `path:"/tMessageLog/view" method:"get" tags:"消息日志" summary:"获取消息日志指定信息" x-check-permission:"cpm:common:tMessageLog:view"` + model.TMessageLogViewParam +} + +type TMessageLogViewRes struct { + *model.TMessageLogViewModel +} + +// EditReq 修改/新增消息日志 +type TMessageLogEditReq struct { + g.Meta `path:"/tMessageLog/edit" method:"post" tags:"消息日志" summary:"修改/新增消息日志" x-check-permission:"cpm:common:tMessageLog:edit"` + model.TMessageLogEditParam +} + +type TMessageLogEditRes struct{} + +// DeleteReq 删除消息日志 +type TMessageLogDeleteReq struct { + g.Meta `path:"/tMessageLog/delete" method:"post" tags:"消息日志" summary:"删除消息日志" x-check-permission:"cpm:common:tMessageLog:delete"` + model.TMessageLogDeleteParam +} + +type TMessageLogDeleteRes struct{} diff --git a/server/api/common/v1/tnotifylog.go b/server/api/common/v1/tnotifylog.go new file mode 100644 index 0000000..0b1992a --- /dev/null +++ b/server/api/common/v1/tnotifylog.go @@ -0,0 +1,59 @@ +// Package tnotifylog +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tnotifylog + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询通知日志列表 +type TNotifyLogListReq struct { + g.Meta `path:"/tNotifyLog/list" method:"get" tags:"通知日志" summary:"获取通知日志列表" x-check-permission:"cpm:common:tNotifyLog:list"` + model.TNotifyLogListParam +} + +type TNotifyLogListRes struct { + response.PageResult + Items []*model.TNotifyLogListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出通知日志列表 +type TNotifyLogExportReq struct { + g.Meta `path:"/tNotifyLog/export" method:"post" tags:"通知日志" summary:"导出通知日志列表" x-check-permission:"cpm:common:tNotifyLog:export"` + model.TNotifyLogListParam +} + +type TNotifyLogExportRes struct{} + +// ViewReq 获取通知日志指定信息 +type TNotifyLogViewReq struct { + g.Meta `path:"/tNotifyLog/view" method:"get" tags:"通知日志" summary:"获取通知日志指定信息" x-check-permission:"cpm:common:tNotifyLog:view"` + model.TNotifyLogViewParam +} + +type TNotifyLogViewRes struct { + *model.TNotifyLogViewModel +} + +// EditReq 修改/新增通知日志 +type TNotifyLogEditReq struct { + g.Meta `path:"/tNotifyLog/edit" method:"post" tags:"通知日志" summary:"修改/新增通知日志" x-check-permission:"cpm:common:tNotifyLog:edit"` + model.TNotifyLogEditParam +} + +type TNotifyLogEditRes struct{} + +// DeleteReq 删除通知日志 +type TNotifyLogDeleteReq struct { + g.Meta `path:"/tNotifyLog/delete" method:"post" tags:"通知日志" summary:"删除通知日志" x-check-permission:"cpm:common:tNotifyLog:delete"` + model.TNotifyLogDeleteParam +} + +type TNotifyLogDeleteRes struct{} diff --git a/server/api/common/v1/tprofitaccountmonthbill.go b/server/api/common/v1/tprofitaccountmonthbill.go new file mode 100644 index 0000000..d8ca64d --- /dev/null +++ b/server/api/common/v1/tprofitaccountmonthbill.go @@ -0,0 +1,99 @@ +// Package tprofitaccountmonthbill +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tprofitaccountmonthbill + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询盈利账户月账单表列表 +type TProfitAccountMonthBillListReq struct { + g.Meta `path:"/tProfitAccountMonthBill/list" method:"get" tags:"盈利账户月账单表" summary:"获取盈利账户月账单表列表" x-check-permission:"cpm:common:tProfitAccountMonthBill:list"` + model.TProfitAccountMonthBillListParam +} + +type TProfitAccountMonthBillListRes struct { + response.PageResult + Items []*model.TProfitAccountMonthBillListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出盈利账户月账单表列表 +type TProfitAccountMonthBillExportReq struct { + g.Meta `path:"/tProfitAccountMonthBill/export" method:"post" tags:"盈利账户月账单表" summary:"导出盈利账户月账单表列表" x-check-permission:"cpm:common:tProfitAccountMonthBill:export"` + model.TProfitAccountMonthBillListParam +} + +type TProfitAccountMonthBillExportRes struct{} + +// ViewReq 获取盈利账户月账单表指定信息 +type TProfitAccountMonthBillViewReq struct { + g.Meta `path:"/tProfitAccountMonthBill/view" method:"get" tags:"盈利账户月账单表" summary:"获取盈利账户月账单表指定信息" x-check-permission:"cpm:common:tProfitAccountMonthBill:view"` + model.TProfitAccountMonthBillViewParam +} + +type TProfitAccountMonthBillViewRes struct { + *model.TProfitAccountMonthBillViewModel +} + +// EditReq 修改/新增盈利账户月账单表 +type TProfitAccountMonthBillEditReq struct { + g.Meta `path:"/tProfitAccountMonthBill/edit" method:"post" tags:"盈利账户月账单表" summary:"修改/新增盈利账户月账单表" x-check-permission:"cpm:common:tProfitAccountMonthBill:edit"` + model.TProfitAccountMonthBillEditParam +} + +type TProfitAccountMonthBillEditRes struct{} + +// DeleteReq 删除盈利账户月账单表 +type TProfitAccountMonthBillDeleteReq struct { + g.Meta `path:"/tProfitAccountMonthBill/delete" method:"post" tags:"盈利账户月账单表" summary:"删除盈利账户月账单表" x-check-permission:"cpm:common:tProfitAccountMonthBill:delete"` + model.TProfitAccountMonthBillDeleteParam +} + +type TProfitAccountMonthBillDeleteRes struct{} + +// SettleReq 统计并写入盈利账户月账单 +type TProfitAccountMonthBillSettleReq struct { + g.Meta `path:"/tProfitAccountMonthBill/settle" method:"post" tags:"盈利账户月账单表" summary:"统计并写入盈利账户月账单" x-permission:"cpm:common:tProfitAccountMonthBill:settle"` + model.TProfitAccountMonthBillSettleParam +} + +type TProfitAccountMonthBillSettleRes struct { + *model.TProfitAccountMonthBillSettleResult +} + +// GetProfitBillSummaryReq 获取上月盈利账单汇总信息 +type TProfitAccountMonthBillGetProfitBillSummaryReq struct { + g.Meta `path:"/tProfitAccountMonthBill/getProfitBillSummary" method:"get" tags:"盈利账户月账单表" summary:"获取上月盈利账单汇总信息" x-permission:"cpm:common:tProfitAccountMonthBill:getProfitBillSummary"` + Month string `json:"month" v:"required|length:7,7" dc:"账期,格式:YYYY-MM"` +} + +type TProfitAccountMonthBillGetProfitBillSummaryRes struct { + *model.TProfitBillModel +} + +// GetCoreFinancialDataReq 获取核心财务指标 +type TProfitAccountMonthBillGetCoreFinancialDataReq struct { + g.Meta `path:"/tProfitAccountMonthBill/getCoreFinancialData" method:"get" tags:"盈利账户月账单表" summary:"获取核心财务指标" x-permission:"cpm:common:tProfitAccountMonthBill:getCoreFinancialData"` + model.TCommissionOverviewParam +} + +type TProfitAccountMonthBillGetCoreFinancialDataRes struct { + *model.TCoreFinancialDataModel +} + +// GetFinancialTrendReq 获取财务趋势折线图 +type TProfitAccountMonthBillGetFinancialTrendReq struct { + g.Meta `path:"/tProfitAccountMonthBill/getFinancialTrend" method:"get" tags:"盈利账户月账单表" summary:"获取财务趋势折线图" x-permission:"cpm:common:tProfitAccountMonthBill:getFinancialTrend"` + model.TFinancialTrendParam +} + +type TProfitAccountMonthBillGetFinancialTrendRes struct { + *model.TFinancialTrendModel +} diff --git a/server/api/common/v1/twocommunication.go b/server/api/common/v1/twocommunication.go new file mode 100644 index 0000000..327c52d --- /dev/null +++ b/server/api/common/v1/twocommunication.go @@ -0,0 +1,66 @@ +// Package twocommunication +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //twocommunication + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// TWoCommunicationListReq 查询工单问题沟通表列表 +type TWoCommunicationListReq struct { + g.Meta `path:"/tWoCommunication/list" method:"get" tags:"工单问题沟通表" summary:"获取工单问题沟通表列表" x-check-permission:"cpm:gen:tWoCommunication:list"` + model.TWoCommunicationListParam +} + +type TWoCommunicationListRes struct { + response.PageResult + Items []*model.TWoCommunicationListModel `json:"items" dc:"数据列表"` +} + +// TWoCommunicationExportReq 导出工单问题沟通表列表 +type TWoCommunicationExportReq struct { + g.Meta `path:"/tWoCommunication/export" method:"post" tags:"工单问题沟通表" summary:"导出工单问题沟通表列表" x-check-permission:"cpm:gen:tWoCommunication:export"` + model.TWoCommunicationListParam +} + +type TWoCommunicationExportRes struct{} + +// TWoCommunicationViewReq 获取工单问题沟通表指定信息 +type TWoCommunicationViewReq struct { + g.Meta `path:"/tWoCommunication/view" method:"get" tags:"工单问题沟通表" summary:"获取工单问题沟通表指定信息" x-check-permission:"cpm:gen:tWoCommunication:view"` + model.TWoCommunicationViewParam +} + +type TWoCommunicationViewRes struct { + *model.TWoCommunicationViewModel +} + +// TWoCommunicationEditReq 修改/新增工单问题沟通表 +type TWoCommunicationEditReq struct { + g.Meta `path:"/tWoCommunication/edit" method:"post" tags:"工单问题沟通表" summary:"修改/新增工单问题沟通表" x-check-permission:"cpm:gen:tWoCommunication:edit"` + model.TWoCommunicationEditParam +} + +type TWoCommunicationEditRes struct{} + +type TWoCommunicationMessageReq struct { + g.Meta `path:"/tWoCommunication/message" method:"post" tags:"工单问题沟通表" summary:"发送工单对话消息" x-check-permission:"cpm:gen:tWoCommunication:message"` + model.TWoMainMessageParam +} + +type TWoCommunicationMessageRes struct{} + +// TWoCommunicationDeleteReq 删除工单问题沟通表 +type TWoCommunicationDeleteReq struct { + g.Meta `path:"/tWoCommunication/delete" method:"post" tags:"工单问题沟通表" summary:"删除工单问题沟通表" x-check-permission:"cpm:gen:tWoCommunication:delete"` + model.TWoCommunicationDeleteParam +} + +type TWoCommunicationDeleteRes struct{} diff --git a/server/api/common/v1/twomain.go b/server/api/common/v1/twomain.go new file mode 100644 index 0000000..eb28ff1 --- /dev/null +++ b/server/api/common/v1/twomain.go @@ -0,0 +1,94 @@ +// Package twomain +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //twomain + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// TWoMainListReq 查询工单主表列表 +type TWoMainListReq struct { + g.Meta `path:"/tWoMain/list" method:"get" tags:"工单主表" summary:"获取工单主表列表" x-check-permission:"cpm:gen:tWoMain:list"` + model.TWoMainListParam +} + +type TWoMainListRes struct { + response.PageResult + Items []*model.TWoMainListModel `json:"items" dc:"数据列表"` +} + +// TWoMainExportReq 导出工单主表列表 +type TWoMainExportReq struct { + g.Meta `path:"/tWoMain/export" method:"post" tags:"工单主表" summary:"导出工单主表列表" x-check-permission:"cpm:gen:tWoMain:export"` + model.TWoMainListParam +} + +type TWoMainExportRes struct{} + +// TWoMainViewReq 获取工单主表指定信息 +type TWoMainViewReq struct { + g.Meta `path:"/tWoMain/view" method:"get" tags:"工单主表" summary:"获取工单主表指定信息" x-check-permission:"cpm:gen:tWoMain:view"` + model.TWoMainViewParam +} + +type TWoMainViewRes struct { + *model.TWoMainViewModel +} + +// TWoMainEditReq 修改/新增工单主表 +type TWoMainEditReq struct { + g.Meta `path:"/tWoMain/edit" method:"post" tags:"工单主表" summary:"修改/新增工单主表" x-check-permission:"cpm:gen:tWoMain:edit"` + model.TWoMainEditParam +} + +type TWoMainEditRes struct{} + +type TWoMainTransferReq struct { + g.Meta `path:"/tWoMain/transfer" method:"post" tags:"工单主表" summary:"工单转单到顶级部门" x-check-permission:"cpm:gen:tWoMain:transfer"` + model.TWoMainTransferParam +} + +type TWoMainTransferRes struct{} + +type TWoMainResolveReq struct { + g.Meta `path:"/tWoMain/resolve" method:"post" tags:"工单主表" summary:"工单处理完成" x-check-permission:"cpm:gen:tWoMain:resolve"` + model.TWoMainResolveParam +} + +type TWoMainResolveRes struct{} + +type TWoMainCancelReq struct { + g.Meta `path:"/tWoMain/cancel" method:"post" tags:"工单主表" summary:"用户取消工单" x-check-permission:"cpm:gen:tWoMain:cancel"` + model.TWoMainCancelParam +} + +type TWoMainCancelRes struct{} + +type TWoMainCloseReq struct { + g.Meta `path:"/tWoMain/close" method:"post" tags:"工单主表" summary:"关闭工单" x-check-permission:"cpm:gen:tWoMain:close"` + model.TWoMainCloseParam +} + +type TWoMainCloseRes struct{} + +type TWoMainEvaluateReq struct { + g.Meta `path:"/tWoMain/evaluate" method:"post" tags:"工单主表" summary:"用户评价工单" x-check-permission:"cpm:gen:tWoMain:evaluate"` + model.TWoMainEvaluateParam +} + +type TWoMainEvaluateRes struct{} + +// TWoMainDeleteReq 删除工单主表 +type TWoMainDeleteReq struct { + g.Meta `path:"/tWoMain/delete" method:"post" tags:"工单主表" summary:"删除工单主表" x-check-permission:"cpm:gen:tWoMain:delete"` + model.TWoMainDeleteParam +} + +type TWoMainDeleteRes struct{} diff --git a/server/api/common/v1/tworecord.go b/server/api/common/v1/tworecord.go new file mode 100644 index 0000000..93ca452 --- /dev/null +++ b/server/api/common/v1/tworecord.go @@ -0,0 +1,59 @@ +// Package tworecord +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tworecord + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询工单记录表列表 +type TWoRecordListReq struct { + g.Meta `path:"/tWoRecord/list" method:"get" tags:"工单记录表" summary:"获取工单记录表列表" x-check-permission:"cpm:gen:tWoRecord:list"` + model.TWoRecordListParam +} + +type TWoRecordListRes struct { + response.PageResult + Items []*model.TWoRecordListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出工单记录表列表 +type TWoRecordExportReq struct { + g.Meta `path:"/tWoRecord/export" method:"post" tags:"工单记录表" summary:"导出工单记录表列表" x-check-permission:"cpm:gen:tWoRecord:export"` + model.TWoRecordListParam +} + +type TWoRecordExportRes struct{} + +// ViewReq 获取工单记录表指定信息 +type TWoRecordViewReq struct { + g.Meta `path:"/tWoRecord/view" method:"get" tags:"工单记录表" summary:"获取工单记录表指定信息" x-check-permission:"cpm:gen:tWoRecord:view"` + model.TWoRecordViewParam +} + +type TWoRecordViewRes struct { + *model.TWoRecordViewModel +} + +// EditReq 修改/新增工单记录表 +type TWoRecordEditReq struct { + g.Meta `path:"/tWoRecord/edit" method:"post" tags:"工单记录表" summary:"修改/新增工单记录表" x-check-permission:"cpm:gen:tWoRecord:edit"` + model.TWoRecordEditParam +} + +type TWoRecordEditRes struct{} + +// DeleteReq 删除工单记录表 +type TWoRecordDeleteReq struct { + g.Meta `path:"/tWoRecord/delete" method:"post" tags:"工单记录表" summary:"删除工单记录表" x-check-permission:"cpm:gen:tWoRecord:delete"` + model.TWoRecordDeleteParam +} + +type TWoRecordDeleteRes struct{} diff --git a/server/api/common/v1/upload.go b/server/api/common/v1/upload.go new file mode 100644 index 0000000..0af5169 --- /dev/null +++ b/server/api/common/v1/upload.go @@ -0,0 +1,29 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysOssUploadReq struct { + g.Meta `path:"/oss/upload" method:"post" tags:"系统-存储管理" summary:"上传文件" x-check-permission:"cpm:system:oss:upload"` + *model.SysOssUploadParam +} + +type SysOssUploadRes struct { + *model.SysOssUploadModel +} +type SysOssDownloadReq struct { + g.Meta `path:"/oss/download" method:"get" tags:"系统-存储管理" summary:"下载文件" x-check-permission:"cpm:system:oss:download"` + *model.SysOssDownloadParam +} + +type SysOssDownloadRes struct { + *model.SysOssDownloadModel +} diff --git a/server/api/gen/testdemo/testdemo.go b/server/api/gen/testdemo/testdemo.go new file mode 100644 index 0000000..b22823b --- /dev/null +++ b/server/api/gen/testdemo/testdemo.go @@ -0,0 +1,19 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package testdemo + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo/v1" +) + +type ITestdemoV1 interface { + TestDemoList(ctx context.Context, req *v1.TestDemoListReq) (res *v1.TestDemoListRes, err error) + TestDemoExport(ctx context.Context, req *v1.TestDemoExportReq) (res *v1.TestDemoExportRes, err error) + TestDemoView(ctx context.Context, req *v1.TestDemoViewReq) (res *v1.TestDemoViewRes, err error) + TestDemoEdit(ctx context.Context, req *v1.TestDemoEditReq) (res *v1.TestDemoEditRes, err error) + TestDemoDelete(ctx context.Context, req *v1.TestDemoDeleteReq) (res *v1.TestDemoDeleteRes, err error) +} diff --git a/server/api/gen/testdemo/v1/testdemo.go b/server/api/gen/testdemo/v1/testdemo.go new file mode 100644 index 0000000..d514cee --- /dev/null +++ b/server/api/gen/testdemo/v1/testdemo.go @@ -0,0 +1,59 @@ +// Package testdemo +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //testdemo + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/genin" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询测试单表列表 +type TestDemoListReq struct { + g.Meta `path:"/testDemo/list" method:"get" tags:"测试单表" summary:"获取测试单表列表" x-check-permission:"cpm:gen:testDemo:list"` + genin.TestDemoListParam +} + +type TestDemoListRes struct { + response.PageResult + Items []*genin.TestDemoListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出测试单表列表 +type TestDemoExportReq struct { + g.Meta `path:"/testDemo/export" method:"post" tags:"测试单表" summary:"导出测试单表列表" x-check-permission:"cpm:gen:testDemo:export"` + genin.TestDemoListParam +} + +type TestDemoExportRes struct{} + +// ViewReq 获取测试单表指定信息 +type TestDemoViewReq struct { + g.Meta `path:"/testDemo/view" method:"get" tags:"测试单表" summary:"获取测试单表指定信息" x-check-permission:"cpm:gen:testDemo:view"` + genin.TestDemoViewParam +} + +type TestDemoViewRes struct { + *genin.TestDemoViewModel +} + +// EditReq 修改/新增测试单表 +type TestDemoEditReq struct { + g.Meta `path:"/testDemo/edit" method:"post" tags:"测试单表" summary:"修改/新增测试单表" x-check-permission:"cpm:gen:testDemo:edit"` + genin.TestDemoEditParam +} + +type TestDemoEditRes struct{} + +// DeleteReq 删除测试单表 +type TestDemoDeleteReq struct { + g.Meta `path:"/testDemo/delete" method:"post" tags:"测试单表" summary:"删除测试单表" x-check-permission:"cpm:gen:testDemo:delete"` + genin.TestDemoDeleteParam +} + +type TestDemoDeleteRes struct{} diff --git a/server/api/gen_codes/gen_codes.go b/server/api/gen_codes/gen_codes.go new file mode 100644 index 0000000..71178e6 --- /dev/null +++ b/server/api/gen_codes/gen_codes.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package gen_codes + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen_codes/v1" +) + +type IGenCodesV1 interface { + SysGenTableList(ctx context.Context, req *v1.SysGenTableListReq) (res *v1.SysGenTableListRes, err error) + SysGenTableView(ctx context.Context, req *v1.SysGenTableViewReq) (res *v1.SysGenTableViewRes, err error) + SysGenTableAdd(ctx context.Context, req *v1.SysGenTableAddReq) (res *v1.SysGenTableAddRes, err error) + SysGenTableEdit(ctx context.Context, req *v1.SysGenTableEditReq) (res *v1.SysGenTableEditRes, err error) + SysGenTableDelete(ctx context.Context, req *v1.SysGenTableDeleteReq) (res *v1.SysGenTableDeleteRes, err error) + SysGenTableSelects(ctx context.Context, req *v1.SysGenTableSelectsReq) (res *v1.SysGenTableSelectsRes, err error) + SysGenTableTableSelect(ctx context.Context, req *v1.SysGenTableTableSelectReq) (res *v1.SysGenTableTableSelectRes, err error) + SysGenTableColumnSelect(ctx context.Context, req *v1.SysGenTableColumnSelectReq) (res *v1.SysGenTableColumnSelectRes, err error) + SysGenTableColumnList(ctx context.Context, req *v1.SysGenTableColumnListReq) (res *v1.SysGenTableColumnListRes, err error) + SysGenTablePreview(ctx context.Context, req *v1.SysGenTablePreviewReq) (res *v1.SysGenTablePreviewRes, err error) + SysGenTableBuild(ctx context.Context, req *v1.SysGenTableBuildReq) (res *v1.SysGenTableBuildRes, err error) +} diff --git a/server/api/gen_codes/v1/gen_table.go b/server/api/gen_codes/v1/gen_table.go new file mode 100644 index 0000000..97dbabe --- /dev/null +++ b/server/api/gen_codes/v1/gen_table.go @@ -0,0 +1,112 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysGenTableListReq struct { + g.Meta `path:"/genTable/list" method:"get" tags:"工具-代码生成" summary:"获取代码生成列表" x-check-permission:"cpm:tool:gen:list"` + *model.SysGenTableListParam +} + +type SysGenTableListRes struct { + response.PageResult + Items []*model.SysGenTableListModel `json:"items"` +} + +type SysGenTableViewReq struct { + g.Meta `path:"/genTable/view" method:"get" tags:"工具-代码生成" summary:"获取代码生成详情" x-check-permission:"cpm:tool:gen:query"` + *model.SysGenTableViewParam +} + +type SysGenTableViewRes struct { + *model.SysGenTableViewModel +} + +type SysGenTableAddReq struct { + g.Meta `path:"/genTable/add" method:"post" tags:"工具-代码生成" summary:"新增代码生成" x-check-permission:"cpm:tool:gen:import"` + *model.SysGenTableAddParam +} + +type SysGenTableAddRes struct { + *model.SysGenTableAddModel +} + +type SysGenTableEditReq struct { + g.Meta `path:"/genTable/edit" method:"post" tags:"工具-代码生成" summary:"修改代码生成" x-check-permission:"cpm:tool:gen:edit"` + *model.SysGenTableEditParam +} + +type SysGenTableEditRes struct { + *model.SysGenTableEditModel +} + +type SysGenTableDeleteReq struct { + g.Meta `path:"/genTable/delete" method:"post" tags:"工具-代码生成" summary:"删除代码生成" x-check-permission:"cpm:tool:gen:remove"` + *model.SysGenTableDeleteParam +} + +type SysGenTableDeleteRes struct { + *model.SysGenTableDeleteModel +} + +type SysGenTableSelectsReq struct { + g.Meta `path:"/genTable/selects" method:"get" tags:"工具-代码生成" summary:"获取代码生成选择项" x-check-permission:"cpm:tool:gen:list"` +} + +type SysGenTableSelectsRes struct { + *model.SelectsModel +} + +type SysGenTableTableSelectReq struct { + g.Meta `path:"/genTable/tableSelect" method:"get" tags:"工具-代码生成" summary:"获取代码生成表选择项" x-check-permission:"cpm:tool:gen:list"` + *model.GenCodesTableSelectParam +} + +type SysGenTableTableSelectRes struct { + Items []*model.GenCodesTableSelectModel `json:"items"` +} + +type SysGenTableColumnSelectReq struct { + g.Meta `path:"/genTable/columnSelect" method:"get" tags:"工具-代码生成" summary:"获取代码生成字段选择项" x-check-permission:"cpm:tool:gen:list"` + *model.GenCodesColumnSelectParam +} + +type SysGenTableColumnSelectRes struct { + Items []*model.GenCodesColumnSelectModel `json:"items"` +} + +type SysGenTableColumnListReq struct { + g.Meta `path:"/genTable/columnList" method:"get" tags:"工具-代码生成" summary:"获取代码生成字段列表" x-check-permission:"cpm:tool:gen:list"` + *model.GenCodesColumnListParam +} + +type SysGenTableColumnListRes struct { + Items []*model.GenCodesColumnListModel `json:"items"` +} + +type SysGenTablePreviewReq struct { + g.Meta `path:"/genTable/preview" method:"post" tags:"工具-代码生成" summary:"生成预览" x-check-permission:"cpm:tool:gen:preview"` + *model.GenCodesPreviewParam +} + +type SysGenTablePreviewRes struct { + *model.GenCodesPreviewModel +} + +type SysGenTableBuildReq struct { + g.Meta `path:"/genTable/build" method:"post" tags:"工具-代码生成" summary:"构建" x-check-permission:"cpm:tool:gen:code"` + *model.GenCodesBuildParam +} + +type SysGenTableBuildRes struct { + *model.GenCodesBuildModel +} diff --git a/server/api/home/home.go b/server/api/home/home.go new file mode 100644 index 0000000..acb7a1a --- /dev/null +++ b/server/api/home/home.go @@ -0,0 +1,19 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package home + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/home/v1" +) + +type IHomeV1 interface { + CardStatistics(ctx context.Context, req *v1.CardStatisticsReq) (res *v1.CardStatisticsRes, err error) + CardStatusStatistics(ctx context.Context, req *v1.CardStatusStatisticsReq) (res *v1.CardStatusStatisticsRes, err error) + TopUsageCards(ctx context.Context, req *v1.TopUsageCardsReq) (res *v1.TopUsageCardsRes, err error) + FlowUsageChart(ctx context.Context, req *v1.FlowUsageChartReq) (res *v1.FlowUsageChartRes, err error) + FlowPoolUsage(ctx context.Context, req *v1.FlowPoolUsageReq) (res *v1.FlowPoolUsageRes, err error) +} diff --git a/server/api/home/v1/home.go b/server/api/home/v1/home.go new file mode 100644 index 0000000..9af93f1 --- /dev/null +++ b/server/api/home/v1/home.go @@ -0,0 +1,53 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type CardStatisticsReq struct { + g.Meta `path:"/cardStatistics" method:"get" tags:"首页统计" summary:"获取卡片数据统计"` +} + +type CardStatisticsRes struct { + model.CardStatistics +} + +type CardStatusStatisticsReq struct { + g.Meta `path:"/cardStatusStatistics" method:"get" tags:"首页统计" summary:"获取卡状态统计"` +} + +type CardStatusStatisticsRes struct { + model.CardStatusStatistics +} + +type TopUsageCardsReq struct { + g.Meta `path:"/topUsageCards" method:"get" tags:"首页统计" summary:"获取前一天流量使用前五名的卡片"` +} + +type TopUsageCardsRes struct { + Data []model.TopUsageCard `json:"data"` +} + +type FlowUsageChartReq struct { + g.Meta `path:"/flowUsageChart" method:"get" tags:"首页统计" summary:"获取流量使用图表数据"` + Period string `json:"period" dc:"时间周期: 7d前7天, 1m前6个月" v:"required|in:7d,1m"` +} + +type FlowUsageChartRes struct { + model.FlowUsageChartData +} + +type FlowPoolUsageReq struct { + g.Meta `path:"/flowPoolUsage" method:"get" tags:"首页统计" summary:"获取流量池流量使用情况"` +} + +type FlowPoolUsageRes struct { + Data []model.FlowPoolUsageItem `json:"data"` +} diff --git a/server/api/iot/iot.go b/server/api/iot/iot.go new file mode 100644 index 0000000..ef3854e --- /dev/null +++ b/server/api/iot/iot.go @@ -0,0 +1,195 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" +) + +type IIotV1 interface { + SimWarningConfigList(ctx context.Context, req *v1.SimWarningConfigListReq) (res *v1.SimWarningConfigListRes, err error) + SimWarningConfigView(ctx context.Context, req *v1.SimWarningConfigViewReq) (res *v1.SimWarningConfigViewRes, err error) + SimWarningConfigSave(ctx context.Context, req *v1.SimWarningConfigSaveReq) (res *v1.SimWarningConfigSaveRes, err error) + SimWarningConfigStatus(ctx context.Context, req *v1.SimWarningConfigStatusReq) (res *v1.SimWarningConfigStatusRes, err error) + SimWarningConfigDelete(ctx context.Context, req *v1.SimWarningConfigDeleteReq) (res *v1.SimWarningConfigDeleteRes, err error) + TFlowPackageConfigList(ctx context.Context, req *v1.TFlowPackageConfigListReq) (res *v1.TFlowPackageConfigListRes, err error) + TFlowPackageConfigExport(ctx context.Context, req *v1.TFlowPackageConfigExportReq) (res *v1.TFlowPackageConfigExportRes, err error) + TFlowPackageConfigView(ctx context.Context, req *v1.TFlowPackageConfigViewReq) (res *v1.TFlowPackageConfigViewRes, err error) + TFlowPackageConfigEdit(ctx context.Context, req *v1.TFlowPackageConfigEditReq) (res *v1.TFlowPackageConfigEditRes, err error) + TFlowPackageConfigDelete(ctx context.Context, req *v1.TFlowPackageConfigDeleteReq) (res *v1.TFlowPackageConfigDeleteRes, err error) + TOrderList(ctx context.Context, req *v1.TOrderListReq) (res *v1.TOrderListRes, err error) + TOrderExport(ctx context.Context, req *v1.TOrderExportReq) (res *v1.TOrderExportRes, err error) + TOrderView(ctx context.Context, req *v1.TOrderViewReq) (res *v1.TOrderViewRes, err error) + TOrderEdit(ctx context.Context, req *v1.TOrderEditReq) (res *v1.TOrderEditRes, err error) + TOrderDelete(ctx context.Context, req *v1.TOrderDeleteReq) (res *v1.TOrderDeleteRes, err error) + TOrderSellList(ctx context.Context, req *v1.TOrderSellListReq) (res *v1.TOrderSellListRes, err error) + TSimCardAllocateTargetList(ctx context.Context, req *v1.TSimCardAllocateTargetListReq) (res *v1.TSimCardAllocateTargetListRes, err error) + TSimCardAllocateExcelTemplate(ctx context.Context, req *v1.TSimCardAllocateExcelTemplateReq) (res *v1.TSimCardAllocateExcelTemplateRes, err error) + TSimCardAllocateInputPrepare(ctx context.Context, req *v1.TSimCardAllocateInputPrepareReq) (res *v1.TSimCardAllocateInputPrepareRes, err error) + TSimCardAllocateExcelSubmit(ctx context.Context, req *v1.TSimCardAllocateExcelSubmitReq) (res *v1.TSimCardAllocateExcelSubmitRes, err error) + TSimCardAllocateBatchSubmit(ctx context.Context, req *v1.TSimCardAllocateBatchSubmitReq) (res *v1.TSimCardAllocateBatchSubmitRes, err error) + TSimCardBindPkgList(ctx context.Context, req *v1.TSimCardBindPkgListReq) (res *v1.TSimCardBindPkgListRes, err error) + TSimCardBindPkgExport(ctx context.Context, req *v1.TSimCardBindPkgExportReq) (res *v1.TSimCardBindPkgExportRes, err error) + TSimCardBindPkgView(ctx context.Context, req *v1.TSimCardBindPkgViewReq) (res *v1.TSimCardBindPkgViewRes, err error) + TSimCardBindPkgEdit(ctx context.Context, req *v1.TSimCardBindPkgEditReq) (res *v1.TSimCardBindPkgEditRes, err error) + TSimCardBindPkgDelete(ctx context.Context, req *v1.TSimCardBindPkgDeleteReq) (res *v1.TSimCardBindPkgDeleteRes, err error) + TSimCardBindPkgGetPkgInfo(ctx context.Context, req *v1.TSimCardBindPkgGetPkgInfoReq) (res *v1.TSimCardBindPkgGetPkgInfoRes, err error) + TSimCardBindPkgGetChangePkg(ctx context.Context, req *v1.TSimCardBindPkgGetChangePkgReq) (res *v1.TSimCardBindPkgGetChangePkgRes, err error) + TSimCardBindPkgAddPackageOptions(ctx context.Context, req *v1.TSimCardBindPkgAddPackageOptionsReq) (res *v1.TSimCardBindPkgAddPackageOptionsRes, err error) + TSimCardBindPkgAddPackagePaymentContext(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePaymentContextReq) (res *v1.TSimCardBindPkgAddPackagePaymentContextRes, err error) + TSimCardBindPkgDownloadExcelTemplate(ctx context.Context, req *v1.TSimCardBindPkgDownloadExcelTemplateReq) (res *v1.TSimCardBindPkgDownloadExcelTemplateRes, err error) + TSimCardBindPkgSubmitExcel(ctx context.Context, req *v1.TSimCardBindPkgSubmitExcelReq) (res *v1.TSimCardBindPkgSubmitExcelRes, err error) + TSimCardBindPkgSubmitInput(ctx context.Context, req *v1.TSimCardBindPkgSubmitInputReq) (res *v1.TSimCardBindPkgSubmitInputRes, err error) + TSimCardBindPkgAddPackageInputPrepare(ctx context.Context, req *v1.TSimCardBindPkgAddPackageInputPrepareReq) (res *v1.TSimCardBindPkgAddPackageInputPrepareRes, err error) + TSimCardBindPkgAddPackagePrepareResult(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePrepareResultReq) (res *v1.TSimCardBindPkgAddPackagePrepareResultRes, err error) + TSimCardBindPkgAddPackageBatchConfirm(ctx context.Context, req *v1.TSimCardBindPkgAddPackageBatchConfirmReq) (res *v1.TSimCardBindPkgAddPackageBatchConfirmRes, err error) + TSimCardCancelExcelTemplate(ctx context.Context, req *v1.TSimCardCancelExcelTemplateReq) (res *v1.TSimCardCancelExcelTemplateRes, err error) + TSimCardCancelExcelSubmit(ctx context.Context, req *v1.TSimCardCancelExcelSubmitReq) (res *v1.TSimCardCancelExcelSubmitRes, err error) + TSimCardCancelInputSubmit(ctx context.Context, req *v1.TSimCardCancelInputSubmitReq) (res *v1.TSimCardCancelInputSubmitRes, err error) + TSimCardCancellationList(ctx context.Context, req *v1.TSimCardCancellationListReq) (res *v1.TSimCardCancellationListRes, err error) + TSimCardCancellationExport(ctx context.Context, req *v1.TSimCardCancellationExportReq) (res *v1.TSimCardCancellationExportRes, err error) + TSimCardChangeExcelTemplate(ctx context.Context, req *v1.TSimCardChangeExcelTemplateReq) (res *v1.TSimCardChangeExcelTemplateRes, err error) + TSimCardChangeExcelSubmit(ctx context.Context, req *v1.TSimCardChangeExcelSubmitReq) (res *v1.TSimCardChangeExcelSubmitRes, err error) + TSimCardChangeInputOptions(ctx context.Context, req *v1.TSimCardChangeInputOptionsReq) (res *v1.TSimCardChangeInputOptionsRes, err error) + TSimCardChangeRangeOptions(ctx context.Context, req *v1.TSimCardChangeRangeOptionsReq) (res *v1.TSimCardChangeRangeOptionsRes, err error) + TSimCardChangeInputPrepare(ctx context.Context, req *v1.TSimCardChangeInputPrepareReq) (res *v1.TSimCardChangeInputPrepareRes, err error) + TSimCardChangeRangePrepare(ctx context.Context, req *v1.TSimCardChangeRangePrepareReq) (res *v1.TSimCardChangeRangePrepareRes, err error) + TSimCardChangeBatchSubmit(ctx context.Context, req *v1.TSimCardChangeBatchSubmitReq) (res *v1.TSimCardChangeBatchSubmitRes, err error) + TSimCardChangePrepareResult(ctx context.Context, req *v1.TSimCardChangePrepareResultReq) (res *v1.TSimCardChangePrepareResultRes, err error) + TSimCardDataCutExcelTemplate(ctx context.Context, req *v1.TSimCardDataCutExcelTemplateReq) (res *v1.TSimCardDataCutExcelTemplateRes, err error) + TSimCardDataCutExcelSubmit(ctx context.Context, req *v1.TSimCardDataCutExcelSubmitReq) (res *v1.TSimCardDataCutExcelSubmitRes, err error) + TSimCardDataCutInputSubmit(ctx context.Context, req *v1.TSimCardDataCutInputSubmitReq) (res *v1.TSimCardDataCutInputSubmitRes, err error) + TSimCardDataStartExcelTemplate(ctx context.Context, req *v1.TSimCardDataStartExcelTemplateReq) (res *v1.TSimCardDataStartExcelTemplateRes, err error) + TSimCardDataStartExcelSubmit(ctx context.Context, req *v1.TSimCardDataStartExcelSubmitReq) (res *v1.TSimCardDataStartExcelSubmitRes, err error) + TSimCardDataStartInputSubmit(ctx context.Context, req *v1.TSimCardDataStartInputSubmitReq) (res *v1.TSimCardDataStartInputSubmitRes, err error) + TSimCardDataStopExcelTemplate(ctx context.Context, req *v1.TSimCardDataStopExcelTemplateReq) (res *v1.TSimCardDataStopExcelTemplateRes, err error) + TSimCardDataStopExcelSubmit(ctx context.Context, req *v1.TSimCardDataStopExcelSubmitReq) (res *v1.TSimCardDataStopExcelSubmitRes, err error) + TSimCardDataStopInputSubmit(ctx context.Context, req *v1.TSimCardDataStopInputSubmitReq) (res *v1.TSimCardDataStopInputSubmitRes, err error) + TSimCardInboundExcelTemplate(ctx context.Context, req *v1.TSimCardInboundExcelTemplateReq) (res *v1.TSimCardInboundExcelTemplateRes, err error) + TSimCardInboundExcelSubmit(ctx context.Context, req *v1.TSimCardInboundExcelSubmitReq) (res *v1.TSimCardInboundExcelSubmitRes, err error) + TSimCardInboundRangeSubmit(ctx context.Context, req *v1.TSimCardInboundRangeSubmitReq) (res *v1.TSimCardInboundRangeSubmitRes, err error) + TSimCardInboundInputSubmit(ctx context.Context, req *v1.TSimCardInboundInputSubmitReq) (res *v1.TSimCardInboundInputSubmitRes, err error) + TSimCardInfoList(ctx context.Context, req *v1.TSimCardInfoListReq) (res *v1.TSimCardInfoListRes, err error) + TSimCardInfoExport(ctx context.Context, req *v1.TSimCardInfoExportReq) (res *v1.TSimCardInfoExportRes, err error) + TSimCardInfoView(ctx context.Context, req *v1.TSimCardInfoViewReq) (res *v1.TSimCardInfoViewRes, err error) + TSimCardInfoEdit(ctx context.Context, req *v1.TSimCardInfoEditReq) (res *v1.TSimCardInfoEditRes, err error) + TSimCardInfoDelete(ctx context.Context, req *v1.TSimCardInfoDeleteReq) (res *v1.TSimCardInfoDeleteRes, err error) + TSimCardInfoSyncSimCardFlow(ctx context.Context, req *v1.TSimCardInfoSyncSimCardFlowReq) (res *v1.TSimCardInfoSyncSimCardFlowRes, err error) + TSimCardInfoSyncSimCardStatus(ctx context.Context, req *v1.TSimCardInfoSyncSimCardStatusReq) (res *v1.TSimCardInfoSyncSimCardStatusRes, err error) + TSimCardInfoSyncSimCardStatusQueue(ctx context.Context, req *v1.TSimCardInfoSyncSimCardStatusQueueReq) (res *v1.TSimCardInfoSyncSimCardStatusQueueRes, err error) + TSimCardInfoQuerySimSession(ctx context.Context, req *v1.TSimCardInfoQuerySimSessionReq) (res *v1.TSimCardInfoQuerySimSessionRes, err error) + TSimCardInfoQuerySimStatus(ctx context.Context, req *v1.TSimCardInfoQuerySimStatusReq) (res *v1.TSimCardInfoQuerySimStatusRes, err error) + TSimCardOutboundExcelTemplate(ctx context.Context, req *v1.TSimCardOutboundExcelTemplateReq) (res *v1.TSimCardOutboundExcelTemplateRes, err error) + TSimCardOutboundExcelSubmit(ctx context.Context, req *v1.TSimCardOutboundExcelSubmitReq) (res *v1.TSimCardOutboundExcelSubmitRes, err error) + TSimCardOutboundRangeSubmit(ctx context.Context, req *v1.TSimCardOutboundRangeSubmitReq) (res *v1.TSimCardOutboundRangeSubmitRes, err error) + TSimCardOutboundInputSubmit(ctx context.Context, req *v1.TSimCardOutboundInputSubmitReq) (res *v1.TSimCardOutboundInputSubmitRes, err error) + TSimCardOutboundInboundBatchList(ctx context.Context, req *v1.TSimCardOutboundInboundBatchListReq) (res *v1.TSimCardOutboundInboundBatchListRes, err error) + TSimCardOutboundInboundBatchCards(ctx context.Context, req *v1.TSimCardOutboundInboundBatchCardsReq) (res *v1.TSimCardOutboundInboundBatchCardsRes, err error) + TSimCardOutboundBatchSubmit(ctx context.Context, req *v1.TSimCardOutboundBatchSubmitReq) (res *v1.TSimCardOutboundBatchSubmitRes, err error) + TSimCardOutboundCustomerBalance(ctx context.Context, req *v1.TSimCardOutboundCustomerBalanceReq) (res *v1.TSimCardOutboundCustomerBalanceRes, err error) + TSimCardRenewExcelTemplate(ctx context.Context, req *v1.TSimCardRenewExcelTemplateReq) (res *v1.TSimCardRenewExcelTemplateRes, err error) + TSimCardRenewExcelSubmit(ctx context.Context, req *v1.TSimCardRenewExcelSubmitReq) (res *v1.TSimCardRenewExcelSubmitRes, err error) + TSimCardRenewInputPrepare(ctx context.Context, req *v1.TSimCardRenewInputPrepareReq) (res *v1.TSimCardRenewInputPrepareRes, err error) + TSimCardRenewBatchConfirm(ctx context.Context, req *v1.TSimCardRenewBatchConfirmReq) (res *v1.TSimCardRenewBatchConfirmRes, err error) + TSimCardRenewPrepareResult(ctx context.Context, req *v1.TSimCardRenewPrepareResultReq) (res *v1.TSimCardRenewPrepareResultRes, err error) + TSimCardRestartExcelTemplate(ctx context.Context, req *v1.TSimCardRestartExcelTemplateReq) (res *v1.TSimCardRestartExcelTemplateRes, err error) + TSimCardRestartExcelSubmit(ctx context.Context, req *v1.TSimCardRestartExcelSubmitReq) (res *v1.TSimCardRestartExcelSubmitRes, err error) + TSimCardRestartInputSubmit(ctx context.Context, req *v1.TSimCardRestartInputSubmitReq) (res *v1.TSimCardRestartInputSubmitRes, err error) + TSimCardStartExcelTemplate(ctx context.Context, req *v1.TSimCardStartExcelTemplateReq) (res *v1.TSimCardStartExcelTemplateRes, err error) + TSimCardStartExcelSubmit(ctx context.Context, req *v1.TSimCardStartExcelSubmitReq) (res *v1.TSimCardStartExcelSubmitRes, err error) + TSimCardStartInputSubmit(ctx context.Context, req *v1.TSimCardStartInputSubmitReq) (res *v1.TSimCardStartInputSubmitRes, err error) + TSimCardStockList(ctx context.Context, req *v1.TSimCardStockListReq) (res *v1.TSimCardStockListRes, err error) + TSimCardStockExport(ctx context.Context, req *v1.TSimCardStockExportReq) (res *v1.TSimCardStockExportRes, err error) + TSimCardStockView(ctx context.Context, req *v1.TSimCardStockViewReq) (res *v1.TSimCardStockViewRes, err error) + TSimCardStockEdit(ctx context.Context, req *v1.TSimCardStockEditReq) (res *v1.TSimCardStockEditRes, err error) + TSimCardStockDelete(ctx context.Context, req *v1.TSimCardStockDeleteReq) (res *v1.TSimCardStockDeleteRes, err error) + TSimCardStopExcelTemplate(ctx context.Context, req *v1.TSimCardStopExcelTemplateReq) (res *v1.TSimCardStopExcelTemplateRes, err error) + TSimCardStopExcelSubmit(ctx context.Context, req *v1.TSimCardStopExcelSubmitReq) (res *v1.TSimCardStopExcelSubmitRes, err error) + TSimCardStopInputSubmit(ctx context.Context, req *v1.TSimCardStopInputSubmitReq) (res *v1.TSimCardStopInputSubmitRes, err error) + TSimCardTrafficCutoffExcelTemplate(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelTemplateReq) (res *v1.TSimCardTrafficCutoffExcelTemplateRes, err error) + TSimCardTrafficCutoffExcelSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelSubmitReq) (res *v1.TSimCardTrafficCutoffExcelSubmitRes, err error) + TSimCardTrafficCutoffInputSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffInputSubmitReq) (res *v1.TSimCardTrafficCutoffInputSubmitRes, err error) + TSimCardTrafficCutoffRangeSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffRangeSubmitReq) (res *v1.TSimCardTrafficCutoffRangeSubmitRes, err error) + TSimCardTrafficCutoffList(ctx context.Context, req *v1.TSimCardTrafficCutoffListReq) (res *v1.TSimCardTrafficCutoffListRes, err error) + TSimCardTrafficCutoffExport(ctx context.Context, req *v1.TSimCardTrafficCutoffExportReq) (res *v1.TSimCardTrafficCutoffExportRes, err error) + TSimCardTrafficCutoffEdit(ctx context.Context, req *v1.TSimCardTrafficCutoffEditReq) (res *v1.TSimCardTrafficCutoffEditRes, err error) + TSimCardTrafficCutoffDelete(ctx context.Context, req *v1.TSimCardTrafficCutoffDeleteReq) (res *v1.TSimCardTrafficCutoffDeleteRes, err error) + TSimCardUnsubExcelTemplate(ctx context.Context, req *v1.TSimCardUnsubExcelTemplateReq) (res *v1.TSimCardUnsubExcelTemplateRes, err error) + TSimCardUnsubExcelSubmit(ctx context.Context, req *v1.TSimCardUnsubExcelSubmitReq) (res *v1.TSimCardUnsubExcelSubmitRes, err error) + TSimCardUnsubInputSubmit(ctx context.Context, req *v1.TSimCardUnsubInputSubmitReq) (res *v1.TSimCardUnsubInputSubmitRes, err error) + TSimCardUnsubRangeSubmit(ctx context.Context, req *v1.TSimCardUnsubRangeSubmitReq) (res *v1.TSimCardUnsubRangeSubmitRes, err error) + TSimChannelsList(ctx context.Context, req *v1.TSimChannelsListReq) (res *v1.TSimChannelsListRes, err error) + TSimChannelsExport(ctx context.Context, req *v1.TSimChannelsExportReq) (res *v1.TSimChannelsExportRes, err error) + TSimChannelsView(ctx context.Context, req *v1.TSimChannelsViewReq) (res *v1.TSimChannelsViewRes, err error) + TSimChannelsEdit(ctx context.Context, req *v1.TSimChannelsEditReq) (res *v1.TSimChannelsEditRes, err error) + TSimChannelsDelete(ctx context.Context, req *v1.TSimChannelsDeleteReq) (res *v1.TSimChannelsDeleteRes, err error) + TSimChannelsTest(ctx context.Context, req *v1.TSimChannelsTestReq) (res *v1.TSimChannelsTestRes, err error) + TSimChannelTemplateList(ctx context.Context, req *v1.TSimChannelTemplateListReq) (res *v1.TSimChannelTemplateListRes, err error) + TSimChannelTemplateExport(ctx context.Context, req *v1.TSimChannelTemplateExportReq) (res *v1.TSimChannelTemplateExportRes, err error) + TSimChannelTemplateView(ctx context.Context, req *v1.TSimChannelTemplateViewReq) (res *v1.TSimChannelTemplateViewRes, err error) + TSimChannelTemplateEdit(ctx context.Context, req *v1.TSimChannelTemplateEditReq) (res *v1.TSimChannelTemplateEditRes, err error) + TSimChannelTemplateDelete(ctx context.Context, req *v1.TSimChannelTemplateDeleteReq) (res *v1.TSimChannelTemplateDeleteRes, err error) + TSimDiagnoseInfo(ctx context.Context, req *v1.TSimDiagnoseInfoReq) (res *v1.TSimDiagnoseInfoRes, err error) + TSimDiagnoseFlow(ctx context.Context, req *v1.TSimDiagnoseFlowReq) (res *v1.TSimDiagnoseFlowRes, err error) + TSimFlowPackageInfoList(ctx context.Context, req *v1.TSimFlowPackageInfoListReq) (res *v1.TSimFlowPackageInfoListRes, err error) + TSimFlowPackageInfoExport(ctx context.Context, req *v1.TSimFlowPackageInfoExportReq) (res *v1.TSimFlowPackageInfoExportRes, err error) + TSimFlowPackageInfoView(ctx context.Context, req *v1.TSimFlowPackageInfoViewReq) (res *v1.TSimFlowPackageInfoViewRes, err error) + TSimFlowPackageInfoEdit(ctx context.Context, req *v1.TSimFlowPackageInfoEditReq) (res *v1.TSimFlowPackageInfoEditRes, err error) + TSimFlowPackageInfoDelete(ctx context.Context, req *v1.TSimFlowPackageInfoDeleteReq) (res *v1.TSimFlowPackageInfoDeleteRes, err error) + TSimFlowPackageInfoSyncDeptPackages(ctx context.Context, req *v1.TSimFlowPackageInfoSyncDeptPackagesReq) (res *v1.TSimFlowPackageInfoSyncDeptPackagesRes, err error) + TSimFlowPackageInfoFlowPackageList(ctx context.Context, req *v1.TSimFlowPackageInfoFlowPackageListReq) (res *v1.TSimFlowPackageInfoFlowPackageListRes, err error) + TSimFlowPackageInfoFlowPackageAddList(ctx context.Context, req *v1.TSimFlowPackageInfoFlowPackageAddListReq) (res *v1.TSimFlowPackageInfoFlowPackageAddListRes, err error) + TSimFlowPackageInfoGetFlowPackageOptions(ctx context.Context, req *v1.TSimFlowPackageInfoGetFlowPackageOptionsReq) (res *v1.TSimFlowPackageInfoGetFlowPackageOptionsRes, err error) + TSimFlowPackageInfoRenewablePackageOptions(ctx context.Context, req *v1.TSimFlowPackageInfoRenewablePackageOptionsReq) (res *v1.TSimFlowPackageInfoRenewablePackageOptionsRes, err error) + TSimFlowPackagePriceagentTree(ctx context.Context, req *v1.TSimFlowPackagePriceagentTreeReq) (res *v1.TSimFlowPackagePriceagentTreeRes, err error) + TSimFlowPackagePriceAgentPackagePriceList(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceListReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceListRes, err error) + TSimFlowPackagePriceAgentPackagePriceSave(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceSaveReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceSaveRes, err error) + TSimFlowPackagePriceAgentPackagePriceInherit(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceInheritReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceInheritRes, err error) + TSimFlowPackagePriceAgentDefaultPackagePriceList(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceListReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceListRes, err error) + TSimFlowPackagePriceAgentDefaultPackagePriceSave(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveRes, err error) + TSimFlowPackagePriceAgentDefaultPackagePriceInherit(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritRes, err error) + TSimFlowPoolList(ctx context.Context, req *v1.TSimFlowPoolListReq) (res *v1.TSimFlowPoolListRes, err error) + TSimFlowPoolExport(ctx context.Context, req *v1.TSimFlowPoolExportReq) (res *v1.TSimFlowPoolExportRes, err error) + TSimFlowPoolView(ctx context.Context, req *v1.TSimFlowPoolViewReq) (res *v1.TSimFlowPoolViewRes, err error) + TSimFlowPoolEdit(ctx context.Context, req *v1.TSimFlowPoolEditReq) (res *v1.TSimFlowPoolEditRes, err error) + TSimFlowPoolDelete(ctx context.Context, req *v1.TSimFlowPoolDeleteReq) (res *v1.TSimFlowPoolDeleteRes, err error) + TSimFlowPoolSyncPoolCard(ctx context.Context, req *v1.TSimFlowPoolSyncPoolCardReq) (res *v1.TSimFlowPoolSyncPoolCardRes, err error) + TSimFlowPoolGetCardsByPackageCodes(ctx context.Context, req *v1.TSimFlowPoolGetCardsByPackageCodesReq) (res *v1.TSimFlowPoolGetCardsByPackageCodesRes, err error) + TSimPackageCategoryList(ctx context.Context, req *v1.TSimPackageCategoryListReq) (res *v1.TSimPackageCategoryListRes, err error) + TSimPackageCategoryExport(ctx context.Context, req *v1.TSimPackageCategoryExportReq) (res *v1.TSimPackageCategoryExportRes, err error) + TSimPackageCategoryView(ctx context.Context, req *v1.TSimPackageCategoryViewReq) (res *v1.TSimPackageCategoryViewRes, err error) + TSimPackageCategoryEdit(ctx context.Context, req *v1.TSimPackageCategoryEditReq) (res *v1.TSimPackageCategoryEditRes, err error) + TSimPackageCategoryDelete(ctx context.Context, req *v1.TSimPackageCategoryDeleteReq) (res *v1.TSimPackageCategoryDeleteRes, err error) + TSimPoolBindPackageList(ctx context.Context, req *v1.TSimPoolBindPackageListReq) (res *v1.TSimPoolBindPackageListRes, err error) + TSimPoolBindPackageExport(ctx context.Context, req *v1.TSimPoolBindPackageExportReq) (res *v1.TSimPoolBindPackageExportRes, err error) + TSimPoolBindPackageView(ctx context.Context, req *v1.TSimPoolBindPackageViewReq) (res *v1.TSimPoolBindPackageViewRes, err error) + TSimPoolBindPackageEdit(ctx context.Context, req *v1.TSimPoolBindPackageEditReq) (res *v1.TSimPoolBindPackageEditRes, err error) + TSimPoolBindPackageDelete(ctx context.Context, req *v1.TSimPoolBindPackageDeleteReq) (res *v1.TSimPoolBindPackageDeleteRes, err error) + TSimPoolBindPackageAddPackageOptions(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageOptionsReq) (res *v1.TSimPoolBindPackageAddPackageOptionsRes, err error) + TSimPoolBindPackageAddPackagePaymentContext(ctx context.Context, req *v1.TSimPoolBindPackageAddPackagePaymentContextReq) (res *v1.TSimPoolBindPackageAddPackagePaymentContextRes, err error) + TSimPoolBindPackageDownloadExcelTemplate(ctx context.Context, req *v1.TSimPoolBindPackageDownloadExcelTemplateReq) (res *v1.TSimPoolBindPackageDownloadExcelTemplateRes, err error) + TSimPoolBindPackageSubmitExcel(ctx context.Context, req *v1.TSimPoolBindPackageSubmitExcelReq) (res *v1.TSimPoolBindPackageSubmitExcelRes, err error) + TSimPoolBindPackageSubmitInput(ctx context.Context, req *v1.TSimPoolBindPackageSubmitInputReq) (res *v1.TSimPoolBindPackageSubmitInputRes, err error) + TSimPoolBindPackageAddPackageInputPrepare(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageInputPrepareReq) (res *v1.TSimPoolBindPackageAddPackageInputPrepareRes, err error) + TSimPoolBindPackageAddPackagePrepareResult(ctx context.Context, req *v1.TSimPoolBindPackageAddPackagePrepareResultReq) (res *v1.TSimPoolBindPackageAddPackagePrepareResultRes, err error) + TSimPoolBindPackageAddPackageBatchConfirm(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageBatchConfirmReq) (res *v1.TSimPoolBindPackageAddPackageBatchConfirmRes, err error) + TSimPoolWarnConfigList(ctx context.Context, req *v1.TSimPoolWarnConfigListReq) (res *v1.TSimPoolWarnConfigListRes, err error) + TSimPoolWarnConfigExport(ctx context.Context, req *v1.TSimPoolWarnConfigExportReq) (res *v1.TSimPoolWarnConfigExportRes, err error) + TSimPoolWarnConfigView(ctx context.Context, req *v1.TSimPoolWarnConfigViewReq) (res *v1.TSimPoolWarnConfigViewRes, err error) + TSimPoolWarnConfigEdit(ctx context.Context, req *v1.TSimPoolWarnConfigEditReq) (res *v1.TSimPoolWarnConfigEditRes, err error) + TSimPoolWarnConfigDelete(ctx context.Context, req *v1.TSimPoolWarnConfigDeleteReq) (res *v1.TSimPoolWarnConfigDeleteRes, err error) + TSimUpstreamPackageList(ctx context.Context, req *v1.TSimUpstreamPackageListReq) (res *v1.TSimUpstreamPackageListRes, err error) + TSimUpstreamPackageExport(ctx context.Context, req *v1.TSimUpstreamPackageExportReq) (res *v1.TSimUpstreamPackageExportRes, err error) + TSimUpstreamPackageView(ctx context.Context, req *v1.TSimUpstreamPackageViewReq) (res *v1.TSimUpstreamPackageViewRes, err error) + TSimUpstreamPackageEdit(ctx context.Context, req *v1.TSimUpstreamPackageEditReq) (res *v1.TSimUpstreamPackageEditRes, err error) + TSimUpstreamPackageDelete(ctx context.Context, req *v1.TSimUpstreamPackageDeleteReq) (res *v1.TSimUpstreamPackageDeleteRes, err error) + TSimWarningConfigExcelTemplate(ctx context.Context, req *v1.TSimWarningConfigExcelTemplateReq) (res *v1.TSimWarningConfigExcelTemplateRes, err error) + TSimWarningConfigEmailCode(ctx context.Context, req *v1.TSimWarningConfigEmailCodeReq) (res *v1.TSimWarningConfigEmailCodeRes, err error) + TSimWarningConfigExcelSubmit(ctx context.Context, req *v1.TSimWarningConfigExcelSubmitReq) (res *v1.TSimWarningConfigExcelSubmitRes, err error) + TSimWarningConfigInputSubmit(ctx context.Context, req *v1.TSimWarningConfigInputSubmitReq) (res *v1.TSimWarningConfigInputSubmitRes, err error) + TSimWarningConfigRangeSubmit(ctx context.Context, req *v1.TSimWarningConfigRangeSubmitReq) (res *v1.TSimWarningConfigRangeSubmitRes, err error) +} diff --git a/server/api/iot/v1/full_sync_monitor.go b/server/api/iot/v1/full_sync_monitor.go new file mode 100644 index 0000000..36bca0c --- /dev/null +++ b/server/api/iot/v1/full_sync_monitor.go @@ -0,0 +1,85 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry" + + "github.com/gogf/gf/v2/frame/g" +) + +type FullSyncRunsListReq struct { + g.Meta `path:"/fullSyncRuns" method:"get" tags:"全量同步" summary:"查询全量同步" x-check-permission:"cpm:iot:fullSyncRuns:view"` + SyncKind string `json:"syncKind"` + Limit int `json:"limit"` +} + +type FullSyncRunsListRes struct { + Items []fullsyncretry.RunView `json:"items"` + Total int `json:"total"` +} + +type FullSyncRunDetailReq struct { + g.Meta `path:"/fullSyncRuns/{runId}" method:"get" tags:"全量同步" summary:"查看全量同步详情" x-check-permission:"cpm:iot:fullSyncRuns:view"` + RunID string `json:"runId" v:"required"` +} + +type FullSyncRunDetailRes struct { + fullsyncretry.RunView + SyncKind string `json:"syncKind"` + SyncName string `json:"syncName"` +} + +type FullSyncRunFailuresReq struct { + g.Meta `path:"/fullSyncRuns/{runId}/failures" method:"get" tags:"全量同步" summary:"查看全量同步失败明细" x-check-permission:"cpm:iot:fullSyncRuns:failures"` + RunID string `json:"runId" v:"required"` + Limit int `json:"limit"` + Cursor string `json:"cursor"` +} + +type FullSyncRunFailuresRes struct { + Items []fullsyncretry.Failure `json:"items"` + NextCursor string `json:"nextCursor"` +} + +type FullSyncRunStartReq struct { + g.Meta `path:"/fullSyncRuns/start" method:"post" tags:"全量同步" summary:"手动启动全量同步" x-check-permission:"cpm:iot:fullSyncRuns:start"` + SyncKind string `json:"syncKind" v:"required"` + // Channels narrows the run to the listed chanKeys. Empty or omitted means a + // full sync, which is the only behaviour that existed before this field. + Channels []string `json:"channels"` + // QueryDate backfills a specific day (yyyyMMdd) instead of the default + // "yesterday". Only valid when syncKind=traffic_usage_daily; empty keeps the + // default period. + QueryDate string `json:"queryDate"` + // QueryMonth backfills a specific month (yyyyMM) instead of the default + // "previous month". Only valid when syncKind=traffic_usage_monthly; empty + // keeps the default period. + QueryMonth string `json:"queryMonth"` +} + +type FullSyncRunStartRes struct { + RunID string `json:"runId"` + SyncKind string `json:"syncKind"` + Status string `json:"status"` + // ScopeChannels is the normalized channel count; 0 means a full sync. + ScopeChannels int `json:"scopeChannels"` + // QueryPeriod echoes the requested period (yyyyMMdd or yyyyMM); empty means + // the run used its default period. + QueryPeriod string `json:"queryPeriod"` +} + +type FullSyncChannelOptionsReq struct { + g.Meta `path:"/fullSyncRuns/channels" method:"get" tags:"全量同步" summary:"可同步通道候选" x-check-permission:"cpm:iot:fullSyncRuns:view"` +} + +type FullSyncChannelOptionsRes struct { + Items []FullSyncChannelOption `json:"items"` +} + +type FullSyncChannelOption struct { + ChanKey string `json:"chanKey"` + ChanName string `json:"chanName"` + TempKey string `json:"tempKey"` + Operator int `json:"operator"` + CardCount int64 `json:"cardCount"` + SyncEnabled bool `json:"syncEnabled"` +} diff --git a/server/api/iot/v1/full_sync_replay.go b/server/api/iot/v1/full_sync_replay.go new file mode 100644 index 0000000..d968f5f --- /dev/null +++ b/server/api/iot/v1/full_sync_replay.go @@ -0,0 +1,30 @@ +package v1 + +import "github.com/gogf/gf/v2/frame/g" + +type FullSyncReplayReq struct { + g.Meta `path:"/fullSyncRuns/replay" method:"post" tags:"全量同步" summary:"重投Run失败卡" x-check-permission:"cpm:iot:fullSyncRuns:replay"` + SourceRunID string `json:"sourceRunId" v:"required"` + // MaxRounds 省略或为 0 时使用 Worker 配置默认值(当前 3);显式范围为 1..100。 + MaxRounds int `json:"maxRounds" v:"min:0|max:100"` +} + +type FullSyncReplayRes struct { + ReplayRunID string `json:"replayRunId"` + Status string `json:"status"` +} + +type FullSyncReplayStatusReq struct { + g.Meta `path:"/fullSyncRuns/replay/{replayRunId}" method:"get" tags:"全量同步" summary:"查看重投状态" x-check-permission:"cpm:iot:fullSyncRuns:replay:view"` + ReplayRunID string `json:"replayRunId" v:"required"` +} + +type FullSyncReplayStatusRes struct { + ReplayRunID string `json:"replayRunId"` + SourceRunID string `json:"sourceRunId"` + Status string `json:"status"` + Remaining int64 `json:"remaining"` + Enqueued int64 `json:"enqueued"` + RunStatus string `json:"runStatus,omitempty"` + Error string `json:"error,omitempty"` +} diff --git a/server/api/iot/v1/simwarningconfig.go b/server/api/iot/v1/simwarningconfig.go new file mode 100644 index 0000000..31ae3a0 --- /dev/null +++ b/server/api/iot/v1/simwarningconfig.go @@ -0,0 +1,56 @@ +// Package torder +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SimWarningConfigListReq struct { + g.Meta `path:"/simWarningConfig/list" method:"get" tags:"单卡预警配置" summary:"获取单卡预警配置列表" x-check-permission:"cpm:iot:simWarningConfig:list"` + model.SimWarningConfigListParam +} + +type SimWarningConfigListRes struct { + response.PageResult + Items []*model.SimWarningConfigModel `json:"items" dc:"数据列表"` +} + +type SimWarningConfigViewReq struct { + g.Meta `path:"/simWarningConfig/view" method:"get" tags:"单卡预警配置" summary:"获取单卡预警配置详情" x-check-permission:"cpm:iot:simWarningConfig:view"` + model.SimWarningConfigViewParam +} + +type SimWarningConfigViewRes struct { + *model.SimWarningConfigModel +} + +type SimWarningConfigSaveReq struct { + g.Meta `path:"/simWarningConfig/save" method:"post" tags:"单卡预警配置" summary:"保存单卡预警配置" x-check-permission:"cpm:iot:simWarningConfig:save"` + model.SimWarningConfigSaveParam +} + +type SimWarningConfigSaveRes struct { + *model.SimWarningConfigSaveModel +} + +type SimWarningConfigStatusReq struct { + g.Meta `path:"/simWarningConfig/status" method:"post" tags:"单卡预警配置" summary:"启停单卡预警配置" x-check-permission:"cpm:iot:simWarningConfig:status"` + model.SimWarningConfigStatusParam +} + +type SimWarningConfigStatusRes struct{} + +type SimWarningConfigDeleteReq struct { + g.Meta `path:"/simWarningConfig/delete" method:"post" tags:"单卡预警配置" summary:"删除单卡预警配置" x-check-permission:"cpm:iot:simWarningConfig:delete"` + model.SimWarningConfigDeleteParam +} + +type SimWarningConfigDeleteRes struct{} diff --git a/server/api/iot/v1/tflowpackageconfig.go b/server/api/iot/v1/tflowpackageconfig.go new file mode 100644 index 0000000..1b2a477 --- /dev/null +++ b/server/api/iot/v1/tflowpackageconfig.go @@ -0,0 +1,59 @@ +// Package tflowpackageconfig +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tflowpackageconfig + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询SIM流量池套餐配置表列表 +type TFlowPackageConfigListReq struct { + g.Meta `path:"/tFlowPackageConfig/list" method:"get" tags:"SIM流量池套餐配置表" summary:"获取SIM流量池套餐配置表列表" x-check-permission:"cpm:iot:tFlowPackageConfig:list"` + model.TFlowPackageConfigListParam +} + +type TFlowPackageConfigListRes struct { + response.PageResult + Items []*model.TFlowPackageConfigListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出SIM流量池套餐配置表列表 +type TFlowPackageConfigExportReq struct { + g.Meta `path:"/tFlowPackageConfig/export" method:"post" tags:"SIM流量池套餐配置表" summary:"导出SIM流量池套餐配置表列表" x-check-permission:"cpm:iot:tFlowPackageConfig:export"` + model.TFlowPackageConfigListParam +} + +type TFlowPackageConfigExportRes struct{} + +// ViewReq 获取SIM流量池套餐配置表指定信息 +type TFlowPackageConfigViewReq struct { + g.Meta `path:"/tFlowPackageConfig/view" method:"get" tags:"SIM流量池套餐配置表" summary:"获取SIM流量池套餐配置表指定信息" x-check-permission:"cpm:iot:tFlowPackageConfig:view"` + model.TFlowPackageConfigViewParam +} + +type TFlowPackageConfigViewRes struct { + *model.TFlowPackageConfigViewModel +} + +// EditReq 修改/新增SIM流量池套餐配置表 +type TFlowPackageConfigEditReq struct { + g.Meta `path:"/tFlowPackageConfig/edit" method:"post" tags:"SIM流量池套餐配置表" summary:"修改/新增SIM流量池套餐配置表" x-check-permission:"cpm:iot:tFlowPackageConfig:edit"` + model.TFlowPackageConfigEditParam +} + +type TFlowPackageConfigEditRes struct{} + +// DeleteReq 删除SIM流量池套餐配置表 +type TFlowPackageConfigDeleteReq struct { + g.Meta `path:"/tFlowPackageConfig/delete" method:"post" tags:"SIM流量池套餐配置表" summary:"删除SIM流量池套餐配置表" x-check-permission:"cpm:iot:tFlowPackageConfig:delete"` + model.TFlowPackageConfigDeleteParam +} + +type TFlowPackageConfigDeleteRes struct{} diff --git a/server/api/iot/v1/torder.go b/server/api/iot/v1/torder.go new file mode 100644 index 0000000..9d032da --- /dev/null +++ b/server/api/iot/v1/torder.go @@ -0,0 +1,70 @@ +// Package torder +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //torder + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询订单主表列表 +type TOrderListReq struct { + g.Meta `path:"/tOrder/list" method:"get" tags:"订单主表" summary:"获取订单主表列表" x-check-permission:"cpm:iot:tOrder:list"` + model.TOrderListParam +} + +type TOrderListRes struct { + response.PageResult + Items []*model.TOrderListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出订单主表列表 +type TOrderExportReq struct { + g.Meta `path:"/tOrder/export" method:"post" tags:"订单主表" summary:"导出订单主表列表" x-check-permission:"cpm:iot:tOrder:export"` + model.TOrderListParam +} + +type TOrderExportRes struct{} + +// ViewReq 获取订单主表指定信息 +type TOrderViewReq struct { + g.Meta `path:"/tOrder/view" method:"get" tags:"订单主表" summary:"获取订单主表指定信息" x-check-permission:"cpm:iot:tOrder:view"` + model.TOrderViewParam +} + +type TOrderViewRes struct { + *model.TOrderViewModel +} + +// EditReq 修改/新增订单主表 +type TOrderEditReq struct { + g.Meta `path:"/tOrder/edit" method:"post" tags:"订单主表" summary:"修改/新增订单主表" x-check-permission:"cpm:iot:tOrder:edit"` + model.TOrderEditParam +} + +type TOrderEditRes struct{} + +// DeleteReq 删除订单主表 +type TOrderDeleteReq struct { + g.Meta `path:"/tOrder/delete" method:"post" tags:"订单主表" summary:"删除订单主表" x-check-permission:"cpm:iot:tOrder:delete"` + model.TOrderDeleteParam +} + +type TOrderDeleteRes struct{} + +// SellListReq 获取销售订单列表 +type TOrderSellListReq struct { + g.Meta `path:"/tOrder/sellList" method:"get" tags:"订单主表" summary:"获取销售订单列表" x-check-permission:"cpm:iot:tOrder:sellList"` + model.TOrderListParam +} + +type TOrderSellListRes struct { + response.PageResult + Items []*model.TOrderListModel `json:"items" dc:"数据列表"` +} diff --git a/server/api/iot/v1/tsimcardallocate.go b/server/api/iot/v1/tsimcardallocate.go new file mode 100644 index 0000000..bbc44d5 --- /dev/null +++ b/server/api/iot/v1/tsimcardallocate.go @@ -0,0 +1,49 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardAllocateTargetListReq struct { + g.Meta `path:"/tSimCardAllocate/targets" method:"get" tags:"卡划拨" summary:"查询卡划拨目标客户" x-check-permission:"cpm:iot:tSimCardAllocate:targets"` + model.TSimCardAllocateTargetListParam +} + +type TSimCardAllocateExcelTemplateReq struct { + g.Meta `path:"/tSimCardAllocate/excel/template" method:"get" tags:"卡划拨" summary:"下载卡划拨Excel模板" x-check-permission:"cpm:iot:tSimCardAllocate:excel:template"` +} + +type TSimCardAllocateExcelTemplateRes struct{} + +type TSimCardAllocateTargetListRes struct { + Items []*model.TSimCardAllocateTargetModel `json:"items" dc:"目标客户列表"` +} + +type TSimCardAllocateInputPrepareReq struct { + g.Meta `path:"/tSimCardAllocate/input/prepare" method:"post" tags:"卡划拨" summary:"批量输入提交卡划拨异步任务" x-check-permission:"cpm:iot:tSimCardAllocate:input:prepare"` + model.TSimCardAllocatePrepareParam +} + +type TSimCardAllocateInputPrepareRes struct { + *model.TSimCardAllocateBatchModel +} + +type TSimCardAllocateExcelSubmitReq struct { + g.Meta `path:"/tSimCardAllocate/excel/submit" method:"post" tags:"卡划拨" summary:"Excel提交卡划拨异步任务" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardAllocate:excel:submit"` + model.TSimCardAllocateExcelSubmitParam +} + +type TSimCardAllocateExcelSubmitRes struct { + *model.TSimCardAllocateBatchModel +} + +type TSimCardAllocateBatchSubmitReq struct { + g.Meta `path:"/tSimCardAllocate/batch/submit" method:"post" tags:"卡划拨" summary:"确认卡划拨" x-check-permission:"cpm:iot:tSimCardAllocate:batch:submit"` + model.TSimCardAllocateBatchSubmitParam +} + +type TSimCardAllocateBatchSubmitRes struct { + *model.TSimCardAllocateBatchModel +} diff --git a/server/api/iot/v1/tsimcardbindpkg.go b/server/api/iot/v1/tsimcardbindpkg.go new file mode 100644 index 0000000..8a624e0 --- /dev/null +++ b/server/api/iot/v1/tsimcardbindpkg.go @@ -0,0 +1,136 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardBindPkgListReq struct { + g.Meta `path:"/tSimCardBindPkg/list" method:"get" tags:"订购表" summary:"获取订购表列表" x-check-permission:"cpm:iot:tSimCardBindPkg:list"` + model.TSimCardBindPkgListParam +} + +type TSimCardBindPkgListRes struct { + response.PageResult + Items []*model.TSimCardBindPkgListModel `json:"items" dc:"数据列表"` +} + +type TSimCardBindPkgExportReq struct { + g.Meta `path:"/tSimCardBindPkg/export" method:"post" tags:"订购表" summary:"导出订购表列表" x-check-permission:"cpm:iot:tSimCardBindPkg:export"` + model.TSimCardBindPkgListParam +} + +type TSimCardBindPkgExportRes struct{} + +type TSimCardBindPkgViewReq struct { + g.Meta `path:"/tSimCardBindPkg/view" method:"get" tags:"订购表" summary:"获取订购表详情" x-check-permission:"cpm:iot:tSimCardBindPkg:view"` + model.TSimCardBindPkgViewParam +} + +type TSimCardBindPkgViewRes struct { + *model.TSimCardBindPkgViewModel +} + +type TSimCardBindPkgEditReq struct { + g.Meta `path:"/tSimCardBindPkg/edit" method:"post" tags:"订购表" summary:"新增或修改订购表" x-check-permission:"cpm:iot:tSimCardBindPkg:edit"` + model.TSimCardBindPkgEditParam +} + +type TSimCardBindPkgEditRes struct{} + +type TSimCardBindPkgDeleteReq struct { + g.Meta `path:"/tSimCardBindPkg/delete" method:"post" tags:"订购表" summary:"删除订购表" x-check-permission:"cpm:iot:tSimCardBindPkg:delete"` + model.TSimCardBindPkgDeleteParam +} + +type TSimCardBindPkgDeleteRes struct{} + +type TSimCardBindPkgGetPkgInfoReq struct { + g.Meta `path:"/tSimCardBindPkg/getPkgInfo" method:"get" tags:"订购表" summary:"套餐详情查询" x-check-permission:"cpm:iot:tSimCardBindPkg:getPkgInfo"` + model.TSimCardBindPkgInfoParam +} + +type TSimCardBindPkgGetPkgInfoRes struct { + response.PageResult + Items []*model.TSimCardBindPkgListModel `json:"items" dc:"套餐详情列表"` +} + +type TSimCardBindPkgGetChangePkgReq struct { + g.Meta `path:"/tSimCardBindPkg/getChangePkg" method:"get" tags:"订购表" summary:"变更套餐查询" x-check-permission:"cpm:iot:tSimCardBindPkg:getChangePkg"` + model.TSimCardBindPkgInfoParam +} + +type TSimCardBindPkgGetChangePkgRes struct { + response.PageResult + Items []*model.TSimCardBindPkgListModel `json:"items" dc:"变更套餐列表"` +} + +type TSimCardBindPkgAddPackageOptionsReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/options" method:"post" tags:"加油包" summary:"获取单卡可订购加油包" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` + model.TSimCardAddPackageOptionsParam +} + +type TSimCardBindPkgAddPackageOptionsRes struct { + *model.TSimAddPackageOptionsRes +} + +type TSimCardBindPkgAddPackagePaymentContextReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/payment-context" method:"post" tags:"加油包" summary:"获取单卡加油包支付上下文" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` +} + +type TSimCardBindPkgAddPackagePaymentContextRes struct { + *model.TSimAddPackageOptionsRes +} + +type TSimCardBindPkgDownloadExcelTemplateReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/excel/template" method:"get" tags:"加油包" summary:"下载单卡加油包导入模板" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` +} + +type TSimCardBindPkgDownloadExcelTemplateRes struct{} + +type TSimCardBindPkgSubmitExcelReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/excel/submit" method:"post" tags:"加油包" summary:"提交单卡加油包Excel批次" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` + model.TSimCardBindPkgAddPackageExcelSubmitParam +} + +type TSimCardBindPkgSubmitExcelRes struct { + *model.TSimCardBindPkgAddPackageExcelSubmitRes +} + +type TSimCardBindPkgSubmitInputReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/input/submit" method:"post" tags:"加油包" summary:"提交单卡加油包手输批次" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` + model.TSimCardBindPkgAddPackageInputSubmitParam +} + +type TSimCardBindPkgSubmitInputRes struct { + *model.TSimCardBindPkgAddPackageInputSubmitRes +} + +type TSimCardBindPkgAddPackageInputPrepareReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/input/prepare" method:"post" tags:"加油包" summary:"单卡加油包手输预处理" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` + model.TSimCardBindPkgAddPackageInputPrepareParam +} + +type TSimCardBindPkgAddPackageInputPrepareRes struct { + *model.TSimCardBindPkgAddPackageInputPrepareRes +} + +type TSimCardBindPkgAddPackagePrepareResultReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/prepare/result" method:"get" tags:"加油包" summary:"查询单卡加油包预处理结果" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` + BatchNo string `json:"batchNo" v:"required#批次号不能为空" in:"query" dc:"批次号"` +} + +type TSimCardBindPkgAddPackagePrepareResultRes struct { + *model.TSimCardBindPkgAddPackagePrepareResultRes +} + +type TSimCardBindPkgAddPackageBatchConfirmReq struct { + g.Meta `path:"/tSimCardBindPkg/addPackage/batch/confirm" method:"post" tags:"加油包" summary:"确认单卡加油包采购批次" x-check-permission:"cpm:iot:tSimCardBindPkg:addPackage"` + model.TSimCardBindPkgAddPackageBatchConfirmParam +} + +type TSimCardBindPkgAddPackageBatchConfirmRes struct { + *model.TSimCardBindPkgAddPackageBatchConfirmRes +} diff --git a/server/api/iot/v1/tsimcardcancel.go b/server/api/iot/v1/tsimcardcancel.go new file mode 100644 index 0000000..ab1f43e --- /dev/null +++ b/server/api/iot/v1/tsimcardcancel.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardCancelExcelTemplateReq struct { + g.Meta `path:"/tSimCardCancel/excel/template" method:"get" tags:"卡销户" summary:"下载批量卡销户Excel模板" x-check-permission:"cpm:iot:tSimCardCancel:excel:template"` +} + +type TSimCardCancelExcelTemplateRes struct{} + +type TSimCardCancelExcelSubmitReq struct { + g.Meta `path:"/tSimCardCancel/excel/submit" method:"post" tags:"卡销户" summary:"提交Excel批量卡销户" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardCancel:excel:submit"` + model.TSimCardCancelExcelSubmitParam +} + +type TSimCardCancelExcelSubmitRes struct { + *model.TSimCardCancelExcelSubmitRes +} + +type TSimCardCancelInputSubmitReq struct { + g.Meta `path:"/tSimCardCancel/input/submit" method:"post" tags:"卡销户" summary:"提交批量输入卡销户" x-check-permission:"cpm:iot:tSimCardCancel:input:submit"` + model.TSimCardCancelInputSubmitParam +} + +type TSimCardCancelInputSubmitRes struct { + *model.TSimCardCancelInputSubmitRes +} diff --git a/server/api/iot/v1/tsimcardcancellation.go b/server/api/iot/v1/tsimcardcancellation.go new file mode 100644 index 0000000..dd1afa1 --- /dev/null +++ b/server/api/iot/v1/tsimcardcancellation.go @@ -0,0 +1,25 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardCancellationListReq struct { + g.Meta `path:"/tSimCardCancellation/list" method:"get" tags:"销户卡信息" summary:"获取销户卡信息列表" x-check-permission:"cpm:iot:tSimCardCancellation:list"` + model.TSimCardCancellationListParam +} + +type TSimCardCancellationListRes struct { + response.PageResult + Items []*model.TSimCardCancellationListModel `json:"items" dc:"数据列表"` +} + +type TSimCardCancellationExportReq struct { + g.Meta `path:"/tSimCardCancellation/export" method:"post" tags:"销户卡信息" summary:"导出销户卡信息" x-check-permission:"cpm:iot:tSimCardCancellation:export"` + model.TSimCardCancellationFilter +} + +type TSimCardCancellationExportRes struct{} diff --git a/server/api/iot/v1/tsimcardchange.go b/server/api/iot/v1/tsimcardchange.go new file mode 100644 index 0000000..5ee30c6 --- /dev/null +++ b/server/api/iot/v1/tsimcardchange.go @@ -0,0 +1,76 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardChangeExcelTemplateReq struct { + g.Meta `path:"/tSimCardChange/excel/template" method:"get" tags:"卡变更套餐" summary:"下载Excel卡变更套餐模板" x-check-permission:"cpm:iot:tSimCardChange:excel:template"` +} + +type TSimCardChangeExcelTemplateRes struct{} + +type TSimCardChangeExcelSubmitReq struct { + g.Meta `path:"/tSimCardChange/excel/submit" method:"post" tags:"卡变更套餐" summary:"提交Excel卡变更套餐" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardChange:excel:submit"` + model.TSimCardChangeExcelSubmitParam +} + +type TSimCardChangeExcelSubmitRes struct { + *model.TSimCardChangeExcelSubmitRes +} + +type TSimCardChangeInputOptionsReq struct { + g.Meta `path:"/tSimCardChange/input/change-options" method:"post" tags:"卡变更套餐" summary:"获取批量输入卡可变更套餐" x-check-permission:"cpm:iot:tSimCardChange:input:prepare"` + model.TSimCardChangeInputOptionsParam +} + +type TSimCardChangeInputOptionsRes struct { + *model.TSimCardChangeOptionsRes +} + +type TSimCardChangeRangeOptionsReq struct { + g.Meta `path:"/tSimCardChange/range/change-options" method:"post" tags:"卡变更套餐" summary:"获取连号卡可变更套餐" x-check-permission:"cpm:iot:tSimCardChange:range:prepare"` + model.TSimCardChangeRangeOptionsParam +} + +type TSimCardChangeRangeOptionsRes struct { + *model.TSimCardChangeOptionsRes +} + +type TSimCardChangeInputPrepareReq struct { + g.Meta `path:"/tSimCardChange/input/prepare" method:"post" tags:"卡变更套餐" summary:"批量输入卡变更套餐预处理" x-check-permission:"cpm:iot:tSimCardChange:input:prepare"` + model.TSimCardChangeInputPrepareParam +} + +type TSimCardChangeInputPrepareRes struct { + *model.TSimCardChangeBatchPrepareRes +} + +type TSimCardChangeRangePrepareReq struct { + g.Meta `path:"/tSimCardChange/range/prepare" method:"post" tags:"卡变更套餐" summary:"连号卡变更套餐预处理" x-check-permission:"cpm:iot:tSimCardChange:range:prepare"` + model.TSimCardChangeRangePrepareParam +} + +type TSimCardChangeRangePrepareRes struct { + *model.TSimCardChangeBatchPrepareRes +} + +type TSimCardChangeBatchSubmitReq struct { + g.Meta `path:"/tSimCardChange/batch/submit" method:"post" tags:"卡变更套餐" summary:"提交批次卡变更套餐" x-check-permission:"cpm:iot:tSimCardChange:batch:submit"` + model.TSimCardChangeBatchSubmitParam +} + +type TSimCardChangeBatchSubmitRes struct { + *model.TSimCardChangeBatchSubmitRes +} + +type TSimCardChangePrepareResultReq struct { + g.Meta `path:"/tSimCardChange/prepare/result" method:"get" tags:"卡变更套餐" summary:"查询卡变更预处理结果" x-check-permission:"cpm:iot:tSimCardChange:prepare:result"` + BatchNo string `json:"batchNo" v:"required#批次号不能为空" in:"query" dc:"批次号"` +} + +type TSimCardChangePrepareResultRes struct { + *model.TSimCardChangePrepareResultRes +} diff --git a/server/api/iot/v1/tsimcarddatacut.go b/server/api/iot/v1/tsimcarddatacut.go new file mode 100644 index 0000000..e896200 --- /dev/null +++ b/server/api/iot/v1/tsimcarddatacut.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardDataCutExcelTemplateReq struct { + g.Meta `path:"/tSimCardDataCut/excel/template" method:"get" tags:"达量断网" summary:"下载批量达量断网Excel模板" x-check-permission:"cpm:iot:tSimCardDataCut:excel:template"` +} + +type TSimCardDataCutExcelTemplateRes struct{} + +type TSimCardDataCutExcelSubmitReq struct { + g.Meta `path:"/tSimCardDataCut/excel/submit" method:"post" tags:"达量断网" summary:"提交Excel批量达量断网" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardDataCut:excel:submit"` + model.TSimCardDataCutExcelSubmitParam +} + +type TSimCardDataCutExcelSubmitRes struct { + *model.TSimCardDataCutExcelSubmitRes +} + +type TSimCardDataCutInputSubmitReq struct { + g.Meta `path:"/tSimCardDataCut/input/submit" method:"post" tags:"达量断网" summary:"提交批量输入达量断网" x-check-permission:"cpm:iot:tSimCardDataCut:input:submit"` + model.TSimCardDataCutInputSubmitParam +} + +type TSimCardDataCutInputSubmitRes struct { + *model.TSimCardDataCutInputSubmitRes +} diff --git a/server/api/iot/v1/tsimcarddatastart.go b/server/api/iot/v1/tsimcarddatastart.go new file mode 100644 index 0000000..12b9741 --- /dev/null +++ b/server/api/iot/v1/tsimcarddatastart.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardDataStartExcelTemplateReq struct { + g.Meta `path:"/tSimCardDataStart/excel/template" method:"get" tags:"数据服务开通" summary:"下载批量数据服务开通Excel模板" x-check-permission:"cpm:iot:tSimCardDataStart:excel:template"` +} + +type TSimCardDataStartExcelTemplateRes struct{} + +type TSimCardDataStartExcelSubmitReq struct { + g.Meta `path:"/tSimCardDataStart/excel/submit" method:"post" tags:"数据服务开通" summary:"提交Excel批量数据服务开通" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardDataStart:excel:submit"` + model.TSimCardDataStartExcelSubmitParam +} + +type TSimCardDataStartExcelSubmitRes struct { + *model.TSimCardDataStartSubmitRes +} + +type TSimCardDataStartInputSubmitReq struct { + g.Meta `path:"/tSimCardDataStart/input/submit" method:"post" tags:"数据服务开通" summary:"提交批量输入数据服务开通" x-check-permission:"cpm:iot:tSimCardDataStart:input:submit"` + model.TSimCardDataStartInputSubmitParam +} + +type TSimCardDataStartInputSubmitRes struct { + *model.TSimCardDataStartSubmitRes +} diff --git a/server/api/iot/v1/tsimcarddatastop.go b/server/api/iot/v1/tsimcarddatastop.go new file mode 100644 index 0000000..597524d --- /dev/null +++ b/server/api/iot/v1/tsimcarddatastop.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardDataStopExcelTemplateReq struct { + g.Meta `path:"/tSimCardDataStop/excel/template" method:"get" tags:"数据服务停用" summary:"下载批量数据服务停用Excel模板" x-check-permission:"cpm:iot:tSimCardDataStop:excel:template"` +} + +type TSimCardDataStopExcelTemplateRes struct{} + +type TSimCardDataStopExcelSubmitReq struct { + g.Meta `path:"/tSimCardDataStop/excel/submit" method:"post" tags:"数据服务停用" summary:"提交Excel批量数据服务停用" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardDataStop:excel:submit"` + model.TSimCardDataStopExcelSubmitParam +} + +type TSimCardDataStopExcelSubmitRes struct { + *model.TSimCardDataStopSubmitRes +} + +type TSimCardDataStopInputSubmitReq struct { + g.Meta `path:"/tSimCardDataStop/input/submit" method:"post" tags:"数据服务停用" summary:"提交批量输入数据服务停用" x-check-permission:"cpm:iot:tSimCardDataStop:input:submit"` + model.TSimCardDataStopInputSubmitParam +} + +type TSimCardDataStopInputSubmitRes struct { + *model.TSimCardDataStopSubmitRes +} diff --git a/server/api/iot/v1/tsimcardinbound.go b/server/api/iot/v1/tsimcardinbound.go new file mode 100644 index 0000000..0e5d478 --- /dev/null +++ b/server/api/iot/v1/tsimcardinbound.go @@ -0,0 +1,40 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardInboundExcelTemplateReq struct { + g.Meta `path:"/tSimCardInbound/excel/template" method:"get" tags:"卡入库" summary:"下载Excel批量卡入库模板" x-check-permission:"cpm:iot:tSimCardInbound:excel:template"` +} + +type TSimCardInboundExcelTemplateRes struct{} + +type TSimCardInboundExcelSubmitReq struct { + g.Meta `path:"/tSimCardInbound/excel/submit" method:"post" tags:"卡入库" summary:"提交Excel批量卡入库" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardInbound:excel:submit"` + model.TSimCardInboundExcelSubmitParam +} + +type TSimCardInboundExcelSubmitRes struct { + *model.TSimCardInboundExcelSubmitRes +} + +type TSimCardInboundRangeSubmitReq struct { + g.Meta `path:"/tSimCardInbound/range/submit" method:"post" tags:"卡入库" summary:"提交连号批量卡入库" x-check-permission:"cpm:iot:tSimCardInbound:range:submit"` + model.TSimCardInboundRangeSubmitParam +} + +type TSimCardInboundRangeSubmitRes struct { + *model.TSimCardInboundRangeSubmitRes +} + +type TSimCardInboundInputSubmitReq struct { + g.Meta `path:"/tSimCardInbound/input/submit" method:"post" tags:"卡入库" summary:"提交批量输入卡入库" x-check-permission:"cpm:iot:tSimCardInbound:input:submit"` + model.TSimCardInboundInputSubmitParam +} + +type TSimCardInboundInputSubmitRes struct { + *model.TSimCardInboundInputSubmitRes +} diff --git a/server/api/iot/v1/tsimcardinfo.go b/server/api/iot/v1/tsimcardinfo.go new file mode 100644 index 0000000..048d84b --- /dev/null +++ b/server/api/iot/v1/tsimcardinfo.go @@ -0,0 +1,99 @@ +// Package tsimcardinfo +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimcardinfo + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询卡信息表列表 +type TSimCardInfoListReq struct { + g.Meta `path:"/tSimCardInfo/list" method:"get" tags:"卡信息表" summary:"获取卡信息表列表" x-check-permission:"cpm:iot:tSimCardInfo:list"` + model.TSimCardInfoListParam +} + +type TSimCardInfoListRes struct { + response.PageResult + Items []*model.TSimCardInfoListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出卡信息表列表 +type TSimCardInfoExportReq struct { + g.Meta `path:"/tSimCardInfo/export" method:"post" tags:"卡信息表" summary:"导出卡信息表列表" x-check-permission:"cpm:iot:tSimCardInfo:export"` + model.TSimCardInfoListParam +} + +type TSimCardInfoExportRes struct{} + +// ViewReq 获取卡信息表指定信息 +type TSimCardInfoViewReq struct { + g.Meta `path:"/tSimCardInfo/view" method:"get" tags:"卡信息表" summary:"获取卡信息表指定信息" x-check-permission:"cpm:iot:tSimCardInfo:view"` + model.TSimCardInfoViewParam +} + +type TSimCardInfoViewRes struct { + *model.TSimCardInfoViewModel +} + +// EditReq 修改/新增卡信息表 +type TSimCardInfoEditReq struct { + g.Meta `path:"/tSimCardInfo/edit" method:"post" tags:"卡信息表" summary:"修改/新增卡信息表" x-check-permission:"cpm:iot:tSimCardInfo:edit"` + model.TSimCardInfoEditParam +} + +type TSimCardInfoEditRes struct{} + +// DeleteReq 删除卡信息表 +type TSimCardInfoDeleteReq struct { + g.Meta `path:"/tSimCardInfo/delete" method:"post" tags:"卡信息表" summary:"删除卡信息表" x-check-permission:"cpm:iot:tSimCardInfo:delete"` + model.TSimCardInfoDeleteParam +} + +type TSimCardInfoDeleteRes struct{} + +// SyncSimCardFlowReq 同步SIM卡流量 +type TSimCardInfoSyncSimCardFlowReq struct { + g.Meta `path:"/tSimCardInfo/syncSimCardFlow" method:"post" tags:"卡信息表" summary:"同步SIM卡流量" x-check-permission:"cpm:iot:tSimCardInfo:syncCardFlow"` + model.SyncSimCardFlowInput +} +type TSimCardInfoSyncSimCardFlowRes struct{} + +// SyncSimCardStatusReq 同步SIM卡状态 +type TSimCardInfoSyncSimCardStatusReq struct { + g.Meta `path:"/tSimCardInfo/syncSimCardStatus" method:"post" tags:"卡信息表" summary:"同步SIM卡状态" x-check-permission:"cpm:iot:tSimCardInfo:syncSimCardStatus"` + model.SyncSimCardStatusInput +} +type TSimCardInfoSyncSimCardStatusRes struct{} + +// SyncSimCardStatusQueueReq enqueues one SIM status query without calling the +// legacy synchronous status implementation. +type TSimCardInfoSyncSimCardStatusQueueReq struct { + g.Meta `path:"/tSimCardInfo/syncSimCardStatusQueue" method:"post" tags:"卡信息表" summary:"异步同步SIM卡状态" x-check-permission:"cpm:iot:tSimCardInfo:syncSimCardStatusQueue"` + model.SyncSimCardStatusInput +} +type TSimCardInfoSyncSimCardStatusQueueRes struct{} + +// QuerySimSessionReq 查询SIM卡会话 +type TSimCardInfoQuerySimSessionReq struct { + g.Meta `path:"/tSimCardInfo/querySimSession" method:"get" tags:"卡信息表" summary:"查询SIM卡会话" x-check-permission:"cpm:iot:tSimCardInfo:querySimSession"` + model.QuerySimSessionInput +} +type TSimCardInfoQuerySimSessionRes struct { + *model.QuerySimSessionOutput +} + +// QuerySimStatusReq 查询SIM卡状态 +type TSimCardInfoQuerySimStatusReq struct { + g.Meta `path:"/tSimCardInfo/querySimStatus" method:"get" tags:"卡信息表" summary:"查询SIM卡状态" x-check-permission:"cpm:iot:tSimCardInfo:querySimStatus"` + model.QuerySimStatusInput +} +type TSimCardInfoQuerySimStatusRes struct { + *model.QuerySimStatusOutput +} diff --git a/server/api/iot/v1/tsimcardoutbound.go b/server/api/iot/v1/tsimcardoutbound.go new file mode 100644 index 0000000..86e12df --- /dev/null +++ b/server/api/iot/v1/tsimcardoutbound.go @@ -0,0 +1,76 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardOutboundExcelTemplateReq struct { + g.Meta `path:"/tSimCardOutbound/excel/template" method:"get" tags:"卡出库" summary:"下载Excel批量卡出库模板" x-check-permission:"cpm:iot:tSimCardOutbound:excel:template"` +} + +type TSimCardOutboundExcelTemplateRes struct{} + +type TSimCardOutboundExcelSubmitReq struct { + g.Meta `path:"/tSimCardOutbound/excel/submit" method:"post" tags:"卡出库" summary:"提交Excel批量卡出库校验批次" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardOutbound:excel:submit"` + model.TSimCardOutboundExcelSubmitParam +} + +type TSimCardOutboundExcelSubmitRes struct { + *model.TSimCardOutboundExcelSubmitRes +} + +type TSimCardOutboundRangeSubmitReq struct { + g.Meta `path:"/tSimCardOutbound/range/submit" method:"post" tags:"卡出库" summary:"提交连号卡出库校验批次" x-check-permission:"cpm:iot:tSimCardOutbound:range:submit"` + model.TSimCardOutboundRangeSubmitParam +} + +type TSimCardOutboundRangeSubmitRes struct { + *model.TSimCardOutboundRangeSubmitRes +} + +type TSimCardOutboundInputSubmitReq struct { + g.Meta `path:"/tSimCardOutbound/input/submit" method:"post" tags:"卡出库" summary:"提交批量输入卡出库" x-check-permission:"cpm:iot:tSimCardOutbound:input:submit"` + model.TSimCardOutboundInputSubmitParam +} + +type TSimCardOutboundInputSubmitRes struct { + *model.TSimCardOutboundInputSubmitRes +} + +type TSimCardOutboundInboundBatchListReq struct { + g.Meta `path:"/tSimCardOutbound/inboundBatch/list" method:"get" tags:"卡出库" summary:"查询可出库批次列表" x-check-permission:"cpm:iot:tSimCardOutbound:inboundBatch:list"` + model.TSimCardOutboundInboundBatchListParam +} + +type TSimCardOutboundInboundBatchListRes struct { + *model.TSimCardOutboundInboundBatchListRes +} + +type TSimCardOutboundInboundBatchCardsReq struct { + g.Meta `path:"/tSimCardOutbound/inboundBatch/cards" method:"get" tags:"卡出库" summary:"查询指定批次卡列表" x-check-permission:"cpm:iot:tSimCardOutbound:inboundBatch:cards"` + model.TSimCardOutboundInboundBatchCardsParam +} + +type TSimCardOutboundInboundBatchCardsRes struct { + *model.TSimCardOutboundInboundBatchCardsRes +} + +type TSimCardOutboundBatchSubmitReq struct { + g.Meta `path:"/tSimCardOutbound/batch/submit" method:"post" tags:"卡出库" summary:"提交指定批次卡出库" x-check-permission:"cpm:iot:tSimCardOutbound:batch:submit"` + model.TSimCardOutboundBatchSubmitParam +} + +type TSimCardOutboundBatchSubmitRes struct { + *model.TSimCardOutboundBatchSubmitRes +} + +type TSimCardOutboundCustomerBalanceReq struct { + g.Meta `path:"/tSimCardOutbound/customerBalance" method:"get" tags:"卡出库" summary:"查询出库客户账户余额" x-check-permission:""` + model.TSimCardOutboundCustomerBalanceParam +} + +type TSimCardOutboundCustomerBalanceRes struct { + *model.TSimCardOutboundCustomerBalanceRes +} diff --git a/server/api/iot/v1/tsimcardrenew.go b/server/api/iot/v1/tsimcardrenew.go new file mode 100644 index 0000000..9d0b1b2 --- /dev/null +++ b/server/api/iot/v1/tsimcardrenew.go @@ -0,0 +1,49 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardRenewExcelTemplateReq struct { + g.Meta `path:"/tSimCardRenew/excel/template" method:"get" tags:"卡续费" summary:"下载Excel卡续费模板" x-check-permission:"cpm:iot:tSimCardRenew:excel:template"` +} + +type TSimCardRenewExcelTemplateRes struct{} + +type TSimCardRenewExcelSubmitReq struct { + g.Meta `path:"/tSimCardRenew/excel/submit" method:"post" tags:"卡续费" summary:"提交Excel卡续费" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardRenew:excel:submit"` + model.TSimCardRenewExcelSubmitParam +} + +type TSimCardRenewExcelSubmitRes struct { + *model.TSimCardRenewExcelSubmitRes +} + +type TSimCardRenewInputPrepareReq struct { + g.Meta `path:"/tSimCardRenew/input/prepare" method:"post" tags:"卡续费" summary:"批量输入卡续费预处理" x-check-permission:"cpm:iot:tSimCardRenew:input:prepare"` + model.TSimCardRenewInputPrepareParam +} + +type TSimCardRenewInputPrepareRes struct { + *model.TSimCardRenewBatchPrepareRes +} + +type TSimCardRenewBatchConfirmReq struct { + g.Meta `path:"/tSimCardRenew/batch/confirm" method:"post" tags:"卡续费" summary:"确认批次卡续费" x-check-permission:"cpm:iot:tSimCardRenew:batch:confirm"` + model.TSimCardRenewBatchConfirmParam +} + +type TSimCardRenewBatchConfirmRes struct { + *model.TSimCardRenewBatchConfirmRes +} + +type TSimCardRenewPrepareResultReq struct { + g.Meta `path:"/tSimCardRenew/prepare/result" method:"get" tags:"卡续费" summary:"查询卡续费预处理结果" x-check-permission:"cpm:iot:tSimCardRenew:prepare:result"` + BatchNo string `json:"batchNo" v:"required#批次号不能为空" in:"query" dc:"批次号"` +} + +type TSimCardRenewPrepareResultRes struct { + *model.TSimCardRenewPrepareResultRes +} diff --git a/server/api/iot/v1/tsimcardrestart.go b/server/api/iot/v1/tsimcardrestart.go new file mode 100644 index 0000000..edf193c --- /dev/null +++ b/server/api/iot/v1/tsimcardrestart.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardRestartExcelTemplateReq struct { + g.Meta `path:"/tSimCardRestart/excel/template" method:"get" tags:"自主重启" summary:"下载批量自主重启Excel模板" x-check-permission:"cpm:iot:tSimCardRestart:excel:template"` +} + +type TSimCardRestartExcelTemplateRes struct{} + +type TSimCardRestartExcelSubmitReq struct { + g.Meta `path:"/tSimCardRestart/excel/submit" method:"post" tags:"自主重启" summary:"提交Excel批量自主重启" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardRestart:excel:submit"` + model.TSimCardRestartExcelSubmitParam +} + +type TSimCardRestartExcelSubmitRes struct { + *model.TSimCardRestartExcelSubmitRes +} + +type TSimCardRestartInputSubmitReq struct { + g.Meta `path:"/tSimCardRestart/input/submit" method:"post" tags:"自主重启" summary:"提交批量输入自主重启" x-check-permission:"cpm:iot:tSimCardRestart:input:submit"` + model.TSimCardRestartInputSubmitParam +} + +type TSimCardRestartInputSubmitRes struct { + *model.TSimCardRestartInputSubmitRes +} diff --git a/server/api/iot/v1/tsimcardstart.go b/server/api/iot/v1/tsimcardstart.go new file mode 100644 index 0000000..28bc6cf --- /dev/null +++ b/server/api/iot/v1/tsimcardstart.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardStartExcelTemplateReq struct { + g.Meta `path:"/tSimCardStart/excel/template" method:"get" tags:"自主复机" summary:"下载批量自主复机Excel模板" x-check-permission:"cpm:iot:tSimCardStart:excel:template"` +} + +type TSimCardStartExcelTemplateRes struct{} + +type TSimCardStartExcelSubmitReq struct { + g.Meta `path:"/tSimCardStart/excel/submit" method:"post" tags:"自主复机" summary:"提交Excel批量自主复机" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardStart:excel:submit"` + model.TSimCardStartExcelSubmitParam +} + +type TSimCardStartExcelSubmitRes struct { + *model.TSimCardStartExcelSubmitRes +} + +type TSimCardStartInputSubmitReq struct { + g.Meta `path:"/tSimCardStart/input/submit" method:"post" tags:"自主复机" summary:"提交批量输入自主复机" x-check-permission:"cpm:iot:tSimCardStart:input:submit"` + model.TSimCardStartInputSubmitParam +} + +type TSimCardStartInputSubmitRes struct { + *model.TSimCardStartInputSubmitRes +} diff --git a/server/api/iot/v1/tsimcardstock.go b/server/api/iot/v1/tsimcardstock.go new file mode 100644 index 0000000..80ab4a2 --- /dev/null +++ b/server/api/iot/v1/tsimcardstock.go @@ -0,0 +1,59 @@ +// Package tsimcardstock +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimcardstock + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询库存卡信息表列表 +type TSimCardStockListReq struct { + g.Meta `path:"/tSimCardStock/list" method:"get" tags:"库存卡信息表" summary:"获取库存卡信息表列表" x-check-permission:"cpm:iot:tSimCardStock:list"` + model.TSimCardStockListParam +} + +type TSimCardStockListRes struct { + response.PageResult + Items []*model.TSimCardStockListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出库存卡信息表列表 +type TSimCardStockExportReq struct { + g.Meta `path:"/tSimCardStock/export" method:"post" tags:"库存卡信息表" summary:"导出库存卡信息表列表" x-check-permission:"cpm:iot:tSimCardStock:export"` + model.TSimCardStockListParam +} + +type TSimCardStockExportRes struct{} + +// ViewReq 获取库存卡信息表指定信息 +type TSimCardStockViewReq struct { + g.Meta `path:"/tSimCardStock/view" method:"get" tags:"库存卡信息表" summary:"获取库存卡信息表指定信息" x-check-permission:"cpm:iot:tSimCardStock:view"` + model.TSimCardStockViewParam +} + +type TSimCardStockViewRes struct { + *model.TSimCardStockViewModel +} + +// EditReq 修改/新增库存卡信息表 +type TSimCardStockEditReq struct { + g.Meta `path:"/tSimCardStock/edit" method:"post" tags:"库存卡信息表" summary:"修改/新增库存卡信息表" x-check-permission:"cpm:iot:tSimCardStock:edit"` + model.TSimCardStockEditParam +} + +type TSimCardStockEditRes struct{} + +// DeleteReq 删除库存卡信息表 +type TSimCardStockDeleteReq struct { + g.Meta `path:"/tSimCardStock/delete" method:"post" tags:"库存卡信息表" summary:"删除库存卡信息表" x-check-permission:"cpm:iot:tSimCardStock:delete"` + model.TSimCardStockDeleteParam +} + +type TSimCardStockDeleteRes struct{} diff --git a/server/api/iot/v1/tsimcardstop.go b/server/api/iot/v1/tsimcardstop.go new file mode 100644 index 0000000..c530114 --- /dev/null +++ b/server/api/iot/v1/tsimcardstop.go @@ -0,0 +1,31 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardStopExcelTemplateReq struct { + g.Meta `path:"/tSimCardStop/excel/template" method:"get" tags:"自主停机" summary:"下载批量自主停机Excel模板" x-check-permission:"cpm:iot:tSimCardStop:excel:template"` +} + +type TSimCardStopExcelTemplateRes struct{} + +type TSimCardStopExcelSubmitReq struct { + g.Meta `path:"/tSimCardStop/excel/submit" method:"post" tags:"自主停机" summary:"提交Excel批量自主停机" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardStop:excel:submit"` + model.TSimCardStopExcelSubmitParam +} + +type TSimCardStopExcelSubmitRes struct { + *model.TSimCardStopExcelSubmitRes +} + +type TSimCardStopInputSubmitReq struct { + g.Meta `path:"/tSimCardStop/input/submit" method:"post" tags:"自主停机" summary:"提交批量输入自主停机" x-check-permission:"cpm:iot:tSimCardStop:input:submit"` + model.TSimCardStopInputSubmitParam +} + +type TSimCardStopInputSubmitRes struct { + *model.TSimCardStopInputSubmitRes +} diff --git a/server/api/iot/v1/tsimcardtrafficcutoff.go b/server/api/iot/v1/tsimcardtrafficcutoff.go new file mode 100644 index 0000000..ba8fcfa --- /dev/null +++ b/server/api/iot/v1/tsimcardtrafficcutoff.go @@ -0,0 +1,72 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardTrafficCutoffExcelTemplateReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/excel/template" method:"get" tags:"达量断网配置" summary:"下载达量断网配置Excel模板" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:excel:template"` +} + +type TSimCardTrafficCutoffExcelTemplateRes struct{} + +type TSimCardTrafficCutoffExcelSubmitReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/excel/submit" method:"post" tags:"达量断网配置" summary:"提交Excel批量达量断网配置" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:excel:submit"` + model.TSimCardTrafficCutoffExcelSubmitParam +} + +type TSimCardTrafficCutoffExcelSubmitRes struct { + *model.TSimCardTrafficCutoffExcelSubmitRes +} + +type TSimCardTrafficCutoffInputSubmitReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/input/submit" method:"post" tags:"达量断网配置" summary:"提交批量输入达量断网配置" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:input:submit"` + model.TSimCardTrafficCutoffInputSubmitParam +} + +type TSimCardTrafficCutoffInputSubmitRes struct { + *model.TSimCardTrafficCutoffInputSubmitRes +} + +type TSimCardTrafficCutoffRangeSubmitReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/range/submit" method:"post" tags:"达量断网配置" summary:"提交连号达量断网配置" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:range:submit"` + model.TSimCardTrafficCutoffRangeSubmitParam +} + +type TSimCardTrafficCutoffRangeSubmitRes struct { + *model.TSimCardTrafficCutoffRangeSubmitRes +} + +type TSimCardTrafficCutoffListReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/list" method:"get" tags:"达量断网卡信息" summary:"查询达量断网卡信息" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:list"` + model.TSimCardTrafficCutoffListParam +} + +type TSimCardTrafficCutoffListRes struct { + response.PageResult + Items []*model.TSimCardInfoListModel `json:"items"` +} + +type TSimCardTrafficCutoffExportReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/export" method:"post" tags:"达量断网卡信息" summary:"导出达量断网卡信息" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:export"` + model.TSimCardTrafficCutoffListParam +} + +type TSimCardTrafficCutoffExportRes struct{} + +type TSimCardTrafficCutoffEditReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/edit" method:"post" tags:"达量断网卡信息" summary:"修改达量断网配置" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:edit"` + model.TSimCardTrafficCutoffEditParam +} + +type TSimCardTrafficCutoffEditRes struct{} + +type TSimCardTrafficCutoffDeleteReq struct { + g.Meta `path:"/tSimCardTrafficCutoff/delete" method:"post" tags:"达量断网卡信息" summary:"删除达量断网配置" x-check-permission:"cpm:iot:tSimCardTrafficCutoff:delete"` + model.TSimCardTrafficCutoffDeleteParam +} + +type TSimCardTrafficCutoffDeleteRes struct{} diff --git a/server/api/iot/v1/tsimcardunsub.go b/server/api/iot/v1/tsimcardunsub.go new file mode 100644 index 0000000..0d3fc54 --- /dev/null +++ b/server/api/iot/v1/tsimcardunsub.go @@ -0,0 +1,40 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimCardUnsubExcelTemplateReq struct { + g.Meta `path:"/tSimCardUnsub/excel/template" method:"get" tags:"卡退订" summary:"下载Excel卡退订模板" x-check-permission:"cpm:iot:tSimCardUnsub:excel:template"` +} + +type TSimCardUnsubExcelTemplateRes struct{} + +type TSimCardUnsubExcelSubmitReq struct { + g.Meta `path:"/tSimCardUnsub/excel/submit" method:"post" tags:"卡退订" summary:"提交Excel卡退订" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimCardUnsub:excel:submit"` + model.TSimCardUnsubExcelSubmitParam +} + +type TSimCardUnsubExcelSubmitRes struct { + *model.TSimCardUnsubExcelSubmitRes +} + +type TSimCardUnsubInputSubmitReq struct { + g.Meta `path:"/tSimCardUnsub/input/submit" method:"post" tags:"卡退订" summary:"提交批量输入卡退订" x-check-permission:"cpm:iot:tSimCardUnsub:input:submit"` + model.TSimCardUnsubInputSubmitParam +} + +type TSimCardUnsubInputSubmitRes struct { + *model.TSimCardUnsubInputSubmitRes +} + +type TSimCardUnsubRangeSubmitReq struct { + g.Meta `path:"/tSimCardUnsub/range/submit" method:"post" tags:"卡退订" summary:"提交连号卡退订" x-check-permission:"cpm:iot:tSimCardUnsub:range:submit"` + model.TSimCardUnsubRangeSubmitParam +} + +type TSimCardUnsubRangeSubmitRes struct { + *model.TSimCardUnsubRangeSubmitRes +} diff --git a/server/api/iot/v1/tsimchannels.go b/server/api/iot/v1/tsimchannels.go new file mode 100644 index 0000000..418d896 --- /dev/null +++ b/server/api/iot/v1/tsimchannels.go @@ -0,0 +1,74 @@ +// Package tsimchannels +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimchannels + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询通道列表列表 +type TSimChannelsListReq struct { + g.Meta `path:"/tSimChannels/list" method:"get" tags:"通道管理" summary:"获取通道管理列表" x-check-permission:"cpm:iot:tSimChannels:list"` + model.TSimChannelsListParam +} + +type TSimChannelsListRes struct { + response.PageResult + Items []*model.TSimChannelsListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出通道列表列表 +type TSimChannelsExportReq struct { + g.Meta `path:"/tSimChannels/export" method:"post" tags:"通道管理" summary:"导出通道管理列表" x-check-permission:"cpm:iot:tSimChannels:export"` + model.TSimChannelsListParam +} + +type TSimChannelsExportRes struct{} + +// ViewReq 获取通道列表指定信息 +type TSimChannelsViewReq struct { + g.Meta `path:"/tSimChannels/view" method:"get" tags:"通道管理" summary:"获取通道管理指定信息" x-check-permission:"cpm:iot:tSimChannels:view"` + model.TSimChannelsViewParam +} + +type TSimChannelsViewRes struct { + *model.TSimChannelsViewModel +} + +// EditReq 修改/新增通道列表 +type TSimChannelsEditReq struct { + g.Meta `path:"/tSimChannels/edit" method:"post" tags:"通道管理" summary:"修改/新增通道管理" x-check-permission:"cpm:iot:tSimChannels:edit"` + model.TSimChannelsEditParam +} + +type TSimChannelsEditRes struct{} + +// DeleteReq 删除通道列表 +type TSimChannelsDeleteReq struct { + g.Meta `path:"/tSimChannels/delete" method:"post" tags:"通道管理" summary:"删除通道管理" x-check-permission:"cpm:iot:tSimChannels:delete"` + model.TSimChannelsDeleteParam +} + +type TSimChannelsDeleteRes struct{} + +type TSimChannelsTestReq struct { + g.Meta `path:"/tSimChannels/test" method:"post" tags:"通道管理" summary:"测试通道查询接口" x-check-permission:"cpm:iot:tSimChannels:test"` + model.TSimChannelsTestParam +} + +type TSimChannelsTestRes struct { + *model.TSimChannelsTestOutput +} + +type TSimChannelsRefreshCardCountReq struct { + g.Meta `path:"/tSimChannels/refresh-card-count" method:"post" tags:"通道管理" summary:"刷新通道卡数量" x-check-permission:"cpm:iot:tSimChannels:list"` +} + +type TSimChannelsRefreshCardCountRes struct{} diff --git a/server/api/iot/v1/tsimchanneltemplate.go b/server/api/iot/v1/tsimchanneltemplate.go new file mode 100644 index 0000000..3e27c7e --- /dev/null +++ b/server/api/iot/v1/tsimchanneltemplate.go @@ -0,0 +1,59 @@ +// Package tsimchanneltemplate +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimchanneltemplate + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询通道模板列表 +type TSimChannelTemplateListReq struct { + g.Meta `path:"/tSimChannelTemplate/list" method:"get" tags:"通道模板" summary:"获取通道模板列表" x-check-permission:"cpm:iot:tSimChannelTemplate:list"` + model.TSimChannelTemplateListParam +} + +type TSimChannelTemplateListRes struct { + response.PageResult + Items []*model.TSimChannelTemplateListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出通道模板列表 +type TSimChannelTemplateExportReq struct { + g.Meta `path:"/tSimChannelTemplate/export" method:"post" tags:"通道模板" summary:"导出通道模板列表" x-check-permission:"cpm:iot:tSimChannelTemplate:export"` + model.TSimChannelTemplateListParam +} + +type TSimChannelTemplateExportRes struct{} + +// ViewReq 获取通道模板指定信息 +type TSimChannelTemplateViewReq struct { + g.Meta `path:"/tSimChannelTemplate/view" method:"get" tags:"通道模板" summary:"获取通道模板指定信息" x-check-permission:"cpm:iot:tSimChannelTemplate:view"` + model.TSimChannelTemplateViewParam +} + +type TSimChannelTemplateViewRes struct { + *model.TSimChannelTemplateViewModel +} + +// EditReq 修改/新增通道模板 +type TSimChannelTemplateEditReq struct { + g.Meta `path:"/tSimChannelTemplate/edit" method:"post" tags:"通道模板" summary:"修改/新增通道模板" x-check-permission:"cpm:iot:tSimChannelTemplate:edit"` + model.TSimChannelTemplateEditParam +} + +type TSimChannelTemplateEditRes struct{} + +// DeleteReq 删除通道模板 +type TSimChannelTemplateDeleteReq struct { + g.Meta `path:"/tSimChannelTemplate/delete" method:"post" tags:"通道模板" summary:"删除通道模板" x-check-permission:"cpm:iot:tSimChannelTemplate:delete"` + model.TSimChannelTemplateDeleteParam +} + +type TSimChannelTemplateDeleteRes struct{} diff --git a/server/api/iot/v1/tsimdiagnose.go b/server/api/iot/v1/tsimdiagnose.go new file mode 100644 index 0000000..4be887d --- /dev/null +++ b/server/api/iot/v1/tsimdiagnose.go @@ -0,0 +1,33 @@ +// Package tsimdiagnose +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimdiagnose + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +// InfoReq 查询SIM卡诊断信息 +type TSimDiagnoseInfoReq struct { + g.Meta `path:"/tSimdiagnose/info" method:"post" tags:"SIM卡诊断" summary:"查询SIM卡基本信息、会话信息、套餐信息" x-check-permission:"cpm:iot:tSimdiagnose:info"` + model.TSimDiagnoseInfoReq +} + +type TSimDiagnoseInfoRes struct { + *model.TSimDiagnoseInfoOutput +} + +// FlowReq 查询SIM卡使用流量 +type TSimDiagnoseFlowReq struct { + g.Meta `path:"/tSimdiagnose/flow" method:"post" tags:"SIM卡诊断" summary:"查询SIM卡使用流量" x-check-permission:"cpm:iot:tSimdiagnose:flow"` + model.TSimDiagnoseFlowReq +} + +type TSimDiagnoseFlowRes struct { + *model.TSimDiagnoseFlowOutput +} diff --git a/server/api/iot/v1/tsimflowpackageinfo.go b/server/api/iot/v1/tsimflowpackageinfo.go new file mode 100644 index 0000000..21a81ee --- /dev/null +++ b/server/api/iot/v1/tsimflowpackageinfo.go @@ -0,0 +1,94 @@ +// Package tsimflowpackageinfo +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimflowpackageinfo + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询SIM流量套餐管理列表 +type TSimFlowPackageInfoListReq struct { + g.Meta `path:"/tSimFlowPackageInfo/list" method:"get" tags:"SIM流量套餐管理" summary:"获取SIM流量套餐管理列表" x-check-permission:"cpm:iot:tSimFlowPackageInfo:list"` + model.TSimFlowPackageInfoListParam +} + +type TSimFlowPackageInfoListRes struct { + response.PageResult + Items []*model.TSimFlowPackageInfoListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出SIM流量套餐管理列表 +type TSimFlowPackageInfoExportReq struct { + g.Meta `path:"/tSimFlowPackageInfo/export" method:"post" tags:"SIM流量套餐管理" summary:"导出SIM流量套餐管理列表" x-check-permission:"cpm:iot:tSimFlowPackageInfo:export"` + model.TSimFlowPackageInfoListParam +} + +type TSimFlowPackageInfoExportRes struct{} + +// ViewReq 获取SIM流量套餐管理指定信息 +type TSimFlowPackageInfoViewReq struct { + g.Meta `path:"/tSimFlowPackageInfo/view" method:"get" tags:"SIM流量套餐管理" summary:"获取SIM流量套餐管理指定信息" x-check-permission:"cpm:iot:tSimFlowPackageInfo:view"` + model.TSimFlowPackageInfoViewParam +} + +type TSimFlowPackageInfoViewRes struct { + *model.TSimFlowPackageInfoViewModel +} + +// EditReq 修改/新增SIM流量套餐管理 +type TSimFlowPackageInfoEditReq struct { + g.Meta `path:"/tSimFlowPackageInfo/edit" method:"post" tags:"SIM流量套餐管理" summary:"修改/新增SIM流量套餐管理" x-check-permission:"cpm:iot:tSimFlowPackageInfo:edit"` + model.TSimFlowPackageInfoEditParam +} + +type TSimFlowPackageInfoEditRes struct{} + +// DeleteReq 删除SIM流量套餐管理 +type TSimFlowPackageInfoDeleteReq struct { + g.Meta `path:"/tSimFlowPackageInfo/delete" method:"post" tags:"SIM流量套餐管理" summary:"删除SIM流量套餐管理" x-check-permission:"cpm:iot:tSimFlowPackageInfo:delete"` + model.TSimFlowPackageInfoDeleteParam +} + +type TSimFlowPackageInfoDeleteRes struct{} + +type TSimFlowPackageInfoSyncDeptPackagesReq struct { + g.Meta `path:"/tSimFlowPackageInfo/syncDeptPackages" method:"post" tags:"SIM流量套餐管理" summary:"同步当前部门套餐关联" x-check-permission:"cpm:iot:tSimFlowPackageInfo:list"` +} + +type TSimFlowPackageInfoSyncDeptPackagesRes struct{} + +// FlowPackageListReq 可配置池列表 +type TSimFlowPackageInfoFlowPackageListReq struct { + g.Meta `path:"/tSimFlowPackageInfo/flowPackageList" method:"get" tags:"SIM流量套餐管理" summary:"可配置池套餐列表" x-check-permission:"cpm:iot:tSimFlowPackageInfo:list"` + model.TSimFlowPackageInfoFlowPackageListParam +} + +type TSimFlowPackageInfoFlowPackageListRes struct { + Items []*model.TSimFlowPackageInfoListModel `json:"items" dc:"数据列表"` +} + +// FlowPackageAddListReq 可配置池加油包列表 +type TSimFlowPackageInfoFlowPackageAddListReq struct { + g.Meta `path:"/tSimFlowPackageInfo/flowPackageAddList" method:"get" tags:"SIM流量套餐管理" summary:"可配置池加油包列表" x-check-permission:"cpm:iot:tSimFlowPackageInfo:list"` +} + +type TSimFlowPackageInfoFlowPackageAddListRes struct { + Items []*model.TSimFlowPackageInfoListModel `json:"items" dc:"数据列表"` +} + +// GetFlowPackageOptionsReq 获取流量套餐GB+MB组合选项 +type TSimFlowPackageInfoGetFlowPackageOptionsReq struct { + g.Meta `path:"/tSimFlowPackageInfo/getFlowPackageOptions" method:"get" tags:"SIM流量套餐管理" summary:"获取流量套餐GB+MB组合选项" x-check-permission:"cpm:iot:tSimFlowPackageInfo:list"` + model.TSimFlowPackageInfoFlowPackageOptionsParam +} + +type TSimFlowPackageInfoGetFlowPackageOptionsRes struct { + Items []string `json:"items" dc:"GB+MB组合列表,格式:['1,2','1,3']"` +} diff --git a/server/api/iot/v1/tsimflowpackageinfo_options.go b/server/api/iot/v1/tsimflowpackageinfo_options.go new file mode 100644 index 0000000..38be305 --- /dev/null +++ b/server/api/iot/v1/tsimflowpackageinfo_options.go @@ -0,0 +1,16 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimFlowPackageInfoRenewablePackageOptionsReq struct { + g.Meta `path:"/tSimFlowPackageInfo/renewablePackageOptions" method:"get" tags:"SIM流量套餐管理" summary:"获取可续费套餐候选列表" x-check-permission:"cpm:iot:tSimFlowPackageInfo:list"` + model.TSimFlowPackageInfoRenewablePackageOptionsParam +} + +type TSimFlowPackageInfoRenewablePackageOptionsRes struct { + Items []*model.TSimFlowPackageInfoListModel `json:"items" dc:"数据列表"` +} diff --git a/server/api/iot/v1/tsimflowpackageprice.go b/server/api/iot/v1/tsimflowpackageprice.go new file mode 100644 index 0000000..f2a72ae --- /dev/null +++ b/server/api/iot/v1/tsimflowpackageprice.go @@ -0,0 +1,71 @@ +// Package tsimflowpackageprice +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimflowpackageprice + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimFlowPackagePriceagentTreeReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentTree" method:"get" tags:"SIM流量套餐定价" summary:"获取渠道代理树形结构" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentTree"` + model.TSimFlowPackagePriceAgentTreeParam +} + +type TSimFlowPackagePriceagentTreeRes struct { + Items []*model.SysDeptTreeModel `json:"items" dc:"代理/公司树"` +} + +type TSimFlowPackagePriceAgentPackagePriceListReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentPackagePrice/list" method:"get" tags:"SIM流量套餐定价" summary:"查询指定下级代理套餐生效定价" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentPackagePrice:list"` + model.TSimFlowPackagePriceAgentPackagePriceListParam +} + +type TSimFlowPackagePriceAgentPackagePriceListRes struct { + response.PageResult + Items []*model.TSimFlowPackagePriceAgentPackagePriceListItem `json:"items" dc:"数据列表"` +} + +type TSimFlowPackagePriceAgentPackagePriceSaveReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentPackagePrice/save" method:"post" tags:"SIM流量套餐定价" summary:"保存下级代理专属套餐定价" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentPackagePrice:edit"` + model.TSimFlowPackagePriceAgentPackagePriceSaveParam +} + +type TSimFlowPackagePriceAgentPackagePriceSaveRes struct{} + +type TSimFlowPackagePriceAgentPackagePriceInheritReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentPackagePrice/inherit" method:"post" tags:"SIM流量套餐定价" summary:"承袭下级代理上级套餐定价" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentPackagePrice:edit"` + model.TSimFlowPackagePriceAgentPackagePriceInheritParam +} + +type TSimFlowPackagePriceAgentPackagePriceInheritRes struct{} + +type TSimFlowPackagePriceAgentDefaultPackagePriceListReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentDefaultPackagePrice/list" method:"get" tags:"SIM流量套餐定价" summary:"查询本级默认套餐定价" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentDefaultPackagePrice:list"` + model.TSimFlowPackagePriceAgentDefaultPackagePriceListParam +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceListRes struct { + response.PageResult + Items []*model.TSimFlowPackagePriceAgentDefaultPackagePriceListItem `json:"items" dc:"数据列表"` +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceSaveReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentDefaultPackagePrice/save" method:"post" tags:"SIM流量套餐定价" summary:"保存本级默认套餐定价" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentDefaultPackagePrice:edit"` + model.TSimFlowPackagePriceAgentDefaultPackagePriceSaveParam +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceSaveRes struct{} + +type TSimFlowPackagePriceAgentDefaultPackagePriceInheritReq struct { + g.Meta `path:"/tSimFlowPackagePrice/agentDefaultPackagePrice/inherit" method:"post" tags:"SIM流量套餐定价" summary:"承袭上级套餐定价" x-check-permission:"cpm:iot:tSimFlowPackagePrice:agentDefaultPackagePrice:edit"` + model.TSimFlowPackagePriceAgentDefaultPackagePriceInheritParam +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceInheritRes struct{} diff --git a/server/api/iot/v1/tsimflowpool.go b/server/api/iot/v1/tsimflowpool.go new file mode 100644 index 0000000..fbc4344 --- /dev/null +++ b/server/api/iot/v1/tsimflowpool.go @@ -0,0 +1,78 @@ +// Package tsimflowpool +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimflowpool + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询流量池表列表 +type TSimFlowPoolListReq struct { + g.Meta `path:"/tSimFlowPool/list" method:"get" tags:"流量池表" summary:"获取流量池表列表" x-check-permission:"cpm:iot:tSimFlowPool:list"` + model.TSimFlowPoolListParam +} + +type TSimFlowPoolListRes struct { + response.PageResult + Items []*model.TSimFlowPoolListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出流量池表列表 +type TSimFlowPoolExportReq struct { + g.Meta `path:"/tSimFlowPool/export" method:"post" tags:"流量池表" summary:"导出流量池表列表" x-check-permission:"cpm:iot:tSimFlowPool:export"` + model.TSimFlowPoolListParam +} + +type TSimFlowPoolExportRes struct{} + +// ViewReq 获取流量池表指定信息 +type TSimFlowPoolViewReq struct { + g.Meta `path:"/tSimFlowPool/view" method:"get" tags:"流量池表" summary:"获取流量池表指定信息" x-check-permission:"cpm:iot:tSimFlowPool:view"` + model.TSimFlowPoolViewParam +} + +type TSimFlowPoolViewRes struct { + *model.TSimFlowPoolViewModel +} + +// EditReq 修改/新增流量池表 +type TSimFlowPoolEditReq struct { + g.Meta `path:"/tSimFlowPool/edit" method:"post" tags:"流量池表" summary:"修改/新增流量池表" x-check-permission:"cpm:iot:tSimFlowPool:edit"` + model.TSimFlowPoolEditParam +} + +type TSimFlowPoolEditRes struct{} + +// DeleteReq 删除流量池表 +type TSimFlowPoolDeleteReq struct { + g.Meta `path:"/tSimFlowPool/delete" method:"post" tags:"流量池表" summary:"删除流量池表" x-check-permission:"cpm:iot:tSimFlowPool:delete"` + model.TSimFlowPoolDeleteParam +} + +type TSimFlowPoolDeleteRes struct{} + +// SyncPoolCardReq 流量池同步卡信息 +type TSimFlowPoolSyncPoolCardReq struct { + g.Meta `path:"/tSimFlowPool/syncPoolCard" method:"post" tags:"流量池表" summary:"流量池同步卡信息" x-check-permission:"cpm:iot:tSimFlowPool:syncPoolCard"` + DeptId int64 `json:"deptId" dc:"客户编号"` +} + +type TSimFlowPoolSyncPoolCardRes struct{} + +// GetCardsByPackageCodesReq 根据套餐编码列表获取卡列表 +type TSimFlowPoolGetCardsByPackageCodesReq struct { + g.Meta `path:"/tSimFlowPool/getCardsByPackageCodes" method:"post" tags:"流量池表" summary:"根据流量池表获取卡列表" x-check-permission:"cpm:iot:tSimFlowPool:getCardsByPackageCodes"` + model.GetCardsByPackageCodesParam +} + +type TSimFlowPoolGetCardsByPackageCodesRes struct { + response.PageResult + Items []*model.TSimCardInfoListModel `json:"items" dc:"卡列表"` +} diff --git a/server/api/iot/v1/tsimpackagecategory.go b/server/api/iot/v1/tsimpackagecategory.go new file mode 100644 index 0000000..163a6f8 --- /dev/null +++ b/server/api/iot/v1/tsimpackagecategory.go @@ -0,0 +1,59 @@ +// Package tsimpackagecategory +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimpackagecategory + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询套餐分类表列表 +type TSimPackageCategoryListReq struct { + g.Meta `path:"/tSimPackageCategory/list" method:"get" tags:"套餐分类表" summary:"获取套餐分类表列表" x-check-permission:"cpm:iot:tSimPackageCategory:list"` + model.TSimPackageCategoryListParam +} + +type TSimPackageCategoryListRes struct { + response.PageResult + Items []*model.TSimPackageCategoryListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出套餐分类表列表 +type TSimPackageCategoryExportReq struct { + g.Meta `path:"/tSimPackageCategory/export" method:"post" tags:"套餐分类表" summary:"导出套餐分类表列表" x-check-permission:"cpm:iot:tSimPackageCategory:export"` + model.TSimPackageCategoryListParam +} + +type TSimPackageCategoryExportRes struct{} + +// ViewReq 获取套餐分类表指定信息 +type TSimPackageCategoryViewReq struct { + g.Meta `path:"/tSimPackageCategory/view" method:"get" tags:"套餐分类表" summary:"获取套餐分类表指定信息" x-check-permission:"cpm:iot:tSimPackageCategory:view"` + model.TSimPackageCategoryViewParam +} + +type TSimPackageCategoryViewRes struct { + *model.TSimPackageCategoryViewModel +} + +// EditReq 修改/新增套餐分类表 +type TSimPackageCategoryEditReq struct { + g.Meta `path:"/tSimPackageCategory/edit" method:"post" tags:"套餐分类表" summary:"修改/新增套餐分类表" x-check-permission:"cpm:iot:tSimPackageCategory:edit"` + model.TSimPackageCategoryEditParam +} + +type TSimPackageCategoryEditRes struct{} + +// DeleteReq 删除套餐分类表 +type TSimPackageCategoryDeleteReq struct { + g.Meta `path:"/tSimPackageCategory/delete" method:"post" tags:"套餐分类表" summary:"删除套餐分类表" x-check-permission:"cpm:iot:tSimPackageCategory:delete"` + model.TSimPackageCategoryDeleteParam +} + +type TSimPackageCategoryDeleteRes struct{} diff --git a/server/api/iot/v1/tsimpoolbindpackage.go b/server/api/iot/v1/tsimpoolbindpackage.go new file mode 100644 index 0000000..5a2a171 --- /dev/null +++ b/server/api/iot/v1/tsimpoolbindpackage.go @@ -0,0 +1,116 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimPoolBindPackageListReq struct { + g.Meta `path:"/tSimPoolBindPackage/list" method:"get" tags:"卡池加油包订购表" summary:"获取卡池加油包订购表列表" x-check-permission:"cpm:iot:tSimPoolBindPackage:list"` + model.TSimPoolBindPackageListParam +} + +type TSimPoolBindPackageListRes struct { + response.PageResult + Items []*model.TSimPoolBindPackageListModel `json:"items" dc:"数据列表"` +} + +type TSimPoolBindPackageExportReq struct { + g.Meta `path:"/tSimPoolBindPackage/export" method:"post" tags:"卡池加油包订购表" summary:"导出卡池加油包订购表列表" x-check-permission:"cpm:iot:tSimPoolBindPackage:export"` + model.TSimPoolBindPackageListParam +} + +type TSimPoolBindPackageExportRes struct{} + +type TSimPoolBindPackageViewReq struct { + g.Meta `path:"/tSimPoolBindPackage/view" method:"get" tags:"卡池加油包订购表" summary:"获取卡池加油包订购表详情" x-check-permission:"cpm:iot:tSimPoolBindPackage:view"` + model.TSimPoolBindPackageViewParam +} + +type TSimPoolBindPackageViewRes struct { + *model.TSimPoolBindPackageViewModel +} + +type TSimPoolBindPackageEditReq struct { + g.Meta `path:"/tSimPoolBindPackage/edit" method:"post" tags:"卡池加油包订购表" summary:"新增或修改卡池加油包订购表" x-check-permission:"cpm:iot:tSimPoolBindPackage:edit"` + model.TSimPoolBindPackageEditParam +} + +type TSimPoolBindPackageEditRes struct{} + +type TSimPoolBindPackageDeleteReq struct { + g.Meta `path:"/tSimPoolBindPackage/delete" method:"post" tags:"卡池加油包订购表" summary:"删除卡池加油包订购表" x-check-permission:"cpm:iot:tSimPoolBindPackage:delete"` + model.TSimPoolBindPackageDeleteParam +} + +type TSimPoolBindPackageDeleteRes struct{} + +type TSimPoolBindPackageAddPackageOptionsReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/options" method:"post" tags:"加油包" summary:"获取流量池可订购加油包" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` + model.TSimPoolAddPackageOptionsParam +} + +type TSimPoolBindPackageAddPackageOptionsRes struct { + *model.TSimAddPackageOptionsRes +} + +type TSimPoolBindPackageAddPackagePaymentContextReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/payment-context" method:"post" tags:"加油包" summary:"获取流量池加油包支付上下文" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` +} + +type TSimPoolBindPackageAddPackagePaymentContextRes struct { + *model.TSimAddPackageOptionsRes +} + +type TSimPoolBindPackageDownloadExcelTemplateReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/excel/template" method:"get" tags:"加油包" summary:"下载流量池加油包导入模板" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` +} + +type TSimPoolBindPackageDownloadExcelTemplateRes struct{} + +type TSimPoolBindPackageSubmitExcelReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/excel/submit" method:"post" tags:"加油包" summary:"提交流量池加油包Excel批次" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` + model.TSimPoolBindPackageAddPackageExcelSubmitParam +} + +type TSimPoolBindPackageSubmitExcelRes struct { + *model.TSimPoolBindPackageAddPackageExcelSubmitRes +} + +type TSimPoolBindPackageSubmitInputReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/input/submit" method:"post" tags:"加油包" summary:"提交流量池加油包手输批次" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` + model.TSimPoolBindPackageAddPackageInputSubmitParam +} + +type TSimPoolBindPackageSubmitInputRes struct { + *model.TSimPoolBindPackageAddPackageInputSubmitRes +} + +type TSimPoolBindPackageAddPackageInputPrepareReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/input/prepare" method:"post" tags:"加油包" summary:"流量池加油包手输预处理" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` + model.TSimPoolBindPackageAddPackageInputPrepareParam +} + +type TSimPoolBindPackageAddPackageInputPrepareRes struct { + *model.TSimPoolBindPackageAddPackageInputPrepareRes +} + +type TSimPoolBindPackageAddPackagePrepareResultReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/prepare/result" method:"get" tags:"加油包" summary:"查询流量池加油包预处理结果" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` + BatchNo string `json:"batchNo" v:"required#批次号不能为空" in:"query" dc:"批次号"` +} + +type TSimPoolBindPackageAddPackagePrepareResultRes struct { + *model.TSimPoolBindPackageAddPackagePrepareResultRes +} + +type TSimPoolBindPackageAddPackageBatchConfirmReq struct { + g.Meta `path:"/tSimPoolBindPackage/addPackage/batch/confirm" method:"post" tags:"加油包" summary:"确认流量池加油包采购批次" x-check-permission:"cpm:iot:tSimPoolBindPackage:addPackage"` + model.TSimPoolBindPackageAddPackageBatchConfirmParam +} + +type TSimPoolBindPackageAddPackageBatchConfirmRes struct { + *model.TSimPoolBindPackageAddPackageBatchConfirmRes +} diff --git a/server/api/iot/v1/tsimpoolwarnconfig.go b/server/api/iot/v1/tsimpoolwarnconfig.go new file mode 100644 index 0000000..5783045 --- /dev/null +++ b/server/api/iot/v1/tsimpoolwarnconfig.go @@ -0,0 +1,59 @@ +// Package tsimpoolwarnconfig +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimpoolwarnconfig + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询流量池预警配置表列表 +type TSimPoolWarnConfigListReq struct { + g.Meta `path:"/tSimPoolWarnConfig/list" method:"get" tags:"流量池预警配置表" summary:"获取流量池预警配置表列表" x-check-permission:"cpm:iot:tSimPoolWarnConfig:list"` + model.TSimPoolWarnConfigListParam +} + +type TSimPoolWarnConfigListRes struct { + response.PageResult + Items []*model.TSimPoolWarnConfigListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出流量池预警配置表列表 +type TSimPoolWarnConfigExportReq struct { + g.Meta `path:"/tSimPoolWarnConfig/export" method:"post" tags:"流量池预警配置表" summary:"导出流量池预警配置表列表" x-check-permission:"cpm:iot:tSimPoolWarnConfig:export"` + model.TSimPoolWarnConfigListParam +} + +type TSimPoolWarnConfigExportRes struct{} + +// ViewReq 获取流量池预警配置表指定信息 +type TSimPoolWarnConfigViewReq struct { + g.Meta `path:"/tSimPoolWarnConfig/view" method:"get" tags:"流量池预警配置表" summary:"获取流量池预警配置表指定信息" x-check-permission:"cpm:iot:tSimPoolWarnConfig:view"` + model.TSimPoolWarnConfigViewParam +} + +type TSimPoolWarnConfigViewRes struct { + *model.TSimPoolWarnConfigViewModel +} + +// EditReq 修改/新增流量池预警配置表 +type TSimPoolWarnConfigEditReq struct { + g.Meta `path:"/tSimPoolWarnConfig/edit" method:"post" tags:"流量池预警配置表" summary:"修改/新增流量池预警配置表" x-check-permission:"cpm:iot:tSimPoolWarnConfig:edit"` + model.TSimPoolWarnConfigEditParam +} + +type TSimPoolWarnConfigEditRes struct{} + +// DeleteReq 删除流量池预警配置表 +type TSimPoolWarnConfigDeleteReq struct { + g.Meta `path:"/tSimPoolWarnConfig/delete" method:"post" tags:"流量池预警配置表" summary:"删除流量池预警配置表" x-check-permission:"cpm:iot:tSimPoolWarnConfig:delete"` + model.TSimPoolWarnConfigDeleteParam +} + +type TSimPoolWarnConfigDeleteRes struct{} diff --git a/server/api/iot/v1/tsimupstreampackage.go b/server/api/iot/v1/tsimupstreampackage.go new file mode 100644 index 0000000..39346d3 --- /dev/null +++ b/server/api/iot/v1/tsimupstreampackage.go @@ -0,0 +1,59 @@ +// Package tsimupstreampackage +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //tsimupstreampackage + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询上游套餐表列表 +type TSimUpstreamPackageListReq struct { + g.Meta `path:"/tSimUpstreamPackage/list" method:"get" tags:"上游套餐表" summary:"获取上游套餐表列表" x-check-permission:"cpm:iot:tSimUpstreamPackage:list"` + model.TUpstreamPackageListParam +} + +type TSimUpstreamPackageListRes struct { + response.PageResult + Items []*model.TUpstreamPackageListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出上游套餐表列表 +type TSimUpstreamPackageExportReq struct { + g.Meta `path:"/tSimUpstreamPackage/export" method:"post" tags:"上游套餐表" summary:"导出上游套餐表列表" x-check-permission:"cpm:iot:tSimUpstreamPackage:export"` + model.TUpstreamPackageListParam +} + +type TSimUpstreamPackageExportRes struct{} + +// ViewReq 获取上游套餐表指定信息 +type TSimUpstreamPackageViewReq struct { + g.Meta `path:"/tSimUpstreamPackage/view" method:"get" tags:"上游套餐表" summary:"获取上游套餐表指定信息" x-check-permission:"cpm:iot:tSimUpstreamPackage:view"` + model.TUpstreamPackageViewParam +} + +type TSimUpstreamPackageViewRes struct { + *model.TUpstreamPackageViewModel +} + +// EditReq 修改/新增上游套餐表 +type TSimUpstreamPackageEditReq struct { + g.Meta `path:"/tSimUpstreamPackage/edit" method:"post" tags:"上游套餐表" summary:"修改/新增上游套餐表" x-check-permission:"cpm:iot:tSimUpstreamPackage:edit"` + model.TUpstreamPackageEditParam +} + +type TSimUpstreamPackageEditRes struct{} + +// DeleteReq 删除上游套餐表 +type TSimUpstreamPackageDeleteReq struct { + g.Meta `path:"/tSimUpstreamPackage/delete" method:"post" tags:"上游套餐表" summary:"删除上游套餐表" x-check-permission:"cpm:iot:tSimUpstreamPackage:delete"` + model.TUpstreamPackageDeleteParam +} + +type TSimUpstreamPackageDeleteRes struct{} diff --git a/server/api/iot/v1/tsimwarningconfig.go b/server/api/iot/v1/tsimwarningconfig.go new file mode 100644 index 0000000..ad7d0ce --- /dev/null +++ b/server/api/iot/v1/tsimwarningconfig.go @@ -0,0 +1,48 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type TSimWarningConfigExcelTemplateReq struct { + g.Meta `path:"/tSimWarningConfig/excel/template" method:"get" tags:"SIM卡预警配置" summary:"下载SIM卡预警配置Excel模板" x-check-permission:"cpm:iot:tSimWarningConfig:excel:template"` + ItemType int `json:"itemType" form:"itemType" dc:"对象类型:1单卡,2流量池;默认1"` +} + +type TSimWarningConfigExcelTemplateRes struct{} + +type TSimWarningConfigEmailCodeReq struct { + g.Meta `path:"/tSimWarningConfig/email/code" method:"post" tags:"SIM卡预警配置" summary:"发送预警邮箱验证码" x-check-permission:"cpm:iot:tSimWarningConfig:input:submit"` + model.TSimWarningConfigEmailCodeParam +} + +type TSimWarningConfigEmailCodeRes struct{} + +type TSimWarningConfigExcelSubmitReq struct { + g.Meta `path:"/tSimWarningConfig/excel/submit" method:"post" tags:"SIM卡预警配置" summary:"提交Excel批量SIM卡预警配置" mime:"multipart/form-data" x-check-permission:"cpm:iot:tSimWarningConfig:excel:submit"` + model.TSimWarningConfigExcelSubmitParam +} + +type TSimWarningConfigExcelSubmitRes struct { + *model.TSimWarningConfigExcelSubmitRes +} + +type TSimWarningConfigInputSubmitReq struct { + g.Meta `path:"/tSimWarningConfig/input/submit" method:"post" tags:"SIM卡预警配置" summary:"提交批量输入SIM卡预警配置" x-check-permission:"cpm:iot:tSimWarningConfig:input:submit"` + model.TSimWarningConfigInputSubmitParam +} + +type TSimWarningConfigInputSubmitRes struct { + *model.TSimWarningConfigInputSubmitRes +} + +type TSimWarningConfigRangeSubmitReq struct { + g.Meta `path:"/tSimWarningConfig/range/submit" method:"post" tags:"SIM卡预警配置" summary:"提交连号SIM卡预警配置" x-check-permission:"cpm:iot:tSimWarningConfig:range:submit"` + model.TSimWarningConfigRangeSubmitParam +} + +type TSimWarningConfigRangeSubmitRes struct { + *model.TSimWarningConfigRangeSubmitRes +} diff --git a/server/api/monitor/monitor.go b/server/api/monitor/monitor.go new file mode 100644 index 0000000..eae358f --- /dev/null +++ b/server/api/monitor/monitor.go @@ -0,0 +1,16 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package monitor + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/monitor/v1" +) + +type IMonitorV1 interface { + RedisInfo(ctx context.Context, req *v1.RedisInfoReq) (res *v1.RedisInfoRes, err error) + MemoryDBRebuild(ctx context.Context, req *v1.MemoryDBRebuildReq) (res *v1.MemoryDBRebuildRes, err error) +} diff --git a/server/api/monitor/v1/cache.go b/server/api/monitor/v1/cache.go new file mode 100644 index 0000000..a5480bd --- /dev/null +++ b/server/api/monitor/v1/cache.go @@ -0,0 +1,33 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +type RedisInfoReq struct { + g.Meta `path:"/cache" method:"get" tags:"监控-缓存监控" summary:"获取缓存监控信息" x-check-permission:"cpm:monitor:cache:list"` +} + +type RedisInfoRes struct { + DBSize int `json:"dbSize"` + CommandStats []*CommandStats `json:"commandStats"` + Info map[string]string `json:"info"` +} + +type CommandStats struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type MemoryDBRebuildReq struct { + g.Meta `path:"/cache/memory/rebuild" method:"post" tags:"监控-缓存监控" summary:"重建系统内存缓存" x-check-permission:"cpr:superadmin"` +} + +type MemoryDBRebuildRes struct { + Tables int `json:"tables"` +} diff --git a/server/api/pay/pay.go b/server/api/pay/pay.go new file mode 100644 index 0000000..f384b1f --- /dev/null +++ b/server/api/pay/pay.go @@ -0,0 +1,19 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package pay + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/pay/v1" +) + +type IPayV1 interface { + AlipayPay(ctx context.Context, req *v1.AlipayPayReq) (res *v1.AlipayPayRes, err error) + AlipayNotify(ctx context.Context, req *v1.AlipayNotifyReq) (res *v1.AlipayNotifyRes, err error) + AlipayReturn(ctx context.Context, req *v1.AlipayReturnReq) (res *v1.AlipayReturnRes, err error) + AlipayTradeQuery(ctx context.Context, req *v1.AlipayTradeQueryReq) (res *v1.AlipayTradeQueryRes, err error) + AlipayRefund(ctx context.Context, req *v1.AlipayRefundReq) (res *v1.AlipayRefundRes, err error) +} diff --git a/server/api/pay/v1/alipay.go b/server/api/pay/v1/alipay.go new file mode 100644 index 0000000..d097574 --- /dev/null +++ b/server/api/pay/v1/alipay.go @@ -0,0 +1,52 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type AlipayPayReq struct { + g.Meta `path:"/alipay/pay" method:"get,post" tags:"支付宝支付" summary:"创建支付宝支付链接" x-check-permission:"cpc:current:user"` + model.AlipayPayInput +} + +type AlipayPayRes struct { + model.AlipayPayOutput +} + +type AlipayNotifyReq struct { + g.Meta `path:"/alipay/notify" method:"post" tags:"支付宝支付" summary:"支付宝异步通知"` + model.AlipayNotifyInput +} + +type AlipayNotifyRes struct { + model.AlipayNotifyOutput +} + +type AlipayReturnReq struct { + g.Meta `path:"/alipay/return" method:"get" tags:"支付宝支付" summary:"支付宝同步回跳"` + model.AlipayReturnInput +} + +type AlipayReturnRes struct { + model.AlipayReturnOutput +} + +type AlipayTradeQueryReq struct { + g.Meta `path:"/alipay/query" method:"get" tags:"支付宝支付" summary:"查询支付宝交易" x-check-permission:"cpc:current:user"` + model.AlipayTradeQueryInput +} + +type AlipayTradeQueryRes struct { + model.AlipayTradeQueryOutput +} + +type AlipayRefundReq struct { + g.Meta `path:"/alipay/refund" method:"post" tags:"支付宝支付" summary:"支付宝退款" x-check-permission:"cpc:current:user"` + model.AlipayRefundInput +} + +type AlipayRefundRes struct { + model.AlipayRefundOutput +} diff --git a/server/api/system/system.go b/server/api/system/system.go new file mode 100644 index 0000000..058ef72 --- /dev/null +++ b/server/api/system/system.go @@ -0,0 +1,151 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package system + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" +) + +type ISystemV1 interface { + Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error) + SendSmsLoginCode(ctx context.Context, req *v1.SendSmsLoginCodeReq) (res *v1.SendSmsLoginCodeRes, err error) + SmsLogin(ctx context.Context, req *v1.SmsLoginReq) (res *v1.SmsLoginRes, err error) + RefreshToken(ctx context.Context, req *v1.RefreshTokenReq) (res *v1.RefreshTokenRes, err error) + Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error) + GetAccessCodes(ctx context.Context, req *v1.GetAccessCodesReq) (res *v1.GetAccessCodesRes, err error) + TenantList(ctx context.Context, req *v1.TenantListReq) (res *v1.TenantListRes, err error) + GetCaptcha(ctx context.Context, req *v1.GetCaptchaReq) (res *v1.GetCaptchaRes, err error) + SysClientList(ctx context.Context, req *v1.SysClientListReq) (res *v1.SysClientListRes, err error) + SysClientView(ctx context.Context, req *v1.SysClientViewReq) (res *v1.SysClientViewRes, err error) + SysClientAdd(ctx context.Context, req *v1.SysClientAddReq) (res *v1.SysClientAddRes, err error) + SysClientEdit(ctx context.Context, req *v1.SysClientEditReq) (res *v1.SysClientEditRes, err error) + SysClientDelete(ctx context.Context, req *v1.SysClientDeleteReq) (res *v1.SysClientDeleteRes, err error) + SysClientStatus(ctx context.Context, req *v1.SysClientStatusReq) (res *v1.SysClientStatusRes, err error) + GetConfigList(ctx context.Context, req *v1.GetConfigListReq) (res *v1.GetConfigListRes, err error) + AddConfig(ctx context.Context, req *v1.AddConfigReq) (res *v1.AddConfigRes, err error) + EditConfig(ctx context.Context, req *v1.EditConfigReq) (res *v1.EditConfigRes, err error) + DeleteConfig(ctx context.Context, req *v1.DeleteConfigReq) (res *v1.DeleteConfigRes, err error) + GetConfigById(ctx context.Context, req *v1.GetConfigByIdReq) (res *v1.GetConfigByIdRes, err error) + DeptList(ctx context.Context, req *v1.DeptListReq) (res *v1.DeptListRes, err error) + DeptTree(ctx context.Context, req *v1.DeptTreeReq) (res *v1.DeptTreeRes, err error) + DeptFullTree(ctx context.Context, req *v1.DeptFullTreeReq) (res *v1.DeptFullTreeRes, err error) + DeptAdd(ctx context.Context, req *v1.DeptAddReq) (res *v1.DeptAddRes, err error) + DeptEdit(ctx context.Context, req *v1.DeptEditReq) (res *v1.DeptEditRes, err error) + DeptDelete(ctx context.Context, req *v1.DeptDeleteReq) (res *v1.DeptDeleteRes, err error) + DeptView(ctx context.Context, req *v1.DeptViewReq) (res *v1.DeptViewRes, err error) + SysDictTypeList(ctx context.Context, req *v1.SysDictTypeListReq) (res *v1.SysDictTypeListRes, err error) + SysDictTypeAdd(ctx context.Context, req *v1.SysDictTypeAddReq) (res *v1.SysDictTypeAddRes, err error) + SysDictTypeEdit(ctx context.Context, req *v1.SysDictTypeEditReq) (res *v1.SysDictTypeEditRes, err error) + SysDictTypeDelete(ctx context.Context, req *v1.SysDictTypeDeleteReq) (res *v1.SysDictTypeDeleteRes, err error) + SysDictTypeView(ctx context.Context, req *v1.SysDictTypeViewReq) (res *v1.SysDictTypeViewRes, err error) + SysDictDataList(ctx context.Context, req *v1.SysDictDataListReq) (res *v1.SysDictDataListRes, err error) + SysDictDataAdd(ctx context.Context, req *v1.SysDictDataAddReq) (res *v1.SysDictDataAddRes, err error) + SysDictDataEdit(ctx context.Context, req *v1.SysDictDataEditReq) (res *v1.SysDictDataEditRes, err error) + SysDictDataDelete(ctx context.Context, req *v1.SysDictDataDeleteReq) (res *v1.SysDictDataDeleteRes, err error) + SysDictDataView(ctx context.Context, req *v1.SysDictDataViewReq) (res *v1.SysDictDataViewRes, err error) + SysJobList(ctx context.Context, req *v1.SysJobListReq) (res *v1.SysJobListRes, err error) + SysJobView(ctx context.Context, req *v1.SysJobViewReq) (res *v1.SysJobViewRes, err error) + SysJobAdd(ctx context.Context, req *v1.SysJobAddReq) (res *v1.SysJobAddRes, err error) + SysJobUpdate(ctx context.Context, req *v1.SysJobUpdateReq) (res *v1.SysJobUpdateRes, err error) + SysJobUpdateStatus(ctx context.Context, req *v1.SysJobUpdateStatusReq) (res *v1.SysJobUpdateStatusRes, err error) + SysJobDelete(ctx context.Context, req *v1.SysJobDeleteReq) (res *v1.SysJobDeleteRes, err error) + SysJobExec(ctx context.Context, req *v1.SysJobExecReq) (res *v1.SysJobExecRes, err error) + ListLogininfor(ctx context.Context, req *v1.ListLogininforReq) (res *v1.ListLogininforRes, err error) + DeleteLogininfor(ctx context.Context, req *v1.DeleteLogininforReq) (res *v1.DeleteLogininforRes, err error) + MenuAll(ctx context.Context, req *v1.MenuAllReq) (res *v1.MenuAllRes, err error) + MenuList(ctx context.Context, req *v1.MenuListReq) (res *v1.MenuListRes, err error) + MenuView(ctx context.Context, req *v1.MenuViewReq) (res *v1.MenuViewRes, err error) + MenuAdd(ctx context.Context, req *v1.MenuAddReq) (res *v1.MenuAddRes, err error) + MenuUpdate(ctx context.Context, req *v1.MenuUpdateReq) (res *v1.MenuUpdateRes, err error) + MenuDelete(ctx context.Context, req *v1.MenuDeleteReq) (res *v1.MenuDeleteRes, err error) + MenuTree(ctx context.Context, req *v1.MenuTreeReq) (res *v1.MenuTreeRes, err error) + SysNoticeList(ctx context.Context, req *v1.SysNoticeListReq) (res *v1.SysNoticeListRes, err error) + SysNoticeAdd(ctx context.Context, req *v1.SysNoticeAddReq) (res *v1.SysNoticeAddRes, err error) + SysNoticeEdit(ctx context.Context, req *v1.SysNoticeEditReq) (res *v1.SysNoticeEditRes, err error) + SysNoticeDelete(ctx context.Context, req *v1.SysNoticeDeleteReq) (res *v1.SysNoticeDeleteRes, err error) + SysNoticeView(ctx context.Context, req *v1.SysNoticeViewReq) (res *v1.SysNoticeViewRes, err error) + SysUserOnlineList(ctx context.Context, req *v1.SysUserOnlineListReq) (res *v1.SysUserOnlineListRes, err error) + SysUserOnlineDelete(ctx context.Context, req *v1.SysUserOnlineDeleteReq) (res *v1.SysUserOnlineDeleteRes, err error) + GetOperLogList(ctx context.Context, req *v1.GetOperLogListReq) (res *v1.GetOperLogListRes, err error) + SysOssList(ctx context.Context, req *v1.SysOssListReq) (res *v1.SysOssListRes, err error) + SysOssView(ctx context.Context, req *v1.SysOssViewReq) (res *v1.SysOssViewRes, err error) + SysOssDelete(ctx context.Context, req *v1.SysOssDeleteReq) (res *v1.SysOssDeleteRes, err error) + SysOssConfigList(ctx context.Context, req *v1.SysOssConfigListReq) (res *v1.SysOssConfigListRes, err error) + SysOssConfigView(ctx context.Context, req *v1.SysOssConfigViewReq) (res *v1.SysOssConfigViewRes, err error) + SysOssConfigAdd(ctx context.Context, req *v1.SysOssConfigAddReq) (res *v1.SysOssConfigAddRes, err error) + SysOssConfigEdit(ctx context.Context, req *v1.SysOssConfigEditReq) (res *v1.SysOssConfigEditRes, err error) + SysOssConfigDelete(ctx context.Context, req *v1.SysOssConfigDeleteReq) (res *v1.SysOssConfigDeleteRes, err error) + PostList(ctx context.Context, req *v1.PostListReq) (res *v1.PostListRes, err error) + PostAdd(ctx context.Context, req *v1.PostAddReq) (res *v1.PostAddRes, err error) + PostEdit(ctx context.Context, req *v1.PostEditReq) (res *v1.PostEditRes, err error) + PostDelete(ctx context.Context, req *v1.PostDeleteReq) (res *v1.PostDeleteRes, err error) + PostView(ctx context.Context, req *v1.PostViewReq) (res *v1.PostViewRes, err error) + PostExport(ctx context.Context, req *v1.PostExportReq) (res *v1.PostExportRes, err error) + QrcodeLogin(ctx context.Context, req *v1.QrcodeLoginReq) (res *v1.QrcodeLoginRes, err error) + QrcodeLoginStatus(ctx context.Context, req *v1.QrcodeLoginStatusReq) (res *v1.QrcodeLoginStatusRes, err error) + QrcodeBind(ctx context.Context, req *v1.QrcodeBindReq) (res *v1.QrcodeBindRes, err error) + QrcodeBindStatus(ctx context.Context, req *v1.QrcodeBindStatusReq) (res *v1.QrcodeBindStatusRes, err error) + QrcodeScanCallback(ctx context.Context, req *v1.QrcodeScanCallbackReq) (res *v1.QrcodeScanCallbackRes, err error) + QrcodeRegisterAndBindOpenId(ctx context.Context, req *v1.QrcodeRegisterAndBindOpenIdReq) (res *v1.QrcodeRegisterAndBindOpenIdRes, err error) + QrcodeLoginAndBindOpenId(ctx context.Context, req *v1.QrcodeLoginAndBindOpenIdReq) (res *v1.QrcodeLoginAndBindOpenIdRes, err error) + QrcodeLoginSelectUser(ctx context.Context, req *v1.QrcodeLoginSelectUserReq) (res *v1.QrcodeLoginSelectUserRes, err error) + RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) + RoleAdd(ctx context.Context, req *v1.RoleAddReq) (res *v1.RoleAddRes, err error) + RoleEdit(ctx context.Context, req *v1.RoleEditReq) (res *v1.RoleEditRes, err error) + RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) + RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error) + RoleDataScopeEdit(ctx context.Context, req *v1.RoleDataScopeEditReq) (res *v1.RoleDataScopeEditRes, err error) + SysSocialList(ctx context.Context, req *v1.SysSocialListReq) (res *v1.SysSocialListRes, err error) + SysSocialDelete(ctx context.Context, req *v1.SysSocialDeleteReq) (res *v1.SysSocialDeleteRes, err error) + SysNoticeUserList(ctx context.Context, req *v1.SysNoticeUserListReq) (res *v1.SysNoticeUserListRes, err error) + SysNoticeUserExport(ctx context.Context, req *v1.SysNoticeUserExportReq) (res *v1.SysNoticeUserExportRes, err error) + SysNoticeUserView(ctx context.Context, req *v1.SysNoticeUserViewReq) (res *v1.SysNoticeUserViewRes, err error) + SysNoticeUserEdit(ctx context.Context, req *v1.SysNoticeUserEditReq) (res *v1.SysNoticeUserEditRes, err error) + SysNoticeUserDelete(ctx context.Context, req *v1.SysNoticeUserDeleteReq) (res *v1.SysNoticeUserDeleteRes, err error) + SysNoticeUserStatus(ctx context.Context, req *v1.SysNoticeUserStatusReq) (res *v1.SysNoticeUserStatusRes, err error) + SysNoticeUserRead(ctx context.Context, req *v1.SysNoticeUserReadReq) (res *v1.SysNoticeUserReadRes, err error) + SysTenantList(ctx context.Context, req *v1.SysTenantListReq) (res *v1.SysTenantListRes, err error) + SysTenantAdd(ctx context.Context, req *v1.SysTenantAddReq) (res *v1.SysTenantAddRes, err error) + SysTenantEdit(ctx context.Context, req *v1.SysTenantEditReq) (res *v1.SysTenantEditRes, err error) + SysTenantDelete(ctx context.Context, req *v1.SysTenantDeleteReq) (res *v1.SysTenantDeleteRes, err error) + SysTenantStatus(ctx context.Context, req *v1.SysTenantStatusReq) (res *v1.SysTenantStatusRes, err error) + SysTenantView(ctx context.Context, req *v1.SysTenantViewReq) (res *v1.SysTenantViewRes, err error) + SysTenantSyncMenu(ctx context.Context, req *v1.SysTenantSyncMenuReq) (res *v1.SysTenantSyncMenuRes, err error) + SysTenantPackageList(ctx context.Context, req *v1.SysTenantPackageListReq) (res *v1.SysTenantPackageListRes, err error) + SysTenantPackageView(ctx context.Context, req *v1.SysTenantPackageViewReq) (res *v1.SysTenantPackageViewRes, err error) + SysTenantPackageStatus(ctx context.Context, req *v1.SysTenantPackageStatusReq) (res *v1.SysTenantPackageStatusRes, err error) + SysTenantPackageAdd(ctx context.Context, req *v1.SysTenantPackageAddReq) (res *v1.SysTenantPackageAddRes, err error) + SysTenantPackageEdit(ctx context.Context, req *v1.SysTenantPackageEditReq) (res *v1.SysTenantPackageEditRes, err error) + SysTenantPackageDelete(ctx context.Context, req *v1.SysTenantPackageDeleteReq) (res *v1.SysTenantPackageDeleteRes, err error) + TTplatformSettingList(ctx context.Context, req *v1.TTplatformSettingListReq) (res *v1.TTplatformSettingListRes, err error) + TTplatformSettingExport(ctx context.Context, req *v1.TTplatformSettingExportReq) (res *v1.TTplatformSettingExportRes, err error) + TTplatformSettingView(ctx context.Context, req *v1.TTplatformSettingViewReq) (res *v1.TTplatformSettingViewRes, err error) + TTplatformSettingEdit(ctx context.Context, req *v1.TTplatformSettingEditReq) (res *v1.TTplatformSettingEditRes, err error) + TTplatformSettingDelete(ctx context.Context, req *v1.TTplatformSettingDeleteReq) (res *v1.TTplatformSettingDeleteRes, err error) + TTplatformSettingMaxSort(ctx context.Context, req *v1.TTplatformSettingMaxSortReq) (res *v1.TTplatformSettingMaxSortRes, err error) + TTplatformSettingStatus(ctx context.Context, req *v1.TTplatformSettingStatusReq) (res *v1.TTplatformSettingStatusRes, err error) + UserInfo(ctx context.Context, req *v1.UserInfoReq) (res *v1.UserInfoRes, err error) + UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error) + AddUser(ctx context.Context, req *v1.AddUserReq) (res *v1.AddUserRes, err error) + UserProfile(ctx context.Context, req *v1.UserProfileReq) (res *v1.UserProfileRes, err error) + UpdateCurrentUser(ctx context.Context, req *v1.UpdateCurrentUserReq) (res *v1.UpdateCurrentUserRes, err error) + UpdateCurrentUserPassword(ctx context.Context, req *v1.UpdateCurrentUserPasswordReq) (res *v1.UpdateCurrentUserPasswordRes, err error) + SendCurrentUserEmailCode(ctx context.Context, req *v1.SendCurrentUserEmailCodeReq) (res *v1.SendCurrentUserEmailCodeRes, err error) + UpdateCurrentUserEmail(ctx context.Context, req *v1.UpdateCurrentUserEmailReq) (res *v1.UpdateCurrentUserEmailRes, err error) + SendCurrentUserPhoneCode(ctx context.Context, req *v1.SendCurrentUserPhoneCodeReq) (res *v1.SendCurrentUserPhoneCodeRes, err error) + UpdateCurrentUserPhone(ctx context.Context, req *v1.UpdateCurrentUserPhoneReq) (res *v1.UpdateCurrentUserPhoneRes, err error) + UpdateUser(ctx context.Context, req *v1.UpdateUserReq) (res *v1.UpdateUserRes, err error) + DeleteUser(ctx context.Context, req *v1.DeleteUserReq) (res *v1.DeleteUserRes, err error) + GetUser(ctx context.Context, req *v1.GetUserReq) (res *v1.GetUserRes, err error) + ResetPassword(ctx context.Context, req *v1.ResetPasswordReq) (res *v1.ResetPasswordRes, err error) + GetUserListByDeptId(ctx context.Context, req *v1.GetUserListByDeptIdReq) (res *v1.GetUserListByDeptIdRes, err error) + UserRegister(ctx context.Context, req *v1.UserRegisterReq) (res *v1.UserRegisterRes, err error) + UserStatus(ctx context.Context, req *v1.UserStatusReq) (res *v1.UserStatusRes, err error) + IsMfaEnabled(ctx context.Context, req *v1.IsMfaEnabledReq) (res *v1.IsMfaEnabledRes, err error) + SetMfaEnabled(ctx context.Context, req *v1.SetMfaEnabledReq) (res *v1.SetMfaEnabledRes, err error) + MfaVerify(ctx context.Context, req *v1.MfaVerifyReq) (res *v1.MfaVerifyRes, err error) +} diff --git a/server/api/system/v1/auth.go b/server/api/system/v1/auth.go new file mode 100644 index 0000000..ffde433 --- /dev/null +++ b/server/api/system/v1/auth.go @@ -0,0 +1,93 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +type LoginReq struct { + g.Meta `path:"/auth/login" method:"post" tags:"系统-授权" summary:"登录"` + TenantId string `json:"tenantId" v:"required#租户ID不能为空" dc:"租户ID"` + Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"` + Password string `json:"password" v:"required#密码不能为空" dc:"密码"` + CaptchaID string `json:"captchaID" dc:"验证码ID"` + CaptchaValue string `json:"captchaValue" v:"required#验证码不能为空" dc:"验证码"` +} + +type LoginRes struct { + ID int64 `json:"id" dc:"用户ID"` + Username string `json:"username" dc:"用户名"` + NickName string `json:"nickName" dc:"昵称"` + Avatar string `json:"avatar" dc:"头像"` + AccessToken string `json:"accessToken" dc:"访问令牌"` +} + +type SendSmsLoginCodeReq struct { + g.Meta `path:"/auth/sms-code" method:"post" tags:"系统-授权" summary:"发送手机验证码登录短信"` + Phone string `json:"phone" v:"required|phone#手机号不能为空|手机号格式不正确" dc:"手机号"` +} + +type SendSmsLoginCodeRes struct{} + +type SmsLoginReq struct { + g.Meta `path:"/auth/sms-login" method:"post" tags:"系统-授权" summary:"手机验证码登录"` + Phone string `json:"phone" v:"required|phone#手机号不能为空|手机号格式不正确" dc:"手机号"` + Code string `json:"code" v:"required|length:6,6#验证码不能为空|验证码应为6位" dc:"短信验证码"` +} + +type SmsLoginRes struct { + ID int64 `json:"id" dc:"用户ID"` + Username string `json:"username" dc:"用户名"` + NickName string `json:"nickName" dc:"昵称"` + Avatar string `json:"avatar" dc:"头像"` + AccessToken string `json:"accessToken" dc:"访问令牌"` +} + +type RefreshTokenReq struct { + g.Meta `path:"/auth/refresh" method:"post" tags:"系统-授权" summary:"刷新访问令牌"` + WithCredentials bool `json:"withCredentials" dc:"是否携带凭证"` +} + +type RefreshTokenRes struct { + Data string `json:"data" dc:"新的访问令牌"` + Status int `json:"status" dc:"状态码"` +} + +type LogoutReq struct { + g.Meta `path:"/auth/logout" method:"post" tags:"系统-授权" summary:"退出登录"` + WithCredentials bool `json:"withCredentials" dc:"是否携带凭证"` +} + +type LogoutRes struct { + Data string `json:"data" dc:"退出登录"` + Status int `json:"status" dc:"状态码"` +} + +type GetAccessCodesReq struct { + g.Meta `path:"/auth/codes" method:"get" tags:"系统-授权" summary:"获取用户权限码"` + IsCache bool `json:"isCache" dc:"是否从缓存中获取"` +} + +type GetAccessCodesRes struct { + Data []string `json:"data" dc:"用户权限码"` + Status int `json:"status" dc:"状态码"` +} + +type TenantListReq struct { + g.Meta `path:"/auth/getTenantList" method:"get" tags:"系统-授权" summary:"获取租户列表"` +} + +type TenantListData struct { + CompanyName string `json:"companyName" dc:"企业名称"` + Domain string `json:"domain" dc:"域名"` + TenantId string `json:"tenantId" dc:"租户ID"` +} + +type TenantListRes struct { + TenantEnabled bool `json:"tenantEnabled" dc:"是否启用租户"` + VoList []TenantListData `json:"voList" dc:"租户列表"` +} diff --git a/server/api/system/v1/captcha.go b/server/api/system/v1/captcha.go new file mode 100644 index 0000000..979a188 --- /dev/null +++ b/server/api/system/v1/captcha.go @@ -0,0 +1,18 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import "github.com/gogf/gf/v2/frame/g" + +// 获取验证码 +type GetCaptchaReq struct { + g.Meta `path:"/captcha" method:"get" tags:"系统-授权" summary:"获取验证码"` +} + +type GetCaptchaRes struct { + CaptchaID string `json:"captchaID" dc:"验证码ID"` + CaptchaImage string `json:"captchaImage" dc:"验证码图片"` +} diff --git a/server/api/system/v1/client.go b/server/api/system/v1/client.go new file mode 100644 index 0000000..90fafb1 --- /dev/null +++ b/server/api/system/v1/client.go @@ -0,0 +1,68 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysClientListReq struct { + g.Meta `path:"/client/list" method:"get" tags:"系统-客户端管理" summary:"获取客户端列表" x-check-permission:"cpm:system:client:list"` + model.SysClientListParam +} + +type SysClientListRes struct { + Items []*model.SysClientListModel `json:"items"` + response.PageResult +} + +type SysClientViewReq struct { + g.Meta `path:"/client/view" method:"get" tags:"系统-客户端管理" summary:"获取客户端详情" x-check-permission:"cpm:system:client:query"` + *model.SysClientViewParam +} + +type SysClientViewRes struct { + *model.SysClientViewModel +} + +type SysClientAddReq struct { + g.Meta `path:"/client/add" method:"post" tags:"系统-客户端管理" summary:"添加客户端" x-check-permission:"cpm:system:client:add"` + *model.SysClientAddParam +} + +type SysClientAddRes struct { + *model.SysClientAddModel +} + +type SysClientEditReq struct { + g.Meta `path:"/client/edit" method:"post" tags:"系统-客户端管理" summary:"编辑客户端" x-check-permission:"cpm:system:client:edit"` + *model.SysClientEditParam +} + +type SysClientEditRes struct { + *model.SysClientEditModel +} + +type SysClientDeleteReq struct { + g.Meta `path:"/client/delete" method:"post" tags:"系统-客户端管理" summary:"删除客户端" x-check-permission:"cpm:system:client:remove"` + *model.SysClientDeleteParam +} + +type SysClientDeleteRes struct { + *model.SysClientDeleteModel +} + +type SysClientStatusReq struct { + g.Meta `path:"/client/status" method:"post" tags:"系统-客户端管理" summary:"修改客户端状态" x-check-permission:"cpm:system:client:edit"` + *model.SysClientStatusParam +} + +type SysClientStatusRes struct { + *model.SysClientStatusModel +} diff --git a/server/api/system/v1/config.go b/server/api/system/v1/config.go new file mode 100644 index 0000000..b1c2798 --- /dev/null +++ b/server/api/system/v1/config.go @@ -0,0 +1,59 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type GetConfigListReq struct { + g.Meta `path:"/config/list" method:"get" tags:"系统-配置管理" summary:"获取系统配置列表" x-check-permission:"cpm:system:config:list"` + model.SysConfigListParam +} + +type GetConfigListRes struct { + response.PageResult + Data []*model.SysConfigListModel `json:"items" dc:"系统配置列表"` +} + +type AddConfigReq struct { + g.Meta `path:"/config/add" method:"post" tags:"系统-配置管理" summary:"添加系统配置" x-check-permission:"cpm:system:config:add"` + model.SysConfigAddParam +} + +type AddConfigRes struct { + model.SysConfigAddModel +} + +type EditConfigReq struct { + g.Meta `path:"/config/edit" method:"post" tags:"系统-配置管理" summary:"编辑系统配置" x-check-permission:"cpm:system:config:edit"` + model.SysConfigEditParam +} + +type EditConfigRes struct { + model.SysConfigEditModel +} + +type DeleteConfigReq struct { + g.Meta `path:"/config/delete" method:"post" tags:"系统-配置管理" summary:"删除系统配置" x-check-permission:"cpm:system:config:remove"` + model.SysConfigDeleteParam +} + +type DeleteConfigRes struct { + model.SysConfigDeleteModel +} + +type GetConfigByIdReq struct { + g.Meta `path:"/config/view" method:"get" tags:"系统-配置管理" summary:"获取系统配置详情" x-check-permission:"cpm:system:config:query"` + model.SysConfigViewParam +} + +type GetConfigByIdRes struct { + model.SysConfigViewModel +} diff --git a/server/api/system/v1/dept.go b/server/api/system/v1/dept.go new file mode 100644 index 0000000..2725fd1 --- /dev/null +++ b/server/api/system/v1/dept.go @@ -0,0 +1,83 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type DeptListReq struct { + g.Meta `path:"/dept/list" method:"get" tags:"系统-部门管理" summary:"获取部门列表" x-check-permission:"cpm:system:dept:list"` + request.PageInfo + model.SysDeptListParam +} + +type DeptListRes struct { + response.PageResult + Data []*model.SysDeptListModel `json:"items" dc:"部门列表"` +} + +type DeptTreeReq struct { + g.Meta `path:"/dept/tree" method:"get" tags:"系统-部门管理" summary:"获取部门树" x-check-permission:"cpm:system:dept:list"` + model.SysDeptTreeParam +} + +type DeptTreeRes struct { + Data []*model.SysDeptTreeModel `json:"items" dc:"部门树"` +} + +// DeptFullTreeReq 组织管理页专用的完整部门树。 +// +// 与 DeptTreeReq 分开而非复用:/dept/tree 有 10+ 处调用方(部门选择器、 +// 用户管理左栏、通知公告等),它们只依赖精简的7 个字段,不能改动其结构。 +type DeptFullTreeReq struct { + g.Meta `path:"/dept/tree/full" method:"get" tags:"系统-部门管理" summary:"获取完整部门树" x-check-permission:"cpm:system:dept:list"` + model.SysDeptFullTreeParam +} + +type DeptFullTreeRes struct { + Data []*model.SysDeptFullTreeModel `json:"items" dc:"完整部门树"` +} + +type DeptAddReq struct { + g.Meta `path:"/dept/add" method:"post" tags:"系统-部门管理" summary:"新增部门" x-check-permission:"cpm:system:dept:add"` + model.SysDeptAddModel +} + +type DeptAddRes struct { + DeptId int64 `json:"deptId" dc:"部门id"` +} + +type DeptEditReq struct { + g.Meta `path:"/dept/edit" method:"post" tags:"系统-部门管理" summary:"编辑部门" x-check-permission:"cpm:system:dept:edit"` + model.SysDeptEditModel +} + +type DeptEditRes struct { + DeptId int64 `json:"deptId" dc:"部门id"` +} + +type DeptDeleteReq struct { + g.Meta `path:"/dept/delete" method:"post" tags:"系统-部门管理" summary:"删除部门" x-check-permission:"cpm:system:dept:remove"` + model.SysDeptDeleteModel +} + +type DeptDeleteRes struct { + DeptId int64 `json:"deptId" dc:"部门id"` +} + +type DeptViewReq struct { + g.Meta `path:"/dept/view" method:"get" tags:"系统-部门管理" summary:"获取部门详情" x-check-permission:"cpm:system:dept:query"` + model.SysDeptViewModel +} + +type DeptViewRes struct { + model.SysDeptViewModel +} diff --git a/server/api/system/v1/dict.go b/server/api/system/v1/dict.go new file mode 100644 index 0000000..9afbee4 --- /dev/null +++ b/server/api/system/v1/dict.go @@ -0,0 +1,108 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysDictTypeListReq struct { + g.Meta `path:"/dict/list" method:"get" tags:"系统-字典管理" summary:"字典类型列表" x-check-permission:"cpm:system:dict:list"` + model.SysDictTypeListParam +} + +type SysDictTypeListRes struct { + response.PageResult + Items []model.SysDictTypeListModel `json:"items"` +} + +type SysDictTypeAddReq struct { + g.Meta `path:"/dict-type/add" method:"post" tags:"系统-字典管理" summary:"新增字典类型" x-check-permission:"cpm:system:dict:add"` + model.SysDictTypeAddParam +} + +type SysDictTypeAddRes struct { + model.SysDictTypeAddModel +} + +type SysDictTypeEditReq struct { + g.Meta `path:"/dict-type/edit" method:"post" tags:"系统-字典管理" summary:"编辑字典类型" x-check-permission:"cpm:system:dict:edit"` + model.SysDictTypeEditParam +} + +type SysDictTypeEditRes struct { + model.SysDictTypeEditModel +} + +type SysDictTypeDeleteReq struct { + g.Meta `path:"/dict-type/delete" method:"post" tags:"系统-字典管理" summary:"删除字典类型" x-check-permission:"cpm:system:dict:remove"` + model.SysDictTypeDeleteParam +} + +type SysDictTypeDeleteRes struct { + model.SysDictTypeDeleteModel +} + +type SysDictTypeViewReq struct { + g.Meta `path:"/dict-type/view" method:"get" tags:"系统-字典管理" summary:"字典类型详情" x-check-permission:"cpm:system:dict:query"` + model.SysDictTypeViewParam +} + +type SysDictTypeViewRes struct { + model.SysDictTypeViewModel +} + +type SysDictDataListReq struct { + g.Meta `path:"/dict-data/list/{id}" method:"get" tags:"系统-字典管理" summary:"字典数据列表" ` + request.PageInfo + model.SysDictDataListParam +} + +type SysDictDataListRes struct { + response.PageResult + Items []model.SysDictDataListModel `json:"items"` + Type *model.SysDictTypeViewModel `json:"type"` +} + +type SysDictDataAddReq struct { + g.Meta `path:"/dict-data/add" method:"post" tags:"系统-字典管理" summary:"新增字典数据" x-check-permission:"cpm:system:dict:add"` + model.SysDictDataAddParam +} + +type SysDictDataAddRes struct { + model.SysDictDataAddModel +} + +type SysDictDataEditReq struct { + g.Meta `path:"/dict-data/edit" method:"post" tags:"系统-字典管理" summary:"编辑字典数据" x-check-permission:"cpm:system:dict:edit"` + model.SysDictDataEditParam +} + +type SysDictDataEditRes struct { + model.SysDictDataEditModel +} + +type SysDictDataDeleteReq struct { + g.Meta `path:"/dict-data/delete" method:"post" tags:"系统-字典管理" summary:"删除字典数据" x-check-permission:"cpm:system:dict:remove"` + model.SysDictDataDeleteParam +} + +type SysDictDataDeleteRes struct { + model.SysDictDataDeleteModel +} + +type SysDictDataViewReq struct { + g.Meta `path:"/dict-data/view" method:"get" tags:"系统-字典管理" summary:"字典数据详情" x-check-permission:"cpm:system:dict:query"` + model.SysDictDataViewParam +} + +type SysDictDataViewRes struct { + model.SysDictDataViewModel +} diff --git a/server/api/system/v1/job.go b/server/api/system/v1/job.go new file mode 100644 index 0000000..5122489 --- /dev/null +++ b/server/api/system/v1/job.go @@ -0,0 +1,83 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// 获取任务列表 +type SysJobListReq struct { + g.Meta `path:"/job/list" method:"get" tags:"系统-任务管理" summary:"获取任务列表" x-check-permission:"cpm:system:job:list"` + model.SysJobListParam + request.PageInfo +} + +type SysJobListRes struct { + Data []*model.SysJobListModel `json:"items" dc:"任务列表"` + response.PageResult +} + +// 获取任务详情 +type SysJobViewReq struct { + g.Meta `path:"/job/view" method:"get" tags:"系统-任务管理" summary:"获取任务详情" x-check-permission:"cpm:system:job:view"` + JobId int64 `v:"required" json:"jobId" dc:"任务ID"` +} + +type SysJobViewRes struct { + model.SysJobViewModel +} + +// 添加任务 +type SysJobAddReq struct { + g.Meta `path:"/job/add" method:"post" tags:"系统-任务管理" summary:"添加任务" x-check-permission:"cpm:system:job:add"` + model.SysJobAddModel +} + +type SysJobAddRes struct { + model.SysJobViewModel +} + +// 更新任务 +type SysJobUpdateReq struct { + g.Meta `path:"/job/update" method:"post" tags:"系统-任务管理" summary:"更新任务" x-check-permission:"cpm:system:job:update"` + model.SysJobUpdateModel +} + +type SysJobUpdateRes struct { + model.SysJobViewModel +} + +// 更新任务 +type SysJobUpdateStatusReq struct { + g.Meta `path:"/job/status" method:"post" tags:"系统" summary:"更新任务状态" x-check-permission:"cpm:system:job:status"` + model.SysJobUpdateStatusModel +} + +type SysJobUpdateStatusRes = SysJobUpdateRes + +// 删除任务 +type SysJobDeleteReq struct { + g.Meta `path:"/job/delete" method:"post" tags:"系统-任务管理" summary:"删除任务" x-check-permission:"cpm:system:job:delete"` + JobIds []int64 `json:"jobId" dc:"任务ID"` +} + +type SysJobExecReq struct { + g.Meta `path:"/job/exec" method:"post" tags:"系统" summary:"执行任务" x-check-permission:"cpm:system:job:exec"` + JobId int64 `v:"required" json:"jobId" dc:"任务ID"` +} + +type SysJobDeleteRes struct { + JobIds []int64 `json:"jobId" dc:"任务ID"` +} + +type SysJobExecRes struct { + JobId int64 `json:"jobId" dc:"任务ID"` +} diff --git a/server/api/system/v1/logininfor.go b/server/api/system/v1/logininfor.go new file mode 100644 index 0000000..16e9c06 --- /dev/null +++ b/server/api/system/v1/logininfor.go @@ -0,0 +1,32 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type ListLogininforReq struct { + g.Meta `path:"/logininfor/list" method:"get" tags:"系统-日志管理" summary:"登录信息列表" x-check-permission:"cpm:monitor:logininfor:list"` + model.SysLogininforListParam +} + +type ListLogininforRes struct { + Items []*model.SysLogininforListModel `json:"items"` + response.PageResult +} + +type DeleteLogininforReq struct { + g.Meta `path:"/logininfor/delete" method:"post" tags:"系统-日志管理" summary:"删除登录信息" x-check-permission:"cpm:monitor:logininfor:remove"` + model.SysLogininforDeleteParam +} + +type DeleteLogininforRes struct { + model.SysLogininforDeleteModel +} diff --git a/server/api/system/v1/menu.go b/server/api/system/v1/menu.go new file mode 100644 index 0000000..e66319a --- /dev/null +++ b/server/api/system/v1/menu.go @@ -0,0 +1,127 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +// 路由菜单 +type RouteMenu struct { + Id int64 `json:"id" dc:"路由ID"` + ParentId int64 `json:"parentId" dc:"父路由ID"` + Path string `json:"path" dc:"路由路径"` + Redirect *string `json:"redirect,omitempty" dc:"重定向路径"` + Name string `json:"name" dc:"路由名称"` // 必须唯一 + Component string `json:"component" dc:"组件路径"` + Meta *RouteMeta `json:"meta,omitempty" dc:"路由元数据"` + Children []*RouteMenu `json:"children,omitempty" dc:"子路由"` +} + +// 路由元数据 +// 对应 vue/packages/@core/base/typings/src/vue-router.d.ts +type RouteMeta struct { + Title string `json:"title" dc:"菜单标题"` + Icon *string `json:"icon,omitempty" dc:"菜单图标"` + Order *int `json:"order,omitempty" dc:"菜单排序"` + OpenInNewWindow *bool `json:"openInNewWindow,omitempty" dc:"是否在新窗口打开"` + NoBasicLayout *bool `json:"noBasicLayout,omitempty" dc:"是否不使用基础布局"` + HideInMenu *bool `json:"hideInMenu,omitempty" dc:"是否隐藏菜单"` + HideInBreadcrumb *bool `json:"hideInBreadcrumb,omitempty" dc:"是否隐藏面包屑"` + HideChildrenInMenu *bool `json:"hideChildrenInMenu,omitempty" dc:"是否隐藏子菜单"` + HideInTab *bool `json:"hideInTab,omitempty" dc:"是否隐藏标签页"` + MenuVisibleWithForbidden *bool `json:"menuVisibleWithForbidden,omitempty" dc:"菜单可见但访问会被重定向到403"` + IgnoreAccess *bool `json:"ignoreAccess,omitempty" dc:"忽略权限,直接可以访问"` + KeepAlive *bool `json:"keepAlive,omitempty" dc:"开启KeepAlive缓存"` + Link *string `json:"link,omitempty" dc:"外链-跳转路径"` + Query map[string]string `json:"query,omitempty" dc:"路由所携带的参数"` + IframeSrc *string `json:"iframeSrc,omitempty" dc:"iframe地址"` + MaxNumOfOpenTab *int `json:"maxNumOfOpenTab,omitempty" dc:"标签页最大打开数量"` + Badge *string `json:"badge,omitempty" dc:"徽标"` + BadgeType *string `json:"badgeType,omitempty" dc:"徽标类型"` + BadgeVariants *string `json:"badgeVariants,omitempty" dc:"徽标颜色"` + Authority []string `json:"authority,omitempty" dc:"需要特定的角色标识才可以访问"` + AffixTab *bool `json:"affixTab,omitempty" dc:"是否固定标签页"` + AffixTabOrder *int `json:"affixTabOrder,omitempty" dc:"固定标签页的顺序"` + ActiveIcon *string `json:"activeIcon,omitempty" dc:"激活图标"` + ActivePath *string `json:"activePath,omitempty" dc:"当前激活的菜单"` +} + +// 获取用户所有菜单 +type MenuAllReq struct { + g.Meta `path:"/menu/all" method:"get" tags:"系统-菜单管理" summary:"获取用户所有菜单" x-check-permission:""` +} + +// type MenuAllRes struct { +// Data []RouteMenu `json:"data" dc:"菜单列表"` +// } +type MenuAllRes = []*RouteMenu + +type MenuListReq struct { + g.Meta `path:"/menu/list" method:"get" tags:"系统-菜单管理" summary:"获取菜单列表" x-check-permission:"cpm:system:menu:list"` + model.SysMenuListParam +} + +type MenuListRes struct { + Data []*model.SysMenuListModel `json:"items" dc:"菜单列表"` + Total int `json:"total" dc:"总数"` +} + +type MenuViewReq struct { + g.Meta `path:"/menu/view" method:"get" tags:"系统-菜单管理" summary:"获取菜单详情" x-check-permission:"cpm:system:menu:query"` + MenuId int64 `json:"menuId" dc:"菜单ID"` +} + +type MenuViewRes struct { + model.SysMenuViewModel +} + +type MenuAddReq struct { + g.Meta `path:"/menu/add" method:"post" tags:"系统-菜单管理" summary:"添加菜单" x-check-permission:"cpm:system:menu:add"` + model.SysMenuAddModel +} + +type MenuAddRes struct { + model.SysMenuViewModel +} + +type MenuUpdateReq struct { + g.Meta `path:"/menu/update" method:"post" tags:"系统-菜单管理" summary:"更新菜单" x-check-permission:"cpm:system:menu:edit"` + model.SysMenuUpdateModel +} + +type MenuUpdateRes struct { + model.SysMenuViewModel +} + +type MenuDeleteReq struct { + g.Meta `path:"/menu/delete" method:"post" tags:"系统-菜单管理" summary:"删除菜单" x-check-permission:"cpm:system:menu:remove"` + MenuId int64 `json:"menuId" dc:"菜单ID"` +} + +type MenuDeleteRes struct { +} + +// MenuTreeReq 菜单树,服务于两个场景: +// 1. 菜单管理页(需要 cpm:system:menu:list) +// 2. 角色管理页里的授权树(需要 cpm:system:role:query) +// +// 二者权限域不同,因此用逗号分隔声明为「或」关系:拥有任一权限即可调用。 +// 逗号 OR 语义由中间件实现(internal/logic/middleware/middleware.go 中对 +// x-check-permission 按 "," 切分后逐个匹配,任一通过即放行)。 +// +// 若只要求 cpm:system:menu:list,则只有角色管理权限、没有菜单管理权限的用户 +// 将无法打开授权树。此设计与 /agent/menu/tree 使用角色权限的思路一致。 +type MenuTreeReq struct { + g.Meta `path:"/menu/tree" method:"get" tags:"系统-菜单管理" summary:"获取菜单树" x-check-permission:"cpm:system:menu:list,cpm:system:role:query"` + model.SysMenuListParam +} + +type MenuTreeRes struct { + Data []*model.SysMenuFullTreeModel `json:"items" dc:"菜单树"` +} diff --git a/server/api/system/v1/notice.go b/server/api/system/v1/notice.go new file mode 100644 index 0000000..42f47fa --- /dev/null +++ b/server/api/system/v1/notice.go @@ -0,0 +1,59 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysNoticeListReq struct { + g.Meta `path:"/notice/list" method:"get" tags:"系统-公告管理" summary:"公告列表" x-check-permission:"cpm:system:notice:list"` + *model.SysNoticeListParam +} + +type SysNoticeListRes struct { + response.PageResult + Items []*model.SysNoticeListModel `json:"items"` +} + +type SysNoticeAddReq struct { + g.Meta `path:"/notice/add" method:"post" tags:"系统-公告管理" summary:"新增公告" x-check-permission:"cpm:system:notice:add"` + *model.SysNoticeAddParam +} + +type SysNoticeAddRes struct { + *model.SysNoticeAddModel +} + +type SysNoticeEditReq struct { + g.Meta `path:"/notice/edit" method:"post" tags:"系统-公告管理" summary:"编辑公告" x-check-permission:"cpm:system:notice:edit"` + *model.SysNoticeEditParam +} + +type SysNoticeEditRes struct { + *model.SysNoticeEditModel +} + +type SysNoticeDeleteReq struct { + g.Meta `path:"/notice/delete" method:"post" tags:"系统-公告管理" summary:"删除公告" x-check-permission:"cpm:system:notice:remove"` + *model.SysNoticeDeleteParam +} + +type SysNoticeDeleteRes struct { + *model.SysNoticeDeleteModel +} + +type SysNoticeViewReq struct { + g.Meta `path:"/notice/view" method:"get" tags:"系统-公告管理" summary:"查看公告" x-check-permission:"cpm:system:notice:query"` + *model.SysNoticeViewParam +} + +type SysNoticeViewRes struct { + *model.SysNoticeViewModel +} diff --git a/server/api/system/v1/online.go b/server/api/system/v1/online.go new file mode 100644 index 0000000..e541386 --- /dev/null +++ b/server/api/system/v1/online.go @@ -0,0 +1,33 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysUserOnlineListReq struct { + g.Meta `path:"/user-online/list" method:"get" tags:"监控-在线用户管理" summary:"系统用户在线列表" x-check-permission:"cpm:monitor:online:list"` + request.PageInfo + model.SysUserOnlineListParam +} + +type SysUserOnlineListRes struct { + Items []*model.SysUserOnlineListModel `json:"items"` + response.PageResult +} + +type SysUserOnlineDeleteReq struct { + g.Meta `path:"/user-online/delete" method:"post" tags:"监控-在线用户管理" summary:"系统用户在线删除" x-check-permission:"cpm:monitor:online:remove"` + Ids []int64 `json:"ids"` +} + +type SysUserOnlineDeleteRes struct { +} diff --git a/server/api/system/v1/oper_log.go b/server/api/system/v1/oper_log.go new file mode 100644 index 0000000..b65b998 --- /dev/null +++ b/server/api/system/v1/oper_log.go @@ -0,0 +1,25 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type GetOperLogListReq struct { + g.Meta `path:"/oper-log/list" method:"get" tags:"系统-日志管理" summary:"操作日志列表" x-check-permission:"cpm:monitor:operlog:list"` + model.SysOperLogListParam + request.PageInfo +} + +type GetOperLogListRes struct { + Items []*model.SysOperLogListModel `json:"items"` + response.PageResult +} diff --git a/server/api/system/v1/oss.go b/server/api/system/v1/oss.go new file mode 100644 index 0000000..b64d4f4 --- /dev/null +++ b/server/api/system/v1/oss.go @@ -0,0 +1,43 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysOssListReq struct { + g.Meta `path:"/oss/list" method:"get" tags:"系统-存储管理" summary:"获取OSS列表" x-check-permission:"cpm:system:oss:list"` + model.SysOssListParam + request.PageInfo +} + +type SysOssListRes struct { + Items []*model.SysOssListModel `json:"items"` + response.PageResult +} + +type SysOssViewReq struct { + g.Meta `path:"/oss/view" method:"get" tags:"系统-存储管理" summary:"查看文件" x-check-permission:"cpm:system:oss:query"` + *model.SysOssViewParam +} + +type SysOssViewRes struct { + *model.SysOssViewModel +} + +type SysOssDeleteReq struct { + g.Meta `path:"/oss/delete" method:"post" tags:"系统-存储管理" summary:"删除文件" x-check-permission:"cpm:system:oss:remove"` + *model.SysOssDeleteParam +} + +type SysOssDeleteRes struct { + *model.SysOssDeleteModel +} diff --git a/server/api/system/v1/oss_config.go b/server/api/system/v1/oss_config.go new file mode 100644 index 0000000..dda85e3 --- /dev/null +++ b/server/api/system/v1/oss_config.go @@ -0,0 +1,54 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysOssConfigListReq struct { + g.Meta `path:"/oss-config/list" method:"get" tags:"系统-存储管理" summary:"获取存储配置列表" x-check-permission:"cpm:system:ossConfig:list"` + *model.SysOssConfigListParam +} +type SysOssConfigListRes struct { + response.PageResult + Items []*model.SysOssConfigListModel `json:"items"` +} + +type SysOssConfigViewReq struct { + g.Meta `path:"/oss-config/view" method:"get" tags:"系统-存储管理" summary:"获取存储配置详情" x-check-permission:"cpm:system:ossConfig:list"` + *model.SysOssConfigViewParam +} +type SysOssConfigViewRes struct { + *model.SysOssConfigViewModel +} + +type SysOssConfigAddReq struct { + g.Meta `path:"/oss-config/add" method:"post" tags:"系统-存储管理" summary:"新增存储配置" x-check-permission:"cpm:system:ossConfig:add"` + *model.SysOssConfigAddParam +} +type SysOssConfigAddRes struct { + *model.SysOssConfigAddModel +} + +type SysOssConfigEditReq struct { + g.Meta `path:"/oss-config/edit" method:"post" tags:"系统-存储管理" summary:"编辑存储配置" x-check-permission:"cpm:system:ossConfig:edit"` + *model.SysOssConfigEditParam +} +type SysOssConfigEditRes struct { + *model.SysOssConfigEditModel +} + +type SysOssConfigDeleteReq struct { + g.Meta `path:"/oss-config/delete" method:"post" tags:"系统-存储管理" summary:"删除存储配置" x-check-permission:"cpm:system:ossConfig:remove"` + *model.SysOssConfigDeleteParam +} +type SysOssConfigDeleteRes struct { + *model.SysOssConfigDeleteModel +} diff --git a/server/api/system/v1/post.go b/server/api/system/v1/post.go new file mode 100644 index 0000000..b45118c --- /dev/null +++ b/server/api/system/v1/post.go @@ -0,0 +1,68 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type PostListReq struct { + g.Meta `path:"/post/list" method:"get" tags:"系统-岗位管理" summary:"获取岗位列表" x-check-permission:"cpm:system:post:list"` + *model.SysPostListParam +} + +type PostListRes struct { + response.PageResult + Data []*model.SysPostListModel `json:"items" dc:"岗位列表"` +} + +type PostAddReq struct { + g.Meta `path:"/post/add" method:"post" tags:"系统-岗位管理" summary:"新增岗位" x-check-permission:"cpm:system:post:add"` + *model.SysPostAddParam +} + +type PostAddRes struct { + *model.SysPostAddModel +} + +type PostEditReq struct { + g.Meta `path:"/post/edit" method:"post" tags:"系统-岗位管理" summary:"编辑岗位" x-check-permission:"cpm:system:post:edit"` + *model.SysPostEditParam +} + +type PostEditRes struct { + *model.SysPostEditModel +} + +type PostDeleteReq struct { + g.Meta `path:"/post/delete" method:"post" tags:"系统-岗位管理" summary:"删除岗位"` + *model.SysPostDeleteParam +} + +type PostDeleteRes struct { + *model.SysPostDeleteModel +} + +type PostViewReq struct { + g.Meta `path:"/post/view" method:"get" tags:"系统-岗位管理" summary:"获取岗位详情" x-check-permission:"cpm:system:post:list"` + *model.SysPostViewParam +} + +type PostViewRes struct { + *model.SysPostViewModel +} + +type PostExportReq struct { + g.Meta `path:"/post/export" method:"post" tags:"系统-岗位管理" summary:"导出岗位" x-check-permission:"cpm:system:post:export"` + *model.SysPostExportParam +} + +type PostExportRes struct { + *model.SysPostExportModel +} diff --git a/server/api/system/v1/qrcode.go b/server/api/system/v1/qrcode.go new file mode 100644 index 0000000..507ec5a --- /dev/null +++ b/server/api/system/v1/qrcode.go @@ -0,0 +1,83 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +// 获取登录二维码 +type QrcodeLoginReq struct { + g.Meta `path:"/qrcode/login" method:"get" tags:"系统-二维码" summary:"获取登录二维码"` +} + +type QrcodeLoginRes struct { + model.QrcodeLoginModel +} + +// 获取登录二维码扫码结果 +type QrcodeLoginStatusReq struct { + g.Meta `path:"/qrcode/login/status" method:"get" tags:"系统-二维码" summary:"获取登录二维码扫码状态"` + TempUserId string `json:"tempUserId" dc:"临时用户ID" v:"required#临时用户ID不能为空"` +} + +type QrcodeLoginStatusRes struct { + model.QrcodeLoginModel +} + +// 获取绑定二维码 +type QrcodeBindReq struct { + g.Meta `path:"/qrcode/bind" method:"get" tags:"系统-二维码" summary:"获取绑定二维码"` +} + +type QrcodeBindRes struct { + model.QrcodeCacheModel +} + +// 获取绑定二维码扫码结果 +type QrcodeBindStatusReq struct { + g.Meta `path:"/qrcode/bind/status" method:"get" tags:"系统-二维码" summary:"获取绑定二维码扫码状态"` +} + +type QrcodeBindStatusRes struct { + model.QrcodeBindStatusModel +} + +// 扫码成功回调 +type QrcodeScanCallbackReq struct { + g.Meta `path:"/qrcode/scan/callback" method:"post" tags:"系统-二维码" summary:"扫码成功回调"` + model.QrcodeScanCallbackParam +} + +type QrcodeScanCallbackRes struct { +} + +// 注册并关联OpenId +type QrcodeRegisterAndBindOpenIdReq struct { + g.Meta `path:"/qrcode/registerAndBindOpenId" method:"post" tags:"系统-二维码" summary:"注册并关联OpenId"` + model.QrcodeRegisterAndBindOpenIdParam +} + +type QrcodeRegisterAndBindOpenIdRes struct { + model.QrcodeLoginAndBindOpenIdModel +} + +// 登录并关联OpenId +type QrcodeLoginAndBindOpenIdReq struct { + g.Meta `path:"/qrcode/loginAndBindOpenId" method:"post" tags:"系统-二维码" summary:"登录并关联OpenId"` + model.QrcodeLoginAndBindOpenIdParam +} + +type QrcodeLoginAndBindOpenIdRes struct { + model.QrcodeLoginAndBindOpenIdModel +} + +// 扫码后选择用户登录 +type QrcodeLoginSelectUserReq struct { + g.Meta `path:"/qrcode/loginSelectUser" method:"post" tags:"系统-二维码" summary:"扫码后选择用户登录"` + model.QrcodeLoginSelectUserIdParam +} + +type QrcodeLoginSelectUserRes struct { + model.QrcodeLoginAndBindOpenIdModel +} diff --git a/server/api/system/v1/role.go b/server/api/system/v1/role.go new file mode 100644 index 0000000..9425ab9 --- /dev/null +++ b/server/api/system/v1/role.go @@ -0,0 +1,69 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type RoleListReq struct { + g.Meta `path:"/role/list" method:"get" tags:"系统-角色管理" summary:"获取角色列表" x-check-permission:"cpm:system:role:list"` + request.PageInfo + model.SysRoleListParam +} + +type RoleListRes struct { + response.PageResult + Data []*model.SysRoleListModel `json:"items" dc:"角色列表"` +} + +type RoleAddReq struct { + g.Meta `path:"/role/add" method:"post" tags:"系统-角色管理" summary:"新增角色" x-check-permission:"cpm:system:role:add"` + model.SysRoleAddParam +} + +type RoleAddRes struct { + model.SysRoleAddModel +} + +type RoleEditReq struct { + g.Meta `path:"/role/edit" method:"post" tags:"系统-角色管理" summary:"编辑角色" x-check-permission:"cpm:system:role:edit"` + model.SysRoleEditParam +} + +type RoleEditRes struct { + model.SysRoleEditModel +} + +type RoleDeleteReq struct { + g.Meta `path:"/role/delete" method:"post" tags:"系统-角色管理" summary:"删除角色" x-check-permission:"cpm:system:role:remove"` + model.SysRoleDeleteParam +} + +type RoleDeleteRes struct { + model.SysRoleDeleteModel +} + +type RoleViewReq struct { + g.Meta `path:"/role/view" method:"get" tags:"系统-角色管理" summary:"获取角色详情" x-check-permission:"cpm:system:role:query"` + model.SysRoleViewParam +} + +type RoleViewRes struct { + model.SysRoleViewModel +} + +type RoleDataScopeEditReq struct { + g.Meta `path:"/role/dataScope" method:"post" tags:"系统-角色管理" summary:"编辑角色数据权限" x-check-permission:"cpm:system:role:edit"` + model.SysRoleDataScopeEditParam +} + +type RoleDataScopeEditRes struct { +} diff --git a/server/api/system/v1/social.go b/server/api/system/v1/social.go new file mode 100644 index 0000000..596e129 --- /dev/null +++ b/server/api/system/v1/social.go @@ -0,0 +1,34 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysSocialListReq struct { + g.Meta `path:"/social/list" method:"get" tags:"系统-第三方授权管理" summary:"社交列表" x-check-permission:"cpc:current:user"` + model.SysSocialListParam + request.PageInfo +} + +type SysSocialListRes struct { + Items []*model.SysSocialListModel `json:"items"` + response.PageResult +} + +// 删除绑定关系 +type SysSocialDeleteReq struct { + g.Meta `path:"/social/delete" method:"post" tags:"系统-第三方授权管理" summary:"删除社交" x-check-permission:"cpc:current:user"` + Id int64 `json:"id" dc:"主键"` +} + +type SysSocialDeleteRes struct { +} diff --git a/server/api/system/v1/sysnoticeuser.go b/server/api/system/v1/sysnoticeuser.go new file mode 100644 index 0000000..e219b7e --- /dev/null +++ b/server/api/system/v1/sysnoticeuser.go @@ -0,0 +1,75 @@ +// Package sysnoticeuser +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //sysnoticeuser + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询用户通知公告表列表 +type SysNoticeUserListReq struct { + g.Meta `path:"/sysNoticeUser/list" method:"get" tags:"系统-用户通知公告表" summary:"获取用户通知公告表列表" x-check-permission:"cpm:system:sysNoticeUser:list,cpc:current:user"` + model.SysNoticeUserListParam +} + +type SysNoticeUserListRes struct { + response.PageResult + Items []*model.SysNoticeUserListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出用户通知公告表列表 +type SysNoticeUserExportReq struct { + g.Meta `path:"/sysNoticeUser/export" method:"post" tags:"系统-用户通知公告表" summary:"导出用户通知公告表列表" x-check-permission:"cpm:system:sysNoticeUser:export,cpc:current:user"` + model.SysNoticeUserListParam +} + +type SysNoticeUserExportRes struct{} + +// ViewReq 获取用户通知公告表指定信息 +type SysNoticeUserViewReq struct { + g.Meta `path:"/sysNoticeUser/view" method:"get" tags:"系统-用户通知公告表" summary:"获取用户通知公告表指定信息" x-check-permission:"cpm:system:sysNoticeUser:view,cpc:current:user"` + model.SysNoticeUserViewParam +} + +type SysNoticeUserViewRes struct { + *model.SysNoticeUserViewModel +} + +// EditReq 修改/新增用户通知公告表 +type SysNoticeUserEditReq struct { + g.Meta `path:"/sysNoticeUser/edit" method:"post" tags:"系统-用户通知公告表" summary:"修改/新增用户通知公告表" x-check-permission:"cpm:system:sysNoticeUser:edit,cpc:current:user"` + model.SysNoticeUserEditParam +} + +type SysNoticeUserEditRes struct{} + +// DeleteReq 删除用户通知公告表 +type SysNoticeUserDeleteReq struct { + g.Meta `path:"/sysNoticeUser/delete" method:"post" tags:"系统-用户通知公告表" summary:"删除用户通知公告表" x-check-permission:"cpm:system:sysNoticeUser:delete,cpc:current:user"` + model.SysNoticeUserDeleteParam +} + +type SysNoticeUserDeleteRes struct{} + +// StatusReq 更新用户通知公告表状态 +type SysNoticeUserStatusReq struct { + g.Meta `path:"/sysNoticeUser/status" method:"post" tags:"系统-用户通知公告表" summary:"更新用户通知公告表状态" x-check-permission:"cpm:system:sysNoticeUser:status,cpc:current:user"` + model.SysNoticeUserStatusParam +} + +type SysNoticeUserStatusRes struct{} + +// ReadReq 已读 +type SysNoticeUserReadReq struct { + g.Meta `path:"/sysNoticeUser/read" method:"post" tags:"系统-用户通知公告表" summary:"已读" x-check-permission:"cpm:system:sysNoticeUser:read,cpc:current:user"` + model.SysNoticeUserReadParam +} + +type SysNoticeUserReadRes struct{} diff --git a/server/api/system/v1/tenant.go b/server/api/system/v1/tenant.go new file mode 100644 index 0000000..89ccbdf --- /dev/null +++ b/server/api/system/v1/tenant.go @@ -0,0 +1,135 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type SysTenantListReq struct { + g.Meta `path:"/tenant/list" method:"get" tags:"系统-租户管理" summary:"租户列表" x-check-permission:"cpm:system:tenant:list"` + request.PageInfo + *model.SysTenantListParam +} + +type SysTenantListRes struct { + response.PageResult + Items []*model.SysTenantListModel `json:"items"` +} + +type SysTenantAddReq struct { + g.Meta `path:"/tenant/add" method:"post" tags:"系统-租户管理" summary:"租户添加" x-check-permission:"cpm:system:tenant:add"` + *model.SysTenantAddParam +} + +type SysTenantAddRes struct { + *model.SysTenantAddModel +} + +type SysTenantEditReq struct { + g.Meta `path:"/tenant/edit" method:"post" tags:"系统-租户管理" summary:"租户编辑" x-check-permission:"cpm:system:tenant:edit"` + *model.SysTenantEditParam +} + +type SysTenantEditRes struct { + *model.SysTenantEditModel +} + +type SysTenantDeleteReq struct { + g.Meta `path:"/tenant/delete" method:"post" tags:"系统-租户管理" summary:"租户删除" x-check-permission:"cpm:system:tenant:remove"` + *model.SysTenantDeleteParam +} + +type SysTenantDeleteRes struct { + *model.SysTenantDeleteModel +} + +type SysTenantStatusReq struct { + g.Meta `path:"/tenant/status" method:"post" tags:"系统-租户管理" summary:"租户状态" x-check-permission:"cpm:system:tenant:edit"` + *model.SysTenantStatusParam +} + +type SysTenantStatusRes struct { + *model.SysTenantStatusModel +} + +type SysTenantViewReq struct { + g.Meta `path:"/tenant/view" method:"get" tags:"系统-租户管理" summary:"租户详情" x-check-permission:"cpm:system:tenant:query"` + *model.SysTenantViewParam +} + +type SysTenantViewRes struct { + *model.SysTenantViewModel +} + +type SysTenantSyncMenuReq struct { + g.Meta `path:"/tenant/syncmenu" method:"post" tags:"系统-租户管理" summary:"同步租户菜单" x-check-permission:"cpm:system:tenant:syncmenu"` + *model.SysTenantSyncMenuParam +} + +type SysTenantSyncMenuRes struct { + *model.SysTenantSyncMenuModel +} + +type SysTenantPackageListReq struct { + g.Meta `path:"/tenant/package/list" method:"get" tags:"系统-租户管理" summary:"租户套餐列表" x-check-permission:"cpm:system:tenant:package:list"` + request.PageInfo + model.SysTenantPackageListParam +} + +type SysTenantPackageListRes struct { + response.PageResult + Items []*model.SysTenantPackageListModel `json:"items"` +} + +type SysTenantPackageViewReq struct { + g.Meta `path:"/tenant/package/view" method:"get" tags:"系统-租户管理" summary:"租户套餐详情" x-check-permission:"cpm:system:tenantPackage:query"` + *model.SysTenantPackageViewParam +} + +type SysTenantPackageViewRes struct { + *model.SysTenantPackageViewModel +} + +type SysTenantPackageStatusReq struct { + g.Meta `path:"/tenant/package/status" method:"post" tags:"系统-租户管理" summary:"租户套餐状态" x-check-permission:"cpm:system:tenantPackage:edit"` + *model.SysTenantPackageStatusParam +} + +type SysTenantPackageStatusRes struct { + *model.SysTenantPackageStatusModel +} + +type SysTenantPackageAddReq struct { + g.Meta `path:"/tenant/package/add" method:"post" tags:"系统-租户管理" summary:"租户套餐添加" x-check-permission:"cpm:system:tenantPackage:add"` + *model.SysTenantPackageAddParam +} + +type SysTenantPackageAddRes struct { + *model.SysTenantPackageAddModel +} + +type SysTenantPackageEditReq struct { + g.Meta `path:"/tenant/package/edit" method:"post" tags:"系统-租户管理" summary:"租户套餐编辑" x-check-permission:"cpm:system:tenantPackage:edit"` + *model.SysTenantPackageEditParam +} + +type SysTenantPackageEditRes struct { + *model.SysTenantPackageEditModel +} + +type SysTenantPackageDeleteReq struct { + g.Meta `path:"/tenant/package/delete" method:"post" tags:"系统-租户管理" summary:"租户套餐删除" x-check-permission:"cpm:system:tenantPackage:remove"` + *model.SysTenantPackageDeleteParam +} + +type SysTenantPackageDeleteRes struct { + *model.SysTenantPackageDeleteModel +} diff --git a/server/api/system/v1/ttplatformsetting.go b/server/api/system/v1/ttplatformsetting.go new file mode 100644 index 0000000..917ba5d --- /dev/null +++ b/server/api/system/v1/ttplatformsetting.go @@ -0,0 +1,77 @@ +// Package ttplatformsetting +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package v1 //ttplatformsetting + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +// ListReq 查询二级域名站点个性化配置表列表 +type TTplatformSettingListReq struct { + g.Meta `path:"/tTplatformSetting/list" method:"get" tags:"二级表" summary:"表" summary:"获取二级域名站点个性化配置表列表" x-check-permission:"cpm:system:tTplatformSetting:list"` + model.TTplatformSettingListParam +} + +type TTplatformSettingListRes struct { + response.PageResult + Items []*model.TTplatformSettingListModel `json:"items" dc:"数据列表"` +} + +// ExportReq 导出二级域名站点个性化配置表列表 +type TTplatformSettingExportReq struct { + g.Meta `path:"/tTplatformSetting/export" method:"post" tags:"二级表" summary:"导出二级域名站点个性化配置表列表" x-check-permission:"cpm:system:tTplatformSetting:export"` + model.TTplatformSettingListParam +} + +type TTplatformSettingExportRes struct{} + +// ViewReq 获取二级域名站点个性化配置表指定信息 +type TTplatformSettingViewReq struct { + g.Meta `path:"/tTplatformSetting/view" method:"get" tags:"二级表" summary:"获取二级域名站点个性化配置表指定信息" x-check-permission:"cpm:system:tTplatformSetting:view"` + model.TTplatformSettingViewParam +} + +type TTplatformSettingViewRes struct { + *model.TTplatformSettingViewModel +} + +// EditReq 修改/新增二级域名站点个性化配置表 +type TTplatformSettingEditReq struct { + g.Meta `path:"/tTplatformSetting/edit" method:"post" tags:"二级表" summary:"修改/新增二级域名站点个性化配置表" x-check-permission:"cpm:system:tTplatformSetting:edit"` + model.TTplatformSettingEditParam +} + +type TTplatformSettingEditRes struct{} + +// DeleteReq 删除二级域名站点个性化配置表 +type TTplatformSettingDeleteReq struct { + g.Meta `path:"/tTplatformSetting/delete" method:"post" tags:"二级表" summary:"删除二级域名站点个性化配置表" x-check-permission:"cpm:system:tTplatformSetting:delete"` + model.TTplatformSettingDeleteParam +} + +type TTplatformSettingDeleteRes struct{} + +// MaxSortReq 获取二级域名站点个性化配置表最大排序 +type TTplatformSettingMaxSortReq struct { + g.Meta `path:"/tTplatformSetting/maxSort" method:"get" tags:"二级域名站点个性化配置表" summary:"获取二级域名站点个性化配置表最大排序" x-check-permission:"cpm:system:tTplatformSetting:maxSort"` + model.TTplatformSettingMaxSortParam +} + +type TTplatformSettingMaxSortRes struct { + *model.TTplatformSettingMaxSortModel +} + +// StatusReq 更新二级域名站点个性化配置表状态 +type TTplatformSettingStatusReq struct { + g.Meta `path:"/tTplatformSetting/status" method:"post" tags:"二级域名站点个性化配置表" summary:"更新二级域名站点个性化配置表状态" x-check-permission:"cpm:system:tTplatformSetting:status"` + model.TTplatformSettingStatusParam +} + +type TTplatformSettingStatusRes struct{} diff --git a/server/api/system/v1/user.go b/server/api/system/v1/user.go new file mode 100644 index 0000000..25a1f97 --- /dev/null +++ b/server/api/system/v1/user.go @@ -0,0 +1,202 @@ +// Package v1 +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + + "github.com/gogf/gf/v2/frame/g" +) + +type UserInfo struct { + Id int64 `json:"id" dc:"用户ID"` + Username string `json:"userName" dc:"用户名"` + Nickname string `json:"realName" dc:"昵称"` + Avatar string `json:"avatar" dc:"头像"` + Email string `json:"email" dc:"邮箱"` + HomePath string `json:"homePath" dc:"首页路径"` + // Phonenumber 当前用户手机号,为空时前端提示绑定手机号。 + Phonenumber string `json:"phonenumber" dc:"手机号"` + // IsInitPassword 当前密码是否未由用户本人设置(初始或管理员临时密码),为 true 时前端引导首次登录修改密码。 + IsInitPassword bool `json:"isInitPassword" dc:"密码是否未由用户本人设置"` +} + +type UserInfoReq struct { + g.Meta `path:"/user/info" method:"get" tags:"系统-用户管理" summary:"获取当前用户信息" x-check-permission:"cpc:current:user"` +} + +type UserInfoRes struct { + UserInfo +} + +type UserListReq struct { + g.Meta `path:"/user/list" method:"get" tags:"系统-用户管理" summary:"获取用户列表" x-check-permission:"cpm:system:user:list"` + request.PageInfo + model.UserListParam +} + +type UserListRes struct { + response.PageResult + Data []*model.SysUserListModel `json:"items" dc:"用户列表"` +} + +type AddUserReq struct { + g.Meta `path:"/user/add" method:"post" tags:"系统-用户管理" summary:"新增用户" x-check-permission:"cpm:system:user:add"` + model.SysUserAddModel +} + +type AddUserRes struct { + Data *model.SysUserViewModel `json:"data" dc:"用户信息"` +} + +type UserProfileReq struct { + g.Meta `path:"/user/profile" method:"get" tags:"系统-用户管理" summary:"获取当前用户信息" x-check-permission:"cpc:current:user"` +} + +type UserProfileRes struct { + User *model.UserProfileModel `json:"user" dc:"用户信息"` +} + +type UpdateCurrentUserReq struct { + g.Meta `path:"/user/profile/update" method:"post" tags:"系统-用户管理" summary:"更新当前用户信息" x-check-permission:"cpc:current:user"` + model.UpdateCurrentUserModel +} + +type UpdateCurrentUserRes struct { + UserInfo +} + +type UpdateCurrentUserPasswordReq struct { + g.Meta `path:"/user/profile/password" method:"post" tags:"系统-用户管理" summary:"更新当前用户密码" x-check-permission:"cpc:current:user"` + model.UpdateCurrentUserPasswordModel +} + +type UpdateCurrentUserPasswordRes struct { +} + +type SendCurrentUserEmailCodeReq struct { + g.Meta `path:"/user/profile/email/code" method:"post" tags:"系统-用户管理" summary:"发送修改邮箱验证码" x-check-permission:"cpc:current:user"` + model.SendCurrentUserEmailCodeModel +} + +type SendCurrentUserEmailCodeRes struct{} + +type UpdateCurrentUserEmailReq struct { + g.Meta `path:"/user/profile/email" method:"post" tags:"系统-用户管理" summary:"修改当前用户邮箱" x-check-permission:"cpc:current:user"` + model.UpdateCurrentUserEmailModel +} + +type UpdateCurrentUserEmailRes struct{} + +type SendCurrentUserPhoneCodeReq struct { + g.Meta `path:"/user/profile/phone/code" method:"post" tags:"系统-用户管理" summary:"发送修改电话验证码" x-check-permission:"cpc:current:user"` + model.SendCurrentUserPhoneCodeModel +} + +type SendCurrentUserPhoneCodeRes struct{} + +type UpdateCurrentUserPhoneReq struct { + g.Meta `path:"/user/profile/phone" method:"post" tags:"系统-用户管理" summary:"修改当前用户电话" x-check-permission:"cpc:current:user"` + model.UpdateCurrentUserPhoneModel +} + +type UpdateCurrentUserPhoneRes struct{} + +type UpdateUserReq struct { + g.Meta `path:"/user/update" method:"post" tags:"系统-用户管理" summary:"更新用户信息" x-check-permission:"cpm:system:user:edit"` + model.SysUserUpdateModel +} + +type UpdateUserRes struct { + model.SysUserViewModel +} + +type DeleteUserReq struct { + g.Meta `path:"/user/delete" method:"post" tags:"系统-用户管理" summary:"删除用户" x-check-permission:"cpm:system:user:remove"` + UserId int64 `json:"userId" dc:"用户ID"` + UserIds []int64 `json:"userIds" dc:"用户ID列表"` +} + +type DeleteUserRes struct { +} + +type GetUserReq struct { + g.Meta `path:"/user/view" method:"get" tags:"系统-用户管理" summary:"获取用户信息" x-check-permission:"cpm:system:user:query"` + UserId int64 `json:"userId" dc:"用户ID"` +} + +type GetUserRes struct { + model.SysUserViewModel +} + +type ResetPasswordReq struct { + g.Meta `path:"/user/resetPassword" method:"post" tags:"系统-用户管理" summary:"重置用户密码" x-check-permission:"cpm:system:user:resetPwd"` + UserId int64 `json:"userId" dc:"用户ID"` + Password string `json:"password" dc:"新密码"` +} + +type ResetPasswordRes struct { +} + +type GetUserListByDeptIdReq struct { + g.Meta `path:"/user/listByDeptId" method:"get" tags:"系统-用户管理" summary:"获取部门用户列表" x-check-permission:"cpm:system:user:list"` + DeptId int64 `json:"deptId" dc:"部门ID"` + request.PageInfo +} + +type GetUserListByDeptIdRes struct { + response.PageResult + Items []*model.SysUserMiniModel `json:"items" dc:"用户列表"` +} + +// 用户注册 +type UserRegisterReq struct { + g.Meta `path:"/user/register" method:"post" tags:"系统-用户管理" summary:"用户注册" x-check-permission:"cpm:system:user:register"` + model.SysUserRegisterModel +} + +type UserRegisterRes struct { +} + +// StatusReq 更新用户状态 +type UserStatusReq struct { + g.Meta `path:"/user/status" method:"post" tags:"系统-用户管理" summary:"更新用户状态" x-check-permission:"cpm:system:user:edit"` + model.SysUserStatusParam +} + +type UserStatusRes struct { +} + +// IsMfaEnabledReq 登录时查看是否开启mfa验证 +type IsMfaEnabledReq struct { + g.Meta `path:"/user/isMfaEnabled" method:"get" tags:"系统-用户管理" summary:"登录时查看是否开启mfa验证"` + UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"` +} + +type IsMfaEnabledRes struct { + model.SysUserMfaEnabledModel +} + +// SetMfaEnabledReq 是否开启mfa验证 +type SetMfaEnabledReq struct { + g.Meta `path:"/user/setMfaEnabled" method:"post" tags:"系统-用户管理" summary:"是否开启mfa验证"` + model.SysUserIsMfaEnabledModel +} + +type SetMfaEnabledRes struct { + Uuid string `json:"uuid" dc:"mfa验证码uuid"` +} + +// MfaVerifyReq mfa验证 +type MfaVerifyReq struct { + g.Meta `path:"/user/mfaVerify" method:"post" tags:"系统-用户管理" summary:"mfa验证" ` + model.SysUserIsMfaEnabledModel +} + +type MfaVerifyRes struct { +} diff --git a/server/api/trade/trade.go b/server/api/trade/trade.go new file mode 100644 index 0000000..e68d921 --- /dev/null +++ b/server/api/trade/trade.go @@ -0,0 +1,15 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package trade + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/trade/v1" +) + +type ITradeV1 interface { + Recharge(ctx context.Context, req *v1.RechargeReq) (res *v1.RechargeRes, err error) +} diff --git a/server/api/trade/v1/recharge.go b/server/api/trade/v1/recharge.go new file mode 100644 index 0000000..88ac2ec --- /dev/null +++ b/server/api/trade/v1/recharge.go @@ -0,0 +1,15 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +// RechargeReq 余额充值 +type RechargeReq struct { + g.Meta `path:"/trade/recharge" method:"post" tags:"交易" summary:"余额充值(支付宝回调)"` + model.TBalanceDetailRechargeModel +} + +type RechargeRes struct{} diff --git a/server/api/workerdiagnostic/v1/diagnostic.go b/server/api/workerdiagnostic/v1/diagnostic.go new file mode 100644 index 0000000..df94b2b --- /dev/null +++ b/server/api/workerdiagnostic/v1/diagnostic.go @@ -0,0 +1,14 @@ +package v1 + +import "github.com/gogf/gf/v2/frame/g" + +type DiagnosticReq struct { + g.Meta `path:"/worker/diagnostic" method:"post" tags:"Monitor" summary:"Publish Worker diagnostic message"` + Message string `json:"message" v:"required|length:1,200#message is required|message length must be between 1 and 200 characters" dc:"Diagnostic message"` +} + +type DiagnosticRes struct { + TraceID string `json:"traceId"` + Queue string `json:"queue"` + SentAt int64 `json:"sentAt"` +} diff --git a/server/api/workerdiagnostic/workerdiagnostic.go b/server/api/workerdiagnostic/workerdiagnostic.go new file mode 100644 index 0000000..ffdfcbb --- /dev/null +++ b/server/api/workerdiagnostic/workerdiagnostic.go @@ -0,0 +1,15 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package workerdiagnostic + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/workerdiagnostic/v1" +) + +type IWorkerdiagnosticV1 interface { + Diagnostic(ctx context.Context, req *v1.DiagnosticReq) (res *v1.DiagnosticRes, err error) +} diff --git a/server/build/Dockerfile b/server/build/Dockerfile new file mode 100644 index 0000000..f1ec372 --- /dev/null +++ b/server/build/Dockerfile @@ -0,0 +1,45 @@ +FROM golang:1.25-alpine AS builder + +LABEL stage=gobuilder + +ENV GOPROXY=https://goproxy.cn,direct +ENV TZ=Asia/Shanghai +ENV CGO_ENABLED=1 +ENV GOOS=linux +ENV GOARCH=amd64 + +RUN apk add --no-cache gcc musl-dev git tzdata + +WORKDIR /build + +COPY go.mod go.sum ./ + +RUN go mod download + +COPY . . + +ARG BuildVersion=unknown +ARG CommitID=unknown +ARG BuildTime=unknown + +RUN set -euxo pipefail && \ + pwd && ls -la && \ + go build -v \ + -o /build/iotlcmadmin_svc \ + -ldflags "-X main.BuildVersion=${BuildVersion} -X main.CommitID=${CommitID} -X main.BuildTime=${BuildTime}" \ + . + +FROM alpine:3.23 + +RUN apk add --no-cache ca-certificates tzdata + +COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai +ENV TZ=Asia/Shanghai + +EXPOSE 13100 + +WORKDIR /app +COPY --from=builder /build/iotlcmadmin_svc /app/iotlcmadmin_svc +COPY --from=builder /build/build/build_config.yaml /app/config/config.yaml + +CMD ["./iotlcmadmin_svc"] diff --git a/server/build/build_config.yaml b/server/build/build_config.yaml new file mode 100644 index 0000000..c7b73ca --- /dev/null +++ b/server/build/build_config.yaml @@ -0,0 +1,127 @@ +# config.yaml 配置文件 +# @Link https://github.com/xiujiecn/xiu-admin +# @Copyright Copyright (c) 2025 LiXiujie +# @Author Lxj +# @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +# 系统配置 +system: + name: "IotLCM" + version: "1.0" + description: "IotLCM Server" + gfmode: "dev" + upload: + local: + path: "/app/upload" + +workerDiagnostic: + enabled: true + +batch: + allocate: + chunkSize: 5000 + maxFileSize: 52428800 +# 服务配置 +server: + # 基本配置 + address: ":8008" + # 接口文档 + openapiPath: "/api.json" # OpenAPI接口文档地址 + swaggerPath: "/swagger" # 内置SwaggerUI展示地址 + # 静态服务配置 + indexFiles: ["index.html","index.htm"] # 自动首页静态文件检索。默认为["index.html", "index.htm"] + indexFolder: false # 当访问静态文件目录时,是否展示目录下的文件列表。默认关闭,那么请求将返回403 + # serverRoot: "/app/public" # 静态文件服务的目录根路径,配置时自动开启静态文件服务。默认关闭 + # searchPaths: ["/resource/public"] # 提供静态文件服务时额外的文件搜索路径,当根路径找不到时则按照顺序在搜索目录查找。默认关闭 + fileServerEnabled: true + initLoadMemoryDB: false # 是否初始化内存数据库,默认关闭 + + # 文件上传配置 + maxHeaderBytes: "20KB" + clientMaxBodySize: "200MB" + +# 日志配置 +logger: + path: "/app/logs" # 日志文件路径。默认为空,表示关闭,仅输出到终端 + file: "{Y-m-d-H}.log" # 日志文件格式。默认为"{Y-m-d}.log" + prefix: "" # 日志内容输出前缀。默认为空 + level: "dev" # 日志输出级别 + timeFormat: "2006-01-02T15:04:05" # 自定义日志输出的时间格式,使用Golang标准的时间格式配置 + ctxKeys: [] # 自定义Context上下文变量名称,自动打印Context的变量到日志中。默认为空 + header: true # 是否打印日志的头信息。默认true + stdout: true # 日志是否同时输出到终端。默认true + rotateSize: 0 # 按照日志文件大小对文件进行滚动切分。默认为0,表示关闭滚动切分特性 + rotateExpire: 0 # 按照日志文件时间间隔对文件滚动切分。默认为0,表示关闭滚动切分特性 + rotateBackupLimit: 0 # 按照切分的文件数量清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 + rotateBackupExpire: 0 # 按照切分的文件有效期清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 + rotateBackupCompress: 0 # 滚动切分文件的压缩比(0-9)。默认为0,表示不压缩 + rotateCheckInterval: "1h" # 滚动切分的时间检测间隔,一般不需要设置。默认为1小时 + stdoutColorDisabled: false # 关闭终端的颜色打印。默认开启 + writerColorEnable: false # 日志文件是否带上颜色。默认false,表示不带颜色 + +# JWT配置 +jwt: + signingKey: "${JWT_SIGNING_KEY}" + expiresTime: 7d + bufferTime: 1d + issuer: iotlcm # 发行人 + +# 验证码配置 +captcha: + keyLong: 6 + imgWidth: 240 + imgHeight: 80 + openCaptcha: 0 + openCaptchaTimeout: 3600 + +database: + logger: + path: "/app/logs" + level: "all" + stdout: true + default: # 分组名称,可自定义,默认为default + link: "mysql:${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)/db_iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai" + debug: true #开启调试模式 + charset: "utf8mb4" # (可选)数据库编码(如: utf8mb4/utf8/gbk/gb2312),一般设置为utf8mb4。默认为utf8。 + dryRun: false #ORM空跑(只读不写) + maxIdle: 30 #连接池最大闲置的连接数 + maxOpen: 100 #连接池最大打开的连接数 + maxLifetime: 120 #(单位秒)连接对象可重复使用的时间长度 + memorydb: + # link: "sqlite::@file(jieiotmem.db)?journal_mode=WAL" + link: "sqlite::@file(:memory:)" + # link: "" + debug: true + maxIdle: 1 + maxOpen: 1 + maxLifetime: 30 + +# 缓存配置 +cache: + adapter: "redis" # 缓存适配器,支持:file|redis + fileDir: "/app/cache" # 缓存文件目录 + +# Redis 配置示例 +redis: + # 单实例配置 + default: + mode: "single" #redis模式,支持:single|cluster|sentinel + sentinelMasterName: "iotlcm-master" #哨兵模式主节点名称 + address: 172.17.0.1:6379 + db: 0 + pass: "${REDIS_PASSWORD}" + minIdle: 5 #最小空闲连接数 + maxIdle: 30 #允许闲置的最大连接数 + maxActive: 5000 #最大活跃连接数 + idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/2m/2d + ClientName: "SystemCache" + + +# 路由配置 +router: + # 不需要验证登录的路由地址 + exceptLogin: + - /api/v1/system/auth/login + - /api/v1/system/auth/refresh + - /api/v1/system/captcha + - /api/v1/system/auth/getTenantList + diff --git a/server/config/config.yaml b/server/config/config.yaml new file mode 100644 index 0000000..93c7a17 --- /dev/null +++ b/server/config/config.yaml @@ -0,0 +1,272 @@ +# config.yaml 配置文件 +# @Link https://github.com/xiujiecn/xiu-admin +# @Copyright Copyright (c) 2025 LiXiujie +# @Author Lxj +# @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +# 系统配置 +system: + name: "IotLCM" + version: "1.0" + description: "IotLCM Server" + gfmode: "dev" + upload: + local: + path: "resource/upload" + +workerDiagnostic: + enabled: true + +batch: + allocate: + chunkSize: 5000 + maxFileSize: 52428800 +# 服务配置 +server: + # 基本配置 + address: ":8008" + # 接口文档 + openapiPath: "/api.json" # OpenAPI接口文档地址 + swaggerPath: "/swagger" # 内置SwaggerUI展示地址 + # 静态服务配置 + indexFiles: ["index.html","index.htm"] # 自动首页静态文件检索。默认为["index.html", "index.htm"] + indexFolder: false # 当访问静态文件目录时,是否展示目录下的文件列表。默认关闭,那么请求将返回403 + serverRoot: "resource/public" # 静态文件服务的目录根路径,配置时自动开启静态文件服务。默认关闭 + searchPaths: ["/resource/public"] # 提供静态文件服务时额外的文件搜索路径,当根路径找不到时则按照顺序在搜索目录查找。默认关闭 + fileServerEnabled: true + initLoadMemoryDB: false # 是否初始化内存数据库,默认关闭 + + # 文件上传配置 + maxHeaderBytes: "20KB" + clientMaxBodySize: "200MB" + readTimeout: "20m" + writeTimeout: "20m" + +# 日志配置 +logger: + path: "/app/logs" # 日志文件路径。默认为空,表示关闭,仅输出到终端 + file: "{Y-m-d-H}.log" # 日志文件格式。默认为"{Y-m-d}.log" + prefix: "" # 日志内容输出前缀。默认为空 + level: "dev" # 日志输出级别 + timeFormat: "2006-01-02T15:04:05" # 自定义日志输出的时间格式,使用Golang标准的时间格式配置 + ctxKeys: [] # 自定义Context上下文变量名称,自动打印Context的变量到日志中。默认为空 + header: true # 是否打印日志的头信息。默认true + stdout: true # 日志是否同时输出到终端。默认true + rotateSize: 0 # 按照日志文件大小对文件进行滚动切分。默认为0,表示关闭滚动切分特性 + rotateExpire: 0 # 按照日志文件时间间隔对文件滚动切分。默认为0,表示关闭滚动切分特性 + rotateBackupLimit: 0 # 按照切分的文件数量清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 + rotateBackupExpire: 0 # 按照切分的文件有效期清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 + rotateBackupCompress: 0 # 滚动切分文件的压缩比(0-9)。默认为0,表示不压缩 + rotateCheckInterval: "1h" # 滚动切分的时间检测间隔,一般不需要设置。默认为1小时 + stdoutColorDisabled: false # 关闭终端的颜色打印。默认开启 + writerColorEnable: false # 日志文件是否带上颜色。默认false,表示不带颜色 + +# JWT配置 +jwt: + signingKey: "${JWT_SIGNING_KEY}" + expiresTime: 7d + bufferTime: 1d + issuer: iotlcm # 发行人 + +# 验证码配置 +captcha: + keyLong: 6 + imgWidth: 240 + imgHeight: 80 + openCaptcha: 0 + openCaptchaTimeout: 3600 + +# 注册验证码配置。短信 bodyTemplate、邮件 bodyTemplate 支持 {contact}/{code} 或 ${contact}/${code} +register: + sms: + url: "" + method: "POST" + headers: {} + bodyTemplate: '{"phone":"{contact}","code":"{code}"}' + successStatus: 200 + email: + host: "smtp.exmail.qq.com" + port: 465 + username: "iotlcm@example.com" + password: "JH8DaDFxJuzFRLyB" + from: "iotlcm@example.com" + fromName: "物联卡管理平台" + subject: "注册验证码" + bodyTemplate: "您的注册验证码是:{code},6小时内有效。" + ssl: true + +# 预警通知配置。短信服务使用 iotlcm-sms,配置完整并 enabled=true 后才会真实发送。 +warning: + expire: + # 系统默认套餐到期预警天数;必须满足 firstWarnDays > secondWarnDays > thirdWarnDays。 + firstWarnDays: 30 + secondWarnDays: 15 + thirdWarnDays: 7 + sms: + enabled: true + # HTTP 接口地址;如果配置 grpcAddr,则优先走 gRPC。 + url: "http://127.0.0.1:11190/api/v1/sms/send" + grpcAddr: "127.0.0.1:11200" + timeout: "5s" + routerId: 0 + # 兼容当前 iotlcm-sms 协议:如果短信微服务没有内置供应商配置,可在这里透传。 + # 阿里云 serviceType=1,腾讯云 serviceType=2。 + serviceType: "" + regionId: "" + accessKeyId: "" + accessKeySecret: "" + sdkAppId: "" + signName: "" + templateId: "" + # 阿里云模板参数通常需要 JSON;如果预警模板变量名是 content,可配置为 '{"content":{contentJson}}'。 + # 腾讯云多参数模板可按实际顺序配置,例如 '{firstItem}|{count}'。 + msgContentTemplate: "" + # 长期建议:短信平台签名、模板和密钥由短信微服务自行处理,lcm 只传手机号和聚合内容。 + wechat: + enabled: false + appId: "wx9e26905702c1a372" + appSecret: "" + templateId: "DMDP2PKktdtG1ES_3Ic1JcR0LGELQmWE6LunYyerHCY" + page: "pages/message/index" + timeout: "5s" + + +database: + logger: + path: "/app/logs/sql" + level: "all" + stdout: true + default: # 分组名称,可自定义,默认为default + link: "mysql:${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)/db_iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai" + debug: true #开启调试模式 + charset: "utf8mb4" # (可选)数据库编码(如: utf8mb4/utf8/gbk/gb2312),一般设置为utf8mb4。默认为utf8。 + dryRun: false #ORM空跑(只读不写) + maxIdle: 30 #连接池最大闲置的连接数 + maxOpen: 100 #连接池最大打开的连接数 + maxLifetime: 120 #(单位秒)连接对象可重复使用的时间长度 + memorydb: + # link: "sqlite::@file(jieiotmem.db)?journal_mode=WAL" + link: "sqlite::@file(:memory:)" + # link: "" + debug: true + maxIdle: 1 + maxOpen: 1 + maxLifetime: 30 + +# 缓存配置 +cache: + adapter: "redis" # 缓存适配器,支持:file|redis + fileDir: "resource/cache" # 缓存文件目录 + +# Redis 配置示例 +redis: + # 单实例配置 + default: + mode: "single" #redis模式,支持:single|cluster|sentinel + sentinelMasterName: "iotlcm-master" #哨兵模式主节点名称 + address: 192.0.2.29:6379 + db: 0 + pass: "${REDIS_PASSWORD}" + minIdle: 5 #最小空闲连接数 + maxIdle: 30 #允许闲置的最大连接数 + maxActive: 5000 #最大活跃连接数 + idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/2m/2d + ClientName: "SystemCache" + +rabbitmq: + enabled: true + # 示例:amqp://${MQ_USER}:${MQ_PASSWORD}@${MQ_HOST}/ + # dsn: "amqp://${MQ_USER}:${MQ_PASSWORD}@${MQ_HOST}/" + dsn: "amqp://${MQ_USER}:${MQ_PASSWORD}@${MQ_HOST}/" + +tsdb: + database: "TdEngine" #可选择 TdEngine、Influxdb + tdengine: + # type: "taosRestful" #http连接方式,端口是6041 + # dsn: "root:taosdata@http(127.0.0.1:6041)/" + type: "taosWS" #websocket连接方式,端口是6041 + # dsn: "root:taosdata@ws(127.0.0.1:6041)/" + dsn: "root:sdyz2026__@ws(192.0.2.29:6041)/" + dbName: "iotlcm" + maxOpenConns: 100 + maxIdleConns: 10 + batchSize: 200 + + +# 路由配置 +router: + # 不需要验证登录的路由地址 + exceptLogin: + - /api/v1/system/auth/login + - /api/v1/system/auth/refresh + - /api/v1/system/captcha + - /api/v1/system/auth/getTenantList + - /api/v1/pay/alipay/notify + - /api/v1/pay/alipay/return + +# 生成代码 +alipay: + appId: "9021000165668942" + privateKey: "MIIEowIBAAKCAQEAg+4BpLO2Fw5GMbrihnugyQqiLBp2RhSbSsvjNyzaG10u900N1DcVlh8HNdcus5AGjfbiUwMQwv7Os+NnFrEZA3CtWLXH+uczHIpcMqJJhoVgA//4gf2TX9K4OSQ1pgJeAhTS9WWMEB7DQLb7A6xGjvBdGNbPAzucGhUmtG1tgZSVOcpWqN2h4dQxkZhfR+6m3AqWAPahpQXsNINHewetQ4mIG+b3+z/OknEll0RDRmw7OihOJ24B51Phy7lewl160LgLpLffyaQUUXcFdcNo+HvWqtIT0mH8WWHAgqfN/WVkMz/WVjE0rzbIVgmpQc7+hMbrcafTmeq0wdnVXrKS6QIDAQABAoIBAEagy1ZuMyRiqueCojTWyHv4altsCzd3Xq+LOWfXZihSGYuhP68FklPc5pJHUaQljazAp+dC891AZk5dhlnak4aI8vRT1OyYi39S/wrIYM5YZs+dYF/O7e/VsnQ800+9YrCAj3N6WqJiparmirkrqFZrjZt3nDmh1u8Ltb3P+1jr90MBEdS+BXaEQP/KGxFiKZyoWFn9B4l0aPFkPExF+hgtRpP3gxFcyljQKGVmSUIkT6V08F1oRm72NQOhcizCh9lX+5HYLTkUVQVg6FHwdZs/KeJcZu6Y829pNSNeJmPbR3VPUpTbvwb0qeEoc42T3H/C0xXUeTYizUpHmhJJqnUCgYEA3Y7Xz+MUk98zRJnlr2BDUc+Qnhv3wmSA5LCcRbxTNNBp4TXjnZknY6Ms9D+nJupL4nw6QSYkO6O+tAEmU6gaSDEHKI1uKqU0zOdbGIHNkMqka3rinQcMJNNRZ8T1FLCPFna7S1FNlxulZgWxjqxP/KvWOEpCWLCLzwZNk8fEd+MCgYEAmHBNbaMmT4WvLevY/OMv/5e5csnDFIcsNJKvFLZZMBLuKT/26YN2ryVUivY+TTyHL5zk4VybeauTdQHIvX6sNJoh2Ii6vthKfSufL4rkMob8PHiG33iHBx3VxAwiVXfu3JHVnbCPcXTOzsdRzT17X3rODK9t8319qfVjd0Gxi8MCgYEAqgNc0+ea+MXD35aAzA0AW5z9inZHruHUjqh/onubFeH//ZOOsHa/5RNoAZ1+tLwBszBEu417LFDAm/xt3rAWSuNkbNfqe8r+M2YtXybsCXmWpetMTdcEmJWX2BspPdEmW8SMgIVJFvVd/GXOFH9hebCa1+MT+l6vShO6H/ahaqUCgYAzon6nr4bPkvHWtTfH2VCt2//mIO+iaXMQz8rcUjP9s7vWXyNMz8oI47UyaNyLnwAPoa5po8vKN9L35EXR4jGEk9z5Er9m267HnVoLaZmIf+66sPzGf3YFdBavlIiguMJBFmjsRB0iijVvF1bfFX9PxTI8W8P7oTtKsaMihy8TrwKBgCgjA8DL8HJbRwZ+V/KWOh8rzO5cBUUH3ThIj6u7Wn4tMlscfi+KFKTXghjSORfIVx8v9v2aNZKwGZ547AOPRXhDF09cLAcCfl7uOrwsftziIeBQnrqtpIqcVTgRwGMIMBJEtQEks5N/E/d+dSL1YQKC76mVC8/RMf52WYKH1QCa" + alipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8Df1EPFkA2xy8NgF0UdRYxsshslUi2XSGTG01oQKsrYNB+rhAw9MJdMlunVQxSrBZsw5N7htXGdiTceaLo/n8Wuibp0cRHdErJSp9GhP4pW2IR3FoCCPYlJlyiCUR/NInI3XMai0UdjgiPX03bvYLRAKE8lLiOSgxNagQmOFLmQYRYfFhGbxDe98XMg83YdSWvZKrlM+vzgk8/aPgq7BFLpbRKqLvd8OXXBHDCaWMSSGwCN0whhdEiwbIhSVgwTgkhWXUuNDmT741/+7D46djp8wX/84SDts0fWb63/in9ATTGtNivJX7HPDyqrmcN2iUi5xFHS9XwYBdT4yu/xFQwIDAQAB" + notifyUrl: "https://evolution-starless-municipal.ngrok-free.dev/api/v1/pay/alipay/notify" + returnUrl: "http://localhost:5666/enterpriseManagement/tBalanceDetail/tAgentBalance" + isProduction: false + +pay: + expireTime: 3 # 支付过期时间,方便测试先改为3分钟 + balanceRecharge: + timeoutDelay: "3m" # 余额充值支付宝支付与 RabbitMQ 延时检查时间,方便测试先改为3分钟,后续改为真正时间 + +xgen: + allowedIPs: [ "127.0.0.1", "*" ] # 白名单,*代表所有,只有允许的IP后台才能使用生成代码功能 + selectDbs: [ "default" ] # 可选生成表的数据库配置名称,支持多库 + disableTables: [ ] # 禁用的表,禁用以后将不会在选择表中看到 + delimiters: [ "@{", "}" ] # 模板引擎变量分隔符号 + # 生成应用模型,所有生成模板允许自定义,可以参考default模板进行改造 + application: + # CRUD和关系树列表模板 + crud: + templates: + # 默认的主包模板 + - group: "default" # 分组名称 + isAddon: false # 是否为插件模板 false|true + masterPackage: "gen" # 主包名称,需和controllerPath、logicPath、inputPath保持关联 + templatePath: "./resource/generate/default/curd" # 模板路径 + apiPath: "./api/gen" # goApi生成路径 + controllerPath: "./internal/controller/gen" # 控制器生成路径 + logicPath: "./internal/logic/gen" # 主要业务生成路径 + inputPath: "./internal/model/genin" # 表单过滤器生成路径 + routerPath: "./internal/router/genrouter" # 生成路由表路径 + sqlPath: "./manifest/generate" # 生成sql语句路径 + webApiPath: "../vue/apps/web-antd/src/api/gen" # webApi生成路径 + webViewsPath: "../vue/apps/web-antd/src/views/gen" # web页面生成路径 + + # 默认的插件包模板,{$name}会自动替换成实际的插件名称 + - group: "addon" # 分组名称 + isAddon: true # 是否为插件模板 false|true + masterPackage: "sys" # 主包名称,需和controllerPath、logicPath、inputPath保持关联 + templatePath: "./resource/generate/default/curd" # 模板路径 + apiPath: "./addons/{$name}/api/admin" # goApi生成路径 + controllerPath: "./addons/{$name}/controller/admin/sys" # 控制器生成路径 + logicPath: "./addons/{$name}/logic/sys" # 主要业务生成路径 + inputPath: "./addons/{$name}/model/input/sysin" # 表单过滤器生成路径 + routerPath: "./addons/{$name}/router/genrouter" # 生成路由表路径 + sqlPath: "./storage/data/generate/addons" # 生成sql语句路径 + webApiPath: "../web/src/api/addons/{$name}" # webApi生成路径 + webViewsPath: "../web/src/views/addons/{$name}" # web页面生成路径 + +upstream: + proxy: + # address: "yzupstreamproxy-http-svc" + address: "localhost:8510" + timeout: 10s + gateway: + # address: "iotlcmupstreamchan-http-svc" + address: "localhost:8110" + timeout: 10s + diagnose: + clientName: "iotlcm.example.com:8110" + timeout: 10s + inboundBasicInfo: + clientName: "iotlcm.example.com:8110" + timeout: 10s diff --git a/server/config/config_default.yaml b/server/config/config_default.yaml new file mode 100644 index 0000000..f010756 --- /dev/null +++ b/server/config/config_default.yaml @@ -0,0 +1,218 @@ +# config_default.yaml 配置文件 +# @Link https://github.com/xiujiecn/xiu-admin +# @Copyright Copyright (c) 2025 LiXiujie +# @Author Lxj +# @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +# 系统配置 +system: + name: "IotLCM" + version: "1.0" + description: "IotLCM Server" + gfmode: "dev" + upload: + local: + path: "resource/upload" + +workerDiagnostic: + enabled: false + +batch: + allocate: + chunkSize: 5000 + maxFileSize: 52428800 +# 服务配置 +server: + # 基本配置 + address: ":8199" + # 接口文档 + openapiPath: "/api.json" # OpenAPI接口文档地址 + swaggerPath: "/swagger" # 内置SwaggerUI展示地址 + # 静态服务配置 + indexFiles: ["index.html","index.htm"] # 自动首页静态文件检索。默认为["index.html", "index.htm"] + indexFolder: false # 当访问静态文件目录时,是否展示目录下的文件列表。默认关闭,那么请求将返回403 + serverRoot: "resource/public" # 静态文件服务的目录根路径,配置时自动开启静态文件服务。默认关闭 + searchPaths: ["/resource/public"] # 提供静态文件服务时额外的文件搜索路径,当根路径找不到时则按照顺序在搜索目录查找。默认关闭 + fileServerEnabled: true + # 文件上传配置 + maxHeaderBytes: "20KB" + clientMaxBodySize: "200MB" + +# 日志配置 +logger: + path: "/app/logs" # 日志文件路径。默认为空,表示关闭,仅输出到终端 + file: "{Y-m-d-H}.log" # 日志文件格式。默认为"{Y-m-d}.log" + prefix: "" # 日志内容输出前缀。默认为空 + level: "dev" # 日志输出级别 + timeFormat: "2006-01-02T15:04:05" # 自定义日志输出的时间格式,使用Golang标准的时间格式配置 + ctxKeys: [] # 自定义Context上下文变量名称,自动打印Context的变量到日志中。默认为空 + header: true # 是否打印日志的头信息。默认true + stdout: true # 日志是否同时输出到终端。默认true + rotateSize: 0 # 按照日志文件大小对文件进行滚动切分。默认为0,表示关闭滚动切分特性 + rotateExpire: 0 # 按照日志文件时间间隔对文件滚动切分。默认为0,表示关闭滚动切分特性 + rotateBackupLimit: 0 # 按照切分的文件数量清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 + rotateBackupExpire: 0 # 按照切分的文件有效期清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 + rotateBackupCompress: 0 # 滚动切分文件的压缩比(0-9)。默认为0,表示不压缩 + rotateCheckInterval: "1h" # 滚动切分的时间检测间隔,一般不需要设置。默认为1小时 + stdoutColorDisabled: false # 关闭终端的颜色打印。默认开启 + writerColorEnable: false # 日志文件是否带上颜色。默认false,表示不带颜色 + +# JWT配置 +jwt: + signingKey: "${JWT_SIGNING_KEY}" + expiresTime: 7d + bufferTime: 1d + issuer: xiujie # 发行人 + +# 验证码配置 +captcha: + keyLong: 6 + imgWidth: 240 + imgHeight: 80 + openCaptcha: 0 + openCaptchaTimeout: 3600 + +# 预警通知配置。短信服务使用 iotlcm-sms,配置完整并 enabled=true 后才会真实发送。 +warning: + expire: + # 系统默认套餐到期预警天数;必须满足 firstWarnDays > secondWarnDays > thirdWarnDays。 + firstWarnDays: 30 + secondWarnDays: 15 + thirdWarnDays: 7 + sms: + enabled: false + # HTTP 接口地址;如果配置 grpcAddr,则优先走 gRPC。 + url: "http://127.0.0.1:11190/api/v1/sms/send" + grpcAddr: "127.0.0.1:11200" + timeout: "5s" + routerId: 0 + # 兼容当前 iotlcm-sms 协议:如果短信微服务没有内置供应商配置,可在这里透传。 + # 阿里云 serviceType=1,腾讯云 serviceType=2。 + serviceType: "" + regionId: "" + accessKeyId: "" + accessKeySecret: "" + sdkAppId: "" + signName: "" + templateId: "" + # 阿里云模板参数通常需要 JSON;如果预警模板变量名是 content,可配置为 '{"content":{contentJson}}'。 + # 腾讯云多参数模板可按实际顺序配置,例如 '{firstItem}|{count}'。 + msgContentTemplate: "" + # 长期建议:短信平台签名、模板和密钥由短信微服务自行处理,lcm 只传手机号和聚合内容。 + + wechat: + enabled: false + appId: "wx9e26905702c1a372" + appSecret: "" + templateId: "DMDP2PKktdtG1ES_3Ic1JcR0LGELQmWE6LunYyerHCY" + page: "pages/message/index" + timeout: "5s" + +database: + legacyCard: + link: "" + debug: false + logger: + path: "/app/logs/sql" + level: "all" + stdout: true + default: # 分组名称,可自定义,默认为default + link: "mysql:${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)/iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai" + debug: true #开启调试模式 + charset: "utf8mb4" # (可选)数据库编码(如: utf8mb4/utf8/gbk/gb2312),一般设置为utf8mb4。默认为utf8。 + dryRun: false #ORM空跑(只读不写) + maxIdle: 30 #连接池最大闲置的连接数 + maxOpen: 100 #连接池最大打开的连接数 + maxLifetime: 120 #(单位秒)连接对象可重复使用的时间长度 + +# 缓存配置 +cache: + adapter: "redis" # 缓存适配器,支持:file|redis + fileDir: "resource/cache" # 缓存文件目录 + +# Redis 配置示例 +redis: + # 单实例配置 + default: + mode: "single" #redis模式,支持:single|cluster|sentinel + sentinelMasterName: "${REDIS_SENTINEL_MASTER}" #哨兵模式主节点名称 + address: 192.0.2.200:6379 + db: 0 + pass: "${REDIS_PASSWORD}" + minIdle: 5 #最小空闲连接数 + maxIdle: 30 #允许闲置的最大连接数 + maxActive: 5000 #最大活跃连接数 + idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/2m/2d + ClientName: "SystemCache" + +# Queue配置 +queue: + type: "asynq" # 队列类型 + asynq: + redis: + address: 192.0.2.200:6379 + db: 0 + pass: "${REDIS_PASSWORD}" + user: + concurrency: 10 # 最大同时执行的任务数量 + logLevel: 4 # 日志级别 DebugLevel 1, InfoLevel 2, WarnLevel 3, ErrorLevel 4, FatalLevel 5 + +# 路由配置 +router: + # 不需要验证登录的路由地址 + exceptLogin: + - /api/v1/system/auth/login + - /api/v1/system/auth/refresh + - /api/v1/system/captcha + - /api/v1/system/auth/getTenantList + - /api/v1/system/auth/sms-code + - /api/v1/system/auth/sms-login + + +# 生成代码 +xgen: + allowedIPs: [ "127.0.0.1", "*" ] # 白名单,*代表所有,只有允许的IP后台才能使用生成代码功能 + selectDbs: [ "default" ] # 可选生成表的数据库配置名称,支持多库 + disableTables: [ ] # 禁用的表,禁用以后将不会在选择表中看到 + delimiters: [ "@{", "}" ] # 模板引擎变量分隔符号 + # 生成应用模型,所有生成模板允许自定义,可以参考default模板进行改造 + application: + # CRUD和关系树列表模板 + crud: + templates: + # 默认的主包模板 + - group: "default" # 分组名称 + isAddon: false # 是否为插件模板 false|true + masterPackage: "gen" # 主包名称,需和controllerPath、logicPath、inputPath保持关联 + templatePath: "./resource/generate/default/curd" # 模板路径 + apiPath: "./api/gen/v1/" # goApi生成路径 + controllerPath: "./internal/controller/gen" # 控制器生成路径 + logicPath: "./internal/logic/gen" # 主要业务生成路径 + inputPath: "./internal/model/genin" # 表单过滤器生成路径 + routerPath: "./internal/router/genrouter" # 生成路由表路径 + sqlPath: "./manifest/generate" # 生成sql语句路径 + webApiPath: "./web/generate/api" # webApi生成路径 + webViewsPath: "./web/generate/views" # web页面生成路径 + + # 默认的插件包模板,{$name}会自动替换成实际的插件名称 + - group: "addon" # 分组名称 + isAddon: true # 是否为插件模板 false|true + masterPackage: "sys" # 主包名称,需和controllerPath、logicPath、inputPath保持关联 + templatePath: "./resource/generate/default/curd" # 模板路径 + apiPath: "./addons/{$name}/api/admin" # goApi生成路径 + controllerPath: "./addons/{$name}/controller/admin/sys" # 控制器生成路径 + logicPath: "./addons/{$name}/logic/sys" # 主要业务生成路径 + inputPath: "./addons/{$name}/model/input/sysin" # 表单过滤器生成路径 + routerPath: "./addons/{$name}/router/genrouter" # 生成路由表路径 + sqlPath: "./storage/data/generate/addons" # 生成sql语句路径 + webApiPath: "../web/src/api/addons/{$name}" # webApi生成路径 + webViewsPath: "../web/src/views/addons/{$name}" # web页面生成路径 + +upstream: + proxy: + # address: "yzupstreamproxy-http-svc" + address: "localhost:8510" + timeout: 10s + gateway: + # address: "iotlcmupstreamchan-http-svc" + address: "localhost:8110" + timeout: 10s diff --git a/server/go.mod b/server/go.mod new file mode 100644 index 0000000..e00ebcf --- /dev/null +++ b/server/go.mod @@ -0,0 +1,99 @@ +module git.5iot.com/iotlcm-public/iotlcm-admin-svr + +go 1.23.0 + +toolchain go1.23.5 + +require ( + github.com/dromara/carbon/v2 v2.6.0 + github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0 + github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.6 + github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0 + github.com/gogf/gf/v2 v2.9.6 + github.com/golang-jwt/jwt/v4 v4.5.2 + github.com/google/uuid v1.6.0 + github.com/gorilla/websocket v1.5.3 + github.com/mileusna/useragent v1.3.5 + github.com/mojocn/base64Captcha v1.3.8 + github.com/olekukonko/tablewriter v1.1.0 + github.com/pkg/errors v0.9.1 + github.com/rabbitmq/amqp091-go v1.10.0 + github.com/redis/go-redis/v9 v9.7.0 + github.com/robfig/cron/v3 v3.0.1 + github.com/shirou/gopsutil/v3 v3.24.5 + github.com/smartwalle/alipay/v3 v3.2.29 + github.com/xiujiecn/asynq v0.25.10 + github.com/xuri/excelize/v2 v2.9.0 + go.opentelemetry.io/otel v1.38.0 + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 + golang.org/x/net v0.40.0 + golang.org/x/tools v0.31.0 + gorm.io/gorm v1.25.12 +) + +require ( + github.com/BurntSushi/toml v1.5.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/clbanning/mxj/v2 v2.7.0 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/emirpasic/gods/v2 v2.0.0-alpha // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/glebarez/go-sqlite v1.21.2 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-sql-driver/mysql v1.7.1 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/grokify/html-strip-tags-go v0.1.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.10 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/olekukonko/errors v1.1.0 // indirect + github.com/olekukonko/ll v0.0.9 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/richardlehane/mscfb v1.0.4 // indirect + github.com/richardlehane/msoleps v1.0.4 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/smartwalle/ncrypto v1.0.4 // indirect + github.com/smartwalle/ngx v1.1.0 // indirect + github.com/smartwalle/nsign v1.0.9 // indirect + github.com/spf13/cast v1.7.0 // indirect + github.com/taosdata/driver-go/v3 v3.8.0 // indirect + github.com/tealeg/xlsx v1.0.5 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect + github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/image v0.23.0 // indirect + golang.org/x/mod v0.24.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.25.0 // indirect + golang.org/x/time v0.8.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/grpc v1.64.1 // indirect + google.golang.org/protobuf v1.36.6 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + modernc.org/libc v1.22.5 // indirect + modernc.org/mathutil v1.5.0 // indirect + modernc.org/memory v1.5.0 // indirect + modernc.org/sqlite v1.23.1 // indirect +) diff --git a/server/go.sum b/server/go.sum new file mode 100644 index 0000000..196dba8 --- /dev/null +++ b/server/go.sum @@ -0,0 +1,297 @@ +github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= +github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/dromara/carbon/v2 v2.6.0 h1:LyRL5QHK6q37wjHjbBkuTGHXbdQKuYy3Isu0RhsxVWo= +github.com/dromara/carbon/v2 v2.6.0/go.mod h1:Baj3A1uBBctJmpZWJd6/+WWnmIuY2pobR6IOpB6xigc= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/emirpasic/gods/v2 v2.0.0-alpha h1:dwFlh8pBg1VMOXWGipNMRt8v96dKAIvBehtCt6OtunU= +github.com/emirpasic/gods/v2 v2.0.0-alpha/go.mod h1:W0y4M2dtBB9U5z3YlghmpuUhiaZT2h6yoeE+C1sCp6A= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo= +github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0 h1:1f7EeD0lfPHoXfaJDSL7cxRcSRelbsAKgF3MGXY+Uyo= +github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0/go.mod h1:tToO1PjGkLIR+9DbJ0wrKicYma0H/EUHXOpwel6Dw+0= +github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.6 h1:3QZvWIlz3dLjNELQU+5ZZZWuzEx9gsRFLU+qIKVUG6M= +github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.6/go.mod h1:7EEAe8UYI5dLeuwCWN3HgC62OhjIYbkynaoavw1U/k4= +github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0 h1:EEZqu1PNRSmm+7Cqm9A/8+ObgfbMzhE1ps9Z3LD7HgM= +github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0/go.mod h1:LHrxY+2IzNTHVTPG/s5yaz1VmXbj+CQ7Hr5SeVkHiTw= +github.com/gogf/gf/v2 v2.9.6 h1:fQ6uPtS1Ra8qY+OuzPPZTlgksJ4eOXmTZ1/a2l3Idog= +github.com/gogf/gf/v2 v2.9.6/go.mod h1:Svl1N+E8G/QshU2DUbh/3J/AJauqCgUnxHurXWR4Qx0= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= +github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= +github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mileusna/useragent v1.3.5 h1:SJM5NzBmh/hO+4LGeATKpaEX9+b4vcGg2qXGLiNGDws= +github.com/mileusna/useragent v1.3.5/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/mojocn/base64Captcha v1.3.8 h1:rrN9BhCwXKS8ht1e21kvR3iTaMgf4qPC9sRoV52bqEg= +github.com/mojocn/base64Captcha v1.3.8/go.mod h1:QFZy927L8HVP3+VV5z2b1EAEiv1KxVJKZbAucVgLUy4= +github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM= +github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= +github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= +github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw= +github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o= +github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= +github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM= +github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= +github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= +github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM/9/g00= +github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= +github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= +github.com/smartwalle/alipay/v3 v3.2.29 h1:roGFqlml8hDa//0TpFmlyxZhndTYs7rbYLu/HlNFNJo= +github.com/smartwalle/alipay/v3 v3.2.29/go.mod h1:XarBLuAkwK3ah7mYjVtghRu+ysxzlex9sRkgqNMzMRU= +github.com/smartwalle/ncrypto v1.0.4 h1:P2rqQxDepJwgeO5ShoC+wGcK2wNJDmcdBOWAksuIgx8= +github.com/smartwalle/ncrypto v1.0.4/go.mod h1:Dwlp6sfeNaPMnOxMNayMTacvC5JGEVln3CVdiVDgbBk= +github.com/smartwalle/ngx v1.1.0 h1:q8nANgWSPRGeI/u+ixBoA4mf68DrUq6vZ+n9L5UKv9I= +github.com/smartwalle/ngx v1.1.0/go.mod h1:mx/nz2Pk5j+RBs7t6u6k22MPiBG/8CtOMpCnALIG8Y0= +github.com/smartwalle/nsign v1.0.9 h1:8poAgG7zBd8HkZy9RQDwasC6XZvJpDGQWSjzL2FZL6E= +github.com/smartwalle/nsign v1.0.9/go.mod h1:eY6I4CJlyNdVMP+t6z1H6Jpd4m5/V+8xi44ufSTxXgc= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/taosdata/driver-go/v3 v3.8.0 h1:qY1xFidspISuuZc0TAbeJWMtAdKJOSYQOXfepkUK6fI= +github.com/taosdata/driver-go/v3 v3.8.0/go.mod h1:S6OGOinfR0xxxaMGsvBi9cLkYxEIW1p6qqr8QJATTlg= +github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE= +github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/xiujiecn/asynq v0.25.10 h1:TWy8i127GOZjXh3yTKGhjNfeThGP5O61RG92haPXX1o= +github.com/xiujiecn/asynq v0.25.10/go.mod h1:Nxtqdx+iW8gKpJHpxyNevTEq1E4eD2gQgcBISajdJQk= +github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY= +github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= +github.com/xuri/excelize/v2 v2.9.0 h1:1tgOaEq92IOEumR1/JfYS/eR0KHOCsRv/rYXXh6YJQE= +github.com/xuri/excelize/v2 v2.9.0/go.mod h1:uqey4QBZ9gdMeWApPLdhm9x+9o2lq4iVmjiLfBS5hdE= +github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 h1:hPVCafDV85blFTabnqKgNhDCkJX25eik94Si9cTER4A= +github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= +golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= +golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= +google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8= +gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= +modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE= +modernc.org/libc v1.22.5/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= +modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= +modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= +modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/sqlite v1.23.1 h1:nrSBg4aRQQwq59JpvGEQ15tNxoO5pX/kUjcRNwSAGQM= +modernc.org/sqlite v1.23.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk= diff --git a/server/hack/config.yaml b/server/hack/config.yaml new file mode 100644 index 0000000..82dec45 --- /dev/null +++ b/server/hack/config.yaml @@ -0,0 +1,19 @@ + +# CLI tool, only in development environment. +# https://goframe.org/docs/cli +gfcli: + gen: + dao: + - link: "mysql:${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)/db_iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai" + tables: "sys_*" + descriptionTag: true # 数据表字段注释 + noModelComment: true + jsonCase: "CamelLower" # 生成json字段时,字段名使用驼峰命名 + gJsonSupport: true + group: "default" # 分组 使用代码生成功能时必须填 + tablesEx: "sys_addons_install" # 指定当前数据库中需要排除代码生成的数据表。 + + docker: + build: "-a amd64 -s linux -p temp -ew" + tagPrefixes: + - my.image.pub/my-app \ No newline at end of file diff --git a/server/hack/hack-cli.mk b/server/hack/hack-cli.mk new file mode 100644 index 0000000..f4e2ad2 --- /dev/null +++ b/server/hack/hack-cli.mk @@ -0,0 +1,20 @@ + +# Install/Update to the latest CLI tool. +.PHONY: cli +cli: + @set -e; \ + wget -O gf \ + https://github.com/gogf/gf/releases/latest/download/gf_$(shell go env GOOS)_$(shell go env GOARCH) && \ + chmod +x gf && \ + ./gf install -y && \ + rm ./gf + + +# Check and install CLI tool. +.PHONY: cli.install +cli.install: + @set -e; \ + gf -v > /dev/null 2>&1 || if [[ "$?" -ne "0" ]]; then \ + echo "GoFame CLI is not installed, start proceeding auto installation..."; \ + make cli; \ + fi; \ No newline at end of file diff --git a/server/hack/hack.mk b/server/hack/hack.mk new file mode 100644 index 0000000..cbdb4cc --- /dev/null +++ b/server/hack/hack.mk @@ -0,0 +1,107 @@ +.DEFAULT_GOAL := build + +# Update GoFrame and its CLI to latest stable version. +.PHONY: up +up: cli.install + @gf up -a + +# Build binary using configuration from hack/config.yaml. +.PHONY: build +build: cli.install + @gf build -ew + +# Parse api and generate controller/sdk. +.PHONY: ctrl +ctrl: cli.install + @gf gen ctrl -m + +# Generate Go files for DAO/DO/Entity. +.PHONY: dao +dao: cli.install + @gf gen dao + +# Parse current project go files and generate enums go file. +.PHONY: enums +enums: cli.install + @gf gen enums + +# Generate Go files for Service. +.PHONY: service +service: cli.install + @gf gen service + + +# Build docker image. +.PHONY: image +image: cli.install + $(eval _TAG = $(shell git rev-parse --short HEAD)) +ifneq (, $(shell git status --porcelain 2>/dev/null)) + $(eval _TAG = $(_TAG).dirty) +endif + $(eval _TAG = $(if ${TAG}, ${TAG}, $(_TAG))) + $(eval _PUSH = $(if ${PUSH}, ${PUSH}, )) + @gf docker ${_PUSH} -tn $(DOCKER_NAME):${_TAG}; + + +# Build docker image and automatically push to docker repo. +.PHONY: image.push +image.push: cli.install + @make image PUSH=-p; + + +# Deploy image and yaml to current kubectl environment. +.PHONY: deploy +deploy: cli.install + $(eval _TAG = $(if ${TAG}, ${TAG}, develop)) + + @set -e; \ + mkdir -p $(ROOT_DIR)/temp/kustomize;\ + cd $(ROOT_DIR)/manifest/deploy/kustomize/overlays/${_ENV};\ + kustomize build > $(ROOT_DIR)/temp/kustomize.yaml;\ + kubectl apply -f $(ROOT_DIR)/temp/kustomize.yaml; \ + if [ $(DEPLOY_NAME) != "" ]; then \ + kubectl patch -n $(NAMESPACE) deployment/$(DEPLOY_NAME) -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"; \ + fi; + + +# Parsing protobuf files and generating go files. +.PHONY: pb +pb: cli.install + @gf gen pb + +# Generate protobuf files for database tables. +.PHONY: pbentity +pbentity: cli.install + @gf gen pbentity + + + + +export AppName=jieiot_linux +export BuildVersion=$(shell git describe --abbrev=0 --tags) +export BuildTime=$(shell date +%FT%T%z) +export CommitID=$(shell git rev-parse HEAD) +.PHONY: linux +linux: + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${AppName} -a -ldflags "-w -s -X main.BuildVersion=${BuildVersion} -X main.CommitID=${CommitID} -X main.BuildTime=${BuildTime}" + +export NOWTIME=$(shell date "+%Y%m%d%H%M%S") +.PHONY: clean_docker_iotlcmadmin create_docker_iotlcmadmin + +clean_docker_iotlcmadmin: + docker tag docker_iotlcmadmin:v0 ${REGISTRY}/docker_iotlcmadmin:v0 + docker rmi docker_iotlcmadmin:v0 + +create_docker_iotlcmadmin: + docker build --rm -f build/Dockerfile --progress=plain --platform linux/amd64 -t docker_iotlcmadmin:v0 --build-arg BuildVersion=${BuildVersion} --build-arg BuildTime=${BuildTime} --build-arg CommitID=${CommitID} . + # docker save -o docker_iotlcmadmin.tar docker_iotlcmadmin:v0 + + +mod: + go mod tidy + +dockerbuild: create_docker_iotlcmadmin + echo "docker build success" +dockerpush: + docker tag docker_iotlcmadmin:v0 ${REGISTRY}/docker_iotlcmadmin:v0 + docker push ${REGISTRY}/$1:$2 \ No newline at end of file diff --git a/server/internal/cmd/cmd.go b/server/internal/cmd/cmd.go new file mode 100644 index 0000000..7acaf5a --- /dev/null +++ b/server/internal/cmd/cmd.go @@ -0,0 +1,10 @@ +// Package cmd +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package cmd + +var ( + Main = Http +) diff --git a/server/internal/cmd/global.go b/server/internal/cmd/global.go new file mode 100644 index 0000000..8f40b6e --- /dev/null +++ b/server/internal/cmd/global.go @@ -0,0 +1,61 @@ +// Package cmd +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package cmd + +import ( + "context" + "errors" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/cache" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmode" +) + +// 系统初始化 +func SystemInit(ctx context.Context) { + // 检查数据库连接 + if err := CheckConnDB(ctx); err != nil { + panic(err) + } + // 设置gf运行模式 + SetGFMode(ctx) + // 默认上海时区 + if err := gtime.SetTimeZone("Asia/Shanghai"); err != nil { + g.Log().Fatalf(ctx, "时区设置异常 err: %+v", err) + return + } + // 设置缓存适配器 + cache.SetAdapter(ctx) +} + +// CheckConnDB 检查数据库连接 +func CheckConnDB(ctx context.Context) error { + err := g.DB().PingMaster() + if err != nil { + return errors.New("连接到数据库失败") + } + return nil +} + +// 设置gf运行模式 +func SetGFMode(ctx context.Context) { + gfmode := g.Cfg().MustGet(ctx, "system.gfmode").String() + if len(gfmode) == 0 { + gfmode = gmode.NOT_SET + } + var modes = []string{gmode.DEVELOP, gmode.TESTING, gmode.STAGING, gmode.PRODUCT} + for _, mode := range modes { + if mode == gfmode { + gmode.Set(mode) + break + } + } +} + +func DBHandle(ctx context.Context) { + +} diff --git a/server/internal/cmd/http.go b/server/internal/cmd/http.go new file mode 100644 index 0000000..a3aa28f --- /dev/null +++ b/server/internal/cmd/http.go @@ -0,0 +1,57 @@ +package cmd + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/cmd/inithttp" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/rabbitmq" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/websocket" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/router" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/tasks" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcmd" + + _ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/queues/httpqueues" +) + +func init() { + inithttp.RegisterHttpInitFunc("initJobTask", initJobTask) + inithttp.RegisterHttpCleanupFunc("rabbitmq", func(ctx context.Context) error { + return rabbitmq.Close() + }) +} + +var Http = &gcmd.Command{ + Name: "http", + Usage: "http", + Brief: "HTTP控制台服务", + Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { + g.Log().Infof(ctx, "Http init start") + serverWg.Add(1) + s := g.Server() + go func() { + waitServerClose(ctx) + websocket.StopWebSocket(ctx) + s.Shutdown() + serverWg.Done() + }() + err = inithttp.InitHttp(ctx) + if err != nil { + g.Log().Errorf(ctx, "http init error: %v", err) + return err + } + s.SetDumpRouterMap(true) + router.InitRouter(ctx, s) + websocket.StartWebSocket(ctx) + s.Run() + inithttp.CleanupHttp(ctx) + return nil + }, +} + +func initJobTask(ctx context.Context) error { + tasks.TasksInstance(ctx) + service.SysJob().InitRegister() + return nil +} diff --git a/server/internal/cmd/initfuunc.go b/server/internal/cmd/initfuunc.go new file mode 100644 index 0000000..4bc4d3b --- /dev/null +++ b/server/internal/cmd/initfuunc.go @@ -0,0 +1,46 @@ +// Package cmd +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package cmd + +import ( + "context" + "errors" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gmode" +) + +var ( + initFuncList map[string]func(ctx context.Context) error +) + +func RegisterInitFunc(name string, fn func(ctx context.Context) error) { + if initFuncList == nil { + initFuncList = make(map[string]func(ctx context.Context) error) + } + initFuncList[name] = fn +} + +func InitSystemDeferFunc(ctx context.Context) error { + for name, fn := range initFuncList { + if fn == nil { + g.Log().Errorf(ctx, "InitSystemDeferFunc %s fn is nil.", name) + return errors.New("func is nil") + } + err := fn(ctx) + if err != nil { + g.Log().Errorf(ctx, "InitSystemDeferFunc %s err: %v", name, err) + return err + } + g.Log().Infof(ctx, "InitSystemDeferFunc %s success.", name) + } + // 初始化生成代码配置 + if !gmode.IsProduct() { + xgen.Init(ctx) + } + return nil +} diff --git a/server/internal/cmd/inithttp/inithttp.go b/server/internal/cmd/inithttp/inithttp.go new file mode 100644 index 0000000..a2b45c1 --- /dev/null +++ b/server/internal/cmd/inithttp/inithttp.go @@ -0,0 +1,59 @@ +package inithttp + +import ( + "context" + "sync" + + "github.com/gogf/gf/v2/frame/g" +) + +var ( + httpInitFunc map[string]func(ctx context.Context) error + httpCleanupFunc map[string]func(ctx context.Context) error + rwLock sync.RWMutex +) + +func RegisterHttpInitFunc(name string, fn func(ctx context.Context) error) { + rwLock.Lock() + defer rwLock.Unlock() + if httpInitFunc == nil { + httpInitFunc = make(map[string]func(ctx context.Context) error) + } + httpInitFunc[name] = fn +} + +func RegisterHttpCleanupFunc(name string, fn func(ctx context.Context) error) { + rwLock.Lock() + defer rwLock.Unlock() + if httpCleanupFunc == nil { + httpCleanupFunc = make(map[string]func(ctx context.Context) error) + } + httpCleanupFunc[name] = fn +} + +func InitHttp(ctx context.Context) error { + rwLock.RLock() + defer rwLock.RUnlock() + for name, fn := range httpInitFunc { + if err := fn(ctx); err != nil { + g.Log().Errorf(ctx, "httpInitFunc %s error: %v", name, err) + return err + } else { + g.Log().Infof(ctx, "httpInitFunc %s success", name) + } + } + return nil +} + +func CleanupHttp(ctx context.Context) error { + rwLock.RLock() + defer rwLock.RUnlock() + for name, fn := range httpCleanupFunc { + if err := fn(ctx); err != nil { + g.Log().Errorf(ctx, "httpCleanupFunc %s error: %v", name, err) + } else { + g.Log().Infof(ctx, "httpCleanupFunc %s success", name) + } + } + return nil +} diff --git a/server/internal/cmd/monitor.go b/server/internal/cmd/monitor.go new file mode 100644 index 0000000..d114108 --- /dev/null +++ b/server/internal/cmd/monitor.go @@ -0,0 +1,74 @@ +// Package cmd +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package cmd + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/cmd/inithttp" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/websocket" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "time" +) + +func init() { + inithttp.RegisterHttpInitFunc("InitMonitor", func(ctx context.Context) error { + InitMonitor() + return nil + }) +} + +func InitMonitor() { + go func() { + for { + RunMonitor() + time.Sleep(time.Second * 5) + } + }() + websocket.RegisterTagCallback(consts.WSTagMonitorServer, func(client *websocket.Client, tag string) { + RunMonitor() + }) +} + +func RunMonitor() { + ctx := context.Background() + hostInfo := service.MonitorServer().GetHostInfo(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerHost), + Data: hostInfo, + }) + sysLoad := service.MonitorServer().GetSysLoad(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerSysLoad), + Data: sysLoad, + }) + cpuInfo := service.MonitorServer().GetCpuInfo(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerCpu), + Data: cpuInfo, + }) + memInfo := service.MonitorServer().GetMemInfo(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerMem), + Data: memInfo, + }) + diskInfo := service.MonitorServer().GetDiskInfo(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerDisk), + Data: diskInfo, + }) + netInfo := service.MonitorServer().GetNetStatusInfo(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerNet), + Data: netInfo, + }) + goInfo := service.MonitorServer().GetGoInfo(ctx) + websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{ + Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerGo), + Data: goInfo, + }) +} diff --git a/server/internal/cmd/shutdown.go b/server/internal/cmd/shutdown.go new file mode 100644 index 0000000..e996374 --- /dev/null +++ b/server/internal/cmd/shutdown.go @@ -0,0 +1,58 @@ +package cmd + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event" + "os" + "sync" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gctx" + "github.com/gogf/gf/v2/os/gproc" +) + +var ( + serverCloseSignal = make(chan struct{}, 1) + serverWg = sync.WaitGroup{} + once sync.Once +) + +// 等待接收服务关闭信号 +func waitServerClose(ctx context.Context) { + signalListen(ctx, handleSignalClose) + <-serverCloseSignal +} + +// 等待所有服务关闭 +func waitAllServerClose(ctx context.Context) { + serverWg.Wait() +} + +// 处理服务关闭信号 +func handleSignalClose(sig os.Signal) { + serverCloseEvent(gctx.GetInitCtx()) + serverCloseSignal <- struct{}{} +} + +// 监听信号 +func signalListen(ctx context.Context, handler ...gproc.SigHandler) { + g.Go(ctx, func(ctx context.Context) { + // syscall.SIGINT, + // syscall.SIGQUIT, + // syscall.SIGKILL, + // syscall.SIGTERM, + // syscall.SIGABRT. + gproc.AddSigHandlerShutdown(handler...) + gproc.Listen() + }, func(ctx context.Context, exception error) { + g.Log().Fatalf(ctx, "信号监听异常 err: %+v", exception) + }) +} + +// serverCloseEvent 关闭事件 +func serverCloseEvent(ctx context.Context) { + once.Do(func() { + event.EventsInstance().Emit(ctx, consts.EventKeyServerClose, nil) + }) +} diff --git a/server/internal/consts/batch.go b/server/internal/consts/batch.go new file mode 100644 index 0000000..72fc6c3 --- /dev/null +++ b/server/internal/consts/batch.go @@ -0,0 +1,228 @@ +package consts + +const ( + BatchAsyncStatusCreated = 0 + BatchAsyncStatusPending = 1 + BatchAsyncStatusProcessing = 2 + BatchAsyncStatusSuccess = 3 + BatchAsyncStatusFailed = 4 + BatchAsyncStatusPartialSuccess = 5 +) + +const ( + BatchRunResultPending = 0 + BatchRunResultRunning = 1 + BatchRunResultSuccess = 2 + BatchRunResultFailed = 3 + BatchRunResultPartialSuccess = 4 +) + +const ( + BatchStatusNormal = 0 + BatchStatusAbandoned = 1 +) + +const ( + BatchDetailStatusPending = 0 + BatchDetailStatusRunning = 1 + BatchDetailStatusSuccess = 2 + BatchDetailStatusFailed = 3 +) + +const ( + BatchSourceTypeBatchSelect = 0 + BatchSourceTypeRange = 1 + BatchSourceTypeBatchInput = 2 + BatchSourceTypeFile = 3 + BatchSourceTypeScheduled = 4 +) + +const ( + BatchTypeInbound = 1 + BatchTypeOutbound = 2 + BatchTypeAllocate = 3 + BatchTypePrepare = 4 + BatchTypeCardAddPackage = 11 + BatchTypePoolAddPackage = 12 + BatchTypeSimWarningConfig = 40 + BatchTypeTrafficCutoffConfig = 41 + + BatchTypeRenew = 101 + BatchTypeChange = 102 + BatchTypeStart = 103 + BatchTypeStop = 104 + BatchTypeRestart = 105 + BatchTypeCancel = 106 + BatchTypeDataCut = 107 + BatchTypeUnsub = 108 + BatchTypeDataStart = 109 + BatchTypeDataStop = 110 +) + +const ( + BatchNoPrefixInbound = "INB" + BatchNoPrefixOutbound = "OUT" + BatchNoPrefixAllocate = "ALC" + BatchNoPrefixCardAddPackage = "ADP" + BatchNoPrefixPoolAddPackage = "PAP" + BatchNoPrefixSimWarningConfig = "SWC" + BatchNoPrefixTrafficCutoffConfig = "TCC" + + BatchNoPrefixRenew = "REN" + BatchNoPrefixChange = "CHG" + BatchNoPrefixStart = "STR" + BatchNoPrefixStop = "STP" + BatchNoPrefixRestart = "RST" + BatchNoPrefixCancel = "CAN" + BatchNoPrefixDataCut = "DCT" + BatchNoPrefixUnsub = "UNS" + BatchNoPrefixDataStart = "DOP" + BatchNoPrefixDataStop = "DST" +) + +const ( + BlankOutStatusYes = 0 + BlankOutStatusNo = 1 +) + +const ( + DownloadStatusPending = 0 + DownloadStatusGenerated = 1 + DownloadStatusRunning = 2 + DownloadStatusFailed = 3 +) + +const ( + ResourceTypeExcel = 1 + ResourceExportSceneInbound = 1 + ResourceExportSceneOutbound = 2 + ResourceExportSceneAllocate = 3 + ResourceExportSceneCardAddPackage = 11 + ResourceExportScenePoolAddPackage = 12 + ResourceExportSceneSimWarningConfig = 40 + ResourceExportSceneTrafficCutoffConfig = 41 + ResourceExportSceneRenew = 101 + ResourceExportSceneChange = 102 + ResourceExportSceneCancel = 106 + ResourceExportSceneDataCut = 107 + ResourceExportSceneUnsub = 108 + ResourceExportSceneDataStart = 109 + ResourceExportSceneDataStop = 110 +) + +const ( + ImportStatusSuccess = "success" + ImportStatusFailed = "failed" +) + +const ( + ResourceBatchDownloadTaskSimCardInbound = "卡入库结果" + ResourceBatchDownloadTaskSimCardOutbound = "卡出库结果" + ResourceBatchDownloadTaskSimCardRenew = "卡续费结果" + ResourceBatchDownloadTaskSimCardChange = "卡变更套餐结果" + ResourceBatchDownloadTaskSimCardCancel = "卡销户结果" + ResourceBatchDownloadTaskSimCardUnsub = "卡退订结果" + ResourceBatchDownloadTaskSimCardAddPackage = "单卡加油包结果" + ResourceBatchDownloadTaskSimPoolAddPackage = "流量池加油包结果" + ResourceBatchDownloadTaskSimWarningConfig = "预警配置结果" + ResourceBatchDownloadTaskTrafficCutoffConfig = "达量断网配置结果" + ResourceBatchDownloadTaskSimCardDataCut = "SIM卡达量断网结果" + + SimCardInboundMaxFileSize = 50 << 20 + SimCardInboundSubDirImportInput = "sim-card-inbound/import-input" + SimCardInboundDefaultInputInlineMaxRows = 1000 + SimCardOutboundMaxFileSize = 50 << 20 + SimCardRenewMaxFileSize = 50 << 20 + SimCardChangeMaxFileSize = 50 << 20 + SimCardCancelMaxFileSize = 50 << 20 + SimCardUnsubMaxFileSize = 50 << 20 + SimCardAddPackageMaxFileSize = 50 << 20 + SimPoolAddPackageMaxFileSize = 50 << 20 + + SimCardInboundSubDirImportExcel = "sim-card-inbound/import" + SimCardInboundSubDirResultExcel = "sim-card-inbound/result" + SimCardOutboundSubDirImportExcel = "sim-card-outbound/import" + SimCardOutboundSubDirResultExcel = "sim-card-outbound/result" + SimCardRenewSubDirImportExcel = "sim-card-renew/import" + SimCardRenewSubDirResultExcel = "sim-card-renew/result" + SimCardChangeSubDirImportExcel = "sim-card-change/import" + SimCardChangeSubDirResultExcel = "sim-card-change/result" + SimCardCancelSubDirImportExcel = "sim-card-cancel/import" + SimCardCancelSubDirResultExcel = "sim-card-cancel/result" + SimCardUnsubSubDirImportExcel = "sim-card-unsub/import" + SimCardUnsubSubDirResultExcel = "sim-card-unsub/result" + SimCardAddPackageSubDirImportExcel = "sim-card-add-package/import" + SimCardAddPackageSubDirResultExcel = "sim-card-add-package/result" + SimPoolAddPackageSubDirImportExcel = "sim-pool-add-package/import" + SimPoolAddPackageSubDirResultExcel = "sim-pool-add-package/result" + + SimCardDataStartMaxFileSize = 50 << 20 + SimCardDataStopMaxFileSize = 50 << 20 + + // 业务受理-开停数据 / 停复机(自主复机、重启)单次导入的条数上限,Excel 与批量输入统一生效 + SimCardBatchMaxRows = 20000 + SimCardDataStartSubDirImportExcel = "sim-card-data-start/import" + SimCardDataStartSubDirResultExcel = "sim-card-data-start/result" + SimCardDataStopSubDirImportExcel = "sim-card-data-stop/import" + SimCardDataStopSubDirResultExcel = "sim-card-data-stop/result" + + SimWarningConfigMaxFileSize = 50 << 20 + SimWarningConfigSubDirImportExcel = "sim-warning-config/import" + SimWarningConfigSubDirResultExcel = "sim-warning-config/result" + SimCardTrafficCutoffConfigMaxFileSize = 50 << 20 + SimCardTrafficCutoffConfigSubDirImportExcel = "sim-card-traffic-cutoff-config/import" + SimCardTrafficCutoffConfigSubDirResultExcel = "sim-card-traffic-cutoff-config/result" + SimCardDataCutMaxFileSize = 50 << 20 + SimCardDataCutSubDirImportExcel = "sim-card-data-cut/import" + SimCardDataCutSubDirResultExcel = "sim-card-data-cut/result" +) + +const ( + OrderTypeCardSubscribe = 1 + OrderTypeCardRenew = 2 + OrderTypeCardChange = 3 + + OrderStatusCompleted = 5 + + CustomerTypeAgent = 1 + + PayTypeOffline = 3 + PayTypeBalance = 4 + + PayStatusPaid = 2 + + ProductTypeCard = 1 + + PayModeYearMonth = 1 + + PackageBusinessTypeSubscribe = 0 + PackageBusinessTypeChange = 1 + PackageBusinessTypeRenew = 2 + + // Package types: formal card/pool packages and their add-on packages. + PackageTypeCard = 101 + PackageTypePool = 102 + PackageTypeCardAddPackage = 103 + PackageTypePoolAddPackage = 104 + + OrderReturnStatusNone = 0 + OrderReturnStatusPending = 1 + OrderReturnStatusRunning = 2 + OrderReturnStatusPartial = 3 + OrderReturnStatusSuccess = 4 +) + +const ( + PackageStatusNone = 0 + PackageStatusPending = 1 + PackageStatusEffective = 2 + PackageStatusExpired = 3 +) + +const ( + EffectiveStatusPending = 0 + EffectiveStatusEffective = 1 + EffectiveStatusExpired = 2 + EffectiveStatusTerminated = 3 + EffectiveStatusVoided = 4 +) diff --git a/server/internal/consts/bcache.go b/server/internal/consts/bcache.go new file mode 100644 index 0000000..8e37349 --- /dev/null +++ b/server/internal/consts/bcache.go @@ -0,0 +1,10 @@ +// Package consts 定义缓存键模板。 +package consts + +const ( + KeySysAuthToken = "login:%d:%s" // 系统认证token缓存 login:{userId}:{uuid} + KeySysAuthTokenReject = "login_reject:%d:%s:" // 系统认证token拒绝缓存 login_reject:{userId}:{uuid} + KeyLoginScanWechat = "login:scan:wechat:%d" // 系统二维码登录缓存 hash Key:SceneId field:tempUserId value:QrcodeCacheModel + KeyUserBindWechat = "user:bind:wechat:%d" // 系统二维码绑定缓存 hash Key:SceneId field:userId value:QrcodeCacheModel + KeyUserMfaCode = "user:mfa:%s" // 用户mfa验证码缓存 user:mfa:{uuid} +) diff --git a/server/internal/consts/code.go b/server/internal/consts/code.go new file mode 100644 index 0000000..49fb677 --- /dev/null +++ b/server/internal/consts/code.go @@ -0,0 +1,41 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +import "github.com/gogf/gf/v2/errors/gcode" + +var ( + // 账号不存在 + CodeUserNotFound = gcode.New(10001, "账号不存在", nil) + // 账号已删除 + CodeUserDeleted = gcode.New(10002, "账号已删除", nil) + // 密码错误 + CodeUserPasswordError = gcode.New(10003, "密码错误", nil) + // 账号已禁用 + CodeUserDisabled = gcode.New(10004, "账号已禁用", nil) + // 账号已锁定 + CodeUserLocked = gcode.New(10005, "账号已锁定", nil) + // 账号已过期 + CodeUserExpired = gcode.New(10006, "账号已过期", nil) + // 验证码错误 + CodeCaptchaError = gcode.New(10007, "验证码错误", nil) + // 用户名已存在 + CodeUserExists = gcode.New(10008, "用户名已存在", nil) + // 部门不存在 + CodeDeptNotFound = gcode.New(10009, "部门不存在", nil) + // 手机号已存在 + CodePhoneExists = gcode.New(10010, "手机号已存在", nil) + // 邮箱已存在 + CodeEmailExists = gcode.New(10011, "邮箱已存在", nil) + // 登录已过期 + CodeLoginExpired = gcode.New(10012, "登录已过期", nil) + // 部门下有子部门,不能删除 + CodeDeptHasSub = gcode.New(10013, "部门下有子部门,不能删除", nil) + // 没有权限 + CodeNoPermission = gcode.New(10014, "没有权限", nil) + // 无效Token + CodeInvalidToken = gcode.New(10015, "无效Token", nil) +) diff --git a/server/internal/consts/config.go b/server/internal/consts/config.go new file mode 100644 index 0000000..b6bf46d --- /dev/null +++ b/server/internal/consts/config.go @@ -0,0 +1,21 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +const ( + ConfigOssUrlPath = "sys.oss.urlPath" // 上传文件Url路径 "http://ab.com/" 或 "/" 或 "resource/upload|http://ab.com/upload" + ConfigOssFileTypeKey = "sys.oss.fileType" // 上传文件类型 + ConfigOssImgTypeKey = "sys.oss.imgType" // 上传图片类型 + ConfigOssFileSizeKey = "sys.oss.fileSize" // 上传文件大小 + ConfigOssImgSizeKey = "sys.oss.imgSize" // 上传图片大小 + ConfigOnlineForceLogout = "sys.online.forceLogout" // 在线用户强制退出 + ConfigOssNewFileTypePath = "sys.oss.newFileTypePath.%d" // 上传文件类型路径 ${newFileType} +) + +const ( + ConfigOnlineForceLogoutTrue = "true" // 在线用户强制退出 + ConfigOnlineForceLogoutFalse = "false" // 在线用户强制退出 +) diff --git a/server/internal/consts/consts.go b/server/internal/consts/consts.go new file mode 100644 index 0000000..da0878d --- /dev/null +++ b/server/internal/consts/consts.go @@ -0,0 +1,10 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +const ( + ContextKey = "ContextKey" // 上下文变量存储键名,前后端系统共享 +) diff --git a/server/internal/consts/db.go b/server/internal/consts/db.go new file mode 100644 index 0000000..2256ce4 --- /dev/null +++ b/server/internal/consts/db.go @@ -0,0 +1,6 @@ +package consts + +const ( + DBNameDefault = "default" + DBNameMemory = "memorydb" +) diff --git a/server/internal/consts/event.go b/server/internal/consts/event.go new file mode 100644 index 0000000..d568d9b --- /dev/null +++ b/server/internal/consts/event.go @@ -0,0 +1,55 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +const ( + EventKeyServerClose = "server_close" // 服务关闭 args=[] +) + +const ( + EventKeyUserLogin = "user_login" // 用户登录 args=[uid,] + EventKeyUserLogout = "user_logout" // 用户退出 args=[uid,] + EventKeyUserCreate = "user_create" // 用户创建 args=[uid,] + EventKeyUserDelete = "user_delete" // 用户删除 args=[uidArray,] + EventKeyUserUpdate = "user_update" // 用户更新 args=[uid,] +) +const ( + EventKeyDBSysConfigUpdate = "db.sys_config_update" // 系统配置创建更新删除 args=[configId, tenantId,key?] + EventKeyDBSysConfigCreate = "db.sys_config_create" // 系统配置创建 args=[configId, tenantId,key?] + EventKeyDBSysConfigDelete = "db.sys_config_delete" // 系统配置删除 args=[configId, tenantId] +) + +const ( + EventKeyDBSysDeptCreate = "db.sys_dept_create" // 系统部门创建 args=[deptId,] + EventKeyDBSysDeptUpdate = "db.sys_dept_update" // 系统部门更新 args=[deptId,] + EventKeyDBSysDeptDelete = "db.sys_dept_delete" // 系统部门删除 args=[deptId[],] +) + +const ( + EventKeyDBSysTenantCreate = "db.sys_tenant_create" // 租户创建 args=[pk,] + EventKeyDBSysTenantUpdate = "db.sys_tenant_update" // 租户更新 args=[pk,] + EventKeyDBSysTenantDelete = "db.sys_tenant_delete" // 租户删除 args=[pk[],] + + EventKeyDBSysRoleCreate = "db.sys_role_create" // 角色创建 args=[pk,] + EventKeyDBSysRoleUpdate = "db.sys_role_update" // 角色更新 args=[pk,] + EventKeyDBSysRoleDelete = "db.sys_role_delete" // 角色删除 args=[pk[],] + + EventKeyDBSysMenuCreate = "db.sys_menu_create" // 菜单创建 args=[pk,] + EventKeyDBSysMenuUpdate = "db.sys_menu_update" // 菜单更新 args=[pk,] + EventKeyDBSysMenuDelete = "db.sys_menu_delete" // 菜单删除 args=[pk[],] + + EventKeyDBSysPostCreate = "db.sys_post_create" // 岗位创建 args=[pk,] + EventKeyDBSysPostUpdate = "db.sys_post_update" // 岗位更新 args=[pk,] + EventKeyDBSysPostDelete = "db.sys_post_delete" // 岗位删除 args=[pk[],] + + EventKeyDBSysDictDataCreate = "db.sys_dict_data_create" // 字典数据创建 args=[pk,] + EventKeyDBSysDictDataUpdate = "db.sys_dict_data_update" // 字典数据更新 args=[pk,] + EventKeyDBSysDictDataDelete = "db.sys_dict_data_delete" // 字典数据删除 args=[pk[],] + + EventKeyDBSysDictTypeCreate = "db.sys_dict_type_create" // 字典类型创建 args=[pk,] + EventKeyDBSysDictTypeUpdate = "db.sys_dict_type_update" // 字典类型更新 args=[pk,] + EventKeyDBSysDictTypeDelete = "db.sys_dict_type_delete" // 字典类型删除 args=[pk[],] +) diff --git a/server/internal/consts/http.go b/server/internal/consts/http.go new file mode 100644 index 0000000..6db02b7 --- /dev/null +++ b/server/internal/consts/http.go @@ -0,0 +1,14 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +const ( + HTTPContentTypeXml = "text/xml" + HTTPContentTypeHtml = "text/html" + HTTPContentTypeStream = "text/event-stream" + HTTPContentTypeJson = "application/json" + HTTPContentTypeExcel = "application/octet-stream" +) diff --git a/server/internal/consts/mcache.go b/server/internal/consts/mcache.go new file mode 100644 index 0000000..65f7e54 --- /dev/null +++ b/server/internal/consts/mcache.go @@ -0,0 +1,15 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +// 内存缓存KEY常量 注明 key组成和 过期时间 清理方式 +const ( + MemCacheDeptName = "dept_name_%d" // 部门名称缓存 部门id:name 24小时过期 + MemCacheUserInfo = "user_info_%d" // 用户信息缓存 用户id:miniinfo 24小时过期 用户修改是清理 + MemCacheUserAccessCodeList = "user_access_code_list_%d" // 用户访问码列表缓存 用户id:access_code_list 24小时过期 用户退出清理 + MemCacheUserRoleDataAccessCodeList = "user_role_data_access_code_list_%d" // 用户角色数据访问码列表缓存 用户id:role_id:data_access_code_list 24小时过期 用户退出清理 + MemCacheSystemConfig = "system_config_%s" // 系统配置缓存 租户ID:map[key]value 24小时过期 +) diff --git a/server/internal/consts/package_duration.go b/server/internal/consts/package_duration.go new file mode 100644 index 0000000..5ddbb11 --- /dev/null +++ b/server/internal/consts/package_duration.go @@ -0,0 +1,42 @@ +package consts + +import "strings" + +const ( + BillingMethodMonth = 1 + BillingMethodYear = 2 + + RenewDurationUnitMonth = "month" + RenewDurationUnitYear = "year" +) + +func BillingMethodDurationUnit(billingMethod int) string { + if billingMethod == BillingMethodMonth { + return RenewDurationUnitMonth + } + return RenewDurationUnitYear +} + +func NormalizeRenewDurationUnit(unit string) string { + if strings.EqualFold(strings.TrimSpace(unit), RenewDurationUnitMonth) { + return RenewDurationUnitMonth + } + return RenewDurationUnitYear +} + +func RenewDurationUnitText(unit string) string { + if NormalizeRenewDurationUnit(unit) == RenewDurationUnitMonth { + return "个月" + } + return "年" +} + +func DurationValueToMonths(unit string, value int) int { + if value <= 0 { + return 0 + } + if NormalizeRenewDurationUnit(unit) == RenewDurationUnitMonth { + return value + } + return value * 12 +} diff --git a/server/internal/consts/queue.go b/server/internal/consts/queue.go new file mode 100644 index 0000000..92284d1 --- /dev/null +++ b/server/internal/consts/queue.go @@ -0,0 +1,46 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +const ( + QueueSysOptLog = "queue:sys_opt_log" + QueueTrafficUsageDailyRetry = "iotlcm.traffic_usage.daily.retry" + QueueTrafficUsageMonthlyRetry = "iotlcm.traffic_usage.monthly.retry" + // QueueTrafficUsageMonthlyStart carries one command per full monthly usage run. + // Worker consumes it and owns database scanning and Redis production. + QueueTrafficUsageMonthlyStart = "iotlcm.traffic_usage.monthly.start" + // QueueTrafficUsageDailyStart carries one command per full daily usage run. + // Worker consumes it and owns database scanning and Redis production. + QueueTrafficUsageDailyStart = "iotlcm.traffic_usage.daily.start" + // QueueTrafficUsageMonthlyHistoryStart carries one command per full monthly + // usage history run (the TDengine monthly table). + QueueTrafficUsageMonthlyHistoryStart = "iotlcm.traffic_usage.monthly_history.start" + QueueSimStatusQueueStart = "iotlcm.sim_status.queue.start" + QueueImeiQueueStart = "iotlcm.imei.queue.start" + QueueSimStatusQueueTask = "iotlcm.sim_status.queue.task" + QueueWorkOrderAutoClose = "iotlcm.work_order.auto_close" + QueueWorkOrderAutoCloseDelay = "iotlcm.work_order.auto_close.delay" + QueueWorkerDiagnostic = "iotlcm.worker.diagnostic" + QueueBatchExecute = "iotlcm.batch.execute" + QueueBatchOutboundExecute = "iotlcm.batch.outbound.execute" + QueueBalanceRechargeTimeout = "iotlcm.balance.recharge.timeout" + QueueBalanceRechargeDelay = "iotlcm.balance.recharge.delay" + QueuePackageCustomerSync = "iotlcm.package_customer.sync" + QueueChannelRefresh = "iotlcm.channel.refresh" + QueueAgentRoleSync = "iotlcm.agent.role.sync" + QueueAgentRoleSyncRetry = "iotlcm.agent.role.sync.retry" + QueueAgentRoleSyncDeadLetter = "iotlcm.agent.role.sync.dlq" +) + +// 数据库变动类型 +const ( + DbChgTypeAdd = "add" // 数据库变动新增 + DbChgTypeEdit = "edit" // 数据库变动编辑 + DbChgTypeDel = "del" // 数据库变动删除 +) +const ( + BroadcastDbChg = "broadcast:db:chg" // 数据库配置表变动更新广播消息 obj{table_name,pk,type:add/edit/del,data:{主要字段数据}} +) diff --git a/server/internal/consts/sim_card_lifecycle.go b/server/internal/consts/sim_card_lifecycle.go new file mode 100644 index 0000000..4f09524 --- /dev/null +++ b/server/internal/consts/sim_card_lifecycle.go @@ -0,0 +1,34 @@ +package consts + +const ( + SimCardStatusOperTypeStop = "0" + SimCardStatusOperTypeStart = "1" + + ResourceExportSceneStart = 103 + ResourceExportSceneStop = 104 + ResourceExportSceneRestart = 105 + + ResourceBatchDownloadTaskSimCardStart = "SIM卡批量复机结果" + ResourceBatchDownloadTaskSimCardStop = "SIM卡批量停机结果" + ResourceBatchDownloadTaskSimCardRestart = "SIM卡批量重启结果" + SimCardLifecycleMaxFileSize = 50 << 20 + SimCardStartSubDirImportExcel = "sim-card-start/import" + SimCardStartSubDirResultExcel = "sim-card-start/result" + SimCardStopSubDirImportExcel = "sim-card-stop/import" + SimCardStopSubDirResultExcel = "sim-card-stop/result" + SimCardRestartSubDirImportExcel = "sim-card-restart/import" + SimCardRestartSubDirResultExcel = "sim-card-restart/result" +) + +const ( + SimCardDataOperTypeStart = 0 + SimCardDataOperTypeStop = 1 + + SimCardDataApnName = "CMIOT" + + DataOperationStart = "dataStart" + DataOperationStop = "dataStop" + + ResourceBatchDownloadTaskSimCardDataStart = "SIM卡批量开通数据服务结果" + ResourceBatchDownloadTaskSimCardDataStop = "SIM卡批量停用数据服务结果" +) diff --git a/server/internal/consts/system.go b/server/internal/consts/system.go new file mode 100644 index 0000000..c12cf33 --- /dev/null +++ b/server/internal/consts/system.go @@ -0,0 +1,146 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +var ( + // 默认系统租客编号,禁止修改编号 + DefaultSystemTenantCode = "000000" + SuperAdminRoleId = int64(1) +) + +var ( + // 状态: 0正常 1停用 + SysStatusNormal = "0" + SysStatusDisable = "1" +) + +var ( + // 菜单状态: 0正常 1停用 + SysMenuStatusNormal = "0" + SysMenuStatusDisable = "1" +) + +var ( + // 菜单类型: M目录 C菜单 F按钮 + SysMenuTypeDir = "M" + SysMenuTypeMenu = "C" + SysMenuTypeBtn = "F" +) + +var ( + // 菜单可见: 0显示 1隐藏 + SysMenuVisibleShow = "0" + SysMenuVisibleHide = "1" +) + +var ( + // 菜单是否为外链: 0是 1否 + SysMenuIsFrameNo = 1 + SysMenuIsFrameYes = 0 +) + +var ( + // 用户状态: 0正常 1停用 + SysUserStatusNormal = "0" + SysUserStatusDisable = "1" + SysUserStatusLocked = "2" + SysUserStatusExpired = "3" + SysUserStatusDeleted = "4" +) + +var ( + // 角色数据范围: 1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限 + SysRoleMenuDataScopeRole = "0" + SysRoleDataScopeAll = "1" + SysRoleDataScopeCustom = "2" + SysRoleDataScopeDept = "3" + SysRoleDataScopeDeptAndBelow = "4" + SysRoleDataScopePersonal = "5" + SysRoleDataScopeDeptAndBelowOrPersonal = "6" + SysRoleDataScopeOrgAndNextLevel = "7" + SysRoleDataScopeOrgNextLevel = "8" +) + +var ( + // 上传文件类型: 1文件 2图片 + SysUploadFileTypeFile = "file" + SysUploadFileTypeImg = "img" +) + +var ( + // 新文件类型 + SysUploadNewFileTypeUserFile = 1 // 用户文件 + SysUploadNewFileTypeUserImg = 2 // 用户图片 + SysUploadNewFileTypeDeviceFile = 3 // 设备文件 ${device_key} +) +var ( + // 新文件类型路径 + SysUploadNewFileTypePathUserFile = "user/file" // 用户文件 + SysUploadNewFileTypePathUserImg = "user/img" // 用户图片 + SysUploadNewFileTypePathDeviceFile = "device" // 设备文件 ${device_key} +) +var ( + // 用户性别: 0男 1女 2未知 + SysUserSexMale = "0" + SysUserSexFemale = "1" + SysUserSexUnknown = "2" +) + +var ( + // 用户类型: pc端 app端 + SysUserTypeSys = "sys_user" + SysUserTypeAPP = "app_user" +) + +var ( + // 部门状态: 0正常 1停用 + SysDeptStatusNormal = "0" + SysDeptStatusDisable = "1" +) + +var ( + // 任务状态: 0正常 1停用 + SysJobStatusNormal = "0" + SysJobStatusDisable = "1" +) + +var ( + // 计划执行策略 0不限制并发 1限制并发 + SysJobMisfirePolicyMulty = 1 + SysJobMisfirePolicyOnce = 2 +) +var ( + // 权限码前缀 x-check-permission + SysCheckPermissionPrefix = "cp" + SysCheckPermissionRolePrefix = "cpr:" // 角色权限码前缀+角色权限 + SysCheckPermissionMenuPrefix = "cpm:" // 菜单权限码前缀+菜单权限 + SysCheckPermissionDeptPrefix = "cpd:" // 部门权限码前缀+部门编码 + SysCheckPermissionPostPrefix = "cpp:" // 岗位权限码前缀+岗位编码 + SysCheckPermissionUserPrefix = "cpu:" // 用户权限码前缀+用户名 + SysCheckPermissionCurrentUser = "cpc:current:user" // 当前登录用户默认权限 +) +var StatusSlice = []int{0, 1} + +// MethodSlice HTTP请求方法 +var MethodSlice = []int{1, 2, 3, 4} + +var ( + // 公告范围: 1全部 2指定组织 3指定用户 + NoticeRangeAll = 1 + NoticeRangeDept = 2 + NoticeRangeUser = 3 +) + +var ( + // 租户配置 + ConfigKeyTenantDefaultRegisterDeptId = "iot.register.dept" + ConfigKeyTenantDefaultRegisterRoleId = "iot.register.role" +) + +var ( + // 微信平台 + SourceWechatMp = "wechat_mp" +) diff --git a/server/internal/consts/v3api.go b/server/internal/consts/v3api.go new file mode 100644 index 0000000..422135a --- /dev/null +++ b/server/internal/consts/v3api.go @@ -0,0 +1,90 @@ +package consts + +// V3 API enum labels are centralized here for urgent compatibility work. +// Move domain enum values to their own const files when the compatibility layer stabilizes. + +const ( + V3ApiSimAccessTypeIPv4 = 1 + V3ApiSimAccessTypeIPv6 = 2 + V3ApiSimAccessTypeIPv4IPv6 = 3 +) + +var V3ApiSimAccessTypeNameMap = map[int]string{ + V3ApiSimAccessTypeIPv4: "IPV4", + V3ApiSimAccessTypeIPv6: "IPV6", + V3ApiSimAccessTypeIPv4IPv6: "IPV4/IPV6", +} + +const ( + V3ApiSimBossCardStatusPendingActivate = 1 + V3ApiSimBossCardStatusActivated = 2 + V3ApiSimBossCardStatusStopped = 4 + V3ApiSimBossCardStatusTestable = 6 + V3ApiSimBossCardStatusStock = 7 + V3ApiSimBossCardStatusPreCancel = 8 + V3ApiSimBossCardStatusCanceled = 9 +) + +var V3ApiSimBossCardStatusNameMap = map[int]string{ + V3ApiSimBossCardStatusPendingActivate: "待激活", + V3ApiSimBossCardStatusActivated: "已激活", + V3ApiSimBossCardStatusStopped: "已停机", + V3ApiSimBossCardStatusTestable: "可测试", + V3ApiSimBossCardStatusStock: "库存", + V3ApiSimBossCardStatusPreCancel: "预销户", + V3ApiSimBossCardStatusCanceled: "已销户", +} + +const ( + V3ApiSimCardTypePlug = 1 + V3ApiSimCardType5X6 = 2 + V3ApiSimCardType2X2 = 3 + V3ApiSimCardTypeMP1 = 4 + V3ApiSimCardTypeMP2 = 5 + V3ApiSimCardTypeMS0 = 6 + V3ApiSimCardTypeMS1 = 7 +) + +var V3ApiSimCardTypeNameMap = map[int]string{ + V3ApiSimCardTypePlug: "插拔", + V3ApiSimCardType5X6: "贴片卡5X6", + V3ApiSimCardType2X2: "贴片卡2X2", + V3ApiSimCardTypeMP1: "插拔卡(MP1)", + V3ApiSimCardTypeMP2: "插拔卡(MP2)", + V3ApiSimCardTypeMS0: "贴片卡(MS0)", + V3ApiSimCardTypeMS1: "贴片卡(MS1)", +} + +const ( + V3ApiSimNetModel3G = 1 + V3ApiSimNetModel2G = 2 + V3ApiSimNetModel4G = 3 + V3ApiSimNetModel5G = 4 + V3ApiSimNetModelNBIoT = 5 + V3ApiSimNetModel5GSA = 6 + V3ApiSimNetModel5GNSA = 7 + V3ApiSimNetModel2G3G = 8 + V3ApiSimNetModelTelecomNB = 9 + V3ApiSimNetModelMobile4G = 10 + V3ApiSimNetModelUnicomNB = 11 + V3ApiSimNetModelUnicom4G = 12 + V3ApiSimNetModelTelecom4G = 13 + V3ApiSimNetModelRedCap = 14 +) + +var V3ApiSimNetModelNameMap = map[int]string{ + V3ApiSimNetModel3G: "3G", + V3ApiSimNetModel2G: "2G", + V3ApiSimNetModel4G: "4G", + V3ApiSimNetModel5G: "5G", + V3ApiSimNetModelNBIoT: "NB-IOT", + V3ApiSimNetModel5GSA: "5G-SA", + V3ApiSimNetModel5GNSA: "5G-NSA", + V3ApiSimNetModel2G3G: "2G/3G", + V3ApiSimNetModelTelecomNB: "电信NB", + V3ApiSimNetModelMobile4G: "移动4G", + V3ApiSimNetModelUnicomNB: "联通NB", + V3ApiSimNetModelUnicom4G: "联通4G", + V3ApiSimNetModelTelecom4G: "电信4G", + V3ApiSimNetModelRedCap: "RedCap", +} diff --git a/server/internal/consts/warning.go b/server/internal/consts/warning.go new file mode 100644 index 0000000..9485d5b --- /dev/null +++ b/server/internal/consts/warning.go @@ -0,0 +1,6 @@ +package consts + +const ( + WarningWechatTemplateIDDefault = "DMDP2PKktdtG1ES_3Ic1JcR0LGELQmWE6LunYyerHCY" + WarningWechatSource = "wechat_mp" +) diff --git a/server/internal/consts/websocket.go b/server/internal/consts/websocket.go new file mode 100644 index 0000000..9c49716 --- /dev/null +++ b/server/internal/consts/websocket.go @@ -0,0 +1,23 @@ +// Package consts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package consts + +// 服务器监控信息 +const ( + MonitorServerHost = "host" + MonitorServerSysLoad = "sysLoad" + MonitorServerCpu = "cpu" + MonitorServerMem = "mem" + MonitorServerDisk = "disk" + MonitorServerNet = "net" + MonitorServerGo = "go" +) + +// WEBSOCKET订阅Tag 服务器监控信息 +const ( + WSTagMonitorServer = "ws:tag:monitor:server" // WEBSOCKET订阅Tag 服务器监控信息 + WSEventMonitorServer = "ws:event:monitor:server:%s" // WEBSOCKET订阅 服务器监控信息 %s in [host,sysLoad,cpu,disk,net,go] +) diff --git a/server/internal/controller/agent/agent_dept.go b/server/internal/controller/agent/agent_dept.go new file mode 100644 index 0000000..538ec13 --- /dev/null +++ b/server/internal/controller/agent/agent_dept.go @@ -0,0 +1,67 @@ +package agent + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) DeptList(ctx context.Context, req *v1.DeptListReq) (res *v1.DeptListRes, err error) { + data, total, err := service.AgentDept().DeptList(ctx, &req.AgentDeptListParam) + if err != nil { + return nil, err + } + return &v1.DeptListRes{PageResult: response.PageResult{Page: 1, PageSize: 5000, Total: total}, Data: data}, nil +} + +func (c *ControllerV1) DeptView(ctx context.Context, req *v1.DeptViewReq) (res *v1.DeptViewRes, err error) { + data, err := service.AgentDept().DeptView(ctx, req.DeptId) + if err != nil { + return nil, err + } + return &v1.DeptViewRes{AgentEnterpriseCustomerModel: *data}, nil +} + +func (c *ControllerV1) DeptSave(ctx context.Context, req *v1.DeptSaveReq) (res *v1.DeptSaveRes, err error) { + deptId, err := service.AgentDept().DeptSave(ctx, &req.AgentDeptSaveParam) + if err != nil { + return nil, err + } + return &v1.DeptSaveRes{DeptId: deptId}, nil +} + +func (c *ControllerV1) DeptDelete(ctx context.Context, req *v1.DeptDeleteReq) (res *v1.DeptDeleteRes, err error) { + err = service.AgentDept().DeptDelete(ctx, req.DeptId) + return &v1.DeptDeleteRes{}, err +} + +func (c *ControllerV1) DeptResetPassword(ctx context.Context, req *v1.DeptResetPasswordReq) (res *v1.DeptResetPasswordRes, err error) { + err = service.AgentDept().DeptResetPassword(ctx, req.DeptId, req.Password) + return &v1.DeptResetPasswordRes{}, err +} + +func (c *ControllerV1) GetDeptApiInfo(ctx context.Context, req *v1.GetDeptApiInfoReq) (res *v1.GetDeptApiInfoRes, err error) { + data, err := service.AgentDept().GetDeptApiInfo(ctx) + if err != nil { + return nil, err + } + return &v1.GetDeptApiInfoRes{AgentDeptApiModel: *data}, nil +} + +func (c *ControllerV1) Scope(ctx context.Context, req *v1.ScopeReq) (res *v1.ScopeRes, err error) { + deptIds, err := service.AgentScope().ScopeDeptIds(ctx) + if err != nil { + return nil, err + } + return &v1.ScopeRes{DeptIds: deptIds}, nil +} + +func (c *ControllerV1) SubCompany(ctx context.Context, req *v1.SubCompanyReq) (res *v1.SubCompanyRes, err error) { + data, err := service.AgentDept().SubCompany(ctx) + if err != nil { + return nil, err + } + return &v1.SubCompanyRes{Data: data}, nil +} diff --git a/server/internal/controller/agent/agent_menu.go b/server/internal/controller/agent/agent_menu.go new file mode 100644 index 0000000..fcff98c --- /dev/null +++ b/server/internal/controller/agent/agent_menu.go @@ -0,0 +1,16 @@ +package agent + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) MenuTree(ctx context.Context, req *v1.MenuTreeReq) (res *v1.MenuTreeRes, err error) { + tree, menuIds, err := service.AgentMenu().AllowedMenuTree(ctx, 0) + if err != nil { + return nil, err + } + return &v1.MenuTreeRes{Items: tree, MenuIds: menuIds}, nil +} diff --git a/server/internal/controller/agent/agent_new.go b/server/internal/controller/agent/agent_new.go new file mode 100644 index 0000000..96824b4 --- /dev/null +++ b/server/internal/controller/agent/agent_new.go @@ -0,0 +1,13 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package agent + +import "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent" + +type ControllerV1 struct{} + +func NewV1() agent.IAgentV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/agent/agent_role.go b/server/internal/controller/agent/agent_role.go new file mode 100644 index 0000000..e90857e --- /dev/null +++ b/server/internal/controller/agent/agent_role.go @@ -0,0 +1,42 @@ +package agent + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) { + data, total, err := service.AgentRole().RoleList(ctx, &req.AgentRoleListParam) + if err != nil { + return nil, err + } + return &v1.RoleListRes{PageResult: response.PageResult{Total: total}, Data: data}, nil +} + +func (c *ControllerV1) RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error) { + data, err := service.AgentRole().RoleView(ctx, req.RoleId) + if err != nil { + return nil, err + } + return &v1.RoleViewRes{AgentRoleViewModel: *data}, nil +} + +func (c *ControllerV1) RoleSave(ctx context.Context, req *v1.RoleSaveReq) (res *v1.RoleSaveRes, err error) { + roleId, err := service.AgentRole().RoleSave(ctx, &req.AgentRoleSaveParam) + if err != nil { + return nil, err + } + return &v1.RoleSaveRes{RoleId: roleId}, nil +} + +func (c *ControllerV1) RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) { + roleIds := req.RoleIds + if req.RoleId != 0 { + roleIds = append(roleIds, req.RoleId) + } + err = service.AgentRole().RoleDelete(ctx, roleIds) + return &v1.RoleDeleteRes{}, err +} diff --git a/server/internal/controller/agent/agent_user.go b/server/internal/controller/agent/agent_user.go new file mode 100644 index 0000000..6c11228 --- /dev/null +++ b/server/internal/controller/agent/agent_user.go @@ -0,0 +1,59 @@ +package agent + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error) { + data, total, err := service.AgentUser().UserList(ctx, &req.AgentUserListParam) + if err != nil { + return nil, err + } + return &v1.UserListRes{PageResult: response.PageResult{Page: req.Page, PageSize: req.PageSize, Total: total}, Data: data}, nil +} + +func (c *ControllerV1) UserView(ctx context.Context, req *v1.UserViewReq) (res *v1.UserViewRes, err error) { + data, err := service.AgentUser().UserView(ctx, req.UserId) + if err != nil { + return nil, err + } + return &v1.UserViewRes{AgentUserViewModel: *data}, nil +} + +func (c *ControllerV1) UserAdd(ctx context.Context, req *v1.UserAddReq) (res *v1.UserAddRes, err error) { + data, err := service.AgentUser().UserSave(ctx, &req.SysUserAddModel) + if err != nil { + return nil, err + } + return &v1.UserAddRes{Data: data}, nil +} + +func (c *ControllerV1) UserUpdate(ctx context.Context, req *v1.UserUpdateReq) (res *v1.UserUpdateRes, err error) { + err = service.AgentUser().UserUpdate(ctx, &req.SysUserUpdateModel) + if err != nil { + return nil, err + } + data, err := service.AgentUser().UserView(ctx, req.UserId) + if err != nil { + return nil, err + } + return &v1.UserUpdateRes{Data: data}, nil +} + +func (c *ControllerV1) UserDelete(ctx context.Context, req *v1.UserDeleteReq) (res *v1.UserDeleteRes, err error) { + userIds := req.UserIds + if req.UserId != 0 { + userIds = append(userIds, req.UserId) + } + err = service.AgentUser().UserDelete(ctx, userIds) + return &v1.UserDeleteRes{}, err +} + +func (c *ControllerV1) UserResetPassword(ctx context.Context, req *v1.UserResetPasswordReq) (res *v1.UserResetPasswordRes, err error) { + err = service.AgentUser().UserResetPassword(ctx, req.UserId, req.Password) + return &v1.UserResetPasswordRes{}, err +} diff --git a/server/internal/controller/agent/t_agent_enterprise.go b/server/internal/controller/agent/t_agent_enterprise.go new file mode 100644 index 0000000..e0aff2c --- /dev/null +++ b/server/internal/controller/agent/t_agent_enterprise.go @@ -0,0 +1,57 @@ +package agent + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看企业客户单位信息列表 +func (c *ControllerV1) TAgentEnterpriseList(ctx context.Context, req *v1.TAgentEnterpriseListReq) (res *v1.TAgentEnterpriseListRes, err error) { + list, totalCount, err := service.AgentEnterprise().List(ctx, &req.TAgentEnterpriseListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TAgentEnterpriseListModel{} + } + + res = new(v1.TAgentEnterpriseListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出企业客户单位信息列表 +func (c *ControllerV1) TAgentEnterpriseExport(ctx context.Context, req *v1.TAgentEnterpriseExportReq) (res *v1.TAgentEnterpriseExportRes, err error) { + err = service.AgentEnterprise().Export(ctx, &req.TAgentEnterpriseListParam) + return +} + +// Edit 更新企业客户单位信息 +func (c *ControllerV1) TAgentEnterpriseEdit(ctx context.Context, req *v1.TAgentEnterpriseEditReq) (res *v1.TAgentEnterpriseEditRes, err error) { + err = service.AgentEnterprise().Edit(ctx, &req.TAgentEnterpriseEditParam) + return +} + +// View 获取指定企业客户单位信息信息 +func (c *ControllerV1) TAgentEnterpriseView(ctx context.Context, req *v1.TAgentEnterpriseViewReq) (res *v1.TAgentEnterpriseViewRes, err error) { + data, err := service.AgentEnterprise().View(ctx, &req.TAgentEnterpriseViewParam) + if err != nil { + return + } + + res = new(v1.TAgentEnterpriseViewRes) + res.TAgentEnterpriseViewModel = data + return +} + +// Delete 删除企业客户单位信息 +func (c *ControllerV1) TAgentEnterpriseDelete(ctx context.Context, req *v1.TAgentEnterpriseDeleteReq) (res *v1.TAgentEnterpriseDeleteRes, err error) { + err = service.AgentEnterprise().Delete(ctx, &req.TAgentEnterpriseDeleteParam) + return +} diff --git a/server/internal/controller/agent/t_api.go b/server/internal/controller/agent/t_api.go new file mode 100644 index 0000000..8bca1d9 --- /dev/null +++ b/server/internal/controller/agent/t_api.go @@ -0,0 +1,57 @@ +package agent + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看API集成列表 +func (c *ControllerV1) TApiList(ctx context.Context, req *v1.TApiListReq) (res *v1.TApiListRes, err error) { + list, totalCount, err := service.AgentTApi().List(ctx, &req.TApiListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TApiListModel{} + } + + res = new(v1.TApiListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出API集成列表 +func (c *ControllerV1) TApiExport(ctx context.Context, req *v1.TApiExportReq) (res *v1.TApiExportRes, err error) { + err = service.AgentTApi().Export(ctx, &req.TApiListParam) + return +} + +// Edit 更新API集成 +func (c *ControllerV1) TApiEdit(ctx context.Context, req *v1.TApiEditReq) (res *v1.TApiEditRes, err error) { + err = service.AgentTApi().Edit(ctx, &req.TApiEditParam) + return +} + +// View 获取指定API集成信息 +func (c *ControllerV1) TApiView(ctx context.Context, req *v1.TApiViewReq) (res *v1.TApiViewRes, err error) { + data, err := service.AgentTApi().View(ctx, &req.TApiViewParam) + if err != nil { + return + } + + res = new(v1.TApiViewRes) + res.TApiViewModel = data + return +} + +// Delete 删除API集成 +func (c *ControllerV1) TApiDelete(ctx context.Context, req *v1.TApiDeleteReq) (res *v1.TApiDeleteRes, err error) { + err = service.AgentTApi().Delete(ctx, &req.TApiDeleteParam) + return +} diff --git a/server/internal/controller/agent/t_api_group.go b/server/internal/controller/agent/t_api_group.go new file mode 100644 index 0000000..6bb7865 --- /dev/null +++ b/server/internal/controller/agent/t_api_group.go @@ -0,0 +1,60 @@ +package agent + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// TApiGroupList 查询开放接口权限组列表。 +func (c *ControllerV1) TApiGroupList(ctx context.Context, req *v1.TApiGroupListReq) (res *v1.TApiGroupListRes, err error) { + list, totalCount, err := service.AgentTApiGroup().List(ctx, &req.TApiGroupListParam) + if err != nil { + return + } + if list == nil { + list = []*model.TApiGroupListModel{} + } + res = new(v1.TApiGroupListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// TApiGroupExport 导出开放接口权限组列表。 +func (c *ControllerV1) TApiGroupExport(ctx context.Context, req *v1.TApiGroupExportReq) (res *v1.TApiGroupExportRes, err error) { + err = service.AgentTApiGroup().Export(ctx, &req.TApiGroupListParam) + return +} + +// TApiGroupEdit 新增或修改开放接口权限组,并维护权限组绑定的接口资源。 +func (c *ControllerV1) TApiGroupEdit(ctx context.Context, req *v1.TApiGroupEditReq) (res *v1.TApiGroupEditRes, err error) { + err = service.AgentTApiGroup().Edit(ctx, &req.TApiGroupEditParam) + return +} + +// TApiGroupView 查询开放接口权限组详情。 +func (c *ControllerV1) TApiGroupView(ctx context.Context, req *v1.TApiGroupViewReq) (res *v1.TApiGroupViewRes, err error) { + data, err := service.AgentTApiGroup().View(ctx, &req.TApiGroupViewParam) + if err != nil { + return + } + res = new(v1.TApiGroupViewRes) + res.TApiGroupViewModel = data + return +} + +// TApiGroupDelete 删除开放接口权限组,并清理对应资源关联。 +func (c *ControllerV1) TApiGroupDelete(ctx context.Context, req *v1.TApiGroupDeleteReq) (res *v1.TApiGroupDeleteRes, err error) { + err = service.AgentTApiGroup().Delete(ctx, &req.TApiGroupDeleteParam) + return +} + +// TApiGroupStatus 更新开放接口权限组启停状态。 +func (c *ControllerV1) TApiGroupStatus(ctx context.Context, req *v1.TApiGroupStatusReq) (res *v1.TApiGroupStatusRes, err error) { + err = service.AgentTApiGroup().Status(ctx, &req.TApiGroupStatusParam) + return +} diff --git a/server/internal/controller/agent/t_api_resource.go b/server/internal/controller/agent/t_api_resource.go new file mode 100644 index 0000000..5dd139b --- /dev/null +++ b/server/internal/controller/agent/t_api_resource.go @@ -0,0 +1,69 @@ +package agent + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "github.com/gogf/gf/v2/frame/g" +) + +// TApiResourceList 查询开放接口资源列表。 +func (c *ControllerV1) TApiResourceList(ctx context.Context, req *v1.TApiResourceListReq) (res *v1.TApiResourceListRes, err error) { + list, totalCount, err := service.AgentTApiResource().List(ctx, &req.TApiResourceListParam) + if err != nil { + return + } + if list == nil { + list = []*model.TApiResourceListModel{} + } + res = new(v1.TApiResourceListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// TApiResourceExport 导出开放接口资源列表。 +func (c *ControllerV1) TApiResourceExport(ctx context.Context, req *v1.TApiResourceExportReq) (res *v1.TApiResourceExportRes, err error) { + err = service.AgentTApiResource().Export(ctx, &req.TApiResourceListParam) + return +} + +// TApiResourceEdit 新增或修改开放接口资源。 +func (c *ControllerV1) TApiResourceEdit(ctx context.Context, req *v1.TApiResourceEditReq) (res *v1.TApiResourceEditRes, err error) { + param := req.TApiResourceEditParam + g.Log().Info(ctx, "TApiResourceEdit", param) + if r := g.RequestFromCtx(ctx); r != nil { + if err = r.Parse(¶m); err != nil { + return + } + } + err = service.AgentTApiResource().Edit(ctx, ¶m) + return +} + +// TApiResourceView 查询开放接口资源详情。 +func (c *ControllerV1) TApiResourceView(ctx context.Context, req *v1.TApiResourceViewReq) (res *v1.TApiResourceViewRes, err error) { + data, err := service.AgentTApiResource().View(ctx, &req.TApiResourceViewParam) + if err != nil { + return + } + res = new(v1.TApiResourceViewRes) + res.TApiResourceViewModel = data + return +} + +// TApiResourceDelete 删除开放接口资源,并清理权限组资源关联。 +func (c *ControllerV1) TApiResourceDelete(ctx context.Context, req *v1.TApiResourceDeleteReq) (res *v1.TApiResourceDeleteRes, err error) { + err = service.AgentTApiResource().Delete(ctx, &req.TApiResourceDeleteParam) + return +} + +// TApiResourceStatus 更新开放接口资源启停状态。 +func (c *ControllerV1) TApiResourceStatus(ctx context.Context, req *v1.TApiResourceStatusReq) (res *v1.TApiResourceStatusRes, err error) { + err = service.AgentTApiResource().Status(ctx, &req.TApiResourceStatusParam) + return +} diff --git a/server/internal/controller/agent/t_cust_withdraw_account.go b/server/internal/controller/agent/t_cust_withdraw_account.go new file mode 100644 index 0000000..213f4da --- /dev/null +++ b/server/internal/controller/agent/t_cust_withdraw_account.go @@ -0,0 +1,63 @@ +package agent + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看客户提现账户表列表 +func (c *ControllerV1) TCustWithdrawAccountList(ctx context.Context, req *v1.TCustWithdrawAccountListReq) (res *v1.TCustWithdrawAccountListRes, err error) { + list, totalCount, err := service.AgentTCustWithdrawAccount().List(ctx, &req.TCustWithdrawAccountListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TCustWithdrawAccountListModel{} + } + + res = new(v1.TCustWithdrawAccountListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出客户提现账户表列表 +func (c *ControllerV1) TCustWithdrawAccountExport(ctx context.Context, req *v1.TCustWithdrawAccountExportReq) (res *v1.TCustWithdrawAccountExportRes, err error) { + err = service.AgentTCustWithdrawAccount().Export(ctx, &req.TCustWithdrawAccountListParam) + return +} + +// Edit 更新客户提现账户表 +func (c *ControllerV1) TCustWithdrawAccountEdit(ctx context.Context, req *v1.TCustWithdrawAccountEditReq) (res *v1.TCustWithdrawAccountEditRes, err error) { + err = service.AgentTCustWithdrawAccount().Edit(ctx, &req.TCustWithdrawAccountEditParam) + return +} + +// View 获取指定客户提现账户表信息 +func (c *ControllerV1) TCustWithdrawAccountView(ctx context.Context, req *v1.TCustWithdrawAccountViewReq) (res *v1.TCustWithdrawAccountViewRes, err error) { + data, err := service.AgentTCustWithdrawAccount().View(ctx, &req.TCustWithdrawAccountViewParam) + if err != nil { + return + } + + res = new(v1.TCustWithdrawAccountViewRes) + res.TCustWithdrawAccountViewModel = data + return +} + +// Delete 删除客户提现账户表 +func (c *ControllerV1) TCustWithdrawAccountDelete(ctx context.Context, req *v1.TCustWithdrawAccountDeleteReq) (res *v1.TCustWithdrawAccountDeleteRes, err error) { + err = service.AgentTCustWithdrawAccount().Delete(ctx, &req.TCustWithdrawAccountDeleteParam) + return +} + +// Status 更新客户提现账户表状态 +func (c *ControllerV1) TCustWithdrawAccountStatus(ctx context.Context, req *v1.TCustWithdrawAccountStatusReq) (res *v1.TCustWithdrawAccountStatusRes, err error) { + err = service.AgentTCustWithdrawAccount().Status(ctx, &req.TCustWithdrawAccountStatusParam) + return +} diff --git a/server/internal/controller/common/common.go b/server/internal/controller/common/common.go new file mode 100644 index 0000000..76ec691 --- /dev/null +++ b/server/internal/controller/common/common.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package common diff --git a/server/internal/controller/common/common_new.go b/server/internal/controller/common/common_new.go new file mode 100644 index 0000000..c5bbce9 --- /dev/null +++ b/server/internal/controller/common/common_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package common + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common" +) + +type ControllerV1 struct{} + +func NewV1() common.ICommonV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/common/common_v1_batchExecutionLog.go b/server/internal/controller/common/common_v1_batchExecutionLog.go new file mode 100644 index 0000000..649fb9c --- /dev/null +++ b/server/internal/controller/common/common_v1_batchExecutionLog.go @@ -0,0 +1,53 @@ +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) BatchExecutionLogList(ctx context.Context, req *v1.BatchExecutionLogListReq) (res *v1.BatchExecutionLogListRes, err error) { + list, totalCount, err := service.CommonBatchExecutionLog().List(ctx, &req.BatchExecutionLogListParam) + if err != nil { + return + } + if list == nil { + list = []*model.BatchExecutionLogListModel{} + } + + res = new(v1.BatchExecutionLogListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +func (c *ControllerV1) BatchExecutionLogSummary(ctx context.Context, req *v1.BatchExecutionLogSummaryReq) (res *v1.BatchExecutionLogSummaryRes, err error) { + data, err := service.CommonBatchExecutionLog().Summary(ctx, &req.BatchExecutionLogDetailParam) + if err != nil { + return + } + + res = new(v1.BatchExecutionLogSummaryRes) + res.BatchExecutionLogDetailModel = data + return +} + +func (c *ControllerV1) BatchExecutionLogDetailList(ctx context.Context, req *v1.BatchExecutionLogDetailListReq) (res *v1.BatchExecutionLogDetailListRes, err error) { + list, totalCount, err := service.CommonBatchExecutionLog().DetailList(ctx, &req.BatchDetailListParam) + if err != nil { + return + } + if list == nil { + list = []*model.BatchDetailListModel{} + } + + res = new(v1.BatchExecutionLogDetailListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} diff --git a/server/internal/controller/common/common_v1_batchMain.go b/server/internal/controller/common/common_v1_batchMain.go new file mode 100644 index 0000000..4b5a1fb --- /dev/null +++ b/server/internal/controller/common/common_v1_batchMain.go @@ -0,0 +1,108 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看批次主表列表 +func (c *ControllerV1) BatchMainList(ctx context.Context, req *v1.BatchMainListReq) (res *v1.BatchMainListRes, err error) { + list, totalCount, err := service.CommonBatchMain().List(ctx, &req.BatchMainListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.BatchMainListModel{} + } + + res = new(v1.BatchMainListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +func (c *ControllerV1) BatchMainSuccessList(ctx context.Context, req *v1.BatchMainSuccessListReq) (res *v1.BatchMainSuccessListRes, err error) { + list, totalCount, err := service.CommonBatchMain().SuccessList(ctx, &req.BatchMainSuccessListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.BatchMainSuccessListModel{} + } + + res = new(v1.BatchMainSuccessListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +func (c *ControllerV1) BatchMainCards(ctx context.Context, req *v1.BatchMainCardsReq) (res *v1.BatchMainCardsRes, err error) { + list, totalCount, err := service.CommonBatchMain().ListCards(ctx, &req.BatchCardListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.BatchCardListModel{} + } + + res = new(v1.BatchMainCardsRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出批次主表列表 +func (c *ControllerV1) BatchMainExport(ctx context.Context, req *v1.BatchMainExportReq) (res *v1.BatchMainExportRes, err error) { + err = service.CommonBatchMain().Export(ctx, &req.BatchMainListParam) + return +} + +// Edit 更新批次主表 +func (c *ControllerV1) BatchMainEdit(ctx context.Context, req *v1.BatchMainEditReq) (res *v1.BatchMainEditRes, err error) { + err = service.CommonBatchMain().Edit(ctx, &req.BatchMainEditParam) + return +} + +// View 获取指定批次主表信息 +func (c *ControllerV1) BatchMainView(ctx context.Context, req *v1.BatchMainViewReq) (res *v1.BatchMainViewRes, err error) { + data, err := service.CommonBatchMain().View(ctx, &req.BatchMainViewParam) + if err != nil { + return + } + + res = new(v1.BatchMainViewRes) + res.BatchMainViewModel = data + return +} + +// Delete 删除批次主表 +func (c *ControllerV1) BatchMainDelete(ctx context.Context, req *v1.BatchMainDeleteReq) (res *v1.BatchMainDeleteRes, err error) { + err = service.CommonBatchMain().Delete(ctx, &req.BatchMainDeleteParam) + return +} + +func (c *ControllerV1) BatchMainRequeue(ctx context.Context, req *v1.BatchMainRequeueReq) (res *v1.BatchMainRequeueRes, err error) { + data, err := service.CommonBatchMain().Requeue(ctx, &req.BatchMainRequeueParam) + if err != nil { + return nil, err + } + return &v1.BatchMainRequeueRes{BatchMainRequeueModel: data}, nil +} diff --git a/server/internal/controller/common/common_v1_tagentbalance.go b/server/internal/controller/common/common_v1_tagentbalance.go new file mode 100644 index 0000000..0ca1750 --- /dev/null +++ b/server/internal/controller/common/common_v1_tagentbalance.go @@ -0,0 +1,122 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看企业客户财务信息列表 +func (c *ControllerV1) TAgentBalanceList(ctx context.Context, req *v1.TAgentBalanceListReq) (res *v1.TAgentBalanceListRes, err error) { + list, totalCount, err := service.CommonAgentBalance().List(ctx, &req.TAgentBalanceListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TAgentBalanceListModel{} + } + + res = new(v1.TAgentBalanceListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出企业客户财务信息列表 +func (c *ControllerV1) TAgentBalanceExport(ctx context.Context, req *v1.TAgentBalanceExportReq) (res *v1.TAgentBalanceExportRes, err error) { + err = service.CommonAgentBalance().Export(ctx, &req.TAgentBalanceListParam) + return +} + +// Edit 更新企业客户财务信息 +func (c *ControllerV1) TAgentBalanceEdit(ctx context.Context, req *v1.TAgentBalanceEditReq) (res *v1.TAgentBalanceEditRes, err error) { + err = service.CommonAgentBalance().Edit(ctx, &req.TAgentBalanceEditParam) + return +} + +// View 获取指定企业客户财务信息信息 +func (c *ControllerV1) TAgentBalanceView(ctx context.Context, req *v1.TAgentBalanceViewReq) (res *v1.TAgentBalanceViewRes, err error) { + data, err := service.CommonAgentBalance().View(ctx, &req.TAgentBalanceViewParam) + if err != nil { + return + } + + res = new(v1.TAgentBalanceViewRes) + res.TAgentBalanceViewModel = data + return +} + +// Delete 删除企业客户财务信息 +func (c *ControllerV1) TAgentBalanceDelete(ctx context.Context, req *v1.TAgentBalanceDeleteReq) (res *v1.TAgentBalanceDeleteRes, err error) { + err = service.CommonAgentBalance().Delete(ctx, &req.TAgentBalanceDeleteParam) + return +} + +// Status 更新企业客户财务信息状态 +func (c *ControllerV1) TAgentBalanceStatus(ctx context.Context, req *v1.TAgentBalanceStatusReq) (res *v1.TAgentBalanceStatusRes, err error) { + err = service.CommonAgentBalance().Status(ctx, &req.TAgentBalanceStatusParam) + return +} + +func (c *ControllerV1) TAgentBalanceAccountTrend(ctx context.Context, req *v1.TAgentBalanceAccountTrendReq) (res *v1.TAgentBalanceAccountTrendRes, err error) { + data, err := service.CommonAgentBalance().AccountTrend(ctx, &req.TAgentBalanceTrendParam) + if err != nil { + return + } + res = new(v1.TAgentBalanceAccountTrendRes) + res.TAgentBalanceChartData = data + return +} + +func (c *ControllerV1) TAgentBalanceGetAccountBalance(ctx context.Context, req *v1.TAgentBalanceGetAccountBalanceReq) (res *v1.TAgentBalanceGetAccountBalanceRes, err error) { + data, err := service.CommonAgentBalance().GetAccountBalance(ctx, &req.TAgentBalanceTrendParam) + if err != nil { + return + } + res = new(v1.TAgentBalanceGetAccountBalanceRes) + res.TAgentBalanceChartData = data + return +} + +func (c *ControllerV1) TAgentBalanceBalanceTransferApply(ctx context.Context, req *v1.TAgentBalanceBalanceTransferApplyReq) (res *v1.TAgentBalanceBalanceTransferApplyRes, err error) { + data, err := service.CommonAgentBalance().BalanceTransferApply(ctx, &req.TAgentBalanceTransferApplyParam) + if err != nil { + return + } + res = new(v1.TAgentBalanceBalanceTransferApplyRes) + res.TAgentBalanceTransferApplyModel = data + return +} + +func (c *ControllerV1) TAgentBalanceBalanceTransferAudit(ctx context.Context, req *v1.TAgentBalanceBalanceTransferAuditReq) (res *v1.TAgentBalanceBalanceTransferAuditRes, err error) { + err = service.CommonAgentBalance().BalanceTransferAudit(ctx, &req.TAgentBalanceTransferAuditParam) + if err != nil { + return + } + res = new(v1.TAgentBalanceBalanceTransferAuditRes) + return +} + +// TAgentBalanceSettleCommission 按账期区间结算分润并同步可提现金额。 +func (c *ControllerV1) TAgentBalanceSettleCommission(ctx context.Context, req *v1.TAgentBalanceSettleCommissionReq) (res *v1.TAgentBalanceSettleCommissionRes, err error) { + data, err := service.CommonAgentBalance().SettleCommissionByPeriod(ctx, &model.TAgentBalanceCommissionSettlementParam{ + StartPeriod: req.StartPeriod, + EndPeriod: req.EndPeriod, + }) + if err != nil { + return + } + res = new(v1.TAgentBalanceSettleCommissionRes) + res.TAgentBalanceCommissionSettlementResult = data + return +} diff --git a/server/internal/controller/common/common_v1_tbalancedetail.go b/server/internal/controller/common/common_v1_tbalancedetail.go new file mode 100644 index 0000000..4390ae9 --- /dev/null +++ b/server/internal/controller/common/common_v1_tbalancedetail.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看余额明细表列表 +func (c *ControllerV1) TBalanceDetailList(ctx context.Context, req *v1.TBalanceDetailListReq) (res *v1.TBalanceDetailListRes, err error) { + list, totalCount, err := service.CommonTBalanceDetail().List(ctx, &req.TBalanceDetailListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TBalanceDetailListModel{} + } + + res = new(v1.TBalanceDetailListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出余额明细表列表 +func (c *ControllerV1) TBalanceDetailExport(ctx context.Context, req *v1.TBalanceDetailExportReq) (res *v1.TBalanceDetailExportRes, err error) { + err = service.CommonTBalanceDetail().Export(ctx, &req.TBalanceDetailListParam) + return +} + +// Edit 更新余额明细表 +func (c *ControllerV1) TBalanceDetailEdit(ctx context.Context, req *v1.TBalanceDetailEditReq) (res *v1.TBalanceDetailEditRes, err error) { + err = service.CommonTBalanceDetail().Edit(ctx, &req.TBalanceDetailEditParam) + return +} + +// View 获取指定余额明细表信息 +func (c *ControllerV1) TBalanceDetailView(ctx context.Context, req *v1.TBalanceDetailViewReq) (res *v1.TBalanceDetailViewRes, err error) { + data, err := service.CommonTBalanceDetail().View(ctx, &req.TBalanceDetailViewParam) + if err != nil { + return + } + + res = new(v1.TBalanceDetailViewRes) + res.TBalanceDetailViewModel = data + return +} + +// Delete 删除余额明细表 +func (c *ControllerV1) TBalanceDetailDelete(ctx context.Context, req *v1.TBalanceDetailDeleteReq) (res *v1.TBalanceDetailDeleteRes, err error) { + err = service.CommonTBalanceDetail().Delete(ctx, &req.TBalanceDetailDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tconsumeaccountmonth_bill.go b/server/internal/controller/common/common_v1_tconsumeaccountmonth_bill.go new file mode 100644 index 0000000..508f9d4 --- /dev/null +++ b/server/internal/controller/common/common_v1_tconsumeaccountmonth_bill.go @@ -0,0 +1,87 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看消费账户月账单表列表 +func (c *ControllerV1) TConsumeAccountMonthBillList(ctx context.Context, req *v1.TConsumeAccountMonthBillListReq) (res *v1.TConsumeAccountMonthBillListRes, err error) { + list, totalCount, err := service.CommonConsumeAccountMonthBill().List(ctx, &req.TConsumeAccountMonthBillListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TConsumeAccountMonthBillListModel{} + } + + res = new(v1.TConsumeAccountMonthBillListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出消费账户月账单表列表 +func (c *ControllerV1) TConsumeAccountMonthBillExport(ctx context.Context, req *v1.TConsumeAccountMonthBillExportReq) (res *v1.TConsumeAccountMonthBillExportRes, err error) { + err = service.CommonConsumeAccountMonthBill().Export(ctx, &req.TConsumeAccountMonthBillListParam) + return +} + +// Edit 更新消费账户月账单表 +func (c *ControllerV1) TConsumeAccountMonthBillEdit(ctx context.Context, req *v1.TConsumeAccountMonthBillEditReq) (res *v1.TConsumeAccountMonthBillEditRes, err error) { + err = service.CommonConsumeAccountMonthBill().Edit(ctx, &req.TConsumeAccountMonthBillEditParam) + return +} + +// View 获取指定消费账户月账单表信息 +func (c *ControllerV1) TConsumeAccountMonthBillView(ctx context.Context, req *v1.TConsumeAccountMonthBillViewReq) (res *v1.TConsumeAccountMonthBillViewRes, err error) { + data, err := service.CommonConsumeAccountMonthBill().View(ctx, &req.TConsumeAccountMonthBillViewParam) + if err != nil { + return + } + + res = new(v1.TConsumeAccountMonthBillViewRes) + res.TConsumeAccountMonthBillViewModel = data + return +} + +// Delete 删除消费账户月账单表 +func (c *ControllerV1) TConsumeAccountMonthBillDelete(ctx context.Context, req *v1.TConsumeAccountMonthBillDeleteReq) (res *v1.TConsumeAccountMonthBillDeleteRes, err error) { + err = service.CommonConsumeAccountMonthBill().Delete(ctx, &req.TConsumeAccountMonthBillDeleteParam) + return +} + +// Settle 按账期统计消费账户月账单 +func (c *ControllerV1) TConsumeAccountMonthBillSettle(ctx context.Context, req *v1.TConsumeAccountMonthBillSettleReq) (res *v1.TConsumeAccountMonthBillSettleRes, err error) { + data, err := service.CommonConsumeAccountMonthBill().SettleConsumeAccountMonthBill(ctx, &req.TConsumeAccountMonthBillSettleParam) + if err != nil { + return + } + + res = new(v1.TConsumeAccountMonthBillSettleRes) + res.TConsumeAccountMonthBillSettleResult = data + return +} + +// GetConsumptionBillSummary 获取上月消费账单汇总信息 +func (c *ControllerV1) TConsumeAccountMonthBillGetConsumptionBillSummary(ctx context.Context, req *v1.TConsumeAccountMonthBillGetConsumptionBillSummaryReq) (res *v1.TConsumeAccountMonthBillGetConsumptionBillSummaryRes, err error) { + data, err := service.CommonConsumeAccountMonthBill().GetConsumptionBillSummary(ctx, req.Month) + if err != nil { + return + } + + res = new(v1.TConsumeAccountMonthBillGetConsumptionBillSummaryRes) + res.TConsumptionBillSummaryModel = data + return +} diff --git a/server/internal/controller/common/common_v1_tcreditdetail.go b/server/internal/controller/common/common_v1_tcreditdetail.go new file mode 100644 index 0000000..0be8961 --- /dev/null +++ b/server/internal/controller/common/common_v1_tcreditdetail.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看信用额度明细表列表 +func (c *ControllerV1) TCreditDetailList(ctx context.Context, req *v1.TCreditDetailListReq) (res *v1.TCreditDetailListRes, err error) { + list, totalCount, err := service.CommonTCreditDetail().List(ctx, &req.TCreditDetailListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TCreditDetailListModel{} + } + + res = new(v1.TCreditDetailListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出信用额度明细表列表 +func (c *ControllerV1) TCreditDetailExport(ctx context.Context, req *v1.TCreditDetailExportReq) (res *v1.TCreditDetailExportRes, err error) { + err = service.CommonTCreditDetail().Export(ctx, &req.TCreditDetailListParam) + return +} + +// Edit 更新信用额度明细表 +func (c *ControllerV1) TCreditDetailEdit(ctx context.Context, req *v1.TCreditDetailEditReq) (res *v1.TCreditDetailEditRes, err error) { + err = service.CommonTCreditDetail().Edit(ctx, &req.TCreditDetailEditParam) + return +} + +// View 获取指定信用额度明细表信息 +func (c *ControllerV1) TCreditDetailView(ctx context.Context, req *v1.TCreditDetailViewReq) (res *v1.TCreditDetailViewRes, err error) { + data, err := service.CommonTCreditDetail().View(ctx, &req.TCreditDetailViewParam) + if err != nil { + return + } + + res = new(v1.TCreditDetailViewRes) + res.TCreditDetailViewModel = data + return +} + +// Delete 删除信用额度明细表 +func (c *ControllerV1) TCreditDetailDelete(ctx context.Context, req *v1.TCreditDetailDeleteReq) (res *v1.TCreditDetailDeleteRes, err error) { + err = service.CommonTCreditDetail().Delete(ctx, &req.TCreditDetailDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tfinanceapply.go b/server/internal/controller/common/common_v1_tfinanceapply.go new file mode 100644 index 0000000..41b2dd3 --- /dev/null +++ b/server/internal/controller/common/common_v1_tfinanceapply.go @@ -0,0 +1,58 @@ +package common + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" +) + +// List 查看财务申请表列表 +func (c *ControllerV1) TFinanceApplyList(ctx context.Context, req *v1.TFinanceApplyListReq) (res *v1.TFinanceApplyListRes, err error) { + list, totalCount, err := service.CommonTFinanceApply().List(ctx, &req.TFinanceApplyListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TFinanceApplyListModel{} + } + + res = new(v1.TFinanceApplyListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出财务申请表列表 +func (c *ControllerV1) TFinanceApplyExport(ctx context.Context, req *v1.TFinanceApplyExportReq) (res *v1.TFinanceApplyExportRes, err error) { + err = service.CommonTFinanceApply().Export(ctx, &req.TFinanceApplyListParam) + return +} + +// Edit 更新财务申请表 +func (c *ControllerV1) TFinanceApplyEdit(ctx context.Context, req *v1.TFinanceApplyEditReq) (res *v1.TFinanceApplyEditRes, err error) { + err = service.CommonTFinanceApply().Edit(ctx, &req.TFinanceApplyEditParam) + return +} + +// View 获取指定财务申请表信息 +func (c *ControllerV1) TFinanceApplyView(ctx context.Context, req *v1.TFinanceApplyViewReq) (res *v1.TFinanceApplyViewRes, err error) { + data, err := service.CommonTFinanceApply().View(ctx, &req.TFinanceApplyViewParam) + if err != nil { + return + } + + res = new(v1.TFinanceApplyViewRes) + res.TFinanceApplyViewModel = data + return +} + +// Delete 删除财务申请表 +func (c *ControllerV1) TFinanceApplyDelete(ctx context.Context, req *v1.TFinanceApplyDeleteReq) (res *v1.TFinanceApplyDeleteRes, err error) { + err = service.CommonTFinanceApply().Delete(ctx, &req.TFinanceApplyDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tfinanceauditrecord.go b/server/internal/controller/common/common_v1_tfinanceauditrecord.go new file mode 100644 index 0000000..a31f6b9 --- /dev/null +++ b/server/internal/controller/common/common_v1_tfinanceauditrecord.go @@ -0,0 +1,58 @@ +package common + +import ( + "context" + // v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/tfinanceauditrecord/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看财务审核记录表列表 +func (c *ControllerV1) TFinanceAuditRecordList(ctx context.Context, req *v1.TFinanceAuditRecordListReq) (res *v1.TFinanceAuditRecordListRes, err error) { + list, totalCount, err := service.CommonTFinanceAuditRecord().List(ctx, &req.TFinanceAuditRecordListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TFinanceAuditRecordListModel{} + } + + res = new(v1.TFinanceAuditRecordListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出财务审核记录表列表 +func (c *ControllerV1) TFinanceAuditRecordExport(ctx context.Context, req *v1.TFinanceAuditRecordExportReq) (res *v1.TFinanceAuditRecordExportRes, err error) { + err = service.CommonTFinanceAuditRecord().Export(ctx, &req.TFinanceAuditRecordListParam) + return +} + +// Edit 更新财务审核记录表 +func (c *ControllerV1) TFinanceAuditRecordEdit(ctx context.Context, req *v1.TFinanceAuditRecordEditReq) (res *v1.TFinanceAuditRecordEditRes, err error) { + err = service.CommonTFinanceAuditRecord().Edit(ctx, &req.TFinanceAuditRecordEditParam) + return +} + +// View 获取指定财务审核记录表信息 +func (c *ControllerV1) TFinanceAuditRecordView(ctx context.Context, req *v1.TFinanceAuditRecordViewReq) (res *v1.TFinanceAuditRecordViewRes, err error) { + data, err := service.CommonTFinanceAuditRecord().View(ctx, &req.TFinanceAuditRecordViewParam) + if err != nil { + return + } + + res = new(v1.TFinanceAuditRecordViewRes) + res.TFinanceAuditRecordViewModel = data + return +} + +// Delete 删除财务审核记录表 +func (c *ControllerV1) TFinanceAuditRecordDelete(ctx context.Context, req *v1.TFinanceAuditRecordDeleteReq) (res *v1.TFinanceAuditRecordDeleteRes, err error) { + err = service.CommonTFinanceAuditRecord().Delete(ctx, &req.TFinanceAuditRecordDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tfincommissiondetail.go b/server/internal/controller/common/common_v1_tfincommissiondetail.go new file mode 100644 index 0000000..2e4bf18 --- /dev/null +++ b/server/internal/controller/common/common_v1_tfincommissiondetail.go @@ -0,0 +1,87 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看分润明细表列表 +func (c *ControllerV1) TFinCommissionDetailList(ctx context.Context, req *v1.TFinCommissionDetailListReq) (res *v1.TFinCommissionDetailListRes, err error) { + list, totalCount, err := service.CommonTFinCommissionDetail().List(ctx, &req.TFinCommissionDetailListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TFinCommissionDetailListModel{} + } + + res = new(v1.TFinCommissionDetailListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出分润明细表列表 +func (c *ControllerV1) TFinCommissionDetailExport(ctx context.Context, req *v1.TFinCommissionDetailExportReq) (res *v1.TFinCommissionDetailExportRes, err error) { + err = service.CommonTFinCommissionDetail().Export(ctx, &req.TFinCommissionDetailListParam) + return +} + +// Edit 更新分润明细表 +func (c *ControllerV1) TFinCommissionDetailEdit(ctx context.Context, req *v1.TFinCommissionDetailEditReq) (res *v1.TFinCommissionDetailEditRes, err error) { + err = service.CommonTFinCommissionDetail().Edit(ctx, &req.TFinCommissionDetailEditParam) + return +} + +// View 获取指定分润明细表信息 +func (c *ControllerV1) TFinCommissionDetailView(ctx context.Context, req *v1.TFinCommissionDetailViewReq) (res *v1.TFinCommissionDetailViewRes, err error) { + data, err := service.CommonTFinCommissionDetail().View(ctx, &req.TFinCommissionDetailViewParam) + if err != nil { + return + } + + res = new(v1.TFinCommissionDetailViewRes) + res.TFinCommissionDetailViewModel = data + return +} + +// Delete 删除分润明细表 +func (c *ControllerV1) TFinCommissionDetailDelete(ctx context.Context, req *v1.TFinCommissionDetailDeleteReq) (res *v1.TFinCommissionDetailDeleteRes, err error) { + err = service.CommonTFinCommissionDetail().Delete(ctx, &req.TFinCommissionDetailDeleteParam) + return +} + +// GetCommissionOverview 获取分层分润概览 +func (c *ControllerV1) TFinCommissionDetailGetCommissionOverview(ctx context.Context, req *v1.TFinCommissionDetailGetCommissionOverviewReq) (res *v1.TFinCommissionDetailGetCommissionOverviewRes, err error) { + data, err := service.CommonTFinCommissionDetail().GetCommissionOverview(ctx, &req.TCommissionOverviewParam) + if err != nil { + return + } + + res = new(v1.TFinCommissionDetailGetCommissionOverviewRes) + res.TCommissionOverviewModel = data + return +} + +// GetLevelSummary 获取层级汇总表 +func (c *ControllerV1) TFinCommissionDetailGetLevelSummary(ctx context.Context, req *v1.TFinCommissionDetailGetLevelSummaryReq) (res *v1.TFinCommissionDetailGetLevelSummaryRes, err error) { + data, err := service.CommonTFinCommissionDetail().GetLevelSummary(ctx, &req.TLevelSummaryParam) + if err != nil { + return + } + + res = new(v1.TFinCommissionDetailGetLevelSummaryRes) + res.TLevelSummaryModel = data + return +} diff --git a/server/internal/controller/common/common_v1_tfinwithdrawablechange.go b/server/internal/controller/common/common_v1_tfinwithdrawablechange.go new file mode 100644 index 0000000..6a4ff19 --- /dev/null +++ b/server/internal/controller/common/common_v1_tfinwithdrawablechange.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看可提现变动明细表列表 +func (c *ControllerV1) TFinWithdrawableChangeList(ctx context.Context, req *v1.TFinWithdrawableChangeListReq) (res *v1.TFinWithdrawableChangeListRes, err error) { + list, totalCount, err := service.CommonTFinWithdrawableChange().List(ctx, &req.TFinWithdrawableChangeListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TFinWithdrawableChangeListModel{} + } + + res = new(v1.TFinWithdrawableChangeListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出可提现变动明细表列表 +func (c *ControllerV1) TFinWithdrawableChangeExport(ctx context.Context, req *v1.TFinWithdrawableChangeExportReq) (res *v1.TFinWithdrawableChangeExportRes, err error) { + err = service.CommonTFinWithdrawableChange().Export(ctx, &req.TFinWithdrawableChangeListParam) + return +} + +// Edit 更新可提现变动明细表 +func (c *ControllerV1) TFinWithdrawableChangeEdit(ctx context.Context, req *v1.TFinWithdrawableChangeEditReq) (res *v1.TFinWithdrawableChangeEditRes, err error) { + err = service.CommonTFinWithdrawableChange().Edit(ctx, &req.TFinWithdrawableChangeEditParam) + return +} + +// View 获取指定可提现变动明细表信息 +func (c *ControllerV1) TFinWithdrawableChangeView(ctx context.Context, req *v1.TFinWithdrawableChangeViewReq) (res *v1.TFinWithdrawableChangeViewRes, err error) { + data, err := service.CommonTFinWithdrawableChange().View(ctx, &req.TFinWithdrawableChangeViewParam) + if err != nil { + return + } + + res = new(v1.TFinWithdrawableChangeViewRes) + res.TFinWithdrawableChangeViewModel = data + return +} + +// Delete 删除可提现变动明细表 +func (c *ControllerV1) TFinWithdrawableChangeDelete(ctx context.Context, req *v1.TFinWithdrawableChangeDeleteReq) (res *v1.TFinWithdrawableChangeDeleteRes, err error) { + err = service.CommonTFinWithdrawableChange().Delete(ctx, &req.TFinWithdrawableChangeDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tmessagelog.go b/server/internal/controller/common/common_v1_tmessagelog.go new file mode 100644 index 0000000..9e34434 --- /dev/null +++ b/server/internal/controller/common/common_v1_tmessagelog.go @@ -0,0 +1,57 @@ +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看消息日志列表 +func (c *ControllerV1) TMessageLogList(ctx context.Context, req *v1.TMessageLogListReq) (res *v1.TMessageLogListRes, err error) { + list, totalCount, err := service.CommonTMessageLog().List(ctx, &req.TMessageLogListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TMessageLogListModel{} + } + + res = new(v1.TMessageLogListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出消息日志列表 +func (c *ControllerV1) TMessageLogExport(ctx context.Context, req *v1.TMessageLogExportReq) (res *v1.TMessageLogExportRes, err error) { + err = service.CommonTMessageLog().Export(ctx, &req.TMessageLogListParam) + return +} + +// Edit 更新消息日志 +func (c *ControllerV1) TMessageLogEdit(ctx context.Context, req *v1.TMessageLogEditReq) (res *v1.TMessageLogEditRes, err error) { + err = service.CommonTMessageLog().Edit(ctx, &req.TMessageLogEditParam) + return +} + +// View 获取指定消息日志信息 +func (c *ControllerV1) TMessageLogView(ctx context.Context, req *v1.TMessageLogViewReq) (res *v1.TMessageLogViewRes, err error) { + data, err := service.CommonTMessageLog().View(ctx, &req.TMessageLogViewParam) + if err != nil { + return + } + + res = new(v1.TMessageLogViewRes) + res.TMessageLogViewModel = data + return +} + +// Delete 删除消息日志 +func (c *ControllerV1) TMessageLogDelete(ctx context.Context, req *v1.TMessageLogDeleteReq) (res *v1.TMessageLogDeleteRes, err error) { + err = service.CommonTMessageLog().Delete(ctx, &req.TMessageLogDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tnotifylog.go b/server/internal/controller/common/common_v1_tnotifylog.go new file mode 100644 index 0000000..24de2be --- /dev/null +++ b/server/internal/controller/common/common_v1_tnotifylog.go @@ -0,0 +1,57 @@ +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看通知日志列表 +func (c *ControllerV1) TNotifyLogList(ctx context.Context, req *v1.TNotifyLogListReq) (res *v1.TNotifyLogListRes, err error) { + list, totalCount, err := service.CommonTNotifyLog().List(ctx, &req.TNotifyLogListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TNotifyLogListModel{} + } + + res = new(v1.TNotifyLogListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出通知日志列表 +func (c *ControllerV1) TNotifyLogExport(ctx context.Context, req *v1.TNotifyLogExportReq) (res *v1.TNotifyLogExportRes, err error) { + err = service.CommonTNotifyLog().Export(ctx, &req.TNotifyLogListParam) + return +} + +// Edit 更新通知日志 +func (c *ControllerV1) TNotifyLogEdit(ctx context.Context, req *v1.TNotifyLogEditReq) (res *v1.TNotifyLogEditRes, err error) { + err = service.CommonTNotifyLog().Edit(ctx, &req.TNotifyLogEditParam) + return +} + +// View 获取指定通知日志信息 +func (c *ControllerV1) TNotifyLogView(ctx context.Context, req *v1.TNotifyLogViewReq) (res *v1.TNotifyLogViewRes, err error) { + data, err := service.CommonTNotifyLog().View(ctx, &req.TNotifyLogViewParam) + if err != nil { + return + } + + res = new(v1.TNotifyLogViewRes) + res.TNotifyLogViewModel = data + return +} + +// Delete 删除通知日志 +func (c *ControllerV1) TNotifyLogDelete(ctx context.Context, req *v1.TNotifyLogDeleteReq) (res *v1.TNotifyLogDeleteRes, err error) { + err = service.CommonTNotifyLog().Delete(ctx, &req.TNotifyLogDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tprofitaccountmonth_bill.go b/server/internal/controller/common/common_v1_tprofitaccountmonth_bill.go new file mode 100644 index 0000000..6978ae1 --- /dev/null +++ b/server/internal/controller/common/common_v1_tprofitaccountmonth_bill.go @@ -0,0 +1,111 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看盈利账户月账单表列表 +func (c *ControllerV1) TProfitAccountMonthBillList(ctx context.Context, req *v1.TProfitAccountMonthBillListReq) (res *v1.TProfitAccountMonthBillListRes, err error) { + list, totalCount, err := service.CommonProfitAccountMonthBill().List(ctx, &req.TProfitAccountMonthBillListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TProfitAccountMonthBillListModel{} + } + + res = new(v1.TProfitAccountMonthBillListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出盈利账户月账单表列表 +func (c *ControllerV1) TProfitAccountMonthBillExport(ctx context.Context, req *v1.TProfitAccountMonthBillExportReq) (res *v1.TProfitAccountMonthBillExportRes, err error) { + err = service.CommonProfitAccountMonthBill().Export(ctx, &req.TProfitAccountMonthBillListParam) + return +} + +// Edit 更新盈利账户月账单表 +func (c *ControllerV1) TProfitAccountMonthBillEdit(ctx context.Context, req *v1.TProfitAccountMonthBillEditReq) (res *v1.TProfitAccountMonthBillEditRes, err error) { + err = service.CommonProfitAccountMonthBill().Edit(ctx, &req.TProfitAccountMonthBillEditParam) + return +} + +// View 获取指定盈利账户月账单表信息 +func (c *ControllerV1) TProfitAccountMonthBillView(ctx context.Context, req *v1.TProfitAccountMonthBillViewReq) (res *v1.TProfitAccountMonthBillViewRes, err error) { + data, err := service.CommonProfitAccountMonthBill().View(ctx, &req.TProfitAccountMonthBillViewParam) + if err != nil { + return + } + + res = new(v1.TProfitAccountMonthBillViewRes) + res.TProfitAccountMonthBillViewModel = data + return +} + +// Delete 删除盈利账户月账单表 +func (c *ControllerV1) TProfitAccountMonthBillDelete(ctx context.Context, req *v1.TProfitAccountMonthBillDeleteReq) (res *v1.TProfitAccountMonthBillDeleteRes, err error) { + err = service.CommonProfitAccountMonthBill().Delete(ctx, &req.TProfitAccountMonthBillDeleteParam) + return +} + +// Settle 统计并写入盈利账户月账单 +func (c *ControllerV1) TProfitAccountMonthBillSettle(ctx context.Context, req *v1.TProfitAccountMonthBillSettleReq) (res *v1.TProfitAccountMonthBillSettleRes, err error) { + data, err := service.CommonProfitAccountMonthBill().SettleProfitAccountMonthBill(ctx, &req.TProfitAccountMonthBillSettleParam) + if err != nil { + return + } + + res = new(v1.TProfitAccountMonthBillSettleRes) + res.TProfitAccountMonthBillSettleResult = data + return +} + +// GetProfitBillSummary 获取上月盈利账单汇总信息 +func (c *ControllerV1) TProfitAccountMonthBillGetProfitBillSummary(ctx context.Context, req *v1.TProfitAccountMonthBillGetProfitBillSummaryReq) (res *v1.TProfitAccountMonthBillGetProfitBillSummaryRes, err error) { + data, err := service.CommonProfitAccountMonthBill().GetProfitBillSummary(ctx, req.Month) + if err != nil { + return + } + + res = new(v1.TProfitAccountMonthBillGetProfitBillSummaryRes) + res.TProfitBillModel = data + return +} + +// GetCoreFinancialData 获取核心财务指标 +func (c *ControllerV1) TProfitAccountMonthBillGetCoreFinancialData(ctx context.Context, req *v1.TProfitAccountMonthBillGetCoreFinancialDataReq) (res *v1.TProfitAccountMonthBillGetCoreFinancialDataRes, err error) { + data, err := service.CommonProfitAccountMonthBill().GetCoreFinancialData(ctx, &req.TCommissionOverviewParam) + if err != nil { + return + } + + res = new(v1.TProfitAccountMonthBillGetCoreFinancialDataRes) + res.TCoreFinancialDataModel = data + return +} + +// GetFinancialTrend 获取财务趋势折线图 +func (c *ControllerV1) TProfitAccountMonthBillGetFinancialTrend(ctx context.Context, req *v1.TProfitAccountMonthBillGetFinancialTrendReq) (res *v1.TProfitAccountMonthBillGetFinancialTrendRes, err error) { + data, err := service.CommonProfitAccountMonthBill().GetFinancialTrend(ctx, &req.TFinancialTrendParam) + if err != nil { + return + } + + res = new(v1.TProfitAccountMonthBillGetFinancialTrendRes) + res.TFinancialTrendModel = data + return +} diff --git a/server/internal/controller/common/common_v1_twocommunication.go b/server/internal/controller/common/common_v1_twocommunication.go new file mode 100644 index 0000000..1f74326 --- /dev/null +++ b/server/internal/controller/common/common_v1_twocommunication.go @@ -0,0 +1,64 @@ +package common + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" +) + +// TWoCommunicationList 查看工单问题沟通表列表 +func (c *ControllerV1) TWoCommunicationList(ctx context.Context, req *v1.TWoCommunicationListReq) (res *v1.TWoCommunicationListRes, err error) { + list, totalCount, err := service.CommonTWoCommunication().List(ctx, &req.TWoCommunicationListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TWoCommunicationListModel{} + } + + res = new(v1.TWoCommunicationListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// TWoCommunicationExport 导出工单问题沟通表列表 +func (c *ControllerV1) TWoCommunicationExport(ctx context.Context, req *v1.TWoCommunicationExportReq) (res *v1.TWoCommunicationExportRes, err error) { + err = service.CommonTWoCommunication().Export(ctx, &req.TWoCommunicationListParam) + return +} + +// TWoCommunicationEdit 更新工单问题沟通表 +func (c *ControllerV1) TWoCommunicationEdit(ctx context.Context, req *v1.TWoCommunicationEditReq) (res *v1.TWoCommunicationEditRes, err error) { + err = service.CommonTWoCommunication().Edit(ctx, &req.TWoCommunicationEditParam) + return +} + +func (c *ControllerV1) TWoCommunicationMessage(ctx context.Context, req *v1.TWoCommunicationMessageReq) (res *v1.TWoCommunicationMessageRes, err error) { + err = service.CommonTWoCommunication().Message(ctx, &req.TWoMainMessageParam) + return +} + +// TWoCommunicationView 获取指定工单问题沟通表信息 +func (c *ControllerV1) TWoCommunicationView(ctx context.Context, req *v1.TWoCommunicationViewReq) (res *v1.TWoCommunicationViewRes, err error) { + data, err := service.CommonTWoCommunication().View(ctx, &req.TWoCommunicationViewParam) + if err != nil { + return + } + + res = new(v1.TWoCommunicationViewRes) + res.TWoCommunicationViewModel = data + return +} + +// TWoCommunicationDelete 删除工单问题沟通表 +func (c *ControllerV1) TWoCommunicationDelete(ctx context.Context, req *v1.TWoCommunicationDeleteReq) (res *v1.TWoCommunicationDeleteRes, err error) { + err = service.CommonTWoCommunication().Delete(ctx, &req.TWoCommunicationDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_twomain.go b/server/internal/controller/common/common_v1_twomain.go new file mode 100644 index 0000000..f2dbf6c --- /dev/null +++ b/server/internal/controller/common/common_v1_twomain.go @@ -0,0 +1,84 @@ +package common + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" +) + +// TWoMainList 查看工单主表列表 +func (c *ControllerV1) TWoMainList(ctx context.Context, req *v1.TWoMainListReq) (res *v1.TWoMainListRes, err error) { + list, totalCount, err := service.CommonTWoMain().List(ctx, &req.TWoMainListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TWoMainListModel{} + } + + res = new(v1.TWoMainListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// TWoMainExport 导出工单主表列表 +func (c *ControllerV1) TWoMainExport(ctx context.Context, req *v1.TWoMainExportReq) (res *v1.TWoMainExportRes, err error) { + err = service.CommonTWoMain().Export(ctx, &req.TWoMainListParam) + return +} + +// TWoMainEdit 更新工单主表 +func (c *ControllerV1) TWoMainEdit(ctx context.Context, req *v1.TWoMainEditReq) (res *v1.TWoMainEditRes, err error) { + err = service.CommonTWoMain().Edit(ctx, &req.TWoMainEditParam) + return +} + +func (c *ControllerV1) TWoMainTransfer(ctx context.Context, req *v1.TWoMainTransferReq) (res *v1.TWoMainTransferRes, err error) { + err = service.CommonTWoMain().Transfer(ctx, &req.TWoMainTransferParam) + return +} + +func (c *ControllerV1) TWoMainResolve(ctx context.Context, req *v1.TWoMainResolveReq) (res *v1.TWoMainResolveRes, err error) { + err = service.CommonTWoMain().Resolve(ctx, &req.TWoMainResolveParam) + return +} + +func (c *ControllerV1) TWoMainCancel(ctx context.Context, req *v1.TWoMainCancelReq) (res *v1.TWoMainCancelRes, err error) { + err = service.CommonTWoMain().Cancel(ctx, &req.TWoMainCancelParam) + return +} + +func (c *ControllerV1) TWoMainClose(ctx context.Context, req *v1.TWoMainCloseReq) (res *v1.TWoMainCloseRes, err error) { + err = service.CommonTWoMain().Close(ctx, &req.TWoMainCloseParam) + return +} + +func (c *ControllerV1) TWoMainEvaluate(ctx context.Context, req *v1.TWoMainEvaluateReq) (res *v1.TWoMainEvaluateRes, err error) { + err = service.CommonTWoMain().Evaluate(ctx, &req.TWoMainEvaluateParam) + return +} + +// TWoMainView 获取指定工单主表信息 +func (c *ControllerV1) TWoMainView(ctx context.Context, req *v1.TWoMainViewReq) (res *v1.TWoMainViewRes, err error) { + data, err := service.CommonTWoMain().View(ctx, &req.TWoMainViewParam) + if err != nil { + return + } + + res = new(v1.TWoMainViewRes) + res.TWoMainViewModel = data + return +} + +// TWoMainDelete 删除工单主表 +func (c *ControllerV1) TWoMainDelete(ctx context.Context, req *v1.TWoMainDeleteReq) (res *v1.TWoMainDeleteRes, err error) { + err = service.CommonTWoMain().Delete(ctx, &req.TWoMainDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_tworecord.go b/server/internal/controller/common/common_v1_tworecord.go new file mode 100644 index 0000000..60ce27e --- /dev/null +++ b/server/internal/controller/common/common_v1_tworecord.go @@ -0,0 +1,59 @@ +package common + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" +) + +// List 查看工单记录表列表 +func (c *ControllerV1) TWoRecordList(ctx context.Context, req *v1.TWoRecordListReq) (res *v1.TWoRecordListRes, err error) { + list, totalCount, err := service.CommonTWoRecord().List(ctx, &req.TWoRecordListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TWoRecordListModel{} + } + + res = new(v1.TWoRecordListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出工单记录表列表 +func (c *ControllerV1) TWoRecordExport(ctx context.Context, req *v1.TWoRecordExportReq) (res *v1.TWoRecordExportRes, err error) { + err = service.CommonTWoRecord().Export(ctx, &req.TWoRecordListParam) + return +} + +// Edit 更新工单记录表 +func (c *ControllerV1) TWoRecordEdit(ctx context.Context, req *v1.TWoRecordEditReq) (res *v1.TWoRecordEditRes, err error) { + err = service.CommonTWoRecord().Edit(ctx, &req.TWoRecordEditParam) + return +} + +// View 获取指定工单记录表信息 +func (c *ControllerV1) TWoRecordView(ctx context.Context, req *v1.TWoRecordViewReq) (res *v1.TWoRecordViewRes, err error) { + data, err := service.CommonTWoRecord().View(ctx, &req.TWoRecordViewParam) + if err != nil { + return + } + + res = new(v1.TWoRecordViewRes) + res.TWoRecordViewModel = data + return +} + +// Delete 删除工单记录表 +func (c *ControllerV1) TWoRecordDelete(ctx context.Context, req *v1.TWoRecordDeleteReq) (res *v1.TWoRecordDeleteRes, err error) { + err = service.CommonTWoRecord().Delete(ctx, &req.TWoRecordDeleteParam) + return +} diff --git a/server/internal/controller/common/common_v1_upload.go b/server/internal/controller/common/common_v1_upload.go new file mode 100644 index 0000000..8847fa8 --- /dev/null +++ b/server/internal/controller/common/common_v1_upload.go @@ -0,0 +1,30 @@ +package common + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysOssUpload(ctx context.Context, req *v1.SysOssUploadReq) (res *v1.SysOssUploadRes, err error) { + + info, err := service.SysOss().Upload(ctx, req.SysOssUploadParam) + if err != nil { + return nil, err + } + res = &v1.SysOssUploadRes{ + SysOssUploadModel: info, + } + return +} +func (c *ControllerV1) SysOssDownload(ctx context.Context, req *v1.SysOssDownloadReq) (res *v1.SysOssDownloadRes, err error) { + output, err := service.SysOss().Download(ctx, req.SysOssDownloadParam) + if err != nil { + return nil, err + } + res = &v1.SysOssDownloadRes{ + SysOssDownloadModel: output, + } + return +} diff --git a/server/internal/controller/common/t_division_code.go b/server/internal/controller/common/t_division_code.go new file mode 100644 index 0000000..2d2402f --- /dev/null +++ b/server/internal/controller/common/t_division_code.go @@ -0,0 +1,63 @@ +// Package iot +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package common + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看村级行政区划表列表 +func (c *ControllerV1) TDivisionCodeList(ctx context.Context, req *v1.TDivisionCodeListReq) (res *v1.TDivisionCodeListRes, err error) { + list, totalCount, err := service.IotTDivisionCode().List(ctx, &req.TDivisionCodeListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TDivisionCodeListModel{} + } + + res = new(v1.TDivisionCodeListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出村级行政区划表列表 +func (c *ControllerV1) TDivisionCodeExport(ctx context.Context, req *v1.TDivisionCodeExportReq) (res *v1.TDivisionCodeExportRes, err error) { + err = service.IotTDivisionCode().Export(ctx, &req.TDivisionCodeListParam) + return +} + +// Edit 更新村级行政区划表 +func (c *ControllerV1) TDivisionCodeEdit(ctx context.Context, req *v1.TDivisionCodeEditReq) (res *v1.TDivisionCodeEditRes, err error) { + err = service.IotTDivisionCode().Edit(ctx, &req.TDivisionCodeEditParam) + return +} + +// View 获取指定村级行政区划表信息 +func (c *ControllerV1) TDivisionCodeView(ctx context.Context, req *v1.TDivisionCodeViewReq) (res *v1.TDivisionCodeViewRes, err error) { + data, err := service.IotTDivisionCode().View(ctx, &req.TDivisionCodeViewParam) + if err != nil { + return + } + + res = new(v1.TDivisionCodeViewRes) + res.TDivisionCodeViewModel = data + return +} + +// Delete 删除村级行政区划表 +func (c *ControllerV1) TDivisionCodeDelete(ctx context.Context, req *v1.TDivisionCodeDeleteReq) (res *v1.TDivisionCodeDeleteRes, err error) { + err = service.IotTDivisionCode().Delete(ctx, &req.TDivisionCodeDeleteParam) + return +} diff --git a/server/internal/controller/gen/test_demo.go b/server/internal/controller/gen/test_demo.go new file mode 100644 index 0000000..8e9cffd --- /dev/null +++ b/server/internal/controller/gen/test_demo.go @@ -0,0 +1,69 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package gen + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/genin" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +var ( + TestDemo = cTestDemo{} +) + +type cTestDemo struct{} + +// List 查看测试单表列表 +func (c *cTestDemo) TestDemoList(ctx context.Context, req *v1.TestDemoListReq) (res *v1.TestDemoListRes, err error) { + list, totalCount, err := service.GenTestDemo().List(ctx, &req.TestDemoListParam) + if err != nil { + return + } + + if list == nil { + list = []*genin.TestDemoListModel{} + } + + res = new(v1.TestDemoListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出测试单表列表 +func (c *cTestDemo) TestDemoExport(ctx context.Context, req *v1.TestDemoExportReq) (res *v1.TestDemoExportRes, err error) { + err = service.GenTestDemo().Export(ctx, &req.TestDemoListParam) + return +} + +// Edit 更新测试单表 +func (c *cTestDemo) TestDemoEdit(ctx context.Context, req *v1.TestDemoEditReq) (res *v1.TestDemoEditRes, err error) { + err = service.GenTestDemo().Edit(ctx, &req.TestDemoEditParam) + return +} + +// View 获取指定测试单表信息 +func (c *cTestDemo) TestDemoView(ctx context.Context, req *v1.TestDemoViewReq) (res *v1.TestDemoViewRes, err error) { + data, err := service.GenTestDemo().View(ctx, &req.TestDemoViewParam) + if err != nil { + return + } + + res = new(v1.TestDemoViewRes) + res.TestDemoViewModel = data + return +} + +// Delete 删除测试单表 +func (c *cTestDemo) TestDemoDelete(ctx context.Context, req *v1.TestDemoDeleteReq) (res *v1.TestDemoDeleteRes, err error) { + err = service.GenTestDemo().Delete(ctx, &req.TestDemoDeleteParam) + return +} diff --git a/server/internal/controller/gen/testdemo/testdemo.go b/server/internal/controller/gen/testdemo/testdemo.go new file mode 100644 index 0000000..14ae444 --- /dev/null +++ b/server/internal/controller/gen/testdemo/testdemo.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package testdemo diff --git a/server/internal/controller/gen/testdemo/testdemo_new.go b/server/internal/controller/gen/testdemo/testdemo_new.go new file mode 100644 index 0000000..b9b7169 --- /dev/null +++ b/server/internal/controller/gen/testdemo/testdemo_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package testdemo + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo" +) + +type ControllerV1 struct{} + +func NewV1() testdemo.ITestdemoV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/gen/testdemo/testdemo_v1_testdemo.go b/server/internal/controller/gen/testdemo/testdemo_v1_testdemo.go new file mode 100644 index 0000000..2a1646a --- /dev/null +++ b/server/internal/controller/gen/testdemo/testdemo_v1_testdemo.go @@ -0,0 +1,26 @@ +package testdemo + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo/v1" +) + +func (c *ControllerV1) TestDemoList(ctx context.Context, req *v1.TestDemoListReq) (res *v1.TestDemoListRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} +func (c *ControllerV1) TestDemoExport(ctx context.Context, req *v1.TestDemoExportReq) (res *v1.TestDemoExportRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} +func (c *ControllerV1) TestDemoView(ctx context.Context, req *v1.TestDemoViewReq) (res *v1.TestDemoViewRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} +func (c *ControllerV1) TestDemoEdit(ctx context.Context, req *v1.TestDemoEditReq) (res *v1.TestDemoEditRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} +func (c *ControllerV1) TestDemoDelete(ctx context.Context, req *v1.TestDemoDeleteReq) (res *v1.TestDemoDeleteRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/server/internal/controller/gen_codes/gen_codes.go b/server/internal/controller/gen_codes/gen_codes.go new file mode 100644 index 0000000..d8a3741 --- /dev/null +++ b/server/internal/controller/gen_codes/gen_codes.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package gen_codes diff --git a/server/internal/controller/gen_codes/gen_codes_new.go b/server/internal/controller/gen_codes/gen_codes_new.go new file mode 100644 index 0000000..e54e089 --- /dev/null +++ b/server/internal/controller/gen_codes/gen_codes_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package gen_codes + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen_codes" +) + +type ControllerV1 struct{} + +func NewV1() gen_codes.IGenCodesV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/gen_codes/gen_codes_v1_gen_table.go b/server/internal/controller/gen_codes/gen_codes_v1_gen_table.go new file mode 100644 index 0000000..9918bdd --- /dev/null +++ b/server/internal/controller/gen_codes/gen_codes_v1_gen_table.go @@ -0,0 +1,127 @@ +package gen_codes + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen_codes/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysGenTableList(ctx context.Context, req *v1.SysGenTableListReq) (res *v1.SysGenTableListRes, err error) { + items, total, err := service.SysGenTable().List(ctx, req.SysGenTableListParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + } + return res, nil +} + +func (c *ControllerV1) SysGenTableView(ctx context.Context, req *v1.SysGenTableViewReq) (res *v1.SysGenTableViewRes, err error) { + item, err := service.SysGenTable().View(ctx, req.SysGenTableViewParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableViewRes{ + SysGenTableViewModel: item, + } + return res, nil +} + +func (c *ControllerV1) SysGenTableAdd(ctx context.Context, req *v1.SysGenTableAddReq) (res *v1.SysGenTableAddRes, err error) { + output, err := service.SysGenTable().Add(ctx, req.SysGenTableAddParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableAddRes{ + SysGenTableAddModel: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableDelete(ctx context.Context, req *v1.SysGenTableDeleteReq) (res *v1.SysGenTableDeleteRes, err error) { + output, err := service.SysGenTable().Delete(ctx, req.SysGenTableDeleteParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableDeleteRes{ + SysGenTableDeleteModel: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableSelects(ctx context.Context, req *v1.SysGenTableSelectsReq) (res *v1.SysGenTableSelectsRes, err error) { + output, err := service.SysGenTable().Selects(ctx) + if err != nil { + return nil, err + } + res = &v1.SysGenTableSelectsRes{ + SelectsModel: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableTableSelect(ctx context.Context, req *v1.SysGenTableTableSelectReq) (res *v1.SysGenTableTableSelectRes, err error) { + output, err := service.SysGenTable().TableSelect(ctx, req.GenCodesTableSelectParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableTableSelectRes{ + Items: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableColumnSelect(ctx context.Context, req *v1.SysGenTableColumnSelectReq) (res *v1.SysGenTableColumnSelectRes, err error) { + output, err := service.SysGenTable().ColumnSelect(ctx, req.GenCodesColumnSelectParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableColumnSelectRes{ + Items: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTablePreview(ctx context.Context, req *v1.SysGenTablePreviewReq) (res *v1.SysGenTablePreviewRes, err error) { + output, err := service.SysGenTable().Preview(ctx, req.GenCodesPreviewParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTablePreviewRes{ + GenCodesPreviewModel: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableBuild(ctx context.Context, req *v1.SysGenTableBuildReq) (res *v1.SysGenTableBuildRes, err error) { + output, err := service.SysGenTable().Build(ctx, req.GenCodesBuildParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableBuildRes{ + GenCodesBuildModel: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableColumnList(ctx context.Context, req *v1.SysGenTableColumnListReq) (res *v1.SysGenTableColumnListRes, err error) { + output, err := service.SysGenTable().ColumnList(ctx, req.GenCodesColumnListParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableColumnListRes{ + Items: output, + } + return res, nil +} +func (c *ControllerV1) SysGenTableEdit(ctx context.Context, req *v1.SysGenTableEditReq) (res *v1.SysGenTableEditRes, err error) { + output, err := service.SysGenTable().Edit(ctx, req.SysGenTableEditParam) + if err != nil { + return nil, err + } + res = &v1.SysGenTableEditRes{ + SysGenTableEditModel: output, + } + return res, nil +} diff --git a/server/internal/controller/home/home.go b/server/internal/controller/home/home.go new file mode 100644 index 0000000..4be5959 --- /dev/null +++ b/server/internal/controller/home/home.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package home diff --git a/server/internal/controller/home/home_new.go b/server/internal/controller/home/home_new.go new file mode 100644 index 0000000..7811540 --- /dev/null +++ b/server/internal/controller/home/home_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package home + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/home" +) + +type ControllerV1 struct{} + +func NewV1() home.IHomeV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/home/home_v1_home.go b/server/internal/controller/home/home_v1_home.go new file mode 100644 index 0000000..bf32dae --- /dev/null +++ b/server/internal/controller/home/home_v1_home.go @@ -0,0 +1,51 @@ +package home + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/home/v1" +) + +func (c *ControllerV1) CardStatistics(ctx context.Context, req *v1.CardStatisticsReq) (res *v1.CardStatisticsRes, err error) { + result, err := service.Home().GetCardStatistics(ctx) + if err != nil { + return nil, gerror.NewCode(gcode.CodeInternalError, err.Error()) + } + return &v1.CardStatisticsRes{CardStatistics: *result}, nil +} + +func (c *ControllerV1) CardStatusStatistics(ctx context.Context, req *v1.CardStatusStatisticsReq) (res *v1.CardStatusStatisticsRes, err error) { + result, err := service.Home().GetCardStatusStatistics(ctx) + if err != nil { + return nil, gerror.NewCode(gcode.CodeInternalError, err.Error()) + } + return &v1.CardStatusStatisticsRes{CardStatusStatistics: *result}, nil +} + +func (c *ControllerV1) TopUsageCards(ctx context.Context, req *v1.TopUsageCardsReq) (res *v1.TopUsageCardsRes, err error) { + result, err := service.Home().GetTopUsageCardsYesterday(ctx) + if err != nil { + return nil, gerror.NewCode(gcode.CodeInternalError, err.Error()) + } + return &v1.TopUsageCardsRes{Data: result}, nil +} + +func (c *ControllerV1) FlowUsageChart(ctx context.Context, req *v1.FlowUsageChartReq) (res *v1.FlowUsageChartRes, err error) { + result, err := service.Home().GetDeptFlowUsageChart(ctx, req.Period) + if err != nil { + return nil, gerror.NewCode(gcode.CodeInternalError, err.Error()) + } + return &v1.FlowUsageChartRes{FlowUsageChartData: *result}, nil +} +func (c *ControllerV1) FlowPoolUsage(ctx context.Context, req *v1.FlowPoolUsageReq) (res *v1.FlowPoolUsageRes, err error) { + result, err := service.Home().GetFlowPoolUsageList(ctx) + if err != nil { + return nil, gerror.NewCode(gcode.CodeInternalError, err.Error()) + } + return &v1.FlowPoolUsageRes{Data: result}, nil +} diff --git a/server/internal/controller/iot/full_sync_monitor.go b/server/internal/controller/iot/full_sync_monitor.go new file mode 100644 index 0000000..32f3749 --- /dev/null +++ b/server/internal/controller/iot/full_sync_monitor.go @@ -0,0 +1,281 @@ +package iot + +import ( + "context" + "strings" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry" +) + +type FullSyncMonitorController struct { + client fullsyncretry.Client +} + +func NewFullSyncMonitor() *FullSyncMonitorController { + return &FullSyncMonitorController{client: fullsyncretry.FromEnvironment()} +} + +func (c *FullSyncMonitorController) List(ctx context.Context, req *v1.FullSyncRunsListReq) (*v1.FullSyncRunsListRes, error) { + result, err := c.client.ListRuns(ctx, req.SyncKind, req.Limit) + if err != nil { + return nil, err + } + return &v1.FullSyncRunsListRes{Items: result.Items, Total: result.Total}, nil +} + +func (c *FullSyncMonitorController) Detail(ctx context.Context, req *v1.FullSyncRunDetailReq) (*v1.FullSyncRunDetailRes, error) { + view, err := c.client.Run(ctx, req.RunID) + if err != nil { + return nil, err + } + kind, name := fullSyncKindName(view.Run.Operation) + return &v1.FullSyncRunDetailRes{RunView: view, SyncKind: kind, SyncName: name}, nil +} + +func (c *FullSyncMonitorController) Failures(ctx context.Context, req *v1.FullSyncRunFailuresReq) (*v1.FullSyncRunFailuresRes, error) { + page, err := c.client.Failures(ctx, req.RunID, req.Limit, req.Cursor) + if err != nil { + return nil, err + } + return &v1.FullSyncRunFailuresRes{Items: page.Items, NextCursor: page.NextCursor}, nil +} + +func (c *FullSyncMonitorController) Start(ctx context.Context, req *v1.FullSyncRunStartReq) (*v1.FullSyncRunStartRes, error) { + userID := contexts.GetUserId(ctx) + if userID == 0 { + return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required") + } + if !fullsyncretry.ValidSyncKind(req.SyncKind) { + return nil, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid full-sync type") + } + // A period field only applies to its own sync kind. Rejecting a stray field + // keeps an operator from believing a backfill was scheduled when it was not. + period, err := resolvePeriod(req) + if err != nil { + return nil, err + } + // Validate and canonicalize the channel scope before the active-run check so + // a malformed request fails fast without touching Worker state. + scope, err := model.NormalizeScope(&model.SyncScope{Channels: req.Channels, TriggerSource: model.TriggerSourceManual}) + if err != nil { + return nil, gerror.NewCode(gcode.CodeInvalidParameter, err.Error()) + } + list, err := c.client.ListRuns(ctx, req.SyncKind, 100) + if err != nil { + return nil, err + } + for _, item := range list.Items { + if item.Run.Status == "producing" || item.Run.Status == "running" { + return nil, gerror.NewCode(gcode.CodeInvalidParameter, "A full-sync run is already active") + } + } + var runID string + switch req.SyncKind { + case "traffic_usage": + runID, err = service.TrafficUsageMonthlySync().StartMonthlyRunScoped(ctx, scope) + case "sim_status": + runID, err = service.SimStatusQueue().StartFullSyncRunScoped(ctx, scope) + case "imei": + runID, err = service.ImeiQueue().StartImeiRunScoped(ctx, scope) + case "traffic_usage_daily": + runID, err = service.TrafficUsageDailySync().StartDailyRunScopedAt(ctx, scope, req.QueryDate) + case "traffic_usage_monthly": + runID, err = service.TrafficUsageMonthlySync().StartMonthlyHistoryRunScopedAt(ctx, scope, req.QueryMonth) + } + if err != nil { + g.Log().Warningf(ctx, "full_sync_manual_start rejected actor=%d syncKind=%s scopeChannels=%d period=%s error=%q", userID, req.SyncKind, scope.ChannelCount(), period, err.Error()) + return nil, err + } + g.Log().Infof(ctx, "full_sync_manual_start accepted actor=%d syncKind=%s runId=%s scopeChannels=%d scopeSample=%s period=%s", userID, req.SyncKind, runID, scope.ChannelCount(), strings.Join(scope.ChannelSample(10), ","), period) + return &v1.FullSyncRunStartRes{RunID: runID, SyncKind: req.SyncKind, Status: "published", ScopeChannels: scope.ChannelCount(), QueryPeriod: period}, nil +} + +// resolvePeriod returns the requested backfill period for req.SyncKind and +// rejects a period field that does not belong to that sync kind. +func resolvePeriod(req *v1.FullSyncRunStartReq) (string, error) { + if req.QueryDate != "" && req.SyncKind != "traffic_usage_daily" { + return "", gerror.NewCodef(gcode.CodeInvalidParameter, "queryDate is only valid for syncKind=traffic_usage_daily, got %s", req.SyncKind) + } + if req.QueryMonth != "" && req.SyncKind != "traffic_usage_monthly" { + return "", gerror.NewCodef(gcode.CodeInvalidParameter, "queryMonth is only valid for syncKind=traffic_usage_monthly, got %s", req.SyncKind) + } + switch req.SyncKind { + case "traffic_usage_daily": + return req.QueryDate, nil + case "traffic_usage_monthly": + return req.QueryMonth, nil + } + return "", nil +} + +// Channels returns the channels a partial sync can target, with their card +// counts so an operator can judge the blast radius before selecting. +func (c *FullSyncMonitorController) Channels(ctx context.Context, _ *v1.FullSyncChannelOptionsReq) (*v1.FullSyncChannelOptionsRes, error) { + if contexts.GetUserId(ctx) == 0 { + return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required") + } + tenantID := contexts.GetTenantId(ctx) + type channelRow struct { + ChanKey string `orm:"chan_key"` + ChanName string `orm:"chan_name"` + TempKey string `orm:"temp_key"` + Operator int `orm:"operator"` + SyncEnabled int `orm:"sync_enabled"` + CardCount int64 `orm:"card_count"` + } + var rows []*channelRow + channels := dao.TSimChannels.Columns() + cards := dao.TSimCardInfo.Columns() + // Count cards per channel in one pass. The left join keeps channels that + // currently hold no cards so they stay selectable (and visibly empty), and + // both sides are tenant-scoped so the count cannot leak across tenants. + // + // The select list and the GROUP BY clause must be built from the same + // column set; see channelOptionsQuery for why. + query := channelOptionsQuery(channelQueryColumns{ + ChanKey: channels.ChanKey, + ChanName: channels.ChanName, + TempKey: channels.TempKey, + Operator: channels.Operator, + SyncEnabled: channels.SyncEnabled, + TenantID: channels.TenantId, + }, cardQueryColumns{ + Id: cards.Id, + ChanKey: cards.ChanKey, + TenantID: cards.TenantId, + }, tenantID) + err := dao.TSimChannels.Ctx(ctx). + As(query.alias). + LeftJoin(query.joinTable, query.joinOn). + Fields(query.fields...). + Where(query.tenantWhere, query.tenantID). + Group(query.groupBy...). + OrderAsc(query.orderBy). + Scan(&rows) + if err != nil { + return nil, gerror.Wrap(err, "load full-sync channel options failed") + } + items := make([]v1.FullSyncChannelOption, 0, len(rows)) + for _, row := range rows { + if row == nil { + continue + } + items = append(items, v1.FullSyncChannelOption{ + ChanKey: row.ChanKey, + ChanName: row.ChanName, + TempKey: row.TempKey, + Operator: row.Operator, + CardCount: row.CardCount, + SyncEnabled: row.SyncEnabled == 1, + }) + } + return &v1.FullSyncChannelOptionsRes{Items: items}, nil +} + +func fullSyncKindName(operation string) (string, string) { + switch operation { + case "current_month_usage_full_sync": + return "traffic_usage", "流量全量同步" + case "sim_status_queue_full_sync": + return "sim_status", "卡状态全量同步" + case "previous_day_usage_full_sync": + return "traffic_usage_daily", "日流量全量同步" + case "previous_month_usage_full_sync": + return "traffic_usage_monthly", "月流量历史全量同步" + case "imei_full_sync": + return "imei", "IMEI 全量同步" + default: + return "", operation + } +} + +// channelQueryColumns / cardQueryColumns carry the physical column names the +// channel-options query needs. They keep the builder a pure function so its +// SQL shape can be asserted in a unit test. +type channelQueryColumns struct { + ChanKey string + ChanName string + TempKey string + Operator string + SyncEnabled string + TenantID string +} + +type cardQueryColumns struct { + Id string + ChanKey string + TenantID string +} + +// channelOptionsQueryShape holds the assembled pieces of the channel-options query +// so the SQL shape can be asserted without a database. +type channelOptionsQueryShape struct { + alias string + joinTable string + joinOn string + fields []any + groupBy []any + orderBy string + tenantWhere string + tenantID string +} + +// channelOptionsQuery builds the channel candidate query. +// +// IMPORTANT: every non-aggregate column in the select list must also appear in +// GROUP BY. MySQL runs with ONLY_FULL_GROUP_BY, and GoFrame sends the tenant +// filter as a prepared-statement parameter. A bound parameter is not a +// constant, so MySQL cannot use the unique key uk_key(tenant_id, chan_key) to +// prove that chan_name/temp_key/operator/sync_enabled are functionally +// dependent on the grouped column. Grouping by chan_key alone therefore fails +// in production with: +// +// Error 1055: Expression #2 of SELECT list is not in GROUP BY clause and +// contains nonaggregated column 'db_iotlcm.c.chan_name' which is not +// functionally dependent on columns in GROUP BY clause +// +// Adding the remaining columns keeps the grouping semantically identical +// because (tenant_id, chan_key) is unique, and it satisfies the SQL mode. +func channelOptionsQuery(channels channelQueryColumns, cards cardQueryColumns, tenantID string) channelOptionsQueryShape { + const alias = "c" + const joinAlias = "ci" + + // Single source of truth: the non-aggregate columns that are both selected + // and grouped. + nonAggregate := []struct{ column, out string }{ + {channels.ChanKey, "chan_key"}, + {channels.ChanName, "chan_name"}, + {channels.TempKey, "temp_key"}, + {channels.Operator, "operator"}, + {channels.SyncEnabled, "sync_enabled"}, + } + + fields := make([]any, 0, len(nonAggregate)+1) + groupBy := make([]any, 0, len(nonAggregate)) + for _, column := range nonAggregate { + fields = append(fields, alias+"."+column.column+" AS "+column.out) + groupBy = append(groupBy, alias+"."+column.column) + } + fields = append(fields, "COUNT("+joinAlias+"."+cards.Id+") AS card_count") + + return channelOptionsQueryShape{ + alias: alias, + joinTable: dao.TSimCardInfo.Table() + " AS " + joinAlias, + joinOn: alias + "." + channels.ChanKey + " = " + joinAlias + "." + cards.ChanKey + + " AND " + joinAlias + "." + cards.TenantID + " = " + alias + "." + channels.TenantID, + fields: fields, + groupBy: groupBy, + orderBy: alias + "." + channels.ChanKey, + tenantWhere: alias + "." + channels.TenantID, + tenantID: tenantID, + } +} diff --git a/server/internal/controller/iot/full_sync_monitor_channels_test.go b/server/internal/controller/iot/full_sync_monitor_channels_test.go new file mode 100644 index 0000000..2baa9da --- /dev/null +++ b/server/internal/controller/iot/full_sync_monitor_channels_test.go @@ -0,0 +1,144 @@ +package iot + +import ( + "strings" + "testing" +) + +// testChannelColumns mirrors the physical column names of t_sim_channels. +func testChannelColumns() channelQueryColumns { + return channelQueryColumns{ + ChanKey: "chan_key", + ChanName: "chan_name", + TempKey: "temp_key", + Operator: "operator", + SyncEnabled: "sync_enabled", + TenantID: "tenant_id", + } +} + +func testCardColumns() cardQueryColumns { + return cardQueryColumns{Id: "id", ChanKey: "chan_key", TenantID: "tenant_id"} +} + +// TestChannelOptionsQueryGroupsEverySelectedNonAggregateColumn guards a +// production regression. +// +// MySQL runs with ONLY_FULL_GROUP_BY and GoFrame binds the tenant filter as a +// prepared-statement parameter. A bound parameter is not a constant, so MySQL +// cannot use the unique key uk_key(tenant_id, chan_key) to prove that the +// selected columns are functionally dependent on the grouped column. Grouping +// by chan_key alone therefore fails on the real database with: +// +// Error 1055: Expression #2 of SELECT list is not in GROUP BY clause and +// contains nonaggregated column 'db_iotlcm.c.chan_name' ... +// +// Every selected non-aggregate column must therefore be grouped. +func TestChannelOptionsQueryGroupsEverySelectedNonAggregateColumn(t *testing.T) { + query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000") + + // Derive the selected non-aggregate columns from the built select list, so + // this test fails if someone adds a column to the query without grouping it. + selected := make(map[string]string, len(query.fields)) + for _, field := range query.fields { + expression, ok := field.(string) + if !ok { + t.Fatalf("unexpected non-string field %#v", field) + } + if strings.Contains(expression, "COUNT(") { + continue // aggregate, does not belong in GROUP BY + } + // "c.chan_key AS chan_key" -> physical column "chan_key" + physical := strings.TrimSpace(strings.Split(expression, " AS ")[0]) + physical = strings.TrimPrefix(physical, query.alias+".") + selected[physical] = expression + } + if len(selected) == 0 { + t.Fatal("query selects no non-aggregate columns; test would be vacuous") + } + + grouped := make(map[string]struct{}, len(query.groupBy)) + for _, column := range query.groupBy { + name, ok := column.(string) + if !ok { + t.Fatalf("unexpected non-string group column %#v", column) + } + grouped[strings.TrimPrefix(name, query.alias+".")] = struct{}{} + } + + for physical, expression := range selected { + if _, ok := grouped[physical]; !ok { + t.Errorf("column %q is selected (%s) but not in GROUP BY; "+ + "MySQL ONLY_FULL_GROUP_BY will reject this query with Error 1055", + physical, expression) + } + } + if len(grouped) != len(selected) { + t.Errorf("grouped %d columns but selected %d non-aggregate columns", len(grouped), len(selected)) + } +} + +// TestChannelOptionsQueryGroupsChanKeyAloneRegression pins the exact broken +// shape: a GROUP BY that contains only chan_key. +func TestChannelOptionsQueryGroupsChanKeyAloneRegression(t *testing.T) { + query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000") + if len(query.groupBy) == 1 { + t.Fatalf("GROUP BY contains only %v; grouping by chan_key alone fails under "+ + "ONLY_FULL_GROUP_BY with a bound tenant parameter (Error 1055)", query.groupBy) + } +} + +// TestChannelOptionsQueryGroupsExpectedColumns locks the concrete clause so a +// refactor cannot silently drop a column. +func TestChannelOptionsQueryGroupsExpectedColumns(t *testing.T) { + query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000") + got := make([]string, 0, len(query.groupBy)) + for _, column := range query.groupBy { + got = append(got, column.(string)) + } + want := []string{ + "c.chan_key", + "c.chan_name", + "c.temp_key", + "c.operator", + "c.sync_enabled", + } + if strings.Join(got, ",") != strings.Join(want, ",") { + t.Fatalf("GROUP BY = %v, want %v", got, want) + } +} + +// TestChannelOptionsQueryCountsCardsWithAggregate ensures the count column is +// present and is not accidentally grouped. +func TestChannelOptionsQueryCountsCardsWithAggregate(t *testing.T) { + query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000") + var found bool + for _, field := range query.fields { + if strings.Contains(field.(string), "COUNT(ci.id) AS card_count") { + found = true + } + } + if !found { + t.Fatalf("card_count aggregate missing from fields: %v", query.fields) + } + for _, column := range query.groupBy { + if strings.Contains(column.(string), "COUNT") { + t.Fatalf("aggregate must not appear in GROUP BY: %v", query.groupBy) + } + } +} + +// TestChannelOptionsQueryScopesBothSidesToTenant keeps the tenant isolation +// guarantee: the join condition and the WHERE clause must both be tenant-scoped. +func TestChannelOptionsQueryScopesBothSidesToTenant(t *testing.T) { + query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000") + if !strings.Contains(query.joinOn, "ci.tenant_id = c.tenant_id") { + t.Errorf("join must scope both sides by tenant, got %q", query.joinOn) + } + if query.tenantWhere != "c.tenant_id" { + t.Errorf("tenant where = %q, want c.tenant_id", query.tenantWhere) + } + if query.tenantID != "000000" { + t.Errorf("tenant id = %q, want 000000", query.tenantID) + } +} diff --git a/server/internal/controller/iot/full_sync_replay.go b/server/internal/controller/iot/full_sync_replay.go new file mode 100644 index 0000000..05f8a63 --- /dev/null +++ b/server/internal/controller/iot/full_sync_replay.go @@ -0,0 +1,45 @@ +package iot + +import ( + "context" + "strconv" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry" +) + +type FullSyncReplayController struct{ client fullsyncretry.Client } + +func NewFullSyncReplay() *FullSyncReplayController { + return &FullSyncReplayController{client: fullsyncretry.FromEnvironment()} +} + +func (c *FullSyncReplayController) Replay(ctx context.Context, req *v1.FullSyncReplayReq) (*v1.FullSyncReplayRes, error) { + userID := contexts.GetUserId(ctx) + if userID == 0 { + return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required") + } + receipt, err := c.client.Replay(ctx, req.SourceRunID, strconv.FormatInt(userID, 10), req.MaxRounds) + if err != nil { + g.Log().Warningf(ctx, "full_sync_replay rejected actor=%d sourceRunId=%s maxRounds=%d", userID, req.SourceRunID, req.MaxRounds) + return nil, err + } + g.Log().Infof(ctx, "full_sync_replay accepted actor=%d sourceRunId=%s maxRounds=%d replayRunId=%s", userID, req.SourceRunID, req.MaxRounds, receipt.ReplayRunID) + return &v1.FullSyncReplayRes{ReplayRunID: receipt.ReplayRunID, Status: receipt.Status}, nil +} + +func (c *FullSyncReplayController) Status(ctx context.Context, req *v1.FullSyncReplayStatusReq) (*v1.FullSyncReplayStatusRes, error) { + if contexts.GetUserId(ctx) == 0 { + return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required") + } + status, err := c.client.Get(ctx, req.ReplayRunID) + if err != nil { + return nil, err + } + return &v1.FullSyncReplayStatusRes{ReplayRunID: status.ReplayRunID, SourceRunID: status.SourceRunID, Status: status.Status, Enqueued: status.Enqueued, Remaining: status.Remaining, RunStatus: status.RunStatus, Error: status.Error}, nil +} diff --git a/server/internal/controller/iot/iot.go b/server/internal/controller/iot/iot.go new file mode 100644 index 0000000..80565b3 --- /dev/null +++ b/server/internal/controller/iot/iot.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package iot diff --git a/server/internal/controller/iot/iot_new.go b/server/internal/controller/iot/iot_new.go new file mode 100644 index 0000000..b161d7c --- /dev/null +++ b/server/internal/controller/iot/iot_new.go @@ -0,0 +1,13 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package iot + +import "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot" + +type ControllerV1 struct{} + +func NewV1() iot.IIotV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/iot/iot_v1_simwarningconfig.go b/server/internal/controller/iot/iot_v1_simwarningconfig.go new file mode 100644 index 0000000..373ba7d --- /dev/null +++ b/server/internal/controller/iot/iot_v1_simwarningconfig.go @@ -0,0 +1,90 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimWarningConfigExcelTemplate(ctx context.Context, req *v1.TSimWarningConfigExcelTemplateReq) (res *v1.TSimWarningConfigExcelTemplateRes, err error) { + err = service.IotTSimWarningConfig().DownloadExcelTemplate(ctx, req.ItemType) + return +} + +func (c *ControllerV1) TSimWarningConfigEmailCode(ctx context.Context, req *v1.TSimWarningConfigEmailCodeReq) (res *v1.TSimWarningConfigEmailCodeRes, err error) { + if err = service.IotTSimWarningConfig().SendEmailCode(ctx, &req.TSimWarningConfigEmailCodeParam); err != nil { + return nil, err + } + return &v1.TSimWarningConfigEmailCodeRes{}, nil +} + +func (c *ControllerV1) TSimWarningConfigExcelSubmit(ctx context.Context, req *v1.TSimWarningConfigExcelSubmitReq) (res *v1.TSimWarningConfigExcelSubmitRes, err error) { + data, err := service.IotTSimWarningConfig().SubmitExcel(ctx, &req.TSimWarningConfigExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimWarningConfigExcelSubmitRes{TSimWarningConfigExcelSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimWarningConfigInputSubmit(ctx context.Context, req *v1.TSimWarningConfigInputSubmitReq) (res *v1.TSimWarningConfigInputSubmitRes, err error) { + data, err := service.IotTSimWarningConfig().SubmitInput(ctx, &req.TSimWarningConfigInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimWarningConfigInputSubmitRes{TSimWarningConfigInputSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimWarningConfigRangeSubmit(ctx context.Context, req *v1.TSimWarningConfigRangeSubmitReq) (res *v1.TSimWarningConfigRangeSubmitRes, err error) { + data, err := service.IotTSimWarningConfig().SubmitRange(ctx, &req.TSimWarningConfigRangeSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimWarningConfigRangeSubmitRes{TSimWarningConfigRangeSubmitRes: data}, nil +} + +func (c *ControllerV1) SimWarningConfigList(ctx context.Context, req *v1.SimWarningConfigListReq) (res *v1.SimWarningConfigListRes, err error) { + list, totalCount, err := service.SimWarning().ConfigList(ctx, &req.SimWarningConfigListParam) + if err != nil { + return nil, err + } + if list == nil { + list = []*model.SimWarningConfigModel{} + } + return &v1.SimWarningConfigListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: totalCount, + }, + Items: list, + }, nil +} + +func (c *ControllerV1) SimWarningConfigView(ctx context.Context, req *v1.SimWarningConfigViewReq) (res *v1.SimWarningConfigViewRes, err error) { + data, err := service.SimWarning().ConfigView(ctx, &req.SimWarningConfigViewParam) + if err != nil { + return nil, err + } + return &v1.SimWarningConfigViewRes{SimWarningConfigModel: data}, nil +} + +func (c *ControllerV1) SimWarningConfigSave(ctx context.Context, req *v1.SimWarningConfigSaveReq) (res *v1.SimWarningConfigSaveRes, err error) { + data, err := service.SimWarning().ConfigSave(ctx, &req.SimWarningConfigSaveParam) + if err != nil { + return nil, err + } + return &v1.SimWarningConfigSaveRes{SimWarningConfigSaveModel: data}, nil +} + +func (c *ControllerV1) SimWarningConfigStatus(ctx context.Context, req *v1.SimWarningConfigStatusReq) (res *v1.SimWarningConfigStatusRes, err error) { + err = service.SimWarning().ConfigStatus(ctx, &req.SimWarningConfigStatusParam) + return &v1.SimWarningConfigStatusRes{}, err +} + +func (c *ControllerV1) SimWarningConfigDelete(ctx context.Context, req *v1.SimWarningConfigDeleteReq) (res *v1.SimWarningConfigDeleteRes, err error) { + err = service.SimWarning().ConfigDelete(ctx, &req.SimWarningConfigDeleteParam) + return &v1.SimWarningConfigDeleteRes{}, err +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_submit.go new file mode 100644 index 0000000..66cb620 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataCutExcelSubmit(ctx context.Context, req *v1.TSimCardDataCutExcelSubmitReq) (res *v1.TSimCardDataCutExcelSubmitRes, err error) { + data, err := service.IotTSimCardDataCut().SubmitExcel(ctx, &req.TSimCardDataCutExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardDataCutExcelSubmitRes{TSimCardDataCutExcelSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_template.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_template.go new file mode 100644 index 0000000..adebdc9 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_excel_template.go @@ -0,0 +1,13 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataCutExcelTemplate(ctx context.Context, req *v1.TSimCardDataCutExcelTemplateReq) (res *v1.TSimCardDataCutExcelTemplateRes, err error) { + err = service.IotTSimCardDataCut().DownloadExcelTemplate(ctx) + return +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_input_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_input_submit.go new file mode 100644 index 0000000..86beb4d --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_cut_input_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataCutInputSubmit(ctx context.Context, req *v1.TSimCardDataCutInputSubmitReq) (res *v1.TSimCardDataCutInputSubmitRes, err error) { + data, err := service.IotTSimCardDataCut().SubmitInput(ctx, &req.TSimCardDataCutInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardDataCutInputSubmitRes{TSimCardDataCutInputSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_submit.go new file mode 100644 index 0000000..8253d20 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataStartExcelSubmit(ctx context.Context, req *v1.TSimCardDataStartExcelSubmitReq) (res *v1.TSimCardDataStartExcelSubmitRes, err error) { + data, err := service.IotTSimCardDataStart().SubmitExcel(ctx, &req.TSimCardDataStartExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardDataStartExcelSubmitRes{TSimCardDataStartSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_template.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_template.go new file mode 100644 index 0000000..def0ecb --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_start_excel_template.go @@ -0,0 +1,13 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataStartExcelTemplate(ctx context.Context, req *v1.TSimCardDataStartExcelTemplateReq) (res *v1.TSimCardDataStartExcelTemplateRes, err error) { + err = service.IotTSimCardDataStart().DownloadExcelTemplate(ctx) + return +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_start_input_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_start_input_submit.go new file mode 100644 index 0000000..449c42d --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_start_input_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataStartInputSubmit(ctx context.Context, req *v1.TSimCardDataStartInputSubmitReq) (res *v1.TSimCardDataStartInputSubmitRes, err error) { + data, err := service.IotTSimCardDataStart().SubmitInput(ctx, &req.TSimCardDataStartInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardDataStartInputSubmitRes{TSimCardDataStartSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_submit.go new file mode 100644 index 0000000..fcbf527 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataStopExcelSubmit(ctx context.Context, req *v1.TSimCardDataStopExcelSubmitReq) (res *v1.TSimCardDataStopExcelSubmitRes, err error) { + data, err := service.IotTSimCardDataStop().SubmitExcel(ctx, &req.TSimCardDataStopExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardDataStopExcelSubmitRes{TSimCardDataStopSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_template.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_template.go new file mode 100644 index 0000000..77fc504 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_excel_template.go @@ -0,0 +1,13 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataStopExcelTemplate(ctx context.Context, req *v1.TSimCardDataStopExcelTemplateReq) (res *v1.TSimCardDataStopExcelTemplateRes, err error) { + err = service.IotTSimCardDataStop().DownloadExcelTemplate(ctx) + return +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_input_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_input_submit.go new file mode 100644 index 0000000..0c88b7c --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_data_stop_input_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardDataStopInputSubmit(ctx context.Context, req *v1.TSimCardDataStopInputSubmitReq) (res *v1.TSimCardDataStopInputSubmitRes, err error) { + data, err := service.IotTSimCardDataStop().SubmitInput(ctx, &req.TSimCardDataStopInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardDataStopInputSubmitRes{TSimCardDataStopSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_submit.go new file mode 100644 index 0000000..10b8278 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardRestartExcelSubmit(ctx context.Context, req *v1.TSimCardRestartExcelSubmitReq) (res *v1.TSimCardRestartExcelSubmitRes, err error) { + data, err := service.IotTSimCardRestart().SubmitExcel(ctx, &req.TSimCardRestartExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardRestartExcelSubmitRes{TSimCardRestartExcelSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_template.go b/server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_template.go new file mode 100644 index 0000000..748c422 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_restart_excel_template.go @@ -0,0 +1,13 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardRestartExcelTemplate(ctx context.Context, req *v1.TSimCardRestartExcelTemplateReq) (res *v1.TSimCardRestartExcelTemplateRes, err error) { + err = service.IotTSimCardRestart().DownloadExcelTemplate(ctx) + return +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_restart_input_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_restart_input_submit.go new file mode 100644 index 0000000..6e587ab --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_restart_input_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardRestartInputSubmit(ctx context.Context, req *v1.TSimCardRestartInputSubmitReq) (res *v1.TSimCardRestartInputSubmitRes, err error) { + data, err := service.IotTSimCardRestart().SubmitInput(ctx, &req.TSimCardRestartInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardRestartInputSubmitRes{TSimCardRestartInputSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_start_excel_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_start_excel_submit.go new file mode 100644 index 0000000..772f906 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_start_excel_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardStartExcelSubmit(ctx context.Context, req *v1.TSimCardStartExcelSubmitReq) (res *v1.TSimCardStartExcelSubmitRes, err error) { + data, err := service.IotTSimCardStart().SubmitExcel(ctx, &req.TSimCardStartExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardStartExcelSubmitRes{TSimCardStartExcelSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_start_excel_template.go b/server/internal/controller/iot/iot_v1_t_sim_card_start_excel_template.go new file mode 100644 index 0000000..cb05c09 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_start_excel_template.go @@ -0,0 +1,13 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardStartExcelTemplate(ctx context.Context, req *v1.TSimCardStartExcelTemplateReq) (res *v1.TSimCardStartExcelTemplateRes, err error) { + err = service.IotTSimCardStart().DownloadExcelTemplate(ctx) + return +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_start_input_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_start_input_submit.go new file mode 100644 index 0000000..65c91b6 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_start_input_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardStartInputSubmit(ctx context.Context, req *v1.TSimCardStartInputSubmitReq) (res *v1.TSimCardStartInputSubmitRes, err error) { + data, err := service.IotTSimCardStart().SubmitInput(ctx, &req.TSimCardStartInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardStartInputSubmitRes{TSimCardStartInputSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_submit.go new file mode 100644 index 0000000..2a26f02 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardStopExcelSubmit(ctx context.Context, req *v1.TSimCardStopExcelSubmitReq) (res *v1.TSimCardStopExcelSubmitRes, err error) { + data, err := service.IotTSimCardStop().SubmitExcel(ctx, &req.TSimCardStopExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardStopExcelSubmitRes{TSimCardStopExcelSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_template.go b/server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_template.go new file mode 100644 index 0000000..9218ca7 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_stop_excel_template.go @@ -0,0 +1,13 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardStopExcelTemplate(ctx context.Context, req *v1.TSimCardStopExcelTemplateReq) (res *v1.TSimCardStopExcelTemplateRes, err error) { + err = service.IotTSimCardStop().DownloadExcelTemplate(ctx) + return +} diff --git a/server/internal/controller/iot/iot_v1_t_sim_card_stop_input_submit.go b/server/internal/controller/iot/iot_v1_t_sim_card_stop_input_submit.go new file mode 100644 index 0000000..292a8d6 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_t_sim_card_stop_input_submit.go @@ -0,0 +1,16 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardStopInputSubmit(ctx context.Context, req *v1.TSimCardStopInputSubmitReq) (res *v1.TSimCardStopInputSubmitRes, err error) { + data, err := service.IotTSimCardStop().SubmitInput(ctx, &req.TSimCardStopInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardStopInputSubmitRes{TSimCardStopInputSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_tflowpackageconfig.go b/server/internal/controller/iot/iot_v1_tflowpackageconfig.go new file mode 100644 index 0000000..cfc7edc --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tflowpackageconfig.go @@ -0,0 +1,58 @@ +package iot + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" +) + +// List 查看SIM流量池套餐配置表列表 +func (c *ControllerV1) TFlowPackageConfigList(ctx context.Context, req *v1.TFlowPackageConfigListReq) (res *v1.TFlowPackageConfigListRes, err error) { + list, totalCount, err := service.IotTFlowPackageConfig().List(ctx, &req.TFlowPackageConfigListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TFlowPackageConfigListModel{} + } + + res = new(v1.TFlowPackageConfigListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出SIM流量池套餐配置表列表 +func (c *ControllerV1) TFlowPackageConfigExport(ctx context.Context, req *v1.TFlowPackageConfigExportReq) (res *v1.TFlowPackageConfigExportRes, err error) { + err = service.IotTFlowPackageConfig().Export(ctx, &req.TFlowPackageConfigListParam) + return +} + +// Edit 更新SIM流量池套餐配置表 +func (c *ControllerV1) TFlowPackageConfigEdit(ctx context.Context, req *v1.TFlowPackageConfigEditReq) (res *v1.TFlowPackageConfigEditRes, err error) { + err = service.IotTFlowPackageConfig().Edit(ctx, &req.TFlowPackageConfigEditParam) + return +} + +// View 获取指定SIM流量池套餐配置表信息 +func (c *ControllerV1) TFlowPackageConfigView(ctx context.Context, req *v1.TFlowPackageConfigViewReq) (res *v1.TFlowPackageConfigViewRes, err error) { + data, err := service.IotTFlowPackageConfig().View(ctx, &req.TFlowPackageConfigViewParam) + if err != nil { + return + } + + res = new(v1.TFlowPackageConfigViewRes) + res.TFlowPackageConfigViewModel = data + return +} + +// Delete 删除SIM流量池套餐配置表 +func (c *ControllerV1) TFlowPackageConfigDelete(ctx context.Context, req *v1.TFlowPackageConfigDeleteReq) (res *v1.TFlowPackageConfigDeleteRes, err error) { + err = service.IotTFlowPackageConfig().Delete(ctx, &req.TFlowPackageConfigDeleteParam) + return +} diff --git a/server/internal/controller/iot/iot_v1_torder.go b/server/internal/controller/iot/iot_v1_torder.go new file mode 100644 index 0000000..02df880 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_torder.go @@ -0,0 +1,78 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" +) + +// List 查看订单主表列表 +func (c *ControllerV1) TOrderList(ctx context.Context, req *v1.TOrderListReq) (res *v1.TOrderListRes, err error) { + list, totalCount, err := service.IotTOrder().List(ctx, &req.TOrderListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TOrderListModel{} + } + + res = new(v1.TOrderListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出订单主表列表 +func (c *ControllerV1) TOrderExport(ctx context.Context, req *v1.TOrderExportReq) (res *v1.TOrderExportRes, err error) { + err = service.IotTOrder().Export(ctx, &req.TOrderListParam) + return +} + +// Edit 更新订单主表 +func (c *ControllerV1) TOrderEdit(ctx context.Context, req *v1.TOrderEditReq) (res *v1.TOrderEditRes, err error) { + err = service.IotTOrder().Edit(ctx, &req.TOrderEditParam) + return +} + +// View 获取指定订单主表信息 +func (c *ControllerV1) TOrderView(ctx context.Context, req *v1.TOrderViewReq) (res *v1.TOrderViewRes, err error) { + data, err := service.IotTOrder().View(ctx, &req.TOrderViewParam) + if err != nil { + return + } + + res = new(v1.TOrderViewRes) + res.TOrderViewModel = data + return +} + +// Delete 删除订单主表 +func (c *ControllerV1) TOrderDelete(ctx context.Context, req *v1.TOrderDeleteReq) (res *v1.TOrderDeleteRes, err error) { + err = service.IotTOrder().Delete(ctx, &req.TOrderDeleteParam) + return +} + +// SellList 查看销售订单列表 +func (c *ControllerV1) TOrderSellList(ctx context.Context, req *v1.TOrderSellListReq) (res *v1.TOrderSellListRes, err error) { + list, totalCount, err := service.IotTOrder().SellList(ctx, &req.TOrderListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TOrderListModel{} + } + + res = new(v1.TOrderSellListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardallocate.go b/server/internal/controller/iot/iot_v1_tsimcardallocate.go new file mode 100644 index 0000000..cca93a0 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardallocate.go @@ -0,0 +1,45 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardAllocateExcelTemplate(ctx context.Context, req *v1.TSimCardAllocateExcelTemplateReq) (res *v1.TSimCardAllocateExcelTemplateRes, err error) { + err = service.IotTSimCardAllocate().DownloadExcelTemplate(ctx) + return nil, err +} + +func (c *ControllerV1) TSimCardAllocateTargetList(ctx context.Context, req *v1.TSimCardAllocateTargetListReq) (res *v1.TSimCardAllocateTargetListRes, err error) { + items, err := service.IotTSimCardAllocate().ListTargets(ctx, &req.TSimCardAllocateTargetListParam) + if err != nil { + return nil, err + } + return &v1.TSimCardAllocateTargetListRes{Items: items}, nil +} + +func (c *ControllerV1) TSimCardAllocateInputPrepare(ctx context.Context, req *v1.TSimCardAllocateInputPrepareReq) (res *v1.TSimCardAllocateInputPrepareRes, err error) { + data, err := service.IotTSimCardAllocate().PrepareInput(ctx, &req.TSimCardAllocatePrepareParam) + if err != nil { + return nil, err + } + return &v1.TSimCardAllocateInputPrepareRes{TSimCardAllocateBatchModel: data}, nil +} + +func (c *ControllerV1) TSimCardAllocateExcelSubmit(ctx context.Context, req *v1.TSimCardAllocateExcelSubmitReq) (res *v1.TSimCardAllocateExcelSubmitRes, err error) { + data, err := service.IotTSimCardAllocate().PrepareExcel(ctx, &req.TSimCardAllocateExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardAllocateExcelSubmitRes{TSimCardAllocateBatchModel: data}, nil +} + +func (c *ControllerV1) TSimCardAllocateBatchSubmit(ctx context.Context, req *v1.TSimCardAllocateBatchSubmitReq) (res *v1.TSimCardAllocateBatchSubmitRes, err error) { + data, err := service.IotTSimCardAllocate().SubmitBatch(ctx, &req.TSimCardAllocateBatchSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardAllocateBatchSubmitRes{TSimCardAllocateBatchModel: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardbindpkg.go b/server/internal/controller/iot/iot_v1_tsimcardbindpkg.go new file mode 100644 index 0000000..a521819 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardbindpkg.go @@ -0,0 +1,168 @@ +package iot + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看订购表列表 +func (c *ControllerV1) TSimCardBindPkgList(ctx context.Context, req *v1.TSimCardBindPkgListReq) (res *v1.TSimCardBindPkgListRes, err error) { + list, totalCount, err := service.IotTSimCardBindPkg().List(ctx, &req.TSimCardBindPkgListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimCardBindPkgListModel{} + } + + res = new(v1.TSimCardBindPkgListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出订购表列表 +func (c *ControllerV1) TSimCardBindPkgExport(ctx context.Context, req *v1.TSimCardBindPkgExportReq) (res *v1.TSimCardBindPkgExportRes, err error) { + err = service.IotTSimCardBindPkg().Export(ctx, &req.TSimCardBindPkgListParam) + return +} + +// Edit 更新订购表 +func (c *ControllerV1) TSimCardBindPkgEdit(ctx context.Context, req *v1.TSimCardBindPkgEditReq) (res *v1.TSimCardBindPkgEditRes, err error) { + err = service.IotTSimCardBindPkg().Edit(ctx, &req.TSimCardBindPkgEditParam) + return +} + +// View 获取指定订购表信息 +func (c *ControllerV1) TSimCardBindPkgView(ctx context.Context, req *v1.TSimCardBindPkgViewReq) (res *v1.TSimCardBindPkgViewRes, err error) { + data, err := service.IotTSimCardBindPkg().View(ctx, &req.TSimCardBindPkgViewParam) + if err != nil { + return + } + + res = new(v1.TSimCardBindPkgViewRes) + res.TSimCardBindPkgViewModel = data + return +} + +// Delete 删除订购表 +func (c *ControllerV1) TSimCardBindPkgDelete(ctx context.Context, req *v1.TSimCardBindPkgDeleteReq) (res *v1.TSimCardBindPkgDeleteRes, err error) { + err = service.IotTSimCardBindPkg().Delete(ctx, &req.TSimCardBindPkgDeleteParam) + return +} + +// GetPkgInfo 套餐详情查询 +func (c *ControllerV1) TSimCardBindPkgGetPkgInfo(ctx context.Context, req *v1.TSimCardBindPkgGetPkgInfoReq) (res *v1.TSimCardBindPkgGetPkgInfoRes, err error) { + list, totalCount, err := service.IotTSimCardBindPkg().GetPkgInfo(ctx, &req.TSimCardBindPkgInfoParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimCardBindPkgListModel{} + } + + res = new(v1.TSimCardBindPkgGetPkgInfoRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// GetChangePkg 变更套餐查询 +func (c *ControllerV1) TSimCardBindPkgGetChangePkg(ctx context.Context, req *v1.TSimCardBindPkgGetChangePkgReq) (res *v1.TSimCardBindPkgGetChangePkgRes, err error) { + list, totalCount, err := service.IotTSimCardBindPkg().GetChangePkg(ctx, &req.TSimCardBindPkgInfoParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimCardBindPkgListModel{} + } + + res = new(v1.TSimCardBindPkgGetChangePkgRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +func (c *ControllerV1) TSimCardBindPkgAddPackagePaymentContext(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePaymentContextReq) (res *v1.TSimCardBindPkgAddPackagePaymentContextRes, err error) { + data, err := service.IotTSimCardBindPkg().AddPackagePaymentContext(ctx) + if err != nil { + return nil, err + } + if data == nil { + data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}} + } + return &v1.TSimCardBindPkgAddPackagePaymentContextRes{TSimAddPackageOptionsRes: data}, nil +} + +func (c *ControllerV1) TSimCardBindPkgAddPackageOptions(ctx context.Context, req *v1.TSimCardBindPkgAddPackageOptionsReq) (res *v1.TSimCardBindPkgAddPackageOptionsRes, err error) { + data, err := service.IotTSimCardBindPkg().AddPackageOptions(ctx, &req.TSimCardAddPackageOptionsParam) + if err != nil { + return nil, err + } + if data == nil { + data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}} + } + if data.Items == nil { + data.Items = []*model.TSimAddPackageOptionModel{} + } + return &v1.TSimCardBindPkgAddPackageOptionsRes{TSimAddPackageOptionsRes: data}, nil +} + +func (c *ControllerV1) TSimCardBindPkgDownloadExcelTemplate(ctx context.Context, req *v1.TSimCardBindPkgDownloadExcelTemplateReq) (res *v1.TSimCardBindPkgDownloadExcelTemplateRes, err error) { + err = service.IotTSimCardBindPkg().DownloadExcelTemplate(ctx) + return +} + +func (c *ControllerV1) TSimCardBindPkgSubmitExcel(ctx context.Context, req *v1.TSimCardBindPkgSubmitExcelReq) (res *v1.TSimCardBindPkgSubmitExcelRes, err error) { + data, err := service.IotTSimCardBindPkg().SubmitExcel(ctx, &req.TSimCardBindPkgAddPackageExcelSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardBindPkgSubmitExcelRes{TSimCardBindPkgAddPackageExcelSubmitRes: data} + return +} + +func (c *ControllerV1) TSimCardBindPkgSubmitInput(ctx context.Context, req *v1.TSimCardBindPkgSubmitInputReq) (res *v1.TSimCardBindPkgSubmitInputRes, err error) { + data, err := service.IotTSimCardBindPkg().SubmitInput(ctx, &req.TSimCardBindPkgAddPackageInputSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardBindPkgSubmitInputRes{TSimCardBindPkgAddPackageInputSubmitRes: data} + return +} + +func (c *ControllerV1) TSimCardBindPkgAddPackageInputPrepare(ctx context.Context, req *v1.TSimCardBindPkgAddPackageInputPrepareReq) (res *v1.TSimCardBindPkgAddPackageInputPrepareRes, err error) { + data, err := service.IotTSimCardBindPkg().PrepareInput(ctx, &req.TSimCardBindPkgAddPackageInputPrepareParam) + if err != nil { + return nil, err + } + return &v1.TSimCardBindPkgAddPackageInputPrepareRes{TSimCardBindPkgAddPackageInputPrepareRes: data}, nil +} + +func (c *ControllerV1) TSimCardBindPkgAddPackagePrepareResult(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePrepareResultReq) (res *v1.TSimCardBindPkgAddPackagePrepareResultRes, err error) { + data, err := service.IotTSimCardBindPkg().PrepareResult(ctx, req.BatchNo) + if err != nil { + return nil, err + } + return &v1.TSimCardBindPkgAddPackagePrepareResultRes{TSimCardBindPkgAddPackagePrepareResultRes: data}, nil +} + +func (c *ControllerV1) TSimCardBindPkgAddPackageBatchConfirm(ctx context.Context, req *v1.TSimCardBindPkgAddPackageBatchConfirmReq) (res *v1.TSimCardBindPkgAddPackageBatchConfirmRes, err error) { + data, err := service.IotTSimCardBindPkg().ConfirmBatch(ctx, &req.TSimCardBindPkgAddPackageBatchConfirmParam) + if err != nil { + return nil, err + } + return &v1.TSimCardBindPkgAddPackageBatchConfirmRes{TSimCardBindPkgAddPackageBatchConfirmRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardcancel.go b/server/internal/controller/iot/iot_v1_tsimcardcancel.go new file mode 100644 index 0000000..244cca6 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardcancel.go @@ -0,0 +1,29 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardCancelExcelTemplate(ctx context.Context, req *v1.TSimCardCancelExcelTemplateReq) (res *v1.TSimCardCancelExcelTemplateRes, err error) { + err = service.IotTSimCardCancel().DownloadExcelTemplate(ctx) + return +} + +func (c *ControllerV1) TSimCardCancelExcelSubmit(ctx context.Context, req *v1.TSimCardCancelExcelSubmitReq) (res *v1.TSimCardCancelExcelSubmitRes, err error) { + data, err := service.IotTSimCardCancel().SubmitExcel(ctx, &req.TSimCardCancelExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardCancelExcelSubmitRes{TSimCardCancelExcelSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimCardCancelInputSubmit(ctx context.Context, req *v1.TSimCardCancelInputSubmitReq) (res *v1.TSimCardCancelInputSubmitRes, err error) { + data, err := service.IotTSimCardCancel().SubmitInput(ctx, &req.TSimCardCancelInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardCancelInputSubmitRes{TSimCardCancelInputSubmitRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardcancellation.go b/server/internal/controller/iot/iot_v1_tsimcardcancellation.go new file mode 100644 index 0000000..088642d --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardcancellation.go @@ -0,0 +1,31 @@ +package iot + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardCancellationList(ctx context.Context, req *v1.TSimCardCancellationListReq) (res *v1.TSimCardCancellationListRes, err error) { + list, total, err := service.IotTSimCardCancellation().List(ctx, &req.TSimCardCancellationListParam) + if err != nil { + return nil, err + } + if list == nil { + list = []*model.TSimCardCancellationListModel{} + } + res = &v1.TSimCardCancellationListRes{Items: list} + res.Page = req.Page + res.PageSize = req.PageSize + res.Total = total + return res, nil +} + +func (c *ControllerV1) TSimCardCancellationExport(ctx context.Context, req *v1.TSimCardCancellationExportReq) (res *v1.TSimCardCancellationExportRes, err error) { + if err = service.IotTSimCardCancellation().Export(ctx, &req.TSimCardCancellationFilter); err != nil { + return nil, err + } + return nil, nil +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardchange.go b/server/internal/controller/iot/iot_v1_tsimcardchange.go new file mode 100644 index 0000000..41e67d6 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardchange.go @@ -0,0 +1,70 @@ +package iot + +import ( + "context" + "strings" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardChangeExcelTemplate(ctx context.Context, req *v1.TSimCardChangeExcelTemplateReq) (res *v1.TSimCardChangeExcelTemplateRes, err error) { + err = service.IotTSimCardChange().DownloadExcelTemplate(ctx) + return nil, err +} + +func (c *ControllerV1) TSimCardChangeExcelSubmit(ctx context.Context, req *v1.TSimCardChangeExcelSubmitReq) (res *v1.TSimCardChangeExcelSubmitRes, err error) { + data, err := service.IotTSimCardChange().SubmitExcel(ctx, &req.TSimCardChangeExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardChangeExcelSubmitRes{TSimCardChangeExcelSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimCardChangeInputOptions(ctx context.Context, req *v1.TSimCardChangeInputOptionsReq) (res *v1.TSimCardChangeInputOptionsRes, err error) { + data, err := service.IotTSimCardChange().InputOptions(ctx, &req.TSimCardChangeInputOptionsParam) + if err != nil { + return nil, err + } + return &v1.TSimCardChangeInputOptionsRes{TSimCardChangeOptionsRes: data}, nil +} + +func (c *ControllerV1) TSimCardChangeRangeOptions(ctx context.Context, req *v1.TSimCardChangeRangeOptionsReq) (res *v1.TSimCardChangeRangeOptionsRes, err error) { + data, err := service.IotTSimCardChange().RangeOptions(ctx, &req.TSimCardChangeRangeOptionsParam) + if err != nil { + return nil, err + } + return &v1.TSimCardChangeRangeOptionsRes{TSimCardChangeOptionsRes: data}, nil +} + +func (c *ControllerV1) TSimCardChangeInputPrepare(ctx context.Context, req *v1.TSimCardChangeInputPrepareReq) (res *v1.TSimCardChangeInputPrepareRes, err error) { + data, err := service.IotTSimCardChange().PrepareInput(ctx, &req.TSimCardChangeInputPrepareParam) + if err != nil { + return nil, err + } + return &v1.TSimCardChangeInputPrepareRes{TSimCardChangeBatchPrepareRes: data}, nil +} + +func (c *ControllerV1) TSimCardChangeRangePrepare(ctx context.Context, req *v1.TSimCardChangeRangePrepareReq) (res *v1.TSimCardChangeRangePrepareRes, err error) { + data, err := service.IotTSimCardChange().PrepareRange(ctx, &req.TSimCardChangeRangePrepareParam) + if err != nil { + return nil, err + } + return &v1.TSimCardChangeRangePrepareRes{TSimCardChangeBatchPrepareRes: data}, nil +} + +func (c *ControllerV1) TSimCardChangeBatchSubmit(ctx context.Context, req *v1.TSimCardChangeBatchSubmitReq) (res *v1.TSimCardChangeBatchSubmitRes, err error) { + data, err := service.IotTSimCardChange().SubmitBatch(ctx, &req.TSimCardChangeBatchSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardChangeBatchSubmitRes{TSimCardChangeBatchSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimCardChangePrepareResult(ctx context.Context, req *v1.TSimCardChangePrepareResultReq) (res *v1.TSimCardChangePrepareResultRes, err error) { + data, err := service.IotTSimCardChange().PrepareResult(ctx, strings.TrimSpace(req.BatchNo)) + if err != nil { + return nil, err + } + return &v1.TSimCardChangePrepareResultRes{TSimCardChangePrepareResultRes: data}, nil +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardoutbound.go b/server/internal/controller/iot/iot_v1_tsimcardoutbound.go new file mode 100644 index 0000000..a7e1b13 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardoutbound.go @@ -0,0 +1,83 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardOutboundExcelTemplate(ctx context.Context, req *v1.TSimCardOutboundExcelTemplateReq) (res *v1.TSimCardOutboundExcelTemplateRes, err error) { + err = service.IotTSimCardOutbound().DownloadExcelTemplate(ctx) + return nil, err +} +func (c *ControllerV1) TSimCardOutboundExcelSubmit(ctx context.Context, req *v1.TSimCardOutboundExcelSubmitReq) (res *v1.TSimCardOutboundExcelSubmitRes, err error) { + data, err := service.IotTSimCardOutbound().SubmitExcel(ctx, &req.TSimCardOutboundExcelSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundExcelSubmitRes{ + TSimCardOutboundExcelSubmitRes: data, + } + return +} +func (c *ControllerV1) TSimCardOutboundRangeSubmit(ctx context.Context, req *v1.TSimCardOutboundRangeSubmitReq) (res *v1.TSimCardOutboundRangeSubmitRes, err error) { + data, err := service.IotTSimCardOutbound().SubmitRange(ctx, &req.TSimCardOutboundRangeSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundRangeSubmitRes{ + TSimCardOutboundRangeSubmitRes: data, + } + return +} +func (c *ControllerV1) TSimCardOutboundInputSubmit(ctx context.Context, req *v1.TSimCardOutboundInputSubmitReq) (res *v1.TSimCardOutboundInputSubmitRes, err error) { + data, err := service.IotTSimCardOutbound().SubmitInput(ctx, &req.TSimCardOutboundInputSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundInputSubmitRes{ + TSimCardOutboundInputSubmitRes: data, + } + return +} +func (c *ControllerV1) TSimCardOutboundInboundBatchList(ctx context.Context, req *v1.TSimCardOutboundInboundBatchListReq) (res *v1.TSimCardOutboundInboundBatchListRes, err error) { + data, err := service.IotTSimCardOutbound().ListInboundBatches(ctx, &req.TSimCardOutboundInboundBatchListParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundInboundBatchListRes{ + TSimCardOutboundInboundBatchListRes: data, + } + return +} +func (c *ControllerV1) TSimCardOutboundInboundBatchCards(ctx context.Context, req *v1.TSimCardOutboundInboundBatchCardsReq) (res *v1.TSimCardOutboundInboundBatchCardsRes, err error) { + data, err := service.IotTSimCardOutbound().ListInboundBatchCards(ctx, &req.TSimCardOutboundInboundBatchCardsParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundInboundBatchCardsRes{ + TSimCardOutboundInboundBatchCardsRes: data, + } + return +} +func (c *ControllerV1) TSimCardOutboundBatchSubmit(ctx context.Context, req *v1.TSimCardOutboundBatchSubmitReq) (res *v1.TSimCardOutboundBatchSubmitRes, err error) { + data, err := service.IotTSimCardOutbound().SubmitBatch(ctx, &req.TSimCardOutboundBatchSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundBatchSubmitRes{ + TSimCardOutboundBatchSubmitRes: data, + } + return +} +func (c *ControllerV1) TSimCardOutboundCustomerBalance(ctx context.Context, req *v1.TSimCardOutboundCustomerBalanceReq) (res *v1.TSimCardOutboundCustomerBalanceRes, err error) { + data, err := service.IotTSimCardOutbound().CustomerBalance(ctx, &req.TSimCardOutboundCustomerBalanceParam) + if err != nil { + return + } + res = &v1.TSimCardOutboundCustomerBalanceRes{ + TSimCardOutboundCustomerBalanceRes: data, + } + return +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardrenew.go b/server/internal/controller/iot/iot_v1_tsimcardrenew.go new file mode 100644 index 0000000..c1e4672 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardrenew.go @@ -0,0 +1,58 @@ +package iot + +import ( + "context" + "strings" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardRenewInputPrepare(ctx context.Context, req *v1.TSimCardRenewInputPrepareReq) (res *v1.TSimCardRenewInputPrepareRes, err error) { + data, err := service.IotTSimCardRenew().PrepareInput(ctx, &req.TSimCardRenewInputPrepareParam) + if err != nil { + return nil, err + } + res = &v1.TSimCardRenewInputPrepareRes{ + TSimCardRenewBatchPrepareRes: data, + } + return +} + +func (c *ControllerV1) TSimCardRenewExcelTemplate(ctx context.Context, req *v1.TSimCardRenewExcelTemplateReq) (res *v1.TSimCardRenewExcelTemplateRes, err error) { + err = service.IotTSimCardRenew().DownloadExcelTemplate(ctx) + return nil, err +} + +func (c *ControllerV1) TSimCardRenewExcelSubmit(ctx context.Context, req *v1.TSimCardRenewExcelSubmitReq) (res *v1.TSimCardRenewExcelSubmitRes, err error) { + data, err := service.IotTSimCardRenew().SubmitExcel(ctx, &req.TSimCardRenewExcelSubmitParam) + if err != nil { + return nil, err + } + res = &v1.TSimCardRenewExcelSubmitRes{ + TSimCardRenewExcelSubmitRes: data, + } + return +} + +func (c *ControllerV1) TSimCardRenewBatchConfirm(ctx context.Context, req *v1.TSimCardRenewBatchConfirmReq) (res *v1.TSimCardRenewBatchConfirmRes, err error) { + data, err := service.IotTSimCardRenew().ConfirmBatch(ctx, &req.TSimCardRenewBatchConfirmParam) + if err != nil { + return nil, err + } + res = &v1.TSimCardRenewBatchConfirmRes{ + TSimCardRenewBatchConfirmRes: data, + } + return +} + +func (c *ControllerV1) TSimCardRenewPrepareResult(ctx context.Context, req *v1.TSimCardRenewPrepareResultReq) (res *v1.TSimCardRenewPrepareResultRes, err error) { + data, err := service.IotTSimCardRenew().PrepareResult(ctx, strings.TrimSpace(req.BatchNo)) + if err != nil { + return nil, err + } + res = &v1.TSimCardRenewPrepareResultRes{ + TSimCardRenewPrepareResultRes: data, + } + return +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardtrafficcutoff.go b/server/internal/controller/iot/iot_v1_tsimcardtrafficcutoff.go new file mode 100644 index 0000000..9073e09 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardtrafficcutoff.go @@ -0,0 +1,66 @@ +package iot + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardTrafficCutoffExcelTemplate(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelTemplateReq) (res *v1.TSimCardTrafficCutoffExcelTemplateRes, err error) { + err = service.IotTSimCardTrafficCutoff().DownloadExcelTemplate(ctx) + return +} + +func (c *ControllerV1) TSimCardTrafficCutoffExcelSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelSubmitReq) (res *v1.TSimCardTrafficCutoffExcelSubmitRes, err error) { + data, err := service.IotTSimCardTrafficCutoff().SubmitExcel(ctx, &req.TSimCardTrafficCutoffExcelSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardTrafficCutoffExcelSubmitRes{TSimCardTrafficCutoffExcelSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimCardTrafficCutoffInputSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffInputSubmitReq) (res *v1.TSimCardTrafficCutoffInputSubmitRes, err error) { + data, err := service.IotTSimCardTrafficCutoff().SubmitInput(ctx, &req.TSimCardTrafficCutoffInputSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardTrafficCutoffInputSubmitRes{TSimCardTrafficCutoffInputSubmitRes: data}, nil +} + +func (c *ControllerV1) TSimCardTrafficCutoffRangeSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffRangeSubmitReq) (res *v1.TSimCardTrafficCutoffRangeSubmitRes, err error) { + data, err := service.IotTSimCardTrafficCutoff().SubmitRange(ctx, &req.TSimCardTrafficCutoffRangeSubmitParam) + if err != nil { + return nil, err + } + return &v1.TSimCardTrafficCutoffRangeSubmitRes{TSimCardTrafficCutoffRangeSubmitRes: data}, nil +} +func (c *ControllerV1) TSimCardTrafficCutoffList(ctx context.Context, req *v1.TSimCardTrafficCutoffListReq) (res *v1.TSimCardTrafficCutoffListRes, err error) { + list, total, err := service.IotTSimCardTrafficCutoff().List(ctx, &req.TSimCardTrafficCutoffListParam) + if err != nil { + return nil, err + } + if list == nil { + list = []*model.TSimCardInfoListModel{} + } + res = &v1.TSimCardTrafficCutoffListRes{Items: list} + res.Page = req.Page + res.PageSize = req.PageSize + res.Total = total + return res, nil +} + +func (c *ControllerV1) TSimCardTrafficCutoffExport(ctx context.Context, req *v1.TSimCardTrafficCutoffExportReq) (res *v1.TSimCardTrafficCutoffExportRes, err error) { + err = service.IotTSimCardTrafficCutoff().Export(ctx, &req.TSimCardTrafficCutoffListParam) + return +} + +func (c *ControllerV1) TSimCardTrafficCutoffEdit(ctx context.Context, req *v1.TSimCardTrafficCutoffEditReq) (res *v1.TSimCardTrafficCutoffEditRes, err error) { + err = service.IotTSimCardTrafficCutoff().Edit(ctx, &req.TSimCardTrafficCutoffEditParam) + return +} +func (c *ControllerV1) TSimCardTrafficCutoffDelete(ctx context.Context, req *v1.TSimCardTrafficCutoffDeleteReq) (res *v1.TSimCardTrafficCutoffDeleteRes, err error) { + err = service.IotTSimCardTrafficCutoff().Delete(ctx, &req.TSimCardTrafficCutoffDeleteParam) + return +} diff --git a/server/internal/controller/iot/iot_v1_tsimcardunsub.go b/server/internal/controller/iot/iot_v1_tsimcardunsub.go new file mode 100644 index 0000000..4a1d694 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimcardunsub.go @@ -0,0 +1,46 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardUnsubExcelTemplate(ctx context.Context, req *v1.TSimCardUnsubExcelTemplateReq) (res *v1.TSimCardUnsubExcelTemplateRes, err error) { + err = service.IotTSimCardUnsub().DownloadExcelTemplate(ctx) + return +} + +func (c *ControllerV1) TSimCardUnsubExcelSubmit(ctx context.Context, req *v1.TSimCardUnsubExcelSubmitReq) (res *v1.TSimCardUnsubExcelSubmitRes, err error) { + data, err := service.IotTSimCardUnsub().SubmitExcel(ctx, &req.TSimCardUnsubExcelSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardUnsubExcelSubmitRes{ + TSimCardUnsubExcelSubmitRes: data, + } + return +} + +func (c *ControllerV1) TSimCardUnsubInputSubmit(ctx context.Context, req *v1.TSimCardUnsubInputSubmitReq) (res *v1.TSimCardUnsubInputSubmitRes, err error) { + data, err := service.IotTSimCardUnsub().SubmitInput(ctx, &req.TSimCardUnsubInputSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardUnsubInputSubmitRes{ + TSimCardUnsubInputSubmitRes: data, + } + return +} + +func (c *ControllerV1) TSimCardUnsubRangeSubmit(ctx context.Context, req *v1.TSimCardUnsubRangeSubmitReq) (res *v1.TSimCardUnsubRangeSubmitRes, err error) { + data, err := service.IotTSimCardUnsub().SubmitRange(ctx, &req.TSimCardUnsubRangeSubmitParam) + if err != nil { + return + } + res = &v1.TSimCardUnsubRangeSubmitRes{ + TSimCardUnsubRangeSubmitRes: data, + } + return +} diff --git a/server/internal/controller/iot/iot_v1_tsimflowpackageprice.go b/server/internal/controller/iot/iot_v1_tsimflowpackageprice.go new file mode 100644 index 0000000..dd45040 --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimflowpackageprice.go @@ -0,0 +1,53 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimFlowPackagePriceAgentDefaultPackagePriceList(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceListReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceListRes, err error) { + list, totalCount, err := service.IotTSimFlowPackagePrice().AgentDefaultPackagePriceList(ctx, &req.TSimFlowPackagePriceAgentDefaultPackagePriceListParam) + if err != nil { + return + } + + if list == nil { + list = []*iotin.TSimFlowPackagePriceAgentDefaultPackagePriceListItem{} + } + + res = new(v1.TSimFlowPackagePriceAgentDefaultPackagePriceListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} +func (c *ControllerV1) TSimFlowPackagePriceAgentPackagePriceSave(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceSaveReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceSaveRes, err error) { + err = service.IotTSimFlowPackagePrice().SaveAgentPackagePrice(ctx, &req.TSimFlowPackagePriceAgentPackagePriceSaveParam) + if err != nil { + return + } + res = new(v1.TSimFlowPackagePriceAgentPackagePriceSaveRes) + return +} + +func (c *ControllerV1) TSimFlowPackagePriceAgentDefaultPackagePriceSave(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveRes, err error) { + err = service.IotTSimFlowPackagePrice().SaveAgentDefaultPackagePrice(ctx, &req.TSimFlowPackagePriceAgentDefaultPackagePriceSaveParam) + if err != nil { + return + } + res = new(v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveRes) + return +} + +func (c *ControllerV1) TSimFlowPackagePriceAgentDefaultPackagePriceInherit(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritRes, err error) { + err = service.IotTSimFlowPackagePrice().InheritAgentDefaultPackagePrice(ctx, &req.TSimFlowPackagePriceAgentDefaultPackagePriceInheritParam) + if err != nil { + return + } + res = new(v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritRes) + return +} diff --git a/server/internal/controller/iot/iot_v1_tsimpoolbindpackage.go b/server/internal/controller/iot/iot_v1_tsimpoolbindpackage.go new file mode 100644 index 0000000..aa872fb --- /dev/null +++ b/server/internal/controller/iot/iot_v1_tsimpoolbindpackage.go @@ -0,0 +1,131 @@ +package iot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" +) + +// List 查看卡池加油包订购表列表 +func (c *ControllerV1) TSimPoolBindPackageList(ctx context.Context, req *v1.TSimPoolBindPackageListReq) (res *v1.TSimPoolBindPackageListRes, err error) { + list, totalCount, err := service.IotTSimPoolBindPackage().List(ctx, &req.TSimPoolBindPackageListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimPoolBindPackageListModel{} + } + + res = new(v1.TSimPoolBindPackageListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出卡池加油包订购表列表 +func (c *ControllerV1) TSimPoolBindPackageExport(ctx context.Context, req *v1.TSimPoolBindPackageExportReq) (res *v1.TSimPoolBindPackageExportRes, err error) { + err = service.IotTSimPoolBindPackage().Export(ctx, &req.TSimPoolBindPackageListParam) + return +} + +// Edit 更新卡池加油包订购表 +func (c *ControllerV1) TSimPoolBindPackageEdit(ctx context.Context, req *v1.TSimPoolBindPackageEditReq) (res *v1.TSimPoolBindPackageEditRes, err error) { + err = service.IotTSimPoolBindPackage().Edit(ctx, &req.TSimPoolBindPackageEditParam) + return +} + +// View 获取指定卡池加油包订购表信息 +func (c *ControllerV1) TSimPoolBindPackageView(ctx context.Context, req *v1.TSimPoolBindPackageViewReq) (res *v1.TSimPoolBindPackageViewRes, err error) { + data, err := service.IotTSimPoolBindPackage().View(ctx, &req.TSimPoolBindPackageViewParam) + if err != nil { + return + } + + res = new(v1.TSimPoolBindPackageViewRes) + res.TSimPoolBindPackageViewModel = data + return +} + +// Delete 删除卡池加油包订购表 +func (c *ControllerV1) TSimPoolBindPackageDelete(ctx context.Context, req *v1.TSimPoolBindPackageDeleteReq) (res *v1.TSimPoolBindPackageDeleteRes, err error) { + err = service.IotTSimPoolBindPackage().Delete(ctx, &req.TSimPoolBindPackageDeleteParam) + return +} + +func (c *ControllerV1) TSimPoolBindPackageAddPackagePaymentContext(ctx context.Context, req *v1.TSimPoolBindPackageAddPackagePaymentContextReq) (res *v1.TSimPoolBindPackageAddPackagePaymentContextRes, err error) { + data, err := service.IotTSimPoolBindPackage().AddPackagePaymentContext(ctx) + if err != nil { + return nil, err + } + if data == nil { + data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}} + } + return &v1.TSimPoolBindPackageAddPackagePaymentContextRes{TSimAddPackageOptionsRes: data}, nil +} + +func (c *ControllerV1) TSimPoolBindPackageAddPackageOptions(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageOptionsReq) (res *v1.TSimPoolBindPackageAddPackageOptionsRes, err error) { + data, err := service.IotTSimPoolBindPackage().AddPackageOptions(ctx, &req.TSimPoolAddPackageOptionsParam) + if err != nil { + return nil, err + } + if data == nil { + data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}} + } + if data.Items == nil { + data.Items = []*model.TSimAddPackageOptionModel{} + } + return &v1.TSimPoolBindPackageAddPackageOptionsRes{TSimAddPackageOptionsRes: data}, nil +} + +func (c *ControllerV1) TSimPoolBindPackageDownloadExcelTemplate(ctx context.Context, req *v1.TSimPoolBindPackageDownloadExcelTemplateReq) (res *v1.TSimPoolBindPackageDownloadExcelTemplateRes, err error) { + err = service.IotTSimPoolBindPackage().DownloadExcelTemplate(ctx) + return +} + +func (c *ControllerV1) TSimPoolBindPackageSubmitExcel(ctx context.Context, req *v1.TSimPoolBindPackageSubmitExcelReq) (res *v1.TSimPoolBindPackageSubmitExcelRes, err error) { + data, err := service.IotTSimPoolBindPackage().SubmitExcel(ctx, &req.TSimPoolBindPackageAddPackageExcelSubmitParam) + if err != nil { + return + } + res = &v1.TSimPoolBindPackageSubmitExcelRes{TSimPoolBindPackageAddPackageExcelSubmitRes: data} + return +} + +func (c *ControllerV1) TSimPoolBindPackageSubmitInput(ctx context.Context, req *v1.TSimPoolBindPackageSubmitInputReq) (res *v1.TSimPoolBindPackageSubmitInputRes, err error) { + data, err := service.IotTSimPoolBindPackage().SubmitInput(ctx, &req.TSimPoolBindPackageAddPackageInputSubmitParam) + if err != nil { + return + } + res = &v1.TSimPoolBindPackageSubmitInputRes{TSimPoolBindPackageAddPackageInputSubmitRes: data} + return +} + +func (c *ControllerV1) TSimPoolBindPackageAddPackageInputPrepare(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageInputPrepareReq) (res *v1.TSimPoolBindPackageAddPackageInputPrepareRes, err error) { + data, err := service.IotTSimPoolBindPackage().PrepareInput(ctx, &req.TSimPoolBindPackageAddPackageInputPrepareParam) + if err != nil { + return nil, err + } + return &v1.TSimPoolBindPackageAddPackageInputPrepareRes{TSimPoolBindPackageAddPackageInputPrepareRes: data}, nil +} + +func (c *ControllerV1) TSimPoolBindPackageAddPackagePrepareResult(ctx context.Context, req *v1.TSimPoolBindPackageAddPackagePrepareResultReq) (res *v1.TSimPoolBindPackageAddPackagePrepareResultRes, err error) { + data, err := service.IotTSimPoolBindPackage().PrepareResult(ctx, req.BatchNo) + if err != nil { + return nil, err + } + return &v1.TSimPoolBindPackageAddPackagePrepareResultRes{TSimPoolBindPackageAddPackagePrepareResultRes: data}, nil +} + +func (c *ControllerV1) TSimPoolBindPackageAddPackageBatchConfirm(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageBatchConfirmReq) (res *v1.TSimPoolBindPackageAddPackageBatchConfirmRes, err error) { + data, err := service.IotTSimPoolBindPackage().ConfirmBatch(ctx, &req.TSimPoolBindPackageAddPackageBatchConfirmParam) + if err != nil { + return nil, err + } + return &v1.TSimPoolBindPackageAddPackageBatchConfirmRes{TSimPoolBindPackageAddPackageBatchConfirmRes: data}, nil +} diff --git a/server/internal/controller/iot/t_order.go b/server/internal/controller/iot/t_order.go new file mode 100644 index 0000000..1875ac3 --- /dev/null +++ b/server/internal/controller/iot/t_order.go @@ -0,0 +1,9 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import () diff --git a/server/internal/controller/iot/t_sim_card_inbound.go b/server/internal/controller/iot/t_sim_card_inbound.go new file mode 100644 index 0000000..1ad1b9b --- /dev/null +++ b/server/internal/controller/iot/t_sim_card_inbound.go @@ -0,0 +1,46 @@ +package iot + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimCardInboundExcelTemplate(ctx context.Context, req *v1.TSimCardInboundExcelTemplateReq) (res *v1.TSimCardInboundExcelTemplateRes, err error) { + err = service.IotTSimCardInbound().DownloadExcelTemplate(ctx) + return nil, nil +} + +func (c *ControllerV1) TSimCardInboundExcelSubmit(ctx context.Context, req *v1.TSimCardInboundExcelSubmitReq) (res *v1.TSimCardInboundExcelSubmitRes, err error) { + data, err := service.IotTSimCardInbound().SubmitExcel(ctx, &req.TSimCardInboundExcelSubmitParam) + if err != nil { + return + } + + res = new(v1.TSimCardInboundExcelSubmitRes) + res.TSimCardInboundExcelSubmitRes = data + return +} + +func (c *ControllerV1) TSimCardInboundRangeSubmit(ctx context.Context, req *v1.TSimCardInboundRangeSubmitReq) (res *v1.TSimCardInboundRangeSubmitRes, err error) { + data, err := service.IotTSimCardInbound().SubmitRange(ctx, &req.TSimCardInboundRangeSubmitParam) + if err != nil { + return + } + + res = new(v1.TSimCardInboundRangeSubmitRes) + res.TSimCardInboundRangeSubmitRes = data + return +} + +func (c *ControllerV1) TSimCardInboundInputSubmit(ctx context.Context, req *v1.TSimCardInboundInputSubmitReq) (res *v1.TSimCardInboundInputSubmitRes, err error) { + data, err := service.IotTSimCardInbound().SubmitInput(ctx, &req.TSimCardInboundInputSubmitParam) + if err != nil { + return + } + + res = new(v1.TSimCardInboundInputSubmitRes) + res.TSimCardInboundInputSubmitRes = data + return +} diff --git a/server/internal/controller/iot/t_sim_card_info.go b/server/internal/controller/iot/t_sim_card_info.go new file mode 100644 index 0000000..6ac9c1a --- /dev/null +++ b/server/internal/controller/iot/t_sim_card_info.go @@ -0,0 +1,106 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看卡信息表列表 +func (c *ControllerV1) TSimCardInfoList(ctx context.Context, req *v1.TSimCardInfoListReq) (res *v1.TSimCardInfoListRes, err error) { + list, totalCount, err := service.IotTSimCardInfo().List(ctx, &req.TSimCardInfoListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimCardInfoListModel{} + } + + res = new(v1.TSimCardInfoListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出卡信息表列表 +func (c *ControllerV1) TSimCardInfoExport(ctx context.Context, req *v1.TSimCardInfoExportReq) (res *v1.TSimCardInfoExportRes, err error) { + err = service.IotTSimCardInfo().Export(ctx, &req.TSimCardInfoListParam) + return +} + +// Edit 修改/新增卡信息表 +func (c *ControllerV1) TSimCardInfoEdit(ctx context.Context, req *v1.TSimCardInfoEditReq) (res *v1.TSimCardInfoEditRes, err error) { + if req.Id > 0 { + err = service.IotTSimCardInfo().Edit(ctx, &model.TSimCardInfoEditParam{ + Id: req.Id, + Remark: req.Remark, + }) + return + } + err = service.IotTSimCardInfo().Edit(ctx, &req.TSimCardInfoEditParam) + return +} + +// View 获取指定卡信息表信息 +func (c *ControllerV1) TSimCardInfoView(ctx context.Context, req *v1.TSimCardInfoViewReq) (res *v1.TSimCardInfoViewRes, err error) { + data, err := service.IotTSimCardInfo().View(ctx, &req.TSimCardInfoViewParam) + if err != nil { + return + } + + res = new(v1.TSimCardInfoViewRes) + res.TSimCardInfoViewModel = data + return +} + +// Delete 删除卡信息表 +func (c *ControllerV1) TSimCardInfoDelete(ctx context.Context, req *v1.TSimCardInfoDeleteReq) (res *v1.TSimCardInfoDeleteRes, err error) { + err = service.IotTSimCardInfo().Delete(ctx, &req.TSimCardInfoDeleteParam) + return +} + +// SyncCardFlow 同步卡流量 +func (c *ControllerV1) TSimCardInfoSyncSimCardFlow(ctx context.Context, req *v1.TSimCardInfoSyncSimCardFlowReq) (res *v1.TSimCardInfoSyncSimCardFlowRes, err error) { + err = service.IotTSimCardInfo().SyncSimCardFlow(ctx, &req.SyncSimCardFlowInput) + return +} + +// SyncSimCardStatus 同步SIM卡状态 +func (c *ControllerV1) TSimCardInfoSyncSimCardStatus(ctx context.Context, req *v1.TSimCardInfoSyncSimCardStatusReq) (res *v1.TSimCardInfoSyncSimCardStatusRes, err error) { + err = service.IotTSimCardInfo().SyncSimCardStatus(ctx, &req.SyncSimCardStatusInput) + if err != nil { + return + } + res = &v1.TSimCardInfoSyncSimCardStatusRes{} + return +} + +// QuerySimSession 查询SIM卡会话 +func (c *ControllerV1) TSimCardInfoQuerySimSession(ctx context.Context, req *v1.TSimCardInfoQuerySimSessionReq) (res *v1.TSimCardInfoQuerySimSessionRes, err error) { + simSessionOutput, err := service.IotTSimCardInfo().QuerySimSession(ctx, &req.QuerySimSessionInput) + if err != nil { + return + } + res = &v1.TSimCardInfoQuerySimSessionRes{QuerySimSessionOutput: simSessionOutput} + return res, nil +} + +// QuerySimStatus 查询SIM卡状态 +func (c *ControllerV1) TSimCardInfoQuerySimStatus(ctx context.Context, req *v1.TSimCardInfoQuerySimStatusReq) (res *v1.TSimCardInfoQuerySimStatusRes, err error) { + simStatusOutput, err := service.IotTSimCardInfo().QuerySimStatus(ctx, &req.QuerySimStatusInput) + if err != nil { + return + } + res = &v1.TSimCardInfoQuerySimStatusRes{QuerySimStatusOutput: simStatusOutput} + return res, nil +} diff --git a/server/internal/controller/iot/t_sim_card_status_queue.go b/server/internal/controller/iot/t_sim_card_status_queue.go new file mode 100644 index 0000000..ac36b3f --- /dev/null +++ b/server/internal/controller/iot/t_sim_card_status_queue.go @@ -0,0 +1,17 @@ +package iot + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// TSimCardInfoSyncSimCardStatusQueue enqueues a status query. The existing +// TSimCardInfoSyncSimCardStatus endpoint remains synchronous and untouched. +func (c *ControllerV1) TSimCardInfoSyncSimCardStatusQueue(ctx context.Context, req *v1.TSimCardInfoSyncSimCardStatusQueueReq) (res *v1.TSimCardInfoSyncSimCardStatusQueueRes, err error) { + if err = service.IotTSimCardInfo().EnqueueSimCardStatus(ctx, &req.SyncSimCardStatusInput); err != nil { + return nil, err + } + return &v1.TSimCardInfoSyncSimCardStatusQueueRes{}, nil +} diff --git a/server/internal/controller/iot/t_sim_card_stock.go b/server/internal/controller/iot/t_sim_card_stock.go new file mode 100644 index 0000000..25323b1 --- /dev/null +++ b/server/internal/controller/iot/t_sim_card_stock.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看库存卡信息表列表 +func (c *ControllerV1) TSimCardStockList(ctx context.Context, req *v1.TSimCardStockListReq) (res *v1.TSimCardStockListRes, err error) { + list, totalCount, err := service.IotTSimCardStock().List(ctx, &req.TSimCardStockListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimCardStockListModel{} + } + + res = new(v1.TSimCardStockListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出库存卡信息表列表 +func (c *ControllerV1) TSimCardStockExport(ctx context.Context, req *v1.TSimCardStockExportReq) (res *v1.TSimCardStockExportRes, err error) { + err = service.IotTSimCardStock().Export(ctx, &req.TSimCardStockListParam) + return +} + +// Edit 更新库存卡信息表 +func (c *ControllerV1) TSimCardStockEdit(ctx context.Context, req *v1.TSimCardStockEditReq) (res *v1.TSimCardStockEditRes, err error) { + err = service.IotTSimCardStock().Edit(ctx, &req.TSimCardStockEditParam) + return +} + +// View 获取指定库存卡信息表信息 +func (c *ControllerV1) TSimCardStockView(ctx context.Context, req *v1.TSimCardStockViewReq) (res *v1.TSimCardStockViewRes, err error) { + data, err := service.IotTSimCardStock().View(ctx, &req.TSimCardStockViewParam) + if err != nil { + return + } + + res = new(v1.TSimCardStockViewRes) + res.TSimCardStockViewModel = data + return +} + +// Delete 删除库存卡信息表 +func (c *ControllerV1) TSimCardStockDelete(ctx context.Context, req *v1.TSimCardStockDeleteReq) (res *v1.TSimCardStockDeleteRes, err error) { + err = service.IotTSimCardStock().Delete(ctx, &req.TSimCardStockDeleteParam) + return +} diff --git a/server/internal/controller/iot/t_sim_channel_template.go b/server/internal/controller/iot/t_sim_channel_template.go new file mode 100644 index 0000000..25077bf --- /dev/null +++ b/server/internal/controller/iot/t_sim_channel_template.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看通道模板列表 +func (c *ControllerV1) TSimChannelTemplateList(ctx context.Context, req *v1.TSimChannelTemplateListReq) (res *v1.TSimChannelTemplateListRes, err error) { + list, totalCount, err := service.IotTSimChannelTemplate().List(ctx, &req.TSimChannelTemplateListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimChannelTemplateListModel{} + } + + res = new(v1.TSimChannelTemplateListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出通道模板列表 +func (c *ControllerV1) TSimChannelTemplateExport(ctx context.Context, req *v1.TSimChannelTemplateExportReq) (res *v1.TSimChannelTemplateExportRes, err error) { + err = service.IotTSimChannelTemplate().Export(ctx, &req.TSimChannelTemplateListParam) + return +} + +// Edit 更新通道模板 +func (c *ControllerV1) TSimChannelTemplateEdit(ctx context.Context, req *v1.TSimChannelTemplateEditReq) (res *v1.TSimChannelTemplateEditRes, err error) { + err = service.IotTSimChannelTemplate().Edit(ctx, &req.TSimChannelTemplateEditParam) + return +} + +// View 获取指定通道模板信息 +func (c *ControllerV1) TSimChannelTemplateView(ctx context.Context, req *v1.TSimChannelTemplateViewReq) (res *v1.TSimChannelTemplateViewRes, err error) { + data, err := service.IotTSimChannelTemplate().View(ctx, &req.TSimChannelTemplateViewParam) + if err != nil { + return + } + + res = new(v1.TSimChannelTemplateViewRes) + res.TSimChannelTemplateViewModel = data + return +} + +// Delete 删除通道模板 +func (c *ControllerV1) TSimChannelTemplateDelete(ctx context.Context, req *v1.TSimChannelTemplateDeleteReq) (res *v1.TSimChannelTemplateDeleteRes, err error) { + err = service.IotTSimChannelTemplate().Delete(ctx, &req.TSimChannelTemplateDeleteParam) + return +} diff --git a/server/internal/controller/iot/t_sim_channels.go b/server/internal/controller/iot/t_sim_channels.go new file mode 100644 index 0000000..97f9aaf --- /dev/null +++ b/server/internal/controller/iot/t_sim_channels.go @@ -0,0 +1,76 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看通道列表列表 +func (c *ControllerV1) TSimChannelsList(ctx context.Context, req *v1.TSimChannelsListReq) (res *v1.TSimChannelsListRes, err error) { + list, totalCount, err := service.IotTSimChannels().List(ctx, &req.TSimChannelsListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimChannelsListModel{} + } + + res = new(v1.TSimChannelsListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出通道列表列表 +func (c *ControllerV1) TSimChannelsExport(ctx context.Context, req *v1.TSimChannelsExportReq) (res *v1.TSimChannelsExportRes, err error) { + err = service.IotTSimChannels().Export(ctx, &req.TSimChannelsListParam) + return +} + +// Edit 更新通道列表 +func (c *ControllerV1) TSimChannelsEdit(ctx context.Context, req *v1.TSimChannelsEditReq) (res *v1.TSimChannelsEditRes, err error) { + err = service.IotTSimChannels().Edit(ctx, &req.TSimChannelsEditParam) + return +} + +// View 获取指定通道列表信息 +func (c *ControllerV1) TSimChannelsView(ctx context.Context, req *v1.TSimChannelsViewReq) (res *v1.TSimChannelsViewRes, err error) { + data, err := service.IotTSimChannels().View(ctx, &req.TSimChannelsViewParam) + if err != nil { + return + } + + res = new(v1.TSimChannelsViewRes) + res.TSimChannelsViewModel = data + return +} + +// Delete 删除通道列表 +func (c *ControllerV1) TSimChannelsDelete(ctx context.Context, req *v1.TSimChannelsDeleteReq) (res *v1.TSimChannelsDeleteRes, err error) { + err = service.IotTSimChannels().Delete(ctx, &req.TSimChannelsDeleteParam) + return +} + +func (c *ControllerV1) TSimChannelsTest(ctx context.Context, req *v1.TSimChannelsTestReq) (res *v1.TSimChannelsTestRes, err error) { + output, err := service.IotTSimChannels().Test(ctx, &req.TSimChannelsTestParam) + if err != nil { + return nil, err + } + return &v1.TSimChannelsTestRes{TSimChannelsTestOutput: output}, nil +} + +func (c *ControllerV1) TSimChannelsRefreshCardCount(ctx context.Context, req *v1.TSimChannelsRefreshCardCountReq) (res *v1.TSimChannelsRefreshCardCountRes, err error) { + err = service.IotTSimChannels().RefreshCardCounts(ctx) + return &v1.TSimChannelsRefreshCardCountRes{}, err +} diff --git a/server/internal/controller/iot/t_sim_diagnose.go b/server/internal/controller/iot/t_sim_diagnose.go new file mode 100644 index 0000000..b81a083 --- /dev/null +++ b/server/internal/controller/iot/t_sim_diagnose.go @@ -0,0 +1,27 @@ +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// Info 查询SIM卡诊断信息 +func (c *ControllerV1) TSimDiagnoseInfo(ctx context.Context, req *v1.TSimDiagnoseInfoReq) (res *v1.TSimDiagnoseInfoRes, err error) { + output, err := service.IotTSimDiagnose().Info(ctx, &req.TSimDiagnoseInfoReq) + if err != nil { + return + } + res = &v1.TSimDiagnoseInfoRes{TSimDiagnoseInfoOutput: output} + return res, nil +} + +// Flow 查询SIM卡使用流量 +func (c *ControllerV1) TSimDiagnoseFlow(ctx context.Context, req *v1.TSimDiagnoseFlowReq) (res *v1.TSimDiagnoseFlowRes, err error) { + output, err := service.IotTSimDiagnose().Flow(ctx, &req.TSimDiagnoseFlowReq) + if err != nil { + return + } + res = &v1.TSimDiagnoseFlowRes{TSimDiagnoseFlowOutput: output} + return res, nil +} diff --git a/server/internal/controller/iot/t_sim_flow_package_info.go b/server/internal/controller/iot/t_sim_flow_package_info.go new file mode 100644 index 0000000..a9b6fb3 --- /dev/null +++ b/server/internal/controller/iot/t_sim_flow_package_info.go @@ -0,0 +1,112 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看SIM流量套餐管理列表 +func (c *ControllerV1) TSimFlowPackageInfoList(ctx context.Context, req *v1.TSimFlowPackageInfoListReq) (res *v1.TSimFlowPackageInfoListRes, err error) { + list, totalCount, err := service.IotTSimFlowPackageInfo().List(ctx, &req.TSimFlowPackageInfoListParam) + if err != nil { + return + } + + if list == nil { + list = []*iotin.TSimFlowPackageInfoListModel{} + } + + res = new(v1.TSimFlowPackageInfoListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出SIM流量套餐管理列表 +func (c *ControllerV1) TSimFlowPackageInfoExport(ctx context.Context, req *v1.TSimFlowPackageInfoExportReq) (res *v1.TSimFlowPackageInfoExportRes, err error) { + err = service.IotTSimFlowPackageInfo().Export(ctx, &req.TSimFlowPackageInfoListParam) + return +} + +// Edit 更新SIM流量套餐管理 +func (c *ControllerV1) TSimFlowPackageInfoEdit(ctx context.Context, req *v1.TSimFlowPackageInfoEditReq) (res *v1.TSimFlowPackageInfoEditRes, err error) { + err = service.IotTSimFlowPackageInfo().Edit(ctx, &req.TSimFlowPackageInfoEditParam) + return +} + +// View 获取指定SIM流量套餐管理信息 +func (c *ControllerV1) TSimFlowPackageInfoView(ctx context.Context, req *v1.TSimFlowPackageInfoViewReq) (res *v1.TSimFlowPackageInfoViewRes, err error) { + data, err := service.IotTSimFlowPackageInfo().View(ctx, &req.TSimFlowPackageInfoViewParam) + if err != nil { + return + } + + res = new(v1.TSimFlowPackageInfoViewRes) + res.TSimFlowPackageInfoViewModel = data + return +} + +// Delete 删除SIM流量套餐管理 +func (c *ControllerV1) TSimFlowPackageInfoDelete(ctx context.Context, req *v1.TSimFlowPackageInfoDeleteReq) (res *v1.TSimFlowPackageInfoDeleteRes, err error) { + err = service.IotTSimFlowPackageInfo().Delete(ctx, &req.TSimFlowPackageInfoDeleteParam) + return +} + +func (c *ControllerV1) TSimFlowPackageInfoSyncDeptPackages(ctx context.Context, req *v1.TSimFlowPackageInfoSyncDeptPackagesReq) (res *v1.TSimFlowPackageInfoSyncDeptPackagesRes, err error) { + err = service.IotTSimFlowPackageInfo().SyncDeptPackages(ctx) + return +} + +func (c *ControllerV1) TSimFlowPackageInfoFlowPackageList(ctx context.Context, req *v1.TSimFlowPackageInfoFlowPackageListReq) (res *v1.TSimFlowPackageInfoFlowPackageListRes, err error) { + list, err := service.IotTSimFlowPackageInfo().FlowPackageList(ctx, &req.TSimFlowPackageInfoFlowPackageListParam) + if err != nil { + return nil, err + } + res = &v1.TSimFlowPackageInfoFlowPackageListRes{ + Items: list, + } + return +} + +func (c *ControllerV1) TSimFlowPackageInfoFlowPackageAddList(ctx context.Context, req *v1.TSimFlowPackageInfoFlowPackageAddListReq) (res *v1.TSimFlowPackageInfoFlowPackageAddListRes, err error) { + list, err := service.IotTSimFlowPackageInfo().FlowPackageAddList(ctx) + if err != nil { + return nil, err + } + res = &v1.TSimFlowPackageInfoFlowPackageAddListRes{ + Items: list, + } + return +} + +func (c *ControllerV1) TSimFlowPackageInfoRenewablePackageOptions(ctx context.Context, req *v1.TSimFlowPackageInfoRenewablePackageOptionsReq) (res *v1.TSimFlowPackageInfoRenewablePackageOptionsRes, err error) { + list, err := service.IotTSimFlowPackageInfo().RenewablePackageOptions(ctx, &req.TSimFlowPackageInfoRenewablePackageOptionsParam) + if err != nil { + return nil, err + } + res = &v1.TSimFlowPackageInfoRenewablePackageOptionsRes{ + Items: list, + } + return +} + +func (c *ControllerV1) TSimFlowPackageInfoGetFlowPackageOptions(ctx context.Context, req *v1.TSimFlowPackageInfoGetFlowPackageOptionsReq) (res *v1.TSimFlowPackageInfoGetFlowPackageOptionsRes, err error) { + items, err := service.IotTSimFlowPackageInfo().GetFlowPackageOptions(ctx, &req.TSimFlowPackageInfoFlowPackageOptionsParam) + if err != nil { + return nil, err + } + res = &v1.TSimFlowPackageInfoGetFlowPackageOptionsRes{ + Items: items, + } + return +} diff --git a/server/internal/controller/iot/t_sim_flow_package_price.go b/server/internal/controller/iot/t_sim_flow_package_price.go new file mode 100644 index 0000000..6e7d438 --- /dev/null +++ b/server/internal/controller/iot/t_sim_flow_package_price.go @@ -0,0 +1,54 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TSimFlowPackagePriceAgentPackagePriceList(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceListReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceListRes, err error) { + list, totalCount, err := service.IotTSimFlowPackagePrice().AgentPackagePriceList(ctx, &req.TSimFlowPackagePriceAgentPackagePriceListParam) + if err != nil { + return + } + + if list == nil { + list = []*iotin.TSimFlowPackagePriceAgentPackagePriceListItem{} + } + + res = new(v1.TSimFlowPackagePriceAgentPackagePriceListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +func (c *ControllerV1) TSimFlowPackagePriceAgentPackagePriceInherit(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceInheritReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceInheritRes, err error) { + err = service.IotTSimFlowPackagePrice().InheritAgentPackagePrice(ctx, &req.TSimFlowPackagePriceAgentPackagePriceInheritParam) + if err != nil { + return + } + res = new(v1.TSimFlowPackagePriceAgentPackagePriceInheritRes) + return +} + +func (c *ControllerV1) TSimFlowPackagePriceagentTree(ctx context.Context, req *v1.TSimFlowPackagePriceagentTreeReq) (res *v1.TSimFlowPackagePriceagentTreeRes, err error) { + data, err := service.IotTSimFlowPackagePrice().AgentTree(ctx, &req.TSimFlowPackagePriceAgentTreeParam) + if err != nil { + return + } + + res = new(v1.TSimFlowPackagePriceagentTreeRes) + if data != nil { + res.Items = data.Items + } + return +} diff --git a/server/internal/controller/iot/t_sim_flow_pool.go b/server/internal/controller/iot/t_sim_flow_pool.go new file mode 100644 index 0000000..880fcff --- /dev/null +++ b/server/internal/controller/iot/t_sim_flow_pool.go @@ -0,0 +1,88 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看流量池表列表 +func (c *ControllerV1) TSimFlowPoolList(ctx context.Context, req *v1.TSimFlowPoolListReq) (res *v1.TSimFlowPoolListRes, err error) { + list, totalCount, err := service.IotTSimFlowPool().List(ctx, &req.TSimFlowPoolListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimFlowPoolListModel{} + } + + res = new(v1.TSimFlowPoolListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出流量池表列表 +func (c *ControllerV1) TSimFlowPoolExport(ctx context.Context, req *v1.TSimFlowPoolExportReq) (res *v1.TSimFlowPoolExportRes, err error) { + err = service.IotTSimFlowPool().Export(ctx, &req.TSimFlowPoolListParam) + return +} + +// Edit 更新流量池表 +func (c *ControllerV1) TSimFlowPoolEdit(ctx context.Context, req *v1.TSimFlowPoolEditReq) (res *v1.TSimFlowPoolEditRes, err error) { + err = service.IotTSimFlowPool().Edit(ctx, &req.TSimFlowPoolEditParam) + return +} + +// View 获取指定流量池表信息 +func (c *ControllerV1) TSimFlowPoolView(ctx context.Context, req *v1.TSimFlowPoolViewReq) (res *v1.TSimFlowPoolViewRes, err error) { + data, err := service.IotTSimFlowPool().View(ctx, &req.TSimFlowPoolViewParam) + if err != nil { + return + } + + res = new(v1.TSimFlowPoolViewRes) + res.TSimFlowPoolViewModel = data + return +} + +// Delete 删除流量池表 +func (c *ControllerV1) TSimFlowPoolDelete(ctx context.Context, req *v1.TSimFlowPoolDeleteReq) (res *v1.TSimFlowPoolDeleteRes, err error) { + err = service.IotTSimFlowPool().Delete(ctx, &req.TSimFlowPoolDeleteParam) + return +} + +// SyncPoolCard 流量池同步卡信息 +func (c *ControllerV1) TSimFlowPoolSyncPoolCard(ctx context.Context, req *v1.TSimFlowPoolSyncPoolCardReq) (res *v1.TSimFlowPoolSyncPoolCardRes, err error) { + err = service.IotTSimFlowPool().SyncPoolCard(ctx, req.DeptId) + return +} + +// GetCardsByPackageCodes 根据套餐编码列表获取卡列表 +func (c *ControllerV1) TSimFlowPoolGetCardsByPackageCodes(ctx context.Context, req *v1.TSimFlowPoolGetCardsByPackageCodesReq) (res *v1.TSimFlowPoolGetCardsByPackageCodesRes, err error) { + list, totalCount, err := service.IotTSimFlowPool().GetCardsByPackageCodes(ctx, &req.GetCardsByPackageCodesParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimCardInfoListModel{} + } + + res = new(v1.TSimFlowPoolGetCardsByPackageCodesRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} diff --git a/server/internal/controller/iot/t_sim_package_category.go b/server/internal/controller/iot/t_sim_package_category.go new file mode 100644 index 0000000..d9bdc50 --- /dev/null +++ b/server/internal/controller/iot/t_sim_package_category.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看套餐分类表列表 +func (c *ControllerV1) TSimPackageCategoryList(ctx context.Context, req *v1.TSimPackageCategoryListReq) (res *v1.TSimPackageCategoryListRes, err error) { + list, totalCount, err := service.IotTSimPackageCategory().List(ctx, &req.TSimPackageCategoryListParam) + if err != nil { + return + } + + if list == nil { + list = []*iotin.TSimPackageCategoryListModel{} + } + + res = new(v1.TSimPackageCategoryListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出套餐分类表列表 +func (c *ControllerV1) TSimPackageCategoryExport(ctx context.Context, req *v1.TSimPackageCategoryExportReq) (res *v1.TSimPackageCategoryExportRes, err error) { + err = service.IotTSimPackageCategory().Export(ctx, &req.TSimPackageCategoryListParam) + return +} + +// Edit 更新套餐分类表 +func (c *ControllerV1) TSimPackageCategoryEdit(ctx context.Context, req *v1.TSimPackageCategoryEditReq) (res *v1.TSimPackageCategoryEditRes, err error) { + err = service.IotTSimPackageCategory().Edit(ctx, &req.TSimPackageCategoryEditParam) + return +} + +// View 获取指定套餐分类表信息 +func (c *ControllerV1) TSimPackageCategoryView(ctx context.Context, req *v1.TSimPackageCategoryViewReq) (res *v1.TSimPackageCategoryViewRes, err error) { + data, err := service.IotTSimPackageCategory().View(ctx, &req.TSimPackageCategoryViewParam) + if err != nil { + return + } + + res = new(v1.TSimPackageCategoryViewRes) + res.TSimPackageCategoryViewModel = data + return +} + +// Delete 删除套餐分类表 +func (c *ControllerV1) TSimPackageCategoryDelete(ctx context.Context, req *v1.TSimPackageCategoryDeleteReq) (res *v1.TSimPackageCategoryDeleteRes, err error) { + err = service.IotTSimPackageCategory().Delete(ctx, &req.TSimPackageCategoryDeleteParam) + return +} diff --git a/server/internal/controller/iot/t_sim_pool_warn_config.go b/server/internal/controller/iot/t_sim_pool_warn_config.go new file mode 100644 index 0000000..0644938 --- /dev/null +++ b/server/internal/controller/iot/t_sim_pool_warn_config.go @@ -0,0 +1,64 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看流量池预警配置表列表 +func (c *ControllerV1) TSimPoolWarnConfigList(ctx context.Context, req *v1.TSimPoolWarnConfigListReq) (res *v1.TSimPoolWarnConfigListRes, err error) { + list, totalCount, err := service.IotTSimPoolWarnConfig().List(ctx, &req.TSimPoolWarnConfigListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TSimPoolWarnConfigListModel{} + } + + res = new(v1.TSimPoolWarnConfigListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出流量池预警配置表列表 +func (c *ControllerV1) TSimPoolWarnConfigExport(ctx context.Context, req *v1.TSimPoolWarnConfigExportReq) (res *v1.TSimPoolWarnConfigExportRes, err error) { + err = service.IotTSimPoolWarnConfig().Export(ctx, &req.TSimPoolWarnConfigListParam) + return +} + +// Edit 更新流量池预警配置表 +func (c *ControllerV1) TSimPoolWarnConfigEdit(ctx context.Context, req *v1.TSimPoolWarnConfigEditReq) (res *v1.TSimPoolWarnConfigEditRes, err error) { + err = service.IotTSimPoolWarnConfig().Edit(ctx, &req.TSimPoolWarnConfigEditParam) + return +} + +// View 获取指定流量池预警配置表信息 +func (c *ControllerV1) TSimPoolWarnConfigView(ctx context.Context, req *v1.TSimPoolWarnConfigViewReq) (res *v1.TSimPoolWarnConfigViewRes, err error) { + data, err := service.IotTSimPoolWarnConfig().View(ctx, &req.TSimPoolWarnConfigViewParam) + if err != nil { + return + } + + res = new(v1.TSimPoolWarnConfigViewRes) + res.TSimPoolWarnConfigViewModel = data + return +} + +// Delete 删除流量池预警配置表 +func (c *ControllerV1) TSimPoolWarnConfigDelete(ctx context.Context, req *v1.TSimPoolWarnConfigDeleteReq) (res *v1.TSimPoolWarnConfigDeleteRes, err error) { + err = service.IotTSimPoolWarnConfig().Delete(ctx, &req.TSimPoolWarnConfigDeleteParam) + return +} diff --git a/server/internal/controller/iot/t_sim_upstream_package.go b/server/internal/controller/iot/t_sim_upstream_package.go new file mode 100644 index 0000000..0965b70 --- /dev/null +++ b/server/internal/controller/iot/t_sim_upstream_package.go @@ -0,0 +1,63 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2026 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package iot + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看上游套餐表列表 +func (c *ControllerV1) TSimUpstreamPackageList(ctx context.Context, req *v1.TSimUpstreamPackageListReq) (res *v1.TSimUpstreamPackageListRes, err error) { + list, totalCount, err := service.IotTUpstreamPackage().List(ctx, &req.TUpstreamPackageListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.TUpstreamPackageListModel{} + } + + res = new(v1.TSimUpstreamPackageListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出上游套餐表列表 +func (c *ControllerV1) TSimUpstreamPackageExport(ctx context.Context, req *v1.TSimUpstreamPackageExportReq) (res *v1.TSimUpstreamPackageExportRes, err error) { + err = service.IotTUpstreamPackage().Export(ctx, &req.TUpstreamPackageListParam) + return +} + +// Edit 更新上游套餐表 +func (c *ControllerV1) TSimUpstreamPackageEdit(ctx context.Context, req *v1.TSimUpstreamPackageEditReq) (res *v1.TSimUpstreamPackageEditRes, err error) { + err = service.IotTUpstreamPackage().Edit(ctx, &req.TUpstreamPackageEditParam) + return +} + +// View 获取指定上游套餐表信息 +func (c *ControllerV1) TSimUpstreamPackageView(ctx context.Context, req *v1.TSimUpstreamPackageViewReq) (res *v1.TSimUpstreamPackageViewRes, err error) { + data, err := service.IotTUpstreamPackage().View(ctx, &req.TUpstreamPackageViewParam) + if err != nil { + return + } + + res = new(v1.TSimUpstreamPackageViewRes) + res.TUpstreamPackageViewModel = data + return +} + +// Delete 删除上游套餐表 +func (c *ControllerV1) TSimUpstreamPackageDelete(ctx context.Context, req *v1.TSimUpstreamPackageDeleteReq) (res *v1.TSimUpstreamPackageDeleteRes, err error) { + err = service.IotTUpstreamPackage().Delete(ctx, &req.TUpstreamPackageDeleteParam) + return +} diff --git a/server/internal/controller/monitor/monitor.go b/server/internal/controller/monitor/monitor.go new file mode 100644 index 0000000..46dd6de --- /dev/null +++ b/server/internal/controller/monitor/monitor.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package monitor diff --git a/server/internal/controller/monitor/monitor_new.go b/server/internal/controller/monitor/monitor_new.go new file mode 100644 index 0000000..ee9cbb7 --- /dev/null +++ b/server/internal/controller/monitor/monitor_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package monitor + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/monitor" +) + +type ControllerV1 struct{} + +func NewV1() monitor.IMonitorV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/monitor/monitor_v1_cache.go b/server/internal/controller/monitor/monitor_v1_cache.go new file mode 100644 index 0000000..5dbc212 --- /dev/null +++ b/server/internal/controller/monitor/monitor_v1_cache.go @@ -0,0 +1,70 @@ +package monitor + +import ( + "context" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/monitor/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility" +) + +func (c *ControllerV1) MemoryDBRebuild(ctx context.Context, req *v1.MemoryDBRebuildReq) (res *v1.MemoryDBRebuildRes, err error) { + if !contexts.IsSuperAdmin(ctx) { + return nil, gerror.New("仅超级管理员可重建内存缓存") + } + if err = service.MemoryDB().Rebuild(ctx); err != nil { + return nil, err + } + return &v1.MemoryDBRebuildRes{Tables: 8}, nil +} + +func (c *ControllerV1) RedisInfo(ctx context.Context, req *v1.RedisInfoReq) (res *v1.RedisInfoRes, err error) { + info, err := g.Redis().Do(ctx, "INFO") + if err != nil { + return nil, err + } + + infoMap := make(map[string]string) + for _, line := range strings.Split(info.String(), "\n") { + if strings.HasPrefix(line, "#") { + continue + } + parts := strings.Split(line, ":") + if len(parts) == 2 { + infoMap[parts[0]] = parts[1] + } + } + dbSize := gconv.Int(infoMap["db0"]) + + info, err = g.Redis().Do(ctx, "INFO", "COMMANDSTATS") + if err != nil { + return nil, err + } + commandStats := make([]*v1.CommandStats, 0) + for _, line := range strings.Split(info.String(), "\n") { + if strings.HasPrefix(line, "#") { + continue + } + parts := strings.Split(line, ":") + if len(parts) == 2 { + if strings.HasPrefix(parts[0], "cmdstat_") { + commandStats = append(commandStats, &v1.CommandStats{ + Name: strings.TrimPrefix(parts[0], "cmdstat_"), + Value: utility.GetBetweenStr(parts[1], "calls=", ",usec"), + }) + } + } + } + + return &v1.RedisInfoRes{ + Info: infoMap, + DBSize: dbSize, + CommandStats: commandStats, + }, nil +} diff --git a/server/internal/controller/pay/pay.go b/server/internal/controller/pay/pay.go new file mode 100644 index 0000000..5bd5640 --- /dev/null +++ b/server/internal/controller/pay/pay.go @@ -0,0 +1 @@ +package pay diff --git a/server/internal/controller/pay/pay_new.go b/server/internal/controller/pay/pay_new.go new file mode 100644 index 0000000..707c7be --- /dev/null +++ b/server/internal/controller/pay/pay_new.go @@ -0,0 +1,9 @@ +package pay + +import "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/pay" + +type ControllerV1 struct{} + +func NewV1() pay.IPayV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/pay/pay_v1_alipay.go b/server/internal/controller/pay/pay_v1_alipay.go new file mode 100644 index 0000000..5c0167b --- /dev/null +++ b/server/internal/controller/pay/pay_v1_alipay.go @@ -0,0 +1,53 @@ +package pay + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/pay/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) AlipayPay(ctx context.Context, req *v1.AlipayPayReq) (res *v1.AlipayPayRes, err error) { + out, err := service.Alipay().Pay(ctx, &req.AlipayPayInput) + if err != nil { + return nil, err + } + res = &v1.AlipayPayRes{AlipayPayOutput: *out} + return res, nil +} + +func (c *ControllerV1) AlipayNotify(ctx context.Context, req *v1.AlipayNotifyReq) (res *v1.AlipayNotifyRes, err error) { + out, err := service.Alipay().Notify(ctx, &req.AlipayNotifyInput) + if err != nil { + return nil, err + } + res = &v1.AlipayNotifyRes{AlipayNotifyOutput: *out} + return res, nil +} + +func (c *ControllerV1) AlipayReturn(ctx context.Context, req *v1.AlipayReturnReq) (res *v1.AlipayReturnRes, err error) { + out, err := service.Alipay().Return(ctx, &req.AlipayReturnInput) + if err != nil { + return nil, err + } + res = &v1.AlipayReturnRes{AlipayReturnOutput: *out} + return res, nil +} + +func (c *ControllerV1) AlipayTradeQuery(ctx context.Context, req *v1.AlipayTradeQueryReq) (res *v1.AlipayTradeQueryRes, err error) { + out, err := service.Alipay().Query(ctx, &req.AlipayTradeQueryInput) + if err != nil { + return nil, err + } + res = &v1.AlipayTradeQueryRes{AlipayTradeQueryOutput: *out} + return res, nil +} + +func (c *ControllerV1) AlipayRefund(ctx context.Context, req *v1.AlipayRefundReq) (res *v1.AlipayRefundRes, err error) { + out, err := service.Alipay().Refund(ctx, &req.AlipayRefundInput) + if err != nil { + return nil, err + } + res = &v1.AlipayRefundRes{AlipayRefundOutput: *out} + return res, nil +} diff --git a/server/internal/controller/simwarning/sim_warning_config.go b/server/internal/controller/simwarning/sim_warning_config.go new file mode 100644 index 0000000..c4ba05e --- /dev/null +++ b/server/internal/controller/simwarning/sim_warning_config.go @@ -0,0 +1,60 @@ +package simwarning + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +type ControllerV1 struct{} + +func NewV1() *ControllerV1 { + return &ControllerV1{} +} + +func (c *ControllerV1) SimWarningConfigList(ctx context.Context, req *v1.SimWarningConfigListReq) (res *v1.SimWarningConfigListRes, err error) { + list, totalCount, err := service.SimWarning().ConfigList(ctx, &req.SimWarningConfigListParam) + if err != nil { + return nil, err + } + if list == nil { + list = []*model.SimWarningConfigModel{} + } + return &v1.SimWarningConfigListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: totalCount, + }, + Items: list, + }, nil +} + +func (c *ControllerV1) SimWarningConfigView(ctx context.Context, req *v1.SimWarningConfigViewReq) (res *v1.SimWarningConfigViewRes, err error) { + data, err := service.SimWarning().ConfigView(ctx, &req.SimWarningConfigViewParam) + if err != nil { + return nil, err + } + return &v1.SimWarningConfigViewRes{SimWarningConfigModel: data}, nil +} + +func (c *ControllerV1) SimWarningConfigSave(ctx context.Context, req *v1.SimWarningConfigSaveReq) (res *v1.SimWarningConfigSaveRes, err error) { + data, err := service.SimWarning().ConfigSave(ctx, &req.SimWarningConfigSaveParam) + if err != nil { + return nil, err + } + return &v1.SimWarningConfigSaveRes{SimWarningConfigSaveModel: data}, nil +} + +func (c *ControllerV1) SimWarningConfigStatus(ctx context.Context, req *v1.SimWarningConfigStatusReq) (res *v1.SimWarningConfigStatusRes, err error) { + err = service.SimWarning().ConfigStatus(ctx, &req.SimWarningConfigStatusParam) + return &v1.SimWarningConfigStatusRes{}, err +} + +func (c *ControllerV1) SimWarningConfigDelete(ctx context.Context, req *v1.SimWarningConfigDeleteReq) (res *v1.SimWarningConfigDeleteRes, err error) { + err = service.SimWarning().ConfigDelete(ctx, &req.SimWarningConfigDeleteParam) + return &v1.SimWarningConfigDeleteRes{}, err +} diff --git a/server/internal/controller/system/sys_notice_user.go b/server/internal/controller/system/sys_notice_user.go new file mode 100644 index 0000000..281034b --- /dev/null +++ b/server/internal/controller/system/sys_notice_user.go @@ -0,0 +1,75 @@ +// Package gen +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// @AutoGenerate Version +package system + +import ( + "context" + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// List 查看用户通知公告表列表 +func (c *ControllerV1) SysNoticeUserList(ctx context.Context, req *v1.SysNoticeUserListReq) (res *v1.SysNoticeUserListRes, err error) { + list, totalCount, err := service.SysNoticeUser().List(ctx, &req.SysNoticeUserListParam) + if err != nil { + return + } + + if list == nil { + list = []*model.SysNoticeUserListModel{} + } + + res = new(v1.SysNoticeUserListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = totalCount + return +} + +// Export 导出用户通知公告表列表 +func (c *ControllerV1) SysNoticeUserExport(ctx context.Context, req *v1.SysNoticeUserExportReq) (res *v1.SysNoticeUserExportRes, err error) { + err = service.SysNoticeUser().Export(ctx, &req.SysNoticeUserListParam) + return +} + +// Edit 更新用户通知公告表 +func (c *ControllerV1) SysNoticeUserEdit(ctx context.Context, req *v1.SysNoticeUserEditReq) (res *v1.SysNoticeUserEditRes, err error) { + err = service.SysNoticeUser().Edit(ctx, &req.SysNoticeUserEditParam) + return +} + +// View 获取指定用户通知公告表信息 +func (c *ControllerV1) SysNoticeUserView(ctx context.Context, req *v1.SysNoticeUserViewReq) (res *v1.SysNoticeUserViewRes, err error) { + data, err := service.SysNoticeUser().View(ctx, &req.SysNoticeUserViewParam) + if err != nil { + return + } + + res = new(v1.SysNoticeUserViewRes) + res.SysNoticeUserViewModel = data + return +} + +// Delete 删除用户通知公告表 +func (c *ControllerV1) SysNoticeUserDelete(ctx context.Context, req *v1.SysNoticeUserDeleteReq) (res *v1.SysNoticeUserDeleteRes, err error) { + err = service.SysNoticeUser().Delete(ctx, &req.SysNoticeUserDeleteParam) + return +} + +// Status 更新用户通知公告表状态 +func (c *ControllerV1) SysNoticeUserStatus(ctx context.Context, req *v1.SysNoticeUserStatusReq) (res *v1.SysNoticeUserStatusRes, err error) { + err = service.SysNoticeUser().Status(ctx, &req.SysNoticeUserStatusParam) + return +} + +// Read 已读 +func (c *ControllerV1) SysNoticeUserRead(ctx context.Context, req *v1.SysNoticeUserReadReq) (res *v1.SysNoticeUserReadRes, err error) { + err = service.SysNoticeUser().Read(ctx, &req.SysNoticeUserReadParam) + return +} diff --git a/server/internal/controller/system/system.go b/server/internal/controller/system/system.go new file mode 100644 index 0000000..24bd259 --- /dev/null +++ b/server/internal/controller/system/system.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package system diff --git a/server/internal/controller/system/system_new.go b/server/internal/controller/system/system_new.go new file mode 100644 index 0000000..c1be256 --- /dev/null +++ b/server/internal/controller/system/system_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package system + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system" +) + +type ControllerV1 struct{} + +func NewV1() system.ISystemV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/system/system_v1_auth.go b/server/internal/controller/system/system_v1_auth.go new file mode 100644 index 0000000..451c4b2 --- /dev/null +++ b/server/internal/controller/system/system_v1_auth.go @@ -0,0 +1,113 @@ +package system + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/mcache" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error) { + userOut, token, err := service.SysAuth().Login(ctx, &model.LoginParams{ + CaptchaID: req.CaptchaID, + CaptchaValue: req.CaptchaValue, + Username: req.Username, + Password: req.Password, + TenantId: req.TenantId, + }) + if err != nil { + return nil, err + } + return &v1.LoginRes{ + ID: userOut.ID, + Username: userOut.Username, + NickName: userOut.NickName, + Avatar: userOut.Avatar, + AccessToken: token, + }, nil +} +func (c *ControllerV1) RefreshToken(ctx context.Context, req *v1.RefreshTokenReq) (res *v1.RefreshTokenRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} +func (c *ControllerV1) SendSmsLoginCode(ctx context.Context, req *v1.SendSmsLoginCodeReq) (res *v1.SendSmsLoginCodeRes, err error) { + if err = service.SysAuth().SendSmsLoginCode(ctx, req.Phone); err != nil { + return nil, err + } + return &v1.SendSmsLoginCodeRes{}, nil +} +func (c *ControllerV1) SmsLogin(ctx context.Context, req *v1.SmsLoginReq) (res *v1.SmsLoginRes, err error) { + userOut, token, err := service.SysAuth().LoginByPhoneCode(ctx, req.Phone, req.Code) + if err != nil { + return nil, err + } + return &v1.SmsLoginRes{ + ID: userOut.ID, + Username: userOut.Username, + NickName: userOut.NickName, + Avatar: userOut.Avatar, + AccessToken: token, + }, nil +} +func (c *ControllerV1) Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error) { + token, _ := service.SysAuth().GetAccessToken(ctx) + service.SysUserOnline().DeleteByToken(ctx, token) + event.EventsInstance().Emit(ctx, consts.EventKeyUserLogout, contexts.GetUserId(ctx)) + return &v1.LogoutRes{ + Data: "退出成功", + Status: 200, + }, nil +} +func (c *ControllerV1) GetAccessCodes(ctx context.Context, req *v1.GetAccessCodesReq) (res *v1.GetAccessCodesRes, err error) { + if req.IsCache { + accessCodes, _, err := mcache.GetUserAccessCodeList(ctx, contexts.GetUserId(ctx)) + if err != nil { + return nil, err + } + res = &v1.GetAccessCodesRes{ + Data: accessCodes, + } + } else { + accessCodes, roleDataAccessCodes, err := service.SysAuth().GetUserAccessCodeList(ctx, contexts.GetUserId(ctx)) + if err != nil { + return nil, err + } + mcache.SetUserAccessCodeList(ctx, contexts.GetUserId(ctx), accessCodes) + mcache.SetUserRoleDataAccessCodeList(ctx, contexts.GetUserId(ctx), roleDataAccessCodes) + res = &v1.GetAccessCodesRes{ + Data: accessCodes, + } + } + return res, nil +} +func (c *ControllerV1) TenantList(ctx context.Context, req *v1.TenantListReq) (res *v1.TenantListRes, err error) { + tenantList, _, err := service.SysTenant().List(ctx, &model.SysTenantListParam{ + Status: consts.SysDeptStatusNormal, + }) + if err != nil { + return nil, err + } + tenantEnabled := false + if len(tenantList) > 1 { + tenantEnabled = true + } + voList := make([]v1.TenantListData, 0) + for _, tenant := range tenantList { + voList = append(voList, v1.TenantListData{ + CompanyName: tenant.CompanyName, + Domain: tenant.Domain, + TenantId: tenant.TenantId, + }) + } + return &v1.TenantListRes{ + TenantEnabled: tenantEnabled, + VoList: voList, + }, nil +} diff --git a/server/internal/controller/system/system_v1_captcha.go b/server/internal/controller/system/system_v1_captcha.go new file mode 100644 index 0000000..453db24 --- /dev/null +++ b/server/internal/controller/system/system_v1_captcha.go @@ -0,0 +1,17 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) GetCaptcha(ctx context.Context, req *v1.GetCaptchaReq) (res *v1.GetCaptchaRes, err error) { + key, image, err := service.SysCaptcha().GenerateCaptcha(ctx) + res = &v1.GetCaptchaRes{ + CaptchaID: key, + CaptchaImage: image, + } + return +} diff --git a/server/internal/controller/system/system_v1_client.go b/server/internal/controller/system/system_v1_client.go new file mode 100644 index 0000000..059f31f --- /dev/null +++ b/server/internal/controller/system/system_v1_client.go @@ -0,0 +1,75 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysClientList(ctx context.Context, req *v1.SysClientListReq) (res *v1.SysClientListRes, err error) { + items, total, err := service.SysClient().List(ctx, &req.SysClientListParam) + if err != nil { + return nil, err + } + res = &v1.SysClientListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + } + return +} +func (c *ControllerV1) SysClientView(ctx context.Context, req *v1.SysClientViewReq) (res *v1.SysClientViewRes, err error) { + info, err := service.SysClient().View(ctx, req.SysClientViewParam) + if err != nil { + return nil, err + } + res = &v1.SysClientViewRes{ + SysClientViewModel: info, + } + return +} +func (c *ControllerV1) SysClientAdd(ctx context.Context, req *v1.SysClientAddReq) (res *v1.SysClientAddRes, err error) { + output, err := service.SysClient().Add(ctx, req.SysClientAddParam) + if err != nil { + return nil, err + } + res = &v1.SysClientAddRes{ + SysClientAddModel: output, + } + return +} +func (c *ControllerV1) SysClientEdit(ctx context.Context, req *v1.SysClientEditReq) (res *v1.SysClientEditRes, err error) { + output, err := service.SysClient().Edit(ctx, req.SysClientEditParam) + if err != nil { + return nil, err + } + res = &v1.SysClientEditRes{ + SysClientEditModel: output, + } + return +} +func (c *ControllerV1) SysClientDelete(ctx context.Context, req *v1.SysClientDeleteReq) (res *v1.SysClientDeleteRes, err error) { + output, err := service.SysClient().Delete(ctx, req.SysClientDeleteParam) + if err != nil { + return nil, err + } + res = &v1.SysClientDeleteRes{ + SysClientDeleteModel: output, + } + return +} +func (c *ControllerV1) SysClientStatus(ctx context.Context, req *v1.SysClientStatusReq) (res *v1.SysClientStatusRes, err error) { + output, err := service.SysClient().Status(ctx, req.SysClientStatusParam) + if err != nil { + return nil, err + } + res = &v1.SysClientStatusRes{ + SysClientStatusModel: output, + } + return +} diff --git a/server/internal/controller/system/system_v1_config.go b/server/internal/controller/system/system_v1_config.go new file mode 100644 index 0000000..f2c295d --- /dev/null +++ b/server/internal/controller/system/system_v1_config.go @@ -0,0 +1,63 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) GetConfigList(ctx context.Context, req *v1.GetConfigListReq) (res *v1.GetConfigListRes, err error) { + + items, total, err := service.SysConfig().List(ctx, &req.SysConfigListParam) + res = &v1.GetConfigListRes{ + Data: items, + PageResult: response.PageResult{ + Total: total, + Page: req.Page, + PageSize: req.PageSize, + }, + } + return +} +func (c *ControllerV1) AddConfig(ctx context.Context, req *v1.AddConfigReq) (res *v1.AddConfigRes, err error) { + output, err := service.SysConfig().Add(ctx, &req.SysConfigAddParam) + if err != nil { + return nil, err + } + res = &v1.AddConfigRes{ + SysConfigAddModel: *output, + } + return +} +func (c *ControllerV1) EditConfig(ctx context.Context, req *v1.EditConfigReq) (res *v1.EditConfigRes, err error) { + output, err := service.SysConfig().Edit(ctx, &req.SysConfigEditParam) + if err != nil { + return nil, err + } + res = &v1.EditConfigRes{ + SysConfigEditModel: *output, + } + return +} +func (c *ControllerV1) DeleteConfig(ctx context.Context, req *v1.DeleteConfigReq) (res *v1.DeleteConfigRes, err error) { + output, err := service.SysConfig().Delete(ctx, &req.SysConfigDeleteParam) + if err != nil { + return nil, err + } + res = &v1.DeleteConfigRes{ + SysConfigDeleteModel: *output, + } + return +} +func (c *ControllerV1) GetConfigById(ctx context.Context, req *v1.GetConfigByIdReq) (res *v1.GetConfigByIdRes, err error) { + output, err := service.SysConfig().View(ctx, &req.SysConfigViewParam) + if err != nil { + return nil, err + } + res = &v1.GetConfigByIdRes{ + SysConfigViewModel: *output, + } + return +} diff --git a/server/internal/controller/system/system_v1_dept.go b/server/internal/controller/system/system_v1_dept.go new file mode 100644 index 0000000..05b975e --- /dev/null +++ b/server/internal/controller/system/system_v1_dept.go @@ -0,0 +1,80 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) DeptList(ctx context.Context, req *v1.DeptListReq) (res *v1.DeptListRes, err error) { + items, total, err := service.SysDept().GetDeptList(ctx, req.SysDeptListParam) + if err != nil { + return nil, err + } + return &v1.DeptListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + Data: items, + }, nil +} + +func (c *ControllerV1) DeptTree(ctx context.Context, req *v1.DeptTreeReq) (res *v1.DeptTreeRes, err error) { + items, err := service.SysDept().GetDeptTree(ctx, req.SysDeptTreeParam) + if err != nil { + return nil, err + } + return &v1.DeptTreeRes{ + Data: items, + }, nil +} +func (c *ControllerV1) DeptFullTree(ctx context.Context, req *v1.DeptFullTreeReq) (res *v1.DeptFullTreeRes, err error) { + items, err := service.SysDept().GetDeptFullTree(ctx, req.SysDeptFullTreeParam) + if err != nil { + return nil, err + } + return &v1.DeptFullTreeRes{ + Data: items, + }, nil +} + +func (c *ControllerV1) DeptAdd(ctx context.Context, req *v1.DeptAddReq) (res *v1.DeptAddRes, err error) { + deptId, err := service.SysDept().AddDept(ctx, &req.SysDeptAddModel) + if err != nil { + return nil, err + } + return &v1.DeptAddRes{ + DeptId: deptId, + }, nil +} +func (c *ControllerV1) DeptEdit(ctx context.Context, req *v1.DeptEditReq) (res *v1.DeptEditRes, err error) { + deptId, err := service.SysDept().EditDept(ctx, &req.SysDeptEditModel) + if err != nil { + return nil, err + } + return &v1.DeptEditRes{ + DeptId: deptId, + }, nil +} +func (c *ControllerV1) DeptDelete(ctx context.Context, req *v1.DeptDeleteReq) (res *v1.DeptDeleteRes, err error) { + deptId, err := service.SysDept().DeleteDept(ctx, &req.SysDeptDeleteModel) + if err != nil { + return nil, err + } + return &v1.DeptDeleteRes{ + DeptId: deptId, + }, nil +} +func (c *ControllerV1) DeptView(ctx context.Context, req *v1.DeptViewReq) (res *v1.DeptViewRes, err error) { + dept, err := service.SysDept().GetDeptById(ctx, req.SysDeptViewModel.DeptId) + if err != nil { + return nil, err + } + return &v1.DeptViewRes{ + SysDeptViewModel: *dept, + }, nil +} diff --git a/server/internal/controller/system/system_v1_dict.go b/server/internal/controller/system/system_v1_dict.go new file mode 100644 index 0000000..d6179d6 --- /dev/null +++ b/server/internal/controller/system/system_v1_dict.go @@ -0,0 +1,123 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysDictTypeList(ctx context.Context, req *v1.SysDictTypeListReq) (res *v1.SysDictTypeListRes, err error) { + items, total, err := service.SysDictType().List(ctx, &req.SysDictTypeListParam) + if err != nil { + return nil, err + } + return &v1.SysDictTypeListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} + +func (c *ControllerV1) SysDictDataList(ctx context.Context, req *v1.SysDictDataListReq) (res *v1.SysDictDataListRes, err error) { + items, total, err := service.SysDictData().List(ctx, &req.SysDictDataListParam) + if err != nil { + return nil, err + } + typeData, err := service.SysDictType().View(ctx, &model.SysDictTypeViewParam{ + DictId: req.SysDictDataListParam.DictId, + DictType: req.SysDictDataListParam.DictType, + }) + if err != nil { + return nil, err + } + + return &v1.SysDictDataListRes{ + Items: items, + Type: typeData, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} +func (c *ControllerV1) SysDictTypeAdd(ctx context.Context, req *v1.SysDictTypeAddReq) (res *v1.SysDictTypeAddRes, err error) { + output, err := service.SysDictType().Add(ctx, &req.SysDictTypeAddParam) + if err != nil { + return nil, err + } + return &v1.SysDictTypeAddRes{ + SysDictTypeAddModel: *output, + }, nil +} +func (c *ControllerV1) SysDictTypeEdit(ctx context.Context, req *v1.SysDictTypeEditReq) (res *v1.SysDictTypeEditRes, err error) { + output, err := service.SysDictType().Edit(ctx, &req.SysDictTypeEditParam) + if err != nil { + return nil, err + } + return &v1.SysDictTypeEditRes{ + SysDictTypeEditModel: *output, + }, nil +} +func (c *ControllerV1) SysDictTypeDelete(ctx context.Context, req *v1.SysDictTypeDeleteReq) (res *v1.SysDictTypeDeleteRes, err error) { + output, err := service.SysDictType().Delete(ctx, &req.SysDictTypeDeleteParam) + if err != nil { + return nil, err + } + return &v1.SysDictTypeDeleteRes{ + SysDictTypeDeleteModel: *output, + }, nil +} +func (c *ControllerV1) SysDictTypeView(ctx context.Context, req *v1.SysDictTypeViewReq) (res *v1.SysDictTypeViewRes, err error) { + output, err := service.SysDictType().View(ctx, &req.SysDictTypeViewParam) + if err != nil { + return nil, err + } + return &v1.SysDictTypeViewRes{ + SysDictTypeViewModel: *output, + }, nil +} +func (c *ControllerV1) SysDictDataAdd(ctx context.Context, req *v1.SysDictDataAddReq) (res *v1.SysDictDataAddRes, err error) { + output, err := service.SysDictData().Add(ctx, &req.SysDictDataAddParam) + if err != nil { + return nil, err + } + return &v1.SysDictDataAddRes{ + SysDictDataAddModel: *output, + }, nil +} +func (c *ControllerV1) SysDictDataEdit(ctx context.Context, req *v1.SysDictDataEditReq) (res *v1.SysDictDataEditRes, err error) { + output, err := service.SysDictData().Edit(ctx, &req.SysDictDataEditParam) + if err != nil { + return nil, err + } + return &v1.SysDictDataEditRes{ + SysDictDataEditModel: *output, + }, nil +} +func (c *ControllerV1) SysDictDataDelete(ctx context.Context, req *v1.SysDictDataDeleteReq) (res *v1.SysDictDataDeleteRes, err error) { + _, err = service.SysDictData().Delete(ctx, &req.SysDictDataDeleteParam) + if err != nil { + return nil, err + } + return &v1.SysDictDataDeleteRes{ + SysDictDataDeleteModel: model.SysDictDataDeleteModel{ + DictCodes: req.SysDictDataDeleteParam.DictCodes, + }, + }, nil +} +func (c *ControllerV1) SysDictDataView(ctx context.Context, req *v1.SysDictDataViewReq) (res *v1.SysDictDataViewRes, err error) { + output, err := service.SysDictData().View(ctx, &req.SysDictDataViewParam) + if err != nil { + return nil, err + } + return &v1.SysDictDataViewRes{ + SysDictDataViewModel: *output, + }, nil +} diff --git a/server/internal/controller/system/system_v1_job.go b/server/internal/controller/system/system_v1_job.go new file mode 100644 index 0000000..dd5d4ca --- /dev/null +++ b/server/internal/controller/system/system_v1_job.go @@ -0,0 +1,118 @@ +package system + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysJobList(ctx context.Context, req *v1.SysJobListReq) (res *v1.SysJobListRes, err error) { + data, total, err := service.SysJob().List(ctx, &req.SysJobListParam, &req.PageInfo) + if err != nil { + return nil, err + } + + return &v1.SysJobListRes{ + Data: data, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil + +} +func (c *ControllerV1) SysJobView(ctx context.Context, req *v1.SysJobViewReq) (res *v1.SysJobViewRes, err error) { + data, err := service.SysJob().View(ctx, req.JobId) + if err != nil { + return nil, err + } + return &v1.SysJobViewRes{ + SysJobViewModel: *data, + }, nil + +} +func (c *ControllerV1) SysJobAdd(ctx context.Context, req *v1.SysJobAddReq) (res *v1.SysJobAddRes, err error) { + lastInserId, err := service.SysJob().Add(ctx, &req.SysJobAddModel) + if err != nil { + return nil, err + } + data, err := service.SysJob().View(ctx, lastInserId) + + if err != nil { + return nil, err + } + return &v1.SysJobAddRes{ + SysJobViewModel: *data, + }, nil + +} +func (c *ControllerV1) SysJobUpdate(ctx context.Context, req *v1.SysJobUpdateReq) (res *v1.SysJobUpdateRes, err error) { + effectedRow, err := service.SysJob().Update(ctx, &req.SysJobUpdateModel) + if err != nil { + return nil, err + } + + if effectedRow == 0 { + return nil, gerror.NewCode(gcode.CodeInvalidParameter, "要更新的数据不存在") + } + + data, err := service.SysJob().View(ctx, req.JobId) + if err != nil { + return nil, err + } + return &v1.SysJobUpdateRes{ + SysJobViewModel: *data, + }, nil +} + +func (c *ControllerV1) SysJobUpdateStatus(ctx context.Context, req *v1.SysJobUpdateStatusReq) (res *v1.SysJobUpdateStatusRes, err error) { + effectedRow, err := service.SysJob().UpdateStatus(ctx, &req.SysJobUpdateStatusModel) + if err != nil { + return nil, err + } + + if effectedRow == 0 { + return nil, gerror.NewCode(gcode.CodeInvalidParameter, "要更新的数据不存在") + } + + data, err := service.SysJob().View(ctx, req.JobId) + if err != nil { + return nil, err + } + return &v1.SysJobUpdateStatusRes{ + SysJobViewModel: *data, + }, nil +} + +func (c *ControllerV1) SysJobDelete(ctx context.Context, req *v1.SysJobDeleteReq) (res *v1.SysJobDeleteRes, err error) { + if len(req.JobIds) == 0 { + return nil, gerror.NewCode(gcode.CodeMissingParameter, "参数不能为空") + } + + _, err = service.SysJob().Delete(ctx, &model.SysJobDeleteModel{JobIds: req.JobIds}) + if err != nil { + return nil, err + } + + return &v1.SysJobDeleteRes{ + JobIds: req.JobIds, + }, nil +} + +func (c *ControllerV1) SysJobExec(ctx context.Context, req *v1.SysJobExecReq) (res *v1.SysJobExecRes, err error) { + err = service.SysJob().Exec(ctx, req.JobId) + if err != nil { + return nil, err + } + + return &v1.SysJobExecRes{ + JobId: req.JobId, + }, nil +} diff --git a/server/internal/controller/system/system_v1_logininfor.go b/server/internal/controller/system/system_v1_logininfor.go new file mode 100644 index 0000000..6bf5724 --- /dev/null +++ b/server/internal/controller/system/system_v1_logininfor.go @@ -0,0 +1,33 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) ListLogininfor(ctx context.Context, req *v1.ListLogininforReq) (res *v1.ListLogininforRes, err error) { + items, total, err := service.SysLogininfor().List(ctx, &req.SysLogininforListParam) + if err != nil { + return nil, err + } + return &v1.ListLogininforRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} +func (c *ControllerV1) DeleteLogininfor(ctx context.Context, req *v1.DeleteLogininforReq) (res *v1.DeleteLogininforRes, err error) { + out, err := service.SysLogininfor().Delete(ctx, &req.SysLogininforDeleteParam) + if err != nil { + return nil, err + } + return &v1.DeleteLogininforRes{ + SysLogininforDeleteModel: *out, + }, nil +} diff --git a/server/internal/controller/system/system_v1_menu.go b/server/internal/controller/system/system_v1_menu.go new file mode 100644 index 0000000..489d5fe --- /dev/null +++ b/server/internal/controller/system/system_v1_menu.go @@ -0,0 +1,65 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) MenuAll(ctx context.Context, req *v1.MenuAllReq) (res *v1.MenuAllRes, err error) { + data, err := service.SysMenu().GetUserMenuTree(ctx) + return &data, err +} +func (c *ControllerV1) MenuList(ctx context.Context, req *v1.MenuListReq) (res *v1.MenuListRes, err error) { + data, total, err := service.SysMenu().GetTenantMenu(ctx, &req.SysMenuListParam) + return &v1.MenuListRes{ + Data: data, + Total: total, + }, err +} +func (c *ControllerV1) MenuView(ctx context.Context, req *v1.MenuViewReq) (res *v1.MenuViewRes, err error) { + data, err := service.SysMenu().GetSysMenuView(ctx, req.MenuId) + if err != nil { + return nil, err + } + return &v1.MenuViewRes{ + SysMenuViewModel: *data, + }, nil +} + +func (c *ControllerV1) MenuAdd(ctx context.Context, req *v1.MenuAddReq) (res *v1.MenuAddRes, err error) { + data, err := service.SysMenu().AddSysMenu(ctx, &req.SysMenuAddModel) + if err != nil { + return nil, err + } + return &v1.MenuAddRes{ + SysMenuViewModel: *data, + }, nil +} + +func (c *ControllerV1) MenuUpdate(ctx context.Context, req *v1.MenuUpdateReq) (res *v1.MenuUpdateRes, err error) { + data, err := service.SysMenu().UpdateSysMenu(ctx, &req.SysMenuUpdateModel) + if err != nil { + return nil, err + } + return &v1.MenuUpdateRes{ + SysMenuViewModel: *data, + }, nil +} +func (c *ControllerV1) MenuDelete(ctx context.Context, req *v1.MenuDeleteReq) (res *v1.MenuDeleteRes, err error) { + err = service.SysMenu().DeleteSysMenu(ctx, req.MenuId) + if err != nil { + return nil, err + } + return &v1.MenuDeleteRes{}, nil +} +func (c *ControllerV1) MenuTree(ctx context.Context, req *v1.MenuTreeReq) (res *v1.MenuTreeRes, err error) { + data, err := service.SysMenu().GetTenantMenuTree(ctx, &req.SysMenuListParam) + if err != nil { + return nil, err + } + return &v1.MenuTreeRes{ + Data: data, + }, nil +} diff --git a/server/internal/controller/system/system_v1_notice.go b/server/internal/controller/system/system_v1_notice.go new file mode 100644 index 0000000..08a103b --- /dev/null +++ b/server/internal/controller/system/system_v1_notice.go @@ -0,0 +1,59 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "github.com/gogf/gf/v2/frame/g" +) + +func (c *ControllerV1) SysNoticeList(ctx context.Context, req *v1.SysNoticeListReq) (res *v1.SysNoticeListRes, err error) { + g.Log().Infof(ctx, "SystemControl.SysNoticeList %+v", req) + items, total, err := service.SysNotice().List(ctx, req.SysNoticeListParam) + if err != nil { + return nil, err + } + res = &v1.SysNoticeListRes{ + Items: items, + PageResult: response.PageResult{ + Total: total, + Page: req.PageInfo.Page, + PageSize: req.PageInfo.PageSize, + }, + } + return +} +func (c *ControllerV1) SysNoticeAdd(ctx context.Context, req *v1.SysNoticeAddReq) (res *v1.SysNoticeAddRes, err error) { + err = service.SysNotice().Add(ctx, req.SysNoticeAddParam) + if err != nil { + return nil, err + } + return +} +func (c *ControllerV1) SysNoticeEdit(ctx context.Context, req *v1.SysNoticeEditReq) (res *v1.SysNoticeEditRes, err error) { + err = service.SysNotice().Edit(ctx, req.SysNoticeEditParam) + if err != nil { + return nil, err + } + return +} +func (c *ControllerV1) SysNoticeDelete(ctx context.Context, req *v1.SysNoticeDeleteReq) (res *v1.SysNoticeDeleteRes, err error) { + err = service.SysNotice().Delete(ctx, req.SysNoticeDeleteParam) + if err != nil { + return nil, err + } + return +} +func (c *ControllerV1) SysNoticeView(ctx context.Context, req *v1.SysNoticeViewReq) (res *v1.SysNoticeViewRes, err error) { + data, err := service.SysNotice().View(ctx, req.SysNoticeViewParam) + if err != nil { + return nil, err + } + res = &v1.SysNoticeViewRes{ + SysNoticeViewModel: data, + } + return +} diff --git a/server/internal/controller/system/system_v1_online.go b/server/internal/controller/system/system_v1_online.go new file mode 100644 index 0000000..0ba23e7 --- /dev/null +++ b/server/internal/controller/system/system_v1_online.go @@ -0,0 +1,36 @@ +package system + +import ( + "context" + "errors" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysUserOnlineList(ctx context.Context, req *v1.SysUserOnlineListReq) (res *v1.SysUserOnlineListRes, err error) { + items, total, err := service.SysUserOnline().List(ctx, &req.SysUserOnlineListParam, &req.PageInfo) + if err != nil { + return nil, err + } + return &v1.SysUserOnlineListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} + +func (c *ControllerV1) SysUserOnlineDelete(ctx context.Context, req *v1.SysUserOnlineDeleteReq) (res *v1.SysUserOnlineDeleteRes, err error) { + if len(req.Ids) == 0 { + return nil, errors.New("ids不能为空") + } + err = service.SysUserOnline().Delete(ctx, req.Ids) + if err != nil { + return nil, err + } + return &v1.SysUserOnlineDeleteRes{}, nil +} diff --git a/server/internal/controller/system/system_v1_oper_log.go b/server/internal/controller/system/system_v1_oper_log.go new file mode 100644 index 0000000..d15fef0 --- /dev/null +++ b/server/internal/controller/system/system_v1_oper_log.go @@ -0,0 +1,25 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) GetOperLogList(ctx context.Context, req *v1.GetOperLogListReq) (res *v1.GetOperLogListRes, err error) { + items, total, err := service.SysOperLog().GetOperLogList(ctx, &req.SysOperLogListParam, &req.PageInfo) + if err != nil { + return nil, err + } + + return &v1.GetOperLogListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} diff --git a/server/internal/controller/system/system_v1_oss.go b/server/internal/controller/system/system_v1_oss.go new file mode 100644 index 0000000..f91dde6 --- /dev/null +++ b/server/internal/controller/system/system_v1_oss.go @@ -0,0 +1,43 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysOssList(ctx context.Context, req *v1.SysOssListReq) (res *v1.SysOssListRes, err error) { + items, total, err := service.SysOss().List(ctx, &req.SysOssListParam, &req.PageInfo) + if err != nil { + return nil, err + } + res = &v1.SysOssListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + } + return +} +func (c *ControllerV1) SysOssView(ctx context.Context, req *v1.SysOssViewReq) (res *v1.SysOssViewRes, err error) { + info, err := service.SysOss().View(ctx, req.SysOssViewParam) + if err != nil { + return nil, err + } + res = &v1.SysOssViewRes{ + SysOssViewModel: info, + } + return +} +func (c *ControllerV1) SysOssDelete(ctx context.Context, req *v1.SysOssDeleteReq) (res *v1.SysOssDeleteRes, err error) { + _, err = service.SysOss().Delete(ctx, req.SysOssDeleteParam) + if err != nil { + return nil, err + } + res = &v1.SysOssDeleteRes{} + return +} diff --git a/server/internal/controller/system/system_v1_oss_config.go b/server/internal/controller/system/system_v1_oss_config.go new file mode 100644 index 0000000..b30e154 --- /dev/null +++ b/server/internal/controller/system/system_v1_oss_config.go @@ -0,0 +1,61 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysOssConfigList(ctx context.Context, req *v1.SysOssConfigListReq) (res *v1.SysOssConfigListRes, err error) { + items, total, err := service.SysOssConfig().List(ctx, req.SysOssConfigListParam) + if err != nil { + return nil, err + } + return &v1.SysOssConfigListRes{ + Items: items, + PageResult: response.PageResult{ + Total: total, + Page: req.Page, + PageSize: req.PageSize, + }, + }, nil +} +func (c *ControllerV1) SysOssConfigView(ctx context.Context, req *v1.SysOssConfigViewReq) (res *v1.SysOssConfigViewRes, err error) { + item, err := service.SysOssConfig().View(ctx, req.SysOssConfigViewParam) + if err != nil { + return nil, err + } + return &v1.SysOssConfigViewRes{ + SysOssConfigViewModel: item, + }, nil +} +func (c *ControllerV1) SysOssConfigAdd(ctx context.Context, req *v1.SysOssConfigAddReq) (res *v1.SysOssConfigAddRes, err error) { + item, err := service.SysOssConfig().Add(ctx, req.SysOssConfigAddParam) + if err != nil { + return nil, err + } + return &v1.SysOssConfigAddRes{ + SysOssConfigAddModel: item, + }, nil +} +func (c *ControllerV1) SysOssConfigEdit(ctx context.Context, req *v1.SysOssConfigEditReq) (res *v1.SysOssConfigEditRes, err error) { + item, err := service.SysOssConfig().Edit(ctx, req.SysOssConfigEditParam) + if err != nil { + return nil, err + } + return &v1.SysOssConfigEditRes{ + SysOssConfigEditModel: item, + }, nil +} + +func (c *ControllerV1) SysOssConfigDelete(ctx context.Context, req *v1.SysOssConfigDeleteReq) (res *v1.SysOssConfigDeleteRes, err error) { + item, err := service.SysOssConfig().Delete(ctx, req.SysOssConfigDeleteParam) + if err != nil { + return nil, err + } + return &v1.SysOssConfigDeleteRes{ + SysOssConfigDeleteModel: item, + }, nil +} diff --git a/server/internal/controller/system/system_v1_post.go b/server/internal/controller/system/system_v1_post.go new file mode 100644 index 0000000..53a43f7 --- /dev/null +++ b/server/internal/controller/system/system_v1_post.go @@ -0,0 +1,67 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) PostList(ctx context.Context, req *v1.PostListReq) (res *v1.PostListRes, err error) { + items, total, err := service.SysPost().List(ctx, req.SysPostListParam) + if err != nil { + return nil, err + } + return &v1.PostListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + Data: items, + }, nil +} +func (c *ControllerV1) PostAdd(ctx context.Context, req *v1.PostAddReq) (res *v1.PostAddRes, err error) { + post, err := service.SysPost().Add(ctx, req.SysPostAddParam) + if err != nil { + return nil, err + } + return &v1.PostAddRes{ + SysPostAddModel: post, + }, nil +} +func (c *ControllerV1) PostEdit(ctx context.Context, req *v1.PostEditReq) (res *v1.PostEditRes, err error) { + post, err := service.SysPost().Edit(ctx, req.SysPostEditParam) + if err != nil { + return nil, err + } + return &v1.PostEditRes{ + SysPostEditModel: post, + }, nil +} +func (c *ControllerV1) PostDelete(ctx context.Context, req *v1.PostDeleteReq) (res *v1.PostDeleteRes, err error) { + post, err := service.SysPost().Delete(ctx, req.SysPostDeleteParam) + if err != nil { + return nil, err + } + return &v1.PostDeleteRes{ + SysPostDeleteModel: post, + }, nil +} +func (c *ControllerV1) PostView(ctx context.Context, req *v1.PostViewReq) (res *v1.PostViewRes, err error) { + post, err := service.SysPost().View(ctx, req.SysPostViewParam) + if err != nil { + return nil, err + } + return &v1.PostViewRes{ + SysPostViewModel: post, + }, nil +} +func (c *ControllerV1) PostExport(ctx context.Context, req *v1.PostExportReq) (res *v1.PostExportRes, err error) { + _, err = service.SysPost().Export(ctx, req.SysPostExportParam) + if err != nil { + return nil, err + } + return &v1.PostExportRes{}, nil +} diff --git a/server/internal/controller/system/system_v1_qrcode.go b/server/internal/controller/system/system_v1_qrcode.go new file mode 100644 index 0000000..5ba4357 --- /dev/null +++ b/server/internal/controller/system/system_v1_qrcode.go @@ -0,0 +1,94 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +// 获取登录二维码 +func (c *ControllerV1) QrcodeLogin(ctx context.Context, req *v1.QrcodeLoginReq) (res *v1.QrcodeLoginRes, err error) { + qrcodeLoginModel, err := service.SysQrcode().GetQrcodeLogin(ctx) + if err != nil { + return nil, err + } + return &v1.QrcodeLoginRes{ + QrcodeLoginModel: *qrcodeLoginModel, + }, nil +} + +// 获取登录二维码扫码结果 +func (c *ControllerV1) QrcodeLoginStatus(ctx context.Context, req *v1.QrcodeLoginStatusReq) (res *v1.QrcodeLoginStatusRes, err error) { + qrcodeLoginModel, err := service.SysQrcode().GetQrcodeLoginStatus(ctx, req.TempUserId) + if err != nil { + return nil, err + } + return &v1.QrcodeLoginStatusRes{ + QrcodeLoginModel: *qrcodeLoginModel, + }, nil +} + +// 获取绑定二维码 +func (c *ControllerV1) QrcodeBind(ctx context.Context, req *v1.QrcodeBindReq) (res *v1.QrcodeBindRes, err error) { + qrcodeBindModel, err := service.SysQrcode().GetQrcodeBind(ctx) + if err != nil { + return nil, err + } + return &v1.QrcodeBindRes{ + QrcodeCacheModel: *qrcodeBindModel, + }, nil +} + +// 获取绑定二维码扫码结果 +func (c *ControllerV1) QrcodeBindStatus(ctx context.Context, req *v1.QrcodeBindStatusReq) (res *v1.QrcodeBindStatusRes, err error) { + qrcodeBindStatusModel, err := service.SysQrcode().GetQrcodeBindStatus(ctx) + if err != nil { + return nil, err + } + return &v1.QrcodeBindStatusRes{ + QrcodeBindStatusModel: *qrcodeBindStatusModel, + }, nil +} + +// 扫码成功回调 +func (c *ControllerV1) QrcodeScanCallback(ctx context.Context, req *v1.QrcodeScanCallbackReq) (res *v1.QrcodeScanCallbackRes, err error) { + err = service.SysQrcode().QrcodeScanCallback(ctx, &req.QrcodeScanCallbackParam) + if err != nil { + return nil, err + } + return &v1.QrcodeScanCallbackRes{}, nil +} + +// 注册并关联OpenId +func (c *ControllerV1) QrcodeRegisterAndBindOpenId(ctx context.Context, req *v1.QrcodeRegisterAndBindOpenIdReq) (res *v1.QrcodeRegisterAndBindOpenIdRes, err error) { + qrcodeLoginAndBindOpenIdModel, err := service.SysQrcode().QrcodeRegisterAndBindOpenId(ctx, &req.QrcodeRegisterAndBindOpenIdParam) + if err != nil { + return nil, err + } + return &v1.QrcodeRegisterAndBindOpenIdRes{ + QrcodeLoginAndBindOpenIdModel: *qrcodeLoginAndBindOpenIdModel, + }, nil +} + +// 登录并关联OpenId +func (c *ControllerV1) QrcodeLoginAndBindOpenId(ctx context.Context, req *v1.QrcodeLoginAndBindOpenIdReq) (res *v1.QrcodeLoginAndBindOpenIdRes, err error) { + qrcodeLoginAndBindOpenIdModel, err := service.SysQrcode().QrcodeLoginAndBindOpenId(ctx, &req.QrcodeLoginAndBindOpenIdParam) + if err != nil { + return nil, err + } + return &v1.QrcodeLoginAndBindOpenIdRes{ + QrcodeLoginAndBindOpenIdModel: *qrcodeLoginAndBindOpenIdModel, + }, nil +} + +// 扫码后选择用户登录 +func (c *ControllerV1) QrcodeLoginSelectUser(ctx context.Context, req *v1.QrcodeLoginSelectUserReq) (res *v1.QrcodeLoginSelectUserRes, err error) { + qrcodeLoginAndBindOpenIdModel, err := service.SysQrcode().QrcodeLoginSelectUserId(ctx, &req.QrcodeLoginSelectUserIdParam) + if err != nil { + return nil, err + } + return &v1.QrcodeLoginSelectUserRes{ + QrcodeLoginAndBindOpenIdModel: *qrcodeLoginAndBindOpenIdModel, + }, nil +} diff --git a/server/internal/controller/system/system_v1_role.go b/server/internal/controller/system/system_v1_role.go new file mode 100644 index 0000000..98a06a2 --- /dev/null +++ b/server/internal/controller/system/system_v1_role.go @@ -0,0 +1,69 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) { + data, total, err := service.SysRole().List(ctx, &req.SysRoleListParam) + if err != nil { + return nil, err + } + return &v1.RoleListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + Data: data, + }, nil +} +func (c *ControllerV1) RoleAdd(ctx context.Context, req *v1.RoleAddReq) (res *v1.RoleAddRes, err error) { + role, err := service.SysRole().Add(ctx, &req.SysRoleAddParam) + if err != nil { + return nil, err + } + return &v1.RoleAddRes{ + SysRoleAddModel: *role, + }, nil +} +func (c *ControllerV1) RoleEdit(ctx context.Context, req *v1.RoleEditReq) (res *v1.RoleEditRes, err error) { + role, err := service.SysRole().Edit(ctx, &req.SysRoleEditParam) + if err != nil { + return nil, err + } + return &v1.RoleEditRes{ + SysRoleEditModel: *role, + }, nil +} + +func (c *ControllerV1) RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) { + role, err := service.SysRole().Delete(ctx, &req.SysRoleDeleteParam) + if err != nil { + return nil, err + } + return &v1.RoleDeleteRes{ + SysRoleDeleteModel: *role, + }, nil +} + +func (c *ControllerV1) RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error) { + record, err := service.SysRole().View(ctx, &req.SysRoleViewParam) + if err != nil { + return nil, err + } + return &v1.RoleViewRes{ + SysRoleViewModel: *record, + }, nil +} +func (c *ControllerV1) RoleDataScopeEdit(ctx context.Context, req *v1.RoleDataScopeEditReq) (res *v1.RoleDataScopeEditRes, err error) { + err = service.SysRole().EditRoleDataScope(ctx, &req.SysRoleDataScopeEditParam) + if err != nil { + return nil, err + } + return &v1.RoleDataScopeEditRes{}, nil +} diff --git a/server/internal/controller/system/system_v1_social.go b/server/internal/controller/system/system_v1_social.go new file mode 100644 index 0000000..914bee0 --- /dev/null +++ b/server/internal/controller/system/system_v1_social.go @@ -0,0 +1,34 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysSocialList(ctx context.Context, req *v1.SysSocialListReq) (res *v1.SysSocialListRes, err error) { + items, total, err := service.SysSocial().List(ctx, &req.SysSocialListParam, &req.PageInfo) + if err != nil { + return nil, err + } + res = &v1.SysSocialListRes{ + Items: items, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + } + return res, nil +} + +// 删除绑定关系 +func (c *ControllerV1) SysSocialDelete(ctx context.Context, req *v1.SysSocialDeleteReq) (res *v1.SysSocialDeleteRes, err error) { + err = service.SysSocial().Delete(ctx, req.Id) + if err != nil { + return nil, err + } + return &v1.SysSocialDeleteRes{}, nil +} diff --git a/server/internal/controller/system/system_v1_tenant.go b/server/internal/controller/system/system_v1_tenant.go new file mode 100644 index 0000000..118e54e --- /dev/null +++ b/server/internal/controller/system/system_v1_tenant.go @@ -0,0 +1,141 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) SysTenantList(ctx context.Context, req *v1.SysTenantListReq) (res *v1.SysTenantListRes, err error) { + items, total, err := service.SysTenant().List(ctx, req.SysTenantListParam) + if err != nil { + return nil, err + } + res = &v1.SysTenantListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + Items: items, + } + return +} + +func (c *ControllerV1) SysTenantPackageList(ctx context.Context, req *v1.SysTenantPackageListReq) (res *v1.SysTenantPackageListRes, err error) { + items, total, err := service.SysTenantPackage().List(ctx, &req.SysTenantPackageListParam) + if err != nil { + return nil, err + } + res = &v1.SysTenantPackageListRes{ + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + Items: items, + } + return +} +func (c *ControllerV1) SysTenantAdd(ctx context.Context, req *v1.SysTenantAddReq) (res *v1.SysTenantAddRes, err error) { + data, err := service.SysTenant().Add(ctx, req.SysTenantAddParam) + if err != nil { + return nil, err + } + return &v1.SysTenantAddRes{ + SysTenantAddModel: data, + }, nil +} +func (c *ControllerV1) SysTenantEdit(ctx context.Context, req *v1.SysTenantEditReq) (res *v1.SysTenantEditRes, err error) { + data, err := service.SysTenant().Edit(ctx, req.SysTenantEditParam) + if err != nil { + return nil, err + } + return &v1.SysTenantEditRes{ + SysTenantEditModel: data, + }, nil +} +func (c *ControllerV1) SysTenantDelete(ctx context.Context, req *v1.SysTenantDeleteReq) (res *v1.SysTenantDeleteRes, err error) { + data, err := service.SysTenant().Delete(ctx, req.SysTenantDeleteParam) + if err != nil { + return nil, err + } + return &v1.SysTenantDeleteRes{ + SysTenantDeleteModel: data, + }, nil +} +func (c *ControllerV1) SysTenantStatus(ctx context.Context, req *v1.SysTenantStatusReq) (res *v1.SysTenantStatusRes, err error) { + data, err := service.SysTenant().Status(ctx, req.SysTenantStatusParam) + if err != nil { + return nil, err + } + return &v1.SysTenantStatusRes{ + SysTenantStatusModel: data, + }, nil +} +func (c *ControllerV1) SysTenantView(ctx context.Context, req *v1.SysTenantViewReq) (res *v1.SysTenantViewRes, err error) { + data, err := service.SysTenant().View(ctx, req.SysTenantViewParam) + if err != nil { + return nil, err + } + return &v1.SysTenantViewRes{ + SysTenantViewModel: data, + }, nil +} +func (c *ControllerV1) SysTenantPackageView(ctx context.Context, req *v1.SysTenantPackageViewReq) (res *v1.SysTenantPackageViewRes, err error) { + data, err := service.SysTenantPackage().View(ctx, req.SysTenantPackageViewParam) + if err != nil { + return nil, err + } + return &v1.SysTenantPackageViewRes{ + SysTenantPackageViewModel: data, + }, nil +} +func (c *ControllerV1) SysTenantPackageStatus(ctx context.Context, req *v1.SysTenantPackageStatusReq) (res *v1.SysTenantPackageStatusRes, err error) { + data, err := service.SysTenantPackage().Status(ctx, req.SysTenantPackageStatusParam) + if err != nil { + return nil, err + } + return &v1.SysTenantPackageStatusRes{ + SysTenantPackageStatusModel: data, + }, nil +} +func (c *ControllerV1) SysTenantPackageAdd(ctx context.Context, req *v1.SysTenantPackageAddReq) (res *v1.SysTenantPackageAddRes, err error) { + data, err := service.SysTenantPackage().Add(ctx, req.SysTenantPackageAddParam) + if err != nil { + return nil, err + } + return &v1.SysTenantPackageAddRes{ + SysTenantPackageAddModel: data, + }, nil +} +func (c *ControllerV1) SysTenantPackageEdit(ctx context.Context, req *v1.SysTenantPackageEditReq) (res *v1.SysTenantPackageEditRes, err error) { + data, err := service.SysTenantPackage().Edit(ctx, req.SysTenantPackageEditParam) + if err != nil { + return nil, err + } + return &v1.SysTenantPackageEditRes{ + SysTenantPackageEditModel: data, + }, nil +} +func (c *ControllerV1) SysTenantPackageDelete(ctx context.Context, req *v1.SysTenantPackageDeleteReq) (res *v1.SysTenantPackageDeleteRes, err error) { + data, err := service.SysTenantPackage().Delete(ctx, req.SysTenantPackageDeleteParam) + if err != nil { + return nil, err + } + return &v1.SysTenantPackageDeleteRes{ + SysTenantPackageDeleteModel: data, + }, nil +} +func (c *ControllerV1) SysTenantSyncMenu(ctx context.Context, req *v1.SysTenantSyncMenuReq) (res *v1.SysTenantSyncMenuRes, err error) { + err = service.SysTenant().SyncTenantMenu(ctx, req.TenantId) + if err != nil { + return nil, err + } + return &v1.SysTenantSyncMenuRes{ + SysTenantSyncMenuModel: &model.SysTenantSyncMenuModel{}, + }, nil +} diff --git a/server/internal/controller/system/system_v1_ttplatformsetting.go b/server/internal/controller/system/system_v1_ttplatformsetting.go new file mode 100644 index 0000000..452d11e --- /dev/null +++ b/server/internal/controller/system/system_v1_ttplatformsetting.go @@ -0,0 +1,65 @@ +package system + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) TTplatformSettingList(ctx context.Context, req *v1.TTplatformSettingListReq) (res *v1.TTplatformSettingListRes, err error) { + list, total, err := service.SysTTplatformSetting().List(ctx, &req.TTplatformSettingListParam) + if err != nil { + return nil, err + } + if list == nil { + list = []*model.TTplatformSettingListModel{} + } + res = new(v1.TTplatformSettingListRes) + res.Items = list + res.PageResult.Page = req.Page + res.PageResult.PageSize = req.PageSize + res.PageResult.Total = total + return +} + +func (c *ControllerV1) TTplatformSettingExport(ctx context.Context, req *v1.TTplatformSettingExportReq) (res *v1.TTplatformSettingExportRes, err error) { + err = service.SysTTplatformSetting().Export(ctx, &req.TTplatformSettingListParam) + return +} + +func (c *ControllerV1) TTplatformSettingView(ctx context.Context, req *v1.TTplatformSettingViewReq) (res *v1.TTplatformSettingViewRes, err error) { + data, err := service.SysTTplatformSetting().View(ctx, &req.TTplatformSettingViewParam) + if err != nil { + return nil, err + } + res = new(v1.TTplatformSettingViewRes) + res.TTplatformSettingViewModel = data + return +} + +func (c *ControllerV1) TTplatformSettingEdit(ctx context.Context, req *v1.TTplatformSettingEditReq) (res *v1.TTplatformSettingEditRes, err error) { + err = service.SysTTplatformSetting().Edit(ctx, &req.TTplatformSettingEditParam) + return +} + +func (c *ControllerV1) TTplatformSettingDelete(ctx context.Context, req *v1.TTplatformSettingDeleteReq) (res *v1.TTplatformSettingDeleteRes, err error) { + err = service.SysTTplatformSetting().Delete(ctx, &req.TTplatformSettingDeleteParam) + return +} + +func (c *ControllerV1) TTplatformSettingMaxSort(ctx context.Context, req *v1.TTplatformSettingMaxSortReq) (res *v1.TTplatformSettingMaxSortRes, err error) { + data, err := service.SysTTplatformSetting().MaxSort(ctx, &req.TTplatformSettingMaxSortParam) + if err != nil { + return nil, err + } + res = new(v1.TTplatformSettingMaxSortRes) + res.TTplatformSettingMaxSortModel = data + return +} + +func (c *ControllerV1) TTplatformSettingStatus(ctx context.Context, req *v1.TTplatformSettingStatusReq) (res *v1.TTplatformSettingStatusRes, err error) { + err = service.SysTTplatformSetting().Status(ctx, &req.TTplatformSettingStatusParam) + return +} diff --git a/server/internal/controller/system/system_v1_user.go b/server/internal/controller/system/system_v1_user.go new file mode 100644 index 0000000..93957d7 --- /dev/null +++ b/server/internal/controller/system/system_v1_user.go @@ -0,0 +1,297 @@ +package system + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" +) + +func (c *ControllerV1) UserInfo(ctx context.Context, req *v1.UserInfoReq) (res *v1.UserInfoRes, err error) { + // 获取token + userId := contexts.GetUserId(ctx) + if userId == 0 { + return nil, gerror.NewCode(gcode.CodeSecurityReason) + } + // 获取用户信息 + user, err := service.SysUser().GetUserById(ctx, userId) + if err != nil { + return nil, err + } + menus, err := service.SysMenu().GetUserMenuTree(ctx) + if err != nil { + return nil, err + } + homePath := "" + firstMenu := "404" + if len(menus) > 0 { + for _, menu := range menus { + firstMenu = menu.Path + if len(menu.Children) == 0 { + break + } + for _, menu2 := range menu.Children { + firstMenu = firstMenu + "/" + menu2.Path + if len(menu2.Children) == 0 { + break + } + for _, menu3 := range menu2.Children { + firstMenu = firstMenu + "/" + menu3.Path + if len(menu3.Children) == 0 { + break + } + for _, menu4 := range menu3.Children { + firstMenu = firstMenu + "/" + menu4.Path + if len(menu4.Children) == 0 { + break + } + for _, menu5 := range menu4.Children { + firstMenu = firstMenu + "/" + menu5.Path + if len(menu5.Children) == 0 { + break + } + for _, menu6 := range menu5.Children { + firstMenu = firstMenu + "/" + menu6.Path + if len(menu6.Children) == 0 { + break + } + } + } + } + } + } + } + } + g.Log().Debugf(ctx, "firstMenu: %s", firstMenu) + if homePath == "" { + homePath = "/" + firstMenu + } + + // 是否未由用户本人设置密码:用于前端「首次登录引导修改密码」。 + // 1=新账号尚未设密或管理员重置的临时密码,登录后引导修改;用户本人改密后归 0。 + isInitPassword := user.IsInitPassword == 1 + + return &v1.UserInfoRes{ + UserInfo: v1.UserInfo{ + Id: user.UserId, + Username: user.UserName, + Nickname: user.NickName, + Avatar: user.Avatar, + Email: user.Email, + HomePath: homePath, + Phonenumber: user.Phonenumber, + IsInitPassword: isInitPassword, + }, + }, nil +} +func (c *ControllerV1) UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error) { + // 获取用户列表 + users, total, err := service.SysUser().List(ctx, &req.PageInfo, &req.UserListParam) + if err != nil { + return nil, err + } + return &v1.UserListRes{ + Data: users, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} + +func (c *ControllerV1) AddUser(ctx context.Context, req *v1.AddUserReq) (res *v1.AddUserRes, err error) { + data, err := service.SysUser().AddUser(ctx, &req.SysUserAddModel) + if err != nil { + return nil, err + } + return &v1.AddUserRes{ + Data: data, + }, nil +} + +func (c *ControllerV1) UserProfile(ctx context.Context, req *v1.UserProfileReq) (res *v1.UserProfileRes, err error) { + user, err := service.SysUser().Profile(ctx) + if err != nil { + return nil, err + } + return &v1.UserProfileRes{ + User: user, + }, nil +} + +func (c *ControllerV1) UpdateCurrentUser(ctx context.Context, req *v1.UpdateCurrentUserReq) (res *v1.UpdateCurrentUserRes, err error) { + user, err := service.SysUser().UpdateCurrentUser(ctx, &req.UpdateCurrentUserModel) + if err != nil { + return nil, err + } + return &v1.UpdateCurrentUserRes{ + UserInfo: v1.UserInfo{ + Id: user.UserId, + Username: user.UserName, + Nickname: user.NickName, + Avatar: user.Avatar, + Email: user.Email, + }, + }, nil +} + +func (c *ControllerV1) UpdateCurrentUserPassword(ctx context.Context, req *v1.UpdateCurrentUserPasswordReq) (res *v1.UpdateCurrentUserPasswordRes, err error) { + err = service.SysUser().UpdateCurrentUserPassword(ctx, &req.UpdateCurrentUserPasswordModel) + if err != nil { + return nil, err + } + return &v1.UpdateCurrentUserPasswordRes{}, nil +} + +func (c *ControllerV1) SendCurrentUserEmailCode(ctx context.Context, req *v1.SendCurrentUserEmailCodeReq) (res *v1.SendCurrentUserEmailCodeRes, err error) { + if err = service.SysUser().SendCurrentUserEmailCode(ctx, &req.SendCurrentUserEmailCodeModel); err != nil { + return nil, err + } + return &v1.SendCurrentUserEmailCodeRes{}, nil +} + +func (c *ControllerV1) UpdateCurrentUserEmail(ctx context.Context, req *v1.UpdateCurrentUserEmailReq) (res *v1.UpdateCurrentUserEmailRes, err error) { + if err = service.SysUser().UpdateCurrentUserEmail(ctx, &req.UpdateCurrentUserEmailModel); err != nil { + return nil, err + } + return &v1.UpdateCurrentUserEmailRes{}, nil +} + +func (c *ControllerV1) SendCurrentUserPhoneCode(ctx context.Context, req *v1.SendCurrentUserPhoneCodeReq) (res *v1.SendCurrentUserPhoneCodeRes, err error) { + if err = service.SysUser().SendCurrentUserPhoneCode(ctx, &req.SendCurrentUserPhoneCodeModel); err != nil { + return nil, err + } + return &v1.SendCurrentUserPhoneCodeRes{}, nil +} + +func (c *ControllerV1) UpdateCurrentUserPhone(ctx context.Context, req *v1.UpdateCurrentUserPhoneReq) (res *v1.UpdateCurrentUserPhoneRes, err error) { + if err = service.SysUser().UpdateCurrentUserPhone(ctx, &req.UpdateCurrentUserPhoneModel); err != nil { + return nil, err + } + return &v1.UpdateCurrentUserPhoneRes{}, nil +} + +func (c *ControllerV1) UpdateUser(ctx context.Context, req *v1.UpdateUserReq) (res *v1.UpdateUserRes, err error) { + err = service.SysUser().UpdateUser(ctx, &req.SysUserUpdateModel) + if err != nil { + return nil, err + } + user, err := service.SysUser().GetUserById(ctx, req.UserId) + if err != nil { + return nil, err + } + return &v1.UpdateUserRes{ + SysUserViewModel: *user, + }, nil +} + +func (c *ControllerV1) DeleteUser(ctx context.Context, req *v1.DeleteUserReq) (res *v1.DeleteUserRes, err error) { + if req.UserId != 0 { + err = service.SysUser().DeleteUser(ctx, []int64{req.UserId}) + } else { + err = service.SysUser().DeleteUser(ctx, req.UserIds) + } + if err != nil { + return nil, err + } + return &v1.DeleteUserRes{}, nil +} +func (c *ControllerV1) GetUser(ctx context.Context, req *v1.GetUserReq) (res *v1.GetUserRes, err error) { + // 如果调用方传入 userId == 0,则不返回错误,直接返回空的用户视图结构 + if req.UserId == 0 { + return &v1.GetUserRes{ + SysUserViewModel: model.SysUserViewModel{}, + }, nil + } + + user, err := service.SysUser().GetUserById(ctx, req.UserId) + if err != nil { + return nil, err + } + return &v1.GetUserRes{ + SysUserViewModel: *user, + }, nil +} +func (c *ControllerV1) ResetPassword(ctx context.Context, req *v1.ResetPasswordReq) (res *v1.ResetPasswordRes, err error) { + err = service.SysUser().ResetPassword(ctx, req.UserId, req.Password) + if err != nil { + return nil, err + } + return &v1.ResetPasswordRes{}, nil +} +func (c *ControllerV1) GetUserListByDeptId(ctx context.Context, req *v1.GetUserListByDeptIdReq) (res *v1.GetUserListByDeptIdRes, err error) { + users, total, err := service.SysUser().List(ctx, &request.PageInfo{ + Page: req.Page, + PageSize: req.PageSize, + }, &model.UserListParam{ + DeptId: req.DeptId, + }) + if err != nil { + return nil, err + } + miniUsers := make([]*model.SysUserMiniModel, 0) + gconv.Structs(users, &miniUsers) + return &v1.GetUserListByDeptIdRes{ + Items: miniUsers, + PageResult: response.PageResult{ + Page: req.Page, + PageSize: req.PageSize, + Total: total, + }, + }, nil +} + +// UserRegister 用户注册 +func (c *ControllerV1) UserRegister(ctx context.Context, req *v1.UserRegisterReq) (res *v1.UserRegisterRes, err error) { + err = service.SysUser().Register(ctx, &req.SysUserRegisterModel) + if err != nil { + return nil, err + } + return &v1.UserRegisterRes{}, nil +} + +// UserStatus 更新用户状态 +func (c *ControllerV1) UserStatus(ctx context.Context, req *v1.UserStatusReq) (res *v1.UserStatusRes, err error) { + err = service.SysUser().Status(ctx, &req.SysUserStatusParam) + if err != nil { + return nil, err + } + return &v1.UserStatusRes{}, nil +} + +// IsMfaEnabled 登录时查看是否开启mfa验证 +func (c *ControllerV1) IsMfaEnabled(ctx context.Context, req *v1.IsMfaEnabledReq) (res *v1.IsMfaEnabledRes, err error) { + mfaEnabledModel, err := service.SysUser().IsMfaEnabled(ctx) + if err != nil { + return nil, err + } + return &v1.IsMfaEnabledRes{SysUserMfaEnabledModel: mfaEnabledModel}, nil +} + +// SetMfaEnabled 是否开启mfa验证 +func (c *ControllerV1) SetMfaEnabled(ctx context.Context, req *v1.SetMfaEnabledReq) (res *v1.SetMfaEnabledRes, err error) { + uuid, err := service.SysUser().SetMfaEnabled(ctx) + if err != nil { + return nil, err + } + return &v1.SetMfaEnabledRes{Uuid: uuid}, nil +} + +// MfaVerify mfa验证 +func (c *ControllerV1) MfaVerify(ctx context.Context, req *v1.MfaVerifyReq) (res *v1.MfaVerifyRes, err error) { + err = service.SysUser().MfaVerify(ctx, &req.SysUserIsMfaEnabledModel) + if err != nil { + return nil, err + } + return &v1.MfaVerifyRes{}, nil +} diff --git a/server/internal/controller/trade/trade.go b/server/internal/controller/trade/trade.go new file mode 100644 index 0000000..526a216 --- /dev/null +++ b/server/internal/controller/trade/trade.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package trade diff --git a/server/internal/controller/trade/trade_new.go b/server/internal/controller/trade/trade_new.go new file mode 100644 index 0000000..9b996a7 --- /dev/null +++ b/server/internal/controller/trade/trade_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package trade + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/trade" +) + +type ControllerV1 struct{} + +func NewV1() trade.ITradeV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/trade/trade_v1_recharge.go b/server/internal/controller/trade/trade_v1_recharge.go new file mode 100644 index 0000000..03dff74 --- /dev/null +++ b/server/internal/controller/trade/trade_v1_recharge.go @@ -0,0 +1,14 @@ +package trade + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/trade/v1" +) + +func (c *ControllerV1) Recharge(ctx context.Context, req *v1.RechargeReq) (res *v1.RechargeRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/server/internal/controller/workerdiagnostic/worker_diagnostic.go b/server/internal/controller/workerdiagnostic/worker_diagnostic.go new file mode 100644 index 0000000..34015fb --- /dev/null +++ b/server/internal/controller/workerdiagnostic/worker_diagnostic.go @@ -0,0 +1,28 @@ +package workerdiagnostic + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/workerdiagnostic/v1" + workerdiagnosticservice "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/workerdiagnostic" +) + +type Controller struct { + service *workerdiagnosticservice.Service +} + +func New(service *workerdiagnosticservice.Service) *Controller { + return &Controller{service: service} +} + +func (c *Controller) Diagnostic(ctx context.Context, req *v1.DiagnosticReq) (*v1.DiagnosticRes, error) { + result, err := c.service.Publish(ctx, req.Message) + if err != nil { + return nil, err + } + return &v1.DiagnosticRes{ + TraceID: result.TraceID, + Queue: result.Queue, + SentAt: result.SentAt, + }, nil +} diff --git a/server/internal/controller/workerdiagnostic/workerdiagnostic.go b/server/internal/controller/workerdiagnostic/workerdiagnostic.go new file mode 100644 index 0000000..c13c808 --- /dev/null +++ b/server/internal/controller/workerdiagnostic/workerdiagnostic.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package workerdiagnostic diff --git a/server/internal/controller/workerdiagnostic/workerdiagnostic_new.go b/server/internal/controller/workerdiagnostic/workerdiagnostic_new.go new file mode 100644 index 0000000..0288da3 --- /dev/null +++ b/server/internal/controller/workerdiagnostic/workerdiagnostic_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package workerdiagnostic + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/workerdiagnostic" +) + +type ControllerV1 struct{} + +func NewV1() workerdiagnostic.IWorkerdiagnosticV1 { + return &ControllerV1{} +} diff --git a/server/internal/controller/workerdiagnostic/workerdiagnostic_v1_diagnostic.go b/server/internal/controller/workerdiagnostic/workerdiagnostic_v1_diagnostic.go new file mode 100644 index 0000000..4f986be --- /dev/null +++ b/server/internal/controller/workerdiagnostic/workerdiagnostic_v1_diagnostic.go @@ -0,0 +1,14 @@ +package workerdiagnostic + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/workerdiagnostic/v1" +) + +func (c *ControllerV1) Diagnostic(ctx context.Context, req *v1.DiagnosticReq) (res *v1.DiagnosticRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/server/internal/dao/batch_detail.go b/server/internal/dao/batch_detail.go new file mode 100644 index 0000000..bbebe01 --- /dev/null +++ b/server/internal/dao/batch_detail.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// batchDetailDao is the data access object for the table batch_detail. +// You can define custom methods on it to extend its functionality as needed. +type batchDetailDao struct { + *internal.BatchDetailDao +} + +var ( + // BatchDetail is a globally accessible object for table batch_detail operations. + BatchDetail = batchDetailDao{internal.NewBatchDetailDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/batch_main.go b/server/internal/dao/batch_main.go new file mode 100644 index 0000000..8d99d3e --- /dev/null +++ b/server/internal/dao/batch_main.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// batchMainDao is the data access object for the table batch_main. +// You can define custom methods on it to extend its functionality as needed. +type batchMainDao struct { + *internal.BatchMainDao +} + +var ( + // BatchMain is a globally accessible object for table batch_main operations. + BatchMain = batchMainDao{internal.NewBatchMainDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/internal/batch_detail.go b/server/internal/dao/internal/batch_detail.go new file mode 100644 index 0000000..2facffc --- /dev/null +++ b/server/internal/dao/internal/batch_detail.go @@ -0,0 +1,109 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// BatchDetailDao is the data access object for the table batch_detail. +type BatchDetailDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns BatchDetailColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// BatchDetailColumns defines and stores column names for the table batch_detail. +type BatchDetailColumns struct { + Id string // 主键ID + BatchNo string // 批次编号 + BatchType string // 批次类型 枚举(与主表一致) + DetailStatus string // 明细异步处理状态 0-待处理 1-处理中 2-成功 3-失败 + BlankOutStatus string // 作废状态 0-是 1-否 + RowNo string // 行号 + ItemId string // 项ID:卡ICCID/设备编码 + ErrorCode string // 异常编码 + ErrorReason string // 异常原因 + Snapshot string // 信息快照 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// batchDetailColumns holds the columns for the table batch_detail. +var batchDetailColumns = BatchDetailColumns{ + Id: "id", + BatchNo: "batch_no", + BatchType: "batch_type", + DetailStatus: "detail_status", + BlankOutStatus: "blank_out_status", + RowNo: "row_no", + ItemId: "item_id", + ErrorCode: "error_code", + ErrorReason: "error_reason", + Snapshot: "snapshot", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewBatchDetailDao creates and returns a new DAO object for table data access. +func NewBatchDetailDao(handlers ...gdb.ModelHandler) *BatchDetailDao { + return &BatchDetailDao{ + group: "default", + table: "batch_detail", + columns: batchDetailColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *BatchDetailDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *BatchDetailDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *BatchDetailDao) Columns() BatchDetailColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *BatchDetailDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *BatchDetailDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *BatchDetailDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/batch_main.go b/server/internal/dao/internal/batch_main.go new file mode 100644 index 0000000..3ffc6a3 --- /dev/null +++ b/server/internal/dao/internal/batch_main.go @@ -0,0 +1,139 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// BatchMainDao is the data access object for the table batch_main. +type BatchMainDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns BatchMainColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// BatchMainColumns defines and stores column names for the table batch_main. +type BatchMainColumns struct { + Id string // 主键ID + BatchNo string // 批次编号 + OrderSn string // 订单编号 + BatchType string // 批次类型 枚举 + BatchStatus string // 批次状态 枚举 + BatchAsyncStatus string // 异步处理状态 + SourceType string // 来源方式 枚举 + SourceBatchNo string // 来源批次编号 + SourceOssId string // 源文件OSS ID + ResultOssId string // 结果文件OSS ID + IsCrossDept string // 是否跨级操作机构 + TargetDeptId string // 目标机构编号 + DeptId string // 机构编号 + TotalCount string // 总数量 + ValidCount string // 有效数量 + SuccessCount string // 成功数量 + FailCount string // 失败数量 + RunResult string // 运行结果 + FailReason string // 失败原因 + BatchInfo string // 批次信息:入库/出库展示字段 + Remark string // 备注扩展字段 + StartTime string // 开始时间 + EndTime string // 结束时间 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 + SourceChannel string // 发起渠道:console/mini_program/api/system/legacy + ExecutionMode string // 操作规模:0未知1单卡2批量 +} + +// batchMainColumns holds the columns for the table batch_main. +var batchMainColumns = BatchMainColumns{ + Id: "id", + BatchNo: "batch_no", + OrderSn: "order_sn", + BatchType: "batch_type", + BatchStatus: "batch_status", + BatchAsyncStatus: "batch_async_status", + SourceType: "source_type", + SourceBatchNo: "source_batch_no", + SourceOssId: "source_oss_id", + ResultOssId: "result_oss_id", + IsCrossDept: "is_cross_dept", + TargetDeptId: "target_dept_id", + DeptId: "dept_id", + TotalCount: "total_count", + ValidCount: "valid_count", + SuccessCount: "success_count", + FailCount: "fail_count", + RunResult: "run_result", + FailReason: "fail_reason", + BatchInfo: "batch_info", + Remark: "remark", + StartTime: "start_time", + EndTime: "end_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + SourceChannel: "source_channel", + ExecutionMode: "execution_mode", +} + +// NewBatchMainDao creates and returns a new DAO object for table data access. +func NewBatchMainDao(handlers ...gdb.ModelHandler) *BatchMainDao { + return &BatchMainDao{ + group: "default", + table: "batch_main", + columns: batchMainColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *BatchMainDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *BatchMainDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *BatchMainDao) Columns() BatchMainColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *BatchMainDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *BatchMainDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *BatchMainDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_client.go b/server/internal/dao/internal/sys_client.go new file mode 100644 index 0000000..68581a0 --- /dev/null +++ b/server/internal/dao/internal/sys_client.go @@ -0,0 +1,109 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysClientDao is the data access object for the table sys_client. +type SysClientDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysClientColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysClientColumns defines and stores column names for the table sys_client. +type SysClientColumns struct { + Id string // id + ClientId string // 客户端id + ClientKey string // 客户端key + ClientSecret string // 客户端秘钥 + GrantType string // 授权类型 + DeviceType string // 设备类型 + ActiveTimeout string // token活跃超时时间 + Timeout string // token固定超时 + Status string // 状态(0正常 1停用) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// sysClientColumns holds the columns for the table sys_client. +var sysClientColumns = SysClientColumns{ + Id: "id", + ClientId: "client_id", + ClientKey: "client_key", + ClientSecret: "client_secret", + GrantType: "grant_type", + DeviceType: "device_type", + ActiveTimeout: "active_timeout", + Timeout: "timeout", + Status: "status", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewSysClientDao creates and returns a new DAO object for table data access. +func NewSysClientDao(handlers ...gdb.ModelHandler) *SysClientDao { + return &SysClientDao{ + group: "default", + table: "sys_client", + columns: sysClientColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysClientDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysClientDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysClientDao) Columns() SysClientColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysClientDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysClientDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysClientDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_config.go b/server/internal/dao/internal/sys_config.go new file mode 100644 index 0000000..9bd0555 --- /dev/null +++ b/server/internal/dao/internal/sys_config.go @@ -0,0 +1,101 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysConfigDao is the data access object for the table sys_config. +type SysConfigDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysConfigColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysConfigColumns defines and stores column names for the table sys_config. +type SysConfigColumns struct { + ConfigId string // 参数主键 + TenantId string // 租户编号 + ConfigName string // 参数名称 + ConfigKey string // 参数键名 + ConfigValue string // 参数键值 + ConfigType string // 系统内置(Y是 N否) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysConfigColumns holds the columns for the table sys_config. +var sysConfigColumns = SysConfigColumns{ + ConfigId: "config_id", + TenantId: "tenant_id", + ConfigName: "config_name", + ConfigKey: "config_key", + ConfigValue: "config_value", + ConfigType: "config_type", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysConfigDao creates and returns a new DAO object for table data access. +func NewSysConfigDao(handlers ...gdb.ModelHandler) *SysConfigDao { + return &SysConfigDao{ + group: "default", + table: "sys_config", + columns: sysConfigColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysConfigDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysConfigDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysConfigDao) Columns() SysConfigColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysConfigDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_dept.go b/server/internal/dao/internal/sys_dept.go new file mode 100644 index 0000000..724901e --- /dev/null +++ b/server/internal/dao/internal/sys_dept.go @@ -0,0 +1,125 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysDeptDao is the data access object for the table sys_dept. +type SysDeptDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysDeptColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysDeptColumns defines and stores column names for the table sys_dept. +type SysDeptColumns struct { + DeptId string // 部门id + TenantId string // 租户编号 + ParentId string // 父部门id + Ancestors string // 祖级列表 + DeptKey string // 机构编号 + DeptName string // 部门名称 + DeptType string // 部门类型(0:部门 1:公司) + DeptCategory string // 部门类别编码 + OrderNum string // 显示顺序 + Leader string // 负责人 + Phone string // 联系电话 + Email string // 邮箱 + Status string // 部门状态(0正常 1停用) + CreditCode string // 统一社会信用代码 + AreaCode string // 行政区域代码 + Address string // 地址 + DeptRole string // 机构默认角色ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// sysDeptColumns holds the columns for the table sys_dept. +var sysDeptColumns = SysDeptColumns{ + DeptId: "dept_id", + TenantId: "tenant_id", + ParentId: "parent_id", + Ancestors: "ancestors", + DeptKey: "dept_key", + DeptName: "dept_name", + DeptType: "dept_type", + DeptCategory: "dept_category", + OrderNum: "order_num", + Leader: "leader", + Phone: "phone", + Email: "email", + Status: "status", + CreditCode: "credit_code", + AreaCode: "area_code", + Address: "address", + DeptRole: "dept_role", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewSysDeptDao creates and returns a new DAO object for table data access. +func NewSysDeptDao(handlers ...gdb.ModelHandler) *SysDeptDao { + return &SysDeptDao{ + group: "default", + table: "sys_dept", + columns: sysDeptColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysDeptDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysDeptDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysDeptDao) Columns() SysDeptColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysDeptDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysDeptDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_dict_data.go b/server/internal/dao/internal/sys_dict_data.go new file mode 100644 index 0000000..b8c182e --- /dev/null +++ b/server/internal/dao/internal/sys_dict_data.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysDictDataDao is the data access object for the table sys_dict_data. +type SysDictDataDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysDictDataColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysDictDataColumns defines and stores column names for the table sys_dict_data. +type SysDictDataColumns struct { + DictCode string // 字典编码 + TenantId string // 租户编号 + DictSort string // 字典排序 + DictLabel string // 字典标签 + DictValue string // 字典键值 + DictType string // 字典类型 + CssClass string // 样式属性(其他样式扩展) + ListClass string // 表格回显样式 + IsDefault string // 是否默认(Y是 N否) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysDictDataColumns holds the columns for the table sys_dict_data. +var sysDictDataColumns = SysDictDataColumns{ + DictCode: "dict_code", + TenantId: "tenant_id", + DictSort: "dict_sort", + DictLabel: "dict_label", + DictValue: "dict_value", + DictType: "dict_type", + CssClass: "css_class", + ListClass: "list_class", + IsDefault: "is_default", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysDictDataDao creates and returns a new DAO object for table data access. +func NewSysDictDataDao(handlers ...gdb.ModelHandler) *SysDictDataDao { + return &SysDictDataDao{ + group: "default", + table: "sys_dict_data", + columns: sysDictDataColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysDictDataDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysDictDataDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysDictDataDao) Columns() SysDictDataColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysDictDataDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysDictDataDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_dict_type.go b/server/internal/dao/internal/sys_dict_type.go new file mode 100644 index 0000000..0fd068d --- /dev/null +++ b/server/internal/dao/internal/sys_dict_type.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysDictTypeDao is the data access object for the table sys_dict_type. +type SysDictTypeDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysDictTypeColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysDictTypeColumns defines and stores column names for the table sys_dict_type. +type SysDictTypeColumns struct { + DictId string // 字典主键 + TenantId string // 租户编号 + DictName string // 字典名称 + DictType string // 字典类型 + IsSys string // 是否系统(0是 1否) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysDictTypeColumns holds the columns for the table sys_dict_type. +var sysDictTypeColumns = SysDictTypeColumns{ + DictId: "dict_id", + TenantId: "tenant_id", + DictName: "dict_name", + DictType: "dict_type", + IsSys: "is_sys", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysDictTypeDao creates and returns a new DAO object for table data access. +func NewSysDictTypeDao(handlers ...gdb.ModelHandler) *SysDictTypeDao { + return &SysDictTypeDao{ + group: "default", + table: "sys_dict_type", + columns: sysDictTypeColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysDictTypeDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysDictTypeDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysDictTypeDao) Columns() SysDictTypeColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysDictTypeDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysDictTypeDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_gen_table.go b/server/internal/dao/internal/sys_gen_table.go new file mode 100644 index 0000000..cfdcf1b --- /dev/null +++ b/server/internal/dao/internal/sys_gen_table.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysGenTableDao is the data access object for the table sys_gen_table. +type SysGenTableDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysGenTableColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysGenTableColumns defines and stores column names for the table sys_gen_table. +type SysGenTableColumns struct { + TableId string // 生成ID + GenType string // 生成类型 + GenTemplate string // 生成模板 + VarName string // 实体命名 + Options string // 配置选项 + DbName string // 数据库名称 + TableName string // 主表名称 + TableComment string // 主表注释 + DaoName string // 主表dao模型 + MasterColumns string // 主表字段 + AddonName string // 插件名称 + Status string // 生成状态(0成功 1未开始) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// sysGenTableColumns holds the columns for the table sys_gen_table. +var sysGenTableColumns = SysGenTableColumns{ + TableId: "table_id", + GenType: "gen_type", + GenTemplate: "gen_template", + VarName: "var_name", + Options: "options", + DbName: "db_name", + TableName: "table_name", + TableComment: "table_comment", + DaoName: "dao_name", + MasterColumns: "master_columns", + AddonName: "addon_name", + Status: "status", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewSysGenTableDao creates and returns a new DAO object for table data access. +func NewSysGenTableDao(handlers ...gdb.ModelHandler) *SysGenTableDao { + return &SysGenTableDao{ + group: "default", + table: "sys_gen_table", + columns: sysGenTableColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysGenTableDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysGenTableDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysGenTableDao) Columns() SysGenTableColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysGenTableDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysGenTableDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysGenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_job.go b/server/internal/dao/internal/sys_job.go new file mode 100644 index 0000000..d9384f6 --- /dev/null +++ b/server/internal/dao/internal/sys_job.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysJobDao is the data access object for the table sys_job. +type SysJobDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysJobColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysJobColumns defines and stores column names for the table sys_job. +type SysJobColumns struct { + JobId string // 任务ID + JobName string // 任务名称 + JobParams string // 参数 + JobGroup string // 任务组名 + InvokeTarget string // 调用目标字符串 + CronExpression string // cron执行表达式 + MisfirePolicy string // 计划执行策略(1多次执行 2执行一次) + Concurrent string // 是否并发执行(0允许 1禁止) + Status string // 状态(0正常 1暂停) + Remark string // 备注信息 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// sysJobColumns holds the columns for the table sys_job. +var sysJobColumns = SysJobColumns{ + JobId: "job_id", + JobName: "job_name", + JobParams: "job_params", + JobGroup: "job_group", + InvokeTarget: "invoke_target", + CronExpression: "cron_expression", + MisfirePolicy: "misfire_policy", + Concurrent: "concurrent", + Status: "status", + Remark: "remark", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewSysJobDao creates and returns a new DAO object for table data access. +func NewSysJobDao(handlers ...gdb.ModelHandler) *SysJobDao { + return &SysJobDao{ + group: "default", + table: "sys_job", + columns: sysJobColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysJobDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysJobDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysJobDao) Columns() SysJobColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysJobDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysJobDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysJobDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_logininfor.go b/server/internal/dao/internal/sys_logininfor.go new file mode 100644 index 0000000..4db9a83 --- /dev/null +++ b/server/internal/dao/internal/sys_logininfor.go @@ -0,0 +1,101 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysLogininforDao is the data access object for the table sys_logininfor. +type SysLogininforDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysLogininforColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysLogininforColumns defines and stores column names for the table sys_logininfor. +type SysLogininforColumns struct { + InfoId string // 访问ID + TenantId string // 租户编号 + UserName string // 用户账号 + ClientKey string // 客户端 + DeviceType string // 设备类型 + Ipaddr string // 登录IP地址 + LoginLocation string // 登录地点 + Browser string // 浏览器类型 + Os string // 操作系统 + Status string // 登录状态(0成功 1失败) + Msg string // 提示消息 + LoginTime string // 访问时间 +} + +// sysLogininforColumns holds the columns for the table sys_logininfor. +var sysLogininforColumns = SysLogininforColumns{ + InfoId: "info_id", + TenantId: "tenant_id", + UserName: "user_name", + ClientKey: "client_key", + DeviceType: "device_type", + Ipaddr: "ipaddr", + LoginLocation: "login_location", + Browser: "browser", + Os: "os", + Status: "status", + Msg: "msg", + LoginTime: "login_time", +} + +// NewSysLogininforDao creates and returns a new DAO object for table data access. +func NewSysLogininforDao(handlers ...gdb.ModelHandler) *SysLogininforDao { + return &SysLogininforDao{ + group: "default", + table: "sys_logininfor", + columns: sysLogininforColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysLogininforDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysLogininforDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysLogininforDao) Columns() SysLogininforColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysLogininforDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysLogininforDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysLogininforDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_menu.go b/server/internal/dao/internal/sys_menu.go new file mode 100644 index 0000000..3a22bef --- /dev/null +++ b/server/internal/dao/internal/sys_menu.go @@ -0,0 +1,121 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysMenuDao is the data access object for the table sys_menu. +type SysMenuDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysMenuColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysMenuColumns defines and stores column names for the table sys_menu. +type SysMenuColumns struct { + MenuId string // 菜单ID + MenuName string // 菜单名称 + ParentId string // 父菜单ID + Level string // 关系树等级 + Tree string // 关系树 + OrderNum string // 显示顺序 + Path string // 路由地址 + Component string // 组件路径 + QueryParam string // 路由参数 + IsFrame string // 是否为外链(0是 1否) + IsCache string // 是否缓存(0缓存 1不缓存) + MenuType string // 菜单类型(M目录 C菜单 F按钮) + Visible string // 显示状态(0显示 1隐藏) + Status string // 菜单状态(0正常 1停用) + Perms string // 权限标识 + Icon string // 菜单图标 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysMenuColumns holds the columns for the table sys_menu. +var sysMenuColumns = SysMenuColumns{ + MenuId: "menu_id", + MenuName: "menu_name", + ParentId: "parent_id", + Level: "level", + Tree: "tree", + OrderNum: "order_num", + Path: "path", + Component: "component", + QueryParam: "query_param", + IsFrame: "is_frame", + IsCache: "is_cache", + MenuType: "menu_type", + Visible: "visible", + Status: "status", + Perms: "perms", + Icon: "icon", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysMenuDao creates and returns a new DAO object for table data access. +func NewSysMenuDao(handlers ...gdb.ModelHandler) *SysMenuDao { + return &SysMenuDao{ + group: "default", + table: "sys_menu", + columns: sysMenuColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysMenuDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysMenuDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysMenuDao) Columns() SysMenuColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysMenuDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysMenuDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_notice.go b/server/internal/dao/internal/sys_notice.go new file mode 100644 index 0000000..72ad751 --- /dev/null +++ b/server/internal/dao/internal/sys_notice.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysNoticeDao is the data access object for the table sys_notice. +type SysNoticeDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysNoticeColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysNoticeColumns defines and stores column names for the table sys_notice. +type SysNoticeColumns struct { + NoticeId string // 公告ID + TenantId string // 租户编号 + NoticeTitle string // 公告标题 + NoticeType string // 公告类型(1通知 2公告) + NoticeContent string // 公告内容 + Status string // 公告状态(0正常 1关闭) + NoticeRange string // 通知范围(1全员 2指定机构 3指定用户) + DeptIds string // 通知机构ID列表JSON + UserIds string // 通知用户ID列表JSON + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysNoticeColumns holds the columns for the table sys_notice. +var sysNoticeColumns = SysNoticeColumns{ + NoticeId: "notice_id", + TenantId: "tenant_id", + NoticeTitle: "notice_title", + NoticeType: "notice_type", + NoticeContent: "notice_content", + Status: "status", + NoticeRange: "notice_range", + DeptIds: "dept_ids", + UserIds: "user_ids", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysNoticeDao creates and returns a new DAO object for table data access. +func NewSysNoticeDao(handlers ...gdb.ModelHandler) *SysNoticeDao { + return &SysNoticeDao{ + group: "default", + table: "sys_notice", + columns: sysNoticeColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysNoticeDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysNoticeDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysNoticeDao) Columns() SysNoticeColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysNoticeDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysNoticeDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_notice_user.go b/server/internal/dao/internal/sys_notice_user.go new file mode 100644 index 0000000..00836b9 --- /dev/null +++ b/server/internal/dao/internal/sys_notice_user.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysNoticeUserDao is the data access object for the table sys_notice_user. +type SysNoticeUserDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysNoticeUserColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysNoticeUserColumns defines and stores column names for the table sys_notice_user. +type SysNoticeUserColumns struct { + Id string // ID + NoticeId string // 公告ID + TenantId string // 租户编号 + NoticeTitle string // 公告标题 + NoticeType string // 公告类型(1通知 2公告) + NoticeContent string // 公告内容 + Status string // 公告状态(0正常 1关闭) + UserId string // 用户ID + IsRead string // 是否已读(0未读 1已读) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysNoticeUserColumns holds the columns for the table sys_notice_user. +var sysNoticeUserColumns = SysNoticeUserColumns{ + Id: "id", + NoticeId: "notice_id", + TenantId: "tenant_id", + NoticeTitle: "notice_title", + NoticeType: "notice_type", + NoticeContent: "notice_content", + Status: "status", + UserId: "user_id", + IsRead: "is_read", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysNoticeUserDao creates and returns a new DAO object for table data access. +func NewSysNoticeUserDao(handlers ...gdb.ModelHandler) *SysNoticeUserDao { + return &SysNoticeUserDao{ + group: "default", + table: "sys_notice_user", + columns: sysNoticeUserColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysNoticeUserDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysNoticeUserDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysNoticeUserDao) Columns() SysNoticeUserColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysNoticeUserDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysNoticeUserDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysNoticeUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_oper_log.go b/server/internal/dao/internal/sys_oper_log.go new file mode 100644 index 0000000..0d82659 --- /dev/null +++ b/server/internal/dao/internal/sys_oper_log.go @@ -0,0 +1,113 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysOperLogDao is the data access object for the table sys_oper_log. +type SysOperLogDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysOperLogColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysOperLogColumns defines and stores column names for the table sys_oper_log. +type SysOperLogColumns struct { + OperId string // 日志主键 + TenantId string // 租户编号 + Title string // 模块标题 + BusinessType string // 业务类型(0其它 1新增 2修改 3删除) + Method string // 方法名称 + RequestMethod string // 请求方式 + OperatorType string // 操作类别(0其它 1后台用户 2手机端用户) + OperName string // 操作人员 + DeptName string // 部门名称 + OperUrl string // 请求URL + OperIp string // 主机地址 + OperLocation string // 操作地点 + OperParam string // 请求参数 + JsonResult string // 返回参数 + Status string // 操作状态(0正常 1异常) + ErrorMsg string // 错误消息 + OperTime string // 操作时间 + CostTime string // 消耗时间 +} + +// sysOperLogColumns holds the columns for the table sys_oper_log. +var sysOperLogColumns = SysOperLogColumns{ + OperId: "oper_id", + TenantId: "tenant_id", + Title: "title", + BusinessType: "business_type", + Method: "method", + RequestMethod: "request_method", + OperatorType: "operator_type", + OperName: "oper_name", + DeptName: "dept_name", + OperUrl: "oper_url", + OperIp: "oper_ip", + OperLocation: "oper_location", + OperParam: "oper_param", + JsonResult: "json_result", + Status: "status", + ErrorMsg: "error_msg", + OperTime: "oper_time", + CostTime: "cost_time", +} + +// NewSysOperLogDao creates and returns a new DAO object for table data access. +func NewSysOperLogDao(handlers ...gdb.ModelHandler) *SysOperLogDao { + return &SysOperLogDao{ + group: "default", + table: "sys_oper_log", + columns: sysOperLogColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysOperLogDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysOperLogDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysOperLogDao) Columns() SysOperLogColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysOperLogDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysOperLogDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysOperLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_oss.go b/server/internal/dao/internal/sys_oss.go new file mode 100644 index 0000000..c0ce038 --- /dev/null +++ b/server/internal/dao/internal/sys_oss.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysOssDao is the data access object for the table sys_oss. +type SysOssDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysOssColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysOssColumns defines and stores column names for the table sys_oss. +type SysOssColumns struct { + OssId string // 对象存储主键 + TenantId string // 租户编号 + FileName string // 文件名 + OriginalName string // 原名 + FileSuffix string // 文件后缀名 + Path string // 存储路径 + Url string // URL地址 + CreatedDept string // 创建部门 + CreatedAt string // 创建时间 + CreatedBy string // 创建者 + UpdatedAt string // 更新时间 + UpdatedBy string // 更新者 + Service string // 服务商 + Md5 string // 文件MD5 + FileSize string // 文件大小 + FileCrc16 string // 文件Crc16 + FileSum string // 文件校验和 +} + +// sysOssColumns holds the columns for the table sys_oss. +var sysOssColumns = SysOssColumns{ + OssId: "oss_id", + TenantId: "tenant_id", + FileName: "file_name", + OriginalName: "original_name", + FileSuffix: "file_suffix", + Path: "path", + Url: "url", + CreatedDept: "created_dept", + CreatedAt: "created_at", + CreatedBy: "created_by", + UpdatedAt: "updated_at", + UpdatedBy: "updated_by", + Service: "service", + Md5: "md5", + FileSize: "file_size", + FileCrc16: "file_crc16", + FileSum: "file_sum", +} + +// NewSysOssDao creates and returns a new DAO object for table data access. +func NewSysOssDao(handlers ...gdb.ModelHandler) *SysOssDao { + return &SysOssDao{ + group: "default", + table: "sys_oss", + columns: sysOssColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysOssDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysOssDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysOssDao) Columns() SysOssColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysOssDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysOssDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysOssDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_oss_config.go b/server/internal/dao/internal/sys_oss_config.go new file mode 100644 index 0000000..f373526 --- /dev/null +++ b/server/internal/dao/internal/sys_oss_config.go @@ -0,0 +1,117 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysOssConfigDao is the data access object for the table sys_oss_config. +type SysOssConfigDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysOssConfigColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysOssConfigColumns defines and stores column names for the table sys_oss_config. +type SysOssConfigColumns struct { + OssConfigId string // 主键 + TenantId string // 租户编号 + ConfigKey string // 配置key + AccessKey string // accessKey + SecretKey string // 秘钥 + BucketName string // 桶名称 + Prefix string // 前缀 + Endpoint string // 访问站点 + Domain string // 自定义域名 + IsHttps string // 是否https(Y=是,N=否) + Region string // 域 + AccessPolicy string // 桶权限类型(0=private 1=public 2=custom) + Status string // 是否默认(0=是,1=否) + Ext1 string // 扩展字段 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + Remark string // 备注 +} + +// sysOssConfigColumns holds the columns for the table sys_oss_config. +var sysOssConfigColumns = SysOssConfigColumns{ + OssConfigId: "oss_config_id", + TenantId: "tenant_id", + ConfigKey: "config_key", + AccessKey: "access_key", + SecretKey: "secret_key", + BucketName: "bucket_name", + Prefix: "prefix", + Endpoint: "endpoint", + Domain: "domain", + IsHttps: "is_https", + Region: "region", + AccessPolicy: "access_policy", + Status: "status", + Ext1: "ext1", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + Remark: "remark", +} + +// NewSysOssConfigDao creates and returns a new DAO object for table data access. +func NewSysOssConfigDao(handlers ...gdb.ModelHandler) *SysOssConfigDao { + return &SysOssConfigDao{ + group: "default", + table: "sys_oss_config", + columns: sysOssConfigColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysOssConfigDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysOssConfigDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysOssConfigDao) Columns() SysOssConfigColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysOssConfigDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysOssConfigDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysOssConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_post.go b/server/internal/dao/internal/sys_post.go new file mode 100644 index 0000000..ee6f95e --- /dev/null +++ b/server/internal/dao/internal/sys_post.go @@ -0,0 +1,109 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysPostDao is the data access object for the table sys_post. +type SysPostDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysPostColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysPostColumns defines and stores column names for the table sys_post. +type SysPostColumns struct { + PostId string // 岗位ID + TenantId string // 租户编号 + DeptId string // 部门id + PostCode string // 岗位编码 + PostCategory string // 岗位类别编码 + PostName string // 岗位名称 + PostSort string // 显示顺序 + Status string // 状态(0正常 1停用) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 + Remark string // 备注 +} + +// sysPostColumns holds the columns for the table sys_post. +var sysPostColumns = SysPostColumns{ + PostId: "post_id", + TenantId: "tenant_id", + DeptId: "dept_id", + PostCode: "post_code", + PostCategory: "post_category", + PostName: "post_name", + PostSort: "post_sort", + Status: "status", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", + Remark: "remark", +} + +// NewSysPostDao creates and returns a new DAO object for table data access. +func NewSysPostDao(handlers ...gdb.ModelHandler) *SysPostDao { + return &SysPostDao{ + group: "default", + table: "sys_post", + columns: sysPostColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysPostDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysPostDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysPostDao) Columns() SysPostColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysPostDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysPostDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_role.go b/server/internal/dao/internal/sys_role.go new file mode 100644 index 0000000..e9dc2e8 --- /dev/null +++ b/server/internal/dao/internal/sys_role.go @@ -0,0 +1,119 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysRoleDao is the data access object for the table sys_role. +type SysRoleDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysRoleColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysRoleColumns defines and stores column names for the table sys_role. +type SysRoleColumns struct { + RoleId string // 角色ID + TenantId string // 租户编号 + DeptId string // 部门机构id + RoleName string // 角色名称 + RoleKey string // 角色权限字符串 + RoleSort string // 显示顺序 + DataScope string // 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:仅本人数据权限 7:本组织及下一级数据权限 + MenuCheckStrictly string // 菜单树选择项是否关联显示 + DeptCheckStrictly string // 部门树选择项是否关联显示 + Status string // 角色状态(0正常 1停用) + IsPass string // 是否传递数据权限(0:传递 1:不传递) + SourceRoleId string // 来源角色ID + SourceDeptId string // 来源组织ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 + Remark string // 备注 +} + +// sysRoleColumns holds the columns for the table sys_role. +var sysRoleColumns = SysRoleColumns{ + RoleId: "role_id", + TenantId: "tenant_id", + DeptId: "dept_id", + RoleName: "role_name", + RoleKey: "role_key", + RoleSort: "role_sort", + DataScope: "data_scope", + MenuCheckStrictly: "menu_check_strictly", + DeptCheckStrictly: "dept_check_strictly", + Status: "status", + IsPass: "is_pass", + SourceRoleId: "source_role_id", + SourceDeptId: "source_dept_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", + Remark: "remark", +} + +// NewSysRoleDao creates and returns a new DAO object for table data access. +func NewSysRoleDao(handlers ...gdb.ModelHandler) *SysRoleDao { + return &SysRoleDao{ + group: "default", + table: "sys_role", + columns: sysRoleColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysRoleDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysRoleDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysRoleDao) Columns() SysRoleColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysRoleDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysRoleDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_role_dept.go b/server/internal/dao/internal/sys_role_dept.go new file mode 100644 index 0000000..8498277 --- /dev/null +++ b/server/internal/dao/internal/sys_role_dept.go @@ -0,0 +1,83 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysRoleDeptDao is the data access object for the table sys_role_dept. +type SysRoleDeptDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysRoleDeptColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysRoleDeptColumns defines and stores column names for the table sys_role_dept. +type SysRoleDeptColumns struct { + TenantId string // 租户编号 + RoleId string // 角色ID + DeptId string // 部门ID +} + +// sysRoleDeptColumns holds the columns for the table sys_role_dept. +var sysRoleDeptColumns = SysRoleDeptColumns{ + TenantId: "tenant_id", + RoleId: "role_id", + DeptId: "dept_id", +} + +// NewSysRoleDeptDao creates and returns a new DAO object for table data access. +func NewSysRoleDeptDao(handlers ...gdb.ModelHandler) *SysRoleDeptDao { + return &SysRoleDeptDao{ + group: "default", + table: "sys_role_dept", + columns: sysRoleDeptColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysRoleDeptDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysRoleDeptDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysRoleDeptDao) Columns() SysRoleDeptColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysRoleDeptDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysRoleDeptDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysRoleDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_role_menu.go b/server/internal/dao/internal/sys_role_menu.go new file mode 100644 index 0000000..1c99abd --- /dev/null +++ b/server/internal/dao/internal/sys_role_menu.go @@ -0,0 +1,85 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysRoleMenuDao is the data access object for the table sys_role_menu. +type SysRoleMenuDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysRoleMenuColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysRoleMenuColumns defines and stores column names for the table sys_role_menu. +type SysRoleMenuColumns struct { + TenantId string // 租户编号 + RoleId string // 角色ID + MenuId string // 菜单ID + DataScope string // 数据范围(0按角色数据权限 1全部数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限) +} + +// sysRoleMenuColumns holds the columns for the table sys_role_menu. +var sysRoleMenuColumns = SysRoleMenuColumns{ + TenantId: "tenant_id", + RoleId: "role_id", + MenuId: "menu_id", + DataScope: "data_scope", +} + +// NewSysRoleMenuDao creates and returns a new DAO object for table data access. +func NewSysRoleMenuDao(handlers ...gdb.ModelHandler) *SysRoleMenuDao { + return &SysRoleMenuDao{ + group: "default", + table: "sys_role_menu", + columns: sysRoleMenuColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysRoleMenuDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysRoleMenuDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysRoleMenuDao) Columns() SysRoleMenuColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysRoleMenuDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysRoleMenuDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_social.go b/server/internal/dao/internal/sys_social.go new file mode 100644 index 0000000..79dc0b3 --- /dev/null +++ b/server/internal/dao/internal/sys_social.go @@ -0,0 +1,137 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysSocialDao is the data access object for the table sys_social. +type SysSocialDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysSocialColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysSocialColumns defines and stores column names for the table sys_social. +type SysSocialColumns struct { + Id string // 主键 + UserId string // 用户ID + TenantId string // 租户id + AuthId string // 平台+平台唯一id + Source string // 用户来源 + OpenId string // 平台编号唯一id + UserName string // 登录账号 + NickName string // 用户昵称 + Email string // 用户邮箱 + Avatar string // 头像地址 + AccessToken string // 用户的授权令牌 + ExpireIn string // 用户的授权令牌的有效期,部分平台可能没有 + RefreshToken string // 刷新令牌,部分平台可能没有 + AccessCode string // 平台的授权信息,部分平台可能没有 + UnionId string // 用户的 unionid + Scope string // 授予的权限,部分平台可能没有 + TokenType string // 个别平台的授权信息,部分平台可能没有 + IdToken string // id token,部分平台可能没有 + MacAlgorithm string // 小米平台用户的附带属性,部分平台可能没有 + MacKey string // 小米平台用户的附带属性,部分平台可能没有 + Code string // 用户的授权code,部分平台可能没有 + OauthToken string // Twitter平台用户的附带属性,部分平台可能没有 + OauthTokenSecret string // Twitter平台用户的附带属性,部分平台可能没有 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// sysSocialColumns holds the columns for the table sys_social. +var sysSocialColumns = SysSocialColumns{ + Id: "id", + UserId: "user_id", + TenantId: "tenant_id", + AuthId: "auth_id", + Source: "source", + OpenId: "open_id", + UserName: "user_name", + NickName: "nick_name", + Email: "email", + Avatar: "avatar", + AccessToken: "access_token", + ExpireIn: "expire_in", + RefreshToken: "refresh_token", + AccessCode: "access_code", + UnionId: "union_id", + Scope: "scope", + TokenType: "token_type", + IdToken: "id_token", + MacAlgorithm: "mac_algorithm", + MacKey: "mac_key", + Code: "code", + OauthToken: "oauth_token", + OauthTokenSecret: "oauth_token_secret", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewSysSocialDao creates and returns a new DAO object for table data access. +func NewSysSocialDao(handlers ...gdb.ModelHandler) *SysSocialDao { + return &SysSocialDao{ + group: "default", + table: "sys_social", + columns: sysSocialColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysSocialDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysSocialDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysSocialDao) Columns() SysSocialColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysSocialDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysSocialDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysSocialDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_tenant.go b/server/internal/dao/internal/sys_tenant.go new file mode 100644 index 0000000..f897116 --- /dev/null +++ b/server/internal/dao/internal/sys_tenant.go @@ -0,0 +1,125 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysTenantDao is the data access object for the table sys_tenant. +type SysTenantDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysTenantColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysTenantColumns defines and stores column names for the table sys_tenant. +type SysTenantColumns struct { + Id string // id + TenantId string // 租户编号 + ContactUserName string // 联系人 + ContactPhone string // 联系电话 + CompanyName string // 企业名称 + LicenseNumber string // 统一社会信用代码 + Address string // 地址 + Intro string // 企业简介 + Domain string // 域名 + Remark string // 备注 + PackageId string // 租户套餐编号 + AdminRoleId string // 管理员角色ID + AdminDeptId string // 管理员部门ID + AdminUserId string // 管理员用户ID + ExpireTime string // 过期时间 + AccountCount string // 用户数量(-1不限制) + Status string // 租户状态(0正常 1停用) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// sysTenantColumns holds the columns for the table sys_tenant. +var sysTenantColumns = SysTenantColumns{ + Id: "id", + TenantId: "tenant_id", + ContactUserName: "contact_user_name", + ContactPhone: "contact_phone", + CompanyName: "company_name", + LicenseNumber: "license_number", + Address: "address", + Intro: "intro", + Domain: "domain", + Remark: "remark", + PackageId: "package_id", + AdminRoleId: "admin_role_id", + AdminDeptId: "admin_dept_id", + AdminUserId: "admin_user_id", + ExpireTime: "expire_time", + AccountCount: "account_count", + Status: "status", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewSysTenantDao creates and returns a new DAO object for table data access. +func NewSysTenantDao(handlers ...gdb.ModelHandler) *SysTenantDao { + return &SysTenantDao{ + group: "default", + table: "sys_tenant", + columns: sysTenantColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysTenantDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysTenantDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysTenantDao) Columns() SysTenantColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysTenantDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysTenantDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysTenantDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_tenant_package.go b/server/internal/dao/internal/sys_tenant_package.go new file mode 100644 index 0000000..f2a3720 --- /dev/null +++ b/server/internal/dao/internal/sys_tenant_package.go @@ -0,0 +1,103 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysTenantPackageDao is the data access object for the table sys_tenant_package. +type SysTenantPackageDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysTenantPackageColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysTenantPackageColumns defines and stores column names for the table sys_tenant_package. +type SysTenantPackageColumns struct { + PackageId string // 租户套餐id + PackageName string // 套餐名称 + MenuIds string // 关联菜单id + Remark string // 备注 + MenuCheckStrictly string // 菜单树选择项是否关联显示 + Status string // 状态(0正常 1停用) + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// sysTenantPackageColumns holds the columns for the table sys_tenant_package. +var sysTenantPackageColumns = SysTenantPackageColumns{ + PackageId: "package_id", + PackageName: "package_name", + MenuIds: "menu_ids", + Remark: "remark", + MenuCheckStrictly: "menu_check_strictly", + Status: "status", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewSysTenantPackageDao creates and returns a new DAO object for table data access. +func NewSysTenantPackageDao(handlers ...gdb.ModelHandler) *SysTenantPackageDao { + return &SysTenantPackageDao{ + group: "default", + table: "sys_tenant_package", + columns: sysTenantPackageColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysTenantPackageDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysTenantPackageDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysTenantPackageDao) Columns() SysTenantPackageColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysTenantPackageDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysTenantPackageDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysTenantPackageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_user.go b/server/internal/dao/internal/sys_user.go new file mode 100644 index 0000000..f14fa96 --- /dev/null +++ b/server/internal/dao/internal/sys_user.go @@ -0,0 +1,127 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysUserDao is the data access object for the table sys_user. +type SysUserDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysUserColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysUserColumns defines and stores column names for the table sys_user. +type SysUserColumns struct { + UserId string // 用户ID + TenantId string // 租户编号 + DeptId string // 部门ID + UserName string // 用户账号 + NickName string // 用户昵称 + UserType string // 用户类型(sys_user系统用户) + Email string // 用户邮箱 + Phonenumber string // 手机号码 + Sex string // 用户性别(0男 1女 2未知) + Avatar string // 头像地址 + Salt string // 加密盐 + Password string // 密码 + IsInitPassword string // 当前密码是否未由用户本人设置(1=初始或管理员临时密码 0=用户已自设) + Status string // 帐号状态(0正常 1停用) + LoginIp string // 最后登录IP + LoginDate string // 最后登录时间 + MfaEnabled string // 是否开启邮箱MFA 0否 1是 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 + Remark string // 备注 +} + +// sysUserColumns holds the columns for the table sys_user. +var sysUserColumns = SysUserColumns{ + UserId: "user_id", + TenantId: "tenant_id", + DeptId: "dept_id", + UserName: "user_name", + NickName: "nick_name", + UserType: "user_type", + Email: "email", + Phonenumber: "phonenumber", + Sex: "sex", + Avatar: "avatar", + Salt: "salt", + Password: "password", + IsInitPassword: "is_init_password", + Status: "status", + LoginIp: "login_ip", + LoginDate: "login_date", + MfaEnabled: "mfa_enabled", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", + Remark: "remark", +} + +// NewSysUserDao creates and returns a new DAO object for table data access. +func NewSysUserDao(handlers ...gdb.ModelHandler) *SysUserDao { + return &SysUserDao{ + group: "default", + table: "sys_user", + columns: sysUserColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysUserDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysUserDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysUserDao) Columns() SysUserColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysUserDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysUserDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_user_online.go b/server/internal/dao/internal/sys_user_online.go new file mode 100644 index 0000000..034b2cf --- /dev/null +++ b/server/internal/dao/internal/sys_user_online.go @@ -0,0 +1,105 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysUserOnlineDao is the data access object for the table sys_user_online. +type SysUserOnlineDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysUserOnlineColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysUserOnlineColumns defines and stores column names for the table sys_user_online. +type SysUserOnlineColumns struct { + OnlineId string // 访问ID + TenantId string // 租户编号 + Uuid string // UUID + UserName string // 用户账号 + ClientKey string // 客户端 + DeviceType string // 设备类型 + Ipaddr string // 登录IP地址 + LoginLocation string // 登录地点 + Browser string // 浏览器类型 + Os string // 操作系统 + Token string // Token + LoginTime string // 访问时间 + ExpireTime string // 过期时间 + DeletedAt string // 删除时间 +} + +// sysUserOnlineColumns holds the columns for the table sys_user_online. +var sysUserOnlineColumns = SysUserOnlineColumns{ + OnlineId: "online_id", + TenantId: "tenant_id", + Uuid: "uuid", + UserName: "user_name", + ClientKey: "client_key", + DeviceType: "device_type", + Ipaddr: "ipaddr", + LoginLocation: "login_location", + Browser: "browser", + Os: "os", + Token: "token", + LoginTime: "login_time", + ExpireTime: "expire_time", + DeletedAt: "deleted_at", +} + +// NewSysUserOnlineDao creates and returns a new DAO object for table data access. +func NewSysUserOnlineDao(handlers ...gdb.ModelHandler) *SysUserOnlineDao { + return &SysUserOnlineDao{ + group: "default", + table: "sys_user_online", + columns: sysUserOnlineColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysUserOnlineDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysUserOnlineDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysUserOnlineDao) Columns() SysUserOnlineColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysUserOnlineDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysUserOnlineDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysUserOnlineDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_user_post.go b/server/internal/dao/internal/sys_user_post.go new file mode 100644 index 0000000..3a182ca --- /dev/null +++ b/server/internal/dao/internal/sys_user_post.go @@ -0,0 +1,83 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysUserPostDao is the data access object for the table sys_user_post. +type SysUserPostDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysUserPostColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysUserPostColumns defines and stores column names for the table sys_user_post. +type SysUserPostColumns struct { + TenantId string // 租户编号 + UserId string // 用户ID + PostId string // 岗位ID +} + +// sysUserPostColumns holds the columns for the table sys_user_post. +var sysUserPostColumns = SysUserPostColumns{ + TenantId: "tenant_id", + UserId: "user_id", + PostId: "post_id", +} + +// NewSysUserPostDao creates and returns a new DAO object for table data access. +func NewSysUserPostDao(handlers ...gdb.ModelHandler) *SysUserPostDao { + return &SysUserPostDao{ + group: "default", + table: "sys_user_post", + columns: sysUserPostColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysUserPostDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysUserPostDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysUserPostDao) Columns() SysUserPostColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysUserPostDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysUserPostDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysUserPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/sys_user_role.go b/server/internal/dao/internal/sys_user_role.go new file mode 100644 index 0000000..9646157 --- /dev/null +++ b/server/internal/dao/internal/sys_user_role.go @@ -0,0 +1,83 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SysUserRoleDao is the data access object for the table sys_user_role. +type SysUserRoleDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns SysUserRoleColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// SysUserRoleColumns defines and stores column names for the table sys_user_role. +type SysUserRoleColumns struct { + TenantId string // 租户编号 + UserId string // 用户ID + RoleId string // 角色ID +} + +// sysUserRoleColumns holds the columns for the table sys_user_role. +var sysUserRoleColumns = SysUserRoleColumns{ + TenantId: "tenant_id", + UserId: "user_id", + RoleId: "role_id", +} + +// NewSysUserRoleDao creates and returns a new DAO object for table data access. +func NewSysUserRoleDao(handlers ...gdb.ModelHandler) *SysUserRoleDao { + return &SysUserRoleDao{ + group: "default", + table: "sys_user_role", + columns: sysUserRoleColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SysUserRoleDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SysUserRoleDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SysUserRoleDao) Columns() SysUserRoleColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SysUserRoleDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SysUserRoleDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SysUserRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_agent_balance.go b/server/internal/dao/internal/t_agent_balance.go new file mode 100644 index 0000000..da9e49d --- /dev/null +++ b/server/internal/dao/internal/t_agent_balance.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TAgentBalanceDao is the data access object for the table t_agent_balance. +type TAgentBalanceDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TAgentBalanceColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TAgentBalanceColumns defines and stores column names for the table t_agent_balance. +type TAgentBalanceColumns struct { + Id string // 账户ID + DeptId string // 机构ID + Balance string // 账户余额 + WithdrawAmount string // 可提现金额 + WithdrawAmountStatus string // 可提现金额状态: 1-正常, 0-冻结 + InvoiceAmount string // 已开票金额 + CanInvoiceAmount string // 可开票金额 + CreditLimit string // 信用额度 + UsedCredit string // 已使用信用额度 + PendingRepayment string // 待还款金额 + Status string // 状态: 0-正常, 1-禁用 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tAgentBalanceColumns holds the columns for the table t_agent_balance. +var tAgentBalanceColumns = TAgentBalanceColumns{ + Id: "id", + DeptId: "dept_id", + Balance: "balance", + WithdrawAmount: "withdraw_amount", + WithdrawAmountStatus: "withdraw_amount_status", + InvoiceAmount: "invoice_amount", + CanInvoiceAmount: "can_invoice_amount", + CreditLimit: "credit_limit", + UsedCredit: "used_credit", + PendingRepayment: "pending_repayment", + Status: "status", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTAgentBalanceDao creates and returns a new DAO object for table data access. +func NewTAgentBalanceDao(handlers ...gdb.ModelHandler) *TAgentBalanceDao { + return &TAgentBalanceDao{ + group: "default", + table: "t_agent_balance", + columns: tAgentBalanceColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TAgentBalanceDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TAgentBalanceDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TAgentBalanceDao) Columns() TAgentBalanceColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TAgentBalanceDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TAgentBalanceDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TAgentBalanceDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_agent_enterprise.go b/server/internal/dao/internal/t_agent_enterprise.go new file mode 100644 index 0000000..026daa9 --- /dev/null +++ b/server/internal/dao/internal/t_agent_enterprise.go @@ -0,0 +1,109 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TAgentEnterpriseDao is the data access object for the table t_agent_enterprise. +type TAgentEnterpriseDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TAgentEnterpriseColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TAgentEnterpriseColumns defines and stores column names for the table t_agent_enterprise. +type TAgentEnterpriseColumns struct { + Id string // 主键ID + DeptId string // 部门机构id + FullName string // 单位全称 + Industry string // 行业 + LegalPersonName string // 法人名称 + LegalPersonIdCard string // 法人身份证号 + CompanyType string // 单位类型 + EstablishTime string // 单位成立时间 + BankName string // 开户行名称 + BankAccount string // 开户行账号 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tAgentEnterpriseColumns holds the columns for the table t_agent_enterprise. +var tAgentEnterpriseColumns = TAgentEnterpriseColumns{ + Id: "id", + DeptId: "dept_id", + FullName: "full_name", + Industry: "industry", + LegalPersonName: "legal_person_name", + LegalPersonIdCard: "legal_person_id_card", + CompanyType: "company_type", + EstablishTime: "establish_time", + BankName: "bank_name", + BankAccount: "bank_account", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTAgentEnterpriseDao creates and returns a new DAO object for table data access. +func NewTAgentEnterpriseDao(handlers ...gdb.ModelHandler) *TAgentEnterpriseDao { + return &TAgentEnterpriseDao{ + group: "default", + table: "t_agent_enterprise", + columns: tAgentEnterpriseColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TAgentEnterpriseDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TAgentEnterpriseDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TAgentEnterpriseDao) Columns() TAgentEnterpriseColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TAgentEnterpriseDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TAgentEnterpriseDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TAgentEnterpriseDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_api.go b/server/internal/dao/internal/t_api.go new file mode 100644 index 0000000..ffd5c48 --- /dev/null +++ b/server/internal/dao/internal/t_api.go @@ -0,0 +1,105 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TApiDao is the data access object for the table t_api. +type TApiDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TApiColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TApiColumns defines and stores column names for the table t_api. +type TApiColumns struct { + Id string // ID + AppKey string // APPKey + AppSecret string // APPSecret + GroupId string // 权限组ID + Status string // 状态:0启用,1停用 + RateLimitPeriod string // 限流周期(秒,0:不限流) + RateLimitCount string // 限流次数 + DeptId string // 所属机构 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tApiColumns holds the columns for the table t_api. +var tApiColumns = TApiColumns{ + Id: "id", + AppKey: "app_key", + AppSecret: "app_secret", + GroupId: "group_id", + Status: "status", + RateLimitPeriod: "rate_limit_period", + RateLimitCount: "rate_limit_count", + DeptId: "dept_id", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTApiDao creates and returns a new DAO object for table data access. +func NewTApiDao(handlers ...gdb.ModelHandler) *TApiDao { + return &TApiDao{ + group: "default", + table: "t_api", + columns: tApiColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TApiDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TApiDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TApiDao) Columns() TApiColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TApiDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TApiDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TApiDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_api_group.go b/server/internal/dao/internal/t_api_group.go new file mode 100644 index 0000000..d2fb7ad --- /dev/null +++ b/server/internal/dao/internal/t_api_group.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TApiGroupDao is the data access object for the table t_api_group. +type TApiGroupDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TApiGroupColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TApiGroupColumns defines and stores column names for the table t_api_group. +type TApiGroupColumns struct { + Id string // 主键ID + GroupName string // 权限组名称 + GroupCode string // 权限组编码 + Status string // 状态:0启用,1停用 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tApiGroupColumns holds the columns for the table t_api_group. +var tApiGroupColumns = TApiGroupColumns{ + Id: "id", + GroupName: "group_name", + GroupCode: "group_code", + Status: "status", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTApiGroupDao creates and returns a new DAO object for table data access. +func NewTApiGroupDao(handlers ...gdb.ModelHandler) *TApiGroupDao { + return &TApiGroupDao{ + group: "default", + table: "t_api_group", + columns: tApiGroupColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TApiGroupDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TApiGroupDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TApiGroupDao) Columns() TApiGroupColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TApiGroupDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TApiGroupDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TApiGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_api_group_resource.go b/server/internal/dao/internal/t_api_group_resource.go new file mode 100644 index 0000000..7548f3d --- /dev/null +++ b/server/internal/dao/internal/t_api_group_resource.go @@ -0,0 +1,81 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TApiGroupResourceDao is the data access object for the table t_api_group_resource. +type TApiGroupResourceDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TApiGroupResourceColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TApiGroupResourceColumns defines and stores column names for the table t_api_group_resource. +type TApiGroupResourceColumns struct { + GroupId string // 权限组ID,对应t_api_group.id + ApiId string // 开放接口资源ID,对应t_api_resource.id +} + +// tApiGroupResourceColumns holds the columns for the table t_api_group_resource. +var tApiGroupResourceColumns = TApiGroupResourceColumns{ + GroupId: "group_id", + ApiId: "api_id", +} + +// NewTApiGroupResourceDao creates and returns a new DAO object for table data access. +func NewTApiGroupResourceDao(handlers ...gdb.ModelHandler) *TApiGroupResourceDao { + return &TApiGroupResourceDao{ + group: "default", + table: "t_api_group_resource", + columns: tApiGroupResourceColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TApiGroupResourceDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TApiGroupResourceDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TApiGroupResourceDao) Columns() TApiGroupResourceColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TApiGroupResourceDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TApiGroupResourceDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TApiGroupResourceDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_api_resource.go b/server/internal/dao/internal/t_api_resource.go new file mode 100644 index 0000000..473deb3 --- /dev/null +++ b/server/internal/dao/internal/t_api_resource.go @@ -0,0 +1,105 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TApiResourceDao is the data access object for the table t_api_resource. +type TApiResourceDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TApiResourceColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TApiResourceColumns defines and stores column names for the table t_api_resource. +type TApiResourceColumns struct { + Id string // 主键ID + ApiName string // 接口名称 + ApiCode string // 接口权限标识 + Method string // 请求方法:GET/POST/PUT/DELETE + Path string // 接口路径 + Status string // 状态:0启用,1停用 + Version string // 接口版本 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tApiResourceColumns holds the columns for the table t_api_resource. +var tApiResourceColumns = TApiResourceColumns{ + Id: "id", + ApiName: "api_name", + ApiCode: "api_code", + Method: "method", + Path: "path", + Status: "status", + Version: "version", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTApiResourceDao creates and returns a new DAO object for table data access. +func NewTApiResourceDao(handlers ...gdb.ModelHandler) *TApiResourceDao { + return &TApiResourceDao{ + group: "default", + table: "t_api_resource", + columns: tApiResourceColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TApiResourceDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TApiResourceDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TApiResourceDao) Columns() TApiResourceColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TApiResourceDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TApiResourceDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TApiResourceDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_balance_detail.go b/server/internal/dao/internal/t_balance_detail.go new file mode 100644 index 0000000..4aa4c91 --- /dev/null +++ b/server/internal/dao/internal/t_balance_detail.go @@ -0,0 +1,117 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TBalanceDetailDao is the data access object for the table t_balance_detail. +type TBalanceDetailDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TBalanceDetailColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TBalanceDetailColumns defines and stores column names for the table t_balance_detail. +type TBalanceDetailColumns struct { + Id string // 明细ID + DeptId string // 账户ID + SerialNo string // 流水号 + TransactionTime string // 交易时间 + IncomeExpenseType string // 收支类型: 0收入,1支出 + TransactionType string // 交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整 + TransactionChannel string // 交易渠道:1支付宝 2微信 3余额 + TransactionStatus string // 交易状态:0待支付、1已支付、2已过期、3交易失败 + Amount string // 交易金额 + BeforeBalance string // 变动前余额 + BalanceAfter string // 变动后余额 + ChannelSerialNo string // 交易渠道流水号 + OrderSn string // 关联订单号 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tBalanceDetailColumns holds the columns for the table t_balance_detail. +var tBalanceDetailColumns = TBalanceDetailColumns{ + Id: "id", + DeptId: "dept_id", + SerialNo: "serial_no", + TransactionTime: "transaction_time", + IncomeExpenseType: "income_expense_type", + TransactionType: "transaction_type", + TransactionChannel: "transaction_channel", + TransactionStatus: "transaction_status", + Amount: "amount", + BeforeBalance: "before_balance", + BalanceAfter: "balance_after", + ChannelSerialNo: "channel_serial_no", + OrderSn: "order_sn", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTBalanceDetailDao creates and returns a new DAO object for table data access. +func NewTBalanceDetailDao(handlers ...gdb.ModelHandler) *TBalanceDetailDao { + return &TBalanceDetailDao{ + group: "default", + table: "t_balance_detail", + columns: tBalanceDetailColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TBalanceDetailDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TBalanceDetailDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TBalanceDetailDao) Columns() TBalanceDetailColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TBalanceDetailDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TBalanceDetailDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TBalanceDetailDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_consume_account_month_bill.go b/server/internal/dao/internal/t_consume_account_month_bill.go new file mode 100644 index 0000000..b4821e8 --- /dev/null +++ b/server/internal/dao/internal/t_consume_account_month_bill.go @@ -0,0 +1,133 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TConsumeAccountMonthBillDao is the data access object for the table t_consume_account_month_bill. +type TConsumeAccountMonthBillDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TConsumeAccountMonthBillColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TConsumeAccountMonthBillColumns defines and stores column names for the table t_consume_account_month_bill. +type TConsumeAccountMonthBillColumns struct { + Id string // 账单ID + DeptId string // 机构ID + AccountPeriod string // 账期YYYY-MM + OpeningBalance string // 月初余额 + RechargeIncome string // 充值收入 + WithdrawableTransferInIncome string // 可提现转入收入 + ManualAdjustIncome string // 人工调账收入 + RefundIncome string // 退款收入 + ConsumeExpense string // 平台消费支出 + BalanceTransferOutExpense string // 转可提现支出 + ManualAdjustExpense string // 人工调账支出 + ConsumeCreditRepayExpense string // 消费账户还款支出 + TotalIncome string // 本月收入总额 + TotalExpense string // 本月支出总额 + ClosingBalance string // 月末余额(月初余额+本月收入-本月支出) + IncomeCount string // 收入笔数 + ExpenseCount string // 支出笔数 + CreditUsed string // 本月使用信用额度 + CreditRepaid string // 本月还款信用额度 + BillStatus string // 账单状态:1正常,2已调整,3已作废 + SettleTime string // 结算时间 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tConsumeAccountMonthBillColumns holds the columns for the table t_consume_account_month_bill. +var tConsumeAccountMonthBillColumns = TConsumeAccountMonthBillColumns{ + Id: "id", + DeptId: "dept_id", + AccountPeriod: "account_period", + OpeningBalance: "opening_balance", + RechargeIncome: "recharge_income", + WithdrawableTransferInIncome: "withdrawable_transfer_in_income", + ManualAdjustIncome: "manual_adjust_income", + RefundIncome: "refund_income", + ConsumeExpense: "consume_expense", + BalanceTransferOutExpense: "balance_transfer_out_expense", + ManualAdjustExpense: "manual_adjust_expense", + ConsumeCreditRepayExpense: "consume_credit_repay_expense", + TotalIncome: "total_income", + TotalExpense: "total_expense", + ClosingBalance: "closing_balance", + IncomeCount: "income_count", + ExpenseCount: "expense_count", + CreditUsed: "credit_used", + CreditRepaid: "credit_repaid", + BillStatus: "bill_status", + SettleTime: "settle_time", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTConsumeAccountMonthBillDao creates and returns a new DAO object for table data access. +func NewTConsumeAccountMonthBillDao(handlers ...gdb.ModelHandler) *TConsumeAccountMonthBillDao { + return &TConsumeAccountMonthBillDao{ + group: "default", + table: "t_consume_account_month_bill", + columns: tConsumeAccountMonthBillColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TConsumeAccountMonthBillDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TConsumeAccountMonthBillDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TConsumeAccountMonthBillDao) Columns() TConsumeAccountMonthBillColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TConsumeAccountMonthBillDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TConsumeAccountMonthBillDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TConsumeAccountMonthBillDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_credit_detail.go b/server/internal/dao/internal/t_credit_detail.go new file mode 100644 index 0000000..3a5f834 --- /dev/null +++ b/server/internal/dao/internal/t_credit_detail.go @@ -0,0 +1,113 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TCreditDetailDao is the data access object for the table t_credit_detail. +type TCreditDetailDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TCreditDetailColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TCreditDetailColumns defines and stores column names for the table t_credit_detail. +type TCreditDetailColumns struct { + Id string // 明细ID + DeptId string // 组织机构ID + AccountPeriod string // 账期(YYYY-MM) + TransactionType string // 交易类型: 使用/还款 + Amount string // 金额 + CreditBalanceBefore string // 变动前信用额度余额 + CreditBalanceAfter string // 变动后信用额度余额 + RelatedOrderSn string // 关联订单号 + RepaymentMethod string // 还款方式: 0 余额 1 银行卡 2 支付宝 3 微信 + RepaymentChannelSerial string // 交易渠道流水号 + TransactionTime string // 交易时间 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tCreditDetailColumns holds the columns for the table t_credit_detail. +var tCreditDetailColumns = TCreditDetailColumns{ + Id: "id", + DeptId: "dept_id", + AccountPeriod: "account_period", + TransactionType: "transaction_type", + Amount: "amount", + CreditBalanceBefore: "credit_balance_before", + CreditBalanceAfter: "credit_balance_after", + RelatedOrderSn: "related_order_sn", + RepaymentMethod: "repayment_method", + RepaymentChannelSerial: "repayment_channel_serial", + TransactionTime: "transaction_time", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTCreditDetailDao creates and returns a new DAO object for table data access. +func NewTCreditDetailDao(handlers ...gdb.ModelHandler) *TCreditDetailDao { + return &TCreditDetailDao{ + group: "default", + table: "t_credit_detail", + columns: tCreditDetailColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TCreditDetailDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TCreditDetailDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TCreditDetailDao) Columns() TCreditDetailColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TCreditDetailDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TCreditDetailDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TCreditDetailDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_cust_withdraw_account.go b/server/internal/dao/internal/t_cust_withdraw_account.go new file mode 100644 index 0000000..0f21bf2 --- /dev/null +++ b/server/internal/dao/internal/t_cust_withdraw_account.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TCustWithdrawAccountDao is the data access object for the table t_cust_withdraw_account. +type TCustWithdrawAccountDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TCustWithdrawAccountColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TCustWithdrawAccountColumns defines and stores column names for the table t_cust_withdraw_account. +type TCustWithdrawAccountColumns struct { + Id string // 主键ID + DeptId string // 企业客户ID + AccountType string // 提现账号类型,1:支付宝,2:微信 + AccountNo string // 账号 + AccountName string // 账户名称/真实姓名 + Mobile string // 手机号 + IsDefault string // 是否默认账号:0-否 1-是 + Enabled string // 是否启用:0-未启用 1-启用 + Status string // 状态:0-禁用 1-正常 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tCustWithdrawAccountColumns holds the columns for the table t_cust_withdraw_account. +var tCustWithdrawAccountColumns = TCustWithdrawAccountColumns{ + Id: "id", + DeptId: "dept_id", + AccountType: "account_type", + AccountNo: "account_no", + AccountName: "account_name", + Mobile: "mobile", + IsDefault: "is_default", + Enabled: "enabled", + Status: "status", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTCustWithdrawAccountDao creates and returns a new DAO object for table data access. +func NewTCustWithdrawAccountDao(handlers ...gdb.ModelHandler) *TCustWithdrawAccountDao { + return &TCustWithdrawAccountDao{ + group: "default", + table: "t_cust_withdraw_account", + columns: tCustWithdrawAccountColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TCustWithdrawAccountDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TCustWithdrawAccountDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TCustWithdrawAccountDao) Columns() TCustWithdrawAccountColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TCustWithdrawAccountDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TCustWithdrawAccountDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TCustWithdrawAccountDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_dept_flow_daily.go b/server/internal/dao/internal/t_dept_flow_daily.go new file mode 100644 index 0000000..c7d957d --- /dev/null +++ b/server/internal/dao/internal/t_dept_flow_daily.go @@ -0,0 +1,103 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TDeptFlowDailyDao is the data access object for the table t_dept_flow_daily. +type TDeptFlowDailyDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TDeptFlowDailyColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TDeptFlowDailyColumns defines and stores column names for the table t_dept_flow_daily. +type TDeptFlowDailyColumns struct { + Id string // 自增主键 + DeptId string // 渠道客户ID + StatDate string // 统计日期 + TotalUsedFlowMb string // 当日所有卡总消耗流量MB + TotalSms string // 当日总短信使用条数 + TotalVoiceMin string // 当日总语音分钟数 + Remark string // 备注,同步失败原因/特殊说明 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tDeptFlowDailyColumns holds the columns for the table t_dept_flow_daily. +var tDeptFlowDailyColumns = TDeptFlowDailyColumns{ + Id: "id", + DeptId: "dept_id", + StatDate: "stat_date", + TotalUsedFlowMb: "total_used_flow_mb", + TotalSms: "total_sms", + TotalVoiceMin: "total_voice_min", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTDeptFlowDailyDao creates and returns a new DAO object for table data access. +func NewTDeptFlowDailyDao(handlers ...gdb.ModelHandler) *TDeptFlowDailyDao { + return &TDeptFlowDailyDao{ + group: "default", + table: "t_dept_flow_daily", + columns: tDeptFlowDailyColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TDeptFlowDailyDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TDeptFlowDailyDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TDeptFlowDailyDao) Columns() TDeptFlowDailyColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TDeptFlowDailyDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TDeptFlowDailyDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TDeptFlowDailyDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_division_code.go b/server/internal/dao/internal/t_division_code.go new file mode 100644 index 0000000..b56fd6d --- /dev/null +++ b/server/internal/dao/internal/t_division_code.go @@ -0,0 +1,89 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TDivisionCodeDao is the data access object for the table t_division_code. +type TDivisionCodeDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TDivisionCodeColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TDivisionCodeColumns defines and stores column names for the table t_division_code. +type TDivisionCodeColumns struct { + RegionId string // ID + RegionCode string // 行政区域代码 + RegionName string // 行政区域名称 + RegionLevel string // 等级 + RegionParent string // 上级代码 + RegionType string // 城乡分类代码 +} + +// tDivisionCodeColumns holds the columns for the table t_division_code. +var tDivisionCodeColumns = TDivisionCodeColumns{ + RegionId: "region_id", + RegionCode: "region_code", + RegionName: "region_name", + RegionLevel: "region_level", + RegionParent: "region_parent", + RegionType: "region_type", +} + +// NewTDivisionCodeDao creates and returns a new DAO object for table data access. +func NewTDivisionCodeDao(handlers ...gdb.ModelHandler) *TDivisionCodeDao { + return &TDivisionCodeDao{ + group: "default", + table: "t_division_code", + columns: tDivisionCodeColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TDivisionCodeDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TDivisionCodeDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TDivisionCodeDao) Columns() TDivisionCodeColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TDivisionCodeDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TDivisionCodeDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TDivisionCodeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_fin_commission_detail.go b/server/internal/dao/internal/t_fin_commission_detail.go new file mode 100644 index 0000000..d753961 --- /dev/null +++ b/server/internal/dao/internal/t_fin_commission_detail.go @@ -0,0 +1,115 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TFinCommissionDetailDao is the data access object for the table t_fin_commission_detail. +type TFinCommissionDetailDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TFinCommissionDetailColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TFinCommissionDetailColumns defines and stores column names for the table t_fin_commission_detail. +type TFinCommissionDetailColumns struct { + Id string // 主键ID + CommissionNo string // 分润明细编号 + OrderSn string // 订单编号 + OrderType string // 订单类型 + ProductId string // 商品ID + PayerDeptId string // 下级机构ID + BenefitDeptId string // 受益机构ID + BenefitDeptLevel string // 受益机构层级 + CommissionAmount string // 分润金额 + CommissionStatus string // 分润状态:0待结算,1可提现 + BenefitSnapshot string // 价格快照(受益机构的成本价+利润+利润悉数=出货单价) + AccountPeriod string // 账期(YYYY-MM) + SettlementTime string // 结算时间 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tFinCommissionDetailColumns holds the columns for the table t_fin_commission_detail. +var tFinCommissionDetailColumns = TFinCommissionDetailColumns{ + Id: "id", + CommissionNo: "commission_no", + OrderSn: "order_sn", + OrderType: "order_type", + ProductId: "product_id", + PayerDeptId: "payer_dept_id", + BenefitDeptId: "benefit_dept_id", + BenefitDeptLevel: "benefit_dept_level", + CommissionAmount: "commission_amount", + CommissionStatus: "commission_status", + BenefitSnapshot: "benefit_snapshot", + AccountPeriod: "account_period", + SettlementTime: "settlement_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTFinCommissionDetailDao creates and returns a new DAO object for table data access. +func NewTFinCommissionDetailDao(handlers ...gdb.ModelHandler) *TFinCommissionDetailDao { + return &TFinCommissionDetailDao{ + group: "default", + table: "t_fin_commission_detail", + columns: tFinCommissionDetailColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TFinCommissionDetailDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TFinCommissionDetailDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TFinCommissionDetailDao) Columns() TFinCommissionDetailColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TFinCommissionDetailDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TFinCommissionDetailDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TFinCommissionDetailDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_fin_withdrawable_change.go b/server/internal/dao/internal/t_fin_withdrawable_change.go new file mode 100644 index 0000000..589b6a4 --- /dev/null +++ b/server/internal/dao/internal/t_fin_withdrawable_change.go @@ -0,0 +1,119 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TFinWithdrawableChangeDao is the data access object for the table t_fin_withdrawable_change. +type TFinWithdrawableChangeDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TFinWithdrawableChangeColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TFinWithdrawableChangeColumns defines and stores column names for the table t_fin_withdrawable_change. +type TFinWithdrawableChangeColumns struct { + Id string // 主键ID + DeptId string // 机构ID + ChangeType string // 变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款 + IncomeExpenseType string // 收支类型: 0收入,1支出 + ChangeAmount string // 变动金额 + BeforeBalance string // 变动前可提现余额 + AfterBalance string // 变动后可提现余额 + AccountType string // 提现账号类型,1:银行卡,2:支付宝,3:微信 + BankName string // 开户行名称 + BankAccount string // 开户行账号或账号 + AccountName string // 用户姓名 + IdentityCard string // 用户身份证号 + SourceNo string // 来源单号 + Remark string // 备注 + AccountPeriod string // 账期(YYYY-MM) + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tFinWithdrawableChangeColumns holds the columns for the table t_fin_withdrawable_change. +var tFinWithdrawableChangeColumns = TFinWithdrawableChangeColumns{ + Id: "id", + DeptId: "dept_id", + ChangeType: "change_type", + IncomeExpenseType: "income_expense_type", + ChangeAmount: "change_amount", + BeforeBalance: "before_balance", + AfterBalance: "after_balance", + AccountType: "account_type", + BankName: "bank_name", + BankAccount: "bank_account", + AccountName: "account_name", + IdentityCard: "identity_card", + SourceNo: "source_no", + Remark: "remark", + AccountPeriod: "account_period", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTFinWithdrawableChangeDao creates and returns a new DAO object for table data access. +func NewTFinWithdrawableChangeDao(handlers ...gdb.ModelHandler) *TFinWithdrawableChangeDao { + return &TFinWithdrawableChangeDao{ + group: "default", + table: "t_fin_withdrawable_change", + columns: tFinWithdrawableChangeColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TFinWithdrawableChangeDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TFinWithdrawableChangeDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TFinWithdrawableChangeDao) Columns() TFinWithdrawableChangeColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TFinWithdrawableChangeDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TFinWithdrawableChangeDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TFinWithdrawableChangeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_finance_apply.go b/server/internal/dao/internal/t_finance_apply.go new file mode 100644 index 0000000..984d44e --- /dev/null +++ b/server/internal/dao/internal/t_finance_apply.go @@ -0,0 +1,125 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TFinanceApplyDao is the data access object for the table t_finance_apply. +type TFinanceApplyDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TFinanceApplyColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TFinanceApplyColumns defines and stores column names for the table t_finance_apply. +type TFinanceApplyColumns struct { + Id string // 主键ID + ApplyNo string // 申请单号 + ApplyType string // 申请类型(1:提现申请,2:余额转提现) + AuditType string // 审核类型:1初审,2复审 + ApplyDeptId string // 申请机构ID + AuditDeptId string // 审核方机构ID,通常为直属上级或顶级 + AvailableAmountSnapshot string // 申请前可提现余额快照 + ApplyAmount string // 申请金额 + AccountType string // 提现账号类型,1:银行卡,2:支付宝,3:微信 + BankName string // 开户行名称 + BankAccount string // 开户行账号或账号 + AccountName string // 用户姓名 + IdentityCard string // 用户身份证号 + ReceiveAccount string // 收款账户信息快照 + ApplyStatus string // 状态:0待审核,1已通过,2已驳回,3已打款,4已取消 + ApplyTime string // 申请时间 + AuditTime string // 最近审核时间 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tFinanceApplyColumns holds the columns for the table t_finance_apply. +var tFinanceApplyColumns = TFinanceApplyColumns{ + Id: "id", + ApplyNo: "apply_no", + ApplyType: "apply_type", + AuditType: "audit_type", + ApplyDeptId: "apply_dept_id", + AuditDeptId: "audit_dept_id", + AvailableAmountSnapshot: "available_amount_snapshot", + ApplyAmount: "apply_amount", + AccountType: "account_type", + BankName: "bank_name", + BankAccount: "bank_account", + AccountName: "account_name", + IdentityCard: "identity_card", + ReceiveAccount: "receive_account", + ApplyStatus: "apply_status", + ApplyTime: "apply_time", + AuditTime: "audit_time", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTFinanceApplyDao creates and returns a new DAO object for table data access. +func NewTFinanceApplyDao(handlers ...gdb.ModelHandler) *TFinanceApplyDao { + return &TFinanceApplyDao{ + group: "default", + table: "t_finance_apply", + columns: tFinanceApplyColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TFinanceApplyDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TFinanceApplyDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TFinanceApplyDao) Columns() TFinanceApplyColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TFinanceApplyDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TFinanceApplyDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TFinanceApplyDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_finance_audit_record.go b/server/internal/dao/internal/t_finance_audit_record.go new file mode 100644 index 0000000..0b5c0e3 --- /dev/null +++ b/server/internal/dao/internal/t_finance_audit_record.go @@ -0,0 +1,105 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TFinanceAuditRecordDao is the data access object for the table t_finance_audit_record. +type TFinanceAuditRecordDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TFinanceAuditRecordColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TFinanceAuditRecordColumns defines and stores column names for the table t_finance_audit_record. +type TFinanceAuditRecordColumns struct { + Id string // 主键ID + AuditNo string // 审核记录编号 + ApplyNo string // 申请单号 + AuditDeptId string // 审核方机构ID + AuditorUserId string // 审核人ID + AuditResult string // 审核结果:0通过,1驳回 + AuditOpinion string // 审核意见 + AuditTime string // 审核时间 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tFinanceAuditRecordColumns holds the columns for the table t_finance_audit_record. +var tFinanceAuditRecordColumns = TFinanceAuditRecordColumns{ + Id: "id", + AuditNo: "audit_no", + ApplyNo: "apply_no", + AuditDeptId: "audit_dept_id", + AuditorUserId: "auditor_user_id", + AuditResult: "audit_result", + AuditOpinion: "audit_opinion", + AuditTime: "audit_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTFinanceAuditRecordDao creates and returns a new DAO object for table data access. +func NewTFinanceAuditRecordDao(handlers ...gdb.ModelHandler) *TFinanceAuditRecordDao { + return &TFinanceAuditRecordDao{ + group: "default", + table: "t_finance_audit_record", + columns: tFinanceAuditRecordColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TFinanceAuditRecordDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TFinanceAuditRecordDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TFinanceAuditRecordDao) Columns() TFinanceAuditRecordColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TFinanceAuditRecordDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TFinanceAuditRecordDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TFinanceAuditRecordDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_flow_package_config.go b/server/internal/dao/internal/t_flow_package_config.go new file mode 100644 index 0000000..1d7c2c2 --- /dev/null +++ b/server/internal/dao/internal/t_flow_package_config.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TFlowPackageConfigDao is the data access object for the table t_flow_package_config. +type TFlowPackageConfigDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TFlowPackageConfigColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TFlowPackageConfigColumns defines and stores column names for the table t_flow_package_config. +type TFlowPackageConfigColumns struct { + Id string // 主键ID + PoolPackageCode string // 池编码 + PackageCodes string // 套餐编码列表 + TopupPackageCodes string // 可订购加油包套餐编码列表 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tFlowPackageConfigColumns holds the columns for the table t_flow_package_config. +var tFlowPackageConfigColumns = TFlowPackageConfigColumns{ + Id: "id", + PoolPackageCode: "pool_package_code", + PackageCodes: "package_codes", + TopupPackageCodes: "topup_package_codes", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTFlowPackageConfigDao creates and returns a new DAO object for table data access. +func NewTFlowPackageConfigDao(handlers ...gdb.ModelHandler) *TFlowPackageConfigDao { + return &TFlowPackageConfigDao{ + group: "default", + table: "t_flow_package_config", + columns: tFlowPackageConfigColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TFlowPackageConfigDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TFlowPackageConfigDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TFlowPackageConfigDao) Columns() TFlowPackageConfigColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TFlowPackageConfigDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TFlowPackageConfigDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TFlowPackageConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_message_log.go b/server/internal/dao/internal/t_message_log.go new file mode 100644 index 0000000..a7bc2ae --- /dev/null +++ b/server/internal/dao/internal/t_message_log.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TMessageLogDao is the data access object for the table t_message_log. +type TMessageLogDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TMessageLogColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TMessageLogColumns defines and stores column names for the table t_message_log. +type TMessageLogColumns struct { + MessageLogId string // 主键ID + MessageType string // 消息类型 1系统通知 2活动通知 3订单通知 4账户通知 + SendUserType string // 发送用户类型 1代理商 2终端用户 + UserIds string // 接收用户ID集合(JSON数组) + MessageTitle string // 消息标题 + MessageContent string // 消息内容 + MessageLink string // 跳转链接地址 + SendTime string // 发送时间 + IsRecall string // 是否撤回 0未撤回 1已撤回 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tMessageLogColumns holds the columns for the table t_message_log. +var tMessageLogColumns = TMessageLogColumns{ + MessageLogId: "message_log_id", + MessageType: "message_type", + SendUserType: "send_user_type", + UserIds: "user_ids", + MessageTitle: "message_title", + MessageContent: "message_content", + MessageLink: "message_link", + SendTime: "send_time", + IsRecall: "is_recall", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTMessageLogDao creates and returns a new DAO object for table data access. +func NewTMessageLogDao(handlers ...gdb.ModelHandler) *TMessageLogDao { + return &TMessageLogDao{ + group: "default", + table: "t_message_log", + columns: tMessageLogColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TMessageLogDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TMessageLogDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TMessageLogDao) Columns() TMessageLogColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TMessageLogDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TMessageLogDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TMessageLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_notify_log.go b/server/internal/dao/internal/t_notify_log.go new file mode 100644 index 0000000..ada713c --- /dev/null +++ b/server/internal/dao/internal/t_notify_log.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TNotifyLogDao is the data access object for the table t_notify_log. +type TNotifyLogDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TNotifyLogColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TNotifyLogColumns defines and stores column names for the table t_notify_log. +type TNotifyLogColumns struct { + NotifyId string // 主键ID + NotifyTitle string // 标题 + NotifyContent string // 内容 + SendUserType string // 发送用户类型 1代理商 2终端用户 + SendTime string // 发送时间 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tNotifyLogColumns holds the columns for the table t_notify_log. +var tNotifyLogColumns = TNotifyLogColumns{ + NotifyId: "notify_id", + NotifyTitle: "notify_title", + NotifyContent: "notify_content", + SendUserType: "send_user_type", + SendTime: "send_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTNotifyLogDao creates and returns a new DAO object for table data access. +func NewTNotifyLogDao(handlers ...gdb.ModelHandler) *TNotifyLogDao { + return &TNotifyLogDao{ + group: "default", + table: "t_notify_log", + columns: tNotifyLogColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TNotifyLogDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TNotifyLogDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TNotifyLogDao) Columns() TNotifyLogColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TNotifyLogDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TNotifyLogDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TNotifyLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_order.go b/server/internal/dao/internal/t_order.go new file mode 100644 index 0000000..fe3819d --- /dev/null +++ b/server/internal/dao/internal/t_order.go @@ -0,0 +1,183 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TOrderDao is the data access object for the table t_order. +type TOrderDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TOrderColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TOrderColumns defines and stores column names for the table t_order. +type TOrderColumns struct { + Id string // 主键ID + OrderSn string // 订单编号 + ParentOrderId string // 父订单ID + ParentOrderSn string // 父订单编号 + CustomerType string // 客户类型 枚举 + CustomerAgentId string // 渠道编号(购买方) + EndUserId string // 终端客户编号 + AgentId string // 渠道编号(销售方) + OrderType string // 订单类型 枚举 + OrderStatus string // 订单状态 枚举 + ShippingStatus string // 配送状态 枚举 + ReturnStatus string // 退货状态 枚举 + Consignee string // 收货人姓名 + Mobile string // 收货人手机 + Email string // 收货人邮箱 + Address string // 详细地址 + AreaCode string // 行政区域代码 + BuyerNote string // 买家备注 + AdminNote string // 商家备注 + Remark string // 系统备注 + ShippingMethod string // 发货方式 枚举 + LogisticsId string // 快递公司ID + LogisticsName string // 物流公司名称 + ShippingTypeId string // 配送类型ID + ShippingTypeName string // 配送类型名称 + TrackingNo string // 物流单号 + ShippingTime string // 发货时间 + ReceivedTime string // 收货时间 + PayType string // 支付类型 枚举 + PayStatus string // 支付状态 枚举 + PayOrderSn string // 支付订单编号 + PayTime string // 支付时间 + TotalAmount string // 订单总金额 + ProductAmount string // 商品总金额 + ShippingFee string // 运费金额 + ServiceFee string // 服务费金额 + InvoiceFee string // 发票费金额 + CouponAmount string // 优惠券抵扣金额 + DiscountAmount string // 活动优惠金额 + Balance string // 余额抵扣金额 + PaidAmount string // 已支付总金额 + OnlinePaidAmount string // 线上支付金额 + OfflinePaidAmount string // 线下支付金额 + UnpaidAmount string // 未支付金额 + UnrefundAmount string // 未退款金额 + IsNeedCommission string // 是否需要分佣 枚举:yesno_enum + DistributionStatus string // 分销分成状态 枚举 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tOrderColumns holds the columns for the table t_order. +var tOrderColumns = TOrderColumns{ + Id: "id", + OrderSn: "order_sn", + ParentOrderId: "parent_order_id", + ParentOrderSn: "parent_order_sn", + CustomerType: "customer_type", + CustomerAgentId: "customer_agent_id", + EndUserId: "end_user_id", + AgentId: "agent_id", + OrderType: "order_type", + OrderStatus: "order_status", + ShippingStatus: "shipping_status", + ReturnStatus: "return_status", + Consignee: "consignee", + Mobile: "mobile", + Email: "email", + Address: "address", + AreaCode: "area_code", + BuyerNote: "buyer_note", + AdminNote: "admin_note", + Remark: "remark", + ShippingMethod: "shipping_method", + LogisticsId: "logistics_id", + LogisticsName: "logistics_name", + ShippingTypeId: "shipping_type_id", + ShippingTypeName: "shipping_type_name", + TrackingNo: "tracking_no", + ShippingTime: "shipping_time", + ReceivedTime: "received_time", + PayType: "pay_type", + PayStatus: "pay_status", + PayOrderSn: "pay_order_sn", + PayTime: "pay_time", + TotalAmount: "total_amount", + ProductAmount: "product_amount", + ShippingFee: "shipping_fee", + ServiceFee: "service_fee", + InvoiceFee: "invoice_fee", + CouponAmount: "coupon_amount", + DiscountAmount: "discount_amount", + Balance: "balance", + PaidAmount: "paid_amount", + OnlinePaidAmount: "online_paid_amount", + OfflinePaidAmount: "offline_paid_amount", + UnpaidAmount: "unpaid_amount", + UnrefundAmount: "unrefund_amount", + IsNeedCommission: "is_need_commission", + DistributionStatus: "distribution_status", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTOrderDao creates and returns a new DAO object for table data access. +func NewTOrderDao(handlers ...gdb.ModelHandler) *TOrderDao { + return &TOrderDao{ + group: "default", + table: "t_order", + columns: tOrderColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TOrderDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TOrderDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TOrderDao) Columns() TOrderColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TOrderDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TOrderDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_order_item.go b/server/internal/dao/internal/t_order_item.go new file mode 100644 index 0000000..345a1b5 --- /dev/null +++ b/server/internal/dao/internal/t_order_item.go @@ -0,0 +1,141 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TOrderItemDao is the data access object for the table t_order_item. +type TOrderItemDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TOrderItemColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TOrderItemColumns defines and stores column names for the table t_order_item. +type TOrderItemColumns struct { + ItemId string // 订单商品信息自增id + OrderId string // 订单ID + OrderSn string // 订单编号 + CustomerType string // 客户类型 枚举 + CustomerAgentId string // 渠道编号(购买方) + EndUserId string // 客户编号 + Price string // 商品最终单价 + Quantity string // 商品的购买数量 + ProductId string // 商品ID + ProductName string // 商品的名称 + ProductSn string // 商品的唯一货号 + PicThumb string // 商品缩略图 + SkuId string // 规格ID + SkuData string // 【JSON】sku信息[{sku_id,sku_value,sku_name}] + DeliveryQuantity string // 发货数量 + ProductType string // 商品类型 枚举 + IsGift string // 是否为赠品 枚举:yesno_enum + AgentId string // 渠道编号(销售方) + PrepayPrice string // 预售价格 + Commission string // 佣金数据 + OriginPrice string // 商品初始价格 + PromotionData string // 优惠信息 + ExtraSkuData string // 附加属性 + PayMode string // 付费方式 枚举 + ServiceBeginTime string // 服务开始时间 + ServiceEndTime string // 服务结束时间 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tOrderItemColumns holds the columns for the table t_order_item. +var tOrderItemColumns = TOrderItemColumns{ + ItemId: "item_id", + OrderId: "order_id", + OrderSn: "order_sn", + CustomerType: "customer_type", + CustomerAgentId: "customer_agent_id", + EndUserId: "end_user_id", + Price: "price", + Quantity: "quantity", + ProductId: "product_id", + ProductName: "product_name", + ProductSn: "product_sn", + PicThumb: "pic_thumb", + SkuId: "sku_id", + SkuData: "sku_data", + DeliveryQuantity: "delivery_quantity", + ProductType: "product_type", + IsGift: "is_gift", + AgentId: "agent_id", + PrepayPrice: "prepay_price", + Commission: "commission", + OriginPrice: "origin_price", + PromotionData: "promotion_data", + ExtraSkuData: "extra_sku_data", + PayMode: "pay_mode", + ServiceBeginTime: "service_begin_time", + ServiceEndTime: "service_end_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTOrderItemDao creates and returns a new DAO object for table data access. +func NewTOrderItemDao(handlers ...gdb.ModelHandler) *TOrderItemDao { + return &TOrderItemDao{ + group: "default", + table: "t_order_item", + columns: tOrderItemColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TOrderItemDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TOrderItemDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TOrderItemDao) Columns() TOrderItemColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TOrderItemDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TOrderItemDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TOrderItemDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_package_customer.go b/server/internal/dao/internal/t_package_customer.go new file mode 100644 index 0000000..f4f1afa --- /dev/null +++ b/server/internal/dao/internal/t_package_customer.go @@ -0,0 +1,101 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TPackageCustomerDao is the data access object for the table t_package_customer. +type TPackageCustomerDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TPackageCustomerColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TPackageCustomerColumns defines and stores column names for the table t_package_customer. +type TPackageCustomerColumns struct { + Id string // 主键ID + PackageCode string // 套餐编码 + PackageName string // 套餐名称 + DeptId string // 组织客户ID + DeptName string // 组织客户名称 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tPackageCustomerColumns holds the columns for the table t_package_customer. +var tPackageCustomerColumns = TPackageCustomerColumns{ + Id: "id", + PackageCode: "package_code", + PackageName: "package_name", + DeptId: "dept_id", + DeptName: "dept_name", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTPackageCustomerDao creates and returns a new DAO object for table data access. +func NewTPackageCustomerDao(handlers ...gdb.ModelHandler) *TPackageCustomerDao { + return &TPackageCustomerDao{ + group: "default", + table: "t_package_customer", + columns: tPackageCustomerColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TPackageCustomerDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TPackageCustomerDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TPackageCustomerDao) Columns() TPackageCustomerColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TPackageCustomerDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TPackageCustomerDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TPackageCustomerDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_profit_account_month_bill.go b/server/internal/dao/internal/t_profit_account_month_bill.go new file mode 100644 index 0000000..d837d1a --- /dev/null +++ b/server/internal/dao/internal/t_profit_account_month_bill.go @@ -0,0 +1,125 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TProfitAccountMonthBillDao is the data access object for the table t_profit_account_month_bill. +type TProfitAccountMonthBillDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TProfitAccountMonthBillColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TProfitAccountMonthBillColumns defines and stores column names for the table t_profit_account_month_bill. +type TProfitAccountMonthBillColumns struct { + Id string // 账单ID + DeptId string // 机构ID + AccountPeriod string // 账期YYYY-MM + OpeningBalance string // 月初余额 + CommissionIncome string // 分润收入 + BalanceTransferInIncome string // 余额转提现收入 + WithdrawalExpense string // 提现支出 + WithdrawableTransferOutExpense string // 可提现转余额支出 + ProfitCreditRepayExpense string // 盈利账户还款支出 + TotalIncome string // 本月收入总额 + TotalExpense string // 本月支出总额 + ClosingBalance string // 月末余额(月初余额+本月收入-本月支出) + IncomeCount string // 收入笔数 + ExpenseCount string // 支出笔数 + BillStatus string // 账单状态:1正常,2已调整,3已作废 + SettleTime string // 结算时间 + SettleBy string // 结算人ID + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tProfitAccountMonthBillColumns holds the columns for the table t_profit_account_month_bill. +var tProfitAccountMonthBillColumns = TProfitAccountMonthBillColumns{ + Id: "id", + DeptId: "dept_id", + AccountPeriod: "account_period", + OpeningBalance: "opening_balance", + CommissionIncome: "commission_income", + BalanceTransferInIncome: "balance_transfer_in_income", + WithdrawalExpense: "withdrawal_expense", + WithdrawableTransferOutExpense: "withdrawable_transfer_out_expense", + ProfitCreditRepayExpense: "profit_credit_repay_expense", + TotalIncome: "total_income", + TotalExpense: "total_expense", + ClosingBalance: "closing_balance", + IncomeCount: "income_count", + ExpenseCount: "expense_count", + BillStatus: "bill_status", + SettleTime: "settle_time", + SettleBy: "settle_by", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTProfitAccountMonthBillDao creates and returns a new DAO object for table data access. +func NewTProfitAccountMonthBillDao(handlers ...gdb.ModelHandler) *TProfitAccountMonthBillDao { + return &TProfitAccountMonthBillDao{ + group: "default", + table: "t_profit_account_month_bill", + columns: tProfitAccountMonthBillColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TProfitAccountMonthBillDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TProfitAccountMonthBillDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TProfitAccountMonthBillDao) Columns() TProfitAccountMonthBillColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TProfitAccountMonthBillDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TProfitAccountMonthBillDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TProfitAccountMonthBillDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_resource_batch_download.go b/server/internal/dao/internal/t_resource_batch_download.go new file mode 100644 index 0000000..c7a8b4d --- /dev/null +++ b/server/internal/dao/internal/t_resource_batch_download.go @@ -0,0 +1,141 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TResourceBatchDownloadDao is the data access object for the table t_resource_batch_download. +type TResourceBatchDownloadDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TResourceBatchDownloadColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TResourceBatchDownloadColumns defines and stores column names for the table t_resource_batch_download. +type TResourceBatchDownloadColumns struct { + Id string // 主键ID + BatchNo string // 批次编号(全局唯一) + TaskName string // 任务名称 + ResourceType string // 资源类型 枚举 + ExportScene string // 导出场景 枚举 + QueryParams string // 导出查询条件快照 + TotalCount string // 预计导出总条数 + SuccessCount string // 已成功导出条数 + FailCount string // 失败条数 + DownloadStatus string // 下载状态 枚举 + OssId string // OSS文件ID + FileName string // 导出文件名 + FileExt string // 文件扩展名 + FileUrl string // 文件访问地址 + FilePath string // 服务器本地路径 + FileSize string // 文件大小(字节) + FileMd5 string // 文件MD5 + DownloadCount string // 下载次数 + LastDownloadTime string // 最后下载时间 + MaxDownloadCount string // 最大下载次数限制 + ErrorMessage string // 失败原因 + DeptId string // 所属机构ID + StartTime string // 任务开始时间 + FinishTime string // 任务完成时间 + ExpireTime string // 文件过期时间 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tResourceBatchDownloadColumns holds the columns for the table t_resource_batch_download. +var tResourceBatchDownloadColumns = TResourceBatchDownloadColumns{ + Id: "id", + BatchNo: "batch_no", + TaskName: "task_name", + ResourceType: "resource_type", + ExportScene: "export_scene", + QueryParams: "query_params", + TotalCount: "total_count", + SuccessCount: "success_count", + FailCount: "fail_count", + DownloadStatus: "download_status", + OssId: "oss_id", + FileName: "file_name", + FileExt: "file_ext", + FileUrl: "file_url", + FilePath: "file_path", + FileSize: "file_size", + FileMd5: "file_md5", + DownloadCount: "download_count", + LastDownloadTime: "last_download_time", + MaxDownloadCount: "max_download_count", + ErrorMessage: "error_message", + DeptId: "dept_id", + StartTime: "start_time", + FinishTime: "finish_time", + ExpireTime: "expire_time", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTResourceBatchDownloadDao creates and returns a new DAO object for table data access. +func NewTResourceBatchDownloadDao(handlers ...gdb.ModelHandler) *TResourceBatchDownloadDao { + return &TResourceBatchDownloadDao{ + group: "default", + table: "t_resource_batch_download", + columns: tResourceBatchDownloadColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TResourceBatchDownloadDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TResourceBatchDownloadDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TResourceBatchDownloadDao) Columns() TResourceBatchDownloadColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TResourceBatchDownloadDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TResourceBatchDownloadDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TResourceBatchDownloadDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_bind_package_logs.go b/server/internal/dao/internal/t_sim_bind_package_logs.go new file mode 100644 index 0000000..f48b2c9 --- /dev/null +++ b/server/internal/dao/internal/t_sim_bind_package_logs.go @@ -0,0 +1,127 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimBindPackageLogsDao is the data access object for the table t_sim_bind_package_logs. +type TSimBindPackageLogsDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimBindPackageLogsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimBindPackageLogsColumns defines and stores column names for the table t_sim_bind_package_logs. +type TSimBindPackageLogsColumns struct { + Id string // 主键ID + SubscriptionNo string // 订购记录编号 + BatchNo string // 批次编号 + Iccid string // ICCID + Msisdn string // MSISDN/卡号 + DeptId string // 部门机构编号 + PackageType string // 套餐类型 + PackageCode string // 套餐编号 + PreviousPackageCode string // 变更前套餐编号 + BusinessType string // 类型 枚举 + EffectiveStatus string // 订购状态 枚举 + HandleTime string // 办理时间 + EffectiveTime string // 生效时间 + ExpectedExpireTime string // 预计到期时间 + ActualExpireTime string // 实际到期时间 + DurationMonths string // 套餐时长(月) + GiftDurationMonths string // 赠送时长(月) + OrderCode string // 订单编号 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimBindPackageLogsColumns holds the columns for the table t_sim_bind_package_logs. +var tSimBindPackageLogsColumns = TSimBindPackageLogsColumns{ + Id: "id", + SubscriptionNo: "subscription_no", + BatchNo: "batch_no", + Iccid: "iccid", + Msisdn: "msisdn", + DeptId: "dept_id", + PackageType: "package_type", + PackageCode: "package_code", + PreviousPackageCode: "previous_package_code", + BusinessType: "business_type", + EffectiveStatus: "effective_status", + HandleTime: "handle_time", + EffectiveTime: "effective_time", + ExpectedExpireTime: "expected_expire_time", + ActualExpireTime: "actual_expire_time", + DurationMonths: "duration_months", + GiftDurationMonths: "gift_duration_months", + OrderCode: "order_code", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimBindPackageLogsDao creates and returns a new DAO object for table data access. +func NewTSimBindPackageLogsDao(handlers ...gdb.ModelHandler) *TSimBindPackageLogsDao { + return &TSimBindPackageLogsDao{ + group: "default", + table: "t_sim_bind_package_logs", + columns: tSimBindPackageLogsColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimBindPackageLogsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimBindPackageLogsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimBindPackageLogsDao) Columns() TSimBindPackageLogsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimBindPackageLogsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimBindPackageLogsDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimBindPackageLogsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_card_bind_pkg.go b/server/internal/dao/internal/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..d4d9f87 --- /dev/null +++ b/server/internal/dao/internal/t_sim_card_bind_pkg.go @@ -0,0 +1,127 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimCardBindPkgDao is the data access object for the table t_sim_card_bind_pkg. +type TSimCardBindPkgDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimCardBindPkgColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimCardBindPkgColumns defines and stores column names for the table t_sim_card_bind_pkg. +type TSimCardBindPkgColumns struct { + Id string // 主键ID + SubscriptionNo string // 订购记录编号 + BatchNo string // 批次编号 + Iccid string // ICCID + Msisdn string // MSISDN/卡号 + DeptId string // 部门机构编号 + PackageType string // 套餐类型 + PackageCode string // 套餐编号 + PreviousPackageCode string // 变更前套餐编号 + BusinessType string // 类型 枚举 + EffectiveStatus string // 订购状态 枚举 + HandleTime string // 办理时间 + EffectiveTime string // 生效时间 + ExpectedExpireTime string // 预计到期时间 + ActualExpireTime string // 实际到期时间 + DurationMonths string // 套餐时长(月) + GiftDurationMonths string // 赠送时长(月) + OrderCode string // 订单编号 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimCardBindPkgColumns holds the columns for the table t_sim_card_bind_pkg. +var tSimCardBindPkgColumns = TSimCardBindPkgColumns{ + Id: "id", + SubscriptionNo: "subscription_no", + BatchNo: "batch_no", + Iccid: "iccid", + Msisdn: "msisdn", + DeptId: "dept_id", + PackageType: "package_type", + PackageCode: "package_code", + PreviousPackageCode: "previous_package_code", + BusinessType: "business_type", + EffectiveStatus: "effective_status", + HandleTime: "handle_time", + EffectiveTime: "effective_time", + ExpectedExpireTime: "expected_expire_time", + ActualExpireTime: "actual_expire_time", + DurationMonths: "duration_months", + GiftDurationMonths: "gift_duration_months", + OrderCode: "order_code", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimCardBindPkgDao creates and returns a new DAO object for table data access. +func NewTSimCardBindPkgDao(handlers ...gdb.ModelHandler) *TSimCardBindPkgDao { + return &TSimCardBindPkgDao{ + group: "default", + table: "t_sim_card_bind_pkg", + columns: tSimCardBindPkgColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimCardBindPkgDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimCardBindPkgDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimCardBindPkgDao) Columns() TSimCardBindPkgColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimCardBindPkgDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimCardBindPkgDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimCardBindPkgDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_card_cancellation.go b/server/internal/dao/internal/t_sim_card_cancellation.go new file mode 100644 index 0000000..0c2c7bc --- /dev/null +++ b/server/internal/dao/internal/t_sim_card_cancellation.go @@ -0,0 +1,191 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimCardCancellationDao is the data access object for the table t_sim_card_cancellation. +type TSimCardCancellationDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimCardCancellationColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimCardCancellationColumns defines and stores column names for the table t_sim_card_cancellation. +type TSimCardCancellationColumns struct { + Id string // 主键ID + Iccid string // ICCID + Msisdn string // MSISDN/卡号 + Imsi string // IMSI + Imei string // IMEI + RegionCode string // 归属地 + DeptId string // 渠道客户ID + CurrentPackageCode string // 当前套餐编号 + PackageStatus string // 套餐状态:0 无套餐,1待生效,2生效中,3已过期 + AccessType string // 接入方式:ipv4、ipv6、ipv4_ipv6 + BossCardStatus string // 运营商卡状态 枚举 + CancelBatchNo string // 系统销户批次号 + CancelledAt string // 系统销户完成时间 + CardType string // 卡类型 枚举 + BossOpenAt string // 运营商开户日期 + BossActivateAt string // 运营商激活日期 + IsBossActivateEnabled string // 是否按运营商激活减去赠送时长方:1是,0否 + InboundBatchNo string // 入库批次 + OutboundBatchNo string // 出库批次 + AllocationBatchNo string // 划拨批次 + IsFlowPool string // 是否为池卡:1是,0否 + FlowPoolCode string // 流量池编号 + FlowPkgBeginAt string // 当前套餐生效时间 + FlowPkgPresentAt string // 套餐赠送结束时间 + FlowPkgRealPresentAt string // 实际赠送结束时间 + FlowPkgEndAt string // 当前套餐预计到期时间 + DataServiceStatus string // 数据服务状态:0启用,1停用 + PackageTotalFlowMb string // 套餐总流量MB + UsedFlowMb string // 已用流量MB + TrafficCutoffStatus string // 达量断网配置状态:0未配置,1已开启,2已关闭 + TrafficCutoffThreshold string // 达量断网阈值 + SmsServiceStatus string // 短信服务状态:0启用,1停用 + PackageTotalSms string // 套餐短信总条数 + UsedSms string // 已用短信条数 + VoiceServiceStatus string // 语音服务状态:0启用,1停用 + PackageTotalVoice string // 套餐语音总分钟数 + UsedVoice string // 已用语音分钟数 + RoamServiceStatus string // 国漫服务状态:0启用,1停用 + PackageTotalRoamFlowMb string // 套餐国际流量MB + UsedRoamFlowMb string // 已用国际流量MB + StatusSyncTime string // 状态最后一次同步时间 + FlowSyncTime string // 流量最后一次同步时间 + SmsSyncTime string // 短信最后一次同步时间 + VoiceSyncTime string // 语音最后一次同步时间 + RoamSyncTime string // 国漫最后一次同步时间 + ExtraFeeEnabled string // 是否收取附加费:0是,1否 + ExtraFeeMultiple string // 附加费用倍数 + ExtraFee string // 附加金额 + ChanKey string // 通道编号 + NetModel string // 网络类型 枚举 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimCardCancellationColumns holds the columns for the table t_sim_card_cancellation. +var tSimCardCancellationColumns = TSimCardCancellationColumns{ + Id: "id", + Iccid: "iccid", + Msisdn: "msisdn", + Imsi: "imsi", + Imei: "imei", + RegionCode: "region_code", + DeptId: "dept_id", + CurrentPackageCode: "current_package_code", + PackageStatus: "package_status", + AccessType: "access_type", + BossCardStatus: "boss_card_status", + CancelBatchNo: "cancel_batch_no", + CancelledAt: "cancelled_at", + CardType: "card_type", + BossOpenAt: "boss_open_at", + BossActivateAt: "boss_activate_at", + IsBossActivateEnabled: "is_boss_activate_enabled", + InboundBatchNo: "inbound_batch_no", + OutboundBatchNo: "outbound_batch_no", + AllocationBatchNo: "allocation_batch_no", + IsFlowPool: "is_flow_pool", + FlowPoolCode: "flow_pool_code", + FlowPkgBeginAt: "flow_pkg_begin_at", + FlowPkgPresentAt: "flow_pkg_present_at", + FlowPkgRealPresentAt: "flow_pkg_real_present_at", + FlowPkgEndAt: "flow_pkg_end_at", + DataServiceStatus: "data_service_status", + PackageTotalFlowMb: "package_total_flow_mb", + UsedFlowMb: "used_flow_mb", + TrafficCutoffStatus: "traffic_cutoff_status", + TrafficCutoffThreshold: "traffic_cutoff_threshold", + SmsServiceStatus: "sms_service_status", + PackageTotalSms: "package_total_sms", + UsedSms: "used_sms", + VoiceServiceStatus: "voice_service_status", + PackageTotalVoice: "package_total_voice", + UsedVoice: "used_voice", + RoamServiceStatus: "roam_service_status", + PackageTotalRoamFlowMb: "package_total_roam_flow_mb", + UsedRoamFlowMb: "used_roam_flow_mb", + StatusSyncTime: "status_sync_time", + FlowSyncTime: "flow_sync_time", + SmsSyncTime: "sms_sync_time", + VoiceSyncTime: "voice_sync_time", + RoamSyncTime: "roam_sync_time", + ExtraFeeEnabled: "extra_fee_enabled", + ExtraFeeMultiple: "extra_fee_multiple", + ExtraFee: "extra_fee", + ChanKey: "chan_key", + NetModel: "net_model", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimCardCancellationDao creates and returns a new DAO object for table data access. +func NewTSimCardCancellationDao(handlers ...gdb.ModelHandler) *TSimCardCancellationDao { + return &TSimCardCancellationDao{ + group: "default", + table: "t_sim_card_cancellation", + columns: tSimCardCancellationColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimCardCancellationDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimCardCancellationDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimCardCancellationDao) Columns() TSimCardCancellationColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimCardCancellationDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimCardCancellationDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimCardCancellationDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_card_info.go b/server/internal/dao/internal/t_sim_card_info.go new file mode 100644 index 0000000..ee05722 --- /dev/null +++ b/server/internal/dao/internal/t_sim_card_info.go @@ -0,0 +1,189 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimCardInfoDao is the data access object for the table t_sim_card_info. +type TSimCardInfoDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimCardInfoColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimCardInfoColumns defines and stores column names for the table t_sim_card_info. +type TSimCardInfoColumns struct { + Id string // 主键ID + Iccid string // ICCID + Msisdn string // MSISDN/卡号 + Imsi string // IMSI + Imei string // IMEI + RegionCode string // 归属地 + DeptId string // 渠道客户ID + CurrentPackageCode string // 当前套餐编号 + PackageStatus string // 套餐状态:0 无套餐,1待生效,2生效中,3已过期 + AccessType string // 接入方式:ipv4、ipv6、ipv4_ipv6 + BossCardStatus string // 运营商卡状态 枚举 + CardType string // 卡类型 枚举 + BossOpenAt string // 运营商开户日期 + BossActivateAt string // 运营商激活日期 + IsBossActivateEnabled string // 是否按运营商激活减去赠送时长方:1是,0否 + InboundBatchNo string // 入库批次 + OutboundBatchNo string // 出库批次 + AllocationBatchNo string // 划拨批次 + IsFlowPool string // 是否为池卡:1是,0否 + FlowPoolCode string // 流量池编号 + OutStockTime string // 出库时间 + FlowPkgBeginAt string // 当前套餐生效时间 + FlowPkgPresentAt string // 套餐赠送结束时间 + FlowPkgRealPresentAt string // 实际赠送结束时间 + FlowPkgEndAt string // 当前套餐预计到期时间 + DataServiceStatus string // 数据服务状态:1启用、0禁用 + PackageTotalFlowMb string // 套餐总流量MB + UsedFlowMb string // 已用流量MB + TrafficCutoffStatus string // 达量断网配置状态:0未配置,1已开启,2已关闭 + TrafficCutoffThreshold string // 达量断网阈值 + SmsServiceStatus string // 短信服务状态:1启用、0禁用 + PackageTotalSms string // 套餐短信总条数 + UsedSms string // 已用短信条数 + VoiceServiceStatus string // 语音服务状态:1启用、0禁用 + PackageTotalVoice string // 套餐语音总分钟数 + UsedVoice string // 已用语音分钟数 + RoamServiceStatus string // 国漫服务状态:1启用、0禁用 + PackageTotalRoamFlowMb string // 套餐国际流量MB + UsedRoamFlowMb string // 已用国际流量MB + StatusSyncTime string // 状态最后一次同步时间 + FlowSyncTime string // 流量最后一次同步时间 + SmsSyncTime string // 短信最后一次同步时间 + VoiceSyncTime string // 语音最后一次同步时间 + RoamSyncTime string // 国漫最后一次同步时间 + ExtraFeeEnabled string // 是否收取附加费:1是,0否 + ExtraFeeMultiple string // 附加费用倍数 + ExtraFee string // 附加金额 + ChanKey string // 通道编号 + NetModel string // 网络类型:4G、5G、NB-IoT + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimCardInfoColumns holds the columns for the table t_sim_card_info. +var tSimCardInfoColumns = TSimCardInfoColumns{ + Id: "id", + Iccid: "iccid", + Msisdn: "msisdn", + Imsi: "imsi", + Imei: "imei", + RegionCode: "region_code", + DeptId: "dept_id", + CurrentPackageCode: "current_package_code", + PackageStatus: "package_status", + AccessType: "access_type", + BossCardStatus: "boss_card_status", + CardType: "card_type", + BossOpenAt: "boss_open_at", + BossActivateAt: "boss_activate_at", + IsBossActivateEnabled: "is_boss_activate_enabled", + InboundBatchNo: "inbound_batch_no", + OutboundBatchNo: "outbound_batch_no", + AllocationBatchNo: "allocation_batch_no", + IsFlowPool: "is_flow_pool", + FlowPoolCode: "flow_pool_code", + OutStockTime: "out_stock_time", + FlowPkgBeginAt: "flow_pkg_begin_at", + FlowPkgPresentAt: "flow_pkg_present_at", + FlowPkgRealPresentAt: "flow_pkg_real_present_at", + FlowPkgEndAt: "flow_pkg_end_at", + DataServiceStatus: "data_service_status", + PackageTotalFlowMb: "package_total_flow_mb", + UsedFlowMb: "used_flow_mb", + TrafficCutoffStatus: "traffic_cutoff_status", + TrafficCutoffThreshold: "traffic_cutoff_threshold", + SmsServiceStatus: "sms_service_status", + PackageTotalSms: "package_total_sms", + UsedSms: "used_sms", + VoiceServiceStatus: "voice_service_status", + PackageTotalVoice: "package_total_voice", + UsedVoice: "used_voice", + RoamServiceStatus: "roam_service_status", + PackageTotalRoamFlowMb: "package_total_roam_flow_mb", + UsedRoamFlowMb: "used_roam_flow_mb", + StatusSyncTime: "status_sync_time", + FlowSyncTime: "flow_sync_time", + SmsSyncTime: "sms_sync_time", + VoiceSyncTime: "voice_sync_time", + RoamSyncTime: "roam_sync_time", + ExtraFeeEnabled: "extra_fee_enabled", + ExtraFeeMultiple: "extra_fee_multiple", + ExtraFee: "extra_fee", + ChanKey: "chan_key", + NetModel: "net_model", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimCardInfoDao creates and returns a new DAO object for table data access. +func NewTSimCardInfoDao(handlers ...gdb.ModelHandler) *TSimCardInfoDao { + return &TSimCardInfoDao{ + group: "default", + table: "t_sim_card_info", + columns: tSimCardInfoColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimCardInfoDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimCardInfoDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimCardInfoDao) Columns() TSimCardInfoColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimCardInfoDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimCardInfoDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimCardInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_card_stock.go b/server/internal/dao/internal/t_sim_card_stock.go new file mode 100644 index 0000000..744b7f8 --- /dev/null +++ b/server/internal/dao/internal/t_sim_card_stock.go @@ -0,0 +1,103 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimCardStockDao is the data access object for the table t_sim_card_stock. +type TSimCardStockDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimCardStockColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimCardStockColumns defines and stores column names for the table t_sim_card_stock. +type TSimCardStockColumns struct { + Id string // 主键ID + BatchNo string // + Iccid string // ICCID + Msisdn string // MSISDN + Imsi string // IMSI + Imei string // IMEI + ChanKey string // 通道编号 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimCardStockColumns holds the columns for the table t_sim_card_stock. +var tSimCardStockColumns = TSimCardStockColumns{ + Id: "id", + BatchNo: "batch_no", + Iccid: "iccid", + Msisdn: "msisdn", + Imsi: "imsi", + Imei: "imei", + ChanKey: "chan_key", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimCardStockDao creates and returns a new DAO object for table data access. +func NewTSimCardStockDao(handlers ...gdb.ModelHandler) *TSimCardStockDao { + return &TSimCardStockDao{ + group: "default", + table: "t_sim_card_stock", + columns: tSimCardStockColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimCardStockDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimCardStockDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimCardStockDao) Columns() TSimCardStockColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimCardStockDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimCardStockDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimCardStockDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_channel_template.go b/server/internal/dao/internal/t_sim_channel_template.go new file mode 100644 index 0000000..168c1a5 --- /dev/null +++ b/server/internal/dao/internal/t_sim_channel_template.go @@ -0,0 +1,103 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimChannelTemplateDao is the data access object for the table t_sim_channel_template. +type TSimChannelTemplateDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimChannelTemplateColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimChannelTemplateColumns defines and stores column names for the table t_sim_channel_template. +type TSimChannelTemplateColumns struct { + Id string // ID + TempKey string // 模板标识 + TempName string // 模板名称 + TempModel string // 模板模型 + TempConfig string // 模板配置 + TempStatus string // 模板状态(0未启用,1启用) + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimChannelTemplateColumns holds the columns for the table t_sim_channel_template. +var tSimChannelTemplateColumns = TSimChannelTemplateColumns{ + Id: "id", + TempKey: "temp_key", + TempName: "temp_name", + TempModel: "temp_model", + TempConfig: "temp_config", + TempStatus: "temp_status", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimChannelTemplateDao creates and returns a new DAO object for table data access. +func NewTSimChannelTemplateDao(handlers ...gdb.ModelHandler) *TSimChannelTemplateDao { + return &TSimChannelTemplateDao{ + group: "default", + table: "t_sim_channel_template", + columns: tSimChannelTemplateColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimChannelTemplateDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimChannelTemplateDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimChannelTemplateDao) Columns() TSimChannelTemplateColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimChannelTemplateDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimChannelTemplateDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimChannelTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_channels.go b/server/internal/dao/internal/t_sim_channels.go new file mode 100644 index 0000000..64246de --- /dev/null +++ b/server/internal/dao/internal/t_sim_channels.go @@ -0,0 +1,141 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimChannelsDao is the data access object for the table t_sim_channels. +type TSimChannelsDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimChannelsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimChannelsColumns defines and stores column names for the table t_sim_channels. +type TSimChannelsColumns struct { + Operator string // 运营商:1移动,2联通,3电信 + Id string // ID + TempKey string // 模板标识 + SyncEnabled string // 是否轮询:0是(参与) 1否(不参与) + ChanKey string // 通道编号 + ChanName string // 通道名称 + ChanConfig string // 通道配置 + ChanStatus string // 通道状态(0启用,1停用, 2未申请, 3申请中, 4接口信息不全) + ShareEnabled string // 是否开放共享Token(0否,1是) + IsNormal string // 是否正常(0是,1否) + DockingStatus string // 对接信息(0接口信息不全,1接口申请中,2不需要对接,3已对接,4未申请,5接口订阅不全) + ChanAlias string // 通道别名 + RegionCode string // 通道行政区域代码(省市) + AppKey string // 应用标识 + AppSecret string // 应用密钥 + AccessToken string // 接口调用凭证 + AccessTokenCreated string // 凭证申请时间 + AccessTokenExpire string // 凭证过期时间 + RefreshToken string // 刷新凭证 + LoginUser string // 登录账号 + LoginPassword string // 登录密码 + LoginUrl string // 登录地址 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + StockCardCount string // 库存卡数量 + CardInfoCount string // 卡信息数量 + CancellationCardCount string // 销户卡数量 +} + +// tSimChannelsColumns holds the columns for the table t_sim_channels. +var tSimChannelsColumns = TSimChannelsColumns{ + Operator: "operator", + Id: "id", + TempKey: "temp_key", + SyncEnabled: "sync_enabled", + ChanKey: "chan_key", + ChanName: "chan_name", + ChanConfig: "chan_config", + ChanStatus: "chan_status", + ShareEnabled: "share_enabled", + IsNormal: "is_normal", + DockingStatus: "docking_status", + ChanAlias: "chan_alias", + RegionCode: "region_code", + AppKey: "app_key", + AppSecret: "app_secret", + AccessToken: "access_token", + AccessTokenCreated: "access_token_created", + AccessTokenExpire: "access_token_expire", + RefreshToken: "refresh_token", + LoginUser: "login_user", + LoginPassword: "login_password", + LoginUrl: "login_url", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + StockCardCount: "stock_card_count", + CardInfoCount: "card_info_count", + CancellationCardCount: "cancellation_card_count", +} + +// NewTSimChannelsDao creates and returns a new DAO object for table data access. +func NewTSimChannelsDao(handlers ...gdb.ModelHandler) *TSimChannelsDao { + return &TSimChannelsDao{ + group: "default", + table: "t_sim_channels", + columns: tSimChannelsColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimChannelsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimChannelsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimChannelsDao) Columns() TSimChannelsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimChannelsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimChannelsDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimChannelsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_flow_package_info.go b/server/internal/dao/internal/t_sim_flow_package_info.go new file mode 100644 index 0000000..9ee7773 --- /dev/null +++ b/server/internal/dao/internal/t_sim_flow_package_info.go @@ -0,0 +1,143 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimFlowPackageInfoDao is the data access object for the table t_sim_flow_package_info. +type TSimFlowPackageInfoDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimFlowPackageInfoColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimFlowPackageInfoColumns defines and stores column names for the table t_sim_flow_package_info. +type TSimFlowPackageInfoColumns struct { + Id string // 主键ID + PackageCode string // 套餐编码 + CategoryCode string // 套餐分类编码 + PoolPackageCode string // 池套餐编码 + PackageName string // 套餐名称 + PackageType string // 套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包 + BillingMethod string // 计费方式 + SortNo string // 排序号 + FlowMb string // 套餐流量(MB) + FlowGb string // 套餐流量(GB) + Enabled string // 是否启用:0-否 1-是(yesno_enum) + ListPrice string // 目录售价 + CostPrice string // 成本价 + SysDefaultProfit string // 系统默认利润 + SysDefaultRatio string // 系统默认系数 + TerminalCost string // 终端成本 + SysDefaultTerminalProfit string // 系统默认终端利润 + SysDefaultTerminalRatio string // 系统默认终端系数 + RenewableDurationConfig string // 可续费时长配置:[1,2,3] + DiscountRateConfig string // 折扣率配置:{"duration":1,"rate":100} + RenewablePackageCodes string // 可续费套餐编码列表 + ChangeablePackageCodes string // 可变更套餐编码列表 + TopupPackageCodes string // 可订购加油包套餐编码列表 + IsAutoRenew string // 是否自动续费:0-否 1-是 + AutoRenewPackageId string // 自动续费套餐ID + AutoRenewYears string // 自动续费年限 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tSimFlowPackageInfoColumns holds the columns for the table t_sim_flow_package_info. +var tSimFlowPackageInfoColumns = TSimFlowPackageInfoColumns{ + Id: "id", + PackageCode: "package_code", + CategoryCode: "category_code", + PoolPackageCode: "pool_package_code", + PackageName: "package_name", + PackageType: "package_type", + BillingMethod: "billing_method", + SortNo: "sort_no", + FlowMb: "flow_mb", + FlowGb: "flow_gb", + Enabled: "enabled", + ListPrice: "list_price", + CostPrice: "cost_price", + SysDefaultProfit: "sys_default_profit", + SysDefaultRatio: "sys_default_ratio", + TerminalCost: "terminal_cost", + SysDefaultTerminalProfit: "sys_default_terminal_profit", + SysDefaultTerminalRatio: "sys_default_terminal_ratio", + RenewableDurationConfig: "renewable_duration_config", + DiscountRateConfig: "discount_rate_config", + RenewablePackageCodes: "renewable_package_codes", + ChangeablePackageCodes: "changeable_package_codes", + TopupPackageCodes: "topup_package_codes", + IsAutoRenew: "is_auto_renew", + AutoRenewPackageId: "auto_renew_package_id", + AutoRenewYears: "auto_renew_years", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimFlowPackageInfoDao creates and returns a new DAO object for table data access. +func NewTSimFlowPackageInfoDao(handlers ...gdb.ModelHandler) *TSimFlowPackageInfoDao { + return &TSimFlowPackageInfoDao{ + group: "default", + table: "t_sim_flow_package_info", + columns: tSimFlowPackageInfoColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimFlowPackageInfoDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimFlowPackageInfoDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimFlowPackageInfoDao) Columns() TSimFlowPackageInfoColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimFlowPackageInfoDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimFlowPackageInfoDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimFlowPackageInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_flow_package_price.go b/server/internal/dao/internal/t_sim_flow_package_price.go new file mode 100644 index 0000000..a709a3e --- /dev/null +++ b/server/internal/dao/internal/t_sim_flow_package_price.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimFlowPackagePriceDao is the data access object for the table t_sim_flow_package_price. +type TSimFlowPackagePriceDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimFlowPackagePriceColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimFlowPackagePriceColumns defines and stores column names for the table t_sim_flow_package_price. +type TSimFlowPackagePriceColumns struct { + Id string // 主键ID + PackageCode string // 套餐编码 + AgentScopeType string // 渠道适用类型:0-所有客户 1-指定客户 + TargetAgentId string // 指定渠道客户ID + DeptId string // 机构编号 + AgentCostRatio string // 渠道成本系数 + AgentCostProfit string // 渠道成本利润 + UserCostRatio string // 终端用户成本系数 + UserCostProfit string // 终端用户成本利润 + Enabled string // 是否启用:0-否 1-是(yesno_enum) + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门ID + CreatedBy string // 创建者ID + CreatedAt string // 创建时间 + UpdatedBy string // 更新者ID + UpdatedAt string // 更新时间 +} + +// tSimFlowPackagePriceColumns holds the columns for the table t_sim_flow_package_price. +var tSimFlowPackagePriceColumns = TSimFlowPackagePriceColumns{ + Id: "id", + PackageCode: "package_code", + AgentScopeType: "agent_scope_type", + TargetAgentId: "target_agent_id", + DeptId: "dept_id", + AgentCostRatio: "agent_cost_ratio", + AgentCostProfit: "agent_cost_profit", + UserCostRatio: "user_cost_ratio", + UserCostProfit: "user_cost_profit", + Enabled: "enabled", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimFlowPackagePriceDao creates and returns a new DAO object for table data access. +func NewTSimFlowPackagePriceDao(handlers ...gdb.ModelHandler) *TSimFlowPackagePriceDao { + return &TSimFlowPackagePriceDao{ + group: "default", + table: "t_sim_flow_package_price", + columns: tSimFlowPackagePriceColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimFlowPackagePriceDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimFlowPackagePriceDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimFlowPackagePriceDao) Columns() TSimFlowPackagePriceColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimFlowPackagePriceDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimFlowPackagePriceDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimFlowPackagePriceDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_flow_pool.go b/server/internal/dao/internal/t_sim_flow_pool.go new file mode 100644 index 0000000..5208c20 --- /dev/null +++ b/server/internal/dao/internal/t_sim_flow_pool.go @@ -0,0 +1,117 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimFlowPoolDao is the data access object for the table t_sim_flow_pool. +type TSimFlowPoolDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimFlowPoolColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimFlowPoolColumns defines and stores column names for the table t_sim_flow_pool. +type TSimFlowPoolColumns struct { + Id string // 主键ID + FlowPoolCode string // 流量池编号 + DeptId string // 客户编号 + PackageCodes string // 套餐编号列表(冗余) + PoolPackageCode string // 池套餐编码 + CardCount string // 关联卡数量 + CardFlowMb string // 套餐卡流量MB + PoolPackageFlowMb string // 套内总流量MB + AddOnFlowMb string // 加油包总流量MB + TotalFlowMb string // 总流量MB(套内+加油包) + UsedFlowMb string // 已使用流量MB + RemainFlowMb string // 剩余流量MB + PoolStatus string // 状态:0 正常、1 停用、2 锁定 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimFlowPoolColumns holds the columns for the table t_sim_flow_pool. +var tSimFlowPoolColumns = TSimFlowPoolColumns{ + Id: "id", + FlowPoolCode: "flow_pool_code", + DeptId: "dept_id", + PackageCodes: "package_codes", + PoolPackageCode: "pool_package_code", + CardCount: "card_count", + CardFlowMb: "card_flow_mb", + PoolPackageFlowMb: "pool_package_flow_mb", + AddOnFlowMb: "add_on_flow_mb", + TotalFlowMb: "total_flow_mb", + UsedFlowMb: "used_flow_mb", + RemainFlowMb: "remain_flow_mb", + PoolStatus: "pool_status", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimFlowPoolDao creates and returns a new DAO object for table data access. +func NewTSimFlowPoolDao(handlers ...gdb.ModelHandler) *TSimFlowPoolDao { + return &TSimFlowPoolDao{ + group: "default", + table: "t_sim_flow_pool", + columns: tSimFlowPoolColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimFlowPoolDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimFlowPoolDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimFlowPoolDao) Columns() TSimFlowPoolColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimFlowPoolDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimFlowPoolDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimFlowPoolDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_package_category.go b/server/internal/dao/internal/t_sim_package_category.go new file mode 100644 index 0000000..39d5703 --- /dev/null +++ b/server/internal/dao/internal/t_sim_package_category.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimPackageCategoryDao is the data access object for the table t_sim_package_category. +type TSimPackageCategoryDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimPackageCategoryColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimPackageCategoryColumns defines and stores column names for the table t_sim_package_category. +type TSimPackageCategoryColumns struct { + Id string // 主键ID + CategoryCode string // 套餐分类编号 + CategoryName string // 套餐分类名称 + SortNo string // 排序 + Enabled string // 是否启用:1启用,0停用 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimPackageCategoryColumns holds the columns for the table t_sim_package_category. +var tSimPackageCategoryColumns = TSimPackageCategoryColumns{ + Id: "id", + CategoryCode: "category_code", + CategoryName: "category_name", + SortNo: "sort_no", + Enabled: "enabled", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimPackageCategoryDao creates and returns a new DAO object for table data access. +func NewTSimPackageCategoryDao(handlers ...gdb.ModelHandler) *TSimPackageCategoryDao { + return &TSimPackageCategoryDao{ + group: "default", + table: "t_sim_package_category", + columns: tSimPackageCategoryColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimPackageCategoryDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimPackageCategoryDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimPackageCategoryDao) Columns() TSimPackageCategoryColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimPackageCategoryDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimPackageCategoryDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimPackageCategoryDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_pool.go b/server/internal/dao/internal/t_sim_pool.go new file mode 100644 index 0000000..dad1053 --- /dev/null +++ b/server/internal/dao/internal/t_sim_pool.go @@ -0,0 +1,117 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimPoolDao is the data access object for the table t_sim_pool. +type TSimPoolDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimPoolColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimPoolColumns defines and stores column names for the table t_sim_pool. +type TSimPoolColumns struct { + Id string // 主键ID + FlowPoolCode string // 流量池编号 + DeptId string // 客户编号 + PackageCodes string // 套餐编号列表(冗余) + PoolPackageCode string // 池套餐编码 + CardCount string // 关联卡数量 + CardFlowMb string // 套餐卡流量MB + PoolPackageFlowMb string // 套内总流量MB + AddOnFlowMb string // 加油包总流量MB + TotalFlowMb string // 总流量MB(套内+加油包) + UsedFlowMb string // 已使用流量MB + RemainFlowMb string // 剩余流量MB + Status string // 状态:0 正常、1 停用、2 锁定 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimPoolColumns holds the columns for the table t_sim_pool. +var tSimPoolColumns = TSimPoolColumns{ + Id: "id", + FlowPoolCode: "flow_pool_code", + DeptId: "dept_id", + PackageCodes: "package_codes", + PoolPackageCode: "pool_package_code", + CardCount: "card_count", + CardFlowMb: "card_flow_mb", + PoolPackageFlowMb: "pool_package_flow_mb", + AddOnFlowMb: "add_on_flow_mb", + TotalFlowMb: "total_flow_mb", + UsedFlowMb: "used_flow_mb", + RemainFlowMb: "remain_flow_mb", + Status: "status", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimPoolDao creates and returns a new DAO object for table data access. +func NewTSimPoolDao(handlers ...gdb.ModelHandler) *TSimPoolDao { + return &TSimPoolDao{ + group: "default", + table: "t_sim_pool", + columns: tSimPoolColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimPoolDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimPoolDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimPoolDao) Columns() TSimPoolColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimPoolDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimPoolDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimPoolDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_pool_bind_package.go b/server/internal/dao/internal/t_sim_pool_bind_package.go new file mode 100644 index 0000000..35841e1 --- /dev/null +++ b/server/internal/dao/internal/t_sim_pool_bind_package.go @@ -0,0 +1,125 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimPoolBindPackageDao is the data access object for the table t_sim_pool_bind_package. +type TSimPoolBindPackageDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimPoolBindPackageColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimPoolBindPackageColumns defines and stores column names for the table t_sim_pool_bind_package. +type TSimPoolBindPackageColumns struct { + Id string // 主键ID + SubscriptionNo string // 订购记录编号 + BatchNo string // 批次编号 + PoolNo string // 流量池编号 + DeptId string // 部门机构编号 + PackageType string // 套餐类型 + PackageCode string // 套餐编号 + PreviousPackageCode string // 变更前套餐编号 + BusinessType string // 类型 枚举 + EffectiveStatus string // 订购状态 枚举 + HandleTime string // 办理时间 + EffectiveTime string // 生效时间 + ExpectedExpireTime string // 预计到期时间 + ActualExpireTime string // 实际到期时间 + DurationMonths string // 套餐时长(月) + GiftDurationMonths string // 赠送时长(月) + OrderCode string // 订单编号 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimPoolBindPackageColumns holds the columns for the table t_sim_pool_bind_package. +var tSimPoolBindPackageColumns = TSimPoolBindPackageColumns{ + Id: "id", + SubscriptionNo: "subscription_no", + BatchNo: "batch_no", + PoolNo: "pool_no", + DeptId: "dept_id", + PackageType: "package_type", + PackageCode: "package_code", + PreviousPackageCode: "previous_package_code", + BusinessType: "business_type", + EffectiveStatus: "effective_status", + HandleTime: "handle_time", + EffectiveTime: "effective_time", + ExpectedExpireTime: "expected_expire_time", + ActualExpireTime: "actual_expire_time", + DurationMonths: "duration_months", + GiftDurationMonths: "gift_duration_months", + OrderCode: "order_code", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimPoolBindPackageDao creates and returns a new DAO object for table data access. +func NewTSimPoolBindPackageDao(handlers ...gdb.ModelHandler) *TSimPoolBindPackageDao { + return &TSimPoolBindPackageDao{ + group: "default", + table: "t_sim_pool_bind_package", + columns: tSimPoolBindPackageColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimPoolBindPackageDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimPoolBindPackageDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimPoolBindPackageDao) Columns() TSimPoolBindPackageColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimPoolBindPackageDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimPoolBindPackageDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimPoolBindPackageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_pool_warn_config.go b/server/internal/dao/internal/t_sim_pool_warn_config.go new file mode 100644 index 0000000..2f4a8c4 --- /dev/null +++ b/server/internal/dao/internal/t_sim_pool_warn_config.go @@ -0,0 +1,109 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TSimPoolWarnConfigDao is the data access object for the table t_sim_pool_warn_config. +type TSimPoolWarnConfigDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TSimPoolWarnConfigColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TSimPoolWarnConfigColumns defines and stores column names for the table t_sim_pool_warn_config. +type TSimPoolWarnConfigColumns struct { + Id string // 主键ID + PoolId string // 流量池ID + WarnLevel string // 预警等级:1提示,2注意,3警告,4危险,5紧急 + ThresholdPercent string // 阈值(例如0.7) + WarnMethods string // 预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔 + WarnPhones string // 预警手机号 多个逗号分隔 + WarnEmails string // 预警邮箱 多个逗号分隔 + AutoAction string // 自动动作:0无,1限速,2断网 + IsEnabled string // 是否启用:1启用,0停用 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimPoolWarnConfigColumns holds the columns for the table t_sim_pool_warn_config. +var tSimPoolWarnConfigColumns = TSimPoolWarnConfigColumns{ + Id: "id", + PoolId: "pool_id", + WarnLevel: "warn_level", + ThresholdPercent: "threshold_percent", + WarnMethods: "warn_methods", + WarnPhones: "warn_phones", + WarnEmails: "warn_emails", + AutoAction: "auto_action", + IsEnabled: "is_enabled", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTSimPoolWarnConfigDao creates and returns a new DAO object for table data access. +func NewTSimPoolWarnConfigDao(handlers ...gdb.ModelHandler) *TSimPoolWarnConfigDao { + return &TSimPoolWarnConfigDao{ + group: "default", + table: "t_sim_pool_warn_config", + columns: tSimPoolWarnConfigColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TSimPoolWarnConfigDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TSimPoolWarnConfigDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TSimPoolWarnConfigDao) Columns() TSimPoolWarnConfigColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TSimPoolWarnConfigDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TSimPoolWarnConfigDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TSimPoolWarnConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_sim_upstream_package.go b/server/internal/dao/internal/t_sim_upstream_package.go new file mode 100644 index 0000000..9034408 --- /dev/null +++ b/server/internal/dao/internal/t_sim_upstream_package.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TUpstreamPackageDao is the data access object for the table t_sim_upstream_package. +type TUpstreamPackageDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TUpstreamPackageColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TUpstreamPackageColumns defines and stores column names for the table t_sim_upstream_package. +type TUpstreamPackageColumns struct { + Id string // 主键 + UpPkgCode string // 上游套餐编码 + UpPkgName string // 上游套餐名称 + Operator string // 运营商:1移动,2联通,3电信 + ApnName string // APN名称 + Remark string // 备注 + CreatedDept string // 创建部门 + CreatedAt string // 创建时间 + CreatedBy string // 创建者 + UpdatedAt string // 更新时间 + UpdatedBy string // 更新者 +} + +// tUpstreamPackageColumns holds the columns for the table t_sim_upstream_package. +var tUpstreamPackageColumns = TUpstreamPackageColumns{ + Id: "id", + UpPkgCode: "up_pkg_code", + UpPkgName: "up_pkg_name", + Operator: "operator", + ApnName: "apn_name", + Remark: "remark", + CreatedDept: "created_dept", + CreatedAt: "created_at", + CreatedBy: "created_by", + UpdatedAt: "updated_at", + UpdatedBy: "updated_by", +} + +// NewTUpstreamPackageDao creates and returns a new DAO object for table data access. +func NewTUpstreamPackageDao(handlers ...gdb.ModelHandler) *TUpstreamPackageDao { + return &TUpstreamPackageDao{ + group: "default", + table: "t_sim_upstream_package", + columns: tUpstreamPackageColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TUpstreamPackageDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TUpstreamPackageDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TUpstreamPackageDao) Columns() TUpstreamPackageColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TUpstreamPackageDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TUpstreamPackageDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TUpstreamPackageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_tplatform_setting.go b/server/internal/dao/internal/t_tplatform_setting.go new file mode 100644 index 0000000..0fb27f2 --- /dev/null +++ b/server/internal/dao/internal/t_tplatform_setting.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TTplatformSettingDao is the data access object for the table t_tplatform_setting. +type TTplatformSettingDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TTplatformSettingColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TTplatformSettingColumns defines and stores column names for the table t_tplatform_setting. +type TTplatformSettingColumns struct { + Id string // 主键ID + SubDomain string // 二级域名前缀 + FullDomain string // 完整域名 + AppTitle string // 平台标题 + AppIcon string // 图标地址 + LoginPageTitle string // 登录页大标题 + LoginPageDescription string // 登录页描述文案 + LoginSloganImage string // 登录标语图地址 + Sort string // 排序 + Status string // 状态 0启用 1禁用 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tTplatformSettingColumns holds the columns for the table t_tplatform_setting. +var tTplatformSettingColumns = TTplatformSettingColumns{ + Id: "id", + SubDomain: "sub_domain", + FullDomain: "full_domain", + AppTitle: "app_title", + AppIcon: "app_icon", + LoginPageTitle: "login_page_title", + LoginPageDescription: "login_page_description", + LoginSloganImage: "login_slogan_image", + Sort: "sort", + Status: "status", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTTplatformSettingDao creates and returns a new DAO object for table data access. +func NewTTplatformSettingDao(handlers ...gdb.ModelHandler) *TTplatformSettingDao { + return &TTplatformSettingDao{ + group: "default", + table: "t_tplatform_setting", + columns: tTplatformSettingColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TTplatformSettingDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TTplatformSettingDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TTplatformSettingDao) Columns() TTplatformSettingColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TTplatformSettingDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TTplatformSettingDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TTplatformSettingDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_user_message.go b/server/internal/dao/internal/t_user_message.go new file mode 100644 index 0000000..9f387ab --- /dev/null +++ b/server/internal/dao/internal/t_user_message.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TUserMessageDao is the data access object for the table t_user_message. +type TUserMessageDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TUserMessageColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TUserMessageColumns defines and stores column names for the table t_user_message. +type TUserMessageColumns struct { + MessageId string // 主键ID + MessageLogId string // 消息日志ID + UserId string // 用户ID + IsRead string // 是否已读 0未读 1已读 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tUserMessageColumns holds the columns for the table t_user_message. +var tUserMessageColumns = TUserMessageColumns{ + MessageId: "message_id", + MessageLogId: "message_log_id", + UserId: "user_id", + IsRead: "is_read", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTUserMessageDao creates and returns a new DAO object for table data access. +func NewTUserMessageDao(handlers ...gdb.ModelHandler) *TUserMessageDao { + return &TUserMessageDao{ + group: "default", + table: "t_user_message", + columns: tUserMessageColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TUserMessageDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TUserMessageDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TUserMessageDao) Columns() TUserMessageColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TUserMessageDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TUserMessageDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TUserMessageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_warn_config.go b/server/internal/dao/internal/t_warn_config.go new file mode 100644 index 0000000..1747b93 --- /dev/null +++ b/server/internal/dao/internal/t_warn_config.go @@ -0,0 +1,123 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TWarnConfigDao is the data access object for the table t_warn_config. +type TWarnConfigDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TWarnConfigColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TWarnConfigColumns defines and stores column names for the table t_warn_config. +type TWarnConfigColumns struct { + Id string // 主键ID + TenantId string // 租户ID + BatchNo string // 批次编号 + ItemType string // 对象类型:1卡,2流量池 + ItemId string // 对象ID:单卡为t_sim_card_info.id,流量池为t_sim_flow_pool.id + ItemCode string // 对象编码快照:ICCID/MSISDN/流量池编码 + WarnUnit string // 预警单位:1MB,2百分比,3天数,4月数 + FirstWarn string // 第一档预警阈值,单位由warn_unit决定 + SecondWarn string // 第二档预警阈值,单位由warn_unit决定 + ThirdWarn string // 第三档预警阈值,单位由warn_unit决定 + WarnMethods string // 预警方式:0短信,1邮箱,2电话,3平台消息;多选逗号分隔 + WarnPhones string // 预警手机号,多个逗号分隔 + WarnEmails string // 预警邮箱,多个逗号分隔 + AutoAction string // 自动动作:0无,2断网;第一期只保存配置不自动执行 + IsEnabled string // 是否启用:1启用,0停用 + WxTemplateId string // 微信订阅消息模板ID + Remark string // 备注 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 + AppNotifyEnabled string // 是否开启小程序预警通知:0关闭,1开启 +} + +// tWarnConfigColumns holds the columns for the table t_warn_config. +var tWarnConfigColumns = TWarnConfigColumns{ + Id: "id", + TenantId: "tenant_id", + BatchNo: "batch_no", + ItemType: "item_type", + ItemId: "item_id", + ItemCode: "item_code", + WarnUnit: "warn_unit", + FirstWarn: "first_warn", + SecondWarn: "second_warn", + ThirdWarn: "third_warn", + WarnMethods: "warn_methods", + WarnPhones: "warn_phones", + WarnEmails: "warn_emails", + AutoAction: "auto_action", + IsEnabled: "is_enabled", + WxTemplateId: "wx_template_id", + Remark: "remark", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", + AppNotifyEnabled: "app_notify_enabled", +} + +// NewTWarnConfigDao creates and returns a new DAO object for table data access. +func NewTWarnConfigDao(handlers ...gdb.ModelHandler) *TWarnConfigDao { + return &TWarnConfigDao{ + group: "default", + table: "t_warn_config", + columns: tWarnConfigColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TWarnConfigDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TWarnConfigDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TWarnConfigDao) Columns() TWarnConfigColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TWarnConfigDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TWarnConfigDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TWarnConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_warn_log.go b/server/internal/dao/internal/t_warn_log.go new file mode 100644 index 0000000..97cba18 --- /dev/null +++ b/server/internal/dao/internal/t_warn_log.go @@ -0,0 +1,125 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TWarnLogDao is the data access object for the table t_warn_log. +type TWarnLogDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TWarnLogColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TWarnLogColumns defines and stores column names for the table t_warn_log. +type TWarnLogColumns struct { + Id string // 主键ID + TenantId string // 租户ID + ConfigId string // 预警配置ID + ItemType string // 对象类型:1单卡,2流量池 + ItemId string // 对象ID:单卡为t_sim_card_info.id,流量池为t_sim_flow_pool.id + ItemCode string // 对象编码快照:ICCID/MSISDN/流量池编码 + WarnStage string // 触发档位:1第一档,2第二档,3第三档 + WarnLevel string // 预警级别:1提示,2注意,3警告,4危险,5紧急 + WarnUnit string // 预警单位/维度:1MB,2百分比,3天数,4月数 + ThresholdValue string // 触发阈值,单位由warn_unit决定 + ActualValue string // 触发时实际值,单位由warn_unit决定 + TotalFlowMb string // 触发时总流量MB;流量类预警使用 + RemainFlowMb string // 触发时剩余流量MB;流量类预警使用 + WarnMethods string // 实际预警方式快照 + WarnPhones string // 实际预警手机号快照 + WarnEmails string // 实际预警邮箱快照 + MessageLogId string // 平台消息ID;聚合通知时可能为空 + WarnTime string // 预警时间 + Remark string // 备注 + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tWarnLogColumns holds the columns for the table t_warn_log. +var tWarnLogColumns = TWarnLogColumns{ + Id: "id", + TenantId: "tenant_id", + ConfigId: "config_id", + ItemType: "item_type", + ItemId: "item_id", + ItemCode: "item_code", + WarnStage: "warn_stage", + WarnLevel: "warn_level", + WarnUnit: "warn_unit", + ThresholdValue: "threshold_value", + ActualValue: "actual_value", + TotalFlowMb: "total_flow_mb", + RemainFlowMb: "remain_flow_mb", + WarnMethods: "warn_methods", + WarnPhones: "warn_phones", + WarnEmails: "warn_emails", + MessageLogId: "message_log_id", + WarnTime: "warn_time", + Remark: "remark", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTWarnLogDao creates and returns a new DAO object for table data access. +func NewTWarnLogDao(handlers ...gdb.ModelHandler) *TWarnLogDao { + return &TWarnLogDao{ + group: "default", + table: "t_warn_log", + columns: tWarnLogColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TWarnLogDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TWarnLogDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TWarnLogDao) Columns() TWarnLogColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TWarnLogDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TWarnLogDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TWarnLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_wo_audit.go b/server/internal/dao/internal/t_wo_audit.go new file mode 100644 index 0000000..a53b9f0 --- /dev/null +++ b/server/internal/dao/internal/t_wo_audit.go @@ -0,0 +1,117 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TWoAuditDao is the data access object for the table t_wo_audit. +type TWoAuditDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TWoAuditColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TWoAuditColumns defines and stores column names for the table t_wo_audit. +type TWoAuditColumns struct { + Id string // 主键ID + AuditNo string // 审核编号 + WoId string // 工单ID + WoNo string // 工单编号 + AuditType string // 审核类型:0分派,1转派,2退回,3解决,4关闭,5废除 + AuditorType string // 审核人类型:1终端用户,2代理商,3客服 + AuditorDeptId string // 审核人机构ID + AuditorUserId string // 审核人用户ID + AuditorName string // 审核人姓名 + BeforeStatus string // 变更前状态 + AfterStatus string // 变更后状态 + AuditResult string // 审核结果:0通过,1驳回 + AuditOpinion string // 审核意见 + AuditTime string // 审核时间 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tWoAuditColumns holds the columns for the table t_wo_audit. +var tWoAuditColumns = TWoAuditColumns{ + Id: "id", + AuditNo: "audit_no", + WoId: "wo_id", + WoNo: "wo_no", + AuditType: "audit_type", + AuditorType: "auditor_type", + AuditorDeptId: "auditor_dept_id", + AuditorUserId: "auditor_user_id", + AuditorName: "auditor_name", + BeforeStatus: "before_status", + AfterStatus: "after_status", + AuditResult: "audit_result", + AuditOpinion: "audit_opinion", + AuditTime: "audit_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTWoAuditDao creates and returns a new DAO object for table data access. +func NewTWoAuditDao(handlers ...gdb.ModelHandler) *TWoAuditDao { + return &TWoAuditDao{ + group: "default", + table: "t_wo_audit", + columns: tWoAuditColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TWoAuditDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TWoAuditDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TWoAuditDao) Columns() TWoAuditColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TWoAuditDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TWoAuditDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TWoAuditDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_wo_communication.go b/server/internal/dao/internal/t_wo_communication.go new file mode 100644 index 0000000..c27765e --- /dev/null +++ b/server/internal/dao/internal/t_wo_communication.go @@ -0,0 +1,113 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TWoCommunicationDao is the data access object for the table t_wo_communication. +type TWoCommunicationDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TWoCommunicationColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TWoCommunicationColumns defines and stores column names for the table t_wo_communication. +type TWoCommunicationColumns struct { + Id string // 主键ID + CommNo string // 沟通编号 + WoId string // 工单ID + WoNo string // 工单编号 + CommType string // 沟通类型:0回复,1反馈 + SenderType string // 发送人类型:1终端用户,2代理商 + SenderDeptId string // 发送人机构ID + SenderUserId string // 发送人用户ID + SenderName string // 发送人姓名 + Content string // 沟通内容 + AttachmentUrls string // 附件URL列表 + CommTime string // 沟通时间 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tWoCommunicationColumns holds the columns for the table t_wo_communication. +var tWoCommunicationColumns = TWoCommunicationColumns{ + Id: "id", + CommNo: "comm_no", + WoId: "wo_id", + WoNo: "wo_no", + CommType: "comm_type", + SenderType: "sender_type", + SenderDeptId: "sender_dept_id", + SenderUserId: "sender_user_id", + SenderName: "sender_name", + Content: "content", + AttachmentUrls: "attachment_urls", + CommTime: "comm_time", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTWoCommunicationDao creates and returns a new DAO object for table data access. +func NewTWoCommunicationDao(handlers ...gdb.ModelHandler) *TWoCommunicationDao { + return &TWoCommunicationDao{ + group: "default", + table: "t_wo_communication", + columns: tWoCommunicationColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TWoCommunicationDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TWoCommunicationDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TWoCommunicationDao) Columns() TWoCommunicationColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TWoCommunicationDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TWoCommunicationDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TWoCommunicationDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_wo_main.go b/server/internal/dao/internal/t_wo_main.go new file mode 100644 index 0000000..06a6dea --- /dev/null +++ b/server/internal/dao/internal/t_wo_main.go @@ -0,0 +1,137 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TWoMainDao is the data access object for the table t_wo_main. +type TWoMainDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TWoMainColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TWoMainColumns defines and stores column names for the table t_wo_main. +type TWoMainColumns struct { + Id string // 主键ID + WoNo string // 工单编号 + WoType string // 工单类型 0卡,1模组,2设备,3订单,4余额,5提现 + RelatedId string // 关联业务ID + Title string // 工单标题 + Content string // 问题描述 + Attachment string // 附件 + CreatorType string // 创建人类型:1终端用户,2代理商 + CreatorDeptId string // 创建机构ID + CreatorUserId string // 创建用户ID + CreatorName string // 创建人姓名 + CreatorPhone string // 创建人手机号 + AssignDeptId string // 分派方机构ID + AssignUserId string // 分派人用户ID + CurrentStatus string // 当前处理状态:1已分派,2处理中,3已解决,4已完结_关单,5已取消 + HandlerDeptId string // 处理方机构ID + HandlerUserId string // 处理人用户ID + FirstResponseTime string // 首次响应时间 + ResolveTime string // 确认时间 + CloseTime string // 关闭时间 + SatisfactionLevel string // 满意度:1-5分 + EvalContent string // 评价内容 + EvalTime string // 评价时间 + Remark string // 备注 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tWoMainColumns holds the columns for the table t_wo_main. +var tWoMainColumns = TWoMainColumns{ + Id: "id", + WoNo: "wo_no", + WoType: "wo_type", + RelatedId: "related_id", + Title: "title", + Content: "content", + Attachment: "attachment", + CreatorType: "creator_type", + CreatorDeptId: "creator_dept_id", + CreatorUserId: "creator_user_id", + CreatorName: "creator_name", + CreatorPhone: "creator_phone", + AssignDeptId: "assign_dept_id", + AssignUserId: "assign_user_id", + CurrentStatus: "current_status", + HandlerDeptId: "handler_dept_id", + HandlerUserId: "handler_user_id", + FirstResponseTime: "first_response_time", + ResolveTime: "resolve_time", + CloseTime: "close_time", + SatisfactionLevel: "satisfaction_level", + EvalContent: "eval_content", + EvalTime: "eval_time", + Remark: "remark", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTWoMainDao creates and returns a new DAO object for table data access. +func NewTWoMainDao(handlers ...gdb.ModelHandler) *TWoMainDao { + return &TWoMainDao{ + group: "default", + table: "t_wo_main", + columns: tWoMainColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TWoMainDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TWoMainDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TWoMainDao) Columns() TWoMainColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TWoMainDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TWoMainDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TWoMainDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/t_wo_record.go b/server/internal/dao/internal/t_wo_record.go new file mode 100644 index 0000000..365bf7c --- /dev/null +++ b/server/internal/dao/internal/t_wo_record.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TWoRecordDao is the data access object for the table t_wo_record. +type TWoRecordDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TWoRecordColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TWoRecordColumns defines and stores column names for the table t_wo_record. +type TWoRecordColumns struct { + Id string // 主键ID + WoNo string // 工单编号 + OperationType string // 操作类型:0创建,1分派,2处理,3完成,4关单,5取消 + OperationDeptId string // 操作机构ID + OperationUserId string // 操作用户ID + TargetDeptId string // 目标部门ID + TargetUserId string // 目标用户ID + BeforeStatus string // 变更前状态 + AfterStatus string // 变更后状态 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tWoRecordColumns holds the columns for the table t_wo_record. +var tWoRecordColumns = TWoRecordColumns{ + Id: "id", + WoNo: "wo_no", + OperationType: "operation_type", + OperationDeptId: "operation_dept_id", + OperationUserId: "operation_user_id", + TargetDeptId: "target_dept_id", + TargetUserId: "target_user_id", + BeforeStatus: "before_status", + AfterStatus: "after_status", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// NewTWoRecordDao creates and returns a new DAO object for table data access. +func NewTWoRecordDao(handlers ...gdb.ModelHandler) *TWoRecordDao { + return &TWoRecordDao{ + group: "default", + table: "t_wo_record", + columns: tWoRecordColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TWoRecordDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TWoRecordDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TWoRecordDao) Columns() TWoRecordColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TWoRecordDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TWoRecordDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TWoRecordDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/internal/test_demo.go b/server/internal/dao/internal/test_demo.go new file mode 100644 index 0000000..8d625c2 --- /dev/null +++ b/server/internal/dao/internal/test_demo.go @@ -0,0 +1,107 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TestDemoDao is the data access object for the table test_demo. +type TestDemoDao struct { + table string // table is the underlying table name of the DAO. + group string // group is the database configuration group name of the current DAO. + columns TestDemoColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// TestDemoColumns defines and stores column names for the table test_demo. +type TestDemoColumns struct { + Id string // 主键 + TenantId string // 租户编号 + DeptId string // 部门id + UserId string // 用户id + OrderNum string // 排序号 + TestKey string // key键 + Value string // 值 + Version string // 版本 + CreatedDept string // 创建部门 + CreatedAt string // 创建时间 + CreatedBy string // 创建者 + UpdatedAt string // 更新时间 + UpdatedBy string // 更新者 + DeletedBy string // 删除人 + DeletedAt string // 删除时间 +} + +// testDemoColumns holds the columns for the table test_demo. +var testDemoColumns = TestDemoColumns{ + Id: "id", + TenantId: "tenant_id", + DeptId: "dept_id", + UserId: "user_id", + OrderNum: "order_num", + TestKey: "test_key", + Value: "value", + Version: "version", + CreatedDept: "created_dept", + CreatedAt: "created_at", + CreatedBy: "created_by", + UpdatedAt: "updated_at", + UpdatedBy: "updated_by", + DeletedBy: "deleted_by", + DeletedAt: "deleted_at", +} + +// NewTestDemoDao creates and returns a new DAO object for table data access. +func NewTestDemoDao(handlers ...gdb.ModelHandler) *TestDemoDao { + return &TestDemoDao{ + group: "default", + table: "test_demo", + columns: testDemoColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TestDemoDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TestDemoDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TestDemoDao) Columns() TestDemoColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TestDemoDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TestDemoDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TestDemoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/server/internal/dao/sys_client.go b/server/internal/dao/sys_client.go new file mode 100644 index 0000000..be7e7ef --- /dev/null +++ b/server/internal/dao/sys_client.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysClientDao is an internal type for wrapping the internal DAO implementation. +type internalSysClientDao = *internal.SysClientDao + +// sysClientDao is the data access object for the table sys_client. +// You can define custom methods on it to extend its functionality as needed. +type sysClientDao struct { + internalSysClientDao +} + +var ( + // SysClient is a globally accessible object for table sys_client operations. + SysClient = sysClientDao{ + internal.NewSysClientDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_config.go b/server/internal/dao/sys_config.go new file mode 100644 index 0000000..0a85c36 --- /dev/null +++ b/server/internal/dao/sys_config.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysConfigDao is an internal type for wrapping the internal DAO implementation. +type internalSysConfigDao = *internal.SysConfigDao + +// sysConfigDao is the data access object for the table sys_config. +// You can define custom methods on it to extend its functionality as needed. +type sysConfigDao struct { + internalSysConfigDao +} + +var ( + // SysConfig is a globally accessible object for table sys_config operations. + SysConfig = sysConfigDao{ + internal.NewSysConfigDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_dept.go b/server/internal/dao/sys_dept.go new file mode 100644 index 0000000..d9ffaa1 --- /dev/null +++ b/server/internal/dao/sys_dept.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysDeptDao is an internal type for wrapping the internal DAO implementation. +type internalSysDeptDao = *internal.SysDeptDao + +// sysDeptDao is the data access object for the table sys_dept. +// You can define custom methods on it to extend its functionality as needed. +type sysDeptDao struct { + internalSysDeptDao +} + +var ( + // SysDept is a globally accessible object for table sys_dept operations. + SysDept = sysDeptDao{ + internal.NewSysDeptDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_dict_data.go b/server/internal/dao/sys_dict_data.go new file mode 100644 index 0000000..db7edca --- /dev/null +++ b/server/internal/dao/sys_dict_data.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysDictDataDao is an internal type for wrapping the internal DAO implementation. +type internalSysDictDataDao = *internal.SysDictDataDao + +// sysDictDataDao is the data access object for the table sys_dict_data. +// You can define custom methods on it to extend its functionality as needed. +type sysDictDataDao struct { + internalSysDictDataDao +} + +var ( + // SysDictData is a globally accessible object for table sys_dict_data operations. + SysDictData = sysDictDataDao{ + internal.NewSysDictDataDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_dict_type.go b/server/internal/dao/sys_dict_type.go new file mode 100644 index 0000000..0f42a60 --- /dev/null +++ b/server/internal/dao/sys_dict_type.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysDictTypeDao is an internal type for wrapping the internal DAO implementation. +type internalSysDictTypeDao = *internal.SysDictTypeDao + +// sysDictTypeDao is the data access object for the table sys_dict_type. +// You can define custom methods on it to extend its functionality as needed. +type sysDictTypeDao struct { + internalSysDictTypeDao +} + +var ( + // SysDictType is a globally accessible object for table sys_dict_type operations. + SysDictType = sysDictTypeDao{ + internal.NewSysDictTypeDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_gen_table.go b/server/internal/dao/sys_gen_table.go new file mode 100644 index 0000000..90f8edc --- /dev/null +++ b/server/internal/dao/sys_gen_table.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysGenTableDao is an internal type for wrapping the internal DAO implementation. +type internalSysGenTableDao = *internal.SysGenTableDao + +// sysGenTableDao is the data access object for the table sys_gen_table. +// You can define custom methods on it to extend its functionality as needed. +type sysGenTableDao struct { + internalSysGenTableDao +} + +var ( + // SysGenTable is a globally accessible object for table sys_gen_table operations. + SysGenTable = sysGenTableDao{ + internal.NewSysGenTableDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_job.go b/server/internal/dao/sys_job.go new file mode 100644 index 0000000..441010b --- /dev/null +++ b/server/internal/dao/sys_job.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// sysJobDao is the data access object for the table sys_job. +// You can define custom methods on it to extend its functionality as needed. +type sysJobDao struct { + *internal.SysJobDao +} + +var ( + // SysJob is a globally accessible object for table sys_job operations. + SysJob = sysJobDao{internal.NewSysJobDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_logininfor.go b/server/internal/dao/sys_logininfor.go new file mode 100644 index 0000000..1971e00 --- /dev/null +++ b/server/internal/dao/sys_logininfor.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysLogininforDao is an internal type for wrapping the internal DAO implementation. +type internalSysLogininforDao = *internal.SysLogininforDao + +// sysLogininforDao is the data access object for the table sys_logininfor. +// You can define custom methods on it to extend its functionality as needed. +type sysLogininforDao struct { + internalSysLogininforDao +} + +var ( + // SysLogininfor is a globally accessible object for table sys_logininfor operations. + SysLogininfor = sysLogininforDao{ + internal.NewSysLogininforDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_menu.go b/server/internal/dao/sys_menu.go new file mode 100644 index 0000000..859ea57 --- /dev/null +++ b/server/internal/dao/sys_menu.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysMenuDao is an internal type for wrapping the internal DAO implementation. +type internalSysMenuDao = *internal.SysMenuDao + +// sysMenuDao is the data access object for the table sys_menu. +// You can define custom methods on it to extend its functionality as needed. +type sysMenuDao struct { + internalSysMenuDao +} + +var ( + // SysMenu is a globally accessible object for table sys_menu operations. + SysMenu = sysMenuDao{ + internal.NewSysMenuDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_notice.go b/server/internal/dao/sys_notice.go new file mode 100644 index 0000000..f8a10aa --- /dev/null +++ b/server/internal/dao/sys_notice.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysNoticeDao is an internal type for wrapping the internal DAO implementation. +type internalSysNoticeDao = *internal.SysNoticeDao + +// sysNoticeDao is the data access object for the table sys_notice. +// You can define custom methods on it to extend its functionality as needed. +type sysNoticeDao struct { + internalSysNoticeDao +} + +var ( + // SysNotice is a globally accessible object for table sys_notice operations. + SysNotice = sysNoticeDao{ + internal.NewSysNoticeDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_notice_user.go b/server/internal/dao/sys_notice_user.go new file mode 100644 index 0000000..cedbed3 --- /dev/null +++ b/server/internal/dao/sys_notice_user.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// sysNoticeUserDao is the data access object for the table sys_notice_user. +// You can define custom methods on it to extend its functionality as needed. +type sysNoticeUserDao struct { + *internal.SysNoticeUserDao +} + +var ( + // SysNoticeUser is a globally accessible object for table sys_notice_user operations. + SysNoticeUser = sysNoticeUserDao{internal.NewSysNoticeUserDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_oper_log.go b/server/internal/dao/sys_oper_log.go new file mode 100644 index 0000000..5c08152 --- /dev/null +++ b/server/internal/dao/sys_oper_log.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysOperLogDao is an internal type for wrapping the internal DAO implementation. +type internalSysOperLogDao = *internal.SysOperLogDao + +// sysOperLogDao is the data access object for the table sys_oper_log. +// You can define custom methods on it to extend its functionality as needed. +type sysOperLogDao struct { + internalSysOperLogDao +} + +var ( + // SysOperLog is a globally accessible object for table sys_oper_log operations. + SysOperLog = sysOperLogDao{ + internal.NewSysOperLogDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_oss.go b/server/internal/dao/sys_oss.go new file mode 100644 index 0000000..dda8383 --- /dev/null +++ b/server/internal/dao/sys_oss.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysOssDao is an internal type for wrapping the internal DAO implementation. +type internalSysOssDao = *internal.SysOssDao + +// sysOssDao is the data access object for the table sys_oss. +// You can define custom methods on it to extend its functionality as needed. +type sysOssDao struct { + internalSysOssDao +} + +var ( + // SysOss is a globally accessible object for table sys_oss operations. + SysOss = sysOssDao{ + internal.NewSysOssDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_oss_config.go b/server/internal/dao/sys_oss_config.go new file mode 100644 index 0000000..201661a --- /dev/null +++ b/server/internal/dao/sys_oss_config.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysOssConfigDao is an internal type for wrapping the internal DAO implementation. +type internalSysOssConfigDao = *internal.SysOssConfigDao + +// sysOssConfigDao is the data access object for the table sys_oss_config. +// You can define custom methods on it to extend its functionality as needed. +type sysOssConfigDao struct { + internalSysOssConfigDao +} + +var ( + // SysOssConfig is a globally accessible object for table sys_oss_config operations. + SysOssConfig = sysOssConfigDao{ + internal.NewSysOssConfigDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_post.go b/server/internal/dao/sys_post.go new file mode 100644 index 0000000..6701b5b --- /dev/null +++ b/server/internal/dao/sys_post.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysPostDao is an internal type for wrapping the internal DAO implementation. +type internalSysPostDao = *internal.SysPostDao + +// sysPostDao is the data access object for the table sys_post. +// You can define custom methods on it to extend its functionality as needed. +type sysPostDao struct { + internalSysPostDao +} + +var ( + // SysPost is a globally accessible object for table sys_post operations. + SysPost = sysPostDao{ + internal.NewSysPostDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_role.go b/server/internal/dao/sys_role.go new file mode 100644 index 0000000..3055a5b --- /dev/null +++ b/server/internal/dao/sys_role.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysRoleDao is an internal type for wrapping the internal DAO implementation. +type internalSysRoleDao = *internal.SysRoleDao + +// sysRoleDao is the data access object for the table sys_role. +// You can define custom methods on it to extend its functionality as needed. +type sysRoleDao struct { + internalSysRoleDao +} + +var ( + // SysRole is a globally accessible object for table sys_role operations. + SysRole = sysRoleDao{ + internal.NewSysRoleDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_role_dept.go b/server/internal/dao/sys_role_dept.go new file mode 100644 index 0000000..1ad4880 --- /dev/null +++ b/server/internal/dao/sys_role_dept.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysRoleDeptDao is an internal type for wrapping the internal DAO implementation. +type internalSysRoleDeptDao = *internal.SysRoleDeptDao + +// sysRoleDeptDao is the data access object for the table sys_role_dept. +// You can define custom methods on it to extend its functionality as needed. +type sysRoleDeptDao struct { + internalSysRoleDeptDao +} + +var ( + // SysRoleDept is a globally accessible object for table sys_role_dept operations. + SysRoleDept = sysRoleDeptDao{ + internal.NewSysRoleDeptDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_role_menu.go b/server/internal/dao/sys_role_menu.go new file mode 100644 index 0000000..4ac59da --- /dev/null +++ b/server/internal/dao/sys_role_menu.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysRoleMenuDao is an internal type for wrapping the internal DAO implementation. +type internalSysRoleMenuDao = *internal.SysRoleMenuDao + +// sysRoleMenuDao is the data access object for the table sys_role_menu. +// You can define custom methods on it to extend its functionality as needed. +type sysRoleMenuDao struct { + internalSysRoleMenuDao +} + +var ( + // SysRoleMenu is a globally accessible object for table sys_role_menu operations. + SysRoleMenu = sysRoleMenuDao{ + internal.NewSysRoleMenuDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_social.go b/server/internal/dao/sys_social.go new file mode 100644 index 0000000..4dad262 --- /dev/null +++ b/server/internal/dao/sys_social.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysSocialDao is an internal type for wrapping the internal DAO implementation. +type internalSysSocialDao = *internal.SysSocialDao + +// sysSocialDao is the data access object for the table sys_social. +// You can define custom methods on it to extend its functionality as needed. +type sysSocialDao struct { + internalSysSocialDao +} + +var ( + // SysSocial is a globally accessible object for table sys_social operations. + SysSocial = sysSocialDao{ + internal.NewSysSocialDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_tenant.go b/server/internal/dao/sys_tenant.go new file mode 100644 index 0000000..ada3793 --- /dev/null +++ b/server/internal/dao/sys_tenant.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysTenantDao is an internal type for wrapping the internal DAO implementation. +type internalSysTenantDao = *internal.SysTenantDao + +// sysTenantDao is the data access object for the table sys_tenant. +// You can define custom methods on it to extend its functionality as needed. +type sysTenantDao struct { + internalSysTenantDao +} + +var ( + // SysTenant is a globally accessible object for table sys_tenant operations. + SysTenant = sysTenantDao{ + internal.NewSysTenantDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_tenant_package.go b/server/internal/dao/sys_tenant_package.go new file mode 100644 index 0000000..7c3c335 --- /dev/null +++ b/server/internal/dao/sys_tenant_package.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysTenantPackageDao is an internal type for wrapping the internal DAO implementation. +type internalSysTenantPackageDao = *internal.SysTenantPackageDao + +// sysTenantPackageDao is the data access object for the table sys_tenant_package. +// You can define custom methods on it to extend its functionality as needed. +type sysTenantPackageDao struct { + internalSysTenantPackageDao +} + +var ( + // SysTenantPackage is a globally accessible object for table sys_tenant_package operations. + SysTenantPackage = sysTenantPackageDao{ + internal.NewSysTenantPackageDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_user.go b/server/internal/dao/sys_user.go new file mode 100644 index 0000000..e63bb57 --- /dev/null +++ b/server/internal/dao/sys_user.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysUserDao is an internal type for wrapping the internal DAO implementation. +type internalSysUserDao = *internal.SysUserDao + +// sysUserDao is the data access object for the table sys_user. +// You can define custom methods on it to extend its functionality as needed. +type sysUserDao struct { + internalSysUserDao +} + +var ( + // SysUser is a globally accessible object for table sys_user operations. + SysUser = sysUserDao{ + internal.NewSysUserDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_user_online.go b/server/internal/dao/sys_user_online.go new file mode 100644 index 0000000..031f8c8 --- /dev/null +++ b/server/internal/dao/sys_user_online.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysUserOnlineDao is an internal type for wrapping the internal DAO implementation. +type internalSysUserOnlineDao = *internal.SysUserOnlineDao + +// sysUserOnlineDao is the data access object for the table sys_user_online. +// You can define custom methods on it to extend its functionality as needed. +type sysUserOnlineDao struct { + internalSysUserOnlineDao +} + +var ( + // SysUserOnline is a globally accessible object for table sys_user_online operations. + SysUserOnline = sysUserOnlineDao{ + internal.NewSysUserOnlineDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_user_post.go b/server/internal/dao/sys_user_post.go new file mode 100644 index 0000000..986edd8 --- /dev/null +++ b/server/internal/dao/sys_user_post.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysUserPostDao is an internal type for wrapping the internal DAO implementation. +type internalSysUserPostDao = *internal.SysUserPostDao + +// sysUserPostDao is the data access object for the table sys_user_post. +// You can define custom methods on it to extend its functionality as needed. +type sysUserPostDao struct { + internalSysUserPostDao +} + +var ( + // SysUserPost is a globally accessible object for table sys_user_post operations. + SysUserPost = sysUserPostDao{ + internal.NewSysUserPostDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/sys_user_role.go b/server/internal/dao/sys_user_role.go new file mode 100644 index 0000000..e0d9191 --- /dev/null +++ b/server/internal/dao/sys_user_role.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// internalSysUserRoleDao is an internal type for wrapping the internal DAO implementation. +type internalSysUserRoleDao = *internal.SysUserRoleDao + +// sysUserRoleDao is the data access object for the table sys_user_role. +// You can define custom methods on it to extend its functionality as needed. +type sysUserRoleDao struct { + internalSysUserRoleDao +} + +var ( + // SysUserRole is a globally accessible object for table sys_user_role operations. + SysUserRole = sysUserRoleDao{ + internal.NewSysUserRoleDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_agent_balance.go b/server/internal/dao/t_agent_balance.go new file mode 100644 index 0000000..b9d8aee --- /dev/null +++ b/server/internal/dao/t_agent_balance.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tAgentBalanceDao is the data access object for the table t_agent_balance. +// You can define custom methods on it to extend its functionality as needed. +type tAgentBalanceDao struct { + *internal.TAgentBalanceDao +} + +var ( + // TAgentBalance is a globally accessible object for table t_agent_balance operations. + TAgentBalance = tAgentBalanceDao{internal.NewTAgentBalanceDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_agent_enterprise.go b/server/internal/dao/t_agent_enterprise.go new file mode 100644 index 0000000..8eaab34 --- /dev/null +++ b/server/internal/dao/t_agent_enterprise.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tAgentEnterpriseDao is the data access object for the table t_agent_enterprise. +// You can define custom methods on it to extend its functionality as needed. +type tAgentEnterpriseDao struct { + *internal.TAgentEnterpriseDao +} + +var ( + // TAgentEnterprise is a globally accessible object for table t_agent_enterprise operations. + TAgentEnterprise = tAgentEnterpriseDao{internal.NewTAgentEnterpriseDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_api.go b/server/internal/dao/t_api.go new file mode 100644 index 0000000..0b053a7 --- /dev/null +++ b/server/internal/dao/t_api.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tApiDao is the data access object for the table t_api. +// You can define custom methods on it to extend its functionality as needed. +type tApiDao struct { + *internal.TApiDao +} + +var ( + // TApi is a globally accessible object for table t_api operations. + TApi = tApiDao{internal.NewTApiDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_api_group.go b/server/internal/dao/t_api_group.go new file mode 100644 index 0000000..fda65c0 --- /dev/null +++ b/server/internal/dao/t_api_group.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tApiGroupDao is the data access object for the table t_api_group. +// You can define custom methods on it to extend its functionality as needed. +type tApiGroupDao struct { + *internal.TApiGroupDao +} + +var ( + // TApiGroup is a globally accessible object for table t_api_group operations. + TApiGroup = tApiGroupDao{internal.NewTApiGroupDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_api_group_resource.go b/server/internal/dao/t_api_group_resource.go new file mode 100644 index 0000000..791ad7b --- /dev/null +++ b/server/internal/dao/t_api_group_resource.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tApiGroupResourceDao is the data access object for the table t_api_group_resource. +// You can define custom methods on it to extend its functionality as needed. +type tApiGroupResourceDao struct { + *internal.TApiGroupResourceDao +} + +var ( + // TApiGroupResource is a globally accessible object for table t_api_group_resource operations. + TApiGroupResource = tApiGroupResourceDao{internal.NewTApiGroupResourceDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_api_resource.go b/server/internal/dao/t_api_resource.go new file mode 100644 index 0000000..d29eb30 --- /dev/null +++ b/server/internal/dao/t_api_resource.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tApiResourceDao is the data access object for the table t_api_resource. +// You can define custom methods on it to extend its functionality as needed. +type tApiResourceDao struct { + *internal.TApiResourceDao +} + +var ( + // TApiResource is a globally accessible object for table t_api_resource operations. + TApiResource = tApiResourceDao{internal.NewTApiResourceDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_balance_detail.go b/server/internal/dao/t_balance_detail.go new file mode 100644 index 0000000..a482a80 --- /dev/null +++ b/server/internal/dao/t_balance_detail.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tBalanceDetailDao is the data access object for the table t_balance_detail. +// You can define custom methods on it to extend its functionality as needed. +type tBalanceDetailDao struct { + *internal.TBalanceDetailDao +} + +var ( + // TBalanceDetail is a globally accessible object for table t_balance_detail operations. + TBalanceDetail = tBalanceDetailDao{internal.NewTBalanceDetailDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_consume_account_month_bill.go b/server/internal/dao/t_consume_account_month_bill.go new file mode 100644 index 0000000..fea32d4 --- /dev/null +++ b/server/internal/dao/t_consume_account_month_bill.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tConsumeAccountMonthBillDao is the data access object for the table t_consume_account_month_bill. +// You can define custom methods on it to extend its functionality as needed. +type tConsumeAccountMonthBillDao struct { + *internal.TConsumeAccountMonthBillDao +} + +var ( + // TConsumeAccountMonthBill is a globally accessible object for table t_consume_account_month_bill operations. + TConsumeAccountMonthBill = tConsumeAccountMonthBillDao{internal.NewTConsumeAccountMonthBillDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_credit_detail.go b/server/internal/dao/t_credit_detail.go new file mode 100644 index 0000000..5568c99 --- /dev/null +++ b/server/internal/dao/t_credit_detail.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tCreditDetailDao is the data access object for the table t_credit_detail. +// You can define custom methods on it to extend its functionality as needed. +type tCreditDetailDao struct { + *internal.TCreditDetailDao +} + +var ( + // TCreditDetail is a globally accessible object for table t_credit_detail operations. + TCreditDetail = tCreditDetailDao{internal.NewTCreditDetailDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_cust_withdraw_account.go b/server/internal/dao/t_cust_withdraw_account.go new file mode 100644 index 0000000..5da3702 --- /dev/null +++ b/server/internal/dao/t_cust_withdraw_account.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tCustWithdrawAccountDao is the data access object for the table t_cust_withdraw_account. +// You can define custom methods on it to extend its functionality as needed. +type tCustWithdrawAccountDao struct { + *internal.TCustWithdrawAccountDao +} + +var ( + // TCustWithdrawAccount is a globally accessible object for table t_cust_withdraw_account operations. + TCustWithdrawAccount = tCustWithdrawAccountDao{internal.NewTCustWithdrawAccountDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_dept_flow_daily.go b/server/internal/dao/t_dept_flow_daily.go new file mode 100644 index 0000000..3c48b11 --- /dev/null +++ b/server/internal/dao/t_dept_flow_daily.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tDeptFlowDailyDao is the data access object for the table t_dept_flow_daily. +// You can define custom methods on it to extend its functionality as needed. +type tDeptFlowDailyDao struct { + *internal.TDeptFlowDailyDao +} + +var ( + // TDeptFlowDaily is a globally accessible object for table t_dept_flow_daily operations. + TDeptFlowDaily = tDeptFlowDailyDao{internal.NewTDeptFlowDailyDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_division_code.go b/server/internal/dao/t_division_code.go new file mode 100644 index 0000000..45d99de --- /dev/null +++ b/server/internal/dao/t_division_code.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tDivisionCodeDao is the data access object for the table t_division_code. +// You can define custom methods on it to extend its functionality as needed. +type tDivisionCodeDao struct { + *internal.TDivisionCodeDao +} + +var ( + // TDivisionCode is a globally accessible object for table t_division_code operations. + TDivisionCode = tDivisionCodeDao{internal.NewTDivisionCodeDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_fin_commission_detail.go b/server/internal/dao/t_fin_commission_detail.go new file mode 100644 index 0000000..b8bafb7 --- /dev/null +++ b/server/internal/dao/t_fin_commission_detail.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tFinCommissionDetailDao is the data access object for the table t_fin_commission_detail. +// You can define custom methods on it to extend its functionality as needed. +type tFinCommissionDetailDao struct { + *internal.TFinCommissionDetailDao +} + +var ( + // TFinCommissionDetail is a globally accessible object for table t_fin_commission_detail operations. + TFinCommissionDetail = tFinCommissionDetailDao{internal.NewTFinCommissionDetailDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_fin_withdrawable_change.go b/server/internal/dao/t_fin_withdrawable_change.go new file mode 100644 index 0000000..e1812f1 --- /dev/null +++ b/server/internal/dao/t_fin_withdrawable_change.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tFinWithdrawableChangeDao is the data access object for the table t_fin_withdrawable_change. +// You can define custom methods on it to extend its functionality as needed. +type tFinWithdrawableChangeDao struct { + *internal.TFinWithdrawableChangeDao +} + +var ( + // TFinWithdrawableChange is a globally accessible object for table t_fin_withdrawable_change operations. + TFinWithdrawableChange = tFinWithdrawableChangeDao{internal.NewTFinWithdrawableChangeDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_finance_apply.go b/server/internal/dao/t_finance_apply.go new file mode 100644 index 0000000..1bcf743 --- /dev/null +++ b/server/internal/dao/t_finance_apply.go @@ -0,0 +1,19 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tFinanceApplyDao is the data access object for the table t_finance_apply. +type tFinanceApplyDao struct { + *internal.TFinanceApplyDao +} + +var ( + // TFinanceApply is a globally accessible object for table t_finance_apply operations. + TFinanceApply = tFinanceApplyDao{internal.NewTFinanceApplyDao()} +) diff --git a/server/internal/dao/t_finance_audit_record.go b/server/internal/dao/t_finance_audit_record.go new file mode 100644 index 0000000..dbcd9d9 --- /dev/null +++ b/server/internal/dao/t_finance_audit_record.go @@ -0,0 +1,19 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tFinanceAuditRecordDao is the data access object for the table t_finance_audit_record. +type tFinanceAuditRecordDao struct { + *internal.TFinanceAuditRecordDao +} + +var ( + // TFinanceAuditRecord is a globally accessible object for table t_finance_audit_record operations. + TFinanceAuditRecord = tFinanceAuditRecordDao{internal.NewTFinanceAuditRecordDao()} +) diff --git a/server/internal/dao/t_flow_package_config.go b/server/internal/dao/t_flow_package_config.go new file mode 100644 index 0000000..54eb945 --- /dev/null +++ b/server/internal/dao/t_flow_package_config.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tFlowPackageConfigDao is the data access object for the table t_flow_package_config. +// You can define custom methods on it to extend its functionality as needed. +type tFlowPackageConfigDao struct { + *internal.TFlowPackageConfigDao +} + +var ( + // TFlowPackageConfig is a globally accessible object for table t_flow_package_config operations. + TFlowPackageConfig = tFlowPackageConfigDao{internal.NewTFlowPackageConfigDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_message_log.go b/server/internal/dao/t_message_log.go new file mode 100644 index 0000000..44a48ac --- /dev/null +++ b/server/internal/dao/t_message_log.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tMessageLogDao is the data access object for the table t_message_log. +// You can define custom methods on it to extend its functionality as needed. +type tMessageLogDao struct { + *internal.TMessageLogDao +} + +var ( + // TMessageLog is a globally accessible object for table t_message_log operations. + TMessageLog = tMessageLogDao{internal.NewTMessageLogDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_notify_log.go b/server/internal/dao/t_notify_log.go new file mode 100644 index 0000000..7561da6 --- /dev/null +++ b/server/internal/dao/t_notify_log.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tNotifyLogDao is the data access object for the table t_notify_log. +// You can define custom methods on it to extend its functionality as needed. +type tNotifyLogDao struct { + *internal.TNotifyLogDao +} + +var ( + // TNotifyLog is a globally accessible object for table t_notify_log operations. + TNotifyLog = tNotifyLogDao{internal.NewTNotifyLogDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_order.go b/server/internal/dao/t_order.go new file mode 100644 index 0000000..e043da3 --- /dev/null +++ b/server/internal/dao/t_order.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tOrderDao is the data access object for the table t_order. +// You can define custom methods on it to extend its functionality as needed. +type tOrderDao struct { + *internal.TOrderDao +} + +var ( + // TOrder is a globally accessible object for table t_order operations. + TOrder = tOrderDao{internal.NewTOrderDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_order_item.go b/server/internal/dao/t_order_item.go new file mode 100644 index 0000000..9ceb8ad --- /dev/null +++ b/server/internal/dao/t_order_item.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tOrderItemDao is the data access object for the table t_order_item. +// You can define custom methods on it to extend its functionality as needed. +type tOrderItemDao struct { + *internal.TOrderItemDao +} + +var ( + // TOrderItem is a globally accessible object for table t_order_item operations. + TOrderItem = tOrderItemDao{internal.NewTOrderItemDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_package_customer.go b/server/internal/dao/t_package_customer.go new file mode 100644 index 0000000..aec6081 --- /dev/null +++ b/server/internal/dao/t_package_customer.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tPackageCustomerDao is the data access object for the table t_package_customer. +// You can define custom methods on it to extend its functionality as needed. +type tPackageCustomerDao struct { + *internal.TPackageCustomerDao +} + +var ( + // TPackageCustomer is a globally accessible object for table t_package_customer operations. + TPackageCustomer = tPackageCustomerDao{internal.NewTPackageCustomerDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_profit_account_month_bill.go b/server/internal/dao/t_profit_account_month_bill.go new file mode 100644 index 0000000..e917a0f --- /dev/null +++ b/server/internal/dao/t_profit_account_month_bill.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tProfitAccountMonthBillDao is the data access object for the table t_profit_account_month_bill. +// You can define custom methods on it to extend its functionality as needed. +type tProfitAccountMonthBillDao struct { + *internal.TProfitAccountMonthBillDao +} + +var ( + // TProfitAccountMonthBill is a globally accessible object for table t_profit_account_month_bill operations. + TProfitAccountMonthBill = tProfitAccountMonthBillDao{internal.NewTProfitAccountMonthBillDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_resource_batch_download.go b/server/internal/dao/t_resource_batch_download.go new file mode 100644 index 0000000..2dde5fd --- /dev/null +++ b/server/internal/dao/t_resource_batch_download.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tResourceBatchDownloadDao is the data access object for the table t_resource_batch_download. +// You can define custom methods on it to extend its functionality as needed. +type tResourceBatchDownloadDao struct { + *internal.TResourceBatchDownloadDao +} + +var ( + // TResourceBatchDownload is a globally accessible object for table t_resource_batch_download operations. + TResourceBatchDownload = tResourceBatchDownloadDao{internal.NewTResourceBatchDownloadDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_bind_package_logs.go b/server/internal/dao/t_sim_bind_package_logs.go new file mode 100644 index 0000000..12f2aaf --- /dev/null +++ b/server/internal/dao/t_sim_bind_package_logs.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimBindPackageLogsDao is the data access object for the table t_sim_bind_package_logs. +// You can define custom methods on it to extend its functionality as needed. +type tSimBindPackageLogsDao struct { + *internal.TSimBindPackageLogsDao +} + +var ( + // TSimBindPackageLogs is a globally accessible object for table t_sim_bind_package_logs operations. + TSimBindPackageLogs = tSimBindPackageLogsDao{internal.NewTSimBindPackageLogsDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_card_bind_pkg.go b/server/internal/dao/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..868ffee --- /dev/null +++ b/server/internal/dao/t_sim_card_bind_pkg.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimCardBindPkgDao is the data access object for the table t_sim_card_bind_pkg. +// You can define custom methods on it to extend its functionality as needed. +type tSimCardBindPkgDao struct { + *internal.TSimCardBindPkgDao +} + +var ( + // TSimCardBindPkg is a globally accessible object for table t_sim_card_bind_pkg operations. + TSimCardBindPkg = tSimCardBindPkgDao{internal.NewTSimCardBindPkgDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_card_cancellation.go b/server/internal/dao/t_sim_card_cancellation.go new file mode 100644 index 0000000..5d2b19f --- /dev/null +++ b/server/internal/dao/t_sim_card_cancellation.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimCardCancellationDao is the data access object for the table t_sim_card_cancellation. +// You can define custom methods on it to extend its functionality as needed. +type tSimCardCancellationDao struct { + *internal.TSimCardCancellationDao +} + +var ( + // TSimCardCancellation is a globally accessible object for table t_sim_card_cancellation operations. + TSimCardCancellation = tSimCardCancellationDao{internal.NewTSimCardCancellationDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_card_info.go b/server/internal/dao/t_sim_card_info.go new file mode 100644 index 0000000..0f94087 --- /dev/null +++ b/server/internal/dao/t_sim_card_info.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimCardInfoDao is the data access object for the table t_sim_card_info. +// You can define custom methods on it to extend its functionality as needed. +type tSimCardInfoDao struct { + *internal.TSimCardInfoDao +} + +var ( + // TSimCardInfo is a globally accessible object for table t_sim_card_info operations. + TSimCardInfo = tSimCardInfoDao{internal.NewTSimCardInfoDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_card_stock.go b/server/internal/dao/t_sim_card_stock.go new file mode 100644 index 0000000..01576c0 --- /dev/null +++ b/server/internal/dao/t_sim_card_stock.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimCardStockDao is the data access object for the table t_sim_card_stock. +// You can define custom methods on it to extend its functionality as needed. +type tSimCardStockDao struct { + *internal.TSimCardStockDao +} + +var ( + // TSimCardStock is a globally accessible object for table t_sim_card_stock operations. + TSimCardStock = tSimCardStockDao{internal.NewTSimCardStockDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_channel_template.go b/server/internal/dao/t_sim_channel_template.go new file mode 100644 index 0000000..acf8c16 --- /dev/null +++ b/server/internal/dao/t_sim_channel_template.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimChannelTemplateDao is the data access object for the table t_sim_channel_template. +// You can define custom methods on it to extend its functionality as needed. +type tSimChannelTemplateDao struct { + *internal.TSimChannelTemplateDao +} + +var ( + // TSimChannelTemplate is a globally accessible object for table t_sim_channel_template operations. + TSimChannelTemplate = tSimChannelTemplateDao{internal.NewTSimChannelTemplateDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_channels.go b/server/internal/dao/t_sim_channels.go new file mode 100644 index 0000000..259897a --- /dev/null +++ b/server/internal/dao/t_sim_channels.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimChannelsDao is the data access object for the table t_sim_channels. +// You can define custom methods on it to extend its functionality as needed. +type tSimChannelsDao struct { + *internal.TSimChannelsDao +} + +var ( + // TSimChannels is a globally accessible object for table t_sim_channels operations. + TSimChannels = tSimChannelsDao{internal.NewTSimChannelsDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_flow_package_info.go b/server/internal/dao/t_sim_flow_package_info.go new file mode 100644 index 0000000..c4fbd01 --- /dev/null +++ b/server/internal/dao/t_sim_flow_package_info.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimFlowPackageInfoDao is the data access object for the table t_sim_flow_package_info. +// You can define custom methods on it to extend its functionality as needed. +type tSimFlowPackageInfoDao struct { + *internal.TSimFlowPackageInfoDao +} + +var ( + // TSimFlowPackageInfo is a globally accessible object for table t_sim_flow_package_info operations. + TSimFlowPackageInfo = tSimFlowPackageInfoDao{internal.NewTSimFlowPackageInfoDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_flow_package_price.go b/server/internal/dao/t_sim_flow_package_price.go new file mode 100644 index 0000000..228125e --- /dev/null +++ b/server/internal/dao/t_sim_flow_package_price.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimFlowPackagePriceDao is the data access object for the table t_sim_flow_package_price. +// You can define custom methods on it to extend its functionality as needed. +type tSimFlowPackagePriceDao struct { + *internal.TSimFlowPackagePriceDao +} + +var ( + // TSimFlowPackagePrice is a globally accessible object for table t_sim_flow_package_price operations. + TSimFlowPackagePrice = tSimFlowPackagePriceDao{internal.NewTSimFlowPackagePriceDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_flow_pool.go b/server/internal/dao/t_sim_flow_pool.go new file mode 100644 index 0000000..fb646c1 --- /dev/null +++ b/server/internal/dao/t_sim_flow_pool.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimFlowPoolDao is the data access object for the table t_sim_flow_pool. +// You can define custom methods on it to extend its functionality as needed. +type tSimFlowPoolDao struct { + *internal.TSimFlowPoolDao +} + +var ( + // TSimFlowPool is a globally accessible object for table t_sim_flow_pool operations. + TSimFlowPool = tSimFlowPoolDao{internal.NewTSimFlowPoolDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_package_category.go b/server/internal/dao/t_sim_package_category.go new file mode 100644 index 0000000..eecb212 --- /dev/null +++ b/server/internal/dao/t_sim_package_category.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimPackageCategoryDao is the data access object for the table t_sim_package_category. +// You can define custom methods on it to extend its functionality as needed. +type tSimPackageCategoryDao struct { + *internal.TSimPackageCategoryDao +} + +var ( + // TSimPackageCategory is a globally accessible object for table t_sim_package_category operations. + TSimPackageCategory = tSimPackageCategoryDao{internal.NewTSimPackageCategoryDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_pool.go b/server/internal/dao/t_sim_pool.go new file mode 100644 index 0000000..59ad50e --- /dev/null +++ b/server/internal/dao/t_sim_pool.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimPoolDao is the data access object for the table t_sim_pool. +// You can define custom methods on it to extend its functionality as needed. +type tSimPoolDao struct { + *internal.TSimPoolDao +} + +var ( + // TSimPool is a globally accessible object for table t_sim_pool operations. + TSimPool = tSimPoolDao{internal.NewTSimPoolDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_pool_bind_package.go b/server/internal/dao/t_sim_pool_bind_package.go new file mode 100644 index 0000000..4e66034 --- /dev/null +++ b/server/internal/dao/t_sim_pool_bind_package.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimPoolBindPackageDao is the data access object for the table t_sim_pool_bind_package. +// You can define custom methods on it to extend its functionality as needed. +type tSimPoolBindPackageDao struct { + *internal.TSimPoolBindPackageDao +} + +var ( + // TSimPoolBindPackage is a globally accessible object for table t_sim_pool_bind_package operations. + TSimPoolBindPackage = tSimPoolBindPackageDao{internal.NewTSimPoolBindPackageDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_pool_warn_config.go b/server/internal/dao/t_sim_pool_warn_config.go new file mode 100644 index 0000000..b565492 --- /dev/null +++ b/server/internal/dao/t_sim_pool_warn_config.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tSimPoolWarnConfigDao is the data access object for the table t_sim_pool_warn_config. +// You can define custom methods on it to extend its functionality as needed. +type tSimPoolWarnConfigDao struct { + *internal.TSimPoolWarnConfigDao +} + +var ( + // TSimPoolWarnConfig is a globally accessible object for table t_sim_pool_warn_config operations. + TSimPoolWarnConfig = tSimPoolWarnConfigDao{internal.NewTSimPoolWarnConfigDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_sim_upstream_package.go b/server/internal/dao/t_sim_upstream_package.go new file mode 100644 index 0000000..727e17f --- /dev/null +++ b/server/internal/dao/t_sim_upstream_package.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tUpstreamPackageDao is the data access object for the table t_sim_upstream_package. +// You can define custom methods on it to extend its functionality as needed. +type tUpstreamPackageDao struct { + *internal.TUpstreamPackageDao +} + +var ( + // TUpstreamPackage is a globally accessible object for table t_sim_upstream_package operations. + TUpstreamPackage = tUpstreamPackageDao{internal.NewTUpstreamPackageDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_tplatform_setting.go b/server/internal/dao/t_tplatform_setting.go new file mode 100644 index 0000000..565b2bd --- /dev/null +++ b/server/internal/dao/t_tplatform_setting.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tTplatformSettingDao is the data access object for the table t_tplatform_setting. +// You can define custom methods on it to extend its functionality as needed. +type tTplatformSettingDao struct { + *internal.TTplatformSettingDao +} + +var ( + // TTplatformSetting is a globally accessible object for table t_tplatform_setting operations. + TTplatformSetting = tTplatformSettingDao{internal.NewTTplatformSettingDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_user_message.go b/server/internal/dao/t_user_message.go new file mode 100644 index 0000000..e788775 --- /dev/null +++ b/server/internal/dao/t_user_message.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tUserMessageDao is the data access object for the table t_user_message. +// You can define custom methods on it to extend its functionality as needed. +type tUserMessageDao struct { + *internal.TUserMessageDao +} + +var ( + // TUserMessage is a globally accessible object for table t_user_message operations. + TUserMessage = tUserMessageDao{internal.NewTUserMessageDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_warn_config.go b/server/internal/dao/t_warn_config.go new file mode 100644 index 0000000..95eeeae --- /dev/null +++ b/server/internal/dao/t_warn_config.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tWarnConfigDao is the data access object for the table t_warn_config. +// You can define custom methods on it to extend its functionality as needed. +type tWarnConfigDao struct { + *internal.TWarnConfigDao +} + +var ( + // TWarnConfig is a globally accessible object for table t_warn_config operations. + TWarnConfig = tWarnConfigDao{internal.NewTWarnConfigDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_warn_log.go b/server/internal/dao/t_warn_log.go new file mode 100644 index 0000000..68191cd --- /dev/null +++ b/server/internal/dao/t_warn_log.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tWarnLogDao is the data access object for the table t_warn_log. +// You can define custom methods on it to extend its functionality as needed. +type tWarnLogDao struct { + *internal.TWarnLogDao +} + +var ( + // TWarnLog is a globally accessible object for table t_warn_log operations. + TWarnLog = tWarnLogDao{internal.NewTWarnLogDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_wo_audit.go b/server/internal/dao/t_wo_audit.go new file mode 100644 index 0000000..790ab1b --- /dev/null +++ b/server/internal/dao/t_wo_audit.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tWoAuditDao is the data access object for the table t_wo_audit. +// You can define custom methods on it to extend its functionality as needed. +type tWoAuditDao struct { + *internal.TWoAuditDao +} + +var ( + // TWoAudit is a globally accessible object for table t_wo_audit operations. + TWoAudit = tWoAuditDao{internal.NewTWoAuditDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_wo_communication.go b/server/internal/dao/t_wo_communication.go new file mode 100644 index 0000000..570db79 --- /dev/null +++ b/server/internal/dao/t_wo_communication.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tWoCommunicationDao is the data access object for the table t_wo_communication. +// You can define custom methods on it to extend its functionality as needed. +type tWoCommunicationDao struct { + *internal.TWoCommunicationDao +} + +var ( + // TWoCommunication is a globally accessible object for table t_wo_communication operations. + TWoCommunication = tWoCommunicationDao{internal.NewTWoCommunicationDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_wo_main.go b/server/internal/dao/t_wo_main.go new file mode 100644 index 0000000..0fda8b4 --- /dev/null +++ b/server/internal/dao/t_wo_main.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tWoMainDao is the data access object for the table t_wo_main. +// You can define custom methods on it to extend its functionality as needed. +type tWoMainDao struct { + *internal.TWoMainDao +} + +var ( + // TWoMain is a globally accessible object for table t_wo_main operations. + TWoMain = tWoMainDao{internal.NewTWoMainDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/t_wo_record.go b/server/internal/dao/t_wo_record.go new file mode 100644 index 0000000..da259c7 --- /dev/null +++ b/server/internal/dao/t_wo_record.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// tWoRecordDao is the data access object for the table t_wo_record. +// You can define custom methods on it to extend its functionality as needed. +type tWoRecordDao struct { + *internal.TWoRecordDao +} + +var ( + // TWoRecord is a globally accessible object for table t_wo_record operations. + TWoRecord = tWoRecordDao{internal.NewTWoRecordDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/dao/test_demo.go b/server/internal/dao/test_demo.go new file mode 100644 index 0000000..5f51cfd --- /dev/null +++ b/server/internal/dao/test_demo.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao/internal" +) + +// testDemoDao is the data access object for the table test_demo. +// You can define custom methods on it to extend its functionality as needed. +type testDemoDao struct { + *internal.TestDemoDao +} + +var ( + // TestDemo is a globally accessible object for table test_demo operations. + TestDemo = testDemoDao{internal.NewTestDemoDao()} +) + +// Add your custom methods and functionality below. diff --git a/server/internal/library/addons/addons.go b/server/internal/library/addons/addons.go new file mode 100644 index 0000000..7a12736 --- /dev/null +++ b/server/internal/library/addons/addons.go @@ -0,0 +1,16 @@ +// Package addons +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package addons + +import ( + "context" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" +) + +func ModuleSelects(ctx context.Context) (output []*genmodel.SelectItemModel, err error) { + output = make([]*genmodel.SelectItemModel, 0) + return +} diff --git a/server/internal/library/allocationunits/units.go b/server/internal/library/allocationunits/units.go new file mode 100644 index 0000000..56f8a5e --- /dev/null +++ b/server/internal/library/allocationunits/units.go @@ -0,0 +1,141 @@ +package allocationunits + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/errors/gerror" + "strings" +) + +// Fields 是日志展示契约,不增加数据库字段。 +type Fields struct { + SourceDeptId int64 `json:"sourceDeptId" orm:"-"` + SourceDeptName string `json:"sourceDeptName" orm:"-"` + TargetDeptId int64 `json:"targetDeptId" orm:"-"` + TargetDeptName string `json:"targetDeptName" orm:"-"` + TargetDeptMode string `json:"targetDeptMode" orm:"-"` +} +type Unit struct { + Id int64 `orm:"dept_id"` + Key string `orm:"dept_key"` + Name string `orm:"dept_name"` +} + +func Load(ctx context.Context, tenant string, ids []int64, tx ...gdb.TX) (map[int64]Unit, error) { + unique := map[int64]bool{} + for _, id := range ids { + if id > 0 { + unique[id] = true + } + } + result := map[int64]Unit{} + if len(unique) == 0 { + return result, nil + } + ids = nil + for id := range unique { + ids = append(ids, id) + } + var rows []Unit + if len(tx) > 0 { + result, err := tx[0].GetAll("SELECT dept_id,dept_key,dept_name FROM sys_dept WHERE tenant_id=? AND deleted_at IS NULL AND dept_id IN (?)", tenant, ids) + if err != nil { + return nil, gerror.Wrap(err, "读取划拨单位信息失败") + } + if err := result.Structs(&rows); err != nil { + return nil, err + } + units := map[int64]Unit{} + for _, row := range rows { + units[row.Id] = row + } + return units, nil + } + mod := dao.SysDept.Ctx(ctx) + if err := mod.WhereNull("deleted_at").Where("tenant_id", tenant).WhereIn("dept_id", ids).Fields("dept_id", "dept_key", "dept_name", "deleted_at").Scan(&rows); err != nil { + return nil, gerror.Wrap(err, "读取划拨单位信息失败") + } + for _, row := range rows { + result[row.Id] = row + } + return result, nil +} + +// Snapshot 名称由服务端查询,仅在受理时记录,执行时不覆盖。 +func Snapshot(ctx context.Context, tenant string, source, target int64, tx ...gdb.TX) (*gjson.Json, error) { + units, err := Load(ctx, tenant, []int64{source, target}, tx...) + if err != nil { + return nil, err + } + mode := "single" + if target <= 0 { + mode = "per_row" + } + return gjson.New(map[string]any{"sourceDeptId": source, "sourceDeptKey": units[source].Key, "sourceDeptName": units[source].Name, "targetDeptId": target, "targetDeptKey": units[target].Key, "targetDeptName": units[target].Name, "targetDeptMode": mode}), nil +} + +func Resolve(info *gjson.Json, source, target int64) Fields { + f := Fields{SourceDeptId: source, TargetDeptId: target} + if info != nil { + if id := info.Get("sourceDeptId").Int64(); id > 0 { + f.SourceDeptId = id + } + if id := info.Get("targetDeptId").Int64(); id > 0 { + f.TargetDeptId = id + } + f.SourceDeptName = strings.TrimSpace(info.Get("sourceDeptName").String()) + f.TargetDeptName = strings.TrimSpace(info.Get("targetDeptName").String()) + f.TargetDeptMode = info.Get("targetDeptMode").String() + } + if f.TargetDeptMode == "" { + if f.TargetDeptId > 0 { + f.TargetDeptMode = "single" + } else { + f.TargetDeptMode = "per_row" + } + } + return f +} + +// Fill 一页只补查一次旧数据的单位名称,不扫描卡片当前归属,不覆盖历史快照。 +func Fill(ctx context.Context, tenant string, fields []*Fields) error { + ids := []int64{} + for _, f := range fields { + if f.SourceDeptName == "" { + ids = append(ids, f.SourceDeptId) + } + if f.TargetDeptName == "" { + ids = append(ids, f.TargetDeptId) + } + } + units, err := Load(ctx, tenant, ids) + if err != nil { + return err + } + for _, f := range fields { + if f.SourceDeptName == "" { + f.SourceDeptName = units[f.SourceDeptId].Name + } + if f.TargetDeptName == "" { + f.TargetDeptName = units[f.TargetDeptId].Name + } + } + return nil +} + +func Merge(info, units *gjson.Json) *gjson.Json { + data := map[string]any{} + if info != nil { + for k, v := range info.Map() { + data[k] = v + } + } + if units != nil { + for k, v := range units.Map() { + data[k] = v + } + } + return gjson.New(data) +} diff --git a/server/internal/library/batchimport/async.go b/server/internal/library/batchimport/async.go new file mode 100644 index 0000000..39cbfc0 --- /dev/null +++ b/server/internal/library/batchimport/async.go @@ -0,0 +1,204 @@ +package batchimport + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/batchmetadata" + "strings" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/do" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +type PendingOptions struct { + PrepareRows func(ctx context.Context, rows []Row) error +} + +const pendingDetailInsertBatchSize = 500 + +func CreatePendingUpload(ctx context.Context, req SubmitRequest, p PendingProcessor, options PendingOptions) (*Result, error) { + if err := batchmetadata.ValidateCreation(req.SourceChannel, req.ExecutionMode); err != nil { + return nil, err + } + cfg := p.Config() + if req.File == nil { + return nil, gerror.New("请选择上传文件") + } + if err := service.SysOss().CheckType(ctx, consts.SysUploadFileTypeFile, req.File); err != nil { + return nil, err + } + if req.File.Size > cfg.MaxFileSize { + return nil, gerror.Newf("上传文件大小超过限制,最大为%dM", cfg.MaxFileSize>>20) + } + + batchNo, err := NextBatchNoContext(ctx, cfg.BatchNoPrefix) + if err != nil { + return nil, err + } + req.BatchNo = batchNo + content, err := readUploadContent(req.File) + if err != nil { + return nil, err + } + importOss, err := service.SysOss().SaveContent(ctx, &model.SysOssSaveContentParam{ + Content: content, + FileName: batchNo + "-import.xlsx", + NewFileType: consts.SysUploadNewFileTypeUserFile, + SubDirName: cfg.ImportDir, + }) + if err != nil { + return nil, gerror.Wrap(err, "保存原始Excel失败") + } + + rows, err := p.ParseRows(ctx, importOss.Path) + if err != nil { + return nil, err + } + return createPending(ctx, &req, p, rows, importOss, options) +} + +func CreatePendingRows(ctx context.Context, req SubmitRequest, p PendingProcessor, rows []Row, options PendingOptions) (*Result, error) { + if err := batchmetadata.ValidateCreation(req.SourceChannel, req.ExecutionMode); err != nil { + return nil, err + } + return createPending(ctx, &req, p, rows, nil, options) +} + +func createPending(ctx context.Context, req *SubmitRequest, p PendingProcessor, rows []Row, importOss *model.SysOssSaveContentModel, options PendingOptions) (*Result, error) { + if len(rows) == 0 { + return nil, gerror.New("导入数据为空") + } + if err := validatePendingRowCount(len(rows), p.Config().MaxRows); err != nil { + return nil, err + } + if err := p.ValidateRows(ctx, rows); err != nil { + return nil, err + } + if options.PrepareRows != nil { + if err := options.PrepareRows(ctx, rows); err != nil { + return nil, err + } + } + if strings.TrimSpace(req.BatchNo) == "" { + batchNo, err := NextBatchNoContext(ctx, p.Config().BatchNoPrefix) + if err != nil { + return nil, err + } + req.BatchNo = batchNo + } + + result := &Result{ + ImportStatus: consts.ImportStatusSuccess, + BatchNo: req.BatchNo, + BatchType: p.Config().BatchType, + TotalRows: len(rows), + } + if importOss != nil { + result.ImportFileOssId = importOss.OssId + result.ImportFileUrl = importOss.Url + } + + if err := g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error { + sourceBatchNo := strings.TrimSpace(req.SourceBatchNo) + if sourceBatchNo == "" { + sourceBatchNo = req.BatchNo + } + if req.BeforeSave != nil { + if err := req.BeforeSave(ctx, tx, req, rows); err != nil { + return err + } + } + if _, err := tx.Ctx(ctx).Model(dao.BatchMain.Table()).Data(do.BatchMain{ + BatchNo: req.BatchNo, + OrderSn: "", + BatchType: p.Config().BatchType, + BatchAsyncStatus: consts.BatchAsyncStatusPending, + SourceType: req.SourceType, + SourceChannel: batchmetadata.Channel(req.SourceChannel), + ExecutionMode: batchmetadata.NormalizeMode(req.ExecutionMode), + SourceBatchNo: sourceBatchNo, + SourceOssId: ossIDValue(sourceOssID(result, importOss)), + IsCrossDept: 0, + TargetDeptId: req.TargetDeptId, + DeptId: req.Operator.DeptId, + TotalCount: len(rows), + ValidCount: 0, + SuccessCount: 0, + FailCount: 0, + RunResult: consts.BatchRunResultPending, + FailReason: "", + BatchInfo: p.BuildBatchInfo(ctx, *req, result, importOss, nil, 0), + TenantId: req.Operator.TenantId, + CreatedDept: req.Operator.DeptId, + CreatedBy: req.Operator.UserId, + UpdatedBy: req.Operator.UserId, + }).Insert(); err != nil { + return gerror.Wrap(err, "写入待处理批次失败") + } + + details := make([]do.BatchDetail, 0, len(rows)) + for _, row := range rows { + details = append(details, do.BatchDetail{ + BatchNo: req.BatchNo, + BatchType: p.Config().BatchType, + DetailStatus: consts.BatchDetailStatusPending, + BlankOutStatus: consts.BlankOutStatusNo, + RowNo: row.GetRowNo(), + ItemId: row.GetItemID(), + ErrorCode: "", + ErrorReason: strings.Join(row.GetErrorReasons(), ";"), + Snapshot: row.Snapshot(), + TenantId: req.Operator.TenantId, + CreatedDept: req.Operator.DeptId, + CreatedBy: req.Operator.UserId, + UpdatedBy: req.Operator.UserId, + }) + } + for start := 0; start < len(details); start += pendingDetailInsertBatchSize { + end := start + pendingDetailInsertBatchSize + if end > len(details) { + end = len(details) + } + if _, err := tx.Ctx(ctx).Model(dao.BatchDetail.Table()).Data(details[start:end]).Insert(); err != nil { + return gerror.Wrapf(err, "写入待处理批次明细失败,范围:%d-%d", start+1, end) + } + } + return nil + }); err != nil { + return nil, err + } + return result, nil +} + +func validatePendingRowCount(rowCount, maxRows int) error { + if maxRows > 0 && rowCount > maxRows { + return gerror.Newf("单批最多支持%d张卡,当前共%d张,请拆分后重试", maxRows, rowCount) + } + return nil +} + +func SaveAsyncResultFiles( + ctx context.Context, + req SubmitRequest, + p Processor, + result *Result, + rows []Row, + importOss *model.SysOssSaveContentModel, + startTime, endTime *gtime.Time, +) (*model.SysOssSaveContentModel, int64, error) { + resultOss, downloadId, err := saveResultExcelAndDownload(ctx, req, p, result, rows, importOss, startTime, endTime) + if err != nil { + return nil, 0, err + } + result.ResultDownloadId = downloadId + result.ResultFileOssId = resultOss.OssId + result.ResultFileUrl = resultOss.Url + return resultOss, downloadId, nil +} diff --git a/server/internal/library/batchimport/batch_no.go b/server/internal/library/batchimport/batch_no.go new file mode 100644 index 0000000..afcc514 --- /dev/null +++ b/server/internal/library/batchimport/batch_no.go @@ -0,0 +1,117 @@ +package batchimport + +import ( + "context" + "crypto/rand" + "fmt" + "strings" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" +) + +const ( + batchNoPrefixLength = 3 + batchNoSequenceLength = 3 + batchNoSequenceMax = 999 + batchNoSequenceTTL = 48 * time.Hour + batchNoSequenceRedisPrefix = "iotlcm:batch:no:seq:" + randomNoSuffixLength = 8 + randomNoAlphabet = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" +) + +func NextBatchNo(prefix string) (string, error) { + return NextBatchNoContext(context.Background(), prefix) +} + +func NextBatchNoContext(ctx context.Context, prefix string) (string, error) { + prefix, err := normalizeBatchNoPrefix(prefix) + if err != nil { + return "", err + } + if ctx == nil { + ctx = context.Background() + } + now := time.Now() + seq, err := nextDailyBatchSequence(ctx, now) + if err != nil { + return "", err + } + return formatBatchNo(prefix, now, seq) +} + +func NextRandomNo(prefix string) (string, error) { + prefix = strings.TrimSpace(strings.ToUpper(prefix)) + if prefix == "" { + return "", gerror.New("编号前缀不能为空") + } + + random, err := randomNoSuffix(randomNoSuffixLength) + if err != nil { + return "", err + } + return fmt.Sprintf("%s%s%s", prefix, time.Now().Format("20060102150405"), random), nil +} + +func normalizeBatchNoPrefix(prefix string) (string, error) { + prefix = strings.TrimSpace(strings.ToUpper(prefix)) + if prefix == "" { + return "", gerror.New("批次号前缀不能为空") + } + if len(prefix) != batchNoPrefixLength { + return "", gerror.Newf("批次号前缀必须为%d位", batchNoPrefixLength) + } + return prefix, nil +} + +func nextDailyBatchSequence(ctx context.Context, now time.Time) (int64, error) { + key := batchNoSequenceKey(now) + script := ` +local v = redis.call("INCR", KEYS[1]) +if v == 1 then + redis.call("EXPIRE", KEYS[1], ARGV[1]) +end +return v` + res, err := g.Redis().Do(ctx, "EVAL", script, 1, key, int(batchNoSequenceTTL.Seconds())) + if err != nil { + return 0, gerror.Wrap(err, "生成批次号序号失败") + } + seq := res.Int64() + if seq <= 0 { + return 0, gerror.New("生成批次号序号失败") + } + if seq > batchNoSequenceMax { + return 0, gerror.Newf("当日批次号序号超过%03d", batchNoSequenceMax) + } + return seq, nil +} + +func batchNoSequenceKey(now time.Time) string { + return batchNoSequenceRedisPrefix + now.Format("20060102") +} + +func formatBatchNo(prefix string, now time.Time, seq int64) (string, error) { + if seq <= 0 || seq > batchNoSequenceMax { + return "", gerror.Newf("批次号序号必须在1-%03d之间", batchNoSequenceMax) + } + return fmt.Sprintf("%s%s%0*d", prefix, now.Format("20060102150405"), batchNoSequenceLength, seq), nil +} + +func randomNoSuffix(length int) (string, error) { + if length <= 0 { + return "", gerror.New("随机码长度必须大于0") + } + + buf := make([]byte, length) + randomBytes := make([]byte, length) + if _, err := rand.Read(randomBytes); err != nil { + return "", gerror.Wrap(err, "生成随机码失败") + } + + alphabetLen := byte(len(randomNoAlphabet)) + for i, b := range randomBytes { + buf[i] = randomNoAlphabet[b%alphabetLen] + } + return string(buf), nil +} diff --git a/server/internal/library/batchimport/runner.go b/server/internal/library/batchimport/runner.go new file mode 100644 index 0000000..f7bcc64 --- /dev/null +++ b/server/internal/library/batchimport/runner.go @@ -0,0 +1,635 @@ +package batchimport + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/batchmetadata" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/do" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/hash" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/iot_excelize" + "io" + "os" + "strings" + + "github.com/gogf/gf/v2/crypto/gmd5" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gtime" + "github.com/xuri/excelize/v2" +) + +func SubmitAndRun(ctx context.Context, req SubmitRequest, p Processor) (*Result, error) { + if err := batchmetadata.ValidateCreation(req.SourceChannel, req.ExecutionMode); err != nil { + return nil, err + } + cfg := p.Config() + if req.File == nil { + return nil, gerror.New("请选择上传文件") + } + if err := service.SysOss().CheckType(ctx, consts.SysUploadFileTypeFile, req.File); err != nil { + return nil, err + } + if req.File.Size > cfg.MaxFileSize { + return nil, gerror.Newf("上传文件大小超过限制,最大为%dM", cfg.MaxFileSize>>20) + } + + batchNo, err := NextBatchNoContext(ctx, cfg.BatchNoPrefix) + if err != nil { + return nil, err + } + req.BatchNo = batchNo + result := &Result{ + ImportStatus: consts.ImportStatusFailed, + BatchNo: batchNo, + } + + content, err := readUploadContent(req.File) + if err != nil { + return nil, err + } + + importOss, err := service.SysOss().SaveContent(ctx, &model.SysOssSaveContentParam{ + Content: content, + FileName: batchNo + "-import.xlsx", + NewFileType: consts.SysUploadNewFileTypeUserFile, + SubDirName: cfg.ImportDir, + NotAddDate: 0, + }) + if err != nil { + return nil, gerror.Wrap(err, "保存原始Excel失败") + } + result.ImportFileOssId = importOss.OssId + result.ImportFileUrl = importOss.Url + + rows, err := p.ParseRows(ctx, importOss.Path) + if err != nil { + result.FailReason = userFacingFailReason(err) + if err = archiveFailedBatchAfterImport(ctx, req, p, result, nil, importOss); err != nil { + return nil, err + } + return result, nil + } + result.TotalRows = len(rows) + + if err = p.ValidateRows(ctx, rows); err != nil { + for _, row := range rows { + row.AddErrorReason(userFacingFailReason(err)) + } + } + fillResultCounts(result, rows) + + startTime := gtime.Now() + endTime := gtime.Now() + if err = saveBatchAndExecute(ctx, &req, p, result, rows, importOss, startTime, endTime); err != nil { + markRowsFailed(result, rows, userFacingFailReason(err)) + if err = saveBatchAndExecute(ctx, &req, p, result, rows, importOss, startTime, endTime); err != nil { + return nil, err + } + } + result.ExecutionResult = req.ExecutionResult + + resultOss, downloadId, err := saveResultExcelAndDownload(ctx, req, p, result, rows, importOss, startTime, endTime) + if err != nil { + return nil, err + } + result.ResultDownloadId = downloadId + result.ResultFileOssId = resultOss.OssId + result.ResultFileUrl = resultOss.Url + + if err = updateBatchResultFileInfo(ctx, req, p, result, importOss, resultOss, downloadId); err != nil { + return nil, err + } + + return result, nil +} + +func RunRows(ctx context.Context, req SubmitRequest, p Processor, rows []Row, sourceName string) (*Result, error) { + if err := batchmetadata.ValidateCreation(req.SourceChannel, req.ExecutionMode); err != nil { + return nil, err + } + cfg := p.Config() + batchNo, err := NextBatchNoContext(ctx, cfg.BatchNoPrefix) + if err != nil { + return nil, err + } + req.BatchNo = batchNo + result := &Result{ + ImportStatus: consts.ImportStatusFailed, + BatchNo: batchNo, + TotalRows: len(rows), + } + + if len(rows) == 0 { + result.FailReason = "导入数据为空" + } else if err = p.ValidateRows(ctx, rows); err != nil { + for _, row := range rows { + row.AddErrorReason(userFacingFailReason(err)) + } + } + fillResultCounts(result, rows) + if result.FailReason != "" { + result.ImportStatus = consts.ImportStatusFailed + result.InsertedRows = 0 + } + + startTime := gtime.Now() + endTime := gtime.Now() + importOss := &model.SysOssSaveContentModel{SysOss: &entity.SysOss{}} + if sourceName != "" { + importOss.OriginalName = sourceName + } + if err = saveBatchAndExecute(ctx, &req, p, result, rows, importOss, startTime, endTime); err != nil { + markRowsFailed(result, rows, userFacingFailReason(err)) + if err = saveBatchAndExecute(ctx, &req, p, result, rows, importOss, startTime, endTime); err != nil { + return nil, err + } + } + result.ExecutionResult = req.ExecutionResult + + resultOss, downloadId, err := saveResultExcelAndDownload(ctx, req, p, result, rows, importOss, startTime, endTime) + if err != nil { + return nil, err + } + result.ResultDownloadId = downloadId + result.ResultFileOssId = resultOss.OssId + result.ResultFileUrl = resultOss.Url + + if err = updateBatchResultFileInfo(ctx, req, p, result, importOss, resultOss, downloadId); err != nil { + return nil, err + } + + return result, nil +} + +func archiveFailedBatchAfterImport(ctx context.Context, req SubmitRequest, p Processor, result *Result, rows []Row, importOss *model.SysOssSaveContentModel) error { + result.ImportStatus = consts.ImportStatusFailed + result.InsertedRows = 0 + if result.FailReason == "" { + result.FailReason = "导入失败" + } + + startTime := gtime.Now() + endTime := gtime.Now() + if err := saveBatchAndExecute(ctx, &req, p, result, rows, importOss, startTime, endTime); err != nil { + return err + } + result.ExecutionResult = req.ExecutionResult + + resultOss, downloadId, err := saveResultExcelAndDownload(ctx, req, p, result, rows, importOss, startTime, endTime) + if err != nil { + return err + } + result.ResultDownloadId = downloadId + result.ResultFileOssId = resultOss.OssId + result.ResultFileUrl = resultOss.Url + + return updateBatchResultFileInfo(ctx, req, p, result, importOss, resultOss, downloadId) +} + +func readUploadContent(file *ghttp.UploadFile) ([]byte, error) { + reader, err := file.Open() + if err != nil { + return nil, gerror.Wrap(err, "打开上传文件失败") + } + defer reader.Close() + + content, err := io.ReadAll(reader) + if err != nil { + return nil, gerror.Wrap(err, "读取上传文件失败") + } + return content, nil +} + +func fillResultCounts(result *Result, rows []Row) { + failCount := 0 + for _, row := range rows { + if len(row.GetErrorReasons()) > 0 { + failCount++ + } + } + result.ErrorRows = failCount + result.ValidRows = result.TotalRows - failCount + if result.ValidRows < 0 { + result.ValidRows = 0 + } + if failCount == 0 { + result.ImportStatus = consts.ImportStatusSuccess + result.InsertedRows = len(rows) + return + } + result.ImportStatus = consts.ImportStatusFailed + result.InsertedRows = 0 +} + +func markRowsFailed(result *Result, rows []Row, reason string) { + if result == nil { + return + } + if reason == "" { + reason = "业务处理失败" + } + for _, row := range rows { + row.AddErrorReason(reason) + } + result.ImportStatus = consts.ImportStatusFailed + result.FailReason = reason + result.TotalRows = len(rows) + result.ValidRows = 0 + result.ErrorRows = len(rows) + result.InsertedRows = 0 +} + +// saveBatchAndExecute writes stock data only when all rows pass validation. +// Failed validation keeps the batch and result file, but skips business inserts. +func saveBatchAndExecute(ctx context.Context, req *SubmitRequest, p Processor, result *Result, rows []Row, importOss *model.SysOssSaveContentModel, startTime, endTime *gtime.Time) error { + return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error { + now := gtime.Now() + failReason := result.FailReason + if failReason == "" && result.ErrorRows > 0 { + failReason = "存在校验失败数据,本次未写入" + } + + batchType := batchTypeByImportStatus(req, p, result.ImportStatus) + result.BatchType = batchType + if result.ImportStatus == consts.ImportStatusSuccess && len(rows) > 0 && req.BeforeSave != nil { + if err := req.BeforeSave(ctx, tx, req, rows); err != nil { + return err + } + } + sourceBatchNo := req.SourceBatchNo + if sourceBatchNo == "" { + sourceBatchNo = result.BatchNo + } + + if _, err := tx.Ctx(ctx).Model(dao.BatchMain.Table()).Data(do.BatchMain{ + BatchNo: result.BatchNo, + OrderSn: "", + BatchType: batchType, + BatchAsyncStatus: asyncStatusByImportStatus(result.ImportStatus), + BatchStatus: consts.BatchStatusNormal, + SourceType: req.SourceType, + SourceChannel: batchmetadata.Channel(req.SourceChannel), + ExecutionMode: batchmetadata.NormalizeMode(req.ExecutionMode), + SourceBatchNo: sourceBatchNo, + SourceOssId: ossIDValue(sourceOssID(result, importOss)), + IsCrossDept: 0, + TargetDeptId: req.TargetDeptId, + DeptId: req.Operator.DeptId, + TotalCount: result.TotalRows, + ValidCount: result.ValidRows, + SuccessCount: result.InsertedRows, + FailCount: result.ErrorRows, + RunResult: runResultByImportStatus(result.ImportStatus), + FailReason: failReason, + BatchInfo: p.BuildBatchInfo(ctx, *req, result, importOss, nil, 0), + StartTime: startTime, + EndTime: endTime, + TenantId: req.Operator.TenantId, + CreatedDept: req.Operator.DeptId, + CreatedBy: req.Operator.UserId, + CreatedAt: now, + UpdatedBy: req.Operator.UserId, + UpdatedAt: now, + }).Insert(); err != nil { + return gerror.Wrap(err, "写入批次主表失败") + } + + details := make([]do.BatchDetail, 0, len(rows)) + for _, row := range rows { + details = append(details, do.BatchDetail{ + BatchNo: result.BatchNo, + BatchType: batchType, + DetailStatus: detailStatus(row), + BlankOutStatus: consts.BlankOutStatusNo, + RowNo: row.GetRowNo(), + ItemId: row.GetItemID(), + ErrorCode: "", + ErrorReason: strings.Join(row.GetErrorReasons(), ";"), + Snapshot: row.Snapshot(), + TenantId: req.Operator.TenantId, + CreatedDept: req.Operator.DeptId, + CreatedBy: req.Operator.UserId, + CreatedAt: now, + UpdatedBy: req.Operator.UserId, + UpdatedAt: now, + }) + } + if len(details) > 0 { + if _, err := tx.Ctx(ctx).Model(dao.BatchDetail.Table()).Data(details).Insert(); err != nil { + return gerror.Wrap(err, "写入批次明细失败") + } + } + + if result.ImportStatus == consts.ImportStatusSuccess && len(rows) > 0 && !req.SkipExecute { + if err := p.Execute(ctx, tx, req, rows); err != nil { + return err + } + } + return nil + }) +} + +func saveResultExcelAndDownload(ctx context.Context, req SubmitRequest, p Processor, result *Result, rows []Row, importOss *model.SysOssSaveContentModel, startTime, endTime *gtime.Time) (*model.SysOssSaveContentModel, int64, error) { + cfg := p.Config() + resultRows := make([]iot_excelize.BatchResultRow, 0, len(rows)) + for _, row := range rows { + resultRows = append(resultRows, iot_excelize.BatchResultRow{ + RowNo: row.GetRowNo(), + ItemID: row.GetItemID(), + Status: displayRowStatus(row), + ErrorReason: strings.Join(row.GetErrorReasons(), ";"), + }) + } + + importName := "" + importOssId := "" + if importOss != nil { + importName = importOss.OriginalName + if importOss.OssId > 0 { + importOssId = fmt.Sprintf("%d", importOss.OssId) + } + } + + infos := []iot_excelize.BatchInfoItem{ + {Field: "批次号", Value: result.BatchNo}, + {Field: "批次类型", Value: taskTypeName(p)}, + {Field: "处理结果", Value: displayImportStatus(result.ImportStatus)}, + {Field: "总行数", Value: fmt.Sprintf("%d", result.TotalRows)}, + {Field: "校验通过行数", Value: fmt.Sprintf("%d", result.ValidRows)}, + {Field: "失败行数", Value: fmt.Sprintf("%d", result.ErrorRows)}, + {Field: "实际写入行数", Value: fmt.Sprintf("%d", result.InsertedRows)}, + {Field: "原始文件名", Value: importName}, + {Field: "原始文件OSS ID", Value: importOssId}, + {Field: "结果文件OSS ID", Value: ""}, + {Field: "操作人", Value: fmt.Sprintf("%d", req.Operator.UserId)}, + {Field: "开始时间", Value: formatGTime(startTime)}, + {Field: "结束时间", Value: formatGTime(endTime)}, + {Field: "备注", Value: resultRemark(result)}, + } + + f, err := iot_excelize.BuildBatchResultExcel(resultRows, infos) + if err != nil { + return nil, 0, err + } + defer f.Close() + + reader, err := iot_excelize.ToReadSeeker(f) + if err != nil { + return nil, 0, err + } + content, err := io.ReadAll(reader) + if err != nil { + return nil, 0, err + } + + resultOss, err := service.SysOss().SaveContent(ctx, &model.SysOssSaveContentParam{ + Content: content, + FileName: result.BatchNo + "-result.xlsx", + NewFileType: consts.SysUploadNewFileTypeUserFile, + SubDirName: cfg.ResultDir, + NotAddDate: 0, + }) + if err != nil { + return nil, 0, gerror.Wrap(err, "保存结果Excel失败") + } + if err = fillResultOssId(ctx, req, resultOss); err != nil { + return nil, 0, err + } + + now := gtime.Now() + downloadId, err := dao.TResourceBatchDownload.Ctx(ctx).Data(do.TResourceBatchDownload{ + BatchNo: result.BatchNo, + TaskName: cfg.TaskName, + ResourceType: consts.ResourceTypeExcel, + ExportScene: cfg.ExportScene, + TotalCount: result.TotalRows, + SuccessCount: result.InsertedRows, + FailCount: result.ErrorRows, + DownloadStatus: consts.DownloadStatusGenerated, + OssId: resultOss.OssId, + FileName: resultOss.FileName, + FileExt: resultOss.FileSuffix, + FileUrl: resultOss.Url, + FilePath: resultOss.Path, + FileSize: resultOss.FileSize, + FileMd5: resultOss.Md5, + DownloadCount: 0, + MaxDownloadCount: 0, + DeptId: req.Operator.DeptId, + StartTime: startTime, + FinishTime: now, + TenantId: req.Operator.TenantId, + CreatedDept: req.Operator.DeptId, + CreatedBy: req.Operator.UserId, + CreatedAt: now, + UpdatedBy: req.Operator.UserId, + UpdatedAt: now, + }).InsertAndGetId() + if err != nil { + return nil, 0, gerror.Wrap(err, "写入结果下载任务失败") + } + + return resultOss, downloadId, nil +} + +func fillResultOssId(ctx context.Context, req SubmitRequest, resultOss *model.SysOssSaveContentModel) error { + f, err := excelize.OpenFile(resultOss.Path) + if err != nil { + return gerror.Wrap(err, "打开结果Excel失败") + } + defer f.Close() + + const batchInfoSheet = "批次信息" + rows, err := f.GetRows(batchInfoSheet) + if err != nil { + return gerror.Wrap(err, "读取结果Excel批次信息失败") + } + + found := false + for i, row := range rows { + if len(row) == 0 || strings.TrimSpace(row[0]) != "结果文件OSS ID" { + continue + } + cell, err := excelize.CoordinatesToCellName(2, i+1) + if err != nil { + return err + } + if err = f.SetCellStr(batchInfoSheet, cell, fmt.Sprintf("%d", resultOss.OssId)); err != nil { + return err + } + found = true + break + } + if !found { + return gerror.New("结果Excel缺少结果文件OSS ID字段") + } + if err = f.SaveAs(resultOss.Path); err != nil { + return gerror.Wrap(err, "回写结果Excel OSS ID失败") + } + + fileInfo, err := os.Stat(resultOss.Path) + if err != nil { + return gerror.Wrap(err, "读取结果Excel文件信息失败") + } + md5, _ := gmd5.EncryptFile(resultOss.Path) + crc16 := hash.Crc16ChecksumFile(resultOss.Path) + sum16 := hash.Sum16ChecksumFile(resultOss.Path) + + resultOss.FileSize = int(fileInfo.Size()) + resultOss.Md5 = md5 + resultOss.FileCrc16 = int(crc16) + resultOss.FileSum = int(sum16) + + _, err = dao.SysOss.Ctx(ctx). + Where(dao.SysOss.Columns().OssId, resultOss.OssId). + Data(do.SysOss{ + Md5: resultOss.Md5, + FileSize: resultOss.FileSize, + FileCrc16: resultOss.FileCrc16, + FileSum: resultOss.FileSum, + UpdatedAt: gtime.Now(), + UpdatedBy: req.Operator.UserId, + }). + Update() + if err != nil { + return gerror.Wrap(err, "更新结果Excel文件信息失败") + } + return nil +} + +func updateBatchResultFileInfo(ctx context.Context, req SubmitRequest, p Processor, result *Result, importOss *model.SysOssSaveContentModel, resultOss *model.SysOssSaveContentModel, downloadId int64) error { + _, err := dao.BatchMain.Ctx(ctx). + Where(dao.BatchMain.Columns().BatchNo, result.BatchNo). + Data(do.BatchMain{ + SourceOssId: ossIDValue(sourceOssID(result, importOss)), + ResultOssId: ossIDValue(resultOssID(result, resultOss)), + BatchInfo: p.BuildBatchInfo(ctx, req, result, importOss, resultOss, downloadId), + UpdatedBy: req.Operator.UserId, + UpdatedAt: gtime.Now(), + }). + Update() + if err != nil { + return gerror.Wrap(err, "更新批次结果文件信息失败") + } + return nil +} + +func sourceOssID(result *Result, importOss *model.SysOssSaveContentModel) int64 { + if result != nil && result.ImportFileOssId > 0 { + return result.ImportFileOssId + } + if importOss != nil && importOss.OssId > 0 { + return importOss.OssId + } + return 0 +} + +func resultOssID(result *Result, resultOss *model.SysOssSaveContentModel) int64 { + if result != nil && result.ResultFileOssId > 0 { + return result.ResultFileOssId + } + if resultOss != nil && resultOss.OssId > 0 { + return resultOss.OssId + } + return 0 +} + +func ossIDValue(ossID int64) any { + if ossID <= 0 { + return nil + } + return ossID +} + +func asyncStatusByImportStatus(importStatus string) int { + if importStatus == consts.ImportStatusSuccess { + return consts.BatchAsyncStatusSuccess + } + return consts.BatchAsyncStatusFailed +} + +func runResultByImportStatus(importStatus string) int { + if importStatus == consts.ImportStatusSuccess { + return consts.BatchRunResultSuccess + } + return consts.BatchRunResultFailed +} + +func batchTypeByImportStatus(req *SubmitRequest, p Processor, importStatus string) int { + if req == nil { + return p.Config().BatchType + } + if importStatus != consts.ImportStatusSuccess && req.FailureBatchType > 0 { + return req.FailureBatchType + } + if req.BatchType > 0 { + return req.BatchType + } + return p.Config().BatchType +} + +func detailStatus(row Row) int { + if len(row.GetErrorReasons()) > 0 { + return consts.BatchDetailStatusFailed + } + return consts.BatchDetailStatusSuccess +} + +func displayRowStatus(row Row) string { + if len(row.GetErrorReasons()) > 0 { + return "失败" + } + return "成功" +} + +func displayImportStatus(status string) string { + if status == consts.ImportStatusSuccess { + return "成功" + } + return "失败" +} + +func resultRemark(result *Result) string { + if result != nil && result.ImportStatus == consts.ImportStatusSuccess { + return "导入成功" + } + if result != nil && result.FailReason != "" { + return result.FailReason + } + return "存在校验失败数据,本次未写入" +} + +func userFacingFailReason(err error) string { + if err == nil { + return "" + } + reason := strings.TrimSpace(err.Error()) + if reason == "" { + return "导入失败" + } + const maxLen = 500 + if len([]rune(reason)) <= maxLen { + return reason + } + runes := []rune(reason) + return string(runes[:maxLen]) +} + +func taskTypeName(p Processor) string { + taskName := p.Config().TaskName + return strings.TrimSuffix(taskName, "结果") +} + +func formatGTime(t *gtime.Time) string { + if t == nil { + return "" + } + return t.Format("Y-m-d H:i:s") +} diff --git a/server/internal/library/batchimport/types.go b/server/internal/library/batchimport/types.go new file mode 100644 index 0000000..8d1635a --- /dev/null +++ b/server/internal/library/batchimport/types.go @@ -0,0 +1,93 @@ +package batchimport + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/net/ghttp" +) + +type SubmitRequest struct { + SourceChannel string + // ExecutionMode is the semantic size of the operation. Zero means the caller did not specify it. + ExecutionMode int + File *ghttp.UploadFile + BizParams any + SourceType int + SourceBatchNo string + TargetDeptId int64 + Operator OperatorContext + BatchNo string + BatchType int + FailureBatchType int + SkipExecute bool + BeforeSave func(ctx context.Context, tx gdb.TX, req *SubmitRequest, rows []Row) error + ExecutionResult any +} + +type OperatorContext struct { + TenantId string + DeptId int64 + UserId int64 +} + +type Result struct { + ImportStatus string + BatchNo string + BatchType int + FailReason string + ImportFileOssId int64 + ImportFileUrl string + TotalRows int + ValidRows int + ErrorRows int + InsertedRows int + ResultDownloadId int64 + ResultFileOssId int64 + ResultFileUrl string + ExecutionResult any +} + +type Row interface { + GetRowNo() int + GetItemID() string + GetErrorReasons() []string + AddErrorReason(reason string) + Snapshot() *gjson.Json +} + +type ProcessorConfig struct { + Code string + BatchType int + BatchNoPrefix string + TaskName string + ExportScene int + ImportDir string + ResultDir string + MaxFileSize int64 + MaxRows int + TemplateHeaders []string + RequiredHeaders []string +} + +type Processor interface { + Config() ProcessorConfig + ParseRows(ctx context.Context, filePath string) ([]Row, error) + ValidateRows(ctx context.Context, rows []Row) error + Execute(ctx context.Context, tx gdb.TX, req *SubmitRequest, rows []Row) error + BuildBatchInfo(ctx context.Context, req SubmitRequest, result *Result, importOss *model.SysOssSaveContentModel, resultOss *model.SysOssSaveContentModel, downloadId int64) *gjson.Json +} + +type PendingProcessor interface { + Config() ProcessorConfig + ParseRows(ctx context.Context, filePath string) ([]Row, error) + ValidateRows(ctx context.Context, rows []Row) error + BuildBatchInfo(ctx context.Context, req SubmitRequest, result *Result, importOss *model.SysOssSaveContentModel, resultOss *model.SysOssSaveContentModel, downloadId int64) *gjson.Json +} + +type Message struct { + BatchNo string `json:"batchNo"` + BatchType int `json:"batchType"` +} diff --git a/server/internal/library/batchimport/upload.go b/server/internal/library/batchimport/upload.go new file mode 100644 index 0000000..169c0f6 --- /dev/null +++ b/server/internal/library/batchimport/upload.go @@ -0,0 +1,66 @@ +package batchimport + +import ( + "context" + "strings" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/do" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gtime" +) + +func SaveUpload(ctx context.Context, file *ghttp.UploadFile, fileName, subDirName string) (*model.SysOssSaveContentModel, error) { + if file == nil { + return nil, gerror.New("upload file is required") + } + + result, err := service.SysOss().UploadLocalWithFileName( + ctx, + file, + consts.SysUploadNewFileTypeUserFile, + strings.TrimSpace(fileName), + subDirName, + 0, + ) + if err != nil { + return nil, err + } + + now := gtime.Now() + id, err := g.DB().Model(dao.SysOss.Table()).Data(do.SysOss{ + TenantId: contexts.GetTenantId(ctx), + FileName: result.Name, + OriginalName: result.OriginalName, + FileSuffix: result.Ext, + Path: result.Path, + Url: result.FullPath, + CreatedDept: contexts.GetDeptId(ctx), + CreatedAt: now, + CreatedBy: contexts.GetUserId(ctx), + UpdatedAt: now, + UpdatedBy: contexts.GetUserId(ctx), + Service: "local", + Md5: result.Md5, + FileSize: result.Size, + FileCrc16: result.Crc16, + FileSum: result.Sum16, + }).InsertAndGetId() + if err != nil { + return nil, gerror.Wrap(err, "save uploaded file metadata failed") + } + + oss := &entity.SysOss{} + if err = g.DB().Model(dao.SysOss.Table()).Where(dao.SysOss.Columns().OssId, id).Scan(oss); err != nil { + return nil, gerror.Wrap(err, "load uploaded file metadata failed") + } + return &model.SysOssSaveContentModel{SysOss: oss}, nil +} diff --git a/server/internal/library/batchinput/excel/csv.go b/server/internal/library/batchinput/excel/csv.go new file mode 100644 index 0000000..e5d755b --- /dev/null +++ b/server/internal/library/batchinput/excel/csv.go @@ -0,0 +1,78 @@ +package excel + +import ( + "context" + "encoding/csv" + "io" + "os" + + "github.com/gogf/gf/v2/errors/gerror" +) + +func StreamCSVFile(ctx context.Context, filePath string, options ParseOptions, handler func(ParsedRow) error) (int, error) { + file, err := os.Open(filePath) + if err != nil { + return 0, gerror.Wrap(err, "open CSV file failed") + } + defer file.Close() + return StreamCSVReader(ctx, file, options, handler) +} + +func StreamCSVReader(ctx context.Context, reader io.Reader, options ParseOptions, handler func(ParsedRow) error) (int, error) { + if handler == nil { + return 0, gerror.New("CSV row handler cannot be nil") + } + + csvReader := csv.NewReader(reader) + csvReader.FieldsPerRecord = -1 + csvReader.ReuseRecord = true + + headers, err := csvReader.Read() + if err != nil { + if err == io.EOF { + return 0, gerror.New("CSV file has no header") + } + return 0, gerror.Wrap(err, "read CSV header failed") + } + columnIndex, err := buildColumnIndex(headers) + if err != nil { + return 0, err + } + for _, requiredHeader := range options.RequiredHeaders { + if _, ok := columnIndex[normalizeHeader(requiredHeader)]; !ok { + return 0, gerror.Newf("CSV file is missing required column: %s", requiredHeader) + } + } + + rowNo := 1 + parsedCount := 0 + for { + if err = ctx.Err(); err != nil { + return parsedCount, err + } + values, readErr := csvReader.Read() + if readErr == io.EOF { + break + } + if readErr != nil { + return parsedCount, gerror.Wrapf(readErr, "read CSV row %d failed", rowNo+1) + } + rowNo++ + if isEmptyRow(values) { + continue + } + + fields := make(map[string]string, len(columnIndex)) + for columnName, index := range columnIndex { + fields[columnName] = cellValue(values, index) + } + if err = handler(ParsedRow{RowNo: rowNo, Fields: fields}); err != nil { + return parsedCount, err + } + parsedCount++ + } + if parsedCount == 0 { + return 0, gerror.New("CSV file has no data rows") + } + return parsedCount, nil +} diff --git a/server/internal/library/batchinput/excel/parser.go b/server/internal/library/batchinput/excel/parser.go new file mode 100644 index 0000000..1e2cd8c --- /dev/null +++ b/server/internal/library/batchinput/excel/parser.go @@ -0,0 +1,248 @@ +package excel + +import ( + "context" + "io" + "os" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/xuri/excelize/v2" +) + +type ParseOptions struct { + RequiredHeaders []string + SingleSheet bool + // MaxDataRows 限制单次导入的有效数据行数(不含表头、不含空行)。 + // 0 表示不限制(向后兼容已有批量功能)。超过该值立即停止读取并返回错误, + // 避免超大 Excel 在解析阶段占用过多内存或解析完成后才报错。 + MaxDataRows int +} + +func ParseFile(ctx context.Context, filePath string, options ParseOptions) ([]ParsedRow, error) { + file, err := os.Open(filePath) + if err != nil { + return nil, gerror.Wrap(err, "open Excel file failed") + } + defer file.Close() + return ParseReader(ctx, file, options) +} + +// StreamFile parses the first data sheet row by row and keeps only the current +// row in memory. +func StreamFile(ctx context.Context, filePath string, options ParseOptions, handler func(ParsedRow) error) (int, error) { + file, err := os.Open(filePath) + if err != nil { + return 0, gerror.Wrap(err, "open Excel file failed") + } + defer file.Close() + return StreamReader(ctx, file, options, handler) +} + +func StreamReader(ctx context.Context, reader io.Reader, options ParseOptions, handler func(ParsedRow) error) (int, error) { + if handler == nil { + return 0, gerror.New("Excel row handler cannot be nil") + } + f, err := excelize.OpenReader(reader) + if err != nil { + return 0, gerror.Wrap(err, "open Excel file failed") + } + defer func() { _ = f.Close() }() + + sheetList := f.GetSheetList() + if len(sheetList) == 0 { + return 0, gerror.New("Excel file has no worksheet") + } + if options.SingleSheet { + if err = ensureSingleDataSheet(f, sheetList); err != nil { + return 0, err + } + } + + rows, err := f.Rows(sheetList[0]) + if err != nil { + return 0, gerror.Wrap(err, "read Excel rows failed") + } + defer rows.Close() + + if !rows.Next() { + if err = rows.Error(); err != nil { + return 0, gerror.Wrap(err, "read Excel header failed") + } + return 0, gerror.New("Excel file has no header") + } + headers, err := rows.Columns() + if err != nil { + return 0, gerror.Wrap(err, "read Excel header failed") + } + colIndex, err := buildColumnIndex(headers) + if err != nil { + return 0, err + } + for _, col := range options.RequiredHeaders { + if _, ok := colIndex[normalizeHeader(col)]; !ok { + return 0, gerror.Newf("Excel file is missing required column: %s", col) + } + } + + rowNo := 1 + parsedCount := 0 + for rows.Next() { + rowNo++ + if err = ctx.Err(); err != nil { + return parsedCount, err + } + values, columnsErr := rows.Columns() + if columnsErr != nil { + return parsedCount, gerror.Wrapf(columnsErr, "read Excel row %d failed", rowNo) + } + if isEmptyRow(values) { + continue + } + fields := make(map[string]string, len(colIndex)) + for colName, idx := range colIndex { + fields[colName] = cellValue(values, idx) + } + if err = handler(ParsedRow{RowNo: rowNo, Fields: fields}); err != nil { + return parsedCount, err + } + parsedCount++ + } + if err = rows.Error(); err != nil { + return parsedCount, gerror.Wrap(err, "read Excel rows failed") + } + if parsedCount == 0 { + return 0, gerror.New("Excel file has no data rows") + } + return parsedCount, nil +} + +func ParseReader(ctx context.Context, reader io.Reader, options ParseOptions) ([]ParsedRow, error) { + f, err := excelize.OpenReader(reader) + if err != nil { + return nil, gerror.Wrap(err, "open Excel file failed") + } + defer func() { _ = f.Close() }() + + sheetList := f.GetSheetList() + if len(sheetList) == 0 { + return nil, gerror.New("Excel file has no worksheet") + } + if options.SingleSheet { + if err = ensureSingleDataSheet(f, sheetList); err != nil { + return nil, err + } + } + + // 使用流式迭代器逐行读取,避免在超过 MaxDataRows 时仍把整张表读入内存。 + rowsIter, err := f.Rows(sheetList[0]) + if err != nil { + return nil, gerror.Wrap(err, "read Excel rows failed") + } + defer func() { _ = rowsIter.Close() }() + + if !rowsIter.Next() { + return nil, gerror.New("Excel文件缺少表头,请检查文件内容") + } + header, err := rowsIter.Columns() + if err != nil { + return nil, gerror.Wrap(err, "读取Excel表头失败,请检查文件内容") + } + colIndex, err := buildColumnIndex(header) + if err != nil { + return nil, err + } + for _, col := range options.RequiredHeaders { + if _, ok := colIndex[normalizeHeader(col)]; !ok { + return nil, gerror.Newf("Excel file is missing required column: %s", col) + } + } + + initCap := options.MaxDataRows + if initCap <= 0 || initCap > 100000 { + initCap = 1024 + } + parsedRows := make([]ParsedRow, 0, initCap) + lineNo := 2 + dataCount := 0 + for rowsIter.Next() { + if err = ctx.Err(); err != nil { + return nil, err + } + row, err := rowsIter.Columns() + if err != nil { + return nil, gerror.Wrap(err, "读取Excel数据失败,请检查文件内容") + } + if isEmptyRow(row) { + lineNo++ + continue + } + dataCount++ + if options.MaxDataRows > 0 && dataCount > options.MaxDataRows { + return nil, gerror.Newf("单次导入最多支持%d张卡,请拆分后重试", options.MaxDataRows) + } + fields := make(map[string]string, len(colIndex)) + for colName, idx := range colIndex { + fields[colName] = cellValue(row, idx) + } + parsedRows = append(parsedRows, ParsedRow{ + RowNo: lineNo, + Fields: fields, + }) + lineNo++ + } + if len(parsedRows) == 0 { + return nil, gerror.New("Excel file has no data rows") + } + return parsedRows, nil +} + +func buildColumnIndex(headers []string) (map[string]int, error) { + colIndex := make(map[string]int) + for i, col := range headers { + header := NormalizeHeader(col) + if header == "" { + continue + } + if _, exists := colIndex[header]; exists { + return nil, gerror.Newf("Excel file has duplicate column: %s", strings.TrimSpace(col)) + } + colIndex[header] = i + } + return colIndex, nil +} + +func ensureSingleDataSheet(f *excelize.File, sheetList []string) error { + for _, sheetName := range sheetList[1:] { + rows, err := f.GetRows(sheetName) + if err != nil { + return gerror.Wrap(err, "read Excel worksheet failed") + } + for _, row := range rows { + if !isEmptyRow(row) { + return gerror.New("only one non-empty worksheet is supported") + } + } + } + return nil +} + +func cellValue(row []string, index int) string { + if index < 0 || index >= len(row) { + return "" + } + return strings.TrimSpace(row[index]) +} + +func isEmptyRow(row []string) bool { + for _, col := range row { + if strings.TrimSpace(col) != "" { + return false + } + } + return true +} + +func normalizeHeader(header string) string { + return NormalizeHeader(header) +} diff --git a/server/internal/library/batchinput/excel/row.go b/server/internal/library/batchinput/excel/row.go new file mode 100644 index 0000000..12da0ee --- /dev/null +++ b/server/internal/library/batchinput/excel/row.go @@ -0,0 +1,15 @@ +package excel + +import "strings" + +type ParsedRow struct { + RowNo int + Fields map[string]string +} + +func Field(row ParsedRow, name string) string { + if row.Fields == nil { + return "" + } + return strings.TrimSpace(row.Fields[NormalizeHeader(name)]) +} diff --git a/server/internal/library/batchinput/excel/schema.go b/server/internal/library/batchinput/excel/schema.go new file mode 100644 index 0000000..c584da2 --- /dev/null +++ b/server/internal/library/batchinput/excel/schema.go @@ -0,0 +1,33 @@ +package excel + +type ColumnType string + +const ( + ColumnTypeString ColumnType = "string" + ColumnTypeInt ColumnType = "int" + ColumnTypePositiveInt ColumnType = "positive_int" + ColumnTypeNonNegativeInt ColumnType = "non_negative_int" + ColumnTypeBool ColumnType = "bool" + ColumnTypeDate ColumnType = "date" + ColumnTypeDateTime ColumnType = "datetime" + ColumnTypeAmount ColumnType = "amount" +) + +type ColumnSpec struct { + Name string + Required bool + Type ColumnType +} + +type ConsistencyRule struct { + Name string + Type ColumnType + AllowEmpty bool +} + +type RowIssue struct { + RowNo int + Column string + Value string + Message string +} diff --git a/server/internal/library/batchinput/excel/validator.go b/server/internal/library/batchinput/excel/validator.go new file mode 100644 index 0000000..ea71a15 --- /dev/null +++ b/server/internal/library/batchinput/excel/validator.go @@ -0,0 +1,99 @@ +package excel + +import ( + "fmt" + "strings" +) + +func ValidateRequiredFields(rows []ParsedRow, specs []ColumnSpec) []RowIssue { + issues := make([]RowIssue, 0) + for _, row := range rows { + for _, spec := range specs { + if !spec.Required { + continue + } + value := Field(row, spec.Name) + if value != "" { + continue + } + issues = append(issues, RowIssue{ + RowNo: row.RowNo, + Column: spec.Name, + Value: value, + Message: fmt.Sprintf("%s is required", spec.Name), + }) + } + } + return issues +} + +func ValidateRowTypes(rows []ParsedRow, specs []ColumnSpec) []RowIssue { + issues := make([]RowIssue, 0) + for _, row := range rows { + for _, spec := range specs { + value := Field(row, spec.Name) + if value == "" { + continue + } + if _, err := normalizedValue(value, spec.Type); err != nil { + issues = append(issues, RowIssue{ + RowNo: row.RowNo, + Column: spec.Name, + Value: value, + Message: fmt.Sprintf("%s format is invalid", spec.Name), + }) + } + } + } + return issues +} + +func ValidateFileConsistency(rows []ParsedRow, rules []ConsistencyRule) []RowIssue { + issues := make([]RowIssue, 0) + for _, rule := range rules { + baseValue := "" + baseSet := false + for _, row := range rows { + raw := Field(row, rule.Name) + normalized := "" + if strings.TrimSpace(raw) == "" { + if !rule.AllowEmpty { + issues = append(issues, RowIssue{ + RowNo: row.RowNo, + Column: rule.Name, + Value: raw, + Message: fmt.Sprintf("%s must not be empty", rule.Name), + }) + continue + } + } else { + value, err := normalizedValue(raw, rule.Type) + if err != nil { + issues = append(issues, RowIssue{ + RowNo: row.RowNo, + Column: rule.Name, + Value: raw, + Message: fmt.Sprintf("%s format is invalid", rule.Name), + }) + continue + } + normalized = value + } + + if !baseSet { + baseValue = normalized + baseSet = true + continue + } + if normalized != baseValue { + issues = append(issues, RowIssue{ + RowNo: row.RowNo, + Column: rule.Name, + Value: raw, + Message: fmt.Sprintf("%s must be consistent", rule.Name), + }) + } + } + } + return issues +} diff --git a/server/internal/library/batchinput/excel/value.go b/server/internal/library/batchinput/excel/value.go new file mode 100644 index 0000000..a01e24c --- /dev/null +++ b/server/internal/library/batchinput/excel/value.go @@ -0,0 +1,220 @@ +package excel + +import ( + "fmt" + "math" + "strconv" + "strings" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +func NormalizeHeader(header string) string { + header = strings.ReplaceAll(header, "\uFEFF", "") + header = strings.TrimSpace(header) + header = strings.TrimRight(header, "**") + return strings.ToUpper(strings.TrimSpace(header)) +} + +func ParseString(value string) string { + return strings.TrimSpace(value) +} + +func ParseInt(value string) (int, error) { + value = strings.TrimSpace(value) + if value == "" { + return 0, strconv.ErrSyntax + } + return strconv.Atoi(value) +} + +func ParsePositiveInt(value string) (int, error) { + parsed, err := ParseInt(value) + if err != nil || parsed <= 0 { + return 0, strconv.ErrSyntax + } + return parsed, nil +} + +func ParseNonNegativeInt(value string) (int, error) { + parsed, err := ParseInt(value) + if err != nil || parsed < 0 { + return 0, strconv.ErrSyntax + } + return parsed, nil +} + +func ParseBool(value string) (bool, error) { + switch strings.ToLower(strings.TrimSpace(value)) { + case "1", "true", "yes", "y", "\u662f", "\u5df2\u5b8c\u6210", "\u5b8c\u6210": + return true, nil + case "0", "false", "no", "n", "\u5426", "\u672a\u5b8c\u6210": + return false, nil + default: + return false, strconv.ErrSyntax + } +} + +func ParseDate(value string) (*gtime.Time, error) { + parsed, err := parseTimeValue(value) + if err != nil { + return nil, err + } + return gtime.NewFromTime(time.Date( + parsed.Year(), + time.Month(parsed.Month()), + parsed.Day(), + 0, + 0, + 0, + 0, + parsed.Location(), + )), nil +} + +func ParseDateTime(value string) (*gtime.Time, error) { + return parseTimeValue(value) +} + +func ParseAmount(value string) (float64, error) { + value = strings.TrimSpace(value) + if value == "" { + return 0, strconv.ErrSyntax + } + value = strings.ReplaceAll(value, ",", "") + parsed, err := strconv.ParseFloat(value, 64) + if err != nil || parsed < 0 { + return 0, strconv.ErrSyntax + } + return math.Round(parsed*100) / 100, nil +} + +func normalizedValue(value string, typ ColumnType) (string, error) { + switch typ { + case "", ColumnTypeString: + return ParseString(value), nil + case ColumnTypeInt: + parsed, err := ParseInt(value) + if err != nil { + return "", err + } + return strconv.Itoa(parsed), nil + case ColumnTypePositiveInt: + parsed, err := ParsePositiveInt(value) + if err != nil { + return "", err + } + return strconv.Itoa(parsed), nil + case ColumnTypeNonNegativeInt: + parsed, err := ParseNonNegativeInt(value) + if err != nil { + return "", err + } + return strconv.Itoa(parsed), nil + case ColumnTypeBool: + parsed, err := ParseBool(value) + if err != nil { + return "", err + } + return strconv.FormatBool(parsed), nil + case ColumnTypeDate: + parsed, err := ParseDate(value) + if err != nil { + return "", err + } + return parsed.Format("Y-m-d"), nil + case ColumnTypeDateTime: + parsed, err := ParseDateTime(value) + if err != nil { + return "", err + } + return parsed.Format("Y-m-d H:i:s"), nil + case ColumnTypeAmount: + parsed, err := ParseAmount(value) + if err != nil { + return "", err + } + return fmt.Sprintf("%.2f", parsed), nil + default: + return "", gerror.Newf("unsupported column type: %s", typ) + } +} + +func parseTimeValue(value string) (*gtime.Time, error) { + value = strings.TrimSpace(value) + if value == "" { + return nil, strconv.ErrSyntax + } + if parsed, ok := parseCompactTime(value); ok { + return parsed, nil + } + if parsed, ok := parseLayoutTime(value); ok { + return parsed, nil + } + parsed, err := gtime.StrToTime(value) + if err != nil || parsed == nil || parsed.IsZero() || parsed.Year() <= 0 { + if err != nil { + return nil, err + } + return nil, strconv.ErrSyntax + } + return parsed, nil +} + +func parseCompactTime(value string) (*gtime.Time, bool) { + if !isDigits(value) { + return nil, false + } + layout := "" + switch len(value) { + case 8: + layout = "20060102" + case 12: + layout = "200601021504" + case 14: + layout = "20060102150405" + default: + return nil, false + } + parsed, err := time.ParseInLocation(layout, value, time.Local) + if err != nil { + return nil, false + } + return gtime.NewFromTime(parsed), true +} + +func parseLayoutTime(value string) (*gtime.Time, bool) { + layouts := []string{ + time.RFC3339, + time.RFC3339Nano, + "2006-1-2 15:04:05", + "2006-1-2 15:04", + "2006/1/2 15:04:05", + "2006/1/2 15:04", + "2006.1.2 15:04:05", + "2006.1.2 15:04", + "2006-1-2T15:04:05", + "2006-1-2T15:04", + "2006-1-2", + "2006/1/2", + "2006.1.2", + } + for _, layout := range layouts { + parsed, err := time.ParseInLocation(layout, value, time.Local) + if err == nil { + return gtime.NewFromTime(parsed), true + } + } + return nil, false +} + +func isDigits(value string) bool { + for _, r := range value { + if r < '0' || r > '9' { + return false + } + } + return value != "" +} diff --git a/server/internal/library/batchinput/numrange/range.go b/server/internal/library/batchinput/numrange/range.go new file mode 100644 index 0000000..c7e0c70 --- /dev/null +++ b/server/internal/library/batchinput/numrange/range.go @@ -0,0 +1,131 @@ +package numrange + +import ( + "context" + "fmt" + "math/big" + "strings" + "unicode" + + "github.com/gogf/gf/v2/errors/gerror" +) + +func Build(ctx context.Context, start, end, field string, maxRows int) ([]string, error) { + start = strings.TrimSpace(start) + end = strings.TrimSpace(end) + if start == "" || end == "" { + return nil, gerror.Newf("%s起止号不能为空", field) + } + if strings.EqualFold(strings.TrimSpace(field), "ICCID") { + return buildAlphaNumericICCIDRange(ctx, start, end, field, maxRows) + } + return buildNumericRange(ctx, start, end, field, maxRows) +} + +func buildNumericRange(ctx context.Context, start, end, field string, maxRows int) ([]string, error) { + if !isDigits(start) || !isDigits(end) { + return nil, gerror.Newf("%s起止号必须为数字", field) + } + if len(start) != len(end) { + return nil, gerror.Newf("%s起止号长度必须一致", field) + } + + startInt, ok := new(big.Int).SetString(start, 10) + if !ok { + return nil, gerror.Newf("%s起始号格式错误", field) + } + endInt, ok := new(big.Int).SetString(end, 10) + if !ok { + return nil, gerror.Newf("%s结束号格式错误", field) + } + if startInt.Cmp(endInt) > 0 { + return nil, gerror.Newf("%s起始号不能大于结束号", field) + } + + count := new(big.Int).Sub(endInt, startInt) + count.Add(count, big.NewInt(1)) + if maxRows > 0 && (!count.IsInt64() || count.Int64() > int64(maxRows)) { + return nil, gerror.Newf("%s号段数量不能超过%d条", field, maxRows) + } + + size := int(count.Int64()) + rows := make([]string, 0, size) + current := new(big.Int).Set(startInt) + one := big.NewInt(1) + for i := 0; i < size; i++ { + if err := ctx.Err(); err != nil { + return nil, err + } + rows = append(rows, fmt.Sprintf("%0*s", len(start), current.String())) + current.Add(current, one) + } + return rows, nil +} + +func buildAlphaNumericICCIDRange(ctx context.Context, start, end, field string, maxRows int) ([]string, error) { + if !isAlphaNumeric(start) || !isAlphaNumeric(end) { + return nil, gerror.Newf("%s起止号只能包含字母和数字", field) + } + if len(start) != len(end) { + return nil, gerror.Newf("%s起止号长度必须一致", field) + } + if start == end { + return []string{start}, nil + } + + startPrefix, startTail := splitTrailingDigits(start) + endPrefix, endTail := splitTrailingDigits(end) + if startTail == "" || endTail == "" { + return nil, gerror.Newf("%s起止号必须包含可递增的数字尾号", field) + } + if startPrefix != endPrefix { + return nil, gerror.Newf("%s起止号前缀必须一致", field) + } + tails, err := buildNumericRange(ctx, startTail, endTail, field, maxRows) + if err != nil { + return nil, err + } + + rows := make([]string, 0, len(tails)) + for _, tail := range tails { + rows = append(rows, startPrefix+tail) + } + return rows, nil +} + +func isDigits(value string) bool { + if value == "" { + return false + } + for _, r := range value { + if !unicode.IsDigit(r) { + return false + } + } + return true +} + +func isAlphaNumeric(value string) bool { + if value == "" { + return false + } + for _, r := range value { + if (r >= '0' && r <= '9') || (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') { + continue + } + return false + } + return true +} + +func splitTrailingDigits(value string) (prefix, digits string) { + index := len(value) + for index > 0 { + ch := value[index-1] + if ch < '0' || ch > '9' { + break + } + index-- + } + return value[:index], value[index:] +} diff --git a/server/internal/library/batchinput/text/lines.go b/server/internal/library/batchinput/text/lines.go new file mode 100644 index 0000000..49c0a48 --- /dev/null +++ b/server/internal/library/batchinput/text/lines.go @@ -0,0 +1,59 @@ +package text + +import ( + "context" + "errors" + "strings" +) + +var ErrEmptyInput = errors.New("batch input content cannot be empty") + +type Line struct { + RowNo int + Text string +} + +type FieldLine struct { + RowNo int + Fields []string +} + +func ParseNonEmptyLines(ctx context.Context, input string) ([]Line, error) { + lines := strings.Split(input, "\n") + result := make([]Line, 0, len(lines)) + for index, line := range lines { + if err := ctx.Err(); err != nil { + return nil, err + } + value := strings.TrimSpace(line) + if value == "" { + continue + } + result = append(result, Line{ + RowNo: index + 1, + Text: value, + }) + } + if len(result) == 0 { + return nil, ErrEmptyInput + } + return result, nil +} + +func ParseWhitespaceFields(ctx context.Context, input string) ([]FieldLine, error) { + lines, err := ParseNonEmptyLines(ctx, input) + if err != nil { + return nil, err + } + result := make([]FieldLine, 0, len(lines)) + for _, line := range lines { + if err = ctx.Err(); err != nil { + return nil, err + } + result = append(result, FieldLine{ + RowNo: line.RowNo, + Fields: strings.Fields(line.Text), + }) + } + return result, nil +} diff --git a/server/internal/library/batchmetadata/metadata.go b/server/internal/library/batchmetadata/metadata.go new file mode 100644 index 0000000..0d4795e --- /dev/null +++ b/server/internal/library/batchmetadata/metadata.go @@ -0,0 +1,52 @@ +package batchmetadata + +import "github.com/gogf/gf/v2/errors/gerror" + +const ( + Console = "console" + MiniProgram = "mini_program" + API = "api" + System = "system" + Legacy = "legacy" + Unknown = 0 + Single = 1 + Bulk = 2 +) + +// NormalizeMode validates the explicit execution size supplied by the business entry point. +// Execution size is request metadata and must not be inferred from context or result counts. +func NormalizeMode(requested int) int { + if requested == Single || requested == Bulk { + return requested + } + return Unknown +} + +func ValidChannel(value string) bool { + switch value { + case Console, MiniProgram, API, System, Legacy: + return true + } + return false +} + +func Channel(value string) string { + if ValidChannel(value) { + return value + } + return Legacy +} + +func ValidMode(value int) bool { return value >= Unknown && value <= Bulk } + +// ValidateCreation rejects missing attribution for new work; historical reads +// and resumed work continue to use Channel/NormalizeMode for compatibility. +func ValidateCreation(channel string, mode int) error { + if !ValidChannel(channel) || channel == Legacy { + return gerror.New("新建批次发起渠道无效") + } + if mode != Single && mode != Bulk { + return gerror.New("新建批次必须指定单卡或批量操作规模") + } + return nil +} diff --git a/server/internal/library/bcache/bcache.go b/server/internal/library/bcache/bcache.go new file mode 100644 index 0000000..083c8a3 --- /dev/null +++ b/server/internal/library/bcache/bcache.go @@ -0,0 +1,6 @@ +// Package bcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package bcache diff --git a/server/internal/library/bcache/bcache_system_auth.go b/server/internal/library/bcache/bcache_system_auth.go new file mode 100644 index 0000000..92fa2d3 --- /dev/null +++ b/server/internal/library/bcache/bcache_system_auth.go @@ -0,0 +1,77 @@ +// Package bcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package bcache + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/cache" + "time" + + "github.com/gogf/gf/v2/frame/g" +) + +// 设置系统认证token缓存 +func SetSysAuthToken(ctx context.Context, userId int64, uuid string, token string, timeout time.Duration) (err error) { + key := fmt.Sprintf(consts.KeySysAuthToken, userId, uuid) + err = cache.Instance().Set(ctx, key, token, timeout) + if err != nil { + return err + } + return nil +} + +// 获取系统认证token缓存 +func GetSysAuthToken(ctx context.Context, userId int64, uuid string) (token string, err error) { + key := fmt.Sprintf(consts.KeySysAuthToken, userId, uuid) + t, err := cache.Instance().Get(ctx, key) + if err != nil { + g.Log().Errorf(ctx, "bcache.GetSysAuthToken Get failed,error: %v, userId: %d, uuid: %s, key: %s", err, userId, uuid, key) + return "", err + } + return t.String(), nil +} + +// 删除系统认证token缓存 +func DelSysAuthToken(ctx context.Context, userId int64, uuid string) (err error) { + key := fmt.Sprintf(consts.KeySysAuthToken, userId, uuid) + _, err = cache.Instance().Remove(ctx, key) + if err != nil { + return err + } + return nil +} + +// 设置系统认证token拒绝缓存 +func SetSysAuthTokenReject(ctx context.Context, userId int64, uuid string, token string, timeout time.Duration) (err error) { + key := fmt.Sprintf(consts.KeySysAuthTokenReject, userId, uuid) + err = cache.Instance().Set(ctx, key, token, timeout) + if err != nil { + return err + } + return nil +} + +// 获取系统认证token拒绝缓存 +func GetSysAuthTokenReject(ctx context.Context, userId int64, uuid string) (token string, err error) { + key := fmt.Sprintf(consts.KeySysAuthTokenReject, userId, uuid) + t, err := cache.Instance().Get(ctx, key) + if err != nil { + return "", err + } + return t.String(), nil +} + +// 删除系统认证token拒绝缓存 +func DelSysAuthTokenReject(ctx context.Context, userId int64, uuid string) (err error) { + key := fmt.Sprintf(consts.KeySysAuthTokenReject, userId, uuid) + _, err = cache.Instance().Remove(ctx, key) + if err != nil { + return err + } + return nil +} diff --git a/server/internal/library/bcache/mfa.go b/server/internal/library/bcache/mfa.go new file mode 100644 index 0000000..8c204b7 --- /dev/null +++ b/server/internal/library/bcache/mfa.go @@ -0,0 +1,30 @@ +package bcache + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + + "github.com/gogf/gf/v2/frame/g" +) + +// 存储mfa验证码 KeyUserMfaCode:{uuid} +func SetUserMfaCode(ctx context.Context, uuid string, code string) error { + mfaKey := fmt.Sprintf(consts.KeyUserMfaCode, uuid) + _, err := g.Redis().Set(ctx, mfaKey, code) + return err +} + +// 获取mfa验证码 KeyUserMfaCode:{uuid} +func GetUserMfaCode(ctx context.Context, uuid string) (string, error) { + mfaKey := fmt.Sprintf(consts.KeyUserMfaCode, uuid) + code, err := g.Redis().Get(ctx, mfaKey) + return code.String(), err +} + +// 删除mfa验证码 KeyUserMfaCode:{uuid} +func DeleteUserMfaCode(ctx context.Context, uuid string) error { + mfaKey := fmt.Sprintf(consts.KeyUserMfaCode, uuid) + _, err := g.Redis().Del(ctx, mfaKey) + return err +} diff --git a/server/internal/library/cache/cache.go b/server/internal/library/cache/cache.go new file mode 100644 index 0000000..b640904 --- /dev/null +++ b/server/internal/library/cache/cache.go @@ -0,0 +1,60 @@ +// Package cache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package cache + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/cache/file" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcache" + "github.com/gogf/gf/v2/os/gfile" +) + +// cache 缓存驱动 +var cacheVal *gcache.Cache + +// Instance 缓存实例 +func Instance() *gcache.Cache { + if cacheVal == nil { + panic("cache uninitialized.") + } + return cacheVal +} + +// SetAdapter 设置缓存适配器 +func SetAdapter(ctx context.Context) { + var cacheAdapter gcache.Adapter + adapter := g.Cfg().MustGet(ctx, "cache.adapter").String() + fileDir := g.Cfg().MustGet(ctx, "cache.fileDir").String() + + switch adapter { + case "redis": + cacheAdapter = gcache.NewAdapterRedis(g.Redis()) + case "file": + if fileDir == "" { + g.Log().Fatal(ctx, "file path must be configured for file caching.") + return + } + + if !gfile.Exists(fileDir) { + if err := gfile.Mkdir(fileDir); err != nil { + g.Log().Fatalf(ctx, "failed to create the cache directory. procedure, err:%+v", err) + return + } + } + cacheAdapter = file.NewAdapterFile(fileDir) + default: + cacheAdapter = gcache.NewAdapterMemory() + } + + // 数据库缓存,默认和通用缓冲驱动一致,如果你不想使用默认的,可以自行调整 + g.DB().GetCache().SetAdapter(cacheAdapter) + + // 通用缓存 + cacheVal = gcache.New() + cacheVal.SetAdapter(cacheAdapter) +} diff --git a/server/internal/library/cache/file/file.go b/server/internal/library/cache/file/file.go new file mode 100644 index 0000000..3fdb7ba --- /dev/null +++ b/server/internal/library/cache/file/file.go @@ -0,0 +1,440 @@ +// Package file +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package file + +import ( + "context" + "crypto/sha256" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "os" + "path/filepath" + "sync" + "time" + + "github.com/gogf/gf/v2/container/gvar" + "github.com/gogf/gf/v2/os/gcache" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/util/gconv" +) + +type ( + // AdapterFile gcache适配器使用文件的实现 + AdapterFile struct { + dir string + mutex sync.RWMutex // 添加互斥锁以支持并发操作 + } + + fileContent struct { + Duration int64 `json:"duration"` + Data interface{} `json:"data,omitempty"` + } +) + +const perm = 0o666 //设置文件所有者、同用户组成员和其他用户都可以读写该文件,但都不能执。 + +var ( + CacheExpiredErr = errors.New("cache expired") +) + +// NewAdapterFile creates and returns a new memory cache object. +func NewAdapterFile(dir string) gcache.Adapter { + return &AdapterFile{ + dir: dir, + } +} + +func (c *AdapterFile) Set(ctx context.Context, key interface{}, value interface{}, lifeTime time.Duration) (err error) { + c.mutex.Lock() // 加锁 + defer c.mutex.Unlock() // 解锁 + fileKey := gconv.String(key) + if value == nil || lifeTime < 0 { + return c.Delete(fileKey) + } + return c.Save(fileKey, gconv.String(value), lifeTime) +} + +// SetMap 批量设置多个键值对,并且每个键值对的有效期是一样的 +func (c *AdapterFile) SetMap(ctx context.Context, data map[interface{}]interface{}, duration time.Duration) (err error) { + c.mutex.Lock() + defer c.mutex.Unlock() + for key, value := range data { + fileKey := gconv.String(key) + if err = c.Save(fileKey, gconv.String(value), duration); err != nil { + return err + } + } + return nil +} + +// SetIfNotExist 在指定的键不存在时设置其值 +func (c *AdapterFile) SetIfNotExist(ctx context.Context, key interface{}, value interface{}, duration time.Duration) (ok bool, err error) { + c.mutex.Lock() + defer c.mutex.Unlock() + + fileKey := gconv.String(key) + if c.Has(fileKey) { + return false, nil + } + + err = c.Save(fileKey, gconv.String(value), duration) + return true, err +} + +// SetIfNotExistFunc 在指定的键不存在时,通过一个函数来生成值并设置它 +func (c *AdapterFile) SetIfNotExistFunc(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (ok bool, err error) { + c.mutex.Lock() + defer c.mutex.Unlock() + + fileKey := gconv.String(key) + if c.Has(fileKey) { + return false, nil + } + + value, err := f(ctx) + if err != nil { + return false, err + } + err = c.Save(fileKey, gconv.String(value), duration) + return true, err +} + +// SetIfNotExistFuncLock 与 SetIfNotExistFunc 类似,但它在调用生成值的函数时提供了额外的锁机制,以避免在生成值期间的并发问题。 +func (c *AdapterFile) SetIfNotExistFuncLock(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (ok bool, err error) { + c.mutex.Lock() + defer c.mutex.Unlock() + + fileKey := gconv.String(key) + if c.Has(fileKey) { + return false, nil + } + + // 在这里加锁是为了确保在值生成期间不会有并发的写入操作 + value, err := f(ctx) + if err != nil { + return false, err + } + err = c.Save(fileKey, gconv.String(value), duration) + return true, err +} + +func (c *AdapterFile) Get(ctx context.Context, key interface{}) (*gvar.Var, error) { + fetch, err := c.Fetch(gconv.String(key)) + if err != nil { + return nil, err + } + return gvar.New(fetch), nil +} + +func (c *AdapterFile) GetOrSet(ctx context.Context, key interface{}, value interface{}, duration time.Duration) (result *gvar.Var, err error) { + result, err = c.Get(ctx, key) + if err != nil && !errors.Is(err, CacheExpiredErr) { + return nil, err + } + if result.IsNil() { + return gvar.New(value), c.Set(ctx, key, value, duration) + } + return +} + +func (c *AdapterFile) GetOrSetFunc(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (result *gvar.Var, err error) { + v, err := c.Get(ctx, key) + if err != nil && !errors.Is(err, CacheExpiredErr) { + return nil, err + } + if v.IsNil() { + value, err := f(ctx) + if err != nil { + return nil, err + } + if value == nil { + return nil, nil + } + return gvar.New(value), c.Set(ctx, key, value, duration) + } else { + return v, nil + } +} + +func (c *AdapterFile) GetOrSetFuncLock(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (result *gvar.Var, err error) { + return c.GetOrSetFunc(ctx, key, f, duration) +} + +func (c *AdapterFile) Contains(ctx context.Context, key interface{}) (bool, error) { + return c.Has(gconv.String(key)), nil +} + +func (c *AdapterFile) Size(ctx context.Context) (size int, err error) { + return 0, nil +} + +// Data 获取所有缓存的键值对 +func (c *AdapterFile) Data(ctx context.Context) (data map[interface{}]interface{}, err error) { + c.mutex.RLock() + defer c.mutex.RUnlock() + + // 初始化返回的数据结构 + data = make(map[interface{}]interface{}) + + // 读取文件目录中的所有缓存文件 + files, err := os.ReadDir(c.dir) + if err != nil { + return nil, err + } + + // 遍历缓存文件,提取数据 + for _, file := range files { + content, err := c.read(file.Name()) + if err != nil { + continue // 忽略无法读取的文件 + } + data[file.Name()] = content.Data + } + return data, nil +} + +// Keys 获取所有缓存的键 +func (c *AdapterFile) Keys(ctx context.Context) (keys []interface{}, err error) { + c.mutex.RLock() + defer c.mutex.RUnlock() + + files, err := os.ReadDir(c.dir) + if err != nil { + return nil, err + } + + keys = make([]interface{}, 0, len(files)) + for _, file := range files { + keys = append(keys, file.Name()) + } + return keys, nil +} + +// Values 获取所有缓存的值 +func (c *AdapterFile) Values(ctx context.Context) (values []interface{}, err error) { + c.mutex.RLock() + defer c.mutex.RUnlock() + + files, err := os.ReadDir(c.dir) + if err != nil { + return nil, err + } + + values = make([]interface{}, 0, len(files)) + for _, file := range files { + content, err := c.read(file.Name()) + if err != nil { + continue // 忽略无法读取的文件 + } + values = append(values, content.Data) + } + return values, nil +} + +// Update 更新一个指定键的缓存值,如果这个键不存在,则返回错误 +func (c *AdapterFile) Update(ctx context.Context, key interface{}, value interface{}) (oldValue *gvar.Var, exist bool, err error) { + c.mutex.Lock() + defer c.mutex.Unlock() + + fileKey := gconv.String(key) + content, err := c.read(fileKey) + if err != nil { + return nil, false, err + } + if content == nil { + return nil, false, nil + } + + oldValue = gvar.New(content.Data) + err = c.Save(fileKey, gconv.String(value), time.Duration(content.Duration)*time.Second) + return oldValue, true, err +} + +func (c *AdapterFile) UpdateExpire(ctx context.Context, key interface{}, duration time.Duration) (oldDuration time.Duration, err error) { + var ( + v *gvar.Var + oldTTL int64 + fileKey = gconv.String(key) + ) + // TTL. + expire, err := c.GetExpire(ctx, fileKey) + if err != nil { + return + } + oldTTL = int64(expire) + if oldTTL == -2 { + // It does not exist. + return + } + oldDuration = time.Duration(oldTTL) * time.Second + // DEL. + if duration < 0 { + err = c.Delete(fileKey) + return + } + v, err = c.Get(ctx, fileKey) + if err != nil { + return + } + err = c.Set(ctx, fileKey, v.Val(), duration) + return +} + +func (c *AdapterFile) GetExpire(ctx context.Context, key interface{}) (time.Duration, error) { + content, err := c.read(gconv.String(key)) + if err != nil { + return -1, nil + } + + if content.Duration <= time.Now().Unix() { + return -1, nil + } + return time.Duration(time.Now().Unix()-content.Duration) * time.Second, nil +} + +func (c *AdapterFile) Remove(ctx context.Context, keys ...interface{}) (lastValue *gvar.Var, err error) { + if len(keys) == 0 { + return nil, nil + } + // Retrieves the last key value. + if lastValue, err = c.Get(ctx, gconv.String(keys[len(keys)-1])); err != nil { + return nil, err + } + // Deletes all given keys. + err = c.DeleteMulti(gconv.Strings(keys)...) + return +} + +func (c *AdapterFile) Clear(ctx context.Context) error { + return c.Flush() +} + +func (c *AdapterFile) Close(ctx context.Context) error { + return nil +} + +func (c *AdapterFile) createName(key string) string { + h := sha256.New() + _, _ = h.Write([]byte(key)) + hash := hex.EncodeToString(h.Sum(nil)) + return filepath.Join(c.dir, fmt.Sprintf("%s.cache", hash)) +} + +func (c *AdapterFile) read(key string) (*fileContent, error) { + rp := gfile.RealPath(c.createName(key)) + if rp == "" { + return nil, nil + } + + value, err := os.ReadFile(rp) + if err != nil { + return nil, err + } + + content := &fileContent{} + if err := json.Unmarshal(value, content); err != nil { + return nil, err + } + + if content.Duration == 0 { + return content, nil + } + + if content.Duration <= time.Now().Unix() { + _ = c.Delete(key) + return nil, CacheExpiredErr + } + return content, nil +} + +// Has checks if the cached key exists into the File storage +func (c *AdapterFile) Has(key string) bool { + fc, err := c.read(key) + return err == nil && fc != nil +} + +// Delete the cached key from File storage +func (c *AdapterFile) Delete(key string) error { + _, err := os.Stat(c.createName(key)) + if err != nil && os.IsNotExist(err) { + return nil + } + return os.Remove(c.createName(key)) +} + +// DeleteMulti the cached key from File storage +func (c *AdapterFile) DeleteMulti(keys ...string) (err error) { + for _, key := range keys { + if err = c.Delete(key); err != nil { + return + } + } + return +} + +// Fetch retrieves the cached value from key of the File storage +func (c *AdapterFile) Fetch(key string) (interface{}, error) { + content, err := c.read(key) + if err != nil { + return nil, err + } + + if content == nil { + return nil, nil + } + return content.Data, nil +} + +// FetchMulti retrieve multiple cached values from keys of the File storage +func (c *AdapterFile) FetchMulti(keys []string) map[string]interface{} { + result := make(map[string]interface{}) + for _, key := range keys { + if value, err := c.Fetch(key); err == nil { + result[key] = value + } + } + return result +} + +// Flush removes all cached keys of the File storage +func (c *AdapterFile) Flush() error { + dir, err := os.Open(c.dir) + if err != nil { + return err + } + + defer func() { + _ = dir.Close() + }() + + names, _ := dir.Readdirnames(-1) + + for _, name := range names { + _ = os.Remove(filepath.Join(c.dir, name)) + } + return nil +} + +// Save a value in File storage by key +func (c *AdapterFile) Save(key string, value string, lifeTime time.Duration) error { + duration := int64(0) + + if lifeTime > 0 { + duration = time.Now().Unix() + int64(lifeTime.Seconds()) + } + + content := &fileContent{duration, value} + + data, err := json.Marshal(content) + if err != nil { + return err + } + + err = os.WriteFile(c.createName(key), data, perm) + return err +} diff --git a/server/internal/library/contexts/contexts.go b/server/internal/library/contexts/contexts.go new file mode 100644 index 0000000..10e096c --- /dev/null +++ b/server/internal/library/contexts/contexts.go @@ -0,0 +1,199 @@ +// Package contexts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package contexts + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "slices" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" +) + +type ContextKey struct { + name string +} + +var contextKey = &ContextKey{ + name: consts.ContextKey, +} + +// Init初始化上下文对象指针到上下文对象中,以便后续的请求流程中可以修改。 +func Init(r *ghttp.Request, customCtx *model.Context) { + r.SetCtxVar(contextKey, customCtx) +} + +// Set设置本地上下文 +func Set(ctx context.Context, customCtx *model.Context) context.Context { + ctx = context.WithValue(ctx, contextKey, customCtx) + return ctx +} + +// Get 获取上下文变量; +func Get(ctx context.Context) *model.Context { + customCtx, ok := ctx.Value(contextKey).(*model.Context) + if !ok { + return nil + } + return customCtx +} + +// Set 设置上下文变量 +func SetUser(ctx context.Context, user *model.Identity) { + customCtx := Get(ctx) + customCtx.User = user +} + +// GetUser 获取上下文变量中的用户信息 +func GetUser(ctx context.Context) *model.Identity { + customCtx := Get(ctx) + if customCtx == nil { + return nil + } + return customCtx.User +} + +// GetUserId 获取上下文变量中的用户ID +func GetUserId(ctx context.Context) int64 { + user := GetUser(ctx) + if user == nil { + return 0 + } + return user.ID +} + +// GetUserUuid 获取上下文变量中的用户UUID +func GetUserUuid(ctx context.Context) string { + user := GetUser(ctx) + if user == nil { + return "" + } + return user.UUID +} + +// GetUserName 获取上下文变量中的用户名 +func GetUserName(ctx context.Context) string { + user := GetUser(ctx) + if user == nil { + return "" + } + return user.Username +} + +// GetNickName 获取上下文变量中的用户昵称 +func GetNickName(ctx context.Context) string { + user := GetUser(ctx) + if user == nil { + return "" + } + return user.NickName +} + +// GetDeptId 获取上下文变量中的部门ID +func GetDeptId(ctx context.Context) int64 { + user := GetUser(ctx) + if user == nil { + return 0 + } + g.Log().Debug(ctx, user.DeptId) + return user.DeptId +} + +// GetTenantId 获取上下文变量中的租户ID +func GetTenantId(ctx context.Context) string { + user := GetUser(ctx) + if user == nil { + return "" + } + return user.TenantId +} + +// GetRoles 获取上下文变量中的角色列表 +func GetRoles(ctx context.Context) []model.Role { + user := GetUser(ctx) + if user == nil { + return nil + } + return user.Roles +} + +// GetLoginAt 获取上下文变量中的登录时间 +func GetLoginAt(ctx context.Context) int64 { + user := GetUser(ctx) + if user == nil { + return 0 + } + return user.LoginAt +} + +// IsSystemTenant 判断是否是系统租户 +func IsSystemTenant(ctx context.Context) bool { + tenantId := GetTenantId(ctx) + return tenantId == consts.DefaultSystemTenantCode +} + +// IsSuperAdmin 判断是否是超级管理员角色 +func IsSuperAdmin(ctx context.Context) bool { + roles := GetRoles(ctx) + return slices.ContainsFunc(roles, func(role model.Role) bool { + return role.RoleId == consts.SuperAdminRoleId + }) +} +func IsWebSocket(ctx context.Context) bool { + customCtx := Get(ctx) + if customCtx == nil { + return false + } + return customCtx.IsWebSocket +} +func SetIsWebSocket(ctx context.Context, isWebSocket bool) { + customCtx := Get(ctx) + if customCtx == nil { + return + } + customCtx.IsWebSocket = isWebSocket + g.Log().Debugf(ctx, "SetIsWebSocket: %v", isWebSocket) +} + +// GetAccessCodeList 获取上下文变量中的访问码列表 +func GetAccessCodeList(ctx context.Context) []string { + user := GetUser(ctx) + if user == nil { + return nil + } + if len(user.AccessCodeList) == 0 { + return nil + } + return user.AccessCodeList +} + +func GetDataValue(ctx context.Context, key string) interface{} { + customCtx := Get(ctx) + if customCtx == nil { + return nil + } + if customCtx.Data == nil { + return nil + } + value, ok := customCtx.Data[key] + if !ok { + return nil + } + return value +} + +func SetDataValue(ctx context.Context, key string, value interface{}) { + customCtx := Get(ctx) + if customCtx == nil { + return + } + if customCtx.Data == nil { + customCtx.Data = make(g.Map) + } + customCtx.Data[key] = value +} diff --git a/server/internal/library/event/event.go b/server/internal/library/event/event.go new file mode 100644 index 0000000..68fa5a8 --- /dev/null +++ b/server/internal/library/event/event.go @@ -0,0 +1,75 @@ +// Package event +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package event + +import ( + "context" + "sync" +) + +type EventCallbackFunc func(ctx context.Context, eventKey string, args ...interface{}) + +type sEvent struct { + sync.Mutex + eventList map[string][]EventCallbackFunc // 事件列表 [事件Key]:回调函数 +} + +var ( + instance *sEvent + once sync.Once +) + +// EventsInstance 事件实例 +func EventsInstance() *sEvent { + once.Do(func() { + instance = &sEvent{ + eventList: make(map[string][]EventCallbackFunc), + } + }) + return instance +} + +// Register 注册事件 +func (e *sEvent) Register(eventKey interface{}, callback EventCallbackFunc) { + e.Lock() + defer e.Unlock() + eventKeyStr, ok1 := eventKey.(string) + eventKeyList, ok2 := eventKey.([]string) + if !ok1 && !ok2 { + return + } + if ok1 { + e.eventList[eventKeyStr] = append(e.eventList[eventKeyStr], callback) + } else { + for _, eventKey := range eventKeyList { + e.eventList[eventKey] = append(e.eventList[eventKey], callback) + } + } +} + +// Call 回调事件 +func (e *sEvent) Call(ctx context.Context, eventKey string, args ...interface{}) { + if events, ok := e.eventList[eventKey]; ok { + for _, f := range events { + f(ctx, eventKey, args...) + } + } +} + +// Emit 触发事件 +func (e *sEvent) Emit(ctx context.Context, eventKey string, args ...interface{}) { + e.Call(ctx, eventKey, args...) +} + +// Remove 删除事件 +func (e *sEvent) Remove(eventKey string) { + delete(e.eventList, eventKey) +} + +// Clear 清空事件列表 +func (e *sEvent) Clear() { + e.eventList = make(map[string][]EventCallbackFunc) +} diff --git a/server/internal/library/mcache/mcache.go b/server/internal/library/mcache/mcache.go new file mode 100644 index 0000000..8644828 --- /dev/null +++ b/server/internal/library/mcache/mcache.go @@ -0,0 +1,56 @@ +// Package mcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +// 内存缓存管理 +package mcache + +import ( + "context" + "sync" + "time" + + "github.com/gogf/gf/v2/os/gcache" +) + +// cache 缓存驱动 +var ( + mcache *gcache.Cache + mu sync.Mutex +) + +// Instance 缓存实例 +func Instance() *gcache.Cache { + if mcache == nil { + mu.Lock() + if mcache == nil { + mcache = gcache.NewWithAdapter(gcache.NewAdapterMemory()) + } + mu.Unlock() + } + return mcache +} + +func Set(ctx context.Context, key string, value interface{}, timeout time.Duration) error { + return Instance().Set(ctx, key, value, timeout) +} + +func Get(ctx context.Context, key string) (interface{}, error) { + return Instance().Get(ctx, key) +} + +func Remove(ctx context.Context, key string) error { + _, err := Instance().Remove(ctx, key) + return err +} + +// Clear invalidates every derived in-process cache entry. It is used after the +// authoritative SQLite memory database is rebuilt. +func Clear(ctx context.Context) error { + keys := Instance().MustKeys(ctx) + if len(keys) == 0 { + return nil + } + return Instance().Removes(ctx, keys) +} diff --git a/server/internal/library/mcache/mcache_access_list.go b/server/internal/library/mcache/mcache_access_list.go new file mode 100644 index 0000000..bdf1812 --- /dev/null +++ b/server/internal/library/mcache/mcache_access_list.go @@ -0,0 +1,65 @@ +// Package mcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package mcache + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "time" + + "github.com/gogf/gf/v2/frame/g" +) + +func init() { + event.EventsInstance().Register(consts.EventKeyUserLogout, func(ctx context.Context, eventKey string, args ...interface{}) { + if len(args) == 0 { + return + } + userId := args[0].(int64) + RemoveUserAccessCodeList(ctx, userId) + g.Log().Infof(ctx, "mcache_access_list.go EventKeyUserLogout userId: %d", userId) + }) + +} + +func GetUserAccessCodeList(ctx context.Context, userId int64) ([]string, []string, error) { + accessCodeList, err := Instance().Get(ctx, fmt.Sprintf(consts.MemCacheUserAccessCodeList, userId)) + menuRoleDataAccessCodeList, err := Instance().Get(ctx, fmt.Sprintf(consts.MemCacheUserRoleDataAccessCodeList, userId)) + if err != nil || accessCodeList == nil { + accessCodeCurrList, menuRoleDataAccessCodeList, err := service.SysAuth().GetUserAccessCodeList(ctx, userId) + if err != nil { + return nil, nil, err + } + if len(accessCodeCurrList) == 0 { + accessCodeCurrList = []string{"null"} + } + Instance().Set(ctx, fmt.Sprintf(consts.MemCacheUserAccessCodeList, userId), accessCodeCurrList, time.Hour*24) + Instance().Set(ctx, fmt.Sprintf(consts.MemCacheUserRoleDataAccessCodeList, userId), menuRoleDataAccessCodeList, time.Hour*24) + return accessCodeCurrList, menuRoleDataAccessCodeList, nil + } + return accessCodeList.Strings(), menuRoleDataAccessCodeList.Strings(), nil +} + +func SetUserAccessCodeList(ctx context.Context, userId int64, accessCodeList []string) error { + return Instance().Set(ctx, fmt.Sprintf(consts.MemCacheUserAccessCodeList, userId), accessCodeList, time.Hour*24) +} + +func SetUserRoleDataAccessCodeList(ctx context.Context, userId int64, roleDataAccessCodeList []string) error { + return Instance().Set(ctx, fmt.Sprintf(consts.MemCacheUserRoleDataAccessCodeList, userId), roleDataAccessCodeList, time.Hour*24) +} + +func RemoveUserRoleDataAccessCodeList(ctx context.Context, userId int64) error { + _, err := Instance().Remove(ctx, fmt.Sprintf(consts.MemCacheUserRoleDataAccessCodeList, userId)) + return err +} + +func RemoveUserAccessCodeList(ctx context.Context, userId int64) error { + _, err := Instance().Remove(ctx, fmt.Sprintf(consts.MemCacheUserAccessCodeList, userId)) + return err +} diff --git a/server/internal/library/mcache/mcache_system_config.go b/server/internal/library/mcache/mcache_system_config.go new file mode 100644 index 0000000..849ee57 --- /dev/null +++ b/server/internal/library/mcache/mcache_system_config.go @@ -0,0 +1,77 @@ +// Package mcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package mcache + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "time" +) + +func init() { + event.EventsInstance().Register([]string{consts.EventKeyDBSysConfigUpdate, consts.EventKeyDBSysConfigCreate, consts.EventKeyDBSysConfigDelete}, func(ctx context.Context, eventKey string, args ...interface{}) { + if len(args) < 1 { + return + } + // tenantId := args[0].(string) + Instance().Remove(ctx, getKey(ctx)) + }) +} +func getKey(ctx context.Context) string { + return fmt.Sprintf(consts.MemCacheSystemConfig, contexts.GetTenantId(ctx)) +} + +func GetSystemConfig(ctx context.Context, key string, defaultValue string) (string, error) { + mapV, err := Instance().Get(ctx, getKey(ctx)) + if err != nil { + data, _, err := service.SysConfig().List(ctx, &model.SysConfigListParam{ + PageInfo: request.PageInfo{ + Page: 1, + PageSize: 9999, + }, + }) + if err != nil { + return defaultValue, err + } + mapConfig := make(map[string]string) + for _, item := range data { + mapConfig[item.ConfigKey] = item.ConfigValue + } + Instance().Set(ctx, getKey(ctx), mapConfig, time.Hour*24) + return mapConfig[key], nil + } + mapConfig := mapV.MapStrStr() + if v, ok := mapConfig[key]; ok { + return v, nil + } + return defaultValue, nil +} + +func SetSystemConfig(ctx context.Context, key string, value string) error { + mapV, err := Instance().Get(ctx, getKey(ctx)) + if err != nil { + return err + } + mapConfig := mapV.MapStrStr() + mapConfig[key] = value + return Instance().Set(ctx, getKey(ctx), mapConfig, time.Hour*24) +} + +func RemoveSystemConfig(ctx context.Context, key string) error { + mapV, err := Instance().Get(ctx, getKey(ctx)) + if err != nil { + return err + } + mapConfig := mapV.MapStrStr() + delete(mapConfig, key) + return Instance().Set(ctx, getKey(ctx), mapConfig, time.Hour*24) +} diff --git a/server/internal/library/mcache/mcache_system_dept.go b/server/internal/library/mcache/mcache_system_dept.go new file mode 100644 index 0000000..3a77498 --- /dev/null +++ b/server/internal/library/mcache/mcache_system_dept.go @@ -0,0 +1,49 @@ +// Package mcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package mcache + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "time" +) + +func init() { + event.EventsInstance().Register([]string{consts.EventKeyDBSysDeptUpdate, + consts.EventKeyDBSysDeptCreate, + consts.EventKeyDBSysDeptDelete}, func(ctx context.Context, eventKey string, args ...interface{}) { + if len(args) == 0 { + return + } + deptId := args[0].(int64) + RemoveDeptName(ctx, deptId) + }) +} + +func GetDeptName(ctx context.Context, deptId int64) (string, error) { + deptName, err := Instance().Get(ctx, fmt.Sprintf(consts.MemCacheDeptName, deptId)) + if err != nil { + dept, err := service.SysDept().GetDeptById(ctx, deptId) + if err != nil { + return "", err + } + Instance().Set(ctx, fmt.Sprintf(consts.MemCacheDeptName, deptId), dept.DeptName, time.Hour*24) + return dept.DeptName, nil + } + return deptName.String(), nil +} + +func SetDeptName(ctx context.Context, deptId int64, deptName string) error { + return Instance().Set(ctx, fmt.Sprintf(consts.MemCacheDeptName, deptId), deptName, time.Hour*24) +} + +func RemoveDeptName(ctx context.Context, deptId int64) error { + _, err := Instance().Remove(ctx, fmt.Sprintf(consts.MemCacheDeptName, deptId)) + return err +} diff --git a/server/internal/library/mcache/mcache_system_user.go b/server/internal/library/mcache/mcache_system_user.go new file mode 100644 index 0000000..762103b --- /dev/null +++ b/server/internal/library/mcache/mcache_system_user.go @@ -0,0 +1,58 @@ +// Package mcache +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package mcache + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "time" + + "github.com/gogf/gf/v2/util/gconv" +) + +func init() { + event.EventsInstance().Register(consts.EventKeyUserUpdate, func(ctx context.Context, eventKey string, args ...interface{}) { + if len(args) == 0 { + return + } + userId := args[0].(int64) + RemoveUserInfo(ctx, userId) + }) +} + +func GetUserInfo(ctx context.Context, userId int64) (*model.SysUserMiniModel, error) { + userInfo, err := Instance().Get(ctx, fmt.Sprintf(consts.MemCacheUserInfo, userId)) + if err != nil { + user, err := service.SysUser().GetUserById(ctx, userId) + if err != nil { + return nil, err + } + + miniUser := &model.SysUserMiniModel{} + gconv.Struct(miniUser, user) + Instance().Set(ctx, fmt.Sprintf(consts.MemCacheUserInfo, userId), miniUser, time.Hour*24) + return miniUser, nil + } + miniUser := &model.SysUserMiniModel{} + err = userInfo.Struct(miniUser) + if err != nil { + return nil, err + } + return miniUser, nil +} + +func SetUserInfo(ctx context.Context, userId int64, userInfo *model.SysUserMiniModel) error { + return Instance().Set(ctx, fmt.Sprintf(consts.MemCacheUserInfo, userId), userInfo, time.Hour*24) +} + +func RemoveUserInfo(ctx context.Context, userId int64) error { + _, err := Instance().Remove(ctx, fmt.Sprintf(consts.MemCacheUserInfo, userId)) + return err +} diff --git a/server/internal/library/rabbitmq/confirmed.go b/server/internal/library/rabbitmq/confirmed.go new file mode 100644 index 0000000..3c6b45e --- /dev/null +++ b/server/internal/library/rabbitmq/confirmed.go @@ -0,0 +1,53 @@ +package rabbitmq + +import ( + "context" + "encoding/json" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + amqp "github.com/rabbitmq/amqp091-go" +) + +func PublishConfirmed(ctx context.Context, queue string, data any) error { + body, err := json.Marshal(data) + if err != nil { + return err + } + channel, err := Channel(ctx) + if err != nil { + return err + } + defer channel.Close() + if err = declareQueue(channel, queue); err != nil { + return err + } + if err = channel.Confirm(false); err != nil { + return err + } + confirmations := channel.NotifyPublish(make(chan amqp.Confirmation, 1)) + returns := channel.NotifyReturn(make(chan amqp.Return, 1)) + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err = channel.PublishWithContext(ctx, "", queue, true, false, amqp.Publishing{ + ContentType: "application/json", DeliveryMode: amqp.Persistent, Timestamp: time.Now(), Body: body, + }); err != nil { + return err + } + select { + case <-ctx.Done(): + return ctx.Err() + case returned := <-returns: + return gerror.Newf("traffic usage message unroutable: %s", returned.ReplyText) + case confirmation, ok := <-confirmations: + if !ok || !confirmation.Ack { + return gerror.New("traffic usage message was not confirmed") + } + select { + case returned := <-returns: + return gerror.Newf("traffic usage message unroutable: %s", returned.ReplyText) + default: + return nil + } + } +} diff --git a/server/internal/library/rabbitmq/rabbitmq.go b/server/internal/library/rabbitmq/rabbitmq.go new file mode 100644 index 0000000..d86f529 --- /dev/null +++ b/server/internal/library/rabbitmq/rabbitmq.go @@ -0,0 +1,259 @@ +package rabbitmq + +import ( + "context" + "encoding/json" + "fmt" + "sync" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + amqp "github.com/rabbitmq/amqp091-go" +) + +type Config struct { + Enabled bool + Dsn string +} + +// Handler 是 RabbitMQ 消费处理函数。 +// 返回 nil 时消息 Ack;返回 error 时消息 Nack 且不重新入队。 +type Handler func(ctx context.Context, body []byte) error + +// JSONHandler 是 RabbitMQ JSON 消息的业务处理函数。 +type JSONHandler[T any] func(ctx context.Context, message T) error + +var ( + conn *amqp.Connection + connMu sync.Mutex + closers []func() error + closerMu sync.Mutex +) + +func GetConfig(ctx context.Context) Config { + return Config{ + Enabled: g.Cfg().MustGet(ctx, "rabbitmq.enabled", false).Bool(), + Dsn: g.Cfg().MustGet(ctx, "rabbitmq.dsn", "").String(), + } +} + +// Enabled 判断 RabbitMQ 是否启用且 DSN 是否已配置。 +func Enabled(ctx context.Context) bool { + cfg := GetConfig(ctx) + return cfg.Enabled && cfg.Dsn != "" +} + +// Conn 懒加载 RabbitMQ 连接,供多个生产者/消费者复用。 +func Conn(ctx context.Context) (*amqp.Connection, error) { + cfg := GetConfig(ctx) + if !cfg.Enabled { + return nil, gerror.New("rabbitmq is disabled") + } + if cfg.Dsn == "" { + return nil, gerror.New("rabbitmq dsn is empty") + } + + connMu.Lock() + defer connMu.Unlock() + if conn != nil && !conn.IsClosed() { + return conn, nil + } + + c, err := amqp.Dial(cfg.Dsn) + if err != nil { + return nil, gerror.Wrap(err, "rabbitmq connect failed") + } + conn = c + return conn, nil +} + +// Channel 基于共享连接创建独立 channel。 +func Channel(ctx context.Context) (*amqp.Channel, error) { + c, err := Conn(ctx) + if err != nil { + return nil, err + } + ch, err := c.Channel() + if err != nil { + return nil, gerror.Wrap(err, "rabbitmq open channel failed") + } + return ch, nil +} + +// DeclareQueue 声明一个持久化队列。 +func DeclareQueue(ctx context.Context, queue string) error { + ch, err := Channel(ctx) + if err != nil { + return err + } + defer ch.Close() + return declareQueue(ch, queue) +} + +// Publish 将结构体序列化为 JSON 后发布到指定队列。 +func Publish(ctx context.Context, queue string, data any) error { + body, err := json.Marshal(data) + if err != nil { + return gerror.Wrap(err, "rabbitmq marshal message failed") + } + return PublishBytes(ctx, queue, body) +} + +// PublishDelayed 将结构体序列化为 JSON 后发布到延迟队列。 +// 消息在 delayQueue 中等待 delay 后,通过死信路由进入 targetQueue。 +func PublishDelayed(ctx context.Context, delayQueue, targetQueue string, delay time.Duration, data any) error { + body, err := json.Marshal(data) + if err != nil { + return gerror.Wrap(err, "rabbitmq marshal delayed message failed") + } + return PublishDelayedBytes(ctx, delayQueue, targetQueue, delay, body) +} + +// PublishBytes 发布原始消息体到指定队列。 +func PublishBytes(ctx context.Context, queue string, body []byte) error { + ch, err := Channel(ctx) + if err != nil { + return err + } + defer ch.Close() + + // 发布前也声明一次队列,避免生产者先启动时队列不存在。 + if err = declareQueue(ch, queue); err != nil { + return err + } + return ch.PublishWithContext(ctx, "", queue, false, false, amqp.Publishing{ + ContentType: "application/json", + DeliveryMode: amqp.Persistent, + Timestamp: time.Now(), + Body: body, + }) +} + +// PublishDelayedBytes 发布原始消息体到延迟队列。 +func PublishDelayedBytes(ctx context.Context, delayQueue, targetQueue string, delay time.Duration, body []byte) error { + ch, err := Channel(ctx) + if err != nil { + return err + } + defer ch.Close() + + if err = declareQueue(ch, targetQueue); err != nil { + return err + } + if err = declareDelayQueue(ch, delayQueue, targetQueue); err != nil { + return err + } + return ch.PublishWithContext(ctx, "", delayQueue, false, false, amqp.Publishing{ + ContentType: "application/json", + DeliveryMode: amqp.Persistent, + Expiration: fmt.Sprintf("%d", delay.Milliseconds()), + Timestamp: time.Now(), + Body: body, + }) +} + +// Consume 启动消费者,使用手动 Ack,handler 成功才确认消息。 +func Consume(ctx context.Context, queue, consumer string, handler Handler) error { + ch, err := Channel(ctx) + if err != nil { + return err + } + if err = declareQueue(ch, queue); err != nil { + _ = ch.Close() + return err + } + if err = ch.Qos(1, 0, false); err != nil { + _ = ch.Close() + return gerror.Wrap(err, "rabbitmq set qos failed") + } + + // autoAck=false,业务处理成功后手动 Ack,处理失败时 Nack 且不重新入队。 + deliveries, err := ch.Consume(queue, consumer, false, false, false, false, nil) + if err != nil { + _ = ch.Close() + return gerror.Wrap(err, "rabbitmq consume failed") + } + + registerCloser(ch.Close) + go func() { + for { + select { + case <-ctx.Done(): + _ = ch.Close() + return + case delivery, ok := <-deliveries: + if !ok { + return + } + if err = handler(ctx, delivery.Body); err != nil { + g.Log().Errorf(ctx, "rabbitmq handle message failed, queue:%s, err:%+v", queue, err) + _ = delivery.Nack(false, false) + continue + } + // handler 内部已经完成业务处理或重新发布下一次重试消息,这里只确认当前消息。 + _ = delivery.Ack(false) + } + } + }() + return nil +} + +// ConsumeJSON 启动 JSON 消费者,统一完成反序列化和 Ack/Nack 处理。 +func ConsumeJSON[T any](ctx context.Context, queue, consumer string, handler JSONHandler[T]) error { + return Consume(ctx, queue, consumer, func(ctx context.Context, body []byte) error { + var message T + if err := json.Unmarshal(body, &message); err != nil { + g.Log().Errorf(ctx, "rabbitmq message dropped, invalid json, queue:%s, body:%s, err:%+v", queue, string(body), err) + return nil + } + return handler(ctx, message) + }) +} + +// Close 关闭消费者 channel 和共享连接。 +func Close() error { + closerMu.Lock() + for _, closer := range closers { + _ = closer() + } + closers = nil + closerMu.Unlock() + + connMu.Lock() + defer connMu.Unlock() + if conn == nil { + return nil + } + err := conn.Close() + conn = nil + return err +} + +// declareQueue 统一声明持久化队列,生产者和消费者都会调用,保证队列存在。 +func declareQueue(ch *amqp.Channel, queue string) error { + _, err := ch.QueueDeclare(queue, true, false, false, false, nil) + if err != nil { + return gerror.Wrapf(err, "rabbitmq declare queue failed, queue:%s", queue) + } + return nil +} + +// declareDelayQueue 声明 TTL 延迟队列,到期后死信转发到目标队列。 +func declareDelayQueue(ch *amqp.Channel, delayQueue, targetQueue string) error { + _, err := ch.QueueDeclare(delayQueue, true, false, false, false, amqp.Table{ + "x-dead-letter-exchange": "", + "x-dead-letter-routing-key": targetQueue, + }) + if err != nil { + return gerror.Wrapf(err, "rabbitmq declare delay queue failed, queue:%s", delayQueue) + } + return nil +} + +// registerCloser 记录消费者 channel,服务退出时统一关闭。 +func registerCloser(closer func() error) { + closerMu.Lock() + defer closerMu.Unlock() + closers = append(closers, closer) +} diff --git a/server/internal/library/rolepolicy/template.go b/server/internal/library/rolepolicy/template.go new file mode 100644 index 0000000..084dbf5 --- /dev/null +++ b/server/internal/library/rolepolicy/template.go @@ -0,0 +1,189 @@ +package rolepolicy + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity" + "github.com/gogf/gf/v2/errors/gerror" + "strconv" + "strings" +) + +const TemplateConfigKey = "agent.role.template.role_id" + +// TemplateForRoles reports whether any of roleIDs is the configured platform template. +// Callers use it to tell "this save touches the template" apart from "this save is an +// ordinary role" — the latter must not be forced to is_pass=1. +func TemplateForRoles(ctx context.Context, roleIDs ...int64) (*entity.SysRole, error) { + var configs []*entity.SysConfig + if err := dao.SysConfig.Ctx(ctx).Master().Where("tenant_id", consts.DefaultSystemTenantCode).Where("config_key", TemplateConfigKey).Scan(&configs); err != nil { + return nil, err + } + for _, config := range configs { + roleID, err := strconv.ParseInt(strings.TrimSpace(config.ConfigValue), 10, 64) + if err != nil || roleID <= 0 { + continue + } + for _, targetID := range roleIDs { + if targetID != roleID { + continue + } + if len(configs) != 1 { + return nil, gerror.New("代理模板角色系统参数重复") + } + var role *entity.SysRole + if err := dao.SysRole.Ctx(ctx).Master().Where("role_id", roleID).Where("tenant_id", consts.DefaultSystemTenantCode).Scan(&role); err != nil { + return nil, err + } + if role == nil { + role = &entity.SysRole{RoleId: roleID, TenantId: consts.DefaultSystemTenantCode} + } + return role, nil + } + } + return nil, nil +} + +func Template(ctx context.Context) (*entity.SysRole, error) { + var configs []*entity.SysConfig + if err := dao.SysConfig.Ctx(ctx).Where("tenant_id", consts.DefaultSystemTenantCode).Where("config_key", TemplateConfigKey).Scan(&configs); err != nil { + return nil, err + } + if len(configs) == 0 { + return nil, nil + } + if len(configs) != 1 { + return nil, gerror.New("代理模板角色系统参数重复") + } + return ValidateTemplate(ctx, configs[0].ConfigValue) +} + +func ValidateTemplate(ctx context.Context, value string) (*entity.SysRole, error) { + roleID, err := strconv.ParseInt(strings.TrimSpace(value), 10, 64) + if err != nil || roleID <= 0 || roleID == consts.SuperAdminRoleId { + return nil, gerror.New("代理模板参数必须填写非超级管理员的有效角色ID") + } + var role *entity.SysRole + if err = dao.SysRole.Ctx(ctx).Where("role_id", roleID).Where("tenant_id", consts.DefaultSystemTenantCode).Scan(&role); err != nil { + return nil, err + } + if role == nil || role.Status != "0" || (role.CreatedDept > 0 && role.CreatedDept != role.DeptId) || role.DeptId <= 0 || role.IsPass != 1 { + return nil, gerror.New("请在企业管理的角色管理创建下发模板,模板须正常启用、绑定本级机构且非上级继承角色") + } + if role.DataScope != consts.SysRoleDataScopeDeptAndBelow { + return nil, gerror.New("代理模板数据范围必须为本机构及下级") + } + var dept *entity.SysDept + if err := dao.SysDept.Ctx(ctx).Where("tenant_id", role.TenantId).Where("dept_id", role.DeptId).Where("status", "0").Scan(&dept); err != nil { + return nil, err + } + if dept == nil { + return nil, gerror.New("代理模板所属机构不存在或已停用") + } + invalidScopes, err := dao.SysRoleMenu.Ctx(ctx).Where("tenant_id", role.TenantId).Where("role_id", role.RoleId).WhereIn("data_scope", []string{consts.SysRoleDataScopeAll, consts.SysRoleDataScopeCustom}).Count() + if err != nil { + return nil, err + } + if invalidScopes > 0 { + return nil, gerror.New("代理模板按钮不允许全部或自定义数据范围") + } + return role, nil +} + +func MenuIDs(ctx context.Context, roleID int64) ([]int64, error) { + var menus []*entity.SysRoleMenu + if err := dao.SysRoleMenu.Ctx(ctx).Where("role_id", roleID).Scan(&menus); err != nil { + return nil, err + } + ids := make([]int64, 0, len(menus)) + for _, menu := range menus { + ids = append(ids, menu.MenuId) + } + return ids, nil +} + +func Intersect(left, right []int64) []int64 { + allowed := make(map[int64]bool, len(right)) + for _, id := range right { + allowed[id] = true + } + result := make([]int64, 0, len(left)) + for _, id := range left { + if allowed[id] { + result = append(result, id) + } + } + return result +} + +func CurrentSuperAdmin(ctx context.Context, userID int64) (bool, error) { + if userID <= 0 { + return false, nil + } + var relations []*entity.SysUserRole + if err := dao.SysUserRole.Ctx(ctx).Where("tenant_id", consts.DefaultSystemTenantCode).Where("user_id", userID).Where("role_id", consts.SuperAdminRoleId).Scan(&relations); err != nil { + return false, err + } + if len(relations) == 0 { + return false, nil + } + var role *entity.SysRole + if err := dao.SysRole.Ctx(ctx).Where("tenant_id", consts.DefaultSystemTenantCode).Where("role_id", consts.SuperAdminRoleId).Where("status", "0").Scan(&role); err != nil { + return false, err + } + return role != nil, nil +} + +func RestrictMenus(ctx context.Context, tenantID string, deptID int64, ids []int64) ([]int64, error) { + template, err := Template(ctx) + if err != nil { + return nil, err + } + if template == nil { + return ids, nil + } + seen := make(map[int64]bool) + for deptID > 0 { + if seen[deptID] { + return nil, gerror.New("机构上下级存在循环") + } + seen[deptID] = true + var dept *entity.SysDept + if err := dao.SysDept.Ctx(ctx).Where("tenant_id", tenantID).Where("dept_id", deptID).Scan(&dept); err != nil { + return nil, err + } + if dept == nil || dept.Status != "0" { + return []int64{}, nil + } + if template != nil && tenantID == template.TenantId && deptID == template.DeptId { + if len(seen) > 1 { + menus, err := MenuIDs(ctx, template.RoleId) + if err != nil { + return nil, err + } + ids = Intersect(ids, menus) + } + break + } + if dept.DeptRole != consts.SuperAdminRoleId { + var role *entity.SysRole + if err := dao.SysRole.Ctx(ctx).Where("tenant_id", tenantID).Where("dept_id", deptID).Where("role_id", dept.DeptRole).Where("status", "0").Scan(&role); err != nil { + return nil, err + } + if role == nil { + return []int64{}, nil + } + menus, err := MenuIDs(ctx, role.RoleId) + if err != nil { + return nil, err + } + ids = Intersect(ids, menus) + } + deptID = dept.ParentId + } + if tenantID == template.TenantId && !seen[template.DeptId] { + return []int64{}, nil + } + return ids, nil +} diff --git a/server/internal/library/rolesync/sync.go b/server/internal/library/rolesync/sync.go new file mode 100644 index 0000000..8e4fab8 --- /dev/null +++ b/server/internal/library/rolesync/sync.go @@ -0,0 +1,30 @@ +package rolesync + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" +) + +func EnqueueRole(ctx context.Context, roleID, actorID int64) error { + if gdb.TXFromCtx(ctx, g.DB().GetGroup()) != nil { + return nil + } + var role *entity.SysRole + if err := dao.SysRole.Ctx(ctx).Where("role_id", roleID).Scan(&role); err != nil { + return err + } + if role == nil || role.IsPass != 1 { + return nil + } + err := service.AgentRole().SyncInheritedRole(ctx, &model.AgentRoleSyncMessage{TenantId: role.TenantId, SourceRoleId: role.RoleId, SourceDeptId: role.DeptId, ActorId: actorID}) + if err != nil { + return gerror.Wrap(err, "模板已保存,但部分企业同步失败,请修复关联后重新保存") + } + return nil +} diff --git a/server/internal/library/tdengine/tdengine.go b/server/internal/library/tdengine/tdengine.go new file mode 100644 index 0000000..eef40a5 --- /dev/null +++ b/server/internal/library/tdengine/tdengine.go @@ -0,0 +1,205 @@ +package tdengine + +import ( + "context" + "database/sql" + "sync" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + _ "github.com/taosdata/driver-go/v3/taosRestful" + _ "github.com/taosdata/driver-go/v3/taosWS" +) + +const ( + // dailyStable 和 monthlyStable 是 TDengine 中已经提前创建好的超级表名称。 + // 业务启动时只连接和读写,不负责自动建库建表。 + dailyStable = "t_sim_card_usage_daily" + monthlyStable = "t_sim_card_usage_monthly" + poolDailyStable = "t_flow_pool_usage_daily" + poolMonthlyStable = "t_flow_pool_usage_monthly" + poolCardCountDailyStable = "t_flow_pool_card_count_daily" + poolCardCountMonthlyStable = "t_flow_pool_card_count_monthly" + defaultBatchSize = 200 + // defaultDailyDbName / defaultMonthlyDbName 是配置缺失时的兑底库名。 + // 日流量与月流量分库(duration 不同,而 duration 只能建库时确定)。 + defaultDailyDbName = "iotlcm_daily" + defaultMonthlyDbName = "iotlcm_monthly" +) + +// Config 是项目内 TDengine 连接和流量超级表配置。 +// +// 日流量与月流量分库存储(iotlcm_daily / iotlcm_monthly):两库的 duration 需要 +// 不同——日流量按天分片、月流量按月分片——而 TDengine 的 duration 只能建库时确定、 +// 事后无法 alter。DbName 保留为兼容位,指向不支持分库的流量池等表的落库位置。 +type Config struct { + Enabled bool + DriverName string + Dsn string + DbName string + DailyDbName string + MonthlyDbName string + DailyStable string + MonthlyStable string + PoolDailyStable string + PoolMonthlyStable string + PoolCardCountDailyStable string + PoolCardCountMonthlyStable string + MaxOpenConns int + MaxIdleConns int + BatchSize int +} + +// pools 按库名缓存连接池。DSN 不携带库名(形如 ws(host:6041)/), +// 因此同一个 DSN 可以服务多个 database,日/月分库无需两套连接串。 +var ( + poolsMu sync.Mutex + pools = map[string]*sql.DB{} +) + +// GetConfig 从 GoFrame 配置中读取 TDengine 配置。 +// 表名保持在代码中固定,避免业务配置文件里暴露过多 TDengine 内部结构。 +func GetConfig(ctx context.Context) Config { + database := g.Cfg().MustGet(ctx, "tsdb.database", "TdEngine").String() + // dbName 只是连接池的键名与兑底值,不决定实际访问哪个库: + // DSN 末尾留空、库名由 SQL 里的 库名.表名 指定。 + // 默认值取日库,避免兑底到一个不存在的库名。 + dbName := g.Cfg().MustGet(ctx, "tsdb.tdengine.dbName", defaultDailyDbName).String() + // dailyDbName / monthlyDbName 未配置时回退到 dbName。 + dailyDbName := g.Cfg().MustGet(ctx, "tsdb.tdengine.dailyDbName", dbName).String() + monthlyDbName := g.Cfg().MustGet(ctx, "tsdb.tdengine.monthlyDbName", dbName).String() + return Config{ + Enabled: database == "TdEngine", + DriverName: g.Cfg().MustGet(ctx, "tsdb.tdengine.type", "taosWS").String(), + Dsn: g.Cfg().MustGet(ctx, "tsdb.tdengine.dsn", "").String(), + DbName: dbName, + DailyDbName: dailyDbName, + MonthlyDbName: monthlyDbName, + DailyStable: dailyStable, + MonthlyStable: monthlyStable, + PoolDailyStable: poolDailyStable, + PoolMonthlyStable: poolMonthlyStable, + PoolCardCountDailyStable: poolCardCountDailyStable, + PoolCardCountMonthlyStable: poolCardCountMonthlyStable, + MaxOpenConns: g.Cfg().MustGet(ctx, "tsdb.tdengine.maxOpenConns", 100).Int(), + MaxIdleConns: g.Cfg().MustGet(ctx, "tsdb.tdengine.maxIdleConns", 10).Int(), + BatchSize: g.Cfg().MustGet(ctx, "tsdb.tdengine.batchSize", defaultBatchSize).Int(), + } +} + +// DbNameFor 返回指定超级表应该写入的 database 名。 +// +// 日流量与月流量分库:两库的 TDengine duration 不同(日库按天分片、月库按月分片), +// 而 duration 只能建库时确定。未单独配置 dailyDbName/monthlyDbName 时回退到 DbName。 +func (c Config) DbNameFor(stable string) string { + switch stable { + case c.DailyStable, c.PoolDailyStable, c.PoolCardCountDailyStable: + if c.DailyDbName != "" { + return c.DailyDbName + } + case c.MonthlyStable, c.PoolMonthlyStable, c.PoolCardCountMonthlyStable: + if c.MonthlyDbName != "" { + return c.MonthlyDbName + } + } + return c.DbName +} + +// Enabled 只判断当前项目是否启用 TDengine,并且 DSN 是否已经配置。 +func Enabled(ctx context.Context) bool { + cfg := GetConfig(ctx) + return cfg.Enabled && cfg.Dsn != "" +} + +// DB 懒加载并复用默认库(DbName)的连接池。 +// 注意:这里不会创建 database/stable,库表需要先通过 SQL 脚本准备好。 +func DB(ctx context.Context) (*sql.DB, error) { + return DBForDb(ctx, GetConfig(ctx).DbName) +} + +// DBForDb 返回指定 database 的连接池;同一库名复用同一个池。 +func DBForDb(ctx context.Context, dbName string) (*sql.DB, error) { + cfg := GetConfig(ctx) + if !cfg.Enabled { + return nil, gerror.New("tdengine is disabled") + } + if cfg.Dsn == "" { + return nil, gerror.New("tdengine dsn is empty") + } + if dbName == "" { + dbName = cfg.DbName + } + + poolsMu.Lock() + defer poolsMu.Unlock() + if pool, ok := pools[dbName]; ok { + return pool, nil + } + + driverName := cfg.DriverName + if driverName == "" { + driverName = "taosWS" + } + pool, err := sql.Open(driverName, cfg.Dsn) + if err != nil { + return nil, err + } + pool.SetMaxIdleConns(cfg.MaxIdleConns) + pool.SetMaxOpenConns(cfg.MaxOpenConns) + if err := pool.PingContext(ctx); err != nil { + _ = pool.Close() + return nil, err + } + pools[dbName] = pool + return pool, nil +} + +// Exec 执行 TDengine 默认库的写入、更新、删除类 SQL。 +func Exec(ctx context.Context, query string, args ...any) (sql.Result, error) { + conn, err := DB(ctx) + if err != nil { + return nil, err + } + return conn.ExecContext(ctx, query, args...) +} + +// ExecForDb 在指定 database 的连接池上执行写入类 SQL。 +func ExecForDb(ctx context.Context, dbName, query string, args ...any) (sql.Result, error) { + conn, err := DBForDb(ctx, dbName) + if err != nil { + return nil, err + } + return conn.ExecContext(ctx, query, args...) +} + +// Query 执行 TDengine 查询 SQL,调用方负责关闭返回的 rows。 +func Query(ctx context.Context, query string, args ...any) (*sql.Rows, error) { + conn, err := DB(ctx) + if err != nil { + return nil, err + } + return conn.QueryContext(ctx, query, args...) +} + +// QueryRow 执行 TDengine 单行查询 SQL。 +func QueryRow(ctx context.Context, query string, args ...any) (*sql.Row, error) { + conn, err := DB(ctx) + if err != nil { + return nil, err + } + return conn.QueryRowContext(ctx, query, args...), nil +} + +// Close 在应用退出时关闭所有 TDengine 连接池。 +func Close() error { + poolsMu.Lock() + defer poolsMu.Unlock() + var firstErr error + for name, pool := range pools { + if err := pool.Close(); err != nil && firstErr == nil { + firstErr = err + } + delete(pools, name) + } + return firstErr +} diff --git a/server/internal/library/utils/utils.go b/server/internal/library/utils/utils.go new file mode 100644 index 0000000..b959b5b --- /dev/null +++ b/server/internal/library/utils/utils.go @@ -0,0 +1,613 @@ +package utils + +import ( + "bufio" + "bytes" + "context" + "fmt" + "io" + "net" + "os" + "path/filepath" + "reflect" + "sort" + "strconv" + "strings" + "time" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/tealeg/xlsx" + + "github.com/gogf/gf/v2/crypto/gmd5" + "github.com/gogf/gf/v2/encoding/gcharset" + "github.com/gogf/gf/v2/encoding/gurl" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" +) + +// EncryptPassword 密码加密 +func EncryptPassword(password, salt string) string { + return gmd5.MustEncryptString(gmd5.MustEncryptString(password) + gmd5.MustEncryptString(salt)) +} + +// GetDomain 获取当前请求接口域名 +func GetDomain(ctx context.Context) string { + r := g.RequestFromCtx(ctx) + pathInfo, err := gurl.ParseURL(r.GetUrl(), -1) + if err != nil { + g.Log().Error(ctx, "GetDomain gurl.ParseURL", err) + return "" + } + return fmt.Sprintf("%s://%s:%s/", pathInfo["scheme"], pathInfo["host"], pathInfo["port"]) +} + +// GetClientIp 获取客户端IP +func GetClientIp(ctx context.Context) string { + return g.RequestFromCtx(ctx).GetClientIp() +} + +// GetLocalIP 获取服务器内网IP +func GetLocalIP() (string, error) { + var localIP string + interfaces, err := net.Interfaces() + if err != nil { + return "", err + } + // 遍历所有网卡 + for _, i := range interfaces { + if i.Flags&net.FlagUp == 0 { + continue // 网卡未开启 + } + if i.Flags&net.FlagLoopback != 0 { + continue // 网卡为loopback地址 + } + addrs, err := i.Addrs() + if err != nil { + return "", err + } + // 遍历网卡上的所有地址 + for _, addr := range addrs { + var ip net.IP + switch v := addr.(type) { + case *net.IPNet: + ip = v.IP + case *net.IPAddr: + ip = v.IP + } + if ip == nil || ip.IsLoopback() { + continue + } + ip = ip.To4() + if ip == nil { + continue // 不是ipv4地址 + } + localIP = ip.String() + return localIP, nil + } + } + return "", fmt.Errorf("no local IP address found") +} + +// GetPublicIP 获取公网IP +func GetPublicIP() (ip string, err error) { + return utility.GetPublicIP() +} + +// GetUserAgent 获取user-agent +func GetUserAgent(ctx context.Context) string { + return ghttp.RequestFromCtx(ctx).Header.Get("User-Agent") +} + +// GetCityByIp 获取ip所属城市 +func GetCityByIp(ip string) string { + return utility.GetCityByIp(ip) +} + +func RemoveRepeatedElementAndEmpty(arr []int) []int { + newArr := make([]int, 0) + for _, item := range arr { + repeat := false + if len(newArr) > 0 { + for _, v := range newArr { + if v == item { + repeat = true + break + } + } + } + if repeat { + continue + } + newArr = append(newArr, item) + } + return newArr +} + +// RemoveDuplicationMap 数组去重 +func RemoveDuplicationMap(arr []string) []string { + set := make(map[string]struct{}, len(arr)) + j := 0 + for _, v := range arr { + _, ok := set[v] + if ok { + continue + } + set[v] = struct{}{} + arr[j] = v + j++ + } + return arr[:j] +} + +// Decimal 保留两位小数 +func Decimal(value float64) float64 { + value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64) + return value +} + +// InArray 判断字符串是否存在数组中 +func InArray(target string, strArray []string) bool { + sort.Strings(strArray) + index := sort.SearchStrings(strArray, target) + if index < len(strArray) && strArray[index] == target { + return true + } + return false +} + +// FileSize 字节的单位转换 保留两位小数 +func FileSize(fileSize int64) string { + units := []string{"B", "KB", "MB", "GB", "TB", "EB"} + var size = float64(fileSize) + var i int + for i = 0; size > 1024; i++ { + size /= 1024 + } + return fmt.Sprintf("%.2f %s", size, units[i]) +} + +type fileInfo struct { + name string + size int64 +} + +// WalkDir 获取目录下文件的名称和大小 +func WalkDir(dirname string) ([]fileInfo, error) { + var fileInfos []fileInfo + err := filepath.Walk(dirname, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if !info.IsDir() { + fileInfos = append(fileInfos, fileInfo{name: path, size: info.Size()}) + } + return nil + }) + + return fileInfos, err +} + +// DirSize 获取目录下所有文件大小 +func DirSize(dirname string) string { + var ( + s int64 + files, _ = WalkDir(dirname) + ) + for _, n := range files { + s += n.size + } + return FileSize(s) +} + +func ConvertToStringSlice(data []interface{}) []string { + result := make([]string, len(data)) + for i, v := range data { + str, ok := v.(string) + if !ok { + // 如果类型断言失败,可以在此处进行相应的错误处理 + // 这里简单地将该元素转换为空字符串 + str = "" + } + result[i] = str + } + return result +} + +// 删除文件 +func DeleteFile(name string) error { + //判断文件是否存在 + if _, err := os.Stat(name); err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + + //打开文件 + file, err := os.Open(name) + if err != nil { + return err + } + defer func(file *os.File) { + err := file.Close() + if err != nil { + fmt.Println("DeleteFile", err) + } + }(file) + + //删除文件 + err = os.Remove(name) + if err != nil { + return err + } + + return nil +} + +// ReverseReadLines 从文件末尾开始逆序高效地读取行。 +func ReverseReadLines(name string) ([]string, error) { + // 打开文件。 + file, err := os.Open(name) + if err != nil { + return nil, err + } + defer func(file *os.File) { + err := file.Close() + if err != nil { + g.Log().Error(context.Background(), "ReverseReadLines", err) + } + }(file) + + // 获取文件大小。 + fs, err := file.Stat() + if err != nil { + return nil, err + } + fileSize := fs.Size() + + // 定义合理的缓冲区大小进行读取。这个值可以根据预期的文件大小和行长度进行调整。 + const bufferSize = 1024 * 20 + + // 创建一个切片用于保存行。 + var lines []string + + // 从文件末尾开始分块读取。 + for offset := fileSize; offset > 0; offset -= bufferSize { + // 计算读取的大小。 + size := GetMin(bufferSize, offset) + buffer := make([]byte, size) + + // 定位并读取这一块。 + _, err := file.ReadAt(buffer, offset-size) + if err != nil { + return nil, err + } + + // 将缓冲区分割成行,并以逆序添加它们。 + scanner := bufio.NewScanner(bufio.NewReaderSize(file, int(size))) + var chunkLines []string + for scanner.Scan() { + chunkLines = append([]string{scanner.Text()}, chunkLines...) + } + // 将这一块的行添加到总行中。 + lines = append(chunkLines, lines...) + if err := scanner.Err(); err != nil { + return nil, err + } + } + + return lines, nil +} + +func ReverseRead(name string, lineNum uint) ([]string, error) { + //打开文件 + file, err := os.Open(name) + if err != nil { + return nil, err + } + defer func(file *os.File) { + err := file.Close() + if err != nil { + g.Log().Error(context.Background(), "ReverseRead file.Close", err) + } + }(file) + //获取文件大小 + fs, err := file.Stat() + if err != nil { + return nil, err + } + fileSize := fs.Size() + + var offset int64 = -1 //偏移量,初始化为-1,若为0则会读到EOF + char := make([]byte, 1) //用于读取单个字节 + lineStr := "" //存放一行的数据 + buff := make([]string, 0, 100) + for (-offset) <= fileSize { + //通过Seek函数从末尾移动游标然后每次读取一个字节 + _, err := file.Seek(offset, io.SeekEnd) + if err != nil { + return nil, err + } + _, err = file.Read(char) + if err != nil { + return buff, err + } + if char[0] == '\n' { + offset-- //windows跳过'\r' + lineNum-- //到此读取完一行 + buff = append(buff, lineStr) + lineStr = "" + if lineNum == 0 { + return buff, nil + } + } else { + lineStr = string(char) + lineStr + } + offset-- + } + buff = append(buff, lineStr) + //使用mahonia解码 + for i := 0; i < len(buff); i++ { + buff[i], err = gcharset.ToUTF8("UTF-8", buff[i]) + } + return buff, nil +} + +// 文件一块一块的读取 +func ReadBlock(filePath string) { + start1 := time.Now() + file, err := os.Open(filePath) + if err != nil { + g.Log().Error(context.Background(), "ReadBlock Open", err) + return + } + defer func(file *os.File) { + err := file.Close() + if err != nil { + g.Log().Error(context.Background(), "ReadBlock file.Close", err) + } + }(file) + // 设置每次读取字节数 + buffer := make([]byte, 1024*4) + for { + n, err := file.Read(buffer) + // 控制条件,根据实际调整 + if err != nil && err != io.EOF { + g.Log().Error(context.Background(), "ReadBlock Read", err) + } + if n == 0 { + break + } + // 如下代码打印出每次读取的文件块(字节数) + //fmt.Println(string(buffer[:n])) + } + fmt.Println("readBolck spend : ", time.Now().Sub(start1)) +} + +const ( + kilobyte = 1024 + megabyte = 1024 * kilobyte + gigabyte = 1024 * megabyte + terabyte = 1024 * gigabyte + petabyte = 1024 * terabyte +) + +// FormatSize 格式化文件大小。 +func FormatSize(size int64) string { + switch { + case size < kilobyte: + return strconv.Itoa(int(size)) + "B" + case size < megabyte: + return fmt.Sprintf("%.2fK", float64(size)/kilobyte) + case size < gigabyte: + return fmt.Sprintf("%.2fM", float64(size)/megabyte) + case size < terabyte: + return fmt.Sprintf("%.2fG", float64(size)/gigabyte) + case size < petabyte: + return fmt.Sprintf("%.2fT", float64(size)/terabyte) + default: + return fmt.Sprintf("%.2fP", float64(size)/petabyte) + } +} + +func ValidatePassword(password string, minimumLength int, requireComplexity int, requireDigit int, requireLowercase int, requireUppercase int) (flag bool, err error) { + //初始化返回结果 + flag = true + //判断密码长度 + if len(password) < minimumLength { + err = gerror.New(fmt.Sprintf(g.I18n().T(context.TODO(), "{#utilsValidatePwLen}"), minimumLength)) + flag = false + return + } + //是否有复杂字符 + if requireComplexity == 1 && !hasComplexCharacters(password) { + err = gerror.New(g.I18n().T(context.TODO(), "{#utilsValidatePwChar}")) + flag = false + return + } + //是否有数字 + if requireDigit == 1 && !hasDigit(password) { + err = gerror.New(g.I18n().T(context.TODO(), "{#utilsValidatePwDigit}")) + flag = false + return + } + //是否有小写字母 + if requireLowercase == 1 && !hasLowercaseLetter(password) { + err = gerror.New(g.I18n().T(context.TODO(), "{#utilsValidatePwLower}")) + flag = false + return + } + //是否有大写字母 + if requireUppercase == 1 && !hasUppercaseLetter(password) { + err = gerror.New(g.I18n().T(context.TODO(), "{#utilsValidatePwUpper}")) + flag = false + return + } + + return +} + +// hasComplexCharacters:检查字符串中是否有复杂字符(特殊字符) +func hasComplexCharacters(str string) bool { + specialCharacters := "!@#$%^&*()_+-=[]{}|;:,.<>?~" + + for _, char := range str { + if contains(specialCharacters, string(char)) { + return true + } + } + + return false +} + +// hasDigit:检查字符串中是否有数字 +func hasDigit(str string) bool { + for _, char := range str { + if isDigit(string(char)) { + return true + } + } + + return false +} + +// hasLowercaseLetter:检查字符串中是否有小写字母 +func hasLowercaseLetter(str string) bool { + for _, char := range str { + if isLowercase(string(char)) { + return true + } + } + + return false +} + +// hasUppercaseLetter:检查字符串中是否有大写字母 +func hasUppercaseLetter(str string) bool { + for _, char := range str { + if isUppercase(string(char)) { + return true + } + } + + return false +} + +// isDigit:判断字符是否是数字 +func isDigit(c string) bool { + return c >= "0" && c <= "9" +} + +// isLowercase:判断字符是否是小写字母 +func isLowercase(c string) bool { + return c >= "a" && c <= "z" +} + +// isUppercase:判断字符是否是大写字母 +func isUppercase(c string) bool { + return c >= "A" && c <= "Z" +} + +// contains:判断字符串是否包含指定字符 +func contains(str, char string) bool { + for _, c := range str { + if string(c) == char { + return true + } + } + + return false +} + +// GetMin 返回两个整数中的较小值 +func GetMin(a, b int64) int64 { + if a < b { + return a + } + return b +} + +// 返回自定义错误码 +func NewGError(code gcode.Code) error { + return gerror.NewCode(code, code.Message()) +} + +// 返回自定义错误码 +func NewGErrorS(code gcode.Code, text string) error { + return gerror.NewCode(code, text) +} + +// ToExcel 生成io.ReadSeeker 参数 titleList 为Excel表头,dataList 为数据 +func ToExcel(dataList []interface{}) (content io.ReadSeeker) { + // 生成一个新的文件 + file := xlsx.NewFile() + // 添加sheet页 + sheet, _ := file.AddSheet("Sheet1") + // 插入表头 + titleRow := sheet.AddRow() + + //获取表头 + objType := reflect.TypeOf(dataList[0]) + elem := objType.Elem() + var titleList []string + if elem.Kind() == reflect.Struct { + for i := 1; i <= elem.NumField(); i++ { + field := elem.Field(i - 1) + if field.Name != "PageReq" { + if field.Tag != "" && field.Tag.Get("description") != "" { + titleList = append(titleList, g.I18n().T(context.TODO(), field.Tag.Get("description"))) + } else { + titleList = append(titleList, g.I18n().T(context.TODO(), field.Name)) + } + } + } + } + + for _, v := range titleList { + cell := titleRow.AddCell() + cell.Value = v + //表头字体颜色 + cell.GetStyle().Font.Color = "000000" + cell.GetStyle().Fill.BgColor = "cfe2f3" + //居中显示 + cell.GetStyle().Alignment.Horizontal = "center" + cell.GetStyle().Alignment.Vertical = "center" + } + // 插入内容 + for _, v := range dataList { + row := sheet.AddRow() + row.WriteStruct(v, -1) + } + + var buffer bytes.Buffer + _ = file.Write(&buffer) + content = bytes.NewReader(buffer.Bytes()) + return +} + +// 解析时间 +func ParseDuration(d string) (time.Duration, error) { + d = strings.TrimSpace(d) + dr, err := time.ParseDuration(d) + if err == nil { + return dr, nil + } + if strings.Contains(d, "d") { + index := strings.Index(d, "d") + + hour, _ := strconv.Atoi(d[:index]) + dr = time.Hour * 24 * time.Duration(hour) + ndr, err := time.ParseDuration(d[index+1:]) + if err != nil { + return dr, nil + } + return dr + ndr, nil + } + + dv, err := strconv.ParseInt(d, 10, 64) + return time.Duration(dv), err +} diff --git a/server/internal/library/websocket/client.go b/server/internal/library/websocket/client.go new file mode 100644 index 0000000..7ea5ec5 --- /dev/null +++ b/server/internal/library/websocket/client.go @@ -0,0 +1,156 @@ +// Package websocket +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package websocket + +import ( + "context" + "fmt" + "runtime/debug" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/uuid32" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" + "github.com/gorilla/websocket" +) + +const ( + // 用户连接超时时间 + heartbeatExpirationTime = 6 * 60 +) + +// 用户登录 +type login struct { + UserId uint64 + Client *Client +} + +// GetKey 读取客户端数据 +func (l *login) GetKey() (key string) { + key = GetUserKey(l.UserId) + return +} + +// Client 客户端连接 +type Client struct { + Addr string // 客户端地址 + ID string // 连接唯一标识 + Socket *websocket.Conn // 用户连接 + Send chan *WResponse // 待发送的数据 + SendClose bool // 发送是否关闭 + UserId uint64 // 用户ID,用户登录以后才有 + FirstTime uint64 // 首次连接事件 + HeartbeatTime uint64 // 用户上次心跳时间 + LoginTime uint64 // 登录时间 登录以后才有 + isApp bool // 是否是app + tags *garray.StrArray // 标签 + Ctx context.Context // 上下文 + closeSignal chan struct{} // 关闭信号 +} + +// NewClient 初始化 +func NewClient(addr string, socket *websocket.Conn, firstTime uint64, ctx context.Context) (client *Client) { + client = &Client{ + Addr: addr, + ID: uuid32.New(), + Socket: socket, + Send: make(chan *WResponse, 100), + SendClose: false, + FirstTime: firstTime, + HeartbeatTime: firstTime, + Ctx: ctx, + closeSignal: make(chan struct{}, 1), + tags: garray.NewStrArray(true), + } + return +} + +// 读取客户端数据 +func (c *Client) read() { + defer func() { + if r := recover(); r != nil { + fmt.Println("write stop", string(debug.Stack()), r) + } + }() + + defer func() { + c.close() + }() + + for { + _, message, err := c.Socket.ReadMessage() + if err != nil { + g.Log().Info(c.Ctx, "websocket Client.read failed.", err) + return + } + // 处理程序 + // fmt.Println(message) + ProcessData(c, message) + } +} + +// 向客户端写数据 +func (c *Client) write() { + defer func() { + if r := recover(); r != nil { + fmt.Println("write stop", string(debug.Stack()), r) + } + }() + defer func() { + clientManager.Unregister <- c + _ = c.Socket.Close() + }() + for { + select { + case <-c.closeSignal: + g.Log().Infof(mctx, "websocket client exit, user:%+v", c.UserId) + return + case message, ok := <-c.Send: + if !ok { + g.Log().Info(c.Ctx, "websocket Client.write failed.") + // 发送数据错误 关闭连接 + return + } + _ = c.Socket.WriteJSON(message) + } + } +} + +// SendMsg 发送数据 +func (c *Client) SendMsg(msg *WResponse) { + if c == nil || c.SendClose { + return + } + defer func() { + if r := recover(); r != nil { + fmt.Println("SendMsg stop:", r, string(debug.Stack())) + } + }() + c.Send <- msg +} + +// Heartbeat 心跳更新 +func (c *Client) Heartbeat(currentTime uint64) { + c.HeartbeatTime = currentTime +} + +// IsHeartbeatTimeout 心跳是否超时 +func (c *Client) IsHeartbeatTimeout(currentTime uint64) (timeout bool) { + if c.HeartbeatTime+heartbeatExpirationTime <= currentTime { + timeout = true + } + return +} + +// 关闭客户端 +func (c *Client) close() { + g.Log().Info(c.Ctx, "websocket Client.close") + if c.SendClose { + return + } + c.SendClose = true + c.closeSignal <- struct{}{} +} diff --git a/server/internal/library/websocket/client_manager.go b/server/internal/library/websocket/client_manager.go new file mode 100644 index 0000000..cd0a6c0 --- /dev/null +++ b/server/internal/library/websocket/client_manager.go @@ -0,0 +1,384 @@ +// Package websocket +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package websocket + +import ( + "context" + "fmt" + "runtime/debug" + "sync" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcron" + "github.com/gogf/gf/v2/os/gtime" +) + +// ClientManager 客户端管理 +type ClientManager struct { + Clients map[*Client]bool // 全部的连接 + ClientsLock sync.RWMutex // 读写锁 + Users map[string]*Client // 登录的用户 // uuid + UserLock sync.RWMutex // 读写锁 + Register chan *Client // 连接连接处理 + Login chan *login // 用户登录处理 + Unregister chan *Client // 断开连接处理程序 + Broadcast chan *WResponse // 广播 向全部成员发送数据 + ClientBroadcast chan *ClientWResponse // 广播 向某个客户端发送数据 + TagBroadcast chan *TagWResponse // 广播 向某个标签成员发送数据 + UserBroadcast chan *UserWResponse // 广播 向某个用户的所有链接发送数据 + TagCallbackMap map[string]func(client *Client, tag string) // 注册标签回调 + closeSignal chan struct{} // 关闭信号 + TagCountMap map[string]int // 标签map + TagLock sync.RWMutex // 标签读写锁 +} + +func NewClientManager() (clientManager *ClientManager) { + clientManager = &ClientManager{ + Clients: make(map[*Client]bool), + Users: make(map[string]*Client), + Register: make(chan *Client, 1000), + Unregister: make(chan *Client, 1000), + Broadcast: make(chan *WResponse, 1000), + TagBroadcast: make(chan *TagWResponse, 1000), + UserBroadcast: make(chan *UserWResponse, 1000), + TagCallbackMap: make(map[string]func(client *Client, tag string)), + closeSignal: make(chan struct{}, 1), + TagCountMap: make(map[string]int), + TagLock: sync.RWMutex{}, + } + return +} + +// GetUserKey 获取用户key +func GetUserKey(userId uint64) (key string) { + key = fmt.Sprintf("%s_%d", "ws", userId) + return +} + +// InClient 客户端是否存在 +func (manager *ClientManager) InClient(client *Client) (ok bool) { + manager.ClientsLock.RLock() + defer manager.ClientsLock.RUnlock() + _, ok = manager.Clients[client] + return +} + +// GetClients 获取所有客户端 +func (manager *ClientManager) GetClients() (clients map[*Client]bool) { + clients = make(map[*Client]bool) + manager.ClientsRange(func(client *Client, value bool) (result bool) { + clients[client] = value + return true + }) + return +} + +// ClientsRange 遍历 +func (manager *ClientManager) ClientsRange(f func(client *Client, value bool) bool) { + manager.ClientsLock.RLock() + defer func() { + manager.ClientsLock.RUnlock() + }() + for key, value := range manager.Clients { + r := f(key, value) + if !r { + break + } + } +} + +// GetClientsLen 获取客户端总数 +func (manager *ClientManager) GetClientsLen() (clientsLen int) { + clientsLen = len(manager.Clients) + return +} + +// AddClients 添加客户端 +func (manager *ClientManager) AddClients(client *Client) { + manager.ClientsLock.Lock() + defer manager.ClientsLock.Unlock() + manager.Clients[client] = true +} + +// DelClients 删除客户端 +func (manager *ClientManager) DelClients(client *Client) { + manager.ClientsLock.Lock() + defer manager.ClientsLock.Unlock() + if _, ok := manager.Clients[client]; ok { + // 删除标签 + client.tags.Iterator(func(k int, name string) bool { + DelTagCount(name) + return true + }) + delete(manager.Clients, client) + } +} + +// GetUserClient 获取用户的连接 +func (manager *ClientManager) GetUserClient(userId uint64) (client *Client) { + manager.UserLock.RLock() + defer manager.UserLock.RUnlock() + userKey := GetUserKey(userId) + if value, ok := manager.Users[userKey]; ok { + client = value + } + return +} + +// AddUsers 添加用户 +func (manager *ClientManager) AddUsers(key string, client *Client) { + manager.UserLock.Lock() + defer manager.UserLock.Unlock() + manager.Users[key] = client +} + +// DelUsers 删除用户 +func (manager *ClientManager) DelUsers(client *Client) (result bool) { + manager.UserLock.Lock() + defer manager.UserLock.Unlock() + key := GetUserKey(client.UserId) + if value, ok := manager.Users[key]; ok { + // 判断是否为相同的用户 + if value.Addr != client.Addr { + return + } + delete(manager.Users, key) + result = true + } + return +} + +// GetUsersLen 已登录用户数 +func (manager *ClientManager) GetUsersLen() (userLen int) { + userLen = len(manager.Users) + return +} + +// EventRegister 用户建立连接事件 +func (manager *ClientManager) EventRegister(client *Client) { + manager.AddClients(client) + //发送当前客户端标识 + client.SendMsg(&WResponse{Event: "connected", Data: g.Map{ + "ID": client.ID, + }}) + if client.UserId > 0 { + manager.AddUsers(GetUserKey(client.UserId), client) + } + g.Log().Info(client.Ctx, "websocket EventRegister.", client.UserId) +} + +// EventLogin 用户登录事件 +func (manager *ClientManager) EventLogin(login *login) { + client := login.Client + if manager.InClient(client) { + userKey := login.GetKey() + manager.AddUsers(userKey, login.Client) + } +} + +// EventUnregister 用户断开连接事件 +func (manager *ClientManager) EventUnregister(client *Client) { + g.Log().Info(client.Ctx, "websocket EventUnregister.", client.UserId) + manager.DelClients(client) + // 删除用户连接 + deleteResult := manager.DelUsers(client) + if !deleteResult { + // 不是当前连接的客户端 + return + } + // 关闭 chan + // close(client.Send) + client.close() +} + +// ClearTimeoutConnections 定时清理超时连接 +func (manager *ClientManager) clearTimeoutConnections() { + currentTime := uint64(gtime.Now().Unix()) + clients := clientManager.GetClients() + for client := range clients { + if client.IsHeartbeatTimeout(currentTime) { + //fmt.Println("心跳时间超时 关闭连接", client.Addr, client.UserId, client.LoginTime, client.HeartbeatTime) + _ = client.Socket.Close() + } + } +} + +// WebsocketPing 心跳处理 +func (manager *ClientManager) ping(ctx context.Context) { + //定时任务,发送心跳包 + _, _ = gcron.Add(ctx, "0 */1 * * * *", func(ctx context.Context) { + res := &WResponse{ + Event: Ping, + Data: g.Map{}, + } + SendToAll(res) + }) + // 定时任务,清理超时连接 + _, _ = gcron.Add(ctx, "*/30 * * * * *", func(ctx context.Context) { + manager.clearTimeoutConnections() + }) + +} + +// 管道处理程序 +func (manager *ClientManager) start() { + defer func() { + if r := recover(); r != nil { + g.Log().Warningf(mctx, "websocket start recover:%+v, stack:%+v", r, string(debug.Stack())) + return + } + }() + for { + select { + case conn := <-manager.Register: + // 建立连接事件 + manager.EventRegister(conn) + + case login := <-manager.Login: + // 用户登录 + manager.EventLogin(login) + + case conn := <-manager.Unregister: + // 断开连接事件 + manager.EventUnregister(conn) + + case message := <-manager.Broadcast: + // 全部客户端广播事件 + clients := manager.GetClients() + for conn := range clients { + conn.SendMsg(message) + } + case message := <-manager.TagBroadcast: + // 标签广播事件 + clients := manager.GetClients() + // find := false + for conn := range clients { + if conn.tags.Contains(message.Tag) { + conn.SendMsg(message.WResponse) + // find = true + } + } + // g.Log().Debugf(context.TODO(), "client_manager.go 标签广播事件 find:%v msg:%v", find, message) + case message := <-manager.UserBroadcast: + // 用户广播事件 + clients := manager.GetClients() + for conn := range clients { + if conn.UserId == message.UserID { + conn.SendMsg(message.WResponse) + } + } + case message := <-manager.ClientBroadcast: + // 单个客户端广播事件 + clients := manager.GetClients() + for conn := range clients { + if conn.ID == message.ID { + conn.SendMsg(message.WResponse) + } + } + case <-manager.closeSignal: + g.Log().Debug(mctx, "websocket closeSignal exit.") + return + } + + } +} + +// SendToAll 发送全部客户端 +func SendToAll(response *WResponse) { + clientManager.Broadcast <- response +} + +// SendToClientID 发送单个客户端 +func SendToClientID(id string, response *WResponse) { + clientRes := &ClientWResponse{ + ID: id, + WResponse: response, + } + clientManager.ClientBroadcast <- clientRes +} + +// SendToUser 发送单个用户 +func SendToUser(userID uint64, response *WResponse) { + userRes := &UserWResponse{ + UserID: userID, + WResponse: response, + } + clientManager.UserBroadcast <- userRes + // g.Log().Debugf(context.Background(), "websocket SendToUser userID:%v response:%+v", userID, response) +} + +// SendToTag 发送某个标签 +func SendToTag(tag string, response *WResponse) { + count := GetTagCount(tag) + if count == 0 { + return + } + + tagRes := &TagWResponse{ + Tag: tag, + WResponse: response, + } + clientManager.TagBroadcast <- tagRes +} + +// RegisterTagCallback 注册标签回调 +func RegisterTagCallback(tag string, callback func(client *Client, tag string)) { + clientManager.TagLock.Lock() + defer clientManager.TagLock.Unlock() + clientManager.TagCallbackMap[tag] = callback +} + +// UnregisterTagCallback 注销标签回调 +func UnregisterTagCallback(tag string) { + clientManager.TagLock.Lock() + defer clientManager.TagLock.Unlock() + delete(clientManager.TagCallbackMap, tag) +} + +// 添加标签订阅计数 +func AddTagCount(tag string) { + clientManager.TagLock.Lock() + defer clientManager.TagLock.Unlock() + if _, ok := clientManager.TagCountMap[tag]; !ok { + clientManager.TagCountMap[tag] = 1 + } else { + clientManager.TagCountMap[tag]++ + } +} + +// 删除标签订阅计数 +func DelTagCount(tag string) { + clientManager.TagLock.Lock() + defer clientManager.TagLock.Unlock() + count, ok := clientManager.TagCountMap[tag] + if ok { + if count > 0 { + clientManager.TagCountMap[tag]-- + } else { + delete(clientManager.TagCountMap, tag) + } + } +} + +// GetTagCount 获取标签订阅计数 +func GetTagCount(tag string) (count int) { + clientManager.TagLock.RLock() + defer clientManager.TagLock.RUnlock() + count, ok := clientManager.TagCountMap[tag] + if ok { + return count + } + return 0 +} + +// 变量Tag Count +func RangeTagCount(callback func(tag string, count int)) { + clientManager.TagLock.RLock() + defer clientManager.TagLock.RUnlock() + for tag, count := range clientManager.TagCountMap { + callback(tag, count) + } +} diff --git a/server/internal/library/websocket/controller.go b/server/internal/library/websocket/controller.go new file mode 100644 index 0000000..da2ebbc --- /dev/null +++ b/server/internal/library/websocket/controller.go @@ -0,0 +1,125 @@ +// Package websocket +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package websocket + +import ( + "fmt" + "strings" + + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gconv" +) + +// LoginController 用户登录 +func LoginController(client *Client, req *request) { + l := &WsLoginDataReq{} + gconv.Struct(req.Data, &l) + userId := gconv.Uint64(l.UserID) + client.UserId = userId + // 用户登录 + login := &login{ + UserId: userId, + Client: client, + } + clientManager.Login <- login + + client.SendMsg(&WResponse{ + Event: Login, + Data: "success", + }) +} + +func IsAppController(client *Client) { + client.isApp = true +} + +// JoinController 加入 +func JoinController(client *Client, req *request) { + name := gconv.String(req.Data["name"]) + + if !client.tags.Contains(name) { + client.tags.Append(name) + for k, v := range clientManager.TagCallbackMap { + if strings.HasPrefix(name, k) { + if v != nil { + v(client, name) + } + } + } + AddTagCount(name) + } + client.SendMsg(&WResponse{ + Event: Join, + Data: client.tags.Slice(), + }) +} + +// QuitController 退出 +func QuitController(client *Client, req *request) { + name := gconv.String(req.Data["name"]) + if client.tags.Contains(name) { + client.tags.RemoveValue(name) + DelTagCount(name) + } + client.SendMsg(&WResponse{ + Event: Quit, + Data: client.tags.Slice(), + }) +} + +func PingController(client *Client) { + currentTime := uint64(gtime.Now().Unix()) + client.Heartbeat(currentTime) +} + +// JoinsController 加入 +func JoinsController(client *Client, req *request) { + if req == nil || req.Data == nil { + fmt.Println("websocket.JoinsController req is nil or req.Data is nil") + return + } + // fmt.Println("websocket.JoinsController req.Data", req.Data) + names, ok := req.Data["names"] + if !ok || names == nil { + fmt.Println("websocket.JoinsController names is nil or names is empty") + return + } + // fmt.Println("websocket.JoinsController names", names) + for _, name := range gconv.Strings(names) { + if name == "" { + continue + } + if !client.tags.Contains(name) { + client.tags.Append(name) + for k, v := range clientManager.TagCallbackMap { + if strings.HasPrefix(name, k) { + if v != nil { + v(client, name) + } + } + } + AddTagCount(name) + } + } + client.SendMsg(&WResponse{ + Event: Joins, + Data: client.tags.Slice(), + }) +} + +// QuitController 退出 +func QuitsController(client *Client, req *request) { + for _, name := range gconv.Strings(req.Data["names"]) { + if client.tags.Contains(name) { + client.tags.RemoveValue(name) + DelTagCount(name) + } + } + client.SendMsg(&WResponse{ + Event: Quits, + Data: client.tags.Slice(), + }) +} diff --git a/server/internal/library/websocket/init.go b/server/internal/library/websocket/init.go new file mode 100644 index 0000000..db2f741 --- /dev/null +++ b/server/internal/library/websocket/init.go @@ -0,0 +1,63 @@ +// Package websocket +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package websocket + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "net/http" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gctx" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gorilla/websocket" +) + +var ( + mctx = gctx.GetInitCtx() // 上下文 + clientManager = NewClientManager() // 管理者 +) +var upGrader = websocket.Upgrader{ + ReadBufferSize: 1024, + WriteBufferSize: 1024, + CheckOrigin: func(r *http.Request) bool { + return true + }, +} + +func StartWebSocket(ctx context.Context) { + g.Log().Info(ctx, "启动:WebSocket") + go clientManager.start() + go clientManager.ping(ctx) +} + +func StopWebSocket(ctx context.Context) { + g.Log().Info(ctx, "停止:WebSocket") + clientManager.closeSignal <- struct{}{} +} + +func WsPage(r *ghttp.Request) { + g.Log().Infof(r.GetCtx(), "websocket.WsPage Begin. UserID:%v ", contexts.GetUserId(r.GetCtx())) + // r.Response.Header().Set("Content-Type", "text/event-stream") + contexts.SetIsWebSocket(r.GetCtx(), true) + conn, err := upGrader.Upgrade(r.Response.Writer, r.Request, nil) + if err != nil { + r.Response.Write(err.Error()) + return + } + currentTime := uint64(gtime.Now().Unix()) + client := NewClient(conn.RemoteAddr().String(), conn, currentTime, r.GetCtx()) + + client.UserId = uint64(contexts.GetUserId(r.GetCtx())) + go client.read() + go client.write() + + // 用户连接事件 + clientManager.Register <- client + + g.Log().Infof(r.GetCtx(), "websocket.WsPage End. UserID:%v", client.UserId) +} diff --git a/server/internal/library/websocket/model.go b/server/internal/library/websocket/model.go new file mode 100644 index 0000000..0660961 --- /dev/null +++ b/server/internal/library/websocket/model.go @@ -0,0 +1,39 @@ +// Package websocket +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package websocket + +import "github.com/gogf/gf/v2/frame/g" + +// 当前输入对象 +type request struct { + Event string `json:"e"` //事件名称 + Data g.Map `json:"d"` //数据 +} + +// WResponse 输出对象 +type WResponse struct { + Event string `json:"e"` //事件名称 + Data interface{} `json:"d"` //数据 +} + +type TagWResponse struct { + Tag string + WResponse *WResponse +} + +type UserWResponse struct { + UserID uint64 + WResponse *WResponse +} + +type ClientWResponse struct { + ID string + WResponse *WResponse +} + +type WsLoginDataReq struct { + UserID uint `json:"userId" ` +} diff --git a/server/internal/library/websocket/router.go b/server/internal/library/websocket/router.go new file mode 100644 index 0000000..c1aca1d --- /dev/null +++ b/server/internal/library/websocket/router.go @@ -0,0 +1,62 @@ +// Package websocket +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package websocket + +import ( + "fmt" + + "github.com/gogf/gf/v2/util/gconv" +) + +const ( + Error = "error" + Login = "login" + Join = "join" + Quit = "quit" + IsApp = "is_app" + Ping = "ping" + Joins = "joins" + Quits = "quits" +) + +// ProcessData 处理数据 +func ProcessData(client *Client, message []byte) { + defer func() { + if r := recover(); r != nil { + fmt.Println("websocket.ProcessData 处理数据 stop", r, "message=", message) + } + }() + request := &request{} + err := gconv.Struct(message, request) + if err != nil { + fmt.Println("websocket.ProcessData 数据解析失败:", err) + return + } + fmt.Println("websocket.ProcessData request", request) + switch request.Event { + case Login: + LoginController(client, request) + break + case Join: + JoinController(client, request) + break + case Quit: + QuitController(client, request) + break + case IsApp: + IsAppController(client) + break + case Ping: + PingController(client) + break + case Joins: + JoinsController(client, request) + break + case Quits: + QuitsController(client, request) + break + } +} diff --git a/server/internal/library/worker/options.go b/server/internal/library/worker/options.go new file mode 100644 index 0000000..880dc89 --- /dev/null +++ b/server/internal/library/worker/options.go @@ -0,0 +1,225 @@ +// Package worker +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package worker + +import ( + "context" + "time" + + "github.com/gogf/gf/v2/frame/g" +) + +type Payload struct { + IsAggregate bool `json:"isAggregate"` + Group string `json:"group"` + Uid string `json:"uid"` + Payload []byte `json:"payload"` +} + +type AggregatorOptions struct { + GroupGracePeriod int // 组的优雅延迟时间(秒) + GroupMaxDelay int // 组的最大延迟时间(秒) + GroupMaxSize int // 组的最大大小 +} + +type WorkerOptions struct { + group string //任务处理器的组名 + redisAddr string //redis地址 + redisUser string //redis用户名 + redisPassword string //redis密码 + redisDB int //redis数据库 + handler func(ctx context.Context, p Payload) error //任务处理函数 + maxRetry int //任务最大重试次数 + clearArchived int //清除已归档任务的时间间隔 + timeout int //任务超时时间 + redisPeriodKey string //redis周期任务键 + aggregator *AggregatorOptions //聚合器选项 +} + +func GetDefaultWorkerOptions(ops *WorkerOptions) *WorkerOptions { + if ops != nil { + return ops + } + addr := g.Cfg().MustGet(context.Background(), "queue.asynq.redis.address").String() + pass := g.Cfg().MustGet(context.Background(), "queue.asynq.redis.pass").String() + db := g.Cfg().MustGet(context.Background(), "queue.asynq.redis.db").Int() + user := g.Cfg().MustGet(context.Background(), "queue.asynq.redis.user").String() + if user == "" { + user = "default" + } + return &WorkerOptions{ + group: "task", + redisAddr: addr, + redisPassword: pass, + redisDB: db, + redisUser: user, + } +} + +func WithWorkerGroup(group string) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).group = group + } +} + +func WithWorkerRedisAddr(addr string) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).redisAddr = addr + } +} + +func WithWorkerRedisUser(user string) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).redisUser = user + } +} + +func WithWorkerRedisPassword(pass string) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).redisPassword = pass + } +} + +func WithWorkerRedisDB(db int) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).redisDB = db + } +} + +func WithWorkerHandler(handler func(ctx context.Context, p Payload) error) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).handler = handler + } +} + +func WithWorkerMaxRetry(maxRetry int) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).maxRetry = maxRetry + } +} + +func WithWorkerClearArchived(clearArchived int) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).clearArchived = clearArchived + } +} + +func WithWorkerTimeout(timeout int) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).timeout = timeout + } +} + +func WithWorkerRedisPeriodKey(redisPeriodKey string) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).redisPeriodKey = redisPeriodKey + } +} + +func WithWorkerAggregator(aggregator *AggregatorOptions) func(*WorkerOptions) { + return func(o *WorkerOptions) { + GetDefaultWorkerOptions(o).aggregator = aggregator + } +} + +type TaskOptions struct { + uid string + group string + payload []byte + expr string // 仅周期任务 + in *time.Duration // 仅一次性任务 当前时间的延迟 + at *time.Time // 仅一次性任务 指定时间 + now bool // 仅一次性任务 当前时间 + retention int // 仅一次性任务 任务保留时间 在这个时间内任务会被保留为已完成状态,过了这个时间后,任务将被自动删除。 + replace bool // 仅一次性任务 是否替换已存在的任务 + ctx context.Context // 仅一次性任务 + maxRetry int + timeout int +} + +func GetDefaultTaskOptions(opt *TaskOptions) *TaskOptions { + if opt != nil { + return opt + } + return &TaskOptions{ + group: "group", + maxRetry: 3, + timeout: 120, + } +} + +func WithTaskUid(uid string) func(*TaskOptions) { + + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).uid = uid + } +} + +func WithTaskGroup(group string) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).group = group + } +} + +func WithTaskPayload(payload []byte) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).payload = payload + } +} + +func WithTaskExpr(expr string) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).expr = expr + } +} + +func WithTaskIn(in *time.Duration) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).in = in + } +} + +func WithTaskAt(at *time.Time) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).at = at + } +} + +func WithTaskNow(now bool) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).now = now + } +} + +func WithTaskRetention(retention int) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).retention = retention + } +} + +func WithTaskReplace(replace bool) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).replace = replace + } +} + +func WithTaskCtx(ctx context.Context) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).ctx = ctx + } +} + +func WithTaskMaxRetry(maxRetry int) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).maxRetry = maxRetry + } +} + +func WithTaskTimeout(timeout int) func(*TaskOptions) { + return func(o *TaskOptions) { + GetDefaultTaskOptions(o).timeout = timeout + } +} diff --git a/server/internal/library/worker/work_proces.go b/server/internal/library/worker/work_proces.go new file mode 100644 index 0000000..3e0d12f --- /dev/null +++ b/server/internal/library/worker/work_proces.go @@ -0,0 +1,84 @@ +// package worker +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package worker + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/uuid32" + + "github.com/gogf/gf/v2/frame/g" +) + +type Queue struct { + topic string + w *Worker +} + +type Process interface { + GetTopic() string // 获取消费主题 + Handle(ctx context.Context, p Payload) (err error) // 处理过程的方法 + GetAggregator() *AggregatorOptions // 获取聚合器配置,返回nil不使用聚合 +} + +func RegisterQueueProcess(p Process) (q *Queue) { + q = &Queue{ + topic: p.GetTopic(), + w: New(WithWorkerGroup(p.GetTopic()), WithWorkerHandler(p.Handle), WithWorkerAggregator(p.GetAggregator())), + } + return +} + +func (q *Queue) Push(ctx context.Context, topic string, data []byte, timeout int) (err error) { + err = q.w.Once( + WithTaskUid(uuid32.New()), + WithTaskGroup(topic), + WithTaskPayload(data), + WithTaskTimeout(timeout), + ) + if err != nil { + g.Log().Debug(ctx, "Run Queue TaskWorker %s Error: %v", topic, err) + } + return nil +} + +func (q *Queue) Stop() { + if q.w != nil { + q.w.Stop() + } +} + +type Scheduled struct { + topic string + w *Worker +} + +func RegisterScheduledProcess(p Process) (q *Queue) { + q = &Queue{ + topic: p.GetTopic(), + w: New(WithWorkerGroup(p.GetTopic()), WithWorkerHandler(p.Handle), WithWorkerAggregator(p.GetAggregator())), + } + return +} +func (s *Scheduled) Cron(ctx context.Context, topic, cronExpr string, data []byte) (entryID string, err error) { + s.topic = topic + entryID, err = s.w.Cron( + 1, + WithTaskUid(uuid32.S()), + WithTaskGroup(topic), + WithTaskExpr(cronExpr), + WithTaskPayload(data), + ) + if err != nil { + g.Log().Debug(ctx, "Run Cron TaskWorker %s Error: %v", topic, err) + } + return +} + +func (s *Scheduled) Remove(entryID string) (err error) { + err = s.w.RemoveCron(entryID) + return +} diff --git a/server/internal/library/worker/worker.go b/server/internal/library/worker/worker.go new file mode 100644 index 0000000..8570aca --- /dev/null +++ b/server/internal/library/worker/worker.go @@ -0,0 +1,307 @@ +// package worker +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package worker + +import ( + "context" + "encoding/json" + "errors" + "strings" + "time" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/uuid32" + + "github.com/dromara/carbon/v2" + "github.com/gogf/gf/v2/frame/g" + "github.com/xiujiecn/asynq" +) + +type Worker struct { + ops *WorkerOptions + client *asynq.Client + inspector *asynq.Inspector + scheduler *asynq.Scheduler + svr *asynq.Server + Error error +} + +type periodTask struct { + Expr string `json:"expr"` // asynq + Group string `json:"group"` + Uid string `json:"uid"` + Payload []byte `json:"payload"` + Next int64 `json:"next"` // next schedule unix timestamp + Processed int64 `json:"processed"` // run times + MaxRetry int `json:"maxRetry"` + Timeout int `json:"timeout"` +} + +func (p *periodTask) String() (str string) { + bs, _ := json.Marshal(p) + str = string(bs) + return +} + +func (p *periodTask) FromString(str string) { + err := json.Unmarshal([]byte(str), p) + if err != nil { + return + } + return +} + +func aggregate(group string, tasks []*asynq.Task) *asynq.Task { + // g.Log().Infof(context.Background(), "server/internal/library/worker/worker.go aggregate group %s, tasks %d", group, len(tasks)) + list := make([][]byte, 0) + for _, t := range tasks { + list = append(list, t.Payload()) + } + payload, _ := json.Marshal(list) + return asynq.NewTask(group+".aggregate", payload, asynq.TaskID(uuid32.S())) +} + +func New(options ...func(*WorkerOptions)) *Worker { + ops := GetDefaultWorkerOptions(nil) + for _, op := range options { + op(ops) + } + + rs := asynq.RedisClientOpt{ + Addr: ops.redisAddr, + Password: ops.redisPassword, + DB: ops.redisDB, + } + + w := &Worker{} + if ops.redisAddr == "" { + w.Error = errors.New("redisAddr is nil") + return w + } + w.ops = ops + w.client = asynq.NewClient(rs) + w.inspector = asynq.NewInspector(rs) + if ops.redisPeriodKey != "" { + w.scheduler = asynq.NewScheduler(rs, &asynq.SchedulerOpts{ + Location: time.Now().Location(), + LogLevel: asynq.LogLevel(g.Cfg().MustGet(context.Background(), "queue.asynq.logLevel").Int()), // 日志级别 DebugLevel 1, InfoLevel 2, WarnLevel 3, ErrorLevel 4, FatalLevel 5 + }) + go func() { + if err := w.scheduler.Start(); err != nil { + g.Log().Error(context.Background(), "server/internal/library/worker/worker.go New 启动调度器失败", err) + panic(err) + } + g.Log().Info(context.Background(), "server/internal/library/worker/worker.go New 启动调度器成功", "group", w.ops.group) + }() + } + conf := asynq.Config{ + Concurrency: g.Cfg().MustGet(context.Background(), "queue.asynq.concurrency").Int(), // 最大同时执行的任务数量 + Queues: map[string]int{ops.group: 10}, // 队列名称和优先级 + LogLevel: asynq.LogLevel(g.Cfg().MustGet(context.Background(), "queue.asynq.logLevel").Int()), // 日志级别 DebugLevel 1, InfoLevel 2, WarnLevel 3, ErrorLevel 4, FatalLevel 5 + } + if w.ops.aggregator != nil { + conf.GroupAggregator = asynq.GroupAggregatorFunc(aggregate) + conf.GroupGracePeriod = time.Duration(w.ops.aggregator.GroupGracePeriod) * time.Second + conf.GroupMaxDelay = time.Duration(w.ops.aggregator.GroupMaxDelay) * time.Second + conf.GroupMaxSize = w.ops.aggregator.GroupMaxSize + g.Log().Infof(context.Background(), "server/internal/library/worker/worker.go New 聚合器配置 group %s, gracePeriod %d, maxDelay %d, maxSize %d", + w.ops.group, w.ops.aggregator.GroupGracePeriod, w.ops.aggregator.GroupMaxDelay, w.ops.aggregator.GroupMaxSize) + } + svr := asynq.NewServer(rs, conf) + h := &taskHandlerBase{w: w} + + mux := asynq.NewServeMux() + if w.ops.aggregator != nil { + mux.HandleFunc(w.ops.group+".aggregate", h.ProcessTask) + } else { + mux.HandleFunc(w.ops.group+".once", h.ProcessTask) + mux.HandleFunc(w.ops.group+".cron", h.ProcessTask) + } + + if err := svr.Start(mux); err != nil { + panic(err) + } + w.svr = svr + if w.ops.clearArchived > 0 { + go func() { + time.Sleep(time.Duration(w.ops.clearArchived) * time.Second) + w.clearArchived() + }() + } + g.Log().Debug(context.Background(), "server/internal/library/worker/worker.go New", "group", w.ops.group) + return w +} + +func (w *Worker) Once(options ...func(*TaskOptions)) (err error) { + ops := GetDefaultTaskOptions(nil) + for _, op := range options { + op(ops) + } + if ops.uid == "" { + err = errors.New("uid is nil") + return + } + t := asynq.NewTask(ops.group+".once", ops.payload, asynq.TaskID(ops.uid), asynq.Group(ops.group)) + taskOpts := []asynq.Option{ + asynq.Queue(w.ops.group), + asynq.MaxRetry(w.ops.maxRetry), + asynq.Timeout(time.Duration(ops.timeout) * time.Second), + } + if ops.maxRetry > 0 { + taskOpts = append(taskOpts, asynq.MaxRetry(ops.maxRetry)) + } + if ops.retention > 0 { + taskOpts = append(taskOpts, asynq.Retention(time.Duration(ops.retention)*time.Second)) + } else { + taskOpts = append(taskOpts, asynq.Retention(time.Duration(w.ops.timeout)*time.Second)) + } + if ops.in != nil { + taskOpts = append(taskOpts, asynq.ProcessIn(*ops.in)) + } else if ops.at != nil { + taskOpts = append(taskOpts, asynq.ProcessAt(*ops.at)) + } else if ops.now { + taskOpts = append(taskOpts, asynq.ProcessIn(time.Millisecond)) + } + _, err = w.client.Enqueue(t, taskOpts...) + if ops.replace && errors.Is(err, asynq.ErrTaskIDConflict) { + // 错误表示由于给定的任务ID已经存在,因此无法将该任务加入队列。这可能是因为任务已经存在,或者任务ID冲突。 + err = w.inspector.DeleteTask(w.ops.group, ops.uid) + if err != nil { + return + } + _, err = w.client.Enqueue(t, taskOpts...) + } + return +} + +// Cron 注册一个cron任务, 如果concurrent为0,则不限制并发,否则限制并发 +func (w *Worker) Cron(concurrent int, options ...func(*TaskOptions)) (entryID string, err error) { + ops := GetDefaultTaskOptions(nil) + for _, op := range options { + op(ops) + } + if ops.expr == "" { + err = errors.New("expr is nil") + return + } + if concurrent == 0 { + // 不限制并发, 不传递任务id,任务ID随机,可并发 + entryID, err = w.scheduler.Register(ops.expr, asynq.NewTask(ops.group+".cron", ops.payload), asynq.Queue(w.ops.group)) + } else { + // 限制并发, 传递任务id,任务ID固定,不可并发 + entryID, err = w.scheduler.Register(ops.expr, asynq.NewTask(ops.group+".cron", ops.payload, asynq.TaskID(ops.uid)), asynq.Queue(w.ops.group)) + } + if err != nil { + return + } + g.Log().Debug(context.Background(), "server/internal/library/worker/worker.go Cron", "group", w.ops.group, "entryID", entryID, "expr", ops.expr, "concurrent", concurrent) + return +} + +func (w *Worker) Remove(uid string) (err error) { + entries, err := w.inspector.SchedulerEntries() + if err != nil { + return + } + for _, entry := range entries { + payload := string(entry.Task.Payload()) + g.Log().Debug(context.Background(), "server/internal/library/worker/worker.go Remove", "group", w.ops.group, "entryID", entry.ID, "payload", payload) + if strings.Contains(string(entry.Task.Payload()), "\""+uid+"\"") { + g.Log().Debug(context.Background(), "strings.Contains(string(entry.Task.Payload()), uid) ") + err = w.scheduler.Unregister(entry.ID) + } + } + return +} + +func (w *Worker) GetTaskInfo(uid string) (task *asynq.TaskInfo, err error) { + task, err = w.inspector.GetTaskInfo(w.ops.group, uid) + if err != nil { + return + } + return task, nil +} + +func (w *Worker) RemoveCron(entryID string) (err error) { + err = w.scheduler.Unregister(entryID) + return +} + +// 获取带有默认超时的上下文 +func (w *Worker) getDefaultTimeoutCtx() context.Context { + c, _ := context.WithTimeout(context.Background(), time.Duration(w.ops.timeout)*time.Second) + return c +} + +// 清除已归档任务 +func (w *Worker) clearArchived() { + list, err := w.inspector.ListArchivedTasks(w.ops.group, asynq.Page(1), asynq.PageSize(100)) + if err != nil { + return + } + // ctx := w.getDefaultTimeoutCtx() + for _, item := range list { + last := carbon.CreateFromStdTime(item.LastFailedAt) + if !last.IsZero() && item.Retried < item.MaxRetry { + continue + } + uid := item.ID + var flag bool + if strings.HasSuffix(item.Type, ".cron") { + if carbon.Now().Gt(last.AddMinutes(5)) { + flag = true + } + } else { + if carbon.Now().Gt(last.AddMinutes(5)) { + flag = true + } + } + if flag { + err := w.inspector.DeleteTask(w.ops.group, uid) + if err != nil { + return + } + } + } +} + +type taskHandlerBase struct { + w *Worker +} + +func (h *taskHandlerBase) ProcessTask(ctx context.Context, task *asynq.Task) (err error) { + var isAggregate bool + if strings.Contains(task.Type(), ".aggregate") { + isAggregate = true + } + group := strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(task.Type(), ".aggregate"), ".once"), ".cron") + if h.w.ops.handler == nil { + g.Log().Errorf(ctx, "server/internal/library/worker/worker.go ProcessTask handler is nil, group: %s, uid: %s, payload: %s", group, task.ResultWriter().TaskID(), string(task.Payload())) + return errors.New("handler is nil") + } + err = h.w.ops.handler(ctx, Payload{ + IsAggregate: isAggregate, + Group: group, + Uid: task.ResultWriter().TaskID(), + Payload: task.Payload(), + }) + + return +} + +func (w *Worker) Stop() { + if w.scheduler != nil { + w.scheduler.Shutdown() + } + if w.client != nil { + w.client.Close() + } + if w.inspector != nil { + w.inspector.Close() + } + if w.svr != nil { + w.svr.Shutdown() + } +} diff --git a/server/internal/library/xgen/gen_consts/gen_codes.go b/server/internal/library/xgen/gen_consts/gen_codes.go new file mode 100644 index 0000000..f087eee --- /dev/null +++ b/server/internal/library/xgen/gen_consts/gen_codes.go @@ -0,0 +1,86 @@ +// package genconsts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genconsts + +// 生成类型值定义 +const ( + GenCodesTypeCurd = 0 + GenCodesTypeTree = 1 +) + +// 生成类型标签映射 +var GenCodesTypeNameMap = map[int]string{ + GenCodesTypeCurd: "增删改查列表", + GenCodesTypeTree: "关系树列表", +} + +// 生成类型配置映射 +var GenCodesTypeConfMap = map[int]string{ + GenCodesTypeCurd: "crud", + GenCodesTypeTree: "tree", +} + +// 生成代码状态 +const ( + GenCodesStatusOk = "0" // 生成成功 + GenCodesStatusWait = "1" // 未生成 + GenCodesStatusFail = "2" // 生成失败 +) + +var GenCodesStatusNameMap = map[string]string{ + GenCodesStatusOk: "生成成功", + GenCodesStatusWait: "未生成", + GenCodesStatusFail: "生成失败", +} + +// 生成代码关联表方式 +const ( + GenCodesJoinLeft = 1 // 左关联 + GenCodesJoinRight = 2 // 右关联 + GenCodesJoinInner = 3 // 内关联 +) + +var GenCodesJoinNameMap = map[int]string{ + GenCodesJoinLeft: "左关联", + GenCodesJoinRight: "右关联", + GenCodesJoinInner: "内关联", +} + +var GenCodesJoinLinkMap = map[int]string{ + GenCodesJoinLeft: "LeftJoin", + GenCodesJoinRight: "RightJoin", + GenCodesJoinInner: "InnerJoin", +} + +// 生成代码的生成方式 +const ( + GenCodesBuildMethCreate = 1 // 创建 + GenCodesBuildMethCover = 2 // 覆盖 + GenCodesBuildMethSkip = 3 // 跳过 + GenCodesBuildIgnore = 4 // 不生成 +) + +var GenCodesBuildMethNameMap = map[int]string{ + GenCodesBuildMethCreate: "创建文件", + GenCodesBuildMethCover: "强制覆盖", + GenCodesBuildMethSkip: "已存在跳过", + GenCodesBuildIgnore: "不生成", +} + +const ( + GenCodesIndexPK = "PRI" // 主键索引 + GenCodesIndexUNI = "UNI" // 唯一索引 +) + +const ( + GenCodesTreeStyleTypeNormal = 1 // 普通树表格 + GenCodesTreeStyleTypeOption = 2 // 选项式树表 +) + +var GenCodesTreeStyleTypeNameMap = map[int]string{ + GenCodesTreeStyleTypeNormal: "普通树表格", + GenCodesTreeStyleTypeOption: "选项式树表", +} diff --git a/server/internal/library/xgen/gen_consts/gen_config.go b/server/internal/library/xgen/gen_consts/gen_config.go new file mode 100644 index 0000000..7726642 --- /dev/null +++ b/server/internal/library/xgen/gen_consts/gen_config.go @@ -0,0 +1,87 @@ +// package genconsts +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genconsts + +import "github.com/gogf/gf/v2/util/gconv" + +// 配置数据类型 +const ( + ConfigTypeString = "string" + ConfigTypeInt = "int" + ConfigTypeInt8 = "int8" + ConfigTypeInt16 = "int16" + ConfigTypeInt32 = "int32" + ConfigTypeInt64 = "int64" + ConfigTypeUint = "uint" + ConfigTypeUint8 = "uint8" + ConfigTypeUint16 = "uint16" + ConfigTypeUint32 = "uint32" + ConfigTypeUint64 = "uint64" + ConfigTypeFloat32 = "float32" + ConfigTypeFloat64 = "float64" + ConfigTypeBool = "bool" + ConfigTypeDate = "date" + ConfigTypeDateTime = "datetime" + ConfigTypeSliceString = "[]string" + ConfigTypeSliceInt = "[]int" + ConfigTypeSliceInt64 = "[]int64" +) + +var ConfigTypes = []string{ConfigTypeString, + ConfigTypeInt, ConfigTypeInt8, ConfigTypeInt16, ConfigTypeInt32, ConfigTypeInt64, + ConfigTypeUint, ConfigTypeUint8, ConfigTypeUint16, ConfigTypeUint32, ConfigTypeUint64, + ConfigTypeFloat32, ConfigTypeFloat64, + ConfigTypeBool, + ConfigTypeDate, ConfigTypeDateTime, + ConfigTypeSliceString, ConfigTypeSliceInt, ConfigTypeSliceInt64, +} + +// ConvType 类型转换 +func ConvType(val interface{}, t string) interface{} { + switch t { + case ConfigTypeString: + val = gconv.String(val) + case ConfigTypeInt: + val = gconv.Int(val) + case ConfigTypeInt8: + val = gconv.Int8(val) + case ConfigTypeInt16: + val = gconv.Int16(val) + case ConfigTypeInt32: + val = gconv.Int32(val) + case ConfigTypeInt64: + val = gconv.Int64(val) + case ConfigTypeUint: + val = gconv.Uint(val) + case ConfigTypeUint8: + val = gconv.Uint8(val) + case ConfigTypeUint16: + val = gconv.Uint16(val) + case ConfigTypeUint32: + val = gconv.Uint32(val) + case ConfigTypeUint64: + val = gconv.Uint64(val) + case ConfigTypeFloat32: + val = gconv.Float32(val) + case ConfigTypeFloat64: + val = gconv.Float64(val) + case ConfigTypeBool: + val = gconv.Bool(val) + case ConfigTypeDate: + val = gconv.Time(val, "Y-m-d") + case ConfigTypeDateTime: + val = gconv.Time(val, "Y-m-d H:i:s") + case ConfigTypeSliceInt: + val = gconv.SliceInt(val) + case ConfigTypeSliceInt64: + val = gconv.SliceInt64(val) + case ConfigTypeSliceString: + val = gconv.SliceStr(val) + default: + val = gconv.String(val) + } + return val +} diff --git a/server/internal/library/xgen/gen_dao/gen_dao.go b/server/internal/library/xgen/gen_dao/gen_dao.go new file mode 100644 index 0000000..bc74176 --- /dev/null +++ b/server/internal/library/xgen/gen_dao/gen_dao.go @@ -0,0 +1,63 @@ +// package gendao +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gendao + +import ( + "context" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/util/gconv" +) + +var ( + daoConfigList = make([]*genmodel.GenDaoConfig, 0) + cliConfigPath = `hack/config.yaml` + cliConfig *gcfg.Config + defaultGenServiceConfig = genmodel.GenServiceConfig{ + SrcFolder: "internal/logic", + DstFolder: "internal/service", + DstFileNameCase: "Snake", + StPattern: `s([A-Z]\w+)`, + Clear: false, + } + serviceConfig = genmodel.GenServiceConfig{} +) + +func GetDaoConfig(ctx context.Context, group string) (output *genmodel.GenDaoConfig, err error) { + for _, v := range daoConfigList { + if v == nil { + continue + } + if v.Group == group { + output = v + return + } + } + return +} + +func Init(ctx context.Context) (err error) { + adapter, err := gcfg.NewAdapterFile(cliConfigPath) + if err != nil { + g.Log().Fatalf(ctx, "get cli configuration file:%v, err:%+v", cliConfigPath, err) + return + } + cliConfig = gcfg.NewWithAdapter(adapter) + + cliConfig.MustGet(ctx, "gfcli.gen.dao").Scan(&daoConfigList) + cliConfig.MustGet(ctx, "gfcli.gen.service").Scan(&serviceConfig) + + return +} + +func GetServiceConfig() *genmodel.GenServiceConfig { + conf := &genmodel.GenServiceConfig{} + _ = gconv.Scan(defaultGenServiceConfig, &conf) + _ = gconv.Scan(serviceConfig, &conf) + return conf +} diff --git a/server/internal/library/xgen/gen_model/gen_codes.go b/server/internal/library/xgen/gen_model/gen_codes.go new file mode 100644 index 0000000..ea600a9 --- /dev/null +++ b/server/internal/library/xgen/gen_model/gen_codes.go @@ -0,0 +1,146 @@ +// package genmodel +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genmodel + +import "github.com/gogf/gf/v2/encoding/gjson" + +type SelectItemModel struct { + Value interface{} `json:"value"` // 选择项值 + Label string `json:"label"` // 选择项标签 + Name string `json:"name"` // 选择项名称 + Disabled bool `json:"disabled"` // 是否禁用 +} + +// 生成类型选择项 +type SelectGenTypeModel struct { + SelectItemModel + Templates []*SelectGenTemplateModel `json:"templates"` // 选择项模板 +} + +// 生成模板选择项 +type SelectGenTemplateModel struct { + SelectItemModel + IsAddon bool `json:"isAddon"` // 是否为插件 +} + +type SelectsModel struct { + GenType []*SelectGenTypeModel `json:"genType"` // 生成类型 0:增删改查列表 1:关系树列表 + Db []*SelectItemModel `json:"db"` // 数据库选择项 + Status []*SelectItemModel `json:"status"` // 状态选择项 0:生成成功 1:未生产 2:生成失败 + LinkMode []*SelectItemModel `json:"linkMode"` // 链接模式选择项 1左关联 2右关联 3内关联 + BuildMethod []*SelectItemModel `json:"buildMethod"` // 构建标志选择项 1:创建文件 2强制覆盖 3已存在跳过 4不生成 + FormMode []*SelectItemModel `json:"formMode"` // 表单项类型选择项 + FormRole []*SelectItemModel `json:"formRole"` // 表单项校验规则选择项 + DictMode []*SelectItemModel `json:"dictMode"` // 字典模式选择项 + WhereMode []*SelectItemModel `json:"whereMode"` // 查询条件选择项 + Addons []*SelectItemModel `json:"addons"` // 插件选择项 + TableAlign []*SelectItemModel `json:"tableAlign"` // 表格对齐方式选择项 + TreeStyleType []*SelectItemModel `json:"treeStyleType"` // 树形结构选择项 +} + +// GenCodesColumn 生成表字段属性 +type GenCodesColumn struct { + // 表属性 + Id int64 `json:"id" dc:"序号"` + Name string `json:"name" dc:"字段列名"` + Dc string `json:"dc" dc:"字段描述"` + DataType string `json:"dataType" dc:"字段类型"` + SqlType string `json:"sqlType" dc:"物理类型"` + Length int64 `json:"length" dc:"字段长度"` + IsAllowNull string `json:"isAllowNull" dc:"是否允许为空"` + DefaultValue interface{} `json:"defaultValue" dc:"默认值"` + Index string `json:"index" dc:"索引"` + Extra string `json:"extra" dc:"额外选项"` + // 自定义生成属性 + // Alias string `json:"alias" dc:"字段别名"` + GoName string `json:"goName" dc:"Go属性"` + GoType string `json:"goType" dc:"Go类型"` + TsName string `json:"tsName" dc:"Ts属性"` + TsType string `json:"tsType" dc:"Ts类型"` + IsList bool `json:"isList" dc:"列表"` + IsExport bool `json:"isExport" dc:"导出"` + IsSort bool `json:"isSort" dc:"排序"` + IsQuery bool `json:"isQuery" dc:"查询"` + QueryWhere string `json:"queryWhere" dc:"查询条件"` + IsEdit bool `json:"isEdit" dc:"编辑"` + Required bool `json:"required" dc:"必填"` + Unique bool `json:"unique" dc:"唯一性"` + FormMode string `json:"formMode" dc:"表单组件"` + FormRole string `json:"formRole" dc:"表单验证"` + FormGridSpan int `json:"formGridSpan" dc:"栅格占位数量"` + DictType string `json:"dictType" dc:"字典类型ID"` + Align string `json:"align" dc:"排列方式"` + Width int64 `json:"width" dc:"列宽"` +} + +type GenCodesTableSelectParam struct { + DbGroup string `json:"dbGroup"` +} + +type GenCodesTableSelectModel struct { + Value string `json:"value"` + Label string `json:"label"` + Name string `json:"name"` + DaoName string `json:"daoName" dc:"orm模型名称"` + DefVarName string `json:"defVarName" dc:"默认实体名称"` + DefAlias string `json:"defAlias" dc:"默认关联表别名"` + DefTableComment string `json:"defTableComment" dc:"默认菜单名称"` +} + +type GenCodesColumnSelectParam struct { + DbGroup string `json:"dbGroup"` + TableName string `json:"tableName"` +} + +type GenCodesColumnSelectModel struct { + Value string `json:"value"` + Label string `json:"label"` + Name string `json:"name"` +} + +type GenCodesColumnListParam struct { + DbGroup string `json:"dbGroup" dc:"数据库配置名称"` + TableName string `json:"tableName" dc:"表名称"` + IsLink int64 `json:"isLink" dc:"是否是关联表"` + Alias string `json:"alias" dc:"关联表别名"` +} + +type GenCodesColumnListModel struct { + GenCodesColumn +} + +type GenCodesPreviewParam struct { + TableId int64 `json:"tableId" orm:"table_id" description:"生成ID"` + GenType uint `json:"genType" orm:"gen_type" description:"生成类型"` + GenTemplate int `json:"genTemplate" orm:"gen_template" description:"生成模板"` + VarName string `json:"varName" orm:"var_name" description:"实体命名"` + Options *gjson.Json `json:"options" orm:"options" description:"配置选项"` + DbName string `json:"dbName" orm:"db_name" description:"数据库名称"` + TableName string `json:"tableName" orm:"table_name" description:"主表名称"` + TableComment string `json:"tableComment" orm:"table_comment" description:"主表注释"` + DaoName string `json:"daoName" orm:"dao_name" description:"主表dao模型"` + MasterColumns *gjson.Json `json:"masterColumns" orm:"master_columns" description:"主表字段"` + AddonName string `json:"addonName" orm:"addon_name" description:"插件名称"` + Status int `json:"status" orm:"status" description:"生成状态"` +} + +// GenFile 生成文件配置 +type GenFile struct { + Content string `json:"content" dc:"页面内容"` + Path string `json:"path" dc:"生成路径"` + Meth int `json:"meth" dc:"生成方式"` + Required bool `json:"required" dc:"是否是必要构建文件"` +} + +type GenCodesPreviewModel struct { + Config *GenCodesConfig `json:"config"` + Views map[string]*GenFile `json:"views" dc:"页面"` +} + +type GenCodesBuildParam = GenCodesPreviewParam + +type GenCodesBuildModel struct { +} diff --git a/server/internal/library/xgen/gen_model/gen_config.go b/server/internal/library/xgen/gen_model/gen_config.go new file mode 100644 index 0000000..3ac87ad --- /dev/null +++ b/server/internal/library/xgen/gen_model/gen_config.go @@ -0,0 +1,126 @@ +// package genmodel +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genmodel + +import ( + genconsts "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_consts" + + "github.com/gogf/gf/v2/util/gconv" +) + +// 模板配置 config/config.yaml xgen.application.crud.templates +type GenCodesConfigCrudTemplate struct { + Group string `name:"group" json:"group"` + IsAddon bool `name:"isAddon" json:"isAddon"` + MasterPackage string `name:"masterPackage" json:"masterPackage"` + TemplatePath string `name:"templatePath" json:"templatePath"` + ApiPath string `name:"apiPath" json:"apiPath"` + InputPath string `name:"inputPath" json:"inputPath"` + ControllerPath string `name:"controllerPath" json:"controllerPath"` + LogicPath string `name:"logicPath" json:"logicPath"` + RouterPath string `name:"routerPath" json:"routerPath"` + SqlPath string `name:"sqlPath" json:"sqlPath"` + WebApiPath string `name:"webApiPath" json:"webApiPath"` + WebViewsPath string `name:"webViewsPath" json:"webViewsPath"` +} +type GenCodesConfigTreeTemplate struct { + Group string `json:"group"` + TemplatePath string `json:"templatePath"` +} + +type GenCodesConfigBuildAddon struct { + SrcPath string `json:"srcPath"` + WebApiPath string `json:"webApiPath"` + WebViewsPath string `json:"webViewsPath"` +} + +// 工具生成配置 hack/config.yaml gfcli.gen.dao +type GenDaoConfig struct { + Group string `name:"group" json:"group"` + Link string `name:"link" json:"link"` + DbName string `name:"dbName" json:"dbName"` + TableName string `name:"tableName" json:"tableName"` + JsonCase string `name:"jsonCase" json:"jsonCase"` + StdTime bool `name:"stdTime" json:"stdTime"` + GJsonSupport bool `name:"gJsonSupport" json:"gJsonSupport"` +} + +// 工具生成配置 hack/config.yaml gfcli.gen.service +type GenServiceConfig struct { + SrcFolder string `name:"srcFolder"` + DstFolder string `name:"dstFolder"` + DstFileNameCase string `name:"dstFileNameCase"` + WatchFile string `name:"watchFile" ` + StPattern string `name:"stPattern" ` + Packages []string `name:"packages" ` + ImportPrefix string `name:"importPrefix" ` + Clear bool `name:"clear" ` +} + +// 模板配置 config/config.yaml xgen +type GenCodesConfig struct { + AllowedIPs []string `json:"allowedIPs"` + Application struct { + Crud struct { + Templates []*GenCodesConfigCrudTemplate `json:"templates"` + } `json:"crud"` + Tree struct { + Templates []*GenCodesConfigTreeTemplate `json:"templates"` + } `json:"tree"` + } `json:"application"` + Delimiters []string `json:"delimiters"` + DevPath string `json:"devPath"` + DisableTables []string `json:"disableTables"` + SelectDbs []string `json:"selectDbs"` + Addon *GenCodesConfigBuildAddon `json:"addon"` +} + +// ConvType 类型转换 +func ConvType(val interface{}, t string) interface{} { + switch t { + case genconsts.ConfigTypeString: + val = gconv.String(val) + case genconsts.ConfigTypeInt: + val = gconv.Int(val) + case genconsts.ConfigTypeInt8: + val = gconv.Int8(val) + case genconsts.ConfigTypeInt16: + val = gconv.Int16(val) + case genconsts.ConfigTypeInt32: + val = gconv.Int32(val) + case genconsts.ConfigTypeInt64: + val = gconv.Int64(val) + case genconsts.ConfigTypeUint: + val = gconv.Uint(val) + case genconsts.ConfigTypeUint8: + val = gconv.Uint8(val) + case genconsts.ConfigTypeUint16: + val = gconv.Uint16(val) + case genconsts.ConfigTypeUint32: + val = gconv.Uint32(val) + case genconsts.ConfigTypeUint64: + val = gconv.Uint64(val) + case genconsts.ConfigTypeFloat32: + val = gconv.Float32(val) + case genconsts.ConfigTypeFloat64: + val = gconv.Float64(val) + case genconsts.ConfigTypeBool: + val = gconv.Bool(val) + case genconsts.ConfigTypeDate: + val = gconv.Time(val, "Y-m-d") + case genconsts.ConfigTypeDateTime: + val = gconv.Time(val, "Y-m-d H:i:s") + case genconsts.ConfigTypeSliceInt: + val = gconv.SliceInt(val) + case genconsts.ConfigTypeSliceInt64: + val = gconv.SliceInt64(val) + case genconsts.ConfigTypeSliceString: + val = gconv.SliceStr(val) + default: + val = gconv.String(val) + } + return val +} diff --git a/server/internal/library/xgen/gen_model/gen_view.go b/server/internal/library/xgen/gen_model/gen_view.go new file mode 100644 index 0000000..896e40f --- /dev/null +++ b/server/internal/library/xgen/gen_model/gen_view.go @@ -0,0 +1,138 @@ +// package genmodel +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genmodel + +import ( + "context" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gview" +) + +// ImportModel 导包 - model.ts +type ImportModel struct { + NaiveUI []string + UtilsIs []string + UtilsUrl []string + UtilsDate []string + UtilsValidate []string + UtilsIndex []string +} + +// CurdStep 生成选项 +type CurdStep struct { + HasMaxSort bool // 最大排序 + HasAdd bool // 表单添加 + HasBatchDel bool // 批量删除 + HasExport bool // 表格导出 + HasNotFilterAuth bool // 不过滤认证权限 + HasEdit bool // 表单编辑 + HasDel bool // 删除 + HasView bool // 查看详情 + HasStatus bool // 修改状态 + HasSwitch bool // 数值开关 + HasCheck bool // 勾选列 + HasMenu bool // 菜单权限 + IsTreeTable bool // 树型列表 + IsOptionTreeTable bool // 选项式树型列表 + HasRules bool // 表单验证规则 + HasRulesValidator bool // 表单验证器 + HasSearchForm bool // 列表搜索 + HasDict bool // 字典 + HasFuncDict bool // 注册方法字典 + HasQueryMemberSummary bool // 查询用户摘要 + HasHookMemberSummary bool // hook用户摘要 + ImportModel ImportModel // 公用导包 - model.ts + ActionColumnWidth int64 // 列表操作栏宽度 + IsAddon bool // 是否是插件 + IsEditModal bool // 新增修改模态框模式 +} + +type FuncDict struct { + ValueColumn string // 选项值 + LabelColumn string // 选项名称 + Value *GenCodesColumnListModel + Label *GenCodesColumnListModel +} + +// PresetStep 预设生成流程参数 +type PresetStep struct { + FormGridCols int `json:"formGridCols" dc:"表单显示的栅格数量"` +} + +// OptionsTree 树形结构选项 +type OptionsTree struct { + TitleColumn string `json:"titleColumn"` + StyleType int `json:"styleType"` + TitleField *GenCodesColumnListModel +} + +// CurdOptionsMenu 菜单选项 +type CurdOptionsMenu struct { + Icon string `json:"icon"` + Pid int `json:"pid"` + Sort int `json:"sort"` +} + +// CurdOptionsJoin 关联表选项 +type CurdOptionsJoin struct { + Uuid string `json:"uuid"` + LinkTable string `json:"linkTable"` + Alias string `json:"alias"` + LinkMode int `json:"linkMode"` + Field string `json:"field"` + MasterField string `json:"masterField"` + DaoName string `json:"daoName"` + Columns []*GenCodesColumnListModel `json:"columns"` +} + +type OptionsSchemasField struct { + Field string + Type string +} + +type CurdOptionsDict struct { + Has bool + Types []string + Schemas []*OptionsSchemasField +} + +// CurdOptions 生成选项 +type CurdOptions struct { + AutoOps []string `json:"autoOps"` + ColumnOps []string `json:"columnOps"` + HeadOps []string `json:"headOps"` + Join []*CurdOptionsJoin `json:"join"` + Menu *CurdOptionsMenu `json:"menu"` + Tree *OptionsTree `json:"tree"` + TemplateGroup string `json:"templateGroup"` + ApiPrefix string `json:"apiPrefix"` + ImportWebApi string `json:"importWebApi"` + FuncDict *FuncDict `json:"funcDict"` + PresetStep *PresetStep `json:"presetStep"` + Step *CurdStep // 转换后的流程控制条件 + DictOps CurdOptionsDict // 字典选项 + DictMap g.Map // 字典选项 -> 字段映射关系 +} + +type CurdPreviewParam struct { + In *GenCodesPreviewParam // 提交参数 + DaoConfig *GenDaoConfig // 生成dao配置 + Config *GenCodesConfig // 生成配置 + View *gview.View // 视图模板 + Content *GenCodesPreviewModel // 页面代码 + MasterFields []*GenCodesColumnListModel // 主表字段属性 + Pk *GenCodesColumnListModel // 主键属性 + Options *CurdOptions // 生成选项 +} + +type CurdBuildEvent map[string]func(ctx context.Context) (err error) + +type CurdBuildParam struct { + PreviewIn *CurdPreviewParam // 预览参数 + BeforeEvent CurdBuildEvent // 前置事件 + AfterEvent CurdBuildEvent // 后置事件 +} diff --git a/server/internal/library/xgen/gen_view/gen_column.go b/server/internal/library/xgen/gen_view/gen_column.go new file mode 100644 index 0000000..ea88987 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_column.go @@ -0,0 +1,253 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "context" + gendao "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_dao" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + "strings" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/text/gregex" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" +) + +func getJsonTagFromCase(str, caseStr string) string { + switch gstr.ToLower(caseStr) { + case gstr.ToLower("Camel"): + return gstr.CaseCamel(str) + + case gstr.ToLower("CamelLower"): + return gstr.CaseCamelLower(str) + + case gstr.ToLower("Kebab"): + return gstr.CaseKebab(str) + + case gstr.ToLower("KebabScreaming"): + return gstr.CaseKebabScreaming(str) + + case gstr.ToLower("Snake"): + return gstr.CaseSnake(str) + + case gstr.ToLower("SnakeFirstUpper"): + return gstr.CaseSnakeFirstUpper(str) + + case gstr.ToLower("SnakeScreaming"): + return gstr.CaseSnakeScreaming(str) + } + return str +} + +func CheckLocalTypeForField(ctx context.Context, fieldType string, fieldValue interface{}) (string, error) { + var ( + typeName string + typePattern string + ) + match, _ := gregex.MatchString(`(.+?)\((.+)\)`, fieldType) + if len(match) == 3 { + typeName = gstr.Trim(match[1]) + typePattern = gstr.Trim(match[2]) + } else { + typeName = gstr.Split(fieldType, " ")[0] + } + typeName = strings.ToLower(typeName) + switch typeName { + case + "binary", + "varbinary", + "blob", + "tinyblob", + "mediumblob", + "longblob": + return string(gdb.LocalTypeBytes), nil + + case + "int", + "tinyint", + "small_int", + "smallint", + "medium_int", + "mediumint", + "serial": + if gstr.ContainsI(fieldType, "unsigned") { + return string(gdb.LocalTypeUint), nil + } + return string(gdb.LocalTypeInt), nil + + case + "big_int", + "bigint", + "bigserial": + if gstr.ContainsI(fieldType, "unsigned") { + return string(gdb.LocalTypeUint64), nil + } + return string(gdb.LocalTypeInt64), nil + + case + "real": + return string(gdb.LocalTypeFloat32), nil + + case + "float", + "double", + "decimal", + "money", + "numeric", + "smallmoney": + return string(gdb.LocalTypeFloat64), nil + + case + "bit": + // It is suggested using bit(1) as boolean. + if typePattern == "1" { + return string(gdb.LocalTypeBool), nil + } + s := gconv.String(fieldValue) + // mssql is true|false string. + if strings.EqualFold(s, "true") || strings.EqualFold(s, "false") { + return string(gdb.LocalTypeBool), nil + } + if gstr.ContainsI(fieldType, "unsigned") { + return string(gdb.LocalTypeUint64Bytes), nil + } + return string(gdb.LocalTypeInt64Bytes), nil + + case + "bool": + return string(gdb.LocalTypeBool), nil + + case + "date": + return string(gdb.LocalTypeDate), nil + + case + "datetime", + "timestamp", + "timestamptz": + return string(gdb.LocalTypeDatetime), nil + + case + "json": + return string(gdb.LocalTypeJson), nil + + case + "jsonb": + return string(gdb.LocalTypeJsonb), nil + + default: + // Auto-detect field type, using key match. + switch { + case strings.Contains(typeName, "text") || strings.Contains(typeName, "char") || strings.Contains(typeName, "character"): + return string(gdb.LocalTypeString), nil + + case strings.Contains(typeName, "float") || strings.Contains(typeName, "double") || strings.Contains(typeName, "numeric"): + return string(gdb.LocalTypeFloat64), nil + + case strings.Contains(typeName, "bool"): + return string(gdb.LocalTypeBool), nil + + case strings.Contains(typeName, "binary") || strings.Contains(typeName, "blob"): + return string(gdb.LocalTypeBytes), nil + + case strings.Contains(typeName, "int"): + if gstr.ContainsI(fieldType, "unsigned") { + return string(gdb.LocalTypeUint), nil + } + return string(gdb.LocalTypeInt), nil + + case strings.Contains(typeName, "time"): + return string(gdb.LocalTypeDatetime), nil + + case strings.Contains(typeName, "date"): + return string(gdb.LocalTypeDatetime), nil + + default: + return string(gdb.LocalTypeString), nil + } + } +} + +// GenGotype 生成字段的go类型 +func GenGotype(ctx context.Context, field *genmodel.GenCodesColumnListModel, in *genmodel.GenDaoConfig) (goName, typeName, tsName string, tsType string) { + var err error + tsName = getJsonTagFromCase(field.Name, in.JsonCase) + goName = gstr.CaseCamel(field.Name) + + typeName, err = CheckLocalTypeForField(ctx, field.DataType, nil) + if err != nil { + panic(err) + } + + switch gdb.LocalType(typeName) { + case gdb.LocalTypeDate, gdb.LocalTypeDatetime: + if in.StdTime { + typeName = "time.Time" + } else { + typeName = "*gtime.Time" + } + + case gdb.LocalTypeInt64Bytes: + typeName = "int64" + + case gdb.LocalTypeUint64Bytes: + typeName = "uint64" + + // Special type handle. + case gdb.LocalTypeJson, gdb.LocalTypeJsonb: + if in.GJsonSupport { + typeName = "*gjson.Json" + } else { + typeName = "string" + } + } + + tsType = ShiftMap[typeName] + return +} + +func CustomLinkAttributes(ctx context.Context, alias string, field *genmodel.GenCodesColumnListModel, in *genmodel.GenDaoConfig) { + field.GoName, field.GoType, field.TsName, field.TsType = GenGotype(ctx, field, in) + + field.GoName = gstr.UcFirst(alias + field.GoName) + field.TsName = gstr.LcFirst(field.GoName) + + setDefaultQueryWhere(field) + setDefaultValue(field) +} + +func CustomAttributes(ctx context.Context, field *genmodel.GenCodesColumnListModel, in *genmodel.GenDaoConfig) { + field.GoName, field.GoType, field.TsName, field.TsType = GenGotype(ctx, field, in) + setDefault(field) +} + +func TableColumnList(ctx context.Context, params *genmodel.GenCodesColumnListParam) (output []*genmodel.GenCodesColumnListModel, err error) { + sql := "select ORDINAL_POSITION as `id`, COLUMN_NAME as `name`, COLUMN_COMMENT as `dc`, DATA_TYPE as `dataType`, COLUMN_TYPE as `sqlType`, CHARACTER_MAXIMUM_LENGTH as `length`, IS_NULLABLE as `isAllowNull`, COLUMN_DEFAULT as `defaultValue`, COLUMN_KEY as `index`, EXTRA as `extra` from information_schema.COLUMNS where TABLE_SCHEMA = ? and TABLE_NAME = ? ORDER BY `id` ASC" + dbConfig := g.DB(params.DbGroup).GetConfig() + daoConfig, err := gendao.GetDaoConfig(ctx, params.DbGroup) + if err != nil { + return + } + + output = make([]*genmodel.GenCodesColumnListModel, 0) + err = g.DB(params.DbGroup).Ctx(ctx).Raw(sql, dbConfig.Name, params.TableName).Scan(&output) + if err != nil { + return + } + if len(output) == 0 { + return + } + for _, v := range output { + if params.IsLink == 1 { + CustomLinkAttributes(ctx, params.Alias, v, daoConfig) + } else { + CustomAttributes(ctx, v, daoConfig) + } + } + return +} diff --git a/server/internal/library/xgen/gen_view/gen_column_default.go b/server/internal/library/xgen/gen_view/gen_column_default.go new file mode 100644 index 0000000..b6ba55e --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_column_default.go @@ -0,0 +1,341 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + genconsts "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_consts" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/text/gstr" +) + +// 默认表单组件映射 Ts -> 表单组件 +var defaultFormModeMap = map[string]string{ + TsTypeString: FMInput, + TsTypeNumber: FMInputNumber, + TsTypeBoolean: FMInputNumber, + TsTypeArray: FMInputDynamic, + TsTypeTuple: FMInputDynamic, + TsTypeAny: FMInput, +} + +var defaultEditFields = map[string]bool{ + "id": false, + "created_dept": false, + "created_by": false, + "created_at": false, + "updated_by": false, + "updated_at": false, + "deleted_by": false, + "deleted_at": false, +} + +var defaultEditSwitch = map[string]bool{ + "id": false, + "level": false, + "tree": false, + "created_by": false, + "updated_by": false, + "created_dept": false, + "created_at": false, + "updated_at": false, + "deleted_at": false, +} + +var defaultListSwitch = map[string]bool{ + "level": false, + "tree": false, + "deleted_at": false, +} + +var defaultExportSwitch = map[string]bool{ + "level": false, + "tree": false, + "deleted_at": false, +} + +var defaultQuerySwitch = map[string]bool{ + "level": false, + "tree": false, + "deleted_at": false, +} + +var defaultSort = map[string]bool{ + "id": true, + "sort": true, +} + +var defaultTreeFields = []string{"pid", "level", "tree"} + +// 默认表单验证映射 物理类型命名识别 +var defaultFormRoleMap = map[string]string{ + "mobile": FRPhone, + "qq": FRQq, + "email": FREmail, + "id_card": FRIdCard, + "bank_card": FRBankCard, + "password": FRPassword, + "pass": FRPassword, + "price": FRAmount, +} + +// 默认查询条件映射 go类型识别 +var defaultWhereModeMap = map[string]string{ + GoTypeString: WMLike, + GoTypeDate: WMEq, + GoTypeDatetime: WMEq, + GoTypeInt: WMEq, + GoTypeUint: WMEq, + GoTypeInt64: WMEq, + GoTypeUint64: WMEq, + GoTypeIntSlice: WMIn, + GoTypeInt64Slice: WMIn, + GoTypeUint64Slice: WMIn, + GoTypeFloat32: WMEq, + GoTypeFloat64: WMEq, + GoTypeBytes: WMEq, + GoTypeTime: WMEq, + GoTypeGTime: WMEq, + GoTypeJson: WMJsonContains, +} + +// IsIndexPK 是否是主键 +func IsIndexPK(index string) bool { + return gstr.ToUpper(index) == gstr.ToUpper(genconsts.GenCodesIndexPK) +} + +// IsIndexUNI 是否是唯一索引 +func IsIndexUNI(index string) bool { + return gstr.ToUpper(index) == gstr.ToUpper(genconsts.GenCodesIndexUNI) +} + +// setDefault 设置默认属性 +func setDefault(field *genmodel.GenCodesColumnListModel) { + setDefaultEdit(field) + + setDefaultFormMode(field) + + setDefaultFormRole(field) + + setDefaultDictType(field) + + setDefaultList(field) + + setDefaultExport(field) + + setDefaultQuery(field) + + setDefaultQueryWhere(field) + + setDefaultValue(field) + + if field.IsAllowNull == "NO" { + field.Required = true + } + + if IsIndexUNI(field.Index) { + field.Unique = true + } + + if df, ok := defaultSort[field.Name]; ok { + field.IsSort = df + } + + if field.Dc == "" { + field.Dc = field.Name + } +} + +// setDefaultEdit 设置默认编辑 +func setDefaultEdit(field *genmodel.GenCodesColumnListModel) { + field.IsEdit = true + + if IsIndexPK(field.Index) { + field.IsEdit = false + return + } + + if df, ok := defaultEditFields[field.Name]; ok { + field.IsEdit = df + } + + if df, ok := defaultEditSwitch[field.Name]; ok { + field.IsEdit = df + } +} + +// setDefaultFormMode 设置默认表单组件 +func setDefaultFormMode(field *genmodel.GenCodesColumnListModel) { + field.FormMode = FMInput + if df, ok := defaultFormModeMap[field.TsType]; ok { + field.FormMode = df + } + + if gstr.HasSuffix(field.GoName, "Status") && IsNumberType(field.GoType) { + field.FormMode = FMSelect + return + } + + if field.GoName == "CreatedAt" { + field.FormMode = FMDateRange + return + } + + if (field.GoName == "ProvinceId" || field.GoName == "CityId") && IsNumberType(field.GoType) { + field.FormMode = FMCitySelector + return + } + + if field.DataType == "datetime" || field.DataType == "timestamp" || field.DataType == "timestamptz" { + field.FormMode = FMTime + return + } + + if field.DataType == "date" { + field.FormMode = FMDate + return + } + + if field.GoType == GoTypeString && field.Length >= 256 && field.Length <= 512 { + field.FormMode = FMInputTextarea + return + } + + if field.GoType == GoTypeString && field.Length > 512 { + field.FormMode = FMInputEditor + return + } +} + +// setDefaultFormRole 设置默认表单验证 +func setDefaultFormRole(field *genmodel.GenCodesColumnListModel) { + field.FormRole = FRNone + + switch field.GoType { + case GoTypeUint, GoTypeUint64: + field.FormRole = FRNum + return + } + + if df, ok := defaultFormRoleMap[field.Name]; ok { + field.FormRole = df + } +} + +// setDefaultDictType 设置默认字典类型 +func setDefaultDictType(field *genmodel.GenCodesColumnListModel) { + if gstr.HasSuffix(field.GoName, "Status") && IsNumberType(field.GoType) { + field.DictType = "sys_common_status" // 默认系统状态ID + return + } +} + +// setDefaultList 设置默认列表 +func setDefaultList(field *genmodel.GenCodesColumnListModel) { + field.IsList = true + switch field.GoType { + case GoTypeIntSlice, GoTypeInt64Slice, GoTypeUint64Slice, GoTypeBytes, GoTypeJson: + field.IsList = false + return + } + + if field.Length >= 500 { + field.IsList = false + return + } + + if df, ok := defaultListSwitch[field.Name]; ok { + field.IsList = df + } +} + +// setDefaultExport 设置默认导出 +func setDefaultExport(field *genmodel.GenCodesColumnListModel) { + field.IsExport = true + switch field.GoType { + case GoTypeIntSlice, GoTypeInt64Slice, GoTypeUint64Slice, GoTypeBytes, GoTypeJson: + field.IsExport = false + return + } + + if field.Length >= 500 { + field.IsExport = false + return + } + + if df, ok := defaultExportSwitch[field.Name]; ok { + field.IsExport = df + } +} + +// setDefaultQuery 设置默认查询 +func setDefaultQuery(field *genmodel.GenCodesColumnListModel) { + field.IsQuery = false + + if IsIndexPK(field.Index) { + field.IsQuery = true + return + } + + if gstr.HasSuffix(field.GoName, "Status") && IsNumberType(field.GoType) { + field.IsQuery = true + return + } + + if field.GoName == "CreatedAt" { + field.IsQuery = true + return + } + + if df, ok := defaultQuerySwitch[field.Name]; ok { + field.IsQuery = df + } +} + +// setDefaultQueryWhere 设置默认查询条件 +func setDefaultQueryWhere(field *genmodel.GenCodesColumnListModel) { + field.QueryWhere = WMEq + + if field.GoName == "CreatedAt" { + field.QueryWhere = WMBetween + return + } + + if field.Length >= 500 { + field.QueryWhere = WMLikeAll + return + } + + if df, ok := defaultWhereModeMap[field.GoType]; ok { + field.QueryWhere = df + } +} + +// setDefaultValue 设置默认value +func setDefaultValue(field *genmodel.GenCodesColumnListModel) { + var value interface{} + if field.DefaultValue == nil { + switch field.GoType { + case GoTypeString, GoTypeBytes, GoTypeDate, GoTypeDatetime, GoTypeTime, GoTypeGTime: + value = "" + case GoTypeIntSlice, GoTypeInt64Slice, GoTypeUint64Slice, GoTypeJson: + value = nil + case GoTypeInt, GoTypeUint, GoTypeInt64, GoTypeUint64: + value = 0 + case GoTypeBool: + value = false + } + } else { + value = genconsts.ConvType(field.DefaultValue, field.GoType) + } + + // 时间类型不做默认值处理 + if field.GoType == GoTypeGTime { + value = "" + } + + field.DefaultValue = value +} diff --git a/server/internal/library/xgen/gen_view/gen_column_map.go b/server/internal/library/xgen/gen_view/gen_column_map.go new file mode 100644 index 0000000..a82bee6 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_column_map.go @@ -0,0 +1,339 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/text/gstr" +) + +// 表单组件 +const ( + FMInput = "Input" // 文本输入 + FMInputNumber = "InputNumber" // 数字输入 + FMInputTextarea = "InputTextarea" // 文本域 + FMInputEditor = "InputEditor" // 富文本 + FMInputDynamic = "InputDynamic" // 动态键值对 + FMDate = "Date" // 日期选择(Y-M-D) + FMDateRange = "DateRange" // 日期范围选择 + FMTime = "Time" // 时间选择(Y-M-D H:i:s) + FMTimeRange = "TimeRange" // 时间范围选择 + FMRadio = "Radio" // 单选按钮 + FMCheckbox = "Checkbox" // 复选按钮 + FMSelect = "Select" // 单选下拉框 + FMSelectMultiple = "SelectMultiple" // 多选下拉框 + FMTreeSelect = "TreeSelect" // 树型选择 + FMCascader = "Cascader" // 级联选择 + FMUploadImage = "UploadImage" // 单图上传 + FMUploadImages = "UploadImages" // 多图上传 + FMUploadFile = "UploadFile" // 单文件上传 + FMUploadFiles = "UploadFiles" // 多文件上传 + FMSwitch = "Switch" // 开关 + FMRate = "Rate" // 评分 + FMCitySelector = "CitySelector" // 省市区选择 + FMPidTreeSelect = "PidTreeSelect" // 树型上级选择,树表生成专用 +) + +var FMs = []string{ + FMInput, FMInputNumber, FMInputTextarea, FMInputEditor, FMInputDynamic, + FMDate, FMDateRange, FMTime, FMTimeRange, + FMRadio, FMCheckbox, FMSelect, FMSelectMultiple, FMTreeSelect, FMCascader, + FMUploadImage, FMUploadImages, FMUploadFile, FMUploadFiles, + FMSwitch, + FMRate, + FMCitySelector, +} + +var FMMap = map[string]string{ + FMInput: "文本输入", + FMInputNumber: "数字输入", + FMInputTextarea: "文本域", + FMInputEditor: "富文本", + FMInputDynamic: "动态键值对", + FMDate: "日期选择(Y-M-D)", + FMDateRange: "日期范围选择", + FMTime: "时间选择(Y-M-D H:i:s)", + FMTimeRange: "时间范围选择", + FMRadio: "单选按钮", + FMCheckbox: "复选按钮", + FMSelect: "单选下拉框", + FMSelectMultiple: "多选下拉框", + FMTreeSelect: "树型选择", + FMCascader: "级联选择", + FMUploadImage: "单图上传", + FMUploadImages: "多图上传", + FMUploadFile: "单文件上传", + FMUploadFiles: "多文件上传", + FMSwitch: "开关", + FMRate: "评分", + FMCitySelector: "省市区选择", +} + +// 表单验证 +const ( + FRNone = "none" + FRIp = "ip" + FRPercentage = "percentage" + FRTel = "tel" + FRPhone = "phone" + FRQq = "qq" + FREmail = "email" + FRIdCard = "idCard" + FRNum = "num" + FRBankCard = "bankCard" + FRWeibo = "weibo" + FRUserName = "userName" + FRAccount = "account" + FRPassword = "password" + FRAmount = "amount" +) + +var FRMap = map[string]string{ + FRNone: "不验证", + FRIp: "Ipv4或Ipv6", + FRPercentage: "0-100百分比", + FRTel: "固话格式", + FRPhone: "手机号", + FRQq: "QQ号码", + FREmail: "邮箱", + FRIdCard: "身份证", + FRNum: "非零正整数", + FRBankCard: "银行卡", + FRWeibo: "微博号", + FRUserName: "用户名", + FRAccount: "账号", + FRPassword: "密码", + FRAmount: "金额", +} + +// 查询条件 +const ( + WMEq = "=" // = + WMNeq = "!=" // != + WMGt = ">" // > + WMGte = ">=" // >= + WMLt = "<" // < + WMLte = "<=" // <= + WMIn = "IN" // IN (...) + WMNotIn = "NOT IN" // NOT IN (...) + WMBetween = "BETWEEN" // BETWEEN + WMNotBetween = "NOT BETWEEN" // NOT BETWEEN + WMLike = "LIKE" // LIKE + WMLikeAll = "LIKE %...%" // LIKE %...% + WMNotLike = "NOT LIKE" // NOT LIKE + WMJsonContains = "JSON_CONTAINS(doc, val)" // JSON_CONTAINS(json_doc, val[, path]) // 判断是否包含某个json值 +) + +var WMs = []string{WMEq, + WMNeq, WMGt, WMGte, WMLt, WMLte, + WMIn, WMNotIn, + WMBetween, WMNotBetween, + WMLike, WMLikeAll, WMNotLike, + WMJsonContains, +} + +// 表格列的排序方式 +const ( + TableAlignLeft = "left" + TableAlignRight = "right" + TableAlignCenter = "center" +) + +var TableAligns = []string{TableAlignLeft, TableAlignRight, TableAlignCenter} + +var TableAlignMap = map[string]string{ + TableAlignLeft: "居左", + TableAlignRight: "居右", + TableAlignCenter: "居中", +} + +// 是否是数字类型 +func IsNumberType(goType string) bool { + switch goType { + case GoTypeInt, GoTypeUint, GoTypeInt64, GoTypeUint64: + return true + case GoTypeFloat32, GoTypeFloat64: + return true + } + return false +} + +// IsSelectFormModel 是否是选择器组件 +func IsSelectFormModel(FM string) bool { + switch FM { + case FMRadio, FMCheckbox, FMSelect, FMSelectMultiple, FMCitySelector, FMTreeSelect, FMCascader: + return true + } + return false +} + +// 字段映射关系 + +// go类型 +const ( + GoTypeString = "string" + GoTypeDate = "date" + GoTypeDatetime = "datetime" + GoTypeInt = "int" + GoTypeUint = "uint" + GoTypeInt64 = "int64" + GoTypeUint64 = "uint64" + GoTypeIntSlice = "[]int" + GoTypeInt64Slice = "[]int64" + GoTypeUint64Slice = "[]uint64" + GoTypeFloat32 = "float32" + GoTypeFloat64 = "float64" + GoTypeBytes = "[]byte" + GoTypeBool = "bool" + GoTypeTime = "time.Time" + GoTypeGTime = "*gtime.Time" + GoTypeJson = "*gjson.Json" +) + +var GoTypeNameMap = map[string]string{ + GoTypeString: GoTypeString, + GoTypeDate: GoTypeDate, + GoTypeDatetime: GoTypeDatetime, + GoTypeInt: GoTypeInt, + GoTypeUint: GoTypeUint, + GoTypeInt64: GoTypeInt64, + GoTypeUint64: GoTypeUint64, + GoTypeIntSlice: GoTypeIntSlice, + GoTypeInt64Slice: GoTypeInt64Slice, + GoTypeUint64Slice: GoTypeUint64Slice, + GoTypeFloat32: GoTypeFloat32, + GoTypeFloat64: GoTypeFloat64, + GoTypeBytes: GoTypeBytes, + GoTypeBool: GoTypeBool, + GoTypeTime: GoTypeTime, + GoTypeGTime: GoTypeGTime, + GoTypeJson: GoTypeJson, +} + +// ts类型 +const ( + TsTypeString = "string" + TsTypeNumber = "number" + TsTypeBoolean = "boolean" + TsTypeArray = "array" + TsTypeTuple = "tuple" + TsTypeAny = "any" +) + +var TsTypeNameMap = map[string]string{ + TsTypeString: TsTypeString, + TsTypeNumber: TsTypeNumber, + TsTypeBoolean: TsTypeBoolean, + TsTypeArray: TsTypeArray, + TsTypeTuple: TsTypeTuple, + TsTypeAny: TsTypeAny, +} + +// ShiftMap Go -> Ts 类型转换 +var ShiftMap = map[string]string{ + GoTypeString: TsTypeString, + GoTypeDate: TsTypeString, + GoTypeDatetime: TsTypeString, + GoTypeInt: TsTypeNumber, + GoTypeUint: TsTypeNumber, + GoTypeInt64: TsTypeNumber, + GoTypeUint64: TsTypeNumber, + GoTypeIntSlice: TsTypeArray, + GoTypeInt64Slice: TsTypeArray, + GoTypeUint64Slice: TsTypeArray, + GoTypeFloat32: TsTypeNumber, + GoTypeFloat64: TsTypeNumber, + GoTypeBytes: TsTypeString, + GoTypeBool: TsTypeBoolean, + GoTypeTime: TsTypeString, + GoTypeGTime: TsTypeString, + GoTypeJson: TsTypeAny, +} + +func HasColumn(fields []*genmodel.GenCodesColumnListModel, column string) bool { + for _, field := range fields { + if field.GoName == column { + return true + } + } + return false +} + +func HasColumnWithFormMode(fields []*genmodel.GenCodesColumnListModel, formMode string) bool { + for _, field := range fields { + if field.FormMode == formMode { + return true + } + } + return false +} + +func HasMaxSort(fields []*genmodel.GenCodesColumnListModel) bool { + return HasColumn(fields, "Sort") +} + +func HasStatus(headOps []string, fields []*genmodel.GenCodesColumnListModel) bool { + if !gstr.InArray(headOps, "status") { + return false + } + return HasColumn(fields, "Status") +} + +func HasSwitch(fields []*genmodel.GenCodesColumnListModel) bool { + return HasColumnWithFormMode(fields, FMSwitch) +} + +func HasHookMemberSummary(fields []*genmodel.GenCodesColumnListModel) bool { + for _, field := range fields { + if IsMemberSummaryField(field.Name) { + if field.IsList { + return true + } + } + } + return false +} + +func HasQueryMemberSummary(fields []*genmodel.GenCodesColumnListModel) bool { + for _, field := range fields { + if IsMemberSummaryField(field.Name) { + if field.IsQuery { + return true + } + } + } + return false +} + +func IsMemberSummaryField(name string) bool { + switch name { + case "created_by", "updated_by", "deleted_by": + return true + } + return false +} + +// ReviseFields 校正字段值,兼容版本升级前的老数据格式 +func ReviseFields(fields []*genmodel.GenCodesColumnListModel) []*genmodel.GenCodesColumnListModel { + for _, field := range fields { + if !gstr.InArray(TableAligns, field.Align) { + field.Align = TableAlignLeft + } + + if field.Width < 1 { + field.Width = -1 + } + if field.Width > 2000 { + field.Width = 2000 + } + + if field.FormGridSpan < 1 { + field.FormGridSpan = 1 + } + } + return fields +} diff --git a/server/internal/library/xgen/gen_view/gen_curd.go b/server/internal/library/xgen/gen_view/gen_curd.go new file mode 100644 index 0000000..381084e --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd.go @@ -0,0 +1,960 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + genconsts "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_consts" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgorm" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/tree" + version "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/version" + "runtime" + "slices" + "strings" + + "github.com/gogf/gf/v2/container/gvar" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/os/gview" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gutil" +) + +var Curd = gCurd{} + +type gCurd struct{} + +func (l *gCurd) DoBuild(ctx context.Context, in *genmodel.CurdBuildParam) (err error) { + st := gtime.Now() + preview, err := l.DoPreview(ctx, in.PreviewIn) + if err != nil { + return + } + + db, err := g.DB().Open(ParseDBConfigNodeLink(&gdb.ConfigNode{Link: in.PreviewIn.DaoConfig.Link})) + if err != nil { + err = gerror.Newf("连接数据库失败,请检查配置文件[server/hack/config.yaml]数据库配置是否正确!err:%v", err.Error()) + return err + } + + defer db.Close() + if err = db.Ping(); err != nil { + err = gerror.Newf("数据库访问异常,请检查配置文件[server/hack/config.yaml]数据库配置是否正确!err:%v", err.Error()) + return + } + + // 前置操作 + if len(in.BeforeEvent) > 0 { + for name, f := range in.BeforeEvent { + if gstr.InArray(in.PreviewIn.Options.AutoOps, name) { + if err = f(ctx); err != nil { + return gerror.Newf("in doBuild operation beforeEvent to '%s' failed:%v", name, err) + } + } + } + } + + // 处理sql文件 + handleSqlFile := func(vi *genmodel.GenFile) (err error) { + // 无需生成 + if vi.Meth != genconsts.GenCodesBuildMethCreate && vi.Meth != genconsts.GenCodesBuildMethCover { + return + } + + if err = gfile.PutContents(vi.Path, strings.TrimSpace(vi.Content)); err != nil { + return gerror.Newf("writing content to '%s' failed: %v", vi.Path, err) + } + + // 导入失败,将sql文件删除 + if err = ImportSql(ctx, vi.Path); err != nil { + _ = gfile.Remove(vi.Path) + } + return + } + + // 将sql文件提取出来优先处理 + // sql执行过程出错是高概率事件,后期在执行前要进行预效验,尽量减少在执行过程中出错的可能性 + sqlGenFile, ok := preview.Views["source.sql"] + if ok { + delete(preview.Views, "source.sql") + if err = handleSqlFile(sqlGenFile); err != nil { + return + } + } + + for _, vi := range preview.Views { + // 无需生成 + if vi.Meth != genconsts.GenCodesBuildMethCreate && vi.Meth != genconsts.GenCodesBuildMethCover { + continue + } + + if err = gfile.PutContents(vi.Path, strings.TrimSpace(vi.Content)); err != nil { + return gerror.Newf("writing content to '%s' failed: %v", vi.Path, err) + } + } + + // 后置操作 + if len(in.AfterEvent) > 0 { + for name, f := range in.AfterEvent { + if gstr.InArray(in.PreviewIn.Options.AutoOps, name) { + if err = f(ctx); err != nil { + return gerror.Newf("in doBuild operation afterEvent to '%s' failed:%v", name, err) + } + } + } + } + g.Log().Debugf(ctx, "generate code operation completed, %vms", gtime.Now().Sub(st).Milliseconds()) + return +} + +func (l *gCurd) DoPreview(ctx context.Context, in *genmodel.CurdPreviewParam) (res *genmodel.GenCodesPreviewModel, err error) { + // 初始化 + if err = l.initInput(ctx, in); err != nil { + return nil, err + } + + // 加载模板 + if err = l.loadView(ctx, in); err != nil { + return nil, err + } + + if err = l.generateApiContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateInputContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateControllerContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateLogicContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateRouterContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateWebApiContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateWebModelContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateWebIndexContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateWebEditContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateWebViewContent(ctx, in); err != nil { + return nil, err + } + + if err = l.generateSqlContent(ctx, in); err != nil { + return nil, err + } + + in.Content.Config = in.Config + res = in.Content + return +} + +func (l *gCurd) initInput(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + in.Content = new(genmodel.GenCodesPreviewModel) + in.Content.Views = make(map[string]*genmodel.GenFile) + + // 初始化生成选项 + if err = initOptions(in); err != nil { + return err + } + + // 初始化表字段配置 + if err = initTableField(ctx, in); err != nil { + return err + } + + // 初始化树表 + if err = initTableTree(in); err != nil { + return err + } + + // 初始化生成选型 + initStep(in) + + // 初始化方法字典 + if err = initFuncDict(in); err != nil { + return err + } + + // 初始化生成模板 + if err = initTemplate(in); err != nil { + return err + } + return +} +func initOptions(in *genmodel.CurdPreviewParam) (err error) { + if err = in.In.Options.Scan(&in.Options); err != nil { + return + } + in.Options.DictMap = make(g.Map) + return +} + +func initTableField(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + // 加载主表配置 + if err = in.In.MasterColumns.Scan(&in.MasterFields); err != nil { + return + } + + if len(in.MasterFields) == 0 { + if in.MasterFields, err = TableColumnList(ctx, &genmodel.GenCodesColumnListParam{DbGroup: in.In.DbName, TableName: in.In.TableName}); err != nil { + return + } + } + + // 主键属性 + in.Pk = getPkField(in) + if in.Pk == nil { + return gerror.New("initInput no primary key is set in the table!") + } + + in.MasterFields = ReviseFields(in.MasterFields) + + // 检查表命名 + var names = []string{in.In.DaoName} + for _, v := range in.Options.Join { + v.Columns = ReviseFields(v.Columns) + names = append(names, v.DaoName) + g.Log().Infof(ctx, "initTableField in.Options.Join: %+v", v) + } + if err = CheckIllegalName("数据库表名", names...); err != nil { + return + } + + if err = CheckIllegalName("实体命名", in.In.VarName); err != nil { + return + } + return +} + +// getPkField 获取主键 +func getPkField(in *genmodel.CurdPreviewParam) *genmodel.GenCodesColumnListModel { + if len(in.MasterFields) == 0 { + panic("getPkField masterFields uninitialized.") + } + for _, field := range in.MasterFields { + if IsIndexPK(field.Index) { + return field + } + } + return nil +} + +func initTableTree(in *genmodel.CurdPreviewParam) (err error) { + // 检查树表字段 + if in.In.GenType == genconsts.GenCodesTypeTree { + if err = CheckTreeTableFields(in.MasterFields); err != nil { + return err + } + + // 解析选项树名称字段 + has := false + for _, field := range in.MasterFields { + if in.Options.Tree.TitleColumn == field.Name { + in.Options.Tree.TitleField = field + has = true + break + } + } + if !has { + err = gerror.New("请选择一个有效的树名称字段") + return + } + } + return err +} + +// CheckTreeTableFields 检查树表字段 +func CheckTreeTableFields(columns []*genmodel.GenCodesColumnListModel) (err error) { + var fields = gutil.Copy(defaultTreeFields).([]string) + for _, v := range columns { + if gstr.InArray(fields, v.Name) { + fields = slices.DeleteFunc(fields, func(item string) bool { + return item == v.Name + }) + } + } + + if len(fields) > 0 { + err = gerror.Newf("树表必须包含[%v]字段", strings.Join(fields, "、")) + return err + } + return +} + +func initStep(in *genmodel.CurdPreviewParam) { + in.Options.Step = new(genmodel.CurdStep) + in.Options.Step.HasMaxSort = HasMaxSort(in.MasterFields) + in.Options.Step.HasAdd = gstr.InArray(in.Options.HeadOps, "add") + in.Options.Step.HasBatchDel = gstr.InArray(in.Options.HeadOps, "batchDel") && gstr.InArray(in.Options.ColumnOps, "check") + in.Options.Step.HasExport = gstr.InArray(in.Options.HeadOps, "export") + in.Options.Step.HasNotFilterAuth = gstr.InArray(in.Options.ColumnOps, "notFilterAuth") + in.Options.Step.HasEdit = gstr.InArray(in.Options.ColumnOps, "edit") + in.Options.Step.HasDel = gstr.InArray(in.Options.ColumnOps, "del") + in.Options.Step.HasView = gstr.InArray(in.Options.ColumnOps, "view") + in.Options.Step.HasStatus = HasStatus(in.Options.ColumnOps, in.MasterFields) + in.Options.Step.HasSwitch = HasSwitch(in.MasterFields) + in.Options.Step.HasCheck = gstr.InArray(in.Options.ColumnOps, "check") + in.Options.Step.HasMenu = gstr.InArray(in.Options.AutoOps, "genMenuPermissions") + in.Options.Step.HasQueryMemberSummary = HasQueryMemberSummary(in.MasterFields) + in.Options.Step.HasHookMemberSummary = HasHookMemberSummary(in.MasterFields) + in.Options.Step.IsTreeTable = in.In.GenType == genconsts.GenCodesTypeTree + if in.Options.Step.IsTreeTable { + in.Options.Step.IsOptionTreeTable = in.Options.Tree.StyleType == genconsts.GenCodesTreeStyleTypeOption + } + in.Options.Step.HasFuncDict = gstr.InArray(in.Options.AutoOps, "genFuncDict") + in.Options.Step.IsAddon = in.Config.Application.Crud.Templates[in.In.GenTemplate].IsAddon + if in.Options.PresetStep.FormGridCols < 1 { + in.Options.PresetStep.FormGridCols = 1 + } + in.Options.Step.IsEditModal = gstr.InArray(in.Options.AutoOps, "genEditModal") +} + +func initFuncDict(in *genmodel.CurdPreviewParam) (err error) { + g.Log().Infof(context.Background(), "server/internal/library/xgen/gen_curd.go initFuncDict in.Options.Step.HasFuncDict:%v in.Options.FuncDict:%+v", in.Options.Step.HasFuncDict, in.Options.FuncDict) + if !in.Options.Step.HasFuncDict || in.Options.FuncDict == nil { + return + } + + if len(in.Options.FuncDict.LabelColumn) == 0 || len(in.Options.FuncDict.ValueColumn) == 0 { + err = gerror.New("生成字典选项必须设置选项值和选项名称") + return err + } + + for _, field := range in.MasterFields { + if field.Name == in.Options.FuncDict.ValueColumn { + in.Options.FuncDict.Value = field + } + + if field.Name == in.Options.FuncDict.LabelColumn { + in.Options.FuncDict.Label = field + } + } + g.Log().Infof(context.Background(), "server/internal/library/xgen/gen_curd.go initFuncDict in.Options.Step.HasFuncDict:%v in.Options.FuncDict:%+v", in.Options.Step.HasFuncDict, in.Options.FuncDict) + return +} + +func initTemplate(in *genmodel.CurdPreviewParam) (err error) { + if len(in.Config.Application.Crud.Templates)-1 < in.In.GenTemplate { + return gerror.New("没有找到生成模板的配置,请检查!") + } + + // api前缀 + apiPrefix := gstr.LcFirst(in.In.VarName) + if in.Config.Application.Crud.Templates[in.In.GenTemplate].IsAddon { + apiPrefix = in.In.AddonName + "/" + apiPrefix + } + in.Options.ApiPrefix = apiPrefix + + if err = checkCurdPath(in.Config.Application.Crud.Templates[in.In.GenTemplate], in.In.AddonName); err != nil { + return + } + in.Options.TemplateGroup = in.Config.Application.Crud.Templates[in.In.GenTemplate].MasterPackage + return +} + +func checkCurdPath(temp *genmodel.GenCodesConfigCrudTemplate, addonName string) (err error) { + if temp == nil { + return gerror.New("生成模板配置不能为空") + } + + if temp.IsAddon { + temp.TemplatePath = gstr.Replace(temp.TemplatePath, "{$name}", addonName) + temp.ApiPath = gstr.Replace(temp.ApiPath, "{$name}", addonName) + temp.InputPath = gstr.Replace(temp.InputPath, "{$name}", addonName) + temp.ControllerPath = gstr.Replace(temp.ControllerPath, "{$name}", addonName) + temp.LogicPath = gstr.Replace(temp.LogicPath, "{$name}", addonName) + temp.RouterPath = gstr.Replace(temp.RouterPath, "{$name}", addonName) + temp.SqlPath = gstr.Replace(temp.SqlPath, "{$name}", addonName) + temp.WebApiPath = gstr.Replace(temp.WebApiPath, "{$name}", addonName) + temp.WebViewsPath = gstr.Replace(temp.WebViewsPath, "{$name}", addonName) + } + + tip := `生成模板配置参数'%s'路径不存在,请先创建路径:%s` + + if !gfile.Exists(temp.TemplatePath) { + return gerror.Newf(tip, "TemplatePath", temp.TemplatePath) + } + if !gfile.Exists(temp.ApiPath) { + return gerror.Newf(tip, "ApiPath", temp.ApiPath) + } + if !gfile.Exists(temp.InputPath) { + return gerror.Newf(tip, "InputPath", temp.InputPath) + } + if !gfile.Exists(temp.ControllerPath) { + return gerror.Newf(tip, "ControllerPath", temp.ControllerPath) + } + if !gfile.Exists(temp.LogicPath) { + return gerror.Newf(tip, "LogicPath", temp.LogicPath) + } + if !gfile.Exists(temp.RouterPath) { + return gerror.Newf(tip, "RouterPath", temp.RouterPath) + } + if !gfile.Exists(temp.SqlPath) { + return gerror.Newf(tip, "SqlPath", temp.SqlPath) + } + if !gfile.Exists(temp.WebApiPath) { + return gerror.Newf(tip, "WebApiPath", temp.WebApiPath) + } + if !gfile.Exists(temp.WebViewsPath) { + return gerror.Newf(tip, "WebViewsPath", temp.WebViewsPath) + } + return +} + +func (l *gCurd) loadView(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + temp := in.Config.Application.Crud.Templates[in.In.GenTemplate] + view := gview.New() + err = view.SetConfigWithMap(g.Map{ + "Paths": temp.TemplatePath, + "Delimiters": in.Config.Delimiters, + }) + if err != nil { + return + } + + now := gtime.Now() + view.BindFuncMap(g.Map{ + "NowYear": now.Year, // 当前年 + "ToLower": strings.ToLower, // 全部小写 + "LcFirst": gstr.LcFirst, // 首字母小写 + "UcFirst": gstr.UcFirst, // 首字母大写 + "ToTSArray": ToTSArray, // 转为ts数组格式 + "DictToTSArray": DictToTSArray, // 转为ts数组格式 + }) + + if err = l.generateWebModelDictOptions(ctx, in); err != nil { + return + } + + modName, err := GetModName(ctx) + if err != nil { + return + } + importApi := gstr.Replace(temp.ApiPath, "./", modName+"/") + "/" + strings.ToLower(in.In.VarName) + "/v1" + importInput := gstr.Replace(temp.InputPath, "./", modName+"/") + importController := gstr.Replace(temp.ControllerPath, "./", modName+"/") + importService := "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + if temp.IsAddon { + importService = "git.5iot.com/iotlcm-public/iotlcm-admin-svr/addons/" + in.In.AddonName + "/service" + } + + in.Options.ImportWebApi = "#/api/gen/" + gstr.LcFirst(in.In.VarName) + if temp.IsAddon { + in.Options.ImportWebApi = "#/api/gen/addons/" + in.In.AddonName + "/" + gstr.LcFirst(in.In.VarName) + } + + componentPrefix := gstr.LcFirst(in.In.VarName) + if temp.IsAddon { + componentPrefix = "addons/" + in.In.AddonName + "/" + componentPrefix + } + + nowTime := now.Format("Y-m-d H:i:s") + view.Assigns(gview.Params{ + "templateGroup": in.Options.TemplateGroup, // 生成模板分组名称 + "servFunName": l.parseServFunName(in.Options.TemplateGroup, in.In.VarName), // 业务服务名称 + "nowTime": nowTime, // 当前时间 + "version": runtime.Version(), // GO 版本 + "xjVersion": version.BuildVersion, // XJ 版本 + "varName": in.In.VarName, // 实体名称 + "tableComment": in.In.TableComment, // 对外名称 + "daoName": in.In.DaoName, // ORM模型 + "masterFields": in.MasterFields, // 主表字段 + "pk": in.Pk, // 主键属性 + "options": in.Options, // 提交选项 + "dictOptions": in.Options.DictOps, // web字典选项 + "importApi": importApi, // 导入goApi包 + "importInput": importInput, // 导入input包 + "importController": importController, // 导入控制器包 + "importService": importService, // 导入业务服务 + "importWebApi": in.Options.ImportWebApi, // 导入webApi + "apiPrefix": in.Options.ApiPrefix, // api前缀 + "componentPrefix": componentPrefix, // vue子组件前缀 + }) + + in.View = view + return +} + +func (l *gCurd) generateApiContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "api.go" + tplData = g.Map{} + genFile = new(genmodel.GenFile) + ) + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content, err = FormatGo(ctx, name, genFile.Content) + if err != nil { + return err + } + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].ApiPath, strings.ToLower(in.In.VarName), "v1", strings.ToLower(in.In.VarName)+".go") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateInputContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "input.go" + genFile = new(genmodel.GenFile) + ) + + tplData, err := l.inputTplData(ctx, in) + if err != nil { + return err + } + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content, err = FormatGo(ctx, name, genFile.Content) + if err != nil { + return err + } + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].InputPath, CamelCaseToUnderline(in.In.VarName)+".go") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateControllerContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "controller.go" + tplData = g.Map{} + genFile = new(genmodel.GenFile) + ) + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content, err = FormatGo(ctx, name, genFile.Content) + if err != nil { + return err + } + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].ControllerPath, CamelCaseToUnderline(in.In.VarName)+".go") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateLogicContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "logic.go" + genFile = new(genmodel.GenFile) + ) + + tplData, err := l.logicTplData(ctx, in) + if err != nil { + return err + } + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content, err = FormatGo(ctx, name, genFile.Content) + if err != nil { + return err + } + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].LogicPath, CamelCaseToUnderline(in.In.VarName)+".go") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateRouterContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "router.go" + tplData = g.Map{} + genFile = new(genmodel.GenFile) + ) + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content, err = FormatGo(ctx, name, genFile.Content) + if err != nil { + return err + } + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].RouterPath, CamelCaseToUnderline(in.In.VarName)+".go") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateWebApiContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "web.api.ts" + tplData = g.Map{} + genFile = new(genmodel.GenFile) + ) + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content = FormatTs(genFile.Content) + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebApiPath, gstr.LcFirst(in.In.VarName), "index.ts") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateWebModelContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "web.model.ts" + genFile = new(genmodel.GenFile) + ) + + tplData, err := l.webModelTplData(ctx, in) + if err != nil { + return + } + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return + } + + genFile.Content = FormatTs(genFile.Content) + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "model.tsx") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateWebIndexContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "web.index.vue" + genFile = new(genmodel.GenFile) + ) + + tplData, err := l.webIndexTplData(ctx, in) + if err != nil { + return err + } + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content = FormatVue(genFile.Content) + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "index.vue") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateWebEditContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "web.edit.vue" + genFile = new(genmodel.GenFile) + ) + + tplData, err := l.webEditTplData(ctx, in) + if err != nil { + return err + } + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content = FormatVue(genFile.Content) + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "edit.vue") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + if !in.Options.Step.HasEdit { + genFile.Meth = genconsts.GenCodesBuildIgnore + genFile.Required = false + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateWebViewContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "web.view.vue" + genFile = new(genmodel.GenFile) + ) + + tplData, err := l.webViewTplData(ctx, in) + if err != nil { + return err + } + + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + genFile.Content = FormatVue(genFile.Content) + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "view.vue") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if genFile.Meth == genconsts.GenCodesBuildMethSkip && gstr.InArray(in.Options.AutoOps, "forcedCover") { + genFile.Meth = genconsts.GenCodesBuildMethCover + } + + if !in.Options.Step.HasView { + genFile.Meth = genconsts.GenCodesBuildIgnore + genFile.Required = false + } + + in.Content.Views[name] = genFile + return +} + +func (l *gCurd) generateSqlContent(ctx context.Context, in *genmodel.CurdPreviewParam) (err error) { + var ( + name = "source.sql" + config = g.DB("default").GetConfig() + tplData = g.Map{ + "dbName": config.Name, + "menuTable": config.Prefix + "sys_menu", + "mainComponent": "LAYOUT", + } + genFile = new(genmodel.GenFile) + ) + + menus, err := service.SysMenu().GetFastList(ctx) + if err != nil { + return err + } + + tplData["dirPid"], tplData["dirLevel"], tplData["dirTree"], err = xgorm.AutoUpdateTree(ctx, &dao.SysMenu, 0, int64(in.Options.Menu.Pid), &xgorm.TreeFiledOption{ + IdField: "menu_id", + PidField: "parent_id", + LevelField: "level", + TreeField: "tree", + }) + if err != nil { + return err + } + + tplData["listLevel"] = tplData["dirLevel"].(int) + 1 + tplData["btnLevel"] = tplData["dirLevel"].(int) + 2 + tplData["sortLevel"] = tplData["dirLevel"].(int) + 3 + + pageRedirect := "" + if in.Options.Menu.Pid > 0 { + tplData["mainComponent"] = "ParentLayout" + menu, ok := menus[int64(in.Options.Menu.Pid)] + if !ok { + err = gerror.New("选择的上级菜单不存在") + return + } + for _, id := range tree.GetIds(menu.Tree) { + if v, ok2 := menus[id]; ok2 { + if !gstr.HasSuffix(pageRedirect, "/") && !gstr.HasPrefix(v.Path, "/") { + pageRedirect += "/" + } + pageRedirect += v.Path + } + } + + if !gstr.HasSuffix(pageRedirect, "/") && !gstr.HasPrefix(menu.Path, "/") { + pageRedirect += "/" + } + pageRedirect += menu.Path + } + pageRedirect += "/" + gstr.LcFirst(in.In.VarName) + "/index" + tplData["pageRedirect"] = pageRedirect + + genFile.Path = utility.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].SqlPath, CamelCaseToUnderline(in.In.VarName)+"_menu.sql") + genFile.Meth = genconsts.GenCodesBuildMethCreate + if gfile.Exists(genFile.Path) { + genFile.Meth = genconsts.GenCodesBuildMethSkip + } + genFile.Required = true + + if !in.Options.Step.HasMenu { + genFile.Meth = genconsts.GenCodesBuildIgnore + genFile.Required = false + } + + // 需要生成时,检查菜单命名是否存在 + if genFile.Meth == genconsts.GenCodesBuildMethCreate { + menuNamePrefix := gstr.LcFirst(in.In.VarName) + menuNames := []string{menuNamePrefix, menuNamePrefix + "Index"} + if in.Options.Step.HasEdit { + menuNames = append(menuNames, menuNamePrefix+"Edit") + menuNames = append(menuNames, menuNamePrefix+"View") + } + if in.Options.Step.HasView { + menuNames = append(menuNames, menuNamePrefix+"View") + } + if in.Options.Step.HasMaxSort { + menuNames = append(menuNames, menuNamePrefix+"MaxSort") + } + if in.Options.Step.HasDel { + menuNames = append(menuNames, menuNamePrefix+"Delete") + } + if in.Options.Step.HasStatus { + menuNames = append(menuNames, menuNamePrefix+"Status") + } + if in.Options.Step.HasSwitch { + menuNames = append(menuNames, menuNamePrefix+"Switch") + } + if in.Options.Step.HasExport { + menuNames = append(menuNames, menuNamePrefix+"Export") + } + if in.Options.Step.IsTreeTable { + menuNames = append(menuNames, menuNamePrefix+"TreeOption") + } + + menuNames = utility.UniqueSlice(menuNames) + + hasMenus, err := service.SysMenu().Model(ctx).Fields("path").WhereIn("path", menuNames).Array() + if err != nil { + return err + } + + if len(hasMenus) > 0 { + err = gerror.Newf("要生成的菜单中有已存在的路由别名,请检查并删除:%v", strings.Join(gvar.New(hasMenus).Strings(), `、`)) + return err + } + } + + tplData["generatePath"] = genFile.Path + genFile.Content, err = in.View.Parse(ctx, name+".template", tplData) + if err != nil { + return err + } + + in.Content.Views[name] = genFile + return +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_input.go b/server/internal/library/xgen/gen_view/gen_curd_input.go new file mode 100644 index 0000000..cb81afd --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_input.go @@ -0,0 +1,409 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "bytes" + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + "strings" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/text/gstr" + "github.com/olekukonko/tablewriter" + "github.com/olekukonko/tablewriter/tw" +) + +const ( + InputTypeListInp = 1 // 列表输入 + InputTypeListModel = 2 // 列表输出 + InputTypeExportModel = 3 // 列表导出 + InputTypeEditInpValidator = 4 // 添加&编辑验证器 + InputTypeUpdateFields = 5 // 编辑修改过滤字段 + InputTypeInsertFields = 6 // 编辑新增过滤字段 + InputTypeTreeOptionFields = 7 // 关系树查询字段 + InputTypeEditParamFields = 8 // 编辑参数过滤字段 + EditInpValidatorGenerally = "if err := g.Validator().Rules(\"%s\").Data(in.%s).Messages(\"%s\").Run(ctx); err != nil {\n\t\treturn err.Current()\n\t}\n" +) + +func (l *gCurd) inputTplData(ctx context.Context, in *genmodel.CurdPreviewParam) (data g.Map, err error) { + data = make(g.Map) + data["listInpColumns"] = l.genInputListColumns(ctx, in, InputTypeListInp) + data["listModelColumns"] = l.genInputListColumns(ctx, in, InputTypeListModel) + data["exportModelColumns"] = l.genInputListColumns(ctx, in, InputTypeExportModel) + data["editInpValidator"] = l.genInputListColumns(ctx, in, InputTypeEditInpValidator) + data["updateFieldsColumns"] = l.genInputListColumns(ctx, in, InputTypeUpdateFields) + data["insertFieldsColumns"] = l.genInputListColumns(ctx, in, InputTypeInsertFields) + data["editParamFieldsColumns"] = l.genInputListColumns(ctx, in, InputTypeEditParamFields) + data["viewModelColumns"] = l.genInputViewColumns(ctx, in) + if in.Options.Step.IsTreeTable { + data["treeOptionFields"] = l.genInputListColumns(ctx, in, InputTypeTreeOptionFields) + } + return +} + +func (l *gCurd) genInputViewColumns(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + + index := 0 + array := make([][]string, 1000) + // 主表 + for _, field := range in.MasterFields { + // 查询用户摘要 + if field.IsList && in.Options.Step.HasHookMemberSummary && IsMemberSummaryField(field.Name) { + tagKey := "`" + descriptionTag := gstr.Replace(formatComment(field.Dc)+"摘要信息", `"`, `\"`) + result := []string{" #" + field.GoName + "Summa"} + result = append(result, " #*hook.MemberSumma") + result = append(result, " #"+fmt.Sprintf(tagKey+`json:"%s"`, field.TsName+"Summa")) + result = append(result, " #"+fmt.Sprintf(`dc:"%s"`+tagKey, descriptionTag)) + array[index] = result + index++ + } + } + table := tablewriter.NewTable(buffer) + + table.Options(tablewriter.WithRendition(tw.Rendition{ + Borders: tw.Border{ + Top: tw.Fail, + Bottom: tw.Fail, + Left: tw.Success, + Right: tw.Success, + }, + Settings: tw.Settings{ + Lines: tw.Lines{ + ShowTop: tw.Fail, + ShowBottom: tw.Fail, + ShowHeaderLine: tw.Fail, + ShowFooterLine: tw.Fail, + }, + }, + }), tablewriter.WithRowConfig(tw.CellConfig{ + Formatting: tw.CellFormatting{ + AutoWrap: tw.WrapNone, + }, + }), tablewriter.WithSymbols(tw.NewSymbols(tw.StyleDefault))) + + // tw.SetBorder(false) + // tw.SetRowLine(false) + // tw.SetAutoWrapText(false) + // tw.SetColumnSeparator("") + table.Bulk(array) + table.Render() + stContent := buffer.String() + // Let's do this hack of table writer for indent! + stContent = gstr.Replace(stContent, "│#", " ") + stContent = gstr.Replace(stContent, "│", " ") + stContent = gstr.Replace(stContent, " #", " ") + stContent = gstr.Replace(stContent, "` ", "`") + stContent = gstr.Replace(stContent, "``", "") + stContent = removeEndWrap(stContent) + + buffer.Reset() + buffer.WriteString(stContent) + return "\tentity." + in.In.DaoName + "\n" + buffer.String() +} + +func (l *gCurd) genInputListColumns(ctx context.Context, in *genmodel.CurdPreviewParam, inputType int) string { + buffer := bytes.NewBuffer(nil) + index := 0 + array := make([][]string, 1000) + // 主表 + for _, field := range in.MasterFields { + row := l.genStructFieldDefinition(in, field, inputType, true) + if row == nil { + continue + } + array[index] = row + index++ + + switch inputType { + case InputTypeListModel: + // 查询用户摘要 + if field.IsList && in.Options.Step.HasHookMemberSummary && IsMemberSummaryField(field.Name) { + tagKey := "`" + descriptionTag := gstr.Replace(formatComment(field.Dc)+"摘要信息", `"`, `\"`) + result := []string{" #" + field.GoName + "Summa"} + result = append(result, " #*hook.MemberSumma") + result = append(result, " #"+fmt.Sprintf(tagKey+`json:"%s"`, field.TsName+"Summa")) + result = append(result, " #"+fmt.Sprintf(`dc:"%s"`+tagKey, descriptionTag)) + array[index] = result + index++ + } + } + } + + // 关联表 + if len(in.Options.Join) > 0 { + for _, v := range in.Options.Join { + if !isEffectiveJoin(v) { + g.Log().Infof(ctx, "genInputListColumns isEffectiveJoin: %+v", v) + continue + } + g.Log().Infof(ctx, "genInputListColumns v: %+v", v) + for _, field := range v.Columns { + row := l.genStructFieldDefinition(in, field, inputType, false) + g.Log().Infof(ctx, "genInputListColumns field: %+v row: %+v", field, row) + if row != nil { + array[index] = row + index++ + } + } + } + } + g.Log().Infof(ctx, "genInputListColumns in.Options.Join: %+v", in.Options.Join) + + table := tablewriter.NewWriter(buffer) + table.Options(tablewriter.WithRendition(tw.Rendition{ + Borders: tw.Border{ + Top: tw.Fail, + Bottom: tw.Fail, + Left: tw.Success, + Right: tw.Success, + }, + Settings: tw.Settings{ + Lines: tw.Lines{ + ShowTop: tw.Fail, + ShowBottom: tw.Fail, + ShowHeaderLine: tw.Fail, + ShowFooterLine: tw.Fail, + }, + }, + }), tablewriter.WithRowConfig(tw.CellConfig{ + Formatting: tw.CellFormatting{ + AutoWrap: tw.WrapNone, + }, + }), tablewriter.WithSymbols(tw.NewSymbols(tw.StyleDefault))) + // tw.SetBorder(false) + // tw.SetRowLine(false) + // tw.SetAutoWrapText(false) + // tw.SetColumnSeparator("") + table.Bulk(array) + table.Render() + stContent := buffer.String() + // Let's do this hack of table writer for indent! + stContent = gstr.Replace(stContent, "│#", " ") + stContent = gstr.Replace(stContent, "│", " ") + stContent = gstr.Replace(stContent, " #", " ") + stContent = gstr.Replace(stContent, "` ", "`") + stContent = gstr.Replace(stContent, "``", "") + stContent = removeEndWrap(stContent) + + buffer.Reset() + buffer.WriteString(stContent) + return buffer.String() +} + +// genStructFieldForModel gens and returns the attribute definition for specified field. +func (l *gCurd) genStructFieldDefinition(in *genmodel.CurdPreviewParam, field *genmodel.GenCodesColumnListModel, inputType int, isMaster bool) []string { + var ( + tagKey = "`" + result = []string{" #" + field.GoName} + descriptionTag = gstr.Replace(formatComment(field.Dc), `"`, `\"`) + ) + + addResult := func() []string { + if inputType == InputTypeEditParamFields && !IsIndexPK(field.Index) && !strings.HasPrefix(field.GoType, "*") { + result = append(result, " #*"+field.GoType) + } else { + result = append(result, " #"+field.GoType) + } + result = append(result, " #"+fmt.Sprintf(tagKey+`json:"%s"`, field.TsName)) + result = append(result, " #"+fmt.Sprintf(`dc:"%s"`+tagKey, descriptionTag)) + return result + } + + isUpdateOrInsertInputFields := func() bool { + if !isMaster { + return field.IsEdit + } + + if field.IsEdit { + return true + } + + // 树表内部维护字段 + if in.Options.Step.IsTreeTable && gstr.InArray(defaultTreeFields, field.Name) { + return true + } + + // 修改人 + if inputType == InputTypeUpdateFields && field.GoName == "UpdatedBy" { + return true + } + if inputType == InputTypeUpdateFields && field.GoName == "UpdatedAt" { + return true + } + // 创建人 + if inputType == InputTypeInsertFields && field.GoName == "CreatedBy" { + return true + } + if inputType == InputTypeInsertFields && field.GoName == "CreatedAt" { + return true + } + if inputType == InputTypeInsertFields && field.GoName == "CreatedDept" { + return true + } + if inputType == InputTypeInsertFields && field.GoName == "TenantId" { + return true + } + return false + } + + isQuery := false + + switch inputType { + case InputTypeListInp: + if in.Options.Step.IsTreeTable && IsPidName(field.Name) { + isQuery = true + field.QueryWhere = WMEq + } + if !field.IsQuery && !isQuery { + return nil + } + + if field.QueryWhere == WMBetween { + result = append(result, " #[]"+field.GoType) + } else { + // 查询用户摘要时,固定接收字符串类型 + if field.IsQuery && in.Options.Step.HasQueryMemberSummary && IsMemberSummaryField(field.Name) { + result = append(result, " #string") + } else { + result = append(result, " #"+field.GoType) + } + } + result = append(result, " #"+fmt.Sprintf(tagKey+`json:"%s"`, field.TsName)) + result = append(result, " #"+fmt.Sprintf(`dc:"%s"`+tagKey, descriptionTag)) + + case InputTypeListModel: + // 主表的主键 + if IsIndexPK(field.Index) && isMaster { + addResult() + // 树表的pid字段 + } else if in.Options.Step.IsTreeTable && IsPidName(field.Name) { + addResult() + } else if field.IsList { + addResult() + } else { + return nil + } + case InputTypeExportModel: + if !field.IsExport { + return nil + } + addResult() + case InputTypeEditInpValidator: + if !field.IsEdit { + return nil + } + if !field.Required && (field.FormRole == "none" || field.FormRole == "") { + return nil + } + rule := "// 验证" + field.Dc + "\n" + if field.Required && (field.FormRole == FRNone || field.FormRole == "") { + field.FormRole = "required" + } + if err, s := makeValidatorFunc(field); err != nil { + return nil + } else { + rule += s + } + result = []string{rule} + case InputTypeUpdateFields: + if !isUpdateOrInsertInputFields() { + return nil + } + addResult() + case InputTypeInsertFields: + if !isUpdateOrInsertInputFields() { + return nil + } + addResult() + case InputTypeTreeOptionFields: + if IsIndexPK(field.Index) { + return addResult() + } + if IsPidName(field.Name) { + return addResult() + } + if in.Options.Tree.TitleColumn == field.Name { + return addResult() + } + return nil + case InputTypeEditParamFields: + return addResult() + default: + panic("inputType is invalid") + } + return result +} + +func makeValidatorFunc(field *genmodel.GenCodesColumnListModel) (err error, rule string) { + if field.FormRole == "required" { + rule = fmt.Sprintf(EditInpValidatorGenerally, "required", field.GoName, field.Dc+"不能为空") + } else if field.FormRole == FRIp { + rule = fmt.Sprintf(EditInpValidatorGenerally, "ip", field.GoName, field.Dc+"必须为IPV4或IPV6") + } else if field.FormRole == FRPercentage { + rule = fmt.Sprintf(EditInpValidatorGenerally, "min:0|max:100", field.GoName, field.Dc+"必须0-100之间") + } else if field.FormRole == FRTel { + rule = fmt.Sprintf(EditInpValidatorGenerally, "telephone", field.GoName, field.Dc+"不是座机号码") + } else if field.FormRole == FRPhone { + rule = fmt.Sprintf(EditInpValidatorGenerally, "phone", field.GoName, field.Dc+"不是手机号码") + } else if field.FormRole == FRQq { + rule = fmt.Sprintf(EditInpValidatorGenerally, "qq", field.GoName, field.Dc+"不是QQ号码") + } else if field.FormRole == FREmail { + rule = fmt.Sprintf(EditInpValidatorGenerally, "email", field.GoName, field.Dc+"不是邮箱地址") + } else if field.FormRole == FRIdCard { + rule = fmt.Sprintf(EditInpValidatorGenerally, "resident-id", field.GoName, field.Dc+"不是身份证号码") + } else if field.FormRole == FRNum { + rule = fmt.Sprintf(EditInpValidatorGenerally, "min:1", field.GoName, field.Dc+"必须大于0") + } else if field.FormRole == FRBankCard { + rule = fmt.Sprintf(EditInpValidatorGenerally, "bank-card", field.GoName, field.Dc+"不是银行卡号") + } else if field.FormRole == FRWeibo { + rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:^[0-9a-zA-Z\\u4e00-\\u9fa5_-]*$", field.GoName, field.Dc+"不是微博号") + } else if field.FormRole == FRUserName { + rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:^[0-9a-zA-Z]{6,16}$", field.GoName, field.Dc+"必须为6-16位由字母和数字组成") + } else if field.FormRole == FRAccount { + rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:^[\\w_\\d]{6,16}$", field.GoName, field.Dc+"必须为6-16位由字母、数字或下划线组成") + } else if field.FormRole == FRPassword { + rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$", field.GoName, field.Dc+"必须包含6-18为字母和数字") + } else if field.FormRole == FRAmount { + rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:(^[0-9]{1,10}$)|(^[0-9]{1,10}[\\\\.]{1}[0-9]{1,2}$)", field.GoName, field.Dc+"最多允许输入10位整数及2位小数") + } else { + err = gerror.New("not support") + } + + // 生成验证字典 + if field.DictType != "" { + var ( + ctx = context.Background() + valueType gdb.Value + resultValue gdb.Result + ) + valueType, err = dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictType).Where(dao.SysDictType.Columns().DictId, field.DictType).Value() + if err != nil { + return + } + resultValue, err = dao.SysDictData.Ctx(context.Background()).Fields(dao.SysDictData.Columns().DictValue).Where(dao.SysDictData.Columns().DictType, valueType.String()).All() + if err != nil { + return + } + if resultValue.Len() > 0 { + names := make([]string, 0) + for _, item := range resultValue { + names = append(names, item["value"].String()) + } + dictRule := "in:" + strings.Join(names, ",") + rule += fmt.Sprintf(EditInpValidatorGenerally, dictRule, field.GoName, field.Dc+"值不正确") + err = nil + } + } + return +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_logic.go b/server/internal/library/xgen/gen_view/gen_curd_logic.go new file mode 100644 index 0000000..ec1b51f --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_logic.go @@ -0,0 +1,316 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "bytes" + "context" + "fmt" + + genconsts "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_consts" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/text/gstr" +) + +const ( + LogicWhereComments = "\n\t// 查询%s\n" + LogicWhereNoSupport = "\t// TODO 暂不支持生成[ %s ]查询方式,请自行补充此处代码!" + LogicEditUpdate = "\tif _, err = s.Model(ctx%s).\n\t\t\tFields(%sin.%sUpdateFields{}).\n\t\t\tWherePri(in.%s).Data(in).Update(); err != nil {\n\t\t\terr = gerror.Wrap(err, \"修改%s失败,请稍后重试!\")\n\t\t}\n\t\treturn" + LogicEditInsert = "\tif _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).\n\t\tFields(%sin.%sInsertFields{}).\n\t\tData(in).Insert(); err != nil {\n\t\terr = gerror.Wrap(err, \"新增%s失败,请稍后重试!\")\n\t}" + LogicEditUnique = "\t// 验证'%s'唯一\n\tif err = xgorm.IsUnique(ctx, &dao.%s, g.Map{dao.%s.Columns().%s: in.%s}, \"%s已存在\", in.%s); err != nil {\n\t\treturn\n\t}\n" + LogicSwitchUpdate = "g.Map{\n\t\tin.Key: in.Value,\n%s}" + LogicStatusUpdate = "g.Map{\n\t\tdao.%s.Columns().Status: in.Status,\n%s}" + LogicDeletedUpdate = "g.Map{\n%s}" +) + +func (l *gCurd) logicTplData(ctx context.Context, in *genmodel.CurdPreviewParam) (data g.Map, err error) { + g.Log().Infof(ctx, "logicTplData in.Options.Join: %+v", in.Options.Join) + data = make(g.Map) + data["listWhere"] = l.genLogicListWhere(ctx, in) + data["listJoin"] = l.genLogicListJoin(ctx, in) + data["listFields"] = l.genLogicListFields(ctx, in) + data["listOrder"] = l.genLogicListOrder(ctx, in) + data["edit"] = l.genLogicEdit(ctx, in) + data["switchFields"] = l.genLogicSwitchFields(ctx, in) + data["switchUpdate"] = l.genLogicSwitchUpdate(ctx, in) + data["statusUpdate"] = l.genLogicStatusUpdate(ctx, in) + data["deletedUpdate"] = l.genLogicDeletedUpdate(ctx, in) + return +} + +func (l *gCurd) genLogicDeletedUpdate(ctx context.Context, in *genmodel.CurdPreviewParam) string { + isDestroy := false + var update string + for _, field := range in.MasterFields { + if field.GoName == "DeletedBy" { + update += "\t\tdao." + in.In.DaoName + ".Columns().DeletedBy: contexts.GetUserId(ctx),\n" + isDestroy = true + } + if field.GoName == "DeletedAt" { + update += "\t\tdao." + in.In.DaoName + ".Columns().DeletedAt: gtime.Now(),\n" + } + } + + if !isDestroy { + return "" + } + + update += "\t" + return fmt.Sprintf(LogicDeletedUpdate, update) +} + +func (l *gCurd) genLogicStatusUpdate(ctx context.Context, in *genmodel.CurdPreviewParam) string { + var update string + for _, field := range in.MasterFields { + if field.GoName == "UpdatedBy" { + update += "\t\tdao." + in.In.DaoName + ".Columns().UpdatedBy: contexts.GetUserId(ctx),\n" + } + } + + update += "\t" + return fmt.Sprintf(LogicStatusUpdate, in.In.DaoName, update) +} + +func (l *gCurd) genLogicSwitchUpdate(ctx context.Context, in *genmodel.CurdPreviewParam) string { + var update string + for _, field := range in.MasterFields { + if field.GoName == "UpdatedBy" { + update += "\t\tdao." + in.In.DaoName + ".Columns().UpdatedBy: contexts.GetUserId(ctx),\n" + } + } + + update += "\t" + return fmt.Sprintf(LogicSwitchUpdate, update) +} + +func (l *gCurd) genLogicSwitchFields(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + if in.Options.Step.HasSwitch { + for _, field := range in.MasterFields { + if field.FormMode == "Switch" { + buffer.WriteString("\t\tdao." + in.In.DaoName + ".Columns()." + field.GoName + ",\n") + } + } + } + return buffer.String() +} + +func (l *gCurd) genLogicEdit(ctx context.Context, in *genmodel.CurdPreviewParam) g.Map { + var ( + data = make(g.Map) + updateBuffer = bytes.NewBuffer(nil) + insertBuffer = bytes.NewBuffer(nil) + uniqueBuffer = bytes.NewBuffer(nil) + ) + + for _, field := range in.MasterFields { + if field.GoName == "TenantId" { + insertBuffer.WriteString("\t\ttenantId := contexts.GetTenantId(ctx)\n\t\tin.TenantId = &tenantId\n") + } + if field.GoName == "CreatedDept" { + insertBuffer.WriteString("\t\tcreatedDept := contexts.GetDeptId(ctx)\n\t\tin.CreatedDept = &createdDept\n") + } + if field.GoName == "CreatedAt" { + insertBuffer.WriteString("\t\tin.CreatedAt = gtime.Now()\n") + } + if field.GoName == "CreatedBy" { + insertBuffer.WriteString("\t\tcreatedBy := contexts.GetUserId(ctx)\n\t\tin.CreatedBy = &createdBy\n") + } + if field.GoName == "UpdatedBy" { + updateBuffer.WriteString("\t\tupdatedBy := contexts.GetUserId(ctx)\n\t\tin.UpdatedBy = &updatedBy\n") + } + if field.GoName == "UpdatedAt" { + updateBuffer.WriteString("\t\tin.UpdatedAt = gtime.Now()\n") + } + + if field.Unique { + uniqueBuffer.WriteString(fmt.Sprintf(LogicEditUnique, field.GoName, in.In.DaoName, in.In.DaoName, field.GoName, field.GoName, field.Dc, in.Pk.GoName)) + } + } + + notFilterAuth := "" + if gstr.InArray(in.Options.ColumnOps, "notFilterAuth") { + notFilterAuth = ", &handler.Option{FilterAuth: false}" + } + + updateBuffer.WriteString(fmt.Sprintf(LogicEditUpdate, notFilterAuth, in.Options.TemplateGroup, in.In.VarName, in.Pk.GoName, in.In.TableComment)) + insertBuffer.WriteString(fmt.Sprintf(LogicEditInsert, in.Options.TemplateGroup, in.In.VarName, in.In.TableComment)) + + data["update"] = updateBuffer.String() + data["insert"] = insertBuffer.String() + data["unique"] = uniqueBuffer.String() + return data +} + +func (l *gCurd) genLogicListOrder(ctx context.Context, in *genmodel.CurdPreviewParam) string { + statement := "" + if hasEffectiveJoins(in.Options.Join) { + statement = "dao." + in.In.DaoName + ".Table() + \".\" +" + } + buffer := bytes.NewBuffer(nil) + if in.Options.Step.HasMaxSort { + buffer.WriteString("OrderAsc(" + statement + "dao." + in.In.DaoName + ".Columns().Sort).") + } + buffer.WriteString("OrderDesc(" + statement + "dao." + in.In.DaoName + ".Columns()." + in.Pk.GoName + ")") + return buffer.String() +} + +func (l *gCurd) genLogicListJoin(ctx context.Context, in *genmodel.CurdPreviewParam) (link string) { + connector := `"="` + if hasEffectiveJoins(in.Options.Join) { + linkBuffer := bytes.NewBuffer(nil) + for _, join := range in.Options.Join { + if isEffectiveJoin(join) { + linkBuffer.WriteString("\tmod = mod." + genconsts.GenCodesJoinLinkMap[join.LinkMode] + "OnFields(dao." + join.DaoName + ".Table(), dao." + in.In.DaoName + ".Columns()." + gstr.CaseCamel(join.MasterField) + "," + connector + ", dao." + join.DaoName + ".Columns()." + gstr.CaseCamel(join.Field) + ")\n") + } + } + link = linkBuffer.String() + } + return +} + +func (l *gCurd) genLogicListFields(ctx context.Context, in *genmodel.CurdPreviewParam) (fields string) { + selectBuffer := bytes.NewBuffer(nil) + if hasEffectiveJoins(in.Options.Join) { + selectBuffer.WriteString("mod = mod.FieldsPrefix(dao." + in.In.DaoName + ".Table(), " + in.Options.TemplateGroup + "in." + in.In.VarName + "ListModel{})\n") + for _, join := range in.Options.Join { + if isEffectiveJoin(join) { + selectBuffer.WriteString("mod = mod.Fields(xgorm.JoinFields(ctx, " + in.Options.TemplateGroup + "in." + in.In.VarName + "ListModel{}, &dao." + join.DaoName + ", \"" + join.Alias + "\"))\n") + } + } + fields = selectBuffer.String() + } else { + fields = fmt.Sprintf("mod = mod.Fields(%sin.%sListModel{})", in.Options.TemplateGroup, in.In.VarName) + } + return +} + +func (l *gCurd) genLogicListWhere(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + + // 主表 + l.genLogicListWhereEach(buffer, in, in.MasterFields, in.In.DaoName, "") + // 关联表 + g.Log().Infof(ctx, "genLogicListWhere in.Options.Join: %+v", in.Options.Join) + if hasEffectiveJoins(in.Options.Join) { + for _, v := range in.Options.Join { + if isEffectiveJoin(v) { + l.genLogicListWhereEach(buffer, in, v.Columns, v.DaoName, v.Alias) + } + } + } + return buffer.String() +} + +func (l *gCurd) genLogicListWhereEach(buffer *bytes.Buffer, in *genmodel.CurdPreviewParam, fields []*genmodel.GenCodesColumnListModel, daoName string, alias string) { + isLink := false + if alias != "" { + alias = `"` + alias + `."+` + isLink = true + } + + tablePrefix := "" + wherePrefix := "Where" + if isLink { + wherePrefix = "WherePrefix" + tablePrefix = "dao." + daoName + ".Table(), " + } + + for _, field := range fields { + isQuery := false + // 树表查询上级 + if in.Options.Step.IsTreeTable && IsPidName(field.Name) { + isQuery = true + field.QueryWhere = WMEq + } + + if (!field.IsQuery && !isQuery) || field.QueryWhere == "" { + continue + } + + buffer.WriteString(fmt.Sprintf(LogicWhereComments, field.Dc)) + + var ( + linkMode string + whereTag string + columnName string + ) + + // 查询用户摘要 + if field.IsQuery && in.Options.Step.HasQueryMemberSummary && IsMemberSummaryField(field.Name) { + servicePackName := "service" + if in.Options.Step.IsAddon { + servicePackName = "isc" + } + buffer.WriteString(fmt.Sprintf("if in.%v != \"\" {\n\t\t\t\tids, err := %v.AdminMember().GetIdsByKeyword(ctx, in.%v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, 0, err\n\t\t\t\t}\n\t\t\t\tmod = mod.WhereIn(dao.%v.Columns().%v, ids)\n\t\t\t}\n", field.GoName, servicePackName, field.GoName, in.In.DaoName, field.GoName)) + continue + } + + if IsNumberType(field.GoType) { + linkMode = `in.` + field.GoName + ` > 0` + } else if field.GoType == GoTypeGTime { + linkMode = `in.` + field.GoName + ` != nil` + } else if field.GoType == GoTypeJson { + linkMode = `!in.` + field.GoName + `.IsNil()` + } else { + linkMode = `in.` + field.GoName + ` != ""` + } + + if field.QueryWhere == WMBetween || field.QueryWhere == WMNotBetween { + linkMode = `len(in.` + field.GoName + `) == 2` + } + + // 如果是关联表重新转换字段 + columnName = field.GoName + if isLink { + columnName = gstr.CaseCamel(field.Name) + } + if field.FormMode == FMDateRange { + tmp := "\tif " + linkMode + " {\n\t\tin." + field.GoName + "[1] = in." + field.GoName + "[1].EndOfDay()\n\t}\n" + buffer.WriteString(tmp) + } + + switch field.QueryWhere { + case WMEq: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMNeq: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Not(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMGt: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "GT(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMGte: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "GTE(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMLt: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "LT(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMLte: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "LTE(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMIn: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "In(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMNotIn: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotIn(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMBetween: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Between(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + "[0], in." + field.GoName + "[1])\n\t}" + case WMNotBetween: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotBetween(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + "[0], in." + field.GoName + "[1])\n\t}" + case WMLike: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Like(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMLikeAll: + val := `"%"+in.` + field.GoName + `+"%"` + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Like(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", " + val + ")\n\t}" + case WMNotLike: + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotLike(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}" + case WMJsonContains: + val := tablePrefix + `"JSON_CONTAINS("+dao.` + daoName + `.Columns().` + columnName + `+",?)", in.` + field.GoName + whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "(" + val + ")\n\t}" + + default: + buffer.WriteString(fmt.Sprintf(LogicWhereNoSupport, field.QueryWhere)) + } + + buffer.WriteString(whereTag + "\n") + } +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_model.go b/server/internal/library/xgen/gen_view/gen_curd_model.go new file mode 100644 index 0000000..78427f4 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_model.go @@ -0,0 +1,854 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "bytes" + "context" + "fmt" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" +) + +type StateItem struct { + Name string + DefaultValue interface{} + Dc string +} + +func (l *gCurd) webModelTplData(ctx context.Context, in *genmodel.CurdPreviewParam) (data g.Map, err error) { + data = make(g.Map) + data["stateItems"] = l.genWebModelStateItems(ctx, in) + data["rules"] = l.genWebModelRules(ctx, in) + data["formSchema"] = l.genWebModelFormSchema(ctx, in) + if data["columns"], err = l.genWebModelColumns(ctx, in); err != nil { + return nil, err + } + if data["columnsInterface"], err = l.genWebModelColumnsInterface(ctx, in); err != nil { + return nil, err + } + data["viewSchema"] = l.genWebModelViewSchema(ctx, in) + data["editSchema"] = l.genWebModelEditSchema(ctx, in) + // 根据表单生成情况,按需导包 + data["import"], data["const"] = l.genWebModelImport(ctx, in) + return +} + +func (l *gCurd) genWebModelImport(ctx context.Context, in *genmodel.CurdPreviewParam) (string, string) { + importBuffer := bytes.NewBuffer(nil) + constBuffer := bytes.NewBuffer(nil) + + importBuffer.WriteString(`import { h, ref } from 'vue'; +import { Tag } from 'ant-design-vue'; +import type { VxeGridProps } from '#/adapter/vxe-table'; +import { getPopupContainer } from '@vben/utils'; +import type { DescItem } from '#/components/description'; +`) + + // 导入基础组件 + if len(in.Options.Step.ImportModel.NaiveUI) > 0 { + importBuffer.WriteString("import " + ImportWebMethod(in.Options.Step.ImportModel.NaiveUI) + " from 'ant-design-vue';\n") + } + + importBuffer.WriteString("import { cloneDeep } from 'lodash-es';\n") + + // 导入表单搜索 + if in.Options.Step.HasSearchForm { + importBuffer.WriteString("import type { VbenFormSchema } from '@vben/common-ui';\n") + } + + // 导入工具类 + if len(in.Options.Step.ImportModel.UtilsIs) > 0 { + importBuffer.WriteString("import " + ImportWebMethod(in.Options.Step.ImportModel.UtilsIs) + " from '#/utils/is';\n") + } + + if len(in.Options.Step.ImportModel.UtilsUrl) > 0 { + importBuffer.WriteString("import " + ImportWebMethod(in.Options.Step.ImportModel.UtilsUrl) + " from '#/utils/urlUtils';\n") + } + + if len(in.Options.Step.ImportModel.UtilsDate) > 0 { + // importBuffer.WriteString("import " + ImportWebMethod(in.Options.Step.ImportModel.UtilsDate) + " from '@/utils/dateUtil';\n") + importBuffer.WriteString("import dayjs from 'dayjs';\n") + } + + if in.Options.Step.HasRulesValidator { + importBuffer.WriteString("import { z } from '@vben/common-ui';\n") + } + + if len(in.Options.Step.ImportModel.UtilsIndex) > 0 { + importBuffer.WriteString("import " + ImportWebMethod(in.Options.Step.ImportModel.UtilsIndex) + " from '#/utils';\n") + } + + // 导入api + var importApiMethod []string + if in.Options.Step.HasSwitch { + importApiMethod = append(importApiMethod, "Switch") + } + if in.Options.Step.IsTreeTable { + importApiMethod = append(importApiMethod, "TreeOption") + } + if len(importApiMethod) > 0 { + importBuffer.WriteString("import " + ImportWebMethod(importApiMethod) + " from '" + in.Options.ImportWebApi + "';\n") + } + + // 导入字典选项 + if in.Options.DictOps.Has { + importBuffer.WriteString(`import { DictEnum } from '@vben/constants'; +import { getDictOptions } from '#/utils/dict';`) + constBuffer.WriteString("\n") + } + + if in.Options.Step.HasSwitch { + importBuffer.WriteString("import { usePermission } from '@/hooks/web/usePermission';\n") + constBuffer.WriteString("const { hasPermission } = usePermission();\n") + constBuffer.WriteString("const $message = window['$message'];\n") + } + + return importBuffer.String(), constBuffer.String() +} + +func (l *gCurd) genWebModelStateItems(ctx context.Context, in *genmodel.CurdPreviewParam) (items []*StateItem) { + for _, field := range in.MasterFields { + var value = field.DefaultValue + if value == nil { + value = "null" + } + if value == "" { + value = `''` + } + if value == "NULL" { + value = "null" + } + + // 选项组件默认值调整 + if gconv.Int(value) == 0 && IsSelectFormModel(field.FormMode) { + value = "null" + } + + if field.Name == "status" { + value = 0 + } + if field.FormMode == FMSwitch { + value = 0 + } + if field.FormMode == FMInputDynamic { + value = "[]" + } + items = append(items, &StateItem{ + Name: field.TsName, + DefaultValue: value, + Dc: field.Dc, + }) + + // 查询用户摘要 + if field.IsList && in.Options.Step.HasHookMemberSummary && IsMemberSummaryField(field.Name) { + items = append(items, &StateItem{ + Name: field.TsName + "Summa?: null | MemberSumma", + DefaultValue: "null", + Dc: field.Dc + "摘要信息", + }) + } + } + return +} + +func (l *gCurd) genWebModelDictOptions(ctx context.Context, in *genmodel.CurdPreviewParam) error { + type DictType struct { + DictType string `json:"dictType"` + DictName string `json:"dictName"` + } + + var ( + dictTypeIds []string + dictTypeList []*DictType + builtinDictTypeIds []int64 + builtinDictTypeList []*DictType + ) + + for _, field := range in.MasterFields { + if field.DictType != "" { + dictTypeIds = append(dictTypeIds, field.DictType) + } + + // if field.DictType < 0 { + // builtinDictTypeIds = append(builtinDictTypeIds, field.DictType) + // } + } + + dictTypeIds = utility.UniqueSlice(dictTypeIds) + builtinDictTypeIds = utility.UniqueSlice(builtinDictTypeIds) + + if len(dictTypeIds) == 0 && len(builtinDictTypeIds) == 0 { + return nil + } + + if len(dictTypeIds) > 0 { + err := g.Model("sys_dict_type").Ctx(ctx). + Fields("dict_type", "dict_name"). + WhereIn("dict_type", dictTypeIds). + Scan(&dictTypeList) + if err != nil { + return err + } + } + + // if len(builtinDictTypeIds) > 0 { + // for _, id := range builtinDictTypeIds { + // typ, err := dict.GetTypeById(ctx, id) + // if err != nil && !errors.Is(err, dict.NotExistKeyError) { + // return err + // } + // if len(typ) > 0 { + // row := new(DictType) + // row.Id = id + // row.Type = typ + // builtinDictTypeList = append(builtinDictTypeList, row) + // } + // } + // } + + if len(dictTypeList) == 0 && len(builtinDictTypeList) == 0 { + return nil + } + + if len(builtinDictTypeList) > 0 { + dictTypeList = append(dictTypeList, builtinDictTypeList...) + } + + in.Options.DictOps.Has = true + + for _, v := range dictTypeList { + // 字段映射字典 + for _, field := range in.MasterFields { + if field.DictType != "" && v.DictType == field.DictType { + in.Options.DictMap[field.TsName] = v.DictType + in.Options.DictOps.Schemas = append(in.Options.DictOps.Schemas, &genmodel.OptionsSchemasField{ + Field: field.TsName, + Type: v.DictType, + }) + } + } + in.Options.DictOps.Types = append(in.Options.DictOps.Types, v.DictName) + } + return nil +} + +func (l *gCurd) genWebModelRules(ctx context.Context, in *genmodel.CurdPreviewParam) string { + // buffer := bytes.NewBuffer(nil) + // buffer.WriteString("export const rules = {\n") + // for _, field := range in.MasterFields { + // if !field.IsEdit || (!field.Required && (field.FormRole == "" || field.FormRole == FRNone)) { + // continue + // } + + // in.Options.Step.HasRules = true + // if field.FormRole == "" || field.FormRole == FRNone || field.FormRole == "required" { + // buffer.WriteString(fmt.Sprintf(" %s: {\n required: %v,\n trigger: ['blur', 'input'],\n type: '%s',\n message: '请输入%s',\n },\n", field.TsName, field.Required, field.TsType, field.Dc)) + // } else { + // in.Options.Step.HasRulesValidator = true + // buffer.WriteString(fmt.Sprintf(" %s: {\n required: %v,\n trigger: ['blur', 'input'],\n type: '%s',\n validator: validate.%v,\n },\n", field.TsName, field.Required, field.TsType, field.FormRole)) + // } + // } + // buffer.WriteString("};\n") + // return buffer.String() + return "" +} + +func (l *gCurd) genWebModelFormSchema(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + buffer.WriteString("export const querySchema: VbenFormSchema[] = [\n") + + // 主表 + l.genWebModelFormSchemaEach(buffer, in.MasterFields, in, false) + + // 关联表 + if len(in.Options.Join) > 0 { + for _, v := range in.Options.Join { + if !isEffectiveJoin(v) { + continue + } + l.genWebModelFormSchemaEach(buffer, v.Columns, in, false) + } + } + + buffer.WriteString("];\n") + return buffer.String() +} + +// genWebDictOption 生产字典选项 +func (l *gCurd) genWebDictOption(typ any) string { + return fmt.Sprintf(`getDictOptions('%v')`, typ) +} + +func (l *gCurd) genWebModelFormSchemaEach(buffer *bytes.Buffer, fields []*genmodel.GenCodesColumnListModel, in *genmodel.CurdPreviewParam, isEdit bool) { + for _, field := range fields { + if isEdit { + if !field.IsEdit && field.Name != in.Pk.Name { + continue + } + if field.Name == in.Pk.Name { + buffer.WriteString(fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + dependencies: { show: () => false, triggerFields: [''], }, + componentProps: { + placeholder: '', + onUpdateValue: (e: any) => { + console.log(e); + }, + }, + formItemClass: 'col-span-%d', + },`, field.TsName, "Input", field.Dc, field.FormGridSpan)) + + continue + } + } else { + if !field.IsQuery { + continue + } + } + rules := "null" + if field.IsEdit { + if field.Required { + if field.FormMode == FMInputNumber { + rules = fmt.Sprintf("z.number({required_error: '请输入%s', invalid_type_error: '无效数字'})", field.Dc) + in.Options.Step.HasRulesValidator = true + } else if field.FormMode == FMSelect || field.FormMode == FMSelectMultiple || field.FormMode == FMCheckbox || field.FormMode == FMDate || field.FormMode == FMDateRange || field.FormMode == FMTime || field.FormMode == FMTimeRange { + rules = "'selectRequired'" + } else { + rules = "'required'" + } + } + } + if field.FormRole != "" { + in.Options.Step.HasRulesValidator = true + if field.FormRole == FRNum { + rules = fmt.Sprintf("z.number({required_error: '请输入%s', invalid_type_error: '无效数字'} )", field.Dc) + } + if field.FormRole == FRIp { + rules = "z.string().ip({message: '无效IP格式'})" + } + if field.FormRole == FRPhone { + rules = "z.string().regex(/^1[3-9]\\d{9}$/, '无效手机号格式')" + } + if field.FormRole == FRTel { + rules = "z.string().regex(/^(?:\\+?\\d{1,3}[-.\\s]?)?(?:$?\\d{1,4}$?[-.\\s]?)?\\d{1,4}[-.\\s]?\\d{1,4}[-.\\s]?\\d{1,9}$/, '无效手机号格式')" + } + if field.FormRole == FRPercentage { + rules = fmt.Sprintf("z.number({required_error: '请输入%s', invalid_type_error: '无效百分比'}).min(0).max(100)", field.Dc) + } + if field.FormRole == FRQq { + rules = "z.string().regex(/^[1-9]\\d{4,}$/, '无效QQ号格式')" + } + if field.FormRole == FRAmount { + rules = "z.number({required_error: '必填', invalid_type_error: '无效金额'} ).min(0)" + } + if field.FormRole == FRBankCard { + rules = "z.string().regex(/^[1-9]\\d{4,}$/, '无效银行卡号格式')" + } + if field.FormRole == FRWeibo { + rules = "z.string().regex(/^[1-9]\\d{4,}$/, '无效微博号格式')" + } + if field.FormRole == FRUserName { + rules = "z.string().regex(/^[a-zA-Z0-9_]+$/, '无效用户名格式')" + } + if field.FormRole == FRPassword { + rules = "z.string().regex(/^[a-zA-Z0-9_]+$/, '无效密码格式')" + } + if field.FormRole == FRAccount { + rules = "z.string().regex(/^[a-zA-Z0-9_]+$/, '无效账号格式')" + } + if field.FormRole == FRIdCard { + rules = "z.string().regex(/^[1-9]\\d{4,}$/, '无效身份证号格式')" + } + if field.FormRole == FREmail { + rules = "z.string().email('无效邮箱格式')" + } + } + + in.Options.Step.HasSearchForm = true + + // 查询用户摘要 + if field.IsQuery && in.Options.Step.HasQueryMemberSummary && IsMemberSummaryField(field.Name) { + buffer.WriteString(fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + placeholder: '请输入ID|用户名|姓名|手机号', + onUpdateValue: (e: any) => { + console.log(e); + }, + }, + rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "Input", field.Dc, rules, field.FormGridSpan)) + + continue + } + + var ( + defaultComponent = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + placeholder: '请输入%s', + onUpdateValue: (e: any) => { + console.log(e); + }, + }, + rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "Input", field.Dc, field.Dc, rules, field.FormGridSpan) + component string + ) + + // 这里根据编辑表单组件来进行推断,如果没有则使用默认input,这可能会导致和查询条件所需参数不符的情况 + switch field.FormMode { + case FMInput, FMInputTextarea, FMInputEditor: + component = defaultComponent + + case FMInputNumber: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + placeholder: '请输入%s', + onUpdateValue: (e: any) => { + console.log(e); + }, + }, rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "InputNumber", field.Dc, field.Dc, rules, field.FormGridSpan) + case FMDate: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + type: '%s', + clearable: true, + onUpdateValue: (e: any) => { + console.log(e); + }, + }, rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "DatePicker", field.Dc, "date", rules, field.FormGridSpan) + + case FMDateRange: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + type: '%s', + clearable: true, + valueFormat: %s, + onUpdateValue: (e: any) => { + console.log(e); + }, + }, rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "RangePicker", field.Dc, "datetimerange", "'YYYY-MM-DD HH:mm:ss'", rules, field.FormGridSpan) + + case FMTime: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + type: '%s', + clearable: true, + showTime: true, + onUpdateValue: (e: any) => { + console.log(e); + }, + }, rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "DatePicker", field.Dc, "datetime", rules, field.FormGridSpan) + + case FMTimeRange: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + type: '%s', + clearable: true, + showTime: true, + onUpdateValue: (e: any) => { + console.log(e); + }, + }, rules:%v, + formItemClass: 'col-span-%d', + },`, field.TsName, "RangePicker", field.Dc, "datetimerange", rules, field.FormGridSpan) + + case FMSwitch: + fallthrough + case FMRadio: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + options: %v + }, + rules:%v, + formItemClass: 'col-span-%d', + }, + `, field.TsName, "RadioGroup", field.Dc, l.genWebDictOption(in.Options.DictMap[field.TsName]), rules, field.FormGridSpan) + + case FMCheckbox: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + componentProps: { + placeholder: '请选择%s', + options: %v + }, + rules:%v, + formItemClass: 'col-span-%d', + }, + `, field.TsName, "CheckboxGroup", field.Dc, field.Dc, + l.genWebDictOption(in.Options.DictMap[field.TsName]), rules, field.FormGridSpan) + + case FMSelect: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + defaultValue: null, + componentProps: { + placeholder: '请选择%s', + options: %v, + onUpdateValue: (e: any) => { + console.log(e); + }, + }, + rules:%v, + formItemClass: 'col-span-%d', + }, + `, field.TsName, "Select", field.Dc, field.Dc, l.genWebDictOption(in.Options.DictMap[field.TsName]), rules, field.FormGridSpan) + + case FMSelectMultiple: + component = fmt.Sprintf(` { + fieldName: '%s', + component: '%s', + label: '%s', + defaultValue: null, + componentProps: { + mode: 'multiple', + placeholder: '请选择%s', + options: %v, + onUpdateValue: (e: any) => { + console.log(e); + }, + }, + rules:%v, + formItemClass: 'col-span-%d', + }, + `, field.TsName, "Select", field.Dc, field.Dc, l.genWebDictOption(in.Options.DictMap[field.TsName]), rules, field.FormGridSpan) + + default: + component = defaultComponent + } + + buffer.WriteString(component) + } +} + +func (l *gCurd) genWebModelColumns(ctx context.Context, in *genmodel.CurdPreviewParam) (string, error) { + buffer := bytes.NewBuffer(nil) + buffer.WriteString("export const columns: VxeGridProps['columns'] = [\n") + + // 主表 + if err := l.genWebModelColumnsEach(buffer, in, in.MasterFields); err != nil { + return "", err + } + + // 关联表 + if len(in.Options.Join) > 0 { + for _, v := range in.Options.Join { + if !isEffectiveJoin(v) { + continue + } + if err := l.genWebModelColumnsEach(buffer, in, v.Columns); err != nil { + return "", err + } + } + } + buffer.WriteString(" { title: '操作', width: 120, slots: { default: 'action' } },\n") + buffer.WriteString("];\n") + return buffer.String(), nil +} + +func (l *gCurd) genWebModelColumnsInterface(ctx context.Context, in *genmodel.CurdPreviewParam) (string, error) { + buffer := bytes.NewBuffer(nil) + buffer.WriteString("export interface RowType {\n") + + // 主表 + for _, field := range in.MasterFields { + buffer.WriteString(fmt.Sprintf(" %s: %s;\n", field.TsName, field.TsType)) + } + + // 关联表 + if len(in.Options.Join) > 0 { + for _, v := range in.Options.Join { + if !isEffectiveJoin(v) { + continue + } + for _, field := range v.Columns { + buffer.WriteString(fmt.Sprintf(" %s: %s;\n", field.TsName, field.TsType)) + } + } + } + buffer.WriteString("};\n") + return buffer.String(), nil +} + +func (l *gCurd) genWebModelViewSchema(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + buffer.WriteString("export const viewSchema: DescItem[] = [\n") + + // 主表 + for _, field := range in.MasterFields { + l.genWebModelViewSchemaEach(buffer, []*genmodel.GenCodesColumnListModel{field}, in) + } + + // 关联表 + if len(in.Options.Join) > 0 { + for _, v := range in.Options.Join { + if !isEffectiveJoin(v) { + continue + } + for _, field := range v.Columns { + l.genWebModelViewSchemaEach(buffer, []*genmodel.GenCodesColumnListModel{field}, in) + } + } + } + buffer.WriteString("];\n") + return buffer.String() +} + +func (l *gCurd) genWebModelEditSchema(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + buffer.WriteString("export const editSchema: VbenFormSchema[] = [\n") + + // 主表 + for _, field := range in.MasterFields { + + l.genWebModelFormSchemaEach(buffer, []*genmodel.GenCodesColumnListModel{field}, in, true) + } + + // 关联表 + if len(in.Options.Join) > 0 { + for _, v := range in.Options.Join { + if !isEffectiveJoin(v) { + continue + } + for _, field := range v.Columns { + l.genWebModelFormSchemaEach(buffer, []*genmodel.GenCodesColumnListModel{field}, in, true) + } + } + } + buffer.WriteString("];\n") + return buffer.String() +} + +func (l *gCurd) genWebModelColumnsEach(buffer *bytes.Buffer, in *genmodel.CurdPreviewParam, fields []*genmodel.GenCodesColumnListModel) (err error) { + for _, field := range fields { + if !field.IsList { + continue + } + + if field.Name == in.Pk.Name { + buffer.WriteString(fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n type: 'checkbox',\n },\n", field.Dc, field.TsName, field.Align, field.Width)) + continue + } + var ( + defaultComponent = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n },\n", field.Dc, field.TsName, field.Align, field.Width) + component string + ) + + // 查询用户摘要 + if in.Options.Step.HasHookMemberSummary && IsMemberSummaryField(field.Name) { + buffer.WriteString(fmt.Sprintf(" {\n title: '%v',\n field: '%v',\n align: '%v',\n width: %v,\n slots: {\n default: ({ row }) => {\n return renderPopoverMemberSumma(row.%vSumma);\n },\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName)) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, []string{"renderPopoverMemberSumma", "type MemberSumma"}...) + continue + } + + // 这里根据编辑表单组件来进行推断,如果没有则使用默认input,这可能会导致和查询条件所需参数不符的情况 + switch field.FormMode { + case FMDate: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return formatDateTime(row.%s);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.Options.Step.ImportModel.UtilsDate = append(in.Options.Step.ImportModel.UtilsDate, "formatToDate") + + case FMRadio: + fallthrough + case FMSelect: + + if g.IsEmpty(in.Options.DictMap[field.TsName]) { + g.Log().Infof(context.Background(), "server/internal/library/xgen/gen_curd_model.go genWebModelColumnsEach in.Options.DictMap:%+v", in.Options.DictMap) + err = gerror.Newf("设置单选下拉框选项时,必须选择字典类型,字段名称:%v", field.Name) + return + } + + component = fmt.Sprintf(` { + title: '%s', field: '%s', align: '%v', width: %v, + slots: { + default: ({ row }) => { + return renderDict(row.%v, '%v'); + } + }, + }, + `, + field.Dc, field.TsName, field.Align, field.Width, field.TsName, in.Options.DictMap[field.TsName]) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderDict") + + case FMSelectMultiple: + if g.IsEmpty(in.Options.DictMap[field.TsName]) { + err = gerror.Newf("设置多选下拉框选项时,必须选择字典类型,字段名称:%v", field.Name) + return + } + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n if (isNullObject(row.%s) || !isArray(row.%s)) {\n return ``;\n }\n return row.%s.map((tagKey) => {\n return renderOptionTag('%s', row.tagKey)\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName, field.TsName, field.TsName, in.Options.DictMap[field.TsName]) + in.Options.Step.ImportModel.NaiveUI = append(in.Options.Step.ImportModel.NaiveUI, "NTag") + in.Options.Step.ImportModel.UtilsIs = append(in.Options.Step.ImportModel.UtilsIs, "isNullObject") + + case FMUploadImage: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderImage(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderImage") + + case FMUploadImages: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderImageGroup(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderImageGroup") + + case FMUploadFile: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderFile(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderFile") + + case FMUploadFiles: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderFileGroup(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderFileGroup") + + case FMSwitch: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return h(%s, {\n value: row.%s === 1,\n checked: '开启',\n unchecked: '关闭',\n disabled: !hasPermission(['%s']),\n onUpdateValue: function (e) {\n console.log('onUpdateValue e:' + JSON.stringify(e));\n row.%s = e ? 1 : 2;\n Switch({ %s: row.%s, key: '%s', value: row.%s }).then((_res) => {\n $message.success('操作成功');\n });\n },\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, "NSwitch", field.TsName, "/"+in.Options.ApiPrefix+"/switch", field.TsName, in.Pk.TsName, in.Pk.TsName, CamelCaseToUnderline(field.TsName), field.TsName) + in.Options.Step.ImportModel.NaiveUI = append(in.Options.Step.ImportModel.NaiveUI, "NSwitch") + + case FMRate: + component = fmt.Sprintf(" {\n title: '%s',\n field: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return h(%s, {\n allowHalf: true,\n readonly: true,\n defaultValue: row.%s,\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, "NRate", field.TsName) + in.Options.Step.ImportModel.NaiveUI = append(in.Options.Step.ImportModel.NaiveUI, "NRate") + + default: + component = defaultComponent + } + + buffer.WriteString(component) + } + return +} + +func (l *gCurd) genWebModelViewSchemaEach(buffer *bytes.Buffer, fields []*genmodel.GenCodesColumnListModel, in *genmodel.CurdPreviewParam) { + for _, field := range fields { + + if field.Name == in.Pk.Name { + tmp := fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + buffer.WriteString(tmp) + continue + } + + // 查询用户摘要 + if field.IsQuery && in.Options.Step.HasQueryMemberSummary && IsMemberSummaryField(field.Name) { + tmp := fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + buffer.WriteString(tmp) + continue + } + + var ( + defaultComponent = fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + component string + ) + + // 这里根据编辑表单组件来进行推断,如果没有则使用默认input,这可能会导致和查询条件所需参数不符的情况 + switch field.FormMode { + case FMInput, FMInputTextarea, FMInputEditor: + component = defaultComponent + + case FMInputNumber: + component = fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + + case FMDate: + component = fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + + case FMDateRange: + component = fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + + case FMTime: + component = fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + + case FMTimeRange: + component = fmt.Sprintf(" { field: '%s', label: '%s'},\n", field.TsName, field.Dc) + + case FMSwitch: + fallthrough + case FMRadio: + component = fmt.Sprintf(` { + field: '%s', + label: '%s', + render(row: any) { + return renderDict(row.%s, '%v'); + }, + }, + `, field.TsName, field.Dc, field.TsName, in.Options.DictMap[field.TsName]) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderDict") + + case FMCheckbox: + component = fmt.Sprintf(` { + field: '%s', + label: '%s', + render(row: any) { + return renderDictTags(row.%s, '%v'); + }, + }, + `, field.TsName, field.Dc, field.TsName, in.Options.DictMap[field.TsName]) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderDictTags") + + case FMSelect: + component = fmt.Sprintf(` { + field: '%s', + label: '%s', + render(row: any) { + return renderDict(row.%s, '%v'); + }, + }, + `, field.TsName, field.Dc, field.TsName, in.Options.DictMap[field.TsName]) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderDict") + + case FMSelectMultiple: + component = fmt.Sprintf(` { + field: '%s', + label: '%s', + render(row: any) { + return renderDictTags(row.%s, '%v'); + }, + }, + `, field.TsName, field.Dc, field.TsName, in.Options.DictMap[field.TsName]) + in.Options.Step.ImportModel.UtilsIndex = append(in.Options.Step.ImportModel.UtilsIndex, "renderDictTags") + + default: + component = defaultComponent + } + + buffer.WriteString(component) + } +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_web_edit.go b/server/internal/library/xgen/gen_view/gen_curd_web_edit.go new file mode 100644 index 0000000..fb31f0c --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_web_edit.go @@ -0,0 +1,219 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "bytes" + "context" + "fmt" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/text/gstr" +) + +func (l *gCurd) webEditTplData(ctx context.Context, in *genmodel.CurdPreviewParam) (data g.Map, err error) { + data = make(g.Map) + data["formItem"] = l.genWebEditFormItem(ctx, in) + data["script"] = l.genWebEditScript(ctx, in) + data["isEditModal"] = in.Options.Step.IsEditModal + return +} + +func (l *gCurd) genWebEditFormItem(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + for _, field := range in.MasterFields { + if !field.IsEdit { + continue + } + + if IsIndexPK(field.Index) { + continue + } + + var ( + defaultComponent = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.Dc, field.TsName) + component string + ) + + if in.Options.Step.IsTreeTable && IsPidName(field.Name) { + field.FormMode = FMPidTreeSelect + } + + switch field.FormMode { + case FMInput: + component = defaultComponent + + case FMInputNumber: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.Dc, field.TsName) + + case FMInputTextarea: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.Dc, field.TsName) + + case FMInputEditor: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName, field.TsName) + + case FMInputDynamic: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + case FMDate: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + // case FMDateRange: // 必须要有两个字段,后面优化下 + + case FMTime: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + // case FMTimeRange: // 必须要有两个字段,后面优化下 + + case FMRadio: + component = fmt.Sprintf("\n \n \n \n ", field.Dc, field.TsName, field.TsName, field.TsName, field.TsName, in.Options.DictMap[field.TsName], field.TsName, field.TsName, field.TsName) + + case FMCheckbox: + component = fmt.Sprintf("\n \n \n \n \n \n ", field.Dc, field.TsName, field.TsName, in.Options.DictMap[field.TsName]) + + case FMSelect: + if in.Options.DictMap[field.TsName] != nil { + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName, in.Options.DictMap[field.TsName]) + } else { + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + } + + case FMSelectMultiple: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName, in.Options.DictMap[field.TsName]) + + case FMUploadImage: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + case FMUploadImages: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + case FMUploadFile: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + case FMUploadFiles: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + case FMSwitch: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + + case FMRate: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName, field.GoName) + + case FMCitySelector: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, field.TsName) + case FMPidTreeSelect: + component = fmt.Sprintf(` + + `, field.Dc, in.Pk.TsName, in.Options.Tree.TitleField.TsName) + case FMTreeSelect: + component = fmt.Sprintf(` + + `, field.Dc, field.TsName, field.Dc, field.TsName) + case FMCascader: + component = fmt.Sprintf(` + + `, field.Dc, field.TsName, field.Dc, field.TsName) + default: + component = defaultComponent + } + + buffer.WriteString(fmt.Sprintf("%v\n\n", field.FormGridSpan, component)) + } + return buffer.String() +} + +func (l *gCurd) genWebEditScript(ctx context.Context, in *genmodel.CurdPreviewParam) g.Map { + var ( + data = make(g.Map) + importBuffer = bytes.NewBuffer(nil) + setupBuffer = bytes.NewBuffer(nil) + ) + + importBuffer.WriteString(" import { ref, computed } from 'vue';\n") + + // 导入字典 + if in.Options.DictOps.Has { + importBuffer.WriteString(" import { useDictStore } from '@/store/modules/dict';\n") + } + + // 导入api + var importApiMethod = []string{"Edit", "View"} + if in.Options.Step.HasMaxSort { + importApiMethod = append(importApiMethod, "MaxSort") + } + importBuffer.WriteString(" import " + ImportWebMethod(importApiMethod) + " from '" + in.Options.ImportWebApi + "';\n") + + // 导入model + var importModelMethod = []string{"State", "newState"} + if in.Options.Step.IsTreeTable { + importModelMethod = append(importModelMethod, []string{"treeOption", "loadTreeOption"}...) + } + + if in.Options.Step.HasRules { + importModelMethod = append(importModelMethod, "rules") + } + importBuffer.WriteString(" import " + ImportWebMethod(importModelMethod) + " from './model';\n") + + for _, field := range in.MasterFields { + if !field.IsEdit { + continue + } + switch field.FormMode { + case FMDate, FMDateRange, FMTime, FMTimeRange: + if !gstr.Contains(importBuffer.String(), `import DatePicker`) { + importBuffer.WriteString(" import DatePicker from '@/components/DatePicker/datePicker.vue';\n") + } + case FMInputEditor: + if !gstr.Contains(importBuffer.String(), `import Editor`) { + importBuffer.WriteString(" import Editor from '@/components/Editor/editor.vue';\n") + } + case FMUploadImage, FMUploadImages: + if !gstr.Contains(importBuffer.String(), `import UploadImage`) { + importBuffer.WriteString(" import UploadImage from '@/components/Upload/uploadImage.vue';\n") + } + case FMUploadFile, FMUploadFiles: + if !gstr.Contains(importBuffer.String(), `import UploadFile`) { + importBuffer.WriteString(" import UploadFile from '@/components/Upload/uploadFile.vue';\n") + } + case FMRate: + setupBuffer.WriteString(fmt.Sprintf(" function update%s(num) {\n formValue.value.%s = num;\n }\n", field.GoName, field.TsName)) + case FMCitySelector: + if !gstr.Contains(importBuffer.String(), `import CitySelector`) { + importBuffer.WriteString(" import CitySelector from '@/components/CitySelector/citySelector.vue';\n") + } + } + } + + data["import"] = importBuffer.String() + data["setup"] = setupBuffer.String() + if in.Options.PresetStep != nil { + data["formGridSpan"] = in.Options.PresetStep.FormGridCols + } + return data +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_web_index.go b/server/internal/library/xgen/gen_view/gen_curd_web_index.go new file mode 100644 index 0000000..44d9c8c --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_web_index.go @@ -0,0 +1,179 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "bytes" + "context" + + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/frame/g" +) + +func (l *gCurd) webIndexTplData(ctx context.Context, in *genmodel.CurdPreviewParam) (g.Map, error) { + var ( + data = make(g.Map) + importBuffer = bytes.NewBuffer(nil) + importVueMethod = []string{"h", "reactive", "ref", "computed"} + importApiMethod = []string{"List"} + importModelMethod = []string{"columns", "querySchema", "type RowType"} + importUtilsMethod = []string{"adaTableScrollX"} + importIcons []string + actionWidth int64 = 72 + ) + + // 添加 MdiPlus, MdiDelete,MdiExport + if in.Options.Step.HasAdd { + importIcons = append(importIcons, "MdiPlus") + } + + // 编辑 + if in.Options.Step.HasEdit { + in.Options.Step.ActionColumnWidth += actionWidth + if in.Options.Step.IsTreeTable && !in.Options.Step.IsOptionTreeTable { + in.Options.Step.ActionColumnWidth += actionWidth + } + if in.Options.Step.IsOptionTreeTable { + importIcons = append(importIcons, "MdiEdit") + } + } + + // 导出 + if in.Options.Step.HasExport { + importIcons = append(importIcons, "MdiExport") + importApiMethod = append(importApiMethod, "Export") + } + + // 删除 + if in.Options.Step.HasDel { + importApiMethod = append(importApiMethod, "Delete") + in.Options.Step.ActionColumnWidth += actionWidth + } + + // 批量删除 + if in.Options.Step.HasBatchDel { + importIcons = append(importIcons, "MdiDelete") + importApiMethod = append(importApiMethod, "Delete") + } + + // 修改状态 + if in.Options.Step.HasStatus { + importApiMethod = append(importApiMethod, "Status") + in.Options.Step.ActionColumnWidth += actionWidth + } + + // 更多 + // 查看详情 + if in.Options.Step.HasView { + in.Options.Step.ActionColumnWidth += actionWidth + } + + // 展开树 + if in.Options.Step.IsTreeTable { + // importIcons = append(importIcons, "MdiExport") + } + + // 存在字典数据选项 + if in.Options.DictOps.Has { + importVueMethod = append(importVueMethod, "onMounted") + // importModelMethod = append(importModelMethod, "loadOptions") + } + + // 普通树表 + if in.Options.Step.IsTreeTable && !in.Options.Step.IsOptionTreeTable { + importUtilsMethod = append(importUtilsMethod, "convertListToTree") + } + + // 选项式树表 + if in.Options.Step.IsOptionTreeTable { + importVueMethod = append(importVueMethod, []string{"onMounted", "unref"}...) + // importIcons = append(importIcons, []string{"FormOutlined", "SearchOutlined"}...) + importApiMethod = append(importApiMethod, "TreeOption") + importUtilsMethod = append(importUtilsMethod, "getTreeKeys") + importModelMethod = append(importModelMethod, []string{"loadTreeOption", "treeOption", "State"}...) + } + + // 操作按钮宽度最小值 + if in.Options.Step.ActionColumnWidth > 0 && in.Options.Step.ActionColumnWidth < actionWidth*2 { + in.Options.Step.ActionColumnWidth = 100 + } + + // 导入基础包 + importBuffer.WriteString(" import " + ImportWebMethod(importVueMethod) + " from 'vue';\n") + importBuffer.WriteString(" import { Button, message,Tag, Modal, Popconfirm,Switch } from 'ant-design-vue';\n") + importBuffer.WriteString(" import type { VbenFormProps } from '#/adapter/form';\n") + importBuffer.WriteString(" import type { VxeTableGridOptions, VxeGridListeners } from '#/adapter/vxe-table';\n") + importBuffer.WriteString(" import type { DeepPartial } from '@vben/types';\n") + importBuffer.WriteString(" import { getVxePopupContainer } from '@vben/utils';\n") + importBuffer.WriteString(" import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';\n") + importBuffer.WriteString(" import { useVbenVxeGrid } from '#/adapter/vxe-table';\n") + importBuffer.WriteString(" import { AccessControl, useAccess } from '@vben/access';\n") + importBuffer.WriteString(" const { hasAccessByCodes } = useAccess();\n") + if in.Options.Step.HasExport { + importBuffer.WriteString(" import { commonDownloadExcel } from '#/utils/file/download';\n") + } + + // 导入字典 + if in.Options.DictOps.Has { + // importBuffer.WriteString(" import { useDictStore } from '@/store/modules/dict';\n") + } + + // 导入api + importBuffer.WriteString(" import " + ImportWebMethod(importApiMethod) + " from '" + in.Options.ImportWebApi + "';\n") + + // 导入icons + if len(importIcons) > 0 { + importBuffer.WriteString(" import " + ImportWebMethod(importIcons) + " from '@vben/icons';\n") + } + + // 导入model + if in.Options.Step.IsTreeTable { + importModelMethod = append(importModelMethod, "newState") + } + importBuffer.WriteString(" import " + ImportWebMethod(importModelMethod) + " from './model';\n") + + // 导入utils + if len(importUtilsMethod) > 0 { + // importBuffer.WriteString(" import " + ImportWebMethod(importUtilsMethod) + " from '@/utils/xjadmin';\n") + } + + // 导入edit组件 + if in.Options.Step.HasEdit { + importBuffer.WriteString(" import editDrawer from './edit.vue';\n") + } + + // 导入view组件 + if in.Options.Step.HasView { + importBuffer.WriteString(" import viewDrawer from './view.vue';\n") + } + + // 没有需要查询的字段则隐藏搜索表单 + isSearchForm := false + for _, field := range in.MasterFields { + if field.IsQuery { + isSearchForm = true + break + } + } + if !isSearchForm { + if len(in.Options.Join) > 0 { + LoopOut: + for _, v := range in.Options.Join { + for _, column := range v.Columns { + if column.IsQuery { + isSearchForm = true + break LoopOut + } + } + } + } + } + data["isSearchForm"] = isSearchForm + data["import"] = importBuffer.String() + data["isEditModal"] = in.Options.Step.IsEditModal + return data, nil +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_web_model.go b/server/internal/library/xgen/gen_view/gen_curd_web_model.go new file mode 100644 index 0000000..3ee5f21 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_web_model.go @@ -0,0 +1,97 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "context" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility" + + "github.com/gogf/gf/v2/frame/g" +) + +func (l *gCurd) generateWebModelDictOptions(ctx context.Context, in *genmodel.CurdPreviewParam) error { + type DictType struct { + DictType string `json:"dictType"` + DictName string `json:"dictName"` + } + + var ( + dictTypeIds []string + dictTypeList []*DictType + builtinDictTypeIds []int64 + builtinDictTypeList []*DictType + ) + + for _, field := range in.MasterFields { + if field.DictType != "" { + dictTypeIds = append(dictTypeIds, field.DictType) + g.Log().Debugf(context.Background(), "curd_generate_web_model.go generateWebModelDictOptions in.masterFields:%+v", field) + } + + // if field.DictType < 0 { + // builtinDictTypeIds = append(builtinDictTypeIds, field.DictType) + // } + } + g.Log().Debugf(context.Background(), "curd_generate_web_model.go generateWebModelDictOptions dictTypeIds:%+v", dictTypeIds) + dictTypeIds = utility.UniqueSlice(dictTypeIds) + builtinDictTypeIds = utility.UniqueSlice(builtinDictTypeIds) + g.Log().Debugf(context.Background(), "curd_generate_web_model.go generateWebModelDictOptions dictTypeIds:%+v", dictTypeIds) + // g.Log().Debugf(context.Background(), "curd_generate_web_model.go generateWebModelDictOptions builtinDictTypeIds:%+v", builtinDictTypeIds) + if len(dictTypeIds) == 0 && len(builtinDictTypeIds) == 0 { + return nil + } + + if len(dictTypeIds) > 0 { + err := g.Model("sys_dict_type").Ctx(ctx). + Fields("dict_type", "dict_name"). + WhereIn("dict_type", dictTypeIds). + Scan(&dictTypeList) + if err != nil { + return err + } + } + g.Log().Debugf(context.Background(), "curd_generate_web_model.go generateWebModelDictOptions dictTypeList:%+v", dictTypeList) + // if len(builtinDictTypeIds) > 0 { + // for _, id := range builtinDictTypeIds { + // typ, err := dict.GetTypeById(ctx, id) + // if err != nil && !errors.Is(err, dict.NotExistKeyError) { + // return err + // } + // if len(typ) > 0 { + // row := new(DictType) + // row.Id = id + // row.Type = typ + // builtinDictTypeList = append(builtinDictTypeList, row) + // } + // } + // } + + if len(dictTypeList) == 0 && len(builtinDictTypeList) == 0 { + return nil + } + + if len(builtinDictTypeList) > 0 { + dictTypeList = append(dictTypeList, builtinDictTypeList...) + } + + in.Options.DictOps.Has = true + + for _, v := range dictTypeList { + // 字段映射字典 + for _, field := range in.MasterFields { + if field.DictType != "" && v.DictType == field.DictType { + in.Options.DictMap[field.TsName] = v.DictType + in.Options.DictOps.Schemas = append(in.Options.DictOps.Schemas, &genmodel.OptionsSchemasField{ + Field: field.TsName, + Type: v.DictType, + }) + } + } + in.Options.DictOps.Types = append(in.Options.DictOps.Types, v.DictName) + } + return nil +} diff --git a/server/internal/library/xgen/gen_view/gen_curd_web_view.go b/server/internal/library/xgen/gen_view/gen_curd_web_view.go new file mode 100644 index 0000000..bb81d66 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_curd_web_view.go @@ -0,0 +1,79 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "bytes" + "context" + "fmt" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + + "github.com/gogf/gf/v2/frame/g" +) + +func (l *gCurd) webViewTplData(ctx context.Context, in *genmodel.CurdPreviewParam) (data g.Map, err error) { + data = make(g.Map) + data["item"] = l.generateWebViewItem(ctx, in) + return +} + +func (l *gCurd) generateWebViewItem(ctx context.Context, in *genmodel.CurdPreviewParam) string { + buffer := bytes.NewBuffer(nil) + for _, field := range in.MasterFields { + if !field.IsEdit { + continue + } + + var ( + defaultComponent = fmt.Sprintf("\n \n {{ formValue.%s }}\n ", field.Dc, field.TsName) + component string + ) + + switch field.FormMode { + case FMInputTextarea, FMInputEditor: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName) + + case FMInputDynamic: + component = defaultComponent + + case FMDate: + component = defaultComponent + + case FMTime: + component = defaultComponent + + case FMRadio, FMSelect: + component = fmt.Sprintf("\n {{ dict.getLabel('%s', formValue.%s) }}\n ", field.Dc, in.Options.DictMap[field.TsName], field.TsName, in.Options.DictMap[field.TsName], field.TsName) + + case FMCheckbox, FMSelectMultiple: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName, in.Options.DictMap[field.TsName], in.Options.DictMap[field.TsName]) + + case FMUploadImage: + component = fmt.Sprintf("\n \n ", field.Dc, field.TsName) + + case FMUploadImages: + component = fmt.Sprintf("\n \n \n \n \n \n \n \n \n ", field.Dc, field.TsName) + + case FMUploadFile: + component = fmt.Sprintf("\n \n
\n
\n
\n
\n {{ getFileExt(formValue.%s) }}\n
\n
\n
\n
\n
", field.Dc, field.TsName, field.TsName, field.TsName) + + case FMUploadFiles: + component = fmt.Sprintf("\n \n
\n \n \n
\n
\n {{\n getFileExt(item)\n }}\n
\n
\n
\n \n \n
", field.Dc, field.TsName) + + case FMSwitch: + component = fmt.Sprintf("\n ", field.Dc, field.TsName) + + case FMRate: + component = fmt.Sprintf("", field.Dc, field.TsName) + + default: + component = defaultComponent + } + + buffer.WriteString(" " + component + "\n\n") + } + return buffer.String() +} diff --git a/server/internal/library/xgen/gen_view/gen_util.go b/server/internal/library/xgen/gen_view/gen_util.go new file mode 100644 index 0000000..1d0b4d7 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gen_util.go @@ -0,0 +1,334 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package genview + +import ( + "context" + "fmt" + "os" + "regexp" + "strings" + "unicode" + + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/mcache" + genmodel "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_model" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen/gen_view/gohtml" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service" + "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility" + version "git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/version" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/text/gregex" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" + "golang.org/x/tools/imports" +) + +func replaceEmptyLinesWithSpace(input string) string { + re := regexp.MustCompile(`\n\s*\n`) + result := re.ReplaceAllString(input, "\n\n") + return result +} + +func FormatTs(code string) string { + code = replaceEmptyLinesWithSpace(code) + return code + "\n" +} + +func ToTSArray(vs []string) string { + formattedStrings := make([]string, len(vs)) + for i, str := range vs { + formattedStrings[i] = fmt.Sprintf("'%s'", str) + } + return fmt.Sprintf("[%s]", strings.Join(formattedStrings, ", ")) +} + +func DictToTSArray(vs []string) string { + formattedStrings := make([]string, len(vs)) + formattedObjStrings := make([]string, len(vs)) + for i, str := range vs { + formattedStrings[i] = fmt.Sprintf("'%s'", str) + formattedObjStrings[i] = fmt.Sprintf("dict_%s", str) + } + return fmt.Sprintf("[%s],[%s]", strings.Join(formattedStrings, ", "), strings.Join(formattedObjStrings, ", ")) +} + +func RemoveSlice[K comparable](src []K, sub K) []K { + for k, v := range src { + if v == sub { + copy(src[k:], src[k+1:]) + return src[:len(src)-1] + } + } + return src +} + +// CheckIllegalName 检查命名是否合理 +func CheckIllegalName(errPrefix string, names ...string) (err error) { + reg, _ := regexp.Compile("^[a-z_][a-z0-9_]*$") + for _, name := range names { + name = strings.ToLower(name) + match := reg.MatchString(name) + if !match { + err = gerror.Newf("%v存在格式不正确,必须全部小写且由字母、数字和下划线组成:%v", errPrefix, name) + return + } + if strings.HasSuffix(name, "test") { + err = gerror.Newf("%v当中不能以`test`结尾:%v", errPrefix, name) + return + } + if StartsWithDigit(name) { + err = gerror.Newf("%v当中不能以阿拉伯数字开头:%v", errPrefix, name) + return + } + } + return +} +func StartsWithDigit(s string) bool { + r := []rune(s) + if len(r) > 0 { + return unicode.IsDigit(r[0]) + } + return false +} + +// GetModName 获取主包名 +func GetModName(ctx context.Context) (modName string, err error) { + if !gfile.Exists("go.mod") { + err = gerror.New("go.mod does not exist in current working directory") + return + } + + var ( + goModContent = gfile.GetContents("go.mod") + match, _ = gregex.MatchString(`^module\s+(.+)\s*`, goModContent) + ) + + if len(match) > 1 { + modName = gstr.Trim(match[1]) + } else { + err = gerror.New("module name does not found in go.mod") + return + } + return +} + +// parseServFunName 解析业务服务名称 +func (l *gCurd) parseServFunName(templateGroup, varName string) string { + templateGroup = gstr.UcFirst(templateGroup) + if gstr.HasPrefix(varName, templateGroup) && varName != templateGroup { + return varName + } + return templateGroup + varName +} + +func GetTempGeneratePath(ctx context.Context) string { + return gfile.Abs(gfile.Temp() + "/tmp_xjgen/" + version.AppName(ctx)) +} + +func FormatGo(ctx context.Context, name, code string) (string, error) { + path := GetTempGeneratePath(ctx) + "/" + name + if err := gfile.PutContents(path, code); err != nil { + return "", err + } + res, err := imports.Process(path, []byte(code), nil) + if err != nil { + err = gerror.Newf(`FormatGo error format "%s" go files: %v`, path, err) + return "", err + } + return string(res), nil +} +func formatComment(comment string) string { + comment = gstr.ReplaceByArray(comment, g.SliceStr{ + "\n", " ", + "\r", " ", + }) + comment = gstr.Replace(comment, `\n`, " ") + comment = gstr.Trim(comment) + return comment +} + +func removeEndWrap(comment string) string { + if len(comment) > 2 && comment[len(comment)-2:] == " \n" { + comment = comment[:len(comment)-2] + } + return comment +} +func isEffectiveJoin(join *genmodel.CurdOptionsJoin) bool { + return join.Alias != "" && join.Field != "" && join.LinkTable != "" && join.MasterField != "" && join.DaoName != "" && join.LinkMode > 0 +} + +func IsPidName(name string) bool { + return name == "pid" +} + +// CamelCaseToUnderline 驼峰单词转下划线单词 +func CamelCaseToUnderline(s string) string { + var output []rune + for i, r := range s { + if i == 0 { + output = append(output, unicode.ToLower(r)) + } else { + if unicode.IsUpper(r) { + output = append(output, '_') + } + + output = append(output, unicode.ToLower(r)) + } + } + return string(output) +} + +// hasEffectiveJoin 存在有效的关联表 +func hasEffectiveJoins(joins []*genmodel.CurdOptionsJoin) bool { + for _, join := range joins { + if isEffectiveJoin(join) { + return true + } + } + return false +} + +// ImportWebMethod 导入前端方法 +func ImportWebMethod(vs []string) string { + vs = utility.UniqueSlice(vs) + str := "{ " + strings.Join(vs, ", ") + " }" + str = strings.TrimSuffix(str, ", ") + return str +} + +func FormatVue(code string) string { + endTag := `` + vueLen := gstr.PosR(code, endTag) + vueCode := code[:vueLen+len(endTag)] + tsCode := code[vueLen+len(endTag):] + vueCode = gohtml.Format(vueCode) + tsCode = FormatTs(tsCode) + return vueCode + tsCode +} + +// ImportSql 导出sql文件 +func ImportSql(ctx context.Context, path string) error { + rows, err := os.ReadFile(path) + if err != nil { + return err + } + + beforeMaxMenuId, _ := dao.SysMenu.Ctx(ctx).Max(dao.SysMenu.Columns().MenuId) + sqlArr := strings.Split(string(rows), "\n") + for _, sql := range sqlArr { + sql = strings.TrimSpace(sql) + if sql == "" || strings.HasPrefix(sql, "--") { + continue + } + g.Log().Infof(ctx, "views.ImportSql sql:%v", sql) + exec, err := g.DB().Exec(ctx, sql) + g.Log().Infof(ctx, "views.ImportSql sql:%v, exec:%+v, err:%+v", sql, exec, err) + if err != nil { + return err + } + } + if err = syncGeneratedMenus(ctx, gconv.Int64(beforeMaxMenuId)); err != nil { + return err + } + return nil +} + +func syncGeneratedMenus(ctx context.Context, beforeMaxMenuId int64) error { + var menuIds []int64 + if err := dao.SysMenu.Ctx(ctx). + Fields(dao.SysMenu.Columns().MenuId). + WhereGT(dao.SysMenu.Columns().MenuId, beforeMaxMenuId). + OrderAsc(dao.SysMenu.Columns().MenuId). + Scan(&menuIds); err != nil { + return err + } + if len(menuIds) == 0 { + return nil + } + + for _, menuId := range menuIds { + if err := service.MemDBSysMenu().LoadData(ctx, menuId); err != nil { + return err + } + } + + var roleIds []int64 + if err := dao.SysRoleMenu.Ctx(ctx). + Fields(dao.SysRoleMenu.Columns().RoleId). + Where(dao.SysRoleMenu.Columns().TenantId, contexts.GetTenantId(ctx)). + WhereIn(dao.SysRoleMenu.Columns().MenuId, menuIds). + Group(dao.SysRoleMenu.Columns().RoleId). + Scan(&roleIds); err != nil { + return err + } + if len(roleIds) == 0 { + return nil + } + + var userIds []int64 + if err := dao.SysUserRole.Ctx(ctx). + Fields(dao.SysUserRole.Columns().UserId). + Where(dao.SysUserRole.Columns().TenantId, contexts.GetTenantId(ctx)). + WhereIn(dao.SysUserRole.Columns().RoleId, roleIds). + Group(dao.SysUserRole.Columns().UserId). + Scan(&userIds); err != nil { + return err + } + for _, userId := range userIds { + _ = mcache.RemoveUserAccessCodeList(ctx, userId) + _ = mcache.RemoveUserRoleDataAccessCodeList(ctx, userId) + } + return nil +} + +// ParseDBConfigNodeLink 解析数据库连接配置 +func ParseDBConfigNodeLink(node *gdb.ConfigNode) *gdb.ConfigNode { + const linkPattern = `(\w+):([\w\-\$]*):(.*?)@(\w+?)\((.+?)\)/{0,1}([^\?]*)\?{0,1}(.*)` + const defaultCharset = `utf8` + const defaultProtocol = `tcp` + + var match []string + if node.Link != "" { + match, _ = gregex.MatchString(linkPattern, node.Link) + if len(match) > 5 { + node.Type = match[1] + node.User = match[2] + node.Pass = match[3] + node.Protocol = match[4] + array := gstr.Split(match[5], ":") + if len(array) == 2 && node.Protocol != "file" { + node.Host = array[0] + node.Port = array[1] + node.Name = match[6] + } else { + node.Name = match[5] + } + if len(match) > 6 && match[7] != "" { + node.Extra = match[7] + } + node.Link = "" + } + } + if node.Extra != "" { + if m, _ := gstr.Parse(node.Extra); len(m) > 0 { + _ = gconv.Struct(m, &node) + } + } + // Default value checks. + if node.Charset == "" { + node.Charset = defaultCharset + } + if node.Protocol == "" { + node.Protocol = defaultProtocol + } + return node +} diff --git a/server/internal/library/xgen/gen_view/gohtml/consts.go b/server/internal/library/xgen/gen_view/gohtml/consts.go new file mode 100644 index 0000000..049c060 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gohtml/consts.go @@ -0,0 +1,12 @@ +// package gohtml +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gohtml + +const ( + defaultIndentString = " " + startIndent = 0 + defaultLastElement = "" +) diff --git a/server/internal/library/xgen/gen_view/gohtml/doc.go b/server/internal/library/xgen/gen_view/gohtml/doc.go new file mode 100644 index 0000000..33246e1 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gohtml/doc.go @@ -0,0 +1,6 @@ +// package genview +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gohtml diff --git a/server/internal/library/xgen/gen_view/gohtml/element.go b/server/internal/library/xgen/gen_view/gohtml/element.go new file mode 100644 index 0000000..bbfad3a --- /dev/null +++ b/server/internal/library/xgen/gen_view/gohtml/element.go @@ -0,0 +1,12 @@ +// package gohtml +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gohtml + +// An element represents an HTML element. +type element interface { + isInline() bool + write(*formattedBuffer, bool) bool +} diff --git a/server/internal/library/xgen/gen_view/gohtml/formatter.go b/server/internal/library/xgen/gen_view/gohtml/formatter.go new file mode 100644 index 0000000..2da0d63 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gohtml/formatter.go @@ -0,0 +1,41 @@ +// package gohtml +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gohtml + +import ( + "bytes" + "strconv" + "strings" +) + +// Format parses the input HTML string, formats it and returns the result. +func Format(s string) string { + return parse(strings.NewReader(s)).html() +} + +// FormatBytes parses input HTML as bytes, formats it and returns the result. +func FormatBytes(b []byte) []byte { + return parse(bytes.NewReader(b)).bytes() +} + +// Format parses the input HTML string, formats it and returns the result with line no. +func FormatWithLineNo(s string) string { + return AddLineNo(Format(s)) +} + +func AddLineNo(s string) string { + lines := strings.Split(s, "\n") + maxLineNoStrLen := len(strconv.Itoa(len(lines))) + bf := &bytes.Buffer{} + for i, line := range lines { + lineNoStr := strconv.Itoa(i + 1) + if i > 0 { + bf.WriteString("\n") + } + bf.WriteString(strings.Repeat(" ", maxLineNoStrLen-len(lineNoStr)) + lineNoStr + " " + line) + } + return bf.String() +} diff --git a/server/internal/library/xgen/gen_view/gohtml/html_document.go b/server/internal/library/xgen/gen_view/gohtml/html_document.go new file mode 100644 index 0000000..a9aa255 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gohtml/html_document.go @@ -0,0 +1,59 @@ +// package gohtml +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gohtml + +import ( + "bytes" + "regexp" +) + +// Column to wrap lines to (disabled by default) +var LineWrapColumn = 0 + +// Maxmimum characters a long word can extend past LineWrapColumn without wrapping +var LineWrapMaxSpillover = 5 + +// An htmlDocument represents an HTML document. +type htmlDocument struct { + elements []element +} + +// html generates an HTML source code and returns it. +func (htmlDoc *htmlDocument) html() string { + str := string(htmlDoc.bytes()) + str = replaceMultipleNewlinesWithSpaceAndTabs(str) + return str +} + +func replaceMultipleNewlinesWithSpaceAndTabs(input string) string { + re := regexp.MustCompile(`\n\s*\n+`) + formattedString := re.ReplaceAllString(input, "\n") + return formattedString +} + +// bytes reads from htmlDocument's internal array of elements and returns HTML source code +func (htmlDoc *htmlDocument) bytes() []byte { + bf := &formattedBuffer{ + buffer: &bytes.Buffer{}, + + lineWrapColumn: LineWrapColumn, + lineWrapMaxSpillover: LineWrapMaxSpillover, + + indentString: defaultIndentString, + indentLevel: startIndent, + } + + isPreviousNodeInline := true + for _, child := range htmlDoc.elements { + isPreviousNodeInline = child.write(bf, isPreviousNodeInline) + } + return bf.buffer.Bytes() +} + +// append appends an element to the htmlDocument. +func (htmlDoc *htmlDocument) append(e element) { + htmlDoc.elements = append(htmlDoc.elements, e) +} diff --git a/server/internal/library/xgen/gen_view/gohtml/parser.go b/server/internal/library/xgen/gen_view/gohtml/parser.go new file mode 100644 index 0000000..f96f782 --- /dev/null +++ b/server/internal/library/xgen/gen_view/gohtml/parser.go @@ -0,0 +1,133 @@ +// package gohtml +// @Link https://github.com/xiujiecn/xiu-admin +// @Copyright Copyright (c) 2025 LiXiujie +// @Author Lxj +// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE +package gohtml + +import ( + "io" + "regexp" + "strings" + + "golang.org/x/net/html" +) + +// parse parses a stirng and converts it into an html. +func parse(r io.Reader) *htmlDocument { + htmlDoc := &htmlDocument{} + tokenizer := html.NewTokenizer(r) + for { + if errorToken, _, _ := parseToken(tokenizer, htmlDoc, nil); errorToken { + break + } + } + return htmlDoc +} + +// Function that identifies which tags will be treated as containing preformatted +// content. Such tags will have the formatting of all its contents preserved +// unchanged. +// The opening tag html.Token is passed to this function. +// By default, only
 and