From 88dfe5c64097613af6068197391bab535e401b90 Mon Sep 17 00:00:00 2001 From: MiFaZhan Date: Fri, 23 Oct 2026 14:15:47 +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-openapi:对外 OpenAPI 网关(V3 接口 + 旧版兼容接口)。 - Go module:iotlcm-openapi → git.5iot.com/iotlcm-public/iotlcm-openapi(178 文件) - 凭据与地址脱敏:JWT signingKey、MySQL DSN、Redis 口令、 RabbitMQ DSN 全部改为 ${*} 占位;私网 IP → 文档地址段 - 7 处真实手机号 → 合法 11 位编造号 - 启动 banner 统一 IOTLCM 方块字 + 社区惯例署名 - 移除内部资产:CI 触发器 - Dockerfile 改用公共基础镜像,移除 GOPRIVATE 内网设置 - README 重写(原为 GoFrame 模板占位文案),补 Apache-2.0 LICENSE, LF 行尾 + .gitattributes --- .gitattributes | 13 + .gitignore | 24 + LICENSE | 201 ++++++ Makefile | 7 + api/common/common.go | 14 + api/common/v1/common.go | 57 ++ api/old_api/old_api.go | 20 + api/old_api/v1/open.go | 59 ++ api/query/query.go | 26 + api/query/v1/sim.go | 97 +++ api/query/v1/token.go | 25 + build/Dockerfile | 47 ++ build/build_config.yaml | 73 +++ docs/batch-number.md | 11 + go.mod | 65 ++ go.sum | 142 +++++ hack/hack-cli.mk | 18 + hack/hack.mk | 75 +++ internal/cmd/cmd.go | 65 ++ internal/consts/batch.go | 181 ++++++ internal/consts/bcache.go | 12 + internal/consts/code.go | 41 ++ internal/consts/config.go | 21 + internal/consts/consts.go | 10 + internal/consts/db.go | 6 + internal/consts/event.go | 55 ++ internal/consts/http.go | 14 + internal/consts/mcache.go | 15 + internal/consts/queue.go | 26 + internal/consts/sim_card_lifecycle.go | 34 + internal/consts/system.go | 146 +++++ internal/consts/traffic_cutoff.go | 6 + internal/consts/v3api.go | 90 +++ internal/consts/websocket.go | 23 + internal/controller/common/common_new.go | 11 + internal/controller/common/renew.go | 114 ++++ internal/controller/old_api/old_api.go | 5 + internal/controller/old_api/old_api_new.go | 13 + internal/controller/old_api/query.go | 69 +++ internal/controller/query/query.go | 5 + internal/controller/query/query_new.go | 15 + internal/controller/query/sim.go | 93 +++ internal/controller/query/token.go | 26 + internal/dao/batch_detail.go | 22 + internal/dao/batch_main.go | 22 + internal/dao/internal/batch_detail.go | 109 ++++ internal/dao/internal/batch_main.go | 139 +++++ internal/dao/internal/sys_client.go | 109 ++++ internal/dao/internal/sys_config.go | 101 +++ internal/dao/internal/sys_dept.go | 125 ++++ internal/dao/internal/sys_dict_data.go | 107 ++++ internal/dao/internal/sys_dict_type.go | 99 +++ internal/dao/internal/sys_gen_table.go | 111 ++++ internal/dao/internal/sys_job.go | 111 ++++ internal/dao/internal/sys_logininfor.go | 101 +++ internal/dao/internal/sys_menu.go | 121 ++++ internal/dao/internal/sys_notice.go | 107 ++++ internal/dao/internal/sys_notice_user.go | 107 ++++ internal/dao/internal/sys_oper_log.go | 113 ++++ internal/dao/internal/sys_oss.go | 111 ++++ internal/dao/internal/sys_oss_config.go | 117 ++++ internal/dao/internal/sys_post.go | 109 ++++ internal/dao/internal/sys_role.go | 113 ++++ internal/dao/internal/sys_role_dept.go | 83 +++ internal/dao/internal/sys_role_menu.go | 85 +++ internal/dao/internal/sys_social.go | 137 ++++ internal/dao/internal/sys_tenant.go | 125 ++++ internal/dao/internal/sys_tenant_package.go | 103 ++++ internal/dao/internal/sys_user.go | 125 ++++ internal/dao/internal/sys_user_online.go | 105 ++++ internal/dao/internal/sys_user_post.go | 83 +++ internal/dao/internal/sys_user_role.go | 83 +++ internal/dao/internal/t_agent_balance.go | 111 ++++ internal/dao/internal/t_agent_enterprise.go | 109 ++++ internal/dao/internal/t_api.go | 105 ++++ internal/dao/internal/t_api_group.go | 99 +++ internal/dao/internal/t_api_group_resource.go | 81 +++ internal/dao/internal/t_api_resource.go | 105 ++++ internal/dao/internal/t_balance_detail.go | 115 ++++ .../internal/t_consume_account_month_bill.go | 133 ++++ internal/dao/internal/t_credit_detail.go | 113 ++++ .../dao/internal/t_cust_withdraw_account.go | 107 ++++ internal/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 ++++ internal/dao/internal/t_order.go | 183 ++++++ internal/dao/internal/t_order_item.go | 141 +++++ internal/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 ++++ internal/dao/internal/t_sim_card_bind_pkg.go | 127 ++++ internal/dao/internal/t_sim_card_info.go | 193 ++++++ internal/dao/internal/t_sim_card_stock.go | 103 ++++ .../dao/internal/t_sim_channel_template.go | 103 ++++ internal/dao/internal/t_sim_channels.go | 127 ++++ .../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 +++ internal/dao/internal/t_sim_pool.go | 117 ++++ .../dao/internal/t_sim_pool_bind_package.go | 123 ++++ .../dao/internal/t_sim_pool_warn_config.go | 109 ++++ .../dao/internal/t_sim_upstream_package.go | 99 +++ internal/dao/internal/t_tplatform_setting.go | 111 ++++ internal/dao/internal/t_wo_audit.go | 117 ++++ internal/dao/internal/t_wo_communication.go | 113 ++++ internal/dao/internal/t_wo_main.go | 137 ++++ internal/dao/internal/t_wo_record.go | 107 ++++ internal/dao/internal/test_demo.go | 107 ++++ internal/dao/sys_client.go | 27 + internal/dao/sys_config.go | 27 + internal/dao/sys_dept.go | 27 + internal/dao/sys_dict_data.go | 27 + internal/dao/sys_dict_type.go | 27 + internal/dao/sys_gen_table.go | 27 + internal/dao/sys_job.go | 22 + internal/dao/sys_logininfor.go | 27 + internal/dao/sys_menu.go | 27 + internal/dao/sys_notice.go | 27 + internal/dao/sys_notice_user.go | 22 + internal/dao/sys_oper_log.go | 27 + internal/dao/sys_oss.go | 27 + internal/dao/sys_oss_config.go | 27 + internal/dao/sys_post.go | 27 + internal/dao/sys_role.go | 27 + internal/dao/sys_role_dept.go | 27 + internal/dao/sys_role_menu.go | 27 + internal/dao/sys_social.go | 27 + internal/dao/sys_tenant.go | 27 + internal/dao/sys_tenant_package.go | 27 + internal/dao/sys_user.go | 27 + internal/dao/sys_user_online.go | 27 + internal/dao/sys_user_post.go | 27 + internal/dao/sys_user_role.go | 27 + internal/dao/t_agent_balance.go | 22 + internal/dao/t_agent_enterprise.go | 22 + internal/dao/t_api.go | 22 + internal/dao/t_api_group.go | 22 + internal/dao/t_api_group_resource.go | 22 + internal/dao/t_api_resource.go | 22 + internal/dao/t_balance_detail.go | 22 + internal/dao/t_consume_account_month_bill.go | 22 + internal/dao/t_credit_detail.go | 22 + internal/dao/t_cust_withdraw_account.go | 22 + internal/dao/t_dept_flow_daily.go | 22 + internal/dao/t_division_code.go | 22 + internal/dao/t_fin_commission_detail.go | 22 + internal/dao/t_fin_withdrawable_change.go | 22 + internal/dao/t_finance_apply.go | 19 + internal/dao/t_finance_audit_record.go | 19 + internal/dao/t_order.go | 22 + internal/dao/t_order_item.go | 22 + internal/dao/t_package_customer.go | 22 + internal/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 + internal/dao/t_sim_card_bind_pkg.go | 22 + internal/dao/t_sim_card_info.go | 22 + internal/dao/t_sim_card_stock.go | 22 + internal/dao/t_sim_channel_template.go | 22 + 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 + internal/dao/t_sim_flow_pool.go | 22 + internal/dao/t_sim_package_category.go | 22 + internal/dao/t_sim_pool.go | 22 + internal/dao/t_sim_pool_bind_package.go | 22 + internal/dao/t_sim_pool_warn_config.go | 22 + internal/dao/t_sim_upstream_package.go | 22 + internal/dao/t_tplatform_setting.go | 22 + internal/dao/t_wo_audit.go | 22 + internal/dao/t_wo_communication.go | 22 + internal/dao/t_wo_main.go | 22 + internal/dao/t_wo_record.go | 22 + internal/dao/test_demo.go | 22 + internal/library/batchimport/batch_no.go | 83 +++ internal/library/batchimport/batch_no_test.go | 75 +++ internal/library/batchmetadata/metadata.go | 10 + internal/library/bcache/bcache.go | 6 + internal/library/bcache/bcache_api_auth.go | 115 ++++ internal/library/cache/cache.go | 60 ++ internal/library/cache/file/file.go | 440 +++++++++++++ internal/library/contexts/contexts.go | 224 +++++++ internal/library/mcache/mcache.go | 46 ++ internal/library/rabbitmq/rabbitmq.go | 211 +++++++ internal/library/utils/utils.go | 27 + internal/library/xgorm/dao.go | 197 ++++++ internal/library/xgorm/dao_tree.go | 195 ++++++ .../library/xgorm/gorm_model/gorm_tree.go | 14 + internal/library/xgorm/handler/filter_auth.go | 224 +++++++ internal/library/xgorm/handler/force_cache.go | 13 + internal/library/xgorm/handler/handler.go | 40 ++ internal/library/xgorm/handler/tenant.go | 27 + internal/library/xgorm/hook/member.go | 118 ++++ internal/logic/common/batch_metadata_test.go | 53 ++ internal/logic/common/batch_wait.go | 66 ++ internal/logic/common/card_identifiers.go | 119 ++++ internal/logic/common/common.go | 102 +++ internal/logic/common/renew.go | 333 ++++++++++ internal/logic/common/single_result.go | 189 ++++++ .../logic/common/traffic_cutoff_config.go | 209 +++++++ .../logic/common/traffic_cutoff_helpers.go | 36 ++ .../logic/common/traffic_cutoff_validation.go | 27 + internal/logic/logic.go | 10 + internal/logic/middleware/middleware.go | 351 +++++++++++ internal/logic/oldApi/query.go | 322 ++++++++++ internal/logic/openapiiot/card_info.go | 27 + internal/logic/query/batch_imei_test.go | 298 +++++++++ internal/logic/query/batch_query.go | 312 ++++++++++ internal/logic/query/batch_status.go | 74 +++ internal/logic/query/batch_status_test.go | 47 ++ internal/logic/query/sim.go | 426 +++++++++++++ internal/logic/query/token.go | 431 +++++++++++++ internal/logic/query/traffic_cutoff_config.go | 201 ++++++ internal/logic/upstream/upstream_chan.go | 583 ++++++++++++++++++ internal/model/agent_dept.go | 83 +++ internal/model/agent_role.go | 44 ++ internal/model/agent_user.go | 67 ++ internal/model/alipay.go | 67 ++ internal/model/batch_detail_list.go | 51 ++ internal/model/batch_execution_log.go | 72 +++ internal/model/batch_main.go | 241 ++++++++ internal/model/bcache_model.go | 15 + internal/model/common.go | 42 ++ internal/model/context.go | 27 + internal/model/do/batch_detail.go | 32 + internal/model/do/batch_main.go | 47 ++ internal/model/do/sys_client.go | 31 + internal/model/do/sys_config.go | 27 + internal/model/do/sys_dept.go | 39 ++ internal/model/do/sys_dict_data.go | 30 + internal/model/do/sys_dict_type.go | 26 + internal/model/do/sys_gen_table.go | 32 + internal/model/do/sys_job.go | 32 + internal/model/do/sys_logininfor.go | 27 + internal/model/do/sys_menu.go | 37 ++ internal/model/do/sys_notice.go | 30 + internal/model/do/sys_notice_user.go | 30 + internal/model/do/sys_oper_log.go | 33 + internal/model/do/sys_oss.go | 32 + internal/model/do/sys_oss_config.go | 35 ++ internal/model/do/sys_post.go | 31 + internal/model/do/sys_role.go | 33 + internal/model/do/sys_role_dept.go | 17 + internal/model/do/sys_role_menu.go | 18 + internal/model/do/sys_social.go | 45 ++ internal/model/do/sys_tenant.go | 39 ++ internal/model/do/sys_tenant_package.go | 28 + internal/model/do/sys_user.go | 39 ++ internal/model/do/sys_user_online.go | 29 + internal/model/do/sys_user_post.go | 17 + internal/model/do/sys_user_role.go | 17 + internal/model/do/t_agent_balance.go | 32 + internal/model/do/t_agent_enterprise.go | 31 + internal/model/do/t_api.go | 29 + internal/model/do/t_api_group.go | 26 + internal/model/do/t_api_group_resource.go | 16 + internal/model/do/t_api_resource.go | 29 + internal/model/do/t_balance_detail.go | 34 + .../model/do/t_consume_account_month_bill.go | 43 ++ internal/model/do/t_credit_detail.go | 33 + internal/model/do/t_cust_withdraw_account.go | 30 + internal/model/do/t_dept_flow_daily.go | 28 + internal/model/do/t_division_code.go | 20 + internal/model/do/t_fin_commission_detail.go | 35 ++ .../model/do/t_fin_withdrawable_change.go | 36 ++ internal/model/do/t_finance_apply.go | 40 ++ internal/model/do/t_finance_audit_record.go | 29 + internal/model/do/t_order.go | 68 ++ 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 ++ internal/model/do/t_sim_bind_package_logs.go | 40 ++ internal/model/do/t_sim_card_bind_pkg.go | 40 ++ internal/model/do/t_sim_card_info.go | 71 +++ internal/model/do/t_sim_card_stock.go | 28 + internal/model/do/t_sim_channel_template.go | 28 + internal/model/do/t_sim_channels.go | 39 ++ internal/model/do/t_sim_flow_package_info.go | 49 ++ internal/model/do/t_sim_flow_package_price.go | 32 + internal/model/do/t_sim_flow_pool.go | 36 ++ internal/model/do/t_sim_package_category.go | 26 + internal/model/do/t_sim_pool_bind_package.go | 38 ++ internal/model/do/t_sim_pool_warn_config.go | 31 + internal/model/do/t_sim_upstream_package.go | 26 + internal/model/do/t_tplatform_setting.go | 32 + internal/model/do/t_wo_audit.go | 35 ++ internal/model/do/t_wo_communication.go | 34 + internal/model/do/t_wo_main.go | 45 ++ internal/model/do/t_wo_record.go | 30 + internal/model/do/test_demo.go | 30 + internal/model/entity/batch_detail.go | 30 + internal/model/entity/batch_main.go | 45 ++ internal/model/entity/sys_client.go | 29 + internal/model/entity/sys_config.go | 25 + internal/model/entity/sys_dept.go | 37 ++ internal/model/entity/sys_dict_data.go | 28 + internal/model/entity/sys_dict_type.go | 24 + internal/model/entity/sys_gen_table.go | 30 + internal/model/entity/sys_job.go | 30 + internal/model/entity/sys_logininfor.go | 25 + internal/model/entity/sys_menu.go | 35 ++ internal/model/entity/sys_notice.go | 28 + internal/model/entity/sys_notice_user.go | 28 + internal/model/entity/sys_oper_log.go | 31 + internal/model/entity/sys_oss.go | 30 + internal/model/entity/sys_oss_config.go | 33 + internal/model/entity/sys_post.go | 29 + internal/model/entity/sys_role.go | 31 + internal/model/entity/sys_role_dept.go | 12 + internal/model/entity/sys_role_menu.go | 13 + internal/model/entity/sys_social.go | 43 ++ internal/model/entity/sys_tenant.go | 37 ++ internal/model/entity/sys_tenant_package.go | 26 + internal/model/entity/sys_user.go | 37 ++ internal/model/entity/sys_user_online.go | 27 + internal/model/entity/sys_user_post.go | 12 + internal/model/entity/sys_user_role.go | 12 + internal/model/entity/t_agent_balance.go | 30 + internal/model/entity/t_agent_enterprise.go | 29 + internal/model/entity/t_api.go | 27 + internal/model/entity/t_api_group.go | 24 + internal/model/entity/t_api_group_resource.go | 11 + internal/model/entity/t_api_resource.go | 27 + internal/model/entity/t_balance_detail.go | 32 + .../entity/t_consume_account_month_bill.go | 41 ++ internal/model/entity/t_credit_detail.go | 31 + .../model/entity/t_cust_withdraw_account.go | 28 + internal/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 + internal/model/entity/t_order.go | 66 ++ internal/model/entity/t_order_item.go | 45 ++ internal/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 ++ internal/model/entity/t_sim_card_bind_pkg.go | 38 ++ internal/model/entity/t_sim_card_info.go | 71 +++ internal/model/entity/t_sim_card_stock.go | 26 + .../model/entity/t_sim_channel_template.go | 26 + internal/model/entity/t_sim_channels.go | 38 ++ .../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 | 36 ++ .../model/entity/t_sim_pool_warn_config.go | 29 + .../model/entity/t_sim_upstream_package.go | 24 + internal/model/entity/t_tplatform_setting.go | 30 + internal/model/entity/t_wo_audit.go | 33 + internal/model/entity/t_wo_communication.go | 32 + internal/model/entity/t_wo_main.go | 43 ++ internal/model/entity/t_wo_record.go | 28 + internal/model/entity/test_demo.go | 28 + internal/model/genin/test_demo.go | 129 ++++ internal/model/home.go | 34 + internal/model/monitor_server.go | 36 ++ internal/model/mybytes.go | 52 ++ internal/model/oldapi.go | 152 +++++ internal/model/qrcode.go | 85 +++ internal/model/query_auth.go | 61 ++ internal/model/query_sim.go | 175 ++++++ internal/model/request/common.go | 20 + internal/model/response/common.go | 12 + internal/model/shared_token.go | 12 + internal/model/sys_auth.go | 38 ++ internal/model/sys_client.go | 93 +++ internal/model/sys_config.go | 83 +++ internal/model/sys_dept.go | 115 ++++ internal/model/sys_dict.go | 177 ++++++ internal/model/sys_job.go | 81 +++ internal/model/sys_logininfor.go | 61 ++ internal/model/sys_menu.go | 112 ++++ internal/model/sys_notice.go | 97 +++ internal/model/sys_notice_user.go | 201 ++++++ internal/model/sys_oper_log.go | 64 ++ internal/model/sys_oss.go | 112 ++++ internal/model/sys_oss_config.go | 98 +++ internal/model/sys_post.go | 111 ++++ internal/model/sys_role.go | 125 ++++ internal/model/sys_social.go | 73 +++ internal/model/sys_tenant.go | 119 ++++ internal/model/sys_tenant_package.go | 73 +++ internal/model/sys_user.go | 232 +++++++ internal/model/sys_user_online.go | 71 +++ internal/model/t_agent_balance.go | 211 +++++++ internal/model/t_agent_enterprise.go | 156 +++++ internal/model/t_api.go | 145 +++++ internal/model/t_api_group.go | 154 +++++ internal/model/t_api_resource.go | 185 ++++++ internal/model/t_balance_detail.go | 207 +++++++ .../model/t_consume_account_month_bill.go | 222 +++++++ internal/model/t_credit_detail.go | 163 +++++ internal/model/t_cust_withdraw_account.go | 178 ++++++ internal/model/t_division_code.go | 110 ++++ internal/model/t_fin_commission_detail.go | 213 +++++++ internal/model/t_fin_withdrawable_change.go | 203 ++++++ internal/model/t_finance_apply.go | 275 +++++++++ internal/model/t_finance_audit_record.go | 158 +++++ internal/model/t_profit_account_month_bill.go | 226 +++++++ internal/model/t_sim_card_bind_pkg.go | 207 +++++++ internal/model/t_sim_card_change.go | 151 +++++ internal/model/t_sim_card_inbound.go | 87 +++ internal/model/t_sim_card_info.go | 434 +++++++++++++ internal/model/t_sim_card_lifecycle.go | 39 ++ internal/model/t_sim_card_outbound.go | 103 ++++ internal/model/t_sim_card_renew.go | 127 ++++ internal/model/t_sim_card_stock.go | 138 +++++ internal/model/t_sim_card_unsub.go | 38 ++ internal/model/t_sim_channel_template.go | 139 +++++ internal/model/t_sim_channels.go | 210 +++++++ internal/model/t_sim_diagnose.go | 58 ++ internal/model/t_sim_flow_package_info.go | 240 +++++++ internal/model/t_sim_flow_package_price.go | 141 +++++ internal/model/t_sim_flow_pool.go | 212 +++++++ internal/model/t_sim_package_category.go | 131 ++++ internal/model/t_sim_pool_warn_config.go | 153 +++++ internal/model/t_tplatform_setting.go | 195 ++++++ internal/model/t_upstream_package.go | 131 ++++ internal/model/t_wo_communication.go | 165 +++++ internal/model/t_wo_main.go | 289 +++++++++ internal/model/t_wo_record.go | 169 +++++ internal/model/traffic_cutoff.go | 43 ++ internal/model/traffic_cutoff_query.go | 53 ++ internal/model/traffic_usage.go | 93 +++ internal/model/traffic_usage_sync.go | 23 + internal/model/upstream_chan.go | 228 +++++++ internal/model/work_order_queue.go | 7 + internal/model/worker_diagnostic.go | 9 + internal/packed/packed.go | 6 + internal/packed/response/response.go | 81 +++ internal/router/change.go | 15 + internal/router/common.go | 15 + internal/router/old_api.go | 15 + internal/router/query.go | 15 + internal/router/router.go | 31 + internal/service/common.go | 41 ++ internal/service/iot.go | 30 + internal/service/middleware.go | 34 + internal/service/old_api.go | 39 ++ internal/service/query.go | 61 ++ internal/service/upstream.go | 59 ++ .../workerdiagnostic/worker_diagnostic.go | 49 ++ .../worker_diagnostic_test.go | 81 +++ main.go | 26 + manifest/config/config.yaml | 76 +++ .../deploy/kustomize/base/deployment.yaml | 21 + .../deploy/kustomize/base/kustomization.yaml | 8 + manifest/deploy/kustomize/base/service.yaml | 12 + .../kustomize/overlays/develop/configmap.yaml | 14 + .../overlays/develop/deployment.yaml | 10 + .../overlays/develop/kustomization.yaml | 14 + manifest/docker/Dockerfile | 16 + manifest/docker/docker.sh | 8 + manifest/i18n/.gitkeep | 0 manifest/protobuf/.keep-if-necessary | 0 resource/template/.gitkeep | 0 utility/convert/convert.go | 92 +++ utility/excel/excel.go | 138 +++++ utility/gfredis/conn.go | 11 + utility/gfredis/gfredis.go | 150 +++++ utility/gfredis/hash.go | 51 ++ utility/gfredis/key.go | 16 + utility/gfredis/list.go | 37 ++ utility/gfredis/string.go | 42 ++ utility/gfredis/subpub.go | 18 + utility/gfredis/zset.go | 21 + utility/hash/crc16.go | 100 +++ utility/hash/sum16.go | 31 + utility/tree/tree.go | 109 ++++ utility/utility.go | 283 +++++++++ utility/uuid32/uuid32.go | 15 + utility/version/version.go | 45 ++ 482 files changed, 34475 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 api/common/common.go create mode 100644 api/common/v1/common.go create mode 100644 api/old_api/old_api.go create mode 100644 api/old_api/v1/open.go create mode 100644 api/query/query.go create mode 100644 api/query/v1/sim.go create mode 100644 api/query/v1/token.go create mode 100644 build/Dockerfile create mode 100644 build/build_config.yaml create mode 100644 docs/batch-number.md create mode 100644 go.mod create mode 100644 go.sum create mode 100644 hack/hack-cli.mk create mode 100644 hack/hack.mk create mode 100644 internal/cmd/cmd.go create mode 100644 internal/consts/batch.go create mode 100644 internal/consts/bcache.go create mode 100644 internal/consts/code.go create mode 100644 internal/consts/config.go create mode 100644 internal/consts/consts.go create mode 100644 internal/consts/db.go create mode 100644 internal/consts/event.go create mode 100644 internal/consts/http.go create mode 100644 internal/consts/mcache.go create mode 100644 internal/consts/queue.go create mode 100644 internal/consts/sim_card_lifecycle.go create mode 100644 internal/consts/system.go create mode 100644 internal/consts/traffic_cutoff.go create mode 100644 internal/consts/v3api.go create mode 100644 internal/consts/websocket.go create mode 100644 internal/controller/common/common_new.go create mode 100644 internal/controller/common/renew.go create mode 100644 internal/controller/old_api/old_api.go create mode 100644 internal/controller/old_api/old_api_new.go create mode 100644 internal/controller/old_api/query.go create mode 100644 internal/controller/query/query.go create mode 100644 internal/controller/query/query_new.go create mode 100644 internal/controller/query/sim.go create mode 100644 internal/controller/query/token.go create mode 100644 internal/dao/batch_detail.go create mode 100644 internal/dao/batch_main.go create mode 100644 internal/dao/internal/batch_detail.go create mode 100644 internal/dao/internal/batch_main.go create mode 100644 internal/dao/internal/sys_client.go create mode 100644 internal/dao/internal/sys_config.go create mode 100644 internal/dao/internal/sys_dept.go create mode 100644 internal/dao/internal/sys_dict_data.go create mode 100644 internal/dao/internal/sys_dict_type.go create mode 100644 internal/dao/internal/sys_gen_table.go create mode 100644 internal/dao/internal/sys_job.go create mode 100644 internal/dao/internal/sys_logininfor.go create mode 100644 internal/dao/internal/sys_menu.go create mode 100644 internal/dao/internal/sys_notice.go create mode 100644 internal/dao/internal/sys_notice_user.go create mode 100644 internal/dao/internal/sys_oper_log.go create mode 100644 internal/dao/internal/sys_oss.go create mode 100644 internal/dao/internal/sys_oss_config.go create mode 100644 internal/dao/internal/sys_post.go create mode 100644 internal/dao/internal/sys_role.go create mode 100644 internal/dao/internal/sys_role_dept.go create mode 100644 internal/dao/internal/sys_role_menu.go create mode 100644 internal/dao/internal/sys_social.go create mode 100644 internal/dao/internal/sys_tenant.go create mode 100644 internal/dao/internal/sys_tenant_package.go create mode 100644 internal/dao/internal/sys_user.go create mode 100644 internal/dao/internal/sys_user_online.go create mode 100644 internal/dao/internal/sys_user_post.go create mode 100644 internal/dao/internal/sys_user_role.go create mode 100644 internal/dao/internal/t_agent_balance.go create mode 100644 internal/dao/internal/t_agent_enterprise.go create mode 100644 internal/dao/internal/t_api.go create mode 100644 internal/dao/internal/t_api_group.go create mode 100644 internal/dao/internal/t_api_group_resource.go create mode 100644 internal/dao/internal/t_api_resource.go create mode 100644 internal/dao/internal/t_balance_detail.go create mode 100644 internal/dao/internal/t_consume_account_month_bill.go create mode 100644 internal/dao/internal/t_credit_detail.go create mode 100644 internal/dao/internal/t_cust_withdraw_account.go create mode 100644 internal/dao/internal/t_dept_flow_daily.go create mode 100644 internal/dao/internal/t_division_code.go create mode 100644 internal/dao/internal/t_fin_commission_detail.go create mode 100644 internal/dao/internal/t_fin_withdrawable_change.go create mode 100644 internal/dao/internal/t_finance_apply.go create mode 100644 internal/dao/internal/t_finance_audit_record.go create mode 100644 internal/dao/internal/t_order.go create mode 100644 internal/dao/internal/t_order_item.go create mode 100644 internal/dao/internal/t_package_customer.go create mode 100644 internal/dao/internal/t_profit_account_month_bill.go create mode 100644 internal/dao/internal/t_resource_batch_download.go create mode 100644 internal/dao/internal/t_sim_bind_package_logs.go create mode 100644 internal/dao/internal/t_sim_card_bind_pkg.go create mode 100644 internal/dao/internal/t_sim_card_info.go create mode 100644 internal/dao/internal/t_sim_card_stock.go create mode 100644 internal/dao/internal/t_sim_channel_template.go create mode 100644 internal/dao/internal/t_sim_channels.go create mode 100644 internal/dao/internal/t_sim_flow_package_info.go create mode 100644 internal/dao/internal/t_sim_flow_package_price.go create mode 100644 internal/dao/internal/t_sim_flow_pool.go create mode 100644 internal/dao/internal/t_sim_package_category.go create mode 100644 internal/dao/internal/t_sim_pool.go create mode 100644 internal/dao/internal/t_sim_pool_bind_package.go create mode 100644 internal/dao/internal/t_sim_pool_warn_config.go create mode 100644 internal/dao/internal/t_sim_upstream_package.go create mode 100644 internal/dao/internal/t_tplatform_setting.go create mode 100644 internal/dao/internal/t_wo_audit.go create mode 100644 internal/dao/internal/t_wo_communication.go create mode 100644 internal/dao/internal/t_wo_main.go create mode 100644 internal/dao/internal/t_wo_record.go create mode 100644 internal/dao/internal/test_demo.go create mode 100644 internal/dao/sys_client.go create mode 100644 internal/dao/sys_config.go create mode 100644 internal/dao/sys_dept.go create mode 100644 internal/dao/sys_dict_data.go create mode 100644 internal/dao/sys_dict_type.go create mode 100644 internal/dao/sys_gen_table.go create mode 100644 internal/dao/sys_job.go create mode 100644 internal/dao/sys_logininfor.go create mode 100644 internal/dao/sys_menu.go create mode 100644 internal/dao/sys_notice.go create mode 100644 internal/dao/sys_notice_user.go create mode 100644 internal/dao/sys_oper_log.go create mode 100644 internal/dao/sys_oss.go create mode 100644 internal/dao/sys_oss_config.go create mode 100644 internal/dao/sys_post.go create mode 100644 internal/dao/sys_role.go create mode 100644 internal/dao/sys_role_dept.go create mode 100644 internal/dao/sys_role_menu.go create mode 100644 internal/dao/sys_social.go create mode 100644 internal/dao/sys_tenant.go create mode 100644 internal/dao/sys_tenant_package.go create mode 100644 internal/dao/sys_user.go create mode 100644 internal/dao/sys_user_online.go create mode 100644 internal/dao/sys_user_post.go create mode 100644 internal/dao/sys_user_role.go create mode 100644 internal/dao/t_agent_balance.go create mode 100644 internal/dao/t_agent_enterprise.go create mode 100644 internal/dao/t_api.go create mode 100644 internal/dao/t_api_group.go create mode 100644 internal/dao/t_api_group_resource.go create mode 100644 internal/dao/t_api_resource.go create mode 100644 internal/dao/t_balance_detail.go create mode 100644 internal/dao/t_consume_account_month_bill.go create mode 100644 internal/dao/t_credit_detail.go create mode 100644 internal/dao/t_cust_withdraw_account.go create mode 100644 internal/dao/t_dept_flow_daily.go create mode 100644 internal/dao/t_division_code.go create mode 100644 internal/dao/t_fin_commission_detail.go create mode 100644 internal/dao/t_fin_withdrawable_change.go create mode 100644 internal/dao/t_finance_apply.go create mode 100644 internal/dao/t_finance_audit_record.go create mode 100644 internal/dao/t_order.go create mode 100644 internal/dao/t_order_item.go create mode 100644 internal/dao/t_package_customer.go create mode 100644 internal/dao/t_profit_account_month_bill.go create mode 100644 internal/dao/t_resource_batch_download.go create mode 100644 internal/dao/t_sim_bind_package_logs.go create mode 100644 internal/dao/t_sim_card_bind_pkg.go create mode 100644 internal/dao/t_sim_card_info.go create mode 100644 internal/dao/t_sim_card_stock.go create mode 100644 internal/dao/t_sim_channel_template.go create mode 100644 internal/dao/t_sim_channels.go create mode 100644 internal/dao/t_sim_flow_package_info.go create mode 100644 internal/dao/t_sim_flow_package_price.go create mode 100644 internal/dao/t_sim_flow_pool.go create mode 100644 internal/dao/t_sim_package_category.go create mode 100644 internal/dao/t_sim_pool.go create mode 100644 internal/dao/t_sim_pool_bind_package.go create mode 100644 internal/dao/t_sim_pool_warn_config.go create mode 100644 internal/dao/t_sim_upstream_package.go create mode 100644 internal/dao/t_tplatform_setting.go create mode 100644 internal/dao/t_wo_audit.go create mode 100644 internal/dao/t_wo_communication.go create mode 100644 internal/dao/t_wo_main.go create mode 100644 internal/dao/t_wo_record.go create mode 100644 internal/dao/test_demo.go create mode 100644 internal/library/batchimport/batch_no.go create mode 100644 internal/library/batchimport/batch_no_test.go create mode 100644 internal/library/batchmetadata/metadata.go create mode 100644 internal/library/bcache/bcache.go create mode 100644 internal/library/bcache/bcache_api_auth.go create mode 100644 internal/library/cache/cache.go create mode 100644 internal/library/cache/file/file.go create mode 100644 internal/library/contexts/contexts.go create mode 100644 internal/library/mcache/mcache.go create mode 100644 internal/library/rabbitmq/rabbitmq.go create mode 100644 internal/library/utils/utils.go create mode 100644 internal/library/xgorm/dao.go create mode 100644 internal/library/xgorm/dao_tree.go create mode 100644 internal/library/xgorm/gorm_model/gorm_tree.go create mode 100644 internal/library/xgorm/handler/filter_auth.go create mode 100644 internal/library/xgorm/handler/force_cache.go create mode 100644 internal/library/xgorm/handler/handler.go create mode 100644 internal/library/xgorm/handler/tenant.go create mode 100644 internal/library/xgorm/hook/member.go create mode 100644 internal/logic/common/batch_metadata_test.go create mode 100644 internal/logic/common/batch_wait.go create mode 100644 internal/logic/common/card_identifiers.go create mode 100644 internal/logic/common/common.go create mode 100644 internal/logic/common/renew.go create mode 100644 internal/logic/common/single_result.go create mode 100644 internal/logic/common/traffic_cutoff_config.go create mode 100644 internal/logic/common/traffic_cutoff_helpers.go create mode 100644 internal/logic/common/traffic_cutoff_validation.go create mode 100644 internal/logic/logic.go create mode 100644 internal/logic/middleware/middleware.go create mode 100644 internal/logic/oldApi/query.go create mode 100644 internal/logic/openapiiot/card_info.go create mode 100644 internal/logic/query/batch_imei_test.go create mode 100644 internal/logic/query/batch_query.go create mode 100644 internal/logic/query/batch_status.go create mode 100644 internal/logic/query/batch_status_test.go create mode 100644 internal/logic/query/sim.go create mode 100644 internal/logic/query/token.go create mode 100644 internal/logic/query/traffic_cutoff_config.go create mode 100644 internal/logic/upstream/upstream_chan.go create mode 100644 internal/model/agent_dept.go create mode 100644 internal/model/agent_role.go create mode 100644 internal/model/agent_user.go create mode 100644 internal/model/alipay.go create mode 100644 internal/model/batch_detail_list.go create mode 100644 internal/model/batch_execution_log.go create mode 100644 internal/model/batch_main.go create mode 100644 internal/model/bcache_model.go create mode 100644 internal/model/common.go create mode 100644 internal/model/context.go create mode 100644 internal/model/do/batch_detail.go create mode 100644 internal/model/do/batch_main.go create mode 100644 internal/model/do/sys_client.go create mode 100644 internal/model/do/sys_config.go create mode 100644 internal/model/do/sys_dept.go create mode 100644 internal/model/do/sys_dict_data.go create mode 100644 internal/model/do/sys_dict_type.go create mode 100644 internal/model/do/sys_gen_table.go create mode 100644 internal/model/do/sys_job.go create mode 100644 internal/model/do/sys_logininfor.go create mode 100644 internal/model/do/sys_menu.go create mode 100644 internal/model/do/sys_notice.go create mode 100644 internal/model/do/sys_notice_user.go create mode 100644 internal/model/do/sys_oper_log.go create mode 100644 internal/model/do/sys_oss.go create mode 100644 internal/model/do/sys_oss_config.go create mode 100644 internal/model/do/sys_post.go create mode 100644 internal/model/do/sys_role.go create mode 100644 internal/model/do/sys_role_dept.go create mode 100644 internal/model/do/sys_role_menu.go create mode 100644 internal/model/do/sys_social.go create mode 100644 internal/model/do/sys_tenant.go create mode 100644 internal/model/do/sys_tenant_package.go create mode 100644 internal/model/do/sys_user.go create mode 100644 internal/model/do/sys_user_online.go create mode 100644 internal/model/do/sys_user_post.go create mode 100644 internal/model/do/sys_user_role.go create mode 100644 internal/model/do/t_agent_balance.go create mode 100644 internal/model/do/t_agent_enterprise.go create mode 100644 internal/model/do/t_api.go create mode 100644 internal/model/do/t_api_group.go create mode 100644 internal/model/do/t_api_group_resource.go create mode 100644 internal/model/do/t_api_resource.go create mode 100644 internal/model/do/t_balance_detail.go create mode 100644 internal/model/do/t_consume_account_month_bill.go create mode 100644 internal/model/do/t_credit_detail.go create mode 100644 internal/model/do/t_cust_withdraw_account.go create mode 100644 internal/model/do/t_dept_flow_daily.go create mode 100644 internal/model/do/t_division_code.go create mode 100644 internal/model/do/t_fin_commission_detail.go create mode 100644 internal/model/do/t_fin_withdrawable_change.go create mode 100644 internal/model/do/t_finance_apply.go create mode 100644 internal/model/do/t_finance_audit_record.go create mode 100644 internal/model/do/t_order.go create mode 100644 internal/model/do/t_order_item.go create mode 100644 internal/model/do/t_package_customer.go create mode 100644 internal/model/do/t_profit_account_month_bill.go create mode 100644 internal/model/do/t_resource_batch_download.go create mode 100644 internal/model/do/t_sim_bind_package_logs.go create mode 100644 internal/model/do/t_sim_card_bind_pkg.go create mode 100644 internal/model/do/t_sim_card_info.go create mode 100644 internal/model/do/t_sim_card_stock.go create mode 100644 internal/model/do/t_sim_channel_template.go create mode 100644 internal/model/do/t_sim_channels.go create mode 100644 internal/model/do/t_sim_flow_package_info.go create mode 100644 internal/model/do/t_sim_flow_package_price.go create mode 100644 internal/model/do/t_sim_flow_pool.go create mode 100644 internal/model/do/t_sim_package_category.go create mode 100644 internal/model/do/t_sim_pool_bind_package.go create mode 100644 internal/model/do/t_sim_pool_warn_config.go create mode 100644 internal/model/do/t_sim_upstream_package.go create mode 100644 internal/model/do/t_tplatform_setting.go create mode 100644 internal/model/do/t_wo_audit.go create mode 100644 internal/model/do/t_wo_communication.go create mode 100644 internal/model/do/t_wo_main.go create mode 100644 internal/model/do/t_wo_record.go create mode 100644 internal/model/do/test_demo.go create mode 100644 internal/model/entity/batch_detail.go create mode 100644 internal/model/entity/batch_main.go create mode 100644 internal/model/entity/sys_client.go create mode 100644 internal/model/entity/sys_config.go create mode 100644 internal/model/entity/sys_dept.go create mode 100644 internal/model/entity/sys_dict_data.go create mode 100644 internal/model/entity/sys_dict_type.go create mode 100644 internal/model/entity/sys_gen_table.go create mode 100644 internal/model/entity/sys_job.go create mode 100644 internal/model/entity/sys_logininfor.go create mode 100644 internal/model/entity/sys_menu.go create mode 100644 internal/model/entity/sys_notice.go create mode 100644 internal/model/entity/sys_notice_user.go create mode 100644 internal/model/entity/sys_oper_log.go create mode 100644 internal/model/entity/sys_oss.go create mode 100644 internal/model/entity/sys_oss_config.go create mode 100644 internal/model/entity/sys_post.go create mode 100644 internal/model/entity/sys_role.go create mode 100644 internal/model/entity/sys_role_dept.go create mode 100644 internal/model/entity/sys_role_menu.go create mode 100644 internal/model/entity/sys_social.go create mode 100644 internal/model/entity/sys_tenant.go create mode 100644 internal/model/entity/sys_tenant_package.go create mode 100644 internal/model/entity/sys_user.go create mode 100644 internal/model/entity/sys_user_online.go create mode 100644 internal/model/entity/sys_user_post.go create mode 100644 internal/model/entity/sys_user_role.go create mode 100644 internal/model/entity/t_agent_balance.go create mode 100644 internal/model/entity/t_agent_enterprise.go create mode 100644 internal/model/entity/t_api.go create mode 100644 internal/model/entity/t_api_group.go create mode 100644 internal/model/entity/t_api_group_resource.go create mode 100644 internal/model/entity/t_api_resource.go create mode 100644 internal/model/entity/t_balance_detail.go create mode 100644 internal/model/entity/t_consume_account_month_bill.go create mode 100644 internal/model/entity/t_credit_detail.go create mode 100644 internal/model/entity/t_cust_withdraw_account.go create mode 100644 internal/model/entity/t_dept_flow_daily.go create mode 100644 internal/model/entity/t_division_code.go create mode 100644 internal/model/entity/t_fin_commission_detail.go create mode 100644 internal/model/entity/t_fin_withdrawable_change.go create mode 100644 internal/model/entity/t_finance_apply.go create mode 100644 internal/model/entity/t_finance_audit_record.go create mode 100644 internal/model/entity/t_order.go create mode 100644 internal/model/entity/t_order_item.go create mode 100644 internal/model/entity/t_package_customer.go create mode 100644 internal/model/entity/t_profit_account_month_bill.go create mode 100644 internal/model/entity/t_resource_batch_download.go create mode 100644 internal/model/entity/t_sim_bind_package_logs.go create mode 100644 internal/model/entity/t_sim_card_bind_pkg.go create mode 100644 internal/model/entity/t_sim_card_info.go create mode 100644 internal/model/entity/t_sim_card_stock.go create mode 100644 internal/model/entity/t_sim_channel_template.go create mode 100644 internal/model/entity/t_sim_channels.go create mode 100644 internal/model/entity/t_sim_flow_package_info.go create mode 100644 internal/model/entity/t_sim_flow_package_price.go create mode 100644 internal/model/entity/t_sim_flow_pool.go create mode 100644 internal/model/entity/t_sim_package_category.go create mode 100644 internal/model/entity/t_sim_pool_bind_package.go create mode 100644 internal/model/entity/t_sim_pool_warn_config.go create mode 100644 internal/model/entity/t_sim_upstream_package.go create mode 100644 internal/model/entity/t_tplatform_setting.go create mode 100644 internal/model/entity/t_wo_audit.go create mode 100644 internal/model/entity/t_wo_communication.go create mode 100644 internal/model/entity/t_wo_main.go create mode 100644 internal/model/entity/t_wo_record.go create mode 100644 internal/model/entity/test_demo.go create mode 100644 internal/model/genin/test_demo.go create mode 100644 internal/model/home.go create mode 100644 internal/model/monitor_server.go create mode 100644 internal/model/mybytes.go create mode 100644 internal/model/oldapi.go create mode 100644 internal/model/qrcode.go create mode 100644 internal/model/query_auth.go create mode 100644 internal/model/query_sim.go create mode 100644 internal/model/request/common.go create mode 100644 internal/model/response/common.go create mode 100644 internal/model/shared_token.go create mode 100644 internal/model/sys_auth.go create mode 100644 internal/model/sys_client.go create mode 100644 internal/model/sys_config.go create mode 100644 internal/model/sys_dept.go create mode 100644 internal/model/sys_dict.go create mode 100644 internal/model/sys_job.go create mode 100644 internal/model/sys_logininfor.go create mode 100644 internal/model/sys_menu.go create mode 100644 internal/model/sys_notice.go create mode 100644 internal/model/sys_notice_user.go create mode 100644 internal/model/sys_oper_log.go create mode 100644 internal/model/sys_oss.go create mode 100644 internal/model/sys_oss_config.go create mode 100644 internal/model/sys_post.go create mode 100644 internal/model/sys_role.go create mode 100644 internal/model/sys_social.go create mode 100644 internal/model/sys_tenant.go create mode 100644 internal/model/sys_tenant_package.go create mode 100644 internal/model/sys_user.go create mode 100644 internal/model/sys_user_online.go create mode 100644 internal/model/t_agent_balance.go create mode 100644 internal/model/t_agent_enterprise.go create mode 100644 internal/model/t_api.go create mode 100644 internal/model/t_api_group.go create mode 100644 internal/model/t_api_resource.go create mode 100644 internal/model/t_balance_detail.go create mode 100644 internal/model/t_consume_account_month_bill.go create mode 100644 internal/model/t_credit_detail.go create mode 100644 internal/model/t_cust_withdraw_account.go create mode 100644 internal/model/t_division_code.go create mode 100644 internal/model/t_fin_commission_detail.go create mode 100644 internal/model/t_fin_withdrawable_change.go create mode 100644 internal/model/t_finance_apply.go create mode 100644 internal/model/t_finance_audit_record.go create mode 100644 internal/model/t_profit_account_month_bill.go create mode 100644 internal/model/t_sim_card_bind_pkg.go create mode 100644 internal/model/t_sim_card_change.go create mode 100644 internal/model/t_sim_card_inbound.go create mode 100644 internal/model/t_sim_card_info.go create mode 100644 internal/model/t_sim_card_lifecycle.go create mode 100644 internal/model/t_sim_card_outbound.go create mode 100644 internal/model/t_sim_card_renew.go create mode 100644 internal/model/t_sim_card_stock.go create mode 100644 internal/model/t_sim_card_unsub.go create mode 100644 internal/model/t_sim_channel_template.go create mode 100644 internal/model/t_sim_channels.go create mode 100644 internal/model/t_sim_diagnose.go create mode 100644 internal/model/t_sim_flow_package_info.go create mode 100644 internal/model/t_sim_flow_package_price.go create mode 100644 internal/model/t_sim_flow_pool.go create mode 100644 internal/model/t_sim_package_category.go create mode 100644 internal/model/t_sim_pool_warn_config.go create mode 100644 internal/model/t_tplatform_setting.go create mode 100644 internal/model/t_upstream_package.go create mode 100644 internal/model/t_wo_communication.go create mode 100644 internal/model/t_wo_main.go create mode 100644 internal/model/t_wo_record.go create mode 100644 internal/model/traffic_cutoff.go create mode 100644 internal/model/traffic_cutoff_query.go create mode 100644 internal/model/traffic_usage.go create mode 100644 internal/model/traffic_usage_sync.go create mode 100644 internal/model/upstream_chan.go create mode 100644 internal/model/work_order_queue.go create mode 100644 internal/model/worker_diagnostic.go create mode 100644 internal/packed/packed.go create mode 100644 internal/packed/response/response.go create mode 100644 internal/router/change.go create mode 100644 internal/router/common.go create mode 100644 internal/router/old_api.go create mode 100644 internal/router/query.go create mode 100644 internal/router/router.go create mode 100644 internal/service/common.go create mode 100644 internal/service/iot.go create mode 100644 internal/service/middleware.go create mode 100644 internal/service/old_api.go create mode 100644 internal/service/query.go create mode 100644 internal/service/upstream.go create mode 100644 internal/service/workerdiagnostic/worker_diagnostic.go create mode 100644 internal/service/workerdiagnostic/worker_diagnostic_test.go create mode 100644 main.go create mode 100644 manifest/config/config.yaml create mode 100644 manifest/deploy/kustomize/base/deployment.yaml create mode 100644 manifest/deploy/kustomize/base/kustomization.yaml create mode 100644 manifest/deploy/kustomize/base/service.yaml create mode 100644 manifest/deploy/kustomize/overlays/develop/configmap.yaml create mode 100644 manifest/deploy/kustomize/overlays/develop/deployment.yaml create mode 100644 manifest/deploy/kustomize/overlays/develop/kustomization.yaml create mode 100644 manifest/docker/Dockerfile create mode 100644 manifest/docker/docker.sh create mode 100644 manifest/i18n/.gitkeep create mode 100644 manifest/protobuf/.keep-if-necessary create mode 100644 resource/template/.gitkeep create mode 100644 utility/convert/convert.go create mode 100644 utility/excel/excel.go create mode 100644 utility/gfredis/conn.go create mode 100644 utility/gfredis/gfredis.go create mode 100644 utility/gfredis/hash.go create mode 100644 utility/gfredis/key.go create mode 100644 utility/gfredis/list.go create mode 100644 utility/gfredis/string.go create mode 100644 utility/gfredis/subpub.go create mode 100644 utility/gfredis/zset.go create mode 100644 utility/hash/crc16.go create mode 100644 utility/hash/sum16.go create mode 100644 utility/tree/tree.go create mode 100644 utility/utility.go create mode 100644 utility/uuid32/uuid32.go create mode 100644 utility/version/version.go diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5837541 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +# 统一使用 LF,避免跨平台协作时产生整文件 diff +* text=auto eol=lf + +# 二进制文件不做行尾转换 +*.png binary +*.jpg binary +*.gif binary +*.ico binary +*.woff binary +*.woff2 binary +*.ttf binary +*.pdf binary +*.exe binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e288cbc --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.buildpath +.hgignore.swp +.project +.orig +.swp +.idea/ +.settings/ +.vscode/ +bin/ +**/.DS_Store +gf +main +main.exe +output/ +manifest/output/ +temp/ +temp.yaml +bin +resource/log/ +resource/public/ +resource/template/* +!resource/template/.gitkeep +kilo.json +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/Makefile b/Makefile new file mode 100644 index 0000000..2a6e6e9 --- /dev/null +++ b/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/api/common/common.go b/api/common/common.go new file mode 100644 index 0000000..10e372a --- /dev/null +++ b/api/common/common.go @@ -0,0 +1,14 @@ +package common + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/api/common/v1" +) + +type ICommonV1 interface { + SimSubscribe(ctx context.Context, req *v1.SimSubscribeReq) (res *v1.SingleRenewRes, err error) + BatchSimSubscribe(ctx context.Context, req *v1.BatchSimSubscribeReq) (res *v1.RenewRes, err error) + SimTrafficCutoff(ctx context.Context, req *v1.SimTrafficCutoffReq) (res *v1.SingleTrafficCutoffRes, err error) + BatchSimTrafficCutoff(ctx context.Context, req *v1.BatchSimTrafficCutoffReq) (res *v1.TrafficCutoffConfigRes, err error) +} diff --git a/api/common/v1/common.go b/api/common/v1/common.go new file mode 100644 index 0000000..3fc8ad7 --- /dev/null +++ b/api/common/v1/common.go @@ -0,0 +1,57 @@ +package v1 + +import ( + "github.com/gogf/gf/v2/frame/g" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +type SimSubscribeReq struct { + g.Meta `path:"/sim-subscribe" method:"POST" tags:"V3 Change API" summary:"Single SIM subscription renewal"` + AppId string `json:"appId" v:"required#appId is required"` + Iccid string `json:"iccid,omitempty"` + Msisdn string `json:"msisdn,omitempty"` + Imsi string `json:"imsi,omitempty"` + PackageId string `json:"packageId" v:"required#packageId is required"` + Validity int `json:"validity" v:"required|min:1#validity is required|validity must be greater than 0"` + Remark string `json:"remark,omitempty"` +} + +type BatchSimSubscribeReq struct { + g.Meta `path:"/batch-sim-subscribe" method:"POST" tags:"V3 Change API" summary:"Batch SIM subscription renewal"` + AppId string `json:"appId" v:"required#appId is required"` + Cards []model.CommonRenewCard `json:"cards,omitempty"` + Iccid []string `json:"iccid,omitempty"` + PackageId string `json:"packageId" v:"required#packageId is required"` + Validity int `json:"validity" v:"required|min:1#validity is required|validity must be greater than 0"` + Remark string `json:"remark,omitempty"` +} + +type RenewReq struct { + g.Meta `path:"/renew" method:"POST" tags:"V3 Common API" summary:"Renewal compatibility endpoint"` + model.CommonRenewParam +} + +type RenewRes struct{ model.CommonRenewRes } +type SingleRenewRes struct{ model.CommonSingleRenewRes } +type TrafficCutoffConfigRes struct { + model.CommonTrafficCutoffConfigRes +} +type SingleTrafficCutoffRes struct { + model.CommonSingleTrafficCutoffRes +} + +type SimTrafficCutoffReq struct { + g.Meta `path:"/sim-traffic-cutoff" method:"POST" tags:"V3 Change API" summary:"Single traffic cutoff configuration"` + model.CommonTrafficCutoffSingleParam +} + +type BatchSimTrafficCutoffReq struct { + g.Meta `path:"/batch-sim-traffic-cutoff" method:"POST" tags:"V3 Change API" summary:"Batch traffic cutoff configuration"` + model.CommonTrafficCutoffConfigParam +} + +type TrafficCutoffConfigReq struct { + g.Meta `path:"/traffic-cutoff-config" method:"POST" tags:"V3 Common API" summary:"Batch traffic cutoff compatibility endpoint"` + model.CommonTrafficCutoffConfigParam +} diff --git a/api/old_api/old_api.go b/api/old_api/old_api.go new file mode 100644 index 0000000..39f697e --- /dev/null +++ b/api/old_api/old_api.go @@ -0,0 +1,20 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package old_api + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/api/old_api/v1" +) + +type IOldApiV1 interface { + CardInfo(ctx context.Context, req *v1.CardInfoReq) (res *v1.CardInfoRes, err error) + SimDataUsage(ctx context.Context, req *v1.SimDataUsageReq) (res *v1.SimDataUsageRes, err error) + SimDataUsageMonthly(ctx context.Context, req *v1.SimDataUsageMonthlyReq) (res *v1.SimDataUsageMonthlyRes, err error) + SimStatus(ctx context.Context, req *v1.SimStatusReq) (res *v1.SimStatusRes, err error) + SimSession(ctx context.Context, req *v1.SimSessionReq) (res *v1.SimSessionRes, err error) + SimCardInfoList(ctx context.Context, req *v1.SimCardInfoListReq) (res *v1.SimCardInfoListRes, err error) +} diff --git a/api/old_api/v1/open.go b/api/old_api/v1/open.go new file mode 100644 index 0000000..dd559c3 --- /dev/null +++ b/api/old_api/v1/open.go @@ -0,0 +1,59 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type CardInfoReq struct { + g.Meta `path:"/cardInfo" method:"POST" tags:"old_Sim" summary:"查询SIM信息"` + model.SimCardInfoInput +} + +type CardInfoRes struct { + model.SimCardInfoOutput +} + +type SimDataUsageReq struct { + g.Meta `path:"/simDataUsage" method:"POST" tags:"old_Sim" summary:"查询SIM账期用量"` + model.SimDataUsageOldInput +} + +type SimDataUsageRes struct { + model.SimDataUsageOldOutput +} + +type SimDataUsageMonthlyReq struct { + g.Meta `path:"/simDataUsageMonthly" method:"POST" tags:"old_Sim" summary:"查询SIM历史用量"` + model.SimDataUsageMonthlyOldInput +} + +type SimDataUsageMonthlyRes struct { + model.SimDataUsageMonthlyOldOutput +} + +type SimStatusReq struct { + g.Meta `path:"/simStatus" method:"POST" tags:"old_Sim" summary:"查询SIM状态"` + model.SimStatusOldInput +} + +type SimStatusRes struct { + model.SimStatusOldOutput +} + +type SimSessionReq struct { + g.Meta `path:"/simSession" method:"POST" tags:"old_Sim" summary:"查询SIM会话"` + model.SimStatusOnlineOldInput +} + +type SimSessionRes struct { + model.SimStatusOnlineOldOutput +} + +type SimCardInfoListReq struct { + g.Meta `path:"/queryCardInfoList" method:"POST" tags:"old_Sim" summary:"查询SIM卡列表"` + model.QueryCardInfoListInput +} + +type SimCardInfoListRes = []model.QueryCardInfoListOutput diff --git a/api/query/query.go b/api/query/query.go new file mode 100644 index 0000000..e12844d --- /dev/null +++ b/api/query/query.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package query + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/api/query/v1" +) + +type IQueryV1 interface { + QuerySimInfo(ctx context.Context, req *v1.QuerySimInfoReq) (res *v1.QuerySimInfoRes, err error) + QuerySimLimit(ctx context.Context, req *v1.QuerySimLimitReq) (res *v1.QuerySimLimitRes, err error) + QuerySimImei(ctx context.Context, req *v1.QuerySimImeiReq) (res *v1.QuerySimImeiRes, err error) + QuerySimUsage(ctx context.Context, req *v1.QuerySimUsageReq) (res *v1.QuerySimUsageRes, err error) + QuerySimStatus(ctx context.Context, req *v1.QuerySimStatusReq) (res *v1.QuerySimStatusRes, err error) + QueryTrafficCutoffConfig(ctx context.Context, req *v1.QueryTrafficCutoffConfigReq) (res *v1.QueryTrafficCutoffConfigRes, err error) + QueryBatchStatus(ctx context.Context, req *v1.QueryBatchStatusReq) (res *v1.QueryBatchStatusRes, err error) + QuerySimStatusBatch(ctx context.Context, req *v1.QuerySimStatusBatchReq) (res *v1.QuerySimStatusBatchRes, err error) + QuerySimUsageBatch(ctx context.Context, req *v1.QuerySimUsageBatchReq) (res *v1.QuerySimUsageBatchRes, err error) + QuerySimImeiBatch(ctx context.Context, req *v1.QuerySimImeiBatchReq) (res *v1.QuerySimImeiBatchRes, err error) + Token(ctx context.Context, req *v1.TokenReq) (res *v1.TokenRes, err error) + OperatorToken(ctx context.Context, req *v1.OperatorTokenReq) (res *v1.OperatorTokenRes, err error) +} diff --git a/api/query/v1/sim.go b/api/query/v1/sim.go new file mode 100644 index 0000000..efe4df3 --- /dev/null +++ b/api/query/v1/sim.go @@ -0,0 +1,97 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +type QuerySimInfoReq struct { + g.Meta `path:"/sim-info" method:"POST" tags:"V3查询接口" summary:"查询SIM信息"` + model.QuerySimInput +} + +type QuerySimInfoRes struct { + model.QuerySimInfoOutput +} + +type QuerySimLimitReq struct { + g.Meta `path:"/sim-limit" method:"POST" tags:"V3查询接口" summary:"查询SIM流量限制"` + model.QuerySimInput +} + +type QuerySimLimitRes struct { + model.QuerySimLimitOutput +} + +type QuerySimImeiReq struct { + g.Meta `path:"/sim-imei" method:"POST" tags:"V3查询接口" summary:"查询SIM IMEI"` + model.QuerySimInput +} + +type QuerySimImeiRes struct { + model.QuerySimImeiOutput +} + +type QuerySimUsageReq struct { + g.Meta `path:"/sim-usage" method:"POST" tags:"V3查询接口" summary:"查询SIM流量使用"` + model.QuerySimInput +} + +type QuerySimUsageRes struct { + model.QuerySimUsageOutput +} + +type QuerySimStatusReq struct { + g.Meta `path:"/sim-status" method:"POST" tags:"V3查询接口" summary:"查询SIM卡状态"` + model.QuerySimInput +} + +type QuerySimStatusRes struct { + model.QuerySimCardStatusOutput +} + +type QueryTrafficCutoffConfigReq struct { + g.Meta `path:"/traffic-cutoff-config" method:"POST" tags:"V3查询接口" summary:"批量查询达量断网配置"` + model.QueryTrafficCutoffConfigParam +} + +type QueryTrafficCutoffConfigRes struct { + model.QueryTrafficCutoffConfigOutput +} + +type QueryBatchStatusReq struct { + g.Meta `path:"/batch-status" method:"POST" tags:"V3查询接口" summary:"查询批次状态"` + model.QueryBatchStatusParam +} + +type QueryBatchStatusRes struct { + model.QueryBatchStatusOutput +} + +type QuerySimStatusBatchReq struct { + g.Meta `path:"/sim-status-batch" method:"POST" tags:"V3查询接口" summary:"批量查询SIM卡状态"` + model.QuerySimStatusBatchParam +} + +type QuerySimStatusBatchRes struct { + model.QuerySimStatusBatchOutput +} + +type QuerySimUsageBatchReq struct { + g.Meta `path:"/sim-usage-batch" method:"POST" tags:"V3查询接口" summary:"批量查询SIM流量使用"` + model.QuerySimUsageBatchParam +} + +type QuerySimUsageBatchRes struct { + model.QuerySimUsageBatchOutput +} + +type QuerySimImeiBatchReq struct { + g.Meta `path:"/sim-imei-batch" method:"POST" tags:"V3查询接口" summary:"批量查询SIM IMEI"` + model.QuerySimImeiBatchParam +} + +type QuerySimImeiBatchRes struct { + model.QuerySimImeiBatchOutput +} diff --git a/api/query/v1/token.go b/api/query/v1/token.go new file mode 100644 index 0000000..39c6056 --- /dev/null +++ b/api/query/v1/token.go @@ -0,0 +1,25 @@ +package v1 + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + + "github.com/gogf/gf/v2/frame/g" +) + +// 获取Token +type TokenReq struct { + g.Meta `path:"/token" method:"POST" tags:"V3-Token获取" summary:"获取平台API Token"` + model.TokenInputApi +} +type TokenRes struct { + model.TokenOutputApi +} + +// 共享运营商token +type OperatorTokenReq struct { + g.Meta `path:"/operator-token" method:"POST" tags:"共享Token" summary:"共享运营商Token(需传入appId+chanKey)"` + model.OperatorTokenInput +} +type OperatorTokenRes struct { + model.OperatorTokenOutput +} diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..07bb8bf --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,47 @@ +FROM golang:1.25-alpine AS builder + +LABEL maintainer="iotlcm-openapi" + +ARG GOPROXY=https://goproxy.cn,direct +ENV GOPROXY=${GOPROXY} \ + GOSUMDB=off + +WORKDIR /app + +ENV GO111MODULE=on \ + CGO_ENABLED=0 \ + GOOS=linux \ + GOARCH=amd64 + +COPY go.mod go.sum ./ +RUN go mod download + +ARG BuildVersion +ARG BuildTime +ARG CommitID + +COPY . . +RUN go build -trimpath -ldflags="-s -w -X main.BuildVersion=${BuildVersion} -X main.BuildTime=${BuildTime} -X main.CommitID=${CommitID}" -o /app/bin/iotlcm-openapi . + +FROM alpine:3.23 + +LABEL maintainer="iotlcm-openapi" + +RUN apk add --no-cache ca-certificates tzdata && \ + cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + echo "Asia/Shanghai" > /etc/timezone + +ENV TZ=Asia/Shanghai \ + WORKDIR=/app + +COPY --from=builder /app/bin/iotlcm-openapi $WORKDIR/main +COPY --from=builder /app/resource $WORKDIR/resource +COPY --from=builder /app/manifest/i18n $WORKDIR/manifest/i18n +COPY --from=builder /app/build/build_config.yaml $WORKDIR/config/config.yaml +RUN mkdir -p $WORKDIR/config + +RUN chmod +x $WORKDIR/main + +EXPOSE 8000 + +CMD ["./main"] diff --git a/build/build_config.yaml b/build/build_config.yaml new file mode 100644 index 0000000..05df252 --- /dev/null +++ b/build/build_config.yaml @@ -0,0 +1,73 @@ +system: + name: "IotLCM-OpenAPI" + version: "1.0" + description: "IotLCM OpenAPI Service" + gfmode: "dev" + +server: + address: ":8000" + openapiPath: "/api.json" + swaggerPath: "/swagger" + maxHeaderBytes: "20KB" + clientMaxBodySize: "200MB" + readTimeout: "20m" + writeTimeout: "20m" + +logger: + path: "/app/logs" + file: "{Y-m-d-H}.log" + level: "dev" + timeFormat: "2006-01-02T15:04:05" + stdout: true + header: true + +jwt: + signingKey: "${JWT_SIGNING_KEY}" + expiresTime: "7d" + bufferTime: "1d" + issuer: "iotlcm" + +database: + logger: + path: "/app/logs/sql" + level: "all" + stdout: true + default: + link: "mysql:${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)/db_iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai" + debug: true + charset: "utf8mb4" + dryRun: false + maxIdle: 30 + maxOpen: 100 + maxLifetime: 120 + +cache: + adapter: "redis" + fileDir: "resource/cache" + +redis: + default: + mode: "single" + sentinelMasterName: "iotlcm-master" + address: "192.0.2.29:6379" + db: 0 + pass: "${REDIS_PASSWORD}" + minIdle: 5 + maxIdle: 30 + maxActive: 5000 + idleTimeout: "60s" + ClientName: "OpenAPICache" + +router: + exceptLogin: + - /openapi/v3/query/token + - /openapi/v3/query/operator-token + +upstream: + proxy: + address: "localhost:8510" + timeout: "10s" + +rabbitmq: + enabled: true + dsn: "amqp://${MQ_USER}:${MQ_PASSWORD}@${MQ_HOST}/" diff --git a/docs/batch-number.md b/docs/batch-number.md new file mode 100644 index 0000000..79afe76 --- /dev/null +++ b/docs/batch-number.md @@ -0,0 +1,11 @@ +# OpenAPI 批次编号 + +OpenAPI 续费与达量断网配置采用与控制台、小程序一致的编号:三位业务前缀、十四位年月日时分秒、三位当日序列,共二十位。例如 `REN20261012101612016`。 + +序列使用默认 Redis 的 `iotlcm:batch:no:seq:YYYYMMDD` 键,通过 Lua 原子递增,首次创建设置 48 小时有效期。不同业务前缀共用当日序列,范围为 001 至 999。Redis 不可用或序列超过上限时直接返回错误,不创建批次,不使用本地计数兜底。生成后其他步骤失败可能留下序列空号,这是正常行为。 + +部署前确认 OpenAPI、控制台和小程序使用同一 Redis 实例及数据库、相同的北京时间配置。仅键名一致不能保证跨服务共享序列。预演与生产必须使用各自隔离的 Redis,不得互相共用。 + +每日 999 个序列为现有两端规则,本次不扩大额度。API 单卡请求也消耗一个序列,上线前需核对三端合计峰值;如需更高容量,应另行统一调整三端序列宽度与规则。 + +历史批次号、数据库关联和 worker 消息不迁移,仍按完整批次号查询处理。该改动独立于接口授权检查,不解决权限默认放行问题。 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..26a1334 --- /dev/null +++ b/go.mod @@ -0,0 +1,65 @@ +module git.5iot.com/iotlcm-public/iotlcm-openapi + +go 1.23.0 + +toolchain go1.23.5 + +require ( + 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/mileusna/useragent v1.3.5 + github.com/rabbitmq/amqp091-go v1.10.0 + github.com/redis/go-redis/v9 v9.7.0 + github.com/xuri/excelize/v2 v2.9.0 + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 +) + +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-sql-driver/mysql v1.7.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/grokify/html-strip-tags-go v0.1.0 // 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/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/olekukonko/tablewriter v1.1.0 // 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/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect + github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel v1.38.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/net v0.40.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.25.0 // 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/go.sum b/go.sum new file mode 100644 index 0000000..8adcafc --- /dev/null +++ b/go.sum @@ -0,0 +1,142 @@ +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.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/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/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-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/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +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.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/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +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/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/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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +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/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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +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= +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.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/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +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/hack/hack-cli.mk b/hack/hack-cli.mk new file mode 100644 index 0000000..526124e --- /dev/null +++ b/hack/hack-cli.mk @@ -0,0 +1,18 @@ + +# Install/Update to the latest CLI tool. +.PHONY: cli +cli: + @set -e; \ + echo "go install github.com/gogf/gf/cmd/gf/v2@latest"; \ + go install github.com/gogf/gf/cmd/gf/v2@latest; \ + echo "GoFame CLI installed successfully!" + + +# 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/hack/hack.mk b/hack/hack.mk new file mode 100644 index 0000000..2f68179 --- /dev/null +++ b/hack/hack.mk @@ -0,0 +1,75 @@ +.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 + +# 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 \ No newline at end of file diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go new file mode 100644 index 0000000..22bc867 --- /dev/null +++ b/internal/cmd/cmd.go @@ -0,0 +1,65 @@ +package cmd + +import ( + "context" + "errors" + + _ "github.com/gogf/gf/contrib/drivers/mysql/v2" + _ "github.com/gogf/gf/contrib/drivers/sqlite/v2" + _ "github.com/gogf/gf/contrib/nosql/redis/v2" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcmd" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmode" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/cache" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/rabbitmq" + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/router" +) + +var ( + Main = gcmd.Command{ + Name: "main", + Usage: "main", + Brief: "start http server", + Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { + if err = systemInit(ctx); err != nil { + return err + } + defer func() { _ = rabbitmq.Close() }() + s := g.Server() + s.SetDumpRouterMap(true) + router.InitRouter(ctx, s) + s.Run() + return nil + }, + } +) + +func systemInit(ctx context.Context) error { + if err := g.DB().PingMaster(); err != nil { + return errors.New("connect database failed") + } + + setGFMode(ctx) + if err := gtime.SetTimeZone("Asia/Shanghai"); err != nil { + return err + } + cache.SetAdapter(ctx) + return nil +} + +func setGFMode(ctx context.Context) { + gfmode := g.Cfg().MustGet(ctx, "system.gfmode").String() + if gfmode == "" { + gfmode = gmode.NOT_SET + } + + for _, mode := range []string{gmode.DEVELOP, gmode.TESTING, gmode.STAGING, gmode.PRODUCT} { + if mode == gfmode { + gmode.Set(mode) + return + } + } +} diff --git a/internal/consts/batch.go b/internal/consts/batch.go new file mode 100644 index 0000000..3437a3d --- /dev/null +++ b/internal/consts/batch.go @@ -0,0 +1,181 @@ +package consts + +const ( + // 批次异步状态 batch_async_status + BatchAsyncStatusCreated = 0 // 已创建 + BatchAsyncStatusPending = 1 // 待处理 + BatchAsyncStatusProcessing = 2 // 处理中 + BatchAsyncStatusSuccess = 3 // 成功 + BatchAsyncStatusFailed = 4 // 失败 + BatchAsyncStatusPartialSuccess = 5 // 部分成功 +) + +const ( + // 批次运行结果 run_result + BatchRunResultPending = 0 // 待运行 + BatchRunResultRunning = 1 // 运行中 + BatchRunResultSuccess = 2 // 成功 + BatchRunResultFailed = 3 // 失败 + BatchRunResultPartialSuccess = 4 // 部分成功 +) + +const ( + // 批次业务状态 batch_status + BatchStatusNormal = 0 // 正常 + BatchStatusAbandoned = 1 // 废弃 +) + +const ( + // 批次明细状态 detail_status + BatchDetailStatusPending = 0 // 待处理 + BatchDetailStatusRunning = 1 // 处理中 + BatchDetailStatusSuccess = 2 // 成功 + BatchDetailStatusFailed = 3 // 失败 +) + +const ( + BatchSourceTypeBatchSelect = 0 + BatchSourceTypeRange = 1 + BatchSourceTypeBatchInput = 2 + BatchSourceTypeFile = 3 +) + +const ( + // 通用批次类型 1-99 + BatchTypeInbound = 1 // 入库 + BatchTypeOutbound = 2 // 出库 + BatchTypeAllocate = 3 // 划拨 + BatchTypePrepare = 4 // 预处理 + + // 卡业务专属批次类型 101-199 + BatchTypeRenew = 101 // 卡续费 + BatchTypeChange = 102 // 卡变更 + BatchTypeStart = 103 // 卡开机 + BatchTypeStop = 104 // 卡停机 + BatchTypeRestart = 105 // 卡停复机 + BatchTypeCancel = 106 // 卡销户 + BatchTypeDataCut = 107 // 卡达量断网 + BatchTypeUnsub = 108 // 卡退订 + + BatchTypeDataStart = 109 // 数据服务开通 + BatchTypeDataStop = 110 // 数据服务停用 +) + +const ( + // 通用批次编号前缀 + BatchNoPrefixInbound = "IN" + BatchNoPrefixOutbound = "OUT" + BatchNoPrefixAllocate = "ALC" + + // 卡业务专属批次编号前缀 + 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 + ResourceExportSceneRenew = 101 + ResourceExportSceneChange = 102 + ResourceExportSceneUnsub = 108 + ResourceExportSceneDataStart = 109 + ResourceExportSceneDataStop = 110 +) + +const ( + ImportStatusSuccess = "success" + ImportStatusFailed = "failed" +) + +const ( + ResourceBatchDownloadTaskSimCardInbound = "卡入库结果" + ResourceBatchDownloadTaskSimCardOutbound = "卡出库结果" + ResourceBatchDownloadTaskSimCardRenew = "卡续费结果" + ResourceBatchDownloadTaskSimCardChange = "卡变更套餐结果" + ResourceBatchDownloadTaskSimCardUnsub = "卡退订结果" + SimCardInboundMaxFileSize = 50 << 20 + SimCardInboundSubDirImportInput = "sim-card-inbound/import-input" + SimCardInboundDefaultInputInlineMaxRows = 1000 + SimCardOutboundMaxFileSize = 50 << 20 + SimCardRenewMaxFileSize = 50 << 20 + SimCardChangeMaxFileSize = 50 << 20 + SimCardUnsubMaxFileSize = 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" + SimCardUnsubSubDirImportExcel = "sim-card-unsub/import" + SimCardUnsubSubDirResultExcel = "sim-card-unsub/result" + SimCardDataStartMaxFileSize = 50 << 20 + SimCardDataStopMaxFileSize = 50 << 20 + SimCardDataStartSubDirImportExcel = "sim-card-data-start/import" + SimCardDataStartSubDirResultExcel = "sim-card-data-start/result" + SimCardDataStopSubDirImportExcel = "sim-card-data-stop/import" + SimCardDataStopSubDirResultExcel = "sim-card-data-stop/result" +) + +const ( + OrderTypeCardSubscribe = 1 + + OrderStatusCompleted = 5 + + CustomerTypeAgent = 1 + + PayTypeOffline = 3 + + PayStatusPaid = 2 + + ProductTypeCard = 1 + + PayModeYearMonth = 1 + + PackageBusinessTypeSubscribe = 0 + + 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/internal/consts/bcache.go b/internal/consts/bcache.go new file mode 100644 index 0000000..bbe63f8 --- /dev/null +++ b/internal/consts/bcache.go @@ -0,0 +1,12 @@ +// Package consts 定义缓存键模板。 +package consts + +const ( + KeySysAuthToken = "login:%d:%s" // 系统认证token缓存 login:{userId}:{uuid} + KeySysAuthTokenReject = "login_reject:%d:%s:" // 系统认证token拒绝缓存 login_reject:{userId}:{uuid} + KeyApiAuthToken = "api:auth:token:%s" // 接口认证长令牌缓存 api:auth:token:{uuid} + KeyApiAuthActiveToken = "api:auth:active:%d" // 接口认证当前令牌索引 api:auth:active:{deptId} + 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:%d" // 用户mfa验证码缓存 user:mfa:{uuid} +) diff --git a/internal/consts/code.go b/internal/consts/code.go new file mode 100644 index 0000000..49fb677 --- /dev/null +++ b/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/internal/consts/config.go b/internal/consts/config.go new file mode 100644 index 0000000..b6bf46d --- /dev/null +++ b/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/internal/consts/consts.go b/internal/consts/consts.go new file mode 100644 index 0000000..da0878d --- /dev/null +++ b/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/internal/consts/db.go b/internal/consts/db.go new file mode 100644 index 0000000..2256ce4 --- /dev/null +++ b/internal/consts/db.go @@ -0,0 +1,6 @@ +package consts + +const ( + DBNameDefault = "default" + DBNameMemory = "memorydb" +) diff --git a/internal/consts/event.go b/internal/consts/event.go new file mode 100644 index 0000000..d568d9b --- /dev/null +++ b/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/internal/consts/http.go b/internal/consts/http.go new file mode 100644 index 0000000..6db02b7 --- /dev/null +++ b/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/internal/consts/mcache.go b/internal/consts/mcache.go new file mode 100644 index 0000000..65f7e54 --- /dev/null +++ b/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/internal/consts/queue.go b/internal/consts/queue.go new file mode 100644 index 0000000..fa27f9e --- /dev/null +++ b/internal/consts/queue.go @@ -0,0 +1,26 @@ +// 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" + QueueWorkOrderAutoClose = "iotlcm.work_order.auto_close" + QueueWorkOrderAutoCloseDelay = "iotlcm.work_order.auto_close.delay" + QueueWorkerDiagnostic = "iotlcm.worker.diagnostic" + QueueBatchExecute = "iotlcm.batch.execute" +) + +// 数据库变动类型 +const ( + DbChgTypeAdd = "add" // 数据库变动新增 + DbChgTypeEdit = "edit" // 数据库变动编辑 + DbChgTypeDel = "del" // 数据库变动删除 +) +const ( + BroadcastDbChg = "broadcast:db:chg" // 数据库配置表变动更新广播消息 obj{table_name,pk,type:add/edit/del,data:{主要字段数据}} +) diff --git a/internal/consts/sim_card_lifecycle.go b/internal/consts/sim_card_lifecycle.go new file mode 100644 index 0000000..4f09524 --- /dev/null +++ b/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/internal/consts/system.go b/internal/consts/system.go new file mode 100644 index 0000000..c12cf33 --- /dev/null +++ b/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/internal/consts/traffic_cutoff.go b/internal/consts/traffic_cutoff.go new file mode 100644 index 0000000..a6d74ca --- /dev/null +++ b/internal/consts/traffic_cutoff.go @@ -0,0 +1,6 @@ +package consts + +const ( + BatchTypeTrafficCutoffConfig = 41 + BatchNoPrefixTrafficCutoffConfig = `TCC` +) diff --git a/internal/consts/v3api.go b/internal/consts/v3api.go new file mode 100644 index 0000000..422135a --- /dev/null +++ b/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/internal/consts/websocket.go b/internal/consts/websocket.go new file mode 100644 index 0000000..9c49716 --- /dev/null +++ b/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/internal/controller/common/common_new.go b/internal/controller/common/common_new.go new file mode 100644 index 0000000..cf91fe2 --- /dev/null +++ b/internal/controller/common/common_new.go @@ -0,0 +1,11 @@ +package common + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/api/common" +) + +type ControllerV1 struct{} + +func NewV1() common.ICommonV1 { + return &ControllerV1{} +} diff --git a/internal/controller/common/renew.go b/internal/controller/common/renew.go new file mode 100644 index 0000000..120b190 --- /dev/null +++ b/internal/controller/common/renew.go @@ -0,0 +1,114 @@ +package common + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + + v1 "git.5iot.com/iotlcm-public/iotlcm-openapi/api/common/v1" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +func (c *ControllerV1) Renew(ctx context.Context, req *v1.RenewReq) (res *v1.RenewRes, err error) { + output, err := service.Common().SubmitRenew(ctx, &req.CommonRenewParam) + if err != nil { + return nil, err + } + return &v1.RenewRes{CommonRenewRes: *output}, nil +} + +func (c *ControllerV1) TrafficCutoffConfig(ctx context.Context, req *v1.TrafficCutoffConfigReq) (res *v1.TrafficCutoffConfigRes, err error) { + if req == nil { + return nil, gerror.New("请求参数不能为空") + } + req.CommonTrafficCutoffConfigParam.IdempotencyKey = g.RequestFromCtx(ctx).Header.Get("Idempotency-Key") + output, err := service.Common().SubmitTrafficCutoffConfig(ctx, &req.CommonTrafficCutoffConfigParam) + if err != nil { + return nil, err + } + return &v1.TrafficCutoffConfigRes{CommonTrafficCutoffConfigRes: *output}, nil +} + +func (c *ControllerV1) SimSubscribe(ctx context.Context, req *v1.SimSubscribeReq) (res *v1.SingleRenewRes, err error) { + if req == nil { + return nil, gerror.New("请求参数不能为空") + } + output, err := service.Common().SubmitSingleRenew(ctx, model.CommonRenewCard{ + Iccid: req.Iccid, + Msisdn: req.Msisdn, + Imsi: req.Imsi, + PackageId: req.PackageId, + }, req.AppId, req.PackageId, req.Remark, req.Validity) + if err != nil { + return &v1.SingleRenewRes{CommonSingleRenewRes: model.CommonSingleRenewRes{ + OrderId: "0", + OrderSn: "", + Iccid: req.Iccid, + Status: "failed", + ErrorCode: "RENEW_FAILED", + ErrorMessage: err.Error(), + }}, nil + } + return &v1.SingleRenewRes{CommonSingleRenewRes: *output}, nil +} + +func (c *ControllerV1) BatchSimSubscribe(ctx context.Context, req *v1.BatchSimSubscribeReq) (res *v1.RenewRes, err error) { + if req == nil { + return nil, gerror.New("请求参数不能为空") + } + output, err := service.Common().SubmitBatchRenew(ctx, req.AppId, req.Cards, req.Iccid, req.PackageId, req.Remark, req.Validity) + if err != nil { + return nil, err + } + return &v1.RenewRes{CommonRenewRes: *output}, nil +} + +func (c *ControllerV1) SimTrafficCutoff(ctx context.Context, req *v1.SimTrafficCutoffReq) (res *v1.SingleTrafficCutoffRes, err error) { + if req == nil { + return nil, gerror.New("请求参数不能为空") + } + output, err := service.Common().SubmitSingleTrafficCutoffConfig(ctx, &req.CommonTrafficCutoffSingleParam) + if err != nil { + threshold := req.TrafficCutoffThreshold + if req.TrafficCutoffStatus == 0 { + threshold = 0 + } + return &v1.SingleTrafficCutoffRes{CommonSingleTrafficCutoffRes: model.CommonSingleTrafficCutoffRes{ + Success: false, + Iccid: req.Iccid, + Msisdn: req.Msisdn, + Imsi: req.Imsi, + TrafficCutoffStatus: req.TrafficCutoffStatus, + TrafficCutoffThreshold: threshold, + TrafficCutoffThresholdUnit: "MB", + Message: err.Error(), + ErrorCode: "TRAFFIC_CUTOFF_FAILED", + }}, nil + } + return &v1.SingleTrafficCutoffRes{CommonSingleTrafficCutoffRes: *output}, nil +} + +func (c *ControllerV1) BatchSimTrafficCutoff(ctx context.Context, req *v1.BatchSimTrafficCutoffReq) (res *v1.TrafficCutoffConfigRes, err error) { + if req == nil { + return nil, gerror.New("请求参数不能为空") + } + req.CommonTrafficCutoffConfigParam.IdempotencyKey = g.RequestFromCtx(ctx).Header.Get("Idempotency-Key") + output, err := service.Common().SubmitTrafficCutoffConfig(ctx, &req.CommonTrafficCutoffConfigParam) + if err != nil { + return nil, err + } + return &v1.TrafficCutoffConfigRes{CommonTrafficCutoffConfigRes: *output}, nil +} + +func trafficCutoffStatusName(status int) string { + switch status { + case 1: + return "已开启" + case 2: + return "已关闭" + default: + return "删除" + } +} diff --git a/internal/controller/old_api/old_api.go b/internal/controller/old_api/old_api.go new file mode 100644 index 0000000..24ae9f4 --- /dev/null +++ b/internal/controller/old_api/old_api.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package old_api diff --git a/internal/controller/old_api/old_api_new.go b/internal/controller/old_api/old_api_new.go new file mode 100644 index 0000000..c87fd47 --- /dev/null +++ b/internal/controller/old_api/old_api_new.go @@ -0,0 +1,13 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package old_api + +import "git.5iot.com/iotlcm-public/iotlcm-openapi/api/old_api" + +type ControllerV1 struct{} + +func NewV1() old_api.IOldApiV1 { + return &ControllerV1{} +} diff --git a/internal/controller/old_api/query.go b/internal/controller/old_api/query.go new file mode 100644 index 0000000..fb54330 --- /dev/null +++ b/internal/controller/old_api/query.go @@ -0,0 +1,69 @@ +package old_api + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-openapi/api/old_api/v1" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +func (c *ControllerV1) CardInfo(ctx context.Context, req *v1.CardInfoReq) (res *v1.CardInfoRes, err error) { + simCardInfoOutput, err := service.OldApiQuery().QuerySimCard(ctx, &req.SimCardInfoInput) + if err != nil { + return nil, err + } + res = &v1.CardInfoRes{SimCardInfoOutput: *simCardInfoOutput} + return res, nil +} + +func (c *ControllerV1) SimDataUsage(ctx context.Context, req *v1.SimDataUsageReq) (res *v1.SimDataUsageRes, err error) { + simDataUsageOutput, err := service.OldApiQuery().QuerySimDataUsage(ctx, &req.SimDataUsageOldInput) + if err != nil { + return nil, err + } + res = &v1.SimDataUsageRes{ + SimDataUsageOldOutput: *simDataUsageOutput, + } + return res, nil +} + +func (c *ControllerV1) SimDataUsageMonthly(ctx context.Context, req *v1.SimDataUsageMonthlyReq) (res *v1.SimDataUsageMonthlyRes, err error) { + simDataUsageMonthlyOutput, err := service.OldApiQuery().QuerySimDataUsageMonthly(ctx, &req.SimDataUsageMonthlyOldInput) + if err != nil { + return nil, err + } + res = &v1.SimDataUsageMonthlyRes{ + SimDataUsageMonthlyOldOutput: *simDataUsageMonthlyOutput, + } + return res, nil +} + +func (c *ControllerV1) SimStatus(ctx context.Context, req *v1.SimStatusReq) (res *v1.SimStatusRes, err error) { + simStatusOutput, err := service.OldApiQuery().QuerySimStatus(ctx, &req.SimStatusOldInput) + if err != nil { + return nil, err + } + res = &v1.SimStatusRes{ + SimStatusOldOutput: *simStatusOutput, + } + return res, nil +} + +func (c *ControllerV1) SimSession(ctx context.Context, req *v1.SimSessionReq) (res *v1.SimSessionRes, err error) { + simSessionOutput, err := service.OldApiQuery().QuerySimSession(ctx, &req.SimStatusOnlineOldInput) + if err != nil { + return nil, err + } + res = &v1.SimSessionRes{ + SimStatusOnlineOldOutput: *simSessionOutput, + } + return res, nil +} + +func (c *ControllerV1) SimCardInfoList(ctx context.Context, req *v1.SimCardInfoListReq) (res *v1.SimCardInfoListRes, err error) { + simCardInfoListOutput, err := service.OldApiQuery().QueryCardInfoList(ctx, &req.QueryCardInfoListInput) + if err != nil { + return nil, err + } + return &simCardInfoListOutput, nil +} diff --git a/internal/controller/query/query.go b/internal/controller/query/query.go new file mode 100644 index 0000000..08e966b --- /dev/null +++ b/internal/controller/query/query.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package query diff --git a/internal/controller/query/query_new.go b/internal/controller/query/query_new.go new file mode 100644 index 0000000..ceadafb --- /dev/null +++ b/internal/controller/query/query_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package query + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/api/query" +) + +type ControllerV1 struct{} + +func NewV1() query.IQueryV1 { + return &ControllerV1{} +} diff --git a/internal/controller/query/sim.go b/internal/controller/query/sim.go new file mode 100644 index 0000000..42ac49b --- /dev/null +++ b/internal/controller/query/sim.go @@ -0,0 +1,93 @@ +package query + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-openapi/api/query/v1" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +func (c *ControllerV1) QuerySimInfo(ctx context.Context, req *v1.QuerySimInfoReq) (res *v1.QuerySimInfoRes, err error) { + output, err := service.QuerySim().QuerySimInfo(ctx, &req.QuerySimInput) + if err != nil { + return nil, err + } + res = &v1.QuerySimInfoRes{QuerySimInfoOutput: *output} + return res, nil +} + +func (c *ControllerV1) QuerySimLimit(ctx context.Context, req *v1.QuerySimLimitReq) (res *v1.QuerySimLimitRes, err error) { + output, err := service.QuerySim().QuerySimLimit(ctx, &req.QuerySimInput) + if err != nil { + return res, err + } + res = &v1.QuerySimLimitRes{QuerySimLimitOutput: *output} + return res, nil +} + +func (c *ControllerV1) QuerySimImei(ctx context.Context, req *v1.QuerySimImeiReq) (res *v1.QuerySimImeiRes, err error) { + output, err := service.QuerySim().QuerySimImei(ctx, &req.QuerySimInput) + if err != nil { + return nil, err + } + res = &v1.QuerySimImeiRes{QuerySimImeiOutput: *output} + return res, nil +} + +func (c *ControllerV1) QuerySimUsage(ctx context.Context, req *v1.QuerySimUsageReq) (res *v1.QuerySimUsageRes, err error) { + output, err := service.QuerySim().QuerySimUsage(ctx, &req.QuerySimInput) + if err != nil { + return nil, err + } + res = &v1.QuerySimUsageRes{QuerySimUsageOutput: *output} + return res, nil +} + +func (c *ControllerV1) QuerySimStatus(ctx context.Context, req *v1.QuerySimStatusReq) (res *v1.QuerySimStatusRes, err error) { + output, err := service.QuerySim().QuerySimStatus(ctx, &req.QuerySimInput) + if err != nil { + return nil, err + } + res = &v1.QuerySimStatusRes{QuerySimCardStatusOutput: *output} + return res, nil +} + +func (c *ControllerV1) QueryTrafficCutoffConfig(ctx context.Context, req *v1.QueryTrafficCutoffConfigReq) (res *v1.QueryTrafficCutoffConfigRes, err error) { + output, err := service.QuerySim().QueryTrafficCutoffConfig(ctx, &req.QueryTrafficCutoffConfigParam) + if err != nil { + return nil, err + } + return &v1.QueryTrafficCutoffConfigRes{QueryTrafficCutoffConfigOutput: *output}, nil +} + +func (c *ControllerV1) QueryBatchStatus(ctx context.Context, req *v1.QueryBatchStatusReq) (res *v1.QueryBatchStatusRes, err error) { + output, err := service.QuerySim().QueryBatchStatus(ctx, &req.QueryBatchStatusParam) + if err != nil { + return nil, err + } + return &v1.QueryBatchStatusRes{QueryBatchStatusOutput: *output}, nil +} + +func (c *ControllerV1) QuerySimStatusBatch(ctx context.Context, req *v1.QuerySimStatusBatchReq) (res *v1.QuerySimStatusBatchRes, err error) { + output, err := service.QuerySim().QuerySimStatusBatch(ctx, &req.QuerySimStatusBatchParam) + if err != nil { + return nil, err + } + return &v1.QuerySimStatusBatchRes{QuerySimStatusBatchOutput: *output}, nil +} + +func (c *ControllerV1) QuerySimUsageBatch(ctx context.Context, req *v1.QuerySimUsageBatchReq) (res *v1.QuerySimUsageBatchRes, err error) { + output, err := service.QuerySim().QuerySimUsageBatch(ctx, &req.QuerySimUsageBatchParam) + if err != nil { + return nil, err + } + return &v1.QuerySimUsageBatchRes{QuerySimUsageBatchOutput: *output}, nil +} + +func (c *ControllerV1) QuerySimImeiBatch(ctx context.Context, req *v1.QuerySimImeiBatchReq) (res *v1.QuerySimImeiBatchRes, err error) { + output, err := service.QuerySim().QuerySimImeiBatch(ctx, &req.QuerySimImeiBatchParam) + if err != nil { + return nil, err + } + return &v1.QuerySimImeiBatchRes{QuerySimImeiBatchOutput: *output}, nil +} diff --git a/internal/controller/query/token.go b/internal/controller/query/token.go new file mode 100644 index 0000000..76b25c6 --- /dev/null +++ b/internal/controller/query/token.go @@ -0,0 +1,26 @@ +package query + +import ( + "context" + + v1 "git.5iot.com/iotlcm-public/iotlcm-openapi/api/query/v1" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +func (c *ControllerV1) Token(ctx context.Context, req *v1.TokenReq) (res *v1.TokenRes, err error) { + out, err := service.QueryToken().Token(ctx, req.TokenInputApi) + if err != nil { + return nil, err + } + res = &v1.TokenRes{TokenOutputApi: out} + return res, nil +} + +func (c *ControllerV1) OperatorToken(ctx context.Context, req *v1.OperatorTokenReq) (res *v1.OperatorTokenRes, err error) { + out, err := service.QueryToken().OperatorTokenWithAuth(ctx, req.OperatorTokenInput) + if err != nil { + return nil, err + } + res = &v1.OperatorTokenRes{OperatorTokenOutput: out} + return res, nil +} diff --git a/internal/dao/batch_detail.go b/internal/dao/batch_detail.go new file mode 100644 index 0000000..082279b --- /dev/null +++ b/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-openapi/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/internal/dao/batch_main.go b/internal/dao/batch_main.go new file mode 100644 index 0000000..97db215 --- /dev/null +++ b/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-openapi/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/internal/dao/internal/batch_detail.go b/internal/dao/internal/batch_detail.go new file mode 100644 index 0000000..2facffc --- /dev/null +++ b/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/internal/dao/internal/batch_main.go b/internal/dao/internal/batch_main.go new file mode 100644 index 0000000..3ffc6a3 --- /dev/null +++ b/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/internal/dao/internal/sys_client.go b/internal/dao/internal/sys_client.go new file mode 100644 index 0000000..68581a0 --- /dev/null +++ b/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/internal/dao/internal/sys_config.go b/internal/dao/internal/sys_config.go new file mode 100644 index 0000000..9bd0555 --- /dev/null +++ b/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/internal/dao/internal/sys_dept.go b/internal/dao/internal/sys_dept.go new file mode 100644 index 0000000..724901e --- /dev/null +++ b/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/internal/dao/internal/sys_dict_data.go b/internal/dao/internal/sys_dict_data.go new file mode 100644 index 0000000..b8c182e --- /dev/null +++ b/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/internal/dao/internal/sys_dict_type.go b/internal/dao/internal/sys_dict_type.go new file mode 100644 index 0000000..0fd068d --- /dev/null +++ b/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/internal/dao/internal/sys_gen_table.go b/internal/dao/internal/sys_gen_table.go new file mode 100644 index 0000000..cfdcf1b --- /dev/null +++ b/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/internal/dao/internal/sys_job.go b/internal/dao/internal/sys_job.go new file mode 100644 index 0000000..d9384f6 --- /dev/null +++ b/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/internal/dao/internal/sys_logininfor.go b/internal/dao/internal/sys_logininfor.go new file mode 100644 index 0000000..4db9a83 --- /dev/null +++ b/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/internal/dao/internal/sys_menu.go b/internal/dao/internal/sys_menu.go new file mode 100644 index 0000000..3a22bef --- /dev/null +++ b/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/internal/dao/internal/sys_notice.go b/internal/dao/internal/sys_notice.go new file mode 100644 index 0000000..72ad751 --- /dev/null +++ b/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/internal/dao/internal/sys_notice_user.go b/internal/dao/internal/sys_notice_user.go new file mode 100644 index 0000000..00836b9 --- /dev/null +++ b/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/internal/dao/internal/sys_oper_log.go b/internal/dao/internal/sys_oper_log.go new file mode 100644 index 0000000..0d82659 --- /dev/null +++ b/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/internal/dao/internal/sys_oss.go b/internal/dao/internal/sys_oss.go new file mode 100644 index 0000000..c0ce038 --- /dev/null +++ b/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/internal/dao/internal/sys_oss_config.go b/internal/dao/internal/sys_oss_config.go new file mode 100644 index 0000000..f373526 --- /dev/null +++ b/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/internal/dao/internal/sys_post.go b/internal/dao/internal/sys_post.go new file mode 100644 index 0000000..ee6f95e --- /dev/null +++ b/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/internal/dao/internal/sys_role.go b/internal/dao/internal/sys_role.go new file mode 100644 index 0000000..fffa627 --- /dev/null +++ b/internal/dao/internal/sys_role.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" +) + +// 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停用) + 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", + 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/internal/dao/internal/sys_role_dept.go b/internal/dao/internal/sys_role_dept.go new file mode 100644 index 0000000..8498277 --- /dev/null +++ b/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/internal/dao/internal/sys_role_menu.go b/internal/dao/internal/sys_role_menu.go new file mode 100644 index 0000000..1c99abd --- /dev/null +++ b/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/internal/dao/internal/sys_social.go b/internal/dao/internal/sys_social.go new file mode 100644 index 0000000..79dc0b3 --- /dev/null +++ b/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/internal/dao/internal/sys_tenant.go b/internal/dao/internal/sys_tenant.go new file mode 100644 index 0000000..f897116 --- /dev/null +++ b/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/internal/dao/internal/sys_tenant_package.go b/internal/dao/internal/sys_tenant_package.go new file mode 100644 index 0000000..f2a3720 --- /dev/null +++ b/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/internal/dao/internal/sys_user.go b/internal/dao/internal/sys_user.go new file mode 100644 index 0000000..cd5d855 --- /dev/null +++ b/internal/dao/internal/sys_user.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" +) + +// 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 // 密码 + 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", + 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/internal/dao/internal/sys_user_online.go b/internal/dao/internal/sys_user_online.go new file mode 100644 index 0000000..034b2cf --- /dev/null +++ b/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/internal/dao/internal/sys_user_post.go b/internal/dao/internal/sys_user_post.go new file mode 100644 index 0000000..3a182ca --- /dev/null +++ b/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/internal/dao/internal/sys_user_role.go b/internal/dao/internal/sys_user_role.go new file mode 100644 index 0000000..9646157 --- /dev/null +++ b/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/internal/dao/internal/t_agent_balance.go b/internal/dao/internal/t_agent_balance.go new file mode 100644 index 0000000..da9e49d --- /dev/null +++ b/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/internal/dao/internal/t_agent_enterprise.go b/internal/dao/internal/t_agent_enterprise.go new file mode 100644 index 0000000..026daa9 --- /dev/null +++ b/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/internal/dao/internal/t_api.go b/internal/dao/internal/t_api.go new file mode 100644 index 0000000..ffd5c48 --- /dev/null +++ b/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/internal/dao/internal/t_api_group.go b/internal/dao/internal/t_api_group.go new file mode 100644 index 0000000..d2fb7ad --- /dev/null +++ b/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/internal/dao/internal/t_api_group_resource.go b/internal/dao/internal/t_api_group_resource.go new file mode 100644 index 0000000..7548f3d --- /dev/null +++ b/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/internal/dao/internal/t_api_resource.go b/internal/dao/internal/t_api_resource.go new file mode 100644 index 0000000..473deb3 --- /dev/null +++ b/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/internal/dao/internal/t_balance_detail.go b/internal/dao/internal/t_balance_detail.go new file mode 100644 index 0000000..c5b1c60 --- /dev/null +++ b/internal/dao/internal/t_balance_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" +) + +// 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可提现金额 + 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", + 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/internal/dao/internal/t_consume_account_month_bill.go b/internal/dao/internal/t_consume_account_month_bill.go new file mode 100644 index 0000000..b4821e8 --- /dev/null +++ b/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/internal/dao/internal/t_credit_detail.go b/internal/dao/internal/t_credit_detail.go new file mode 100644 index 0000000..3a5f834 --- /dev/null +++ b/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/internal/dao/internal/t_cust_withdraw_account.go b/internal/dao/internal/t_cust_withdraw_account.go new file mode 100644 index 0000000..0f21bf2 --- /dev/null +++ b/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/internal/dao/internal/t_dept_flow_daily.go b/internal/dao/internal/t_dept_flow_daily.go new file mode 100644 index 0000000..c7d957d --- /dev/null +++ b/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/internal/dao/internal/t_division_code.go b/internal/dao/internal/t_division_code.go new file mode 100644 index 0000000..b56fd6d --- /dev/null +++ b/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/internal/dao/internal/t_fin_commission_detail.go b/internal/dao/internal/t_fin_commission_detail.go new file mode 100644 index 0000000..d753961 --- /dev/null +++ b/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/internal/dao/internal/t_fin_withdrawable_change.go b/internal/dao/internal/t_fin_withdrawable_change.go new file mode 100644 index 0000000..589b6a4 --- /dev/null +++ b/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/internal/dao/internal/t_finance_apply.go b/internal/dao/internal/t_finance_apply.go new file mode 100644 index 0000000..984d44e --- /dev/null +++ b/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/internal/dao/internal/t_finance_audit_record.go b/internal/dao/internal/t_finance_audit_record.go new file mode 100644 index 0000000..0b5c0e3 --- /dev/null +++ b/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/internal/dao/internal/t_order.go b/internal/dao/internal/t_order.go new file mode 100644 index 0000000..fe3819d --- /dev/null +++ b/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/internal/dao/internal/t_order_item.go b/internal/dao/internal/t_order_item.go new file mode 100644 index 0000000..345a1b5 --- /dev/null +++ b/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/internal/dao/internal/t_package_customer.go b/internal/dao/internal/t_package_customer.go new file mode 100644 index 0000000..f4f1afa --- /dev/null +++ b/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/internal/dao/internal/t_profit_account_month_bill.go b/internal/dao/internal/t_profit_account_month_bill.go new file mode 100644 index 0000000..d837d1a --- /dev/null +++ b/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/internal/dao/internal/t_resource_batch_download.go b/internal/dao/internal/t_resource_batch_download.go new file mode 100644 index 0000000..c7a8b4d --- /dev/null +++ b/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/internal/dao/internal/t_sim_bind_package_logs.go b/internal/dao/internal/t_sim_bind_package_logs.go new file mode 100644 index 0000000..f48b2c9 --- /dev/null +++ b/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/internal/dao/internal/t_sim_card_bind_pkg.go b/internal/dao/internal/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..d4d9f87 --- /dev/null +++ b/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/internal/dao/internal/t_sim_card_info.go b/internal/dao/internal/t_sim_card_info.go new file mode 100644 index 0000000..7882c42 --- /dev/null +++ b/internal/dao/internal/t_sim_card_info.go @@ -0,0 +1,193 @@ +// ========================================================================== +// 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 // 国漫最后一次同步时间 + ImeiSyncTime string // IMEI 最后一次轮询同步时间 + ImeiUpdateTime string // IMEI 值最后一次实际变更时间 + 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", + ImeiSyncTime: "imei_sync_time", + ImeiUpdateTime: "imei_update_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/internal/dao/internal/t_sim_card_stock.go b/internal/dao/internal/t_sim_card_stock.go new file mode 100644 index 0000000..744b7f8 --- /dev/null +++ b/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/internal/dao/internal/t_sim_channel_template.go b/internal/dao/internal/t_sim_channel_template.go new file mode 100644 index 0000000..168c1a5 --- /dev/null +++ b/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/internal/dao/internal/t_sim_channels.go b/internal/dao/internal/t_sim_channels.go new file mode 100644 index 0000000..5c9ad2e --- /dev/null +++ b/internal/dao/internal/t_sim_channels.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" +) + +// 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 { + Id string // ID + TempKey string // 模板标识 + ChanKey string // 通道编号 + ChanName string // 通道名称 + ChanConfig string // 通道配置 + ChanStatus string // 通道状态(0启用,1停用) + ShareEnabled string // 是否开放共享Token(0否,1是) + ChanAlias string // 通道别名 + RegionCode string // 通道行政区域代码(省市) + AppKey string // 应用标识 + AppSecret string // 应用密钥 + AccessToken string // 接口调用凭证 + AccessTokenCreated string // 凭证申请时间 + AccessTokenExpire string // 凭证过期时间 + RefreshToken string // 刷新凭证 + Remark string // 备注 + LoginUser string // 登录账号 + LoginPassword string // 登录密码 + LoginUrl string // 登录地址 + TenantId string // 租户ID + CreatedDept string // 创建部门 + CreatedBy string // 创建者 + CreatedAt string // 创建时间 + UpdatedBy string // 更新者 + UpdatedAt string // 更新时间 +} + +// tSimChannelsColumns holds the columns for the table t_sim_channels. +var tSimChannelsColumns = TSimChannelsColumns{ + Id: "id", + TempKey: "temp_key", + ChanKey: "chan_key", + ChanName: "chan_name", + ChanConfig: "chan_config", + ChanStatus: "chan_status", + ShareEnabled: "share_enabled", + 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", + Remark: "remark", + LoginUser: "login_user", + LoginPassword: "login_password", + LoginUrl: "login_url", + TenantId: "tenant_id", + CreatedDept: "created_dept", + CreatedBy: "created_by", + CreatedAt: "created_at", + UpdatedBy: "updated_by", + UpdatedAt: "updated_at", +} + +// 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/internal/dao/internal/t_sim_flow_package_info.go b/internal/dao/internal/t_sim_flow_package_info.go new file mode 100644 index 0000000..9ee7773 --- /dev/null +++ b/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/internal/dao/internal/t_sim_flow_package_price.go b/internal/dao/internal/t_sim_flow_package_price.go new file mode 100644 index 0000000..a709a3e --- /dev/null +++ b/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/internal/dao/internal/t_sim_flow_pool.go b/internal/dao/internal/t_sim_flow_pool.go new file mode 100644 index 0000000..5208c20 --- /dev/null +++ b/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/internal/dao/internal/t_sim_package_category.go b/internal/dao/internal/t_sim_package_category.go new file mode 100644 index 0000000..39d5703 --- /dev/null +++ b/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/internal/dao/internal/t_sim_pool.go b/internal/dao/internal/t_sim_pool.go new file mode 100644 index 0000000..dad1053 --- /dev/null +++ b/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/internal/dao/internal/t_sim_pool_bind_package.go b/internal/dao/internal/t_sim_pool_bind_package.go new file mode 100644 index 0000000..7ce2242 --- /dev/null +++ b/internal/dao/internal/t_sim_pool_bind_package.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" +) + +// 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 // 订购记录编号 + 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", + 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/internal/dao/internal/t_sim_pool_warn_config.go b/internal/dao/internal/t_sim_pool_warn_config.go new file mode 100644 index 0000000..2f4a8c4 --- /dev/null +++ b/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/internal/dao/internal/t_sim_upstream_package.go b/internal/dao/internal/t_sim_upstream_package.go new file mode 100644 index 0000000..9034408 --- /dev/null +++ b/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/internal/dao/internal/t_tplatform_setting.go b/internal/dao/internal/t_tplatform_setting.go new file mode 100644 index 0000000..0fb27f2 --- /dev/null +++ b/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/internal/dao/internal/t_wo_audit.go b/internal/dao/internal/t_wo_audit.go new file mode 100644 index 0000000..a53b9f0 --- /dev/null +++ b/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/internal/dao/internal/t_wo_communication.go b/internal/dao/internal/t_wo_communication.go new file mode 100644 index 0000000..c27765e --- /dev/null +++ b/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/internal/dao/internal/t_wo_main.go b/internal/dao/internal/t_wo_main.go new file mode 100644 index 0000000..06a6dea --- /dev/null +++ b/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/internal/dao/internal/t_wo_record.go b/internal/dao/internal/t_wo_record.go new file mode 100644 index 0000000..365bf7c --- /dev/null +++ b/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/internal/dao/internal/test_demo.go b/internal/dao/internal/test_demo.go new file mode 100644 index 0000000..8d625c2 --- /dev/null +++ b/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/internal/dao/sys_client.go b/internal/dao/sys_client.go new file mode 100644 index 0000000..29af49e --- /dev/null +++ b/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-openapi/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/internal/dao/sys_config.go b/internal/dao/sys_config.go new file mode 100644 index 0000000..a35567f --- /dev/null +++ b/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-openapi/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/internal/dao/sys_dept.go b/internal/dao/sys_dept.go new file mode 100644 index 0000000..9d4e0b9 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_dict_data.go b/internal/dao/sys_dict_data.go new file mode 100644 index 0000000..3adf75d --- /dev/null +++ b/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-openapi/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/internal/dao/sys_dict_type.go b/internal/dao/sys_dict_type.go new file mode 100644 index 0000000..e1fc203 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_gen_table.go b/internal/dao/sys_gen_table.go new file mode 100644 index 0000000..180d760 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_job.go b/internal/dao/sys_job.go new file mode 100644 index 0000000..f7d5421 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_logininfor.go b/internal/dao/sys_logininfor.go new file mode 100644 index 0000000..6bba939 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_menu.go b/internal/dao/sys_menu.go new file mode 100644 index 0000000..64dafe1 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_notice.go b/internal/dao/sys_notice.go new file mode 100644 index 0000000..d7461f2 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_notice_user.go b/internal/dao/sys_notice_user.go new file mode 100644 index 0000000..1ad29c8 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_oper_log.go b/internal/dao/sys_oper_log.go new file mode 100644 index 0000000..d2b70b2 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_oss.go b/internal/dao/sys_oss.go new file mode 100644 index 0000000..6bdf95e --- /dev/null +++ b/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-openapi/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/internal/dao/sys_oss_config.go b/internal/dao/sys_oss_config.go new file mode 100644 index 0000000..2a22a38 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_post.go b/internal/dao/sys_post.go new file mode 100644 index 0000000..5d001c8 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_role.go b/internal/dao/sys_role.go new file mode 100644 index 0000000..93349c3 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_role_dept.go b/internal/dao/sys_role_dept.go new file mode 100644 index 0000000..1c70b59 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_role_menu.go b/internal/dao/sys_role_menu.go new file mode 100644 index 0000000..61ca986 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_social.go b/internal/dao/sys_social.go new file mode 100644 index 0000000..7d5ad5c --- /dev/null +++ b/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-openapi/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/internal/dao/sys_tenant.go b/internal/dao/sys_tenant.go new file mode 100644 index 0000000..474ddae --- /dev/null +++ b/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-openapi/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/internal/dao/sys_tenant_package.go b/internal/dao/sys_tenant_package.go new file mode 100644 index 0000000..a399b60 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_user.go b/internal/dao/sys_user.go new file mode 100644 index 0000000..47834c3 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_user_online.go b/internal/dao/sys_user_online.go new file mode 100644 index 0000000..6056f87 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_user_post.go b/internal/dao/sys_user_post.go new file mode 100644 index 0000000..0f78a94 --- /dev/null +++ b/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-openapi/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/internal/dao/sys_user_role.go b/internal/dao/sys_user_role.go new file mode 100644 index 0000000..de1a1d9 --- /dev/null +++ b/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-openapi/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/internal/dao/t_agent_balance.go b/internal/dao/t_agent_balance.go new file mode 100644 index 0000000..18a91d6 --- /dev/null +++ b/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-openapi/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/internal/dao/t_agent_enterprise.go b/internal/dao/t_agent_enterprise.go new file mode 100644 index 0000000..8bcffa7 --- /dev/null +++ b/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-openapi/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/internal/dao/t_api.go b/internal/dao/t_api.go new file mode 100644 index 0000000..2844c3e --- /dev/null +++ b/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-openapi/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/internal/dao/t_api_group.go b/internal/dao/t_api_group.go new file mode 100644 index 0000000..a5e0ce5 --- /dev/null +++ b/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-openapi/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/internal/dao/t_api_group_resource.go b/internal/dao/t_api_group_resource.go new file mode 100644 index 0000000..89a78c5 --- /dev/null +++ b/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-openapi/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/internal/dao/t_api_resource.go b/internal/dao/t_api_resource.go new file mode 100644 index 0000000..94f8e0f --- /dev/null +++ b/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-openapi/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/internal/dao/t_balance_detail.go b/internal/dao/t_balance_detail.go new file mode 100644 index 0000000..20033b4 --- /dev/null +++ b/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-openapi/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/internal/dao/t_consume_account_month_bill.go b/internal/dao/t_consume_account_month_bill.go new file mode 100644 index 0000000..f5a1ee7 --- /dev/null +++ b/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-openapi/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/internal/dao/t_credit_detail.go b/internal/dao/t_credit_detail.go new file mode 100644 index 0000000..5a3634d --- /dev/null +++ b/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-openapi/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/internal/dao/t_cust_withdraw_account.go b/internal/dao/t_cust_withdraw_account.go new file mode 100644 index 0000000..bff8d8b --- /dev/null +++ b/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-openapi/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/internal/dao/t_dept_flow_daily.go b/internal/dao/t_dept_flow_daily.go new file mode 100644 index 0000000..654d786 --- /dev/null +++ b/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-openapi/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/internal/dao/t_division_code.go b/internal/dao/t_division_code.go new file mode 100644 index 0000000..0543d48 --- /dev/null +++ b/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-openapi/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/internal/dao/t_fin_commission_detail.go b/internal/dao/t_fin_commission_detail.go new file mode 100644 index 0000000..660a7cd --- /dev/null +++ b/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-openapi/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/internal/dao/t_fin_withdrawable_change.go b/internal/dao/t_fin_withdrawable_change.go new file mode 100644 index 0000000..4cc1cd3 --- /dev/null +++ b/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-openapi/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/internal/dao/t_finance_apply.go b/internal/dao/t_finance_apply.go new file mode 100644 index 0000000..e356c4c --- /dev/null +++ b/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-openapi/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/internal/dao/t_finance_audit_record.go b/internal/dao/t_finance_audit_record.go new file mode 100644 index 0000000..1724231 --- /dev/null +++ b/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-openapi/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/internal/dao/t_order.go b/internal/dao/t_order.go new file mode 100644 index 0000000..b48b3c6 --- /dev/null +++ b/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-openapi/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/internal/dao/t_order_item.go b/internal/dao/t_order_item.go new file mode 100644 index 0000000..5b9f594 --- /dev/null +++ b/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-openapi/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/internal/dao/t_package_customer.go b/internal/dao/t_package_customer.go new file mode 100644 index 0000000..4034615 --- /dev/null +++ b/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-openapi/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/internal/dao/t_profit_account_month_bill.go b/internal/dao/t_profit_account_month_bill.go new file mode 100644 index 0000000..b75bb88 --- /dev/null +++ b/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-openapi/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/internal/dao/t_resource_batch_download.go b/internal/dao/t_resource_batch_download.go new file mode 100644 index 0000000..c85ecf6 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_bind_package_logs.go b/internal/dao/t_sim_bind_package_logs.go new file mode 100644 index 0000000..e00eef3 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_card_bind_pkg.go b/internal/dao/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..f8aae79 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_card_info.go b/internal/dao/t_sim_card_info.go new file mode 100644 index 0000000..27ea247 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_card_stock.go b/internal/dao/t_sim_card_stock.go new file mode 100644 index 0000000..f2dd76a --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_channel_template.go b/internal/dao/t_sim_channel_template.go new file mode 100644 index 0000000..9d089d1 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_channels.go b/internal/dao/t_sim_channels.go new file mode 100644 index 0000000..c3f7c9f --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_flow_package_info.go b/internal/dao/t_sim_flow_package_info.go new file mode 100644 index 0000000..12918b1 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_flow_package_price.go b/internal/dao/t_sim_flow_package_price.go new file mode 100644 index 0000000..1a7389e --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_flow_pool.go b/internal/dao/t_sim_flow_pool.go new file mode 100644 index 0000000..2041b65 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_package_category.go b/internal/dao/t_sim_package_category.go new file mode 100644 index 0000000..14b3bac --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_pool.go b/internal/dao/t_sim_pool.go new file mode 100644 index 0000000..9e255bc --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_pool_bind_package.go b/internal/dao/t_sim_pool_bind_package.go new file mode 100644 index 0000000..b0089f7 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_pool_warn_config.go b/internal/dao/t_sim_pool_warn_config.go new file mode 100644 index 0000000..9435c02 --- /dev/null +++ b/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-openapi/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/internal/dao/t_sim_upstream_package.go b/internal/dao/t_sim_upstream_package.go new file mode 100644 index 0000000..58a6efa --- /dev/null +++ b/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-openapi/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/internal/dao/t_tplatform_setting.go b/internal/dao/t_tplatform_setting.go new file mode 100644 index 0000000..e2d2b22 --- /dev/null +++ b/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-openapi/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/internal/dao/t_wo_audit.go b/internal/dao/t_wo_audit.go new file mode 100644 index 0000000..62fd9ab --- /dev/null +++ b/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-openapi/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/internal/dao/t_wo_communication.go b/internal/dao/t_wo_communication.go new file mode 100644 index 0000000..a3e8bdb --- /dev/null +++ b/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-openapi/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/internal/dao/t_wo_main.go b/internal/dao/t_wo_main.go new file mode 100644 index 0000000..3aa9bfb --- /dev/null +++ b/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-openapi/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/internal/dao/t_wo_record.go b/internal/dao/t_wo_record.go new file mode 100644 index 0000000..e7343c0 --- /dev/null +++ b/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-openapi/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/internal/dao/test_demo.go b/internal/dao/test_demo.go new file mode 100644 index 0000000..11af430 --- /dev/null +++ b/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-openapi/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/internal/library/batchimport/batch_no.go b/internal/library/batchimport/batch_no.go new file mode 100644 index 0000000..3247aca --- /dev/null +++ b/internal/library/batchimport/batch_no.go @@ -0,0 +1,83 @@ +package batchimport + +import ( + "context" + "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:" +) + +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 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 +} diff --git a/internal/library/batchimport/batch_no_test.go b/internal/library/batchimport/batch_no_test.go new file mode 100644 index 0000000..bf8d92f --- /dev/null +++ b/internal/library/batchimport/batch_no_test.go @@ -0,0 +1,75 @@ +package batchimport + +import ( + "context" + "strings" + "testing" + "time" +) + +func TestNormalizeBatchNoPrefix(t *testing.T) { + prefix, err := normalizeBatchNoPrefix(" inb ") + if err != nil { + t.Fatalf("normalize prefix: %v", err) + } + if prefix != "INB" { + t.Fatalf("unexpected prefix: %s", prefix) + } + + if _, err = normalizeBatchNoPrefix("IN"); err == nil { + t.Fatal("expected error for non-three-character prefix") + } +} + +func TestFormatBatchNo(t *testing.T) { + now := time.Date(2026, 8, 10, 12, 34, 56, 789000000, time.Local) + batchNo, err := formatBatchNo("REN", now, 7) + if err != nil { + t.Fatalf("format batch no: %v", err) + } + if batchNo != "REN20260810123456007" { + t.Fatalf("unexpected batch no: %s", batchNo) + } + if len(batchNo) != 20 { + t.Fatalf("unexpected batch no length: %d", len(batchNo)) + } + if strings.Contains(batchNo, "789") { + t.Fatalf("batch no should not include milliseconds: %s", batchNo) + } +} + +func TestFormatBatchNoRejectsOverflowSequence(t *testing.T) { + _, err := formatBatchNo("REN", time.Now(), 1000) + if err == nil { + t.Fatal("expected overflow sequence error") + } +} + +func TestBatchNoBoundaries(t *testing.T) { + now := time.Date(2026, 10, 12, 23, 59, 59, 0, time.FixedZone("CST", 8*3600)) + for _, sequence := range []int64{-1, 0, 1000} { + if _, err := formatBatchNo("REN", now, sequence); err == nil { + t.Fatalf("sequence %d should be rejected", sequence) + } + } + for _, sequence := range []int64{1, 999} { + number, err := formatBatchNo("REN", now, sequence) + if err != nil || len(number) != 20 { + t.Fatalf("sequence %d: number=%q err=%v", sequence, number, err) + } + } + if batchNoSequenceKey(now) != "iotlcm:batch:no:seq:20261012" || batchNoSequenceKey(now.Add(time.Second)) != "iotlcm:batch:no:seq:20261013" { + t.Fatal("daily sequence key does not roll over at midnight") + } +} + +func TestNextBatchNoRejectsInvalidPrefixBeforeRedis(t *testing.T) { + for _, prefix := range []string{"", " ", "RE", "RENEW"} { + for _, ctx := range []context.Context{nil, context.Background()} { + number, err := NextBatchNoContext(ctx, prefix) + if err == nil || number != "" { + t.Fatalf("prefix %q: number=%q err=%v", prefix, number, err) + } + } + } +} diff --git a/internal/library/batchmetadata/metadata.go b/internal/library/batchmetadata/metadata.go new file mode 100644 index 0000000..ec28f70 --- /dev/null +++ b/internal/library/batchmetadata/metadata.go @@ -0,0 +1,10 @@ +package batchmetadata + +const ( + API = "api" + Unknown = 0 + Single = 1 + Bulk = 2 +) + +func ValidMode(mode int) bool { return mode >= Unknown && mode <= Bulk } diff --git a/internal/library/bcache/bcache.go b/internal/library/bcache/bcache.go new file mode 100644 index 0000000..083c8a3 --- /dev/null +++ b/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/internal/library/bcache/bcache_api_auth.go b/internal/library/bcache/bcache_api_auth.go new file mode 100644 index 0000000..e0082d8 --- /dev/null +++ b/internal/library/bcache/bcache_api_auth.go @@ -0,0 +1,115 @@ +package bcache + +import ( + "context" + "errors" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/cache" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/mcache" + "time" +) + +const apiAuthLocalBackfillTTL = 6 * time.Hour + +// SetApiAuthToken 存储接口认证长令牌,先写本地内存缓存,再写共享缓存。 +func SetApiAuthToken(ctx context.Context, uuid string, token string, timeout time.Duration) (err error) { + if uuid == "" { + return errors.New("api auth token uuid invalid") + } + key := fmt.Sprintf(consts.KeyApiAuthToken, uuid) + if err = mcache.Set(ctx, key, token, timeout); err != nil { + return err + } + if err = cache.Instance().Set(ctx, key, token, timeout); err != nil { + _ = mcache.Remove(ctx, key) + return err + } + return nil +} + +// GetApiAuthToken 获取接口认证长令牌,优先读取本地内存缓存。 +func GetApiAuthToken(ctx context.Context, uuid string) (token string, err error) { + if uuid == "" { + return "", errors.New("api auth token uuid invalid") + } + key := fmt.Sprintf(consts.KeyApiAuthToken, uuid) + t, err := mcache.Instance().Get(ctx, key) + if err == nil && !t.IsNil() { + return t.String(), nil + } + + t, err = cache.Instance().Get(ctx, key) + if err != nil { + return "", err + } + if !t.IsNil() { + _ = mcache.Set(ctx, key, t.String(), apiAuthLocalBackfillTTL) + return t.String(), nil + } + return "", errors.New("api auth token not found") +} + +// DelApiAuthToken 删除接口认证长令牌,先删本地内存缓存,再删共享缓存。 +func DelApiAuthToken(ctx context.Context, uuid string) (err error) { + if uuid == "" { + return errors.New("api auth token uuid invalid") + } + key := fmt.Sprintf(consts.KeyApiAuthToken, uuid) + if err = mcache.Remove(ctx, key); err != nil { + return err + } + _, err = cache.Instance().Remove(ctx, key) + return err +} + +// SetApiAuthActiveToken 设置机构维度的当前有效令牌索引。 +func SetApiAuthActiveToken(ctx context.Context, deptId int64, uuid string, timeout time.Duration) (err error) { + if deptId <= 0 || uuid == "" { + return errors.New("api auth active token key invalid") + } + key := fmt.Sprintf(consts.KeyApiAuthActiveToken, deptId) + if err = mcache.Set(ctx, key, uuid, timeout); err != nil { + return err + } + if err = cache.Instance().Set(ctx, key, uuid, timeout); err != nil { + _ = mcache.Remove(ctx, key) + return err + } + return nil +} + +// GetApiAuthActiveToken 获取机构维度的当前有效令牌索引。 +func GetApiAuthActiveToken(ctx context.Context, deptId int64) (uuid string, err error) { + if deptId <= 0 { + return "", errors.New("api auth active token key invalid") + } + key := fmt.Sprintf(consts.KeyApiAuthActiveToken, deptId) + t, err := mcache.Instance().Get(ctx, key) + if err == nil && !t.IsNil() { + return t.String(), nil + } + + t, err = cache.Instance().Get(ctx, key) + if err != nil { + return "", err + } + if !t.IsNil() { + _ = mcache.Set(ctx, key, t.String(), apiAuthLocalBackfillTTL) + return t.String(), nil + } + return "", errors.New("api auth active token not found") +} + +// DelApiAuthActiveToken 删除机构维度的当前有效令牌索引。 +func DelApiAuthActiveToken(ctx context.Context, deptId int64) (err error) { + if deptId <= 0 { + return errors.New("api auth active token key invalid") + } + key := fmt.Sprintf(consts.KeyApiAuthActiveToken, deptId) + if err = mcache.Remove(ctx, key); err != nil { + return err + } + _, err = cache.Instance().Remove(ctx, key) + return err +} diff --git a/internal/library/cache/cache.go b/internal/library/cache/cache.go new file mode 100644 index 0000000..09800a3 --- /dev/null +++ b/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-openapi/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/internal/library/cache/file/file.go b/internal/library/cache/file/file.go new file mode 100644 index 0000000..3fdb7ba --- /dev/null +++ b/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/internal/library/contexts/contexts.go b/internal/library/contexts/contexts.go new file mode 100644 index 0000000..97e6e1a --- /dev/null +++ b/internal/library/contexts/contexts.go @@ -0,0 +1,224 @@ +// 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-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/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 +} + +func GetAgentUser(ctx context.Context) *model.BaseClaimsApi { + customCtx := Get(ctx) + g.Log().Debug(ctx, customCtx) + if customCtx == nil { + return nil + } + return customCtx.AgentUser +} + +func GetAgentDeptId(ctx context.Context) int64 { + agentUser := GetAgentUser(ctx) + if agentUser == nil { + return 0 + } + return agentUser.DeptId +} + +func GetDeptKey(ctx context.Context) string { + agentUser := GetAgentUser(ctx) + if agentUser == nil { + return "" + } + return agentUser.DeptKey +} diff --git a/internal/library/mcache/mcache.go b/internal/library/mcache/mcache.go new file mode 100644 index 0000000..e17955b --- /dev/null +++ b/internal/library/mcache/mcache.go @@ -0,0 +1,46 @@ +// 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 +} diff --git a/internal/library/rabbitmq/rabbitmq.go b/internal/library/rabbitmq/rabbitmq.go new file mode 100644 index 0000000..f4e75e0 --- /dev/null +++ b/internal/library/rabbitmq/rabbitmq.go @@ -0,0 +1,211 @@ +package rabbitmq + +import ( + "context" + "encoding/json" + "sync" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + amqp "github.com/rabbitmq/amqp091-go" +) + +// Config 保存 RabbitMQ 最小连接配置。 +type Config struct { + Enabled bool + Dsn string +} + +// Handler 是原始字节消息的消费回调。 +type Handler func(ctx context.Context, body []byte) error + +// JSONHandler 是 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 +) + +// GetConfig 从配置中心读取 RabbitMQ 开关和 DSN。 +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。 +func Enabled(ctx context.Context) bool { + cfg := GetConfig(ctx) + return cfg.Enabled && cfg.Dsn != "" +} + +// Conn 返回共享连接,首次调用时懒加载创建。 +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) +} + +// 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, + }) +} + +// Consume 启动普通消费者,业务成功后才 Ack。 +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") + } + + 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 + } + _ = delivery.Ack(false) + } + } + }() + return nil +} + +// ConsumeJSON 启动 JSON 消费者,自动完成反序列化。 +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 +} + +// registerCloser 记录 channel 关闭函数,供服务退出时统一清理。 +func registerCloser(closer func() error) { + closerMu.Lock() + defer closerMu.Unlock() + closers = append(closers, closer) +} diff --git a/internal/library/utils/utils.go b/internal/library/utils/utils.go new file mode 100644 index 0000000..9f881f3 --- /dev/null +++ b/internal/library/utils/utils.go @@ -0,0 +1,27 @@ +package utils + +import ( + "strconv" + "strings" + "time" +) + +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") + day, _ := strconv.Atoi(d[:index]) + dr = time.Hour * 24 * time.Duration(day) + 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/internal/library/xgorm/dao.go b/internal/library/xgorm/dao.go new file mode 100644 index 0000000..e2e964c --- /dev/null +++ b/internal/library/xgorm/dao.go @@ -0,0 +1,197 @@ +// package xgorm +// @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 xgorm + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-openapi/utility" + "slices" + + "reflect" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/text/gstr" +) + +var ( + descTags = []string{"description", "dc", "json"} // 实体描述标签 + fieldTags = []string{"json"} // 实体字段名称映射 +) + +// GetFieldsToSlice 获取dao实例中的所有字段 +func GetFieldsToSlice(ctx context.Context, dao daoInstance) ([]string, error) { + fields, err := dao.Ctx(ctx).TableFields(dao.Table()) + if err != nil { + return nil, err + } + if len(fields) == 0 { + return nil, gerror.New("field not found") + } + + var keys []string + for _, field := range fields { + keys = append(keys, field.Name) + } + return keys, nil +} + +// GetPkField 获取dao实例中的主键名称 +func GetPkField(ctx context.Context, dao daoInstance) (string, error) { + fields, err := dao.Ctx(ctx).TableFields(dao.Table()) + if err != nil { + return "", err + } + if len(fields) == 0 { + return "", gerror.New("field not found") + } + + for _, field := range fields { + if field.Key == "PRI" { + return field.Name, nil + } + } + return "", gerror.New("no primary key") +} + +// IsUnique 是否唯一 +func IsUnique(ctx context.Context, dao daoInstance, where g.Map, message string, pkId ...interface{}) error { + if len(where) == 0 { + return gerror.New("where condition cannot be empty") + } + + m := dao.Ctx(ctx).Where(where) + if len(pkId) > 0 { + field, err := GetPkField(ctx, dao) + if err != nil { + return err + } + m = m.WhereNot(field, pkId[0]) + } + + count, err := m.Count(1) + if err != nil { + return err + } + + if count > 0 { + if message == "" { + for k := range where { + message = fmt.Sprintf("in the table:%s, %v not uniqued", dao.Table(), where[k]) + break + } + } + return gerror.New(message) + } + return nil +} + +func JoinFields(ctx context.Context, entity interface{}, dao daoInstance, as string) (fs string) { + entityFs, err := GetEntityFieldTags(entity) + if err != nil { + g.Log().Errorf(ctx, "JoinFields err: %v", err) + return + } + + if len(entityFs) == 0 { + g.Log().Errorf(ctx, "JoinFields entityFs is empty") + return "" + } + + fields, err := dao.Ctx(ctx).TableFields(dao.Table()) + if err != nil { + g.Log().Errorf(ctx, "JoinFields err: %v", err) + return + } + + var columns []string + for _, v := range entityFs { + if !gstr.HasPrefix(v, as) { + g.Log().Infof(ctx, "JoinFields gstr.HasPrefix: %+v, %+v", v, as) + continue + } + g.Log().Infof(ctx, "JoinFields gstr.HasPrefix2: %+v, %+v", v, as) + field := gstr.CaseSnakeFirstUpper(gstr.StrEx(v, as)) + if _, ok := fields[field]; ok { + columns = append(columns, fmt.Sprintf("`%s`.`%s` as `%s`", dao.Table(), field, v)) + } + g.Log().Infof(ctx, "JoinFields field: %+v fields: %+v", field, fields) + } + + if len(columns) > 0 { + g.Log().Infof(ctx, "JoinFields columns: %+v", columns) + return gstr.Implode(",", utility.UniqueSlice(columns)) + } + return +} + +// GetEntityFieldTags 获取实体中的字段名称 +func GetEntityFieldTags(entity interface{}) (tags []string, err error) { + var formRef = reflect.TypeOf(entity) + for i := 0; i < formRef.NumField(); i++ { + field := formRef.Field(i) + if field.Type.Kind() == reflect.Struct { + addTags, err := reflectTag(field.Type, fieldTags, []string{}) + if err != nil { + return nil, err + } + tags = append(tags, addTags...) + continue + } + tags = append(tags, reflectTagName(field, fieldTags, true)) + } + return +} + +// reflectTag 层级递增解析tag +func reflectTag(reflectType reflect.Type, filterTags []string, tags []string) ([]string, error) { + if reflectType.Kind() == reflect.Ptr { + return nil, gerror.Newf("reflect type do not support reflect.Ptr yet, reflectType:%+v", reflectType) + } + if reflectType.Kind() != reflect.Struct { + return nil, nil + } + for i := 0; i < reflectType.NumField(); i++ { + tag := reflectTagName(reflectType.Field(i), filterTags, false) + if tag == "" { + addTags, err := reflectTag(reflectType.Field(i).Type, filterTags, tags) + if err != nil { + return nil, err + } + tags = append(tags, addTags...) + continue + } + tags = append(tags, tag) + } + return tags, nil +} + +// reflectTagName 解析实体中的描述标签,优先级:description > dc > json > Name +func reflectTagName(field reflect.StructField, filterTags []string, isDef bool) string { + if slices.Contains(filterTags, "description") { + if description, ok := field.Tag.Lookup("description"); ok && description != "" { + return description + } + } + + if slices.Contains(filterTags, "dc") { + if dc, ok := field.Tag.Lookup("dc"); ok && dc != "" { + return dc + } + } + + if slices.Contains(filterTags, "json") { + if jsonName, ok := field.Tag.Lookup("json"); ok && jsonName != "" { + return jsonName + } + } + + if !isDef { + return "" + } + return field.Name +} diff --git a/internal/library/xgorm/dao_tree.go b/internal/library/xgorm/dao_tree.go new file mode 100644 index 0000000..81ffa9e --- /dev/null +++ b/internal/library/xgorm/dao_tree.go @@ -0,0 +1,195 @@ +// package xgorm +// @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 xgorm + +import ( + "context" + gormmodel "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/gorm_model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/utility/tree" + "slices" + + "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/util/gconv" +) + +const ( + idDefaulField = "id" + pidDefaulField = "pid" + levelDefaulField = "level" + treeDefaulField = "tree" +) + +type TreeFiledOption struct { + IdField string + PidField string + LevelField string + TreeField string +} + +type daoInstance interface { + Table() string + Ctx(ctx context.Context) *gdb.Model +} + +func CustomTreeFiledToDefault(old map[string]interface{}, option *TreeFiledOption) *gormmodel.DefaultTree { + if option == nil { + option = &TreeFiledOption{ + IdField: idDefaulField, + PidField: pidDefaulField, + LevelField: levelDefaulField, + TreeField: treeDefaulField, + } + } + pd := &gormmodel.DefaultTree{} + if id, ok := old[option.IdField]; ok { + pd.Id = gconv.Int64(id) + } + if pid, ok := old[option.PidField]; ok { + pd.Pid = gconv.Int64(pid) + } + if level, ok := old[option.LevelField]; ok { + pd.Level = gconv.Int(level) + } + if tree, ok := old[option.TreeField]; ok { + pd.Tree = gconv.String(tree) + } + return pd +} + +// AutoUpdateTree 自动更新关系树 +func AutoUpdateTree(ctx context.Context, dao daoInstance, id, pid int64, option *TreeFiledOption) (newPid int64, newLevel int, newTree string, err error) { + if option == nil { + option = &TreeFiledOption{ + IdField: idDefaulField, + PidField: pidDefaulField, + LevelField: levelDefaulField, + TreeField: treeDefaulField, + } + } + if err = CheckTreeTable(ctx, dao, option); err != nil { + return + } + if pid <= 0 { + newPid = 0 + newLevel = 1 + newTree = "" + } else { + var pdMap map[string]interface{} + row, err := dao.Ctx(ctx).Fields(option.IdField, option.PidField, option.LevelField, option.TreeField).WherePri(pid).One() + if err != nil { + return 0, 0, "", err + } + if row != nil { + pdMap = row.Map() + } + + if len(pdMap) == 0 { + return 0, 0, "", gerror.New("未查询到树表上级信息,请检查!") + } + pd := CustomTreeFiledToDefault(pdMap, option) + + if id > 0 && slices.Contains(tree.GetIds(pd.Tree), id) { + return 0, 0, "", gerror.New("上级不能设为自己当前的子级!") + } + + newPid = pid + newLevel = pd.Level + 1 + newTree = tree.GenLabel(pd.Tree, pid) + } + + if id > 0 { + if pid == id { + return 0, 0, "", gerror.New("上级不能是自己!") + } + + var models *gormmodel.DefaultTree + if err = dao.Ctx(ctx).WherePri(id).Scan(&models); err != nil { + return 0, 0, "", err + } + + if models == nil { + return 0, 0, "", gerror.New("树表信息不存在,请检查!") + } + // g.Log().Infof(ctx, "models: %+v, pid: %v, newPid: %v, newLevel: %v, newTree: %v", models, pid, newPid, newLevel, newTree) + // 上级发生变化时,遍历修改其所有的下级关系树 + if models.Pid != pid { + if err = updateChildrenTree(ctx, dao, models.Id, newLevel, newTree, option); err != nil { + return + } + } + } + return +} + +// CheckTreeTable 检查树表 +func CheckTreeTable(ctx context.Context, dao daoInstance, option *TreeFiledOption) (err error) { + fields, err := GetFieldsToSlice(ctx, dao) + if err != nil { + return err + } + + if !slices.Contains(fields, option.PidField) { + return gerror.New("树表必须包含`pid`字段") + } + + if !slices.Contains(fields, option.LevelField) { + return gerror.New("树表必须包含`level`字段") + } + + if !slices.Contains(fields, option.TreeField) { + return gerror.New("树表必须包含`tree`字段") + } + return +} + +// updateChildrenTree 更新下级关系树 +func updateChildrenTree(ctx context.Context, dao daoInstance, pid int64, pLevel int, pTree string, option *TreeFiledOption) (err error) { + var list []*gormmodel.DefaultTree + // var pdMaps []map[string]interface{} + pdMaps, err := dao.Ctx(ctx).Fields(option.IdField, option.PidField, option.LevelField, option.TreeField).Where(option.PidField, pid).All() + if err != nil { + return err + } + + for _, v := range pdMaps { + if v == nil { + continue + } + pb := CustomTreeFiledToDefault(v.Map(), option) + if pb.Id == 0 { + g.Log().Warningf(ctx, "updateChildrenTree pb.Id is 0, pb: %+v, option: %+v, v: %+v, pdMaps: %+v", pb, option, v, pdMaps) + continue + } + // g.Log().Debugf(ctx, "updateChildrenTree pb: %+v", pb) + list = append(list, pb) + } + + if len(list) == 0 { + return + } + + newLevel := pLevel + 1 + newTree := tree.GenLabel(pTree, pid) + + var updateIds []int64 + for _, v := range list { + updateIds = append(updateIds, v.Id) + if err = updateChildrenTree(ctx, dao, v.Id, newLevel, newTree, option); err != nil { + return + } + } + + if len(updateIds) > 0 { + update := g.Map{ + option.LevelField: newLevel, + option.TreeField: newTree, + } + _, err = dao.Ctx(ctx).WhereIn(option.IdField, updateIds).Data(update).Update() + } + return +} diff --git a/internal/library/xgorm/gorm_model/gorm_tree.go b/internal/library/xgorm/gorm_model/gorm_tree.go new file mode 100644 index 0000000..ada0e31 --- /dev/null +++ b/internal/library/xgorm/gorm_model/gorm_tree.go @@ -0,0 +1,14 @@ +// package gormmodel +// @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 gormmodel + +// DefaultTree 默认树表字段 +type DefaultTree struct { + Id int64 `json:"id" description:"ID"` + Pid int64 `json:"pid" description:"父ID"` + Level int `json:"level" description:"关系树等级"` + Tree string `json:"tree" description:"关系树"` +} diff --git a/internal/library/xgorm/handler/filter_auth.go b/internal/library/xgorm/handler/filter_auth.go new file mode 100644 index 0000000..aa00153 --- /dev/null +++ b/internal/library/xgorm/handler/filter_auth.go @@ -0,0 +1,224 @@ +// package handler +// @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 handler + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/utility/convert" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" +) + +// FilterAuth 过滤数据权限 +// 通过上下文中的用户角色权限和表中是否含有需要过滤的字段附加查询条件 +func FilterAuth(m *gdb.Model) *gdb.Model { + var ( + ctx = m.GetCtx() + fields = convert.EscapeFieldsToSlice(m.GetFieldsStr()) + ) + + // 超管拥有全部权限 + if contexts.IsSuperAdmin(ctx) { + return m + } + + // 获取用户信息 + user := contexts.GetUser(ctx) + if user == nil { + return m + } + if len(user.Roles) == 0 { + return m + } + + deptIds := make([]int64, 0) + userIds := make([]int64, 0) + // 是否进入了非「全部数据」的受限范围;解析结果为空时必须拒绝,不能漏过滤 + hasRestrictedScope := false + currentRoleId := "" + currentRoleDataScope := "" + currentRoleIdIf := contexts.GetDataValue(ctx, "currentRoleId") + if currentRoleIdIf != nil { + currentRoleId = currentRoleIdIf.(string) + } + currentRoleDataScopeIf := contexts.GetDataValue(ctx, "currentRoleDataScope") + if currentRoleDataScopeIf != nil { + currentRoleDataScope = currentRoleDataScopeIf.(string) + } + if len(currentRoleDataScope) > 0 && len(currentRoleId) > 0 { + dataScope := currentRoleDataScope + roleId := gconv.Int64(currentRoleId) + g.Log().Infof(ctx, "uid:%d, currentRoleId: %d, currentRoleDataScope: %s", user.ID, roleId, dataScope) + if dataScope == consts.SysRoleDataScopeAll { // 角色数据范围: 1全部数据权限 + return m + } + hasRestrictedScope = true + if dataScope == consts.SysRoleDataScopeCustom { // 角色数据范围: 2自定数据权限 + var roleDepts []*entity.SysRoleDept + err := g.Model("sys_role_dept").Where("tenant_id", contexts.GetTenantId(ctx)).Where("role_id", roleId).Scan(&roleDepts) + if err != nil { + g.Log().Panicf(ctx, "failed to get role dept data err:%+v", err) + } + for _, roleDept := range roleDepts { + deptIds = append(deptIds, roleDept.DeptId) + } + } else if dataScope == consts.SysRoleDataScopeDept { // 角色数据范围: 3本部门数据权限 + deptIds = append(deptIds, user.DeptId) + } else if dataScope == consts.SysRoleDataScopeDeptAndBelow { // 角色数据范围: 4本部门及以下数据权限 + deptIds = append(deptIds, GetDeptAndSub(ctx, user.DeptId)...) + } else if dataScope == consts.SysRoleDataScopePersonal { // 角色数据范围: 5仅本人数据权限 + userIds = append(userIds, user.ID) + } else if dataScope == consts.SysRoleDataScopeDeptAndBelowOrPersonal { // 角色数据范围: 6本部门及以下或本人数据权限 + deptIds = append(deptIds, GetDeptAndSub(ctx, user.DeptId)...) + userIds = append(userIds, user.ID) + } else if dataScope == consts.SysRoleDataScopeOrgAndNextLevel { // 角色数据范围: 7本组织及本组织下一级数据权限 + deptIds = append(deptIds, GetOrgAndNextLevelDeptIds(ctx, user.DeptId)...) + } else if dataScope == consts.SysRoleDataScopeOrgNextLevel { // 角色数据范围: 8本组织下一级数据权限 + deptIds = append(deptIds, GetOrgNextLevelDeptIds(ctx, user.DeptId)...) + } + } else { + for _, role := range user.Roles { + dataScope := role.DataScope + roleId := role.RoleId + if dataScope == consts.SysRoleDataScopeAll { // 角色数据范围: 1全部数据权限 + return m + } else if dataScope == consts.SysRoleDataScopeCustom { // 角色数据范围: 2自定数据权限 + hasRestrictedScope = true + var roleDepts []*entity.SysRoleDept + err := g.Model("sys_role_dept").Where("tenant_id", contexts.GetTenantId(ctx)).Where("role_id", roleId).Scan(&roleDepts) + if err != nil { + g.Log().Panicf(ctx, "failed to get role dept data err:%+v", err) + } + for _, roleDept := range roleDepts { + deptIds = append(deptIds, roleDept.DeptId) + } + } else if dataScope == consts.SysRoleDataScopeDept { // 角色数据范围: 3本部门数据权限 + hasRestrictedScope = true + deptIds = append(deptIds, user.DeptId) + } else if dataScope == consts.SysRoleDataScopeDeptAndBelow { // 角色数据范围: 4本部门及以下数据权限 + hasRestrictedScope = true + deptIds = append(deptIds, GetDeptAndSub(ctx, user.DeptId)...) + } else if dataScope == consts.SysRoleDataScopePersonal { // 角色数据范围: 5仅本人数据权限 + hasRestrictedScope = true + userIds = append(userIds, user.ID) + } else if dataScope == consts.SysRoleDataScopeDeptAndBelowOrPersonal { // 角色数据范围: 6本部门及以下或本人数据权限 + hasRestrictedScope = true + deptIds = append(deptIds, GetDeptAndSub(ctx, user.DeptId)...) + userIds = append(userIds, user.ID) + } else if dataScope == consts.SysRoleDataScopeOrgAndNextLevel { // 角色数据范围: 7本组织及本组织下一级数据权限 + hasRestrictedScope = true + deptIds = append(deptIds, GetOrgAndNextLevelDeptIds(ctx, user.DeptId)...) + } else if dataScope == consts.SysRoleDataScopeOrgNextLevel { // 角色数据范围: 8本组织下一级数据权限 + hasRestrictedScope = true + deptIds = append(deptIds, GetOrgNextLevelDeptIds(ctx, user.DeptId)...) + } + } + } + + deptFilterField := "" + if gstr.InArray(fields, "dept_id") { + deptFilterField = "dept_id" + } else if gstr.InArray(fields, "created_dept") { + deptFilterField = "created_dept" + } + userFilterField := "" + if gstr.InArray(fields, "user_id") { + userFilterField = "user_id" + } else if gstr.InArray(fields, "created_by") { + userFilterField = "created_by" + } + + if len(deptIds) > 0 && len(userIds) > 0 { + if deptFilterField != "" && userFilterField != "" { + m = m.Where(deptFilterField+" IN (?) OR "+userFilterField+" IN (?)", deptIds, userIds) + } else if deptFilterField != "" { + m = m.WhereIn(deptFilterField, deptIds) + } else if userFilterField != "" { + m = m.WhereIn(userFilterField, userIds) + } + } else if len(deptIds) > 0 && deptFilterField != "" { + m = m.WhereIn(deptFilterField, deptIds) + } else if len(userIds) > 0 && userFilterField != "" { + m = m.WhereIn(userFilterField, userIds) + } else if hasRestrictedScope && (deptFilterField != "" || userFilterField != "") { + // 例:范围8无下级部门、范围2未配自定义部门 → 可见集合为空,禁止放行全表 + g.Log().Warningf(ctx, "FilterAuth empty scope result, deny all data. uid:%d, deptIds:%v, userIds:%v", user.ID, deptIds, userIds) + m = m.Where("1 = 0") + } + return m +} + +// GetParentCompanyDeptId 获取用户所属上级公司组织ID +func GetParentCompanyDeptId(ctx context.Context, deptId int64) int64 { + if deptId <= 0 { + return deptId + } + var dept entity.SysDept + err := g.Model("sys_dept").Where("dept_id", deptId).Scan(&dept) + if err != nil || dept.DeptId == 0 { + return deptId + } + if dept.ParentId == 0 || dept.DeptType == 1 { + return dept.DeptId + } + return GetParentCompanyDeptId(ctx, dept.ParentId) +} + +// GetDeptDirectSub 获取指定部门的直接下级部门ID +func GetDeptDirectSub(ctx context.Context, deptId int64) (ids []int64) { + array, err := g.Model("sys_dept"). + Where("parent_id", deptId). + Fields("dept_id"). + Array() + if err != nil { + g.Log().Panicf(ctx, "GetDeptDirectSub err:%+v", err) + return + } + for _, v := range array { + ids = append(ids, v.Int64()) + } + return +} + +// GetOrgAndNextLevelDeptIds 获取本组织及本组织下一级数据权限范围:所属公司组织及直接下级 +func GetOrgAndNextLevelDeptIds(ctx context.Context, deptId int64) (ids []int64) { + orgDeptId := GetParentCompanyDeptId(ctx, deptId) + ids = append(ids, orgDeptId) + ids = append(ids, GetDeptDirectSub(ctx, orgDeptId)...) + return +} + +// GetOrgNextLevelDeptIds 获取本组织下一级数据权限范围:所属公司组织的直接下级 +func GetOrgNextLevelDeptIds(ctx context.Context, deptId int64) (ids []int64) { + orgDeptId := GetParentCompanyDeptId(ctx, deptId) + return GetDeptDirectSub(ctx, orgDeptId) +} + +// GetDeptAndSub 获取指定部门的所有下级,含本部门 +func GetDeptAndSub(ctx context.Context, deptId int64) (ids []int64) { + array, err := g.Model("sys_dept"). + WhereLike("ancestors", "%,"+fmt.Sprintf("%d", deptId)+",%"). + Fields("dept_id"). + Array() + if err != nil { + g.Log().Panicf(ctx, "GetDeptAndSub err:%+v", err) + return + } + + for _, v := range array { + ids = append(ids, v.Int64()) + } + + ids = append(ids, deptId) + return +} diff --git a/internal/library/xgorm/handler/force_cache.go b/internal/library/xgorm/handler/force_cache.go new file mode 100644 index 0000000..3fc7e75 --- /dev/null +++ b/internal/library/xgorm/handler/force_cache.go @@ -0,0 +1,13 @@ +// package handler +// @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 handler + +import "github.com/gogf/gf/v2/database/gdb" + +// ForceCache 强制缓存 +func ForceCache(m *gdb.Model) *gdb.Model { + return m.Cache(gdb.CacheOption{Duration: 0, Force: true}) +} diff --git a/internal/library/xgorm/handler/handler.go b/internal/library/xgorm/handler/handler.go new file mode 100644 index 0000000..e7903bb --- /dev/null +++ b/internal/library/xgorm/handler/handler.go @@ -0,0 +1,40 @@ +// package handler +// @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 handler + +import "github.com/gogf/gf/v2/database/gdb" + +// Option 预处理选项 +type Option struct { + FilterAuth bool // 过滤权限 + ForceCache bool // 强制缓存 + FilterTenant bool // 过滤多租户权限 +} + +// DefaultOption 默认预处理选项 +var DefaultOption = &Option{ + FilterAuth: true, + FilterTenant: true, +} + +func Model(m *gdb.Model, opt ...*Option) *gdb.Model { + var option *Option + if len(opt) > 0 { + option = opt[0] + } else { + option = DefaultOption + } + if option.FilterAuth { + m = m.Handler(FilterAuth) + } + if option.ForceCache { + m = m.Handler(ForceCache) + } + if option.FilterTenant { + m = m.Handler(FilterTenant) + } + return m +} diff --git a/internal/library/xgorm/handler/tenant.go b/internal/library/xgorm/handler/tenant.go new file mode 100644 index 0000000..32d786d --- /dev/null +++ b/internal/library/xgorm/handler/tenant.go @@ -0,0 +1,27 @@ +// package handler +// @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 handler + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/utility/convert" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/text/gstr" +) + +// FilterTenant 过滤多租户数据权限 +func FilterTenant(m *gdb.Model) *gdb.Model { + var ( + ctx = m.GetCtx() + fields = convert.EscapeFieldsToSlice(m.GetFieldsStr()) + ) + // 如果包含tenant_id字段,则过滤多租户数据权限 + if gstr.InArray(fields, "tenant_id") { + m = m.Where("tenant_id", contexts.GetTenantId(ctx)) + } + return m +} diff --git a/internal/library/xgorm/hook/member.go b/internal/library/xgorm/hook/member.go new file mode 100644 index 0000000..90279c9 --- /dev/null +++ b/internal/library/xgorm/hook/member.go @@ -0,0 +1,118 @@ +// package hook +// @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 hook + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/utility" + + "github.com/gogf/gf/v2/container/gvar" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +type MemberSumma struct { + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` +} + +// MemberSummary 操作人摘要信息 +var MemberSummary = gdb.HookHandler{ + Select: func(ctx context.Context, in *gdb.HookSelectInput) (result gdb.Result, err error) { + result, err = in.Next(ctx) + if err != nil { + return + } + + var ( + createdByIds []int64 + updatedByIds []int64 + deletedByIds []int64 + memberIds []int64 + ) + + for _, record := range result { + if record["created_by"].Int64() > 0 { + createdByIds = append(createdByIds, record["created_by"].Int64()) + } + if record["updated_by"].Int64() > 0 { + updatedByIds = append(updatedByIds, record["updated_by"].Int64()) + } + if record["deleted_by"].Int64() > 0 { + deletedByIds = append(deletedByIds, record["deleted_by"].Int64()) + } + if record["user_id"].Int64() > 0 { + memberIds = append(memberIds, record["user_id"].Int64()) + } + } + + memberIds = append(memberIds, createdByIds...) + memberIds = append(memberIds, updatedByIds...) + memberIds = append(memberIds, deletedByIds...) + memberIds = utility.UniqueSlice(memberIds) + if len(memberIds) == 0 { + return + } + + var members []*MemberSumma + if err = g.Model("sys_user").Ctx(ctx).WhereIn("user_id", memberIds).Scan(&members); err != nil { + g.Log().Errorf(ctx, "[MemberSummary] 查询用户信息失败: %v", err) + return nil, err + } + + if len(members) == 0 { + g.Log().Warningf(ctx, "[MemberSummary] 没有找到任何用户信息,用户IDs: %v", memberIds) + return + } + + findMember := func(id *gvar.Var) *MemberSumma { + userId := id.Int64() + for _, v := range members { + if v.UserId == userId { + return v + } + } + // 只在找不到用户时记录警告(避免日志过多) + g.Log().Warningf(ctx, "[MemberSummary] 未找到用户ID: %d", userId) + return nil + } + + for _, record := range result { + if record["created_by"].Int64() > 0 { + member := findMember(record["created_by"]) + if member != nil { + record["createdBySumma"] = gvar.New(member) + } + } + + if record["updated_by"].Int64() > 0 { + member := findMember(record["updated_by"]) + if member != nil { + record["updatedBySumma"] = gvar.New(member) + } + } + + if record["deleted_by"].Int64() > 0 { + member := findMember(record["deleted_by"]) + if member != nil { + record["deletedBySumma"] = gvar.New(member) + } + } + + if record["user_id"].Int64() > 0 { + member := findMember(record["user_id"]) + if member != nil { + record["memberBySumma"] = gvar.New(member) + } + } + } + return + }, +} diff --git a/internal/logic/common/batch_metadata_test.go b/internal/logic/common/batch_metadata_test.go new file mode 100644 index 0000000..aed293b --- /dev/null +++ b/internal/logic/common/batch_metadata_test.go @@ -0,0 +1,53 @@ +package common + +import ( + "context" + "testing" + + _ "github.com/gogf/gf/contrib/drivers/sqlite/v2" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/batchmetadata" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +func TestSaveBatchMainExecutionMetadata(t *testing.T) { + ctx := context.Background() + if err := gdb.SetConfig(gdb.Config{"default": gdb.ConfigGroup{{Type: "sqlite", Link: "sqlite::@file(:memory:)", MaxOpenConnCount: 1}}}); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = g.DB().Close(ctx) }) + if err := g.DB().GetCore().ClearTableFieldsAll(ctx); err != nil { + t.Fatal(err) + } + if _, err := g.DB().Exec(ctx, "CREATE TABLE batch_main (id INTEGER PRIMARY KEY AUTOINCREMENT, batch_no TEXT, tenant_id TEXT, dept_id INTEGER, source_channel TEXT, execution_mode INTEGER)"); err != nil { + t.Fatal(err) + } + for _, mode := range []int{batchmetadata.Single, batchmetadata.Bulk} { + batchNo := "SINGLE" + if mode == batchmetadata.Bulk { + batchNo = "BULK" + } + if err := g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error { + return New().SaveBatchMain(ctx, tx, &entity.BatchMain{BatchNo: batchNo, TenantId: "A", DeptId: 7}, mode) + }); err != nil { + t.Fatal(err) + } + record, err := g.DB().GetOne(ctx, "SELECT * FROM batch_main WHERE batch_no = ?", batchNo) + if err != nil || record["source_channel"].String() != "api" || record["execution_mode"].Int() != mode || record["tenant_id"].String() != "A" || record["dept_id"].Int() != 7 { + t.Fatalf("metadata not persisted: record=%+v err=%v", record, err) + } + } + for _, mode := range []int{-1, batchmetadata.Unknown, 3} { + if err := g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error { + return New().SaveBatchMain(ctx, tx, &entity.BatchMain{BatchNo: "INVALID"}, mode) + }); err == nil { + t.Fatalf("invalid creation mode accepted: %d", mode) + } + } + count, err := g.DB().GetValue(ctx, "SELECT COUNT(*) FROM batch_main") + if err != nil || count.Int() != 2 { + t.Fatalf("invalid batch inserted: count=%v err=%v", count, err) + } +} diff --git a/internal/logic/common/batch_wait.go b/internal/logic/common/batch_wait.go new file mode 100644 index 0000000..889d07f --- /dev/null +++ b/internal/logic/common/batch_wait.go @@ -0,0 +1,66 @@ +package common + +import ( + "context" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +const ( + singleBatchWaitTimeout = 60 * time.Second + singleBatchPollInterval = 500 * time.Millisecond +) + +func (s *sCommon) waitBatchCompletion(ctx context.Context, tenantID string, deptID int64, batchNo string) (int, error) { + deadline := time.Now().Add(singleBatchWaitTimeout) + for { + status, err := s.loadBatchAsyncStatus(ctx, tenantID, deptID, batchNo) + if err != nil { + return 0, err + } + switch status { + case consts.BatchAsyncStatusSuccess, consts.BatchAsyncStatusFailed, consts.BatchAsyncStatusPartialSuccess: + return status, nil + } + + remaining := time.Until(deadline) + if remaining <= 0 { + return 0, gerror.Newf("batch %s execution timed out; query batch status for the result", batchNo) + } + wait := singleBatchPollInterval + if remaining < wait { + wait = remaining + } + timer := time.NewTimer(wait) + select { + case <-ctx.Done(): + if !timer.Stop() { + <-timer.C + } + return 0, gerror.Wrap(ctx.Err(), "request canceled while waiting for batch completion") + case <-timer.C: + } + } +} + +func (s *sCommon) loadBatchAsyncStatus(ctx context.Context, tenantID string, deptID int64, batchNo string) (int, error) { + columns := dao.BatchMain.Columns() + var batch entity.BatchMain + err := dao.BatchMain.Ctx(ctx). + Where(columns.TenantId, tenantID). + Where(columns.DeptId, deptID). + Where(columns.BatchNo, batchNo). + Scan(&batch) + if err != nil { + return 0, gerror.Wrap(err, "failed to query batch execution status") + } + if batch.Id == 0 { + return 0, gerror.Newf("batch %s does not exist or is not accessible", batchNo) + } + return batch.BatchAsyncStatus, nil +} diff --git a/internal/logic/common/card_identifiers.go b/internal/logic/common/card_identifiers.go new file mode 100644 index 0000000..f2d86a6 --- /dev/null +++ b/internal/logic/common/card_identifiers.go @@ -0,0 +1,119 @@ +package common + +import ( + "context" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +type cardIdentifier struct { + Msisdn string + Iccid string + Imsi string +} + +func validateCardIdentifier(item cardIdentifier) error { + count := 0 + if strings.TrimSpace(item.Msisdn) != "" { + count++ + } + if strings.TrimSpace(item.Iccid) != "" { + count++ + } + if strings.TrimSpace(item.Imsi) != "" { + count++ + } + if count == 0 { + return gerror.New("msisdn、iccid、imsi至少传一个") + } + return nil +} + +func cardIdentifierKey(item cardIdentifier) string { + switch { + case item.Iccid != "": + return "iccid:" + item.Iccid + case item.Msisdn != "": + return "msisdn:" + item.Msisdn + default: + return "imsi:" + item.Imsi + } +} + +func cardMatchesIdentifier(card *entity.TSimCardInfo, identifier cardIdentifier) bool { + if card == nil { + return false + } + if identifier.Iccid != "" && strings.TrimSpace(card.Iccid) != identifier.Iccid { + return false + } + if identifier.Msisdn != "" && strings.TrimSpace(card.Msisdn) != identifier.Msisdn { + return false + } + if identifier.Imsi != "" && strings.TrimSpace(card.Imsi) != identifier.Imsi { + return false + } + return true +} + +func (s *sCommon) loadCardsByIdentifiers(ctx context.Context, tenantID string, deptIDs []int64, identifiers []cardIdentifier) (map[string]*entity.TSimCardInfo, error) { + columns := dao.TSimCardInfo.Columns() + result := make(map[string]*entity.TSimCardInfo, len(identifiers)) + iccidValues := make([]string, 0) + msisdnValues := make([]string, 0) + imsiValues := make([]string, 0) + for _, item := range identifiers { + switch { + case item.Iccid != "": + iccidValues = append(iccidValues, item.Iccid) + case item.Msisdn != "": + msisdnValues = append(msisdnValues, item.Msisdn) + case item.Imsi != "": + imsiValues = append(imsiValues, item.Imsi) + } + } + lookup := func(field string, values []string) error { + if len(values) == 0 { + return nil + } + var rows []*entity.TSimCardInfo + query := dao.TSimCardInfo.Ctx(ctx). + Where(columns.TenantId, tenantID). + WhereIn(columns.DeptId, deptIDs). + WhereIn(field, values). + Fields(columns.Iccid, columns.Msisdn, columns.Imsi, columns.PackageTotalFlowMb, columns.UsedFlowMb, + columns.CurrentPackageCode, columns.OutboundBatchNo, columns.TrafficCutoffStatus, columns.TrafficCutoffThreshold) + if err := query.Scan(&rows); err != nil { + return err + } + for _, row := range rows { + if row == nil { + continue + } + if row.Iccid != "" { + result["iccid:"+strings.TrimSpace(row.Iccid)] = row + } + if row.Msisdn != "" { + result["msisdn:"+strings.TrimSpace(row.Msisdn)] = row + } + if row.Imsi != "" { + result["imsi:"+strings.TrimSpace(row.Imsi)] = row + } + } + return nil + } + if err := lookup(columns.Iccid, iccidValues); err != nil { + return nil, gerror.Wrap(err, "查询卡片失败") + } + if err := lookup(columns.Msisdn, msisdnValues); err != nil { + return nil, gerror.Wrap(err, "查询卡片失败") + } + if err := lookup(columns.Imsi, imsiValues); err != nil { + return nil, gerror.Wrap(err, "查询卡片失败") + } + return result, nil +} diff --git a/internal/logic/common/common.go b/internal/logic/common/common.go new file mode 100644 index 0000000..56a84d0 --- /dev/null +++ b/internal/logic/common/common.go @@ -0,0 +1,102 @@ +package common + +import ( + "context" + "strings" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/util/gconv" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/batchimport" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/batchmetadata" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/rabbitmq" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/do" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +type sCommon struct{} + +func New() *sCommon { + return &sCommon{} +} + +func init() { + service.RegisterCommon(New()) +} + +// BuildBatchNo 与控制台、小程序共用按日递增规则。 +func (s *sCommon) BuildBatchNo(ctx context.Context, prefix string) (string, error) { + return batchimport.NextBatchNoContext(ctx, prefix) +} + +// SaveBatchMain 写入批次主表。 +func (s *sCommon) SaveBatchMain(ctx context.Context, tx gdb.TX, batch *entity.BatchMain, executionMode int) error { + if tx == nil { + return gerror.New("transaction is empty") + } + if batch == nil { + return gerror.New("batch main is empty") + } + if strings.TrimSpace(batch.BatchNo) == "" { + return gerror.New("batch no is empty") + } + if executionMode != batchmetadata.Single && executionMode != batchmetadata.Bulk { + return gerror.New("batch execution mode is invalid") + } + data := do.BatchMain{} + if err := gconv.Struct(batch, &data); err != nil { + return gerror.Wrap(err, "convert batch main failed") + } + data.SourceChannel = batchmetadata.API + data.ExecutionMode = executionMode + data.Id = nil + data.CreatedAt = nil + data.UpdatedAt = nil + _, err := tx.Ctx(ctx).Model(dao.BatchMain.Table()).Data(data).Insert() + if err != nil { + return gerror.Wrap(err, "save batch main failed") + } + return nil +} + +// SaveBatchDetail 写入单条批次明细。 +func (s *sCommon) SaveBatchDetail(ctx context.Context, tx gdb.TX, detail *entity.BatchDetail) error { + if tx == nil { + return gerror.New("transaction is empty") + } + if detail == nil { + return gerror.New("batch detail is empty") + } + if strings.TrimSpace(detail.BatchNo) == "" { + return gerror.New("batch no is empty") + } + data := do.BatchDetail{} + if err := gconv.Struct(detail, &data); err != nil { + return gerror.Wrap(err, "convert batch detail failed") + } + data.Id = nil + data.CreatedAt = nil + data.UpdatedAt = nil + _, err := tx.Ctx(ctx).Model(dao.BatchDetail.Table()).Data(data).Insert() + if err != nil { + return gerror.Wrap(err, "save batch detail failed") + } + return nil +} + +// SaveBatchDetails 批量写入批次明细。为了保持行为稳定,这里按行写入,避免不同数据库驱动对批量结构体的差异。 +func (s *sCommon) SaveBatchDetails(ctx context.Context, tx gdb.TX, details []*entity.BatchDetail) error { + for _, detail := range details { + if err := s.SaveBatchDetail(ctx, tx, detail); err != nil { + return err + } + } + return nil +} + +func (s *sCommon) Publish(ctx context.Context, queue string, data any) error { + return rabbitmq.Publish(ctx, queue, data) +} diff --git a/internal/logic/common/renew.go b/internal/logic/common/renew.go new file mode 100644 index 0000000..86cedca --- /dev/null +++ b/internal/logic/common/renew.go @@ -0,0 +1,333 @@ +package common + +import ( + "context" + "strconv" + "strings" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/batchmetadata" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +// BuildRenewBatchNo 生成续费类批次号。 +func (s *sCommon) BuildRenewBatchNo(ctx context.Context) (string, error) { + return s.BuildBatchNo(ctx, consts.BatchNoPrefixRenew) +} + +// SubmitRenew 创建卡续费批次并投递到 worker 异步执行。 +func (s *sCommon) SubmitRenew(ctx context.Context, in *model.CommonRenewParam) (*model.CommonRenewRes, error) { + return s.submitRenew(ctx, in, false, batchmetadata.Bulk) +} + +func (s *sCommon) submitRenew(ctx context.Context, in *model.CommonRenewParam, waitForCompletion bool, executionMode int) (*model.CommonRenewRes, error) { + if in == nil { + return nil, gerror.New("续费参数不能为空") + } + duration := in.DurationYears + if duration <= 0 { + duration = in.Validity + } + if duration <= 0 { + return nil, gerror.New("续费有效期必须大于0") + } + packageID := strings.TrimSpace(in.PackageId) + cards, err := normalizeRenewCards(in.Cards) + if err != nil { + return nil, err + } + + tenantID := strings.TrimSpace(contexts.GetTenantId(ctx)) + deptID := contexts.GetAgentDeptId(ctx) + userID := contexts.GetUserId(ctx) + if tenantID == "" || deptID <= 0 { + return nil, gerror.New("当前接口调用方信息不完整") + } + if userID <= 0 { + userID = deptID + } + + deptIDs, err := s.loadRenewAccessibleDeptIds(ctx, tenantID, deptID) + if err != nil { + return nil, err + } + identifiers := make([]cardIdentifier, 0, len(cards)) + for _, card := range cards { + identifiers = append(identifiers, cardIdentifier{Msisdn: card.Msisdn, Iccid: card.Iccid, Imsi: card.Imsi}) + } + cardMap, err := s.loadCardsByIdentifiers(ctx, tenantID, deptIDs, identifiers) + if err != nil { + return nil, err + } + for index := range cards { + dbCard := cardMap[cardIdentifierKey(identifiers[index])] + if !cardMatchesIdentifier(dbCard, identifiers[index]) { + return nil, gerror.New("卡片不存在或无权限") + } + cards[index].Iccid = strings.TrimSpace(dbCard.Iccid) + cards[index].Msisdn = strings.TrimSpace(dbCard.Msisdn) + cards[index].Imsi = strings.TrimSpace(dbCard.Imsi) + } + iccids := make([]string, 0, len(cards)) + for _, card := range cards { + iccids = append(iccids, card.Iccid) + } + + batchNo, err := s.BuildRenewBatchNo(ctx) + if err != nil { + return nil, err + } + now := gtime.Now() + remark := strings.TrimSpace(in.Remark) + batchInfo := gjson.New(map[string]any{ + "durationValue": duration, + "durationYears": duration, + "durationMonths": duration, + "packageId": packageID, + "paymentMode": "balance", + + "remark": remark, + "quantity": len(cards), + "submittedFrom": "openapi", + "submittedAt": now.Format("Y-m-d H:i:s"), + "runtimeResolveRenewDetail": true, + }) + + err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error { + main := &entity.BatchMain{ + BatchNo: batchNo, + BatchType: consts.BatchTypeRenew, + BatchStatus: consts.BatchStatusNormal, + BatchAsyncStatus: consts.BatchAsyncStatusPending, + SourceType: consts.BatchSourceTypeBatchInput, + DeptId: deptID, + TotalCount: len(cards), + ValidCount: len(cards), + RunResult: consts.BatchRunResultPending, + BatchInfo: batchInfo, + Remark: gjson.New(map[string]any{"remark": remark}), + TenantId: tenantID, + CreatedDept: deptID, + CreatedBy: userID, + CreatedAt: now, + UpdatedBy: userID, + UpdatedAt: now, + } + if err := s.SaveBatchMain(ctx, tx, main, executionMode); err != nil { + return err + } + details := make([]*entity.BatchDetail, 0, len(cards)) + for i, inputCard := range cards { + dbCard := cardMap[cardIdentifierKey(cardIdentifier{Msisdn: inputCard.Msisdn, Iccid: inputCard.Iccid, Imsi: inputCard.Imsi})] + snapshot := renewDetailSnapshot(inputCard, dbCard) + details = append(details, &entity.BatchDetail{ + BatchNo: batchNo, + BatchType: consts.BatchTypeRenew, + DetailStatus: consts.BatchDetailStatusPending, + BlankOutStatus: consts.BlankOutStatusNo, + RowNo: i + 1, + ItemId: inputCard.Iccid, + Snapshot: snapshot, + TenantId: tenantID, + CreatedDept: deptID, + CreatedBy: userID, + CreatedAt: now, + UpdatedBy: userID, + UpdatedAt: now, + }) + } + return s.SaveBatchDetails(ctx, tx, details) + }) + if err != nil { + return nil, err + } + + message := model.CommonBatchExecuteMessage{BatchNo: batchNo, BatchType: consts.BatchTypeRenew} + if err := s.Publish(ctx, consts.QueueBatchExecute, message); err != nil { + return nil, gerror.Wrap(err, "投递续费异步消息失败") + } + if waitForCompletion { + if _, err := s.waitBatchCompletion(ctx, tenantID, deptID, batchNo); err != nil { + return nil, err + } + } + + return &model.CommonRenewRes{ + BatchNo: batchNo, + BatchType: consts.BatchTypeRenew, + Total: len(cards), + }, nil +} + +func buildRenewSubmitRemark(ctx context.Context) string { + agent := contexts.GetAgentUser(ctx) + if agent == nil { + return "OpenAPI续费调用" + } + deptName := strings.TrimSpace(agent.DeptName) + deptKey := strings.TrimSpace(agent.DeptKey) + switch { + case deptName != "" && deptKey != "": + return "OpenAPI续费调用方:" + deptName + "(" + deptKey + ")" + case deptName != "": + return "OpenAPI续费调用方:" + deptName + case deptKey != "": + return "OpenAPI续费调用方:" + deptKey + default: + return "OpenAPI续费调用" + } +} + +func normalizeRenewCards(input []model.CommonRenewCard) ([]model.CommonRenewCard, error) { + if len(input) == 0 { + return nil, gerror.New("续费卡不能为空") + } + seen := make(map[string]struct{}, len(input)) + cards := make([]model.CommonRenewCard, 0, len(input)) + for _, item := range input { + item.Iccid = strings.TrimSpace(item.Iccid) + item.Msisdn = strings.TrimSpace(item.Msisdn) + item.Imsi = strings.TrimSpace(item.Imsi) + item.PackageId = strings.TrimSpace(item.PackageId) + identifier := cardIdentifier{Msisdn: item.Msisdn, Iccid: item.Iccid, Imsi: item.Imsi} + if err := validateCardIdentifier(identifier); err != nil { + return nil, err + } + key := cardIdentifierKey(identifier) + if _, ok := seen[key]; ok { + return nil, gerror.Newf("卡片标识重复:%s", key) + } + seen[key] = struct{}{} + cards = append(cards, item) + } + return cards, nil +} +func (s *sCommon) loadRenewAccessibleDeptIds(ctx context.Context, tenantID string, deptID int64) ([]int64, error) { + deptIDs := []int64{deptID} + columns := dao.SysDept.Columns() + array, err := dao.SysDept.Ctx(ctx). + Fields(columns.DeptId). + Where(columns.TenantId, tenantID). + WhereNull(columns.DeletedAt). + Where("dept_id = ? OR ancestors LIKE ?", deptID, "%,"+strconv.FormatInt(deptID, 10)+",%"). + Array() + if err != nil { + return nil, gerror.Wrap(err, "查询续费数据权限失败") + } + if len(array) == 0 { + return deptIDs, nil + } + seen := map[int64]struct{}{} + deptIDs = deptIDs[:0] + for _, item := range array { + id := item.Int64() + if id <= 0 { + continue + } + if _, ok := seen[id]; ok { + continue + } + seen[id] = struct{}{} + deptIDs = append(deptIDs, id) + } + if len(deptIDs) == 0 { + deptIDs = append(deptIDs, deptID) + } + return deptIDs, nil +} + +func (s *sCommon) loadRenewCards(ctx context.Context, tenantID string, deptIDs []int64, iccids []string) (map[string]*entity.TSimCardInfo, error) { + cardMap := make(map[string]*entity.TSimCardInfo, len(iccids)) + if len(iccids) == 0 { + return cardMap, nil + } + columns := dao.TSimCardInfo.Columns() + var rows []*entity.TSimCardInfo + err := dao.TSimCardInfo.Ctx(ctx). + Where(columns.TenantId, tenantID). + WhereIn(columns.DeptId, deptIDs). + WhereIn(columns.Iccid, iccids). + Scan(&rows) + if err != nil { + return nil, gerror.Wrap(err, "查询续费卡失败") + } + for _, row := range rows { + if row == nil { + continue + } + row.Iccid = strings.TrimSpace(row.Iccid) + if row.Iccid != "" { + cardMap[row.Iccid] = row + } + } + return cardMap, nil +} + +func renewDetailSnapshot(input model.CommonRenewCard, card *entity.TSimCardInfo) *gjson.Json { + data := map[string]any{ + "iccid": input.Iccid, + "targetCode": input.Iccid, + } + if input.Msisdn != "" { + data["msisdn"] = input.Msisdn + } + if input.Imsi != "" { + data["imsi"] = input.Imsi + } + if input.PackageId != "" { + data["packageId"] = input.PackageId + data["packageCode"] = input.PackageId + } + if card != nil { + if input.Msisdn == "" { + data["msisdn"] = strings.TrimSpace(card.Msisdn) + } + if input.Imsi == "" { + data["imsi"] = strings.TrimSpace(card.Imsi) + } + if input.PackageId == "" { + data["packageCode"] = strings.TrimSpace(card.CurrentPackageCode) + } + data["currentPackageCode"] = strings.TrimSpace(card.CurrentPackageCode) + data["outboundBatchNo"] = strings.TrimSpace(card.OutboundBatchNo) + } + return gjson.New(data) +} + +func (s *sCommon) SubmitSingleRenew(ctx context.Context, card model.CommonRenewCard, appID, packageID, remark string, validity int) (*model.CommonSingleRenewRes, error) { + card.PackageId = packageID + batch, err := s.submitRenew(ctx, &model.CommonRenewParam{ + AppId: appID, PackageId: packageID, Validity: validity, DurationYears: validity, Remark: remark, + Cards: []model.CommonRenewCard{card}, + }, true, batchmetadata.Single) + if err != nil { + return nil, err + } + return s.loadSingleRenewResult(ctx, batch.BatchNo, packageID, validity) +} + +func (s *sCommon) SubmitBatchRenew(ctx context.Context, appID string, cards []model.CommonRenewCard, iccids []string, packageID, remark string, validity int) (*model.CommonRenewRes, error) { + if len(cards) == 0 { + cards = make([]model.CommonRenewCard, 0, len(iccids)) + for _, iccid := range iccids { + cards = append(cards, model.CommonRenewCard{Iccid: iccid, PackageId: packageID}) + } + } + for index := range cards { + if cards[index].PackageId == "" { + cards[index].PackageId = packageID + } + } + return s.SubmitRenew(ctx, &model.CommonRenewParam{ + AppId: appID, PackageId: packageID, Validity: validity, DurationYears: validity, Remark: remark, Cards: cards, + }) +} diff --git a/internal/logic/common/single_result.go b/internal/logic/common/single_result.go new file mode 100644 index 0000000..b22d449 --- /dev/null +++ b/internal/logic/common/single_result.go @@ -0,0 +1,189 @@ +package common + +import ( + "context" + "strconv" + "strings" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +func (s *sCommon) loadSingleRenewResult(ctx context.Context, batchNo, packageID string, validity int) (*model.CommonSingleRenewRes, error) { + batch, err := s.loadBatchMain(ctx, batchNo, consts.BatchTypeRenew) + if err != nil { + return nil, err + } + detail, err := s.loadSingleBatchDetail(ctx, batchNo, consts.BatchTypeRenew) + if err != nil { + return nil, err + } + + result := &model.CommonSingleRenewRes{ + OrderId: "0", + OrderSn: strings.TrimSpace(batch.OrderSn), + Status: "success", + } + orderSn := result.OrderSn + if orderSn != "" { + var order entity.TOrder + orderColumns := dao.TOrder.Columns() + if err := dao.TOrder.Ctx(ctx). + Where(orderColumns.TenantId, batch.TenantId). + Where(orderColumns.OrderSn, orderSn). + Scan(&order); err == nil && order.Id > 0 { + result.OrderId = strconv.FormatInt(order.Id, 10) + result.Amount = order.TotalAmount + } + } + + if detail.Snapshot != nil { + result.Iccid = firstSnapshotValue(detail.Snapshot, "iccid", "ICCID", "targetCode") + result.PlanName = firstSnapshotValue(detail.Snapshot, "packageName") + result.EffectiveType = firstSnapshotValue(detail.Snapshot, "effectiveType", "effectiveMode") + result.EffectiveDate = firstSnapshotValue(detail.Snapshot, "renewEffectiveTime") + result.ExpireDate = firstSnapshotValue(detail.Snapshot, "renewExpectedExpireTime", "cardFlowPkgEndAt") + if snapshotAmount := firstSnapshotFloat(detail.Snapshot, "amount", "totalAmount"); snapshotAmount > 0 { + result.Amount = snapshotAmount + } + } + if result.EffectiveType == "" { + result.EffectiveType = "immediate" + } + if detail.DetailStatus != consts.BatchDetailStatusSuccess { + result.Status = "failed" + result.ErrorCode = strings.TrimSpace(detail.ErrorCode) + result.ErrorMessage = strings.TrimSpace(detail.ErrorReason) + if result.ErrorCode == "" { + result.ErrorCode = "RENEW_FAILED" + } + if result.ErrorMessage == "" { + result.ErrorMessage = "续费失败,执行明细未记录具体原因" + } + } + return result, nil +} + +func (s *sCommon) loadSingleTrafficCutoffResult(ctx context.Context, batchNo string) (*model.CommonSingleTrafficCutoffRes, error) { + detail, err := s.loadSingleBatchDetail(ctx, batchNo, consts.BatchTypeTrafficCutoffConfig) + if err != nil { + return nil, err + } + result := &model.CommonSingleTrafficCutoffRes{ + Success: detail.DetailStatus == consts.BatchDetailStatusSuccess, + Iccid: strings.TrimSpace(detail.ItemId), + Message: "traffic cutoff configuration succeeded", + ErrorCode: strings.TrimSpace(detail.ErrorCode), + } + if detail.Snapshot != nil { + result.Iccid = firstSnapshotValue(detail.Snapshot, "iccid", "ICCID") + result.Msisdn = firstSnapshotValue(detail.Snapshot, "msisdn", "MSISDN") + result.Imsi = firstSnapshotValue(detail.Snapshot, "imsi", "IMSI") + result.TrafficCutoffStatus = firstSnapshotInt(detail.Snapshot, "trafficCutoffStatusAfter", "trafficCutoffStatus") + result.TrafficCutoffThreshold = firstSnapshotFloat(detail.Snapshot, "trafficCutoffThresholdAfter", "trafficCutoffThreshold") + result.TrafficCutoffThresholdUnit = firstSnapshotValue(detail.Snapshot, "thresholdUnit", "trafficCutoffThresholdUnit") + } + if result.TrafficCutoffStatus == 0 { + result.TrafficCutoffThreshold = 0 + } + if result.TrafficCutoffThresholdUnit == "" { + result.TrafficCutoffThresholdUnit = "MB" + } + if !result.Success { + result.Message = strings.TrimSpace(detail.ErrorReason) + if result.Message == "" { + result.Message = "traffic cutoff configuration failed" + } + } + return result, nil +} + +func (s *sCommon) loadSingleBatchDetail(ctx context.Context, batchNo string, batchType int) (*entity.BatchDetail, error) { + tenantID := strings.TrimSpace(contexts.GetTenantId(ctx)) + deptID := contexts.GetAgentDeptId(ctx) + if tenantID == "" || deptID <= 0 { + return nil, gerror.New("request context is incomplete") + } + columns := dao.BatchDetail.Columns() + var detail entity.BatchDetail + err := dao.BatchDetail.Ctx(ctx). + Where(columns.TenantId, tenantID). + Where(columns.CreatedDept, deptID). + Where(columns.BatchNo, batchNo). + Where(columns.BatchType, batchType). + Scan(&detail) + if err != nil { + return nil, gerror.Wrap(err, "failed to query single-card execution result") + } + if detail.Id == 0 { + return nil, gerror.New("single-card execution result does not exist") + } + return &detail, nil +} + +func (s *sCommon) loadBatchMain(ctx context.Context, batchNo string, batchType int) (*entity.BatchMain, error) { + tenantID := strings.TrimSpace(contexts.GetTenantId(ctx)) + deptID := contexts.GetAgentDeptId(ctx) + if tenantID == "" || deptID <= 0 { + return nil, gerror.New("request context is incomplete") + } + columns := dao.BatchMain.Columns() + var batch entity.BatchMain + err := dao.BatchMain.Ctx(ctx). + Where(columns.TenantId, tenantID). + Where(columns.CreatedDept, deptID). + Where(columns.BatchNo, batchNo). + Where(columns.BatchType, batchType). + Scan(&batch) + if err != nil { + return nil, gerror.Wrap(err, "failed to query batch") + } + if batch.Id == 0 { + return nil, gerror.New("batch does not exist") + } + return &batch, nil +} + +func firstSnapshotValue(snapshot *gjson.Json, keys ...string) string { + for _, key := range keys { + if value := strings.TrimSpace(snapshot.Get(key).String()); value != "" { + return value + } + } + return "" +} + +func firstSnapshotInt(snapshot *gjson.Json, keys ...string) int { + for _, key := range keys { + if value := snapshot.Get(key); value != nil && value.String() != "" { + return value.Int() + } + } + return 0 +} + +func firstSnapshotFloat(snapshot *gjson.Json, keys ...string) float64 { + for _, key := range keys { + if value := snapshot.Get(key); value != nil && value.String() != "" { + return value.Float64() + } + } + return 0 +} + +func trafficCutoffStatusName(status int) string { + switch status { + case 1: + return "已开启" + case 2: + return "已关闭" + default: + return "删除" + } +} diff --git a/internal/logic/common/traffic_cutoff_config.go b/internal/logic/common/traffic_cutoff_config.go new file mode 100644 index 0000000..eaa758a --- /dev/null +++ b/internal/logic/common/traffic_cutoff_config.go @@ -0,0 +1,209 @@ +package common + +import ( + "context" + "strings" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/batchmetadata" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +const ( + trafficCutoffConfigMaxCards = 1000 + trafficCutoffRequestIDMaxLen = 64 +) + +func (s *sCommon) SubmitTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffConfigParam) (*model.CommonTrafficCutoffConfigRes, error) { + return s.submitTrafficCutoffConfig(ctx, in, false, batchmetadata.Bulk) +} + +func (s *sCommon) submitTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffConfigParam, waitForCompletion bool, executionMode int) (*model.CommonTrafficCutoffConfigRes, error) { + if in == nil { + return nil, gerror.New("达量断网配置参数不能为空") + } + if strings.TrimSpace(in.AppId) == "" { + return nil, gerror.New("appId不能为空") + } + idempotencyKey := strings.TrimSpace(in.IdempotencyKey) + if len(idempotencyKey) > trafficCutoffRequestIDMaxLen { + return nil, gerror.Newf("Idempotency-Key长度不能超过%d", trafficCutoffRequestIDMaxLen) + } + if in.TrafficCutoffStatus == 0 { + in.TrafficCutoffThreshold = 0 + } + if err := validateTrafficCutoffConfig(in.TrafficCutoffStatus, in.TrafficCutoffThreshold); err != nil { + return nil, err + } + if len(in.Cards) == 0 { + return nil, gerror.New("配置卡不能为空") + } + if len(in.Cards) > trafficCutoffConfigMaxCards { + return nil, gerror.Newf("单次最多配置%d张卡", trafficCutoffConfigMaxCards) + } + + identifiers := make([]cardIdentifier, 0, len(in.Cards)) + seen := make(map[string]struct{}, len(in.Cards)) + for _, card := range in.Cards { + identifier := cardIdentifier{ + Msisdn: strings.TrimSpace(card.Msisdn), + Iccid: strings.TrimSpace(card.Iccid), + Imsi: strings.TrimSpace(card.Imsi), + } + if err := validateCardIdentifier(identifier); err != nil { + return nil, err + } + key := cardIdentifierKey(identifier) + if _, ok := seen[key]; ok { + return nil, gerror.Newf("卡片标识重复:%s", key) + } + seen[key] = struct{}{} + identifiers = append(identifiers, identifier) + } + + tenantID := strings.TrimSpace(contexts.GetTenantId(ctx)) + deptID := contexts.GetAgentDeptId(ctx) + if tenantID == "" || deptID <= 0 { + return nil, gerror.New("当前接口调用方信息不完整") + } + operatorID := contexts.GetUserId(ctx) + if operatorID <= 0 { + operatorID = deptID + } + + if idempotencyKey != "" { + if existing, err := s.findTrafficCutoffBatch(ctx, tenantID, deptID, idempotencyKey); err != nil { + return nil, err + } else if existing != nil { + return &model.CommonTrafficCutoffConfigRes{BatchNo: existing.BatchNo, BatchType: consts.BatchTypeTrafficCutoffConfig}, nil + } + } + + deptIDs, err := s.loadRenewAccessibleDeptIds(ctx, tenantID, deptID) + if err != nil { + return nil, err + } + cardMap, err := s.loadCardsByIdentifiers(ctx, tenantID, deptIDs, identifiers) + if err != nil { + return nil, err + } + iccids := make([]string, 0, len(identifiers)) + for _, identifier := range identifiers { + card := cardMap[cardIdentifierKey(identifier)] + if !cardMatchesIdentifier(card, identifier) { + return nil, gerror.New("卡片不存在或无权限") + } + iccids = append(iccids, strings.TrimSpace(card.Iccid)) + } + + batchNo, err := s.BuildBatchNo(ctx, consts.BatchNoPrefixTrafficCutoffConfig) + if err != nil { + return nil, err + } + now := gtime.Now() + batchInfo := gjson.New(map[string]any{ + "operation": "traffic_cutoff_config", + "configName": "达量断网配置", + "submitScene": "openapi", + "trafficCutoffStatus": in.TrafficCutoffStatus, + "trafficCutoffThreshold": in.TrafficCutoffThreshold, + "trafficCutoffThresholdUnit": "MB", + "remark": strings.TrimSpace(in.Remark), + "quantity": len(iccids), + }) + if idempotencyKey != "" { + batchInfo.Set("idempotencyKey", idempotencyKey) + } + err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error { + main := &entity.BatchMain{ + BatchNo: batchNo, + BatchType: consts.BatchTypeTrafficCutoffConfig, + BatchStatus: consts.BatchStatusNormal, + BatchAsyncStatus: consts.BatchAsyncStatusPending, + SourceType: consts.BatchSourceTypeBatchInput, + DeptId: deptID, + TotalCount: len(iccids), + ValidCount: len(iccids), + RunResult: consts.BatchRunResultPending, + BatchInfo: batchInfo, + Remark: gjson.New(map[string]any{"remark": strings.TrimSpace(in.Remark)}), + TenantId: tenantID, + CreatedDept: deptID, + CreatedBy: operatorID, + CreatedAt: now, + UpdatedBy: operatorID, + UpdatedAt: now, + } + if err := s.SaveBatchMain(ctx, tx, main, executionMode); err != nil { + return err + } + details := make([]*entity.BatchDetail, 0, len(iccids)) + for index, iccid := range iccids { + card := cardMap[cardIdentifierKey(identifiers[index])] + snapshot := gjson.New(map[string]any{ + "iccid": card.Iccid, + "msisdn": card.Msisdn, + "imsi": card.Imsi, + "authorized": true, + "trafficCutoffStatus": in.TrafficCutoffStatus, + "trafficCutoffThreshold": in.TrafficCutoffThreshold, + "trafficCutoffThresholdUnit": "MB", + }) + details = append(details, &entity.BatchDetail{ + BatchNo: batchNo, + BatchType: consts.BatchTypeTrafficCutoffConfig, + DetailStatus: consts.BatchDetailStatusPending, + BlankOutStatus: consts.BlankOutStatusNo, + RowNo: index + 1, + ItemId: iccid, + Snapshot: snapshot, + TenantId: tenantID, + CreatedDept: deptID, + CreatedBy: operatorID, + CreatedAt: now, + UpdatedBy: operatorID, + UpdatedAt: now, + }) + } + return s.SaveBatchDetails(ctx, tx, details) + }) + if err != nil { + return nil, err + } + + message := model.CommonBatchExecuteMessage{BatchNo: batchNo, BatchType: consts.BatchTypeTrafficCutoffConfig} + if err := s.Publish(ctx, consts.QueueBatchExecute, message); err != nil { + return nil, gerror.Wrap(err, "投递达量断网配置异步消息失败") + } + if waitForCompletion { + if _, err := s.waitBatchCompletion(ctx, tenantID, deptID, batchNo); err != nil { + return nil, err + } + } + return &model.CommonTrafficCutoffConfigRes{BatchNo: batchNo, BatchType: consts.BatchTypeTrafficCutoffConfig}, nil +} + +func (s *sCommon) SubmitSingleTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffSingleParam) (*model.CommonSingleTrafficCutoffRes, error) { + if in == nil { + return nil, gerror.New("traffic cutoff configuration parameters are required") + } + batch, err := s.submitTrafficCutoffConfig(ctx, &model.CommonTrafficCutoffConfigParam{ + AppId: in.AppId, + Cards: []model.CommonTrafficCutoffCard{{Msisdn: in.Msisdn, Iccid: in.Iccid, Imsi: in.Imsi}}, + TrafficCutoffStatus: in.TrafficCutoffStatus, + TrafficCutoffThreshold: in.TrafficCutoffThreshold, + Remark: in.Remark, + }, true, batchmetadata.Single) + if err != nil { + return nil, err + } + return s.loadSingleTrafficCutoffResult(ctx, batch.BatchNo) +} diff --git a/internal/logic/common/traffic_cutoff_helpers.go b/internal/logic/common/traffic_cutoff_helpers.go new file mode 100644 index 0000000..7e579be --- /dev/null +++ b/internal/logic/common/traffic_cutoff_helpers.go @@ -0,0 +1,36 @@ +package common + +import ( + "context" + "database/sql" + "errors" + + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +func (s *sCommon) findTrafficCutoffBatch(ctx context.Context, tenantID string, deptID int64, idempotencyKey string) (*entity.BatchMain, error) { + var batch entity.BatchMain + columns := dao.BatchMain.Columns() + err := dao.BatchMain.Ctx(ctx). + Where(columns.TenantId, tenantID). + Where(columns.DeptId, deptID). + Where(columns.BatchType, consts.BatchTypeTrafficCutoffConfig). + Where("JSON_UNQUOTE(JSON_EXTRACT("+columns.BatchInfo+", '$.idempotencyKey')) = ?", idempotencyKey). + OrderDesc(columns.Id). + Limit(1). + Scan(&batch) + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } + if err != nil { + return nil, gerror.Wrap(err, "查询达量断网配置幂等批次失败") + } + if batch.Id == 0 { + return nil, nil + } + return &batch, nil +} diff --git a/internal/logic/common/traffic_cutoff_validation.go b/internal/logic/common/traffic_cutoff_validation.go new file mode 100644 index 0000000..9640e3d --- /dev/null +++ b/internal/logic/common/traffic_cutoff_validation.go @@ -0,0 +1,27 @@ +package common + +import ( + "math" + + "github.com/gogf/gf/v2/errors/gerror" +) + +func validateTrafficCutoffConfig(status int, threshold float64) error { + if status < 0 || status > 2 { + return gerror.New("达量断网配置状态无效") + } + if threshold < 0 { + return gerror.New("达量断网阈值不能小于0") + } + if status == 0 && threshold != 0 { + return gerror.New("未配置达量断网时阈值必须为0") + } + if status == 1 && threshold <= 0 { + return gerror.New("开启达量断网时阈值必须大于0") + } + rounded := math.Round(threshold*1000) / 1000 + if math.Abs(threshold-rounded) > 0.0000001 { + return gerror.New("达量断网阈值最多保留3位小数") + } + return nil +} diff --git a/internal/logic/logic.go b/internal/logic/logic.go new file mode 100644 index 0000000..d45c875 --- /dev/null +++ b/internal/logic/logic.go @@ -0,0 +1,10 @@ +package logic + +import ( + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/common" + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/middleware" + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/oldApi" + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/openapiiot" + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/query" + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/upstream" +) diff --git a/internal/logic/middleware/middleware.go b/internal/logic/middleware/middleware.go new file mode 100644 index 0000000..2be601d --- /dev/null +++ b/internal/logic/middleware/middleware.go @@ -0,0 +1,351 @@ +package middleware + +import ( + "context" + "net/http" + "slices" + "strconv" + "strings" + + "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/net/ghttp" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmeta" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/packed/response" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +type sMiddleware struct{} + +const apiDataScopeRoleId int64 = 17 + +func New() *sMiddleware { + return &sMiddleware{} +} + +func init() { + service.RegisterMiddleware(New()) +} + +func getContentType(r *ghttp.Request) (contentType string) { + contentType = r.Response.Header().Get("Content-Type") + if contentType != "" { + return + } + + mime := gmeta.Get(r.GetHandlerResponse(), "mime").String() + if mime == "" { + contentType = consts.HTTPContentTypeJson + } else { + contentType = mime + } + return +} + +func (m *sMiddleware) ResponseHandler(r *ghttp.Request) { + r.Middleware.Next() + if r.Response.BufferLength() > 0 || contexts.IsWebSocket(r.GetCtx()) { + return + } + if getContentType(r) == consts.HTTPContentTypeExcel { + r.Response.Status = http.StatusOK + return + } + + err := r.GetError() + res := r.GetHandlerResponse() + var code gcode.Code = gcode.CodeOK + if err != nil { + code = gerror.Code(err) + if code == gcode.CodeNil { + code = gcode.CodeInternalError + } + response.JsonExit(r, code.Code(), err.Error()) + return + } + response.Json(r, code.Code(), "", res) +} + +func (s *sMiddleware) ApiCtx(r *ghttp.Request) { + ctx := r.GetCtx() + r.SetCtx(r.GetNeverDoneCtx()) + if r.URL != nil && s.IsExceptLogin(ctx, r.URL.Path) { + r.Middleware.Next() + return + } + + data, err := service.QueryToken().GetCurrentCustomer(ctx) + if err != nil { + g.Log().Errorf(ctx, "sMiddleware.ApiCtx current customer error: %v", err) + r.Middleware.Next() + return + } + if data != nil { + contextModel := new(model.Context) + contextModel.User = &model.Identity{ + BaseClaims: model.BaseClaims{ + ID: 0, + TenantId: data.BaseClaimsApi.TenantId, + DeptId: data.BaseClaimsApi.DeptId, + Roles: []model.Role{ + {RoleId: apiDataScopeRoleId, DataScope: consts.SysRoleDataScopeDeptAndBelow}, + }, + LoginAt: data.BaseClaimsApi.LoginAt, + }, + } + contextModel.AgentUser = &data.BaseClaimsApi + contexts.Init(r, contextModel) + } + r.Middleware.Next() +} + +func (s *sMiddleware) ApiAuth(r *ghttp.Request) { + ctx := r.Context() + path := r.URL.Path + if s.IsExceptLogin(ctx, path) { + r.Middleware.Next() + return + } + + deptKey := contexts.GetDeptKey(ctx) + if deptKey == "" { + g.Log().Error(ctx, "sMiddleware.ApiAuth deptKey is empty", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), consts.CodeLoginExpired.Message()) + return + } + + appId := r.Get("appId").String() + if appId == "" { + g.Log().Error(ctx, "sMiddleware.ApiAuth appId is empty", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), consts.CodeLoginExpired.Message()) + return + } + if deptKey != appId { + g.Log().Error(ctx, "sMiddleware.ApiAuth deptKey not match appId", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), consts.CodeLoginExpired.Message()) + return + } + if contexts.GetAgentDeptId(ctx) == 0 { + g.Log().Error(ctx, "sMiddleware.ApiAuth deptId is 0", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), consts.CodeLoginExpired.Message()) + return + } + if !s.hasOpenApiPermission(ctx, r.Method, path) { + response.JsonExit(r, consts.CodeNoPermission.Code(), consts.CodeNoPermission.Message()) + return + } + + r.Middleware.Next() +} + +func openApiMethodValues(method string) []string { + method = strings.ToUpper(strings.TrimSpace(method)) + values := []string{method} + switch method { + case "GET": + values = append(values, "4") + case "POST": + values = append(values, "1") + case "PUT": + values = append(values, "2") + case "DELETE": + values = append(values, "3") + } + return values +} + +func (s *sMiddleware) hasOpenApiPermission(ctx context.Context, method, path string) bool { + agentUser := contexts.GetAgentUser(ctx) + if agentUser == nil { + return false + } + if path == "/openapi/v3/query/token" { + return true + } + + path = strings.TrimSpace(path) + if path != "/" { + path = strings.TrimRight(path, "/") + } + var apiResource entity.TApiResource + if err := dao.TApiResource.Ctx(ctx). + WhereIn(dao.TApiResource.Columns().Method, openApiMethodValues(method)). + Where(dao.TApiResource.Columns().Path, path). + Scan(&apiResource); err != nil { + g.Log().Warningf(ctx, "sMiddleware.hasOpenApiPermission resource not configured, method: %s, path: %s, err: %v", method, path, err) + return true + } + if apiResource.Id == 0 { + g.Log().Warningf(ctx, "sMiddleware.hasOpenApiPermission resource not configured, method: %s, path: %s", method, path) + return true + } + if apiResource.Status == 1 { + return false + } + + var tApi entity.TApi + apiMod := dao.TApi.Ctx(ctx) + if agentUser.ApiId > 0 { + apiMod = apiMod.Where(dao.TApi.Columns().Id, agentUser.ApiId) + } else if agentUser.AppKey != "" { + apiMod = apiMod.Where(dao.TApi.Columns().AppKey, agentUser.AppKey) + } else { + g.Log().Warningf(ctx, "sMiddleware.hasOpenApiPermission api identity is empty, resourceApiId: %d, path: %s", apiResource.Id, path) + return false + } + if err := apiMod.Scan(&tApi); err != nil { + g.Log().Errorf(ctx, "sMiddleware.hasOpenApiPermission scan t_api error: %v", err) + return false + } + if tApi.Id == 0 || tApi.Status == 1 { + g.Log().Warningf(ctx, "sMiddleware.hasOpenApiPermission t_api unavailable, tApiId: %d, status: %d, resourceApiId: %d, path: %s", tApi.Id, tApi.Status, apiResource.Id, path) + return false + } + if tApi.GroupId <= 0 { + g.Log().Warningf(ctx, "sMiddleware.hasOpenApiPermission groupId is empty, tApiId: %d, appKey: %s, resourceApiId: %d, path: %s", tApi.Id, tApi.AppKey, apiResource.Id, path) + return false + } + + count, err := dao.TApiGroupResource.Ctx(ctx). + Where(dao.TApiGroupResource.Columns().GroupId, tApi.GroupId). + Where(dao.TApiGroupResource.Columns().ApiId, apiResource.Id). + Count() + if err != nil { + g.Log().Errorf(ctx, "sMiddleware.hasOpenApiPermission scan relation error: %v", err) + return false + } + return count > 0 +} + +func (m *sMiddleware) OldResponseHandler(r *ghttp.Request) { + r.Middleware.Next() + if r.Response.BufferLength() > 0 || contexts.IsWebSocket(r.GetCtx()) { + return + } + if getContentType(r) == consts.HTTPContentTypeExcel { + r.Response.Status = http.StatusOK + return + } + + err := r.GetError() + res := r.GetHandlerResponse() + var code gcode.Code = gcode.CodeOK + if err != nil { + code = gerror.Code(err) + if code == gcode.CodeNil { + code = gcode.CodeInternalError + } + response.OldJson(r, code.Code(), err.Error()) + return + } + response.OldJson(r, code.Code(), "", res) +} + +func (s *sMiddleware) OldCtx(r *ghttp.Request) { + ctx := r.GetCtx() + r.SetCtx(r.GetNeverDoneCtx()) + + verifyVar := r.Get("verify") + var verify model.VerifyItem + if err := verifyVar.Scan(&verify); err != nil { + g.Log().Errorf(ctx, "sMiddleware.OldCtx verify scan error: %v", err) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), "request param invalid") + return + } + + var tApi entity.TApi + err := dao.TApi.Ctx(ctx).Where(g.Map{ + dao.TApi.Columns().AppKey: verify.AppId, + }).Scan(&tApi) + if err != nil { + r.Middleware.Next() + return + } + if tApi.Id != 0 { + contextModel := new(model.Context) + contextModel.User = &model.Identity{ + BaseClaims: model.BaseClaims{ + ID: 0, + TenantId: tApi.TenantId, + DeptId: tApi.DeptId, + Roles: []model.Role{ + {RoleId: apiDataScopeRoleId, DataScope: consts.SysRoleDataScopeDeptAndBelow}, + }, + LoginAt: gtime.Now().TimestampMilli(), + }, + } + contextModel.AgentUser = &model.BaseClaimsApi{ + ApiId: tApi.Id, + AppKey: tApi.AppKey, + GroupId: tApi.GroupId, + DeptId: tApi.DeptId, + TenantId: tApi.TenantId, + LoginAt: gtime.Now().TimestampMilli(), + } + contexts.Init(r, contextModel) + } + r.Middleware.Next() +} + +func (s *sMiddleware) OldAuth(r *ghttp.Request) { + ctx := r.Context() + path := r.URL.Path + if s.IsExceptLogin(ctx, path) { + r.Middleware.Next() + return + } + + verifyVar := r.Get("verify") + var verify model.VerifyItem + if err := verifyVar.Scan(&verify); err != nil { + g.Log().Errorf(ctx, "sMiddleware.OldAuth verify scan error: %v", err) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), "request param invalid") + return + } + if verify.TimeStamp == "" { + g.Log().Error(ctx, "sMiddleware.OldAuth timestamp is empty", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), "request param invalid") + return + } + + givenTime, err := strconv.ParseInt(verify.TimeStamp, 10, 64) + if err != nil { + g.Log().Errorf(ctx, "sMiddleware.OldAuth timestamp parse error: %v", err) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), "request param invalid") + return + } + if givenTime > gtime.Now().TimestampMilli()+3*60*1000 { + g.Log().Error(ctx, "sMiddleware.OldAuth timestamp expired", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), "request timeout") + return + } + if verify.AppId == "" { + g.Log().Error(ctx, "sMiddleware.OldAuth appId is empty", "path", path) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), "request param invalid") + return + } + + var tApi entity.TApi + err = dao.TApi.Ctx(ctx).Where(g.Map{ + dao.TApi.Columns().AppKey: verify.AppId, + }).Scan(&tApi) + if err != nil || tApi.Id == 0 || verify.Password != tApi.AppSecret { + g.Log().Errorf(ctx, "sMiddleware.OldAuth auth failed: %v", err) + response.JsonExit(r, gcode.CodeNotAuthorized.Code(), consts.CodeUserNotFound.Message()) + return + } + r.Middleware.Next() +} + +func (s *sMiddleware) IsExceptLogin(ctx context.Context, path string) bool { + pathList := g.Cfg().MustGet(ctx, "router.exceptLogin").Strings() + return slices.Contains(pathList, path) +} diff --git a/internal/logic/oldApi/query.go b/internal/logic/oldApi/query.go new file mode 100644 index 0000000..00e9947 --- /dev/null +++ b/internal/logic/oldApi/query.go @@ -0,0 +1,322 @@ +package oldApi + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/handler" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + "strconv" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +type sOldApiQuery struct { +} + +func NewOldApiQuery() *sOldApiQuery { + return &sOldApiQuery{} +} + +func init() { + service.RegisterOldApiQuery(NewOldApiQuery()) +} + +func (s *sOldApiQuery) StatusConversion(simCardInfo entity.TSimCardInfo) int { + switch simCardInfo.BossCardStatus { + case 0: + return 8 + case 1: + return 3 + case 2: + return 4 + case 4: + return 5 + case 6: + return 2 + case 7: + return 1 + case 8: + return 6 + case 9: + return 7 + default: + return 8 + } +} + +func oldApiDate(times ...*gtime.Time) string { + for _, item := range times { + if item == nil || item.IsZero() { + continue + } + return item.Format("Y-m-d") + } + return "" +} + +func oldApiEndOfDay(t *gtime.Time) *gtime.Time { + if t == nil || t.IsZero() { + return nil + } + return t.EndOfDay() +} + +func oldApiEndOfDayString(t *gtime.Time) string { + if t == nil || t.IsZero() { + return "" + } + return t.EndOfDay().Format("Y-m-d H:i:s") +} + +func oldApiScopedCardByIccid(ctx context.Context, iccid string) (card *entity.TSimCardInfo, err error) { + err = service.IotTSimCardInfo(). + Model(ctx). + Where(dao.TSimCardInfo.Columns().Iccid, iccid). + Limit(1). + Scan(&card) + if err != nil { + return nil, err + } + if card == nil { + return nil, gerror.New("sim卡不存在") + } + return card, nil +} + +func (s *sOldApiQuery) QuerySimCard(ctx context.Context, input *model.SimCardInfoInput) (output *model.SimCardInfoOutput, err error) { + input.Param.Type = strings.ToLower(strings.TrimSpace(input.Param.Type)) + input.Param.Cardno = strings.TrimSpace(input.Param.Cardno) + if input.Param.Type == "" { + return nil, gerror.New("数据类型不能为空") + } + if input.Param.Cardno == "" { + return nil, gerror.New("值不能为空") + } + + field := "" + if input.Param.Type == "iccid" { + field = dao.TSimCardInfo.Columns().Iccid + } else if input.Param.Type == "imsi" { + field = dao.TSimCardInfo.Columns().Imsi + } else if input.Param.Type == "msisdn" { + field = dao.TSimCardInfo.Columns().Msisdn + } else { + return nil, gerror.New("数据类型错误") + } + + var out []model.TSimCardInfoListModel + sysDept := dao.SysDept.Table() + cardInfoTable := dao.TSimCardInfo.Table() + flowPackage := dao.TSimFlowPackageInfo.Table() + err = service.IotTSimCardInfo(). + Model(ctx, &handler.Option{FilterAuth: false, FilterTenant: true}). + Where(field, input.Param.Cardno). + LeftJoin(sysDept, sysDept+"."+dao.SysDept.Columns().DeptId+"="+cardInfoTable+"."+dao.TSimCardInfo.Columns().DeptId). + LeftJoin(flowPackage, flowPackage+"."+dao.TSimFlowPackageInfo.Columns().PackageCode+"="+cardInfoTable+"."+dao.TSimCardInfo.Columns().CurrentPackageCode). + Fields(cardInfoTable + ".*," + sysDept + "." + dao.SysDept.Columns().DeptName + " as DeptName," + flowPackage + "." + dao.TSimFlowPackageInfo.Columns().PackageName + " as PackageName"). + Limit(1). + Scan(&out) + if err != nil { + return nil, gerror.New("查询sim卡信息失败") + } + if len(out) == 0 { + return nil, gerror.New("sim卡不存在") + } + + output = &model.SimCardInfoOutput{ + Vid: strconv.FormatInt(out[0].Id, 10), + Msisdn: out[0].Msisdn, + Iccid: out[0].Iccid, + Imei: out[0].Imei, + Imsi: out[0].Imsi, + DeptName: out[0].DeptName, + StatusId: s.StatusConversion(entity.TSimCardInfo{ + BossCardStatus: out[0].BossCardStatus, + }), + PackageId: out[0].CurrentPackageCode, + PackageName: out[0].PackageName, + Used: out[0].UsedFlowMb, + Remaining: out[0].PackageTotalFlowMb - out[0].UsedFlowMb, + Type: model.SimCardNameMap[out[0].CardType], + PacketArr: nil, + Remark: out[0].Remark, + Grouping: "", + DeliverDate: "", + ActivateDate: oldApiDate(out[0].BossActivateAt, out[0].BossOpenAt, out[0].FlowPkgBeginAt), + ExpireTime: oldApiEndOfDay(out[0].FlowPkgEndAt), + } + return output, nil +} + +func (s *sOldApiQuery) QuerySimDataUsage(ctx context.Context, input *model.SimDataUsageOldInput) (output *model.SimDataUsageOldOutput, err error) { + input.Param.Iccid = strings.TrimSpace(input.Param.Iccid) + if input.Param.Iccid == "" { + return nil, gerror.New("iccid不能为空") + } + + card, err := oldApiScopedCardByIccid(ctx, input.Param.Iccid) + if err != nil { + return nil, err + } + output = &model.SimDataUsageOldOutput{ + UseUnit: "MB", + UseAmount: card.UsedFlowMb, + } + return output, nil +} + +func (s *sOldApiQuery) QuerySimDataUsageMonthly(ctx context.Context, input *model.SimDataUsageMonthlyOldInput) (output *model.SimDataUsageMonthlyOldOutput, err error) { + input.Param.Iccid = strings.TrimSpace(input.Param.Iccid) + input.Param.DateTime = strings.TrimSpace(input.Param.DateTime) + if input.Param.Iccid == "" { + return nil, gerror.New("iccid不能为空") + } + if input.Param.DateTime == "" { + return nil, gerror.New("日期时间不能为空") + } + if _, err = oldApiScopedCardByIccid(ctx, input.Param.Iccid); err != nil { + return nil, err + } + + simDataUsageMonthlyInput := &model.SimDataUsageMonthlyInput{ + SimKeys: []*model.SimKey{ + { + ICCID: input.Param.Iccid, + }, + }, + ReqData: model.SimDataUsageMonthlyInputItem{ + QueryDate: input.Param.DateTime, + }, + } + out, err := service.UpstreamChan().QuerySimDatausageMonthly(ctx, simDataUsageMonthlyInput) + if err != nil { + return nil, gerror.New("查询sim卡历史用量失败") + } + if len(out) == 0 { + return &model.SimDataUsageMonthlyOldOutput{ + UseUnit: "MB", + UseAmount: 0, + }, nil + } + + output = &model.SimDataUsageMonthlyOldOutput{ + UseUnit: "MB", + UseAmount: out[0].ResData.DataAmount, + } + return output, nil +} + +func (s *sOldApiQuery) QuerySimStatus(ctx context.Context, input *model.SimStatusOldInput) (output *model.SimStatusOldOutput, err error) { + input.Param.Iccid = strings.TrimSpace(input.Param.Iccid) + if input.Param.Iccid == "" { + return nil, gerror.New("iccid不能为空") + } + + card, err := oldApiScopedCardByIccid(ctx, input.Param.Iccid) + if err != nil { + return nil, err + } + status := s.StatusConversion(*card) + output = &model.SimStatusOldOutput{ + StatusMessage: model.SimCardStatusMap[status], + StatusCode: status, + } + return output, nil +} + +func (s *sOldApiQuery) QuerySimSession(ctx context.Context, input *model.SimStatusOnlineOldInput) (output *model.SimStatusOnlineOldOutput, err error) { + input.Param.Iccid = strings.TrimSpace(input.Param.Iccid) + if input.Param.Iccid == "" { + return nil, gerror.New("iccid不能为空") + } + if _, err = oldApiScopedCardByIccid(ctx, input.Param.Iccid); err != nil { + return nil, err + } + + simSessionInput := &model.SimSessionInput{ + SimKeys: []*model.SimKey{ + { + ICCID: input.Param.Iccid, + }, + }, + } + outSession, err := service.UpstreamChan().QuerySimSession(ctx, simSessionInput) + if err != nil { + return nil, gerror.New("查询sim卡会话失败") + } + if len(outSession) == 0 { + return &model.SimStatusOnlineOldOutput{ + TypeName: "", + Imei: "", + Data: model.SimStatusOnlineOldData{}, + StatusMessage: "", + StatusCode: 0, + }, nil + } + + simStatusOnlineOldData := model.SimStatusOnlineOldData{ + ApnId: outSession[0].ResData.ApnId, + Rat: outSession[0].ResData.Rat, + Ipv6: outSession[0].ResData.Ipv6, + Ip: outSession[0].ResData.Ipv4, + Ipv6Prefix: outSession[0].ResData.Ipv6Prefix, + Status: outSession[0].ResData.Status, + CreateDate: outSession[0].ResData.CreateTime, + } + output = &model.SimStatusOnlineOldOutput{ + TypeName: "", + Imei: "", + Data: simStatusOnlineOldData, + StatusMessage: "", + StatusCode: 0, + } + return output, nil +} + +func (s *sOldApiQuery) QueryCardInfoList(ctx context.Context, input *model.QueryCardInfoListInput) (output []model.QueryCardInfoListOutput, err error) { + iccids := make([]string, 0, len(input.Param.Iccid)) + for _, iccid := range input.Param.Iccid { + iccid = strings.TrimSpace(iccid) + if iccid == "" { + continue + } + iccids = append(iccids, iccid) + } + if len(iccids) == 0 { + return nil, gerror.New("iccid不能为空") + } + if len(iccids) > 100 { + return nil, gerror.New("iccid数量不能超过100个") + } + + entity := []entity.TSimCardInfo{} + if err := service.IotTSimCardInfo(). + Model(ctx). + WhereIn(dao.TSimCardInfo.Columns().Iccid, iccids). + Scan(&entity); err != nil { + return nil, gerror.New("查询sim卡信息失败") + } + if len(entity) == 0 { + return nil, gerror.New("sim卡不存在") + } + + output = make([]model.QueryCardInfoListOutput, 0, len(entity)) + for _, item := range entity { + output = append(output, model.QueryCardInfoListOutput{ + Iccid: item.Iccid, + ActivateDate: oldApiDate(item.BossActivateAt, item.BossOpenAt, item.FlowPkgBeginAt), + DueExpireTime: oldApiEndOfDayString(item.FlowPkgEndAt), + Imei: item.Imei, + Imsi: item.Imsi, + Msisdn: item.Msisdn, + Type: model.SimCardNameMap[item.CardType], + Remarks: item.Remark, + Status: s.StatusConversion(item), + }) + } + return output, nil +} diff --git a/internal/logic/openapiiot/card_info.go b/internal/logic/openapiiot/card_info.go new file mode 100644 index 0000000..6952f3a --- /dev/null +++ b/internal/logic/openapiiot/card_info.go @@ -0,0 +1,27 @@ +package openapiiot + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/handler" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + + "github.com/gogf/gf/v2/database/gdb" +) + +type sSimCardInfo struct{} + +func init() { + service.RegisterIotTSimCardInfo(&sSimCardInfo{}) +} + +func (s *sSimCardInfo) Model(ctx context.Context, option ...*handler.Option) *gdb.Model { + if len(option) == 0 { + option = append(option, &handler.Option{ + FilterAuth: true, + FilterTenant: true, + }) + } + return handler.Model(dao.TSimCardInfo.Ctx(ctx), option...) +} diff --git a/internal/logic/query/batch_imei_test.go b/internal/logic/query/batch_imei_test.go new file mode 100644 index 0000000..3855af7 --- /dev/null +++ b/internal/logic/query/batch_imei_test.go @@ -0,0 +1,298 @@ +package query + +import ( + "context" + "encoding/json" + "testing" + + _ "github.com/gogf/gf/contrib/drivers/sqlite/v2" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + + "github.com/gogf/gf/v2/util/gconv" + + // 触发 service.RegisterIotTSimCardInfo,否则 loadSimBatchCards 会 panic + _ "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/logic/openapiiot" +) + +// setupImeiBatchDB 建一张最小可用的卡表并灌入覆盖各分支的样本数据。 +// +// 样本设计(对齐 §7 测试场景): +// +// CARD-A 有 imei → 正常命中 +// CARD-B imei 为空 → 卡存在但上游未上报值 +// CARD-C 有 imei → 正常命中(入库带的值) +// CARD-D 属于另一个部门 → 数据权限过滤后视为 notFound +func setupImeiBatchDB(t *testing.T, ctx context.Context) { + t.Helper() + if err := gdb.SetConfig(gdb.Config{"default": gdb.ConfigGroup{{Type: "sqlite", Link: "sqlite::@file(:memory:)", MaxOpenConnCount: 1}}}); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = g.DB().Close(ctx) }) + if err := g.DB().GetCore().ClearTableFieldsAll(ctx); err != nil { + t.Fatal(err) + } + statements := []string{ + `CREATE TABLE t_sim_card_info ( + id INTEGER PRIMARY KEY, + iccid TEXT, msisdn TEXT, imsi TEXT, imei TEXT, + boss_card_status INTEGER, used_flow_mb REAL, + imei_sync_time DATETIME, imei_update_time DATETIME, + dept_id INTEGER, tenant_id TEXT + )`, + // FilterAuth 的 GetDeptAndSub 会查 sys_dept(本部门及以下数据权限) + `CREATE TABLE sys_dept (dept_id INTEGER PRIMARY KEY, ancestors TEXT)`, + `INSERT INTO t_sim_card_info + (id, iccid, msisdn, imsi, imei, boss_card_status, used_flow_mb, imei_sync_time, imei_update_time, dept_id, tenant_id) + VALUES + (1,'CARD-A','13800000001','460000000000001','865466070817587',2,10.5,'2026-10-12 04:31:07','2026-10-12 04:31:07',7,'A'), + (2,'CARD-B','13800000002','460000000000002','', 2,20.0,'2026-10-12 04:31:09',NULL, 7,'A'), + (3,'CARD-C','13800000003','460000000000003','123456789012345',2,30.0,NULL, '2026-09-01 08:00:00',7,'A'), + (4,'CARD-D','13800000004','460000000000004','999888777666555',2,40.0,'2026-10-12 04:31:11','2026-10-12 04:31:11',8,'A')`, + } + for _, statement := range statements { + if _, err := g.DB().Exec(ctx, statement); err != nil { + t.Fatal(err) + } + } +} + +// apiDataScopeRoleId 对齐 middleware.go:28 的 apiDataScopeRoleId(包私有,此处复刻值)。 +const apiDataScopeRoleId int64 = 17 + +// imeiBatchCtx 复现 ApiCtx 中间件注入的身份:API 客户固定 RoleId=17 + +// SysRoleDataScopeDeptAndBelow(对齐 middleware.go:99),使数据权限过滤真实生效。 +func imeiBatchCtx() context.Context { + ctx := contexts.Set(context.Background(), &model.Context{ + User: &model.Identity{ + BaseClaims: model.BaseClaims{ + ID: 0, + TenantId: "A", + DeptId: 7, + Roles: []model.Role{ + {RoleId: apiDataScopeRoleId, DataScope: consts.SysRoleDataScopeDeptAndBelow}, + }, + }, + }, + AgentUser: &model.BaseClaimsApi{DeptId: 7, TenantId: "A"}, + }) + contexts.SetDataValue(ctx, "currentRoleId", gconv.String(apiDataScopeRoleId)) + contexts.SetDataValue(ctx, "currentRoleDataScope", consts.SysRoleDataScopeDeptAndBelow) + return ctx +} + +// TestQuerySimImeiBatchSemantics 覆盖 §7 T11/T12/T16 的核心语义: +// - 有值的卡返回 imei +// - imei 为空但卡存在 → matched=true 且 imei="",不算 notFound(T16) +// - 不存在的卡 → matched=false + CARD_NOT_FOUND(T12) +// - 跨部门的卡 → 数据权限过滤后视为 notFound(T13) +func TestQuerySimImeiBatchSemantics(t *testing.T) { + ctx := imeiBatchCtx() + setupImeiBatchDB(t, ctx) + + output, err := NewQuerySim().QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{ + {Iccid: "CARD-A"}, + {Iccid: "CARD-B"}, + {Iccid: "CARD-C"}, + {Iccid: "CARD-D"}, + {Iccid: "CARD-MISSING"}, + }, + }) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if output.Total != 5 { + t.Fatalf("total = %d, want 5", output.Total) + } + // A/B/C 命中,D(跨部门)与 MISSING 未命中 + if output.MatchedCount != 3 || output.NotFoundCount != 2 { + t.Fatalf("matched=%d notFound=%d, want 3/2", output.MatchedCount, output.NotFoundCount) + } + if len(output.Items) != 5 { + t.Fatalf("items = %d, want 5 (按输入顺序逐卡返回)", len(output.Items)) + } + + // 顺序必须与输入一致(契约:按输入顺序逐卡返回)。 + // 注意:未命中的 item 不返回 iccid(omitempty),所以必须用下标访问, + // 不能用 iccid 建索引,否则未命中项会取到零值。 + ordered := []string{"CARD-A", "CARD-B", "CARD-C", "CARD-D", "CARD-MISSING"} + for i, wantIccid := range ordered { + if i == 3 || i == 4 { + continue // D 与 MISSING 未命中,不返回 iccid + } + if output.Items[i].Iccid != wantIccid { + t.Fatalf("items[%d].iccid = %q, want %q(必须保持输入顺序)", i, output.Items[i].Iccid, wantIccid) + } + } + a, b, c := output.Items[0], output.Items[1], output.Items[2] + d, missing := output.Items[3], output.Items[4] + if !a.Matched || a.Imei != "865466070817587" { + t.Fatalf("CARD-A: %+v", a) + } + + // CARD-B:imei 为空但 matched=true(关键语义,不算 notFound) + if !b.Matched { + t.Fatalf("CARD-B 应为 matched=true(卡存在,只是上游没给值): %+v", b) + } + if b.Imei != "" { + t.Fatalf("CARD-B imei 应为空串: %q", b.Imei) + } + + // CARD-C:入库就带值 + if !c.Matched || c.Imei != "123456789012345" { + t.Fatalf("CARD-C: %+v", c) + } + + // CARD-D / MISSING:未命中,且不泄露 imei + for _, tc := range []struct { + name string + item model.QuerySimImeiBatchItem + }{{"CARD-D(跳部门)", d}, {"CARD-MISSING(不存在)", missing}} { + item := tc.item + if item.Matched { + t.Fatalf("%s 不应命中: %+v", tc.name, item) + } + if item.ErrorCode != "CARD_NOT_FOUND" { + t.Fatalf("%s errorCode = %q, want CARD_NOT_FOUND", tc.name, item.ErrorCode) + } + if item.Imei != "" { + t.Fatalf("%s 未命中时不应返回 imei: %q", tc.name, item.Imei) + } + } +} + +// TestQuerySimImeiBatchValidation 覆盖 §7 T14/T15 的参数校验。 +func TestQuerySimImeiBatchValidation(t *testing.T) { + ctx := imeiBatchCtx() + setupImeiBatchDB(t, ctx) + svc := NewQuerySim() + + cases := []struct { + name string + in *model.QuerySimImeiBatchParam + }{ + {"nil 参数", nil}, + {"appId 为空", &model.QuerySimImeiBatchParam{Cards: []model.QuerySimBatchCard{{Iccid: "CARD-A"}}}}, + {"cards 为空", &model.QuerySimImeiBatchParam{AppId: "app"}}, + } + for _, tc := range cases { + if _, err := svc.QuerySimImeiBatch(ctx, tc.in); err == nil { + t.Fatalf("%s: 应返回错误", tc.name) + } + } + + // 超过 1000 张(T14) + tooMany := make([]model.QuerySimBatchCard, 0, querySimBatchMaxCards+1) + for i := 0; i <= querySimBatchMaxCards; i++ { + tooMany = append(tooMany, model.QuerySimBatchCard{Iccid: "CARD-" + string(rune('0'+i%10)) + string(rune('0'+i/10%10)) + string(rune('0'+i/100%10)) + string(rune('0'+i/1000%10))}) + } + if _, err := svc.QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{AppId: "app", Cards: tooMany}); err == nil { + t.Fatal("超过 1000 张应被拒绝") + } + + // 重复标识(parseSimBatchIdentifiers 既有逻辑) + if _, err := svc.QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{{Iccid: "CARD-A"}, {Iccid: "CARD-A"}}, + }); err == nil { + t.Fatal("重复标识应被拒绝") + } + + // 单标识超长(simBatchIdentifierMaxLen) + longIccid := make([]byte, simBatchIdentifierMaxLen+1) + for i := range longIccid { + longIccid[i] = '9' + } + if _, err := svc.QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{{Iccid: string(longIccid)}}, + }); err == nil { + t.Fatal("超长标识应被拒绝") + } + + // 多标识互相矛盾:ICCID 属于 CARD-A 但 MSISDN 属于 CARD-B(既有校验逻辑) + if _, err := svc.QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{{Iccid: "CARD-A", Msisdn: "13800000002"}}, + }); err != nil { + t.Fatalf("多标识查询本身应合法: %v", err) + } + // 矛盾组合应返回 notFound 而非错误(simBatchCardMatchesIdentifier 拦下) + conflict, err := svc.QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{{Iccid: "CARD-A", Msisdn: "13800000002"}}, + }) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if conflict.NotFoundCount != 1 || conflict.Items[0].Matched { + t.Fatalf("矛盾的 iccid+msisdn 组合应判为 notFound: %+v", conflict.Items[0]) + } +} + +// TestQuerySimImeiBatchByMsisdnAndImsi 验证三种标识都能定位到卡。 +func TestQuerySimImeiBatchByMsisdnAndImsi(t *testing.T) { + ctx := imeiBatchCtx() + setupImeiBatchDB(t, ctx) + + output, err := NewQuerySim().QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{ + {Msisdn: "13800000001"}, + {Imsi: "460000000000003"}, + }, + }) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if output.MatchedCount != 2 { + t.Fatalf("matched = %d, want 2", output.MatchedCount) + } + for _, item := range output.Items { + if !item.Matched || item.Iccid == "" { + t.Fatalf("应通过 msisdn/imsi 定位到卡并回填 iccid: %+v", item) + } + } +} + +// TestQuerySimImeiBatchItemJSONShape 锁死对外字段集:只允许 +// matched / iccid / imei / errorCode / errorMessage,任何额外字段(例如 +// imeiSyncTime、imeiUpdateTime)都会让该用例失败,避免内部字段泄露给客户。 +func TestQuerySimImeiBatchItemJSONShape(t *testing.T) { + ctx := imeiBatchCtx() + setupImeiBatchDB(t, ctx) + + output, err := NewQuerySim().QuerySimImeiBatch(ctx, &model.QuerySimImeiBatchParam{ + AppId: "app", + Cards: []model.QuerySimBatchCard{{Iccid: "CARD-A"}, {Iccid: "CARD-MISSING"}}, + }) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + allowed := map[string]bool{ + "matched": true, "iccid": true, "imei": true, + "errorCode": true, "errorMessage": true, + } + for i, item := range output.Items { + raw, marshalErr := json.Marshal(item) + if marshalErr != nil { + t.Fatalf("items[%d] 序列化失败: %v", i, marshalErr) + } + var fields map[string]any + if err := json.Unmarshal(raw, &fields); err != nil { + t.Fatalf("items[%d] 反序列化失败: %v", i, err) + } + for name := range fields { + if !allowed[name] { + t.Fatalf("items[%d] 出现非预期对外字段 %q: %s", i, name, raw) + } + } + } +} diff --git a/internal/logic/query/batch_query.go b/internal/logic/query/batch_query.go new file mode 100644 index 0000000..7b42048 --- /dev/null +++ b/internal/logic/query/batch_query.go @@ -0,0 +1,312 @@ +package query + +import ( + "context" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" +) + +// querySimBatchMaxCards 批量查询单次的卡数量上限(与 QueryTrafficCutoffConfig 同量级)。 +// 纯本地库读、不调上游,故偏保守;如需更大块,改这一个常量即可(注意 IN 列表与报文大小)。 +const querySimBatchMaxCards = 1000 + +// simBatchIdentifierMaxLen 单标识允许的最大字符数,对齐 t_sim_card_info 列宽(varchar(32))并留余量, +// 用于把请求体内存占用钉死在可控范围(1000 张 * 3 字段 * 64 ≈ 192KB),防止超长字符串滥用。 +const simBatchIdentifierMaxLen = 64 + +type simBatchIdentifier struct { + Msisdn string + Iccid string + Imsi string +} + +func validateSimBatchIdentifier(item simBatchIdentifier) error { + count := 0 + if item.Msisdn != "" { + if len(item.Msisdn) > simBatchIdentifierMaxLen { + return gerror.New("msisdn长度超限") + } + count++ + } + if item.Iccid != "" { + if len(item.Iccid) > simBatchIdentifierMaxLen { + return gerror.New("iccid长度超限") + } + count++ + } + if item.Imsi != "" { + if len(item.Imsi) > simBatchIdentifierMaxLen { + return gerror.New("imsi长度超限") + } + count++ + } + if count == 0 { + return gerror.New("msisdn、iccid、imsi至少传一个") + } + return nil +} + +// simBatchCardMatchesIdentifier 校验返回的卡是否同时匹配输入里提供的所有标识。 +// 防止单条输入同时填了多个互相矛盾的标识(如 iccid 属于 A、msisdn 属于 B)时, +// 仍返回优先级最高那个标识对应卡的数据。沿用 traffic_cutoff_config.go 的同名校验逻辑。 +func simBatchCardMatchesIdentifier(card *entity.TSimCardInfo, identifier simBatchIdentifier) bool { + if card == nil { + return false + } + if identifier.Iccid != "" && strings.TrimSpace(card.Iccid) != identifier.Iccid { + return false + } + if identifier.Msisdn != "" && strings.TrimSpace(card.Msisdn) != identifier.Msisdn { + return false + } + if identifier.Imsi != "" && strings.TrimSpace(card.Imsi) != identifier.Imsi { + return false + } + return true +} + +func simBatchIdentifierKey(item simBatchIdentifier) string { + if item.Iccid != "" { + return "iccid:" + item.Iccid + } + if item.Msisdn != "" { + return "msisdn:" + item.Msisdn + } + return "imsi:" + item.Imsi +} + +// parseSimBatchIdentifiers 校验并去重,返回按 iccid/msisdn/imsi 分桶的标识列表。 +func parseSimBatchIdentifiers(cards []model.QuerySimBatchCard) ([]simBatchIdentifier, error) { + identifiers := make([]simBatchIdentifier, 0, len(cards)) + seen := make(map[string]struct{}, len(cards)) + for _, item := range cards { + identifier := simBatchIdentifier{ + Msisdn: strings.TrimSpace(item.Msisdn), + Iccid: strings.TrimSpace(item.Iccid), + Imsi: strings.TrimSpace(item.Imsi), + } + if err := validateSimBatchIdentifier(identifier); err != nil { + return nil, err + } + key := simBatchIdentifierKey(identifier) + if _, ok := seen[key]; ok { + return nil, gerror.Newf("卡片标识重复:%s", key) + } + seen[key] = struct{}{} + identifiers = append(identifiers, identifier) + } + return identifiers, nil +} + +// loadSimBatchCards 按标识分桶做 WhereIn 查询(自动带部门数据权限),返回 type:key -> 卡 的映射。 +func loadSimBatchCards(ctx context.Context, identifiers []simBatchIdentifier) (map[string]*entity.TSimCardInfo, error) { + columns := dao.TSimCardInfo.Columns() + result := make(map[string]*entity.TSimCardInfo, len(identifiers)) + lookup := func(field string, values []string) error { + if len(values) == 0 { + return nil + } + var cards []*entity.TSimCardInfo + err := service.IotTSimCardInfo().Model(ctx). + Fields(columns.Iccid, columns.Msisdn, columns.Imsi, columns.BossCardStatus, columns.UsedFlowMb, + columns.Imei). + WhereIn(field, values).Scan(&cards) + if err != nil { + return gerror.Wrap(err, "批量查询卡信息失败") + } + for _, card := range cards { + if card == nil { + continue + } + if card.Iccid != "" { + result["iccid:"+strings.TrimSpace(card.Iccid)] = card + } + if card.Msisdn != "" { + result["msisdn:"+strings.TrimSpace(card.Msisdn)] = card + } + if card.Imsi != "" { + result["imsi:"+strings.TrimSpace(card.Imsi)] = card + } + } + return nil + } + iccidValues, msisdnValues, imsiValues := make([]string, 0), make([]string, 0), make([]string, 0) + for _, item := range identifiers { + switch { + case item.Iccid != "": + iccidValues = append(iccidValues, item.Iccid) + case item.Msisdn != "": + msisdnValues = append(msisdnValues, item.Msisdn) + default: + imsiValues = append(imsiValues, item.Imsi) + } + } + if err := lookup(columns.Iccid, iccidValues); err != nil { + return nil, err + } + if err := lookup(columns.Msisdn, msisdnValues); err != nil { + return nil, err + } + if err := lookup(columns.Imsi, imsiValues); err != nil { + return nil, err + } + return result, nil +} + +// QuerySimStatusBatch 批量查询卡状态(纯读本地库,不调上游通道)。 +// 返回结构与单卡 QuerySimStatus 一致(iccid / lifeCycle 内部码 / lifeCycleName), +// 但按输入顺序逐卡返回,未匹配项用 Matched=false + errorCode 标记。 +func (s *sQuerySim) QuerySimStatusBatch(ctx context.Context, in *model.QuerySimStatusBatchParam) (*model.QuerySimStatusBatchOutput, error) { + if in == nil { + return nil, gerror.New("查询参数不能为空") + } + if strings.TrimSpace(in.AppId) == "" { + return nil, gerror.New("appId不能为空") + } + if len(in.Cards) == 0 { + return nil, gerror.New("查询卡不能为空") + } + if len(in.Cards) > querySimBatchMaxCards { + return nil, gerror.Newf("单次最多查询%d张卡", querySimBatchMaxCards) + } + identifiers, err := parseSimBatchIdentifiers(in.Cards) + if err != nil { + return nil, err + } + cardMap, err := loadSimBatchCards(ctx, identifiers) + if err != nil { + return nil, err + } + output := &model.QuerySimStatusBatchOutput{ + Total: len(identifiers), + Items: make([]model.QuerySimStatusBatchItem, 0, len(identifiers)), + } + for _, identifier := range identifiers { + result := model.QuerySimStatusBatchItem{} + card := cardMap[simBatchIdentifierKey(identifier)] + if card == nil || !simBatchCardMatchesIdentifier(card, identifier) { + result.ErrorCode = "CARD_NOT_FOUND" + result.ErrorMessage = "卡片不存在或无权限" + output.NotFoundCount++ + output.Items = append(output.Items, result) + continue + } + result.Matched = true + result.Iccid = strings.TrimSpace(card.Iccid) + statusName, ok := consts.V3ApiSimBossCardStatusNameMap[card.BossCardStatus] + if !ok { + statusName = "未知" + } + result.LifeCycle = card.BossCardStatus + result.LifeCycleName = statusName + output.MatchedCount++ + output.Items = append(output.Items, result) + } + return output, nil +} + +// QuerySimUsageBatch 批量查询卡流量(used_flow_mb,纯读本地库)。 +func (s *sQuerySim) QuerySimUsageBatch(ctx context.Context, in *model.QuerySimUsageBatchParam) (*model.QuerySimUsageBatchOutput, error) { + if in == nil { + return nil, gerror.New("查询参数不能为空") + } + if strings.TrimSpace(in.AppId) == "" { + return nil, gerror.New("appId不能为空") + } + if len(in.Cards) == 0 { + return nil, gerror.New("查询卡不能为空") + } + if len(in.Cards) > querySimBatchMaxCards { + return nil, gerror.Newf("单次最多查询%d张卡", querySimBatchMaxCards) + } + identifiers, err := parseSimBatchIdentifiers(in.Cards) + if err != nil { + return nil, err + } + cardMap, err := loadSimBatchCards(ctx, identifiers) + if err != nil { + return nil, err + } + output := &model.QuerySimUsageBatchOutput{ + Total: len(identifiers), + Items: make([]model.QuerySimUsageBatchItem, 0, len(identifiers)), + } + for _, identifier := range identifiers { + result := model.QuerySimUsageBatchItem{} + card := cardMap[simBatchIdentifierKey(identifier)] + if card == nil || !simBatchCardMatchesIdentifier(card, identifier) { + result.ErrorCode = "CARD_NOT_FOUND" + result.ErrorMessage = "卡片不存在或无权限" + output.NotFoundCount++ + output.Items = append(output.Items, result) + continue + } + result.Matched = true + result.Iccid = strings.TrimSpace(card.Iccid) + result.UseUnit = "MB" + result.UseAmount = card.UsedFlowMb + output.MatchedCount++ + output.Items = append(output.Items, result) + } + return output, nil +} + +// QuerySimImeiBatch 批量查询卡 IMEI(纯读本地库,不调上游通道)。 +// +// 数据来源是 t_sim_card_info.imei 快照,由 worker 的 IMEI 全量同步链路维护; +// 另有一个补充来源:单卡 /openapi/v3/query/sim-imei 在库值为空时会实时调运营商 +// 并回写(不写 imei_sync_time,只写 imei_update_time)。 +// +// 语义要点: +// - imei 为空**不算 notFound**:卡存在但上游从未查到值(如不支持的模板通道)。 +// - 本接口**不触发任何上游请求**,是纯本地库读(与 sim-status-batch 一致)。 +func (s *sQuerySim) QuerySimImeiBatch(ctx context.Context, in *model.QuerySimImeiBatchParam) (*model.QuerySimImeiBatchOutput, error) { + if in == nil { + return nil, gerror.New("查询参数不能为空") + } + if strings.TrimSpace(in.AppId) == "" { + return nil, gerror.New("appId不能为空") + } + if len(in.Cards) == 0 { + return nil, gerror.New("查询卡不能为空") + } + if len(in.Cards) > querySimBatchMaxCards { + return nil, gerror.Newf("单次最多查询%d张卡", querySimBatchMaxCards) + } + identifiers, err := parseSimBatchIdentifiers(in.Cards) + if err != nil { + return nil, err + } + cardMap, err := loadSimBatchCards(ctx, identifiers) + if err != nil { + return nil, err + } + output := &model.QuerySimImeiBatchOutput{ + Total: len(identifiers), + Items: make([]model.QuerySimImeiBatchItem, 0, len(identifiers)), + } + for _, identifier := range identifiers { + result := model.QuerySimImeiBatchItem{} + card := cardMap[simBatchIdentifierKey(identifier)] + if card == nil || !simBatchCardMatchesIdentifier(card, identifier) { + result.ErrorCode = "CARD_NOT_FOUND" + result.ErrorMessage = "卡片不存在或无权限" + output.NotFoundCount++ + output.Items = append(output.Items, result) + continue + } + result.Matched = true + result.Iccid = strings.TrimSpace(card.Iccid) + result.Imei = strings.TrimSpace(card.Imei) + output.MatchedCount++ + output.Items = append(output.Items, result) + } + return output, nil +} diff --git a/internal/logic/query/batch_status.go b/internal/logic/query/batch_status.go new file mode 100644 index 0000000..a62e0f0 --- /dev/null +++ b/internal/logic/query/batch_status.go @@ -0,0 +1,74 @@ +package query + +import ( + "context" + "fmt" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +type batchStatusRecord struct { + Id int64 `orm:"id"` + BatchNo string `orm:"batch_no"` + BatchAsyncStatus int `orm:"batch_async_status"` + SourceChannel string `orm:"source_channel"` + ExecutionMode int `orm:"execution_mode"` + SourceType int `orm:"source_type"` + TotalCount int `orm:"total_count"` + ValidCount int `orm:"valid_count"` + SuccessCount int `orm:"success_count"` + FailCount int `orm:"fail_count"` + RunResult int `orm:"run_result"` + FailReason string `orm:"fail_reason"` +} + +func (s *sQuerySim) QueryBatchStatus(ctx context.Context, in *model.QueryBatchStatusParam) (*model.QueryBatchStatusOutput, error) { + if in == nil { + return nil, gerror.New("查询参数不能为空") + } + if strings.TrimSpace(in.AppId) == "" { + return nil, gerror.New("appId不能为空") + } + batchNo := strings.TrimSpace(in.BatchNo) + if batchNo == "" { + return nil, gerror.New("batchNo不能为空") + } + tenantID := strings.TrimSpace(contexts.GetTenantId(ctx)) + deptID := contexts.GetAgentDeptId(ctx) + if tenantID == "" || deptID <= 0 { + return nil, gerror.New("当前接口调用方信息不完整") + } + columns := dao.BatchMain.Columns() + var batch batchStatusRecord + err := dao.BatchMain.Ctx(ctx). + Where(columns.TenantId, tenantID). + Where(columns.DeptId, deptID). + Where(columns.BatchNo, batchNo). + Where(fmt.Sprintf("NOT (%s = ? AND COALESCE(%s, '') <> '' AND %s <> %s)", columns.BatchType, columns.SourceBatchNo, columns.SourceBatchNo, columns.BatchNo), consts.BatchTypeAllocate). + Scan(&batch) + if err != nil { + return nil, gerror.Wrap(err, "查询批次状态失败") + } + if batch.Id == 0 { + return nil, gerror.New("批次不存在或无权限") + } + return &model.QueryBatchStatusOutput{ + BatchNo: batch.BatchNo, + BatchAsyncStatus: batch.BatchAsyncStatus, + SourceChannel: batch.SourceChannel, + ExecutionMode: batch.ExecutionMode, + SourceType: batch.SourceType, + TotalCount: batch.TotalCount, + ValidCount: batch.ValidCount, + SuccessCount: batch.SuccessCount, + FailCount: batch.FailCount, + RunResult: batch.RunResult, + FailReason: batch.FailReason, + }, nil +} diff --git a/internal/logic/query/batch_status_test.go b/internal/logic/query/batch_status_test.go new file mode 100644 index 0000000..d5eac0e --- /dev/null +++ b/internal/logic/query/batch_status_test.go @@ -0,0 +1,47 @@ +package query + +import ( + "context" + "testing" + + _ "github.com/gogf/gf/contrib/drivers/sqlite/v2" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +func TestBatchStatusScopeAndAllocationChildren(t *testing.T) { + ctx := context.Background() + if err := gdb.SetConfig(gdb.Config{"default": gdb.ConfigGroup{{Type: "sqlite", Link: "sqlite::@file(:memory:)", MaxOpenConnCount: 1}}}); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = g.DB().Close(ctx) }) + if err := g.DB().GetCore().ClearTableFieldsAll(ctx); err != nil { + t.Fatal(err) + } + for _, statement := range []string{ + "CREATE TABLE batch_main (id INTEGER PRIMARY KEY, batch_no TEXT, batch_type INTEGER, source_batch_no TEXT, tenant_id TEXT, dept_id INTEGER, batch_async_status INTEGER, source_channel TEXT, execution_mode INTEGER, source_type INTEGER, total_count INTEGER, valid_count INTEGER, success_count INTEGER, fail_count INTEGER, run_result INTEGER, fail_reason TEXT)", + "INSERT INTO batch_main VALUES (1,'mine',101,'mine','A',7,3,'api',1,2,1,1,1,0,2,''),(2,'other-tenant',101,'','B',7,3,'api',1,2,1,1,1,0,2,''),(3,'other-dept',101,'','A',8,3,'api',1,2,1,1,1,0,2,''),(4,'parent',3,'','A',7,2,'api',2,2,2,2,1,0,1,''),(5,'child',3,'parent','A',7,2,'api',2,2,1,1,0,0,1,''),(6,'self',3,'self','A',7,3,'api',2,2,1,1,1,0,2,'')", + } { + if _, err := g.DB().Exec(ctx, statement); err != nil { + t.Fatal(err) + } + } + ctx = contexts.Set(ctx, &model.Context{ + User: &model.Identity{BaseClaims: model.BaseClaims{TenantId: "A"}}, + AgentUser: &model.BaseClaimsApi{DeptId: 7, TenantId: "A"}, + }) + for _, batchNo := range []string{"mine", "parent", "self"} { + result, err := NewQuerySim().QueryBatchStatus(ctx, &model.QueryBatchStatusParam{AppId: "app", BatchNo: batchNo}) + if err != nil || result == nil || result.BatchNo != batchNo || result.SourceChannel != "api" { + t.Fatalf("batch %s: result=%+v err=%v", batchNo, result, err) + } + } + for _, batchNo := range []string{"other-tenant", "other-dept", "child", "missing"} { + if _, err := NewQuerySim().QueryBatchStatus(ctx, &model.QueryBatchStatusParam{AppId: "app", BatchNo: batchNo}); err == nil { + t.Fatalf("batch exposed: %s", batchNo) + } + } +} diff --git a/internal/logic/query/sim.go b/internal/logic/query/sim.go new file mode 100644 index 0000000..f86ff5a --- /dev/null +++ b/internal/logic/query/sim.go @@ -0,0 +1,426 @@ +package query + +import ( + "context" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + "math" + "strings" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +type sQuerySim struct { +} + +func NewQuerySim() *sQuerySim { + return &sQuerySim{} +} + +func init() { + service.RegisterQuerySim(NewQuerySim()) +} + +func (s *sQuerySim) querySim(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimInfoCard, err error) { + if input.Iccid == "" && input.Msisdn == "" && input.Imsi == "" { + g.Log().Debugf(ctx, "QuerySim.QuerySimCard, Iccid, Msisdn, Imsi are all empty, input: %v", input) + return nil, gerror.New("Iccid, Msisdn, Imsi 不能全为空") + } + field := "" + value := "" + if input.Iccid != "" { + field = dao.TSimCardInfo.Columns().Iccid + value = input.Iccid + } else if input.Msisdn != "" { + field = dao.TSimCardInfo.Columns().Msisdn + value = input.Msisdn + } else if input.Imsi != "" { + field = dao.TSimCardInfo.Columns().Imsi + value = input.Imsi + } + + cardInfoTable := dao.TSimCardInfo.Table() + sysDept := dao.SysDept.Table() + flowPackage := dao.TSimFlowPackageInfo.Table() + packageCategory := dao.TSimPackageCategory.Table() + + err = service.IotTSimCardInfo(). + Model(ctx). + Where(field, value). + LeftJoin(sysDept, sysDept+"."+dao.SysDept.Columns().DeptId+"="+cardInfoTable+"."+dao.TSimCardInfo.Columns().DeptId). + LeftJoin(flowPackage, flowPackage+"."+dao.TSimFlowPackageInfo.Columns().PackageCode+"="+cardInfoTable+"."+dao.TSimCardInfo.Columns().CurrentPackageCode). + LeftJoin(packageCategory, packageCategory+"."+dao.TSimPackageCategory.Columns().CategoryCode+"="+flowPackage+"."+dao.TSimFlowPackageInfo.Columns().CategoryCode). + Fields( + cardInfoTable+".*", + sysDept+"."+dao.SysDept.Columns().DeptName+" as DeptName", + sysDept+"."+dao.SysDept.Columns().DeptKey+" as DeptKey", + sysDept+"."+dao.SysDept.Columns().AreaCode+" as DeptAreaCode", + flowPackage+"."+dao.TSimFlowPackageInfo.Columns().PackageName+" as PackageName", + flowPackage+"."+dao.TSimFlowPackageInfo.Columns().CategoryCode+" as CategoryCode", + packageCategory+"."+dao.TSimPackageCategory.Columns().CategoryName+" as CategoryName", + ). + Limit(1). + Scan(&output) + if err != nil { + g.Log().Debugf(ctx, "QuerySim.QuerySimCard, List sim card info failed, input: %v, err: %v", input, err) + return nil, gerror.New("查询sim卡信息失败,请确认ICCID,MSISDN,IMSI是否正确") + } + if output == nil { + return nil, gerror.New("查询sim卡信息失败,请确认ICCID,MSISDN,IMSI是否正确") + } + return output, nil +} + +func queryDate(t *gtime.Time) string { + if t == nil || t.IsZero() { + return "" + } + return t.Format("Y-m-d") +} + +func queryDateTime(t *gtime.Time) string { + if t == nil || t.IsZero() { + return "" + } + return t.Format("Y-m-d H:i:s") +} + +func queryRemaining(total, used float64) string { + remaining := total - used + if remaining < 0 { + remaining = 0 + } + return fmt.Sprintf("%.1f", remaining) +} + +func queryRemainingInt(total, used int) string { + remaining := total - used + if remaining < 0 { + remaining = 0 + } + return fmt.Sprintf("%d", remaining) +} + +func queryValidityPeriod(begin, end *gtime.Time) int { + if begin == nil || begin.IsZero() || end == nil || end.IsZero() { + return 0 + } + beginTime := begin.Time + endTime := end.Time + months := (endTime.Year()-beginTime.Year())*12 + int(endTime.Month()-beginTime.Month()) + if endTime.Day() >= beginTime.Day()-1 { + months++ + } + if months < 0 { + return 0 + } + return months +} + +func possibleRegionCodes(regionCode string) []string { + seen := map[string]struct{}{} + codes := make([]string, 0, 4) + add := func(code string) { + if code == "" { + return + } + if _, ok := seen[code]; ok { + return + } + seen[code] = struct{}{} + codes = append(codes, code) + } + + add(regionCode) + if len(regionCode) == 12 { + if regionCode[0:2] != "00" { + add(regionCode[0:2] + "0000000000") + } + if regionCode[2:4] != "00" { + add(regionCode[0:4] + "00000000") + } + if regionCode[4:6] != "00" { + add(regionCode[0:6] + "000000") + } + } else { + if len(regionCode) >= 4 { + add(regionCode[:2] + "0000") + } + if len(regionCode) >= 6 { + add(regionCode[:4] + "00") + } + } + return codes +} + +func (s *sQuerySim) queryLocation(ctx context.Context, regionCode string) string { + regionCode = strings.TrimSpace(regionCode) + if regionCode == "" { + return "" + } + + type division struct { + RegionCode string `json:"regionCode"` + RegionName string `json:"regionName"` + RegionParent string `json:"regionParent"` + } + + var divisions []*division + err := dao.TDivisionCode.Ctx(ctx). + WhereIn(dao.TDivisionCode.Columns().RegionCode, possibleRegionCodes(regionCode)). + Scan(&divisions) + if err != nil || len(divisions) == 0 { + return regionCode + } + + byCode := make(map[string]*division, len(divisions)) + for _, item := range divisions { + byCode[item.RegionCode] = item + } + item := byCode[regionCode] + if item == nil { + return regionCode + } + + names := make([]string, 0, 4) + for item != nil { + if item.RegionName != "" { + names = append([]string{item.RegionName}, names...) + } + if item.RegionParent == "" || item.RegionParent == "0" { + break + } + item = byCode[item.RegionParent] + } + if len(names) == 0 { + return regionCode + } + if names[0] != "中国" { + names = append([]string{"中国"}, names...) + } + return strings.Join(names, "/") +} + +func (s *sQuerySim) queryLocationByAreaCode(ctx context.Context, areaCode string) string { + areaCode = strings.TrimSpace(areaCode) + if areaCode == "" { + return "" + } + + type division struct { + RegionCode string `json:"regionCode"` + RegionName string `json:"regionName"` + RegionParent string `json:"regionParent"` + } + + byCode := make(map[string]*division) + currentCode := "" + for _, code := range possibleRegionCodes(areaCode) { + var item *division + err := dao.TDivisionCode.Ctx(ctx). + Where(dao.TDivisionCode.Columns().RegionCode, code). + Scan(&item) + if err != nil { + return areaCode + } + if item == nil { + continue + } + byCode[item.RegionCode] = item + currentCode = item.RegionCode + break + } + if currentCode == "" { + return areaCode + } + + names := make([]string, 0, 4) + for currentCode != "" { + item := byCode[currentCode] + if item == nil { + err := dao.TDivisionCode.Ctx(ctx). + Where(dao.TDivisionCode.Columns().RegionCode, currentCode). + Scan(&item) + if err != nil { + return areaCode + } + if item == nil { + break + } + byCode[item.RegionCode] = item + } + if item.RegionName != "" { + names = append([]string{item.RegionName}, names...) + } + if item.RegionParent == "" || item.RegionParent == "0" { + break + } + currentCode = item.RegionParent + } + if len(names) == 0 { + return areaCode + } + if names[0] != "中国" { + names = append([]string{"中国"}, names...) + } + return strings.Join(names, "/") +} + +func (s *sQuerySim) QuerySimInfo(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimInfoOutput, err error) { + g.Log().Error(ctx, input) + simCard, err := s.querySim(ctx, input) + if err != nil { + return nil, err + } + + output = &model.QuerySimInfoOutput{ + Iccid: simCard.Iccid, + Msisdn: simCard.Msisdn, + Imsi: simCard.Imsi, + Imei: simCard.Imei, + Username: simCard.DeptName, + Location: s.queryLocationByAreaCode(ctx, simCard.DeptAreaCode), + PlanCategory: simCard.CategoryName, + CurrentPlanName: simCard.PackageName, + Plangroup: "", + Planid: simCard.CurrentPackageCode, + Appid: simCard.DeptKey, + AllowPlanChange: 0, + LastSyncTime: queryDateTime(simCard.StatusSyncTime), + AccessType: consts.V3ApiSimAccessTypeNameMap[simCard.AccessType], + CardStatus: consts.V3ApiSimBossCardStatusNameMap[simCard.BossCardStatus], + CardType: consts.V3ApiSimCardTypeNameMap[simCard.CardType], + NetworkType: consts.V3ApiSimNetModelNameMap[simCard.NetModel], + ActivationDate: queryDate(simCard.OutStockTime), + ActiveDate: queryDate(simCard.FlowPkgBeginAt), + ValidityPeriod: queryValidityPeriod(simCard.FlowPkgBeginAt, simCard.FlowPkgEndAt), + ExpiryDate: queryDate(simCard.FlowPkgEndAt), + TestPeriod: 0, + TestPeriodExpiryDate: nil, + SilentPeriod: 0, + SilentPeriodExpiryDate: nil, + DataService: simCard.DataServiceStatus, + PlanData: int(math.Round(simCard.PackageTotalFlowMb)), + UsedData: simCard.UsedFlowMb, + RemainingData: queryRemaining(simCard.PackageTotalFlowMb, simCard.UsedFlowMb), + SmsService: simCard.SmsServiceStatus, + PlanSMS: simCard.PackageTotalSms, + UsedSMS: simCard.UsedSms, + RemainingSMS: queryRemainingInt(simCard.PackageTotalSms, simCard.UsedSms), + VoiceService: simCard.VoiceServiceStatus, + PlanMinutes: simCard.PackageTotalVoice, + UsedMinutes: simCard.UsedVoice, + RemainingMinutes: queryRemainingInt(simCard.PackageTotalVoice, simCard.UsedVoice), + InternationalRoamingService: simCard.RoamServiceStatus, + PlanInternationalData: int(math.Round(simCard.PackageTotalRoamFlowMb)), + UsedInternationalData: int(math.Round(simCard.UsedRoamFlowMb)), + RemainingInternationalData: queryRemaining(simCard.PackageTotalRoamFlowMb, simCard.UsedRoamFlowMb), + Description: nil, + } + return output, nil +} + +func (s *sQuerySim) QuerySimLimit(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimLimitOutput, err error) { + simCard, err := s.querySim(ctx, input) + if err != nil { + return nil, err + } + trafficCutoffName := "删除" + if simCard.TrafficCutoffStatus == 1 { + trafficCutoffName = "已开启" + } else if simCard.TrafficCutoffStatus == 2 { + trafficCutoffName = "已关闭" + } + output = &model.QuerySimLimitOutput{ + TrafficCutoffStatus: simCard.TrafficCutoffStatus, + TrafficCutoffName: trafficCutoffName, + TrafficCutoffThreshold: simCard.TrafficCutoffThreshold, + } + return output, nil +} + +func (s *sQuerySim) QuerySimImei(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimImeiOutput, err error) { + simCard, err := s.querySim(ctx, input) + if err != nil { + return nil, err + } + if imei := strings.TrimSpace(simCard.Imei); imei != "" { + return &model.QuerySimImeiOutput{Imei: imei}, nil + } + + upstreamInput := &model.SimImeiInput{ + SimKeys: []*model.SimKey{{ + ChanKey: strings.TrimSpace(simCard.ChanKey), + ICCID: strings.TrimSpace(simCard.Iccid), + IMSI: strings.TrimSpace(simCard.Imsi), + MSISDN: strings.TrimSpace(simCard.Msisdn), + }}, + } + upstreamResults, err := service.UpstreamChan().QuerySimImei(ctx, upstreamInput) + if err != nil { + g.Log().Warningf(ctx, "QuerySim.QuerySimImei upstream query failed, iccid: %s, err: %v", simCard.Iccid, err) + return &model.QuerySimImeiOutput{Imei: ""}, nil + } + for _, item := range upstreamResults { + if item.Code != 0 { + continue + } + if imei := strings.TrimSpace(item.ResData.Imei); imei != "" { + columns := dao.TSimCardInfo.Columns() + // imei_update_time 记录"值实际变更"的时间(单卡回填必然是从空到有值, + // 故一定发生变更);imei_sync_time 专属于 worker 轮询链路, + // 此处不写,避免污染"轮询覆盖度"指标。 + if _, updateErr := service.IotTSimCardInfo(). + Model(ctx). + Where(columns.Id, simCard.Id). + Data(g.Map{ + columns.Imei: imei, + columns.ImeiUpdateTime: gtime.Now(), + }). + Update(); updateErr != nil { + g.Log().Warningf(ctx, "QuerySim.QuerySimImei persist upstream imei failed, card id: %d, err: %v", simCard.Id, updateErr) + } + return &model.QuerySimImeiOutput{Imei: imei}, nil + } + } + + output = &model.QuerySimImeiOutput{ + Imei: "", + } + return output, nil +} + +func (s *sQuerySim) QuerySimUsage(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimUsageOutput, err error) { + simCard, err := s.querySim(ctx, input) + if err != nil { + return nil, err + } + output = &model.QuerySimUsageOutput{ + UseUnit: "MB", + UseAmount: simCard.UsedFlowMb, + } + return output, nil +} + +// QuerySimStatus 查询SIM卡状态(纯读本地库,不调用上游通道) +func (s *sQuerySim) QuerySimStatus(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimCardStatusOutput, err error) { + simCard, err := s.querySim(ctx, input) + if err != nil { + return nil, err + } + statusName, ok := consts.V3ApiSimBossCardStatusNameMap[simCard.BossCardStatus] + if !ok { + statusName = "未知" + } + output = &model.QuerySimCardStatusOutput{ + Iccid: simCard.Iccid, + LifeCycle: simCard.BossCardStatus, + LifeCycleName: statusName, + } + return output, nil +} diff --git a/internal/logic/query/token.go b/internal/logic/query/token.go new file mode 100644 index 0000000..9a8ba37 --- /dev/null +++ b/internal/logic/query/token.go @@ -0,0 +1,431 @@ +package query + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/bcache" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/contexts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/utils" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + "net/url" + "strings" + "sync/atomic" + "time" + + "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/os/gtime" + "github.com/golang-jwt/jwt/v4" + "github.com/google/uuid" +) + +const ydOperatorTokenURL = "https://api.iot.10086.cn/v5/ec/get/token" + +type ydOperatorTokenResp struct { + Status string `json:"status"` + Message string `json:"message"` + Result []struct { + Token string `json:"token"` + Ttl int64 `json:"ttl"` + } `json:"result"` +} + +var ydOperatorTokenSeq atomic.Int64 + +type sQueryToken struct { +} + +func NewQueryToken() *sQueryToken { + return &sQueryToken{} +} + +func init() { + service.RegisterQueryToken(NewQueryToken()) +} + +// Token 获取Token +func (l *sQueryToken) Token(ctx context.Context, input model.TokenInputApi) (res model.TokenOutputApi, err error) { + // 查询API集成信息 + var tApi entity.TApi + err = dao.TApi.Ctx(ctx).Where(dao.TApi.Columns().AppKey, input.AppKey).Scan(&tApi) + if err != nil { + g.Log().Errorf(ctx, "QueryToken.Token, Select t api by app key failed, err: %v, input: %v", err, input) + return res, gerror.New("APPKey或APPSecret错误") + } + // 校验APPKey是否存在和APPSecret是否正确 + if tApi.Id == 0 { + g.Log().Debugf(ctx, "QueryToken.Token, The t api does not exist, input: %v", input) + return res, gerror.New("APPKey或APPSecret错误") + } + if tApi.AppSecret != input.AppSecret { + g.Log().Debugf(ctx, "QueryToken.Token, APPSecret verification failed, input: %v", input) + return res, gerror.New("APPKey或APPSecret错误") + } + if tApi.Status == 1 { + g.Log().Debugf(ctx, "QueryToken.Token, The t api is disabled, input: %v", input) + return res, gerror.New("API集成已停用") + } + // 验证客户 + // dept, err := service.SysDept().GetDeptById(ctx, tApi.DeptId) + var dept entity.SysDept + err = dao.SysDept.Ctx(ctx).Where(dao.SysDept.Columns().DeptId, tApi.DeptId).Scan(&dept) + if err != nil { + g.Log().Errorf(ctx, "QueryToken.Token, Select dept by id failed, err: %v, input: %v", err, input) + return res, gerror.New("APPKey或APPSecret错误") + } + if dept.DeptId == 0 { + g.Log().Debugf(ctx, "QueryToken.Token, The organization does not exist, input: %v", input) + return res, gerror.New("APPKey或APPSecret错误") + } + g.Log().Debugf(ctx, "dept.DeptId: %v", dept.DeptId) + if dept.DeptKey == "" { + g.Log().Debugf(ctx, "QueryToken.Token, The organization does not have API service enabled, input: %v", input) + return res, gerror.New("客户未开启API服务") + } + + identity := &model.CustomClaimsApi{ + BaseClaimsApi: model.BaseClaimsApi{ + UUID: strings.ReplaceAll(uuid.New().String(), "-", ""), + ApiId: tApi.Id, + AppKey: tApi.AppKey, + GroupId: tApi.GroupId, + DeptKey: dept.DeptKey, + DeptName: dept.DeptName, + DeptType: dept.DeptType, + TenantId: dept.TenantId, + DeptId: dept.DeptId, + LoginAt: time.Now().Unix(), + }, + } + + contextModel := new(model.Context) + ctx = contexts.Set(ctx, contextModel) + + if input.Refresh == "" { + input.Refresh = "1" + } else if input.Refresh != "0" && input.Refresh != "1" { + return res, gerror.New("刷新参数错误") + } + + res.AppId = dept.DeptKey + if input.Refresh == "0" { + tokenUuid, cacheErr := bcache.GetApiAuthActiveToken(ctx, dept.DeptId) + if cacheErr == nil && tokenUuid != "" { + token, tokenErr := l.GenerateShortToken(ctx, tokenUuid) + if tokenErr != nil { + return res, tokenErr + } + res.AccessToken = token + return res, nil + } + } + + if input.Refresh == "1" { + tokenUuid, cacheErr := bcache.GetApiAuthActiveToken(ctx, dept.DeptId) + if cacheErr == nil && tokenUuid != "" { + _ = bcache.DelApiAuthToken(ctx, tokenUuid) + } + _ = bcache.DelApiAuthActiveToken(ctx, dept.DeptId) + } + + _, token, err := l.GenerateToken(ctx, identity) + if err != nil { + return res, err + } + res.AccessToken = token + return res, nil +} + +// OperatorToken 获取移动运营商Token(仅需chanKey,不校验白名单和AppId) +func (l *sQueryToken) OperatorToken(ctx context.Context, input model.OperatorTokenInput) (res model.OperatorTokenOutput, err error) { + return l.fetchYdOperatorToken(ctx, input, false) +} + +// OperatorTokenWithAuth 获取移动运营商Token(校验白名单+AppId,需传appId+chanKey) +func (l *sQueryToken) OperatorTokenWithAuth(ctx context.Context, input model.OperatorTokenInput) (res model.OperatorTokenOutput, err error) { + if input.AppId == "" { + return res, gerror.New("AppId不能为空") + } + return l.fetchYdOperatorToken(ctx, input, true) +} + +// fetchYdOperatorToken 内部实现,checkShare=true时校验白名单和AppId +func (l *sQueryToken) fetchYdOperatorToken(ctx context.Context, input model.OperatorTokenInput, checkShare bool) (res model.OperatorTokenOutput, err error) { + if input.ChanKey == "" { + return res, gerror.New("通道Key不能为空") + } + + fields := []any{ + dao.TSimChannels.Columns().TempKey, + dao.TSimChannels.Columns().ChanAlias, + dao.TSimChannels.Columns().ChanKey, + dao.TSimChannels.Columns().AppKey, + dao.TSimChannels.Columns().AppSecret, + } + if checkShare { + fields = append(fields, dao.TSimChannels.Columns().ShareEnabled) + } + + var simChannels entity.TSimChannels + dbErr := dao.TSimChannels.DB().Model(dao.TSimChannels.Table()).Safe().Ctx(ctx). + Fields(fields...). + Where(dao.TSimChannels.Columns().ChanKey, input.ChanKey). + Scan(&simChannels) + if dbErr != nil { + g.Log().Errorf(ctx, "QueryToken.fetchYdOperatorToken, Select sim channel by chan key failed, err: %v, input: %v", dbErr, input) + return res, gerror.New("通道不存在") + } + if simChannels.ChanKey == "" { + return res, gerror.New("通道不存在") + } + if checkShare { + if simChannels.ShareEnabled != 1 { + g.Log().Warningf(ctx, "QueryToken.fetchYdOperatorToken, sim channel share not enabled, chanKey: %s", input.ChanKey) + return res, gerror.New("该通道未开放共享Token") + } + if input.AppId != simChannels.AppKey { + g.Log().Warningf(ctx, "QueryToken.fetchYdOperatorToken, appId mismatch, chanKey: %s, inputAppId: %s, channelAppId: %s", input.ChanKey, input.AppId, simChannels.AppKey) + return res, gerror.New("AppId与通道不匹配") + } + } + + var tempModel string + if simChannels.TempKey != "" { + var template entity.TSimChannelTemplate + if tmplErr := dao.TSimChannelTemplate.Ctx(ctx). + Fields(dao.TSimChannelTemplate.Columns().TempModel). + Where(dao.TSimChannelTemplate.Columns().TempKey, simChannels.TempKey). + Limit(1).Scan(&template); tmplErr == nil { + tempModel = strings.TrimSpace(template.TempModel) + } + } + + if strings.EqualFold(tempModel, "shared_token") { + result, sharedErr := service.UpstreamChan().GetSharedToken(ctx, input.ChanKey) + if sharedErr != nil { + return res, gerror.Wrap(sharedErr, "获取共享Token失败") + } + return model.OperatorTokenOutput{ + ChanAlias: result.ChanAlias, + ChanKey: result.ChanKey, + AccessToken: result.AccessToken, + AccessTokenExpire: result.AccessTokenExpire, + }, nil + } + + if simChannels.AppKey == "" || simChannels.AppSecret == "" { + return res, gerror.New("通道不存在") + } + + now := time.Now() + transID := buildYdOperatorTokenTransID(simChannels.AppKey, now) + params := g.Map{ + "appid": simChannels.AppKey, + "password": simChannels.AppSecret, + "transid": transID, + "refresh": "0", + } + g.Log().Infof(ctx, "QueryToken.OperatorToken, request yd token url: %s, chanKey: %s", buildYdOperatorTokenRequestURL(simChannels.AppKey, simChannels.AppSecret, transID), input.ChanKey) + client := g.Client() + client.SetTimeout(10 * time.Second) + resp, err := client.Get(ctx, ydOperatorTokenURL, params) + if err != nil { + g.Log().Errorf(ctx, "QueryToken.OperatorToken, request yd token failed, err: %v, chanKey: %s", err, input.ChanKey) + return res, gerror.New("获取移动运营商Token失败") + } + + body := resp.ReadAllString() + var ydResp ydOperatorTokenResp + if err = json.Unmarshal([]byte(body), &ydResp); err != nil { + g.Log().Errorf(ctx, "QueryToken.OperatorToken, parse yd token response failed, err: %v, chanKey: %s, body: %s", err, input.ChanKey, body) + return res, gerror.New("解析移动运营商Token响应失败") + } + if ydResp.Status != "0" { + g.Log().Warningf(ctx, "QueryToken.OperatorToken, yd token response error, status: %s, message: %s, chanKey: %s", ydResp.Status, ydResp.Message, input.ChanKey) + if ydResp.Message != "" { + return res, gerror.New(ydResp.Message) + } + return res, gerror.New("获取移动运营商Token失败") + } + if len(ydResp.Result) == 0 || ydResp.Result[0].Token == "" { + return res, gerror.New("移动运营商Token为空") + } + if ydResp.Result[0].Ttl <= 0 { + return res, gerror.New("移动运营商Token有效期无效") + } + + return model.OperatorTokenOutput{ + ChanAlias: simChannels.ChanAlias, + ChanKey: simChannels.ChanKey, + AccessToken: ydResp.Result[0].Token, + AccessTokenExpire: gtime.NewFromTime(now.Add(time.Duration(ydResp.Result[0].Ttl) * time.Second)), + }, nil +} + +func buildYdOperatorTokenTransID(appKey string, now time.Time) string { + return appKey + now.Format("20060102150405") + fmt.Sprintf("%08d", ydOperatorTokenSeq.Add(1)%100000000) +} + +func buildYdOperatorTokenRequestURL(appKey, password, transID string) string { + values := url.Values{} + values.Set("appid", appKey) + values.Set("password", password) + values.Set("transid", transID) + values.Set("refresh", "0") + return ydOperatorTokenURL + "?" + values.Encode() +} + +// GenerateToken 生成Token +func (s *sQueryToken) GenerateToken(ctx context.Context, customer *model.CustomClaimsApi) (claims *model.CustomClaimsApi, shortToken string, err error) { + ets := g.Cfg().MustGet(ctx, "jwt.expiresTime", "3650d").String() + bts := g.Cfg().MustGet(ctx, "jwt.bufferTime", "1d").String() + iss := g.Cfg().MustGet(ctx, "jwt.issuer", "JieIOTAPI").String() + sk := g.Cfg().MustGet(ctx, "jwt.signingKey", "${JWT_SIGNING_KEY}").String() + et, _ := utils.ParseDuration(ets) + bt, _ := utils.ParseDuration(bts) + g.Log().Infof(ctx, "GenerateToken: customer:%+v, et:%s, bt:%s, iss:%s", customer, et, bt, iss) + + tokenUuid := strings.ReplaceAll(uuid.New().String(), "-", "") + expiresAt := time.Now().Add(et).Unix() + claims = &model.CustomClaimsApi{ + BaseClaimsApi: model.BaseClaimsApi{ + UUID: tokenUuid, + ApiId: customer.ApiId, + AppKey: customer.AppKey, + GroupId: customer.GroupId, + DeptKey: customer.DeptKey, + DeptName: customer.DeptName, + DeptType: customer.DeptType, + DeptId: customer.DeptId, + TenantId: customer.TenantId, + LoginAt: time.Now().Unix(), + }, + BufferTime: int64(bt / time.Second), + RegisteredClaims: jwt.RegisteredClaims{ + Audience: jwt.ClaimStrings{"JIEIOT"}, + ExpiresAt: jwt.NewNumericDate(time.Unix(expiresAt, 0)), + NotBefore: jwt.NewNumericDate(time.Now().Add(-1000)), + Issuer: iss, + }, + } + + fullToken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + fullTokenString, err := fullToken.SignedString([]byte(sk)) + if err != nil { + return nil, "", err + } + if err = bcache.SetApiAuthToken(ctx, tokenUuid, fullTokenString, et); err != nil { + return nil, "", err + } + if err = bcache.SetApiAuthActiveToken(ctx, customer.DeptId, tokenUuid, et); err != nil { + return nil, "", err + } + + shortToken, err = s.GenerateShortToken(ctx, tokenUuid) + if err != nil { + return nil, "", err + } + return claims, shortToken, nil +} + +// GenerateShortToken 生成短令牌 +func (s *sQueryToken) GenerateShortToken(ctx context.Context, tokenUuid string) (token string, err error) { + sk := g.Cfg().MustGet(ctx, "jwt.signingKey", "${JWT_SIGNING_KEY}").String() + shortToken := jwt.NewWithClaims(jwt.SigningMethodHS256, &model.ApiTokenClaims{ + UUID: tokenUuid, + }) + delete(shortToken.Header, "typ") + return shortToken.SignedString([]byte(sk)) +} + +// 解析Token +func (s *sQueryToken) ParseToken(ctx context.Context, token string) (claims *model.CustomClaimsApi, err error) { + sk := g.Cfg().MustGet(ctx, "jwt.signingKey", "${JWT_SIGNING_KEY}").String() + t, err := jwt.ParseWithClaims(token, &model.ApiTokenClaims{}, func(token *jwt.Token) (interface{}, error) { + return []byte(sk), nil + }) + if err != nil { + g.Log().Warningf(ctx, "sApiAuth.ParseToken short token err: %+v", err) + return nil, err + } + shortClaims, ok := t.Claims.(*model.ApiTokenClaims) + if !ok || !t.Valid { + return nil, errors.New("token invalid") + } + + fullTokenString, err := bcache.GetApiAuthToken(ctx, shortClaims.UUID) + if err != nil { + g.Log().Warningf(ctx, "sApiAuth.ParseToken get full token err: %+v", err) + return nil, err + } + fullToken, err := jwt.ParseWithClaims(fullTokenString, &model.CustomClaimsApi{}, func(token *jwt.Token) (interface{}, error) { + return []byte(sk), nil + }) + if err != nil { + g.Log().Warningf(ctx, "sApiAuth.ParseToken full token err: %+v", err) + return nil, err + } + claims, ok = fullToken.Claims.(*model.CustomClaimsApi) + if !ok || !fullToken.Valid { + return nil, errors.New("token invalid") + } + if claims.ExpiresAt == nil || claims.ExpiresAt.Unix() < time.Now().Unix() { + return nil, errors.New("token expired") + } + if claims.UUID != shortClaims.UUID { + return nil, errors.New("token invalid") + } + return claims, nil +} + +// 删除Token +func (s *sQueryToken) DeleteToken(ctx context.Context, token string) (err error) { + sk := g.Cfg().MustGet(ctx, "jwt.signingKey", "${JWT_SIGNING_KEY}").String() + t, err := jwt.ParseWithClaims(token, &model.ApiTokenClaims{}, func(token *jwt.Token) (interface{}, error) { + return []byte(sk), nil + }) + if err != nil { + return err + } + shortClaims, ok := t.Claims.(*model.ApiTokenClaims) + if !ok { + return errors.New("token invalid") + } + return bcache.DelApiAuthToken(ctx, shortClaims.UUID) +} + +// 获取token +func (s *sQueryToken) GetAccessToken(ctx context.Context) (token string, err error) { + headerToken := g.RequestFromCtx(ctx).Header.Get("X-Access-Token") + if headerToken == "" { + return "", gerror.NewCode(gcode.CodeNotImplemented) + } + g.Log().Error(ctx, headerToken) + token = strings.TrimPrefix(headerToken, "Bearer ") + if token == "" { + token = headerToken + } + return token, nil +} + +// 根据Token获取当前登录客户信息 +func (s *sQueryToken) GetCurrentCustomer(ctx context.Context) (claims *model.CustomClaimsApi, err error) { + token, err := s.GetAccessToken(ctx) + g.Log().Debugf(ctx, "sQueryToken.GetCurrentCustomer token: %+v, err: %+v", token, err) + if err != nil { + return nil, err + } + claims, err = s.ParseToken(ctx, token) + g.Log().Debugf(ctx, "sApiAuth.GetCurrentCustomer claims: %+v, err: %+v", claims, err) + if err != nil { + g.Log().Warningf(ctx, "sApiAuth.GetCurrentCustomer err: %+v", err) + return nil, err + } + return claims, nil +} diff --git a/internal/logic/query/traffic_cutoff_config.go b/internal/logic/query/traffic_cutoff_config.go new file mode 100644 index 0000000..95e1ba1 --- /dev/null +++ b/internal/logic/query/traffic_cutoff_config.go @@ -0,0 +1,201 @@ +package query + +import ( + "context" + "strings" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/dao" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + "github.com/gogf/gf/v2/errors/gerror" +) + +const queryTrafficCutoffConfigMaxCards = 1000 + +type trafficCutoffIdentifier struct { + Msisdn string + Iccid string + Imsi string +} + +func validateTrafficCutoffIdentifier(item trafficCutoffIdentifier) error { + count := 0 + if item.Msisdn != "" { + count++ + } + if item.Iccid != "" { + count++ + } + if item.Imsi != "" { + count++ + } + if count == 0 { + return gerror.New("msisdn、iccid、imsi至少传一个") + } + return nil +} + +func trafficCutoffIdentifierKey(item trafficCutoffIdentifier) string { + if item.Iccid != "" { + return "iccid:" + item.Iccid + } + if item.Msisdn != "" { + return "msisdn:" + item.Msisdn + } + return "imsi:" + item.Imsi +} + +func trafficCutoffCardMatchesIdentifier(card *entity.TSimCardInfo, identifier trafficCutoffIdentifier) bool { + if card == nil { + return false + } + if identifier.Iccid != "" && strings.TrimSpace(card.Iccid) != identifier.Iccid { + return false + } + if identifier.Msisdn != "" && strings.TrimSpace(card.Msisdn) != identifier.Msisdn { + return false + } + if identifier.Imsi != "" && strings.TrimSpace(card.Imsi) != identifier.Imsi { + return false + } + return true +} + +func (s *sQuerySim) QueryTrafficCutoffConfig(ctx context.Context, in *model.QueryTrafficCutoffConfigParam) (*model.QueryTrafficCutoffConfigOutput, error) { + if in == nil { + return nil, gerror.New("查询参数不能为空") + } + if strings.TrimSpace(in.AppId) == "" { + return nil, gerror.New("appId不能为空") + } + if len(in.Cards) == 0 { + return nil, gerror.New("查询卡不能为空") + } + if len(in.Cards) > queryTrafficCutoffConfigMaxCards { + return nil, gerror.Newf("单次最多查询%d张卡", queryTrafficCutoffConfigMaxCards) + } + + identifiers := make([]trafficCutoffIdentifier, 0, len(in.Cards)) + seen := make(map[string]struct{}, len(in.Cards)) + for _, item := range in.Cards { + identifier := trafficCutoffIdentifier{Msisdn: strings.TrimSpace(item.Msisdn), Iccid: strings.TrimSpace(item.Iccid), Imsi: strings.TrimSpace(item.Imsi)} + if err := validateTrafficCutoffIdentifier(identifier); err != nil { + return nil, err + } + key := trafficCutoffIdentifierKey(identifier) + if _, ok := seen[key]; ok { + return nil, gerror.Newf("卡片标识重复:%s", key) + } + seen[key] = struct{}{} + identifiers = append(identifiers, identifier) + } + + cardMap, err := loadTrafficCutoffCards(ctx, identifiers) + if err != nil { + return nil, err + } + output := &model.QueryTrafficCutoffConfigOutput{Total: len(identifiers), Items: make([]model.QueryTrafficCutoffConfigItem, 0, len(identifiers))} + for _, identifier := range identifiers { + result := model.QueryTrafficCutoffConfigItem{} + card := cardMap[trafficCutoffIdentifierKey(identifier)] + if !trafficCutoffCardMatchesIdentifier(card, identifier) { + result.ErrorCode = "CARD_NOT_FOUND" + result.ErrorMessage = "卡片不存在或无权限" + output.NotFoundCount++ + output.Items = append(output.Items, result) + continue + } + result.Matched = true + result.Iccid = strings.TrimSpace(card.Iccid) + result.TrafficCutoffStatus = card.TrafficCutoffStatus + result.TrafficCutoffStatusName = trafficCutoffStatusName(card.TrafficCutoffStatus) + result.TrafficCutoffThreshold = card.TrafficCutoffThreshold + if result.TrafficCutoffStatus == 0 { + result.TrafficCutoffThreshold = 0 + } + result.TrafficCutoffThresholdUnit = "MB" + if in.IncludeUsage { + packageTotalFlowMb := card.PackageTotalFlowMb + usedFlowMb := card.UsedFlowMb + remainingFlowMb := maxFloat(packageTotalFlowMb-usedFlowMb, 0) + result.PackageTotalFlowMb = &packageTotalFlowMb + result.UsedFlowMb = &usedFlowMb + result.RemainingFlowMb = &remainingFlowMb + } + output.MatchedCount++ + output.Items = append(output.Items, result) + } + return output, nil +} + +func loadTrafficCutoffCards(ctx context.Context, identifiers []trafficCutoffIdentifier) (map[string]*entity.TSimCardInfo, error) { + columns := dao.TSimCardInfo.Columns() + result := make(map[string]*entity.TSimCardInfo, len(identifiers)) + lookup := func(field string, values []string) error { + if len(values) == 0 { + return nil + } + var cards []*entity.TSimCardInfo + err := service.IotTSimCardInfo().Model(ctx). + Fields(columns.Iccid, columns.Msisdn, columns.Imsi, columns.PackageTotalFlowMb, columns.UsedFlowMb, columns.TrafficCutoffStatus, columns.TrafficCutoffThreshold). + WhereIn(field, values).Scan(&cards) + if err != nil { + return gerror.Wrap(err, "查询达量断网配置失败") + } + for _, card := range cards { + if card == nil { + continue + } + if card.Iccid != "" { + result["iccid:"+strings.TrimSpace(card.Iccid)] = card + } + if card.Msisdn != "" { + result["msisdn:"+strings.TrimSpace(card.Msisdn)] = card + } + if card.Imsi != "" { + result["imsi:"+strings.TrimSpace(card.Imsi)] = card + } + } + return nil + } + iccidValues, msisdnValues, imsiValues := make([]string, 0), make([]string, 0), make([]string, 0) + for _, item := range identifiers { + switch { + case item.Iccid != "": + iccidValues = append(iccidValues, item.Iccid) + case item.Msisdn != "": + msisdnValues = append(msisdnValues, item.Msisdn) + default: + imsiValues = append(imsiValues, item.Imsi) + } + } + if err := lookup(columns.Iccid, iccidValues); err != nil { + return nil, err + } + if err := lookup(columns.Msisdn, msisdnValues); err != nil { + return nil, err + } + if err := lookup(columns.Imsi, imsiValues); err != nil { + return nil, err + } + return result, nil +} + +func trafficCutoffStatusName(status int) string { + switch status { + case 1: + return "已开启" + case 2: + return "已关闭" + default: + return "删除" + } +} + +func maxFloat(value, floor float64) float64 { + if value < floor { + return floor + } + return value +} diff --git a/internal/logic/upstream/upstream_chan.go b/internal/logic/upstream/upstream_chan.go new file mode 100644 index 0000000..9c665e6 --- /dev/null +++ b/internal/logic/upstream/upstream_chan.go @@ -0,0 +1,583 @@ +package upstream + +import ( + "context" + "encoding/json" + "fmt" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + "net/http" + "time" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/gclient" + "github.com/gogf/gf/v2/net/gsvc" + "github.com/gogf/gf/v2/os/gtime" +) + +type sUpstreamChan struct { +} + +func setClientTimeout(client *gclient.Client, timeout time.Duration) { + client.SetTimeout(timeout) + if transport, ok := client.Transport.(*http.Transport); ok { + transport.ResponseHeaderTimeout = timeout + } +} + +func NewUpstreamChan() *sUpstreamChan { + return &sUpstreamChan{} +} + +func init() { + service.RegisterUpstreamChan(NewUpstreamChan()) +} + +func (s *sUpstreamChan) GetUpstreamChanConfig(ctx context.Context) (output model.UpstreamChanConfig, err error) { + // 获取配置文件信息 + proxyConfig, err := g.Cfg().Get(ctx, "upstream.proxy") + if err != nil { + return output, err + } + proxyConfig.Scan(&output) + return output, nil +} + +func (s *sUpstreamChan) getGatewayConfig(ctx context.Context) (output model.UpstreamChanConfig, err error) { + gatewayConfig, err := g.Cfg().Get(ctx, "upstream.gateway") + if err != nil { + return output, err + } + gatewayConfig.Scan(&output) + if output.Address == "" { + return output, gerror.New("upstream gateway config not found") + } + return output, nil +} + +type sharedTokenResponse struct { + Code int `json:"code"` + Message string `json:"message"` + Data *sharedTokenResponseData `json:"data"` +} + +type sharedTokenResponseData struct { + ChanAlias string `json:"chanAlias"` + ChanKey string `json:"chanKey"` + AccessToken string `json:"accessToken"` + AccessTokenExpire string `json:"accessTokenExpire"` +} + +func (s *sUpstreamChan) GetSharedToken(ctx context.Context, chanKey string) (*model.SharedTokenResult, error) { + chanConfig, err := s.getGatewayConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.GetSharedToken, get gateway config error %+v", err) + return nil, gerror.Wrap(err, "获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout) + url := fmt.Sprintf("http://%s/internal/channel/shared-token", chanConfig.Address) + resp, err := client.Post(ctx, url, g.Map{"chanKey": chanKey}) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.GetSharedToken, post error %+v, url %s, chanKey %s", err, url, chanKey) + return nil, gerror.New("请求共享Token失败") + } + body := resp.ReadAll() + var output sharedTokenResponse + if err = json.Unmarshal(body, &output); err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.GetSharedToken, unmarshal error %+v, url %s, body %s", err, url, body) + return nil, gerror.New("解析共享Token响应失败") + } + if output.Code != 0 { + if output.Message == "" { + output.Message = "获取共享Token失败" + } + return nil, gerror.New(output.Message) + } + if output.Data == nil { + return nil, gerror.New("共享Token响应数据为空") + } + result := &model.SharedTokenResult{ + ChanAlias: output.Data.ChanAlias, + ChanKey: output.Data.ChanKey, + AccessToken: output.Data.AccessToken, + } + if output.Data.AccessTokenExpire != "" { + if t, parseErr := gtime.StrToTime(output.Data.AccessTokenExpire); parseErr == nil { + result.AccessTokenExpire = t + } + } + return result, nil +} + +// 获取卡基本信息 +func (s *sUpstreamChan) QuerySimBasicInfo(ctx context.Context, input *model.SimBasicInfoInput) ([]model.SimBaseRes[model.SimBasicInfoItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimBasicInfo, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-basic-info", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-basic-info") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimBasicInfo, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimBasicInfoOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimBasicInfo, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimBasicInfo, query sim basic info error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var basicInfo []model.SimBaseRes[model.SimBasicInfoItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimBasicInfo, query sim basic info error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + basicInfo = append(basicInfo, item) + } + return basicInfo, nil +} + +// 查询会话信息 +func (s *sUpstreamChan) QuerySimSession(ctx context.Context, input *model.SimSessionInput) ([]model.SimBaseRes[model.SimSessionItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimSession, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-session", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-session") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimSession, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimSessionOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimSession, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimSession, query sim session error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var session []model.SimBaseRes[model.SimSessionItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimSession, query sim session error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + session = append(session, item) + } + return session, nil +} + +// 查询状态 +func (s *sUpstreamChan) QuerySimCardStatus(ctx context.Context, input *model.SimCardStatusInput) ([]model.SimBaseRes[model.SimCardStatusItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimCardStatus, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-card-status", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-status") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimCardStatus, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimCardStatusOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimCardStatus, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimCardStatus, query sim card status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var cardStatus []model.SimBaseRes[model.SimCardStatusItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimCardStatus, query sim card status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + cardStatus = append(cardStatus, item) + } + return cardStatus, nil +} + +// 查询IMEI +func (s *sUpstreamChan) QuerySimImei(ctx context.Context, input *model.SimImeiInput) ([]model.SimBaseRes[model.SimImeiItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimImei, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-imei", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-imei") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimImei, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimImeiOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimImei, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimImei, query sim imei error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var imei []model.SimBaseRes[model.SimImeiItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimImei, query sim imei error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + imei = append(imei, item) + } + return imei, nil +} + +// 查询流量 +func (s *sUpstreamChan) QuerySimDatausage(ctx context.Context, input *model.SimDataUsageInput) ([]model.SimBaseRes[model.SimDataUsageItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDataUsage, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-datausage", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-datausage") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDataUsage, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimDataUsageOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDataUsage, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDataUsage, query sim data usage error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var dataUsage []model.SimBaseRes[model.SimDataUsageItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDataUsage, query sim datausage error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + dataUsage = append(dataUsage, item) + } + return dataUsage, nil +} + +// 查询月流量 +func (s *sUpstreamChan) QuerySimDatausageMonthly(ctx context.Context, input *model.SimDataUsageMonthlyInput) ([]model.SimBaseRes[model.SimDataUsageMonthlyOutputItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDatausageMonthly, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-datausage-monthly", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + g.Log().Debug(ctx, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-datausage-monthly") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDatausageMonthly, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimDataUsageMonthlyOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDatausageMonthly, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDatausageMonthly, query sim datausage monthly error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var dataUsage []model.SimBaseRes[model.SimDataUsageMonthlyOutputItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDatausageMonthly, query sim datausage monthly error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + dataUsage = append(dataUsage, item) + } + return dataUsage, nil +} + +// 查询日流量 +func (s *sUpstreamChan) QuerySimDatausageDaily(ctx context.Context, input *model.SimDataUsageDailyInput) ([]model.SimBaseRes[model.SimDataUsageDailyOutputItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDatausageDaily, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-datausage-daily", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-datausage-daily") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDatausageDaily, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimDataUsageDailyOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDatausageDaily, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDatausageDaily, query sim datausage daily error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var dataUsage []model.SimBaseRes[model.SimDataUsageDailyOutputItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDatausageDaily, query sim datausage daily error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + dataUsage = append(dataUsage, item) + } + return dataUsage, nil +} + +// 查询已开通APN信息 +func (s *sUpstreamChan) QuerySimApnInfo(ctx context.Context, input *model.SimApnInfoInput) ([]model.SimBaseRes[model.SimApnInfoItemList], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimApnInfo, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-apn-info", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-apn-info") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimApnInfo, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimApnInfoOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimApnInfo, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimApnInfo, query sim apn info error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var apnInfo []model.SimBaseRes[model.SimApnInfoItemList] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimApnInfo, query sim apn info error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + apnInfo = append(apnInfo, item) + } + return apnInfo, nil +} + +// 卡状态变更 +func (s *sUpstreamChan) ChangeSimStatus(ctx context.Context, input *model.SimCardStatusChangeInput) ([]model.SimBaseRes[model.SimCardStatusChangeItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.ChangeSimStatus, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/change/sim-status", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/change/sim-status") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.ChangeSimStatus, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimCardStatusChangeOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.ChangeSimStatus, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.ChangeSimStatus, change sim status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var statusList []model.SimBaseRes[model.SimCardStatusChangeItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.ChangeSimStatus, change sim status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + } + statusList = append(statusList, item) + } + return statusList, nil +} + +// 卡APN功能开停 +func (s *sUpstreamChan) ChangeSimApnFunction(ctx context.Context, input *model.SimCardOperateChangeApnInput) ([]model.SimBaseRes[model.SimCardOperateChangeApnItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.ChangeSimApnFunction, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-apn", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-apn") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.ChangeSimApnFunction, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimCardOperateChangeApnOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.ChangeSimApnFunction, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.ChangeSimApnFunction, change sim apn function error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + var statusList []model.SimBaseRes[model.SimCardOperateChangeApnItem] + for _, item := range output.Data { + if item.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.ChangeSimApnFunction, change sim apn function error %+v, path %s, params %+v, body %s, ", err, url, input, body) + continue + } + statusList = append(statusList, item) + } + return statusList, nil +} + +// 查询机卡绑定状态 +func (s *sUpstreamChan) QuerySimCardBindStatus(ctx context.Context, input *model.SimCardBindStatusInput) ([]model.SimBaseRes[model.SimCardBindStatusItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimCardBindStatus, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-card-bind-status", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-card-bind-status") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimCardBindStatus, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimCardBindStatusOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimCardBindStatus, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimCardBindStatus, query sim card bind status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + return output.Data, nil +} + +// 查询设备状态 +func (s *sUpstreamChan) QuerySimDeviceStatus(ctx context.Context, input *model.SimDeviceStatusInput) ([]model.SimBaseRes[model.SimDeviceStatusItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDeviceStatus, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-device-status", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-device-status") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDeviceStatus, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimDeviceStatusOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimDeviceStatus, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimDeviceStatus, query sim device status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + return output.Data, nil +} + +// 查询地域限制状态 +func (s *sUpstreamChan) QuerySimRegionLimitStatus(ctx context.Context, input *model.SimRegionLimitStatusInput) ([]model.SimBaseRes[model.SimRegionLimitStatusItem], error) { + chanConfig, err := s.GetUpstreamChanConfig(ctx) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimRegionLimitStatus, get upstream chan config error %+v, path %s, input %+v, ", err, "/sim/query/sim-region-limit-status", input) + return nil, gerror.New("获取上游通道配置失败") + } + client := g.Client() + client.SetDiscovery(gsvc.GetRegistry()) + setClientTimeout(client, chanConfig.Timeout*time.Duration(len(input.SimKeys))) + url := fmt.Sprintf("http://%s%s", chanConfig.Address, "/sim/query/sim-region-limit-status") + resp, err := client.Post(ctx, url, input) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimRegionLimitStatus, post error %+v,url %s, params %+v, ", err, url, input) + return nil, gerror.New("请求失败") + } + body := resp.ReadAll() + output := model.SimRegionLimitStatusOutput{} + err = json.Unmarshal([]byte(body), &output) + if err != nil { + g.Log().Errorf(ctx, "sUpstreamChan.QuerySimRegionLimitStatus, unmarshal error %+v,url %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New("解析响应失败") + } + if output.Code != 0 { + g.Log().Debugf(ctx, "sUpstreamChan.QuerySimRegionLimitStatus, query sim region limit status error %+v, path %s, params %+v, body %s, ", err, url, input, body) + return nil, gerror.New(output.Message) + } + return output.Data, nil +} diff --git a/internal/model/agent_dept.go b/internal/model/agent_dept.go new file mode 100644 index 0000000..1d4a49f --- /dev/null +++ b/internal/model/agent_dept.go @@ -0,0 +1,83 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +type AgentDeptListParam struct { + DeptName string `json:"deptName"` + Status string `json:"status"` + DeptType *int `json:"deptType"` +} + +type AgentDeptModel struct { + DeptId int64 `json:"deptId" orm:"dept_id"` + TenantId string `json:"tenantId" orm:"tenant_id"` + DeptType int `json:"deptType" orm:"dept_type"` + ParentId int64 `json:"parentId" orm:"parent_id"` + Ancestors string `json:"ancestors" orm:"ancestors"` + DeptKey string `json:"deptKey" orm:"dept_key"` + DeptName string `json:"deptName" orm:"dept_name"` + DeptCategory string `json:"deptCategory" orm:"dept_category"` + OrderNum int `json:"orderNum" orm:"order_num"` + Leader int64 `json:"leader" orm:"leader"` + Phone string `json:"phone" orm:"phone"` + Email string `json:"email" orm:"email"` + Status string `json:"status" orm:"status"` + CreditCode string `json:"creditCode" orm:"credit_code"` + AreaCode string `json:"areaCode" orm:"area_code"` + Address string `json:"address" orm:"address"` + DeptRole int64 `json:"deptRole" orm:"dept_role"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` +} + +type AgentEnterpriseCustomerModel struct { + DeptId int64 `json:"deptId" orm:"dept_id"` + TenantId string `json:"tenantId" orm:"tenant_id"` + DeptType int `json:"deptType" orm:"dept_type"` + ParentId int64 `json:"parentId" orm:"parent_id"` + Ancestors string `json:"ancestors" orm:"ancestors"` + DeptKey string `json:"deptKey" orm:"dept_key"` + DeptName string `json:"deptName" orm:"dept_name"` + DeptCategory string `json:"deptCategory" orm:"dept_category"` + OrderNum int `json:"orderNum" orm:"order_num"` + Leader int64 `json:"leader" orm:"leader"` + Phone string `json:"phone" orm:"phone"` + Email string `json:"email" orm:"email"` + Status string `json:"status" orm:"status"` + CreditCode string `json:"creditCode" orm:"credit_code"` + AreaCode string `json:"areaCode" orm:"area_code"` + Address string `json:"address" orm:"address"` + DeptRole int64 `json:"deptRole" orm:"dept_role"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` + UserName string `json:"userName"` + NickName string `json:"nickName"` + DefaultUserId int64 `json:"defaultUserId"` + MenuIds []int64 `json:"menuIds"` +} + +type AgentDeptSaveParam struct { + DeptId int64 `json:"deptId"` + ParentId int64 `json:"parentId"` + DeptName string `json:"deptName"` + DeptCategory string `json:"deptCategory"` + OrderNum int `json:"orderNum"` + Leader int64 `json:"leader"` + Phone string `json:"phone"` + Email string `json:"email"` + CreditCode string `json:"creditCode"` + AreaCode string `json:"areaCode"` + Address string `json:"address"` + Status string `json:"status"` + DeptType int `json:"deptType"` + DeptRole int64 `json:"deptRole"` + RoleIds []int64 `json:"roleIds"` + UserName string `json:"userName"` + Password string `json:"password"` + MenuIds []int64 `json:"menuIds"` +} + +type AgentDeptApiModel struct { + DeptKey string `json:"deptKey" description:"部门key"` + DeptName string `json:"deptName" description:"部门名称"` + AppKey string `json:"appKey" description:"应用key"` + AppSecret string `json:"appSecret" description:"应用密钥"` +} diff --git a/internal/model/agent_role.go b/internal/model/agent_role.go new file mode 100644 index 0000000..d78b95c --- /dev/null +++ b/internal/model/agent_role.go @@ -0,0 +1,44 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +type AgentRoleListParam struct { + RoleName string `json:"roleName"` + RoleKey string `json:"roleKey"` + Status string `json:"status"` + CreatedAt []string `json:"createdAt"` +} + +type AgentRoleListModel struct { + RoleId int64 `json:"roleId" orm:"role_id"` + TenantId string `json:"tenantId" orm:"tenant_id"` + DeptId int64 `json:"deptId" orm:"dept_id"` + RoleName string `json:"roleName" orm:"role_name"` + RoleKey string `json:"roleKey" orm:"role_key"` + Status string `json:"status" orm:"status"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` + Remark string `json:"remark" orm:"remark"` + IsDefaultRole bool `json:"isDefaultRole"` +} + +type AgentRoleSaveParam struct { + RoleId int64 `json:"roleId"` + DeptId int64 `json:"deptId"` + RoleName string `json:"roleName"` + RoleKey string `json:"roleKey"` + RoleSort int `json:"roleSort"` + DataScope string `json:"dataScope"` + MenuCheckStrictly int `json:"menuCheckStrictly"` + DeptCheckStrictly int `json:"deptCheckStrictly"` + Status string `json:"status"` + Remark string `json:"remark"` + MenuIds []int64 `json:"menuIds"` + CreatedAt *gtime.Time `json:"createdAt"` +} + +type AgentRoleViewModel struct { + SysRoleViewModel + AllowedMenuIds []int64 `json:"allowedMenuIds"` + MenuTree []*SysMenuTreeModel `json:"menuTree"` + IsDefaultRole bool `json:"isDefaultRole"` +} diff --git a/internal/model/agent_user.go b/internal/model/agent_user.go new file mode 100644 index 0000000..19b33bd --- /dev/null +++ b/internal/model/agent_user.go @@ -0,0 +1,67 @@ +package model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type AgentUserListParam struct { + request.PageInfo + DeptId int64 `json:"deptId"` + UserName string `json:"userName"` + NickName string `json:"nickName"` + Email string `json:"email"` + Phonenumber string `json:"phonenumber"` + Status string `json:"status"` + CreatedAt []string `json:"createdAt"` +} + +type AgentUserListModel struct { + UserId int64 `json:"userId" orm:"user_id"` + TenantId string `json:"tenantId" orm:"tenant_id"` + DeptId int64 `json:"deptId" orm:"dept_id"` + UserName string `json:"userName" orm:"user_name"` + NickName string `json:"nickName" orm:"nick_name"` + UserType string `json:"userType" orm:"user_type"` + Email string `json:"email" orm:"email"` + Phonenumber string `json:"phonenumber" orm:"phonenumber"` + Sex string `json:"sex" orm:"sex"` + Avatar string `json:"avatar" orm:"avatar"` + Status string `json:"status" orm:"status"` + LoginIp string `json:"loginIp" orm:"login_ip"` + LoginDate *gtime.Time `json:"loginDate" orm:"login_date"` + CreatedDept int64 `json:"createdDept" orm:"created_dept"` + CreatedBy int64 `json:"createdBy" orm:"created_by"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` + Remark string `json:"remark" orm:"remark"` + DeptInfo *SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id"` + Roles []*SysRoleMiniModel `json:"roles"` + IsDefaultUser bool `json:"isDefaultUser"` +} + +type AgentUserViewModel struct { + UserId int64 `json:"userId" orm:"user_id"` + TenantId string `json:"tenantId" orm:"tenant_id"` + DeptId int64 `json:"deptId" orm:"dept_id"` + UserName string `json:"userName" orm:"user_name"` + NickName string `json:"nickName" orm:"nick_name"` + UserType string `json:"userType" orm:"user_type"` + Email string `json:"email" orm:"email"` + Phonenumber string `json:"phonenumber" orm:"phonenumber"` + Sex string `json:"sex" orm:"sex"` + Avatar string `json:"avatar" orm:"avatar"` + Status string `json:"status" orm:"status"` + LoginIp string `json:"loginIp" orm:"login_ip"` + LoginDate *gtime.Time `json:"loginDate" orm:"login_date"` + MfaEnabled int64 `json:"mfaEnabled" orm:"mfa_enabled"` + + CreatedDept int64 `json:"createdDept" orm:"created_dept"` + CreatedBy int64 `json:"createdBy" orm:"created_by"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` + Remark string `json:"remark" orm:"remark"` + DeptInfo *SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id"` + Roles []*SysRoleMiniModel `json:"roles"` + Posts []*SysPostMiniModel `json:"posts"` + IsDefaultUser bool `json:"isDefaultUser"` +} diff --git a/internal/model/alipay.go b/internal/model/alipay.go new file mode 100644 index 0000000..d2ba68c --- /dev/null +++ b/internal/model/alipay.go @@ -0,0 +1,67 @@ +package model + +type AlipayConfig struct { + AppId string `json:"appId" yaml:"appId"` + PrivateKey string `json:"privateKey" yaml:"privateKey"` + AlipayPublicKey string `json:"alipayPublicKey" yaml:"alipayPublicKey"` + NotifyUrl string `json:"notifyUrl" yaml:"notifyUrl"` + ReturnUrl string `json:"returnUrl" yaml:"returnUrl"` + IsProduction bool `json:"isProduction" yaml:"isProduction"` +} + +type AlipayPayInput struct { + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + Subject string `json:"subject" dc:"订单标题" v:"required#订单标题不能为空"` + TotalAmount string `json:"totalAmount" dc:"支付金额(元)" v:"required#支付金额不能为空"` + PayType string `json:"payType" dc:"支付类型:page 电脑网站支付,wap 手机网站支付" d:"page"` +} + +type AlipayPayOutput struct { + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + PayUrl string `json:"payUrl" dc:"支付链接"` +} + +type AlipayNotifyInput struct{} + +type AlipayNotifyOutput struct{} + +type AlipayReturnInput struct{} + +type AlipayReturnOutput struct { + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + TradeNo string `json:"tradeNo" dc:"支付宝交易号"` + TotalAmount string `json:"totalAmount" dc:"交易金额"` + Message string `json:"message" dc:"消息"` +} + +type AlipayTradeQueryInput struct { + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + TradeNo string `json:"tradeNo" dc:"支付宝交易号"` +} + +type AlipayTradeQueryOutput struct { + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + TradeNo string `json:"tradeNo" dc:"支付宝交易号"` + TradeStatus string `json:"tradeStatus" dc:"交易状态"` + TotalAmount string `json:"totalAmount" dc:"交易金额"` + BuyerLogonId string `json:"buyerLogonId" dc:"买家支付宝账号"` + BuyerUserId string `json:"buyerUserId" dc:"买家支付宝用户ID"` + BuyerOpenId string `json:"buyerOpenId" dc:"买家支付宝OpenID"` + SendPayDate string `json:"sendPayDate" dc:"交易付款时间"` +} + +type AlipayRefundInput struct { + OutRequestNo string `json:"outRequestNo" dc:"退款请求号" v:"required#退款请求号不能为空"` + RefundReason string `json:"refundReason" dc:"退款原因"` + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + TradeNo string `json:"tradeNo" dc:"支付宝交易号"` + RefundAmount string `json:"refundAmount" dc:"退款金额(元)" v:"required#退款金额不能为空"` +} + +type AlipayRefundOutput struct { + OutRequestNo string `json:"outRequestNo" dc:"退款请求号"` + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + TradeNo string `json:"tradeNo" dc:"支付宝交易号"` + BuyerLogonId string `json:"buyerLogonId" dc:"买家支付宝账号"` + RefundAmount string `json:"refundAmount" dc:"退款金额(元)"` +} diff --git a/internal/model/batch_detail_list.go b/internal/model/batch_detail_list.go new file mode 100644 index 0000000..4346530 --- /dev/null +++ b/internal/model/batch_detail_list.go @@ -0,0 +1,51 @@ +package model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" +) + +type BatchCardListParam struct { + request.PageInfo + BatchNo string `json:"batchNo" v:"required#批次号不能为空" dc:"批次编号"` + BatchType *int `json:"batchType" dc:"批次类型"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` +} + +func (in *BatchCardListParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchCardListModel struct { + RowNo int `json:"rowNo" dc:"行号"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + DetailStatus int `json:"detailStatus" dc:"明细状态"` +} + +type BatchDetailListParam struct { + request.PageInfo + BatchNo string `json:"batchNo" v:"required#批次号不能为空" dc:"批次编号"` + BatchType *int `json:"batchType" dc:"批次类型"` + DetailStatus *int `json:"detailStatus" dc:"明细状态"` + Iccid string `json:"iccid" dc:"ICCID"` +} + +func (in *BatchDetailListParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchDetailErrorModel struct { + Reason string `json:"reason" dc:"异常原因"` +} + +type BatchDetailListModel struct { + RowNo int `json:"rowNo" dc:"行号"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + DetailStatus int `json:"detailStatus" dc:"明细状态"` + Error *BatchDetailErrorModel `json:"error" dc:"错误信息"` +} diff --git a/internal/model/batch_execution_log.go b/internal/model/batch_execution_log.go new file mode 100644 index 0000000..25553b8 --- /dev/null +++ b/internal/model/batch_execution_log.go @@ -0,0 +1,72 @@ +package model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type BatchExecutionLogListParam struct { + request.PageInfo + BatchNo string `json:"batchNo" dc:"批次编号"` + BatchType *int `json:"batchType" dc:"批次类型"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *BatchExecutionLogListParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchExecutionLogListModel struct { + Id int64 `json:"id" dc:"主键ID"` + BatchNo string `json:"batchNo" dc:"批次编号"` + BatchType int `json:"batchType" dc:"批次类型"` + SourceType *int `json:"sourceType" dc:"来源方式 枚举"` + RunResult int `json:"runResult" dc:"运行结果"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +type BatchExecutionLogDetailParam struct { + BatchNo string `json:"batchNo" v:"required#批次号不能为空" dc:"批次编号"` +} + +func (in *BatchExecutionLogDetailParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchExecutionLogFileModel struct { + OssId int64 `json:"ossId" dc:"OSS文件ID"` + Url string `json:"url" dc:"文件URL"` +} + +type BatchExecutionLogResultFileModel struct { + DownloadId int64 `json:"downloadId" dc:"下载任务ID"` + OssId int64 `json:"ossId" dc:"OSS文件ID"` + Url string `json:"url" dc:"文件URL"` + DownloadStatus int `json:"downloadStatus" dc:"下载状态"` +} + +type BatchExecutionLogDetailModel struct { + Id int64 `json:"id" dc:"主键ID"` + BatchNo string `json:"batchNo" dc:"批次编号"` + BatchType int `json:"batchType" dc:"批次类型"` + SourceType *int `json:"sourceType" dc:"来源方式 枚举"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态 0=已创建 1=待处理 2=处理中 3=成功 4=失败 5=部分成功"` + RunResult int `json:"runResult" dc:"运行结果"` + FailReason string `json:"failReason" dc:"失败原因"` + TotalCount int `json:"totalCount" dc:"总数量"` + ValidCount int `json:"validCount" dc:"有效数量"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + SourceFile *BatchExecutionLogFileModel `json:"sourceFile" dc:"源文件"` + ResultFile *BatchExecutionLogResultFileModel `json:"resultFile" dc:"结果文件"` +} diff --git a/internal/model/batch_main.go b/internal/model/batch_main.go new file mode 100644 index 0000000..613890b --- /dev/null +++ b/internal/model/batch_main.go @@ -0,0 +1,241 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// BatchMainUpdateFields 修改批次主表字段过滤 +type BatchMainUpdateFields struct { + BatchNo string `json:"batchNo" dc:"批次编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + BatchType int `json:"batchType" dc:"批次类型 枚举"` + BatchStatus int `json:"batchStatus" dc:"批次状态 枚举"` + SourceType int `json:"sourceType" dc:"来源方式 枚举"` + SourceBatchNo string `json:"sourceBatchNo" dc:"来源批次编号"` + IsCrossDept int `json:"isCrossDept" dc:"是否跨级操作机构 0-否 1-是"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标机构编号"` + DeptId int64 `json:"deptId" dc:"机构编号"` + TotalCount int `json:"totalCount" dc:"总数量"` + ValidCount int `json:"validCount" dc:"有效数量"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + RunResult int `json:"runResult" dc:"运行结果:0-待运行 1-运行中 2-成功 3-失败"` + FailReason string `json:"failReason" dc:"失败原因"` + BatchInfo *gjson.Json `json:"batchInfo" dc:"批次信息:入库/出库展示字段"` + Remark *gjson.Json `json:"remark" dc:"备注扩展字段"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// BatchMainInsertFields 新增批次主表字段过滤 +type BatchMainInsertFields struct { + BatchNo string `json:"batchNo" dc:"批次编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + BatchType int `json:"batchType" dc:"批次类型 枚举"` + BatchStatus int `json:"batchStatus" dc:"批次状态 枚举"` + SourceType int `json:"sourceType" dc:"来源方式 枚举"` + SourceBatchNo string `json:"sourceBatchNo" dc:"来源批次编号"` + IsCrossDept int `json:"isCrossDept" dc:"是否跨级操作机构 0-否 1-是"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标机构编号"` + DeptId int64 `json:"deptId" dc:"机构编号"` + TotalCount int `json:"totalCount" dc:"总数量"` + ValidCount int `json:"validCount" dc:"有效数量"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + RunResult int `json:"runResult" dc:"运行结果:0-待运行 1-运行中 2-成功 3-失败"` + FailReason string `json:"failReason" dc:"失败原因"` + BatchInfo *gjson.Json `json:"batchInfo" dc:"批次信息:入库/出库展示字段"` + Remark *gjson.Json `json:"remark" dc:"备注扩展字段"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// BatchMainEditParam 修改/新增批次主表 +type BatchMainEditParam struct { + //entity.BatchMain + Id int64 `json:"id" dc:"主键ID"` + BatchNo *string `json:"batchNo" dc:"批次编号"` + OrderSn *string `json:"orderSn" dc:"订单编号"` + BatchType *int `json:"batchType" dc:"批次类型 枚举"` + BatchStatus *int `json:"batchStatus" dc:"批次状态 枚举"` + SourceType *int `json:"sourceType" dc:"来源方式 枚举"` + SourceBatchNo *string `json:"sourceBatchNo" dc:"来源批次编号"` + IsCrossDept *int `json:"isCrossDept" dc:"是否跨级操作机构 0-否 1-是"` + TargetDeptId *int64 `json:"targetDeptId" dc:"目标机构编号"` + DeptId *int64 `json:"deptId" dc:"机构编号"` + TotalCount *int `json:"totalCount" dc:"总数量"` + ValidCount *int `json:"validCount" dc:"有效数量"` + SuccessCount *int `json:"successCount" dc:"成功数量"` + FailCount *int `json:"failCount" dc:"失败数量"` + RunResult *int `json:"runResult" dc:"运行结果:0-待运行 1-运行中 2-成功 3-失败"` + FailReason *string `json:"failReason" dc:"失败原因"` + BatchInfo *gjson.Json `json:"batchInfo" dc:"批次信息:入库/出库展示字段"` + Remark *gjson.Json `json:"remark" dc:"备注扩展字段"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy *int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *BatchMainEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type BatchMainEditModel struct{} + +// BatchMainDeleteParam 删除批次主表 +type BatchMainDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *BatchMainDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchMainDeleteModel struct{} + +type BatchMainRequeueParam struct { + BatchNo string `json:"batchNo" v:"required#批次编号不能为空" dc:"批次编号"` + Reason string `json:"reason" v:"required#重投原因不能为空" dc:"重投原因"` +} + +func (in *BatchMainRequeueParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchMainRequeueModel struct { + BatchNo string `json:"batchNo" dc:"批次编号"` + BatchType int `json:"batchType" dc:"批次类型"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态"` + RunResult int `json:"runResult" dc:"运行结果"` + Requeued bool `json:"requeued" dc:"是否已重投"` +} + +// BatchMainViewParam 获取指定批次主表信息 +type BatchMainViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *BatchMainViewParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchMainViewModel struct { + entity.BatchMain + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者ID摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者ID摘要信息"` +} + +// BatchMainListParam 获取批次主表列表 +type BatchMainListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + BatchNo string `json:"batchNo" dc:"批次编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + BatchType *int `json:"batchType" dc:"批次类型 枚举"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *BatchMainListParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchMainListModel struct { + BatchInfo *gjson.Json `json:"batchInfo" dc:"批次信息:入库/出库展示字段"` + Id int64 `json:"id" dc:"主键ID"` + BatchNo string `json:"batchNo" dc:"批次编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + BatchType int `json:"batchType" dc:"批次类型 枚举"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态 0=已创建 1=待处理 2=处理中 3=成功 4=失败 5=部分成功"` + SourceType int `json:"sourceType" dc:"来源方式 枚举"` + SourceBatchNo string `json:"sourceBatchNo" dc:"来源批次编号"` + IsCrossDept int `json:"isCrossDept" dc:"是否跨级操作机构 0-否 1-是"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标机构编号"` + DeptId int64 `json:"deptId" dc:"机构编号"` + TotalCount int `json:"totalCount" dc:"总数量"` + ValidCount int `json:"validCount" dc:"有效数量"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + RunResult int `json:"runResult" dc:"运行结果:0-待运行 1-运行中 2-成功 3-失败"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者ID摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者ID摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// BatchMainSuccessListParam 获取指定类型成功批次列表 +type BatchMainSuccessListParam struct { + request.PageInfo + BatchType int `json:"batchType" dc:"批次类型(不传则查询所有成功批次)"` + BatchNo string `json:"batchNo" dc:"批次编号"` + Time []*gtime.Time `json:"time" dc:"批次执行时间"` +} + +func (in *BatchMainSuccessListParam) Filter(ctx context.Context) (err error) { + return +} + +type BatchMainSuccessListModel struct { + BatchInfo *gjson.Json `json:"batchInfo" dc:"批次业务参数"` + BatchNo string `json:"batchNo" dc:"批次编号"` + BatchType int `json:"batchType" dc:"批次类型"` + BatchTime *gtime.Time `json:"batchTime" orm:"start_time" dc:"批次执行时间"` + TotalCount int `json:"totalCount" dc:"总数量"` +} + +// BatchMainExportModel 导出批次主表 +type BatchMainExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + BatchNo string `json:"batchNo" dc:"批次编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + BatchType int `json:"batchType" dc:"批次类型 枚举"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态 0=已创建 1=待处理 2=处理中 3=成功 4=失败 5=部分成功"` + SourceType int `json:"sourceType" dc:"来源方式 枚举"` + SourceBatchNo string `json:"sourceBatchNo" dc:"来源批次编号"` + IsCrossDept int `json:"isCrossDept" dc:"是否跨级操作机构 0-否 1-是"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标机构编号"` + DeptId int64 `json:"deptId" dc:"机构编号"` + TotalCount int `json:"totalCount" dc:"总数量"` + ValidCount int `json:"validCount" dc:"有效数量"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + RunResult int `json:"runResult" dc:"运行结果:0-待运行 1-运行中 2-成功 3-失败"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/bcache_model.go b/internal/model/bcache_model.go new file mode 100644 index 0000000..50fa7cd --- /dev/null +++ b/internal/model/bcache_model.go @@ -0,0 +1,15 @@ +package model + +// IotChannelStatusCache 资源通道表状态缓存 +type IotChannelStatusCache struct { + ChannelId int64 `json:"channelId"` + ConnectTime int64 `json:"connectTime"` // 连接时间戳(秒) +} + +// 数据库变动更新广播消息 obj{table_name,pk,type:add/edit/del,data:{}} +type BroadcastDbChgCache struct { + TableName string `json:"table_name"` // 表名 + PK []int64 `json:"pk"` // 主键 + Type string `json:"type"` // 类型:add/edit/del + Data map[string]interface{} `json:"data"` // 变动数据,只需要包含主要字段数据 +} diff --git a/internal/model/common.go b/internal/model/common.go new file mode 100644 index 0000000..951d631 --- /dev/null +++ b/internal/model/common.go @@ -0,0 +1,42 @@ +package model + +type CommonBatchExecuteMessage struct { + BatchNo string `json:"batchNo"` + BatchType int `json:"batchType"` +} + +type CommonRenewCard struct { + Iccid string `json:"iccid,omitempty" dc:"ICCID"` + Msisdn string `json:"msisdn,omitempty" dc:"MSISDN/卡号"` + Imsi string `json:"imsi,omitempty" dc:"IMSI"` + PackageId string `json:"packageId,omitempty" dc:"套餐编码"` +} + +type CommonRenewParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + Cards []CommonRenewCard `json:"cards" v:"required#续费卡不能为空" dc:"续费卡列表"` + DurationYears int `json:"durationYears" dc:"续费时长(年)"` + Remark string `json:"remark" dc:"续费备注"` + PackageId string `json:"packageId,omitempty" dc:"套餐编码"` + Validity int `json:"validity,omitempty" dc:"续费时长(年)"` +} + +type CommonRenewRes struct { + BatchNo string `json:"batchNo" dc:"系统生成批次号"` + BatchType int `json:"batchType" dc:"批次类型"` + Total int `json:"total" dc:"提交数量"` +} + +type CommonSingleRenewRes struct { + OrderId string `json:"orderId" dc:"订单ID"` + OrderSn string `json:"orderSn" dc:"订单号"` + Iccid string `json:"iccid" dc:"ICCID"` + PlanName string `json:"planName" dc:"套餐名称"` + EffectiveType string `json:"effectiveType" dc:"生效类型"` + EffectiveDate string `json:"effectiveDate" dc:"生效日期"` + ExpireDate string `json:"expireDate" dc:"到期日期"` + Amount float64 `json:"amount" dc:"续费金额"` + Status string `json:"status" dc:"续费状态"` + ErrorCode string `json:"errorCode,omitempty" dc:"错误编码"` + ErrorMessage string `json:"errorMessage,omitempty" dc:"错误说明"` +} diff --git a/internal/model/context.go b/internal/model/context.go new file mode 100644 index 0000000..2562215 --- /dev/null +++ b/internal/model/context.go @@ -0,0 +1,27 @@ +// package model +// @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 model + +import "github.com/gogf/gf/v2/frame/g" + +// 上下文结构 +type Context struct { + User *Identity // 上下文用户信息 + AgentUser *BaseClaimsApi // 上下文代理用户信息 + IsWebSocket bool // 是否是WebSocket + Data g.Map // 自定KV变量,业务模块根据需要设置,不固定 +} + +type Role struct { + RoleId int64 // 角色ID + DataScope string // 数据范围 +} + +// 通用身份模型 +type Identity struct { + BaseClaims + AccessCodeList []string // 访问码列表 +} diff --git a/internal/model/do/batch_detail.go b/internal/model/do/batch_detail.go new file mode 100644 index 0000000..92e4277 --- /dev/null +++ b/internal/model/do/batch_detail.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// BatchDetail is the golang structure of table batch_detail for DAO operations like Where/Data. +type BatchDetail struct { + g.Meta `orm:"table:batch_detail, do:true"` + Id any // 主键ID + BatchNo any // 批次编号 + BatchType any // 批次类型 枚举(与主表一致) + DetailStatus any // 明细异步处理状态 0-待处理 1-处理中 2-成功 3-失败 + BlankOutStatus any // 作废状态 0-是 1-否 + RowNo any // 行号 + ItemId any // 项ID:卡ICCID/设备编码 + ErrorCode any // 异常编码 + ErrorReason any // 异常原因 + Snapshot *gjson.Json // 信息快照 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/batch_main.go b/internal/model/do/batch_main.go new file mode 100644 index 0000000..4b3eb94 --- /dev/null +++ b/internal/model/do/batch_main.go @@ -0,0 +1,47 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// BatchMain is the golang structure of table batch_main for DAO operations like Where/Data. +type BatchMain struct { + g.Meta `orm:"table:batch_main, do:true"` + Id any // 主键ID + BatchNo any // 批次编号 + OrderSn any // 订单编号 + BatchType any // 批次类型 枚举 + BatchStatus any // 批次状态 枚举 + BatchAsyncStatus any // 异步处理状态 + SourceType any // 来源方式 枚举 + SourceBatchNo any // 来源批次编号 + SourceOssId any // 源文件OSS ID + ResultOssId any // 结果文件OSS ID + IsCrossDept any // 是否跨级操作机构 + TargetDeptId any // 目标机构编号 + DeptId any // 机构编号 + TotalCount any // 总数量 + ValidCount any // 有效数量 + SuccessCount any // 成功数量 + FailCount any // 失败数量 + RunResult any // 运行结果 + FailReason any // 失败原因 + BatchInfo *gjson.Json // 批次信息:入库/出库展示字段 + Remark *gjson.Json // 备注扩展字段 + StartTime *gtime.Time // 开始时间 + EndTime *gtime.Time // 结束时间 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 + SourceChannel any // 发起渠道:console/mini_program/api/system/legacy + ExecutionMode any // 操作规模:0未知1单卡2批量 +} diff --git a/internal/model/do/sys_client.go b/internal/model/do/sys_client.go new file mode 100644 index 0000000..3de69a9 --- /dev/null +++ b/internal/model/do/sys_client.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysClient is the golang structure of table sys_client for DAO operations like Where/Data. +type SysClient struct { + g.Meta `orm:"table:sys_client, do:true"` + Id any // id + ClientId any // 客户端id + ClientKey any // 客户端key + ClientSecret any // 客户端秘钥 + GrantType any // 授权类型 + DeviceType any // 设备类型 + ActiveTimeout any // token活跃超时时间 + Timeout any // token固定超时 + Status any // 状态(0正常 1停用) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_config.go b/internal/model/do/sys_config.go new file mode 100644 index 0000000..974c4e0 --- /dev/null +++ b/internal/model/do/sys_config.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysConfig is the golang structure of table sys_config for DAO operations like Where/Data. +type SysConfig struct { + g.Meta `orm:"table:sys_config, do:true"` + ConfigId any // 参数主键 + TenantId any // 租户编号 + ConfigName any // 参数名称 + ConfigKey any // 参数键名 + ConfigValue any // 参数键值 + ConfigType any // 系统内置(Y是 N否) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_dept.go b/internal/model/do/sys_dept.go new file mode 100644 index 0000000..afe65aa --- /dev/null +++ b/internal/model/do/sys_dept.go @@ -0,0 +1,39 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysDept is the golang structure of table sys_dept for DAO operations like Where/Data. +type SysDept struct { + g.Meta `orm:"table:sys_dept, do:true"` + DeptId any // 部门id + TenantId any // 租户编号 + ParentId any // 父部门id + Ancestors any // 祖级列表 + DeptKey any // 机构编号 + DeptName any // 部门名称 + DeptType any // 部门类型(0:部门 1:公司) + DeptCategory any // 部门类别编码 + OrderNum any // 显示顺序 + Leader any // 负责人 + Phone any // 联系电话 + Email any // 邮箱 + Status any // 部门状态(0正常 1停用) + CreditCode any // 统一社会信用代码 + AreaCode any // 行政区域代码 + Address any // 地址 + DeptRole any // 机构默认角色ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_dict_data.go b/internal/model/do/sys_dict_data.go new file mode 100644 index 0000000..de6d4c2 --- /dev/null +++ b/internal/model/do/sys_dict_data.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysDictData is the golang structure of table sys_dict_data for DAO operations like Where/Data. +type SysDictData struct { + g.Meta `orm:"table:sys_dict_data, do:true"` + DictCode any // 字典编码 + TenantId any // 租户编号 + DictSort any // 字典排序 + DictLabel any // 字典标签 + DictValue any // 字典键值 + DictType any // 字典类型 + CssClass any // 样式属性(其他样式扩展) + ListClass any // 表格回显样式 + IsDefault any // 是否默认(Y是 N否) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_dict_type.go b/internal/model/do/sys_dict_type.go new file mode 100644 index 0000000..5704713 --- /dev/null +++ b/internal/model/do/sys_dict_type.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysDictType is the golang structure of table sys_dict_type for DAO operations like Where/Data. +type SysDictType struct { + g.Meta `orm:"table:sys_dict_type, do:true"` + DictId any // 字典主键 + TenantId any // 租户编号 + DictName any // 字典名称 + DictType any // 字典类型 + IsSys any // 是否系统(0是 1否) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_gen_table.go b/internal/model/do/sys_gen_table.go new file mode 100644 index 0000000..fc30400 --- /dev/null +++ b/internal/model/do/sys_gen_table.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysGenTable is the golang structure of table sys_gen_table for DAO operations like Where/Data. +type SysGenTable struct { + g.Meta `orm:"table:sys_gen_table, do:true"` + TableId any // 生成ID + GenType any // 生成类型 + GenTemplate any // 生成模板 + VarName any // 实体命名 + Options any // 配置选项 + DbName any // 数据库名称 + TableName any // 主表名称 + TableComment any // 主表注释 + DaoName any // 主表dao模型 + MasterColumns any // 主表字段 + AddonName any // 插件名称 + Status any // 生成状态(0成功 1未开始) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/sys_job.go b/internal/model/do/sys_job.go new file mode 100644 index 0000000..dcce089 --- /dev/null +++ b/internal/model/do/sys_job.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysJob is the golang structure of table sys_job for DAO operations like Where/Data. +type SysJob struct { + g.Meta `orm:"table:sys_job, do:true"` + JobId any // 任务ID + JobName any // 任务名称 + JobParams any // 参数 + JobGroup any // 任务组名 + InvokeTarget any // 调用目标字符串 + CronExpression any // cron执行表达式 + MisfirePolicy any // 计划执行策略(1多次执行 2执行一次) + Concurrent any // 是否并发执行(0允许 1禁止) + Status any // 状态(0正常 1暂停) + Remark any // 备注信息 + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_logininfor.go b/internal/model/do/sys_logininfor.go new file mode 100644 index 0000000..dff7202 --- /dev/null +++ b/internal/model/do/sys_logininfor.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysLogininfor is the golang structure of table sys_logininfor for DAO operations like Where/Data. +type SysLogininfor struct { + g.Meta `orm:"table:sys_logininfor, do:true"` + InfoId any // 访问ID + TenantId any // 租户编号 + UserName any // 用户账号 + ClientKey any // 客户端 + DeviceType any // 设备类型 + Ipaddr any // 登录IP地址 + LoginLocation any // 登录地点 + Browser any // 浏览器类型 + Os any // 操作系统 + Status any // 登录状态(0成功 1失败) + Msg any // 提示消息 + LoginTime *gtime.Time // 访问时间 +} diff --git a/internal/model/do/sys_menu.go b/internal/model/do/sys_menu.go new file mode 100644 index 0000000..5248203 --- /dev/null +++ b/internal/model/do/sys_menu.go @@ -0,0 +1,37 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysMenu is the golang structure of table sys_menu for DAO operations like Where/Data. +type SysMenu struct { + g.Meta `orm:"table:sys_menu, do:true"` + MenuId any // 菜单ID + MenuName any // 菜单名称 + ParentId any // 父菜单ID + Level any // 关系树等级 + Tree any // 关系树 + OrderNum any // 显示顺序 + Path any // 路由地址 + Component any // 组件路径 + QueryParam any // 路由参数 + IsFrame any // 是否为外链(0是 1否) + IsCache any // 是否缓存(0缓存 1不缓存) + MenuType any // 菜单类型(M目录 C菜单 F按钮) + Visible any // 显示状态(0显示 1隐藏) + Status any // 菜单状态(0正常 1停用) + Perms any // 权限标识 + Icon any // 菜单图标 + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_notice.go b/internal/model/do/sys_notice.go new file mode 100644 index 0000000..470e773 --- /dev/null +++ b/internal/model/do/sys_notice.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysNotice is the golang structure of table sys_notice for DAO operations like Where/Data. +type SysNotice struct { + g.Meta `orm:"table:sys_notice, do:true"` + NoticeId any // 公告ID + TenantId any // 租户编号 + NoticeTitle any // 公告标题 + NoticeType any // 公告类型(1通知 2公告) + NoticeContent []byte // 公告内容 + Status any // 公告状态(0正常 1关闭) + NoticeRange any // 通知范围(1全员 2指定机构 3指定用户) + DeptIds any // 通知机构ID列表JSON + UserIds any // 通知用户ID列表JSON + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_notice_user.go b/internal/model/do/sys_notice_user.go new file mode 100644 index 0000000..0abaca2 --- /dev/null +++ b/internal/model/do/sys_notice_user.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysNoticeUser is the golang structure of table sys_notice_user for DAO operations like Where/Data. +type SysNoticeUser struct { + g.Meta `orm:"table:sys_notice_user, do:true"` + Id interface{} // ID + NoticeId interface{} // 公告ID + TenantId interface{} // 租户编号 + NoticeTitle interface{} // 公告标题 + NoticeType interface{} // 公告类型(1通知 2公告) + NoticeContent []byte // 公告内容 + Status interface{} // 公告状态(0正常 1关闭) + UserId interface{} // 用户ID + IsRead interface{} // 是否已读(0未读 1已读) + CreatedDept interface{} // 创建部门 + CreatedBy interface{} // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy interface{} // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark interface{} // 备注 +} diff --git a/internal/model/do/sys_oper_log.go b/internal/model/do/sys_oper_log.go new file mode 100644 index 0000000..7a6bacb --- /dev/null +++ b/internal/model/do/sys_oper_log.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysOperLog is the golang structure of table sys_oper_log for DAO operations like Where/Data. +type SysOperLog struct { + g.Meta `orm:"table:sys_oper_log, do:true"` + OperId any // 日志主键 + TenantId any // 租户编号 + Title any // 模块标题 + BusinessType any // 业务类型(0其它 1新增 2修改 3删除) + Method any // 方法名称 + RequestMethod any // 请求方式 + OperatorType any // 操作类别(0其它 1后台用户 2手机端用户) + OperName any // 操作人员 + DeptName any // 部门名称 + OperUrl any // 请求URL + OperIp any // 主机地址 + OperLocation any // 操作地点 + OperParam any // 请求参数 + JsonResult any // 返回参数 + Status any // 操作状态(0正常 1异常) + ErrorMsg any // 错误消息 + OperTime *gtime.Time // 操作时间 + CostTime any // 消耗时间 +} diff --git a/internal/model/do/sys_oss.go b/internal/model/do/sys_oss.go new file mode 100644 index 0000000..a5f05b4 --- /dev/null +++ b/internal/model/do/sys_oss.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysOss is the golang structure of table sys_oss for DAO operations like Where/Data. +type SysOss struct { + g.Meta `orm:"table:sys_oss, do:true"` + OssId any // 对象存储主键 + TenantId any // 租户编号 + FileName any // 文件名 + OriginalName any // 原名 + FileSuffix any // 文件后缀名 + Path any // 存储路径 + Url any // URL地址 + CreatedDept any // 创建部门 + CreatedAt *gtime.Time // 创建时间 + CreatedBy any // 创建者 + UpdatedAt *gtime.Time // 更新时间 + UpdatedBy any // 更新者 + Service any // 服务商 + Md5 any // 文件MD5 + FileSize any // 文件大小 + FileCrc16 any // 文件Crc16 + FileSum any // 文件校验和 +} diff --git a/internal/model/do/sys_oss_config.go b/internal/model/do/sys_oss_config.go new file mode 100644 index 0000000..d6f5bc5 --- /dev/null +++ b/internal/model/do/sys_oss_config.go @@ -0,0 +1,35 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysOssConfig is the golang structure of table sys_oss_config for DAO operations like Where/Data. +type SysOssConfig struct { + g.Meta `orm:"table:sys_oss_config, do:true"` + OssConfigId any // 主键 + TenantId any // 租户编号 + ConfigKey any // 配置key + AccessKey any // accessKey + SecretKey any // 秘钥 + BucketName any // 桶名称 + Prefix any // 前缀 + Endpoint any // 访问站点 + Domain any // 自定义域名 + IsHttps any // 是否https(Y=是,N=否) + Region any // 域 + AccessPolicy any // 桶权限类型(0=private 1=public 2=custom) + Status any // 是否默认(0=是,1=否) + Ext1 any // 扩展字段 + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_post.go b/internal/model/do/sys_post.go new file mode 100644 index 0000000..38ab5a0 --- /dev/null +++ b/internal/model/do/sys_post.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysPost is the golang structure of table sys_post for DAO operations like Where/Data. +type SysPost struct { + g.Meta `orm:"table:sys_post, do:true"` + PostId any // 岗位ID + TenantId any // 租户编号 + DeptId any // 部门id + PostCode any // 岗位编码 + PostCategory any // 岗位类别编码 + PostName any // 岗位名称 + PostSort any // 显示顺序 + Status any // 状态(0正常 1停用) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_role.go b/internal/model/do/sys_role.go new file mode 100644 index 0000000..5be85d1 --- /dev/null +++ b/internal/model/do/sys_role.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysRole is the golang structure of table sys_role for DAO operations like Where/Data. +type SysRole struct { + g.Meta `orm:"table:sys_role, do:true"` + RoleId any // 角色ID + TenantId any // 租户编号 + DeptId any // 部门机构id + RoleName any // 角色名称 + RoleKey any // 角色权限字符串 + RoleSort any // 显示顺序 + DataScope any // 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:仅本人数据权限 7:本组织及下一级数据权限 + MenuCheckStrictly any // 菜单树选择项是否关联显示 + DeptCheckStrictly any // 部门树选择项是否关联显示 + Status any // 角色状态(0正常 1停用) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_role_dept.go b/internal/model/do/sys_role_dept.go new file mode 100644 index 0000000..1634b9b --- /dev/null +++ b/internal/model/do/sys_role_dept.go @@ -0,0 +1,17 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +// SysRoleDept is the golang structure of table sys_role_dept for DAO operations like Where/Data. +type SysRoleDept struct { + g.Meta `orm:"table:sys_role_dept, do:true"` + TenantId any // 租户编号 + RoleId any // 角色ID + DeptId any // 部门ID +} diff --git a/internal/model/do/sys_role_menu.go b/internal/model/do/sys_role_menu.go new file mode 100644 index 0000000..bb22209 --- /dev/null +++ b/internal/model/do/sys_role_menu.go @@ -0,0 +1,18 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +// SysRoleMenu is the golang structure of table sys_role_menu for DAO operations like Where/Data. +type SysRoleMenu struct { + g.Meta `orm:"table:sys_role_menu, do:true"` + TenantId any // 租户编号 + RoleId any // 角色ID + MenuId any // 菜单ID + DataScope any // 数据范围(0按角色数据权限 1全部数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限) +} diff --git a/internal/model/do/sys_social.go b/internal/model/do/sys_social.go new file mode 100644 index 0000000..f23a4be --- /dev/null +++ b/internal/model/do/sys_social.go @@ -0,0 +1,45 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysSocial is the golang structure of table sys_social for DAO operations like Where/Data. +type SysSocial struct { + g.Meta `orm:"table:sys_social, do:true"` + Id any // 主键 + UserId any // 用户ID + TenantId any // 租户id + AuthId any // 平台+平台唯一id + Source any // 用户来源 + OpenId any // 平台编号唯一id + UserName any // 登录账号 + NickName any // 用户昵称 + Email any // 用户邮箱 + Avatar any // 头像地址 + AccessToken any // 用户的授权令牌 + ExpireIn any // 用户的授权令牌的有效期,部分平台可能没有 + RefreshToken any // 刷新令牌,部分平台可能没有 + AccessCode any // 平台的授权信息,部分平台可能没有 + UnionId any // 用户的 unionid + Scope any // 授予的权限,部分平台可能没有 + TokenType any // 个别平台的授权信息,部分平台可能没有 + IdToken any // id token,部分平台可能没有 + MacAlgorithm any // 小米平台用户的附带属性,部分平台可能没有 + MacKey any // 小米平台用户的附带属性,部分平台可能没有 + Code any // 用户的授权code,部分平台可能没有 + OauthToken any // Twitter平台用户的附带属性,部分平台可能没有 + OauthTokenSecret any // Twitter平台用户的附带属性,部分平台可能没有 + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_tenant.go b/internal/model/do/sys_tenant.go new file mode 100644 index 0000000..ca86011 --- /dev/null +++ b/internal/model/do/sys_tenant.go @@ -0,0 +1,39 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysTenant is the golang structure of table sys_tenant for DAO operations like Where/Data. +type SysTenant struct { + g.Meta `orm:"table:sys_tenant, do:true"` + Id any // id + TenantId any // 租户编号 + ContactUserName any // 联系人 + ContactPhone any // 联系电话 + CompanyName any // 企业名称 + LicenseNumber any // 统一社会信用代码 + Address any // 地址 + Intro any // 企业简介 + Domain any // 域名 + Remark any // 备注 + PackageId any // 租户套餐编号 + AdminRoleId any // 管理员角色ID + AdminDeptId any // 管理员部门ID + AdminUserId any // 管理员用户ID + ExpireTime *gtime.Time // 过期时间 + AccountCount any // 用户数量(-1不限制) + Status any // 租户状态(0正常 1停用) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_tenant_package.go b/internal/model/do/sys_tenant_package.go new file mode 100644 index 0000000..453b507 --- /dev/null +++ b/internal/model/do/sys_tenant_package.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysTenantPackage is the golang structure of table sys_tenant_package for DAO operations like Where/Data. +type SysTenantPackage struct { + g.Meta `orm:"table:sys_tenant_package, do:true"` + PackageId any // 租户套餐id + PackageName any // 套餐名称 + MenuIds any // 关联菜单id + Remark any // 备注 + MenuCheckStrictly any // 菜单树选择项是否关联显示 + Status any // 状态(0正常 1停用) + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_user.go b/internal/model/do/sys_user.go new file mode 100644 index 0000000..8f22347 --- /dev/null +++ b/internal/model/do/sys_user.go @@ -0,0 +1,39 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysUser is the golang structure of table sys_user for DAO operations like Where/Data. +type SysUser struct { + g.Meta `orm:"table:sys_user, do:true"` + UserId any // 用户ID + TenantId any // 租户编号 + DeptId any // 部门ID + UserName any // 用户账号 + NickName any // 用户昵称 + UserType any // 用户类型(sys_user系统用户) + Email any // 用户邮箱 + Phonenumber any // 手机号码 + Sex any // 用户性别(0男 1女 2未知) + Avatar any // 头像地址 + Salt any // 加密盐 + Password any // 密码 + Status any // 帐号状态(0正常 1停用) + LoginIp any // 最后登录IP + LoginDate *gtime.Time // 最后登录时间 + MfaEnabled any // 是否开启邮箱MFA 0否 1是 + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 + DeletedBy any // 删除人 + DeletedAt *gtime.Time // 删除时间 + Remark any // 备注 +} diff --git a/internal/model/do/sys_user_online.go b/internal/model/do/sys_user_online.go new file mode 100644 index 0000000..d6270f5 --- /dev/null +++ b/internal/model/do/sys_user_online.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysUserOnline is the golang structure of table sys_user_online for DAO operations like Where/Data. +type SysUserOnline struct { + g.Meta `orm:"table:sys_user_online, do:true"` + OnlineId any // 访问ID + TenantId any // 租户编号 + Uuid any // UUID + UserName any // 用户账号 + ClientKey any // 客户端 + DeviceType any // 设备类型 + Ipaddr any // 登录IP地址 + LoginLocation any // 登录地点 + Browser any // 浏览器类型 + Os any // 操作系统 + Token any // Token + LoginTime *gtime.Time // 访问时间 + ExpireTime *gtime.Time // 过期时间 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/do/sys_user_post.go b/internal/model/do/sys_user_post.go new file mode 100644 index 0000000..9ada55f --- /dev/null +++ b/internal/model/do/sys_user_post.go @@ -0,0 +1,17 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +// SysUserPost is the golang structure of table sys_user_post for DAO operations like Where/Data. +type SysUserPost struct { + g.Meta `orm:"table:sys_user_post, do:true"` + TenantId any // 租户编号 + UserId any // 用户ID + PostId any // 岗位ID +} diff --git a/internal/model/do/sys_user_role.go b/internal/model/do/sys_user_role.go new file mode 100644 index 0000000..9c29e9c --- /dev/null +++ b/internal/model/do/sys_user_role.go @@ -0,0 +1,17 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +// SysUserRole is the golang structure of table sys_user_role for DAO operations like Where/Data. +type SysUserRole struct { + g.Meta `orm:"table:sys_user_role, do:true"` + TenantId any // 租户编号 + UserId any // 用户ID + RoleId any // 角色ID +} diff --git a/internal/model/do/t_agent_balance.go b/internal/model/do/t_agent_balance.go new file mode 100644 index 0000000..4568fc7 --- /dev/null +++ b/internal/model/do/t_agent_balance.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TAgentBalance is the golang structure of table t_agent_balance for DAO operations like Where/Data. +type TAgentBalance struct { + g.Meta `orm:"table:t_agent_balance, do:true"` + Id any // 账户ID + DeptId any // 机构ID + Balance any // 账户余额 + WithdrawAmount any // 可提现金额 + WithdrawAmountStatus any // 可提现金额状态: 1-正常, 0-冻结 + InvoiceAmount any // 已开票金额 + CanInvoiceAmount any // 可开票金额 + CreditLimit any // 信用额度 + UsedCredit any // 已使用信用额度 + PendingRepayment any // 待还款金额 + Status any // 状态: 0-正常, 1-禁用 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_agent_enterprise.go b/internal/model/do/t_agent_enterprise.go new file mode 100644 index 0000000..b159855 --- /dev/null +++ b/internal/model/do/t_agent_enterprise.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TAgentEnterprise is the golang structure of table t_agent_enterprise for DAO operations like Where/Data. +type TAgentEnterprise struct { + g.Meta `orm:"table:t_agent_enterprise, do:true"` + Id any // 主键ID + DeptId any // 部门机构id + FullName any // 单位全称 + Industry any // 行业 + LegalPersonName any // 法人名称 + LegalPersonIdCard any // 法人身份证号 + CompanyType any // 单位类型 + EstablishTime *gtime.Time // 单位成立时间 + BankName any // 开户行名称 + BankAccount any // 开户行账号 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_api.go b/internal/model/do/t_api.go new file mode 100644 index 0000000..f59cfac --- /dev/null +++ b/internal/model/do/t_api.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TApi is the golang structure of table t_api for DAO operations like Where/Data. +type TApi struct { + g.Meta `orm:"table:t_api, do:true"` + Id any // ID + AppKey any // APPKey + AppSecret any // APPSecret + GroupId any // 权限组ID + Status any // 状态:0启用,1停用 + RateLimitPeriod any // 限流周期(秒,0:不限流) + RateLimitCount any // 限流次数 + DeptId any // 所属机构 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_api_group.go b/internal/model/do/t_api_group.go new file mode 100644 index 0000000..a461549 --- /dev/null +++ b/internal/model/do/t_api_group.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TApiGroup is the golang structure of table t_api_group for DAO operations like Where/Data. +type TApiGroup struct { + g.Meta `orm:"table:t_api_group, do:true"` + Id any // 主键ID + GroupName any // 权限组名称 + GroupCode any // 权限组编码 + Status any // 状态:0启用,1停用 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_api_group_resource.go b/internal/model/do/t_api_group_resource.go new file mode 100644 index 0000000..f32ec88 --- /dev/null +++ b/internal/model/do/t_api_group_resource.go @@ -0,0 +1,16 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +// TApiGroupResource is the golang structure of table t_api_group_resource for DAO operations like Where/Data. +type TApiGroupResource struct { + g.Meta `orm:"table:t_api_group_resource, do:true"` + GroupId any // 权限组ID,对应t_api_group.id + ApiId any // 开放接口资源ID,对应t_api_resource.id +} diff --git a/internal/model/do/t_api_resource.go b/internal/model/do/t_api_resource.go new file mode 100644 index 0000000..98d349d --- /dev/null +++ b/internal/model/do/t_api_resource.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TApiResource is the golang structure of table t_api_resource for DAO operations like Where/Data. +type TApiResource struct { + g.Meta `orm:"table:t_api_resource, do:true"` + Id any // 主键ID + ApiName any // 接口名称 + ApiCode any // 接口权限标识 + Method any // 请求方法:GET/POST/PUT/DELETE + Path any // 接口路径 + Status any // 状态:0启用,1停用 + Version any // 接口版本 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_balance_detail.go b/internal/model/do/t_balance_detail.go new file mode 100644 index 0000000..0a92674 --- /dev/null +++ b/internal/model/do/t_balance_detail.go @@ -0,0 +1,34 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TBalanceDetail is the golang structure of table t_balance_detail for DAO operations like Where/Data. +type TBalanceDetail struct { + g.Meta `orm:"table:t_balance_detail, do:true"` + Id any // 明细ID + DeptId any // 账户ID + SerialNo any // 流水号 + TransactionTime *gtime.Time // 交易时间 + IncomeExpenseType any // 收支类型: 0收入,1支出 + TransactionType any // 交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整 + TransactionChannel any // 交易渠道:1支付宝 2微信 3可提现金额 + Amount any // 交易金额 + BeforeBalance any // 变动前余额 + BalanceAfter any // 变动后余额 + ChannelSerialNo any // 交易渠道流水号 + OrderSn any // 关联订单号 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_consume_account_month_bill.go b/internal/model/do/t_consume_account_month_bill.go new file mode 100644 index 0000000..ca13620 --- /dev/null +++ b/internal/model/do/t_consume_account_month_bill.go @@ -0,0 +1,43 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TConsumeAccountMonthBill is the golang structure of table t_consume_account_month_bill for DAO operations like Where/Data. +type TConsumeAccountMonthBill struct { + g.Meta `orm:"table:t_consume_account_month_bill, do:true"` + Id any // 账单ID + DeptId any // 机构ID + AccountPeriod any // 账期YYYY-MM + OpeningBalance any // 月初余额 + RechargeIncome any // 充值收入 + WithdrawableTransferInIncome any // 可提现转入收入 + ManualAdjustIncome any // 人工调账收入 + RefundIncome any // 退款收入 + ConsumeExpense any // 平台消费支出 + BalanceTransferOutExpense any // 转可提现支出 + ManualAdjustExpense any // 人工调账支出 + ConsumeCreditRepayExpense any // 消费账户还款支出 + TotalIncome any // 本月收入总额 + TotalExpense any // 本月支出总额 + ClosingBalance any // 月末余额(月初余额+本月收入-本月支出) + IncomeCount any // 收入笔数 + ExpenseCount any // 支出笔数 + CreditUsed any // 本月使用信用额度 + CreditRepaid any // 本月还款信用额度 + BillStatus any // 账单状态:1正常,2已调整,3已作废 + SettleTime *gtime.Time // 结算时间 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_credit_detail.go b/internal/model/do/t_credit_detail.go new file mode 100644 index 0000000..f788378 --- /dev/null +++ b/internal/model/do/t_credit_detail.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TCreditDetail is the golang structure of table t_credit_detail for DAO operations like Where/Data. +type TCreditDetail struct { + g.Meta `orm:"table:t_credit_detail, do:true"` + Id any // 明细ID + DeptId any // 组织机构ID + AccountPeriod any // 账期(YYYY-MM) + TransactionType any // 交易类型: 使用/还款 + Amount any // 金额 + CreditBalanceBefore any // 变动前信用额度余额 + CreditBalanceAfter any // 变动后信用额度余额 + RelatedOrderSn any // 关联订单号 + RepaymentMethod any // 还款方式: 0 余额 1 银行卡 2 支付宝 3 微信 + RepaymentChannelSerial any // 交易渠道流水号 + TransactionTime *gtime.Time // 交易时间 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_cust_withdraw_account.go b/internal/model/do/t_cust_withdraw_account.go new file mode 100644 index 0000000..6c2b3b1 --- /dev/null +++ b/internal/model/do/t_cust_withdraw_account.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TCustWithdrawAccount is the golang structure of table t_cust_withdraw_account for DAO operations like Where/Data. +type TCustWithdrawAccount struct { + g.Meta `orm:"table:t_cust_withdraw_account, do:true"` + Id any // 主键ID + DeptId any // 企业客户ID + AccountType any // 提现账号类型,1:支付宝,2:微信 + AccountNo any // 账号 + AccountName any // 账户名称/真实姓名 + Mobile any // 手机号 + IsDefault any // 是否默认账号:0-否 1-是 + Enabled any // 是否启用:0-未启用 1-启用 + Status any // 状态:0-禁用 1-正常 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_dept_flow_daily.go b/internal/model/do/t_dept_flow_daily.go new file mode 100644 index 0000000..5dd763a --- /dev/null +++ b/internal/model/do/t_dept_flow_daily.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TDeptFlowDaily is the golang structure of table t_dept_flow_daily for DAO operations like Where/Data. +type TDeptFlowDaily struct { + g.Meta `orm:"table:t_dept_flow_daily, do:true"` + Id any // 自增主键 + DeptId any // 渠道客户ID + StatDate *gtime.Time // 统计日期 + TotalUsedFlowMb any // 当日所有卡总消耗流量MB + TotalSms any // 当日总短信使用条数 + TotalVoiceMin any // 当日总语音分钟数 + Remark any // 备注,同步失败原因/特殊说明 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_division_code.go b/internal/model/do/t_division_code.go new file mode 100644 index 0000000..6860092 --- /dev/null +++ b/internal/model/do/t_division_code.go @@ -0,0 +1,20 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" +) + +// TDivisionCode is the golang structure of table t_division_code for DAO operations like Where/Data. +type TDivisionCode struct { + g.Meta `orm:"table:t_division_code, do:true"` + RegionId any // ID + RegionCode any // 行政区域代码 + RegionName any // 行政区域名称 + RegionLevel any // 等级 + RegionParent any // 上级代码 + RegionType any // 城乡分类代码 +} diff --git a/internal/model/do/t_fin_commission_detail.go b/internal/model/do/t_fin_commission_detail.go new file mode 100644 index 0000000..560b573 --- /dev/null +++ b/internal/model/do/t_fin_commission_detail.go @@ -0,0 +1,35 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinCommissionDetail is the golang structure of table t_fin_commission_detail for DAO operations like Where/Data. +type TFinCommissionDetail struct { + g.Meta `orm:"table:t_fin_commission_detail, do:true"` + Id any // 主键ID + CommissionNo any // 分润明细编号 + OrderSn any // 订单编号 + OrderType any // 订单类型 + ProductId any // 商品ID + PayerDeptId any // 下级机构ID + BenefitDeptId any // 受益机构ID + BenefitDeptLevel any // 受益机构层级 + CommissionAmount any // 分润金额 + CommissionStatus any // 分润状态:0待结算,1可提现 + BenefitSnapshot *gjson.Json // 价格快照(受益机构的成本价+利润+利润悉数=出货单价) + AccountPeriod any // 账期(YYYY-MM) + SettlementTime *gtime.Time // 结算时间 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_fin_withdrawable_change.go b/internal/model/do/t_fin_withdrawable_change.go new file mode 100644 index 0000000..8adb17f --- /dev/null +++ b/internal/model/do/t_fin_withdrawable_change.go @@ -0,0 +1,36 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinWithdrawableChange is the golang structure of table t_fin_withdrawable_change for DAO operations like Where/Data. +type TFinWithdrawableChange struct { + g.Meta `orm:"table:t_fin_withdrawable_change, do:true"` + Id any // 主键ID + DeptId any // 机构ID + ChangeType any // 变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款 + IncomeExpenseType any // 收支类型: 0收入,1支出 + ChangeAmount any // 变动金额 + BeforeBalance any // 变动前可提现余额 + AfterBalance any // 变动后可提现余额 + AccountType any // 提现账号类型,1:银行卡,2:支付宝,3:微信 + BankName any // 开户行名称 + BankAccount any // 开户行账号或账号 + AccountName any // 用户姓名 + IdentityCard any // 用户身份证号 + SourceNo any // 来源单号 + Remark any // 备注 + AccountPeriod any // 账期(YYYY-MM) + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_finance_apply.go b/internal/model/do/t_finance_apply.go new file mode 100644 index 0000000..ffe1e86 --- /dev/null +++ b/internal/model/do/t_finance_apply.go @@ -0,0 +1,40 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinanceApply is the golang structure of table t_finance_apply for DAO operations like Where/Data. +type TFinanceApply struct { + g.Meta `orm:"table:t_finance_apply, do:true"` + Id any // 主键ID + ApplyNo any // 申请单号 + ApplyType any // 申请类型(1:提现申请,2:余额转提现) + AuditType any // 审核类型:1初审,2复审 + ApplyDeptId any // 申请机构ID + AuditDeptId any // 审核方机构ID,通常为直属上级或顶级 + AvailableAmountSnapshot any // 申请前可提现余额快照 + ApplyAmount any // 申请金额 + AccountType any // 提现账号类型,1:银行卡,2:支付宝,3:微信 + BankName any // 开户行名称 + BankAccount any // 开户行账号或账号 + AccountName any // 用户姓名 + IdentityCard any // 用户身份证号 + ReceiveAccount *gjson.Json // 收款账户信息快照 + ApplyStatus any // 状态:0待审核,1已通过,2已驳回,3已打款,4已取消 + ApplyTime *gtime.Time // 申请时间 + AuditTime *gtime.Time // 最近审核时间 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_finance_audit_record.go b/internal/model/do/t_finance_audit_record.go new file mode 100644 index 0000000..38f3216 --- /dev/null +++ b/internal/model/do/t_finance_audit_record.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinanceAuditRecord is the golang structure of table t_finance_audit_record for DAO operations like Where/Data. +type TFinanceAuditRecord struct { + g.Meta `orm:"table:t_finance_audit_record, do:true"` + Id any // 主键ID + AuditNo any // 审核记录编号 + ApplyNo any // 申请单号 + AuditDeptId any // 审核方机构ID + AuditorUserId any // 审核人ID + AuditResult any // 审核结果:0通过,1驳回 + AuditOpinion any // 审核意见 + AuditTime *gtime.Time // 审核时间 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_order.go b/internal/model/do/t_order.go new file mode 100644 index 0000000..58a5354 --- /dev/null +++ b/internal/model/do/t_order.go @@ -0,0 +1,68 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TOrder is the golang structure of table t_order for DAO operations like Where/Data. +type TOrder struct { + g.Meta `orm:"table:t_order, do:true"` + Id any // 主键ID + OrderSn any // 订单编号 + ParentOrderId any // 父订单ID + ParentOrderSn any // 父订单编号 + CustomerType any // 客户类型 枚举 + CustomerAgentId any // 渠道编号(购买方) + EndUserId any // 终端客户编号 + AgentId any // 渠道编号(销售方) + OrderType any // 订单类型 枚举 + OrderStatus any // 订单状态 枚举 + ShippingStatus any // 配送状态 枚举 + ReturnStatus any // 退货状态 枚举 + Consignee any // 收货人姓名 + Mobile any // 收货人手机 + Email any // 收货人邮箱 + Address any // 详细地址 + AreaCode any // 行政区域代码 + BuyerNote any // 买家备注 + AdminNote any // 商家备注 + Remark any // 系统备注 + ShippingMethod any // 发货方式 枚举 + LogisticsId any // 快递公司ID + LogisticsName any // 物流公司名称 + ShippingTypeId any // 配送类型ID + ShippingTypeName any // 配送类型名称 + TrackingNo any // 物流单号 + ShippingTime *gtime.Time // 发货时间 + ReceivedTime *gtime.Time // 收货时间 + PayType any // 支付类型 枚举 + PayStatus any // 支付状态 枚举 + PayOrderSn any // 支付订单编号 + PayTime *gtime.Time // 支付时间 + TotalAmount any // 订单总金额 + ProductAmount any // 商品总金额 + ShippingFee any // 运费金额 + ServiceFee any // 服务费金额 + InvoiceFee any // 发票费金额 + CouponAmount any // 优惠券抵扣金额 + DiscountAmount any // 活动优惠金额 + Balance any // 余额抵扣金额 + PaidAmount any // 已支付总金额 + OnlinePaidAmount any // 线上支付金额 + OfflinePaidAmount any // 线下支付金额 + UnpaidAmount any // 未支付金额 + UnrefundAmount any // 未退款金额 + IsNeedCommission any // 是否需要分佣 枚举:yesno_enum + DistributionStatus any // 分销分成状态 枚举 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_order_item.go b/internal/model/do/t_order_item.go new file mode 100644 index 0000000..9dcf0fc --- /dev/null +++ b/internal/model/do/t_order_item.go @@ -0,0 +1,47 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TOrderItem is the golang structure of table t_order_item for DAO operations like Where/Data. +type TOrderItem struct { + g.Meta `orm:"table:t_order_item, do:true"` + ItemId any // 订单商品信息自增id + OrderId any // 订单ID + OrderSn any // 订单编号 + CustomerType any // 客户类型 枚举 + CustomerAgentId any // 渠道编号(购买方) + EndUserId any // 客户编号 + Price any // 商品最终单价 + Quantity any // 商品的购买数量 + ProductId any // 商品ID + ProductName any // 商品的名称 + ProductSn any // 商品的唯一货号 + PicThumb any // 商品缩略图 + SkuId any // 规格ID + SkuData any // 【JSON】sku信息[{sku_id,sku_value,sku_name}] + DeliveryQuantity any // 发货数量 + ProductType any // 商品类型 枚举 + IsGift any // 是否为赠品 枚举:yesno_enum + AgentId any // 渠道编号(销售方) + PrepayPrice any // 预售价格 + Commission any // 佣金数据 + OriginPrice any // 商品初始价格 + PromotionData any // 优惠信息 + ExtraSkuData any // 附加属性 + PayMode any // 付费方式 枚举 + ServiceBeginTime *gtime.Time // 服务开始时间 + ServiceEndTime *gtime.Time // 服务结束时间 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_package_customer.go b/internal/model/do/t_package_customer.go new file mode 100644 index 0000000..50e427f --- /dev/null +++ b/internal/model/do/t_package_customer.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TPackageCustomer is the golang structure of table t_package_customer for DAO operations like Where/Data. +type TPackageCustomer struct { + g.Meta `orm:"table:t_package_customer, do:true"` + Id any // 主键ID + PackageCode any // 套餐编码 + PackageName any // 套餐名称 + DeptId any // 组织客户ID + DeptName any // 组织客户名称 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_profit_account_month_bill.go b/internal/model/do/t_profit_account_month_bill.go new file mode 100644 index 0000000..5f81bff --- /dev/null +++ b/internal/model/do/t_profit_account_month_bill.go @@ -0,0 +1,39 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TProfitAccountMonthBill is the golang structure of table t_profit_account_month_bill for DAO operations like Where/Data. +type TProfitAccountMonthBill struct { + g.Meta `orm:"table:t_profit_account_month_bill, do:true"` + Id any // 账单ID + DeptId any // 机构ID + AccountPeriod any // 账期YYYY-MM + OpeningBalance any // 月初余额 + CommissionIncome any // 分润收入 + BalanceTransferInIncome any // 余额转提现收入 + WithdrawalExpense any // 提现支出 + WithdrawableTransferOutExpense any // 可提现转余额支出 + ProfitCreditRepayExpense any // 盈利账户还款支出 + TotalIncome any // 本月收入总额 + TotalExpense any // 本月支出总额 + ClosingBalance any // 月末余额(月初余额+本月收入-本月支出) + IncomeCount any // 收入笔数 + ExpenseCount any // 支出笔数 + BillStatus any // 账单状态:1正常,2已调整,3已作废 + SettleTime *gtime.Time // 结算时间 + SettleBy any // 结算人ID + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_resource_batch_download.go b/internal/model/do/t_resource_batch_download.go new file mode 100644 index 0000000..1478714 --- /dev/null +++ b/internal/model/do/t_resource_batch_download.go @@ -0,0 +1,48 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TResourceBatchDownload is the golang structure of table t_resource_batch_download for DAO operations like Where/Data. +type TResourceBatchDownload struct { + g.Meta `orm:"table:t_resource_batch_download, do:true"` + Id any // 主键ID + BatchNo any // 批次编号(全局唯一) + TaskName any // 任务名称 + ResourceType any // 资源类型 枚举 + ExportScene any // 导出场景 枚举 + QueryParams *gjson.Json // 导出查询条件快照 + TotalCount any // 预计导出总条数 + SuccessCount any // 已成功导出条数 + FailCount any // 失败条数 + DownloadStatus any // 下载状态 枚举 + OssId any // OSS文件ID + FileName any // 导出文件名 + FileExt any // 文件扩展名 + FileUrl any // 文件访问地址 + FilePath any // 服务器本地路径 + FileSize any // 文件大小(字节) + FileMd5 any // 文件MD5 + DownloadCount any // 下载次数 + LastDownloadTime *gtime.Time // 最后下载时间 + MaxDownloadCount any // 最大下载次数限制 + ErrorMessage any // 失败原因 + DeptId any // 所属机构ID + StartTime *gtime.Time // 任务开始时间 + FinishTime *gtime.Time // 任务完成时间 + ExpireTime *gtime.Time // 文件过期时间 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_bind_package_logs.go b/internal/model/do/t_sim_bind_package_logs.go new file mode 100644 index 0000000..e7efe0e --- /dev/null +++ b/internal/model/do/t_sim_bind_package_logs.go @@ -0,0 +1,40 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimBindPackageLogs is the golang structure of table t_sim_bind_package_logs for DAO operations like Where/Data. +type TSimBindPackageLogs struct { + g.Meta `orm:"table:t_sim_bind_package_logs, do:true"` + Id any // 主键ID + SubscriptionNo any // 订购记录编号 + BatchNo any // 批次编号 + Iccid any // ICCID + Msisdn any // MSISDN/卡号 + DeptId any // 部门机构编号 + PackageType any // 套餐类型 + PackageCode any // 套餐编号 + PreviousPackageCode any // 变更前套餐编号 + BusinessType any // 类型 枚举 + EffectiveStatus any // 订购状态 枚举 + HandleTime *gtime.Time // 办理时间 + EffectiveTime *gtime.Time // 生效时间 + ExpectedExpireTime *gtime.Time // 预计到期时间 + ActualExpireTime *gtime.Time // 实际到期时间 + DurationMonths any // 套餐时长(月) + GiftDurationMonths any // 赠送时长(月) + OrderCode any // 订单编号 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_card_bind_pkg.go b/internal/model/do/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..773baa8 --- /dev/null +++ b/internal/model/do/t_sim_card_bind_pkg.go @@ -0,0 +1,40 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardBindPkg is the golang structure of table t_sim_card_bind_pkg for DAO operations like Where/Data. +type TSimCardBindPkg struct { + g.Meta `orm:"table:t_sim_card_bind_pkg, do:true"` + Id any // 主键ID + SubscriptionNo any // 订购记录编号 + BatchNo any // 批次编号 + Iccid any // ICCID + Msisdn any // MSISDN/卡号 + DeptId any // 部门机构编号 + PackageType any // 套餐类型 + PackageCode any // 套餐编号 + PreviousPackageCode any // 变更前套餐编号 + BusinessType any // 类型 枚举 + EffectiveStatus any // 订购状态 枚举 + HandleTime *gtime.Time // 办理时间 + EffectiveTime *gtime.Time // 生效时间 + ExpectedExpireTime *gtime.Time // 预计到期时间 + ActualExpireTime *gtime.Time // 实际到期时间 + DurationMonths any // 套餐时长(月) + GiftDurationMonths any // 赠送时长(月) + OrderCode any // 订单编号 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_card_info.go b/internal/model/do/t_sim_card_info.go new file mode 100644 index 0000000..05423e4 --- /dev/null +++ b/internal/model/do/t_sim_card_info.go @@ -0,0 +1,71 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardInfo is the golang structure of table t_sim_card_info for DAO operations like Where/Data. +type TSimCardInfo struct { + g.Meta `orm:"table:t_sim_card_info, do:true"` + Id any // 主键ID + Iccid any // ICCID + Msisdn any // MSISDN/卡号 + Imsi any // IMSI + Imei any // IMEI + RegionCode any // 归属地 + DeptId any // 渠道客户ID + CurrentPackageCode any // 当前套餐编号 + PackageStatus any // 套餐状态:0 无套餐,1待生效,2生效中,3已过期 + AccessType any // 接入方式:ipv4、ipv6、ipv4_ipv6 + BossCardStatus any // 运营商卡状态 枚举 + CardType any // 卡类型 枚举 + BossOpenAt *gtime.Time // 运营商开户日期 + BossActivateAt *gtime.Time // 运营商激活日期 + IsBossActivateEnabled any // 是否按运营商激活减去赠送时长方:1是,0否 + InboundBatchNo any // 入库批次 + OutboundBatchNo any // 出库批次 + AllocationBatchNo any // 划拨批次 + IsFlowPool any // 是否为池卡:1是,0否 + FlowPoolCode any // 流量池编号 + OutStockTime *gtime.Time // 出库时间 + FlowPkgBeginAt *gtime.Time // 当前套餐生效时间 + FlowPkgPresentAt *gtime.Time // 套餐赠送结束时间 + FlowPkgRealPresentAt *gtime.Time // 实际赠送结束时间 + FlowPkgEndAt *gtime.Time // 当前套餐预计到期时间 + DataServiceStatus any // 数据服务状态:1启用、0禁用 + PackageTotalFlowMb any // 套餐总流量MB + UsedFlowMb any // 已用流量MB + TrafficCutoffStatus any // 达量断网配置状态:0未配置,1已开启,2已关闭 + TrafficCutoffThreshold any // 达量断网阈值 + SmsServiceStatus any // 短信服务状态:1启用、0禁用 + PackageTotalSms any // 套餐短信总条数 + UsedSms any // 已用短信条数 + VoiceServiceStatus any // 语音服务状态:1启用、0禁用 + PackageTotalVoice any // 套餐语音总分钟数 + UsedVoice any // 已用语音分钟数 + RoamServiceStatus any // 国漫服务状态:1启用、0禁用 + PackageTotalRoamFlowMb any // 套餐国际流量MB + UsedRoamFlowMb any // 已用国际流量MB + StatusSyncTime *gtime.Time // 状态最后一次同步时间 + FlowSyncTime *gtime.Time // 流量最后一次同步时间 + SmsSyncTime *gtime.Time // 短信最后一次同步时间 + VoiceSyncTime *gtime.Time // 语音最后一次同步时间 + RoamSyncTime *gtime.Time // 国漫最后一次同步时间 + ExtraFeeEnabled any // 是否收取附加费:1是,0否 + ExtraFeeMultiple any // 附加费用倍数 + ExtraFee any // 附加金额 + ChanKey any // 通道编号 + NetModel any // 网络类型:4G、5G、NB-IoT + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_card_stock.go b/internal/model/do/t_sim_card_stock.go new file mode 100644 index 0000000..9188eca --- /dev/null +++ b/internal/model/do/t_sim_card_stock.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardStock is the golang structure of table t_sim_card_stock for DAO operations like Where/Data. +type TSimCardStock struct { + g.Meta `orm:"table:t_sim_card_stock, do:true"` + Id any // 主键ID + BatchNo any // + Iccid any // ICCID + Msisdn any // MSISDN + Imsi any // IMSI + Imei any // IMEI + ChanKey any // 通道编号 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_channel_template.go b/internal/model/do/t_sim_channel_template.go new file mode 100644 index 0000000..efd5849 --- /dev/null +++ b/internal/model/do/t_sim_channel_template.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimChannelTemplate is the golang structure of table t_sim_channel_template for DAO operations like Where/Data. +type TSimChannelTemplate struct { + g.Meta `orm:"table:t_sim_channel_template, do:true"` + Id any // ID + TempKey any // 模板标识 + TempName any // 模板名称 + TempModel any // 模板模型 + TempConfig any // 模板配置 + TempStatus any // 模板状态(0未启用,1启用) + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_channels.go b/internal/model/do/t_sim_channels.go new file mode 100644 index 0000000..6456d4e --- /dev/null +++ b/internal/model/do/t_sim_channels.go @@ -0,0 +1,39 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimChannels is the golang structure of table t_sim_channels for DAO operations like Where/Data. +type TSimChannels struct { + g.Meta `orm:"table:t_sim_channels, do:true"` + Id any // ID + TempKey any // 模板标识 + ChanKey any // 通道编号 + ChanName any // 通道名称 + ChanConfig any // 通道配置 + ChanStatus any // 通道状态(0启用,1停用) + ChanAlias any // 通道别名 + RegionCode any // 通道行政区域代码(省市) + AppKey any // 应用标识 + AppSecret any // 应用密钥 + AccessToken any // 接口调用凭证 + AccessTokenCreated *gtime.Time // 凭证申请时间 + AccessTokenExpire *gtime.Time // 凭证过期时间 + RefreshToken any // 刷新凭证 + Remark any // 备注 + LoginUser any // 登录账号 + LoginPassword any // 登录密码 + LoginUrl any // 登录地址 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_flow_package_info.go b/internal/model/do/t_sim_flow_package_info.go new file mode 100644 index 0000000..362a770 --- /dev/null +++ b/internal/model/do/t_sim_flow_package_info.go @@ -0,0 +1,49 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPackageInfo is the golang structure of table t_sim_flow_package_info for DAO operations like Where/Data. +type TSimFlowPackageInfo struct { + g.Meta `orm:"table:t_sim_flow_package_info, do:true"` + Id any // 主键ID + PackageCode any // 套餐编码 + CategoryCode any // 套餐分类编码 + PoolPackageCode any // 池套餐编码 + PackageName any // 套餐名称 + PackageType any // 套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包 + BillingMethod any // 计费方式 + SortNo any // 排序号 + FlowMb any // 套餐流量(MB) + FlowGb any // 套餐流量(GB) + Enabled any // 是否启用:0-否 1-是(yesno_enum) + ListPrice any // 目录售价 + CostPrice any // 成本价 + SysDefaultProfit any // 系统默认利润 + SysDefaultRatio any // 系统默认系数 + TerminalCost any // 终端成本 + SysDefaultTerminalProfit any // 系统默认终端利润 + SysDefaultTerminalRatio any // 系统默认终端系数 + RenewableDurationConfig *gjson.Json // 可续费时长配置:[1,2,3] + DiscountRateConfig *gjson.Json // 折扣率配置:{"duration":1,"rate":100} + RenewablePackageCodes *gjson.Json // 可续费套餐编码列表 + ChangeablePackageCodes *gjson.Json // 可变更套餐编码列表 + TopupPackageCodes *gjson.Json // 可订购加油包套餐编码列表 + IsAutoRenew any // 是否自动续费:0-否 1-是 + AutoRenewPackageId any // 自动续费套餐ID + AutoRenewYears any // 自动续费年限 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_flow_package_price.go b/internal/model/do/t_sim_flow_package_price.go new file mode 100644 index 0000000..5a7f012 --- /dev/null +++ b/internal/model/do/t_sim_flow_package_price.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPackagePrice is the golang structure of table t_sim_flow_package_price for DAO operations like Where/Data. +type TSimFlowPackagePrice struct { + g.Meta `orm:"table:t_sim_flow_package_price, do:true"` + Id any // 主键ID + PackageCode any // 套餐编码 + AgentScopeType any // 渠道适用类型:0-所有客户 1-指定客户 + TargetAgentId any // 指定渠道客户ID + DeptId any // 机构编号 + AgentCostRatio any // 渠道成本系数 + AgentCostProfit any // 渠道成本利润 + UserCostRatio any // 终端用户成本系数 + UserCostProfit any // 终端用户成本利润 + Enabled any // 是否启用:0-否 1-是(yesno_enum) + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门ID + CreatedBy any // 创建者ID + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者ID + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_flow_pool.go b/internal/model/do/t_sim_flow_pool.go new file mode 100644 index 0000000..f9efa96 --- /dev/null +++ b/internal/model/do/t_sim_flow_pool.go @@ -0,0 +1,36 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPool is the golang structure of table t_sim_flow_pool for DAO operations like Where/Data. +type TSimFlowPool struct { + g.Meta `orm:"table:t_sim_flow_pool, do:true"` + Id any // 主键ID + FlowPoolCode any // 流量池编号 + DeptId any // 客户编号 + PackageCodes *gjson.Json // 套餐编号列表(冗余) + PoolPackageCode any // 池套餐编码 + CardCount any // 关联卡数量 + CardFlowMb any // 套餐卡流量MB + PoolPackageFlowMb any // 套内总流量MB + AddOnFlowMb any // 加油包总流量MB + TotalFlowMb any // 总流量MB(套内+加油包) + UsedFlowMb any // 已使用流量MB + RemainFlowMb any // 剩余流量MB + PoolStatus any // 状态:0 正常、1 停用、2 锁定 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_package_category.go b/internal/model/do/t_sim_package_category.go new file mode 100644 index 0000000..7cfb4fd --- /dev/null +++ b/internal/model/do/t_sim_package_category.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPackageCategory is the golang structure of table t_sim_package_category for DAO operations like Where/Data. +type TSimPackageCategory struct { + g.Meta `orm:"table:t_sim_package_category, do:true"` + Id any // 主键ID + CategoryCode any // 套餐分类编号 + CategoryName any // 套餐分类名称 + SortNo any // 排序 + Enabled any // 是否启用:1启用,0停用 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_pool_bind_package.go b/internal/model/do/t_sim_pool_bind_package.go new file mode 100644 index 0000000..2c9ebaa --- /dev/null +++ b/internal/model/do/t_sim_pool_bind_package.go @@ -0,0 +1,38 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPoolBindPackage is the golang structure of table t_sim_pool_bind_package for DAO operations like Where/Data. +type TSimPoolBindPackage struct { + g.Meta `orm:"table:t_sim_pool_bind_package, do:true"` + Id any // 主键ID + SubscriptionNo any // 订购记录编号 + PoolNo any // 流量池编号 + DeptId any // 部门机构编号 + PackageType any // 套餐类型 + PackageCode any // 套餐编号 + PreviousPackageCode any // 变更前套餐编号 + BusinessType any // 类型 枚举 + EffectiveStatus any // 订购状态 枚举 + HandleTime *gtime.Time // 办理时间 + EffectiveTime *gtime.Time // 生效时间 + ExpectedExpireTime *gtime.Time // 预计到期时间 + ActualExpireTime *gtime.Time // 实际到期时间 + DurationMonths any // 套餐时长(月) + GiftDurationMonths any // 赠送时长(月) + OrderCode any // 订单编号 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_pool_warn_config.go b/internal/model/do/t_sim_pool_warn_config.go new file mode 100644 index 0000000..2ae9a16 --- /dev/null +++ b/internal/model/do/t_sim_pool_warn_config.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPoolWarnConfig is the golang structure of table t_sim_pool_warn_config for DAO operations like Where/Data. +type TSimPoolWarnConfig struct { + g.Meta `orm:"table:t_sim_pool_warn_config, do:true"` + Id any // 主键ID + PoolId any // 流量池ID + WarnLevel any // 预警等级:1提示,2注意,3警告,4危险,5紧急 + ThresholdPercent any // 阈值(例如0.7) + WarnMethods any // 预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔 + WarnPhones any // 预警手机号 多个逗号分隔 + WarnEmails any // 预警邮箱 多个逗号分隔 + AutoAction any // 自动动作:0无,1限速,2断网 + IsEnabled any // 是否启用:1启用,0停用 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_sim_upstream_package.go b/internal/model/do/t_sim_upstream_package.go new file mode 100644 index 0000000..7c6fbdf --- /dev/null +++ b/internal/model/do/t_sim_upstream_package.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TUpstreamPackage is the golang structure of table t_sim_upstream_package for DAO operations like Where/Data. +type TUpstreamPackage struct { + g.Meta `orm:"table:t_sim_upstream_package, do:true"` + Id any // 主键 + UpPkgCode any // 上游套餐编码 + UpPkgName any // 上游套餐名称 + Operator any // 运营商:1移动,2联通,3电信 + ApnName any // APN名称 + Remark any // 备注 + CreatedDept any // 创建部门 + CreatedAt *gtime.Time // 创建时间 + CreatedBy any // 创建者 + UpdatedAt *gtime.Time // 更新时间 + UpdatedBy any // 更新者 +} diff --git a/internal/model/do/t_tplatform_setting.go b/internal/model/do/t_tplatform_setting.go new file mode 100644 index 0000000..670de15 --- /dev/null +++ b/internal/model/do/t_tplatform_setting.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TTplatformSetting is the golang structure of table t_tplatform_setting for DAO operations like Where/Data. +type TTplatformSetting struct { + g.Meta `orm:"table:t_tplatform_setting, do:true"` + Id any // 主键ID + SubDomain any // 二级域名前缀 + FullDomain any // 完整域名 + AppTitle any // 平台标题 + AppIcon any // 图标地址 + LoginPageTitle any // 登录页大标题 + LoginPageDescription any // 登录页描述文案 + LoginSloganImage any // 登录标语图地址 + Sort any // 排序 + Status any // 状态 0启用 1禁用 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_wo_audit.go b/internal/model/do/t_wo_audit.go new file mode 100644 index 0000000..23168a6 --- /dev/null +++ b/internal/model/do/t_wo_audit.go @@ -0,0 +1,35 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoAudit is the golang structure of table t_wo_audit for DAO operations like Where/Data. +type TWoAudit struct { + g.Meta `orm:"table:t_wo_audit, do:true"` + Id any // 主键ID + AuditNo any // 审核编号 + WoId any // 工单ID + WoNo any // 工单编号 + AuditType any // 审核类型:0分派,1转派,2退回,3解决,4关闭,5废除 + AuditorType any // 审核人类型:1终端用户,2代理商,3客服 + AuditorDeptId any // 审核人机构ID + AuditorUserId any // 审核人用户ID + AuditorName any // 审核人姓名 + BeforeStatus any // 变更前状态 + AfterStatus any // 变更后状态 + AuditResult any // 审核结果:0通过,1驳回 + AuditOpinion any // 审核意见 + AuditTime *gtime.Time // 审核时间 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_wo_communication.go b/internal/model/do/t_wo_communication.go new file mode 100644 index 0000000..fddd200 --- /dev/null +++ b/internal/model/do/t_wo_communication.go @@ -0,0 +1,34 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoCommunication is the golang structure of table t_wo_communication for DAO operations like Where/Data. +type TWoCommunication struct { + g.Meta `orm:"table:t_wo_communication, do:true"` + Id any // 主键ID + CommNo any // 沟通编号 + WoId any // 工单ID + WoNo any // 工单编号 + CommType any // 沟通类型:0回复,1反馈 + SenderType any // 发送人类型:1终端用户,2代理商 + SenderDeptId any // 发送人机构ID + SenderUserId any // 发送人用户ID + SenderName any // 发送人姓名 + Content any // 沟通内容 + AttachmentUrls *gjson.Json // 附件URL列表 + CommTime *gtime.Time // 沟通时间 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_wo_main.go b/internal/model/do/t_wo_main.go new file mode 100644 index 0000000..831c38d --- /dev/null +++ b/internal/model/do/t_wo_main.go @@ -0,0 +1,45 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoMain is the golang structure of table t_wo_main for DAO operations like Where/Data. +type TWoMain struct { + g.Meta `orm:"table:t_wo_main, do:true"` + Id any // 主键ID + WoNo any // 工单编号 + WoType any // 工单类型 0卡,1模组,2设备,3订单,4余额,5提现 + RelatedId any // 关联业务ID + Title any // 工单标题 + Content any // 问题描述 + Attachment any // 附件 + CreatorType any // 创建人类型:1终端用户,2代理商 + CreatorDeptId any // 创建机构ID + CreatorUserId any // 创建用户ID + CreatorName any // 创建人姓名 + CreatorPhone any // 创建人手机号 + AssignDeptId any // 分派方机构ID + AssignUserId any // 分派人用户ID + CurrentStatus any // 当前处理状态:1已分派,2处理中,3已解决,4已完结_关单,5已取消 + HandlerDeptId any // 处理方机构ID + HandlerUserId any // 处理人用户ID + FirstResponseTime *gtime.Time // 首次响应时间 + ResolveTime *gtime.Time // 确认时间 + CloseTime *gtime.Time // 关闭时间 + SatisfactionLevel any // 满意度:1-5分 + EvalContent any // 评价内容 + EvalTime *gtime.Time // 评价时间 + Remark any // 备注 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/t_wo_record.go b/internal/model/do/t_wo_record.go new file mode 100644 index 0000000..3e5bd9b --- /dev/null +++ b/internal/model/do/t_wo_record.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoRecord is the golang structure of table t_wo_record for DAO operations like Where/Data. +type TWoRecord struct { + g.Meta `orm:"table:t_wo_record, do:true"` + Id any // 主键ID + WoNo any // 工单编号 + OperationType any // 操作类型:0创建,1分派,2处理,3完成,4关单,5取消 + OperationDeptId any // 操作机构ID + OperationUserId any // 操作用户ID + TargetDeptId any // 目标部门ID + TargetUserId any // 目标用户ID + BeforeStatus any // 变更前状态 + AfterStatus any // 变更后状态 + TenantId any // 租户ID + CreatedDept any // 创建部门 + CreatedBy any // 创建者 + CreatedAt *gtime.Time // 创建时间 + UpdatedBy any // 更新者 + UpdatedAt *gtime.Time // 更新时间 +} diff --git a/internal/model/do/test_demo.go b/internal/model/do/test_demo.go new file mode 100644 index 0000000..97863cc --- /dev/null +++ b/internal/model/do/test_demo.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// TestDemo is the golang structure of table test_demo for DAO operations like Where/Data. +type TestDemo struct { + g.Meta `orm:"table:test_demo, do:true"` + Id interface{} // 主键 + TenantId interface{} // 租户编号 + DeptId interface{} // 部门id + UserId interface{} // 用户id + OrderNum interface{} // 排序号 + TestKey interface{} // key键 + Value interface{} // 值 + Version interface{} // 版本 + CreatedDept interface{} // 创建部门 + CreatedAt *gtime.Time // 创建时间 + CreatedBy interface{} // 创建者 + UpdatedAt *gtime.Time // 更新时间 + UpdatedBy interface{} // 更新者 + DeletedBy interface{} // 删除人 + DeletedAt *gtime.Time // 删除时间 +} diff --git a/internal/model/entity/batch_detail.go b/internal/model/entity/batch_detail.go new file mode 100644 index 0000000..b301e4d --- /dev/null +++ b/internal/model/entity/batch_detail.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// BatchDetail is the golang structure for table batch_detail. +type BatchDetail struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + BatchNo string `json:"batchNo" orm:"batch_no" description:"批次编号"` + BatchType int `json:"batchType" orm:"batch_type" description:"批次类型 枚举(与主表一致)"` + DetailStatus int `json:"detailStatus" orm:"detail_status" description:"明细异步处理状态 0-待处理 1-处理中 2-成功 3-失败"` + BlankOutStatus int `json:"blankOutStatus" orm:"blank_out_status" description:"作废状态 0-是 1-否"` + RowNo int `json:"rowNo" orm:"row_no" description:"行号"` + ItemId string `json:"itemId" orm:"item_id" description:"项ID:卡ICCID/设备编码"` + ErrorCode string `json:"errorCode" orm:"error_code" description:"异常编码"` + ErrorReason string `json:"errorReason" orm:"error_reason" description:"异常原因"` + Snapshot *gjson.Json `json:"snapshot" orm:"snapshot" description:"信息快照"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/batch_main.go b/internal/model/entity/batch_main.go new file mode 100644 index 0000000..3d2c057 --- /dev/null +++ b/internal/model/entity/batch_main.go @@ -0,0 +1,45 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// BatchMain is the golang structure for table batch_main. +type BatchMain struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + BatchNo string `json:"batchNo" orm:"batch_no" description:"批次编号"` + OrderSn string `json:"orderSn" orm:"order_sn" description:"订单编号"` + BatchType int `json:"batchType" orm:"batch_type" description:"批次类型 枚举"` + BatchStatus int `json:"batchStatus" orm:"batch_status" description:"批次状态 枚举"` + BatchAsyncStatus int `json:"batchAsyncStatus" orm:"batch_async_status" description:"异步处理状态"` + SourceType int `json:"sourceType" orm:"source_type" description:"来源方式 枚举"` + SourceBatchNo string `json:"sourceBatchNo" orm:"source_batch_no" description:"来源批次编号"` + SourceOssId int64 `json:"sourceOssId" orm:"source_oss_id" description:"源文件OSS ID"` + ResultOssId int64 `json:"resultOssId" orm:"result_oss_id" description:"结果文件OSS ID"` + IsCrossDept int `json:"isCrossDept" orm:"is_cross_dept" description:"是否跨级操作机构"` + TargetDeptId int64 `json:"targetDeptId" orm:"target_dept_id" description:"目标机构编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"机构编号"` + TotalCount int `json:"totalCount" orm:"total_count" description:"总数量"` + ValidCount int `json:"validCount" orm:"valid_count" description:"有效数量"` + SuccessCount int `json:"successCount" orm:"success_count" description:"成功数量"` + FailCount int `json:"failCount" orm:"fail_count" description:"失败数量"` + RunResult int `json:"runResult" orm:"run_result" description:"运行结果"` + FailReason string `json:"failReason" orm:"fail_reason" description:"失败原因"` + BatchInfo *gjson.Json `json:"batchInfo" orm:"batch_info" description:"批次信息:入库/出库展示字段"` + Remark *gjson.Json `json:"remark" orm:"remark" description:"备注扩展字段"` + StartTime *gtime.Time `json:"startTime" orm:"start_time" description:"开始时间"` + EndTime *gtime.Time `json:"endTime" orm:"end_time" description:"结束时间"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + SourceChannel string `json:"sourceChannel" orm:"source_channel" description:"发起渠道:console/mini_program/api/system/legacy"` + ExecutionMode uint `json:"executionMode" orm:"execution_mode" description:"操作规模:0未知1单卡2批量"` +} diff --git a/internal/model/entity/sys_client.go b/internal/model/entity/sys_client.go new file mode 100644 index 0000000..54564fa --- /dev/null +++ b/internal/model/entity/sys_client.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysClient is the golang structure for table sys_client. +type SysClient struct { + Id int64 `json:"id" orm:"id" description:"id"` + ClientId string `json:"clientId" orm:"client_id" description:"客户端id"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端key"` + ClientSecret string `json:"clientSecret" orm:"client_secret" description:"客户端秘钥"` + GrantType string `json:"grantType" orm:"grant_type" description:"授权类型"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + ActiveTimeout int `json:"activeTimeout" orm:"active_timeout" description:"token活跃超时时间"` + Timeout int `json:"timeout" orm:"timeout" description:"token固定超时"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_config.go b/internal/model/entity/sys_config.go new file mode 100644 index 0000000..d24eb4d --- /dev/null +++ b/internal/model/entity/sys_config.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysConfig is the golang structure for table sys_config. +type SysConfig struct { + ConfigId int64 `json:"configId" orm:"config_id" description:"参数主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ConfigName string `json:"configName" orm:"config_name" description:"参数名称"` + ConfigKey string `json:"configKey" orm:"config_key" description:"参数键名"` + ConfigValue string `json:"configValue" orm:"config_value" description:"参数键值"` + ConfigType string `json:"configType" orm:"config_type" description:"系统内置(Y是 N否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_dept.go b/internal/model/entity/sys_dept.go new file mode 100644 index 0000000..605de83 --- /dev/null +++ b/internal/model/entity/sys_dept.go @@ -0,0 +1,37 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysDept is the golang structure for table sys_dept. +type SysDept struct { + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父部门id"` + Ancestors string `json:"ancestors" orm:"ancestors" description:"祖级列表"` + DeptKey string `json:"deptKey" orm:"dept_key" description:"机构编号"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` + DeptType int `json:"deptType" orm:"dept_type" description:"部门类型(0:部门 1:公司)"` + DeptCategory string `json:"deptCategory" orm:"dept_category" description:"部门类别编码"` + OrderNum int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Leader int64 `json:"leader" orm:"leader" description:"负责人"` + Phone string `json:"phone" orm:"phone" description:"联系电话"` + Email string `json:"email" orm:"email" description:"邮箱"` + Status string `json:"status" orm:"status" description:"部门状态(0正常 1停用)"` + CreditCode string `json:"creditCode" orm:"credit_code" description:"统一社会信用代码"` + AreaCode string `json:"areaCode" orm:"area_code" description:"行政区域代码"` + Address string `json:"address" orm:"address" description:"地址"` + DeptRole int64 `json:"deptRole" orm:"dept_role" description:"机构默认角色ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_dict_data.go b/internal/model/entity/sys_dict_data.go new file mode 100644 index 0000000..ad8188d --- /dev/null +++ b/internal/model/entity/sys_dict_data.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysDictData is the golang structure for table sys_dict_data. +type SysDictData struct { + DictCode int64 `json:"dictCode" orm:"dict_code" description:"字典编码"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DictSort int `json:"dictSort" orm:"dict_sort" description:"字典排序"` + DictLabel string `json:"dictLabel" orm:"dict_label" description:"字典标签"` + DictValue string `json:"dictValue" orm:"dict_value" description:"字典键值"` + DictType string `json:"dictType" orm:"dict_type" description:"字典类型"` + CssClass string `json:"cssClass" orm:"css_class" description:"样式属性(其他样式扩展)"` + ListClass string `json:"listClass" orm:"list_class" description:"表格回显样式"` + IsDefault string `json:"isDefault" orm:"is_default" description:"是否默认(Y是 N否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_dict_type.go b/internal/model/entity/sys_dict_type.go new file mode 100644 index 0000000..442982a --- /dev/null +++ b/internal/model/entity/sys_dict_type.go @@ -0,0 +1,24 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysDictType is the golang structure for table sys_dict_type. +type SysDictType struct { + DictId int64 `json:"dictId" orm:"dict_id" description:"字典主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DictName string `json:"dictName" orm:"dict_name" description:"字典名称"` + DictType string `json:"dictType" orm:"dict_type" description:"字典类型"` + IsSys string `json:"isSys" orm:"is_sys" description:"是否系统(0是 1否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_gen_table.go b/internal/model/entity/sys_gen_table.go new file mode 100644 index 0000000..dbdc795 --- /dev/null +++ b/internal/model/entity/sys_gen_table.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysGenTable is the golang structure for table sys_gen_table. +type SysGenTable 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 string `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 string `json:"masterColumns" orm:"master_columns" description:"主表字段"` + AddonName string `json:"addonName" orm:"addon_name" description:"插件名称"` + Status string `json:"status" orm:"status" description:"生成状态(0成功 1未开始)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/sys_job.go b/internal/model/entity/sys_job.go new file mode 100644 index 0000000..2f37702 --- /dev/null +++ b/internal/model/entity/sys_job.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysJob is the golang structure for table sys_job. +type SysJob struct { + JobId int64 `json:"jobId" orm:"job_id" description:"任务ID"` + JobName string `json:"jobName" orm:"job_name" description:"任务名称"` + JobParams string `json:"jobParams" orm:"job_params" description:"参数"` + JobGroup string `json:"jobGroup" orm:"job_group" description:"任务组名"` + InvokeTarget string `json:"invokeTarget" orm:"invoke_target" description:"调用目标字符串"` + CronExpression string `json:"cronExpression" orm:"cron_expression" description:"cron执行表达式"` + MisfirePolicy int `json:"misfirePolicy" orm:"misfire_policy" description:"计划执行策略(1多次执行 2执行一次)"` + Concurrent int `json:"concurrent" orm:"concurrent" description:"是否并发执行(0允许 1禁止)"` + Status string `json:"status" orm:"status" description:"状态(0正常 1暂停)"` + Remark string `json:"remark" orm:"remark" description:"备注信息"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_logininfor.go b/internal/model/entity/sys_logininfor.go new file mode 100644 index 0000000..d0bd0c4 --- /dev/null +++ b/internal/model/entity/sys_logininfor.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysLogininfor is the golang structure for table sys_logininfor. +type SysLogininfor struct { + InfoId int64 `json:"infoId" orm:"info_id" description:"访问ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Status string `json:"status" orm:"status" description:"登录状态(0成功 1失败)"` + Msg string `json:"msg" orm:"msg" description:"提示消息"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` +} diff --git a/internal/model/entity/sys_menu.go b/internal/model/entity/sys_menu.go new file mode 100644 index 0000000..1817e89 --- /dev/null +++ b/internal/model/entity/sys_menu.go @@ -0,0 +1,35 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysMenu is the golang structure for table sys_menu. +type SysMenu struct { + MenuId int64 `json:"menuId" orm:"menu_id" description:"菜单ID"` + MenuName string `json:"menuName" orm:"menu_name" description:"菜单名称"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父菜单ID"` + Level int `json:"level" orm:"level" description:"关系树等级"` + Tree string `json:"tree" orm:"tree" description:"关系树"` + OrderNum int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Path string `json:"path" orm:"path" description:"路由地址"` + Component string `json:"component" orm:"component" description:"组件路径"` + QueryParam string `json:"queryParam" orm:"query_param" description:"路由参数"` + IsFrame int `json:"isFrame" orm:"is_frame" description:"是否为外链(0是 1否)"` + IsCache int `json:"isCache" orm:"is_cache" description:"是否缓存(0缓存 1不缓存)"` + MenuType string `json:"menuType" orm:"menu_type" description:"菜单类型(M目录 C菜单 F按钮)"` + Visible string `json:"visible" orm:"visible" description:"显示状态(0显示 1隐藏)"` + Status string `json:"status" orm:"status" description:"菜单状态(0正常 1停用)"` + Perms string `json:"perms" orm:"perms" description:"权限标识"` + Icon string `json:"icon" orm:"icon" description:"菜单图标"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_notice.go b/internal/model/entity/sys_notice.go new file mode 100644 index 0000000..93e3175 --- /dev/null +++ b/internal/model/entity/sys_notice.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysNotice is the golang structure for table sys_notice. +type SysNotice struct { + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + NoticeTitle string `json:"noticeTitle" orm:"notice_title" description:"公告标题"` + NoticeType string `json:"noticeType" orm:"notice_type" description:"公告类型(1通知 2公告)"` + NoticeContent []byte `json:"noticeContent" orm:"notice_content" description:"公告内容"` + Status string `json:"status" orm:"status" description:"公告状态(0正常 1关闭)"` + NoticeRange int `json:"noticeRange" orm:"notice_range" description:"通知范围(1全员 2指定机构 3指定用户)"` + DeptIds string `json:"deptIds" orm:"dept_ids" description:"通知机构ID列表JSON"` + UserIds string `json:"userIds" orm:"user_ids" description:"通知用户ID列表JSON"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_notice_user.go b/internal/model/entity/sys_notice_user.go new file mode 100644 index 0000000..d6562f2 --- /dev/null +++ b/internal/model/entity/sys_notice_user.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysNoticeUser is the golang structure for table sys_notice_user. +type SysNoticeUser struct { + Id int64 `json:"id" orm:"id" description:"ID"` + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + NoticeTitle string `json:"noticeTitle" orm:"notice_title" description:"公告标题"` + NoticeType string `json:"noticeType" orm:"notice_type" description:"公告类型(1通知 2公告)"` + NoticeContent []byte `json:"noticeContent" orm:"notice_content" description:"公告内容"` + Status string `json:"status" orm:"status" description:"公告状态(0正常 1关闭)"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + IsRead int `json:"isRead" orm:"is_read" description:"是否已读(0未读 1已读)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_oper_log.go b/internal/model/entity/sys_oper_log.go new file mode 100644 index 0000000..dfc9eb5 --- /dev/null +++ b/internal/model/entity/sys_oper_log.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysOperLog is the golang structure for table sys_oper_log. +type SysOperLog struct { + OperId int64 `json:"operId" orm:"oper_id" description:"日志主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Title string `json:"title" orm:"title" description:"模块标题"` + BusinessType int `json:"businessType" orm:"business_type" description:"业务类型(0其它 1新增 2修改 3删除)"` + Method string `json:"method" orm:"method" description:"方法名称"` + RequestMethod string `json:"requestMethod" orm:"request_method" description:"请求方式"` + OperatorType int `json:"operatorType" orm:"operator_type" description:"操作类别(0其它 1后台用户 2手机端用户)"` + OperName string `json:"operName" orm:"oper_name" description:"操作人员"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` + OperUrl string `json:"operUrl" orm:"oper_url" description:"请求URL"` + OperIp string `json:"operIp" orm:"oper_ip" description:"主机地址"` + OperLocation string `json:"operLocation" orm:"oper_location" description:"操作地点"` + OperParam string `json:"operParam" orm:"oper_param" description:"请求参数"` + JsonResult string `json:"jsonResult" orm:"json_result" description:"返回参数"` + Status int `json:"status" orm:"status" description:"操作状态(0正常 1异常)"` + ErrorMsg string `json:"errorMsg" orm:"error_msg" description:"错误消息"` + OperTime *gtime.Time `json:"operTime" orm:"oper_time" description:"操作时间"` + CostTime int64 `json:"costTime" orm:"cost_time" description:"消耗时间"` +} diff --git a/internal/model/entity/sys_oss.go b/internal/model/entity/sys_oss.go new file mode 100644 index 0000000..5e6fbec --- /dev/null +++ b/internal/model/entity/sys_oss.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysOss is the golang structure for table sys_oss. +type SysOss struct { + OssId int64 `json:"ossId" orm:"oss_id" description:"对象存储主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + FileName string `json:"fileName" orm:"file_name" description:"文件名"` + OriginalName string `json:"originalName" orm:"original_name" description:"原名"` + FileSuffix string `json:"fileSuffix" orm:"file_suffix" description:"文件后缀名"` + Path string `json:"path" orm:"path" description:"存储路径"` + Url string `json:"url" orm:"url" description:"URL地址"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + Service string `json:"service" orm:"service" description:"服务商"` + Md5 string `json:"md5" orm:"md5" description:"文件MD5"` + FileSize int `json:"fileSize" orm:"file_size" description:"文件大小"` + FileCrc16 int `json:"fileCrc16" orm:"file_crc16" description:"文件Crc16"` + FileSum int `json:"fileSum" orm:"file_sum" description:"文件校验和"` +} diff --git a/internal/model/entity/sys_oss_config.go b/internal/model/entity/sys_oss_config.go new file mode 100644 index 0000000..408d83e --- /dev/null +++ b/internal/model/entity/sys_oss_config.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysOssConfig is the golang structure for table sys_oss_config. +type SysOssConfig struct { + OssConfigId int64 `json:"ossConfigId" orm:"oss_config_id" description:"主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ConfigKey string `json:"configKey" orm:"config_key" description:"配置key"` + AccessKey string `json:"accessKey" orm:"access_key" description:"accessKey"` + SecretKey string `json:"secretKey" orm:"secret_key" description:"秘钥"` + BucketName string `json:"bucketName" orm:"bucket_name" description:"桶名称"` + Prefix string `json:"prefix" orm:"prefix" description:"前缀"` + Endpoint string `json:"endpoint" orm:"endpoint" description:"访问站点"` + Domain string `json:"domain" orm:"domain" description:"自定义域名"` + IsHttps string `json:"isHttps" orm:"is_https" description:"是否https(Y=是,N=否)"` + Region string `json:"region" orm:"region" description:"域"` + AccessPolicy string `json:"accessPolicy" orm:"access_policy" description:"桶权限类型(0=private 1=public 2=custom)"` + Status string `json:"status" orm:"status" description:"是否默认(0=是,1=否)"` + Ext1 string `json:"ext1" orm:"ext1" description:"扩展字段"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_post.go b/internal/model/entity/sys_post.go new file mode 100644 index 0000000..ca6691a --- /dev/null +++ b/internal/model/entity/sys_post.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysPost is the golang structure for table sys_post. +type SysPost struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + PostCode string `json:"postCode" orm:"post_code" description:"岗位编码"` + PostCategory string `json:"postCategory" orm:"post_category" description:"岗位类别编码"` + PostName string `json:"postName" orm:"post_name" description:"岗位名称"` + PostSort int `json:"postSort" orm:"post_sort" description:"显示顺序"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_role.go b/internal/model/entity/sys_role.go new file mode 100644 index 0000000..432df74 --- /dev/null +++ b/internal/model/entity/sys_role.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysRole is the golang structure for table sys_role. +type SysRole struct { + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门机构id"` + RoleName string `json:"roleName" orm:"role_name" description:"角色名称"` + RoleKey string `json:"roleKey" orm:"role_key" description:"角色权限字符串"` + RoleSort int `json:"roleSort" orm:"role_sort" description:"显示顺序"` + DataScope string `json:"dataScope" orm:"data_scope" description:"数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:仅本人数据权限 7:本组织及下一级数据权限"` + MenuCheckStrictly int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + DeptCheckStrictly int `json:"deptCheckStrictly" orm:"dept_check_strictly" description:"部门树选择项是否关联显示"` + Status string `json:"status" orm:"status" description:"角色状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_role_dept.go b/internal/model/entity/sys_role_dept.go new file mode 100644 index 0000000..95f9407 --- /dev/null +++ b/internal/model/entity/sys_role_dept.go @@ -0,0 +1,12 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +// SysRoleDept is the golang structure for table sys_role_dept. +type SysRoleDept struct { + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` +} diff --git a/internal/model/entity/sys_role_menu.go b/internal/model/entity/sys_role_menu.go new file mode 100644 index 0000000..202cf6c --- /dev/null +++ b/internal/model/entity/sys_role_menu.go @@ -0,0 +1,13 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +// SysRoleMenu is the golang structure for table sys_role_menu. +type SysRoleMenu struct { + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + MenuId int64 `json:"menuId" orm:"menu_id" description:"菜单ID"` + DataScope string `json:"dataScope" orm:"data_scope" description:"数据范围(0按角色数据权限 1全部数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限)"` +} diff --git a/internal/model/entity/sys_social.go b/internal/model/entity/sys_social.go new file mode 100644 index 0000000..f2172c2 --- /dev/null +++ b/internal/model/entity/sys_social.go @@ -0,0 +1,43 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysSocial is the golang structure for table sys_social. +type SysSocial struct { + Id int64 `json:"id" orm:"id" description:"主键"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户id"` + AuthId string `json:"authId" orm:"auth_id" description:"平台+平台唯一id"` + Source string `json:"source" orm:"source" description:"用户来源"` + OpenId string `json:"openId" orm:"open_id" description:"平台编号唯一id"` + UserName string `json:"userName" orm:"user_name" description:"登录账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + Email string `json:"email" orm:"email" description:"用户邮箱"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + AccessToken string `json:"accessToken" orm:"access_token" description:"用户的授权令牌"` + ExpireIn int `json:"expireIn" orm:"expire_in" description:"用户的授权令牌的有效期,部分平台可能没有"` + RefreshToken string `json:"refreshToken" orm:"refresh_token" description:"刷新令牌,部分平台可能没有"` + AccessCode string `json:"accessCode" orm:"access_code" description:"平台的授权信息,部分平台可能没有"` + UnionId string `json:"unionId" orm:"union_id" description:"用户的 unionid"` + Scope string `json:"scope" orm:"scope" description:"授予的权限,部分平台可能没有"` + TokenType string `json:"tokenType" orm:"token_type" description:"个别平台的授权信息,部分平台可能没有"` + IdToken string `json:"idToken" orm:"id_token" description:"id token,部分平台可能没有"` + MacAlgorithm string `json:"macAlgorithm" orm:"mac_algorithm" description:"小米平台用户的附带属性,部分平台可能没有"` + MacKey string `json:"macKey" orm:"mac_key" description:"小米平台用户的附带属性,部分平台可能没有"` + Code string `json:"code" orm:"code" description:"用户的授权code,部分平台可能没有"` + OauthToken string `json:"oauthToken" orm:"oauth_token" description:"Twitter平台用户的附带属性,部分平台可能没有"` + OauthTokenSecret string `json:"oauthTokenSecret" orm:"oauth_token_secret" description:"Twitter平台用户的附带属性,部分平台可能没有"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_tenant.go b/internal/model/entity/sys_tenant.go new file mode 100644 index 0000000..4ad6542 --- /dev/null +++ b/internal/model/entity/sys_tenant.go @@ -0,0 +1,37 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysTenant is the golang structure for table sys_tenant. +type SysTenant struct { + Id int64 `json:"id" orm:"id" description:"id"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ContactUserName string `json:"contactUserName" orm:"contact_user_name" description:"联系人"` + ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系电话"` + CompanyName string `json:"companyName" orm:"company_name" description:"企业名称"` + LicenseNumber string `json:"licenseNumber" orm:"license_number" description:"统一社会信用代码"` + Address string `json:"address" orm:"address" description:"地址"` + Intro string `json:"intro" orm:"intro" description:"企业简介"` + Domain string `json:"domain" orm:"domain" description:"域名"` + Remark string `json:"remark" orm:"remark" description:"备注"` + PackageId int64 `json:"packageId" orm:"package_id" description:"租户套餐编号"` + AdminRoleId int64 `json:"adminRoleId" orm:"admin_role_id" description:"管理员角色ID"` + AdminDeptId int64 `json:"adminDeptId" orm:"admin_dept_id" description:"管理员部门ID"` + AdminUserId int64 `json:"adminUserId" orm:"admin_user_id" description:"管理员用户ID"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"过期时间"` + AccountCount int `json:"accountCount" orm:"account_count" description:"用户数量(-1不限制)"` + Status string `json:"status" orm:"status" description:"租户状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_tenant_package.go b/internal/model/entity/sys_tenant_package.go new file mode 100644 index 0000000..ae33a81 --- /dev/null +++ b/internal/model/entity/sys_tenant_package.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysTenantPackage is the golang structure for table sys_tenant_package. +type SysTenantPackage struct { + PackageId int64 `json:"packageId" orm:"package_id" description:"租户套餐id"` + PackageName string `json:"packageName" orm:"package_name" description:"套餐名称"` + MenuIds string `json:"menuIds" orm:"menu_ids" description:"关联菜单id"` + Remark string `json:"remark" orm:"remark" description:"备注"` + MenuCheckStrictly int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_user.go b/internal/model/entity/sys_user.go new file mode 100644 index 0000000..059787e --- /dev/null +++ b/internal/model/entity/sys_user.go @@ -0,0 +1,37 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysUser is the golang structure for table sys_user. +type SysUser struct { + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"` + Email string `json:"email" orm:"email" description:"用户邮箱"` + Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"` + Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + Salt string `json:"salt" orm:"salt" description:"加密盐"` + Password string `json:"password" orm:"password" description:"密码"` + Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"` + LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"` + LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"` + MfaEnabled int `json:"mfaEnabled" orm:"mfa_enabled" description:"是否开启邮箱MFA 0否 1是"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/entity/sys_user_online.go b/internal/model/entity/sys_user_online.go new file mode 100644 index 0000000..90e86c9 --- /dev/null +++ b/internal/model/entity/sys_user_online.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SysUserOnline is the golang structure for table sys_user_online. +type SysUserOnline struct { + OnlineId int64 `json:"onlineId" orm:"online_id" description:"访问ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Uuid string `json:"uuid" orm:"uuid" description:"UUID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Token string `json:"token" orm:"token" description:"Token"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"过期时间"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/entity/sys_user_post.go b/internal/model/entity/sys_user_post.go new file mode 100644 index 0000000..403ace3 --- /dev/null +++ b/internal/model/entity/sys_user_post.go @@ -0,0 +1,12 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +// SysUserPost is the golang structure for table sys_user_post. +type SysUserPost struct { + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` +} diff --git a/internal/model/entity/sys_user_role.go b/internal/model/entity/sys_user_role.go new file mode 100644 index 0000000..29b0f23 --- /dev/null +++ b/internal/model/entity/sys_user_role.go @@ -0,0 +1,12 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +// SysUserRole is the golang structure for table sys_user_role. +type SysUserRole struct { + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` +} diff --git a/internal/model/entity/t_agent_balance.go b/internal/model/entity/t_agent_balance.go new file mode 100644 index 0000000..003f6d2 --- /dev/null +++ b/internal/model/entity/t_agent_balance.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TAgentBalance is the golang structure for table t_agent_balance. +type TAgentBalance struct { + Id int64 `json:"id" orm:"id" description:"账户ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"机构ID"` + Balance float64 `json:"balance" orm:"balance" description:"账户余额"` + WithdrawAmount float64 `json:"withdrawAmount" orm:"withdraw_amount" description:"可提现金额"` + WithdrawAmountStatus int `json:"withdrawAmountStatus" orm:"withdraw_amount_status" description:"可提现金额状态: 1-正常, 0-冻结"` + InvoiceAmount float64 `json:"invoiceAmount" orm:"invoice_amount" description:"已开票金额"` + CanInvoiceAmount float64 `json:"canInvoiceAmount" orm:"can_invoice_amount" description:"可开票金额"` + CreditLimit float64 `json:"creditLimit" orm:"credit_limit" description:"信用额度"` + UsedCredit float64 `json:"usedCredit" orm:"used_credit" description:"已使用信用额度"` + PendingRepayment float64 `json:"pendingRepayment" orm:"pending_repayment" description:"待还款金额"` + Status int `json:"status" orm:"status" description:"状态: 0-正常, 1-禁用"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_agent_enterprise.go b/internal/model/entity/t_agent_enterprise.go new file mode 100644 index 0000000..164c3f8 --- /dev/null +++ b/internal/model/entity/t_agent_enterprise.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TAgentEnterprise is the golang structure for table t_agent_enterprise. +type TAgentEnterprise struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门机构id"` + FullName string `json:"fullName" orm:"full_name" description:"单位全称"` + Industry string `json:"industry" orm:"industry" description:"行业"` + LegalPersonName string `json:"legalPersonName" orm:"legal_person_name" description:"法人名称"` + LegalPersonIdCard string `json:"legalPersonIdCard" orm:"legal_person_id_card" description:"法人身份证号"` + CompanyType string `json:"companyType" orm:"company_type" description:"单位类型"` + EstablishTime *gtime.Time `json:"establishTime" orm:"establish_time" description:"单位成立时间"` + BankName string `json:"bankName" orm:"bank_name" description:"开户行名称"` + BankAccount string `json:"bankAccount" orm:"bank_account" description:"开户行账号"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_api.go b/internal/model/entity/t_api.go new file mode 100644 index 0000000..ccab55f --- /dev/null +++ b/internal/model/entity/t_api.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TApi is the golang structure for table t_api. +type TApi struct { + Id int64 `json:"id" orm:"id" description:"ID"` + AppKey string `json:"appKey" orm:"app_key" description:"APPKey"` + AppSecret string `json:"appSecret" orm:"app_secret" description:"APPSecret"` + GroupId int64 `json:"groupId" orm:"group_id" description:"权限组ID"` + Status int `json:"status" orm:"status" description:"状态:0启用,1停用"` + RateLimitPeriod int `json:"rateLimitPeriod" orm:"rate_limit_period" description:"限流周期(秒,0:不限流)"` + RateLimitCount int `json:"rateLimitCount" orm:"rate_limit_count" description:"限流次数"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"所属机构"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_api_group.go b/internal/model/entity/t_api_group.go new file mode 100644 index 0000000..efa398d --- /dev/null +++ b/internal/model/entity/t_api_group.go @@ -0,0 +1,24 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TApiGroup is the golang structure for table t_api_group. +type TApiGroup struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + GroupName string `json:"groupName" orm:"group_name" description:"权限组名称"` + GroupCode string `json:"groupCode" orm:"group_code" description:"权限组编码"` + Status int `json:"status" orm:"status" description:"状态:0启用,1停用"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_api_group_resource.go b/internal/model/entity/t_api_group_resource.go new file mode 100644 index 0000000..8332e77 --- /dev/null +++ b/internal/model/entity/t_api_group_resource.go @@ -0,0 +1,11 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +// TApiGroupResource is the golang structure for table t_api_group_resource. +type TApiGroupResource struct { + GroupId int64 `json:"groupId" orm:"group_id" description:"权限组ID,对应t_api_group.id"` + ApiId int64 `json:"apiId" orm:"api_id" description:"开放接口资源ID,对应t_api_resource.id"` +} diff --git a/internal/model/entity/t_api_resource.go b/internal/model/entity/t_api_resource.go new file mode 100644 index 0000000..25d5dc3 --- /dev/null +++ b/internal/model/entity/t_api_resource.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TApiResource is the golang structure for table t_api_resource. +type TApiResource struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + ApiName string `json:"apiName" orm:"api_name" description:"接口名称"` + ApiCode string `json:"apiCode" orm:"api_code" description:"接口权限标识"` + Method string `json:"method" orm:"method" description:"请求方法:GET/POST/PUT/DELETE"` + Path string `json:"path" orm:"path" description:"接口路径"` + Status int `json:"status" orm:"status" description:"状态:0启用,1停用"` + Version string `json:"version" orm:"version" description:"接口版本"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_balance_detail.go b/internal/model/entity/t_balance_detail.go new file mode 100644 index 0000000..bd30762 --- /dev/null +++ b/internal/model/entity/t_balance_detail.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TBalanceDetail is the golang structure for table t_balance_detail. +type TBalanceDetail struct { + Id int64 `json:"id" orm:"id" description:"明细ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"账户ID"` + SerialNo string `json:"serialNo" orm:"serial_no" description:"流水号"` + TransactionTime *gtime.Time `json:"transactionTime" orm:"transaction_time" description:"交易时间"` + IncomeExpenseType int `json:"incomeExpenseType" orm:"income_expense_type" description:"收支类型: 0收入,1支出"` + TransactionType int `json:"transactionType" orm:"transaction_type" description:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel int `json:"transactionChannel" orm:"transaction_channel" description:"交易渠道:1支付宝 2微信 3可提现金额"` + Amount float64 `json:"amount" orm:"amount" description:"交易金额"` + BeforeBalance float64 `json:"beforeBalance" orm:"before_balance" description:"变动前余额"` + BalanceAfter float64 `json:"balanceAfter" orm:"balance_after" description:"变动后余额"` + ChannelSerialNo string `json:"channelSerialNo" orm:"channel_serial_no" description:"交易渠道流水号"` + OrderSn string `json:"orderSn" orm:"order_sn" description:"关联订单号"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_consume_account_month_bill.go b/internal/model/entity/t_consume_account_month_bill.go new file mode 100644 index 0000000..cbe7fcd --- /dev/null +++ b/internal/model/entity/t_consume_account_month_bill.go @@ -0,0 +1,41 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TConsumeAccountMonthBill is the golang structure for table t_consume_account_month_bill. +type TConsumeAccountMonthBill struct { + Id int64 `json:"id" orm:"id" description:"账单ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"机构ID"` + AccountPeriod string `json:"accountPeriod" orm:"account_period" description:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" orm:"opening_balance" description:"月初余额"` + RechargeIncome float64 `json:"rechargeIncome" orm:"recharge_income" description:"充值收入"` + WithdrawableTransferInIncome float64 `json:"withdrawableTransferInIncome" orm:"withdrawable_transfer_in_income" description:"可提现转入收入"` + ManualAdjustIncome float64 `json:"manualAdjustIncome" orm:"manual_adjust_income" description:"人工调账收入"` + RefundIncome float64 `json:"refundIncome" orm:"refund_income" description:"退款收入"` + ConsumeExpense float64 `json:"consumeExpense" orm:"consume_expense" description:"平台消费支出"` + BalanceTransferOutExpense float64 `json:"balanceTransferOutExpense" orm:"balance_transfer_out_expense" description:"转可提现支出"` + ManualAdjustExpense float64 `json:"manualAdjustExpense" orm:"manual_adjust_expense" description:"人工调账支出"` + ConsumeCreditRepayExpense float64 `json:"consumeCreditRepayExpense" orm:"consume_credit_repay_expense" description:"消费账户还款支出"` + TotalIncome float64 `json:"totalIncome" orm:"total_income" description:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" orm:"total_expense" description:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" orm:"closing_balance" description:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" orm:"income_count" description:"收入笔数"` + ExpenseCount int `json:"expenseCount" orm:"expense_count" description:"支出笔数"` + CreditUsed float64 `json:"creditUsed" orm:"credit_used" description:"本月使用信用额度"` + CreditRepaid float64 `json:"creditRepaid" orm:"credit_repaid" description:"本月还款信用额度"` + BillStatus int `json:"billStatus" orm:"bill_status" description:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" orm:"settle_time" description:"结算时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_credit_detail.go b/internal/model/entity/t_credit_detail.go new file mode 100644 index 0000000..cc4b084 --- /dev/null +++ b/internal/model/entity/t_credit_detail.go @@ -0,0 +1,31 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TCreditDetail is the golang structure for table t_credit_detail. +type TCreditDetail struct { + Id int64 `json:"id" orm:"id" description:"明细ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"组织机构ID"` + AccountPeriod string `json:"accountPeriod" orm:"account_period" description:"账期(YYYY-MM)"` + TransactionType string `json:"transactionType" orm:"transaction_type" description:"交易类型: 使用/还款"` + Amount float64 `json:"amount" orm:"amount" description:"金额"` + CreditBalanceBefore float64 `json:"creditBalanceBefore" orm:"credit_balance_before" description:"变动前信用额度余额"` + CreditBalanceAfter float64 `json:"creditBalanceAfter" orm:"credit_balance_after" description:"变动后信用额度余额"` + RelatedOrderSn string `json:"relatedOrderSn" orm:"related_order_sn" description:"关联订单号"` + RepaymentMethod int `json:"repaymentMethod" orm:"repayment_method" description:"还款方式: 0 余额 1 银行卡 2 支付宝 3 微信"` + RepaymentChannelSerial string `json:"repaymentChannelSerial" orm:"repayment_channel_serial" description:"交易渠道流水号"` + TransactionTime *gtime.Time `json:"transactionTime" orm:"transaction_time" description:"交易时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_cust_withdraw_account.go b/internal/model/entity/t_cust_withdraw_account.go new file mode 100644 index 0000000..26e6eff --- /dev/null +++ b/internal/model/entity/t_cust_withdraw_account.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TCustWithdrawAccount is the golang structure for table t_cust_withdraw_account. +type TCustWithdrawAccount struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + DeptId uint `json:"deptId" orm:"dept_id" description:"企业客户ID"` + AccountType uint `json:"accountType" orm:"account_type" description:"提现账号类型,1:支付宝,2:微信"` + AccountNo string `json:"accountNo" orm:"account_no" description:"账号"` + AccountName string `json:"accountName" orm:"account_name" description:"账户名称/真实姓名"` + Mobile string `json:"mobile" orm:"mobile" description:"手机号"` + IsDefault int `json:"isDefault" orm:"is_default" description:"是否默认账号:0-否 1-是"` + Enabled int `json:"enabled" orm:"enabled" description:"是否启用:0-未启用 1-启用"` + Status int `json:"status" orm:"status" description:"状态:0-禁用 1-正常"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_dept_flow_daily.go b/internal/model/entity/t_dept_flow_daily.go new file mode 100644 index 0000000..44c85a0 --- /dev/null +++ b/internal/model/entity/t_dept_flow_daily.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TDeptFlowDaily is the golang structure for table t_dept_flow_daily. +type TDeptFlowDaily struct { + Id int64 `json:"id" orm:"id" description:"自增主键"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"渠道客户ID"` + StatDate *gtime.Time `json:"statDate" orm:"stat_date" description:"统计日期"` + TotalUsedFlowMb float64 `json:"totalUsedFlowMb" orm:"total_used_flow_mb" description:"当日所有卡总消耗流量MB"` + TotalSms int `json:"totalSms" orm:"total_sms" description:"当日总短信使用条数"` + TotalVoiceMin int `json:"totalVoiceMin" orm:"total_voice_min" description:"当日总语音分钟数"` + Remark string `json:"remark" orm:"remark" description:"备注,同步失败原因/特殊说明"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_division_code.go b/internal/model/entity/t_division_code.go new file mode 100644 index 0000000..5ed50d3 --- /dev/null +++ b/internal/model/entity/t_division_code.go @@ -0,0 +1,15 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +// TDivisionCode is the golang structure for table t_division_code. +type TDivisionCode struct { + RegionId int64 `json:"regionId" orm:"region_id" description:"ID"` + RegionCode string `json:"regionCode" orm:"region_code" description:"行政区域代码"` + RegionName string `json:"regionName" orm:"region_name" description:"行政区域名称"` + RegionLevel int `json:"regionLevel" orm:"region_level" description:"等级"` + RegionParent string `json:"regionParent" orm:"region_parent" description:"上级代码"` + RegionType string `json:"regionType" orm:"region_type" description:"城乡分类代码"` +} diff --git a/internal/model/entity/t_fin_commission_detail.go b/internal/model/entity/t_fin_commission_detail.go new file mode 100644 index 0000000..6d8da8c --- /dev/null +++ b/internal/model/entity/t_fin_commission_detail.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinCommissionDetail is the golang structure for table t_fin_commission_detail. +type TFinCommissionDetail struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + CommissionNo string `json:"commissionNo" orm:"commission_no" description:"分润明细编号"` + OrderSn string `json:"orderSn" orm:"order_sn" description:"订单编号"` + OrderType string `json:"orderType" orm:"order_type" description:"订单类型"` + ProductId int64 `json:"productId" orm:"product_id" description:"商品ID"` + PayerDeptId int64 `json:"payerDeptId" orm:"payer_dept_id" description:"下级机构ID"` + BenefitDeptId int64 `json:"benefitDeptId" orm:"benefit_dept_id" description:"受益机构ID"` + BenefitDeptLevel int `json:"benefitDeptLevel" orm:"benefit_dept_level" description:"受益机构层级"` + CommissionAmount float64 `json:"commissionAmount" orm:"commission_amount" description:"分润金额"` + CommissionStatus int `json:"commissionStatus" orm:"commission_status" description:"分润状态:0待结算,1可提现"` + BenefitSnapshot *gjson.Json `json:"benefitSnapshot" orm:"benefit_snapshot" description:"价格快照(受益机构的成本价+利润+利润悉数=出货单价)"` + AccountPeriod string `json:"accountPeriod" orm:"account_period" description:"账期(YYYY-MM)"` + SettlementTime *gtime.Time `json:"settlementTime" orm:"settlement_time" description:"结算时间"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_fin_withdrawable_change.go b/internal/model/entity/t_fin_withdrawable_change.go new file mode 100644 index 0000000..f263631 --- /dev/null +++ b/internal/model/entity/t_fin_withdrawable_change.go @@ -0,0 +1,34 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinWithdrawableChange is the golang structure for table t_fin_withdrawable_change. +type TFinWithdrawableChange struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"机构ID"` + ChangeType int `json:"changeType" orm:"change_type" description:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` + IncomeExpenseType int `json:"incomeExpenseType" orm:"income_expense_type" description:"收支类型: 0收入,1支出"` + ChangeAmount float64 `json:"changeAmount" orm:"change_amount" description:"变动金额"` + BeforeBalance float64 `json:"beforeBalance" orm:"before_balance" description:"变动前可提现余额"` + AfterBalance float64 `json:"afterBalance" orm:"after_balance" description:"变动后可提现余额"` + AccountType int `json:"accountType" orm:"account_type" description:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" orm:"bank_name" description:"开户行名称"` + BankAccount string `json:"bankAccount" orm:"bank_account" description:"开户行账号或账号"` + AccountName string `json:"accountName" orm:"account_name" description:"用户姓名"` + IdentityCard string `json:"identityCard" orm:"identity_card" description:"用户身份证号"` + SourceNo string `json:"sourceNo" orm:"source_no" description:"来源单号"` + Remark string `json:"remark" orm:"remark" description:"备注"` + AccountPeriod string `json:"accountPeriod" orm:"account_period" description:"账期(YYYY-MM)"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_finance_apply.go b/internal/model/entity/t_finance_apply.go new file mode 100644 index 0000000..c06c622 --- /dev/null +++ b/internal/model/entity/t_finance_apply.go @@ -0,0 +1,38 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinanceApply is the golang structure for table t_finance_apply. +type TFinanceApply struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + ApplyNo string `json:"applyNo" orm:"apply_no" description:"申请单号"` + ApplyType int `json:"applyType" orm:"apply_type" description:"申请类型(1:提现申请,2:余额转提现)"` + AuditType int `json:"auditType" orm:"audit_type" description:"审核类型:1初审,2复审"` + ApplyDeptId int64 `json:"applyDeptId" orm:"apply_dept_id" description:"申请机构ID"` + AuditDeptId int64 `json:"auditDeptId" orm:"audit_dept_id" description:"审核方机构ID,通常为直属上级或顶级"` + AvailableAmountSnapshot float64 `json:"availableAmountSnapshot" orm:"available_amount_snapshot" description:"申请前可提现余额快照"` + ApplyAmount float64 `json:"applyAmount" orm:"apply_amount" description:"申请金额"` + AccountType int `json:"accountType" orm:"account_type" description:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" orm:"bank_name" description:"开户行名称"` + BankAccount string `json:"bankAccount" orm:"bank_account" description:"开户行账号或账号"` + AccountName string `json:"accountName" orm:"account_name" description:"用户姓名"` + IdentityCard string `json:"identityCard" orm:"identity_card" description:"用户身份证号"` + ReceiveAccount *gjson.Json `json:"receiveAccount" orm:"receive_account" description:"收款账户信息快照"` + ApplyStatus int `json:"applyStatus" orm:"apply_status" description:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + ApplyTime *gtime.Time `json:"applyTime" orm:"apply_time" description:"申请时间"` + AuditTime *gtime.Time `json:"auditTime" orm:"audit_time" description:"最近审核时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_finance_audit_record.go b/internal/model/entity/t_finance_audit_record.go new file mode 100644 index 0000000..4b9a59c --- /dev/null +++ b/internal/model/entity/t_finance_audit_record.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinanceAuditRecord is the golang structure for table t_finance_audit_record. +type TFinanceAuditRecord struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + AuditNo string `json:"auditNo" orm:"audit_no" description:"审核记录编号"` + ApplyNo string `json:"applyNo" orm:"apply_no" description:"申请单号"` + AuditDeptId int64 `json:"auditDeptId" orm:"audit_dept_id" description:"审核方机构ID"` + AuditorUserId int64 `json:"auditorUserId" orm:"auditor_user_id" description:"审核人ID"` + AuditResult int `json:"auditResult" orm:"audit_result" description:"审核结果:0通过,1驳回"` + AuditOpinion string `json:"auditOpinion" orm:"audit_opinion" description:"审核意见"` + AuditTime *gtime.Time `json:"auditTime" orm:"audit_time" description:"审核时间"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_order.go b/internal/model/entity/t_order.go new file mode 100644 index 0000000..dfe43f4 --- /dev/null +++ b/internal/model/entity/t_order.go @@ -0,0 +1,66 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TOrder is the golang structure for table t_order. +type TOrder struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + OrderSn string `json:"orderSn" orm:"order_sn" description:"订单编号"` + ParentOrderId int64 `json:"parentOrderId" orm:"parent_order_id" description:"父订单ID"` + ParentOrderSn string `json:"parentOrderSn" orm:"parent_order_sn" description:"父订单编号"` + CustomerType int `json:"customerType" orm:"customer_type" description:"客户类型 枚举"` + CustomerAgentId int64 `json:"customerAgentId" orm:"customer_agent_id" description:"渠道编号(购买方)"` + EndUserId int64 `json:"endUserId" orm:"end_user_id" description:"终端客户编号"` + AgentId int64 `json:"agentId" orm:"agent_id" description:"渠道编号(销售方)"` + OrderType int `json:"orderType" orm:"order_type" description:"订单类型 枚举"` + OrderStatus int `json:"orderStatus" orm:"order_status" description:"订单状态 枚举"` + ShippingStatus int `json:"shippingStatus" orm:"shipping_status" description:"配送状态 枚举"` + ReturnStatus int `json:"returnStatus" orm:"return_status" description:"退货状态 枚举"` + Consignee string `json:"consignee" orm:"consignee" description:"收货人姓名"` + Mobile string `json:"mobile" orm:"mobile" description:"收货人手机"` + Email string `json:"email" orm:"email" description:"收货人邮箱"` + Address string `json:"address" orm:"address" description:"详细地址"` + AreaCode string `json:"areaCode" orm:"area_code" description:"行政区域代码"` + BuyerNote string `json:"buyerNote" orm:"buyer_note" description:"买家备注"` + AdminNote string `json:"adminNote" orm:"admin_note" description:"商家备注"` + Remark string `json:"remark" orm:"remark" description:"系统备注"` + ShippingMethod int `json:"shippingMethod" orm:"shipping_method" description:"发货方式 枚举"` + LogisticsId int64 `json:"logisticsId" orm:"logistics_id" description:"快递公司ID"` + LogisticsName string `json:"logisticsName" orm:"logistics_name" description:"物流公司名称"` + ShippingTypeId int64 `json:"shippingTypeId" orm:"shipping_type_id" description:"配送类型ID"` + ShippingTypeName string `json:"shippingTypeName" orm:"shipping_type_name" description:"配送类型名称"` + TrackingNo string `json:"trackingNo" orm:"tracking_no" description:"物流单号"` + ShippingTime *gtime.Time `json:"shippingTime" orm:"shipping_time" description:"发货时间"` + ReceivedTime *gtime.Time `json:"receivedTime" orm:"received_time" description:"收货时间"` + PayType int `json:"payType" orm:"pay_type" description:"支付类型 枚举"` + PayStatus int `json:"payStatus" orm:"pay_status" description:"支付状态 枚举"` + PayOrderSn string `json:"payOrderSn" orm:"pay_order_sn" description:"支付订单编号"` + PayTime *gtime.Time `json:"payTime" orm:"pay_time" description:"支付时间"` + TotalAmount float64 `json:"totalAmount" orm:"total_amount" description:"订单总金额"` + ProductAmount float64 `json:"productAmount" orm:"product_amount" description:"商品总金额"` + ShippingFee float64 `json:"shippingFee" orm:"shipping_fee" description:"运费金额"` + ServiceFee float64 `json:"serviceFee" orm:"service_fee" description:"服务费金额"` + InvoiceFee float64 `json:"invoiceFee" orm:"invoice_fee" description:"发票费金额"` + CouponAmount float64 `json:"couponAmount" orm:"coupon_amount" description:"优惠券抵扣金额"` + DiscountAmount float64 `json:"discountAmount" orm:"discount_amount" description:"活动优惠金额"` + Balance float64 `json:"balance" orm:"balance" description:"余额抵扣金额"` + PaidAmount float64 `json:"paidAmount" orm:"paid_amount" description:"已支付总金额"` + OnlinePaidAmount float64 `json:"onlinePaidAmount" orm:"online_paid_amount" description:"线上支付金额"` + OfflinePaidAmount float64 `json:"offlinePaidAmount" orm:"offline_paid_amount" description:"线下支付金额"` + UnpaidAmount float64 `json:"unpaidAmount" orm:"unpaid_amount" description:"未支付金额"` + UnrefundAmount float64 `json:"unrefundAmount" orm:"unrefund_amount" description:"未退款金额"` + IsNeedCommission int `json:"isNeedCommission" orm:"is_need_commission" description:"是否需要分佣 枚举:yesno_enum"` + DistributionStatus int `json:"distributionStatus" orm:"distribution_status" description:"分销分成状态 枚举"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_order_item.go b/internal/model/entity/t_order_item.go new file mode 100644 index 0000000..ff73584 --- /dev/null +++ b/internal/model/entity/t_order_item.go @@ -0,0 +1,45 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TOrderItem is the golang structure for table t_order_item. +type TOrderItem struct { + ItemId int64 `json:"itemId" orm:"item_id" description:"订单商品信息自增id"` + OrderId int64 `json:"orderId" orm:"order_id" description:"订单ID"` + OrderSn string `json:"orderSn" orm:"order_sn" description:"订单编号"` + CustomerType int `json:"customerType" orm:"customer_type" description:"客户类型 枚举"` + CustomerAgentId int64 `json:"customerAgentId" orm:"customer_agent_id" description:"渠道编号(购买方)"` + EndUserId int64 `json:"endUserId" orm:"end_user_id" description:"客户编号"` + Price float64 `json:"price" orm:"price" description:"商品最终单价"` + Quantity uint `json:"quantity" orm:"quantity" description:"商品的购买数量"` + ProductId int64 `json:"productId" orm:"product_id" description:"商品ID"` + ProductName string `json:"productName" orm:"product_name" description:"商品的名称"` + ProductSn string `json:"productSn" orm:"product_sn" description:"商品的唯一货号"` + PicThumb string `json:"picThumb" orm:"pic_thumb" description:"商品缩略图"` + SkuId int64 `json:"skuId" orm:"sku_id" description:"规格ID"` + SkuData string `json:"skuData" orm:"sku_data" description:"【JSON】sku信息[{sku_id,sku_value,sku_name}]"` + DeliveryQuantity uint `json:"deliveryQuantity" orm:"delivery_quantity" description:"发货数量"` + ProductType uint `json:"productType" orm:"product_type" description:"商品类型 枚举"` + IsGift uint `json:"isGift" orm:"is_gift" description:"是否为赠品 枚举:yesno_enum"` + AgentId int64 `json:"agentId" orm:"agent_id" description:"渠道编号(销售方)"` + PrepayPrice float64 `json:"prepayPrice" orm:"prepay_price" description:"预售价格"` + Commission string `json:"commission" orm:"commission" description:"佣金数据"` + OriginPrice float64 `json:"originPrice" orm:"origin_price" description:"商品初始价格"` + PromotionData string `json:"promotionData" orm:"promotion_data" description:"优惠信息"` + ExtraSkuData string `json:"extraSkuData" orm:"extra_sku_data" description:"附加属性"` + PayMode int `json:"payMode" orm:"pay_mode" description:"付费方式 枚举"` + ServiceBeginTime *gtime.Time `json:"serviceBeginTime" orm:"service_begin_time" description:"服务开始时间"` + ServiceEndTime *gtime.Time `json:"serviceEndTime" orm:"service_end_time" description:"服务结束时间"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_package_customer.go b/internal/model/entity/t_package_customer.go new file mode 100644 index 0000000..3da54b6 --- /dev/null +++ b/internal/model/entity/t_package_customer.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TPackageCustomer is the golang structure for table t_package_customer. +type TPackageCustomer struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + PackageCode string `json:"packageCode" orm:"package_code" description:"套餐编码"` + PackageName string `json:"packageName" orm:"package_name" description:"套餐名称"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"组织客户ID"` + DeptName string `json:"deptName" orm:"dept_name" description:"组织客户名称"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_profit_account_month_bill.go b/internal/model/entity/t_profit_account_month_bill.go new file mode 100644 index 0000000..317348d --- /dev/null +++ b/internal/model/entity/t_profit_account_month_bill.go @@ -0,0 +1,37 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TProfitAccountMonthBill is the golang structure for table t_profit_account_month_bill. +type TProfitAccountMonthBill struct { + Id int64 `json:"id" orm:"id" description:"账单ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"机构ID"` + AccountPeriod string `json:"accountPeriod" orm:"account_period" description:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" orm:"opening_balance" description:"月初余额"` + CommissionIncome float64 `json:"commissionIncome" orm:"commission_income" description:"分润收入"` + BalanceTransferInIncome float64 `json:"balanceTransferInIncome" orm:"balance_transfer_in_income" description:"余额转提现收入"` + WithdrawalExpense float64 `json:"withdrawalExpense" orm:"withdrawal_expense" description:"提现支出"` + WithdrawableTransferOutExpense float64 `json:"withdrawableTransferOutExpense" orm:"withdrawable_transfer_out_expense" description:"可提现转余额支出"` + ProfitCreditRepayExpense float64 `json:"profitCreditRepayExpense" orm:"profit_credit_repay_expense" description:"盈利账户还款支出"` + TotalIncome float64 `json:"totalIncome" orm:"total_income" description:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" orm:"total_expense" description:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" orm:"closing_balance" description:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" orm:"income_count" description:"收入笔数"` + ExpenseCount int `json:"expenseCount" orm:"expense_count" description:"支出笔数"` + BillStatus int `json:"billStatus" orm:"bill_status" description:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" orm:"settle_time" description:"结算时间"` + SettleBy int64 `json:"settleBy" orm:"settle_by" description:"结算人ID"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_resource_batch_download.go b/internal/model/entity/t_resource_batch_download.go new file mode 100644 index 0000000..bdd7b89 --- /dev/null +++ b/internal/model/entity/t_resource_batch_download.go @@ -0,0 +1,46 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TResourceBatchDownload is the golang structure for table t_resource_batch_download. +type TResourceBatchDownload struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + BatchNo string `json:"batchNo" orm:"batch_no" description:"批次编号(全局唯一)"` + TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` + ResourceType int `json:"resourceType" orm:"resource_type" description:"资源类型 枚举"` + ExportScene int `json:"exportScene" orm:"export_scene" description:"导出场景 枚举"` + QueryParams *gjson.Json `json:"queryParams" orm:"query_params" description:"导出查询条件快照"` + TotalCount int `json:"totalCount" orm:"total_count" description:"预计导出总条数"` + SuccessCount int `json:"successCount" orm:"success_count" description:"已成功导出条数"` + FailCount int `json:"failCount" orm:"fail_count" description:"失败条数"` + DownloadStatus int `json:"downloadStatus" orm:"download_status" description:"下载状态 枚举"` + OssId int64 `json:"ossId" orm:"oss_id" description:"OSS文件ID"` + FileName string `json:"fileName" orm:"file_name" description:"导出文件名"` + FileExt string `json:"fileExt" orm:"file_ext" description:"文件扩展名"` + FileUrl string `json:"fileUrl" orm:"file_url" description:"文件访问地址"` + FilePath string `json:"filePath" orm:"file_path" description:"服务器本地路径"` + FileSize int64 `json:"fileSize" orm:"file_size" description:"文件大小(字节)"` + FileMd5 string `json:"fileMd5" orm:"file_md5" description:"文件MD5"` + DownloadCount int `json:"downloadCount" orm:"download_count" description:"下载次数"` + LastDownloadTime *gtime.Time `json:"lastDownloadTime" orm:"last_download_time" description:"最后下载时间"` + MaxDownloadCount int `json:"maxDownloadCount" orm:"max_download_count" description:"最大下载次数限制"` + ErrorMessage string `json:"errorMessage" orm:"error_message" description:"失败原因"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"所属机构ID"` + StartTime *gtime.Time `json:"startTime" orm:"start_time" description:"任务开始时间"` + FinishTime *gtime.Time `json:"finishTime" orm:"finish_time" description:"任务完成时间"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"文件过期时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_bind_package_logs.go b/internal/model/entity/t_sim_bind_package_logs.go new file mode 100644 index 0000000..88cc3b0 --- /dev/null +++ b/internal/model/entity/t_sim_bind_package_logs.go @@ -0,0 +1,38 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimBindPackageLogs is the golang structure for table t_sim_bind_package_logs. +type TSimBindPackageLogs struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + SubscriptionNo string `json:"subscriptionNo" orm:"subscription_no" description:"订购记录编号"` + BatchNo string `json:"batchNo" orm:"batch_no" description:"批次编号"` + Iccid string `json:"iccid" orm:"iccid" description:"ICCID"` + Msisdn string `json:"msisdn" orm:"msisdn" description:"MSISDN/卡号"` + DeptId string `json:"deptId" orm:"dept_id" description:"部门机构编号"` + PackageType int `json:"packageType" orm:"package_type" description:"套餐类型"` + PackageCode string `json:"packageCode" orm:"package_code" description:"套餐编号"` + PreviousPackageCode string `json:"previousPackageCode" orm:"previous_package_code" description:"变更前套餐编号"` + BusinessType int `json:"businessType" orm:"business_type" description:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" orm:"effective_status" description:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" orm:"handle_time" description:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" orm:"effective_time" description:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" orm:"expected_expire_time" description:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" orm:"actual_expire_time" description:"实际到期时间"` + DurationMonths int `json:"durationMonths" orm:"duration_months" description:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" orm:"gift_duration_months" description:"赠送时长(月)"` + OrderCode string `json:"orderCode" orm:"order_code" description:"订单编号"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_card_bind_pkg.go b/internal/model/entity/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..b62b79b --- /dev/null +++ b/internal/model/entity/t_sim_card_bind_pkg.go @@ -0,0 +1,38 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardBindPkg is the golang structure for table t_sim_card_bind_pkg. +type TSimCardBindPkg struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + SubscriptionNo string `json:"subscriptionNo" orm:"subscription_no" description:"订购记录编号"` + BatchNo string `json:"batchNo" orm:"batch_no" description:"批次编号"` + Iccid string `json:"iccid" orm:"iccid" description:"ICCID"` + Msisdn string `json:"msisdn" orm:"msisdn" description:"MSISDN/卡号"` + DeptId string `json:"deptId" orm:"dept_id" description:"部门机构编号"` + PackageType int `json:"packageType" orm:"package_type" description:"套餐类型"` + PackageCode string `json:"packageCode" orm:"package_code" description:"套餐编号"` + PreviousPackageCode string `json:"previousPackageCode" orm:"previous_package_code" description:"变更前套餐编号"` + BusinessType int `json:"businessType" orm:"business_type" description:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" orm:"effective_status" description:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" orm:"handle_time" description:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" orm:"effective_time" description:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" orm:"expected_expire_time" description:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" orm:"actual_expire_time" description:"实际到期时间"` + DurationMonths int `json:"durationMonths" orm:"duration_months" description:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" orm:"gift_duration_months" description:"赠送时长(月)"` + OrderCode string `json:"orderCode" orm:"order_code" description:"订单编号"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_card_info.go b/internal/model/entity/t_sim_card_info.go new file mode 100644 index 0000000..47cc89d --- /dev/null +++ b/internal/model/entity/t_sim_card_info.go @@ -0,0 +1,71 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardInfo is the golang structure for table t_sim_card_info. +type TSimCardInfo struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + Iccid string `json:"iccid" orm:"iccid" description:"ICCID"` + Msisdn string `json:"msisdn" orm:"msisdn" description:"MSISDN/卡号"` + Imsi string `json:"imsi" orm:"imsi" description:"IMSI"` + Imei string `json:"imei" orm:"imei" description:"IMEI"` + RegionCode string `json:"regionCode" orm:"region_code" description:"归属地"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"渠道客户ID"` + CurrentPackageCode string `json:"currentPackageCode" orm:"current_package_code" description:"当前套餐编号"` + PackageStatus int `json:"packageStatus" orm:"package_status" description:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + AccessType int `json:"accessType" orm:"access_type" description:"接入方式:ipv4、ipv6、ipv4_ipv6"` + BossCardStatus int `json:"bossCardStatus" orm:"boss_card_status" description:"运营商卡状态 枚举"` + CardType int `json:"cardType" orm:"card_type" description:"卡类型 枚举"` + BossOpenAt *gtime.Time `json:"bossOpenAt" orm:"boss_open_at" description:"运营商开户日期"` + BossActivateAt *gtime.Time `json:"bossActivateAt" orm:"boss_activate_at" description:"运营商激活日期"` + IsBossActivateEnabled int `json:"isBossActivateEnabled" orm:"is_boss_activate_enabled" description:"是否按运营商激活减去赠送时长方:1是,0否"` + InboundBatchNo string `json:"inboundBatchNo" orm:"inbound_batch_no" description:"入库批次"` + OutboundBatchNo string `json:"outboundBatchNo" orm:"outbound_batch_no" description:"出库批次"` + AllocationBatchNo string `json:"allocationBatchNo" orm:"allocation_batch_no" description:"划拨批次"` + IsFlowPool int `json:"isFlowPool" orm:"is_flow_pool" description:"是否为池卡:1是,0否"` + FlowPoolCode string `json:"flowPoolCode" orm:"flow_pool_code" description:"流量池编号"` + OutStockTime *gtime.Time `json:"outStockTime" orm:"out_stock_time" description:"出库时间"` + FlowPkgBeginAt *gtime.Time `json:"flowPkgBeginAt" orm:"flow_pkg_begin_at" description:"当前套餐生效时间"` + FlowPkgPresentAt *gtime.Time `json:"flowPkgPresentAt" orm:"flow_pkg_present_at" description:"套餐赠送结束时间"` + FlowPkgRealPresentAt *gtime.Time `json:"flowPkgRealPresentAt" orm:"flow_pkg_real_present_at" description:"实际赠送结束时间"` + FlowPkgEndAt *gtime.Time `json:"flowPkgEndAt" orm:"flow_pkg_end_at" description:"当前套餐预计到期时间"` + DataServiceStatus int `json:"dataServiceStatus" orm:"data_service_status" description:"数据服务状态:1启用、0禁用"` + PackageTotalFlowMb float64 `json:"packageTotalFlowMb" orm:"package_total_flow_mb" description:"套餐总流量MB"` + UsedFlowMb float64 `json:"usedFlowMb" orm:"used_flow_mb" description:"已用流量MB"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" orm:"traffic_cutoff_status" description:"达量断网配置状态:0未配置,1已开启,2已关闭"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" orm:"traffic_cutoff_threshold" description:"达量断网阈值"` + SmsServiceStatus int `json:"smsServiceStatus" orm:"sms_service_status" description:"短信服务状态:1启用、0禁用"` + PackageTotalSms int `json:"packageTotalSms" orm:"package_total_sms" description:"套餐短信总条数"` + UsedSms int `json:"usedSms" orm:"used_sms" description:"已用短信条数"` + VoiceServiceStatus int `json:"voiceServiceStatus" orm:"voice_service_status" description:"语音服务状态:1启用、0禁用"` + PackageTotalVoice int `json:"packageTotalVoice" orm:"package_total_voice" description:"套餐语音总分钟数"` + UsedVoice int `json:"usedVoice" orm:"used_voice" description:"已用语音分钟数"` + RoamServiceStatus int `json:"roamServiceStatus" orm:"roam_service_status" description:"国漫服务状态:1启用、0禁用"` + PackageTotalRoamFlowMb float64 `json:"packageTotalRoamFlowMb" orm:"package_total_roam_flow_mb" description:"套餐国际流量MB"` + UsedRoamFlowMb float64 `json:"usedRoamFlowMb" orm:"used_roam_flow_mb" description:"已用国际流量MB"` + StatusSyncTime *gtime.Time `json:"statusSyncTime" orm:"status_sync_time" description:"状态最后一次同步时间"` + FlowSyncTime *gtime.Time `json:"flowSyncTime" orm:"flow_sync_time" description:"流量最后一次同步时间"` + SmsSyncTime *gtime.Time `json:"smsSyncTime" orm:"sms_sync_time" description:"短信最后一次同步时间"` + VoiceSyncTime *gtime.Time `json:"voiceSyncTime" orm:"voice_sync_time" description:"语音最后一次同步时间"` + RoamSyncTime *gtime.Time `json:"roamSyncTime" orm:"roam_sync_time" description:"国漫最后一次同步时间"` + ImeiSyncTime *gtime.Time `json:"imeiSyncTime" orm:"imei_sync_time" description:"IMEI 最后一次轮询同步时间"` + ImeiUpdateTime *gtime.Time `json:"imeiUpdateTime" orm:"imei_update_time" description:"IMEI 值最后一次实际变更时间"` + ExtraFeeEnabled int `json:"extraFeeEnabled" orm:"extra_fee_enabled" description:"是否收取附加费:1是,0否"` + ExtraFeeMultiple float64 `json:"extraFeeMultiple" orm:"extra_fee_multiple" description:"附加费用倍数"` + ExtraFee float64 `json:"extraFee" orm:"extra_fee" description:"附加金额"` + ChanKey string `json:"chanKey" orm:"chan_key" description:"通道编号"` + NetModel int `json:"netModel" orm:"net_model" description:"网络类型:4G、5G、NB-IoT"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_card_stock.go b/internal/model/entity/t_sim_card_stock.go new file mode 100644 index 0000000..8a9ec21 --- /dev/null +++ b/internal/model/entity/t_sim_card_stock.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardStock is the golang structure for table t_sim_card_stock. +type TSimCardStock struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + BatchNo string `json:"batchNo" orm:"batch_no" description:""` + Iccid string `json:"iccid" orm:"iccid" description:"ICCID"` + Msisdn string `json:"msisdn" orm:"msisdn" description:"MSISDN"` + Imsi string `json:"imsi" orm:"imsi" description:"IMSI"` + Imei string `json:"imei" orm:"imei" description:"IMEI"` + ChanKey string `json:"chanKey" orm:"chan_key" description:"通道编号"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_channel_template.go b/internal/model/entity/t_sim_channel_template.go new file mode 100644 index 0000000..fa9d234 --- /dev/null +++ b/internal/model/entity/t_sim_channel_template.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimChannelTemplate is the golang structure for table t_sim_channel_template. +type TSimChannelTemplate struct { + Id int64 `json:"id" orm:"id" description:"ID"` + TempKey string `json:"tempKey" orm:"temp_key" description:"模板标识"` + TempName string `json:"tempName" orm:"temp_name" description:"模板名称"` + TempModel string `json:"tempModel" orm:"temp_model" description:"模板模型"` + TempConfig string `json:"tempConfig" orm:"temp_config" description:"模板配置"` + TempStatus int `json:"tempStatus" orm:"temp_status" description:"模板状态(0未启用,1启用)"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_channels.go b/internal/model/entity/t_sim_channels.go new file mode 100644 index 0000000..bd1605a --- /dev/null +++ b/internal/model/entity/t_sim_channels.go @@ -0,0 +1,38 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimChannels is the golang structure for table t_sim_channels. +type TSimChannels struct { + Id int64 `json:"id" orm:"id" description:"ID"` + TempKey string `json:"tempKey" orm:"temp_key" description:"模板标识"` + ChanKey string `json:"chanKey" orm:"chan_key" description:"通道编号"` + ChanName string `json:"chanName" orm:"chan_name" description:"通道名称"` + ChanConfig string `json:"chanConfig" orm:"chan_config" description:"通道配置"` + ChanStatus int `json:"chanStatus" orm:"chan_status" description:"通道状态(0启用,1停用)"` + ShareEnabled int `json:"shareEnabled" orm:"share_enabled" description:"是否开放共享Token(0否,1是)"` + ChanAlias string `json:"chanAlias" orm:"chan_alias" description:"通道别名"` + RegionCode string `json:"regionCode" orm:"region_code" description:"通道行政区域代码(省市)"` + AppKey string `json:"appKey" orm:"app_key" description:"应用标识"` + AppSecret string `json:"appSecret" orm:"app_secret" description:"应用密钥"` + AccessToken string `json:"accessToken" orm:"access_token" description:"接口调用凭证"` + AccessTokenCreated *gtime.Time `json:"accessTokenCreated" orm:"access_token_created" description:"凭证申请时间"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire" orm:"access_token_expire" description:"凭证过期时间"` + RefreshToken string `json:"refreshToken" orm:"refresh_token" description:"刷新凭证"` + Remark string `json:"remark" orm:"remark" description:"备注"` + LoginUser string `json:"loginUser" orm:"login_user" description:"登录账号"` + LoginPassword string `json:"loginPassword" orm:"login_password" description:"登录密码"` + LoginUrl string `json:"loginUrl" orm:"login_url" description:"登录地址"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_flow_package_info.go b/internal/model/entity/t_sim_flow_package_info.go new file mode 100644 index 0000000..1c933bb --- /dev/null +++ b/internal/model/entity/t_sim_flow_package_info.go @@ -0,0 +1,47 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPackageInfo is the golang structure for table t_sim_flow_package_info. +type TSimFlowPackageInfo struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + PackageCode string `json:"packageCode" orm:"package_code" description:"套餐编码"` + CategoryCode string `json:"categoryCode" orm:"category_code" description:"套餐分类编码"` + PoolPackageCode int64 `json:"poolPackageCode" orm:"pool_package_code" description:"池套餐编码"` + PackageName string `json:"packageName" orm:"package_name" description:"套餐名称"` + PackageType int `json:"packageType" orm:"package_type" description:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + BillingMethod int `json:"billingMethod" orm:"billing_method" description:"计费方式"` + SortNo int `json:"sortNo" orm:"sort_no" description:"排序号"` + FlowMb float64 `json:"flowMb" orm:"flow_mb" description:"套餐流量(MB)"` + FlowGb float64 `json:"flowGb" orm:"flow_gb" description:"套餐流量(GB)"` + Enabled int `json:"enabled" orm:"enabled" description:"是否启用:0-否 1-是(yesno_enum)"` + ListPrice float64 `json:"listPrice" orm:"list_price" description:"目录售价"` + CostPrice float64 `json:"costPrice" orm:"cost_price" description:"成本价"` + SysDefaultProfit float64 `json:"sysDefaultProfit" orm:"sys_default_profit" description:"系统默认利润"` + SysDefaultRatio float64 `json:"sysDefaultRatio" orm:"sys_default_ratio" description:"系统默认系数"` + TerminalCost float64 `json:"terminalCost" orm:"terminal_cost" description:"终端成本"` + SysDefaultTerminalProfit float64 `json:"sysDefaultTerminalProfit" orm:"sys_default_terminal_profit" description:"系统默认终端利润"` + SysDefaultTerminalRatio float64 `json:"sysDefaultTerminalRatio" orm:"sys_default_terminal_ratio" description:"系统默认终端系数"` + RenewableDurationConfig *gjson.Json `json:"renewableDurationConfig" orm:"renewable_duration_config" description:"可续费时长配置:[1,2,3]"` + DiscountRateConfig *gjson.Json `json:"discountRateConfig" orm:"discount_rate_config" description:"折扣率配置:{\"duration\":1,\"rate\":100}"` + RenewablePackageCodes *gjson.Json `json:"renewablePackageCodes" orm:"renewable_package_codes" description:"可续费套餐编码列表"` + ChangeablePackageCodes *gjson.Json `json:"changeablePackageCodes" orm:"changeable_package_codes" description:"可变更套餐编码列表"` + TopupPackageCodes *gjson.Json `json:"topupPackageCodes" orm:"topup_package_codes" description:"可订购加油包套餐编码列表"` + IsAutoRenew int `json:"isAutoRenew" orm:"is_auto_renew" description:"是否自动续费:0-否 1-是"` + AutoRenewPackageId int64 `json:"autoRenewPackageId" orm:"auto_renew_package_id" description:"自动续费套餐ID"` + AutoRenewYears int `json:"autoRenewYears" orm:"auto_renew_years" description:"自动续费年限"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_flow_package_price.go b/internal/model/entity/t_sim_flow_package_price.go new file mode 100644 index 0000000..3d062b8 --- /dev/null +++ b/internal/model/entity/t_sim_flow_package_price.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPackagePrice is the golang structure for table t_sim_flow_package_price. +type TSimFlowPackagePrice struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + PackageCode string `json:"packageCode" orm:"package_code" description:"套餐编码"` + AgentScopeType int `json:"agentScopeType" orm:"agent_scope_type" description:"渠道适用类型:0-所有客户 1-指定客户"` + TargetAgentId int64 `json:"targetAgentId" orm:"target_agent_id" description:"指定渠道客户ID"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"机构编号"` + AgentCostRatio float64 `json:"agentCostRatio" orm:"agent_cost_ratio" description:"渠道成本系数"` + AgentCostProfit float64 `json:"agentCostProfit" orm:"agent_cost_profit" description:"渠道成本利润"` + UserCostRatio float64 `json:"userCostRatio" orm:"user_cost_ratio" description:"终端用户成本系数"` + UserCostProfit float64 `json:"userCostProfit" orm:"user_cost_profit" description:"终端用户成本利润"` + Enabled int `json:"enabled" orm:"enabled" description:"是否启用:0-否 1-是(yesno_enum)"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门ID"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_flow_pool.go b/internal/model/entity/t_sim_flow_pool.go new file mode 100644 index 0000000..f67f38c --- /dev/null +++ b/internal/model/entity/t_sim_flow_pool.go @@ -0,0 +1,34 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPool is the golang structure for table t_sim_flow_pool. +type TSimFlowPool struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + FlowPoolCode string `json:"flowPoolCode" orm:"flow_pool_code" description:"流量池编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"客户编号"` + PackageCodes *gjson.Json `json:"packageCodes" orm:"package_codes" description:"套餐编号列表(冗余)"` + PoolPackageCode int64 `json:"poolPackageCode" orm:"pool_package_code" description:"池套餐编码"` + CardCount int64 `json:"cardCount" orm:"card_count" description:"关联卡数量"` + CardFlowMb float64 `json:"cardFlowMb" orm:"card_flow_mb" description:"套餐卡流量MB"` + PoolPackageFlowMb float64 `json:"poolPackageFlowMb" orm:"pool_package_flow_mb" description:"套内总流量MB"` + AddOnFlowMb float64 `json:"addOnFlowMb" orm:"add_on_flow_mb" description:"加油包总流量MB"` + TotalFlowMb float64 `json:"totalFlowMb" orm:"total_flow_mb" description:"总流量MB(套内+加油包)"` + UsedFlowMb float64 `json:"usedFlowMb" orm:"used_flow_mb" description:"已使用流量MB"` + RemainFlowMb float64 `json:"remainFlowMb" orm:"remain_flow_mb" description:"剩余流量MB"` + PoolStatus int `json:"poolStatus" orm:"pool_status" description:"状态:0 正常、1 停用、2 锁定"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_package_category.go b/internal/model/entity/t_sim_package_category.go new file mode 100644 index 0000000..932b947 --- /dev/null +++ b/internal/model/entity/t_sim_package_category.go @@ -0,0 +1,24 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPackageCategory is the golang structure for table t_sim_package_category. +type TSimPackageCategory struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + CategoryCode string `json:"categoryCode" orm:"category_code" description:"套餐分类编号"` + CategoryName string `json:"categoryName" orm:"category_name" description:"套餐分类名称"` + SortNo int `json:"sortNo" orm:"sort_no" description:"排序"` + Enabled int `json:"enabled" orm:"enabled" description:"是否启用:1启用,0停用"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_pool_bind_package.go b/internal/model/entity/t_sim_pool_bind_package.go new file mode 100644 index 0000000..700547d --- /dev/null +++ b/internal/model/entity/t_sim_pool_bind_package.go @@ -0,0 +1,36 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPoolBindPackage is the golang structure for table t_sim_pool_bind_package. +type TSimPoolBindPackage struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + SubscriptionNo string `json:"subscriptionNo" orm:"subscription_no" description:"订购记录编号"` + PoolNo string `json:"poolNo" orm:"pool_no" description:"流量池编号"` + DeptId string `json:"deptId" orm:"dept_id" description:"部门机构编号"` + PackageType int `json:"packageType" orm:"package_type" description:"套餐类型"` + PackageCode string `json:"packageCode" orm:"package_code" description:"套餐编号"` + PreviousPackageCode string `json:"previousPackageCode" orm:"previous_package_code" description:"变更前套餐编号"` + BusinessType int `json:"businessType" orm:"business_type" description:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" orm:"effective_status" description:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" orm:"handle_time" description:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" orm:"effective_time" description:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" orm:"expected_expire_time" description:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" orm:"actual_expire_time" description:"实际到期时间"` + DurationMonths int `json:"durationMonths" orm:"duration_months" description:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" orm:"gift_duration_months" description:"赠送时长(月)"` + OrderCode string `json:"orderCode" orm:"order_code" description:"订单编号"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_pool_warn_config.go b/internal/model/entity/t_sim_pool_warn_config.go new file mode 100644 index 0000000..d5cfcfa --- /dev/null +++ b/internal/model/entity/t_sim_pool_warn_config.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPoolWarnConfig is the golang structure for table t_sim_pool_warn_config. +type TSimPoolWarnConfig struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + PoolId int64 `json:"poolId" orm:"pool_id" description:"流量池ID"` + WarnLevel int `json:"warnLevel" orm:"warn_level" description:"预警等级:1提示,2注意,3警告,4危险,5紧急"` + ThresholdPercent float64 `json:"thresholdPercent" orm:"threshold_percent" description:"阈值(例如0.7)"` + WarnMethods int `json:"warnMethods" orm:"warn_methods" description:"预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔"` + WarnPhones string `json:"warnPhones" orm:"warn_phones" description:"预警手机号 多个逗号分隔"` + WarnEmails string `json:"warnEmails" orm:"warn_emails" description:"预警邮箱 多个逗号分隔"` + AutoAction int `json:"autoAction" orm:"auto_action" description:"自动动作:0无,1限速,2断网"` + IsEnabled int `json:"isEnabled" orm:"is_enabled" description:"是否启用:1启用,0停用"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_sim_upstream_package.go b/internal/model/entity/t_sim_upstream_package.go new file mode 100644 index 0000000..c80d473 --- /dev/null +++ b/internal/model/entity/t_sim_upstream_package.go @@ -0,0 +1,24 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TUpstreamPackage is the golang structure for table t_sim_upstream_package. +type TUpstreamPackage struct { + Id int64 `json:"id" orm:"id" description:"主键"` + UpPkgCode string `json:"upPkgCode" orm:"up_pkg_code" description:"上游套餐编码"` + UpPkgName string `json:"upPkgName" orm:"up_pkg_name" description:"上游套餐名称"` + Operator int `json:"operator" orm:"operator" description:"运营商:1移动,2联通,3电信"` + ApnName string `json:"apnName" orm:"apn_name" description:"APN名称"` + Remark string `json:"remark" orm:"remark" description:"备注"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` +} diff --git a/internal/model/entity/t_tplatform_setting.go b/internal/model/entity/t_tplatform_setting.go new file mode 100644 index 0000000..d9a907f --- /dev/null +++ b/internal/model/entity/t_tplatform_setting.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TTplatformSetting is the golang structure for table t_tplatform_setting. +type TTplatformSetting struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + SubDomain string `json:"subDomain" orm:"sub_domain" description:"二级域名前缀"` + FullDomain string `json:"fullDomain" orm:"full_domain" description:"完整域名"` + AppTitle string `json:"appTitle" orm:"app_title" description:"平台标题"` + AppIcon string `json:"appIcon" orm:"app_icon" description:"图标地址"` + LoginPageTitle string `json:"loginPageTitle" orm:"login_page_title" description:"登录页大标题"` + LoginPageDescription string `json:"loginPageDescription" orm:"login_page_description" description:"登录页描述文案"` + LoginSloganImage string `json:"loginSloganImage" orm:"login_slogan_image" description:"登录标语图地址"` + Sort int `json:"sort" orm:"sort" description:"排序"` + Status int `json:"status" orm:"status" description:"状态 0启用 1禁用"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_wo_audit.go b/internal/model/entity/t_wo_audit.go new file mode 100644 index 0000000..fe50ef6 --- /dev/null +++ b/internal/model/entity/t_wo_audit.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoAudit is the golang structure for table t_wo_audit. +type TWoAudit struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + AuditNo string `json:"auditNo" orm:"audit_no" description:"审核编号"` + WoId int64 `json:"woId" orm:"wo_id" description:"工单ID"` + WoNo string `json:"woNo" orm:"wo_no" description:"工单编号"` + AuditType int `json:"auditType" orm:"audit_type" description:"审核类型:0分派,1转派,2退回,3解决,4关闭,5废除"` + AuditorType int `json:"auditorType" orm:"auditor_type" description:"审核人类型:1终端用户,2代理商,3客服"` + AuditorDeptId int64 `json:"auditorDeptId" orm:"auditor_dept_id" description:"审核人机构ID"` + AuditorUserId int64 `json:"auditorUserId" orm:"auditor_user_id" description:"审核人用户ID"` + AuditorName string `json:"auditorName" orm:"auditor_name" description:"审核人姓名"` + BeforeStatus int `json:"beforeStatus" orm:"before_status" description:"变更前状态"` + AfterStatus int `json:"afterStatus" orm:"after_status" description:"变更后状态"` + AuditResult int `json:"auditResult" orm:"audit_result" description:"审核结果:0通过,1驳回"` + AuditOpinion string `json:"auditOpinion" orm:"audit_opinion" description:"审核意见"` + AuditTime *gtime.Time `json:"auditTime" orm:"audit_time" description:"审核时间"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_wo_communication.go b/internal/model/entity/t_wo_communication.go new file mode 100644 index 0000000..ed8207a --- /dev/null +++ b/internal/model/entity/t_wo_communication.go @@ -0,0 +1,32 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoCommunication is the golang structure for table t_wo_communication. +type TWoCommunication struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + CommNo string `json:"commNo" orm:"comm_no" description:"沟通编号"` + WoId int64 `json:"woId" orm:"wo_id" description:"工单ID"` + WoNo string `json:"woNo" orm:"wo_no" description:"工单编号"` + CommType int `json:"commType" orm:"comm_type" description:"沟通类型:0回复,1反馈"` + SenderType int `json:"senderType" orm:"sender_type" description:"发送人类型:1终端用户,2代理商"` + SenderDeptId int64 `json:"senderDeptId" orm:"sender_dept_id" description:"发送人机构ID"` + SenderUserId int64 `json:"senderUserId" orm:"sender_user_id" description:"发送人用户ID"` + SenderName string `json:"senderName" orm:"sender_name" description:"发送人姓名"` + Content string `json:"content" orm:"content" description:"沟通内容"` + AttachmentUrls *gjson.Json `json:"attachmentUrls" orm:"attachment_urls" description:"附件URL列表"` + CommTime *gtime.Time `json:"commTime" orm:"comm_time" description:"沟通时间"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_wo_main.go b/internal/model/entity/t_wo_main.go new file mode 100644 index 0000000..747a5a8 --- /dev/null +++ b/internal/model/entity/t_wo_main.go @@ -0,0 +1,43 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoMain is the golang structure for table t_wo_main. +type TWoMain struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + WoNo string `json:"woNo" orm:"wo_no" description:"工单编号"` + WoType int `json:"woType" orm:"wo_type" description:"工单类型 0卡,1模组,2设备,3订单,4余额,5提现"` + RelatedId int64 `json:"relatedId" orm:"related_id" description:"关联业务ID"` + Title string `json:"title" orm:"title" description:"工单标题"` + Content string `json:"content" orm:"content" description:"问题描述"` + Attachment string `json:"attachment" orm:"attachment" description:"附件"` + CreatorType int `json:"creatorType" orm:"creator_type" description:"创建人类型:1终端用户,2代理商"` + CreatorDeptId int64 `json:"creatorDeptId" orm:"creator_dept_id" description:"创建机构ID"` + CreatorUserId int64 `json:"creatorUserId" orm:"creator_user_id" description:"创建用户ID"` + CreatorName string `json:"creatorName" orm:"creator_name" description:"创建人姓名"` + CreatorPhone string `json:"creatorPhone" orm:"creator_phone" description:"创建人手机号"` + AssignDeptId int64 `json:"assignDeptId" orm:"assign_dept_id" description:"分派方机构ID"` + AssignUserId int64 `json:"assignUserId" orm:"assign_user_id" description:"分派人用户ID"` + CurrentStatus int `json:"currentStatus" orm:"current_status" description:"当前处理状态:1已分派,2处理中,3已解决,4已完结_关单,5已取消"` + HandlerDeptId int64 `json:"handlerDeptId" orm:"handler_dept_id" description:"处理方机构ID"` + HandlerUserId int64 `json:"handlerUserId" orm:"handler_user_id" description:"处理人用户ID"` + FirstResponseTime *gtime.Time `json:"firstResponseTime" orm:"first_response_time" description:"首次响应时间"` + ResolveTime *gtime.Time `json:"resolveTime" orm:"resolve_time" description:"确认时间"` + CloseTime *gtime.Time `json:"closeTime" orm:"close_time" description:"关闭时间"` + SatisfactionLevel int `json:"satisfactionLevel" orm:"satisfaction_level" description:"满意度:1-5分"` + EvalContent string `json:"evalContent" orm:"eval_content" description:"评价内容"` + EvalTime *gtime.Time `json:"evalTime" orm:"eval_time" description:"评价时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/t_wo_record.go b/internal/model/entity/t_wo_record.go new file mode 100644 index 0000000..347e54b --- /dev/null +++ b/internal/model/entity/t_wo_record.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoRecord is the golang structure for table t_wo_record. +type TWoRecord struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` + WoNo string `json:"woNo" orm:"wo_no" description:"工单编号"` + OperationType int `json:"operationType" orm:"operation_type" description:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId int64 `json:"operationDeptId" orm:"operation_dept_id" description:"操作机构ID"` + OperationUserId int64 `json:"operationUserId" orm:"operation_user_id" description:"操作用户ID"` + TargetDeptId int64 `json:"targetDeptId" orm:"target_dept_id" description:"目标部门ID"` + TargetUserId int64 `json:"targetUserId" orm:"target_user_id" description:"目标用户ID"` + BeforeStatus int `json:"beforeStatus" orm:"before_status" description:"变更前状态"` + AfterStatus int `json:"afterStatus" orm:"after_status" description:"变更后状态"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户ID"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} diff --git a/internal/model/entity/test_demo.go b/internal/model/entity/test_demo.go new file mode 100644 index 0000000..26dc653 --- /dev/null +++ b/internal/model/entity/test_demo.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// TestDemo is the golang structure for table test_demo. +type TestDemo struct { + Id int64 `json:"id" orm:"id" description:"主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + UserId int64 `json:"userId" orm:"user_id" description:"用户id"` + OrderNum int `json:"orderNum" orm:"order_num" description:"排序号"` + TestKey string `json:"testKey" orm:"test_key" description:"key键"` + Value string `json:"value" orm:"value" description:"值"` + Version int `json:"version" orm:"version" description:"版本"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} diff --git a/internal/model/genin/test_demo.go b/internal/model/genin/test_demo.go new file mode 100644 index 0000000..1a82bf3 --- /dev/null +++ b/internal/model/genin/test_demo.go @@ -0,0 +1,129 @@ +// Package genin +// @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 genin + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TestDemoUpdateFields 修改测试单表字段过滤 +type TestDemoUpdateFields struct { + DeptId int64 `json:"deptId" dc:"部门id"` + UserId int64 `json:"userId" dc:"用户id"` + OrderNum int `json:"orderNum" dc:"排序号"` + TestKey string `json:"testKey" dc:"key键"` + Value string `json:"value" dc:"值"` + Version int `json:"version" dc:"版本"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` +} + +// TestDemoInsertFields 新增测试单表字段过滤 +type TestDemoInsertFields struct { + DeptId int64 `json:"deptId" dc:"部门id"` + UserId int64 `json:"userId" dc:"用户id"` + OrderNum int `json:"orderNum" dc:"排序号"` + TestKey string `json:"testKey" dc:"key键"` + Value string `json:"value" dc:"值"` + Version int `json:"version" dc:"版本"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` +} + +// TestDemoEditParam 修改/新增测试单表 +type TestDemoEditParam struct { + entity.TestDemo +} + +func (in *TestDemoEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TestDemoEditModel struct{} + +// TestDemoDeleteParam 删除测试单表 +type TestDemoDeleteParam struct { + Id interface{} `json:"id" v:"required#主键不能为空" dc:"主键"` +} + +func (in *TestDemoDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TestDemoDeleteModel struct{} + +// TestDemoViewParam 获取指定测试单表信息 +type TestDemoViewParam struct { + Id int64 `json:"id" v:"required#主键不能为空" dc:"主键"` +} + +func (in *TestDemoViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TestDemoViewModel struct { + entity.TestDemo + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + DeletedBySumma *hook.MemberSumma `json:"deletedBySumma" dc:"删除人摘要信息"` +} + +// TestDemoListParam 获取测试单表列表 +type TestDemoListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` + DeptDeptName string `json:"deptDeptName" dc:"部门名称"` +} + +func (in *TestDemoListParam) Filter(ctx context.Context) (err error) { + return +} + +type TestDemoListModel struct { + Id int64 `json:"id" dc:"主键"` + TenantId string `json:"tenantId" dc:"租户编号"` + DeptId int64 `json:"deptId" dc:"部门id"` + UserId int64 `json:"userId" dc:"用户id"` + OrderNum int `json:"orderNum" dc:"排序号"` + TestKey string `json:"testKey" dc:"key键"` + Value string `json:"value" dc:"值"` + Version int `json:"version" dc:"版本"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + DeletedBy int64 `json:"deletedBy" dc:"删除人"` + DeletedBySumma *hook.MemberSumma `json:"deletedBySumma" dc:"删除人摘要信息"` + DeptDeptName string `json:"deptDeptName" dc:"部门名称"` +} + +// TestDemoExportModel 导出测试单表 +type TestDemoExportModel struct { + Id int64 `json:"id" dc:"主键"` + TenantId string `json:"tenantId" dc:"租户编号"` + DeptId int64 `json:"deptId" dc:"部门id"` + UserId int64 `json:"userId" dc:"用户id"` + OrderNum int `json:"orderNum" dc:"排序号"` + TestKey string `json:"testKey" dc:"key键"` + Value string `json:"value" dc:"值"` + Version int `json:"version" dc:"版本"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + DeletedBy int64 `json:"deletedBy" dc:"删除人"` + DeptDeptName string `json:"deptDeptName" dc:"部门名称"` +} diff --git a/internal/model/home.go b/internal/model/home.go new file mode 100644 index 0000000..24f9085 --- /dev/null +++ b/internal/model/home.go @@ -0,0 +1,34 @@ +package model + +// 卡片数据统计 +type CardStatistics struct { + TotalCount int64 `json:"totalCount" dc:"总卡数"` // 总卡数 + MonthlyNewCount int64 `json:"monthlyNewCount" dc:"本月新增开卡数"` // 本月新增开卡数 + MonthlyFlowUsage int64 `json:"monthlyFlowUsage" dc:"本月流量用量"` // 本月流量用量 + MonthlyActiveCount int64 `json:"monthlyActiveCount" dc:"本月活跃卡数"` // 本月活跃卡数 +} + +// 卡状态统计 +type CardStatusStatistics struct { + PendingActivationCount int64 `json:"pendingActivationCount" dc:"待激活(1)"` // 待激活(1) + ActivatedCount int64 `json:"activatedCount" dc:"已激活(2)"` // 已激活(2) + StoppedCount int64 `json:"stoppedCount" dc:"停机(4)"` // 停机(4) + TestableCount int64 `json:"testableCount" dc:"可测试(6)"` // 可测试(6) + InventoryCount int64 `json:"inventoryCount" dc:"库存(7)"` // 库存(7) + PreCancelCount int64 `json:"preCancelCount" dc:"预销户(8)"` // 预销户(8) + CanceledCount int64 `json:"canceledCount" dc:"已销户(9)"` // 已销户(9) + UnknownCount int64 `json:"unknownCount" dc:"未知(0)"` // 未知(0) +} + +// FlowUsageChartData 流量使用图表数据,用于折线图展示 +type FlowUsageChartData struct { + Labels []string `json:"labels" dc:"日期标签"` + Values []int64 `json:"values" dc:"流量使用值"` +} + +// FlowPoolUsageItem 单个流量池的流量使用情况 +type FlowPoolUsageItem struct { + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"总流量MB"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已使用流量MB"` +} diff --git a/internal/model/monitor_server.go b/internal/model/monitor_server.go new file mode 100644 index 0000000..2be2376 --- /dev/null +++ b/internal/model/monitor_server.go @@ -0,0 +1,36 @@ +// package model +// @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 model + +type GoRunInfo struct { + GoName string `json:"goName"` //语言名 + GoOs string `json:"goOs"` //操作系统 + Arch string `json:"arch"` //系统架构 + GoVersion string `json:"goVersion"` //GO版本 + StartTime string `json:"startTime"` //系统开始时间 + RunTime int64 `json:"runTime"` //运行时长 + RootPath string `json:"rootPath"` //根路径 + Pwd string `json:"pwd"` //当前路径 + Goroutine string `json:"goroutine"` //协程数 + GoMem string `json:"goMem"` //内存使用 + GoSize string `json:"goSize"` //程序大小 +} + +type CpuInfo struct { + Number int //cup个数 + Cores int32 //核数 + UsedPercent []float64 //cpu使用率 + ModelName string +} + +// NetWorkInfo 网速信息 +type NetWorkInfo struct { + Name string + Receive uint64 + Sent uint64 + ReceiveSpeed uint64 + SentSpeed uint64 +} diff --git a/internal/model/mybytes.go b/internal/model/mybytes.go new file mode 100644 index 0000000..22319d0 --- /dev/null +++ b/internal/model/mybytes.go @@ -0,0 +1,52 @@ +package model + +import ( + "encoding/base64" + "encoding/json" + "errors" +) + +type MyBytes []byte + +func (b MyBytes) MarshalJSON() ([]byte, error) { + base64Str := base64.StdEncoding.EncodeToString(b) + return json.Marshal(base64Str) +} + +func (b *MyBytes) UnmarshalValue(data interface{}) error { + str, ok := data.(string) + if !ok { + return errors.New("data is not a string") + } + bytes, err := base64.StdEncoding.DecodeString(str) + if err != nil { + return err + } + *b = bytes + return nil +} + +func (b *MyBytes) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + return (*b).UnmarshalString(s) +} + +func (b *MyBytes) UnmarshalString(s string) error { + bytes, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return err + } + *b = bytes + return nil +} + +func (b *MyBytes) String() string { + return base64.StdEncoding.EncodeToString(*b) +} + +func (b *MyBytes) Bytes() []byte { + return *b +} diff --git a/internal/model/oldapi.go b/internal/model/oldapi.go new file mode 100644 index 0000000..23e5dd2 --- /dev/null +++ b/internal/model/oldapi.go @@ -0,0 +1,152 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +// 统一模板 +type ReqTemplate[T any] struct { + Param T `json:"Param"` + Verify VerifyItem `json:"verify"` +} + +type VerifyItem struct { + TimeStamp string `json:"timeStamp"` + Password string `json:"password"` + AppId string `json:"appId"` + Sign string `json:"sign"` +} + +type RespTemplate[T any] struct { + Status int `json:"status"` + Message string `json:"message"` + Result T `json:"result"` +} + +// 2.1.1 SIM卡信息详情 请求参数 +type SimCardInfoInput = ReqTemplate[SimCardInfoInputItem] +type SimCardInfoInputItem struct { + Type string `json:"type"` + Cardno string `json:"cardno"` +} + +// 2.1.1 SIM卡信息详情 响应参数 +type SimCardInfoOutput struct { + Vid string `json:"vid"` // 物联网卡虚拟编号 + Msisdn string `json:"msisdn"` // 物联卡号码,最长13位数字 + Iccid string `json:"iccid"` // 20位ICCID卡号 + Imsi string `json:"imsi"` // ≤15位IMSI数字 + Imei string `json:"imei"` // 15~17位IMEI + DeptName string `json:"deptName"` // 所属集团名称 + StatusId int `json:"statusId"` // 卡状态编码 + PackageId string `json:"packageId"` // 套餐编号 + PackageName string `json:"packageName"` // 套餐名称 + Used float64 `json:"used"` // 周期用量 + Remaining float64 `json:"remaining"` // 周期剩余流量 + Type string `json:"type"` // 卡类型 + PacketArr []map[string]interface{} `json:"packetArr"` // 资费计划,仅最后生效1条 + Remark string `json:"remark"` // 备注 + Grouping string `json:"grouping"` // 分组 + DeliverDate string `json:"deliverDate"` // 发货日期 yyyy-MM-dd + ActivateDate string `json:"activateDate"` // 激活日期 yyyy-MM-dd + ExpireTime *gtime.Time `json:"expireTime"` // 到期时间 yyyy-MM-dd HH:mm:ss +} + +var SimCardNameMap = map[int]string{ + 1: "插拔", + 2: "贴卡5X6", + 3: "贴卡2X2", + 4: "插拔卡(MP1)", + 5: "插拔卡(MP2)", + 6: "贴片卡(MS0)", + 7: "贴片卡(MS1)", +} + +// 2.1.3 SIM卡账期用量查询 请求参数 +type SimDataUsageOldInput = ReqTemplate[SimDataUsageInputItem] +type SimDataUsageInputItem struct { + Iccid string `json:"iccid"` +} + +// 2.1.3 SIM卡账期用量查询 响应参数 +type SimDataUsageOldOutput struct { + UseUnit string `json:"useUnit"` // 单位:MB + UseAmount float64 `json:"useAmount"` // 周期用量 +} + +// 2.1.4 SIM卡历史用量查询 请求参数 +type SimDataUsageMonthlyOldInput = ReqTemplate[SimDataUsageMonthlyOldInputItem] +type SimDataUsageMonthlyOldInputItem struct { + Iccid string `json:"iccid"` // 20位ICCID卡号 + DateTime string `json:"dateTime"` // 日期时间 yyyyMM +} + +// 2.1.4 SIM卡历史用量查询 响应参数 +type SimDataUsageMonthlyOldOutput struct { + UseUnit string `json:"useUnit"` // 单位:MB + UseAmount float64 `json:"useAmount"` // 周期用量 +} + +// 2.1.5 SIM卡生命周期查询 请求参数 +type SimStatusOldInput = ReqTemplate[SimStatusOldInputItem] +type SimStatusOldInputItem struct { + Iccid string `json:"iccid"` // 20位ICCID卡号 +} + +// 2.1.5 SIM卡生命周期查询 响应参数 +type SimStatusOldOutput struct { + StatusMessage string `json:"statusMessage"` // 状态描述 + StatusCode int `json:"statusCode"` // 状态码 +} + +var SimCardStatusMap = map[int]string{ + 1: "库存", + 2: "可测试", + 3: "待激活", + 4: "已激活", + 5: "已停机", + 6: "预销户", + 7: "已销户", + 8: "未知", +} + +// 2.1.6 SIM卡在网状态查询 请求参数 +type SimStatusOnlineOldInput = ReqTemplate[SimStatusOnlineOldInputItem] +type SimStatusOnlineOldInputItem struct { + Iccid string `json:"iccid"` // 20位ICCID卡号 +} + +// 2.1.6 SIM卡在网状态查询 响应参数 +type SimStatusOnlineOldOutput struct { + TypeName string `json:"typeName"` // 运营商系统类型 + Imei string `json:"imei"` // 15~17位IMEI + StatusMessage string `json:"statusMessage"` // 状态描述 + StatusCode int `json:"statusCode"` // 状态码 + Data SimStatusOnlineOldData `json:"data"` // 数据 +} +type SimStatusOnlineOldData struct { + ApnId string `json:"apnId"` // APN ID + Rat string `json:"rat"` // Radio Access Technology + Ipv6 string `json:"ipv6"` // IPv6 地址 + Ip string `json:"ip"` // IP 地址 + Ipv6Prefix string `json:"ipv6Prefix"` // IPv6 前缀 + Status string `json:"status"` // 状态 + CreateDate string `json:"createDate"` // 创建时间 yyyy-MM-dd HH:mm:ss +} + +// 2.1.1 批量查询卡基础信息 请求参数 +type QueryCardInfoListInput = ReqTemplate[QueryCardInfoListInputItem] +type QueryCardInfoListInputItem struct { + Iccid []string `json:"iccid"` // 20位ICCID卡号 +} + +// 2.1.1 批量查询卡基础信息 响应参数 +type QueryCardInfoListOutput struct { + Iccid string `json:"iccid"` // 20位ICCID卡号 + ActivateDate string `json:"activateDate"` // 激活日期 yyyy-MM-dd + DueExpireTime string `json:"dueExpireTime"` // 到期时间 yyyy-MM-dd + Imei string `json:"imei"` // 15~17位IMEI + Imsi string `json:"imsi"` // 15~17位IMSI + Msisdn string `json:"msisdn"` // 11位手机号 + Type string `json:"type"` // 卡类型 + Remarks string `json:"remarks"` // 备注 + Status int `json:"status"` // 状态 +} diff --git a/internal/model/qrcode.go b/internal/model/qrcode.go new file mode 100644 index 0000000..5e98f0e --- /dev/null +++ b/internal/model/qrcode.go @@ -0,0 +1,85 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +type QrcodeLoginModel struct { + TempUserId string `json:"tempUserId" dc:"临时用户ID"` + QrcodeCacheModel + Bound bool `json:"bound" dc:"是否已绑定"` + Expired bool `json:"expired" dc:"是否过期"` + LoginUserOut *LoginUserOut `json:"loginUserOut" dc:"登录用户信息"` + Token string `json:"token" dc:"Token"` + UserList []*SysUserSocialModel `json:"userList" dc:"用户列表"` +} + +type ApiCallQrcodeParam struct { + ThirdId int `json:"thirdId" dc:"第三方ID"` + SceneId int `json:"sceneId" dc:"场景ID"` + Token string `json:"token" dc:"Token"` +} + +type ApiCallQrcodeModel struct { + Ticket string `json:"ticket" dc:"Ticket"` + ExpireTime int64 `json:"expireTime" dc:"过期时间"` + QrUrl string `json:"qrUrl" dc:"二维码地址"` +} + +type QrcodeCacheModel struct { + Ticket string `json:"ticket" dc:"Ticket"` + ExpireTime *gtime.Time `json:"expireTime" dc:"过期时间"` + QrUrl string `json:"qrUrl" dc:"二维码地址"` + Scanned bool `json:"scanned" dc:"是否已扫码"` + OpenId string `json:"openId" dc:"微信OpenId"` +} + +type QrcodeRegisterAndBindOpenIdParam struct { + OpenId string `json:"openId" dc:"微信OpenId" v:"required#微信OpenId不能为空"` + SysUserRegisterModel +} + +type QrcodeLoginAndBindOpenIdModel struct { + LoginUserOut *LoginUserOut `json:"loginUserOut" dc:"登录用户信息"` + Token string `json:"token" dc:"Token"` +} + +type QrcodeLoginAndBindOpenIdParam struct { + OpenId string `json:"openId" dc:"微信OpenId" v:"required#微信OpenId不能为空"` + 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 QrcodeBindStatusModel struct { + QrcodeCacheModel + Bound bool `json:"bound" dc:"是否已绑定"` + Expired bool `json:"expired" dc:"是否过期"` +} + +type QrcodeScanCallbackParam struct { + SceneId int `json:"sceneId" dc:"场景ID"` + ThirdId int `json:"thirdId" dc:"第三方ID"` + Ticket string `json:"ticket" dc:"Ticket"` + OpenId string `json:"openId" dc:"微信OpenId"` + Event string `json:"event" dc:"事件类型"` + TimeStamp int64 `json:"timeStamp" dc:"时间戳"` + Sign string `json:"sign" dc:"签名"` +} + +type ApiCallQrcodeResult struct { + Code int `json:"code" dc:"状态码"` + Message string `json:"message" dc:"消息"` + Data struct { + Ticket string `json:"ticket" dc:"Ticket"` + ExpireTime int64 `json:"expireTime" dc:"过期时间"` + QrUrl string `json:"qrUrl" dc:"二维码地址"` + } `json:"data" dc:"数据"` + Error string `json:"error" dc:"错误信息"` +} + +type QrcodeLoginSelectUserIdParam struct { + OpenId string `json:"openId" dc:"微信OpenId" v:"required#微信OpenId不能为空"` + UserName string `json:"userName" dc:"用户名" v:"required#用户名不能为空"` + TenantId string `json:"tenantId" dc:"租户ID" v:"required#租户ID不能为空"` +} diff --git a/internal/model/query_auth.go b/internal/model/query_auth.go new file mode 100644 index 0000000..3d126d0 --- /dev/null +++ b/internal/model/query_auth.go @@ -0,0 +1,61 @@ +package model + +import ( + "errors" + + "github.com/gogf/gf/v2/os/gtime" + jwt "github.com/golang-jwt/jwt/v4" +) + +type BaseClaimsApi struct { + UUID string + ApiId int64 + AppKey string + GroupId int64 + DeptKey string + DeptName string + DeptType int + DeptId int64 + TenantId string + LoginAt int64 +} + +type CustomClaimsApi struct { + BaseClaimsApi + BufferTime int64 + jwt.RegisteredClaims +} + +type ApiTokenClaims struct { + UUID string `json:"u,omitempty"` +} + +func (c *ApiTokenClaims) Valid() error { + if c == nil || c.UUID == "" { + return errors.New("token invalid") + } + return nil +} + +type TokenInputApi struct { + AppKey string `json:"appKey"` + AppSecret string `json:"appSecret"` + Refresh string `json:"refresh"` +} + +type TokenOutputApi struct { + AppId string `json:"appId"` + AccessToken string `json:"accessToken"` +} + +type OperatorTokenInput struct { + AppId string `json:"appId"` + ChanKey string `json:"chanKey"` +} + +type OperatorTokenOutput struct { + ChanAlias string `json:"chanAlias" dc:"通道别名"` + ChanKey string `json:"chanKey" dc:"通道Key"` + AccessToken string `json:"accessToken" dc:"接口调用凭证"` + AccessTokenExpire *gtime.Time `json:"tokenExpire" dc:"过期时间"` +} diff --git a/internal/model/query_sim.go b/internal/model/query_sim.go new file mode 100644 index 0000000..25acc14 --- /dev/null +++ b/internal/model/query_sim.go @@ -0,0 +1,175 @@ +package model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +type QuerySimInput struct { + AppId string `json:"appId"` + Iccid string `json:"iccid"` + Msisdn string `json:"msisdn"` + Imsi string `json:"imsi"` +} + +type QuerySimInfoOutput struct { + Iccid string `json:"iccid"` // ICCID 卡号 + Msisdn string `json:"msisdn"` // 手机号 + Imsi string `json:"imsi"` // IMSI 码 + Imei string `json:"imei"` // IMEI 码(可能为空) + Username string `json:"username"` // 用户名称 + Location string `json:"location"` // 归属地 + PlanCategory string `json:"planCategory"` // 套餐类别 + CurrentPlanName string `json:"currentPlanName"` // 当前套餐名称 + Plangroup string `json:"plangroup"` // 套餐分组(废弃) + Planid string `json:"planid"` // 套餐ID + Appid string `json:"appid"` // 应用ID + AllowPlanChange int `json:"allowPlanChange"` // 是否允许改套餐 1=允许 + LastSyncTime string `json:"lastSyncTime"` // 最后同步时间(流量) + AccessType string `json:"accessType"` // 网络类型 IPV4/IPV6 + CardStatus string `json:"cardStatus"` // 卡状态:可测试/正常/停机等 + CardType interface{} `json:"cardType"` // 卡类型 + NetworkType interface{} `json:"networkType"` // 网络类型 + ActivationDate string `json:"activationDate"` // 激活日期 + ActiveDate string `json:"activeDate"` // 生效日期 + ValidityPeriod int `json:"validityPeriod"` // 有效期(月) + ExpiryDate string `json:"expiryDate"` // 到期日 + TestPeriod int `json:"testPeriod"` // 测试期 + TestPeriodExpiryDate interface{} `json:"testPeriodExpiryDate"` // 测试期到期日 + SilentPeriod int `json:"silentPeriod"` // 沉默期 + SilentPeriodExpiryDate interface{} `json:"silentPeriodExpiryDate"` // 沉默期到期日 + DataService int `json:"dataService"` // 数据业务是否开通 + PlanData int `json:"planData"` // 套餐总流量(MB) + UsedData float64 `json:"usedData"` // 已用流量(MB) + RemainingData string `json:"remainingData"` // 剩余流量 + SmsService int `json:"smsService"` // 短信业务是否开通 + PlanSMS int `json:"planSMS"` // 套餐短信总数 + UsedSMS int `json:"usedSMS"` // 已用短信 + RemainingSMS string `json:"remainingSMS"` // 剩余短信 + VoiceService int `json:"voiceService"` // 语音业务是否开通 + PlanMinutes int `json:"planMinutes"` // 套餐语音时长 + UsedMinutes int `json:"usedMinutes"` // 已用语音时长 + RemainingMinutes string `json:"remainingMinutes"` // 剩余语音时长 + InternationalRoamingService int `json:"internationalRoamingService"` // 国际漫游服务 + PlanInternationalData int `json:"planInternationalData"` // 国际漫游套餐流量 + UsedInternationalData int `json:"usedInternationalData"` // 已用国际漫游流量 + RemainingInternationalData string `json:"remainingInternationalData"` // 剩余国际漫游流量 + Description interface{} `json:"description"` // 备注描述 +} + +type QuerySimInfoCard struct { + entity.TSimCardInfo + DeptName string `json:"deptName"` + DeptKey string `json:"deptKey"` + DeptAreaCode string `json:"deptAreaCode"` + PackageName string `json:"packageName"` + CategoryCode string `json:"categoryCode"` + CategoryName string `json:"categoryName"` +} + +type QuerySimLimitOutput struct { + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0删除,1已开启,2已关闭"` + TrafficCutoffName string `json:"trafficCutoffName" dc:"达量断网类型"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值"` +} + +type QuerySimImeiOutput struct { + Imei string `json:"imei"` +} + +type QuerySimUsageOutput struct { + UseUnit string `json:"useUnit"` + UseAmount float64 `json:"useAmount"` +} + +// QuerySimCardStatusOutput 单卡状态信息查询 响应参数 +// lifeCycle 取值用平台内部枚举(与 t_boss_card_status 字典一致), +// 非 openapi-docs 公共字典那套(两者数字含义不同,勿混用)。 +type QuerySimCardStatusOutput struct { + Iccid string `json:"iccid"` // ICCID + LifeCycle int `json:"lifeCycle"` // 卡状态编码(平台内部枚举) + LifeCycleName string `json:"lifeCycleName"` // 卡状态名称 +} + +// ===== 批量查询(卡状态 / 流量) ===== + +// QuerySimBatchCard 批量查询用单卡标识(iccid/msisdn/imsi 至少传一个) +type QuerySimBatchCard struct { + Msisdn string `json:"msisdn,omitempty" dc:"MSISDN/卡号"` + Iccid string `json:"iccid,omitempty" dc:"ICCID"` + Imsi string `json:"imsi,omitempty" dc:"IMSI"` +} + +// QuerySimStatusBatchParam 批量卡状态查询入参 +type QuerySimStatusBatchParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + Cards []QuerySimBatchCard `json:"cards" v:"required#查询卡不能为空" dc:"查询卡列表"` +} + +// QuerySimStatusBatchItem 单卡状态结果(按输入顺序返回;未匹配见 Matched=false + errorCode) +type QuerySimStatusBatchItem struct { + Matched bool `json:"matched"` + Iccid string `json:"iccid,omitempty"` + LifeCycle int `json:"lifeCycle"` // 卡状态编码(平台内部枚举) + LifeCycleName string `json:"lifeCycleName,omitempty"` + ErrorCode string `json:"errorCode,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` +} + +// QuerySimStatusBatchOutput 批量卡状态查询出参 +type QuerySimStatusBatchOutput struct { + Total int `json:"total"` + MatchedCount int `json:"matchedCount"` + NotFoundCount int `json:"notFoundCount"` + Items []QuerySimStatusBatchItem `json:"items"` +} + +// QuerySimUsageBatchParam 批量流量查询入参 +type QuerySimUsageBatchParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + Cards []QuerySimBatchCard `json:"cards" v:"required#查询卡不能为空" dc:"查询卡列表"` +} + +// QuerySimUsageBatchItem 单卡流量结果 +type QuerySimUsageBatchItem struct { + Matched bool `json:"matched"` + Iccid string `json:"iccid,omitempty"` + UseUnit string `json:"useUnit"` // 流量单位,固定为 MB + UseAmount float64 `json:"useAmount"` // 当前周期已用流量,单位 MB + ErrorCode string `json:"errorCode,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` +} + +// QuerySimUsageBatchOutput 批量流量查询出参 +type QuerySimUsageBatchOutput struct { + Total int `json:"total"` + MatchedCount int `json:"matchedCount"` + NotFoundCount int `json:"notFoundCount"` + Items []QuerySimUsageBatchItem `json:"items"` +} + +// ===== 批量 IMEI 查询 ===== + +// QuerySimImeiBatchParam 批量 IMEI 查询入参(与 sim-status-batch / sim-usage-batch 同构) +type QuerySimImeiBatchParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + Cards []QuerySimBatchCard `json:"cards" v:"required#查询卡不能为空" dc:"查询卡列表"` +} + +// QuerySimImeiBatchItem 单卡 IMEI 结果(按输入顺序返回;未匹配见 Matched=false + errorCode) +// +// Imei 为空不算 notFound:卡存在但上游从未查到值(如不支持的模板通道)。 +type QuerySimImeiBatchItem struct { + Matched bool `json:"matched"` + Iccid string `json:"iccid,omitempty"` + Imei string `json:"imei"` // IMEI,未上报时为空字符串 + ErrorCode string `json:"errorCode,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` +} + +// QuerySimImeiBatchOutput 批量 IMEI 查询出参 +type QuerySimImeiBatchOutput struct { + Total int `json:"total"` + MatchedCount int `json:"matchedCount"` + NotFoundCount int `json:"notFoundCount"` + Items []QuerySimImeiBatchItem `json:"items"` +} diff --git a/internal/model/request/common.go b/internal/model/request/common.go new file mode 100644 index 0000000..e816e9d --- /dev/null +++ b/internal/model/request/common.go @@ -0,0 +1,20 @@ +// package request +// @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 request + +type PageInfo struct { + Page int `json:"page" form:"page" dc:"页码" v:"min:1#页码最小值不能低于1" ` // 页码 + PageSize int `json:"pageSize" form:"pageSize" v:"min:1|max:2000#每页数量最小值不能低于1|最大值不能大于2000" dc:"每页大小"` // 每页大小 + Keyword string `json:"keyword" form:"keyword" dc:"关键字"` // 关键字 +} + +type Empty struct{} + +// SwitchReq 更新开关状态 +type SwitchReq struct { + Key string `json:"key" v:"required#测试ID不能为空" dc:"开关字段"` + Value int `json:"value" v:"in:0,1#输入的开关值是无效的" dc:"更新值"` +} diff --git a/internal/model/response/common.go b/internal/model/response/common.go new file mode 100644 index 0000000..9f9000a --- /dev/null +++ b/internal/model/response/common.go @@ -0,0 +1,12 @@ +// package response +// @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 response + +type PageResult struct { + Page int `json:"page"` + PageSize int `json:"pageSize"` + Total int `json:"total"` +} diff --git a/internal/model/shared_token.go b/internal/model/shared_token.go new file mode 100644 index 0000000..d4771fd --- /dev/null +++ b/internal/model/shared_token.go @@ -0,0 +1,12 @@ +package model + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +type SharedTokenResult struct { + ChanAlias string `json:"chanAlias"` + ChanKey string `json:"chanKey"` + AccessToken string `json:"accessToken"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire"` +} diff --git a/internal/model/sys_auth.go b/internal/model/sys_auth.go new file mode 100644 index 0000000..1b12fce --- /dev/null +++ b/internal/model/sys_auth.go @@ -0,0 +1,38 @@ +// package model +// @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 model + +import ( + jwt "github.com/golang-jwt/jwt/v4" +) + +type BaseClaims struct { + UUID string + ID int64 // 用户ID + Username string // 用户名 + NickName string // 昵称 + DeptId int64 // 部门ID + TenantId string // 租户编号 + Roles []Role // 角色列表 + LoginAt int64 // 登录时间戳(秒) +} + +type CustomClaims struct { + BaseClaims + BufferTime int64 + jwt.RegisteredClaims +} +type LoginParams struct { + CaptchaID string `json:"captchaId" dc:"验证码ID"` + CaptchaValue string `json:"captchaValue" dc:"验证码值"` + Username string `json:"username" dc:"用户名"` + Password string `json:"password" dc:"密码"` + TenantId string `json:"tenantId" dc:"租户ID"` +} + +type LoginResult struct { + Token string +} diff --git a/internal/model/sys_client.go b/internal/model/sys_client.go new file mode 100644 index 0000000..d5ba092 --- /dev/null +++ b/internal/model/sys_client.go @@ -0,0 +1,93 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysClientListModel struct { + Id int64 `json:"id" orm:"id" description:"id"` + ClientId string `json:"clientId" orm:"client_id" description:"客户端id"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端key"` + ClientSecret string `json:"clientSecret" orm:"client_secret" description:"客户端秘钥"` + GrantType string `json:"grantType" orm:"grant_type" description:"授权类型"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + ActiveTimeout int `json:"activeTimeout" orm:"active_timeout" description:"token活跃超时时间"` + Timeout int `json:"timeout" orm:"timeout" description:"token固定超时"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` +} + +type SysClientListParam struct { + request.PageInfo + ClientId string `json:"clientId" orm:"client_id" description:"客户端id"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端key"` + ClientSecret string `json:"clientSecret" orm:"client_secret" description:"客户端秘钥"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` +} + +type SysClientViewParam struct { + Id int64 `json:"id" orm:"id" description:"id"` + ClientId string `json:"clientId" orm:"client_id" description:"客户端id"` +} + +type SysClientViewModel struct { + entity.SysClient +} + +type SysClientAddParam struct { + ClientId string `json:"clientId" orm:"client_id" description:"客户端id"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端key"` + ClientSecret string `json:"clientSecret" orm:"client_secret" description:"客户端秘钥"` + GrantType string `json:"grantType" orm:"grant_type" description:"授权类型"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + ActiveTimeout int `json:"activeTimeout" orm:"active_timeout" description:"token活跃超时时间"` + Timeout int `json:"timeout" orm:"timeout" description:"token固定超时"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` +} + +type SysClientAddModel struct { + Id int64 `json:"id" orm:"id" description:"id"` +} + +type SysClientEditParam struct { + Id int64 `json:"id" description:"id"` + ClientId *string `json:"clientId,omitempty" description:"客户端id"` + ClientKey *string `json:"clientKey,omitempty" description:"客户端key"` + ClientSecret *string `json:"clientSecret,omitempty" description:"客户端秘钥"` + GrantType *string `json:"grantType,omitempty" description:"授权类型"` + DeviceType *string `json:"deviceType,omitempty" description:"设备类型"` + ActiveTimeout *int `json:"activeTimeout,omitempty" description:"token活跃超时时间"` + Timeout *int `json:"timeout,omitempty" description:"token固定超时"` + Status *string `json:"status,omitempty" description:"状态(0正常 1停用)"` +} + +type SysClientEditModel struct { + Id int64 `json:"id" orm:"id" description:"id"` +} + +type SysClientDeleteParam struct { + Ids []int64 `json:"ids" description:"id"` +} + +type SysClientDeleteModel struct { + Ids []int64 `json:"ids" description:"id"` +} + +type SysClientStatusParam struct { + Id int64 `json:"id" description:"id"` + Status string `json:"status" description:"状态(0正常 1停用)"` +} + +type SysClientStatusModel struct { + Id int64 `json:"id" orm:"id" description:"id"` +} diff --git a/internal/model/sys_config.go b/internal/model/sys_config.go new file mode 100644 index 0000000..935ed1f --- /dev/null +++ b/internal/model/sys_config.go @@ -0,0 +1,83 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysConfigListModel struct { + ConfigId int64 `json:"configId" orm:"config_id" description:"参数主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ConfigName string `json:"configName" orm:"config_name" description:"参数名称"` + ConfigKey string `json:"configKey" orm:"config_key" description:"参数键名"` + ConfigValue string `json:"configValue" orm:"config_value" description:"参数键值"` + ConfigType string `json:"configType" orm:"config_type" description:"系统内置(Y是 N否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysConfigListParam struct { + request.PageInfo + ConfigName string `json:"configName" form:"configName" comment:"参数名称"` + ConfigKey string `json:"configKey" form:"configKey" comment:"参数键名"` + ConfigType string `json:"configType" form:"configType" comment:"系统内置"` + ConfigValue string `json:"configValue" orm:"config_value" description:"参数键值"` + CreatedAt []string `json:"createdAt" form:"createdAt" comment:"创建时间"` +} + +type SysConfigAddParam struct { + ConfigName string `json:"configName" description:"参数名称"` + ConfigKey string `json:"configKey" description:"参数键名"` + ConfigValue string `json:"configValue" description:"参数键值"` + ConfigType string `json:"configType" description:"系统内置(Y是 N否)"` + Remark string `json:"remark" description:"备注"` +} + +type SysConfigAddModel struct { + ConfigId int64 `json:"configId" form:"configId" comment:"参数主键"` +} + +type SysConfigEditParam struct { + ConfigId int64 `json:"configId" description:"参数主键"` + ConfigName *string `json:"configName" description:"参数名称"` + ConfigKey *string `json:"configKey" description:"参数键名"` + ConfigValue *string `json:"configValue" description:"参数键值"` + ConfigType *string `json:"configType" description:"系统内置(Y是 N否)"` + Remark *string `json:"remark" description:"备注"` +} +type SysConfigEditModel struct { + ConfigId int64 `json:"configId" form:"configId" comment:"参数主键"` +} + +type SysConfigDeleteParam struct { + ConfigIds []int64 `json:"configIds" form:"configIds" comment:"参数主键"` +} + +type SysConfigDeleteModel struct { + ConfigIds []int64 `json:"configIds" form:"configIds" comment:"参数主键"` +} + +type SysConfigViewParam struct { + ConfigId int64 `json:"configId" form:"configId" comment:"参数主键"` +} + +type SysConfigViewModel struct { + ConfigId int64 `json:"configId" orm:"config_id" description:"参数主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ConfigName string `json:"configName" orm:"config_name" description:"参数名称"` + ConfigKey string `json:"configKey" orm:"config_key" description:"参数键名"` + ConfigValue string `json:"configValue" orm:"config_value" description:"参数键值"` + ConfigType string `json:"configType" orm:"config_type" description:"系统内置(Y是 N否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/sys_dept.go b/internal/model/sys_dept.go new file mode 100644 index 0000000..6d11125 --- /dev/null +++ b/internal/model/sys_dept.go @@ -0,0 +1,115 @@ +// package model +// @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 model + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +type SysDeptMiniModel struct { + g.Meta `orm:"table:sys_dept" description:"部门"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父部门id"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` +} + +type SysDeptListParam struct { + DeptName string `json:"deptName" description:"部门名称"` + Status string `json:"status" description:"部门状态(0正常 1停用)"` + DeptType *int `json:"deptType" description:"部门类型(0:部门 1:公司)"` +} + +type SysDeptListModel struct { + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptType int `json:"deptType" orm:"dept_type" description:"部门类型(0:部门 1:公司)"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父部门id"` + Ancestors string `json:"ancestors" orm:"ancestors" description:"祖级列表"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` + DeptCategory string `json:"deptCategory" orm:"dept_category" description:"部门类别编码"` + OrderNum int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Leader int64 `json:"leader" orm:"leader" description:"负责人"` + Phone string `json:"phone" orm:"phone" description:"联系电话"` + Email string `json:"email" orm:"email" description:"邮箱"` + Status string `json:"status" orm:"status" description:"部门状态(0正常 1停用)"` +} + +type SysDeptTreeModel struct { + DeptId int64 `json:"deptId" description:"部门id"` + ParentId int64 `json:"parentId" description:"父部门id"` + Key string `json:"key" description:"key"` + DeptName string `json:"deptName" description:"部门名称"` + Children []*SysDeptTreeModel `json:"children" description:"子部门"` + Ancestors string `json:"ancestors" description:"祖级列表"` + DeptType int `json:"deptType" description:"部门类型(0:部门 1:公司)"` +} + +type SysDeptViewModel struct { + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptType int `json:"deptType" orm:"dept_type" description:"部门类型(0:部门 1:公司)"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父部门id"` + Ancestors string `json:"ancestors" orm:"ancestors" description:"祖级列表"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` + FullName string `json:"fullName" description:"单位全称"` + DeptCategory string `json:"deptCategory" orm:"dept_category" description:"部门类别编码"` + OrderNum int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Leader int64 `json:"leader" orm:"leader" description:"负责人"` + Phone string `json:"phone" orm:"phone" description:"联系电话"` + Email string `json:"email" orm:"email" description:"邮箱"` + CreditCode string `json:"creditCode" description:"统一社会信用代码"` + AreaCode string `json:"areaCode" orm:"area_code" description:"行政区域代码"` + Address string `json:"address" orm:"address" description:"地址"` + DeptRole int64 `json:"deptRole" orm:"dept_role" description:"机构默认角色ID"` + Status string `json:"status" orm:"status" description:"部门状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} + +type SysDeptAddModel struct { + ParentId int64 `json:"parentId" description:"父部门id"` + DeptName string `json:"deptName" description:"部门名称"` + DeptCategory string `json:"deptCategory" description:"部门类别编码"` + OrderNum int `json:"orderNum" description:"显示顺序"` + Leader int64 `json:"leader" description:"负责人"` + Phone string `json:"phone" description:"联系电话"` + Email string `json:"email" description:"邮箱"` + CreditCode string `json:"creditCode" description:"统一社会信用代码"` + AreaCode string `json:"areaCode" description:"行政区域代码"` + Address string `json:"address" description:"地址"` + Status string `json:"status" description:"部门状态(0正常 1停用)"` + DeptType int `json:"deptType" description:"部门类型(0:部门 1:公司)"` + DeptRole int64 `json:"deptRole" description:"机构默认角色ID"` +} + +type SysDeptEditModel struct { + DeptId int64 `json:"deptId" description:"部门id"` + ParentId *int64 `json:"parentId" description:"父部门id"` + DeptName *string `json:"deptName" description:"部门名称"` + DeptCategory *string `json:"deptCategory" description:"部门类别编码"` + OrderNum *int `json:"orderNum" description:"显示顺序"` + Leader *int64 `json:"leader" description:"负责人"` + Phone *string `json:"phone" description:"联系电话"` + Email *string `json:"email" description:"邮箱"` + Status *string `json:"status" description:"部门状态(0正常 1停用)"` + DeptType *int `json:"deptType" description:"部门类型(0:部门 1:公司)"` + CreditCode *string `json:"creditCode" description:"统一社会信用代码"` + AreaCode *string `json:"areaCode" description:"行政区域代码"` + Address *string `json:"address" description:"地址"` + DeptRole *int64 `json:"deptRole" description:"机构默认角色ID"` +} + +type SysDeptDeleteModel struct { + DeptId int64 `json:"deptId" description:"部门id"` +} + +type SysDeptTreeParam struct { + DeptType *string `json:"deptType" description:"部门类型(0:部门 1:公司)"` +} diff --git a/internal/model/sys_dict.go b/internal/model/sys_dict.go new file mode 100644 index 0000000..a0852fc --- /dev/null +++ b/internal/model/sys_dict.go @@ -0,0 +1,177 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmeta" +) + +type SysDictTypeListModel struct { + gmeta.Meta `orm:"table:sys_dict_type"` + DictId int64 `json:"dictId" orm:"dict_id" description:"字典主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DictName string `json:"dictName" orm:"dict_name" description:"字典名称"` + DictType string `json:"dictType" orm:"dict_type" description:"字典类型"` + IsSys string `json:"isSys" orm:"is_sys" description:"是否系统(0是 1否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysDictTypeListParam struct { + request.PageInfo + DictName string `json:"dictName" description:"字典名称"` + DictType string `json:"dictType" description:"字典类型"` + IsSys string `json:"isSys" description:"是否系统(0是 1否)"` + CreatedAt []string `json:"createdAt" description:"创建时间"` +} + +type SysDictTypeViewParam struct { + DictId int64 `json:"dictId" description:"字典主键"` + IsSys string `json:"isSys" description:"是否系统(0是 1否)"` + DictType string `json:"dictType" orm:"dict_type" description:"字典类型"` +} + +type SysDictTypeViewModel struct { + gmeta.Meta `orm:"table:sys_dict_type"` + DictId int64 `json:"dictId" orm:"dict_id" description:"字典主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DictName string `json:"dictName" orm:"dict_name" description:"字典名称"` + DictType string `json:"dictType" orm:"dict_type" description:"字典类型"` + IsSys string `json:"isSys" orm:"is_sys" description:"是否系统(0是 1否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysDictTypeAddParam struct { + DictName string `json:"dictName" description:"字典名称"` + DictType string `json:"dictType" description:"字典类型"` + IsSys string `json:"isSys" description:"是否系统(0是 1否)"` + Remark string `json:"remark" description:"备注"` +} + +type SysDictTypeAddModel struct { + DictId int64 `json:"dictId" description:"字典主键"` +} + +type SysDictTypeEditParam struct { + DictId int64 `json:"dictId" description:"字典主键"` + DictName string `json:"dictName" description:"字典名称"` + DictType string `json:"dictType" description:"字典类型"` + IsSys string `json:"isSys" description:"是否系统(0是 1否)"` + Remark string `json:"remark" description:"备注"` +} + +type SysDictTypeEditModel struct { + DictId int64 `json:"dictId" description:"字典主键"` +} + +type SysDictTypeDeleteParam struct { + gmeta.Meta `orm:"table:sys_dict_type"` + DictIds []int64 `json:"dictIds" description:"字典主键"` +} + +type SysDictTypeDeleteModel struct { + DictIds []int64 `json:"dictIds" description:"字典主键"` +} + +type SysDictDataListModel struct { + gmeta.Meta `orm:"table:sys_dict_data"` + DictCode int64 `json:"dictCode" orm:"dict_code" description:"字典编码"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DictSort int `json:"dictSort" orm:"dict_sort" description:"字典排序"` + DictLabel string `json:"dictLabel" orm:"dict_label" description:"字典标签"` + DictValue string `json:"dictValue" orm:"dict_value" description:"字典键值"` + DictType string `json:"dictType" orm:"dict_type" description:"字典类型"` + CssClass string `json:"cssClass" orm:"css_class" description:"样式属性(其他样式扩展)"` + ListClass string `json:"listClass" orm:"list_class" description:"表格回显样式"` + IsDefault string `json:"isDefault" orm:"is_default" description:"是否默认(Y是 N否)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysDictDataList struct { + SysDictTypeListModel + Items []SysDictDataListModel `json:"items" orm:"with:dict_type=dict_type"` +} + +type SysDictDataListParam struct { + request.PageInfo + DictId int64 `json:"dictId"` + DictType string `json:"dictType"` + DictValue string `json:"dictValue"` +} + +type SysDictDataViewParam struct { + DictCode int64 `json:"dictCode" description:"字典编码"` +} + +type SysDictDataViewModel struct { + DictCode int64 `json:"dictCode" description:"字典编码"` + TenantId string `json:"tenantId" description:"租户编号"` + DictSort int `json:"dictSort" description:"字典排序"` + DictLabel string `json:"dictLabel" description:"字典标签"` + DictValue string `json:"dictValue" description:"字典键值"` + DictType string `json:"dictType" description:"字典类型"` + CssClass string `json:"cssClass" description:"样式属性(其他样式扩展)"` + ListClass string `json:"listClass" description:"表格回显样式"` + IsDefault string `json:"isDefault" description:"是否默认(Y是 N否)"` + CreatedDept int64 `json:"createdDept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" description:"更新时间"` + Remark string `json:"remark" description:"备注"` +} + +type SysDictDataAddParam struct { + DictSort int `json:"dictSort" description:"字典排序"` + DictLabel string `json:"dictLabel" description:"字典标签"` + DictValue string `json:"dictValue" description:"字典键值"` + DictType string `json:"dictType" description:"字典类型"` + CssClass string `json:"cssClass" description:"样式属性(其他样式扩展)"` + ListClass string `json:"listClass" description:"表格回显样式"` + IsDefault string `json:"isDefault" description:"是否默认(Y是 N否)"` + Remark string `json:"remark" description:"备注"` +} + +type SysDictDataAddModel struct { + DictCode int64 `json:"dictCode" description:"字典编码"` +} + +type SysDictDataEditParam struct { + DictCode int64 `json:"dictCode" description:"字典编码"` + DictSort int `json:"dictSort" description:"字典排序"` + DictLabel string `json:"dictLabel" description:"字典标签"` + DictValue string `json:"dictValue" description:"字典键值"` + DictType string `json:"dictType" description:"字典类型"` + CssClass string `json:"cssClass" description:"样式属性(其他样式扩展)"` + ListClass string `json:"listClass" description:"表格回显样式"` + IsDefault string `json:"isDefault" description:"是否默认(Y是 N否)"` + Remark string `json:"remark" description:"备注"` +} + +type SysDictDataEditModel struct { + DictCode int64 `json:"dictCode" description:"字典编码"` +} + +type SysDictDataDeleteParam struct { + DictCodes []int64 `json:"dictCodes" description:"字典编码"` +} + +type SysDictDataDeleteModel struct { + DictCodes []int64 `json:"dictCodes" description:"字典编码"` +} diff --git a/internal/model/sys_job.go b/internal/model/sys_job.go new file mode 100644 index 0000000..43288fd --- /dev/null +++ b/internal/model/sys_job.go @@ -0,0 +1,81 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysJobListModel struct { + JobId int64 `json:"jobId" orm:"job_id" description:"任务ID"` + JobName string `json:"jobName" orm:"job_name" description:"任务名称"` + JobParams string `json:"jobParams" orm:"job_params" description:"参数"` + JobGroup string `json:"jobGroup" orm:"job_group" description:"任务组名"` + InvokeTarget string `json:"invokeTarget" orm:"invoke_target" description:"调用目标字符串"` + CronExpression string `json:"cronExpression" orm:"cron_expression" description:"cron执行表达式"` + MisfirePolicy int `json:"misfirePolicy" orm:"misfire_policy" description:"计划执行策略(1多次执行 2执行一次)"` + Concurrent int `json:"concurrent" orm:"concurrent" description:"是否并发执行(0允许 1禁止)"` + Status string `json:"status" orm:"status" description:"状态(0正常 1暂停)"` + Remark string `json:"remark" orm:"remark" description:"备注信息"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` +} + +type SysJobViewModel struct { + entity.SysJob +} + +type SysJobAddModel struct { + JobId int64 `json:"jobId" orm:"job_id" description:"任务ID"` + JobName string `v:"required" json:"jobName" orm:"job_name" description:"任务名称"` + JobParams string `json:"jobParams" orm:"job_params" description:"参数"` + JobGroup string `json:"jobGroup" orm:"job_group" description:"任务组名"` + InvokeTarget string `v:"required" json:"invokeTarget" orm:"invoke_target" description:"调用目标字符串"` + CronExpression string `v:"required" json:"cronExpression" orm:"cron_expression" description:"cron执行表达式"` + MisfirePolicy int `v:"required" json:"misfirePolicy" orm:"misfire_policy" description:"计划执行策略(1多次执行 2执行一次)"` + Concurrent int `json:"concurrent" orm:"concurrent" description:"是否并发执行(0允许 1禁止)"` + Status string `v:"required" json:"status" orm:"status" description:"状态(0正常 1暂停)"` + Remark string `json:"remark" orm:"remark" description:"备注信息"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} + +type SysJobUpdateModel struct { + JobId int64 `v:"required" json:"jobId" orm:"job_id" description:"任务ID"` + JobName string `v:"required" json:"jobName" orm:"job_name" description:"任务名称"` + JobParams string `json:"jobParams" orm:"job_params" description:"参数"` + JobGroup string `json:"jobGroup" orm:"job_group" description:"任务组名"` + InvokeTarget string `v:"required" json:"invokeTarget" orm:"invoke_target" description:"调用目标字符串"` + CronExpression string `v:"required" json:"cronExpression" orm:"cron_expression" description:"cron执行表达式"` + MisfirePolicy int `v:"required" json:"misfirePolicy" orm:"misfire_policy" description:"计划执行策略(1多次执行 2执行一次)"` + Concurrent int `json:"concurrent" orm:"concurrent" description:"是否并发执行(0允许 1禁止)"` + Status string `v:"required" json:"status" orm:"status" description:"状态(0正常 1暂停)"` + Remark string `json:"remark" orm:"remark" description:"备注信息"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} + +type SysJobUpdateStatusModel struct { + JobId int64 `v:"required" json:"jobId" orm:"job_id" description:"任务ID"` + Status string `v:"required" json:"status" orm:"status" description:"状态(0正常 1暂停)"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} + +type SysJobDeleteModel struct { + JobIds []int64 `v:"required" json:"jobId" orm:"job_id" description:"任务ID"` + DeletedBy int64 `json:"deletedBy" orm:"deleted_by" description:"删除人"` + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"` +} +type SysJobListParam struct { + JobName string `json:"jobName" orm:"job_name" description:"任务名称"` + JobGroup string `json:"jobGroup" orm:"job_group" description:"任务组名"` + Status string `json:"status" orm:"status" description:"状态(0正常 1暂停)"` +} diff --git a/internal/model/sys_logininfor.go b/internal/model/sys_logininfor.go new file mode 100644 index 0000000..631bb37 --- /dev/null +++ b/internal/model/sys_logininfor.go @@ -0,0 +1,61 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysLogininforListModel struct { + InfoId int64 `json:"infoId" orm:"info_id" description:"访问ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Status string `json:"status" orm:"status" description:"登录状态(0成功 1失败)"` + Msg string `json:"msg" orm:"msg" description:"提示消息"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` +} + +type SysLogininforAddModel struct { + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Status string `json:"status" orm:"status" description:"登录状态(0成功 1失败)"` + Msg string `json:"msg" orm:"msg" description:"提示消息"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` +} + +type SysLogininforViewModel struct { + entity.SysLogininfor +} + +type SysLogininforListParam struct { + request.PageInfo + Ipaddr string `json:"ipaddr" description:"登录IP地址"` + UserName string `json:"userName" description:"用户账号"` + Status string `json:"status" description:"登录状态(0成功 1失败)"` + LoginTime []string `json:"loginTime" description:"访问时间"` +} + +type SysLogininforDeleteParam struct { + InfoIds []int64 `json:"infoIds" description:"访问ID"` +} +type SysLogininforDeleteModel struct { + InfoIds []int64 `json:"infoIds" description:"访问ID"` +} diff --git a/internal/model/sys_menu.go b/internal/model/sys_menu.go new file mode 100644 index 0000000..4ff0732 --- /dev/null +++ b/internal/model/sys_menu.go @@ -0,0 +1,112 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysMenuTree struct { + entity.SysMenu + Children []*SysMenuTree `json:"children"` +} + +type SysMenuListModel struct { + MenuId int64 `json:"menuId" orm:"menu_id" description:"菜单ID"` + MenuName string `json:"menuName" orm:"menu_name" description:"菜单名称"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父菜单ID"` + OrderNum int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Path string `json:"path" orm:"path" description:"路由地址"` + Component string `json:"component" orm:"component" description:"组件路径"` + QueryParam string `json:"queryParam" orm:"query_param" description:"路由参数"` + IsFrame int `json:"isFrame" orm:"is_frame" description:"是否为外链(0是 1否)"` + IsCache int `json:"isCache" orm:"is_cache" description:"是否缓存(0缓存 1不缓存)"` + MenuType string `json:"menuType" orm:"menu_type" description:"菜单类型(M目录 C菜单 F按钮)"` + Visible string `json:"visible" orm:"visible" description:"显示状态(0显示 1隐藏)"` + Status string `json:"status" orm:"status" description:"菜单状态(0正常 1停用)"` + Perms string `json:"perms" orm:"perms" description:"权限标识"` + Icon string `json:"icon" orm:"icon" description:"菜单图标"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysMenuListParam struct { + MenuName string `json:"menuName"` + Status string `json:"status"` + MenuIds []int64 `json:"menuIds"` +} + +type SysMenuViewModel struct { + entity.SysMenu +} + +type SysMenuAddModel struct { + MenuId int64 `json:"menuId" orm:"menu_id" description:"菜单ID"` + MenuName string `json:"menuName" orm:"menu_name" description:"菜单名称"` + ParentId int64 `json:"parentId" orm:"parent_id" description:"父菜单ID"` + OrderNum int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Path string `json:"path" orm:"path" description:"路由地址"` + Component string `json:"component" orm:"component" description:"组件路径"` + QueryParam string `json:"queryParam" orm:"query_param" description:"路由参数"` + IsFrame int `json:"isFrame" orm:"is_frame" description:"是否为外链(0是 1否)"` + IsCache int `json:"isCache" orm:"is_cache" description:"是否缓存(0缓存 1不缓存)"` + MenuType string `json:"menuType" orm:"menu_type" description:"菜单类型(M目录 C菜单 F按钮)"` + Visible string `json:"visible" orm:"visible" description:"显示状态(0显示 1隐藏)"` + Status string `json:"status" orm:"status" description:"菜单状态(0正常 1停用)"` + Perms string `json:"perms" orm:"perms" description:"权限标识"` + Icon string `json:"icon" orm:"icon" description:"菜单图标"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysMenuUpdateModel struct { + MenuId int64 `json:"menuId"` + MenuName *string `json:"menuName" orm:"menu_name" description:"菜单名称"` + ParentId *int64 `json:"parentId" orm:"parent_id" description:"父菜单ID"` + OrderNum *int `json:"orderNum" orm:"order_num" description:"显示顺序"` + Path *string `json:"path" orm:"path" description:"路由地址"` + Component *string `json:"component" orm:"component" description:"组件路径"` + QueryParam *string `json:"queryParam" orm:"query_param" description:"路由参数"` + IsFrame *int `json:"isFrame" orm:"is_frame" description:"是否为外链(0是 1否)"` + IsCache *int `json:"isCache" orm:"is_cache" description:"是否缓存(0缓存 1不缓存)"` + MenuType *string `json:"menuType" orm:"menu_type" description:"菜单类型(M目录 C菜单 F按钮)"` + Visible *string `json:"visible" orm:"visible" description:"显示状态(0显示 1隐藏)"` + Status *string `json:"status" orm:"status" description:"菜单状态(0正常 1停用)"` + Perms *string `json:"perms" orm:"perms" description:"权限标识"` + Icon *string `json:"icon" orm:"icon" description:"菜单图标"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark *string `json:"remark" orm:"remark" description:"备注"` +} + +type SysMenuDeleteModel struct { + MenuId int64 `json:"menuId"` +} + +type SysMenuMini struct { + MenuId int64 `json:"menuId"` + MenuName *string `json:"menuName" orm:"menu_name" description:"菜单名称"` + ParentId *int64 `json:"parentId" orm:"parent_id" description:"父菜单ID"` +} + +type SysMenuTreeModel struct { + Title string `json:"title"` + Key string `json:"key"` + ParentId int64 `json:"parentId"` + MenuId int64 `json:"menuId"` + MenuName string `json:"menuName"` + MenuType string `json:"menuType" orm:"menu_type" description:"菜单类型(M目录 C菜单 F按钮)"` + Perms string `json:"perms"` + Children []*SysMenuTreeModel `json:"children"` +} diff --git a/internal/model/sys_notice.go b/internal/model/sys_notice.go new file mode 100644 index 0000000..f1a4e82 --- /dev/null +++ b/internal/model/sys_notice.go @@ -0,0 +1,97 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysNoticeListModel struct { + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + NoticeTitle string `json:"noticeTitle" orm:"notice_title" description:"公告标题"` + NoticeType string `json:"noticeType" orm:"notice_type" description:"公告类型(1通知 2公告)"` + NoticeContent []byte `json:"noticeContent" orm:"notice_content" description:"公告内容"` + Status string `json:"status" orm:"status" description:"公告状态(0正常 1关闭)"` + NoticeRange int `json:"noticeRange" orm:"notice_range" description:"公告范围(1全部 2指定组织 3指定用户)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + CreatedByUser SysUserMiniModel `json:"createdByUser" orm:"with:user_id=created_by" description:"创建者"` +} + +type SysNoticeListParam struct { + request.PageInfo + NoticeTitle string `json:"noticeTitle" description:"公告标题"` + NoticeType string `json:"noticeType" description:"公告类型(1通知 2公告)"` + CreatedBy string `json:"createdBy" description:"创建者"` + CreatedAt []string `json:"createdAt" description:"创建时间断"` +} + +type SysNoticeAddParam struct { + NoticeTitle string `json:"noticeTitle" description:"公告标题"` + NoticeType string `json:"noticeType" description:"公告类型(1通知 2公告)"` + NoticeContent string `json:"noticeContent" description:"公告内容"` + Status string `json:"status" description:"公告状态(0正常 1关闭)"` + Remark string `json:"remark" description:"备注"` + UserIdList []int64 `json:"userIdList" description:"通知用户ID列表"` + DeptIdList []int64 `json:"deptIdList" description:"通知组织ID列表"` + NoticeRange int `json:"noticeRange" description:"公告范围(1全部 2指定组织 3指定用户)"` +} + +type SysNoticeAddModel struct { + NoticeId int64 `json:"noticeId" description:"公告ID"` +} + +type SysNoticeEditParam struct { + NoticeId int64 `json:"noticeId" description:"公告ID"` + NoticeTitle *string `json:"noticeTitle" description:"公告标题"` + NoticeType *string `json:"noticeType" description:"公告类型(1通知 2公告)"` + NoticeContent *string `json:"noticeContent" description:"公告内容"` + Status *string `json:"status" description:"公告状态(0正常 1关闭)"` + Remark *string `json:"remark" description:"备注"` + UserIdList []int64 `json:"userIdList" description:"通知用户ID列表"` + DeptIdList []int64 `json:"deptIdList" description:"通知组织ID列表"` + NoticeRange int `json:"noticeRange" description:"公告范围(1全部 2指定组织 3指定用户)"` +} + +type SysNoticeEditModel struct { + NoticeId int64 `json:"noticeId" description:"公告ID"` +} + +type SysNoticeDeleteParam struct { + NoticeIds []int64 `json:"noticeIds" orm:"notice_ids" description:"公告ID"` +} + +type SysNoticeDeleteModel struct { + NoticeIds []int64 `json:"noticeIds" orm:"notice_ids" description:"公告ID"` +} +type SysNoticeViewParam struct { + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` +} + +type SysNoticeViewModel struct { + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + NoticeTitle string `json:"noticeTitle" orm:"notice_title" description:"公告标题"` + NoticeType string `json:"noticeType" orm:"notice_type" description:"公告类型(1通知 2公告)"` + NoticeContent string `json:"noticeContent" orm:"notice_content" description:"公告内容"` + UserIds string `json:"userIds" orm:"user_ids" description:"通知用户ID列表"` + DeptIds string `json:"deptIds" orm:"dept_ids" description:"通知组织ID列表"` + UserIdList []int64 `json:"userIdList" description:"通知用户ID列表"` + DeptIdList []int64 `json:"deptIdList" description:"通知组织ID列表"` + NoticeRange int `json:"noticeRange" description:"公告范围(1全部 2指定组织 3指定用户)"` + Status string `json:"status" orm:"status" description:"公告状态(0正常 1关闭)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} diff --git a/internal/model/sys_notice_user.go b/internal/model/sys_notice_user.go new file mode 100644 index 0000000..86e5ae6 --- /dev/null +++ b/internal/model/sys_notice_user.go @@ -0,0 +1,201 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +// SysNoticeUserUpdateFields 修改用户通知公告表字段过滤 +type SysNoticeUserUpdateFields struct { + NoticeId int64 `json:"noticeId" dc:"公告ID"` + TenantId string `json:"tenantId" dc:"租户编号"` + NoticeTitle string `json:"noticeTitle" dc:"公告标题"` + NoticeType string `json:"noticeType" dc:"公告类型"` + NoticeContent []byte `json:"noticeContent" dc:"公告内容"` + Status string `json:"status" dc:"公告状态"` + UserId int64 `json:"userId" dc:"用户ID"` + IsRead int `json:"isRead" dc:"是否已读"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + Remark string `json:"remark" dc:"备注"` +} + +// SysNoticeUserInsertFields 新增用户通知公告表字段过滤 +type SysNoticeUserInsertFields struct { + NoticeId int64 `json:"noticeId" dc:"公告ID"` + TenantId string `json:"tenantId" dc:"租户编号"` + NoticeTitle string `json:"noticeTitle" dc:"公告标题"` + NoticeType string `json:"noticeType" dc:"公告类型"` + NoticeContent []byte `json:"noticeContent" dc:"公告内容"` + Status string `json:"status" dc:"公告状态"` + UserId int64 `json:"userId" dc:"用户ID"` + IsRead int `json:"isRead" dc:"是否已读"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + Remark string `json:"remark" dc:"备注"` +} + +// SysNoticeUserEditParam 修改/新增用户通知公告表 +type SysNoticeUserEditParam struct { + Id int64 `json:"id" orm:"id" description:"ID"` + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + NoticeTitle string `json:"noticeTitle" orm:"notice_title" description:"公告标题"` + NoticeType string `json:"noticeType" orm:"notice_type" description:"公告类型(1通知 2公告)"` + NoticeContent string `json:"noticeContent" orm:"notice_content" description:"公告内容"` + Status string `json:"status" orm:"status" description:"公告状态(0正常 1关闭)"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + IsRead int `json:"isRead" orm:"is_read" description:"是否已读(0未读 1已读)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +func (in *SysNoticeUserEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type SysNoticeUserEditModel struct{} + +// SysNoticeUserDeleteParam 删除用户通知公告表 +type SysNoticeUserDeleteParam struct { + Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"` +} + +func (in *SysNoticeUserDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type SysNoticeUserDeleteModel struct{} + +// SysNoticeUserViewParam 获取指定用户通知公告表信息 +type SysNoticeUserViewParam struct { + Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"` +} + +func (in *SysNoticeUserViewParam) Filter(ctx context.Context) (err error) { + return +} + +type SysNoticeUserViewModel struct { + Id int64 `json:"id" orm:"id" description:"ID"` + NoticeId int64 `json:"noticeId" orm:"notice_id" description:"公告ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + NoticeTitle string `json:"noticeTitle" orm:"notice_title" description:"公告标题"` + NoticeType string `json:"noticeType" orm:"notice_type" description:"公告类型(1通知 2公告)"` + NoticeContent string `json:"noticeContent" orm:"notice_content" description:"公告内容"` + Status string `json:"status" orm:"status" description:"公告状态(0正常 1关闭)"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + IsRead int `json:"isRead" orm:"is_read" description:"是否已读(0未读 1已读)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// SysNoticeUserListParam 获取用户通知公告表列表 +type SysNoticeUserListParam struct { + request.PageInfo + IsRead string `json:"isRead" dc:"是否已读"` + NoticeId int64 `json:"noticeId" dc:"公告ID"` + NoticeTitle string `json:"noticeTitle" dc:"公告标题"` + NoticeType string `json:"noticeType" dc:"公告类型"` +} + +func (in *SysNoticeUserListParam) Filter(ctx context.Context) (err error) { + return +} + +type SysNoticeUserListModel struct { + Id int64 `json:"id" dc:"ID"` + NoticeId int64 `json:"noticeId" dc:"公告ID"` + TenantId string `json:"tenantId" dc:"租户编号"` + NoticeTitle string `json:"noticeTitle" dc:"公告标题"` + NoticeType string `json:"noticeType" dc:"公告类型"` + NoticeContent string `json:"noticeContent" dc:"公告内容"` + Status string `json:"status" dc:"公告状态"` + UserId int64 `json:"userId" dc:"用户ID"` + IsRead int `json:"isRead" dc:"是否已读"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + Remark string `json:"remark" dc:"备注"` +} + +// SysNoticeUserExportModel 导出用户通知公告表 +type SysNoticeUserExportModel struct { + Id int64 `json:"id" dc:"ID"` + NoticeId int64 `json:"noticeId" dc:"公告ID"` + TenantId string `json:"tenantId" dc:"租户编号"` + NoticeTitle string `json:"noticeTitle" dc:"公告标题"` + NoticeType string `json:"noticeType" dc:"公告类型"` + NoticeContent string `json:"noticeContent" dc:"公告内容"` + Status string `json:"status" dc:"公告状态"` + UserId int64 `json:"userId" dc:"用户ID"` + IsRead int `json:"isRead" dc:"是否已读"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + Remark string `json:"remark" dc:"备注"` +} + +// SysNoticeUserStatusParam 更新用户通知公告表状态 +type SysNoticeUserStatusParam struct { + Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"` + Status int `json:"status" dc:"状态"` +} + +func (in *SysNoticeUserStatusParam) Filter(ctx context.Context) (err error) { + if in.Id <= 0 { + err = gerror.New("ID不能为空") + return + } + + if in.Status <= 0 { + err = gerror.New("状态不能为空") + return + } + + if !slices.Contains(consts.StatusSlice, in.Status) { + err = gerror.New("状态不正确") + return + } + return +} + +type SysNoticeUserStatusModel struct{} + +type SysNoticeUserReadParam struct { + Ids []int64 `json:"ids" v:"required#ID不能为空" dc:"ID"` +} + +func (in *SysNoticeUserReadParam) Filter(ctx context.Context) (err error) { + return +} diff --git a/internal/model/sys_oper_log.go b/internal/model/sys_oper_log.go new file mode 100644 index 0000000..15d716d --- /dev/null +++ b/internal/model/sys_oper_log.go @@ -0,0 +1,64 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysOperLogViewModel struct { + entity.SysOperLog +} + +type SysOperLogListModel struct { + OperId int64 `json:"operId" orm:"oper_id" description:"日志主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Title string `json:"title" orm:"title" description:"模块标题"` + BusinessType int `json:"businessType" orm:"business_type" description:"业务类型(0其它 1新增 2修改 3删除)"` + Method string `json:"method" orm:"method" description:"方法名称"` + RequestMethod string `json:"requestMethod" orm:"request_method" description:"请求方式"` + OperatorType int `json:"operatorType" orm:"operator_type" description:"操作类别(0其它 1后台用户 2手机端用户)"` + OperName string `json:"operName" orm:"oper_name" description:"操作人员"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` + OperUrl string `json:"operUrl" orm:"oper_url" description:"请求URL"` + OperIp string `json:"operIp" orm:"oper_ip" description:"主机地址"` + OperLocation string `json:"operLocation" orm:"oper_location" description:"操作地点"` + OperParam string `json:"operParam" orm:"oper_param" description:"请求参数"` + JsonResult string `json:"jsonResult" orm:"json_result" description:"返回参数"` + Status int `json:"status" orm:"status" description:"操作状态(0正常 1异常)"` + ErrorMsg string `json:"errorMsg" orm:"error_msg" description:"错误消息"` + OperTime *gtime.Time `json:"operTime" orm:"oper_time" description:"操作时间"` + CostTime int64 `json:"costTime" orm:"cost_time" description:"消耗时间"` +} + +type SysOperLogListParam struct { + Title string `json:"title"` + BusinessType string `json:"businessType"` + Method string `json:"method"` +} + +type SysOperLogAddParam struct { + // OperId int64 `json:"operId" orm:"oper_id" description:"日志主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Title string `json:"title" orm:"title" description:"模块标题"` + BusinessType int `json:"businessType" orm:"business_type" description:"业务类型(0其它 1新增 2修改 3删除)"` + Method string `json:"method" orm:"method" description:"方法名称"` + RequestMethod string `json:"requestMethod" orm:"request_method" description:"请求方式"` + OperatorType int `json:"operatorType" orm:"operator_type" description:"操作类别(0其它 1后台用户 2手机端用户)"` + OperName string `json:"operName" orm:"oper_name" description:"操作人员"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` + OperUrl string `json:"operUrl" orm:"oper_url" description:"请求URL"` + OperIp string `json:"operIp" orm:"oper_ip" description:"主机地址"` + OperLocation string `json:"operLocation" orm:"oper_location" description:"操作地点"` + OperParam string `json:"operParam" orm:"oper_param" description:"请求参数"` + JsonResult string `json:"jsonResult" orm:"json_result" description:"返回参数"` + Status int `json:"status" orm:"status" description:"操作状态(0正常 1异常)"` + ErrorMsg string `json:"errorMsg" orm:"error_msg" description:"错误消息"` + OperTime *gtime.Time `json:"operTime" orm:"oper_time" description:"操作时间"` + CostTime int64 `json:"costTime" orm:"cost_time" description:"消耗时间"` +} diff --git a/internal/model/sys_oss.go b/internal/model/sys_oss.go new file mode 100644 index 0000000..88288dc --- /dev/null +++ b/internal/model/sys_oss.go @@ -0,0 +1,112 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gtime" +) + +type SysOssListModel struct { + OssId int64 `json:"ossId" orm:"oss_id" description:"对象存储主键"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + FileName string `json:"fileName" orm:"file_name" description:"文件名"` + OriginalName string `json:"originalName" orm:"original_name" description:"原名"` + FileSuffix string `json:"fileSuffix" orm:"file_suffix" description:"文件后缀名"` + Url string `json:"url" orm:"url" description:"URL地址"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + Service string `json:"service" orm:"service" description:"服务商"` +} + +type SysOssListParam struct { + request.PageInfo + FileName string `json:"fileName" orm:"file_name" description:"文件名"` + OriginalName string `json:"originalName" orm:"original_name" description:"原名"` + FileSuffix string `json:"fileSuffix" orm:"file_suffix" description:"文件后缀名"` + Service string `json:"service" orm:"service" description:"服务商"` + CreatedAt []string `json:"createdAt" orm:"created_at" description:"创建时间"` +} + +type SysOssViewParam struct { + OssId int64 `json:"ossId" orm:"oss_id" description:"对象存储主键"` +} + +type SysOssViewModel struct { + entity.SysOss +} + +type SysOssDownloadParam struct { + OssId int64 `json:"ossId" orm:"oss_id" description:"对象存储主键"` +} + +type SysOssDownloadModel struct { + *entity.SysOss +} + +type SysOssDeleteParam struct { + OssIds []int64 `json:"ossIds" description:"对象存储主键"` +} + +type SysOssDeleteModel struct { + entity.SysOss +} + +type SysOssUploadParam struct { + File *ghttp.UploadFile `json:"file" description:"文件"` + FileType string `json:"fileType" description:"文件类型"` + IsDevice bool `json:"isDevice" description:"是否是设备文件"` + NewFileType int `json:"newFileType" description:"新文件类型 1:用户文件 2:用户图片 3:设备文件 4:iot配置图片 5:iot固件文件 6:项目图片 7:项目文件"` + SubDirName string `json:"subDirName" description:"子目录名称或路径"` + SaveOriginalName int `json:"saveOriginalName" description:"是否保存原始文件名 0:否 1:是 默认否"` + NotAddDate int `json:"notAddDate" description:"存储路径不添加日期 0:添加 1:不添加 默认添加"` +} + +type SysOssUploadModel struct { + entity.SysOss +} + +type SysOssMoveFileParam struct { + FilePath string `json:"filePath" description:"文件路径"` + NewFileType int `json:"newFileType" description:"新文件类型 1:用户文件 2:用户图片 3:设备文件 4:iot配置图片 5:iot固件文件 6:项目图片 7:项目文件"` + SubDirName string `json:"subDirName" description:"子目录名称或路径"` + SaveOriginalName int `json:"saveOriginalName" description:"是否保存原始文件名 0:否 1:是 默认否"` + NotAddDate int `json:"notAddDate" description:"存储路径不添加日期 0:添加 1:不添加 默认添加"` +} + +type SysOssMoveFileModel struct { + *entity.SysOss +} + +type SysOssSaveContentParam struct { + Content []byte `json:"content" description:"内容"` + FileName string `json:"fileName" description:"文件名"` + NewFileType int `json:"newFileType" description:"新文件类型 1:用户文件 2:用户图片 3:设备文件 4:iot配置图片 5:iot固件文件 6:项目图片 7:项目文件"` + SubDirName string `json:"subDirName" description:"子目录名称或路径"` + SaveOriginalName int `json:"saveOriginalName" description:"是否保存原始文件名 0:否 1:是 默认否"` + NotAddDate int `json:"notAddDate" description:"存储路径不添加日期 0:添加 1:不添加 默认添加"` +} + +type SysOssSaveContentModel struct { + *entity.SysOss +} + +type UploadResponse struct { + Size int64 `json:"size"` // 文件大小 + Path string `json:"path"` // 文件路径 + FullPath string `json:"full_path"` // 文件全路径 + Name string `json:"name"` // 文件名 + OriginalName string `json:"original_name"` // 文件原名 + Type string `json:"type"` // 文件类型 http Content-type + Ext string `json:"ext"` // 文件扩展名 不包含. + Md5 string `json:"md5"` // 文件MD5 + Crc16 uint16 `json:"crc16"` // 文件CRC-16/MODBUS + Sum16 uint16 `json:"sum16"` // 文件SUM16 +} diff --git a/internal/model/sys_oss_config.go b/internal/model/sys_oss_config.go new file mode 100644 index 0000000..2fb4120 --- /dev/null +++ b/internal/model/sys_oss_config.go @@ -0,0 +1,98 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysOssConfigViewParam struct { + OssConfigId int64 `json:"ossConfigId" description:"主键"` + ConfigKey string `json:"configKey" orm:"config_key" description:"配置key"` +} + +type SysOssConfigViewModel struct { + entity.SysOssConfig +} + +type SysOssConfigListModel struct { + OssConfigId int64 `json:"ossConfigId" orm:"oss_config_id" description:"主键"` + ConfigKey string `json:"configKey" orm:"config_key" description:"配置key"` + AccessKey string `json:"accessKey" orm:"access_key" description:"accessKey"` + SecretKey string `json:"secretKey" orm:"secret_key" description:"秘钥"` + BucketName string `json:"bucketName" orm:"bucket_name" description:"桶名称"` + Prefix string `json:"prefix" orm:"prefix" description:"前缀"` + Endpoint string `json:"endpoint" orm:"endpoint" description:"访问站点"` + Domain string `json:"domain" orm:"domain" description:"自定义域名"` + IsHttps string `json:"isHttps" orm:"is_https" description:"是否https(Y=是,N=否)"` + Region string `json:"region" orm:"region" description:"域"` + AccessPolicy string `json:"accessPolicy" orm:"access_policy" description:"桶权限类型(0=private 1=public 2=custom)"` + Status string `json:"status" orm:"status" description:"是否默认(0=是,1=否)"` + Ext1 string `json:"ext1" orm:"ext1" description:"扩展字段"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysOssConfigListParam struct { + request.PageInfo + ConfigKey string `json:"configKey" description:"配置key"` + BucketName string `json:"bucketName" description:"桶名称"` + Status string `json:"status" description:"是否默认(0=是,1=否)"` +} + +type SysOssConfigAddParam struct { + ConfigKey string `json:"configKey" orm:"config_key" description:"配置key"` + AccessKey string `json:"accessKey" orm:"access_key" description:"accessKey"` + SecretKey string `json:"secretKey" orm:"secret_key" description:"秘钥"` + BucketName string `json:"bucketName" orm:"bucket_name" description:"桶名称"` + Prefix string `json:"prefix" orm:"prefix" description:"前缀"` + Endpoint string `json:"endpoint" orm:"endpoint" description:"访问站点"` + Domain string `json:"domain" orm:"domain" description:"自定义域名"` + IsHttps string `json:"isHttps" orm:"is_https" description:"是否https(Y=是,N=否)"` + Region string `json:"region" orm:"region" description:"域"` + AccessPolicy string `json:"accessPolicy" orm:"access_policy" description:"桶权限类型(0=private 1=public 2=custom)"` + Status string `json:"status" orm:"status" description:"是否默认(0=是,1=否)"` + Ext1 string `json:"ext1" orm:"ext1" description:"扩展字段"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysOssConfigAddModel struct { + OssConfigId int64 `json:"ossConfigId" description:"主键"` +} + +type SysOssConfigEditParam struct { + OssConfigId int64 `json:"ossConfigId" description:"主键"` + ConfigKey *string `json:"configKey" description:"配置key"` + AccessKey *string `json:"accessKey" description:"accessKey"` + SecretKey *string `json:"secretKey" description:"秘钥"` + BucketName *string `json:"bucketName" description:"桶名称"` + Prefix *string `json:"prefix" description:"前缀"` + Endpoint *string `json:"endpoint" description:"访问站点"` + Domain *string `json:"domain" description:"自定义域名"` + IsHttps *string `json:"isHttps,omitempty" description:"是否https(Y=是,N=否)"` + Region *string `json:"region" description:"域"` + AccessPolicy *string `json:"accessPolicy,omitempty" description:"桶权限类型(0=private 1=public 2=custom)"` + Status *string `json:"status,omitempty" description:"是否默认(0=是,1=否)"` + Ext1 *string `json:"ext1" description:"扩展字段"` + Remark *string `json:"remark" description:"备注"` +} + +type SysOssConfigEditModel struct { + OssConfigId int64 `json:"ossConfigId" description:"主键"` +} + +type SysOssConfigDeleteParam struct { + OssConfigIds []int64 `json:"ossConfigIds" description:"主键"` +} + +type SysOssConfigDeleteModel struct { + OssConfigIds []int64 `json:"ossConfigIds" description:"主键"` +} diff --git a/internal/model/sys_post.go b/internal/model/sys_post.go new file mode 100644 index 0000000..42b5ff6 --- /dev/null +++ b/internal/model/sys_post.go @@ -0,0 +1,111 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysPostListModel struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + PostCode string `json:"postCode" orm:"post_code" description:"岗位编码"` + PostCategory string `json:"postCategory" orm:"post_category" description:"岗位类别编码"` + PostName string `json:"postName" orm:"post_name" description:"岗位名称"` + PostSort int `json:"postSort" orm:"post_sort" description:"显示顺序"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + Remark string `json:"remark" orm:"remark" description:"备注"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + DeptInfo SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id" description:"部门信息"` +} + +type SysPostListParam struct { + request.PageInfo + DeptId int64 `json:"deptId" description:"部门id"` + PostCode string `json:"postCode" description:"岗位编码"` + PostCategory string `json:"postCategory" description:"岗位类别编码"` + PostName string `json:"postName" description:"岗位名称"` + BelongDeptId int64 `json:"belongDeptId" description:"归属部门id"` + Status string `json:"status" description:"状态"` + CreatedAt []string `json:"createdAt" description:"创建时间"` + PostIds []int64 `json:"postIds" description:"岗位ID"` +} + +type SysPostMiniModel struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` + PostCode string `json:"postCode" orm:"post_code" description:"岗位编码"` + PostName string `json:"postName" orm:"post_name" description:"岗位名称"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` +} + +type SysPostAddParam struct { + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + PostCode string `json:"postCode" orm:"post_code" description:"岗位编码"` + PostCategory string `json:"postCategory" orm:"post_category" description:"岗位类别编码"` + PostName string `json:"postName" orm:"post_name" description:"岗位名称"` + PostSort int `json:"postSort" orm:"post_sort" description:"显示顺序"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + Remark string `json:"remark" orm:"remark" description:"备注"` +} + +type SysPostAddModel struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` +} + +type SysPostEditParam struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` + DeptId *int64 `json:"deptId" orm:"dept_id" description:"部门id"` + PostCode *string `json:"postCode" orm:"post_code" description:"岗位编码"` + PostCategory *string `json:"postCategory" orm:"post_category" description:"岗位类别编码"` + PostName *string `json:"postName" orm:"post_name" description:"岗位名称"` + PostSort *int `json:"postSort" orm:"post_sort" description:"显示顺序"` + Status *string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + Remark *string `json:"remark" orm:"remark" description:"备注"` +} + +type SysPostEditModel struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` +} + +type SysPostDeleteParam struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` + PostIds []int64 `json:"postIds" orm:"post_ids" description:"岗位ID"` +} + +type SysPostDeleteModel struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` +} + +type SysPostViewParam struct { + PostId int64 `json:"postId" description:"岗位ID"` +} + +type SysPostViewModel struct { + PostId int64 `json:"postId" orm:"post_id" description:"岗位ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门id"` + PostCode string `json:"postCode" orm:"post_code" description:"岗位编码"` + PostCategory string `json:"postCategory" orm:"post_category" description:"岗位类别编码"` + PostName string `json:"postName" orm:"post_name" description:"岗位名称"` + PostSort int `json:"postSort" orm:"post_sort" description:"显示顺序"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + DeptInfo SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id" description:"部门信息"` +} + +type SysPostExportParam struct { + *SysPostListParam +} + +type SysPostExportModel struct { + *SysPostListModel +} diff --git a/internal/model/sys_role.go b/internal/model/sys_role.go new file mode 100644 index 0000000..99ca519 --- /dev/null +++ b/internal/model/sys_role.go @@ -0,0 +1,125 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysRoleListModel struct { + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门组织id"` + RoleName string `json:"roleName" orm:"role_name" description:"角色名称"` + RoleKey string `json:"roleKey" orm:"role_key" description:"角色权限字符串"` + RoleSort int `json:"roleSort" orm:"role_sort" description:"显示顺序"` + DataScope string `json:"dataScope" orm:"data_scope" description:"数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:本部门及以下或本人数据权限 7:本部门及下一级数据权限)"` + MenuCheckStrictly int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + DeptCheckStrictly int `json:"deptCheckStrictly" orm:"dept_check_strictly" description:"部门树选择项是否关联显示"` + Status string `json:"status" orm:"status" description:"角色状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + DeptName string `json:"deptName" orm:"dept_name" description:"部门名称"` +} + +type SysRoleListParam struct { + request.PageInfo + RoleName string `json:"roleName" orm:"role_name"` + Status string `json:"status" orm:"status"` + RoleKey string `json:"roleKey" description:"角色权限字符串"` + CreatedAt []string `json:"createdAt" description:"创建时间"` + RoleIds []int64 `json:"roleIds" description:"角色ID"` + DeptId *int64 `json:"deptId" description:"部门组织id"` +} + +type SysRoleMiniModel struct { + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + RoleName string `json:"roleName" orm:"role_name" description:"角色名称"` + DataScope string `json:"dataScope" orm:"data_scope" description:"数据范围"` +} +type SysRoleViewParam struct { + RoleId int64 `json:"roleId" orm:"role_id"` +} + +type SysRoleViewModel struct { + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门组织id"` + RoleName string `json:"roleName" orm:"role_name" description:"角色名称"` + RoleKey string `json:"roleKey" orm:"role_key" description:"角色权限字符串"` + RoleSort int `json:"roleSort" orm:"role_sort" description:"显示顺序"` + DataScope string `json:"dataScope" orm:"data_scope" description:"数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:本部门及以下或本人数据权限 7:本部门及下一级数据权限)"` + MenuCheckStrictly int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + DeptCheckStrictly int `json:"deptCheckStrictly" orm:"dept_check_strictly" description:"部门树选择项是否关联显示"` + Status string `json:"status" orm:"status" description:"角色状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + MenuIds []int64 `json:"menuIds" orm:"menu_ids" description:"角色菜单ID列表"` + RoleMenuDataScopes map[int64]string `json:"roleMenuDataScopes" description:"角色菜单数据范围"` + DeptIds []int64 `json:"deptIds" orm:"dept_ids" description:"角色部门ID列表"` +} + +type SysRoleAddParam struct { + RoleName string `json:"roleName" orm:"role_name" description:"角色名称"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + RoleKey string `json:"roleKey" orm:"role_key" description:"角色权限字符串"` + RoleSort int `json:"roleSort" orm:"role_sort" description:"显示顺序"` + DataScope string `json:"dataScope" orm:"data_scope" description:"数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:本部门及以下或本人数据权限 7:本部门及下一级数据权限)"` + MenuCheckStrictly int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + Status string `json:"status" orm:"status" description:"角色状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + MenuIds []int64 `json:"menuIds" orm:"menu_ids" description:"菜单ID"` + RoleMenuDataScopes map[int64]string `json:"roleMenuDataScopes" description:"角色菜单数据范围"` + DeptId *int64 `json:"deptId" orm:"dept_id" description:"部门组织id"` +} + +type SysRoleAddModel struct { + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` +} + +type SysRoleEditParam struct { + RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` + RoleName *string `json:"roleName" orm:"role_name" description:"角色名称"` + RoleKey *string `json:"roleKey" orm:"role_key" description:"角色权限字符串"` + RoleSort *int `json:"roleSort" orm:"role_sort" description:"显示顺序"` + MenuCheckStrictly *int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + Status *string `json:"status" orm:"status" description:"角色状态(0正常 1停用)"` + UpdatedBy *int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark *string `json:"remark" orm:"remark" description:"备注"` + MenuIds []int64 `json:"menuIds" orm:"menu_ids" description:"菜单ID"` + RoleMenuDataScopes map[int64]string `json:"roleMenuDataScopes" description:"角色菜单数据范围"` + DeptId *int64 `json:"deptId" orm:"dept_id" description:"部门组织id"` +} + +type SysRoleEditModel struct { + RoleId int64 `json:"roleId" orm:"role_id"` +} + +type SysRoleDeleteParam struct { + RoleId int64 `json:"roleId" orm:"role_id"` + RoleIds []int64 `json:"roleIds" orm:"role_ids"` +} +type SysRoleDeleteModel struct { + RoleId int64 `json:"roleId" orm:"role_id"` + RoleIds []int64 `json:"roleIds" orm:"role_ids"` +} + +type SysRoleDataScopeEditParam struct { + RoleId int64 `json:"roleId" description:"角色ID"` + DataScope string `json:"dataScope" description:"数据范围"` + DeptCheckStrictly *int `json:"deptCheckStrictly" description:"部门树选择项是否关联显示"` + DeptIds []int64 `json:"deptIds" description:"部门ID"` +} diff --git a/internal/model/sys_social.go b/internal/model/sys_social.go new file mode 100644 index 0000000..1fd12e0 --- /dev/null +++ b/internal/model/sys_social.go @@ -0,0 +1,73 @@ +// package model +// @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 model + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +type SysSocialListModel struct { + Id int64 `json:"id" orm:"id" description:"主键"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户id"` + AuthId string `json:"authId" orm:"auth_id" description:"平台+平台唯一id"` + Source string `json:"source" orm:"source" description:"用户来源"` + OpenId string `json:"openId" orm:"open_id" description:"平台编号唯一id"` + UserName string `json:"userName" orm:"user_name" description:"登录账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + Email string `json:"email" orm:"email" description:"用户邮箱"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + AccessToken string `json:"accessToken" orm:"access_token" description:"用户的授权令牌"` + ExpireIn int `json:"expireIn" orm:"expire_in" description:"用户的授权令牌的有效期,部分平台可能没有"` + RefreshToken string `json:"refreshToken" orm:"refresh_token" description:"刷新令牌,部分平台可能没有"` + AccessCode string `json:"accessCode" orm:"access_code" description:"平台的授权信息,部分平台可能没有"` + UnionId string `json:"unionId" orm:"union_id" description:"用户的 unionid"` + Scope string `json:"scope" orm:"scope" description:"授予的权限,部分平台可能没有"` + TokenType string `json:"tokenType" orm:"token_type" description:"个别平台的授权信息,部分平台可能没有"` + IdToken string `json:"idToken" orm:"id_token" description:"id token,部分平台可能没有"` + MacAlgorithm string `json:"macAlgorithm" orm:"mac_algorithm" description:"小米平台用户的附带属性,部分平台可能没有"` + MacKey string `json:"macKey" orm:"mac_key" description:"小米平台用户的附带属性,部分平台可能没有"` + Code string `json:"code" orm:"code" description:"用户的授权code,部分平台可能没有"` + OauthToken string `json:"oauthToken" orm:"oauth_token" description:"Twitter平台用户的附带属性,部分平台可能没有"` + OauthTokenSecret string `json:"oauthTokenSecret" orm:"oauth_token_secret" description:"Twitter平台用户的附带属性,部分平台可能没有"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + User *SysUserViewModel `json:"user" orm:"user" description:"用户信息"` +} + +type SysSocialListParam struct { + UserId int64 `json:"userId" description:"用户ID"` + OpenId string `json:"openId" description:"平台编号唯一id"` + Source string `json:"source" description:"用户来源"` +} + +type SysSocialDeleteParam struct { + Id int64 `json:"id" description:"主键"` +} + +type SysSocialSaveParam struct { + UserId int64 `json:"userId" description:"用户ID"` + AuthId string `json:"authId" description:"平台+平台唯一id"` + TenantId string `json:"tenantId" description:"租户id"` + OpenId string `json:"openId" description:"平台编号唯一id"` + Source string `json:"source" description:"用户来源"` + UserName string `json:"userName" description:"登录账号"` + AccessToken string `json:"accessToken" description:"用户的授权令牌"` + CreatedBy int64 `json:"createdBy" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"` +} + +// 租户Id 用户ID 用户名 用户昵称 手机号 +type SysUserSocialModel struct { + TenantId string `json:"tenantId" description:"租户ID"` + TenantName string `json:"tenantName" description:"租户名称"` + UserId int64 `json:"userId" description:"用户ID"` + UserName string `json:"userName" description:"登录账号"` + NickName string `json:"nickName" description:"用户昵称"` + Phonenumber string `json:"phonenumber" description:"手机号"` + Avatar string `json:"avatar" description:"头像"` +} diff --git a/internal/model/sys_tenant.go b/internal/model/sys_tenant.go new file mode 100644 index 0000000..ff8439a --- /dev/null +++ b/internal/model/sys_tenant.go @@ -0,0 +1,119 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysTenantListModel struct { + Id int64 `json:"id" orm:"id" description:"id"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ContactUserName string `json:"contactUserName" orm:"contact_user_name" description:"联系人"` + ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系电话"` + CompanyName string `json:"companyName" orm:"company_name" description:"企业名称"` + LicenseNumber string `json:"licenseNumber" orm:"license_number" description:"统一社会信用代码"` + Address string `json:"address" orm:"address" description:"地址"` + Intro string `json:"intro" orm:"intro" description:"企业简介"` + Domain string `json:"domain" orm:"domain" description:"域名"` + Remark string `json:"remark" orm:"remark" description:"备注"` + PackageId int64 `json:"packageId" orm:"package_id" description:"租户套餐编号"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"过期时间"` + AccountCount int `json:"accountCount" orm:"account_count" description:"用户数量(-1不限制)"` + Status string `json:"status" orm:"status" description:"租户状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} + +type SysTenantListParam struct { + request.PageInfo + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + ContactUserName string `json:"contactUserName" orm:"contact_user_name" description:"联系人"` + ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系电话"` + CompanyName string `json:"companyName" orm:"company_name" description:"企业名称"` + LicenseNumber string `json:"licenseNumber" orm:"license_number" description:"统一社会信用代码"` + Status string `json:"status" orm:"status" description:"租户状态(0正常 1停用)"` +} + +type SysTenantStatusParam struct { + Id int64 `json:"id" orm:"id" description:"租户id"` + Status string `json:"status" orm:"status" description:"租户状态"` +} + +type SysTenantStatusModel struct { + Id int64 `json:"id" orm:"id" description:"租户id"` +} + +type SysTenantDeleteParam struct { + Ids []int64 `json:"ids" description:"租户id"` +} + +type SysTenantDeleteModel struct { + Ids []int64 `json:"ids" description:"租户id"` +} +type SysTenantViewParam struct { + Id int64 `json:"id" description:"租户id"` + TenantId string `json:"tenantId" description:"租户编号"` +} + +type SysTenantViewModel struct { + entity.SysTenant +} + +type SysTenantAddParam struct { + // TenantId string `json:"tenantId" description:"租户编号"` + ContactUserName string `json:"contactUserName" description:"联系人"` + ContactPhone string `json:"contactPhone" description:"联系电话"` + CompanyName string `json:"companyName" description:"企业名称"` + LicenseNumber string `json:"licenseNumber" description:"统一社会信用代码"` + Address string `json:"address" description:"地址"` + Intro string `json:"intro" description:"企业简介"` + Domain string `json:"domain" description:"域名"` + Remark string `json:"remark" description:"备注"` + PackageId int64 `json:"packageId" description:"租户套餐编号"` + ExpireTime *gtime.Time `json:"expireTime" description:"过期时间"` + AccountCount int `json:"accountCount" description:"用户数量(-1不限制)"` + Status *string `json:"status,omitempty" description:"租户状态(0正常 1停用)"` + Username string `json:"username" description:"用户账号"` + Password string `json:"password" description:"用户密码"` +} + +type SysTenantAddModel struct { + Id int64 `json:"id" description:"id"` +} + +type SysTenantEditParam struct { + Id int64 `json:"id" description:"id"` + ContactUserName *string `json:"contactUserName,omitempty" description:"联系人"` + ContactPhone *string `json:"contactPhone,omitempty" description:"联系电话"` + CompanyName *string `json:"companyName,omitempty" description:"企业名称"` + LicenseNumber *string `json:"licenseNumber,omitempty" description:"统一社会信用代码"` + Address *string `json:"address,omitempty" description:"地址"` + Intro *string `json:"intro,omitempty" description:"企业简介"` + Domain *string `json:"domain,omitempty" description:"域名"` + Remark *string `json:"remark,omitempty" description:"备注"` + PackageId *int64 `json:"packageId,omitempty" description:"租户套餐编号"` + ExpireTime *gtime.Time `json:"expireTime,omitempty" description:"过期时间"` + AccountCount *int `json:"accountCount,omitempty" description:"用户数量(-1不限制)"` + Status *string `json:"status,omitempty" description:"租户状态(0正常 1停用)"` +} + +type SysTenantEditModel struct { + Id int64 `json:"id" orm:"id" description:"id"` +} + +type SysTenantSyncMenuParam struct { + TenantId string `json:"tenantId" description:"租户编号"` +} + +type SysTenantSyncMenuModel struct { +} diff --git a/internal/model/sys_tenant_package.go b/internal/model/sys_tenant_package.go new file mode 100644 index 0000000..8623ec6 --- /dev/null +++ b/internal/model/sys_tenant_package.go @@ -0,0 +1,73 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysTenantPackageListModel struct { + PackageId int64 `json:"packageId" orm:"package_id" description:"租户套餐id"` + PackageName string `json:"packageName" orm:"package_name" description:"套餐名称"` + MenuIds string `json:"menuIds" orm:"menu_ids" description:"关联菜单id"` + Remark string `json:"remark" orm:"remark" description:"备注"` + MenuCheckStrictly int `json:"menuCheckStrictly" orm:"menu_check_strictly" description:"菜单树选择项是否关联显示"` + Status string `json:"status" orm:"status" description:"状态(0正常 1停用)"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` +} + +type SysTenantPackageListParam struct { + request.PageInfo + PackageName string `json:"packageName" orm:"package_name" description:"套餐名称"` +} +type SysTenantPackageStatusParam struct { + PackageId int64 `json:"packageId" description:"租户套餐id"` + Status string `json:"status" description:"状态(0正常 1停用)"` +} +type SysTenantPackageStatusModel struct { + PackageId int64 `json:"packageId" description:"租户套餐id"` +} +type SysTenantPackageViewParam struct { + PackageId int64 `json:"packageId" description:"租户套餐id"` +} +type SysTenantPackageViewModel struct { + entity.SysTenantPackage +} +type SysTenantPackageAddParam struct { + PackageName string `json:"packageName" description:"套餐名称"` + MenuIds string `json:"menuIds" description:"关联菜单id"` + Remark string `json:"remark" description:"备注"` + MenuCheckStrictly int `json:"menuCheckStrictly" description:"菜单树选择项是否关联显示"` + Status string `json:"status" description:"状态(0正常 1停用)"` +} +type SysTenantPackageAddModel struct { + PackageId int64 `json:"packageId" description:"租户套餐id"` +} +type SysTenantPackageEditParam struct { + PackageId int64 `json:"packageId" description:"租户套餐id"` + PackageName *string `json:"packageName,omitempty" description:"套餐名称"` + MenuIds *string `json:"menuIds,omitempty" description:"关联菜单id"` + Remark *string `json:"remark,omitempty" description:"备注"` + MenuCheckStrictly *int `json:"menuCheckStrictly,omitempty" description:"菜单树选择项是否关联显示"` + Status *string `json:"status,omitempty" description:"状态(0正常 1停用)"` +} +type SysTenantPackageEditModel struct { + PackageId int64 `json:"packageId" description:"租户套餐id"` +} + +type SysTenantPackageDeleteParam struct { + PackageIds []int64 `json:"packageIds" description:"租户套餐id"` +} +type SysTenantPackageDeleteModel struct { + PackageIds []int64 `json:"packageIds" description:"租户套餐id"` +} diff --git a/internal/model/sys_user.go b/internal/model/sys_user.go new file mode 100644 index 0000000..5594173 --- /dev/null +++ b/internal/model/sys_user.go @@ -0,0 +1,232 @@ +// package model +// @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 model + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +type SysUserMiniModel struct { + g.Meta `orm:"table:sys_user" description:"用户"` + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` +} + +type LoginUserOut struct { + ID int64 `json:"id"` + Username string `json:"username"` + NickName string `json:"nickName"` + Avatar string `json:"avatar"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` + UUID string `json:"uuid"` + RoleIds []int64 `json:"roleIds"` +} + +type UserListParam struct { + TenantId string `json:"tenantId" description:"租户编号"` + UserId int64 `json:"userId" description:"用户ID"` + DeptId int64 `json:"deptId" description:"部门ID"` + DeptIdList []int64 `json:"deptIdList" description:"部门ID列表"` + UserName string `json:"userName" description:"用户账号"` + NickName string `json:"nickName" description:"用户昵称"` + Email string `json:"email" description:"用户邮箱"` + Phonenumber string `json:"phonenumber" description:"手机号码"` + Status string `json:"status" description:"帐号状态(0正常 1停用)"` + CreatedAt []string `json:"createdAt" description:"创建时间"` +} + +type SysUserListModel struct { + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"` + Email string `json:"email" orm:"email" description:"用户邮箱"` + Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"` + Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"` + LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"` + LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + DeptInfo *SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id" description:"部门信息"` + Roles []*SysRoleMiniModel `json:"roles" description:"角色信息"` + IsDefaultUser bool `json:"isDefaultUser" description:"是否默认用户"` +} + +type SysUserViewModel struct { + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"` + Email string `json:"email" orm:"email" description:"用户邮箱"` + Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"` + Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"` + LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"` + LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"` + MfaEnabled int64 `json:"mfaEnabled" orm:"mfa_enabled" description:"是否开启mfa验证"` + + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + DeptInfo *SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id" description:"部门信息"` + Roles []*SysRoleMiniModel `json:"roles" description:"角色信息"` + Posts []*SysPostMiniModel `json:"posts" description:"岗位信息"` +} + +type UserProfileModel struct { + SysUserViewModel + CompanyInfo *SysDeptMiniModel `json:"companyInfo" orm:"with:dept_id=dept_id" description:"公司信息"` +} + +type UpdateCurrentUserModel struct { + NickName string `json:"nickName"` + Email string `json:"email"` + Phonenumber string `json:"phonenumber"` + Avatar string `json:"avatar"` + Sex string `json:"sex"` +} + +type UpdateCurrentUserPasswordModel struct { + OldPassword string `json:"oldPassword"` + NewPassword string `json:"newPassword"` +} + +type UpdateCurrentUserContactCodeModel struct { + Contact string `json:"contact" v:"required#手机号或邮箱不能为空" dc:"手机号或邮箱"` + CaptchaID string `json:"captchaID" v:"required#图片验证码不能为空" dc:"图片验证码ID"` + CaptchaValue string `json:"captchaValue" v:"required#图片验证码不能为空" dc:"图片验证码值"` +} + +type UpdateCurrentUserContactModel struct { + Contact string `json:"contact" v:"required#手机号或邮箱不能为空" dc:"手机号或邮箱"` + Code string `json:"code" v:"required#验证码不能为空" dc:"短信/邮箱验证码"` +} + +type SendCurrentUserEmailCodeModel struct { + Email string `json:"email" dc:"新邮箱"` + CaptchaID string `json:"captchaId" dc:"身份验证码ID"` + CaptchaValue string `json:"captchaValue" dc:"身份验证码"` +} + +type UpdateCurrentUserEmailModel struct { + Email string `json:"email" dc:"新邮箱"` + Code string `json:"code" dc:"验证码"` +} + +type SendCurrentUserPhoneCodeModel struct { + Phonenumber string `json:"phonenumber" dc:"新电话"` + CaptchaID string `json:"captchaId" dc:"身份验证码ID"` + CaptchaValue string `json:"captchaValue" dc:"身份验证码"` +} + +type UpdateCurrentUserPhoneModel struct { + Phonenumber string `json:"phonenumber" dc:"新电话"` + Code string `json:"code" dc:"验证码"` +} + +type UserCodeHttpSenderConfig struct { + Url string `json:"url"` + Method string `json:"method"` + Headers map[string]string `json:"headers"` + BodyTemplate string `json:"bodyTemplate"` + SuccessStatus int `json:"successStatus"` +} + +type UserCodeEmailSenderConfig struct { + UserCodeHttpSenderConfig + Host string `json:"host"` + Port int `json:"port"` + Username string `json:"username"` + Password string `json:"password"` + From string `json:"from"` + FromName string `json:"fromName"` + Subject string `json:"subject"` + BodyTemplate string `json:"bodyTemplate"` + SSL bool `json:"ssl"` +} + +type SysUserAddModel struct { + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"` + UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"` + Email string `json:"email" orm:"email" description:"用户邮箱"` + Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"` + Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"` + Avatar string `json:"avatar" orm:"avatar" description:"头像地址"` + Salt string `json:"salt" orm:"salt" description:"加密盐"` + Password string `json:"password" orm:"password" description:"密码"` + Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"` + LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"` + LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"` + CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"` + CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` + UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark string `json:"remark" orm:"remark" description:"备注"` + PostIds []int64 `json:"postIds" orm:"post_ids" description:"岗位ID列表"` + RoleIds []int64 `json:"roleIds" orm:"role_ids" description:"角色ID列表"` +} + +type SysUserUpdateModel struct { + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` + DeptId *int64 `json:"deptId" orm:"dept_id" description:"部门ID"` + UserName *string `json:"userName" orm:"user_name" description:"用户账号"` + NickName *string `json:"nickName" orm:"nick_name" description:"用户昵称"` + UserType *string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"` + Email *string `json:"email" orm:"email" description:"用户邮箱"` + Phonenumber *string `json:"phonenumber" orm:"phonenumber" description:"手机号码"` + Sex *string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"` + Avatar *string `json:"avatar" orm:"avatar" description:"头像地址"` + Status *string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"` + UpdatedBy *int64 `json:"updatedBy" orm:"updated_by" description:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` + Remark *string `json:"remark" orm:"remark" description:"备注"` + PostIds []int64 `json:"postIds" orm:"post_ids" description:"岗位ID列表"` + RoleIds []int64 `json:"roleIds" orm:"role_ids" description:"角色ID列表"` +} + +type SysUserRegisterModel struct { + UserName string `json:"userName" v:"required#用户账号不能为空" dc:"用户账号"` + Password string `json:"password" v:"required#密码不能为空" dc:"密码"` + TenantId string `json:"tenantId" v:"required#租户编号不能为空" dc:"租户编号"` + CaptchaID string `json:"captchaId" v:"required#验证码不能为空" dc:"验证码ID"` + CaptchaValue string `json:"captchaValue" v:"required#验证码不能为空" dc:"验证码值"` +} + +type SysUserStatusParam struct { + UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"` + Status string `json:"status" v:"required#状态不能为空" dc:"状态"` +} + +type SysUserMfaEnabledModel struct { + UserId int64 `json:"userId" dc:"用户ID"` + MfaEnabled int64 `json:"mfaEnabled" dc:"是否开启mfa验证 0否 1是"` +} + +type SysUserIsMfaEnabledModel struct { + Uuid string `json:"uuid" dc:"mfa验证码uuid"` + Code string `json:"code" dc:"mfa验证码"` + MfaEnabled int64 `json:"mfaEnabled" dc:"是否开启mfa验证 0否 1是"` +} diff --git a/internal/model/sys_user_online.go b/internal/model/sys_user_online.go new file mode 100644 index 0000000..e9f56f7 --- /dev/null +++ b/internal/model/sys_user_online.go @@ -0,0 +1,71 @@ +// package model +// @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 model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + + "github.com/gogf/gf/v2/os/gtime" +) + +type SysUserOnlineViewModel struct { + entity.SysUserOnline +} + +type SysUserOnlineListParam struct { + UserName string `json:"userName" description:"用户账号"` + ClientKey string `json:"clientKey" description:"客户端"` + DeviceType string `json:"deviceType" description:"设备类型"` + Ipaddr string `json:"ipaddr" description:"登录IP地址"` + LoginTime []string `json:"loginTime" description:"访问时间"` + Token string `json:"token" description:"Token"` +} +type SysUserOnlineListModel struct { + OnlineId int64 `json:"onlineId" orm:"online_id" description:"访问ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Uuid string `json:"uuid" orm:"uuid" description:"UUID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Token string `json:"token" orm:"token" description:"Token"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"过期时间"` +} + +type SysUserOnlineAddModel struct { + OnlineId int64 `json:"onlineId" orm:"online_id" description:"访问ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Uuid string `json:"uuid" orm:"uuid" description:"UUID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Token string `json:"token" orm:"token" description:"Token"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"过期时间"` +} +type SysUserOnlineUpdateModel struct { + OnlineId int64 `json:"onlineId" orm:"online_id" description:"访问ID"` + TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"` + Uuid string `json:"uuid" orm:"uuid" description:"UUID"` + UserName string `json:"userName" orm:"user_name" description:"用户账号"` + ClientKey string `json:"clientKey" orm:"client_key" description:"客户端"` + DeviceType string `json:"deviceType" orm:"device_type" description:"设备类型"` + Ipaddr string `json:"ipaddr" orm:"ipaddr" description:"登录IP地址"` + LoginLocation string `json:"loginLocation" orm:"login_location" description:"登录地点"` + Browser string `json:"browser" orm:"browser" description:"浏览器类型"` + Os string `json:"os" orm:"os" description:"操作系统"` + Token string `json:"token" orm:"token" description:"Token"` + LoginTime *gtime.Time `json:"loginTime" orm:"login_time" description:"访问时间"` + ExpireTime *gtime.Time `json:"expireTime" orm:"expire_time" description:"过期时间"` +} diff --git a/internal/model/t_agent_balance.go b/internal/model/t_agent_balance.go new file mode 100644 index 0000000..e0fc73a --- /dev/null +++ b/internal/model/t_agent_balance.go @@ -0,0 +1,211 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +// TAgentBalanceUpdateFields 修改企业客户财务信息字段过滤 +type TAgentBalanceUpdateFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + Balance float64 `json:"balance" dc:"账户余额"` + WithdrawAmount float64 `json:"withdrawAmount" dc:"可提现金额"` + WithdrawAmountStatus int `json:"withdrawAmountStatus" dc:"可提现金额状态: 1-正常, 0-冻结"` + InvoiceAmount float64 `json:"invoiceAmount" dc:"已开票金额"` + CanInvoiceAmount float64 `json:"canInvoiceAmount" dc:"可开票金额"` + CreditLimit float64 `json:"creditLimit" dc:"信用额度"` + UsedCredit float64 `json:"usedCredit" dc:"已使用信用额度"` + PendingRepayment float64 `json:"pendingRepayment" dc:"待还款金额"` + Status int `json:"status" dc:"状态: 0-正常, 1-禁用"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TAgentBalanceInsertFields 新增企业客户财务信息字段过滤 +type TAgentBalanceInsertFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + Balance float64 `json:"balance" dc:"账户余额"` + WithdrawAmount float64 `json:"withdrawAmount" dc:"可提现金额"` + WithdrawAmountStatus int `json:"withdrawAmountStatus" dc:"可提现金额状态: 1-正常, 0-冻结"` + InvoiceAmount float64 `json:"invoiceAmount" dc:"已开票金额"` + CanInvoiceAmount float64 `json:"canInvoiceAmount" dc:"可开票金额"` + CreditLimit float64 `json:"creditLimit" dc:"信用额度"` + UsedCredit float64 `json:"usedCredit" dc:"已使用信用额度"` + PendingRepayment float64 `json:"pendingRepayment" dc:"待还款金额"` + Status int `json:"status" dc:"状态: 0-正常, 1-禁用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TAgentBalanceEditParam 修改/新增企业客户财务信息 +type TAgentBalanceEditParam struct { + //entity.TAgentBalance + Id int64 `json:"id" dc:"账户ID"` + DeptId *int64 `json:"deptId" dc:"机构ID"` + Balance *float64 `json:"balance" dc:"账户余额"` + WithdrawAmount *float64 `json:"withdrawAmount" dc:"可提现金额"` + WithdrawAmountStatus *int `json:"withdrawAmountStatus" dc:"可提现金额状态: 1-正常, 0-冻结"` + InvoiceAmount *float64 `json:"invoiceAmount" dc:"已开票金额"` + CanInvoiceAmount *float64 `json:"canInvoiceAmount" dc:"可开票金额"` + CreditLimit *float64 `json:"creditLimit" dc:"信用额度"` + UsedCredit *float64 `json:"usedCredit" dc:"已使用信用额度"` + PendingRepayment *float64 `json:"pendingRepayment" dc:"待还款金额"` + Status *int `json:"status" dc:"状态: 0-正常, 1-禁用"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TAgentBalanceEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TAgentBalanceEditModel struct{} + +// TAgentBalanceDeleteParam 删除企业客户财务信息 +type TAgentBalanceDeleteParam struct { + Id interface{} `json:"id" v:"required#账户ID不能为空" dc:"账户ID"` +} + +func (in *TAgentBalanceDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentBalanceDeleteModel struct{} + +// TAgentBalanceViewParam 获取指定企业客户财务信息信息 +type TAgentBalanceViewParam struct { + Id int64 `json:"id" v:"required#账户ID不能为空" dc:"账户ID"` +} + +func (in *TAgentBalanceViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentBalanceViewModel struct { + entity.TAgentBalance + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TAgentBalanceListParam 获取企业客户财务信息列表 +type TAgentBalanceListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"账户ID"` + WithdrawAmountStatus int `json:"withdrawAmountStatus" dc:"可提现金额状态: 1-正常, 0-冻结"` + Status int `json:"status" dc:"状态: 0-正常, 1-禁用"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TAgentBalanceListParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentBalanceListModel struct { + Id int64 `json:"id" dc:"账户ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + Balance float64 `json:"balance" dc:"账户余额"` + WithdrawAmount float64 `json:"withdrawAmount" dc:"可提现金额"` + WithdrawAmountStatus int `json:"withdrawAmountStatus" dc:"可提现金额状态: 1-正常, 0-冻结"` + InvoiceAmount float64 `json:"invoiceAmount" dc:"已开票金额"` + CanInvoiceAmount float64 `json:"canInvoiceAmount" dc:"可开票金额"` + CreditLimit float64 `json:"creditLimit" dc:"信用额度"` + UsedCredit float64 `json:"usedCredit" dc:"已使用信用额度"` + PendingRepayment float64 `json:"pendingRepayment" dc:"待还款金额"` + Status int `json:"status" dc:"状态: 0-正常, 1-禁用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TAgentBalanceExportModel 导出企业客户财务信息 +type TAgentBalanceExportModel struct { + Id int64 `json:"id" dc:"账户ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + Balance float64 `json:"balance" dc:"账户余额"` + WithdrawAmount float64 `json:"withdrawAmount" dc:"可提现金额"` + WithdrawAmountStatus int `json:"withdrawAmountStatus" dc:"可提现金额状态: 1-正常, 0-冻结"` + InvoiceAmount float64 `json:"invoiceAmount" dc:"已开票金额"` + CanInvoiceAmount float64 `json:"canInvoiceAmount" dc:"可开票金额"` + CreditLimit float64 `json:"creditLimit" dc:"信用额度"` + UsedCredit float64 `json:"usedCredit" dc:"已使用信用额度"` + PendingRepayment float64 `json:"pendingRepayment" dc:"待还款金额"` + Status int `json:"status" dc:"状态: 0-正常, 1-禁用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TAgentBalanceStatusParam 更新企业客户财务信息状态 +type TAgentBalanceStatusParam struct { + Id int64 `json:"id" v:"required#账户ID不能为空" dc:"账户ID"` + Status int `json:"status" dc:"状态"` +} + +func (in *TAgentBalanceStatusParam) Filter(ctx context.Context) (err error) { + if in.Id <= 0 { + err = gerror.New("账户ID不能为空") + return + } + + if in.Status <= 0 { + err = gerror.New("状态不能为空") + return + } + + if !slices.Contains(consts.StatusSlice, in.Status) { + err = gerror.New("状态不正确") + return + } + return +} + +type TAgentBalanceStatusModel struct{} + +type TAgentBalanceTrendParam struct { + StartMonth string `json:"startMonth" dc:"开始月份,格式YYYY-MM"` + EndMonth string `json:"endMonth" dc:"结束月份,格式YYYY-MM"` + AccountType string `json:"accountType" dc:"账户类型:1 盈利账户,2消费账户 默认1"` +} + +func (in *TAgentBalanceTrendParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentBalanceChartSeries struct { + Name string `json:"name" dc:"折线名称"` + Values []float64 `json:"values" dc:"折线数据"` +} + +type TAgentBalanceChartData struct { + Labels []string `json:"labels" dc:"月份标签"` + Series []*TAgentBalanceChartSeries `json:"series" dc:"折线数据"` +} diff --git a/internal/model/t_agent_enterprise.go b/internal/model/t_agent_enterprise.go new file mode 100644 index 0000000..0f1c2b9 --- /dev/null +++ b/internal/model/t_agent_enterprise.go @@ -0,0 +1,156 @@ +// Package model +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TAgentEnterpriseUpdateFields 修改企业客户单位信息字段过滤 +type TAgentEnterpriseUpdateFields struct { + DeptId int64 `json:"deptId" dc:"部门机构id"` + FullName string `json:"fullName" dc:"单位全称"` + Industry string `json:"industry" dc:"行业"` + LegalPersonName string `json:"legalPersonName" dc:"法人名称"` + LegalPersonIdCard string `json:"legalPersonIdCard" dc:"法人身份证号"` + CompanyType string `json:"companyType" dc:"单位类型"` + EstablishTime *gtime.Time `json:"establishTime" dc:"单位成立时间"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TAgentEnterpriseInsertFields 新增企业客户单位信息字段过滤 +type TAgentEnterpriseInsertFields struct { + DeptId int64 `json:"deptId" dc:"部门机构id"` + FullName string `json:"fullName" dc:"单位全称"` + Industry string `json:"industry" dc:"行业"` + LegalPersonName string `json:"legalPersonName" dc:"法人名称"` + LegalPersonIdCard string `json:"legalPersonIdCard" dc:"法人身份证号"` + CompanyType string `json:"companyType" dc:"单位类型"` + EstablishTime *gtime.Time `json:"establishTime" dc:"单位成立时间"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TAgentEnterpriseEditParam 修改/新增企业客户单位信息 +type TAgentEnterpriseEditParam struct { + //entity.TAgentEnterprise + Id int64 `json:"id" dc:"主键ID"` + DeptId *int64 `json:"deptId" dc:"部门机构id"` + FullName *string `json:"fullName" dc:"单位全称"` + Industry *string `json:"industry" dc:"行业"` + LegalPersonName *string `json:"legalPersonName" dc:"法人名称"` + LegalPersonIdCard *string `json:"legalPersonIdCard" dc:"法人身份证号"` + CompanyType *string `json:"companyType" dc:"单位类型"` + EstablishTime *gtime.Time `json:"establishTime" dc:"单位成立时间"` + BankName *string `json:"bankName" dc:"开户行名称"` + BankAccount *string `json:"bankAccount" dc:"开户行账号"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TAgentEnterpriseEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TAgentEnterpriseEditModel struct{} + +// TAgentEnterpriseDeleteParam 删除企业客户单位信息 +type TAgentEnterpriseDeleteParam struct { + // Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` + DeptId int64 `json:"deptId" v:"required#部门机构id不能为空" dc:"部门机构id"` +} + +func (in *TAgentEnterpriseDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentEnterpriseDeleteModel struct{} + +// TAgentEnterpriseViewParam 获取指定企业客户单位信息信息 +type TAgentEnterpriseViewParam struct { + // Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` + DeptId int64 `json:"deptId" v:"required#部门机构id不能为空" dc:"部门机构id"` +} + +func (in *TAgentEnterpriseViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentEnterpriseViewModel struct { + entity.TAgentEnterprise + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TAgentEnterpriseListParam 获取企业客户单位信息列表 +type TAgentEnterpriseListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TAgentEnterpriseListParam) Filter(ctx context.Context) (err error) { + return +} + +type TAgentEnterpriseListModel struct { + Id int64 `json:"id" dc:"主键ID"` + DeptId int64 `json:"deptId" dc:"部门机构id"` + FullName string `json:"fullName" dc:"单位全称"` + Industry string `json:"industry" dc:"行业"` + LegalPersonName string `json:"legalPersonName" dc:"法人名称"` + LegalPersonIdCard string `json:"legalPersonIdCard" dc:"法人身份证号"` + CompanyType string `json:"companyType" dc:"单位类型"` + EstablishTime *gtime.Time `json:"establishTime" dc:"单位成立时间"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TAgentEnterpriseExportModel 导出企业客户单位信息 +type TAgentEnterpriseExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + DeptId int64 `json:"deptId" dc:"部门机构id"` + FullName string `json:"fullName" dc:"单位全称"` + Industry string `json:"industry" dc:"行业"` + LegalPersonName string `json:"legalPersonName" dc:"法人名称"` + LegalPersonIdCard string `json:"legalPersonIdCard" dc:"法人身份证号"` + CompanyType string `json:"companyType" dc:"单位类型"` + EstablishTime *gtime.Time `json:"establishTime" dc:"单位成立时间"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_api.go b/internal/model/t_api.go new file mode 100644 index 0000000..a5074b2 --- /dev/null +++ b/internal/model/t_api.go @@ -0,0 +1,145 @@ +// Package iotin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TApiUpdateFields 修改API集成字段过滤 +type TApiUpdateFields struct { + AppKey string `json:"appKey" dc:"APPKey"` + AppSecret string `json:"appSecret" dc:"APPSecret"` + GroupId int64 `json:"groupId" dc:"权限组ID"` + Status int `json:"status" dc:"状态:0启用,1停用"` + RateLimitPeriod int `json:"rateLimitPeriod" dc:"限流周期(秒,0:不限流)"` + RateLimitCount int `json:"rateLimitCount" dc:"限流次数"` + DeptId int64 `json:"deptId" dc:"所属机构"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiInsertFields 新增API集成字段过滤 +type TApiInsertFields struct { + AppKey string `json:"appKey" dc:"APPKey"` + AppSecret string `json:"appSecret" dc:"APPSecret"` + GroupId int64 `json:"groupId" dc:"permission group id"` + Status int `json:"status" dc:"status"` + RateLimitPeriod int `json:"rateLimitPeriod" dc:"限流周期(秒,0:不限流)"` + RateLimitCount int `json:"rateLimitCount" dc:"限流次数"` + DeptId int64 `json:"deptId" dc:"所属机构"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TApiEditParam 修改/新增API集成 +type TApiEditParam struct { + //entity.TApi + Id int64 `json:"id" dc:"ID"` + AppKey *string `json:"appKey" dc:"APPKey"` + AppSecret *string `json:"appSecret" dc:"APPSecret"` + GroupId *int64 `json:"groupId" dc:"权限组ID"` + Status *int `json:"status" dc:"状态:0启用,1停用"` + RateLimitPeriod *int `json:"rateLimitPeriod" dc:"限流周期(秒,0:不限流)"` + RateLimitCount *int `json:"rateLimitCount" dc:"限流次数"` + DeptId *int64 `json:"deptId" dc:"所属机构"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TApiEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TApiEditModel struct{} + +// TApiDeleteParam 删除API集成 +type TApiDeleteParam struct { + Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"` +} + +func (in *TApiDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiDeleteModel struct{} + +// TApiViewParam 获取指定API集成信息 +type TApiViewParam struct { + // Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"` + AppKey string `json:"appKey" v:"required#APPKey不能为空" dc:"APPKey"` +} + +func (in *TApiViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiViewModel struct { + entity.TApi + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TApiListParam 获取API集成列表 +type TApiListParam struct { + request.PageInfo + AppKey string `json:"appKey" dc:"APPKey"` +} + +func (in *TApiListParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiListModel struct { + Id int64 `json:"id" dc:"ID"` + AppKey string `json:"appKey" dc:"APPKey"` + AppSecret string `json:"appSecret" dc:"APPSecret"` + GroupId int64 `json:"groupId" dc:"permission group id"` + Status int `json:"status" dc:"status"` + RateLimitPeriod int `json:"rateLimitPeriod" dc:"限流周期(秒,0:不限流)"` + RateLimitCount int `json:"rateLimitCount" dc:"限流次数"` + DeptId int64 `json:"deptId" dc:"所属机构"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiExportModel 导出API集成 +type TApiExportModel struct { + Id int64 `json:"id" dc:"ID"` + AppKey string `json:"appKey" dc:"APPKey"` + AppSecret string `json:"appSecret" dc:"APPSecret"` + GroupId int64 `json:"groupId" dc:"permission group id"` + Status int `json:"status" dc:"status"` + RateLimitPeriod int `json:"rateLimitPeriod" dc:"限流周期(秒,0:不限流)"` + RateLimitCount int `json:"rateLimitCount" dc:"限流次数"` + DeptId int64 `json:"deptId" dc:"所属机构"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_api_group.go b/internal/model/t_api_group.go new file mode 100644 index 0000000..5043f8e --- /dev/null +++ b/internal/model/t_api_group.go @@ -0,0 +1,154 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +// TApiGroupUpdateFields 修改开放接口权限组表字段过滤 +type TApiGroupUpdateFields struct { + GroupName string `json:"groupName" dc:"权限组名称"` + GroupCode string `json:"groupCode" dc:"权限组编码"` + Status int `json:"status" dc:"状态:0启用,1停用"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiGroupInsertFields 新增开放接口权限组表字段过滤 +type TApiGroupInsertFields struct { + GroupName string `json:"groupName" dc:"权限组名称"` + GroupCode string `json:"groupCode" dc:"权限组编码"` + Status int `json:"status" dc:"状态:0启用,1停用"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TApiGroupEditParam 修改/新增开放接口权限组表 +type TApiGroupEditParam struct { + //entity.TApiGroup + Id int64 `json:"id" dc:"主键ID"` + GroupName *string `json:"groupName" dc:"权限组名称"` + GroupCode *string `json:"groupCode" dc:"权限组编码"` + ApiIds []int64 `json:"apiIds" dc:"开放接口资源ID列表"` + Status *int `json:"status" dc:"状态:0启用,1停用"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TApiGroupEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TApiGroupEditModel struct{} + +// TApiGroupDeleteParam 删除开放接口权限组表 +type TApiGroupDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TApiGroupDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiGroupDeleteModel struct{} + +// TApiGroupViewParam 获取指定开放接口权限组表信息 +type TApiGroupViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TApiGroupViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiGroupViewModel struct { + entity.TApiGroup + ApiIds []int64 `json:"apiIds" dc:"开放接口资源ID列表"` + Apis []*TApiResourceListModel `json:"apis" dc:"开放接口资源列表"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TApiGroupListParam 获取开放接口权限组表列表 +type TApiGroupListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + Status int `json:"status" dc:"状态:0启用,1停用"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` + GroupName string `json:"groupName" dc:"权限组名称"` +} + +func (in *TApiGroupListParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiGroupListModel struct { + Id int64 `json:"id" dc:"主键ID"` + GroupName string `json:"groupName" dc:"权限组名称"` + GroupCode string `json:"groupCode" dc:"权限组编码"` + Status int `json:"status" dc:"状态:0启用,1停用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiGroupExportModel 导出开放接口权限组表 +type TApiGroupExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + GroupName string `json:"groupName" dc:"权限组名称"` + GroupCode string `json:"groupCode" dc:"权限组编码"` + Status int `json:"status" dc:"状态:0启用,1停用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiGroupStatusParam 更新开放接口权限组表状态 +type TApiGroupStatusParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` + Status int `json:"status" dc:"状态"` +} + +func (in *TApiGroupStatusParam) Filter(ctx context.Context) (err error) { + if in.Id <= 0 { + return gerror.New("主键ID不能为空") + } + if !slices.Contains(consts.StatusSlice, in.Status) { + return gerror.New("状态不正确") + } + return +} + +type TApiGroupStatusModel struct{} diff --git a/internal/model/t_api_resource.go b/internal/model/t_api_resource.go new file mode 100644 index 0000000..9953e9e --- /dev/null +++ b/internal/model/t_api_resource.go @@ -0,0 +1,185 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/text/gstr" +) + +// TApiResourceUpdateFields 修改开放接口资源表字段过滤 +type TApiResourceUpdateFields struct { + ApiName string `json:"apiName" dc:"接口名称"` + ApiCode string `json:"apiCode" dc:"接口权限标识"` + Method string `json:"method" dc:"请求方法:GET/POST/PUT/DELETE"` + Path string `json:"path" dc:"接口路径"` + Status int `json:"status" dc:"状态:0启用,1停用"` + Version string `json:"version" dc:"接口版本"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiResourceInsertFields 新增开放接口资源表字段过滤 +type TApiResourceInsertFields struct { + ApiName string `json:"apiName" dc:"接口名称"` + ApiCode string `json:"apiCode" dc:"接口权限标识"` + Method string `json:"method" dc:"请求方法:GET/POST/PUT/DELETE"` + Path string `json:"path" dc:"接口路径"` + Status int `json:"status" dc:"状态:0启用,1停用"` + Version string `json:"version" dc:"接口版本"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TApiResourceEditParam 修改/新增开放接口资源表 +type TApiResourceEditParam struct { + //entity.TApiResource + Id int64 `json:"id" dc:"主键ID"` + ApiName *string `json:"apiName" dc:"接口名称"` + ApiCode *string `json:"apiCode" dc:"接口权限标识"` + Method *int `json:"method" dc:"请求方法:GET/POST/PUT/DELETE"` + Path *string `json:"path" dc:"接口路径"` + Status *int `json:"status" dc:"状态:0启用,1停用"` + Version *string `json:"version" dc:"接口版本"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TApiResourceEditParam) Filter(ctx context.Context) (err error) { + if in == nil { + return gerror.New("请求参数不能为空") + } + if in.ApiName == nil || gstr.Trim(*in.ApiName) == "" { + return gerror.New("接口名称不能为空") + } + if in.ApiCode == nil || gstr.Trim(*in.ApiCode) == "" { + return gerror.New("接口权限标识不能为空") + } + if in.Method == nil || !slices.Contains(consts.MethodSlice, *in.Method) { + return gerror.New("请求方法不能为空") + } + if in.Path == nil || gstr.Trim(*in.Path) == "" { + return gerror.New("接口路径不能为空") + } + if in.Status != nil && !slices.Contains(consts.StatusSlice, *in.Status) { + return gerror.New("状态不正确") + } + return +} + +type TApiResourceEditModel struct{} + +// TApiResourceDeleteParam 删除开放接口资源表 +type TApiResourceDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TApiResourceDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiResourceDeleteModel struct{} + +// TApiResourceViewParam 获取指定开放接口资源表信息 +type TApiResourceViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TApiResourceViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiResourceViewModel struct { + entity.TApiResource + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TApiResourceListParam 获取开放接口资源表列表 +type TApiResourceListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + Status int `json:"status" dc:"状态:0启用,1停用"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` + ApiName string `json:"apiName" dc:"接口名称"` + Version string `json:"version" dc:"接口版本"` +} + +func (in *TApiResourceListParam) Filter(ctx context.Context) (err error) { + return +} + +type TApiResourceListModel struct { + Id int64 `json:"id" dc:"主键ID"` + ApiName string `json:"apiName" dc:"接口名称"` + ApiCode string `json:"apiCode" dc:"接口权限标识"` + Method int `json:"method" dc:"请求方法:GET/POST/PUT/DELETE"` + Path string `json:"path" dc:"接口路径"` + Status int `json:"status" dc:"状态:0启用,1停用"` + Version string `json:"version" dc:"接口版本"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiResourceExportModel 导出开放接口资源表 +type TApiResourceExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + ApiName string `json:"apiName" dc:"接口名称"` + ApiCode string `json:"apiCode" dc:"接口权限标识"` + Method string `json:"method" dc:"请求方法:GET/POST/PUT/DELETE"` + Path string `json:"path" dc:"接口路径"` + Status int `json:"status" dc:"状态:0启用,1停用"` + Version string `json:"version" dc:"接口版本"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TApiResourceStatusParam 更新开放接口资源表状态 +type TApiResourceStatusParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` + Status int `json:"status" dc:"状态"` +} + +func (in *TApiResourceStatusParam) Filter(ctx context.Context) (err error) { + if in.Id <= 0 { + return gerror.New("主键ID不能为空") + } + if !slices.Contains(consts.StatusSlice, in.Status) { + return gerror.New("状态不正确") + } + return +} + +type TApiResourceStatusModel struct{} diff --git a/internal/model/t_balance_detail.go b/internal/model/t_balance_detail.go new file mode 100644 index 0000000..982b216 --- /dev/null +++ b/internal/model/t_balance_detail.go @@ -0,0 +1,207 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TBalanceDetailUpdateFields 修改余额明细表字段过滤 +type TBalanceDetailUpdateFields struct { + DeptId int64 `json:"deptId" dc:"账户ID"` + SerialNo string `json:"serialNo" dc:"流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + TransactionType int `json:"transactionType" dc:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel int `json:"transactionChannel" dc:"交易渠道:1支付宝 2微信 3可提现金额"` + Amount float64 `json:"amount" dc:"交易金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前余额"` + BalanceAfter float64 `json:"balanceAfter" dc:"变动后余额"` + ChannelSerialNo string `json:"channelSerialNo" dc:"交易渠道流水号"` + OrderSn string `json:"orderSn" dc:"关联订单号"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TBalanceDetailInsertFields 新增余额明细表字段过滤 +type TBalanceDetailInsertFields struct { + DeptId int64 `json:"deptId" dc:"账户ID"` + SerialNo string `json:"serialNo" dc:"流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + TransactionType int `json:"transactionType" dc:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel int `json:"transactionChannel" dc:"交易渠道:1支付宝 2微信 3可提现金额"` + Amount float64 `json:"amount" dc:"交易金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前余额"` + BalanceAfter float64 `json:"balanceAfter" dc:"变动后余额"` + ChannelSerialNo string `json:"channelSerialNo" dc:"交易渠道流水号"` + OrderSn string `json:"orderSn" dc:"关联订单号"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TBalanceDetailEditParam 修改/新增余额明细表 +type TBalanceDetailEditParam struct { + //entity.TBalanceDetail + Id int64 `json:"id" dc:"明细ID"` + DeptId *int64 `json:"deptId" dc:"账户ID"` + SerialNo *string `json:"serialNo" dc:"流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + IncomeExpenseType *int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + TransactionType *int `json:"transactionType" dc:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel *int `json:"transactionChannel" dc:"交易渠道:1支付宝 2微信 3可提现金额"` + Amount *float64 `json:"amount" dc:"交易金额"` + BeforeBalance *float64 `json:"beforeBalance" dc:"变动前余额"` + BalanceAfter *float64 `json:"balanceAfter" dc:"变动后余额"` + ChannelSerialNo *string `json:"channelSerialNo" dc:"交易渠道流水号"` + OrderSn *string `json:"orderSn" dc:"关联订单号"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TBalanceDetailEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TBalanceDetailEditModel struct{} + +// TBalanceDetailDeleteParam 删除余额明细表 +type TBalanceDetailDeleteParam struct { + Id interface{} `json:"id" v:"required#明细ID不能为空" dc:"明细ID"` +} + +func (in *TBalanceDetailDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TBalanceDetailDeleteModel struct{} + +// TBalanceDetailViewParam 获取指定余额明细表信息 +type TBalanceDetailViewParam struct { + Id int64 `json:"id" v:"required#明细ID不能为空" dc:"明细ID"` +} + +func (in *TBalanceDetailViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TBalanceDetailViewModel struct { + entity.TBalanceDetail + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TBalanceDetailListParam 获取余额明细表列表 +type TBalanceDetailListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"明细ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期"` + IncomeExpenseType *int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + TransactionType *int `json:"transactionType" dc:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel *int `json:"transactionChannel" dc:"交易渠道:1支付宝 2微信 3可提现金额"` + PayType *int `json:"payType" dc:"支付类型:1 在线支付(微信、支付等)2 货到付款(支持先发货,后付款)3 线下支付"` + Month []string `json:"month" form:"month[]" dc:"月份"` +} + +func (in *TBalanceDetailListParam) Filter(ctx context.Context) (err error) { + return +} + +type TBalanceDetailListModel struct { + Id int64 `json:"id" dc:"明细ID"` + DeptId int64 `json:"deptId" dc:"账户ID"` + DeptName string `json:"deptName" dc:"账户名称"` + SerialNo string `json:"serialNo" dc:"流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + TradingMonth string `json:"tradingMonth" dc:"月份"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + TransactionType int `json:"transactionType" dc:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel int `json:"transactionChannel" dc:"交易渠道:1支付宝 2微信 3可提现金额"` + Amount float64 `json:"amount" dc:"交易金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前余额"` + BalanceAfter float64 `json:"balanceAfter" dc:"变动后余额"` + ChannelSerialNo string `json:"channelSerialNo" dc:"交易渠道流水号"` + OrderSn string `json:"orderSn" dc:"关联订单号"` + OrderType int `json:"orderType" dc:"订单类型:0充值 1提现"` + PayType int `json:"payType" dc:"支付类型:1 在线支付(微信、支付等)2 货到付款(支持先发货,后付款)3 线下支付"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TBalanceDetailExportModel 导出余额明细表 +type TBalanceDetailExportModel struct { + Id int64 `json:"id" dc:"明细ID"` + DeptId int64 `json:"deptId" dc:"账户ID"` + SerialNo string `json:"serialNo" dc:"流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + TransactionType int `json:"transactionType" dc:"交易类型:0充值 1消费 2转可提现 3可提现转入 4人工调整"` + TransactionChannel int `json:"transactionChannel" dc:"交易渠道:1支付宝 2微信 3可提现金额"` + Amount float64 `json:"amount" dc:"交易金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前余额"` + BalanceAfter float64 `json:"balanceAfter" dc:"变动后余额"` + ChannelSerialNo string `json:"channelSerialNo" dc:"交易渠道流水号"` + OrderSn string `json:"orderSn" dc:"关联订单号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +type TBalanceDetailRechargeModel struct { + OutTradeNo string `json:"outTradeNo" dc:"商户订单号"` + TradeNo string `json:"tradeNo" dc:"支付宝交易号"` + TradeStatus string `json:"tradeStatus" dc:"交易状态"` + TotalAmount string `json:"totalAmount" dc:"交易金额"` + BuyerLogonId string `json:"buyerLogonId" dc:"买家支付宝账号"` + BuyerUserId string `json:"buyerUserId" dc:"买家支付宝用户ID"` + BuyerOpenId string `json:"buyerOpenId" dc:"买家支付宝OpenID"` + SendPayDate string `json:"sendPayDate" dc:"交易付款时间"` +} + +// TBalanceTransferDetailCreateParam 是余额转可提现涉及的余额明细写入参数。 +type TBalanceTransferDetailCreateParam struct { + DeptId int64 + SerialNo string + TransactionTime *gtime.Time + IncomeExpenseType int + TransactionType int + TransactionChannel int + Amount float64 + BeforeBalance float64 + BalanceAfter float64 + OrderSn string + Remark string + TenantId string + CreatedDept int64 + CreatedBy int64 + CreatedAt *gtime.Time +} diff --git a/internal/model/t_consume_account_month_bill.go b/internal/model/t_consume_account_month_bill.go new file mode 100644 index 0000000..c799df2 --- /dev/null +++ b/internal/model/t_consume_account_month_bill.go @@ -0,0 +1,222 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TConsumeAccountMonthBillUpdateFields 修改消费账户月账单表字段过滤 +type TConsumeAccountMonthBillUpdateFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + RechargeIncome float64 `json:"rechargeIncome" dc:"充值收入"` + WithdrawableTransferInIncome float64 `json:"withdrawableTransferInIncome" dc:"可提现转入收入"` + ManualAdjustIncome float64 `json:"manualAdjustIncome" dc:"人工调账收入"` + RefundIncome float64 `json:"refundIncome" dc:"退款收入"` + ConsumeExpense float64 `json:"consumeExpense" dc:"平台消费支出"` + BalanceTransferOutExpense float64 `json:"balanceTransferOutExpense" dc:"转可提现支出"` + ManualAdjustExpense float64 `json:"manualAdjustExpense" dc:"人工调账支出"` + ConsumeCreditRepayExpense float64 `json:"consumeCreditRepayExpense" dc:"消费账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + CreditUsed float64 `json:"creditUsed" dc:"本月使用信用额度"` + CreditRepaid float64 `json:"creditRepaid" dc:"本月还款信用额度"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TConsumeAccountMonthBillInsertFields 新增消费账户月账单表字段过滤 +type TConsumeAccountMonthBillInsertFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + RechargeIncome float64 `json:"rechargeIncome" dc:"充值收入"` + WithdrawableTransferInIncome float64 `json:"withdrawableTransferInIncome" dc:"可提现转入收入"` + ManualAdjustIncome float64 `json:"manualAdjustIncome" dc:"人工调账收入"` + RefundIncome float64 `json:"refundIncome" dc:"退款收入"` + ConsumeExpense float64 `json:"consumeExpense" dc:"平台消费支出"` + BalanceTransferOutExpense float64 `json:"balanceTransferOutExpense" dc:"转可提现支出"` + ManualAdjustExpense float64 `json:"manualAdjustExpense" dc:"人工调账支出"` + ConsumeCreditRepayExpense float64 `json:"consumeCreditRepayExpense" dc:"消费账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + CreditUsed float64 `json:"creditUsed" dc:"本月使用信用额度"` + CreditRepaid float64 `json:"creditRepaid" dc:"本月还款信用额度"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TConsumeAccountMonthBillEditParam 修改/新增消费账户月账单表 +type TConsumeAccountMonthBillEditParam struct { + //entity.TConsumeAccountMonthBill + Id int64 `json:"id" dc:"账单ID"` + DeptId *int64 `json:"deptId" dc:"机构ID"` + AccountPeriod *string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance *float64 `json:"openingBalance" dc:"月初余额"` + RechargeIncome *float64 `json:"rechargeIncome" dc:"充值收入"` + WithdrawableTransferInIncome *float64 `json:"withdrawableTransferInIncome" dc:"可提现转入收入"` + ManualAdjustIncome *float64 `json:"manualAdjustIncome" dc:"人工调账收入"` + RefundIncome *float64 `json:"refundIncome" dc:"退款收入"` + ConsumeExpense *float64 `json:"consumeExpense" dc:"平台消费支出"` + BalanceTransferOutExpense *float64 `json:"balanceTransferOutExpense" dc:"转可提现支出"` + ManualAdjustExpense *float64 `json:"manualAdjustExpense" dc:"人工调账支出"` + ConsumeCreditRepayExpense *float64 `json:"consumeCreditRepayExpense" dc:"消费账户还款支出"` + TotalIncome *float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense *float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance *float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount *int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount *int `json:"expenseCount" dc:"支出笔数"` + CreditUsed *float64 `json:"creditUsed" dc:"本月使用信用额度"` + CreditRepaid *float64 `json:"creditRepaid" dc:"本月还款信用额度"` + BillStatus *int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TConsumeAccountMonthBillEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TConsumeAccountMonthBillEditModel struct{} + +// TConsumeAccountMonthBillDeleteParam 删除消费账户月账单表 +type TConsumeAccountMonthBillDeleteParam struct { + Id interface{} `json:"id" v:"required#账单ID不能为空" dc:"账单ID"` +} + +func (in *TConsumeAccountMonthBillDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TConsumeAccountMonthBillDeleteModel struct{} + +// TConsumeAccountMonthBillViewParam 获取指定消费账户月账单表信息 +type TConsumeAccountMonthBillViewParam struct { + Id int64 `json:"id" v:"required#账单ID不能为空" dc:"账单ID"` +} + +func (in *TConsumeAccountMonthBillViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TConsumeAccountMonthBillViewModel struct { + entity.TConsumeAccountMonthBill + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TConsumeAccountMonthBillListParam 获取消费账户月账单表列表 +type TConsumeAccountMonthBillListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"账单ID"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TConsumeAccountMonthBillListParam) Filter(ctx context.Context) (err error) { + return +} + +type TConsumeAccountMonthBillListModel struct { + Id int64 `json:"id" dc:"账单ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + RechargeIncome float64 `json:"rechargeIncome" dc:"充值收入"` + WithdrawableTransferInIncome float64 `json:"withdrawableTransferInIncome" dc:"可提现转入收入"` + ManualAdjustIncome float64 `json:"manualAdjustIncome" dc:"人工调账收入"` + RefundIncome float64 `json:"refundIncome" dc:"退款收入"` + ConsumeExpense float64 `json:"consumeExpense" dc:"平台消费支出"` + BalanceTransferOutExpense float64 `json:"balanceTransferOutExpense" dc:"转可提现支出"` + ManualAdjustExpense float64 `json:"manualAdjustExpense" dc:"人工调账支出"` + ConsumeCreditRepayExpense float64 `json:"consumeCreditRepayExpense" dc:"消费账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + CreditUsed float64 `json:"creditUsed" dc:"本月使用信用额度"` + CreditRepaid float64 `json:"creditRepaid" dc:"本月还款信用额度"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TConsumeAccountMonthBillExportModel 导出消费账户月账单表 +type TConsumeAccountMonthBillExportModel struct { + Id int64 `json:"id" dc:"账单ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + RechargeIncome float64 `json:"rechargeIncome" dc:"充值收入"` + WithdrawableTransferInIncome float64 `json:"withdrawableTransferInIncome" dc:"可提现转入收入"` + ManualAdjustIncome float64 `json:"manualAdjustIncome" dc:"人工调账收入"` + RefundIncome float64 `json:"refundIncome" dc:"退款收入"` + ConsumeExpense float64 `json:"consumeExpense" dc:"平台消费支出"` + BalanceTransferOutExpense float64 `json:"balanceTransferOutExpense" dc:"转可提现支出"` + ManualAdjustExpense float64 `json:"manualAdjustExpense" dc:"人工调账支出"` + ConsumeCreditRepayExpense float64 `json:"consumeCreditRepayExpense" dc:"消费账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + CreditUsed float64 `json:"creditUsed" dc:"本月使用信用额度"` + CreditRepaid float64 `json:"creditRepaid" dc:"本月还款信用额度"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +type TConsumptionBillSummaryModel struct { + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + CreditUsed float64 `json:"creditUsed" dc:"本月使用信用额度"` + CreditRepaid float64 `json:"creditRepaid" dc:"本月还款信用额度"` + OutstandingAmount float64 `json:"outstandingAmount" dc:"未还信用额度"` +} diff --git a/internal/model/t_credit_detail.go b/internal/model/t_credit_detail.go new file mode 100644 index 0000000..6020697 --- /dev/null +++ b/internal/model/t_credit_detail.go @@ -0,0 +1,163 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TCreditDetailUpdateFields 修改信用额度明细表字段过滤 +type TCreditDetailUpdateFields struct { + DeptId int64 `json:"deptId" dc:"组织机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TransactionType string `json:"transactionType" dc:"交易类型: 使用/还款"` + Amount float64 `json:"amount" dc:"金额"` + CreditBalanceBefore float64 `json:"creditBalanceBefore" dc:"变动前信用额度余额"` + CreditBalanceAfter float64 `json:"creditBalanceAfter" dc:"变动后信用额度余额"` + RelatedOrderSn string `json:"relatedOrderSn" dc:"关联订单号"` + RepaymentMethod int `json:"repaymentMethod" dc:"还款方式: 0 余额 1 银行卡 2 支付宝 3 微信"` + RepaymentChannelSerial string `json:"repaymentChannelSerial" dc:"交易渠道流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TCreditDetailInsertFields 新增信用额度明细表字段过滤 +type TCreditDetailInsertFields struct { + DeptId int64 `json:"deptId" dc:"组织机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TransactionType string `json:"transactionType" dc:"交易类型: 使用/还款"` + Amount float64 `json:"amount" dc:"金额"` + CreditBalanceBefore float64 `json:"creditBalanceBefore" dc:"变动前信用额度余额"` + CreditBalanceAfter float64 `json:"creditBalanceAfter" dc:"变动后信用额度余额"` + RelatedOrderSn string `json:"relatedOrderSn" dc:"关联订单号"` + RepaymentMethod int `json:"repaymentMethod" dc:"还款方式: 0 余额 1 银行卡 2 支付宝 3 微信"` + RepaymentChannelSerial string `json:"repaymentChannelSerial" dc:"交易渠道流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TCreditDetailEditParam 修改/新增信用额度明细表 +type TCreditDetailEditParam struct { + //entity.TCreditDetail + Id int64 `json:"id" dc:"明细ID"` + DeptId *int64 `json:"deptId" dc:"组织机构ID"` + AccountPeriod *string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TransactionType *string `json:"transactionType" dc:"交易类型: 使用/还款"` + Amount *float64 `json:"amount" dc:"金额"` + CreditBalanceBefore *float64 `json:"creditBalanceBefore" dc:"变动前信用额度余额"` + CreditBalanceAfter *float64 `json:"creditBalanceAfter" dc:"变动后信用额度余额"` + RelatedOrderSn *string `json:"relatedOrderSn" dc:"关联订单号"` + RepaymentMethod *int `json:"repaymentMethod" dc:"还款方式: 0 余额 1 银行卡 2 支付宝 3 微信"` + RepaymentChannelSerial *string `json:"repaymentChannelSerial" dc:"交易渠道流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TCreditDetailEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TCreditDetailEditModel struct{} + +// TCreditDetailDeleteParam 删除信用额度明细表 +type TCreditDetailDeleteParam struct { + Id interface{} `json:"id" v:"required#明细ID不能为空" dc:"明细ID"` +} + +func (in *TCreditDetailDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TCreditDetailDeleteModel struct{} + +// TCreditDetailViewParam 获取指定信用额度明细表信息 +type TCreditDetailViewParam struct { + Id int64 `json:"id" v:"required#明细ID不能为空" dc:"明细ID"` +} + +func (in *TCreditDetailViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TCreditDetailViewModel struct { + entity.TCreditDetail + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TCreditDetailListParam 获取信用额度明细表列表 +type TCreditDetailListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"明细ID"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TCreditDetailListParam) Filter(ctx context.Context) (err error) { + return +} + +type TCreditDetailListModel struct { + Id int64 `json:"id" dc:"明细ID"` + DeptId int64 `json:"deptId" dc:"组织机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TransactionType string `json:"transactionType" dc:"交易类型: 使用/还款"` + Amount float64 `json:"amount" dc:"金额"` + CreditBalanceBefore float64 `json:"creditBalanceBefore" dc:"变动前信用额度余额"` + CreditBalanceAfter float64 `json:"creditBalanceAfter" dc:"变动后信用额度余额"` + RelatedOrderSn string `json:"relatedOrderSn" dc:"关联订单号"` + RepaymentMethod int `json:"repaymentMethod" dc:"还款方式: 0 余额 1 银行卡 2 支付宝 3 微信"` + RepaymentChannelSerial string `json:"repaymentChannelSerial" dc:"交易渠道流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TCreditDetailExportModel 导出信用额度明细表 +type TCreditDetailExportModel struct { + Id int64 `json:"id" dc:"明细ID"` + DeptId int64 `json:"deptId" dc:"组织机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TransactionType string `json:"transactionType" dc:"交易类型: 使用/还款"` + Amount float64 `json:"amount" dc:"金额"` + CreditBalanceBefore float64 `json:"creditBalanceBefore" dc:"变动前信用额度余额"` + CreditBalanceAfter float64 `json:"creditBalanceAfter" dc:"变动后信用额度余额"` + RelatedOrderSn string `json:"relatedOrderSn" dc:"关联订单号"` + RepaymentMethod int `json:"repaymentMethod" dc:"还款方式: 0 余额 1 银行卡 2 支付宝 3 微信"` + RepaymentChannelSerial string `json:"repaymentChannelSerial" dc:"交易渠道流水号"` + TransactionTime *gtime.Time `json:"transactionTime" dc:"交易时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_cust_withdraw_account.go b/internal/model/t_cust_withdraw_account.go new file mode 100644 index 0000000..af33770 --- /dev/null +++ b/internal/model/t_cust_withdraw_account.go @@ -0,0 +1,178 @@ +// Package iotin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +// TCustWithdrawAccountUpdateFields 修改客户提现账户表字段过滤 +type TCustWithdrawAccountUpdateFields struct { + DeptId int `json:"deptId" dc:"企业客户ID"` + AccountType int `json:"accountType" dc:"提现账号类型,1:支付宝,2:微信"` + AccountNo string `json:"accountNo" dc:"账号"` + AccountName string `json:"accountName" dc:"账户名称/真实姓名"` + Mobile string `json:"mobile" dc:"手机号"` + IsDefault int `json:"isDefault" dc:"是否默认账号:0-否 1-是"` + Enabled int `json:"enabled" dc:"是否启用:0-未启用 1-启用"` + Status int `json:"status" dc:"状态:0-禁用 1-正常"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TCustWithdrawAccountInsertFields 新增客户提现账户表字段过滤 +type TCustWithdrawAccountInsertFields struct { + DeptId int `json:"deptId" dc:"企业客户ID"` + AccountType int `json:"accountType" dc:"提现账号类型,1:支付宝,2:微信"` + AccountNo string `json:"accountNo" dc:"账号"` + AccountName string `json:"accountName" dc:"账户名称/真实姓名"` + Mobile string `json:"mobile" dc:"手机号"` + IsDefault int `json:"isDefault" dc:"是否默认账号:0-否 1-是"` + Enabled int `json:"enabled" dc:"是否启用:0-未启用 1-启用"` + Status int `json:"status" dc:"状态:0-禁用 1-正常"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TCustWithdrawAccountEditParam 修改/新增客户提现账户表 +type TCustWithdrawAccountEditParam struct { + //entity.TCustWithdrawAccount + Id int64 `json:"id" dc:"主键ID"` + DeptId *int `json:"deptId" dc:"企业客户ID"` + AccountType *int `json:"accountType" dc:"提现账号类型,1:支付宝,2:微信"` + AccountNo *string `json:"accountNo" dc:"账号"` + AccountName *string `json:"accountName" dc:"账户名称/真实姓名"` + Mobile *string `json:"mobile" dc:"手机号"` + IsDefault *int `json:"isDefault" dc:"是否默认账号:0-否 1-是"` + Enabled *int `json:"enabled" dc:"是否启用:0-未启用 1-启用"` + Status *int `json:"status" dc:"状态:0-禁用 1-正常"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy *int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TCustWithdrawAccountEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TCustWithdrawAccountEditModel struct{} + +// TCustWithdrawAccountDeleteParam 删除客户提现账户表 +type TCustWithdrawAccountDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TCustWithdrawAccountDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TCustWithdrawAccountDeleteModel struct{} + +// TCustWithdrawAccountViewParam 获取指定客户提现账户表信息 +type TCustWithdrawAccountViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TCustWithdrawAccountViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TCustWithdrawAccountViewModel struct { + entity.TCustWithdrawAccount + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者ID摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者ID摘要信息"` +} + +// TCustWithdrawAccountListParam 获取客户提现账户表列表 +type TCustWithdrawAccountListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + Status int `json:"status" dc:"状态:0-禁用 1-正常"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TCustWithdrawAccountListParam) Filter(ctx context.Context) (err error) { + return +} + +type TCustWithdrawAccountListModel struct { + Id int64 `json:"id" dc:"主键ID"` + DeptId int `json:"deptId" dc:"企业客户ID"` + AccountType int `json:"accountType" dc:"提现账号类型,1:支付宝,2:微信"` + AccountName string `json:"accountName" dc:"账户名称/真实姓名"` + Mobile string `json:"mobile" dc:"手机号"` + IsDefault int `json:"isDefault" dc:"是否默认账号:0-否 1-是"` + Enabled int `json:"enabled" dc:"是否启用:0-未启用 1-启用"` + Status int `json:"status" dc:"状态:0-禁用 1-正常"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者ID摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者ID摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TCustWithdrawAccountExportModel 导出客户提现账户表 +type TCustWithdrawAccountExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + DeptId int `json:"deptId" dc:"企业客户ID"` + AccountType int `json:"accountType" dc:"提现账号类型,1:支付宝,2:微信"` + AccountName string `json:"accountName" dc:"账户名称/真实姓名"` + Mobile string `json:"mobile" dc:"手机号"` + IsDefault int `json:"isDefault" dc:"是否默认账号:0-否 1-是"` + Enabled int `json:"enabled" dc:"是否启用:0-未启用 1-启用"` + Status int `json:"status" dc:"状态:0-禁用 1-正常"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TCustWithdrawAccountStatusParam 更新客户提现账户表状态 +type TCustWithdrawAccountStatusParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` + Status int `json:"status" dc:"状态"` +} + +func (in *TCustWithdrawAccountStatusParam) Filter(ctx context.Context) (err error) { + if in.Id <= 0 { + err = gerror.New("主键ID不能为空") + return + } + + if in.Status <= 0 { + err = gerror.New("状态不能为空") + return + } + + if !slices.Contains(consts.StatusSlice, in.Status) { + err = gerror.New("状态不正确") + return + } + return +} + +type TCustWithdrawAccountStatusModel struct{} diff --git a/internal/model/t_division_code.go b/internal/model/t_division_code.go new file mode 100644 index 0000000..d458967 --- /dev/null +++ b/internal/model/t_division_code.go @@ -0,0 +1,110 @@ +// 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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" +) + +// TDivisionCodeUpdateFields 修改村级行政区划表字段过滤 +type TDivisionCodeUpdateFields struct { + RegionCode string `json:"regionCode" dc:"行政区域代码"` + RegionName string `json:"regionName" dc:"行政区域名称"` + RegionLevel int `json:"regionLevel" dc:"等级"` + RegionParent string `json:"regionParent" dc:"上级代码"` + RegionType string `json:"regionType" dc:"城乡分类代码"` +} + +// TDivisionCodeInsertFields 新增村级行政区划表字段过滤 +type TDivisionCodeInsertFields struct { + RegionCode string `json:"regionCode" dc:"行政区域代码"` + RegionName string `json:"regionName" dc:"行政区域名称"` + RegionLevel int `json:"regionLevel" dc:"等级"` + RegionParent string `json:"regionParent" dc:"上级代码"` + RegionType string `json:"regionType" dc:"城乡分类代码"` +} + +// TDivisionCodeEditParam 修改/新增村级行政区划表 +type TDivisionCodeEditParam struct { + //entity.TDivisionCode + RegionId int64 `json:"regionId" dc:"ID"` + RegionCode *string `json:"regionCode" dc:"行政区域代码"` + RegionName *string `json:"regionName" dc:"行政区域名称"` + RegionLevel *int `json:"regionLevel" dc:"等级"` + RegionParent *string `json:"regionParent" dc:"上级代码"` + RegionType *string `json:"regionType" dc:"城乡分类代码"` +} + +func (in *TDivisionCodeEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TDivisionCodeEditModel struct{} + +// TDivisionCodeDeleteParam 删除村级行政区划表 +type TDivisionCodeDeleteParam struct { + RegionId interface{} `json:"regionId" v:"required#ID不能为空" dc:"ID"` +} + +func (in *TDivisionCodeDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TDivisionCodeDeleteModel struct{} + +// TDivisionCodeViewParam 获取指定村级行政区划表信息 +type TDivisionCodeViewParam struct { + RegionId int64 `json:"regionId" v:"required#ID不能为空" dc:"ID"` +} + +func (in *TDivisionCodeViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TDivisionCodeViewModel struct { + entity.TDivisionCode +} + +// TDivisionCodeListParam 获取村级行政区划表列表 +type TDivisionCodeListParam struct { + request.PageInfo + RegionName string `json:"regionName" dc:"行政区域名称"` + RegionCode string `json:"regionCode" dc:"行政区域代码"` + RegionLevel int `json:"regionLevel" dc:"等级"` + RegionParent string `json:"regionParent" dc:"上级代码"` +} + +func (in *TDivisionCodeListParam) Filter(ctx context.Context) (err error) { + return +} + +type TDivisionCodeListModel struct { + RegionId int64 `json:"regionId" dc:"ID"` + RegionCode string `json:"regionCode" dc:"行政区域代码"` + RegionName string `json:"regionName" dc:"行政区域名称"` + RegionLevel int `json:"regionLevel" dc:"等级"` + RegionParent string `json:"regionParent" dc:"上级代码"` + RegionType string `json:"regionType" dc:"城乡分类代码"` +} + +// TDivisionCodeExportModel 导出村级行政区划表 +type TDivisionCodeExportModel struct { + RegionId int64 `json:"regionId" dc:"ID"` + RegionCode string `json:"regionCode" dc:"行政区域代码"` + RegionName string `json:"regionName" dc:"行政区域名称"` + RegionLevel int `json:"regionLevel" dc:"等级"` + RegionParent string `json:"regionParent" dc:"上级代码"` + RegionType string `json:"regionType" dc:"城乡分类代码"` +} + +// 根据父级ID获取子级列表 +type TDivisionCodeListByParentParam struct { + RegionParent string `json:"regionParent" dc:"上级代码"` +} diff --git a/internal/model/t_fin_commission_detail.go b/internal/model/t_fin_commission_detail.go new file mode 100644 index 0000000..a3a8b27 --- /dev/null +++ b/internal/model/t_fin_commission_detail.go @@ -0,0 +1,213 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinCommissionDetailUpdateFields 修改分润明细表字段过滤 +type TFinCommissionDetailUpdateFields struct { + CommissionNo string `json:"commissionNo" dc:"分润明细编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + OrderType string `json:"orderType" dc:"订单类型"` + ProductId int64 `json:"productId" dc:"商品ID"` + PayerDeptId int64 `json:"payerDeptId" dc:"下级机构ID"` + BenefitDeptId int64 `json:"benefitDeptId" dc:"受益机构ID"` + BenefitDeptLevel int `json:"benefitDeptLevel" dc:"受益机构层级"` + CommissionAmount float64 `json:"commissionAmount" dc:"分润金额"` + CommissionStatus int `json:"commissionStatus" dc:"分润状态:0待结算,1可提现"` + BenefitSnapshot *gjson.Json `json:"benefitSnapshot" dc:"价格快照(受益机构的成本价+利润+利润悉数=出货单价)"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + SettlementTime *gtime.Time `json:"settlementTime" dc:"结算时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinCommissionDetailInsertFields 新增分润明细表字段过滤 +type TFinCommissionDetailInsertFields struct { + CommissionNo string `json:"commissionNo" dc:"分润明细编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + OrderType string `json:"orderType" dc:"订单类型"` + ProductId int64 `json:"productId" dc:"商品ID"` + PayerDeptId int64 `json:"payerDeptId" dc:"下级机构ID"` + BenefitDeptId int64 `json:"benefitDeptId" dc:"受益机构ID"` + BenefitDeptLevel int `json:"benefitDeptLevel" dc:"受益机构层级"` + CommissionAmount float64 `json:"commissionAmount" dc:"分润金额"` + CommissionStatus int `json:"commissionStatus" dc:"分润状态:0待结算,1可提现"` + BenefitSnapshot *gjson.Json `json:"benefitSnapshot" dc:"价格快照(受益机构的成本价+利润+利润悉数=出货单价)"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + SettlementTime *gtime.Time `json:"settlementTime" dc:"结算时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TFinCommissionDetailEditParam 修改/新增分润明细表 +type TFinCommissionDetailEditParam struct { + //entity.TFinCommissionDetail + Id int64 `json:"id" dc:"主键ID"` + CommissionNo *string `json:"commissionNo" dc:"分润明细编号"` + OrderSn *string `json:"orderSn" dc:"订单编号"` + OrderType *string `json:"orderType" dc:"订单类型"` + ProductId *int64 `json:"productId" dc:"商品ID"` + PayerDeptId *int64 `json:"payerDeptId" dc:"下级机构ID"` + BenefitDeptId *int64 `json:"benefitDeptId" dc:"受益机构ID"` + BenefitDeptLevel *int `json:"benefitDeptLevel" dc:"受益机构层级"` + CommissionAmount *float64 `json:"commissionAmount" dc:"分润金额"` + CommissionStatus *int `json:"commissionStatus" dc:"分润状态:0待结算,1可提现"` + BenefitSnapshot *gjson.Json `json:"benefitSnapshot" dc:"价格快照(受益机构的成本价+利润+利润悉数=出货单价)"` + AccountPeriod *string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + SettlementTime *gtime.Time `json:"settlementTime" dc:"结算时间"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TFinCommissionDetailEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TFinCommissionDetailEditModel struct{} + +// TFinCommissionDetailDeleteParam 删除分润明细表 +type TFinCommissionDetailDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinCommissionDetailDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinCommissionDetailDeleteModel struct{} + +// TFinCommissionDetailViewParam 获取指定分润明细表信息 +type TFinCommissionDetailViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinCommissionDetailViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinCommissionDetailViewModel struct { + entity.TFinCommissionDetail + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TFinCommissionDetailListParam 获取分润明细表列表 +type TFinCommissionDetailListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + CommissionStatus int `json:"commissionStatus" dc:"分润状态:0待结算,1可提现"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TFinCommissionDetailListParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinCommissionDetailListModel struct { + Id int64 `json:"id" dc:"主键ID"` + CommissionNo string `json:"commissionNo" dc:"分润明细编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + OrderType string `json:"orderType" dc:"订单类型"` + ProductId int64 `json:"productId" dc:"商品ID"` + PayerDeptId int64 `json:"payerDeptId" dc:"下级机构ID"` + BenefitDeptId int64 `json:"benefitDeptId" dc:"受益机构ID"` + BenefitDeptLevel int `json:"benefitDeptLevel" dc:"受益机构层级"` + CommissionAmount float64 `json:"commissionAmount" dc:"分润金额"` + CommissionStatus int `json:"commissionStatus" dc:"分润状态:0待结算,1可提现"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + SettlementTime *gtime.Time `json:"settlementTime" dc:"结算时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinCommissionDetailExportModel 导出分润明细表 +type TFinCommissionDetailExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + CommissionNo string `json:"commissionNo" dc:"分润明细编号"` + OrderSn string `json:"orderSn" dc:"订单编号"` + OrderType string `json:"orderType" dc:"订单类型"` + ProductId int64 `json:"productId" dc:"商品ID"` + PayerDeptId int64 `json:"payerDeptId" dc:"下级机构ID"` + BenefitDeptId int64 `json:"benefitDeptId" dc:"受益机构ID"` + BenefitDeptLevel int `json:"benefitDeptLevel" dc:"受益机构层级"` + CommissionAmount float64 `json:"commissionAmount" dc:"分润金额"` + CommissionStatus int `json:"commissionStatus" dc:"分润状态:0待结算,1可提现"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + SettlementTime *gtime.Time `json:"settlementTime" dc:"结算时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TCommissionOverviewParam 分层分润概览参数 +type TCommissionOverviewParam struct { + Type int `json:"type" dc:"类型:1年,2月"` + Year string `json:"year" dc:"年份,如:2026"` + Month string `json:"month" dc:"月份,如:2026-01"` +} + +// TCommissionOverviewModel 分层分润概览结果 +type TCommissionOverviewModel struct { + Level1Income float64 `json:"level1Income" dc:"一级客户收入"` + Level2Income float64 `json:"level2Income" dc:"二级客户收入"` + Level3Income float64 `json:"level3Income" dc:"三级客户收入"` + TotalIncome float64 `json:"totalIncome" dc:"总收入"` +} + +// TLevelSummaryParam 层级汇总表参数 +type TLevelSummaryParam struct { + Type int `json:"type" dc:"类型:1年,2月"` + Year string `json:"year" dc:"年份,如:2026"` + Month string `json:"month" dc:"月份,如:2026-01"` +} + +// TLevelSummaryItem 层级汇总项 +type TLevelSummaryItem struct { + Level int `json:"level" dc:"层级:1一级客户,2二级客户,3三级客户"` + CustomerCount int `json:"customerCount" dc:"客户数"` + IncomeAmount float64 `json:"incomeAmount" dc:"收入金额"` + CommissionAmount float64 `json:"commissionAmount" dc:"分润金额"` + IncomeRatio float64 `json:"incomeRatio" dc:"收入占比"` +} + +// TLevelSummaryModel 层级汇总结果 +type TLevelSummaryModel struct { + Items []TLevelSummaryItem `json:"items" dc:"层级汇总列表"` +} + +// IncomeQueryParams 收入查询参数 +type IncomeQueryParams struct { + DeptIds []int64 `json:"deptIds" dc:"部门ID列表"` + StartPeriod string `json:"startPeriod" dc:"开始账期"` + EndPeriod string `json:"endPeriod" dc:"结束账期"` +} diff --git a/internal/model/t_fin_withdrawable_change.go b/internal/model/t_fin_withdrawable_change.go new file mode 100644 index 0000000..388fdc1 --- /dev/null +++ b/internal/model/t_fin_withdrawable_change.go @@ -0,0 +1,203 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinWithdrawableChangeUpdateFields 修改可提现变动明细表字段过滤 +type TFinWithdrawableChangeUpdateFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + ChangeType int `json:"changeType" dc:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + ChangeAmount float64 `json:"changeAmount" dc:"变动金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前可提现余额"` + AfterBalance float64 `json:"afterBalance" dc:"变动后可提现余额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + SourceNo string `json:"sourceNo" dc:"来源单号"` + Remark string `json:"remark" dc:"备注"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinWithdrawableChangeInsertFields 新增可提现变动明细表字段过滤 +type TFinWithdrawableChangeInsertFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + ChangeType int `json:"changeType" dc:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + ChangeAmount float64 `json:"changeAmount" dc:"变动金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前可提现余额"` + AfterBalance float64 `json:"afterBalance" dc:"变动后可提现余额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + SourceNo string `json:"sourceNo" dc:"来源单号"` + Remark string `json:"remark" dc:"备注"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TFinWithdrawableChangeEditParam 修改/新增可提现变动明细表 +type TFinWithdrawableChangeEditParam struct { + //entity.TFinWithdrawableChange + Id int64 `json:"id" dc:"主键ID"` + DeptId *int64 `json:"deptId" dc:"机构ID"` + ChangeType *int `json:"changeType" dc:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` + IncomeExpenseType *int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + ChangeAmount *float64 `json:"changeAmount" dc:"变动金额"` + BeforeBalance *float64 `json:"beforeBalance" dc:"变动前可提现余额"` + AfterBalance *float64 `json:"afterBalance" dc:"变动后可提现余额"` + AccountType *int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName *string `json:"bankName" dc:"开户行名称"` + BankAccount *string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName *string `json:"accountName" dc:"用户姓名"` + IdentityCard *string `json:"identityCard" dc:"用户身份证号"` + SourceNo *string `json:"sourceNo" dc:"来源单号"` + Remark *string `json:"remark" dc:"备注"` + AccountPeriod *string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TFinWithdrawableChangeEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TFinWithdrawableChangeEditModel struct{} + +// TFinWithdrawableChangeDeleteParam 删除可提现变动明细表 +type TFinWithdrawableChangeDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinWithdrawableChangeDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinWithdrawableChangeDeleteModel struct{} + +// TFinWithdrawableChangeViewParam 获取指定可提现变动明细表信息 +type TFinWithdrawableChangeViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinWithdrawableChangeViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinWithdrawableChangeViewModel struct { + entity.TFinWithdrawableChange + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TFinWithdrawableChangeListParam 获取可提现变动明细表列表 +type TFinWithdrawableChangeListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + Month []string `json:"month" form:"month[]" dc:"月份"` + IncomeExpenseType *int `json:"incomeExpenseType" form:"incomeExpenseType[]" dc:"收支类型: 0收入,1支出"` + ChangeType *int `json:"changeType" form:"changeType[]" dc:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` +} + +func (in *TFinWithdrawableChangeListParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinWithdrawableChangeListModel struct { + Id int64 `json:"id" dc:"主键ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + DeptName string `json:"deptName" dc:"机构名称"` + ChangeType int `json:"changeType" dc:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + ChangeAmount float64 `json:"changeAmount" dc:"变动金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前可提现余额"` + AfterBalance float64 `json:"afterBalance" dc:"变动后可提现余额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + SourceNo string `json:"sourceNo" dc:"来源单号"` + OrderType int `json:"orderType" dc:"订单类型"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TradingMonth string `json:"tradingMonth" dc:"月份"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinWithdrawableChangeExportModel 导出可提现变动明细表 +type TFinWithdrawableChangeExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + ChangeType int `json:"changeType" dc:"变动类型:0分润,1提现,2转出(可提现转余额)3转入(余额转可提现)4还款"` + IncomeExpenseType int `json:"incomeExpenseType" dc:"收支类型: 0收入,1支出"` + ChangeAmount float64 `json:"changeAmount" dc:"变动金额"` + BeforeBalance float64 `json:"beforeBalance" dc:"变动前可提现余额"` + AfterBalance float64 `json:"afterBalance" dc:"变动后可提现余额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + SourceNo string `json:"sourceNo" dc:"来源单号"` + AccountPeriod string `json:"accountPeriod" dc:"账期(YYYY-MM)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinWithdrawableBalanceTransferInParam 是余额转可提现审核通过后的可提现明细写入参数。 +type TFinWithdrawableBalanceTransferInParam struct { + DeptId int64 + ChangeAmount float64 + BeforeBalance float64 + AfterBalance float64 + AccountType int + BankName string + BankAccount string + AccountName string + IdentityCard string + SourceNo string + Remark string + AccountPeriod string + TenantId string + CreatedDept int64 + CreatedBy int64 + CreatedAt *gtime.Time +} diff --git a/internal/model/t_finance_apply.go b/internal/model/t_finance_apply.go new file mode 100644 index 0000000..e3375eb --- /dev/null +++ b/internal/model/t_finance_apply.go @@ -0,0 +1,275 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" + + "github.com/gogf/gf/v2/errors/gerror" +) + +// TFinanceApplyUpdateFields 修改财务申请表字段过滤 +type TFinanceApplyUpdateFields struct { + ApplyNo string `json:"applyNo" dc:"申请单号"` + ApplyType int `json:"applyType" dc:"申请类型(1:提现申请,2:余额转提现)"` + AuditType int `json:"auditType" dc:"审核类型:1初审,2复审"` + ApplyDeptId int64 `json:"applyDeptId" dc:"申请机构ID"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID,通常为直属上级或顶级"` + AvailableAmountSnapshot float64 `json:"availableAmountSnapshot" dc:"申请前可提现余额快照"` + ApplyAmount float64 `json:"applyAmount" dc:"申请金额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + ReceiveAccount *gjson.Json `json:"receiveAccount" dc:"收款账户信息快照"` + ApplyStatus int `json:"applyStatus" dc:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + ApplyTime *gtime.Time `json:"applyTime" dc:"申请时间"` + AuditTime *gtime.Time `json:"auditTime" dc:"最近审核时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinanceApplyInsertFields 新增财务申请表字段过滤 +type TFinanceApplyInsertFields struct { + ApplyNo string `json:"applyNo" dc:"申请单号"` + ApplyType int `json:"applyType" dc:"申请类型(1:提现申请,2:余额转提现)"` + AuditType int `json:"auditType" dc:"审核类型:1初审,2复审"` + ApplyDeptId int64 `json:"applyDeptId" dc:"申请机构ID"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID,通常为直属上级或顶级"` + AvailableAmountSnapshot float64 `json:"availableAmountSnapshot" dc:"申请前可提现余额快照"` + ApplyAmount float64 `json:"applyAmount" dc:"申请金额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + ReceiveAccount *gjson.Json `json:"receiveAccount" dc:"收款账户信息快照"` + ApplyStatus int `json:"applyStatus" dc:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + ApplyTime *gtime.Time `json:"applyTime" dc:"申请时间"` + AuditTime *gtime.Time `json:"auditTime" dc:"最近审核时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TFinanceApplyEditParam 修改/新增财务申请表 +type TFinanceApplyEditParam struct { + //entity.TFinanceApply + Id int64 `json:"id" dc:"主键ID"` + ApplyNo *string `json:"applyNo" dc:"申请单号"` + ApplyType *int `json:"applyType" dc:"申请类型(1:提现申请,2:余额转提现)"` + AuditType *int `json:"auditType" dc:"审核类型:1初审,2复审"` + ApplyDeptId *int64 `json:"applyDeptId" dc:"申请机构ID"` + AuditDeptId *int64 `json:"auditDeptId" dc:"审核方机构ID,通常为直属上级或顶级"` + AvailableAmountSnapshot *float64 `json:"availableAmountSnapshot" dc:"申请前可提现余额快照"` + ApplyAmount *float64 `json:"applyAmount" dc:"申请金额"` + AccountType *int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName *string `json:"bankName" dc:"开户行名称"` + BankAccount *string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName *string `json:"accountName" dc:"用户姓名"` + IdentityCard *string `json:"identityCard" dc:"用户身份证号"` + ReceiveAccount *gjson.Json `json:"receiveAccount" dc:"收款账户信息快照"` + ApplyStatus *int `json:"applyStatus" dc:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + ApplyTime *gtime.Time `json:"applyTime" dc:"申请时间"` + AuditTime *gtime.Time `json:"auditTime" dc:"最近审核时间"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TFinanceApplyEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TFinanceApplyEditModel struct{} + +// TFinanceApplyDeleteParam 删除财务申请表 +type TFinanceApplyDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinanceApplyDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinanceApplyDeleteModel struct{} + +// TFinanceApplyViewParam 获取指定财务申请表信息 +type TFinanceApplyViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinanceApplyViewParam) Filter(ctx context.Context) (err error) { + return +} + +// TFinanceApplyListParam 获取财务申请表列表 +type TFinanceApplyListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + ApplyStatus int `json:"applyStatus" dc:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TFinanceApplyListParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinanceApplyListModel struct { + Id int64 `json:"id" dc:"主键ID"` + ApplyNo string `json:"applyNo" dc:"申请单号"` + ApplyType int `json:"applyType" dc:"申请类型(1:提现申请,2:余额转提现)"` + AuditType int `json:"auditType" dc:"审核类型:1初审,2复审"` + ApplyDeptId int64 `json:"applyDeptId" dc:"申请机构ID"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID,通常为直属上级或顶级"` + AvailableAmountSnapshot float64 `json:"availableAmountSnapshot" dc:"申请前可提现余额快照"` + ApplyAmount float64 `json:"applyAmount" dc:"申请金额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + ApplyStatus int `json:"applyStatus" dc:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + ApplyTime *gtime.Time `json:"applyTime" dc:"申请时间"` + AuditTime *gtime.Time `json:"auditTime" dc:"最近审核时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinanceApplyExportModel 导出财务申请表 +type TFinanceApplyExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + ApplyNo string `json:"applyNo" dc:"申请单号"` + ApplyType int `json:"applyType" dc:"申请类型(1:提现申请,2:余额转提现)"` + AuditType int `json:"auditType" dc:"审核类型:1初审,2复审"` + ApplyDeptId int64 `json:"applyDeptId" dc:"申请机构ID"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID,通常为直属上级或顶级"` + AvailableAmountSnapshot float64 `json:"availableAmountSnapshot" dc:"申请前可提现余额快照"` + ApplyAmount float64 `json:"applyAmount" dc:"申请金额"` + AccountType int `json:"accountType" dc:"提现账号类型,1:银行卡,2:支付宝,3:微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户行账号或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + ApplyStatus int `json:"applyStatus" dc:"状态:0待审核,1已通过,2已驳回,3已打款,4已取消"` + ApplyTime *gtime.Time `json:"applyTime" dc:"申请时间"` + AuditTime *gtime.Time `json:"auditTime" dc:"最近审核时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TAgentBalanceTransferApplyParam 是余额转可提现申请参数。 +type TAgentBalanceTransferApplyParam struct { + Amount float64 `json:"amount" dc:"转入可提现金额"` + AccountType int `json:"accountType" dc:"提现账号类型:1银行卡,2支付宝,3微信"` + BankName string `json:"bankName" dc:"开户行名称"` + BankAccount string `json:"bankAccount" dc:"开户地址或账号"` + AccountName string `json:"accountName" dc:"用户姓名"` + IdentityCard string `json:"identityCard" dc:"用户身份证号"` + Remark string `json:"remark" dc:"备注"` +} + +func (in *TAgentBalanceTransferApplyParam) Filter(ctx context.Context) (err error) { + if in == nil { + return gerror.New("申请参数不能为空") + } + if in.Amount <= 0 { + return gerror.New("转入金额必须大于0") + } + if in.AccountType <= 0 { + return gerror.New("提现账号类型不能为空") + } + return nil +} + +// TAgentBalanceTransferApplyModel 是余额转可提现申请返回结果。 +type TAgentBalanceTransferApplyModel struct { + ApplyNo string `json:"applyNo" dc:"申请单号"` + ApplyAmount float64 `json:"applyAmount" dc:"申请金额"` + BalanceAfter float64 `json:"balanceAfter" dc:"扣减后的余额"` +} + +// TAgentBalanceTransferAuditParam 是余额转可提现审核参数。 +type TAgentBalanceTransferAuditParam struct { + ApplyNo string `json:"applyNo" v:"required#申请单号不能为空" dc:"申请单号"` + AuditResult int `json:"auditResult" dc:"审核结果:0通过,1驳回"` + AuditOpinion string `json:"auditOpinion" dc:"审核意见"` +} + +func (in *TAgentBalanceTransferAuditParam) Filter(ctx context.Context) (err error) { + if in == nil { + return gerror.New("审核参数不能为空") + } + if in.ApplyNo == "" { + return gerror.New("申请单号不能为空") + } + if in.AuditResult != 0 && in.AuditResult != 1 { + return gerror.New("审核结果不正确") + } + return nil +} + +type TAgentBalanceTransferAuditModel struct{} + +// TFinanceApplyCreateBalanceTransferParam 是写入余额转可提现申请单的参数。 +type TFinanceApplyCreateBalanceTransferParam struct { + ApplyNo string + ApplyDeptId int64 + AuditDeptId int64 + AvailableAmountSnapshot float64 + ApplyAmount float64 + AccountType int + BankName string + BankAccount string + AccountName string + IdentityCard string + ReceiveAccount *gjson.Json + Remark string + TenantId string + CreatedDept int64 + CreatedBy int64 + CreatedAt *gtime.Time +} + +// TFinanceApplyUpdateAuditStatusParam 是更新财务申请审核状态的参数。 +type TFinanceApplyUpdateAuditStatusParam struct { + ApplyNo string + ApplyStatus int + AuditTime *gtime.Time + UpdatedBy int64 + UpdatedAt *gtime.Time +} + +type TFinanceApplyViewModel struct { + entity.TFinanceApply +} diff --git a/internal/model/t_finance_audit_record.go b/internal/model/t_finance_audit_record.go new file mode 100644 index 0000000..a7c48af --- /dev/null +++ b/internal/model/t_finance_audit_record.go @@ -0,0 +1,158 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TFinanceAuditRecordUpdateFields 修改财务审核记录表字段过滤 +type TFinanceAuditRecordUpdateFields struct { + AuditNo string `json:"auditNo" dc:"审核记录编号"` + ApplyNo string `json:"applyNo" dc:"申请单号"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID"` + AuditorUserId int64 `json:"auditorUserId" dc:"审核人ID"` + AuditResult int `json:"auditResult" dc:"审核结果:0通过,1驳回"` + AuditOpinion string `json:"auditOpinion" dc:"审核意见"` + AuditTime *gtime.Time `json:"auditTime" dc:"审核时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinanceAuditRecordInsertFields 新增财务审核记录表字段过滤 +type TFinanceAuditRecordInsertFields struct { + AuditNo string `json:"auditNo" dc:"审核记录编号"` + ApplyNo string `json:"applyNo" dc:"申请单号"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID"` + AuditorUserId int64 `json:"auditorUserId" dc:"审核人ID"` + AuditResult int `json:"auditResult" dc:"审核结果:0通过,1驳回"` + AuditOpinion string `json:"auditOpinion" dc:"审核意见"` + AuditTime *gtime.Time `json:"auditTime" dc:"审核时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TFinanceAuditRecordEditParam 修改/新增财务审核记录表 +type TFinanceAuditRecordEditParam struct { + //entity.TFinanceAuditRecord + Id int64 `json:"id" dc:"主键ID"` + AuditNo *string `json:"auditNo" dc:"审核记录编号"` + ApplyNo *string `json:"applyNo" dc:"申请单号"` + AuditDeptId *int64 `json:"auditDeptId" dc:"审核方机构ID"` + AuditorUserId *int64 `json:"auditorUserId" dc:"审核人ID"` + AuditResult *int `json:"auditResult" dc:"审核结果:0通过,1驳回"` + AuditOpinion *string `json:"auditOpinion" dc:"审核意见"` + AuditTime *gtime.Time `json:"auditTime" dc:"审核时间"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TFinanceAuditRecordEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TFinanceAuditRecordEditModel struct{} + +// TFinanceAuditRecordDeleteParam 删除财务审核记录表 +type TFinanceAuditRecordDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinanceAuditRecordDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinanceAuditRecordDeleteModel struct{} + +// TFinanceAuditRecordViewParam 获取指定财务审核记录表信息 +type TFinanceAuditRecordViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TFinanceAuditRecordViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinanceAuditRecordViewModel struct { + entity.TFinanceAuditRecord + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TFinanceAuditRecordListParam 获取财务审核记录表列表 +type TFinanceAuditRecordListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TFinanceAuditRecordListParam) Filter(ctx context.Context) (err error) { + return +} + +type TFinanceAuditRecordListModel struct { + Id int64 `json:"id" dc:"主键ID"` + AuditNo string `json:"auditNo" dc:"审核记录编号"` + ApplyNo string `json:"applyNo" dc:"申请单号"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID"` + AuditorUserId int64 `json:"auditorUserId" dc:"审核人ID"` + AuditResult int `json:"auditResult" dc:"审核结果:0通过,1驳回"` + AuditTime *gtime.Time `json:"auditTime" dc:"审核时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinanceAuditRecordExportModel 导出财务审核记录表 +type TFinanceAuditRecordExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + AuditNo string `json:"auditNo" dc:"审核记录编号"` + ApplyNo string `json:"applyNo" dc:"申请单号"` + AuditDeptId int64 `json:"auditDeptId" dc:"审核方机构ID"` + AuditorUserId int64 `json:"auditorUserId" dc:"审核人ID"` + AuditResult int `json:"auditResult" dc:"审核结果:0通过,1驳回"` + AuditTime *gtime.Time `json:"auditTime" dc:"审核时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TFinanceAuditRecordCreateParam 是写入财务审核记录的参数。 +type TFinanceAuditRecordCreateParam struct { + AuditNo string + ApplyNo string + AuditDeptId int64 + AuditorUserId int64 + AuditResult int + AuditOpinion string + AuditTime *gtime.Time + TenantId string + CreatedDept int64 + CreatedBy int64 + CreatedAt *gtime.Time +} diff --git a/internal/model/t_profit_account_month_bill.go b/internal/model/t_profit_account_month_bill.go new file mode 100644 index 0000000..d3e415d --- /dev/null +++ b/internal/model/t_profit_account_month_bill.go @@ -0,0 +1,226 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TProfitAccountMonthBillUpdateFields 修改盈利账户月账单表字段过滤 +type TProfitAccountMonthBillUpdateFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + CommissionIncome float64 `json:"commissionIncome" dc:"分润收入"` + BalanceTransferInIncome float64 `json:"balanceTransferInIncome" dc:"余额转提现收入"` + WithdrawalExpense float64 `json:"withdrawalExpense" dc:"提现支出"` + WithdrawableTransferOutExpense float64 `json:"withdrawableTransferOutExpense" dc:"可提现转余额支出"` + ProfitCreditRepayExpense float64 `json:"profitCreditRepayExpense" dc:"盈利账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + SettleBy int64 `json:"settleBy" dc:"结算人ID"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TProfitAccountMonthBillInsertFields 新增盈利账户月账单表字段过滤 +type TProfitAccountMonthBillInsertFields struct { + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + CommissionIncome float64 `json:"commissionIncome" dc:"分润收入"` + BalanceTransferInIncome float64 `json:"balanceTransferInIncome" dc:"余额转提现收入"` + WithdrawalExpense float64 `json:"withdrawalExpense" dc:"提现支出"` + WithdrawableTransferOutExpense float64 `json:"withdrawableTransferOutExpense" dc:"可提现转余额支出"` + ProfitCreditRepayExpense float64 `json:"profitCreditRepayExpense" dc:"盈利账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + SettleBy int64 `json:"settleBy" dc:"结算人ID"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TProfitAccountMonthBillEditParam 修改/新增盈利账户月账单表 +type TProfitAccountMonthBillEditParam struct { + //entity.TProfitAccountMonthBill + Id int64 `json:"id" dc:"账单ID"` + DeptId *int64 `json:"deptId" dc:"机构ID"` + AccountPeriod *string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance *float64 `json:"openingBalance" dc:"月初余额"` + CommissionIncome *float64 `json:"commissionIncome" dc:"分润收入"` + BalanceTransferInIncome *float64 `json:"balanceTransferInIncome" dc:"余额转提现收入"` + WithdrawalExpense *float64 `json:"withdrawalExpense" dc:"提现支出"` + WithdrawableTransferOutExpense *float64 `json:"withdrawableTransferOutExpense" dc:"可提现转余额支出"` + ProfitCreditRepayExpense *float64 `json:"profitCreditRepayExpense" dc:"盈利账户还款支出"` + TotalIncome *float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense *float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance *float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount *int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount *int `json:"expenseCount" dc:"支出笔数"` + BillStatus *int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + SettleBy *int64 `json:"settleBy" dc:"结算人ID"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TProfitAccountMonthBillEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TProfitAccountMonthBillEditModel struct{} + +// TProfitAccountMonthBillDeleteParam 删除盈利账户月账单表 +type TProfitAccountMonthBillDeleteParam struct { + Id interface{} `json:"id" v:"required#账单ID不能为空" dc:"账单ID"` +} + +func (in *TProfitAccountMonthBillDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TProfitAccountMonthBillDeleteModel struct{} + +// TProfitAccountMonthBillViewParam 获取指定盈利账户月账单表信息 +type TProfitAccountMonthBillViewParam struct { + Id int64 `json:"id" v:"required#账单ID不能为空" dc:"账单ID"` +} + +func (in *TProfitAccountMonthBillViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TProfitAccountMonthBillViewModel struct { + entity.TProfitAccountMonthBill + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TProfitAccountMonthBillListParam 获取盈利账户月账单表列表 +type TProfitAccountMonthBillListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"账单ID"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TProfitAccountMonthBillListParam) Filter(ctx context.Context) (err error) { + return +} + +type TProfitAccountMonthBillListModel struct { + Id int64 `json:"id" dc:"账单ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + CommissionIncome float64 `json:"commissionIncome" dc:"分润收入"` + BalanceTransferInIncome float64 `json:"balanceTransferInIncome" dc:"余额转提现收入"` + WithdrawalExpense float64 `json:"withdrawalExpense" dc:"提现支出"` + WithdrawableTransferOutExpense float64 `json:"withdrawableTransferOutExpense" dc:"可提现转余额支出"` + ProfitCreditRepayExpense float64 `json:"profitCreditRepayExpense" dc:"盈利账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + SettleBy int64 `json:"settleBy" dc:"结算人ID"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TProfitAccountMonthBillExportModel 导出盈利账户月账单表 +type TProfitAccountMonthBillExportModel struct { + Id int64 `json:"id" dc:"账单ID"` + DeptId int64 `json:"deptId" dc:"机构ID"` + AccountPeriod string `json:"accountPeriod" dc:"账期YYYY-MM"` + OpeningBalance float64 `json:"openingBalance" dc:"月初余额"` + CommissionIncome float64 `json:"commissionIncome" dc:"分润收入"` + BalanceTransferInIncome float64 `json:"balanceTransferInIncome" dc:"余额转提现收入"` + WithdrawalExpense float64 `json:"withdrawalExpense" dc:"提现支出"` + WithdrawableTransferOutExpense float64 `json:"withdrawableTransferOutExpense" dc:"可提现转余额支出"` + ProfitCreditRepayExpense float64 `json:"profitCreditRepayExpense" dc:"盈利账户还款支出"` + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` + ClosingBalance float64 `json:"closingBalance" dc:"月末余额(月初余额+本月收入-本月支出)"` + IncomeCount int `json:"incomeCount" dc:"收入笔数"` + ExpenseCount int `json:"expenseCount" dc:"支出笔数"` + BillStatus int `json:"billStatus" dc:"账单状态:1正常,2已调整,3已作废"` + SettleTime *gtime.Time `json:"settleTime" dc:"结算时间"` + SettleBy int64 `json:"settleBy" dc:"结算人ID"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} +type TProfitBillModel struct { + TotalIncome float64 `json:"totalIncome" dc:"本月收入总额"` + TotalExpense float64 `json:"totalExpense" dc:"本月支出总额"` +} + +type TCoreFinancialDataModel struct { + TotalIncome float64 `json:"totalIncome" dc:"总收入"` + TopLevelProfit float64 `json:"topLevelProfit" dc:"顶级利润"` + PendingWithdrawAmount float64 `json:"pendingWithdrawAmount" dc:"待审核提现"` + WithdrawedAmount float64 `json:"withdrawedAmount" dc:"已提现金额"` +} + +// TFinancialTrendParam 财务趋势折线图参数 +type TFinancialTrendParam struct { + Type int `json:"type" dc:"类型:1年,2月"` + Year string `json:"year" dc:"年份,如:2026"` + Month string `json:"month" dc:"月份,如:2026-01"` + Indicators []int `json:"indicators" dc:"指标类型:1总收入,2顶级利润,3待审核提现,4已提现金额"` +} + +// TFinancialTrendModel 财务趋势折线图结果 +type TFinancialTrendModel struct { + Labels []string `json:"labels" dc:"时间数组"` + Series []TFinancialTrendSeries `json:"series" dc:"数据数组"` +} + +// TFinancialTrendSeries 趋势数据系列 +type TFinancialTrendSeries struct { + Name string `json:"name" dc:"指标名称:1总收入,2顶级利润,3待审核提现,4已提现金额"` + Type int `json:"type" dc:"指标类型"` + Values []float64 `json:"values" dc:"指标值数组"` +} diff --git a/internal/model/t_sim_card_bind_pkg.go b/internal/model/t_sim_card_bind_pkg.go new file mode 100644 index 0000000..905f9d3 --- /dev/null +++ b/internal/model/t_sim_card_bind_pkg.go @@ -0,0 +1,207 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardBindPkgUpdateFields 修改订购表字段过滤 +type TSimCardBindPkgUpdateFields struct { + SubscriptionNo string `json:"subscriptionNo" dc:"订购记录编号"` + BatchNo string `json:"batchNo" dc:"批次编号"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + DeptId string `json:"deptId" dc:"部门机构编号"` + PackageType int `json:"packageType" dc:"套餐类型"` + PackageCode string `json:"packageCode" dc:"套餐编号"` + PreviousPackageCode string `json:"previousPackageCode" dc:"变更前套餐编号"` + BusinessType int `json:"businessType" dc:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" dc:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" dc:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" dc:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" dc:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" dc:"实际到期时间"` + DurationMonths int `json:"durationMonths" dc:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"赠送时长(月)"` + OrderCode string `json:"orderCode" dc:"订单编号"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimCardBindPkgInsertFields 新增订购表字段过滤 +type TSimCardBindPkgInsertFields struct { + SubscriptionNo string `json:"subscriptionNo" dc:"订购记录编号"` + BatchNo string `json:"batchNo" dc:"批次编号"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + DeptId string `json:"deptId" dc:"部门机构编号"` + PackageType int `json:"packageType" dc:"套餐类型"` + PackageCode string `json:"packageCode" dc:"套餐编号"` + PreviousPackageCode string `json:"previousPackageCode" dc:"变更前套餐编号"` + BusinessType int `json:"businessType" dc:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" dc:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" dc:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" dc:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" dc:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" dc:"实际到期时间"` + DurationMonths int `json:"durationMonths" dc:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"赠送时长(月)"` + OrderCode string `json:"orderCode" dc:"订单编号"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimCardBindPkgEditParam 修改/新增订购表 +type TSimCardBindPkgEditParam struct { + //entity.TSimCardBindPkg + Id int64 `json:"id" dc:"主键ID"` + SubscriptionNo *string `json:"subscriptionNo" dc:"订购记录编号"` + BatchNo *string `json:"batchNo" dc:"批次编号"` + Iccid *string `json:"iccid" dc:"ICCID"` + Msisdn *string `json:"msisdn" dc:"MSISDN/卡号"` + DeptId *string `json:"deptId" dc:"部门机构编号"` + PackageType *int `json:"packageType" dc:"套餐类型"` + PackageCode *string `json:"packageCode" dc:"套餐编号"` + PreviousPackageCode *string `json:"previousPackageCode" dc:"变更前套餐编号"` + BusinessType *int `json:"businessType" dc:"类型 枚举"` + EffectiveStatus *int `json:"effectiveStatus" dc:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" dc:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" dc:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" dc:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" dc:"实际到期时间"` + DurationMonths *int `json:"durationMonths" dc:"套餐时长(月)"` + GiftDurationMonths *int `json:"giftDurationMonths" dc:"赠送时长(月)"` + OrderCode *string `json:"orderCode" dc:"订单编号"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimCardBindPkgEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimCardBindPkgEditModel struct{} + +// TSimCardBindPkgDeleteParam 删除订购表 +type TSimCardBindPkgDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimCardBindPkgDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardBindPkgDeleteModel struct{} + +// TSimCardBindPkgViewParam 获取指定订购表信息 +type TSimCardBindPkgViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimCardBindPkgViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardBindPkgViewModel struct { + entity.TSimCardBindPkg + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimCardBindPkgListParam 获取订购表列表 +type TSimCardBindPkgListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + Iccid string `json:"iccid" dc:"ICCID"` + EffectiveStatus int `json:"effectiveStatus" dc:"订购状态 枚举"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimCardBindPkgListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardBindPkgListModel struct { + Id int64 `json:"id" dc:"主键ID"` + SubscriptionNo string `json:"subscriptionNo" dc:"订购记录编号"` + BatchNo string `json:"batchNo" dc:"批次编号"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + DeptId string `json:"deptId" dc:"部门机构编号"` + PackageType int `json:"packageType" dc:"套餐类型"` + PackageCode string `json:"packageCode" dc:"变更后套餐编号"` + PackageName string `json:"packageName" dc:"变更后套餐名称"` + PreviousPackageCode string `json:"previousPackageCode" dc:"变更前套餐编号"` + PreviousPackageName string `json:"previousPackageName" dc:"变更前套餐名称"` + BusinessType int `json:"businessType" dc:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" dc:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" dc:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" dc:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" dc:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" dc:"实际到期时间"` + DurationMonths int `json:"durationMonths" dc:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"赠送时长(月)"` + OrderCode string `json:"orderCode" dc:"订单编号"` + PayType int `json:"payType" dc:"支付类型 枚举"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimCardBindPkgExportModel 导出订购表 +type TSimCardBindPkgExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + SubscriptionNo string `json:"subscriptionNo" dc:"订购记录编号"` + BatchNo string `json:"batchNo" dc:"批次编号"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + DeptId string `json:"deptId" dc:"部门机构编号"` + PackageType int `json:"packageType" dc:"套餐类型"` + PackageCode string `json:"packageCode" dc:"套餐编号"` + PreviousPackageCode string `json:"previousPackageCode" dc:"变更前套餐编号"` + BusinessType int `json:"businessType" dc:"类型 枚举"` + EffectiveStatus int `json:"effectiveStatus" dc:"订购状态 枚举"` + HandleTime *gtime.Time `json:"handleTime" dc:"办理时间"` + EffectiveTime *gtime.Time `json:"effectiveTime" dc:"生效时间"` + ExpectedExpireTime *gtime.Time `json:"expectedExpireTime" dc:"预计到期时间"` + ActualExpireTime *gtime.Time `json:"actualExpireTime" dc:"实际到期时间"` + DurationMonths int `json:"durationMonths" dc:"套餐时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"赠送时长(月)"` + OrderCode string `json:"orderCode" dc:"订单编号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} +type TSimCardBindPkgInfoParam struct { + request.PageInfo + Iccid string `json:"iccid" dc:"ICCID"` +} diff --git a/internal/model/t_sim_card_change.go b/internal/model/t_sim_card_change.go new file mode 100644 index 0000000..30db2d1 --- /dev/null +++ b/internal/model/t_sim_card_change.go @@ -0,0 +1,151 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +type TSimCardChangeBatchPrepareParam struct { + SourceBatchNo string `json:"sourceBatchNo" dc:"source order batch no"` +} + +type TSimCardChangeInputPrepareParam struct { + Input string `json:"input" v:"required#batch input cannot be empty" dc:"batch input ICCID text"` + NewPackageCode string `json:"newPackageCode" v:"required#newPackageCode cannot be empty" dc:"target new package code"` + DurationMonths int `json:"durationMonths" v:"required|min:1#durationMonths cannot be empty|durationMonths must be greater than 0" dc:"package duration months"` + GiftDurationMonths int `json:"giftDurationMonths" v:"min:0#giftDurationMonths cannot be negative" dc:"gift duration months"` + EffectiveMode string `json:"effectiveMode" v:"required#effectiveMode cannot be empty" dc:"effective mode"` + OfflineContractCompleted bool `json:"offlineContractCompleted" v:"required#please confirm offline contract is completed" dc:"offline contract completed"` +} + +type TSimCardChangeRangePrepareParam struct { + StartIccid string `json:"startIccid" v:"required#startIccid cannot be empty" dc:"start ICCID"` + EndIccid string `json:"endIccid" v:"required#endIccid cannot be empty" dc:"end ICCID"` + StartMsisdn string `json:"startMsisdn" v:"required#startMsisdn cannot be empty" dc:"start MSISDN"` + EndMsisdn string `json:"endMsisdn" v:"required#endMsisdn cannot be empty" dc:"end MSISDN"` + StartImsi string `json:"startImsi" v:"required#startImsi cannot be empty" dc:"start IMSI"` + EndImsi string `json:"endImsi" v:"required#endImsi cannot be empty" dc:"end IMSI"` + NewPackageCode string `json:"newPackageCode" v:"required#newPackageCode cannot be empty" dc:"target new package code"` + DurationMonths int `json:"durationMonths" v:"required|min:1#durationMonths cannot be empty|durationMonths must be greater than 0" dc:"package duration months"` + GiftDurationMonths int `json:"giftDurationMonths" v:"min:0#giftDurationMonths cannot be negative" dc:"gift duration months"` + EffectiveMode string `json:"effectiveMode" v:"required#effectiveMode cannot be empty" dc:"effective mode"` + OfflineContractCompleted bool `json:"offlineContractCompleted" v:"required#please confirm offline contract is completed" dc:"offline contract completed"` +} + +type TSimCardChangeExcelSubmitParam struct{} + +type TSimCardChangeExcelSubmitRes struct { + BatchNo string `json:"batchNo" dc:"batch no"` + BatchType int `json:"batchType" dc:"batch type"` + TargetBatchType int `json:"targetBatchType" dc:"target batch type"` + Status string `json:"status" dc:"status"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"batch async status"` + RunResult int `json:"runResult" dc:"run result"` + Total int `json:"total" dc:"total rows"` + ResultDownloadId int64 `json:"resultDownloadId" dc:"result download id"` + ResultFileOssId int64 `json:"resultFileOssId" dc:"result file oss id"` + FailReason string `json:"failReason" dc:"fail reason"` +} + +type TSimCardChangeBatchPrepareRes struct { + BatchNo string `json:"batchNo" dc:"change batch no"` + BatchType int `json:"batchType" dc:"current batch type"` + TargetBatchType int `json:"targetBatchType" dc:"target batch type"` + Status string `json:"status" dc:"status"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"batch async status"` + RunResult int `json:"runResult" dc:"run result"` + Total int `json:"total" dc:"total rows"` + ValidCount int `json:"validCount" dc:"valid rows"` + FailCount int `json:"failCount" dc:"failed rows"` + SourceBatchNo string `json:"sourceBatchNo" dc:"source order batch no"` + CustomerAgentId int64 `json:"customerAgentId" dc:"customer agent id"` + CustomerName string `json:"customerName" dc:"customer name"` + OldPackageCode string `json:"oldPackageCode" dc:"old package code"` + OldPackageName string `json:"oldPackageName" dc:"old package name"` + OldPackageType int `json:"oldPackageType" dc:"old package type"` + OldPackageFlowMb float64 `json:"oldPackageFlowMb" dc:"old package flow mb"` + ResultDownloadId int64 `json:"resultDownloadId" dc:"result download id"` + ResultFileOssId int64 `json:"resultFileOssId" dc:"result file oss id"` +} + +type TSimCardChangeBatchSubmitParam struct { + BatchNo string `json:"batchNo" dc:"change batch no"` + NewPackageCode string `json:"newPackageCode" dc:"target new package code"` + DurationMonths int `json:"durationMonths" dc:"package duration months"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"gift duration months"` + EffectiveMode string `json:"effectiveMode" dc:"effective mode"` + OfflineContractCompleted bool `json:"offlineContractCompleted" dc:"offline contract completed"` + BuyerNote string `json:"buyerNote" dc:"buyer note"` + AdminNote string `json:"adminNote" dc:"admin note"` + Remark string `json:"remark" dc:"batch remark"` +} + +type TSimCardChangeBatchSubmitRes struct { + BatchNo string `json:"batchNo" dc:"change batch no"` + BatchType int `json:"batchType" dc:"batch type"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"batch async status"` + SourceBatchNo string `json:"sourceBatchNo" dc:"source order batch no"` + Status string `json:"status" dc:"status"` + NewPackageCode string `json:"newPackageCode" dc:"new package code"` + NewPackageName string `json:"newPackageName" dc:"new package name"` + OldPackageCode string `json:"oldPackageCode" dc:"old package code"` + OldPackageName string `json:"oldPackageName" dc:"old package name"` + DurationMonths int `json:"durationMonths" dc:"duration months"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"gift duration months"` + EffectiveMode string `json:"effectiveMode" dc:"effective mode"` + PackageBeginTime *gtime.Time `json:"packageBeginTime" dc:"package begin time"` + PackageEndTime *gtime.Time `json:"packageEndTime" dc:"package end time"` +} + +type TSimCardChangePrepareSnapshot struct { + SourceBatchNo string `json:"sourceBatchNo"` + CustomerAgentId int64 `json:"customerAgentId"` + CustomerName string `json:"customerName"` + OldPackageCode string `json:"oldPackageCode"` + OldPackageName string `json:"oldPackageName"` + OldPackageType int `json:"oldPackageType"` + OldPackageFlowMb float64 `json:"oldPackageFlowMb"` + Quantity int `json:"quantity"` +} + +type TSimCardChangePriceSnapshot struct { + CustomerAgentId int64 `json:"customerAgentId"` + NewPackageCode string `json:"newPackageCode"` + NewPackageName string `json:"newPackageName"` + PriceSource string `json:"priceSource"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId"` + TargetPriceId int64 `json:"targetPriceId"` + ChangeUnitPrice float64 `json:"changeUnitPrice"` + RenewableDurationOptions []int `json:"renewableDurationOptions"` +} + +type TSimCardChangeInputPrepareRes = TSimCardChangeBatchPrepareRes + +type TSimCardChangeRangePrepareRes = TSimCardChangeBatchPrepareRes + +type TSimCardChangePrepareResultRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"当前批次类型"` + TargetBatchType int `json:"targetBatchType" dc:"目标批次类型"` + Status string `json:"status" dc:"处理状态: pending/processing/success/failed/partial_success"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态"` + RunResult int `json:"runResult" dc:"运行结果"` + Total int `json:"total" dc:"提交总数"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + FailReason string `json:"failReason" dc:"失败原因"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + CustomerAgentId int64 `json:"customerAgentId" dc:"客户代理ID"` + CustomerName string `json:"customerName" dc:"客户名称"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + OldPackageCode string `json:"oldPackageCode" dc:"原套餐编码"` + OldPackageName string `json:"oldPackageName" dc:"原套餐名称"` + OldPackageType int `json:"oldPackageType" dc:"原套餐类型"` + OldPackageFlowMb float64 `json:"oldPackageFlowMb" dc:"原套餐流量"` + Quantity int `json:"quantity" dc:"数量"` + PriceSource string `json:"priceSource" dc:"价格来源"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"代理默认价格ID"` + TargetPriceId int64 `json:"targetPriceId" dc:"目标价格ID"` + ChangeUnitPrice float64 `json:"changeUnitPrice" dc:"变更单价"` + RenewableDurationOptions []int `json:"renewableDurationOptions" dc:"可续费时长"` + Snapshot any `json:"snapshot" dc:"批次完整快照"` +} diff --git a/internal/model/t_sim_card_inbound.go b/internal/model/t_sim_card_inbound.go new file mode 100644 index 0000000..6b9116d --- /dev/null +++ b/internal/model/t_sim_card_inbound.go @@ -0,0 +1,87 @@ +package model + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +type TSimCardInboundCommonFields struct { + ChanKey string `json:"chanKey" dc:"通道编号"` + CardType string `json:"cardType" dc:"卡类型"` + UpPkgCode string `json:"upPkgCode" dc:"上游套餐编码"` + SuppliersCode string `json:"suppliersCode" dc:"供应商编码"` + UpstreamActivationTime *gtime.Time `json:"upstreamActivationTime" dc:"上游给出激活时间"` + InsertToPlugEnabled int `json:"insertToPlugEnabled" dc:"是否贴片转插拔(global_yes_or_no)"` + CarrierTrafficCutoffEnabled int `json:"carrierTrafficCutoffEnabled" dc:"是否运营商达量断网(global_yes_or_no)"` + AgreementExpiryDate *gtime.Time `json:"agreementExpiryDate" dc:"协议期到期时间"` + HasTestPeriod int `json:"hasTestPeriod" dc:"是否有测试期(global_yes_or_no)"` + TestPeriodDays int `json:"testPeriodDays" dc:"测试期天数"` + TestPeriodLatestExpiryDate *gtime.Time `json:"testPeriodLatestExpiryDate" dc:"测试期最晚过期日期"` + HasSilentPeriod int `json:"hasSilentPeriod" dc:"是否有沉默期(global_yes_or_no)"` + SilentPeriodDays int `json:"silentPeriodDays" dc:"沉默期天数"` + SilentPeriodLatestExpiryDate *gtime.Time `json:"silentPeriodLatestExpiryDate" dc:"沉默期最晚过期日期"` +} + +type SimCardInboundCommonProvider interface { + InboundCommon() TSimCardInboundCommonFields +} + +type TSimCardInboundExcelSubmitParam struct { + TSimCardInboundCommonFields + SysOssUploadParam + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +type TSimCardInboundExcelSubmitRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` +} + +type TSimCardInboundRangeSubmitParam struct { + StartIccid string `json:"startIccid" dc:"起始号段ICCID"` + EndIccid string `json:"endIccid" dc:"结束号段ICCID"` + StartMsisdn string `json:"startMsisdn" dc:"起始号段MSISDN"` + EndMsisdn string `json:"endMsisdn" dc:"结束号段MSISDN"` + StartImsi string `json:"startImsi" dc:"起始号段IMSI"` + EndImsi string `json:"endImsi" dc:"结束号段IMSI"` + TSimCardInboundCommonFields +} + +type TSimCardInboundRangeSubmitRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` +} + +type TSimCardInboundInputSubmitParam struct { + Input string `json:"input" dc:"批量输入内容"` + TSimCardInboundCommonFields +} + +type TSimCardInboundInputSubmitRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` +} + +func (p *TSimCardInboundExcelSubmitParam) InboundCommon() TSimCardInboundCommonFields { + if p == nil { + return TSimCardInboundCommonFields{} + } + return p.TSimCardInboundCommonFields +} + +func (p *TSimCardInboundRangeSubmitParam) InboundCommon() TSimCardInboundCommonFields { + if p == nil { + return TSimCardInboundCommonFields{} + } + return p.TSimCardInboundCommonFields +} + +func (p *TSimCardInboundInputSubmitParam) InboundCommon() TSimCardInboundCommonFields { + if p == nil { + return TSimCardInboundCommonFields{} + } + return p.TSimCardInboundCommonFields +} diff --git a/internal/model/t_sim_card_info.go b/internal/model/t_sim_card_info.go new file mode 100644 index 0000000..4bc1506 --- /dev/null +++ b/internal/model/t_sim_card_info.go @@ -0,0 +1,434 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardInfoUpdateFields 修改卡信息表字段过滤 +type TSimCardInfoUpdateFields struct { + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + RegionCode string `json:"regionCode" dc:"归属地"` + DeptId int64 `json:"deptId" dc:"渠道客户ID"` + CurrentPackageCode string `json:"currentPackageCode" dc:"当前套餐编号"` + PackageStatus int `json:"packageStatus" dc:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + AccessType int `json:"accessType" dc:"接入方式:ipv4、ipv6、ipv4_ipv6"` + BossCardStatus int `json:"bossCardStatus" dc:"运营商卡状态 枚举"` + CardType int `json:"cardType" dc:"卡类型 枚举"` + BossOpenAt *gtime.Time `json:"bossOpenAt" dc:"运营商开户日期"` + BossActivateAt *gtime.Time `json:"bossActivateAt" dc:"运营商激活日期"` + IsBossActivateEnabled int `json:"isBossActivateEnabled" dc:"是否按运营商激活减去赠送时长方:1是,0否"` + InboundBatchNo string `json:"inboundBatchNo" dc:"入库批次"` + OutboundBatchNo string `json:"outboundBatchNo" dc:"出库批次"` + AllocationBatchNo string `json:"allocationBatchNo" dc:"划拨批次"` + IsFlowPool int `json:"isFlowPool" dc:"是否为池卡:1是,0否"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + FlowPkgBeginAt *gtime.Time `json:"flowPkgBeginAt" dc:"当前套餐生效时间"` + FlowPkgPresentAt *gtime.Time `json:"flowPkgPresentAt" dc:"套餐赠送结束时间"` + FlowPkgRealPresentAt *gtime.Time `json:"flowPkgRealPresentAt" dc:"实际赠送结束时间"` + FlowPkgEndAt *gtime.Time `json:"flowPkgEndAt" dc:"当前套餐预计到期时间"` + DataServiceStatus int `json:"dataServiceStatus" dc:"数据服务状态:1启用、0禁用"` + PackageTotalFlowMb float64 `json:"packageTotalFlowMb" dc:"套餐总流量MB"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已用流量MB"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0未配置,1已开启,2已关闭"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值"` + SmsServiceStatus int `json:"smsServiceStatus" dc:"短信服务状态:1启用、0禁用"` + PackageTotalSms int `json:"packageTotalSms" dc:"套餐短信总条数"` + UsedSms int `json:"usedSms" dc:"已用短信条数"` + VoiceServiceStatus int `json:"voiceServiceStatus" dc:"语音服务状态:1启用、0禁用"` + PackageTotalVoice int `json:"packageTotalVoice" dc:"套餐语音总分钟数"` + UsedVoice int `json:"usedVoice" dc:"已用语音分钟数"` + RoamServiceStatus int `json:"roamServiceStatus" dc:"国漫服务状态:1启用、0禁用"` + PackageTotalRoamFlowMb float64 `json:"packageTotalRoamFlowMb" dc:"套餐国际流量MB"` + UsedRoamFlowMb float64 `json:"usedRoamFlowMb" dc:"已用国际流量MB"` + StatusSyncTime *gtime.Time `json:"statusSyncTime" dc:"状态最后一次同步时间"` + FlowSyncTime *gtime.Time `json:"flowSyncTime" dc:"流量最后一次同步时间"` + SmsSyncTime *gtime.Time `json:"smsSyncTime" dc:"短信最后一次同步时间"` + VoiceSyncTime *gtime.Time `json:"voiceSyncTime" dc:"语音最后一次同步时间"` + RoamSyncTime *gtime.Time `json:"roamSyncTime" dc:"国漫最后一次同步时间"` + ExtraFeeEnabled int `json:"extraFeeEnabled" dc:"是否收取附加费:1是,0否"` + ExtraFeeMultiple float64 `json:"extraFeeMultiple" dc:"附加费用倍数"` + ExtraFee float64 `json:"extraFee" dc:"附加金额"` + ChanKey string `json:"chanKey" dc:"通道编号"` + NetModel int `json:"netModel" dc:"网络类型:4G、5G、NB-IoT"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimCardInfoInsertFields 新增卡信息表字段过滤 +type TSimCardInfoInsertFields struct { + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + RegionCode string `json:"regionCode" dc:"归属地"` + DeptId int64 `json:"deptId" dc:"渠道客户ID"` + CurrentPackageCode string `json:"currentPackageCode" dc:"当前套餐编号"` + PackageStatus int `json:"packageStatus" dc:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + AccessType int `json:"accessType" dc:"接入方式:ipv4、ipv6、ipv4_ipv6"` + BossCardStatus int `json:"bossCardStatus" dc:"运营商卡状态 枚举"` + CardType int `json:"cardType" dc:"卡类型 枚举"` + BossOpenAt *gtime.Time `json:"bossOpenAt" dc:"运营商开户日期"` + BossActivateAt *gtime.Time `json:"bossActivateAt" dc:"运营商激活日期"` + IsBossActivateEnabled int `json:"isBossActivateEnabled" dc:"是否按运营商激活减去赠送时长方:1是,0否"` + InboundBatchNo string `json:"inboundBatchNo" dc:"入库批次"` + OutboundBatchNo string `json:"outboundBatchNo" dc:"出库批次"` + AllocationBatchNo string `json:"allocationBatchNo" dc:"划拨批次"` + IsFlowPool int `json:"isFlowPool" dc:"是否为池卡:1是,0否"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + FlowPkgBeginAt *gtime.Time `json:"flowPkgBeginAt" dc:"当前套餐生效时间"` + FlowPkgPresentAt *gtime.Time `json:"flowPkgPresentAt" dc:"套餐赠送结束时间"` + FlowPkgRealPresentAt *gtime.Time `json:"flowPkgRealPresentAt" dc:"实际赠送结束时间"` + FlowPkgEndAt *gtime.Time `json:"flowPkgEndAt" dc:"当前套餐预计到期时间"` + DataServiceStatus int `json:"dataServiceStatus" dc:"数据服务状态:1启用、0禁用"` + PackageTotalFlowMb float64 `json:"packageTotalFlowMb" dc:"套餐总流量MB"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已用流量MB"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0未配置,1已开启,2已关闭"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值"` + SmsServiceStatus int `json:"smsServiceStatus" dc:"短信服务状态:1启用、0禁用"` + PackageTotalSms int `json:"packageTotalSms" dc:"套餐短信总条数"` + UsedSms int `json:"usedSms" dc:"已用短信条数"` + VoiceServiceStatus int `json:"voiceServiceStatus" dc:"语音服务状态:1启用、0禁用"` + PackageTotalVoice int `json:"packageTotalVoice" dc:"套餐语音总分钟数"` + UsedVoice int `json:"usedVoice" dc:"已用语音分钟数"` + RoamServiceStatus int `json:"roamServiceStatus" dc:"国漫服务状态:1启用、0禁用"` + PackageTotalRoamFlowMb float64 `json:"packageTotalRoamFlowMb" dc:"套餐国际流量MB"` + UsedRoamFlowMb float64 `json:"usedRoamFlowMb" dc:"已用国际流量MB"` + StatusSyncTime *gtime.Time `json:"statusSyncTime" dc:"状态最后一次同步时间"` + FlowSyncTime *gtime.Time `json:"flowSyncTime" dc:"流量最后一次同步时间"` + SmsSyncTime *gtime.Time `json:"smsSyncTime" dc:"短信最后一次同步时间"` + VoiceSyncTime *gtime.Time `json:"voiceSyncTime" dc:"语音最后一次同步时间"` + RoamSyncTime *gtime.Time `json:"roamSyncTime" dc:"国漫最后一次同步时间"` + ExtraFeeEnabled int `json:"extraFeeEnabled" dc:"是否收取附加费:1是,0否"` + ExtraFeeMultiple float64 `json:"extraFeeMultiple" dc:"附加费用倍数"` + ExtraFee float64 `json:"extraFee" dc:"附加金额"` + ChanKey string `json:"chanKey" dc:"通道编号"` + NetModel int `json:"netModel" dc:"网络类型:4G、5G、NB-IoT"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimCardInfoEditParam 修改/新增卡信息表 +type TSimCardInfoEditParam struct { + //entity.TSimCardInfo + Id int64 `json:"id" dc:"主键ID"` + Iccid *string `json:"iccid" dc:"ICCID"` + Msisdn *string `json:"msisdn" dc:"MSISDN/卡号"` + Imsi *string `json:"imsi" dc:"IMSI"` + Imei *string `json:"imei" dc:"IMEI"` + RegionCode *string `json:"regionCode" dc:"归属地"` + DeptId *int64 `json:"deptId" dc:"渠道客户ID"` + CurrentPackageCode *string `json:"currentPackageCode" dc:"当前套餐编号"` + PackageStatus *int `json:"packageStatus" dc:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + AccessType *int `json:"accessType" dc:"接入方式:ipv4、ipv6、ipv4_ipv6"` + BossCardStatus *int `json:"bossCardStatus" dc:"运营商卡状态 枚举"` + CardType *int `json:"cardType" dc:"卡类型 枚举"` + BossOpenAt *gtime.Time `json:"bossOpenAt" dc:"运营商开户日期"` + BossActivateAt *gtime.Time `json:"bossActivateAt" dc:"运营商激活日期"` + IsBossActivateEnabled *int `json:"isBossActivateEnabled" dc:"是否按运营商激活减去赠送时长方:1是,0否"` + InboundBatchNo *string `json:"inboundBatchNo" dc:"入库批次"` + OutboundBatchNo *string `json:"outboundBatchNo" dc:"出库批次"` + AllocationBatchNo *string `json:"allocationBatchNo" dc:"划拨批次"` + IsFlowPool *int `json:"isFlowPool" dc:"是否为池卡:1是,0否"` + FlowPoolCode *string `json:"flowPoolCode" dc:"流量池编号"` + FlowPkgBeginAt *gtime.Time `json:"flowPkgBeginAt" dc:"当前套餐生效时间"` + FlowPkgPresentAt *gtime.Time `json:"flowPkgPresentAt" dc:"套餐赠送结束时间"` + FlowPkgRealPresentAt *gtime.Time `json:"flowPkgRealPresentAt" dc:"实际赠送结束时间"` + FlowPkgEndAt *gtime.Time `json:"flowPkgEndAt" dc:"当前套餐预计到期时间"` + DataServiceStatus *int `json:"dataServiceStatus" dc:"数据服务状态:1启用、0禁用"` + PackageTotalFlowMb *float64 `json:"packageTotalFlowMb" dc:"套餐总流量MB"` + UsedFlowMb *float64 `json:"usedFlowMb" dc:"已用流量MB"` + TrafficCutoffStatus *int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0未配置,1已开启,2已关闭"` + TrafficCutoffThreshold *float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值"` + SmsServiceStatus *int `json:"smsServiceStatus" dc:"短信服务状态:1启用、0禁用"` + PackageTotalSms *int `json:"packageTotalSms" dc:"套餐短信总条数"` + UsedSms *int `json:"usedSms" dc:"已用短信条数"` + VoiceServiceStatus *int `json:"voiceServiceStatus" dc:"语音服务状态:1启用、0禁用"` + PackageTotalVoice *int `json:"packageTotalVoice" dc:"套餐语音总分钟数"` + UsedVoice *int `json:"usedVoice" dc:"已用语音分钟数"` + RoamServiceStatus *int `json:"roamServiceStatus" dc:"国漫服务状态:1启用、0禁用"` + PackageTotalRoamFlowMb *float64 `json:"packageTotalRoamFlowMb" dc:"套餐国际流量MB"` + UsedRoamFlowMb *float64 `json:"usedRoamFlowMb" dc:"已用国际流量MB"` + StatusSyncTime *gtime.Time `json:"statusSyncTime" dc:"状态最后一次同步时间"` + FlowSyncTime *gtime.Time `json:"flowSyncTime" dc:"流量最后一次同步时间"` + SmsSyncTime *gtime.Time `json:"smsSyncTime" dc:"短信最后一次同步时间"` + VoiceSyncTime *gtime.Time `json:"voiceSyncTime" dc:"语音最后一次同步时间"` + RoamSyncTime *gtime.Time `json:"roamSyncTime" dc:"国漫最后一次同步时间"` + ExtraFeeEnabled *int `json:"extraFeeEnabled" dc:"是否收取附加费:1是,0否"` + ExtraFeeMultiple *float64 `json:"extraFeeMultiple" dc:"附加费用倍数"` + ExtraFee *float64 `json:"extraFee" dc:"附加金额"` + ChanKey *string `json:"chanKey" dc:"通道编号"` + NetModel *int `json:"netModel" dc:"网络类型:4G、5G、NB-IoT"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimCardInfoEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimCardInfoEditModel struct{} + +// TSimCardInfoDeleteParam 删除卡信息表 +type TSimCardInfoDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimCardInfoDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardInfoDeleteModel struct{} + +// TSimCardInfoViewParam 获取指定卡信息表信息 +type TSimCardInfoViewParam struct { + Id int64 `json:"id" dc:"主键ID"` +} + +func (in *TSimCardInfoViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardInfoViewModel struct { + ChanAlias string `json:"chanAlias" dc:"通道别名"` + DeptName string `json:"deptName" dc:"部门名称"` + PackageName string `json:"packageName" dc:"套餐名称"` + ReminFlowMb float64 `json:"reminFlowMb" dc:"剩余流量MB"` + entity.TSimCardInfo + + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimCardInfoListParam 获取卡信息表列表 +type TSimCardInfoListParam struct { + request.PageInfo + BossCardStatus *int `json:"bossCardStatus" dc:"运营商卡状态"` + TimeType *int `json:"timeType" dc:"时间类型"` + Time []*gtime.Time `json:"time" dc:"时间段"` + Condition *string `json:"condition" dc:"查询条件"` + StartNum *string `json:"startNum" dc:"起始号段"` + EndNum *string `json:"endNum" dc:"结束号段"` + Dimension *int `json:"dimension" dc:"维度"` + DimensionStatus *string `json:"dimensionStatus" dc:"维度状态"` + DimensionValue *string `json:"dimensionValue" dc:"维度值"` + SortValue *int `json:"sortValue" dc:"排序值"` + SortType *int `json:"sortType" dc:"排序类型"` + ChanKey *string `json:"chanKey" dc:"通道编号"` + CurrentPackageCode *string `json:"currentPackageCode" dc:"当前套餐编码"` + CardValue string `json:"cardValue" dc:"卡号"` + Remark string `json:"remark" dc:"备注"` + Imei string `json:"imei" dc:"IMEI"` + DeptId int64 `json:"deptId" dc:"渠道客户ID"` + Id int64 `json:"id" dc:"主键ID"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + Imsi string `json:"imsi" dc:"IMSI"` + PackageStatus int `json:"packageStatus" dc:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + + DataServiceStatus int `json:"dataServiceStatus" dc:"数据服务状态:1启用、0禁用"` + SmsServiceStatus int `json:"smsServiceStatus" dc:"短信服务状态:1启用、0禁用"` + VoiceServiceStatus int `json:"voiceServiceStatus" dc:"语音服务状态:1启用、0禁用"` + RoamServiceStatus int `json:"roamServiceStatus" dc:"国漫服务状态:1启用、0禁用"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimCardInfoListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardInfoListModel struct { + Id int64 `json:"id" dc:"主键ID"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + RegionCode string `json:"regionCode" dc:"归属地"` + DeptId int64 `json:"deptId" dc:"渠道客户ID"` + DeptName string `json:"deptName" dc:"渠道客户名称"` + CurrentPackageCode string `json:"currentPackageCode" dc:"当前套餐编号"` + PackageName string `json:"packageName" dc:"当前套餐名称"` + PackageStatus int `json:"packageStatus" dc:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + AccessType int `json:"accessType" dc:"接入方式:ipv4、ipv6、ipv4_ipv6"` + BossCardStatus int `json:"bossCardStatus" dc:"运营商卡状态 枚举"` + CardType int `json:"cardType" dc:"卡类型 枚举"` + BossOpenAt *gtime.Time `json:"bossOpenAt" dc:"运营商开户日期"` + BossActivateAt *gtime.Time `json:"bossActivateAt" dc:"运营商激活日期"` + IsBossActivateEnabled int `json:"isBossActivateEnabled" dc:"是否按运营商激活减去赠送时长方:1是,0否"` + InboundBatchNo string `json:"inboundBatchNo" dc:"入库批次"` + OutboundBatchNo string `json:"outboundBatchNo" dc:"出库批次"` + AllocationBatchNo string `json:"allocationBatchNo" dc:"划拨批次"` + IsFlowPool int `json:"isFlowPool" dc:"是否为池卡:1是,0否"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + FlowPkgBeginAt *gtime.Time `json:"flowPkgBeginAt" dc:"当前套餐生效时间"` + FlowPkgPresentAt *gtime.Time `json:"flowPkgPresentAt" dc:"套餐赠送结束时间"` + FlowPkgRealPresentAt *gtime.Time `json:"flowPkgRealPresentAt" dc:"实际赠送结束时间"` + FlowPkgEndAt *gtime.Time `json:"flowPkgEndAt" dc:"当前套餐预计到期时间"` + DataServiceStatus int `json:"dataServiceStatus" dc:"数据服务状态:1启用、0禁用"` + PackageTotalFlowMb float64 `json:"packageTotalFlowMb" dc:"套餐总流量MB"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已用流量MB"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0未配置,1已开启,2已关闭"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值"` + SmsServiceStatus int `json:"smsServiceStatus" dc:"短信服务状态:1启用、0禁用"` + PackageTotalSms int `json:"packageTotalSms" dc:"套餐短信总条数"` + UsedSms int `json:"usedSms" dc:"已用短信条数"` + VoiceServiceStatus int `json:"voiceServiceStatus" dc:"语音服务状态:1启用、0禁用"` + PackageTotalVoice int `json:"packageTotalVoice" dc:"套餐语音总分钟数"` + UsedVoice int `json:"usedVoice" dc:"已用语音分钟数"` + RoamServiceStatus int `json:"roamServiceStatus" dc:"国漫服务状态:1启用、0禁用"` + PackageTotalRoamFlowMb float64 `json:"packageTotalRoamFlowMb" dc:"套餐国际流量MB"` + UsedRoamFlowMb float64 `json:"usedRoamFlowMb" dc:"已用国际流量MB"` + StatusSyncTime *gtime.Time `json:"statusSyncTime" dc:"状态最后一次同步时间"` + FlowSyncTime *gtime.Time `json:"flowSyncTime" dc:"流量最后一次同步时间"` + SmsSyncTime *gtime.Time `json:"smsSyncTime" dc:"短信最后一次同步时间"` + VoiceSyncTime *gtime.Time `json:"voiceSyncTime" dc:"语音最后一次同步时间"` + RoamSyncTime *gtime.Time `json:"roamSyncTime" dc:"国漫最后一次同步时间"` + ExtraFeeEnabled int `json:"extraFeeEnabled" dc:"是否收取附加费:1是,0否"` + ExtraFeeMultiple float64 `json:"extraFeeMultiple" dc:"附加费用倍数"` + ExtraFee float64 `json:"extraFee" dc:"附加金额"` + ChanKey string `json:"chanKey" dc:"通道编号"` + ChanName string `json:"chanName" dc:"通道名称"` + ChanAlias string `json:"chanAlias" dc:"通道别名"` + Remark string `json:"remark" dc:"备注"` + NetModel int `json:"netModel" dc:"网络类型:4G、5G、NB-IoT"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimCardInfoExportModel 导出卡信息表 +type TSimCardInfoExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN/卡号"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + RegionCode string `json:"regionCode" dc:"归属地"` + DeptId int64 `json:"deptId" dc:"渠道客户ID"` + CurrentPackageCode string `json:"currentPackageCode" dc:"当前套餐编号"` + PackageStatus int `json:"packageStatus" dc:"套餐状态:0 无套餐,1待生效,2生效中,3已过期"` + AccessType int `json:"accessType" dc:"接入方式:ipv4、ipv6、ipv4_ipv6"` + BossCardStatus int `json:"bossCardStatus" dc:"运营商卡状态 枚举"` + CardType int `json:"cardType" dc:"卡类型 枚举"` + BossOpenAt *gtime.Time `json:"bossOpenAt" dc:"运营商开户日期"` + BossActivateAt *gtime.Time `json:"bossActivateAt" dc:"运营商激活日期"` + IsBossActivateEnabled int `json:"isBossActivateEnabled" dc:"是否按运营商激活减去赠送时长方:1是,0否"` + InboundBatchNo string `json:"inboundBatchNo" dc:"入库批次"` + OutboundBatchNo string `json:"outboundBatchNo" dc:"出库批次"` + AllocationBatchNo string `json:"allocationBatchNo" dc:"划拨批次"` + IsFlowPool int `json:"isFlowPool" dc:"是否为池卡:1是,0否"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + FlowPkgBeginAt *gtime.Time `json:"flowPkgBeginAt" dc:"当前套餐生效时间"` + FlowPkgPresentAt *gtime.Time `json:"flowPkgPresentAt" dc:"套餐赠送结束时间"` + FlowPkgRealPresentAt *gtime.Time `json:"flowPkgRealPresentAt" dc:"实际赠送结束时间"` + FlowPkgEndAt *gtime.Time `json:"flowPkgEndAt" dc:"当前套餐预计到期时间"` + DataServiceStatus int `json:"dataServiceStatus" dc:"数据服务状态:1启用、0禁用"` + PackageTotalFlowMb float64 `json:"packageTotalFlowMb" dc:"套餐总流量MB"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已用流量MB"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0未配置,1已开启,2已关闭"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值"` + SmsServiceStatus int `json:"smsServiceStatus" dc:"短信服务状态:1启用、0禁用"` + PackageTotalSms int `json:"packageTotalSms" dc:"套餐短信总条数"` + UsedSms int `json:"usedSms" dc:"已用短信条数"` + VoiceServiceStatus int `json:"voiceServiceStatus" dc:"语音服务状态:1启用、0禁用"` + PackageTotalVoice int `json:"packageTotalVoice" dc:"套餐语音总分钟数"` + UsedVoice int `json:"usedVoice" dc:"已用语音分钟数"` + RoamServiceStatus int `json:"roamServiceStatus" dc:"国漫服务状态:1启用、0禁用"` + PackageTotalRoamFlowMb float64 `json:"packageTotalRoamFlowMb" dc:"套餐国际流量MB"` + UsedRoamFlowMb float64 `json:"usedRoamFlowMb" dc:"已用国际流量MB"` + StatusSyncTime *gtime.Time `json:"statusSyncTime" dc:"状态最后一次同步时间"` + FlowSyncTime *gtime.Time `json:"flowSyncTime" dc:"流量最后一次同步时间"` + SmsSyncTime *gtime.Time `json:"smsSyncTime" dc:"短信最后一次同步时间"` + VoiceSyncTime *gtime.Time `json:"voiceSyncTime" dc:"语音最后一次同步时间"` + RoamSyncTime *gtime.Time `json:"roamSyncTime" dc:"国漫最后一次同步时间"` + ExtraFeeEnabled int `json:"extraFeeEnabled" dc:"是否收取附加费:1是,0否"` + ExtraFeeMultiple float64 `json:"extraFeeMultiple" dc:"附加费用倍数"` + ExtraFee float64 `json:"extraFee" dc:"附加金额"` + ChanKey string `json:"chanKey" dc:"通道编号"` + NetModel int `json:"netModel" dc:"网络类型:4G、5G、NB-IoT"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// 同步SIM卡流量 +type SyncSimCardFlowInput struct { + Iccid string `json:"iccid" dc:"sim卡ID"` +} + +// 同步SIM卡状态 +type SyncSimCardStatusInput struct { + Iccid string `json:"iccid" dc:"sim卡ID"` +} + +// 查询SIM卡状态 +type QuerySimStatusInput = SimKey + +type QuerySimStatusOutput = SimCardStatusItem + +// 查询SIM卡会话 +type QuerySimSessionInput = SimKey + +// 查询SIM卡会话输出 +type QuerySimSessionOutput = SimSessionItem + +// GetCardPackageOptionsReq 获取卡套餐下拉选项 +type GetCardPackageOptionsReq struct{} + +// GetCardPackageOptionsRes 获取卡套餐下拉选项响应 +type GetCardPackageOptionsRes struct { + CurrentPackageCode string `json:"currentPackageCode" dc:"当前套餐编码"` +} + +// PackageStatisticsReq 套餐统计请求 +type PackageStatisticsReq struct { + PackageCodes []string `json:"packageCodes" dc:"套餐编码列表"` +} + +// PackageStatisticsRes 套餐统计响应 +type PackageStatisticsRes struct { + Type102 PackageStatisticsItem `json:"type102" dc:"102池套餐统计"` + Type104 PackageStatisticsItem `json:"type104" dc:"104池套餐统计"` + TotalUsedFlowMb float64 `json:"totalUsedFlowMb" dc:"总已用流量MB"` + RemainUsedFlowMb float64 `json:"remainUsedFlowMb" dc:"剩余已用流量MB"` +} + +// PackageStatisticsItem 套餐统计项 +type PackageStatisticsItem struct { + CardCount int64 `json:"cardCount" dc:"卡数量"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"套餐总流量MB"` + TotalFlowGb float64 `json:"totalFlowGb" dc:"套餐总流量GB"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已用流量MB"` +} diff --git a/internal/model/t_sim_card_lifecycle.go b/internal/model/t_sim_card_lifecycle.go new file mode 100644 index 0000000..1f45ac7 --- /dev/null +++ b/internal/model/t_sim_card_lifecycle.go @@ -0,0 +1,39 @@ +package model + +type TSimCardLifecycleExcelSubmitParam struct { + Remark string `json:"remark" dc:"批次备注"` +} + +type TSimCardLifecycleInputSubmitParam struct { + Input string `json:"input" v:"required#批量输入内容不能为空" dc:"每行填写ICCID,或ICCID MSISDN IMSI"` + Remark string `json:"remark" dc:"批次备注"` +} + +type TSimCardLifecycleSubmitRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态 0=已创建 1=待处理 2=处理中 3=成功 4=失败 5=部分成功"` + Total int `json:"total" dc:"提交总行数"` +} + +type TSimCardStopExcelSubmitParam = TSimCardLifecycleExcelSubmitParam +type TSimCardStopInputSubmitParam = TSimCardLifecycleInputSubmitParam +type TSimCardStopExcelSubmitRes = TSimCardLifecycleSubmitRes +type TSimCardStopInputSubmitRes = TSimCardLifecycleSubmitRes + +type TSimCardStartExcelSubmitParam = TSimCardLifecycleExcelSubmitParam +type TSimCardStartInputSubmitParam = TSimCardLifecycleInputSubmitParam +type TSimCardStartExcelSubmitRes = TSimCardLifecycleSubmitRes +type TSimCardStartInputSubmitRes = TSimCardLifecycleSubmitRes + +type TSimCardDataStartExcelSubmitParam = TSimCardLifecycleExcelSubmitParam +type TSimCardDataStartInputSubmitParam = TSimCardLifecycleInputSubmitParam +type TSimCardDataStartSubmitRes = TSimCardLifecycleSubmitRes + +type TSimCardDataStopExcelSubmitParam = TSimCardLifecycleExcelSubmitParam +type TSimCardDataStopInputSubmitParam = TSimCardLifecycleInputSubmitParam +type TSimCardDataStopSubmitRes = TSimCardLifecycleSubmitRes +type TSimCardRestartExcelSubmitParam = TSimCardLifecycleExcelSubmitParam +type TSimCardRestartInputSubmitParam = TSimCardLifecycleInputSubmitParam +type TSimCardRestartExcelSubmitRes = TSimCardLifecycleSubmitRes +type TSimCardRestartInputSubmitRes = TSimCardLifecycleSubmitRes diff --git a/internal/model/t_sim_card_outbound.go b/internal/model/t_sim_card_outbound.go new file mode 100644 index 0000000..6444080 --- /dev/null +++ b/internal/model/t_sim_card_outbound.go @@ -0,0 +1,103 @@ +package model + +import ( + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type TSimCardOutboundSubmitParam struct { + CustomerAgentId int64 `json:"customerAgentId" v:"required|min:1#客户不能为空|客户不能为空" dc:"客户/机构ID"` + PackageCode string `json:"packageCode" v:"required#套餐不能为空" dc:"套餐编码"` + PackageBeginTime *gtime.Time `json:"packageBeginTime" v:"required#套餐开始时间不能为空" dc:"套餐开始时间"` + DurationMonths int `json:"durationMonths" v:"required|min:1#套餐时长不能为空|套餐时长必须大于0" dc:"套餐购买时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" v:"min:0#赠送时长不能小于0" dc:"赠送时长(月)"` + Amount string `json:"amount" dc:"订单金额"` + OfflineContractCompleted bool `json:"offlineContractCompleted" v:"required#请确认线下业务已完成" dc:"线下合同/销售/走账已完成"` + BuyerNote string `json:"buyerNote" dc:"买家备注"` + AdminNote string `json:"adminNote" dc:"后台备注"` +} + +type TSimCardOutboundExcelSubmitParam struct { +} + +type TSimCardOutboundRangeSubmitParam struct { + TSimCardOutboundSubmitParam + StartIccid string `json:"startIccid" v:"required#起始ICCID不能为空" dc:"起始ICCID卡号"` + EndIccid string `json:"endIccid" v:"required#结束ICCID不能为空" dc:"结束ICCID卡号"` + StartMsisdn string `json:"startMsisdn" v:"required#起始MSISDN不能为空" dc:"起始MSISDN号码"` + EndMsisdn string `json:"endMsisdn" v:"required#结束MSISDN不能为空" dc:"结束MSISDN号码"` + StartImsi string `json:"startImsi" v:"required#起始IMSI不能为空" dc:"起始IMSI号码"` + EndImsi string `json:"endImsi" v:"required#结束IMSI不能为空" dc:"结束IMSI号码"` +} + +type TSimCardOutboundInputSubmitParam struct { + TSimCardOutboundSubmitParam + Input string `json:"input" v:"required#批量输入内容不能为空" dc:"批量输入ICCID文本"` +} + +type TSimCardOutboundInboundBatchListParam struct { + request.PageInfo + BatchNo string `json:"batchNo" form:"batchNo" dc:"入库批次号"` +} + +type TSimCardOutboundInboundBatchListItem struct { + BatchNo string `json:"batchNo" orm:"batch_no" dc:"入库批次号"` + StockCount int `json:"stockCount" orm:"stock_count" dc:"当前库存卡数量"` + FirstCreatedAt *gtime.Time `json:"firstCreatedAt" orm:"first_created_at" dc:"最早库存创建时间"` + LastCreatedAt *gtime.Time `json:"lastCreatedAt" orm:"last_created_at" dc:"最近库存创建时间"` +} + +type TSimCardOutboundInboundBatchListRes struct { + Items []*TSimCardOutboundInboundBatchListItem `json:"items" dc:"数据列表"` + Total int `json:"total" dc:"总数量"` +} + +type TSimCardOutboundInboundBatchCardsParam struct { + request.PageInfo + BatchNo string `json:"batchNo" form:"batchNo" v:"required#批次号不能为空" dc:"入库批次号"` + Iccid string `json:"iccid" form:"iccid" dc:"ICCID卡号"` + Msisdn string `json:"msisdn" form:"msisdn" dc:"MSISDN号码"` + Imsi string `json:"imsi" form:"imsi" dc:"IMSI号码"` +} + +type TSimCardOutboundInboundBatchCardItem struct { + Iccid string `json:"iccid" orm:"iccid" dc:"ICCID卡号"` + Msisdn string `json:"msisdn" orm:"msisdn" dc:"MSISDN号码"` + Imsi string `json:"imsi" orm:"imsi" dc:"IMSI号码"` + Imei string `json:"imei" orm:"imei" dc:"IMEI号码"` + ChanKey string `json:"chanKey" orm:"chan_key" dc:"通道标识"` + BatchNo string `json:"batchNo" orm:"batch_no" dc:"入库批次号"` + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" dc:"创建时间"` +} + +type TSimCardOutboundInboundBatchCardsRes struct { + Items []*TSimCardOutboundInboundBatchCardItem `json:"items" dc:"数据列表"` + Total int `json:"total" dc:"总数量"` +} + +type TSimCardOutboundBatchSubmitParam struct { + TSimCardOutboundSubmitParam + BatchNo string `json:"batchNo" v:"required#批次号不能为空" dc:"入库批次号"` +} + +type TSimCardOutboundSubmitRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` + OrderSn string `json:"orderSn" dc:"订单编号"` + Status string `json:"status" dc:"导入状态"` + Quantity int `json:"quantity" dc:"出库数量"` + Total int `json:"total" dc:"解析总行数"` + ValidCount int `json:"validCount" dc:"校验通过行数"` + FailCount int `json:"failCount" dc:"失败行数"` + ResultDownloadId int64 `json:"resultDownloadId" dc:"结果下载任务ID"` + ResultFileOssId int64 `json:"resultFileOssId" dc:"结果文件OSS ID"` +} + +type TSimCardOutboundExcelSubmitRes = TSimCardOutboundSubmitRes + +type TSimCardOutboundRangeSubmitRes = TSimCardOutboundSubmitRes + +type TSimCardOutboundInputSubmitRes = TSimCardOutboundSubmitRes + +type TSimCardOutboundBatchSubmitRes = TSimCardOutboundSubmitRes diff --git a/internal/model/t_sim_card_renew.go b/internal/model/t_sim_card_renew.go new file mode 100644 index 0000000..901fe85 --- /dev/null +++ b/internal/model/t_sim_card_renew.go @@ -0,0 +1,127 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +type TSimCardRenewBatchPrepareParam struct { + SourceBatchNo string `json:"sourceBatchNo" v:"required#来源批次号不能为空" dc:"来源出库批次号"` +} + +type TSimCardRenewBatchPrepareAllParam struct { + SourceBatchNo string `json:"sourceBatchNo" v:"required#来源批次号不能为空" dc:"来源出库批次号"` +} + +type TSimCardRenewInputPrepareParam struct { + Input string `json:"input" v:"required#批量输入内容不能为空" dc:"批量输入ICCID"` +} + +type TSimCardRenewExcelSubmitParam struct{} + +type TSimCardRenewExcelSubmitRes struct { + BatchNo string `json:"batchNo" dc:"batch no"` + BatchType int `json:"batchType" dc:"batch type"` + TargetBatchType int `json:"targetBatchType" dc:"target batch type"` + Status string `json:"status" dc:"batch status"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"batch async status"` + RunResult int `json:"runResult" dc:"run result"` + Total int `json:"total" dc:"total rows"` + ResultDownloadId int64 `json:"resultDownloadId" dc:"result download id"` + ResultFileOssId int64 `json:"resultFileOssId" dc:"result file oss id"` + FailReason string `json:"failReason" dc:"fail reason"` +} + +type TSimCardRenewBatchPrepareRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` + TargetBatchType int `json:"targetBatchType" dc:"目标批次类型"` + Status string `json:"status" dc:"批处理状态"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态"` + RunResult int `json:"runResult" dc:"运行结果"` + Total int `json:"total" dc:"提交总数"` + ValidCount int `json:"validCount" dc:"校验通过数量"` + FailCount int `json:"failCount" dc:"失败数量"` + CustomerAgentId int64 `json:"customerAgentId" dc:"客户代理ID"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + Quantity int `json:"quantity" dc:"续费数量"` + PriceSource string `json:"priceSource" dc:"价格来源"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"代理默认价格ID"` + TargetPriceId int64 `json:"targetPriceId" dc:"目标价格ID"` + RenewUnitPrice float64 `json:"renewUnitPrice" dc:"续费单价"` + RenewableDurationOptions []int `json:"renewableDurationOptions" dc:"可续费时长"` + ResultDownloadId int64 `json:"resultDownloadId" dc:"结果下载任务ID"` + ResultFileOssId int64 `json:"resultFileOssId" dc:"结果文件OSS ID"` +} + +type TSimCardRenewBatchConfirmParam struct { + BatchNo string `json:"batchNo" v:"required#批次号不能为空" dc:"预处理批次号"` + DurationMonths int `json:"durationMonths" v:"required|min:1#续费时长不能为空|续费时长必须大于0" dc:"续费购买时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" v:"min:0#赠送时长不能小于0" dc:"赠送时长(月)"` + OfflineContractCompleted bool `json:"offlineContractCompleted" v:"required#请确认线下业务已完成" dc:"线下合同/销售/走账已完成"` + RenewDate string `json:"renewDate" dc:"续费办理日期"` + BuyerNote string `json:"buyerNote" dc:"买家备注"` + AdminNote string `json:"adminNote" dc:"后台备注"` + Remark string `json:"remark" dc:"续费批次备注"` +} + +type TSimCardRenewBatchConfirmRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态"` + SourceBatchNo string `json:"sourceBatchNo" dc:"来源批次号"` + DurationMonths int `json:"durationMonths" dc:"续费购买时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" dc:"赠送时长(月)"` + Status string `json:"status" dc:"批处理状态"` +} + +type TSimCardRenewPriceSnapshot struct { + CustomerAgentId int64 `json:"customerAgentId"` + PackageCode string `json:"packageCode"` + PackageName string `json:"packageName"` + PriceSource string `json:"priceSource"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId"` + TargetPriceId int64 `json:"targetPriceId"` + RenewUnitPrice float64 `json:"renewUnitPrice"` + RenewableDurationOptions []int `json:"renewableDurationOptions"` +} + +type TSimCardRenewBatchSubmitParam struct { + SourceBatchNo string `json:"sourceBatchNo" dc:"来源出库批次号"` + DurationMonths int `json:"durationMonths" v:"required|min:1#续费时长不能为空|续费时长必须大于0" dc:"续费购买时长(月)"` + GiftDurationMonths int `json:"giftDurationMonths" v:"min:0#赠送时长不能小于0" dc:"赠送时长(月)"` + Amount string `json:"amount" dc:"订单金额"` + OfflineContractCompleted bool `json:"offlineContractCompleted" v:"required#请确认线下业务已完成" dc:"线下合同/销售/走账已完成"` + BuyerNote string `json:"buyerNote" dc:"买家备注"` + AdminNote string `json:"adminNote" dc:"后台备注"` + Remark string `json:"remark" dc:"续费批次备注"` +} + +type TSimCardRenewPrepareResultRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"当前批次类型"` + TargetBatchType int `json:"targetBatchType" dc:"目标批次类型"` + Status string `json:"status" dc:"处理状态: pending/processing/success/failed/partial_success"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态"` + RunResult int `json:"runResult" dc:"运行结果"` + Total int `json:"total" dc:"提交总数"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + FailReason string `json:"failReason" dc:"失败原因"` + StartTime *gtime.Time `json:"startTime" dc:"开始时间"` + EndTime *gtime.Time `json:"endTime" dc:"结束时间"` + CustomerAgentId int64 `json:"customerAgentId" dc:"客户代理ID"` + CustomerName string `json:"customerName" dc:"客户名称"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + OldPackageCode string `json:"oldPackageCode" dc:"原套餐编码"` + OldPackageName string `json:"oldPackageName" dc:"原套餐名称"` + OldPackageType int `json:"oldPackageType" dc:"原套餐类型"` + OldPackageFlowMb float64 `json:"oldPackageFlowMb" dc:"原套餐流量"` + Quantity int `json:"quantity" dc:"数量"` + PriceSource string `json:"priceSource" dc:"价格来源"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"代理默认价格ID"` + TargetPriceId int64 `json:"targetPriceId" dc:"目标价格ID"` + RenewUnitPrice float64 `json:"renewUnitPrice" dc:"续费单价"` + ChangeUnitPrice float64 `json:"changeUnitPrice" dc:"变更单价"` + RenewableDurationOptions []int `json:"renewableDurationOptions" dc:"可续费时长"` + Snapshot any `json:"snapshot" dc:"批次完整快照"` +} diff --git a/internal/model/t_sim_card_stock.go b/internal/model/t_sim_card_stock.go new file mode 100644 index 0000000..b2a3a25 --- /dev/null +++ b/internal/model/t_sim_card_stock.go @@ -0,0 +1,138 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimCardStockUpdateFields 修改库存卡信息表字段过滤 +type TSimCardStockUpdateFields struct { + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + ChanKey string `json:"chanKey" dc:"通道编号"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimCardStockInsertFields 新增库存卡信息表字段过滤 +type TSimCardStockInsertFields struct { + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + ChanKey string `json:"chanKey" dc:"通道编号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimCardStockEditParam 修改/新增库存卡信息表 +type TSimCardStockEditParam struct { + //entity.TSimCardStock + Id int64 `json:"id" dc:"主键ID"` + Iccid *string `json:"iccid" dc:"ICCID"` + Msisdn *string `json:"msisdn" dc:"MSISDN"` + Imsi *string `json:"imsi" dc:"IMSI"` + Imei *string `json:"imei" dc:"IMEI"` + ChanKey *string `json:"chanKey" dc:"通道编号"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimCardStockEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimCardStockEditModel struct{} + +// TSimCardStockDeleteParam 删除库存卡信息表 +type TSimCardStockDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimCardStockDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardStockDeleteModel struct{} + +// TSimCardStockViewParam 获取指定库存卡信息表信息 +type TSimCardStockViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimCardStockViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardStockViewModel struct { + entity.TSimCardStock + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimCardStockListParam 获取库存卡信息表列表 +type TSimCardStockListParam struct { + request.PageInfo + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + ChanKey string `json:"chanKey" dc:"通道编号"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimCardStockListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimCardStockListModel struct { + Id int64 `json:"id" dc:"主键ID"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + ChanKey string `json:"chanKey" dc:"通道编号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimCardStockExportModel 导出库存卡信息表 +type TSimCardStockExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn" dc:"MSISDN"` + Imsi string `json:"imsi" dc:"IMSI"` + Imei string `json:"imei" dc:"IMEI"` + ChanKey string `json:"chanKey" dc:"通道编号"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_sim_card_unsub.go b/internal/model/t_sim_card_unsub.go new file mode 100644 index 0000000..6e04aa2 --- /dev/null +++ b/internal/model/t_sim_card_unsub.go @@ -0,0 +1,38 @@ +package model + +type TSimCardUnsubBatchSubmitParam struct { + SourceBatchNo string `json:"sourceBatchNo" v:"required#来源批次号不能为空" dc:"来源出库批次号"` + Remark string `json:"remark" dc:"退订备注"` +} + +type TSimCardUnsubExcelSubmitParam struct{} + +type TSimCardUnsubInputSubmitParam struct { + Input string `json:"input" v:"required#批量输入内容不能为空" dc:"批量输入ICCID文本"` + Remark string `json:"remark" dc:"退订备注"` +} + +type TSimCardUnsubRangeSubmitParam struct { + StartIccid string `json:"startIccid" v:"required#起始ICCID不能为空" dc:"起始ICCID卡号"` + EndIccid string `json:"endIccid" v:"required#结束ICCID不能为空" dc:"结束ICCID卡号"` + StartMsisdn string `json:"startMsisdn" v:"required#起始MSISDN不能为空" dc:"起始MSISDN号码"` + EndMsisdn string `json:"endMsisdn" v:"required#结束MSISDN不能为空" dc:"结束MSISDN号码"` + StartImsi string `json:"startImsi" v:"required#起始IMSI不能为空" dc:"起始IMSI号码"` + EndImsi string `json:"endImsi" v:"required#结束IMSI不能为空" dc:"结束IMSI号码"` + Remark string `json:"remark" dc:"退订备注"` +} + +type TSimCardUnsubBatchSubmitRes struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchType int `json:"batchType" dc:"批次类型"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"批次异步状态"` + Total int `json:"total" dc:"解析总行数"` + ValidCount int `json:"validCount" dc:"校验通过行数"` + FailCount int `json:"failCount" dc:"失败行数"` +} + +type TSimCardUnsubExcelSubmitRes = TSimCardUnsubBatchSubmitRes + +type TSimCardUnsubInputSubmitRes = TSimCardUnsubBatchSubmitRes + +type TSimCardUnsubRangeSubmitRes = TSimCardUnsubBatchSubmitRes diff --git a/internal/model/t_sim_channel_template.go b/internal/model/t_sim_channel_template.go new file mode 100644 index 0000000..0d2c088 --- /dev/null +++ b/internal/model/t_sim_channel_template.go @@ -0,0 +1,139 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimChannelTemplateUpdateFields 修改通道模板字段过滤 +type TSimChannelTemplateUpdateFields struct { + TempKey string `json:"tempKey" dc:"模板标识"` + TempName string `json:"tempName" dc:"模板名称"` + TempModel string `json:"tempModel" dc:"模板模型"` + TempConfig string `json:"tempConfig" dc:"模板配置"` + TempStatus int `json:"tempStatus" dc:"模板状态(0未启用,1启用)"` + Remark string `json:"remark" dc:"备注"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimChannelTemplateInsertFields 新增通道模板字段过滤 +type TSimChannelTemplateInsertFields struct { + TempKey string `json:"tempKey" dc:"模板标识"` + TempName string `json:"tempName" dc:"模板名称"` + TempModel string `json:"tempModel" dc:"模板模型"` + TempConfig string `json:"tempConfig" dc:"模板配置"` + TempStatus int `json:"tempStatus" dc:"模板状态(0未启用,1启用)"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimChannelTemplateEditParam 修改/新增通道模板 +type TSimChannelTemplateEditParam struct { + //entity.TSimChannelTemplate + Id int64 `json:"id" dc:"ID"` + TempKey *string `json:"tempKey" dc:"模板标识"` + TempName *string `json:"tempName" dc:"模板名称"` + TempModel *string `json:"tempModel" dc:"模板模型"` + TempConfig *string `json:"tempConfig" dc:"模板配置"` + TempStatus *int `json:"tempStatus" dc:"模板状态(0未启用,1启用)"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimChannelTemplateEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimChannelTemplateEditModel struct{} + +// TSimChannelTemplateDeleteParam 删除通道模板 +type TSimChannelTemplateDeleteParam struct { + Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"` +} + +func (in *TSimChannelTemplateDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimChannelTemplateDeleteModel struct{} + +// TSimChannelTemplateViewParam 获取指定通道模板信息 +type TSimChannelTemplateViewParam struct { + // Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` +} + +func (in *TSimChannelTemplateViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimChannelTemplateViewModel struct { + entity.TSimChannelTemplate + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimChannelTemplateListParam 获取通道模板列表 +type TSimChannelTemplateListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` + TempName string `json:"tempName" dc:"模板名称"` + TempStatus *int `json:"tempStatus" dc:"模板状态(0未启用,1启用)"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimChannelTemplateListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimChannelTemplateListModel struct { + Id int64 `json:"id" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` + TempName string `json:"tempName" dc:"模板名称"` + TempModel string `json:"tempModel" dc:"模板模型"` + TempConfig string `json:"tempConfig" dc:"模板配置"` + TempStatus int `json:"tempStatus" dc:"模板状态(0未启用,1启用)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimChannelTemplateExportModel 导出通道模板 +type TSimChannelTemplateExportModel struct { + Id int64 `json:"id" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` + TempName string `json:"tempName" dc:"模板名称"` + TempStatus int `json:"tempStatus" dc:"模板状态(0未启用,1启用)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_sim_channels.go b/internal/model/t_sim_channels.go new file mode 100644 index 0000000..e0e5a56 --- /dev/null +++ b/internal/model/t_sim_channels.go @@ -0,0 +1,210 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimChannelsUpdateFields 修改通道列表字段过滤 +type TSimChannelsUpdateFields struct { + TempKey string `json:"tempKey" dc:"模板标识"` + ChanKey string `json:"chanKey" dc:"通道编号"` + ChanName string `json:"chanName" dc:"通道名称"` + ChanConfig string `json:"chanConfig" dc:"通道配置"` + ChanStatus int `json:"chanStatus" dc:"通道状态(0未启用,1启用)"` + ChanAlias string `json:"chanAlias" dc:"通道别名"` + RegionCode string `json:"regionCode" dc:"通道行政区域代码(省市)"` + AppKey string `json:"appKey" dc:"应用标识"` + AppSecret string `json:"appSecret" dc:"应用密钥"` + AccessToken string `json:"accessToken" dc:"接口调用凭证"` + AccessTokenCreated *gtime.Time `json:"accessTokenCreated" dc:"凭证申请时间"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire" dc:"凭证过期时间"` + RefreshToken string `json:"refreshToken" dc:"刷新凭证"` + RefreshTokenCreated *gtime.Time `json:"refreshTokenCreated" dc:"刷新凭证申请时间"` + RefreshTokenExpire *gtime.Time `json:"refreshTokenExpire" dc:"刷新凭证过期时间"` + Remark string `json:"remark" dc:"备注"` + LoginUser string `json:"loginUser" dc:"登录账号"` + LoginPassword string `json:"loginPassword" dc:"登录密码"` + LoginUrl string `json:"loginUrl" dc:"登录地址"` + LoginState int `json:"loginState" dc:"登录状态(0未启用,1启用)"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimChannelsInsertFields 新增通道列表字段过滤 +type TSimChannelsInsertFields struct { + TempKey string `json:"tempKey" dc:"模板标识"` + ChanKey string `json:"chanKey" dc:"通道编号"` + ChanName string `json:"chanName" dc:"通道名称"` + ChanConfig string `json:"chanConfig" dc:"通道配置"` + ChanStatus int `json:"chanStatus" dc:"通道状态(0未启用,1启用)"` + ChanAlias string `json:"chanAlias" dc:"通道别名"` + RegionCode string `json:"regionCode" dc:"通道行政区域代码(省市)"` + AppKey string `json:"appKey" dc:"应用标识"` + AppSecret string `json:"appSecret" dc:"应用密钥"` + AccessToken string `json:"accessToken" dc:"接口调用凭证"` + AccessTokenCreated *gtime.Time `json:"accessTokenCreated" dc:"凭证申请时间"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire" dc:"凭证过期时间"` + RefreshToken string `json:"refreshToken" dc:"刷新凭证"` + RefreshTokenCreated *gtime.Time `json:"refreshTokenCreated" dc:"刷新凭证申请时间"` + RefreshTokenExpire *gtime.Time `json:"refreshTokenExpire" dc:"刷新凭证过期时间"` + Remark string `json:"remark" dc:"备注"` + LoginUser string `json:"loginUser" dc:"登录账号"` + LoginPassword string `json:"loginPassword" dc:"登录密码"` + LoginUrl string `json:"loginUrl" dc:"登录地址"` + LoginState int `json:"loginState" dc:"登录状态(0未启用,1启用)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimChannelsEditParam 修改/新增通道列表 +type TSimChannelsEditParam struct { + //entity.TSimChannels + Id int64 `json:"id" dc:"ID"` + TempKey *string `json:"tempKey" dc:"模板标识"` + ChanKey *string `json:"chanKey" dc:"通道编号"` + ChanName *string `json:"chanName" dc:"通道名称"` + ChanConfig *string `json:"chanConfig" dc:"通道配置"` + ChanStatus *int `json:"chanStatus" dc:"通道状态(0未启用,1启用)"` + ChanAlias *string `json:"chanAlias" dc:"通道别名"` + RegionCode *string `json:"regionCode" dc:"通道行政区域代码(省市)"` + AppKey *string `json:"appKey" dc:"应用标识"` + AppSecret *string `json:"appSecret" dc:"应用密钥"` + AccessToken *string `json:"accessToken" dc:"接口调用凭证"` + AccessTokenCreated *gtime.Time `json:"accessTokenCreated" dc:"凭证申请时间"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire" dc:"凭证过期时间"` + RefreshToken *string `json:"refreshToken" dc:"刷新凭证"` + RefreshTokenCreated *gtime.Time `json:"refreshTokenCreated" dc:"刷新凭证申请时间"` + RefreshTokenExpire *gtime.Time `json:"refreshTokenExpire" dc:"刷新凭证过期时间"` + Remark *string `json:"remark" dc:"备注"` + LoginUser *string `json:"loginUser" dc:"登录账号"` + LoginPassword *string `json:"loginPassword" dc:"登录密码"` + LoginUrl *string `json:"loginUrl" dc:"登录地址"` + LoginState *int `json:"loginState" dc:"登录状态(0未启用,1启用)"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimChannelsEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimChannelsEditModel struct{} + +// TSimChannelsDeleteParam 删除通道列表 +type TSimChannelsDeleteParam struct { + Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"` +} + +func (in *TSimChannelsDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimChannelsDeleteModel struct{} + +// TSimChannelsViewParam 获取指定通道列表信息 +type TSimChannelsViewParam struct { + Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"` +} + +func (in *TSimChannelsViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimChannelsViewModel struct { + entity.TSimChannels + TempName string `json:"tempName" dc:"模板名称"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimChannelsListParam 获取通道列表列表 +type TSimChannelsListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` + ChanKey string `json:"chanKey" dc:"通道编号"` + ChanName string `json:"chanName" dc:"通道名称"` + ChanStatus *int `json:"chanStatus" dc:"通道状态(0未启用,1启用)"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimChannelsListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimChannelsListModel struct { + Id int64 `json:"id" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` + TempName string `json:"tempName" dc:"模板名称"` + ChanKey string `json:"chanKey" dc:"通道编号"` + ChanName string `json:"chanName" dc:"通道名称"` + ChanConfig string `json:"chanConfig" dc:"通道配置"` + ChanStatus int `json:"chanStatus" dc:"通道状态(0未启用,1启用)"` + ChanAlias string `json:"chanAlias" dc:"通道别名"` + RegionCode string `json:"regionCode" dc:"通道行政区域代码(省市)"` + AppKey string `json:"appKey" dc:"应用标识"` + AppSecret string `json:"appSecret" dc:"应用密钥"` + AccessToken string `json:"accessToken" dc:"接口调用凭证"` + AccessTokenCreated *gtime.Time `json:"accessTokenCreated" dc:"凭证申请时间"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire" dc:"凭证过期时间"` + RefreshToken string `json:"refreshToken" dc:"刷新凭证"` + RefreshTokenCreated *gtime.Time `json:"refreshTokenCreated" dc:"刷新凭证申请时间"` + RefreshTokenExpire *gtime.Time `json:"refreshTokenExpire" dc:"刷新凭证过期时间"` + Remark string `json:"remark" dc:"备注"` + LoginUser string `json:"loginUser" dc:"登录账号"` + LoginPassword string `json:"loginPassword" dc:"登录密码"` + LoginUrl string `json:"loginUrl" dc:"登录地址"` + LoginState int `json:"loginState" dc:"登录状态(0未启用,1启用)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimChannelsExportModel 导出通道列表 +type TSimChannelsExportModel struct { + Id int64 `json:"id" dc:"ID"` + TempKey string `json:"tempKey" dc:"模板标识"` + ChanKey string `json:"chanKey" dc:"通道编号"` + ChanName string `json:"chanName" dc:"通道名称"` + ChanStatus int `json:"chanStatus" dc:"通道状态(0未启用,1启用)"` + ChanAlias string `json:"chanAlias" dc:"通道别名"` + RegionCode string `json:"regionCode" dc:"通道行政区域代码(省市)"` + AppKey string `json:"appKey" dc:"应用标识"` + AppSecret string `json:"appSecret" dc:"应用密钥"` + AccessTokenCreated *gtime.Time `json:"accessTokenCreated" dc:"凭证申请时间"` + AccessTokenExpire *gtime.Time `json:"accessTokenExpire" dc:"凭证过期时间"` + RefreshTokenCreated *gtime.Time `json:"refreshTokenCreated" dc:"刷新凭证申请时间"` + RefreshTokenExpire *gtime.Time `json:"refreshTokenExpire" dc:"刷新凭证过期时间"` + LoginUser string `json:"loginUser" dc:"登录账号"` + LoginPassword string `json:"loginPassword" dc:"登录密码"` + LoginState int `json:"loginState" dc:"登录状态(0未启用,1启用)"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_sim_diagnose.go b/internal/model/t_sim_diagnose.go new file mode 100644 index 0000000..2d32369 --- /dev/null +++ b/internal/model/t_sim_diagnose.go @@ -0,0 +1,58 @@ +package model + +// TSimDiagnoseInfoReq 查询SIM卡诊断信息 +type TSimDiagnoseInfoReq struct { + QueryCode string `json:"queryCode" v:"required#查询码不能为空" dc:"查询码:ICCID / MSISDN / IMSI"` +} + +// TSimDiagnoseInfoOutput 查询SIM卡诊断信息响应 +type TSimDiagnoseInfoOutput struct { + Info *TSimDiagnoseInfoItem `json:"info" dc:"SIM卡基本信息"` + Session *TSimDiagnoseSessionItem `json:"session" dc:"SIM卡会话信息"` + Package *TSimDiagnosePackageItem `json:"package" dc:"SIM卡套餐信息"` +} + +// TSimDiagnoseFlowReq 查询SIM卡使用流量 +type TSimDiagnoseFlowReq struct { + QueryCode string `json:"queryCode" v:"required#查询码不能为空" dc:"查询码:ICCID / MSISDN / IMSI"` + QueryType string `json:"queryType" v:"required|in:7d,30d,6M#查询类型不能为空|查询类型只能为7d近7天、30d近30天、6M近6个月" dc:"查询类型:7d近7天 30d近30天 6M近6个月"` +} + +// TSimDiagnoseFlowOutput 查询SIM卡使用流量响应 +type TSimDiagnoseFlowOutput struct { + Times []string `json:"times" dc:"时间列表"` + Flow []float64 `json:"flow" dc:"流量列表"` + Unit string `json:"unit" dc:"流量单位:MB / GB"` +} + +// TSimDiagnoseInfoItem SIM卡基本信息 +type TSimDiagnoseInfoItem struct { + Iccid *string `json:"iccid" dc:"ICCID"` + Imsi *string `json:"imsi" dc:"IMSI"` + Msisdn *string `json:"msisdn" dc:"MSISDN/卡号"` + Status *string `json:"status" dc:"卡状态:0未知 1待激活 2已激活 4已停机 6可测试 7库存 8预销户 9已销户"` + DataStatus *string `json:"dataStatus" dc:"数据状态:0关闭/停用 1开启/启用"` + OnlineStatus *string `json:"onlineStatus" dc:"在线状态:0离线 1在线 2未知"` + DeviceStatus *string `json:"deviceStatus" dc:"设备状态:0异常/不可用 1正常"` + ImeiStatus *string `json:"imeiStatus" dc:"机卡状态:0异常/机卡分离 1正常"` + RegionLimitStatus *string `json:"regionLimitStatus" dc:"地域限制状态:0受限/已触发 1正常/未触发"` +} + +// TSimDiagnoseSessionItem SIM卡会话信息 +type TSimDiagnoseSessionItem struct { + ApnId *string `json:"apnId" dc:"APN"` + Rat *string `json:"rat" dc:"接入方式"` + Ipv4 *string `json:"ipv4" dc:"IPV4"` + Ipv6 *string `json:"ipv6" dc:"IPV6"` + Ipv6Prefix *string `json:"ipv6Prefix" dc:"IPV6前缀"` +} + +// TSimDiagnosePackageItem SIM卡套餐信息 +type TSimDiagnosePackageItem struct { + PackageName *string `json:"packageName" dc:"套餐名称"` + PackageType *string `json:"packageType" dc:"套餐类型:1基础套餐 101卡套餐 102池套餐 103单卡加油包 104池卡加油包"` + EffectiveStatus *string `json:"effectiveStatus" dc:"生效状态:0待生效 1生效中 2已过期 3已终止 4已作废"` + PackageTotalFlowMb *float64 `json:"packageTotalFlowMb" dc:"套餐总流量MB"` + DurationMonths *int `json:"durationMonths" dc:"套餐时长(月)"` + ExpectedExpireTime *string `json:"expectedExpireTime" dc:"预计到期时间"` +} diff --git a/internal/model/t_sim_flow_package_info.go b/internal/model/t_sim_flow_package_info.go new file mode 100644 index 0000000..cf871ce --- /dev/null +++ b/internal/model/t_sim_flow_package_info.go @@ -0,0 +1,240 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPackageInfoUpdateFields 修改SIM流量套餐管理字段过滤 +type TSimFlowPackageInfoUpdateFields struct { + PackageCode string `json:"packageCode" dc:"套餐编码"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编码"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + PackageType int `json:"packageType" dc:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + BillingMethod string `json:"billingMethod" dc:"计费方式"` + SortNo int `json:"sortNo" dc:"排序号"` + FlowMb float64 `json:"flowMb" dc:"套餐流量(MB)"` + FlowGb float64 `json:"flowGb" dc:"套餐流量(GB)"` + Enabled int `json:"enabled" dc:"是否启用:0-否 1-是(yesno_enum)"` + ListPrice float64 `json:"listPrice" dc:"目录售价"` + CostPrice float64 `json:"costPrice" dc:"成本价"` + SysDefaultProfit float64 `json:"defaultProfit" dc:"默认利润"` + SysDefaultRatio float64 `json:"defaultRatio" dc:"默认系数"` + TerminalCost float64 `json:"terminalCost" dc:"终端成本"` + SysDefaultTerminalProfit float64 `json:"defaultTerminalProfit" dc:"默认终端利润"` + SysDefaultTerminalRatio float64 `json:"defaultTerminalRatio" dc:"默认终端系数"` + RenewableDurationConfig *gjson.Json `json:"renewableDurationConfig" dc:"可续费时长配置:[1,2,3]"` + DiscountRateConfig *gjson.Json `json:"discountRateConfig" dc:"折扣率配置:{\"duration\":1,\"rate\":100}"` + RenewablePackageCodes *gjson.Json `json:"renewablePackageCodes" dc:"可续费套餐编码列表"` + ChangeablePackageCodes *gjson.Json `json:"changeablePackageCodes" dc:"可变更套餐编码列表"` + TopupPackageCodes *gjson.Json `json:"topupPackageCodes" dc:"可订购加油包套餐编码列表"` + IsAutoRenew int `json:"isAutoRenew" dc:"是否自动续费"` + AutoRenewPackageId int64 `json:"autoRenewPackageId" dc:"自动续费套餐ID"` + AutoRenewYears int `json:"autoRenewYears" dc:"自动续费年限"` + Remark string `json:"remark" dc:"备注"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimFlowPackageInfoInsertFields 新增SIM流量套餐管理字段过滤 +type TSimFlowPackageInfoInsertFields struct { + PackageCode string `json:"packageCode" dc:"套餐编码"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编码"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + PackageType int `json:"packageType" dc:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + BillingMethod string `json:"billingMethod" dc:"计费方式"` + SortNo int `json:"sortNo" dc:"排序号"` + FlowMb float64 `json:"flowMb" dc:"套餐流量(MB)"` + FlowGb float64 `json:"flowGb" dc:"套餐流量(GB)"` + Enabled int `json:"enabled" dc:"是否启用:0-否 1-是(yesno_enum)"` + ListPrice float64 `json:"listPrice" dc:"目录售价"` + CostPrice float64 `json:"costPrice" dc:"成本价"` + SysDefaultProfit float64 `json:"defaultProfit" dc:"默认利润"` + SysDefaultRatio float64 `json:"defaultRatio" dc:"默认系数"` + TerminalCost float64 `json:"terminalCost" dc:"终端成本"` + SysDefaultTerminalProfit float64 `json:"defaultTerminalProfit" dc:"默认终端利润"` + SysDefaultTerminalRatio float64 `json:"defaultTerminalRatio" dc:"默认终端系数"` + RenewableDurationConfig *gjson.Json `json:"renewableDurationConfig" dc:"可续费时长配置:[1,2,3]"` + DiscountRateConfig *gjson.Json `json:"discountRateConfig" dc:"折扣率配置:{\"duration\":1,\"rate\":100}"` + RenewablePackageCodes *gjson.Json `json:"renewablePackageCodes" dc:"可续费套餐编码列表"` + ChangeablePackageCodes *gjson.Json `json:"changeablePackageCodes" dc:"可变更套餐编码列表"` + TopupPackageCodes *gjson.Json `json:"topupPackageCodes" dc:"可订购加油包套餐编码列表"` + IsAutoRenew int `json:"isAutoRenew" dc:"是否自动续费"` + AutoRenewPackageId int64 `json:"autoRenewPackageId" dc:"自动续费套餐ID"` + AutoRenewYears int `json:"autoRenewYears" dc:"自动续费年限"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimFlowPackageInfoEditParam 修改/新增SIM流量套餐管理 +type TSimFlowPackageInfoEditParam struct { + //entity.TSimFlowPackageInfo + Id int64 `json:"id" dc:"主键ID"` + PackageCode *string `json:"packageCode" dc:"套餐编码"` + CategoryCode *string `json:"categoryCode" dc:"套餐分类编码"` + PoolPackageCode *int64 `json:"poolPackageCode" dc:"池套餐编码"` + PackageName *string `json:"packageName" dc:"套餐名称"` + PackageType *int `json:"packageType" dc:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + BillingMethod *string `json:"billingMethod" dc:"计费方式"` + SortNo *int `json:"sortNo" dc:"排序号"` + FlowMb *float64 `json:"flowMb" dc:"套餐流量(MB)"` + FlowGb *float64 `json:"flowGb" dc:"套餐流量(GB)"` + Enabled *int `json:"enabled" dc:"是否启用:0-否 1-是(yesno_enum)"` + ListPrice *float64 `json:"listPrice" dc:"目录售价"` + CostPrice *float64 `json:"costPrice" dc:"成本价"` + SysDefaultProfit *float64 `json:"defaultProfit" dc:"默认利润"` + SysDefaultRatio *float64 `json:"defaultRatio" dc:"默认系数"` + TerminalCost *float64 `json:"terminalCost" dc:"终端成本"` + SysDefaultTerminalProfit *float64 `json:"defaultTerminalProfit" dc:"默认终端利润"` + SysDefaultTerminalRatio *float64 `json:"defaultTerminalRatio" dc:"默认终端系数"` + RenewableDurationConfig *gjson.Json `json:"renewableDurationConfig" dc:"可续费时长配置:[1,2,3]"` + DiscountRateConfig *gjson.Json `json:"discountRateConfig" dc:"折扣率配置:{\"duration\":1,\"rate\":100}"` + RenewablePackageCodes *gjson.Json `json:"renewablePackageCodes" dc:"可续费套餐编码列表"` + ChangeablePackageCodes *gjson.Json `json:"changeablePackageCodes" dc:"可变更套餐编码列表"` + TopupPackageCodes *gjson.Json `json:"topupPackageCodes" dc:"可订购加油包套餐编码列表"` + IsAutoRenew *int `json:"isAutoRenew" dc:"是否自动续费"` + AutoRenewPackageId *int64 `json:"autoRenewPackageId" dc:"自动续费套餐ID"` + AutoRenewYears *int `json:"autoRenewYears" dc:"自动续费年限"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy *int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimFlowPackageInfoEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimFlowPackageInfoEditModel struct{} + +// TSimFlowPackageInfoDeleteParam 删除SIM流量套餐管理 +type TSimFlowPackageInfoDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimFlowPackageInfoDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPackageInfoDeleteModel struct{} + +// TSimFlowPackageInfoViewParam 获取指定SIM流量套餐管理信息 +type TSimFlowPackageInfoViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimFlowPackageInfoViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPackageInfoViewModel struct { + entity.TSimFlowPackageInfo + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者ID摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者ID摘要信息"` +} + +// TSimFlowPackageInfoListParam 获取SIM流量套餐管理列表 +type TSimFlowPackageInfoListParam struct { + request.PageInfo + PackageCode string `json:"packageCode" dc:"套餐编码"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + PackageType string `json:"packageType" dc:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + Enabled *int `json:"enabled" dc:"是否启用:0-否 1-是(yesno_enum)"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimFlowPackageInfoListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPackageInfoListModel struct { + Id int64 `json:"id" dc:"主键ID"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编码"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + PackageType int `json:"packageType" dc:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + BillingMethod string `json:"billingMethod" dc:"计费方式"` + SortNo int `json:"sortNo" dc:"排序号"` + FlowMb float64 `json:"flowMb" dc:"套餐流量(MB)"` + FlowGb float64 `json:"flowGb" dc:"套餐流量(GB)"` + Enabled int `json:"enabled" dc:"是否启用:0-否 1-是(yesno_enum)"` + ListPrice float64 `json:"listPrice" dc:"目录售价"` + CostPrice float64 `json:"costPrice" dc:"成本价"` + SysDefaultProfit float64 `json:"defaultProfit" dc:"默认利润"` + SysDefaultRatio float64 `json:"defaultRatio" dc:"默认系数"` + TerminalCost float64 `json:"terminalCost" dc:"终端成本"` + SysDefaultTerminalProfit float64 `json:"defaultTerminalProfit" dc:"默认终端利润"` + SysDefaultTerminalRatio float64 `json:"defaultTerminalRatio" dc:"默认终端系数"` + RenewableDurationConfig *gjson.Json `json:"renewableDurationConfig" dc:"可续费时长配置:[1,2,3]"` + DiscountRateConfig *gjson.Json `json:"discountRateConfig" dc:"折扣率配置:{\"duration\":1,\"rate\":100}"` + RenewablePackageCodes *gjson.Json `json:"renewablePackageCodes" dc:"可续费套餐编码列表"` + ChangeablePackageCodes *gjson.Json `json:"changeablePackageCodes" dc:"可变更套餐编码列表"` + TopupPackageCodes *gjson.Json `json:"topupPackageCodes" dc:"可订购加油包套餐编码列表"` + IsAutoRenew int `json:"isAutoRenew" dc:"是否自动续费"` + AutoRenewPackageId int64 `json:"autoRenewPackageId" dc:"自动续费套餐ID"` + AutoRenewYears int `json:"autoRenewYears" dc:"自动续费年限"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者ID摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者ID摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimFlowPackageInfoExportModel 导出SIM流量套餐管理 +type TSimFlowPackageInfoExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编码"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + PackageType int `json:"packageType" dc:"套餐类型:101-卡套餐 102-池套餐 103-单卡加油包 104-池卡加油包"` + BillingMethod string `json:"billingMethod" dc:"计费方式"` + SortNo int `json:"sortNo" dc:"排序号"` + FlowMb float64 `json:"flowMb" dc:"套餐流量(MB)"` + FlowGb float64 `json:"flowGb" dc:"套餐流量(GB)"` + Enabled int `json:"enabled" dc:"是否启用:0-否 1-是(yesno_enum)"` + ListPrice float64 `json:"listPrice" dc:"目录售价"` + CostPrice float64 `json:"costPrice" dc:"成本价"` + SysDefaultProfit float64 `json:"defaultProfit" dc:"默认利润"` + SysDefaultRatio float64 `json:"defaultRatio" dc:"默认系数"` + TerminalCost float64 `json:"terminalCost" dc:"终端成本"` + SysDefaultTerminalProfit float64 `json:"defaultTerminalProfit" dc:"默认终端利润"` + SysDefaultTerminalRatio float64 `json:"defaultTerminalRatio" dc:"默认终端系数"` + IsAutoRenew int `json:"isAutoRenew" dc:"是否自动续费"` + AutoRenewPackageId int64 `json:"autoRenewPackageId" dc:"自动续费套餐ID"` + AutoRenewYears int `json:"autoRenewYears" dc:"自动续费年限"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门ID"` + CreatedBy int64 `json:"createdBy" dc:"创建者ID"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者ID"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_sim_flow_package_price.go b/internal/model/t_sim_flow_package_price.go new file mode 100644 index 0000000..a3069f4 --- /dev/null +++ b/internal/model/t_sim_flow_package_price.go @@ -0,0 +1,141 @@ +// Package model contains SIM flow package pricing API models. +package model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +type TSimFlowPackagePriceAgentTreeParam struct{} + +type TSimFlowPackagePriceAgentTreeRes struct { + Items []*SysDeptTreeModel `json:"items" dc:"代理/公司树"` +} + +// TSimFlowPackagePriceAgentPackagePriceListParam 查询指定下级代理套餐生效定价参数 +type TSimFlowPackagePriceAgentPackagePriceListParam struct { + request.PageInfo + TargetAgentId int64 `json:"targetAgentId" dc:"指定下级代理ID"` + PackageCode string `json:"packageCode" dc:"套餐编码(可选)"` + PackageName string `json:"packageName" dc:"套餐名称(可选)"` +} + +func (in *TSimFlowPackagePriceAgentPackagePriceListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceSaveItem struct { + PriceSource string `json:"priceSource" dc:"价格来源:system/agentDefault"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"本级默认定价ID"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + AgentCostRatio float64 `json:"agentCostRatio" dc:"渠道成本系数"` + AgentCostProfit float64 `json:"agentCostProfit" dc:"渠道利润"` + TerminalCostRatio float64 `json:"terminalCostRatio" dc:"终端成本系数"` + TerminalCostProfit float64 `json:"terminalCostProfit" dc:"终端利润"` + Remark string `json:"remark" dc:"备注"` +} + +type TSimFlowPackagePriceAgentPackagePriceSaveItem struct { + PriceSource string `json:"priceSource" dc:"价格来源:system/agentDefault/target"` + TargetPriceId int64 `json:"targetPriceId" dc:"下级专属定价ID"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"本级默认定价ID"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + AgentCostRatio float64 `json:"agentCostRatio" dc:"渠道成本系数"` + AgentCostProfit float64 `json:"agentCostProfit" dc:"渠道利润"` + TerminalCostRatio float64 `json:"terminalCostRatio" dc:"终端成本系数"` + TerminalCostProfit float64 `json:"terminalCostProfit" dc:"终端利润"` + Remark string `json:"remark" dc:"备注"` +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceSaveParam struct { + Items []*TSimFlowPackagePriceAgentDefaultPackagePriceSaveItem `json:"items" dc:"保存项"` +} + +func (in *TSimFlowPackagePriceAgentDefaultPackagePriceSaveParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPackagePriceAgentPackagePriceSaveParam struct { + TargetAgentId int64 `json:"targetAgentId" dc:"指定下级代理ID"` + Items []*TSimFlowPackagePriceAgentPackagePriceSaveItem `json:"items" dc:"保存项"` +} + +func (in *TSimFlowPackagePriceAgentPackagePriceSaveParam) Filter(ctx context.Context) (err error) { + return +} + +// TSimFlowPackagePriceAgentPackagePriceListItem 查询指定下级代理套餐生效定价响应项 +type TSimFlowPackagePriceAgentPackagePriceListItem struct { + TargetAgentId int64 `json:"targetAgentId" dc:"目标代理ID"` + PackageCode string `json:"packageCode" dc:"套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"本级默认定价ID,没有则为0"` + TargetPriceId int64 `json:"targetPriceId" dc:"本级对当前下级代理的专属定价ID,没有则为0"` + PriceSource string `json:"priceSource" dc:"价格来源:system-系统级/agentDefault-本级默认/target-下级专属"` + + AgentCost float64 `json:"agentCost" dc:"代理成本"` + TerminalCost float64 `json:"terminalCost" dc:"终端成本"` + + AgentCostRatio float64 `json:"agentCostRatio" dc:"代理成本系数"` + AgentCostProfit float64 `json:"agentCostProfit" dc:"渠道利润"` + AgentShipmentPrice float64 `json:"agentShipmentPrice" dc:"渠道出货价"` + TerminalCostRatio float64 `json:"terminalCostRatio" dc:"终端成本系数"` + TerminalCostProfit float64 `json:"terminalCostProfit" dc:"终端利润"` + TerminalSalePrice float64 `json:"terminalSalePrice" dc:"终端售价"` + + Remark string `json:"remark" dc:"备注"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceListParam struct { + request.PageInfo + PackageCode string `json:"packageCode" dc:"套餐编码(可选)"` + PackageName string `json:"packageName" dc:"套餐名称(可选)"` +} + +func (in *TSimFlowPackagePriceAgentDefaultPackagePriceListParam) Filter(ctx context.Context) (err error) { + return +} + +// TSimFlowPackagePriceAgentDefaultPackagePriceListItem 查询本级默认套餐定价响应项 +type TSimFlowPackagePriceAgentDefaultPackagePriceListItem struct { + PackageCode string `json:"packageCode" dc:"套餐编码"` + PackageName string `json:"packageName" dc:"套餐名称"` + AgentDefaultPriceId int64 `json:"agentDefaultPriceId" dc:"本级默认定价ID,没有则为0"` + PriceSource string `json:"priceSource" dc:"价格来源:system-系统级/agentDefault-本级默认"` + AgentCost float64 `json:"agentCost" dc:"代理成本"` + TerminalCost float64 `json:"terminalCost" dc:"终端成本"` + AgentCostRatio float64 `json:"agentCostRatio" dc:"渠道成本系数"` + AgentCostProfit float64 `json:"agentCostProfit" dc:"渠道利润"` + AgentShipmentPrice float64 `json:"agentShipmentPrice" dc:"渠道出货价"` + TerminalCostRatio float64 `json:"terminalCostRatio" dc:"终端成本系数"` + TerminalCostProfit float64 `json:"terminalCostProfit" dc:"终端利润"` + TerminalSalePrice float64 `json:"terminalSalePrice" dc:"终端售价"` + Remark string `json:"remark" dc:"备注"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +type TSimFlowPackagePriceAgentDefaultPackagePricePackageItem struct { + PackageCode string `json:"packageCode"` + PackageName string `json:"packageName"` + CostPrice float64 `json:"costPrice"` + TerminalCost float64 `json:"terminalCost"` + SysDefaultRatio float64 `json:"sysDefaultRatio"` + SysDefaultProfit float64 `json:"sysDefaultProfit"` + SysDefaultTerminalRatio float64 `json:"sysDefaultTerminalRatio"` + SysDefaultTerminalProfit float64 `json:"sysDefaultTerminalProfit"` +} + +type TSimFlowPackagePriceAgentDefaultPackagePriceRecord struct { + Id int64 `json:"id"` + PackageCode string `json:"packageCode"` + AgentCostRatio float64 `json:"agentCostRatio"` + AgentCostProfit float64 `json:"agentCostProfit"` + UserCostRatio float64 `json:"userCostRatio"` + UserCostProfit float64 `json:"userCostProfit"` + Remark string `json:"remark"` + UpdatedAt *gtime.Time `json:"updatedAt"` +} diff --git a/internal/model/t_sim_flow_pool.go b/internal/model/t_sim_flow_pool.go new file mode 100644 index 0000000..5cd3e75 --- /dev/null +++ b/internal/model/t_sim_flow_pool.go @@ -0,0 +1,212 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimFlowPoolUpdateFields 修改流量池表字段过滤 +type TSimFlowPoolUpdateFields struct { + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + DeptId int64 `json:"deptId" dc:"客户编号"` + PackageCodes *gjson.Json `json:"packageCodes" dc:"套餐编号列表(冗余)"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + CardCount int64 `json:"cardCount" dc:"关联卡数量"` + CardFlowMb float64 `json:"cardFlowMb" dc:"套餐卡流量MB"` + PoolPackageFlowMb float64 `json:"poolPackageFlowMb" dc:"套内总流量MB"` + AddOnFlowMb float64 `json:"addOnFlowMb" dc:"加油包总流量MB"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"总流量MB(套内+加油包)"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已使用流量MB"` + RemainFlowMb float64 `json:"remainFlowMb" dc:"剩余流量MB"` + PoolStatus int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimFlowPoolInsertFields 新增流量池表字段过滤 +type TSimFlowPoolInsertFields struct { + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + DeptId int64 `json:"deptId" dc:"客户编号"` + PackageCodes *gjson.Json `json:"packageCodes" dc:"套餐编号列表(冗余)"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + CardCount int64 `json:"cardCount" dc:"关联卡数量"` + CardFlowMb float64 `json:"cardFlowMb" dc:"套餐卡流量MB"` + PoolPackageFlowMb float64 `json:"poolPackageFlowMb" dc:"套内总流量MB"` + AddOnFlowMb float64 `json:"addOnFlowMb" dc:"加油包总流量MB"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"总流量MB(套内+加油包)"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已使用流量MB"` + RemainFlowMb float64 `json:"remainFlowMb" dc:"剩余流量MB"` + PoolStatus int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimFlowPoolEditParam 修改/新增流量池表 +type TSimFlowPoolEditParam struct { + //entity.TSimFlowPool + Id int64 `json:"id" dc:"主键ID"` + FlowPoolCode *string `json:"flowPoolCode" dc:"流量池编号"` + DeptId *int64 `json:"deptId" dc:"客户编号"` + PackageCodes *gjson.Json `json:"packageCodes" dc:"套餐编号列表(冗余)"` + PoolPackageCode *int64 `json:"poolPackageCode" dc:"池套餐编码"` + CardCount *int64 `json:"cardCount" dc:"关联卡数量"` + CardFlowMb *float64 `json:"cardFlowMb" dc:"套餐卡流量MB"` + PoolPackageFlowMb *float64 `json:"poolPackageFlowMb" dc:"套内总流量MB"` + AddOnFlowMb *float64 `json:"addOnFlowMb" dc:"加油包总流量MB"` + TotalFlowMb *float64 `json:"totalFlowMb" dc:"总流量MB(套内+加油包)"` + UsedFlowMb *float64 `json:"usedFlowMb" dc:"已使用流量MB"` + RemainFlowMb *float64 `json:"remainFlowMb" dc:"剩余流量MB"` + PoolStatus *int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimFlowPoolEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimFlowPoolEditModel struct{} + +// TSimFlowPoolDeleteParam 删除流量池表 +type TSimFlowPoolDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +// CalculatePoolStatisticsReq 计算流量池统计数据请求 +type CalculatePoolStatisticsReq struct { + DeptId int64 `json:"deptId" dc:"客户编号"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + CardCodes102 []string `json:"cardCodes102" dc:"102套餐编码列表"` + CardCodes104 []string `json:"cardCodes104" dc:"104加油包套餐编码列表"` +} + +// CalculatePoolStatisticsRes 计算流量池统计数据响应 +type CalculatePoolStatisticsRes struct { + TotalCardCount int64 `json:"totalCardCount" dc:"总卡数量"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"总流量MB"` + AddOnFlowMb float64 `json:"addOnFlowMb" dc:"加油包流量MB"` + PoolPackageFlowMb float64 `json:"poolPackageFlowMb" dc:"套内总流量MB"` + TotalUsedFlowMb float64 `json:"totalUsedFlowMb" dc:"总已用流量MB"` + RemainFlowMb float64 `json:"remainFlowMb" dc:"剩余流量MB"` + PoolStatus int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + CardFlowMb float64 `json:"cardFlowMb" dc:"单卡流量MB(取第一张卡)"` +} + +func (in *TSimFlowPoolDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPoolDeleteModel struct{} + +// TSimFlowPoolViewParam 获取指定流量池表信息 +type TSimFlowPoolViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimFlowPoolViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPoolViewModel struct { + entity.TSimFlowPool + DeptName string `json:"deptName" dc:"客户名称"` + PoolPackageName string `json:"poolPackageName" dc:"池套餐名称"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimFlowPoolListParam 获取流量池表列表 +type TSimFlowPoolListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + DeptId int64 `json:"deptId" dc:"客户编号"` + PoolStatus *int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` +} + +func (in *TSimFlowPoolListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimFlowPoolListModel struct { + Id int64 `json:"id" dc:"主键ID"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + DeptId int64 `json:"deptId" dc:"客户编号"` + DeptName string `json:"deptName" dc:"客户名称"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + PoolPackageName string `json:"poolPackageName" dc:"池套餐名称"` + CardCount int64 `json:"cardCount" dc:"关联卡数量"` + CardFlowMb float64 `json:"cardFlowMb" dc:"套餐卡流量MB"` + PoolPackageFlowMb float64 `json:"poolPackageFlowMb" dc:"套内总流量MB"` + AddOnFlowMb float64 `json:"addOnFlowMb" dc:"加油包总流量MB"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"总流量MB(套内+加油包)"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已使用流量MB"` + RemainFlowMb float64 `json:"remainFlowMb" dc:"剩余流量MB"` + PoolStatus int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// GetCardsByPackageCodesParam 根据套餐编码列表获取卡列表请求 +type GetCardsByPackageCodesParam struct { + PageSize int `json:"pageSize" dc:"每页大小"` + Page int `json:"page" dc:"页码"` + Iccid string `json:"iccid" dc:"ICCID"` + ChanKey string `json:"chanKey" dc:"通道编号"` + BossCardStatus *int `json:"bossCardStatus" dc:"运营商卡状态"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + PackageCodes []string `json:"packageCodes" dc:"套餐编码列表"` + DeptId int64 `json:"deptId" dc:"部门ID"` +} + +// TSimFlowPoolExportModel 导出流量池表 +type TSimFlowPoolExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + FlowPoolCode string `json:"flowPoolCode" dc:"流量池编号"` + DeptId int64 `json:"deptId" dc:"客户编号"` + PoolPackageCode int64 `json:"poolPackageCode" dc:"池套餐编码"` + CardCount int64 `json:"cardCount" dc:"关联卡数量"` + CardFlowMb float64 `json:"cardFlowMb" dc:"套餐卡流量MB"` + PoolPackageFlowMb float64 `json:"poolPackageFlowMb" dc:"套内总流量MB"` + AddOnFlowMb float64 `json:"addOnFlowMb" dc:"加油包总流量MB"` + TotalFlowMb float64 `json:"totalFlowMb" dc:"总流量MB(套内+加油包)"` + UsedFlowMb float64 `json:"usedFlowMb" dc:"已使用流量MB"` + RemainFlowMb float64 `json:"remainFlowMb" dc:"剩余流量MB"` + PoolStatus int `json:"poolStatus" dc:"状态:0 正常、1 停用、2 锁定"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_sim_package_category.go b/internal/model/t_sim_package_category.go new file mode 100644 index 0000000..8e8a269 --- /dev/null +++ b/internal/model/t_sim_package_category.go @@ -0,0 +1,131 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPackageCategoryUpdateFields 修改套餐分类表字段过滤 +type TSimPackageCategoryUpdateFields struct { + CategoryCode string `json:"categoryCode" dc:"套餐分类编号"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + SortNo int `json:"sortNo" dc:"排序"` + Enabled int `json:"enabled" dc:"是否启用"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimPackageCategoryInsertFields 新增套餐分类表字段过滤 +type TSimPackageCategoryInsertFields struct { + CategoryCode string `json:"categoryCode" dc:"套餐分类编号"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + SortNo int `json:"sortNo" dc:"排序"` + Enabled int `json:"enabled" dc:"是否启用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimPackageCategoryEditParam 修改/新增套餐分类表 +type TSimPackageCategoryEditParam struct { + //entity.TSimPackageCategory + Id int64 `json:"id" dc:"主键ID"` + CategoryCode *string `json:"categoryCode" dc:"套餐分类编号"` + CategoryName *string `json:"categoryName" dc:"套餐分类名称"` + SortNo *int `json:"sortNo" dc:"排序"` + Enabled *int `json:"enabled" dc:"是否启用"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimPackageCategoryEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimPackageCategoryEditModel struct{} + +// TSimPackageCategoryDeleteParam 删除套餐分类表 +type TSimPackageCategoryDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimPackageCategoryDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimPackageCategoryDeleteModel struct{} + +// TSimPackageCategoryViewParam 获取指定套餐分类表信息 +type TSimPackageCategoryViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimPackageCategoryViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimPackageCategoryViewModel struct { + entity.TSimPackageCategory + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimPackageCategoryListParam 获取套餐分类表列表 +type TSimPackageCategoryListParam struct { + request.PageInfo + CategoryCode string `json:"categoryCode" dc:"套餐分类编号"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + Enabled *int `json:"enabled" dc:"是否启用"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimPackageCategoryListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimPackageCategoryListModel struct { + Id int64 `json:"id" dc:"主键ID"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编号"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + SortNo int `json:"sortNo" dc:"排序"` + Enabled int `json:"enabled" dc:"是否启用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimPackageCategoryExportModel 导出套餐分类表 +type TSimPackageCategoryExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + CategoryCode string `json:"categoryCode" dc:"套餐分类编号"` + CategoryName string `json:"categoryName" dc:"套餐分类名称"` + SortNo int `json:"sortNo" dc:"排序"` + Enabled int `json:"enabled" dc:"是否启用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_sim_pool_warn_config.go b/internal/model/t_sim_pool_warn_config.go new file mode 100644 index 0000000..8788149 --- /dev/null +++ b/internal/model/t_sim_pool_warn_config.go @@ -0,0 +1,153 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TSimPoolWarnConfigUpdateFields 修改流量池预警配置表字段过滤 +type TSimPoolWarnConfigUpdateFields struct { + PoolId int64 `json:"poolId" dc:"流量池ID"` + WarnLevel int `json:"warnLevel" dc:"预警等级:1提示,2注意,3警告,4危险,5紧急"` + ThresholdPercent float64 `json:"thresholdPercent" dc:"阈值(例如0.7)"` + WarnMethods int `json:"warnMethods" dc:"预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔"` + WarnPhones string `json:"warnPhones" dc:"预警手机号 多个逗号分隔"` + WarnEmails string `json:"warnEmails" dc:"预警邮箱 多个逗号分隔"` + AutoAction int `json:"autoAction" dc:"自动动作:0无,1限速,2断网"` + IsEnabled int `json:"isEnabled" dc:"是否启用:1启用,0停用"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimPoolWarnConfigInsertFields 新增流量池预警配置表字段过滤 +type TSimPoolWarnConfigInsertFields struct { + PoolId int64 `json:"poolId" dc:"流量池ID"` + WarnLevel int `json:"warnLevel" dc:"预警等级:1提示,2注意,3警告,4危险,5紧急"` + ThresholdPercent float64 `json:"thresholdPercent" dc:"阈值(例如0.7)"` + WarnMethods int `json:"warnMethods" dc:"预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔"` + WarnPhones string `json:"warnPhones" dc:"预警手机号 多个逗号分隔"` + WarnEmails string `json:"warnEmails" dc:"预警邮箱 多个逗号分隔"` + AutoAction int `json:"autoAction" dc:"自动动作:0无,1限速,2断网"` + IsEnabled int `json:"isEnabled" dc:"是否启用:1启用,0停用"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TSimPoolWarnConfigEditParam 修改/新增流量池预警配置表 +type TSimPoolWarnConfigEditParam struct { + //entity.TSimPoolWarnConfig + Id int64 `json:"id" dc:"主键ID"` + PoolId *int64 `json:"poolId" dc:"流量池ID"` + WarnLevel *int `json:"warnLevel" dc:"预警等级:1提示,2注意,3警告,4危险,5紧急"` + ThresholdPercent *float64 `json:"thresholdPercent" dc:"阈值(例如0.7)"` + WarnMethods *int `json:"warnMethods" dc:"预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔"` + WarnPhones *string `json:"warnPhones" dc:"预警手机号 多个逗号分隔"` + WarnEmails *string `json:"warnEmails" dc:"预警邮箱 多个逗号分隔"` + AutoAction *int `json:"autoAction" dc:"自动动作:0无,1限速,2断网"` + IsEnabled *int `json:"isEnabled" dc:"是否启用:1启用,0停用"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TSimPoolWarnConfigEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TSimPoolWarnConfigEditModel struct{} + +// TSimPoolWarnConfigDeleteParam 删除流量池预警配置表 +type TSimPoolWarnConfigDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimPoolWarnConfigDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimPoolWarnConfigDeleteModel struct{} + +// TSimPoolWarnConfigViewParam 获取指定流量池预警配置表信息 +type TSimPoolWarnConfigViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TSimPoolWarnConfigViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimPoolWarnConfigViewModel struct { + entity.TSimPoolWarnConfig + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TSimPoolWarnConfigListParam 获取流量池预警配置表列表 +type TSimPoolWarnConfigListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TSimPoolWarnConfigListParam) Filter(ctx context.Context) (err error) { + return +} + +type TSimPoolWarnConfigListModel struct { + Id int64 `json:"id" dc:"主键ID"` + PoolId int64 `json:"poolId" dc:"流量池ID"` + WarnLevel int `json:"warnLevel" dc:"预警等级:1提示,2注意,3警告,4危险,5紧急"` + ThresholdPercent float64 `json:"thresholdPercent" dc:"阈值(例如0.7)"` + WarnMethods int `json:"warnMethods" dc:"预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔"` + WarnPhones string `json:"warnPhones" dc:"预警手机号 多个逗号分隔"` + WarnEmails string `json:"warnEmails" dc:"预警邮箱 多个逗号分隔"` + AutoAction int `json:"autoAction" dc:"自动动作:0无,1限速,2断网"` + IsEnabled int `json:"isEnabled" dc:"是否启用:1启用,0停用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TSimPoolWarnConfigExportModel 导出流量池预警配置表 +type TSimPoolWarnConfigExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + PoolId int64 `json:"poolId" dc:"流量池ID"` + WarnLevel int `json:"warnLevel" dc:"预警等级:1提示,2注意,3警告,4危险,5紧急"` + ThresholdPercent float64 `json:"thresholdPercent" dc:"阈值(例如0.7)"` + WarnMethods int `json:"warnMethods" dc:"预警方式:0短信,1邮箱,2电话,3平台消息 多选逗号分隔"` + WarnPhones string `json:"warnPhones" dc:"预警手机号 多个逗号分隔"` + WarnEmails string `json:"warnEmails" dc:"预警邮箱 多个逗号分隔"` + AutoAction int `json:"autoAction" dc:"自动动作:0无,1限速,2断网"` + IsEnabled int `json:"isEnabled" dc:"是否启用:1启用,0停用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_tplatform_setting.go b/internal/model/t_tplatform_setting.go new file mode 100644 index 0000000..19f370a --- /dev/null +++ b/internal/model/t_tplatform_setting.go @@ -0,0 +1,195 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" +) + +// TTplatformSettingUpdateFields 修改二级域名站点个性化配置表字段过滤 +type TTplatformSettingUpdateFields struct { + SubDomain string `json:"subDomain" dc:"二级域名前缀"` + FullDomain string `json:"fullDomain" dc:"完整域名"` + AppTitle string `json:"appTitle" dc:"平台标题"` + AppIcon string `json:"appIcon" dc:"图标地址"` + LoginPageTitle string `json:"loginPageTitle" dc:"登录页大标题"` + LoginPageDescription string `json:"loginPageDescription" dc:"登录页描述文案"` + LoginSloganImage string `json:"loginSloganImage" dc:"登录标语图地址"` + Sort int `json:"sort" dc:"排序"` + Status int `json:"status" dc:"状态 0启用 1禁用"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TTplatformSettingInsertFields 新增二级域名站点个性化配置表字段过滤 +type TTplatformSettingInsertFields struct { + SubDomain string `json:"subDomain" dc:"二级域名前缀"` + FullDomain string `json:"fullDomain" dc:"完整域名"` + AppTitle string `json:"appTitle" dc:"平台标题"` + AppIcon string `json:"appIcon" dc:"图标地址"` + LoginPageTitle string `json:"loginPageTitle" dc:"登录页大标题"` + LoginPageDescription string `json:"loginPageDescription" dc:"登录页描述文案"` + LoginSloganImage string `json:"loginSloganImage" dc:"登录标语图地址"` + Sort int `json:"sort" dc:"排序"` + Status int `json:"status" dc:"状态 0启用 1禁用"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TTplatformSettingEditParam 修改/新增二级域名站点个性化配置表 +type TTplatformSettingEditParam struct { + //entity.TTplatformSetting + Id int64 `json:"id" dc:"主键ID"` + SubDomain *string `json:"subDomain" dc:"二级域名前缀"` + FullDomain *string `json:"fullDomain" dc:"完整域名"` + AppTitle *string `json:"appTitle" dc:"平台标题"` + AppIcon *string `json:"appIcon" dc:"图标地址"` + LoginPageTitle *string `json:"loginPageTitle" dc:"登录页大标题"` + LoginPageDescription *string `json:"loginPageDescription" dc:"登录页描述文案"` + LoginSloganImage *string `json:"loginSloganImage" dc:"登录标语图地址"` + Sort *int `json:"sort" dc:"排序"` + Status *int `json:"status" dc:"状态 0启用 1禁用"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TTplatformSettingEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TTplatformSettingEditModel struct{} + +// TTplatformSettingDeleteParam 删除二级域名站点个性化配置表 +type TTplatformSettingDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TTplatformSettingDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TTplatformSettingDeleteModel struct{} + +// TTplatformSettingViewParam 获取指定二级域名站点个性化配置表信息 +type TTplatformSettingViewParam struct { + FullDomain string `json:"fullDomain" dc:"完整域名"` +} + +func (in *TTplatformSettingViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TTplatformSettingViewModel struct { + entity.TTplatformSetting + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TTplatformSettingListParam 获取二级域名站点个性化配置表列表 +type TTplatformSettingListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + Status int `json:"status" dc:"状态 0启用 1禁用"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TTplatformSettingListParam) Filter(ctx context.Context) (err error) { + return +} + +type TTplatformSettingListModel struct { + Id int64 `json:"id" dc:"主键ID"` + SubDomain string `json:"subDomain" dc:"二级域名前缀"` + FullDomain string `json:"fullDomain" dc:"完整域名"` + AppTitle string `json:"appTitle" dc:"平台标题"` + LoginPageTitle string `json:"loginPageTitle" dc:"登录页大标题"` + LoginPageDescription string `json:"loginPageDescription" dc:"登录页描述文案"` + LoginSloganImage string `json:"loginSloganImage" dc:"登录标语图地址"` + Sort int `json:"sort" dc:"排序"` + Status int `json:"status" dc:"状态 0启用 1禁用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TTplatformSettingExportModel 导出二级域名站点个性化配置表 +type TTplatformSettingExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + SubDomain string `json:"subDomain" dc:"二级域名前缀"` + FullDomain string `json:"fullDomain" dc:"完整域名"` + AppTitle string `json:"appTitle" dc:"平台标题"` + LoginPageTitle string `json:"loginPageTitle" dc:"登录页大标题"` + Sort int `json:"sort" dc:"排序"` + Status int `json:"status" dc:"状态 0启用 1禁用"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TTplatformSettingMaxSortParam 获取二级域名站点个性化配置表最大排序 +type TTplatformSettingMaxSortParam struct{} + +func (in *TTplatformSettingMaxSortParam) Filter(ctx context.Context) (err error) { + return +} + +type TTplatformSettingMaxSortModel struct { + Sort int `json:"sort" description:"排序"` +} + +// TTplatformSettingStatusParam 更新二级域名站点个性化配置表状态 +type TTplatformSettingStatusParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` + Status int `json:"status" dc:"状态"` +} + +func (in *TTplatformSettingStatusParam) Filter(ctx context.Context) (err error) { + if in.Id <= 0 { + err = gerror.New("主键ID不能为空") + return + } + + if in.Status <= 0 { + err = gerror.New("状态不能为空") + return + } + + if !slices.Contains(consts.StatusSlice, in.Status) { + err = gerror.New("状态不正确") + return + } + return +} + +type TTplatformSettingStatusModel struct{} diff --git a/internal/model/t_upstream_package.go b/internal/model/t_upstream_package.go new file mode 100644 index 0000000..c2e7c28 --- /dev/null +++ b/internal/model/t_upstream_package.go @@ -0,0 +1,131 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TUpstreamPackageUpdateFields 修改上游套餐表字段过滤 +type TUpstreamPackageUpdateFields struct { + UpPkgCode string `json:"upPkgCode" dc:"上游套餐编码"` + UpPkgName string `json:"upPkgName" dc:"上游套餐名称"` + Operator int `json:"operator" dc:"运营商:1移动,2联通,3电信"` + ApnName string `json:"apnName" dc:"APN名称"` + Remark string `json:"remark" dc:"备注"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` +} + +// TUpstreamPackageInsertFields 新增上游套餐表字段过滤 +type TUpstreamPackageInsertFields struct { + UpPkgCode string `json:"upPkgCode" dc:"上游套餐编码"` + UpPkgName string `json:"upPkgName" dc:"上游套餐名称"` + Operator int `json:"operator" dc:"运营商:1移动,2联通,3电信"` + ApnName string `json:"apnName" dc:"APN名称"` + Remark string `json:"remark" dc:"备注"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` +} + +// TUpstreamPackageEditParam 修改/新增上游套餐表 +type TUpstreamPackageEditParam struct { + //entity.TUpstreamPackage + Id int64 `json:"id" dc:"主键"` + UpPkgCode *string `json:"upPkgCode" dc:"上游套餐编码"` + UpPkgName *string `json:"upPkgName" dc:"上游套餐名称"` + Operator *int `json:"operator" dc:"运营商:1移动,2联通,3电信"` + ApnName *string `json:"apnName" dc:"APN名称"` + Remark *string `json:"remark" dc:"备注"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` +} + +func (in *TUpstreamPackageEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TUpstreamPackageEditModel struct{} + +// TUpstreamPackageDeleteParam 删除上游套餐表 +type TUpstreamPackageDeleteParam struct { + Id interface{} `json:"id" v:"required#主键不能为空" dc:"主键"` +} + +func (in *TUpstreamPackageDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TUpstreamPackageDeleteModel struct{} + +// TUpstreamPackageViewParam 获取指定上游套餐表信息 +type TUpstreamPackageViewParam struct { + Id int64 `json:"id" v:"required#主键不能为空" dc:"主键"` +} + +func (in *TUpstreamPackageViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TUpstreamPackageViewModel struct { + entity.TUpstreamPackage + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TUpstreamPackageListParam 获取上游套餐表列表 +type TUpstreamPackageListParam struct { + request.PageInfo + UpPkgCode string `json:"upPkgCode" dc:"上游套餐编码"` + UpPkgName string `json:"upPkgName" dc:"上游套餐名称"` + Operator int `json:"operator" dc:"运营商:1移动,2联通,3电信"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TUpstreamPackageListParam) Filter(ctx context.Context) (err error) { + return +} + +type TUpstreamPackageListModel struct { + Id int64 `json:"id" dc:"主键"` + UpPkgCode string `json:"upPkgCode" dc:"上游套餐编码"` + UpPkgName string `json:"upPkgName" dc:"上游套餐名称"` + Operator int `json:"operator" dc:"运营商:1移动,2联通,3电信"` + ApnName string `json:"apnName" dc:"APN名称"` + Remark string `json:"remark" dc:"备注"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TUpstreamPackageExportModel 导出上游套餐表 +type TUpstreamPackageExportModel struct { + Id int64 `json:"id" dc:"主键"` + UpPkgCode string `json:"upPkgCode" dc:"上游套餐编码"` + UpPkgName string `json:"upPkgName" dc:"上游套餐名称"` + Operator int `json:"operator" dc:"运营商:1移动,2联通,3电信"` + ApnName string `json:"apnName" dc:"APN名称"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` +} diff --git a/internal/model/t_wo_communication.go b/internal/model/t_wo_communication.go new file mode 100644 index 0000000..88db802 --- /dev/null +++ b/internal/model/t_wo_communication.go @@ -0,0 +1,165 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoCommunicationUpdateFields 修改工单问题沟通表字段过滤 +type TWoCommunicationUpdateFields struct { + CommNo string `json:"commNo" dc:"沟通编号"` + WoId int64 `json:"woId" dc:"工单ID"` + WoNo string `json:"woNo" dc:"工单编号"` + CommType int `json:"commType" dc:"沟通类型:0回复,1反馈"` + SenderType int `json:"senderType" dc:"发送人类型:1终端用户,2代理商"` + SenderDeptId int64 `json:"senderDeptId" dc:"发送人机构ID"` + SenderUserId int64 `json:"senderUserId" dc:"发送人用户ID"` + SenderName string `json:"senderName" dc:"发送人姓名"` + Content string `json:"content" dc:"沟通内容"` + AttachmentUrls *gjson.Json `json:"attachmentUrls" dc:"附件URL列表"` + CommTime *gtime.Time `json:"commTime" dc:"沟通时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TWoCommunicationInsertFields 新增工单问题沟通表字段过滤 +type TWoCommunicationInsertFields struct { + CommNo string `json:"commNo" dc:"沟通编号"` + WoId int64 `json:"woId" dc:"工单ID"` + WoNo string `json:"woNo" dc:"工单编号"` + CommType int `json:"commType" dc:"沟通类型:0回复,1反馈"` + SenderType int `json:"senderType" dc:"发送人类型:1终端用户,2代理商"` + SenderDeptId int64 `json:"senderDeptId" dc:"发送人机构ID"` + SenderUserId int64 `json:"senderUserId" dc:"发送人用户ID"` + SenderName string `json:"senderName" dc:"发送人姓名"` + Content string `json:"content" dc:"沟通内容"` + AttachmentUrls *gjson.Json `json:"attachmentUrls" dc:"附件URL列表"` + CommTime *gtime.Time `json:"commTime" dc:"沟通时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TWoCommunicationEditParam 修改/新增工单问题沟通表 +type TWoCommunicationEditParam struct { + //entity.TWoCommunication + Id int64 `json:"id" dc:"主键ID"` + CommNo *string `json:"commNo" dc:"沟通编号"` + WoId *int64 `json:"woId" dc:"工单ID"` + WoNo *string `json:"woNo" dc:"工单编号"` + CommType *int `json:"commType" dc:"沟通类型:0回复,1反馈"` + SenderType *int `json:"senderType" dc:"发送人类型:1终端用户,2代理商"` + SenderDeptId *int64 `json:"senderDeptId" dc:"发送人机构ID"` + SenderUserId *int64 `json:"senderUserId" dc:"发送人用户ID"` + SenderName *string `json:"senderName" dc:"发送人姓名"` + Content *string `json:"content" dc:"沟通内容"` + AttachmentUrls *gjson.Json `json:"attachmentUrls" dc:"附件URL列表"` + CommTime *gtime.Time `json:"commTime" dc:"沟通时间"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TWoCommunicationEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TWoCommunicationEditModel struct{} + +// TWoCommunicationDeleteParam 删除工单问题沟通表 +type TWoCommunicationDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TWoCommunicationDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoCommunicationDeleteModel struct{} + +// TWoCommunicationViewParam 获取指定工单问题沟通表信息 +type TWoCommunicationViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TWoCommunicationViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoCommunicationViewModel struct { + entity.TWoCommunication + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TWoCommunicationListParam 获取工单问题沟通表列表 +type TWoCommunicationListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + WoNo string `json:"woNo" dc:"工单编号"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` +} + +func (in *TWoCommunicationListParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoCommunicationListModel struct { + Id int64 `json:"id" dc:"主键ID"` + CommNo string `json:"commNo" dc:"沟通编号"` + WoId int64 `json:"woId" dc:"工单ID"` + WoNo string `json:"woNo" dc:"工单编号"` + CommType int `json:"commType" dc:"沟通类型:0回复,1反馈"` + SenderType int `json:"senderType" dc:"发送人类型:1终端用户,2代理商"` + SenderDeptId int64 `json:"senderDeptId" dc:"发送人机构ID"` + SenderUserId int64 `json:"senderUserId" dc:"发送人用户ID"` + Content string `json:"content" dc:"沟通内容"` + AttachmentUrls *gjson.Json `json:"attachmentUrls" dc:"附件URL列表"` + SenderName string `json:"senderName" dc:"发送人姓名"` + CommTime *gtime.Time `json:"commTime" dc:"沟通时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TWoCommunicationExportModel 导出工单问题沟通表 +type TWoCommunicationExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + CommNo string `json:"commNo" dc:"沟通编号"` + WoId int64 `json:"woId" dc:"工单ID"` + WoNo string `json:"woNo" dc:"工单编号"` + CommType int `json:"commType" dc:"沟通类型:0回复,1反馈"` + SenderType int `json:"senderType" dc:"发送人类型:1终端用户,2代理商"` + SenderDeptId int64 `json:"senderDeptId" dc:"发送人机构ID"` + SenderUserId int64 `json:"senderUserId" dc:"发送人用户ID"` + SenderName string `json:"senderName" dc:"发送人姓名"` + CommTime *gtime.Time `json:"commTime" dc:"沟通时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_wo_main.go b/internal/model/t_wo_main.go new file mode 100644 index 0000000..95f6d19 --- /dev/null +++ b/internal/model/t_wo_main.go @@ -0,0 +1,289 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoMainUpdateFields 修改工单主表字段过滤 +type TWoMainUpdateFields struct { + WoNo string `json:"woNo" dc:"工单编号"` + WoType int `json:"woType" dc:"工单类型 枚举"` + Title string `json:"title" dc:"工单标题"` + Content string `json:"content" dc:"问题描述"` + Attachment string `json:"attachment" dc:"附件"` + CreatorType int `json:"creatorType" dc:"创建人类型:1终端用户,2代理商,3客服"` + CreatorDeptId int64 `json:"creatorDeptId" dc:"创建人机构ID"` + CreatorUserId int64 `json:"creatorUserId" dc:"创建人用户ID"` + CreatorName string `json:"creatorName" dc:"创建人姓名"` + CurrentStatus int `json:"currentStatus" dc:"当前处理状态:0已分派,1处理中,2待反馈,3已反馈,4待确认,5已确认,6已关闭,7已废除"` + HandlerDeptId int64 `json:"handlerDeptId" dc:"处理方机构ID"` + HandlerUserId int64 `json:"handlerUserId" dc:"处理人用户ID"` + HandlerName string `json:"handlerName" dc:"处理人姓名"` + RelatedType int `json:"relatedType" dc:"关联业务类型:0卡,1套餐,2订单,3系统"` + RelatedId int64 `json:"relatedId" dc:"关联业务ID"` + FirstResponseTime *gtime.Time `json:"firstResponseTime" dc:"首次响应时间"` + ResolveTime *gtime.Time `json:"resolveTime" dc:"解决时间"` + CloseTime *gtime.Time `json:"closeTime" dc:"关闭时间"` + SatisfactionLevel int `json:"satisfactionLevel" dc:"满意度:1-5分"` + EvalContent string `json:"evalContent" dc:"评价内容"` + EvalTime *gtime.Time `json:"evalTime" dc:"评价时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TWoMainInsertFields 新增工单主表字段过滤 +type TWoMainInsertFields struct { + WoNo string `json:"woNo" dc:"工单编号"` + WoType int `json:"woType" dc:"工单类型 枚举"` + Title string `json:"title" dc:"工单标题"` + Content string `json:"content" dc:"问题描述"` + Attachment string `json:"attachment" dc:"附件"` + CreatorType int `json:"creatorType" dc:"创建人类型:1终端用户,2代理商,3客服"` + CreatorDeptId int64 `json:"creatorDeptId" dc:"创建人机构ID"` + CreatorUserId int64 `json:"creatorUserId" dc:"创建人用户ID"` + CreatorName string `json:"creatorName" dc:"创建人姓名"` + CreatorPhone string `json:"creatorPhone" dc:"创建人手机号"` + CurrentStatus int `json:"currentStatus" dc:"当前处理状态:0已分派,1处理中,2待反馈,3已反馈,4待确认,5已确认,6已关闭,7已废除"` + HandlerDeptId int64 `json:"handlerDeptId" dc:"处理方机构ID"` + HandlerUserId int64 `json:"handlerUserId" dc:"处理人用户ID"` + HandlerName string `json:"handlerName" dc:"处理人姓名"` + RelatedType int `json:"relatedType" dc:"关联业务类型:0卡,1套餐,2订单,3系统"` + RelatedId int64 `json:"relatedId" dc:"关联业务ID"` + FirstResponseTime *gtime.Time `json:"firstResponseTime" dc:"首次响应时间"` + ResolveTime *gtime.Time `json:"resolveTime" dc:"解决时间"` + CloseTime *gtime.Time `json:"closeTime" dc:"关闭时间"` + SatisfactionLevel int `json:"satisfactionLevel" dc:"满意度:1-5分"` + EvalContent string `json:"evalContent" dc:"评价内容"` + EvalTime *gtime.Time `json:"evalTime" dc:"评价时间"` + Remark string `json:"remark" dc:"备注"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TWoMainEditParam 修改/新增工单主表 +type TWoMainEditParam struct { + //entity.TWoMain + Id int64 `json:"id" dc:"主键ID"` + WoNo *string `json:"woNo" dc:"工单编号"` + WoType *int `json:"woType" dc:"工单类型 枚举"` + Title *string `json:"title" dc:"工单标题"` + Content *string `json:"content" dc:"问题描述"` + File *ghttp.UploadFile `json:"file" dc:"工单附件文件"` + Attachment *string `json:"attachment" dc:"附件"` + AttachmentUrls []string `json:"attachmentUrls" dc:"附件URL列表"` + CreatorType *int `json:"creatorType" dc:"创建人类型:1终端用户,2代理商,3客服"` + CreatorDeptId *int64 `json:"creatorDeptId" dc:"创建人机构ID"` + CreatorUserId *int64 `json:"creatorUserId" dc:"创建人用户ID"` + CreatorName *string `json:"creatorName" dc:"创建人姓名"` + CreatorPhone *string `json:"creatorPhone" dc:"创建人手机号"` + CurrentStatus *int `json:"currentStatus" dc:"当前处理状态:0已分派,1处理中,2待反馈,3已反馈,4待确认,5已确认,6已关闭,7已废除"` + AssignDeptId *int64 `json:"assignDeptId" dc:"分派机构ID"` + AssignUserId *int64 `json:"assignUserId" dc:"分派人用户ID"` + HandlerDeptId *int64 `json:"handlerDeptId" dc:"处理方机构ID"` + HandlerUserId *int64 `json:"handlerUserId" dc:"处理人用户ID"` + HandlerName *string `json:"handlerName" dc:"处理人姓名"` + RelatedType *int `json:"relatedType" dc:"关联业务类型:0卡,1套餐,2订单,3系统"` + RelatedId *int64 `json:"relatedId" dc:"关联业务ID"` + FirstResponseTime *gtime.Time `json:"firstResponseTime" dc:"首次响应时间"` + ResolveTime *gtime.Time `json:"resolveTime" dc:"解决时间"` + CloseTime *gtime.Time `json:"closeTime" dc:"关闭时间"` + SatisfactionLevel *int `json:"satisfactionLevel" dc:"满意度:1-5分"` + EvalContent *string `json:"evalContent" dc:"评价内容"` + EvalTime *gtime.Time `json:"evalTime" dc:"评价时间"` + Remark *string `json:"remark" dc:"备注"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TWoMainEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TWoMainEditModel struct{} + +type TWoMainMessageParam struct { + WoNo string `json:"woNo" v:"required#工单编号不能为空" dc:"工单编号"` + CommType int `json:"commType" dc:"沟通类型:0回复,1反馈"` + Content string `json:"content" v:"required#内容不能为空" dc:"内容"` + File *ghttp.UploadFile `json:"file" dc:"附件文件"` + AttachmentUrls []string `json:"attachmentUrls" dc:"附件URL列表"` +} + +func (in *TWoMainMessageParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainMessageModel struct{} + +type TWoMainTransferParam struct { + WoNo string `json:"woNo" v:"required#工单编号不能为空" dc:"工单编号"` +} + +func (in *TWoMainTransferParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainTransferModel struct{} + +type TWoMainResolveParam struct { + WoNo string `json:"woNo" v:"required#工单编号不能为空" dc:"工单编号"` +} + +func (in *TWoMainResolveParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainResolveModel struct{} + +type TWoMainCancelParam struct { + WoNo string `json:"woNo" v:"required#工单编号不能为空" dc:"工单编号"` +} + +func (in *TWoMainCancelParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainCancelModel struct{} + +type TWoMainCloseParam struct { + WoNo string `json:"woNo" v:"required#工单编号不能为空" dc:"工单编号"` +} + +func (in *TWoMainCloseParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainCloseModel struct{} + +type TWoMainEvaluateParam struct { + WoNo string `json:"woNo" v:"required#工单编号不能为空" dc:"工单编号"` + SatisfactionLevel int `json:"satisfactionLevel" v:"required#满意度不能为空" dc:"满意度:1-5分"` + EvalContent string `json:"evalContent" dc:"评价内容"` +} + +func (in *TWoMainEvaluateParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainEvaluateModel struct{} + +// TWoMainDeleteParam 删除工单主表 +type TWoMainDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TWoMainDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainDeleteModel struct{} + +// TWoMainViewParam 获取指定工单主表信息 +type TWoMainViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TWoMainViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainViewModel struct { + entity.TWoMain + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TWoMainListParam 获取工单主表列表 +type TWoMainListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + CurrentStatus int `json:"currentStatus" dc:"当前处理状态:0已分派,1处理中,2待反馈,3已反馈,4待确认,5已确认,6已关闭,7已废除"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` + WoNo string `json:"woNo" dc:"工单编号"` + WoType int `json:"woType" dc:"工单类型 枚举"` +} + +func (in *TWoMainListParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoMainListModel struct { + Id int64 `json:"id" dc:"主键ID"` + WoNo string `json:"woNo" dc:"工单编号"` + WoType int `json:"woType" dc:"工单类型 枚举"` + Title string `json:"title" dc:"工单标题"` + Attachment string `json:"attachment" dc:"附件"` + CreatorType int `json:"creatorType" dc:"创建人类型:1终端用户,2代理商,3客服"` + CreatorDeptId int64 `json:"creatorDeptId" dc:"创建人机构ID"` + CreatorUserId int64 `json:"creatorUserId" dc:"创建人用户ID"` + CreatorName string `json:"creatorName" dc:"创建人姓名"` + CurrentStatus int `json:"currentStatus" dc:"当前处理状态:0已分派,1处理中,2待反馈,3已反馈,4待确认,5已确认,6已关闭,7已废除"` + HandlerDeptId int64 `json:"handlerDeptId" dc:"处理方机构ID"` + HandlerUserId int64 `json:"handlerUserId" dc:"处理人用户ID"` + HandlerName string `json:"handlerName" dc:"处理人姓名"` + RelatedType int `json:"relatedType" dc:"关联业务类型:0卡,1套餐,2订单,3系统"` + RelatedId int64 `json:"relatedId" dc:"关联业务ID"` + FirstResponseTime *gtime.Time `json:"firstResponseTime" dc:"首次响应时间"` + ResolveTime *gtime.Time `json:"resolveTime" dc:"解决时间"` + CloseTime *gtime.Time `json:"closeTime" dc:"关闭时间"` + SatisfactionLevel int `json:"satisfactionLevel" dc:"满意度:1-5分"` + EvalTime *gtime.Time `json:"evalTime" dc:"评价时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TWoMainExportModel 导出工单主表 +type TWoMainExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + WoNo string `json:"woNo" dc:"工单编号"` + WoType int `json:"woType" dc:"工单类型 枚举"` + Title string `json:"title" dc:"工单标题"` + CreatorType int `json:"creatorType" dc:"创建人类型:1终端用户,2代理商,3客服"` + CreatorDeptId int64 `json:"creatorDeptId" dc:"创建人机构ID"` + CreatorUserId int64 `json:"creatorUserId" dc:"创建人用户ID"` + CreatorName string `json:"creatorName" dc:"创建人姓名"` + CurrentStatus int `json:"currentStatus" dc:"当前处理状态:0已分派,1处理中,2待反馈,3已反馈,4待确认,5已确认,6已关闭,7已废除"` + HandlerDeptId int64 `json:"handlerDeptId" dc:"处理方机构ID"` + HandlerUserId int64 `json:"handlerUserId" dc:"处理人用户ID"` + HandlerName string `json:"handlerName" dc:"处理人姓名"` + RelatedType int `json:"relatedType" dc:"关联业务类型:0卡,1套餐,2订单,3系统"` + RelatedId int64 `json:"relatedId" dc:"关联业务ID"` + FirstResponseTime *gtime.Time `json:"firstResponseTime" dc:"首次响应时间"` + ResolveTime *gtime.Time `json:"resolveTime" dc:"解决时间"` + CloseTime *gtime.Time `json:"closeTime" dc:"关闭时间"` + SatisfactionLevel int `json:"satisfactionLevel" dc:"满意度:1-5分"` + EvalTime *gtime.Time `json:"evalTime" dc:"评价时间"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/t_wo_record.go b/internal/model/t_wo_record.go new file mode 100644 index 0000000..c370e81 --- /dev/null +++ b/internal/model/t_wo_record.go @@ -0,0 +1,169 @@ +// Package genin +// @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 model + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/hook" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/request" + + "github.com/gogf/gf/v2/os/gtime" +) + +// TWoRecordUpdateFields 修改工单记录表字段过滤 +type TWoRecordUpdateFields struct { + WoNo string `json:"woNo" dc:"工单编号"` + OperationType int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId int64 `json:"operationDeptId" dc:"操作机构ID"` + OperationUserId int64 `json:"operationUserId" dc:"操作用户ID"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标部门ID"` + TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"` + BeforeStatus int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus int `json:"afterStatus" dc:"变更后状态"` + TenantId string `json:"tenantId" dc:"租户ID"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TWoRecordInsertFields 新增工单记录表字段过滤 +type TWoRecordInsertFields struct { + WoNo string `json:"woNo" dc:"工单编号"` + OperationType int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId int64 `json:"operationDeptId" dc:"操作机构ID"` + OperationUserId int64 `json:"operationUserId" dc:"操作用户ID"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标部门ID"` + TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"` + BeforeStatus int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus int `json:"afterStatus" dc:"变更后状态"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` +} + +// TWoRecordEditParam 修改/新增工单记录表 +type TWoRecordEditParam struct { + //entity.TWoRecord + Id int64 `json:"id" dc:"主键ID"` + WoNo *string `json:"woNo" dc:"工单编号"` + OperationType *int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId *int64 `json:"operationDeptId" dc:"操作机构ID"` + OperationUserId *int64 `json:"operationUserId" dc:"操作用户ID"` + TargetDeptId *int64 `json:"targetDeptId" dc:"目标部门ID"` + TargetUserId *int64 `json:"targetUserId" dc:"目标用户ID"` + BeforeStatus *int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus *int `json:"afterStatus" dc:"变更后状态"` + TenantId *string `json:"tenantId" dc:"租户ID"` + CreatedDept *int64 `json:"createdDept" dc:"创建部门"` + CreatedBy *int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy *int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +func (in *TWoRecordEditParam) Filter(ctx context.Context) (err error) { + + return +} + +type TWoRecordEditModel struct{} + +type TWoRecordAddOperationParam struct { + WoNo string `json:"woNo" dc:"工单编号"` + OperationType int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId int64 `json:"operationDeptId" dc:"操作机构ID"` + OperationUserId int64 `json:"operationUserId" dc:"操作用户ID"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标部门ID"` + TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"` + BeforeStatus int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus int `json:"afterStatus" dc:"变更后状态"` +} + +// TWoRecordDeleteParam 删除工单记录表 +type TWoRecordDeleteParam struct { + Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TWoRecordDeleteParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoRecordDeleteModel struct{} + +// TWoRecordViewParam 获取指定工单记录表信息 +type TWoRecordViewParam struct { + Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"` +} + +func (in *TWoRecordViewParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoRecordViewModel struct { + entity.TWoRecord + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` +} + +// TWoRecordListParam 获取工单记录表列表 +type TWoRecordListParam struct { + request.PageInfo + Id int64 `json:"id" dc:"主键ID"` + BeforeStatus int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus int `json:"afterStatus" dc:"变更后状态"` + CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` + WoNo string `json:"woNo" dc:"工单编号"` + OperationType int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` +} + +func (in *TWoRecordListParam) Filter(ctx context.Context) (err error) { + return +} + +type TWoRecordListModel struct { + Id int64 `json:"id" dc:"主键ID"` + WoNo string `json:"woNo" dc:"工单编号"` + OperationType int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId int64 `json:"operationDeptId" dc:"操作机构ID"` + OperationDeptName string `json:"operationDeptName" dc:"操作机构名称"` + OperationUserId int64 `json:"operationUserId" dc:"操作用户ID"` + OperationUserName string `json:"operationUserName" dc:"操作用户名称"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标部门ID"` + TargetDeptName string `json:"targetDeptName" dc:"目标部门名称"` + TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"` + TargetUserName string `json:"targetUserName" dc:"目标用户名称"` + BeforeStatus int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus int `json:"afterStatus" dc:"变更后状态"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} + +// TWoRecordExportModel 导出工单记录表 +type TWoRecordExportModel struct { + Id int64 `json:"id" dc:"主键ID"` + WoNo string `json:"woNo" dc:"工单编号"` + OperationType int `json:"operationType" dc:"操作类型:0创建,1分派,2处理,3完成,4关单,5取消"` + OperationDeptId int64 `json:"operationDeptId" dc:"操作机构ID"` + OperationUserId int64 `json:"operationUserId" dc:"操作用户ID"` + TargetDeptId int64 `json:"targetDeptId" dc:"目标部门ID"` + TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"` + BeforeStatus int `json:"beforeStatus" dc:"变更前状态"` + AfterStatus int `json:"afterStatus" dc:"变更后状态"` + TenantId string `json:"tenantId" dc:"租户ID"` + CreatedDept int64 `json:"createdDept" dc:"创建部门"` + CreatedBy int64 `json:"createdBy" dc:"创建者"` + CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` + UpdatedBy int64 `json:"updatedBy" dc:"更新者"` + UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"` +} diff --git a/internal/model/traffic_cutoff.go b/internal/model/traffic_cutoff.go new file mode 100644 index 0000000..6cfd777 --- /dev/null +++ b/internal/model/traffic_cutoff.go @@ -0,0 +1,43 @@ +package model + +type CommonTrafficCutoffCard struct { + Msisdn string `json:"msisdn,omitempty" dc:"MSISDN/卡号"` + Iccid string `json:"iccid,omitempty" dc:"ICCID"` + Imsi string `json:"imsi,omitempty" dc:"IMSI"` +} + +type CommonTrafficCutoffConfigParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + Cards []CommonTrafficCutoffCard `json:"cards" v:"required#配置卡不能为空" dc:"配置卡列表"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"达量断网配置状态:0删除,1已开启,2已关闭"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"达量断网阈值,单位MB"` + Remark string `json:"remark" dc:"批次备注"` + IdempotencyKey string `json:"-"` +} + +type CommonTrafficCutoffSingleParam struct { + AppId string `json:"appId" v:"required#appId is required" dc:"Platform API application ID"` + Msisdn string `json:"msisdn,omitempty" dc:"MSISDN"` + Iccid string `json:"iccid,omitempty" dc:"ICCID"` + Imsi string `json:"imsi,omitempty" dc:"IMSI"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"Traffic cutoff status: 0 delete, 1 enabled, 2 disabled"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"Traffic cutoff threshold in MB"` + Remark string `json:"remark,omitempty" dc:"Batch remark"` +} + +type CommonTrafficCutoffConfigRes struct { + BatchNo string `json:"batchNo" dc:"系统生成批次号"` + BatchType int `json:"batchType" dc:"批次类型"` +} + +type CommonSingleTrafficCutoffRes struct { + Success bool `json:"success" dc:"Configuration result"` + Iccid string `json:"iccid" dc:"ICCID"` + Msisdn string `json:"msisdn,omitempty" dc:"MSISDN"` + Imsi string `json:"imsi,omitempty" dc:"IMSI"` + TrafficCutoffStatus int `json:"trafficCutoffStatus" dc:"Traffic cutoff status"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold" dc:"Traffic cutoff threshold in MB"` + TrafficCutoffThresholdUnit string `json:"trafficCutoffThresholdUnit" dc:"Traffic cutoff threshold unit"` + Message string `json:"message" dc:"Result message"` + ErrorCode string `json:"errorCode,omitempty" dc:"Error code"` +} diff --git a/internal/model/traffic_cutoff_query.go b/internal/model/traffic_cutoff_query.go new file mode 100644 index 0000000..2ff59d0 --- /dev/null +++ b/internal/model/traffic_cutoff_query.go @@ -0,0 +1,53 @@ +package model + +type QueryTrafficCutoffCard struct { + Msisdn string `json:"msisdn,omitempty" dc:"MSISDN/卡号"` + Iccid string `json:"iccid,omitempty" dc:"ICCID"` + Imsi string `json:"imsi,omitempty" dc:"IMSI"` +} + +type QueryTrafficCutoffConfigParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + Cards []QueryTrafficCutoffCard `json:"cards" v:"required#查询卡不能为空" dc:"查询卡列表"` + IncludeUsage bool `json:"includeUsage" dc:"是否返回流量使用信息"` +} + +type QueryTrafficCutoffConfigItem struct { + Matched bool `json:"matched"` + Iccid string `json:"iccid,omitempty"` + TrafficCutoffStatus int `json:"trafficCutoffStatus"` + TrafficCutoffStatusName string `json:"trafficCutoffStatusName,omitempty"` + TrafficCutoffThreshold float64 `json:"trafficCutoffThreshold"` + TrafficCutoffThresholdUnit string `json:"trafficCutoffThresholdUnit,omitempty"` + PackageTotalFlowMb *float64 `json:"packageTotalFlowMb,omitempty"` + UsedFlowMb *float64 `json:"usedFlowMb,omitempty"` + RemainingFlowMb *float64 `json:"remainingFlowMb,omitempty"` + ErrorCode string `json:"errorCode,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` +} + +type QueryTrafficCutoffConfigOutput struct { + Total int `json:"total"` + MatchedCount int `json:"matchedCount"` + NotFoundCount int `json:"notFoundCount"` + Items []QueryTrafficCutoffConfigItem `json:"items"` +} + +type QueryBatchStatusParam struct { + AppId string `json:"appId" v:"required#appId不能为空" dc:"平台API应用ID"` + BatchNo string `json:"batchNo" v:"required#batchNo不能为空" dc:"批次号"` +} + +type QueryBatchStatusOutput struct { + BatchNo string `json:"batchNo" dc:"批次号"` + BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步状态"` + SourceChannel string `json:"sourceChannel,omitempty" dc:"发起渠道"` + ExecutionMode int `json:"executionMode" dc:"操作规模:0未知1单卡2批量"` + SourceType int `json:"sourceType" dc:"输入方式"` + TotalCount int `json:"totalCount" dc:"总数量"` + ValidCount int `json:"validCount" dc:"有效数量"` + SuccessCount int `json:"successCount" dc:"成功数量"` + FailCount int `json:"failCount" dc:"失败数量"` + RunResult int `json:"runResult" dc:"运行结果"` + FailReason string `json:"failReason,omitempty" dc:"失败原因"` +} diff --git a/internal/model/traffic_usage.go b/internal/model/traffic_usage.go new file mode 100644 index 0000000..dbdfc43 --- /dev/null +++ b/internal/model/traffic_usage.go @@ -0,0 +1,93 @@ +package model + +import "time" + +// TrafficUsageBase 是日流量和月流量共用的业务字段。 +// 这些字段会分别写入 TDengine 的普通列和标签列。 +type TrafficUsageBase struct { + Iccid string + UsageMb float64 + PackageCode string +} + +// TrafficUsageDailyItem 表示某张卡某一天的流量用量。 +// Date 会被归一化到当天 00:00:00 作为 TDengine 主时间戳。 +type TrafficUsageDailyItem struct { + TrafficUsageBase + Date time.Time +} + +// TrafficUsageMonthlyItem 表示某张卡某个月的流量用量。 +// Month 会被归一化到当月 1 日 00:00:00 作为 TDengine 主时间戳。 +type TrafficUsageMonthlyItem struct { + TrafficUsageBase + Month time.Time +} + +// TrafficPoolUsageItem 表示某张流量池某一天的流量用量。 +type TrafficPoolUsageItem struct { + FlowPoolCode string + UsageMb float64 + Date time.Time +} + +// TrafficPoolCardCountItem 表示某张流量池某一天的卡数。 +type TrafficPoolCardCountItem struct { + FlowPoolCode string + CardCount int64 + Date time.Time +} + +// TrafficPoolCard 表示某张流量池某一天的一张卡。 +type TrafficPoolCard struct { + Iccid string + FlowPoolCode string +} + +// TrafficPoolUsageAggregate 表示某张流量池某一天的流量用量和卡数。 +type TrafficPoolUsageAggregate struct { + FlowPoolCode string + UsageMb float64 + RecordCount int64 +} + +// TrafficUsageQueryInput 是按 ICCID 和时间范围查询流量数据的入参。 +type TrafficUsageQueryInput struct { + Iccid string + StartTime time.Time + EndTime time.Time + Page int + PageSize int + Asc bool +} + +// TrafficUsageDeleteInput 是按 ICCID 和时间范围删除流量数据的入参。 +// 删除必须带时间范围,避免误删整张子表数据。 +type TrafficUsageDeleteInput struct { + Iccid string + StartTime time.Time + EndTime time.Time +} + +// TrafficUsageDailyRecord 是日流量查询结果。 +type TrafficUsageDailyRecord struct { + Ts time.Time `json:"ts"` + UsageMb float64 `json:"usageMb"` + PackageCode string `json:"packageCode"` + Iccid string `json:"iccid"` +} + +// TrafficUsageMonthlyRecord 是月流量查询结果。 +type TrafficUsageMonthlyRecord struct { + Ts time.Time `json:"ts"` + UsageMb float64 `json:"usageMb"` + PackageCode string `json:"packageCode"` + Iccid string `json:"iccid"` +} + +// TopUsageCard 是流量使用排名前五的卡片。 +type TopUsageCard struct { + Iccid string `json:"iccid"` + UsageMb float64 `json:"usageMb"` + StatDate string `json:"statDate"` +} diff --git a/internal/model/traffic_usage_sync.go b/internal/model/traffic_usage_sync.go new file mode 100644 index 0000000..62914c9 --- /dev/null +++ b/internal/model/traffic_usage_sync.go @@ -0,0 +1,23 @@ +package model + +// TrafficUsageSimCard is the basic card data needed when writing usage to TDengine. +type TrafficUsageSimCard struct { + Iccid string `json:"iccid"` + PackageCode string `json:"packageCode"` +} + +// TrafficUsageDailyRetryMessage is the retry message for daily traffic usage. +type TrafficUsageDailyRetryMessage struct { + SimKey *SimKey `json:"simKey"` + Card TrafficUsageSimCard `json:"card"` + // QueryDate format: yyyyMMdd. + QueryDate string `json:"queryDate"` +} + +// TrafficUsageMonthlyRetryMessage is the retry message for monthly traffic usage. +type TrafficUsageMonthlyRetryMessage struct { + SimKey *SimKey `json:"simKey"` + Card TrafficUsageSimCard `json:"card"` + // QueryDate format: yyyyMM. + QueryDate string `json:"queryDate"` +} diff --git a/internal/model/upstream_chan.go b/internal/model/upstream_chan.go new file mode 100644 index 0000000..d922b25 --- /dev/null +++ b/internal/model/upstream_chan.go @@ -0,0 +1,228 @@ +package model + +import "time" + +// 上游通道代理配置 +type UpstreamChanConfig struct { + Address string `json:"address" dc:"服务地址或服务发现名称"` + Timeout time.Duration `json:"timeout" dc:"超时时间"` +} + +// 物联网卡标识 +type SimKey struct { + ChanKey string `json:"chanKey" dc:"通道标识"` + ICCID string `json:"iccid" dc:"联网卡集成电路卡识别码20位"` + IMSI string `json:"imsi" dc:"国际移动用户识别码"` + MSISDN string `json:"msisdn" dc:"移动用户识别码"` +} + +// 物联网卡基础请求参数 +type SimBaseReq[T any] struct { + SimKeys []*SimKey `json:"simKeys" dc:"SIM卡标识列表"` + ReqData T `json:"reqData" dc:"请求数据"` +} + +// 代理响应参数 +type SimResponseData[T any] struct { + Code int `json:"code" dc:"状态码"` + Message string `json:"message" dc:"消息"` + Data []SimBaseRes[T] `json:"data" dc:"数据"` +} + +// 物联网卡基础响应参数 +type SimBaseRes[T any] struct { + Code int `json:"code" dc:"状态码"` + Message string `json:"message" dc:"消息"` + SimKey *SimKey `json:"simKey" dc:"SIM卡标识"` + ResData T `json:"resData" dc:"响应数据"` +} + +// 查询请求参数 空结构 +type SimInputReqNullDate struct{} + +// 物联网卡基本信息查询 +type SimBasicInfoInput = SimBaseReq[SimInputReqNullDate] + +// 物联网卡基本信息查询 响应参数 +type SimBasicInfoOutput = SimResponseData[SimBasicInfoItem] + +// 物联网卡基本信息查询 响应参数 基本信息项 +type SimBasicInfoItem struct { + ActiveDate string `json:"activeDate" dc:"激活时间"` + OpenDate string `json:"openDate" dc:"开卡时间"` + Remark string `json:"remark" dc:"备注"` +} + +// 物联网卡在线信息实时查询 请求参数 +type SimSessionInput = SimBaseReq[SimInputReqNullDate] + +// 物联网卡在线信息实时查询 响应参数 +type SimSessionOutput = SimResponseData[SimSessionItem] + +// 物联网卡在线信息实时查询 响应参数 会话项 +type SimSessionItem struct { + ApnId string `json:"apnId" dc:"APN ID"` + Rat string `json:"rat" dc:"接入方式"` + Ipv4 string `json:"ipv4" dc:"IPV4"` + Ipv6 string `json:"ipv6" dc:"IPV6"` + Ipv6Prefix string `json:"ipv6Prefix" dc:"IPV6前缀"` + Status string `json:"status" dc:"状态(0:用户在线 -1:用户不在线 -2:未查询到会话信息)"` + CreateTime string `json:"createTime" dc:"创建时间"` +} + +// 物联网卡卡状态查询 请求参数 +type SimCardStatusInput = SimBaseReq[SimInputReqNullDate] + +// 物联网卡卡状态查询 响应参数 +type SimCardStatusOutput = SimResponseData[SimCardStatusItem] + +// 物联网卡卡状态查询 响应参数 卡状态项 +type SimCardStatusItem struct { + CardStatus int `json:"cardStatus" dc:"卡状态"` + LastChangeDate string `json:"lastChangeDate" dc:"最后变更时间"` +} + +// 物联网卡IMEI查询 请求参数 +type SimImeiInput = SimBaseReq[SimInputReqNullDate] + +// 物联网卡IMEI查询 响应参数 +type SimImeiOutput = SimResponseData[SimImeiItem] + +// 物联网卡IMEI查询 响应参数 IMEI项 +type SimImeiItem struct { + Imei string `json:"imei" dc:"IMEI"` +} + +// 单卡本月流量累计使用量查询 请求参数 +type SimDataUsageInPoolInput = SimBaseReq[SimInputReqNullDate] + +// 单卡本月流量累计使用量查询 响应参数 +type SimDataUsageInPoolOutput = SimResponseData[SimDataUsageInPoolItem] + +// 单卡本月流量累计使用量查询 响应参数 流量累计使用量项 +type SimDataUsageInPoolItem struct { + DataUsage float64 `json:"dataUsage" dc:"流量累计使用量(单位: KB)"` +} + +// 单卡本月流量累计使用量查询 请求参数 +type SimDataUsageInput = SimBaseReq[SimInputReqNullDate] + +// 单卡本月流量累计使用量查询 响应参数 +type SimDataUsageOutput = SimResponseData[SimDataUsageItem] + +// 单卡本月流量累计使用量查询 响应参数 流量累计使用量项 +type SimDataUsageItem struct { + DataUsage float64 `json:"dataUsage" dc:"流量累计使用量(单位: MB)"` +} + +// 物联卡单月 GPRS流量使用量批量查询 请求参数 +type SimDataUsageMonthlyInput = SimBaseReq[SimDataUsageMonthlyInputItem] +type SimDataUsageMonthlyInputItem struct { + QueryDate string `json:"queryDate" dc:"查询日期"` +} + +// 物联卡单月 GPRS流量使用量批量查询 响应参数 +type SimDataUsageMonthlyOutput = SimResponseData[SimDataUsageMonthlyOutputItem] +type SimDataUsageMonthlyOutputItem struct { + DeadLine string `json:"deadLine" dc:"截止时间"` + DataAmount float64 `json:"dataAmount" dc:"流量累计使用量"` +} + +// 物联卡单日 GPRS流量使用量查询 请求参数 +type SimDataUsageDailyInput = SimBaseReq[SimDataUsageDailyInputItem] +type SimDataUsageDailyInputItem struct { + QueryDate string `json:"queryDate" dc:"查询日期,格式yyyyMMdd"` +} + +// 物联卡单日 GPRS流量使用量查询 响应参数 +type SimDataUsageDailyOutput = SimResponseData[SimDataUsageDailyOutputItem] +type SimDataUsageDailyOutputItem struct { + QueryDate string `json:"queryDate" dc:"查询日期,格式yyyyMMdd"` + DataAmount float64 `json:"dataAmount" dc:"单日流量使用量,单位MB"` +} + +// 单卡已开通APN信息查询 请求参数 +type SimApnInfoInput = SimBaseReq[SimInputReqNullDate] + +// 单卡已开通APN信息查询 响应参数 +type SimApnInfoOutput = SimResponseData[SimApnInfoItemList] + +// 单卡已开通APN信息查询 响应参数 APN信息项 +type SimApnInfoItemList struct { + ApnList []SimApnInfoItem `json:"apnList" dc:"APN列表"` +} +type SimApnInfoItem struct { + ApnName string `json:"apnName" dc:"APN名称"` + Status string `json:"status" dc:"状态"` +} + +// 物联网卡状态变更 请求参数 +type SimCardStatusChangeInput = SimBaseReq[SimCardStatusChangeInputItem] + +// 物联网卡状态变更 请求参数 操作类型 +type SimCardStatusChangeInputItem struct { + OperType string `json:"operType" dc:"操作类型"` +} + +// 物联网卡状态变更 响应参数 +type SimCardStatusChangeOutput = SimResponseData[SimCardStatusChangeItem] + +// 物联网卡状态变更 响应参数 数据项 +type SimCardStatusChangeItem struct { + OrderNum string `json:"orderNum" dc:"订单号"` +} + +// 单卡 APN功能开停 请求参数 +type SimCardOperateChangeApnInput = SimBaseReq[SimCardOperateChangeApnInputItem] + +// 单卡 APN功能开停 请求参数 操作类型 +type SimCardOperateChangeApnInputItem struct { + OperType string `json:"operType" dc:"操作类型"` + ApnName string `json:"apnName" dc:"APN名称"` +} + +// 单卡 APN功能开停 响应参数 +type SimCardOperateChangeApnOutput = SimResponseData[SimCardOperateChangeApnItem] + +// 单卡 APN功能开停 响应参数 数据项 +type SimCardOperateChangeApnItem struct { + OrderNum string `json:"orderNum" dc:"订单号"` +} + +// 物联网卡机卡绑定状态查询 请求参数 +type SimCardBindStatusInput = SimBaseReq[SimCardBindStatusInputItem] + +// 物联网卡机卡绑定状态查询 请求参数 请求项 +type SimCardBindStatusInputItem struct { + TestType int `json:"testType" dc:"分离检测方式:0话单侧检测 1网络侧检测"` +} + +// 物联网卡机卡绑定状态查询 响应参数 +type SimCardBindStatusOutput = SimResponseData[SimCardBindStatusItem] + +// 物联网卡机卡绑定状态查询 响应参数 机卡绑定状态项 +type SimCardBindStatusItem struct { + BindStatus string `json:"bindStatus" dc:"机卡绑定状态"` +} + +// 物联网卡设备状态查询 请求参数 +type SimDeviceStatusInput = SimBaseReq[SimInputReqNullDate] + +// 物联网卡设备状态查询 响应参数 +type SimDeviceStatusOutput = SimResponseData[SimDeviceStatusItem] + +// 物联网卡设备状态查询 响应参数 设备状态项 +type SimDeviceStatusItem struct { + DeviceStatus string `json:"deviceStatus" dc:"设备状态"` +} + +// 物联网卡地域限制状态查询 请求参数 +type SimRegionLimitStatusInput = SimBaseReq[SimInputReqNullDate] + +// 物联网卡地域限制状态查询 响应参数 +type SimRegionLimitStatusOutput = SimResponseData[SimRegionLimitStatusItem] + +// 物联网卡地域限制状态查询 响应参数 地域限制状态项 +type SimRegionLimitStatusItem struct { + RegionLimitStatus string `json:"regionLimitStatus" dc:"地域限制状态"` +} diff --git a/internal/model/work_order_queue.go b/internal/model/work_order_queue.go new file mode 100644 index 0000000..989b844 --- /dev/null +++ b/internal/model/work_order_queue.go @@ -0,0 +1,7 @@ +package model + +// WorkOrderAutoCloseMessage is consumed after the auto-close waiting window. +type WorkOrderAutoCloseMessage struct { + WoNo string `json:"woNo"` + ResolveTimeTs int64 `json:"resolveTimeTs"` +} diff --git a/internal/model/worker_diagnostic.go b/internal/model/worker_diagnostic.go new file mode 100644 index 0000000..833950c --- /dev/null +++ b/internal/model/worker_diagnostic.go @@ -0,0 +1,9 @@ +package model + +// WorkerDiagnosticMessage verifies the Admin-to-Worker RabbitMQ path without +// touching business data. +type WorkerDiagnosticMessage struct { + TraceID string `json:"traceId"` + SentAt int64 `json:"sentAt"` + Message string `json:"message"` +} diff --git a/internal/packed/packed.go b/internal/packed/packed.go new file mode 100644 index 0000000..25355af --- /dev/null +++ b/internal/packed/packed.go @@ -0,0 +1,6 @@ +// package packed +// @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 packed diff --git a/internal/packed/response/response.go b/internal/packed/response/response.go new file mode 100644 index 0000000..39d78ed --- /dev/null +++ b/internal/packed/response/response.go @@ -0,0 +1,81 @@ +// package response +// @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 response + +import ( + "fmt" + "io" + "net/http" + "time" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gtime" +) + +type JsonResponse struct { + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data"` + Error interface{} `json:"error"` +} + +type OldJsonResponse struct { + Status int `json:"status"` + Message string `json:"message"` + Result interface{} `json:"result"` +} + +func Json(r *ghttp.Request, code int, message string, data ...interface{}) { + var responseData interface{} + if len(data) > 0 { + responseData = data[0] + } else { + responseData = g.Map{} + } + // g.Log().Infof(r.GetCtx(), "response.Json: %v", responseData) + r.Response.WriteJson(JsonResponse{ + Code: code, + Message: message, + Data: responseData, + }) +} + +func JsonExit(r *ghttp.Request, code int, message string, data ...interface{}) { + Json(r, code, message, data...) + r.ExitAll() +} + +// 向前端返回Excel文件 参数 content 为上面生成的io.ReadSeeker, fileTag 为返回前端的文件名 +func Excel(r *ghttp.Request, content io.ReadSeeker, fileTag string) { + fileName := fmt.Sprintf("%s%s%s.xlsx", gtime.Now().Format("Ymdhis"), `_`, fileTag) + r.Response.Header().Set("Content-Type", "application/vnd.ms-excel") + r.Response.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", fileName)) + http.ServeContent(r.Response.Writer, r.Request, fileTag, time.Now(), content) +} + +// 向前端返回Json文件 参数 content 为上面生成的io.ReadSeeker, fileTag 为返回前端的文件名 +func JsonFile(r *ghttp.Request, content io.ReadSeeker, fileTag string) { + fileName := fmt.Sprintf("%s%s%s.json", gtime.Now().Format("Ymdhis"), `_`, fileTag) + r.Response.Header().Set("Content-Type", "application/json") + r.Response.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", fileName)) + http.ServeContent(r.Response.Writer, r.Request, fileTag, time.Now(), content) +} + +func OldJson(r *ghttp.Request, code int, message string, data ...interface{}) { + var responseData interface{} + if len(data) > 0 { + responseData = data[0] + } else { + responseData = g.Map{} + } + // g.Log().Infof(r.GetCtx(), "response.Json: %v", responseData) + r.Response.WriteJson(OldJsonResponse{ + Status: code, + Message: message, + Result: responseData, + }) +} diff --git a/internal/router/change.go b/internal/router/change.go new file mode 100644 index 0000000..363021f --- /dev/null +++ b/internal/router/change.go @@ -0,0 +1,15 @@ +package router + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/controller/common" + + "github.com/gogf/gf/v2/net/ghttp" +) + +func Change(ctx context.Context, group *ghttp.RouterGroup) { + group.Group("/change", func(group *ghttp.RouterGroup) { + group.Bind(common.NewV1()) + }) +} diff --git a/internal/router/common.go b/internal/router/common.go new file mode 100644 index 0000000..3bcb4e6 --- /dev/null +++ b/internal/router/common.go @@ -0,0 +1,15 @@ +package router + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/controller/common" + + "github.com/gogf/gf/v2/net/ghttp" +) + +func Common(ctx context.Context, group *ghttp.RouterGroup) { + group.Group("/common", func(group *ghttp.RouterGroup) { + group.Bind(common.NewV1()) + }) +} diff --git a/internal/router/old_api.go b/internal/router/old_api.go new file mode 100644 index 0000000..6950e87 --- /dev/null +++ b/internal/router/old_api.go @@ -0,0 +1,15 @@ +package router + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/controller/old_api" + + "github.com/gogf/gf/v2/net/ghttp" +) + +func Route(ctx context.Context, group *ghttp.RouterGroup) { + group.Group("/open", func(group *ghttp.RouterGroup) { + group.Bind(old_api.NewV1()) + }) +} diff --git a/internal/router/query.go b/internal/router/query.go new file mode 100644 index 0000000..e3beda8 --- /dev/null +++ b/internal/router/query.go @@ -0,0 +1,15 @@ +package router + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/controller/query" + + "github.com/gogf/gf/v2/net/ghttp" +) + +func Query(ctx context.Context, group *ghttp.RouterGroup) { + group.Group("/query", func(group *ghttp.RouterGroup) { + group.Bind(query.NewV1()) + }) +} diff --git a/internal/router/router.go b/internal/router/router.go new file mode 100644 index 0000000..b9f01ec --- /dev/null +++ b/internal/router/router.go @@ -0,0 +1,31 @@ +package router + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/service" + + "github.com/gogf/gf/v2/net/ghttp" +) + +func InitRouter(ctx context.Context, s *ghttp.Server) { + s.Group("/openapi/v3", func(group *ghttp.RouterGroup) { + group.Middleware( + service.Middleware().ApiCtx, + service.Middleware().ApiAuth, + service.Middleware().ResponseHandler, + ) + Common(ctx, group) + Change(ctx, group) + Query(ctx, group) + }) + + s.Group("/route", func(group *ghttp.RouterGroup) { + group.Middleware( + service.Middleware().OldCtx, + service.Middleware().OldAuth, + service.Middleware().OldResponseHandler, + ) + Route(ctx, group) + }) +} diff --git a/internal/service/common.go b/internal/service/common.go new file mode 100644 index 0000000..d3b1a27 --- /dev/null +++ b/internal/service/common.go @@ -0,0 +1,41 @@ +package service + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +type ( + ICommon interface { + BuildBatchNo(ctx context.Context, prefix string) (string, error) + BuildRenewBatchNo(ctx context.Context) (string, error) + SaveBatchMain(ctx context.Context, tx gdb.TX, batch *entity.BatchMain, executionMode int) error + SaveBatchDetail(ctx context.Context, tx gdb.TX, detail *entity.BatchDetail) error + SaveBatchDetails(ctx context.Context, tx gdb.TX, details []*entity.BatchDetail) error + Publish(ctx context.Context, queue string, data any) error + SubmitRenew(ctx context.Context, in *model.CommonRenewParam) (*model.CommonRenewRes, error) + SubmitSingleRenew(ctx context.Context, card model.CommonRenewCard, appID, packageID, remark string, validity int) (*model.CommonSingleRenewRes, error) + SubmitBatchRenew(ctx context.Context, appID string, cards []model.CommonRenewCard, iccids []string, packageID, remark string, validity int) (*model.CommonRenewRes, error) + SubmitTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffConfigParam) (*model.CommonTrafficCutoffConfigRes, error) + SubmitSingleTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffSingleParam) (*model.CommonSingleTrafficCutoffRes, error) + } +) + +var ( + localCommon ICommon +) + +func Common() ICommon { + if localCommon == nil { + panic("implement not found for interface ICommon, forgot register?") + } + return localCommon +} + +func RegisterCommon(i ICommon) { + localCommon = i +} diff --git a/internal/service/iot.go b/internal/service/iot.go new file mode 100644 index 0000000..b3877e0 --- /dev/null +++ b/internal/service/iot.go @@ -0,0 +1,30 @@ +package service + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/library/xgorm/handler" + + "github.com/gogf/gf/v2/database/gdb" +) + +type ( + IIotTSimCardInfo interface { + Model(ctx context.Context, option ...*handler.Option) *gdb.Model + } +) + +var ( + localIotTSimCardInfo IIotTSimCardInfo +) + +func IotTSimCardInfo() IIotTSimCardInfo { + if localIotTSimCardInfo == nil { + panic("implement not found for interface IIotTSimCardInfo, forgot register?") + } + return localIotTSimCardInfo +} + +func RegisterIotTSimCardInfo(i IIotTSimCardInfo) { + localIotTSimCardInfo = i +} diff --git a/internal/service/middleware.go b/internal/service/middleware.go new file mode 100644 index 0000000..7e9c114 --- /dev/null +++ b/internal/service/middleware.go @@ -0,0 +1,34 @@ +package service + +import ( + "context" + + "github.com/gogf/gf/v2/net/ghttp" +) + +type ( + IMiddleware interface { + ResponseHandler(r *ghttp.Request) + ApiCtx(r *ghttp.Request) + ApiAuth(r *ghttp.Request) + OldResponseHandler(r *ghttp.Request) + OldCtx(r *ghttp.Request) + OldAuth(r *ghttp.Request) + IsExceptLogin(ctx context.Context, path string) bool + } +) + +var ( + localMiddleware IMiddleware +) + +func Middleware() IMiddleware { + if localMiddleware == nil { + panic("implement not found for interface IMiddleware, forgot register?") + } + return localMiddleware +} + +func RegisterMiddleware(i IMiddleware) { + localMiddleware = i +} diff --git a/internal/service/old_api.go b/internal/service/old_api.go new file mode 100644 index 0000000..80a6ee9 --- /dev/null +++ b/internal/service/old_api.go @@ -0,0 +1,39 @@ +// ================================================================================ +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// You can delete these comments if you wish manually maintain this interface file. +// ================================================================================ + +package service + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity" +) + +type ( + IOldApiQuery interface { + StatusConversion(simCardInfo entity.TSimCardInfo) int + QuerySimCard(ctx context.Context, input *model.SimCardInfoInput) (output *model.SimCardInfoOutput, err error) + QuerySimDataUsage(ctx context.Context, input *model.SimDataUsageOldInput) (output *model.SimDataUsageOldOutput, err error) + QuerySimDataUsageMonthly(ctx context.Context, input *model.SimDataUsageMonthlyOldInput) (output *model.SimDataUsageMonthlyOldOutput, err error) + QuerySimStatus(ctx context.Context, input *model.SimStatusOldInput) (output *model.SimStatusOldOutput, err error) + QuerySimSession(ctx context.Context, input *model.SimStatusOnlineOldInput) (output *model.SimStatusOnlineOldOutput, err error) + QueryCardInfoList(ctx context.Context, input *model.QueryCardInfoListInput) (output []model.QueryCardInfoListOutput, err error) + } +) + +var ( + localOldApiQuery IOldApiQuery +) + +func OldApiQuery() IOldApiQuery { + if localOldApiQuery == nil { + panic("implement not found for interface IOldApiQuery, forgot register?") + } + return localOldApiQuery +} + +func RegisterOldApiQuery(i IOldApiQuery) { + localOldApiQuery = i +} diff --git a/internal/service/query.go b/internal/service/query.go new file mode 100644 index 0000000..769a512 --- /dev/null +++ b/internal/service/query.go @@ -0,0 +1,61 @@ +package service + +import ( + "context" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +type ( + IQuerySim interface { + QuerySimInfo(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimInfoOutput, err error) + QuerySimLimit(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimLimitOutput, err error) + QuerySimImei(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimImeiOutput, err error) + QuerySimUsage(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimUsageOutput, err error) + QuerySimStatus(ctx context.Context, input *model.QuerySimInput) (output *model.QuerySimCardStatusOutput, err error) + QueryTrafficCutoffConfig(ctx context.Context, in *model.QueryTrafficCutoffConfigParam) (*model.QueryTrafficCutoffConfigOutput, error) + QueryBatchStatus(ctx context.Context, in *model.QueryBatchStatusParam) (*model.QueryBatchStatusOutput, error) + QuerySimStatusBatch(ctx context.Context, in *model.QuerySimStatusBatchParam) (*model.QuerySimStatusBatchOutput, error) + QuerySimUsageBatch(ctx context.Context, in *model.QuerySimUsageBatchParam) (*model.QuerySimUsageBatchOutput, error) + QuerySimImeiBatch(ctx context.Context, in *model.QuerySimImeiBatchParam) (*model.QuerySimImeiBatchOutput, error) + } + + IQueryToken interface { + Token(ctx context.Context, input model.TokenInputApi) (res model.TokenOutputApi, err error) + OperatorToken(ctx context.Context, input model.OperatorTokenInput) (res model.OperatorTokenOutput, err error) + OperatorTokenWithAuth(ctx context.Context, input model.OperatorTokenInput) (res model.OperatorTokenOutput, err error) + GenerateToken(ctx context.Context, customer *model.CustomClaimsApi) (claims *model.CustomClaimsApi, shortToken string, err error) + GenerateShortToken(ctx context.Context, tokenUuid string) (token string, err error) + ParseToken(ctx context.Context, token string) (claims *model.CustomClaimsApi, err error) + DeleteToken(ctx context.Context, token string) (err error) + GetAccessToken(ctx context.Context) (token string, err error) + GetCurrentCustomer(ctx context.Context) (claims *model.CustomClaimsApi, err error) + } +) + +var ( + localQuerySim IQuerySim + localQueryToken IQueryToken +) + +func QuerySim() IQuerySim { + if localQuerySim == nil { + panic("implement not found for interface IQuerySim, forgot register?") + } + return localQuerySim +} + +func RegisterQuerySim(i IQuerySim) { + localQuerySim = i +} + +func QueryToken() IQueryToken { + if localQueryToken == nil { + panic("implement not found for interface IQueryToken, forgot register?") + } + return localQueryToken +} + +func RegisterQueryToken(i IQueryToken) { + localQueryToken = i +} diff --git a/internal/service/upstream.go b/internal/service/upstream.go new file mode 100644 index 0000000..3ef78f5 --- /dev/null +++ b/internal/service/upstream.go @@ -0,0 +1,59 @@ +// ================================================================================ +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// You can delete these comments if you wish manually maintain this interface file. +// ================================================================================ + +package service + +import ( + "context" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +type ( + IUpstreamChan interface { + GetUpstreamChanConfig(ctx context.Context) (output model.UpstreamChanConfig, err error) + GetSharedToken(ctx context.Context, chanKey string) (*model.SharedTokenResult, error) + // 获取卡基本信息 + QuerySimBasicInfo(ctx context.Context, input *model.SimBasicInfoInput) ([]model.SimBaseRes[model.SimBasicInfoItem], error) + // 查询会话信息 + QuerySimSession(ctx context.Context, input *model.SimSessionInput) ([]model.SimBaseRes[model.SimSessionItem], error) + // 查询状态 + QuerySimCardStatus(ctx context.Context, input *model.SimCardStatusInput) ([]model.SimBaseRes[model.SimCardStatusItem], error) + // 查询IMEI + QuerySimImei(ctx context.Context, input *model.SimImeiInput) ([]model.SimBaseRes[model.SimImeiItem], error) + // 查询流量 + QuerySimDatausage(ctx context.Context, input *model.SimDataUsageInput) ([]model.SimBaseRes[model.SimDataUsageItem], error) + // 查询月流量 + QuerySimDatausageMonthly(ctx context.Context, input *model.SimDataUsageMonthlyInput) ([]model.SimBaseRes[model.SimDataUsageMonthlyOutputItem], error) + // 查询日流量 + QuerySimDatausageDaily(ctx context.Context, input *model.SimDataUsageDailyInput) ([]model.SimBaseRes[model.SimDataUsageDailyOutputItem], error) + // 查询已开通APN信息 + QuerySimApnInfo(ctx context.Context, input *model.SimApnInfoInput) ([]model.SimBaseRes[model.SimApnInfoItemList], error) + // 卡状态变更 + ChangeSimStatus(ctx context.Context, input *model.SimCardStatusChangeInput) ([]model.SimBaseRes[model.SimCardStatusChangeItem], error) + // 卡APN功能开停 + ChangeSimApnFunction(ctx context.Context, input *model.SimCardOperateChangeApnInput) ([]model.SimBaseRes[model.SimCardOperateChangeApnItem], error) + // 查询机卡绑定状态 + QuerySimCardBindStatus(ctx context.Context, input *model.SimCardBindStatusInput) ([]model.SimBaseRes[model.SimCardBindStatusItem], error) + // 查询设备状态 + QuerySimDeviceStatus(ctx context.Context, input *model.SimDeviceStatusInput) ([]model.SimBaseRes[model.SimDeviceStatusItem], error) + // 查询地域限制状态 + QuerySimRegionLimitStatus(ctx context.Context, input *model.SimRegionLimitStatusInput) ([]model.SimBaseRes[model.SimRegionLimitStatusItem], error) + } +) + +var ( + localUpstreamChan IUpstreamChan +) + +func UpstreamChan() IUpstreamChan { + if localUpstreamChan == nil { + panic("implement not found for interface IUpstreamChan, forgot register?") + } + return localUpstreamChan +} + +func RegisterUpstreamChan(i IUpstreamChan) { + localUpstreamChan = i +} diff --git a/internal/service/workerdiagnostic/worker_diagnostic.go b/internal/service/workerdiagnostic/worker_diagnostic.go new file mode 100644 index 0000000..4c6353d --- /dev/null +++ b/internal/service/workerdiagnostic/worker_diagnostic.go @@ -0,0 +1,49 @@ +package workerdiagnostic + +import ( + "context" + "fmt" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/guid" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +type Publisher func(ctx context.Context, queue string, data any) error + +type Service struct { + publisher Publisher +} + +type Result struct { + TraceID string + Queue string + SentAt int64 +} + +func New(publisher Publisher) *Service { + return &Service{publisher: publisher} +} + +func (s *Service) Publish(ctx context.Context, message string) (*Result, error) { + var ( + traceID = fmt.Sprintf("worker-test-%s", guid.S()) + sentAt = gtime.TimestampMilli() + payload = model.WorkerDiagnosticMessage{ + TraceID: traceID, + SentAt: sentAt, + Message: message, + } + ) + if err := s.publisher(ctx, consts.QueueWorkerDiagnostic, payload); err != nil { + return nil, gerror.Wrap(err, "publish worker diagnostic message failed") + } + return &Result{ + TraceID: traceID, + Queue: consts.QueueWorkerDiagnostic, + SentAt: sentAt, + }, nil +} diff --git a/internal/service/workerdiagnostic/worker_diagnostic_test.go b/internal/service/workerdiagnostic/worker_diagnostic_test.go new file mode 100644 index 0000000..c0a9c02 --- /dev/null +++ b/internal/service/workerdiagnostic/worker_diagnostic_test.go @@ -0,0 +1,81 @@ +package workerdiagnostic + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "strings" + "testing" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/consts" + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model" +) + +func TestPublish(t *testing.T) { + var ( + publishedQueue string + publishedPayload model.WorkerDiagnosticMessage + ) + service := New(func(ctx context.Context, queue string, data any) error { + publishedQueue = queue + var ok bool + publishedPayload, ok = data.(model.WorkerDiagnosticMessage) + if !ok { + t.Fatalf("unexpected payload type %T", data) + } + return nil + }) + + result, err := service.Publish(context.Background(), "worker ping") + if err != nil { + t.Fatalf("Publish() error = %v", err) + } + if publishedQueue != consts.QueueWorkerDiagnostic { + t.Fatalf("queue = %q, want %q", publishedQueue, consts.QueueWorkerDiagnostic) + } + if !strings.HasPrefix(result.TraceID, "worker-test-") { + t.Fatalf("traceId = %q, want worker-test- prefix", result.TraceID) + } + if result.SentAt <= 0 { + t.Fatalf("sentAt = %d, want positive timestamp", result.SentAt) + } + if result.Queue != consts.QueueWorkerDiagnostic { + t.Fatalf("result queue = %q, want %q", result.Queue, consts.QueueWorkerDiagnostic) + } + if publishedPayload.TraceID != result.TraceID || publishedPayload.SentAt != result.SentAt { + t.Fatalf("published identifiers = %+v, result = %+v", publishedPayload, result) + } + if publishedPayload.Message != "worker ping" { + t.Fatalf("message = %q, want worker ping", publishedPayload.Message) + } + body, err := json.Marshal(publishedPayload) + if err != nil { + t.Fatalf("json.Marshal() error = %v", err) + } + wantJSON := `{"traceId":"` + result.TraceID + `","sentAt":` + fmt.Sprint(result.SentAt) + `,"message":"worker ping"}` + if string(body) != wantJSON { + t.Fatalf("JSON = %s, want %s", body, wantJSON) + } +} + +func TestPublishWrapsPublisherError(t *testing.T) { + publishErr := errors.New("broker unavailable") + service := New(func(ctx context.Context, queue string, data any) error { + return publishErr + }) + + result, err := service.Publish(context.Background(), "worker ping") + if result != nil { + t.Fatalf("result = %+v, want nil", result) + } + if err == nil { + t.Fatal("Publish() error = nil, want error") + } + if !errors.Is(err, publishErr) { + t.Fatalf("Publish() error = %v, want wrapped publisher error", err) + } + if !strings.Contains(err.Error(), "publish worker diagnostic message failed") { + t.Fatalf("Publish() error = %v, want context", err) + } +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..65b75f5 --- /dev/null +++ b/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gctx" + + "git.5iot.com/iotlcm-public/iotlcm-openapi/internal/cmd" +) + +var ( + BuildVersion = "0.0" + BuildTime = "" + CommitID = "" +) + +func main() { + ctx := gctx.GetInitCtx() + g.Log().Noticef( + ctx, + "iotlcm-openapi starting, version:%s, buildTime:%s, commitID:%s", + BuildVersion, + BuildTime, + CommitID, + ) + cmd.Main.Run(ctx) +} diff --git a/manifest/config/config.yaml b/manifest/config/config.yaml new file mode 100644 index 0000000..db28858 --- /dev/null +++ b/manifest/config/config.yaml @@ -0,0 +1,76 @@ +system: + name: "IotLCM-OpenAPI" + version: "1.0" + description: "IotLCM OpenAPI Service" + gfmode: "dev" + +server: + address: ":8000" + openapiPath: "/api.json" + swaggerPath: "/swagger" + maxHeaderBytes: "20KB" + clientMaxBodySize: "200MB" + readTimeout: "20m" + writeTimeout: "20m" + +logger: + path: "/app/logs" + file: "{Y-m-d-H}.log" + level: "dev" + timeFormat: "2006-01-02T15:04:05" + stdout: true + header: true + +jwt: + signingKey: "${JWT_SIGNING_KEY}" + expiresTime: "7d" + bufferTime: "1d" + issuer: "iotlcm" + +database: + logger: + path: "/app/logs/sql" + level: "all" + stdout: true + default: + link: "mysql:${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)/db_iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai" + debug: true + charset: "utf8mb4" + dryRun: false + maxIdle: 30 + maxOpen: 100 + maxLifetime: 120 + +cache: + adapter: "redis" + fileDir: "resource/cache" + +redis: + default: + mode: "single" + sentinelMasterName: "iotlcm-master" + address: "192.0.2.29:6379" + db: 0 + pass: "${REDIS_PASSWORD}" + minIdle: 5 + maxIdle: 30 + maxActive: 5000 + idleTimeout: "60s" + ClientName: "OpenAPICache" + +router: + exceptLogin: + - /openapi/v3/query/token + - /openapi/v3/query/operator-token + +upstream: + proxy: + address: "localhost:8510" + timeout: "10s" + gateway: + address: "localhost:8110" + timeout: "10s" + +rabbitmq: + enabled: true + dsn: "amqp://${MQ_USER}:${MQ_PASSWORD}@${MQ_HOST}/" diff --git a/manifest/deploy/kustomize/base/deployment.yaml b/manifest/deploy/kustomize/base/deployment.yaml new file mode 100644 index 0000000..28f1d69 --- /dev/null +++ b/manifest/deploy/kustomize/base/deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: template-single + labels: + app: template-single +spec: + replicas: 1 + selector: + matchLabels: + app: template-single + template: + metadata: + labels: + app: template-single + spec: + containers: + - name : main + image: template-single + imagePullPolicy: Always + diff --git a/manifest/deploy/kustomize/base/kustomization.yaml b/manifest/deploy/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..302d92d --- /dev/null +++ b/manifest/deploy/kustomize/base/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- deployment.yaml +- service.yaml + + + diff --git a/manifest/deploy/kustomize/base/service.yaml b/manifest/deploy/kustomize/base/service.yaml new file mode 100644 index 0000000..608771c --- /dev/null +++ b/manifest/deploy/kustomize/base/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: template-single +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 8000 + selector: + app: template-single + diff --git a/manifest/deploy/kustomize/overlays/develop/configmap.yaml b/manifest/deploy/kustomize/overlays/develop/configmap.yaml new file mode 100644 index 0000000..3b1d0af --- /dev/null +++ b/manifest/deploy/kustomize/overlays/develop/configmap.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: template-single-configmap +data: + config.yaml: | + server: + address: ":8000" + openapiPath: "/api.json" + swaggerPath: "/swagger" + + logger: + level : "all" + stdout: true diff --git a/manifest/deploy/kustomize/overlays/develop/deployment.yaml b/manifest/deploy/kustomize/overlays/develop/deployment.yaml new file mode 100644 index 0000000..04e4851 --- /dev/null +++ b/manifest/deploy/kustomize/overlays/develop/deployment.yaml @@ -0,0 +1,10 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: template-single +spec: + template: + spec: + containers: + - name : main + image: template-single:develop \ No newline at end of file diff --git a/manifest/deploy/kustomize/overlays/develop/kustomization.yaml b/manifest/deploy/kustomize/overlays/develop/kustomization.yaml new file mode 100644 index 0000000..4731c47 --- /dev/null +++ b/manifest/deploy/kustomize/overlays/develop/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../base +- configmap.yaml + +patchesStrategicMerge: +- deployment.yaml + +namespace: default + + + diff --git a/manifest/docker/Dockerfile b/manifest/docker/Dockerfile new file mode 100644 index 0000000..d85977d --- /dev/null +++ b/manifest/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM crpi-svwhn8x8nvask31h.cn-beijing.personal.cr.aliyuncs.com/xjzlpublic/alpine + +############################################################################### +# INSTALLATION +############################################################################### + +ENV WORKDIR /app +ADD resource $WORKDIR/ +ADD ./temp/linux_amd64/main $WORKDIR/main +RUN chmod +x $WORKDIR/main + +############################################################################### +# START +############################################################################### +WORKDIR $WORKDIR +CMD ./main diff --git a/manifest/docker/docker.sh b/manifest/docker/docker.sh new file mode 100644 index 0000000..ff393f9 --- /dev/null +++ b/manifest/docker/docker.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# This shell is executed before docker build. + + + + + diff --git a/manifest/i18n/.gitkeep b/manifest/i18n/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/manifest/protobuf/.keep-if-necessary b/manifest/protobuf/.keep-if-necessary new file mode 100644 index 0000000..e69de29 diff --git a/resource/template/.gitkeep b/resource/template/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/utility/convert/convert.go b/utility/convert/convert.go new file mode 100644 index 0000000..8b4be61 --- /dev/null +++ b/utility/convert/convert.go @@ -0,0 +1,92 @@ +// package convert +// @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 convert + +import ( + "reflect" + "slices" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/text/gstr" +) + +var ( + descTags = []string{"description", "dc", "json"} // 实体描述标签 + fieldTags = []string{"json"} // 实体字段名称映射 +) + +// EscapeFieldsToSlice 将转义过的字段转换为字段集切片 +func EscapeFieldsToSlice(s string) []string { + return gstr.Explode(",", gstr.Replace(gstr.Replace(s, "`,`", ","), "`", "")) +} + +// GetEntityDescTags 获取实体中的描述标签 +func GetEntityDescTags(entity interface{}) (tags []string, err error) { + var formRef = reflect.TypeOf(entity) + for i := 0; i < formRef.NumField(); i++ { + field := formRef.Field(i) + if field.Type.Kind() == reflect.Struct { + addTags, err := reflectTag(field.Type, descTags, []string{}) + if err != nil { + return nil, err + } + tags = append(tags, addTags...) + continue + } + tags = append(tags, reflectTagName(field, descTags, true)) + } + return +} + +// reflectTag 层级递增解析tag +func reflectTag(reflectType reflect.Type, filterTags []string, tags []string) ([]string, error) { + if reflectType.Kind() == reflect.Ptr { + return nil, gerror.Newf("reflect type do not support reflect.Ptr yet, reflectType:%+v", reflectType) + } + if reflectType.Kind() != reflect.Struct { + return nil, nil + } + for i := 0; i < reflectType.NumField(); i++ { + tag := reflectTagName(reflectType.Field(i), filterTags, false) + if tag == "" { + addTags, err := reflectTag(reflectType.Field(i).Type, filterTags, tags) + if err != nil { + return nil, err + } + tags = append(tags, addTags...) + continue + } + tags = append(tags, tag) + } + return tags, nil +} + +// reflectTagName 解析实体中的描述标签,优先级:description > dc > json > Name +func reflectTagName(field reflect.StructField, filterTags []string, isDef bool) string { + + if slices.Contains(filterTags, "description") { + if description, ok := field.Tag.Lookup("description"); ok && description != "" { + return description + } + } + + if slices.Contains(filterTags, "dc") { + if dc, ok := field.Tag.Lookup("dc"); ok && dc != "" { + return dc + } + } + + if slices.Contains(filterTags, "json") { + if jsonName, ok := field.Tag.Lookup("json"); ok && jsonName != "" { + return jsonName + } + } + + if !isDef { + return "" + } + return field.Name +} diff --git a/utility/excel/excel.go b/utility/excel/excel.go new file mode 100644 index 0000000..dbce1a4 --- /dev/null +++ b/utility/excel/excel.go @@ -0,0 +1,138 @@ +// package excel +// @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 excel + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "unicode" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/util/gconv" + excelize "github.com/xuri/excelize/v2" +) + +var ( + // 单元格表头 + char = []string{"", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} + // 默认行样式 + // defaultRowStyle = `{"font":{"color":"#666666","size":13,"family":"arial"},"alignment":{"vertical":"center","horizontal":"center"}}` + defaultRowStyle = &excelize.Style{ + Font: &excelize.Font{ + Color: "#666666", + Size: 13, + Family: "arial", + }, + Alignment: &excelize.Alignment{ + Vertical: "center", + Horizontal: "center", + }, + } +) + +// ExportByStructs 导出切片结构体到excel表格 +func ExportByStructs(ctx context.Context, tags []string, list interface{}, fileName string, sheetName string) (err error) { + f := excelize.NewFile() + f.SetSheetName("Sheet1", sheetName) + _ = f.SetRowHeight("Sheet1", 1, 30) + + rowStyleID, err := f.NewStyle(defaultRowStyle) + if err != nil { + return + } + _ = f.SetSheetRow(sheetName, "A1", &tags) + var ( + length = len(tags) + headStyle = letter(length) + lastRow string + widthRow string + ) + for k, v := range headStyle { + if k == length-1 { + lastRow = fmt.Sprintf("%s1", v) + widthRow = v + } + } + + if err = f.SetColWidth(sheetName, "A", widthRow, 30); err != nil { + return err + } + var rowNum = 1 + for _, v := range gconv.Interfaces(list) { + t := reflect.TypeOf(v) + value := reflect.ValueOf(v) + row := make([]interface{}, 0) + for l := 0; l < t.NumField(); l++ { + val := value.Field(l).Interface() + row = append(row, val) + } + rowNum++ + if err = f.SetSheetRow(sheetName, "A"+gconv.String(rowNum), &row); err != nil { + return + } + if err = f.SetCellStyle(sheetName, fmt.Sprintf("A%d", rowNum), lastRow, rowStyleID); err != nil { + return + } + } + r := ghttp.RequestFromCtx(ctx) + if r == nil { + err = gerror.New("ctx not http request") + return + } + writer := r.Response.Writer + writer.Header().Set("Content-Type", "application/octet-stream") + writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s.xlsx", url.QueryEscape(fileName))) + writer.Header().Set("Content-Transfer-Encoding", "binary") + writer.Header().Set("Access-Control-Expose-Headers", "Content-Disposition") + + if err = f.Write(writer); err != nil { + return + } + r.Response.Status = http.StatusOK + f.Close() + writer.Flush() + return +} + +// letter 生成完整的表头 +func letter(length int) []string { + var str []string + for i := 1; i <= length; i++ { + str = append(str, numToChars(i)) + } + return str +} + +// numToChars 将数字转换为具体的表格表头名称 +func numToChars(num int) string { + var cols string + v := num + for v > 0 { + k := v % 26 + if k == 0 { + k = 26 + } + v = (v - k) / 26 + cols = char[k] + cols + } + return cols +} + +// NextLetter 传入一个字母,获取下一个字母 +func NextLetter(input string) string { + if len(input) == 0 { + return "" + } + upperInput := unicode.ToUpper(rune(input[0])) + if upperInput >= 'A' && upperInput < 'Z' { + return string(upperInput + 1) + } + return "A" +} diff --git a/utility/gfredis/conn.go b/utility/gfredis/conn.go new file mode 100644 index 0000000..ef16061 --- /dev/null +++ b/utility/gfredis/conn.go @@ -0,0 +1,11 @@ +package gfredis + +import ( + "context" + + "github.com/redis/go-redis/v9" +) + +func (r *Redis) Conn(ctx context.Context) (*redis.Conn, error) { + return r.rdb.Conn(), nil +} diff --git a/utility/gfredis/gfredis.go b/utility/gfredis/gfredis.go new file mode 100644 index 0000000..d6d230b --- /dev/null +++ b/utility/gfredis/gfredis.go @@ -0,0 +1,150 @@ +package gfredis + +import ( + "context" + "crypto/tls" + "sync" + "time" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" + "github.com/redis/go-redis/v9" +) + +const ( + DefaultGroupName = "default" // Default configuration group name. +) + +var ( + lock sync.RWMutex + instances map[string]*Redis +) + +func init() { + instances = make(map[string]*Redis) +} + +type Redis struct { + config *Config + rdb *redis.Client +} + +// Config is redis configuration. +type Config struct { + // Address It supports single and cluster redis server. Multiple addresses joined with char ','. Eg: 192.168.1.1:6379, 192.168.1.2:6379. + Address string `json:"address"` + Db int `json:"db"` // Redis db. + User string `json:"user"` // Username for AUTH. + Pass string `json:"pass"` // Password for AUTH. + SentinelUser string `json:"sentinel_user"` // Username for sentinel AUTH. + SentinelPass string `json:"sentinel_pass"` // Password for sentinel AUTH. + MinIdle int `json:"minIdle"` // Minimum number of connections allowed to be idle (default is 0) + MaxIdle int `json:"maxIdle"` // Maximum number of connections allowed to be idle (default is 10) + MaxActive int `json:"maxActive"` // Maximum number of connections limit (default is 0 means no limit). + MaxConnLifetime time.Duration `json:"maxConnLifetime"` // Maximum lifetime of the connection (default is 30 seconds, not allowed to be set to 0) + IdleTimeout time.Duration `json:"idleTimeout"` // Maximum idle time for connection (default is 10 seconds, not allowed to be set to 0) + WaitTimeout time.Duration `json:"waitTimeout"` // Timed out duration waiting to get a connection from the connection pool. + DialTimeout time.Duration `json:"dialTimeout"` // Dial connection timeout for TCP. + ReadTimeout time.Duration `json:"readTimeout"` // Read timeout for TCP. DO NOT set it if not necessary. + WriteTimeout time.Duration `json:"writeTimeout"` // Write timeout for TCP. + MasterName string `json:"masterName"` // Used in Redis Sentinel mode. + TLS bool `json:"tls"` // Specifies whether TLS should be used when connecting to the server. + TLSSkipVerify bool `json:"tlsSkipVerify"` // Disables server name verification when connecting over TLS. + TLSConfig *tls.Config `json:"-"` // TLS Config to use. When set TLS will be negotiated. + SlaveOnly bool `json:"slaveOnly"` // Route all commands to slave read-only nodes. + Cluster bool `json:"cluster"` // Specifies whether cluster mode be used. + Protocol int `json:"protocol"` // Specifies the RESP version (Protocol 2 or 3.) +} + +func New(groupName string, config *Config) *Redis { + instance := &Redis{ + config: config, + } + if config == nil { + instance.rdb = redis.NewClient(&redis.Options{}) + return instance + } + poolSize := config.MaxActive + if poolSize == 0 { + poolSize = 10 + config.MaxActive = 10 + } + + if config.IdleTimeout < 1*time.Minute { + config.IdleTimeout = 30 * time.Minute + } + if config.MaxConnLifetime <= 1 { + config.MaxConnLifetime = 24 * 365 * 10 * time.Hour + } + if config.WaitTimeout < 1*time.Second { + config.WaitTimeout = 6 * time.Second + } + if config.DialTimeout < 1*time.Second { + config.DialTimeout = 5 * time.Second + } + if config.ReadTimeout < 1*time.Second { + config.ReadTimeout = 5 * time.Second + } + if config.WriteTimeout < 1*time.Second { + config.WriteTimeout = 5 * time.Second + } + opt := &redis.Options{ + Addr: config.Address, + Password: config.Pass, + DB: config.Db, + MinIdleConns: config.MinIdle, + MaxIdleConns: config.MaxIdle, + MaxActiveConns: config.MaxActive, + ConnMaxIdleTime: config.IdleTimeout, + PoolSize: poolSize, + PoolTimeout: config.WaitTimeout, + DialTimeout: config.DialTimeout, + ReadTimeout: config.ReadTimeout, + WriteTimeout: config.WriteTimeout, + TLSConfig: config.TLSConfig, + // IdentitySuffix: config.IdentitySuffix, + // ConnMaxLifetime: config.MaxConnLifetime, + } + instance.rdb = redis.NewClient(opt) + g.Log().Noticef(context.Background(), "groupName: %s, opt: %+v", groupName, opt) + return instance +} + +func GetConfig(name string) *Config { + cfg, err := g.Cfg().Get(context.Background(), "redis."+name) + if err != nil { + panic(err) + } + if cfg == nil || cfg.IsNil() { + panic("redis config not found: " + name) + } + config := &Config{} + if err = gconv.Scan(cfg.Map(), config); err != nil { + panic(`invalid redis configuration: ` + cfg.String()) + } + return config +} + +func Instance(name ...string) *Redis { + groupName := DefaultGroupName + if len(name) > 0 { + groupName = name[0] + if groupName == "" { + groupName = DefaultGroupName + } + } + lock.RLock() + instance, ok := instances[groupName] + lock.RUnlock() + if !ok { + lock.Lock() + instance, ok = instances[groupName] + if !ok { + instance = New(groupName, GetConfig(groupName)) + instances[groupName] = instance + } + lock.Unlock() + return instance + } + return instance +} diff --git a/utility/gfredis/hash.go b/utility/gfredis/hash.go new file mode 100644 index 0000000..61d88c3 --- /dev/null +++ b/utility/gfredis/hash.go @@ -0,0 +1,51 @@ +package gfredis + +import ( + "context" + + "github.com/gogf/gf/v2/util/gconv" + "github.com/redis/go-redis/v9" +) + +func (r *Redis) HMSet(ctx context.Context, key string, mp map[string]interface{}) error { + mp2 := make(map[string]string) + for k, v := range mp { + mp2[k] = gconv.String(v) + } + cmd := r.rdb.HMSet(ctx, key, mp2) + return cmd.Err() +} +func (r *Redis) HGetAll(ctx context.Context, key string) (map[string]string, error) { + cmd := r.rdb.HGetAll(ctx, key) + return cmd.Val(), cmd.Err() +} + +func (r *Redis) HGet(ctx context.Context, key, field string) (string, error) { + cmd := r.rdb.HGet(ctx, key, field) + if cmd.Err() == redis.Nil { + return "", nil + } + return cmd.Val(), cmd.Err() +} + +func (r *Redis) HSet(ctx context.Context, key string, mp map[string]interface{}) error { + mp2 := make(map[string]string) + for k, v := range mp { + mp2[k] = gconv.String(v) + } + cmd := r.rdb.HSet(ctx, key, mp2) + return cmd.Err() +} + +func (r *Redis) HSetNX(ctx context.Context, key, field string, value interface{}) (bool, error) { + cmd := r.rdb.HSetNX(ctx, key, field, gconv.String(value)) + return cmd.Val(), cmd.Err() +} +func (r *Redis) HDel(ctx context.Context, key string, field string) (int64, error) { + cmd := r.rdb.HDel(ctx, key, field) + return cmd.Val(), cmd.Err() +} +func (r *Redis) HLen(ctx context.Context, key string) (int64, error) { + cmd := r.rdb.HLen(ctx, key) + return cmd.Val(), cmd.Err() +} diff --git a/utility/gfredis/key.go b/utility/gfredis/key.go new file mode 100644 index 0000000..8f5e1d2 --- /dev/null +++ b/utility/gfredis/key.go @@ -0,0 +1,16 @@ +package gfredis + +import ( + "context" + + "github.com/gogf/gf/v2/frame/g" + "github.com/redis/go-redis/v9" +) + +func (r *Redis) Do(ctx context.Context, args ...interface{}) (*g.Var, error) { + cmd := r.rdb.Do(ctx, args...) + if cmd.Err() == redis.Nil { + return g.NewVar(nil), nil + } + return g.NewVar(cmd.Val()), cmd.Err() +} diff --git a/utility/gfredis/list.go b/utility/gfredis/list.go new file mode 100644 index 0000000..924aa6a --- /dev/null +++ b/utility/gfredis/list.go @@ -0,0 +1,37 @@ +package gfredis + +import ( + "context" + "time" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" + "github.com/redis/go-redis/v9" +) + +func (r *Redis) LRange(ctx context.Context, key string, start, stop int64) (*g.Var, error) { + cmd := r.rdb.LRange(ctx, key, start, stop) + if cmd.Err() == redis.Nil { + return g.NewVar(nil), nil + } + return g.NewVar(cmd.Val()), cmd.Err() +} +func (r *Redis) RPush(ctx context.Context, key string, value interface{}) (int64, error) { + cmd := r.rdb.RPush(ctx, key, gconv.String(value)) + return cmd.Val(), cmd.Err() +} +func (r *Redis) LLen(ctx context.Context, key string) (int64, error) { + cmd := r.rdb.LLen(ctx, key) + return cmd.Val(), cmd.Err() +} +func (r *Redis) LTrim(ctx context.Context, key string, start, stop int64) error { + cmd := r.rdb.LTrim(ctx, key, start, stop) + return cmd.Err() +} +func (r *Redis) BLPop(ctx context.Context, timeout time.Duration, keys ...string) (*g.Var, error) { + cmd := r.rdb.BLPop(ctx, timeout, keys...) + if cmd.Err() == redis.Nil { + return g.NewVar(nil), nil + } + return g.NewVar(cmd.Val()), cmd.Err() +} diff --git a/utility/gfredis/string.go b/utility/gfredis/string.go new file mode 100644 index 0000000..7942811 --- /dev/null +++ b/utility/gfredis/string.go @@ -0,0 +1,42 @@ +package gfredis + +import ( + "context" + "time" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" + "github.com/redis/go-redis/v9" +) + +func (r *Redis) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error { + cmd := r.rdb.Set(ctx, key, gconv.String(value), expiration) + return cmd.Err() +} + +func (r *Redis) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error) { + cmd := r.rdb.SetNX(ctx, key, gconv.String(value), expiration) + return cmd.Val(), cmd.Err() +} + +func (r *Redis) Get(ctx context.Context, key string) (*g.Var, error) { + cmd := r.rdb.Get(ctx, key) + if cmd.Err() == redis.Nil { + return g.NewVar(nil), nil + } + return g.NewVar(cmd.Val()), cmd.Err() +} + +func (r *Redis) UpdateExpire(ctx context.Context, key string, expiration time.Duration) (bool, error) { + cmd := r.rdb.Expire(ctx, key, expiration) + return cmd.Val(), cmd.Err() +} + +func (r *Redis) Remove(ctx context.Context, key string) (bool, error) { + cmd := r.rdb.Del(ctx, key) + return cmd.Val() > 0, cmd.Err() +} +func (r *Redis) Del(ctx context.Context, key string) (int64, error) { + cmd := r.rdb.Del(ctx, key) + return cmd.Val(), cmd.Err() +} diff --git a/utility/gfredis/subpub.go b/utility/gfredis/subpub.go new file mode 100644 index 0000000..30f4dcc --- /dev/null +++ b/utility/gfredis/subpub.go @@ -0,0 +1,18 @@ +package gfredis + +import ( + "context" + + "github.com/gogf/gf/v2/util/gconv" + "github.com/redis/go-redis/v9" +) + +func (r *Redis) Subscribe(ctx context.Context, channels ...string) (*redis.PubSub, error) { + cmd := r.rdb.Subscribe(ctx, channels...) + return cmd, nil +} + +func (r *Redis) Publish(ctx context.Context, channel string, message interface{}) (int64, error) { + cmd := r.rdb.Publish(ctx, channel, gconv.String(message)) + return cmd.Val(), cmd.Err() +} diff --git a/utility/gfredis/zset.go b/utility/gfredis/zset.go new file mode 100644 index 0000000..0139083 --- /dev/null +++ b/utility/gfredis/zset.go @@ -0,0 +1,21 @@ +package gfredis + +import ( + "context" +) + +func (r *Redis) ZPopByScore(ctx context.Context, key string, min, max string, limit int64) (res []string, err error) { + var luaScript = ` + local members = redis.call('ZRANGEBYSCORE', KEYS[1], ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) + if #members > 0 then + redis.call('ZREM', KEYS[1], unpack(members)) + end + return members + ` + cmd := r.rdb.Eval(ctx, luaScript, []string{key}, min, max, limit) + if err = cmd.Err(); err != nil { + return nil, err + } + res, err = cmd.StringSlice() + return +} diff --git a/utility/hash/crc16.go b/utility/hash/crc16.go new file mode 100644 index 0000000..2abb7c9 --- /dev/null +++ b/utility/hash/crc16.go @@ -0,0 +1,100 @@ +package hash + +import ( + "os" +) + +// Table of CRC values for high–order byte +var crcHighBytes = []byte{ + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, +} + +// Table of CRC values for low-order byte +var crcLowBytes = []byte{ + 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, + 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, + 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, + 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10, + 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, + 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, + 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, + 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, + 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, + 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, + 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, + 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, + 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, + 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, + 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, + 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40, +} + +// Cyclical Redundancy Checking +type Crc16 struct { + high byte + low byte +} + +func (crc *Crc16) Reset() *Crc16 { + crc.high = 0xFF + crc.low = 0xFF + return crc +} + +func (crc *Crc16) PushBytes(bs []byte) *Crc16 { + var idx, b byte + + for _, b = range bs { + idx = crc.low ^ b + crc.low = crc.high ^ crcHighBytes[idx] + crc.high = crcLowBytes[idx] + } + return crc +} + +func (crc *Crc16) Value() uint16 { + return uint16(crc.high)<<8 | uint16(crc.low) +} + +func Crc16ChecksumData(bs []byte) uint16 { + crc := &Crc16{} + crc.Reset() + crc.PushBytes(bs) + return crc.Value() +} + +func Crc16ChecksumFile(filePath string) uint16 { + file, err := os.Open(filePath) + if err != nil { + return 0 + } + defer file.Close() + crc := &Crc16{} + crc.Reset() + // 分块读取 + blockSize := 1024 * 1024 + buf := make([]byte, blockSize) + for { + n, err := file.Read(buf) + if err != nil { + break + } + crc.PushBytes(buf[:n]) + } + return crc.Value() +} diff --git a/utility/hash/sum16.go b/utility/hash/sum16.go new file mode 100644 index 0000000..d95e9be --- /dev/null +++ b/utility/hash/sum16.go @@ -0,0 +1,31 @@ +package hash + +import "os" + +func Sum16ChecksumData(bs []byte) uint16 { + sum := uint16(0) + for _, b := range bs { + sum += uint16(b) + } + return sum +} + +func Sum16ChecksumFile(filePath string) uint16 { + file, err := os.Open(filePath) + if err != nil { + return 0 + } + defer file.Close() + // 分块读取 + blockSize := 1024 * 1024 + buf := make([]byte, blockSize) + sum := uint16(0) + for { + n, err := file.Read(buf) + if err != nil { + break + } + sum += Sum16ChecksumData(buf[:n]) + } + return sum +} diff --git a/utility/tree/tree.go b/utility/tree/tree.go new file mode 100644 index 0000000..9a0a27d --- /dev/null +++ b/utility/tree/tree.go @@ -0,0 +1,109 @@ +// package tree +// @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 tree + +import ( + "fmt" + "strings" + + "github.com/gogf/gf/v2/util/gconv" +) + +const ( + treeDefaultId = "id" // 树ID + treeDefaultPid = "pid" // 上级树ID + treeDefaultChildren = "children" // 下级属性 + treeBeginCut = "tr_" // 树标识开头 + treeEndCut = " " // 树标识结尾 +) + +// GenOption 生成选项 +type GenOption struct { + IdField string + PidField string + ChildrenField string +} + +// GenLabel 生成关系树标识 +func GenLabel(basic string, appendId int64) string { + return fmt.Sprintf("%v%v%v%v", basic, treeBeginCut, appendId, treeEndCut) +} + +// GetIdLabel 获取指定Id的树标签 +func GetIdLabel(id int64) string { + return fmt.Sprintf("%v%v%v", treeBeginCut, id, treeEndCut) +} + +// GetIds 获取上级ID集合 +func GetIds(tree string) (ids []int64) { + idsStr := strings.Split(tree, treeEndCut) + if len(idsStr) == 0 { + return + } + + for _, v := range idsStr { + newId := gconv.Int64(strings.ReplaceAll(v, treeBeginCut, "")) + if newId > 0 { + ids = append(ids, newId) + } + } + return +} + +// GenTree 生成关系树 +func GenTree(menus []map[string]interface{}) (realMenu []map[string]interface{}) { + return GenTreeWithField(menus, GenOption{ + IdField: treeDefaultId, + PidField: treeDefaultPid, + ChildrenField: treeDefaultChildren, + }) +} + +// GenTreeWithField 生成关系树 自定义生成属性 +func GenTreeWithField(menus []map[string]interface{}, op GenOption) (realMenu []map[string]interface{}) { + if len(menus) < 1 { + return + } + + minPid := GetMinPid(menus, op.PidField) + formatMenu := make(map[int]map[string]interface{}) + for _, m := range menus { + formatMenu[gconv.Int(m[op.IdField])] = m + if gconv.Int(m[op.PidField]) == minPid { + realMenu = append(realMenu, m) // 需要返回的顶级菜单 + } + } + // 得益于都是地址操作,可以直接往父级塞 + for _, m := range formatMenu { + if formatMenu[gconv.Int(m[op.PidField])] == nil { + continue + } + if formatMenu[gconv.Int(m[op.PidField])][op.ChildrenField] == nil { + formatMenu[gconv.Int(m[op.PidField])][op.ChildrenField] = []map[string]interface{}{} + } + + formatMenu[gconv.Int(m[op.PidField])][op.ChildrenField] = append(formatMenu[gconv.Int(m[op.PidField])][op.ChildrenField].([]map[string]interface{}), m) + } + return +} + +func GetMinPid(menus []map[string]interface{}, pidField string) int { + index := -1 + for _, m := range menus { + if index == -1 { + index = gconv.Int(m[pidField]) + continue + } + if gconv.Int(m[pidField]) < index { + index = gconv.Int(m[pidField]) + } + } + + if index == -1 { + return 0 + } + return index +} diff --git a/utility/utility.go b/utility/utility.go new file mode 100644 index 0000000..be4735c --- /dev/null +++ b/utility/utility.go @@ -0,0 +1,283 @@ +// package utility +// @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 utility + +import ( + "context" + "fmt" + "io" + "net" + "net/http" + "os" + "path/filepath" + "slices" + "strconv" + "strings" + "time" + + "github.com/gogf/gf/v2/crypto/gmd5" + "github.com/gogf/gf/v2/encoding/gcharset" + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" + "github.com/mileusna/useragent" + "golang.org/x/exp/rand" +) + +func Md5(str string) string { + return gmd5.MustEncryptString(str) +} + +// 密码加密 +func PasswordEncrypt(password string, salt string) string { + return Md5(password + salt) +} + +// 解析时间 +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 +} + +// 随机生成5位字符 +func RandomString(n int) string { + letters := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + b := make([]byte, n) + for i := range b { + b[i] = letters[rand.Intn(len(letters))] + } + return string(b) +} + +// 获取客户端IP +func GetClientIp(ctx context.Context) string { + if ctx == nil { + return "" + } + if ghttp.RequestFromCtx(ctx) == nil { + return "" + } + return ghttp.RequestFromCtx(ctx).GetClientIp() +} + +// 获取user-agent +func GetUserAgent(ctx context.Context) string { + return ghttp.RequestFromCtx(ctx).Header.Get("User-Agent") +} + +// 获取操作系统 +func GetOs(ctx context.Context) string { + userAgent := GetUserAgent(ctx) + ua := useragent.Parse(userAgent) + return ua.OS +} + +// 获取浏览器 +func GetBrowser(ctx context.Context) string { + userAgent := GetUserAgent(ctx) + ua := useragent.Parse(userAgent) + return ua.Name +} + +// 获取ip所属城市 +func GetCityByIp(ip string) string { + if ip == "" { + return "" + } + if ip == "[::1]" || ip == "127.0.0.1" { + return "内网IP" + } + url := "https://whois.pconline.com.cn/ipJson.jsp?json=true&ip=" + ip + bytes := g.Client().GetBytes(context.TODO(), url) + src := string(bytes) + srcCharset := "GBK" + tmp, _ := gcharset.ToUTF8(srcCharset, src) + json, err := gjson.DecodeToJson(tmp) + if err != nil { + return "" + } + if json.Get("code").Int() == 0 { + city := "" + if strings.EqualFold(json.Get("pro").String(), json.Get("city").String()) { + city = fmt.Sprintf("%s", json.Get("pro").String()) + } else { + city = fmt.Sprintf("%s %s", json.Get("pro").String(), json.Get("city").String()) + } + + return city + } else { + return "" + } +} + +// 时间戳转 yyyy-MM-dd HH:mm:ss +func TimeStampToDateTime(timeStamp int64) string { + tm := gtime.NewFromTimeStamp(timeStamp) + return tm.Format("Y-m-d H:i:s") +} + +// 时间戳转 yyyy-MM-dd +func TimeStampToDate(timeStamp int64) string { + tm := gtime.NewFromTimeStamp(timeStamp) + return tm.Format("Y-m-d") +} + +// 服务端ip +func GetLocalIP() (ip string, err error) { + addrs, err := net.InterfaceAddrs() + if err != nil { + return + } + for _, addr := range addrs { + ipAddr, ok := addr.(*net.IPNet) + if !ok { + continue + } + if ipAddr.IP.IsLoopback() { + continue + } + if !ipAddr.IP.IsGlobalUnicast() { + continue + } + return ipAddr.IP.String(), nil + } + return +} +func GetPublicIP() (ip string, err error) { + resp, err := http.Get("https://ifconfig.co/ip") + if err != nil { + fmt.Println("GetPublicIP", err) + return + } + defer func(Body io.ReadCloser) { + if err := Body.Close(); err != nil { + fmt.Println("GetPublicIP Body.Close", err) + } + }(resp.Body) + body, err := io.ReadAll(resp.Body) + if err != nil { + fmt.Println("GetPublicIP ReadAll", err) + return + } + ip = string(body) + // 去除空格 + ip = strings.Replace(ip, " ", "", -1) + // 去除换行符 + ip = strings.Replace(ip, "\n", "", -1) + + return +} + +// 获取两个字符串之间的字符串 +func GetBetweenStr(str, start, end string) (result string) { + startIndex := strings.Index(str, start) + if startIndex == -1 { + return "" + } + // 更新startIndex为开始字符串之后的位置 + startIndex += len(start) + + // 找到结束字符串的位置,从更新后的startIndex开始查找 + endIndex := strings.Index(str[startIndex:], end) + if endIndex == -1 { + return "" + } + + // 切片操作获取中间的字符串 + result = str[startIndex : startIndex+endIndex] + return +} + +// A和B两个数组,A数组中存在,B数组中不存在 +func ArrayRightDiff(a, b []int64) []int64 { + diff := make([]int64, 0) + for _, v := range a { + if !slices.Contains(b, v) { + diff = append(diff, v) + } + } + return diff +} + +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 +} +func DirSize(dirname string) string { + var ( + s int64 + files, _ = WalkDir(dirname) + ) + for _, n := range files { + s += n.size + } + return FileSize(s) +} +func MergeAbs(path string, fileName ...string) string { + var paths = []string{gfile.RealPath(path)} + paths = append(paths, fileName...) + return gfile.Join(paths...) +} + +// 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]) +} + +// UniqueSlice 切片去重 +func UniqueSlice[K comparable](languages []K) []K { + result := make([]K, 0, len(languages)) + temp := map[K]struct{}{} + for _, item := range languages { + if _, ok := temp[item]; !ok { + temp[item] = struct{}{} + result = append(result, item) + } + } + return result +} diff --git a/utility/uuid32/uuid32.go b/utility/uuid32/uuid32.go new file mode 100644 index 0000000..331b904 --- /dev/null +++ b/utility/uuid32/uuid32.go @@ -0,0 +1,15 @@ +package uuid32 + +import ( + "strings" + + "github.com/google/uuid" +) + +func New() string { + return strings.ReplaceAll(uuid.NewString(), "-", "") +} + +func S() string { + return New() +} diff --git a/utility/version/version.go b/utility/version/version.go new file mode 100644 index 0000000..e718bcf --- /dev/null +++ b/utility/version/version.go @@ -0,0 +1,45 @@ +// package version +// @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 version + +import ( + "context" + "fmt" + + "github.com/gogf/gf/v2/frame/g" +) + +var ( + BuildTime string + BuildVersion string + CommitID string +) + +func ShowLogo(buildVersion, buildTime, commitID string) { + BuildVersion = buildVersion + BuildTime = buildTime + CommitID = commitID + //版本号 + + fmt.Println(` + ██╗██╗███████╗ ██╗ ██████╗ ████████╗ + ██║██║██╔════╝ ██║██╔═══██╗╚══██╔══╝ + ██║██║█████╗ ██║██║ ██║ ██║ +██ ██║██║██╔══╝ ██║██║ ██║ ██║ +╚█████╔╝██║███████╗ ██║╚██████╔╝ ██║ + ╚════╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝`) + fmt.Println("") + + fmt.Println("Version :", buildVersion) + fmt.Println("BuildTime :", buildTime) + fmt.Println("CommitID :", commitID) + fmt.Println("") + fmt.Println("Copyright:", "2026 The iotLCM Authors") +} + +func AppName(ctx context.Context) string { + return g.Cfg().MustGet(ctx, "system.appName", "IotLCM").String() +}