chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
+268
View File
@@ -0,0 +1,268 @@
// ================================================================================
// 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-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity"
"github.com/gogf/gf/v2/database/gdb"
)
type (
IAgentDept interface {
DeptExport(ctx context.Context, in *model.AgentDeptListParam) error
DeptList(ctx context.Context, in *model.AgentDeptListParam) (list []*model.AgentEnterpriseCustomerModel, total int, err error)
DeptView(ctx context.Context, deptId int64) (res *model.AgentEnterpriseCustomerModel, err error)
DeptSave(ctx context.Context, in *model.AgentDeptSaveParam) (deptId int64, err error)
// EnsureCurrentDeptDefaultRole upgrades legacy child enterprises that did not
// receive an inherited administrator role when they were created.
EnsureCurrentDeptDefaultRole(ctx context.Context) error
// DeptDelete 删除企业客户
DeptDelete(ctx context.Context, deptId int64) (err error)
DeptResetPassword(ctx context.Context, deptId int64, password string) (err error)
// GetDeptApiInfo 获取当前代理商组织的 API 集成信息
GetDeptApiInfo(ctx context.Context) (res *model.AgentDeptApiModel, err error)
// SubCompany 获取当前代理商组织的子组织列表
SubCompany(ctx context.Context) (list []*model.SysDeptTreeModel, err error)
// IsTopDept 判断当前组织是否为顶级组织
IsTopDept(ctx context.Context) (isTop bool, dept *entity.SysDept, err error)
}
IAgentMenu interface {
// AllowedMenuIdsByDeptRole 获取当前机构允许的菜单ID
AllowedMenuIdsByDeptRole(ctx context.Context, deptId int64) (menuIds []int64, err error)
AllowedMenuTree(ctx context.Context, deptId int64) (tree []*model.SysMenuTreeModel, menuIds []int64, err error)
}
IAgentRole interface {
// RoleList 查询当前登录组织本级角色列表。
RoleList(ctx context.Context, in *model.AgentRoleListParam) (list []*model.AgentRoleListModel, total int, err error)
// RoleView 查询角色详情,并返回当前登录组织可分配的菜单树。
RoleView(ctx context.Context, roleId int64) (res *model.AgentRoleViewModel, err error)
// RoleSave 保存代理商角色,按角色ID区分新增和修改流程。
RoleSave(ctx context.Context, in *model.AgentRoleSaveParam) (roleId int64, err error)
// RoleDelete 删除代理商角色,删除前校验本级机构默认角色不可被删除。
RoleDelete(ctx context.Context, roleIds []int64) (err error)
}
IAgentScope interface {
ScopeDeptIds(ctx context.Context) (deptIds []int64, err error)
}
IAgentUser interface {
UserExport(ctx context.Context, in *model.AgentUserListParam) error
// UserList 查询用户列表
UserList(ctx context.Context, in *model.AgentUserListParam) (list []*model.AgentUserListModel, total int, err error)
// UserView 查看用户详情
UserView(ctx context.Context, userId int64) (res *model.AgentUserViewModel, err error)
// UserSave 新增/修改用户
UserSave(ctx context.Context, in *model.SysUserAddModel) (res *model.AgentUserViewModel, err error)
// UserUpdate 更新用户
UserUpdate(ctx context.Context, in *model.SysUserUpdateModel) (err error)
// UserDelete 删除用户
UserDelete(ctx context.Context, userIds []int64) (err error)
// UserResetPassword 重置用户密码
UserResetPassword(ctx context.Context, userId int64, password string) (err error)
}
IAgentEnterprise interface {
// Model 企业客户单位信息ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取企业客户单位信息列表
List(ctx context.Context, in *model.TAgentEnterpriseListParam) (list []*model.TAgentEnterpriseListModel, totalCount int, err error)
// Export 导出企业客户单位信息
Export(ctx context.Context, in *model.TAgentEnterpriseListParam) (err error)
// Edit 修改/新增企业客户单位信息
Edit(ctx context.Context, in *model.TAgentEnterpriseEditParam) (err error)
// Delete 删除企业客户单位信息
Delete(ctx context.Context, in *model.TAgentEnterpriseDeleteParam) (err error)
// View 获取企业客户单位信息指定信息
View(ctx context.Context, in *model.TAgentEnterpriseViewParam) (res *model.TAgentEnterpriseViewModel, err error)
}
IAgentTApi interface {
// Model API集成ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取API集成列表
List(ctx context.Context, in *model.TApiListParam) (list []*model.TApiListModel, totalCount int, err error)
// Export 导出API集成
Export(ctx context.Context, in *model.TApiListParam) (err error)
// Edit 修改/新增API集成
Edit(ctx context.Context, in *model.TApiEditParam) (err error)
// Delete 删除API集成
Delete(ctx context.Context, in *model.TApiDeleteParam) (err error)
// View 获取API集成指定信息
View(ctx context.Context, in *model.TApiViewParam) (res *model.TApiViewModel, err error)
}
IAgentTApiGroup interface {
// Model 返回开放接口权限组 ORM 模型,默认启用租户和数据权限过滤。
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 分页查询开放接口权限组列表。
List(ctx context.Context, in *model.TApiGroupListParam) (list []*model.TApiGroupListModel, totalCount int, err error)
// Export 导出开放接口权限组列表。
Export(ctx context.Context, in *model.TApiGroupListParam) (err error)
// Edit 新增或修改开放接口权限组,并同步维护权限组与接口资源的关联。
Edit(ctx context.Context, in *model.TApiGroupEditParam) (err error)
// Delete 删除开放接口权限组,并删除该权限组下的资源关联。
Delete(ctx context.Context, in *model.TApiGroupDeleteParam) (err error)
// View returns the API group detail with bound resource IDs and resource list.
View(ctx context.Context, in *model.TApiGroupViewParam) (res *model.TApiGroupViewModel, err error)
// Status 更新开放接口权限组启停状态。
Status(ctx context.Context, in *model.TApiGroupStatusParam) (err error)
}
IAgentTApiResource interface {
// Model 返回开放接口资源 ORM 模型,默认启用租户和数据权限过滤。
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 分页查询开放接口资源列表。
List(ctx context.Context, in *model.TApiResourceListParam) (list []*model.TApiResourceListModel, totalCount int, err error)
// Export 导出开放接口资源列表。
Export(ctx context.Context, in *model.TApiResourceListParam) (err error)
// Edit 新增或修改开放接口资源。
Edit(ctx context.Context, in *model.TApiResourceEditParam) (err error)
// Delete 删除开放接口资源,并清理权限组资源关联。
Delete(ctx context.Context, in *model.TApiResourceDeleteParam) (err error)
// View 查询开放接口资源详情。
View(ctx context.Context, in *model.TApiResourceViewParam) (res *model.TApiResourceViewModel, err error)
// Status 更新开放接口资源启停状态。
Status(ctx context.Context, in *model.TApiResourceStatusParam) (err error)
}
IAgentTCustWithdrawAccount interface {
// Model 客户提现账户表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取客户提现账户表列表
List(ctx context.Context, in *model.TCustWithdrawAccountListParam) (list []*model.TCustWithdrawAccountListModel, totalCount int, err error)
// Export 导出客户提现账户表
Export(ctx context.Context, in *model.TCustWithdrawAccountListParam) (err error)
// Edit 修改/新增客户提现账户表
Edit(ctx context.Context, in *model.TCustWithdrawAccountEditParam) (err error)
// Delete 删除客户提现账户表
Delete(ctx context.Context, in *model.TCustWithdrawAccountDeleteParam) (err error)
// View 获取客户提现账户表指定信息
View(ctx context.Context, in *model.TCustWithdrawAccountViewParam) (res *model.TCustWithdrawAccountViewModel, err error)
// Status 更新客户提现账户表状态
Status(ctx context.Context, in *model.TCustWithdrawAccountStatusParam) (err error)
}
)
var (
localAgentDept IAgentDept
localAgentMenu IAgentMenu
localAgentRole IAgentRole
localAgentScope IAgentScope
localAgentUser IAgentUser
localAgentEnterprise IAgentEnterprise
localAgentTApi IAgentTApi
localAgentTApiGroup IAgentTApiGroup
localAgentTApiResource IAgentTApiResource
localAgentTCustWithdrawAccount IAgentTCustWithdrawAccount
)
func AgentDept() IAgentDept {
if localAgentDept == nil {
panic("implement not found for interface IAgentDept, forgot register?")
}
return localAgentDept
}
func RegisterAgentDept(i IAgentDept) {
localAgentDept = i
}
func AgentMenu() IAgentMenu {
if localAgentMenu == nil {
panic("implement not found for interface IAgentMenu, forgot register?")
}
return localAgentMenu
}
func RegisterAgentMenu(i IAgentMenu) {
localAgentMenu = i
}
func AgentRole() IAgentRole {
if localAgentRole == nil {
panic("implement not found for interface IAgentRole, forgot register?")
}
return localAgentRole
}
func RegisterAgentRole(i IAgentRole) {
localAgentRole = i
}
func AgentScope() IAgentScope {
if localAgentScope == nil {
panic("implement not found for interface IAgentScope, forgot register?")
}
return localAgentScope
}
func RegisterAgentScope(i IAgentScope) {
localAgentScope = i
}
func AgentUser() IAgentUser {
if localAgentUser == nil {
panic("implement not found for interface IAgentUser, forgot register?")
}
return localAgentUser
}
func RegisterAgentUser(i IAgentUser) {
localAgentUser = i
}
func AgentEnterprise() IAgentEnterprise {
if localAgentEnterprise == nil {
panic("implement not found for interface IAgentEnterprise, forgot register?")
}
return localAgentEnterprise
}
func RegisterAgentEnterprise(i IAgentEnterprise) {
localAgentEnterprise = i
}
func AgentTApi() IAgentTApi {
if localAgentTApi == nil {
panic("implement not found for interface IAgentTApi, forgot register?")
}
return localAgentTApi
}
func RegisterAgentTApi(i IAgentTApi) {
localAgentTApi = i
}
func AgentTApiGroup() IAgentTApiGroup {
if localAgentTApiGroup == nil {
panic("implement not found for interface IAgentTApiGroup, forgot register?")
}
return localAgentTApiGroup
}
func RegisterAgentTApiGroup(i IAgentTApiGroup) {
localAgentTApiGroup = i
}
func AgentTApiResource() IAgentTApiResource {
if localAgentTApiResource == nil {
panic("implement not found for interface IAgentTApiResource, forgot register?")
}
return localAgentTApiResource
}
func RegisterAgentTApiResource(i IAgentTApiResource) {
localAgentTApiResource = i
}
func AgentTCustWithdrawAccount() IAgentTCustWithdrawAccount {
if localAgentTCustWithdrawAccount == nil {
panic("implement not found for interface IAgentTCustWithdrawAccount, forgot register?")
}
return localAgentTCustWithdrawAccount
}
func RegisterAgentTCustWithdrawAccount(i IAgentTCustWithdrawAccount) {
localAgentTCustWithdrawAccount = i
}
+554
View File
@@ -0,0 +1,554 @@
// ================================================================================
// 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-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity"
"github.com/gogf/gf/v2/database/gdb"
)
type (
ICommonBatchExecutionLog interface {
List(ctx context.Context, in *model.BatchExecutionLogListParam) (list []*model.BatchExecutionLogListModel, totalCount int, err error)
Summary(ctx context.Context, in *model.BatchExecutionLogDetailParam) (res *model.BatchExecutionLogDetailModel, err error)
DetailList(ctx context.Context, in *model.BatchDetailListParam) (list []*model.BatchDetailListModel, totalCount int, err error)
// SyncReview 手动同步待核查批次的上游执行结果(只读补查既有受理号,不重发办理)
SyncReview(ctx context.Context, in *model.BatchExecutionLogSyncReviewParam) (res *model.BatchExecutionLogSyncReviewModel, err error)
}
ICommonDownloadCenter interface {
// List 下载中心列表(K2 仅本人 + K1 业务权限过滤)
List(ctx context.Context, in *model.DownloadCenterListParam) (list []*model.DownloadCenterListModel, totalCount int, err error)
// Recent 右上角全局入口:最近任务与进行中/已完成数量
Recent(ctx context.Context, in *model.DownloadCenterRecentParam) (res *model.DownloadCenterRecentModel, err error)
// Download 下载导出文件,直接写文件流
Download(ctx context.Context, in *model.DownloadCenterTaskParam) (err error)
// Remove 删除导出任务与文件
Remove(ctx context.Context, in *model.DownloadCenterTaskParam) (err error)
}
ICommonBatchMain interface {
// Model 批次主表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取批次主表列表
List(ctx context.Context, in *model.BatchMainListParam) (list []*model.BatchMainListModel, totalCount int, err error)
SuccessList(ctx context.Context, in *model.BatchMainSuccessListParam) (list []*model.BatchMainSuccessListModel, totalCount int, err error)
// ExportWarehousing 导出入库批次列表(数据与入库管理页一致)
ExportWarehousing(ctx context.Context, in *model.BatchMainSuccessListParam) (err error)
ListCards(ctx context.Context, in *model.BatchCardListParam) (list []*model.BatchCardListModel, totalCount int, err error)
// Export 导出批次主表
Export(ctx context.Context, in *model.BatchMainListParam) (err error)
// Edit 修改/新增批次主表
Edit(ctx context.Context, in *model.BatchMainEditParam) (err error)
// Delete 删除批次主表
Delete(ctx context.Context, in *model.BatchMainDeleteParam) (err error)
// View 获取批次主表指定信息
Requeue(ctx context.Context, in *model.BatchMainRequeueParam) (res *model.BatchMainRequeueModel, err error)
View(ctx context.Context, in *model.BatchMainViewParam) (res *model.BatchMainViewModel, err error)
}
ICommonAgentBalance interface {
// Model 企业客户财务信息ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取企业客户财务信息列表
List(ctx context.Context, in *model.TAgentBalanceListParam) (list []*model.TAgentBalanceListModel, totalCount int, err error)
// Export 导出企业客户财务信息
Export(ctx context.Context, in *model.TAgentBalanceListParam) (err error)
// Edit 修改/新增企业客户财务信息
Edit(ctx context.Context, in *model.TAgentBalanceEditParam) (err error)
// Delete 删除企业客户财务信息
Delete(ctx context.Context, in *model.TAgentBalanceDeleteParam) (err error)
// View 获取企业客户财务信息指定信息
View(ctx context.Context, in *model.TAgentBalanceViewParam) (res *model.TAgentBalanceViewModel, err error)
// Status 更新企业客户财务信息状态
Status(ctx context.Context, in *model.TAgentBalanceStatusParam) (err error)
// GetAccountBalance 获取当前登录企业的账户余额信息。
GetAccountBalance(ctx context.Context, in *model.TAgentBalanceTrendParam) (res *model.TAgentBalanceChartData, err error)
// AccountTrend 获取收入金额、支出金额折线图。
AccountTrend(ctx context.Context, in *model.TAgentBalanceTrendParam) (res *model.TAgentBalanceChartData, err error)
// BalanceTransferApply 发起余额转可提现申请。申请时先扣余额并写余额明细,申请单保持待审核。
BalanceTransferApply(ctx context.Context, in *model.TAgentBalanceTransferApplyParam) (*model.TAgentBalanceTransferApplyModel, error)
// BalanceTransferAudit 审核余额转可提现申请。通过时加可提现金额,驳回时退回申请时扣掉的余额。
BalanceTransferAudit(ctx context.Context, in *model.TAgentBalanceTransferAuditParam) error
// SettleCommissionByPeriod 按账期区间结算待结算分润,同步到企业账户可提现金额并写入可提现明细。
SettleCommissionByPeriod(ctx context.Context, in *model.TAgentBalanceCommissionSettlementParam) (*model.TAgentBalanceCommissionSettlementResult, error)
}
ICommonTBalanceDetail interface {
// Model 余额明细表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取余额明细表列表
List(ctx context.Context, in *model.TBalanceDetailListParam) (list []*model.TBalanceDetailListModel, totalCount int, err error)
// Export 导出余额明细表
Export(ctx context.Context, in *model.TBalanceDetailListParam) (err error)
// Edit 修改/新增余额明细表
Edit(ctx context.Context, in *model.TBalanceDetailEditParam) (err error)
// Delete 删除余额明细表
Delete(ctx context.Context, in *model.TBalanceDetailDeleteParam) (err error)
// View 获取余额明细表指定信息
View(ctx context.Context, in *model.TBalanceDetailViewParam) (res *model.TBalanceDetailViewModel, err error)
// CreateBalanceTransferDetail 写入余额转可提现相关的余额明细。
CreateBalanceTransferDetail(ctx context.Context, tx gdb.TX, in *model.TBalanceTransferDetailCreateParam) error
}
ICommonConsumeAccountMonthBill interface {
// Model 消费账户月账单表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取消费账户月账单表列表
List(ctx context.Context, in *model.TConsumeAccountMonthBillListParam) (list []*model.TConsumeAccountMonthBillListModel, totalCount int, err error)
// Export 导出消费账户月账单表
Export(ctx context.Context, in *model.TConsumeAccountMonthBillListParam) (err error)
// Edit 修改/新增消费账户月账单表
Edit(ctx context.Context, in *model.TConsumeAccountMonthBillEditParam) (err error)
// Delete 删除消费账户月账单表
Delete(ctx context.Context, in *model.TConsumeAccountMonthBillDeleteParam) (err error)
// View 获取消费账户月账单表指定信息
View(ctx context.Context, in *model.TConsumeAccountMonthBillViewParam) (res *model.TConsumeAccountMonthBillViewModel, err error)
// GetSummary 获取月账单消费账户汇总信息
GetConsumptionBillSummary(ctx context.Context, month string) (res *model.TConsumptionBillSummaryModel, err error)
// SettleConsumeAccountMonthBill 按账期统计消费账户月账单。
SettleConsumeAccountMonthBill(ctx context.Context, in *model.TConsumeAccountMonthBillSettleParam) (res *model.TConsumeAccountMonthBillSettleResult, err error)
}
ICommonTCreditDetail interface {
// Model 信用额度明细表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取信用额度明细表列表
List(ctx context.Context, in *model.TCreditDetailListParam) (list []*model.TCreditDetailListModel, totalCount int, err error)
// Export 导出信用额度明细表
Export(ctx context.Context, in *model.TCreditDetailListParam) (err error)
// Edit 修改/新增信用额度明细表
Edit(ctx context.Context, in *model.TCreditDetailEditParam) (err error)
// Delete 删除信用额度明细表
Delete(ctx context.Context, in *model.TCreditDetailDeleteParam) (err error)
// View 获取信用额度明细表指定信息
View(ctx context.Context, in *model.TCreditDetailViewParam) (res *model.TCreditDetailViewModel, err error)
}
IIotTDivisionCode interface {
// Model 村级行政区划表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取村级行政区划表列表
List(ctx context.Context, in *model.TDivisionCodeListParam) (list []*model.TDivisionCodeListModel, totalCount int, err error)
// Export 导出村级行政区划表
Export(ctx context.Context, in *model.TDivisionCodeListParam) (err error)
// Edit 修改/新增村级行政区划表
Edit(ctx context.Context, in *model.TDivisionCodeEditParam) (err error)
// Delete 删除村级行政区划表
Delete(ctx context.Context, in *model.TDivisionCodeDeleteParam) (err error)
// View 获取村级行政区划表指定信息
View(ctx context.Context, in *model.TDivisionCodeViewParam) (res *model.TDivisionCodeViewModel, err error)
}
ICommonTFinCommissionDetail interface {
// Model 分润明细表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取分润明细表列表
List(ctx context.Context, in *model.TFinCommissionDetailListParam) (list []*model.TFinCommissionDetailListModel, totalCount int, err error)
// Export 导出分润明细表
Export(ctx context.Context, in *model.TFinCommissionDetailListParam) (err error)
// Edit 修改/新增分润明细表
Edit(ctx context.Context, in *model.TFinCommissionDetailEditParam) (err error)
// Delete 删除分润明细表
Delete(ctx context.Context, in *model.TFinCommissionDetailDeleteParam) (err error)
// View 获取分润明细表指定信息
View(ctx context.Context, in *model.TFinCommissionDetailViewParam) (res *model.TFinCommissionDetailViewModel, err error)
// MarkSettled 批量标记分润明细为可提现状态。
MarkSettled(ctx context.Context, tx gdb.TX, in *model.TFinCommissionSettleUpdateParam) error
// 分层分润概览 分润表
// 一级客户收入 benefit_dept_level=1 commission_amount相加
// 二级客户收入 benefit_dept_level=2 commission_amount相加
// 三级客户收入 benefit_dept_level=3 commission_amount相加
// 总收入 一级二级三级加起来总和
GetCommissionOverview(ctx context.Context, in *model.TCommissionOverviewParam) (res *model.TCommissionOverviewModel, err error)
// GetLevelSummary 获取层级汇总表
// 客户数 根据 benefit_dept_level 收益机构层级分组
// 收入金额 根据收益机构id去 t_profit_account_month_bill 查,dept_id=收益机构id,收入=分润结算+余额转提现
// 分润金额 根据收益机构id去 t_profit_account_month_bill 查,commission_income
// 顶级利润贡献 等于分润金额
// 收入占比
// 环比 选年与去年对比,选月与上个月对比
GetLevelSummary(ctx context.Context, in *model.TLevelSummaryParam) (res *model.TLevelSummaryModel, err error)
}
ICommonTFinWithdrawableChange interface {
// Model 可提现变动明细表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取可提现变动明细表列表
List(ctx context.Context, in *model.TFinWithdrawableChangeListParam) (list []*model.TFinWithdrawableChangeListModel, totalCount int, err error)
// Export 导出可提现变动明细表
Export(ctx context.Context, in *model.TFinWithdrawableChangeListParam) (err error)
// Edit 修改/新增可提现变动明细表
Edit(ctx context.Context, in *model.TFinWithdrawableChangeEditParam) (err error)
// Delete 删除可提现变动明细表
Delete(ctx context.Context, in *model.TFinWithdrawableChangeDeleteParam) (err error)
// View 获取可提现变动明细表指定信息
View(ctx context.Context, in *model.TFinWithdrawableChangeViewParam) (res *model.TFinWithdrawableChangeViewModel, err error)
// CreateBalanceTransferInChange 写入余额转可提现审核通过后的可提现金额变动明细。
CreateBalanceTransferInChange(ctx context.Context, tx gdb.TX, in *model.TFinWithdrawableBalanceTransferInParam) error
// CreateCommissionSettlementChange 写入分润结算产生的可提现明细。
CreateCommissionSettlementChange(ctx context.Context, tx gdb.TX, in *model.TFinWithdrawableCommissionSettlementParam) error
}
ICommonTFinanceApply interface {
// Model 财务申请表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取财务申请表列表
List(ctx context.Context, in *model.TFinanceApplyListParam) (list []*model.TFinanceApplyListModel, totalCount int, err error)
// Export 导出财务申请表
Export(ctx context.Context, in *model.TFinanceApplyListParam) (err error)
// Edit 修改/新增财务申请表
Edit(ctx context.Context, in *model.TFinanceApplyEditParam) (err error)
// Delete 删除财务申请表
Delete(ctx context.Context, in *model.TFinanceApplyDeleteParam) (err error)
// View 获取财务申请表指定信息
View(ctx context.Context, in *model.TFinanceApplyViewParam) (res *model.TFinanceApplyViewModel, err error)
// CreateBalanceTransferApply 创建余额转可提现的待审核申请单。
CreateBalanceTransferApply(ctx context.Context, tx gdb.TX, in *model.TFinanceApplyCreateBalanceTransferParam) error
// GetPendingByApplyNo 按申请单号查询待审核申请。
GetPendingByApplyNo(ctx context.Context, tx gdb.TX, applyNo string, tenantId string) (*entity.TFinanceApply, error)
// UpdateAuditStatus 更新财务申请的审核状态。
UpdateAuditStatus(ctx context.Context, tx gdb.TX, in *model.TFinanceApplyUpdateAuditStatusParam) error
}
ICommonTFinanceAuditRecord interface {
// Model 财务审核记录表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取财务审核记录表列表
List(ctx context.Context, in *model.TFinanceAuditRecordListParam) (list []*model.TFinanceAuditRecordListModel, totalCount int, err error)
// Export 导出财务审核记录表
Export(ctx context.Context, in *model.TFinanceAuditRecordListParam) (err error)
// Edit 修改/新增财务审核记录表
Edit(ctx context.Context, in *model.TFinanceAuditRecordEditParam) (err error)
// Delete 删除财务审核记录表
Delete(ctx context.Context, in *model.TFinanceAuditRecordDeleteParam) (err error)
// View 获取财务审核记录表指定信息
View(ctx context.Context, in *model.TFinanceAuditRecordViewParam) (res *model.TFinanceAuditRecordViewModel, err error)
// CreateRecord 写入财务审核记录。
CreateRecord(ctx context.Context, tx gdb.TX, in *model.TFinanceAuditRecordCreateParam) error
}
ICommonTMessageLog interface {
// Model 消息日志ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取消息日志列表
List(ctx context.Context, in *model.TMessageLogListParam) (list []*model.TMessageLogListModel, totalCount int, err error)
// Export 导出消息日志
Export(ctx context.Context, in *model.TMessageLogListParam) (err error)
// Edit 修改/新增消息日志
Edit(ctx context.Context, in *model.TMessageLogEditParam) (err error)
// Delete 删除消息日志
Delete(ctx context.Context, in *model.TMessageLogDeleteParam) (err error)
// View 获取消息日志指定信息,并标记已读
View(ctx context.Context, in *model.TMessageLogViewParam) (res *model.TMessageLogViewModel, err error)
// UnreadList 获取当前登录用户的未读消息通知
UnreadList(ctx context.Context, in *model.TMessageLogUnreadListParam) (list []*model.TMessageLogUnreadListModel, totalCount int, err error)
// Read 标记当前登录用户指定消息已读
Read(ctx context.Context, in *model.TMessageLogReadParam) (err error)
// ReadAll 标记当前登录用户全部消息已读
ReadAll(ctx context.Context, in *model.TMessageLogReadAllParam) (err error)
}
ICommonTNotifyLog interface {
// Model 通知日志ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取通知日志列表
List(ctx context.Context, in *model.TNotifyLogListParam) (list []*model.TNotifyLogListModel, totalCount int, err error)
// Export 导出通知日志
Export(ctx context.Context, in *model.TNotifyLogListParam) (err error)
// Edit 修改/新增通知日志
Edit(ctx context.Context, in *model.TNotifyLogEditParam) (err error)
// Delete 删除通知日志
Delete(ctx context.Context, in *model.TNotifyLogDeleteParam) (err error)
// View 获取通知日志指定信息
View(ctx context.Context, in *model.TNotifyLogViewParam) (res *model.TNotifyLogViewModel, err error)
}
ICommonProfitAccountMonthBill interface {
// Model 盈利账户月账单表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取盈利账户月账单表列表
List(ctx context.Context, in *model.TProfitAccountMonthBillListParam) (list []*model.TProfitAccountMonthBillListModel, totalCount int, err error)
// Export 导出盈利账户月账单表
Export(ctx context.Context, in *model.TProfitAccountMonthBillListParam) (err error)
// Edit 修改/新增盈利账户月账单表
Edit(ctx context.Context, in *model.TProfitAccountMonthBillEditParam) (err error)
// Delete 删除盈利账户月账单表
Delete(ctx context.Context, in *model.TProfitAccountMonthBillDeleteParam) (err error)
// View 获取盈利账户月账单表指定信息
View(ctx context.Context, in *model.TProfitAccountMonthBillViewParam) (res *model.TProfitAccountMonthBillViewModel, err error)
// SettleProfitAccountMonthBill 按可提现变动明细统计并写入盈利账户月账单。
SettleProfitAccountMonthBill(ctx context.Context, in *model.TProfitAccountMonthBillSettleParam) (res *model.TProfitAccountMonthBillSettleResult, err error)
// 获取月账单盈利账户汇总信息
GetProfitBillSummary(ctx context.Context, month string) (res *model.TProfitBillModel, err error)
// GetCoreFinancialData 获取核心财务指标
GetCoreFinancialData(ctx context.Context, in *model.TCommissionOverviewParam) (res *model.TCoreFinancialDataModel, err error)
// GetFinancialTrend 获取财务趋势折线图
// 指标类型:1总收入,2顶级利润,3待审核提现,4已提现金额
// 月份视图:按天查询 t_fin_withdrawable_change
// 年份视图:按月查询 t_profit_account_month_bill
GetFinancialTrend(ctx context.Context, in *model.TFinancialTrendParam) (res *model.TFinancialTrendModel, err error)
}
ICommonTWoCommunication interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, in *model.TWoCommunicationListParam) (list []*model.TWoCommunicationListModel, totalCount int, err error)
Export(ctx context.Context, in *model.TWoCommunicationListParam) (err error)
Edit(ctx context.Context, in *model.TWoCommunicationEditParam) (err error)
// CreateInitialMessage 创建工单时同步生成首条沟通消息。
CreateInitialMessage(ctx context.Context, tx gdb.TX, in *model.TWoCommunicationInitialMessageParam) error
Message(ctx context.Context, in *model.TWoMainMessageParam) (err error)
Delete(ctx context.Context, in *model.TWoCommunicationDeleteParam) (err error)
View(ctx context.Context, in *model.TWoCommunicationViewParam) (res *model.TWoCommunicationViewModel, err error)
}
ICommonTWoMain interface {
// Model returns the work order main ORM model
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List returns work order main records.
List(ctx context.Context, in *model.TWoMainListParam) (list []*model.TWoMainListModel, totalCount int, err error)
Export(ctx context.Context, in *model.TWoMainListParam) (err error)
// 添加工单
Edit(ctx context.Context, in *model.TWoMainEditParam) (err error)
Message(ctx context.Context, in *model.TWoMainMessageParam) (err error)
// 转单:转给顶级部门(ParentId=0)的负责人
Transfer(ctx context.Context, in *model.TWoMainTransferParam) (err error)
// 解决
Resolve(ctx context.Context, in *model.TWoMainResolveParam) (err error)
AutoCloseResolved(ctx context.Context, message model.WorkOrderAutoCloseMessage) error
// 关单
Close(ctx context.Context, in *model.TWoMainCloseParam) (err error)
// 取消
Cancel(ctx context.Context, in *model.TWoMainCancelParam) (err error)
// 评价
Evaluate(ctx context.Context, in *model.TWoMainEvaluateParam) (err error)
Delete(ctx context.Context, in *model.TWoMainDeleteParam) (err error)
// View returns a work order main record.
View(ctx context.Context, in *model.TWoMainViewParam) (res *model.TWoMainViewModel, err error)
}
ICommonTWoRecord interface {
// Model 工单记录表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取工单记录表列表
List(ctx context.Context, in *model.TWoRecordListParam) (list []*model.TWoRecordListModel, totalCount int, err error)
// Export 导出工单记录表
Export(ctx context.Context, in *model.TWoRecordListParam) (err error)
// Edit 修改/新增工单记录表
Edit(ctx context.Context, in *model.TWoRecordEditParam) (err error)
// 添加工单记录表
AddOperation(ctx context.Context, in *model.TWoRecordAddOperationParam) (err error)
Delete(ctx context.Context, in *model.TWoRecordDeleteParam) (err error)
// View 获取工单记录表指定信息
View(ctx context.Context, in *model.TWoRecordViewParam) (res *model.TWoRecordViewModel, err error)
}
)
var (
localCommonBatchExecutionLog ICommonBatchExecutionLog
localCommonDownloadCenter ICommonDownloadCenter
localCommonBatchMain ICommonBatchMain
localCommonAgentBalance ICommonAgentBalance
localCommonTBalanceDetail ICommonTBalanceDetail
localCommonConsumeAccountMonthBill ICommonConsumeAccountMonthBill
localCommonTCreditDetail ICommonTCreditDetail
localIotTDivisionCode IIotTDivisionCode
localCommonTFinCommissionDetail ICommonTFinCommissionDetail
localCommonTFinWithdrawableChange ICommonTFinWithdrawableChange
localCommonTFinanceApply ICommonTFinanceApply
localCommonTFinanceAuditRecord ICommonTFinanceAuditRecord
localCommonTMessageLog ICommonTMessageLog
localCommonTNotifyLog ICommonTNotifyLog
localCommonProfitAccountMonthBill ICommonProfitAccountMonthBill
localCommonTWoCommunication ICommonTWoCommunication
localCommonTWoMain ICommonTWoMain
localCommonTWoRecord ICommonTWoRecord
)
func CommonBatchExecutionLog() ICommonBatchExecutionLog {
if localCommonBatchExecutionLog == nil {
panic("implement not found for interface ICommonBatchExecutionLog, forgot register?")
}
return localCommonBatchExecutionLog
}
func RegisterCommonBatchExecutionLog(i ICommonBatchExecutionLog) {
localCommonBatchExecutionLog = i
}
func CommonDownloadCenter() ICommonDownloadCenter {
if localCommonDownloadCenter == nil {
panic("implement not found for interface ICommonDownloadCenter, forgot register?")
}
return localCommonDownloadCenter
}
func RegisterCommonDownloadCenter(i ICommonDownloadCenter) {
localCommonDownloadCenter = i
}
func CommonBatchMain() ICommonBatchMain {
if localCommonBatchMain == nil {
panic("implement not found for interface ICommonBatchMain, forgot register?")
}
return localCommonBatchMain
}
func RegisterCommonBatchMain(i ICommonBatchMain) {
localCommonBatchMain = i
}
func CommonAgentBalance() ICommonAgentBalance {
if localCommonAgentBalance == nil {
panic("implement not found for interface ICommonAgentBalance, forgot register?")
}
return localCommonAgentBalance
}
func RegisterCommonAgentBalance(i ICommonAgentBalance) {
localCommonAgentBalance = i
}
func CommonTBalanceDetail() ICommonTBalanceDetail {
if localCommonTBalanceDetail == nil {
panic("implement not found for interface ICommonTBalanceDetail, forgot register?")
}
return localCommonTBalanceDetail
}
func RegisterCommonTBalanceDetail(i ICommonTBalanceDetail) {
localCommonTBalanceDetail = i
}
func CommonConsumeAccountMonthBill() ICommonConsumeAccountMonthBill {
if localCommonConsumeAccountMonthBill == nil {
panic("implement not found for interface ICommonConsumeAccountMonthBill, forgot register?")
}
return localCommonConsumeAccountMonthBill
}
func RegisterCommonConsumeAccountMonthBill(i ICommonConsumeAccountMonthBill) {
localCommonConsumeAccountMonthBill = i
}
func CommonTCreditDetail() ICommonTCreditDetail {
if localCommonTCreditDetail == nil {
panic("implement not found for interface ICommonTCreditDetail, forgot register?")
}
return localCommonTCreditDetail
}
func RegisterCommonTCreditDetail(i ICommonTCreditDetail) {
localCommonTCreditDetail = i
}
func IotTDivisionCode() IIotTDivisionCode {
if localIotTDivisionCode == nil {
panic("implement not found for interface IIotTDivisionCode, forgot register?")
}
return localIotTDivisionCode
}
func RegisterIotTDivisionCode(i IIotTDivisionCode) {
localIotTDivisionCode = i
}
func CommonTFinCommissionDetail() ICommonTFinCommissionDetail {
if localCommonTFinCommissionDetail == nil {
panic("implement not found for interface ICommonTFinCommissionDetail, forgot register?")
}
return localCommonTFinCommissionDetail
}
func RegisterCommonTFinCommissionDetail(i ICommonTFinCommissionDetail) {
localCommonTFinCommissionDetail = i
}
func CommonTFinWithdrawableChange() ICommonTFinWithdrawableChange {
if localCommonTFinWithdrawableChange == nil {
panic("implement not found for interface ICommonTFinWithdrawableChange, forgot register?")
}
return localCommonTFinWithdrawableChange
}
func RegisterCommonTFinWithdrawableChange(i ICommonTFinWithdrawableChange) {
localCommonTFinWithdrawableChange = i
}
func CommonTFinanceApply() ICommonTFinanceApply {
if localCommonTFinanceApply == nil {
panic("implement not found for interface ICommonTFinanceApply, forgot register?")
}
return localCommonTFinanceApply
}
func RegisterCommonTFinanceApply(i ICommonTFinanceApply) {
localCommonTFinanceApply = i
}
func CommonTFinanceAuditRecord() ICommonTFinanceAuditRecord {
if localCommonTFinanceAuditRecord == nil {
panic("implement not found for interface ICommonTFinanceAuditRecord, forgot register?")
}
return localCommonTFinanceAuditRecord
}
func RegisterCommonTFinanceAuditRecord(i ICommonTFinanceAuditRecord) {
localCommonTFinanceAuditRecord = i
}
func CommonTMessageLog() ICommonTMessageLog {
if localCommonTMessageLog == nil {
panic("implement not found for interface ICommonTMessageLog, forgot register?")
}
return localCommonTMessageLog
}
func RegisterCommonTMessageLog(i ICommonTMessageLog) {
localCommonTMessageLog = i
}
func CommonTNotifyLog() ICommonTNotifyLog {
if localCommonTNotifyLog == nil {
panic("implement not found for interface ICommonTNotifyLog, forgot register?")
}
return localCommonTNotifyLog
}
func RegisterCommonTNotifyLog(i ICommonTNotifyLog) {
localCommonTNotifyLog = i
}
func CommonProfitAccountMonthBill() ICommonProfitAccountMonthBill {
if localCommonProfitAccountMonthBill == nil {
panic("implement not found for interface ICommonProfitAccountMonthBill, forgot register?")
}
return localCommonProfitAccountMonthBill
}
func RegisterCommonProfitAccountMonthBill(i ICommonProfitAccountMonthBill) {
localCommonProfitAccountMonthBill = i
}
func CommonTWoCommunication() ICommonTWoCommunication {
if localCommonTWoCommunication == nil {
panic("implement not found for interface ICommonTWoCommunication, forgot register?")
}
return localCommonTWoCommunication
}
func RegisterCommonTWoCommunication(i ICommonTWoCommunication) {
localCommonTWoCommunication = i
}
func CommonTWoMain() ICommonTWoMain {
if localCommonTWoMain == nil {
panic("implement not found for interface ICommonTWoMain, forgot register?")
}
return localCommonTWoMain
}
func RegisterCommonTWoMain(i ICommonTWoMain) {
localCommonTWoMain = i
}
func CommonTWoRecord() ICommonTWoRecord {
if localCommonTWoRecord == nil {
panic("implement not found for interface ICommonTWoRecord, forgot register?")
}
return localCommonTWoRecord
}
func RegisterCommonTWoRecord(i ICommonTWoRecord) {
localCommonTWoRecord = i
}
@@ -0,0 +1,305 @@
package fullsyncretry
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
)
const maxResponse = 512 << 10
var ErrConfig = errors.New("full-sync worker is not configured")
type Client struct {
BaseURL string
HTTP *http.Client
}
type Receipt struct {
ReplayRunID string `json:"replayRunId"`
Status string `json:"status"`
}
type Status struct {
ReplayRunID string `json:"replayRunId"`
SourceRunID string `json:"sourceRunId"`
Status string `json:"status"`
Remaining int64 `json:"remaining"`
Enqueued int64 `json:"enqueued"`
RunStatus string `json:"runStatus,omitempty"`
Error string `json:"error,omitempty"`
}
type RunMeta struct {
RunID string `json:"runId"`
Operation string `json:"operation"`
QueryMonth string `json:"queryMonth"`
Status string `json:"status"`
ProducerDone bool `json:"producerDone"`
CurrentRound int `json:"currentRound"`
ActiveCount int64 `json:"activeCount"`
InflightCount int64 `json:"inflightCount"`
NextRoundCount int64 `json:"nextRoundCount"`
SuccessCount int64 `json:"successCount"`
FailedCount int64 `json:"failedCount"`
CreatedAt time.Time `json:"createdAt"`
ProducerCompletedAt time.Time `json:"producerCompletedAt"`
CompletedAt time.Time `json:"completedAt"`
SyncType string `json:"syncType,omitempty"`
SourceRunID string `json:"sourceRunId,omitempty"`
ReplayCycle int `json:"replayCycle,omitempty"`
TriggerSource string `json:"triggerSource,omitempty"`
ScannedCount int64 `json:"scannedCount,omitempty"`
EnqueuedCount int64 `json:"enqueuedCount,omitempty"`
UpstreamAttemptCount int64 `json:"upstreamAttemptCount,omitempty"`
BatchCount int64 `json:"batchCount,omitempty"`
MaxRound int `json:"maxRound,omitempty"`
PendingFailureCount int64 `json:"pendingFailureCount,omitempty"`
StartedAt *time.Time `json:"startedAt,omitempty"`
ScanCompletedAt *time.Time `json:"scanCompletedAt,omitempty"`
ArchiveStatus string `json:"archiveStatus,omitempty"`
ArchivedAt *time.Time `json:"archivedAt,omitempty"`
}
type RoundStats struct {
RunID string `json:"runId"`
Round int `json:"round"`
EnqueuedCount int64 `json:"enqueuedCount"`
ActiveCount int64 `json:"activeCount"`
NextRoundCount int64 `json:"nextRoundCount"`
SuccessCount int64 `json:"successCount"`
FailedCount int64 `json:"failedCount"`
UpstreamAttemptCount int64 `json:"upstreamAttemptCount"`
BatchCount int64 `json:"batchCount"`
StartedAt *time.Time `json:"startedAt,omitempty"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
}
type RunView struct {
Source string `json:"source"`
Run RunMeta `json:"run"`
Rounds []RoundStats `json:"rounds,omitempty"`
}
type RunList struct {
Items []RunView `json:"items"`
Total int `json:"total"`
}
type Failure struct {
TaskID string `json:"taskId"`
CardID int64 `json:"cardId"`
ErrorCategory string `json:"errorCategory"`
ErrorMessage string `json:"errorMessage"`
FailedAt time.Time `json:"failedAt"`
Round int `json:"round"`
}
type FailurePage struct {
Items []Failure `json:"items"`
NextCursor string `json:"nextCursor"`
}
type StartReceipt struct {
RunID string `json:"runId"`
SyncKind string `json:"syncKind"`
Status string `json:"status"`
}
func FromEnvironment() Client {
return Client{BaseURL: "http://iotlcm-worker-svr:18081"}
}
func ValidateID(id string) bool {
if len(id) == 0 || len(id) > 128 {
return false
}
for _, c := range id {
if c < '0' || c > '9' {
if c < 'a' || c > 'z' {
if c < 'A' || c > 'Z' {
if c != '-' && c != '_' && c != ':' && c != '.' {
return false
}
}
}
}
}
return true
}
// MaxReplayRounds mirrors the Worker's server-side ceiling so an oversized
// request is rejected at the edge instead of surfacing as an opaque 400.
const MaxReplayRounds = 100
// Replay requests a re-run of the source run's failures. maxRounds == 0 asks
// the Worker to apply its configured default; any other value is passed
// through and must not exceed MaxReplayRounds.
func (c Client) Replay(ctx context.Context, id, actor string, maxRounds int) (Receipt, error) {
if !ValidateID(id) || actor == "" {
return Receipt{}, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid replay request")
}
if maxRounds < 0 || maxRounds > MaxReplayRounds {
return Receipt{}, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid replay maxRounds")
}
body, _ := json.Marshal(struct {
RequestedBy string `json:"requestedBy"`
MaxRounds int `json:"maxRounds,omitempty"`
}{actor, maxRounds})
var receipt Receipt
if err := c.do(ctx, http.MethodPost, "/internal/v1/full-sync-runs/"+url.PathEscape(id)+"/replay", body, http.StatusAccepted, &receipt); err != nil {
return Receipt{}, err
}
if !ValidateID(receipt.ReplayRunID) {
return Receipt{}, gerror.NewCode(gcode.CodeInternalError, "Invalid Worker response")
}
return receipt, nil
}
// ValidSyncKind matches the Worker's full-sync kinds for both monitoring and starts.
func ValidSyncKind(kind string) bool {
switch kind {
case "traffic_usage", "sim_status", "imei", "traffic_usage_daily", "traffic_usage_monthly":
return true
default:
return false
}
}
func (c Client) ListRuns(ctx context.Context, kind string, limit int) (RunList, error) {
if (kind != "" && !ValidSyncKind(kind)) || limit < 0 || limit > 100 {
return RunList{}, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid full-sync filter")
}
query := url.Values{}
if kind != "" {
query.Set("syncKind", kind)
}
if limit > 0 {
query.Set("limit", fmt.Sprint(limit))
}
path := "/internal/v1/full-sync-runs"
if len(query) > 0 {
path += "?" + query.Encode()
}
var result RunList
if err := c.do(ctx, http.MethodGet, path, nil, http.StatusOK, &result); err != nil {
return RunList{}, err
}
if result.Items == nil {
result.Items = []RunView{}
}
return result, nil
}
func (c Client) Run(ctx context.Context, id string) (RunView, error) {
if !ValidateID(id) {
return RunView{}, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid run ID")
}
var result RunView
if err := c.do(ctx, http.MethodGet, "/internal/v1/full-sync-runs/"+url.PathEscape(id), nil, http.StatusOK, &result); err != nil {
return RunView{}, err
}
if result.Run.RunID != id {
return RunView{}, gerror.NewCode(gcode.CodeInternalError, "Invalid Worker response")
}
return result, nil
}
func (c Client) Failures(ctx context.Context, id string, limit int, cursor string) (FailurePage, error) {
if !ValidateID(id) || limit < 0 || limit > 500 || len(cursor) > 1024 {
return FailurePage{}, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid failure query")
}
query := url.Values{}
if limit > 0 {
query.Set("limit", fmt.Sprint(limit))
}
if cursor != "" {
query.Set("cursor", cursor)
}
path := "/internal/v1/full-sync-runs/" + url.PathEscape(id) + "/failures"
if len(query) > 0 {
path += "?" + query.Encode()
}
var result FailurePage
if err := c.do(ctx, http.MethodGet, path, nil, http.StatusOK, &result); err != nil {
return FailurePage{}, err
}
if result.Items == nil {
result.Items = []Failure{}
}
return result, nil
}
func (c Client) Get(ctx context.Context, id string) (Status, error) {
if !ValidateID(id) {
return Status{}, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid replay run ID")
}
var status Status
if err := c.do(ctx, http.MethodGet, "/internal/v1/full-sync-replays/"+url.PathEscape(id), nil, http.StatusOK, &status); err != nil {
return Status{}, err
}
if status.ReplayRunID != id {
return Status{}, gerror.NewCode(gcode.CodeInternalError, "Invalid Worker response")
}
return status, nil
}
func (c Client) do(ctx context.Context, method, path string, body []byte, expected int, result any) error {
base, err := url.Parse(c.BaseURL)
if err != nil || base == nil || base.Scheme != "http" || base.Host == "" || base.User != nil || base.RawQuery != "" || base.Fragment != "" || base.Path != "" {
return gerror.NewCode(gcode.CodeInternalError, ErrConfig.Error())
}
client := c.HTTP
if client == nil {
client = &http.Client{Timeout: 5 * time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
}
request, err := http.NewRequestWithContext(ctx, method, strings.TrimRight(base.String(), "/")+path, bytes.NewReader(body))
if err != nil {
return gerror.NewCode(gcode.CodeInternalError, "Invalid Worker request")
}
if body != nil {
request.Header.Set("Content-Type", "application/json")
}
response, err := client.Do(request)
if err != nil {
return gerror.NewCode(gcode.CodeInternalError, "Worker unavailable")
}
defer response.Body.Close()
if response.StatusCode != expected {
return workerError(response.StatusCode)
}
decoder := json.NewDecoder(io.LimitReader(response.Body, maxResponse))
if err := decoder.Decode(result); err != nil {
return gerror.NewCode(gcode.CodeInternalError, "Invalid Worker response")
}
return nil
}
func workerError(status int) error {
switch status {
case http.StatusBadRequest:
return gerror.NewCode(gcode.CodeInvalidParameter, "Invalid replay request")
case http.StatusNotFound:
return gerror.NewCode(gcode.CodeNotFound, "Run not found")
case http.StatusGone:
return gerror.NewCode(gcode.CodeNotFound, "Failure details are no longer available")
case http.StatusServiceUnavailable:
return gerror.NewCode(gcode.CodeInternalError, "Worker is busy")
case http.StatusConflict:
return gerror.NewCode(gcode.CodeInvalidParameter, "Run is not ready for replay")
case http.StatusUnprocessableEntity:
return gerror.NewCode(gcode.CodeInvalidParameter, "Run has no failures")
default:
return gerror.NewCode(gcode.CodeInternalError, fmt.Sprintf("Worker failed (HTTP %d)", status))
}
}
@@ -0,0 +1,159 @@
package fullsyncretry
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
)
func TestReplayAndStatusProxy(t *testing.T) {
calls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
if r.Header.Get("Authorization") != "" {
t.Error("Admin JWT must not be forwarded to Worker")
}
if r.Method == "POST" {
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Error(err)
}
if len(body) != 1 || body["requestedBy"] != "42" {
t.Errorf("unexpected Worker request: %+v", body)
}
w.WriteHeader(http.StatusAccepted)
_, _ = w.Write([]byte(`{"replayRunId":"replay-1","status":"accepted"}`))
return
}
_, _ = w.Write([]byte(`{"replayRunId":"replay-1","sourceRunId":"source","status":"completed","remaining":0,"enqueued":3}`))
}))
defer server.Close()
client := Client{BaseURL: server.URL}
r, err := client.Replay(context.Background(), "source", "42", 0)
if err != nil || r.ReplayRunID != "replay-1" {
t.Fatalf("replay: %+v %v", r, err)
}
s, err := client.Get(context.Background(), "replay-1")
if err != nil || s.Enqueued != 3 || calls != 2 {
t.Fatalf("status: %+v %v, calls=%d", s, err, calls)
}
}
func TestRunQueriesAndFailures(t *testing.T) {
calls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
switch {
case r.Method == http.MethodGet && r.URL.Path == "/internal/v1/full-sync-runs":
if r.URL.Query().Get("syncKind") != "traffic_usage" || r.URL.Query().Get("limit") != "7" {
t.Fatalf("query = %s", r.URL.RawQuery)
}
_, _ = w.Write([]byte(`{"items":[{"source":"live","run":{"runId":"run-1","operation":"current_month_usage_full_sync","status":"running"}}],"total":1}`))
case r.Method == http.MethodGet && r.URL.Path == "/internal/v1/full-sync-runs/run-1":
_, _ = w.Write([]byte(`{"source":"archive","run":{"runId":"run-1","operation":"current_month_usage_full_sync","status":"completed"},"rounds":[]}`))
case r.Method == http.MethodGet && r.URL.Path == "/internal/v1/full-sync-runs/run-1/failures":
_, _ = w.Write([]byte(`{"items":[{"taskId":"task-1","cardId":1,"errorCategory":"business","errorMessage":"failed","round":2}],"nextCursor":"next"}`))
default:
http.NotFound(w, r)
}
}))
defer server.Close()
client := Client{BaseURL: server.URL}
list, err := client.ListRuns(context.Background(), "traffic_usage", 7)
if err != nil || list.Total != 1 || len(list.Items) != 1 {
t.Fatalf("list = %+v, err = %v", list, err)
}
view, err := client.Run(context.Background(), "run-1")
if err != nil || view.Source != "archive" {
t.Fatalf("run = %+v, err = %v", view, err)
}
page, err := client.Failures(context.Background(), "run-1", 100, "cursor")
if err != nil || len(page.Items) != 1 || page.NextCursor != "next" || calls != 3 {
t.Fatalf("failures = %+v, err = %v, calls = %d", page, err, calls)
}
}
func TestReplayWorkerTimeout(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(50 * time.Millisecond) }))
defer server.Close()
client := Client{BaseURL: server.URL, HTTP: &http.Client{Timeout: time.Millisecond}}
_, err := client.Replay(context.Background(), "source", "42", 0)
if err == nil || !strings.Contains(err.Error(), "Worker unavailable") {
t.Fatalf("timeout: %v", err)
}
}
func TestReplayValidationAndWorkerErrors(t *testing.T) {
calls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
w.WriteHeader(http.StatusConflict)
_, _ = w.Write([]byte(`{"error":{"message":"ICCID secret"}}`))
}))
defer server.Close()
client := Client{BaseURL: server.URL}
for _, id := range []string{"", "a/b", "{bad}", strings.Repeat("a", 129)} {
if _, err := client.Replay(context.Background(), id, "42", 0); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("id=%q: %v", id, err)
}
}
if calls != 0 {
t.Fatal("invalid source triggered Worker")
}
// The edge must reject an oversized round budget before calling Worker.
for _, rounds := range []int{-1, MaxReplayRounds + 1} {
if _, err := client.Replay(context.Background(), "source", "42", rounds); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("maxRounds=%d: %v", rounds, err)
}
}
if calls != 0 {
t.Fatal("invalid maxRounds triggered Worker")
}
_, err := client.Replay(context.Background(), "source", "42", 0)
if gerror.Code(err) != gcode.CodeInvalidParameter || strings.Contains(err.Error(), "ICCID") {
t.Fatalf("error leaked Worker body: %v", err)
}
for _, status := range []int{400, 401, 404, 409, 422, 500} {
if workerError(status) == nil {
t.Fatalf("missing error mapping for %d", status)
}
}
}
// The round budget must reach Worker only when the caller asks for one, so an
// omitted value keeps the Worker-side configured default authoritative.
func TestReplayForwardsMaxRoundsOnlyWhenSet(t *testing.T) {
var bodies []map[string]any
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
_ = json.NewDecoder(r.Body).Decode(&body)
bodies = append(bodies, body)
w.WriteHeader(http.StatusAccepted)
_, _ = w.Write([]byte(`{"replayRunId":"replay-1","status":"accepted"}`))
}))
defer server.Close()
client := Client{BaseURL: server.URL}
if _, err := client.Replay(context.Background(), "source", "42", 0); err != nil {
t.Fatal(err)
}
if _, err := client.Replay(context.Background(), "source", "42", 7); err != nil {
t.Fatal(err)
}
if len(bodies) != 2 {
t.Fatalf("expected 2 Worker calls, got %d", len(bodies))
}
if _, present := bodies[0]["maxRounds"]; present {
t.Fatalf("omitted budget must not be sent: %+v", bodies[0])
}
if got := bodies[1]["maxRounds"]; got != float64(7) {
t.Fatalf("explicit budget must be forwarded, got %+v", bodies[1])
}
}
@@ -0,0 +1,39 @@
package fullsyncretry
import (
"context"
"net/http"
"net/http/httptest"
"testing"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
)
func TestListRunsAcceptsFiveKindsAndRejectsUnknownFilters(t *testing.T) {
var filters []string
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
filters = append(filters, r.URL.Query().Get("syncKind"))
_, _ = w.Write([]byte(`{"items":null,"total":0}`))
}))
defer server.Close()
client := Client{BaseURL: server.URL}
kinds := []string{"", "traffic_usage", "sim_status", "imei", "traffic_usage_daily", "traffic_usage_monthly"}
for i, kind := range kinds {
result, err := client.ListRuns(context.Background(), kind, 100)
if err != nil || result.Items == nil || len(filters) != i+1 || filters[i] != kind {
t.Fatalf("kind=%q result=%+v filters=%v error=%v", kind, result, filters, err)
}
}
for _, query := range []struct {
kind string
limit int
}{{"unknown", 10}, {"IMEI", 10}, {"", -1}, {"imei", 101}} {
if _, err := client.ListRuns(context.Background(), query.kind, query.limit); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("invalid filter %+v: %v", query, err)
}
}
if len(filters) != len(kinds) {
t.Fatal("invalid filter reached Worker")
}
}
+46
View File
@@ -0,0 +1,46 @@
// ================================================================================
// 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-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/genin"
"github.com/gogf/gf/v2/database/gdb"
)
type (
IGenTestDemo interface {
// Model 测试单表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取测试单表列表
List(ctx context.Context, in *genin.TestDemoListParam) (list []*genin.TestDemoListModel, totalCount int, err error)
// Export 导出测试单表
Export(ctx context.Context, in *genin.TestDemoListParam) (err error)
// Edit 修改/新增测试单表
Edit(ctx context.Context, in *genin.TestDemoEditParam) (err error)
// Delete 删除测试单表
Delete(ctx context.Context, in *genin.TestDemoDeleteParam) (err error)
// View 获取测试单表指定信息
View(ctx context.Context, in *genin.TestDemoViewParam) (res *genin.TestDemoViewModel, err error)
}
)
var (
localGenTestDemo IGenTestDemo
)
func GenTestDemo() IGenTestDemo {
if localGenTestDemo == nil {
panic("implement not found for interface IGenTestDemo, forgot register?")
}
return localGenTestDemo
}
func RegisterGenTestDemo(i IGenTestDemo) {
localGenTestDemo = i
}
@@ -0,0 +1,56 @@
// ================================================================================
// 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-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"github.com/gogf/gf/v2/database/gdb"
)
type (
ISysGenTable interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// 列表
List(ctx context.Context, param *model.SysGenTableListParam) (output []*model.SysGenTableListModel, total int, err error)
// 详情
View(ctx context.Context, param *model.SysGenTableViewParam) (output *model.SysGenTableViewModel, err error)
// 新增
Add(ctx context.Context, param *model.SysGenTableAddParam) (output *model.SysGenTableAddModel, err error)
// 修改
Edit(ctx context.Context, param *model.SysGenTableEditParam) (output *model.SysGenTableEditModel, err error)
Delete(ctx context.Context, param *model.SysGenTableDeleteParam) (output *model.SysGenTableDeleteModel, err error)
// 获取选择项
Selects(ctx context.Context) (output *model.SelectsModel, err error)
// 获取表选择项
TableSelect(ctx context.Context, param *model.GenCodesTableSelectParam) (output []*model.GenCodesTableSelectModel, err error)
// 获取字段选择项
ColumnSelect(ctx context.Context, param *model.GenCodesColumnSelectParam) (output []*model.GenCodesColumnSelectModel, err error)
// 获取字段列表
ColumnList(ctx context.Context, param *model.GenCodesColumnListParam) (output []*model.GenCodesColumnListModel, err error)
// 预览
Preview(ctx context.Context, param *model.GenCodesPreviewParam) (output *model.GenCodesPreviewModel, err error)
// 构建
Build(ctx context.Context, param *model.GenCodesBuildParam) (output *model.GenCodesBuildModel, err error)
}
)
var (
localSysGenTable ISysGenTable
)
func SysGenTable() ISysGenTable {
if localSysGenTable == nil {
panic("implement not found for interface ISysGenTable, forgot register?")
}
return localSysGenTable
}
func RegisterSysGenTable(i ISysGenTable) {
localSysGenTable = i
}
+41
View File
@@ -0,0 +1,41 @@
// ================================================================================
// 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-admin-svr/internal/model"
)
type (
IHome interface {
GetCardStatistics(ctx context.Context) (stats *model.CardStatistics, err error)
// GetCardStatusStatistics 获取卡状态统计
GetCardStatusStatistics(ctx context.Context) (stats *model.CardStatusStatistics, err error)
// GetDeptFlowUsageChart 获取部门流量使用图表数据,用于折线图展示
// period: 7d 前7天, 1m 前6个月
GetDeptFlowUsageChart(ctx context.Context, period string) (*model.FlowUsageChartData, error)
// GetTopUsageCardsYesterday 获取前一天流量使用前五名的卡片
GetTopUsageCardsYesterday(ctx context.Context) ([]model.TopUsageCard, error)
// GetFlowPoolUsageList 获取该用户下所有流量池的流量使用情况
GetFlowPoolUsageList(ctx context.Context) ([]model.FlowPoolUsageItem, error)
}
)
var (
localHome IHome
)
func Home() IHome {
if localHome == nil {
panic("implement not found for interface IHome, forgot register?")
}
return localHome
}
func RegisterHome(i IHome) {
localHome = i
}
@@ -0,0 +1,29 @@
package service
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
)
// IImeiQueue publishes the additive IMEI-sync queue protocol. It is separate
// from the status queue so the two full-sync chains can be enabled, scoped and
// retried independently.
type IImeiQueue interface {
// StartImeiRun starts a full run and returns its runId.
StartImeiRun(context.Context) (string, error)
// StartImeiRunScoped narrows the run to a channel whitelist; a nil or empty
// scope is a full sync.
StartImeiRunScoped(context.Context, *model.SyncScope) (string, error)
}
var localImeiQueue IImeiQueue
func ImeiQueue() IImeiQueue {
if localImeiQueue == nil {
panic("implement not found for interface IImeiQueue, forgot register?")
}
return localImeiQueue
}
func RegisterImeiQueue(i IImeiQueue) { localImeiQueue = i }
+756
View File
@@ -0,0 +1,756 @@
// ================================================================================
// 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-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"github.com/gogf/gf/v2/database/gdb"
)
type (
IIotTFlowPackageConfig interface {
// Model SIM流量池套餐配置表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取SIM流量池套餐配置表列表
List(ctx context.Context, in *model.TFlowPackageConfigListParam) (list []*model.TFlowPackageConfigListModel, totalCount int, err error)
// Export 导出SIM流量池套餐配置表
Export(ctx context.Context, in *model.TFlowPackageConfigListParam) (err error)
// Edit 修改/新增SIM流量池套餐配置表
Edit(ctx context.Context, in *model.TFlowPackageConfigEditParam) (err error)
// Delete 删除SIM流量池套餐配置表
Delete(ctx context.Context, in *model.TFlowPackageConfigDeleteParam) (err error)
// View 获取SIM流量池套餐配置表指定信息
View(ctx context.Context, in *model.TFlowPackageConfigViewParam) (res *model.TFlowPackageConfigViewModel, err error)
}
IIotTOrder interface {
// Model 订单主表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取订单主表列表
List(ctx context.Context, in *model.TOrderListParam) (list []*model.TOrderListModel, totalCount int, err error)
// SellList 获取销售订单列表
SellList(ctx context.Context, in *model.TOrderListParam) (list []*model.TOrderListModel, totalCount int, err error)
// Export 导出订单主表
Export(ctx context.Context, in *model.TOrderListParam) (err error)
// Edit 修改/新增订单主表
Edit(ctx context.Context, in *model.TOrderEditParam) (err error)
// Delete 删除订单主表
Delete(ctx context.Context, in *model.TOrderDeleteParam) (err error)
// View 获取订单主表指定信息
View(ctx context.Context, in *model.TOrderViewParam) (res *model.TOrderViewModel, err error)
}
IIotTSimCardAllocate interface {
DownloadExcelTemplate(ctx context.Context) error
ListTargets(ctx context.Context, in *model.TSimCardAllocateTargetListParam) (items []*model.TSimCardAllocateTargetModel, err error)
PrepareInput(ctx context.Context, in *model.TSimCardAllocatePrepareParam) (*model.TSimCardAllocateBatchModel, error)
PrepareExcel(ctx context.Context, in *model.TSimCardAllocateExcelSubmitParam) (*model.TSimCardAllocateBatchModel, error)
SubmitBatch(ctx context.Context, in *model.TSimCardAllocateBatchSubmitParam) (*model.TSimCardAllocateBatchModel, error)
}
IIotTSimCardBindPkg interface {
// Model 订购表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取订购表列表
List(ctx context.Context, in *model.TSimCardBindPkgListParam) (list []*model.TSimCardBindPkgListModel, totalCount int, err error)
// Export 导出订购表
Export(ctx context.Context, in *model.TSimCardBindPkgListParam) (err error)
// Edit 修改/新增订购表
Edit(ctx context.Context, in *model.TSimCardBindPkgEditParam) (err error)
// Delete 删除订购表
Delete(ctx context.Context, in *model.TSimCardBindPkgDeleteParam) (err error)
// View 获取订购表指定信息
View(ctx context.Context, in *model.TSimCardBindPkgViewParam) (res *model.TSimCardBindPkgViewModel, err error)
// 套餐详情查询
GetPkgInfo(ctx context.Context, in *model.TSimCardBindPkgInfoParam) (list []*model.TSimCardBindPkgListModel, totalCount int, err error)
// 变更套餐
GetChangePkg(ctx context.Context, in *model.TSimCardBindPkgInfoParam) (list []*model.TSimCardBindPkgListModel, totalCount int, err error)
AddPackageOptions(ctx context.Context, in *model.TSimCardAddPackageOptionsParam) (*model.TSimAddPackageOptionsRes, error)
AddPackagePaymentContext(ctx context.Context) (*model.TSimAddPackageOptionsRes, error)
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardBindPkgAddPackageExcelSubmitParam) (*model.TSimCardBindPkgAddPackageExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardBindPkgAddPackageInputSubmitParam) (*model.TSimCardBindPkgAddPackageInputSubmitRes, error)
PrepareInput(ctx context.Context, in *model.TSimCardBindPkgAddPackageInputPrepareParam) (*model.TSimCardBindPkgAddPackageInputPrepareRes, error)
PrepareResult(ctx context.Context, batchNo string) (*model.TSimCardBindPkgAddPackagePrepareResultRes, error)
ConfirmBatch(ctx context.Context, in *model.TSimCardBindPkgAddPackageBatchConfirmParam) (*model.TSimCardBindPkgAddPackageBatchConfirmRes, error)
}
IIotTSimCardCancel interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardCancelExcelSubmitParam) (*model.TSimCardCancelExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardCancelInputSubmitParam) (*model.TSimCardCancelInputSubmitRes, error)
}
IIotTSimCardCancellation interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, in *model.TSimCardCancellationListParam) (list []*model.TSimCardCancellationListModel, total int, err error)
Export(ctx context.Context, filter *model.TSimCardCancellationFilter) error
}
IIotTSimCardChange interface {
DownloadExcelTemplate(ctx context.Context) error
// SubmitExcel Excel 仅作为 prepare source:构造 batch_type=4 的 Pending 变更预处理批次。
SubmitExcel(ctx context.Context, in *model.TSimCardChangeExcelSubmitParam) (*model.TSimCardChangeExcelSubmitRes, error)
PrepareBatch(ctx context.Context, in *model.TSimCardChangeBatchPrepareParam) (*model.TSimCardChangeBatchPrepareRes, error)
PrepareInput(ctx context.Context, in *model.TSimCardChangeInputPrepareParam) (*model.TSimCardChangeBatchPrepareRes, error)
PrepareRange(ctx context.Context, in *model.TSimCardChangeRangePrepareParam) (*model.TSimCardChangeBatchPrepareRes, error)
InputOptions(ctx context.Context, in *model.TSimCardChangeInputOptionsParam) (*model.TSimCardChangeOptionsRes, error)
RangeOptions(ctx context.Context, in *model.TSimCardChangeRangeOptionsParam) (*model.TSimCardChangeOptionsRes, error)
// SubmitBatch 作为 confirm 的语义:CAS 转换 batch_type=4+Success -> batch_type=102 Pending,发布异步任务。
SubmitBatch(ctx context.Context, in *model.TSimCardChangeBatchSubmitParam) (*model.TSimCardChangeBatchSubmitRes, error)
// PrepareResult 查询预处理批次当前异步状态。
PrepareResult(ctx context.Context, batchNo string) (*model.TSimCardChangePrepareResultRes, error)
}
IIotTSimCardDataCut interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardDataCutExcelSubmitParam) (*model.TSimCardDataCutExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardDataCutInputSubmitParam) (*model.TSimCardDataCutInputSubmitRes, error)
}
IIotTSimCardDataStart interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardDataStartExcelSubmitParam) (*model.TSimCardDataStartSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardDataStartInputSubmitParam) (*model.TSimCardDataStartSubmitRes, error)
}
IIotTSimCardDataStop interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardDataStopExcelSubmitParam) (*model.TSimCardDataStopSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardDataStopInputSubmitParam) (*model.TSimCardDataStopSubmitRes, error)
}
IIotTSimCardInbound interface {
DownloadExcelTemplate(ctx context.Context) (err error)
SubmitExcel(ctx context.Context, in *model.TSimCardInboundExcelSubmitParam) (res *model.TSimCardInboundExcelSubmitRes, err error)
SubmitRange(ctx context.Context, in *model.TSimCardInboundRangeSubmitParam) (res *model.TSimCardInboundRangeSubmitRes, err error)
SubmitInput(ctx context.Context, in *model.TSimCardInboundInputSubmitParam) (res *model.TSimCardInboundInputSubmitRes, err error)
}
IIotTSimCardInfo interface {
// Model 卡信息表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取卡信息表列表
List(ctx context.Context, in *model.TSimCardInfoListParam) (list []*model.TSimCardInfoListModel, totalCount int, err error)
// Export 导出卡信息表
Export(ctx context.Context, in *model.TSimCardInfoListParam) (err error)
// Edit 修改/新增卡信息表
Edit(ctx context.Context, in *model.TSimCardInfoEditParam) (err error)
// Delete 删除卡信息表
Delete(ctx context.Context, in *model.TSimCardInfoDeleteParam) (err error)
// View 获取卡信息表指定信息
View(ctx context.Context, in *model.TSimCardInfoViewParam) (res *model.TSimCardInfoViewModel, err error)
// SyncSimCardFlow 同步SIM卡流量
SyncSimCardFlow(ctx context.Context, input *model.SyncSimCardFlowInput) (err error)
// SyncSimCardStatus 同步SIM卡状态
SyncSimCardStatus(ctx context.Context, input *model.SyncSimCardStatusInput) (err error)
// EnqueueSimCardStatus publishes the additive asynchronous status task.
EnqueueSimCardStatus(ctx context.Context, input *model.SyncSimCardStatusInput) (err error)
// QuerySimStatus 查询SIM卡状态
QuerySimStatus(ctx context.Context, input *model.QuerySimStatusInput) (res *model.QuerySimStatusOutput, err error)
// QuerySimSession 查询SIM卡会话
QuerySimSession(ctx context.Context, input *model.QuerySimSessionInput) (res *model.QuerySimSessionOutput, err error)
// GetCardPackageOptions 获取卡套餐下拉选项(去重后的套餐编码列表,套餐状态为生效中)
GetCardPackageOptions(ctx context.Context, deptId int64) (res []*model.GetCardPackageOptionsRes, err error)
// CalculatePoolStatistics 计算流量池统计数据
CalculatePoolStatistics(ctx context.Context, req *model.CalculatePoolStatisticsReq) (res *model.CalculatePoolStatisticsRes, err error)
// GetCardsByPackageCodes 根据套餐编码列表获取卡列表
GetCardsByPackageCodes(ctx context.Context, req *model.GetCardsByPackageCodesParam) (list []*model.TSimCardInfoListModel, totalCount int, err error)
}
IIotTSimCardOutbound interface {
DownloadExcelTemplate(ctx context.Context) error
CustomerBalance(ctx context.Context, in *model.TSimCardOutboundCustomerBalanceParam) (*model.TSimCardOutboundCustomerBalanceRes, error)
SubmitExcel(ctx context.Context, in *model.TSimCardOutboundExcelSubmitParam) (*model.TSimCardOutboundExcelSubmitRes, error)
SubmitRange(ctx context.Context, in *model.TSimCardOutboundRangeSubmitParam) (*model.TSimCardOutboundRangeSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardOutboundInputSubmitParam) (*model.TSimCardOutboundInputSubmitRes, error)
ListInboundBatches(ctx context.Context, in *model.TSimCardOutboundInboundBatchListParam) (*model.TSimCardOutboundInboundBatchListRes, error)
ListInboundBatchCards(ctx context.Context, in *model.TSimCardOutboundInboundBatchCardsParam) (*model.TSimCardOutboundInboundBatchCardsRes, error)
SubmitBatch(ctx context.Context, in *model.TSimCardOutboundBatchSubmitParam) (*model.TSimCardOutboundBatchSubmitRes, error)
}
IIotTSimCardRenew interface {
PrepareBatch(ctx context.Context, in *model.TSimCardRenewBatchPrepareParam) (*model.TSimCardRenewBatchPrepareRes, error)
PrepareBatchAll(ctx context.Context, in *model.TSimCardRenewBatchPrepareAllParam) (*model.TSimCardRenewBatchPrepareRes, error)
PrepareInput(ctx context.Context, in *model.TSimCardRenewInputPrepareParam) (*model.TSimCardRenewBatchPrepareRes, error)
ConfirmBatch(ctx context.Context, in *model.TSimCardRenewBatchConfirmParam) (*model.TSimCardRenewBatchConfirmRes, error)
// PrepareResult 查询预处理批次的当前异步状态。
PrepareResult(ctx context.Context, batchNo string) (*model.TSimCardRenewPrepareResultRes, error)
DownloadExcelTemplate(ctx context.Context) error
// SubmitExcel creates an asynchronous renew prepare batch. The worker performs
// database validation, including the six-month expiry window and latest pending
// subscription selection. The formal renew batch is created after confirmation.
SubmitExcel(ctx context.Context, in *model.TSimCardRenewExcelSubmitParam) (*model.TSimCardRenewExcelSubmitRes, error)
}
IIotTSimCardRestart interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardRestartExcelSubmitParam) (*model.TSimCardRestartExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardRestartInputSubmitParam) (*model.TSimCardRestartInputSubmitRes, error)
}
IIotTSimCardStart interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardStartExcelSubmitParam) (*model.TSimCardStartExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardStartInputSubmitParam) (*model.TSimCardStartInputSubmitRes, error)
}
IIotTSimCardStock interface {
// Model 库存卡信息表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取库存卡信息表列表
List(ctx context.Context, in *model.TSimCardStockListParam) (list []*model.TSimCardStockListModel, totalCount int, err error)
// Export 导出库存卡信息表
Export(ctx context.Context, in *model.TSimCardStockListParam) (err error)
// Edit 修改/新增库存卡信息表
Edit(ctx context.Context, in *model.TSimCardStockEditParam) (err error)
// Delete 删除库存卡信息表
Delete(ctx context.Context, in *model.TSimCardStockDeleteParam) (err error)
// View 获取库存卡信息表指定信息
View(ctx context.Context, in *model.TSimCardStockViewParam) (res *model.TSimCardStockViewModel, err error)
}
IIotTSimCardStop interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardStopExcelSubmitParam) (*model.TSimCardStopExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardStopInputSubmitParam) (*model.TSimCardStopInputSubmitRes, error)
}
IIotTSimCardTrafficCutoff interface {
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardTrafficCutoffExcelSubmitParam) (*model.TSimCardTrafficCutoffExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardTrafficCutoffInputSubmitParam) (*model.TSimCardTrafficCutoffInputSubmitRes, error)
SubmitRange(ctx context.Context, in *model.TSimCardTrafficCutoffRangeSubmitParam) (*model.TSimCardTrafficCutoffRangeSubmitRes, error)
List(ctx context.Context, in *model.TSimCardTrafficCutoffListParam) (list []*model.TSimCardInfoListModel, total int, err error)
Export(ctx context.Context, in *model.TSimCardTrafficCutoffListParam) error
Edit(ctx context.Context, in *model.TSimCardTrafficCutoffEditParam) error
Delete(ctx context.Context, in *model.TSimCardTrafficCutoffDeleteParam) error
}
IIotTSimCardUnsub interface {
SubmitBatch(ctx context.Context, in *model.TSimCardUnsubBatchSubmitParam) (*model.TSimCardUnsubBatchSubmitRes, error)
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimCardUnsubExcelSubmitParam) (*model.TSimCardUnsubExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimCardUnsubInputSubmitParam) (*model.TSimCardUnsubInputSubmitRes, error)
SubmitRange(ctx context.Context, in *model.TSimCardUnsubRangeSubmitParam) (*model.TSimCardUnsubRangeSubmitRes, error)
}
IIotTSimChannelTemplate interface {
// Model 通道模板ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取通道模板列表
List(ctx context.Context, in *model.TSimChannelTemplateListParam) (list []*model.TSimChannelTemplateListModel, totalCount int, err error)
// Export 导出通道模板
Export(ctx context.Context, in *model.TSimChannelTemplateListParam) (err error)
// Edit 修改/新增通道模板
Edit(ctx context.Context, in *model.TSimChannelTemplateEditParam) (err error)
// Delete 删除通道模板
Delete(ctx context.Context, in *model.TSimChannelTemplateDeleteParam) (err error)
// View 获取通道模板指定信息
View(ctx context.Context, in *model.TSimChannelTemplateViewParam) (res *model.TSimChannelTemplateViewModel, err error)
}
IIotTSimChannels interface {
// Model 通道列表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取通道列表列表
List(ctx context.Context, in *model.TSimChannelsListParam) (list []*model.TSimChannelsListModel, totalCount int, err error)
RefreshCardCounts(ctx context.Context) error
// Export 导出通道列表
Export(ctx context.Context, in *model.TSimChannelsListParam) (err error)
// Edit 修改/新增通道列表
Edit(ctx context.Context, in *model.TSimChannelsEditParam) (err error)
// Delete 删除通道列表
Delete(ctx context.Context, in *model.TSimChannelsDeleteParam) (err error)
// View 获取通道列表指定信息
View(ctx context.Context, in *model.TSimChannelsViewParam) (res *model.TSimChannelsViewModel, err error)
Test(ctx context.Context, in *model.TSimChannelsTestParam) (res *model.TSimChannelsTestOutput, err error)
}
IIotTSimDiagnose interface {
// Info 查询SIM卡诊断信息
Info(ctx context.Context, in *model.TSimDiagnoseInfoReq) (res *model.TSimDiagnoseInfoOutput, err error)
// Flow 查询SIM卡使用流量
Flow(ctx context.Context, in *model.TSimDiagnoseFlowReq) (res *model.TSimDiagnoseFlowOutput, err error)
}
IIotTSimFlowPackageInfo interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, in *model.TSimFlowPackageInfoListParam) (list []*model.TSimFlowPackageInfoListModel, totalCount int, err error)
// 可配置池列表(PackageType=102)
FlowPackageList(ctx context.Context, in *model.TSimFlowPackageInfoFlowPackageListParam) (list []*model.TSimFlowPackageInfoListModel, err error)
// 可配置池加油包列表(PackageType=104)
FlowPackageAddList(ctx context.Context) (list []*model.TSimFlowPackageInfoListModel, err error)
RenewablePackageOptions(ctx context.Context, in *model.TSimFlowPackageInfoRenewablePackageOptionsParam) (list []*model.TSimFlowPackageInfoListModel, err error)
// GetFlowPackageOptions 获取流量套餐GB+MB组合选项
GetFlowPackageOptions(ctx context.Context, in *model.TSimFlowPackageInfoFlowPackageOptionsParam) ([]string, error)
Export(ctx context.Context, in *model.TSimFlowPackageInfoListParam) (err error)
Edit(ctx context.Context, in *model.TSimFlowPackageInfoEditParam) (err error)
Delete(ctx context.Context, in *model.TSimFlowPackageInfoDeleteParam) (err error)
View(ctx context.Context, in *model.TSimFlowPackageInfoViewParam) (res *model.TSimFlowPackageInfoViewModel, err error)
// GetPoolPackagesByCardPackages 根据卡套餐编码列表获取对应的池套餐编码列表
GetPoolPackagesByCardPackages(ctx context.Context, cardPackageCodes []string) (poolPackageMap102 map[string]int64, poolPackageMap104 map[string]int64, err error)
SyncDeptPackages(ctx context.Context) (err error)
SyncDeptPackagesByDept(ctx context.Context, tenantId string, deptId int64, userId int64) error
}
IIotTSimFlowPackagePrice interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
AgentTree(ctx context.Context, in *model.TSimFlowPackagePriceAgentTreeParam) (res *model.TSimFlowPackagePriceAgentTreeRes, err error)
// AgentPackagePriceList 查询指定下级代理套餐生效定价
AgentPackagePriceList(ctx context.Context, in *model.TSimFlowPackagePriceAgentPackagePriceListParam) (list []*model.TSimFlowPackagePriceAgentPackagePriceListItem, totalCount int, err error)
// AgentDefaultPackagePriceList 查询本级默认套餐生效定价
AgentDefaultPackagePriceList(ctx context.Context, in *model.TSimFlowPackagePriceAgentDefaultPackagePriceListParam) (list []*model.TSimFlowPackagePriceAgentDefaultPackagePriceListItem, totalCount int, err error)
// SaveAgentDefaultPackagePrice 保存本级默认套餐生效定价
SaveAgentDefaultPackagePrice(ctx context.Context, in *model.TSimFlowPackagePriceAgentDefaultPackagePriceSaveParam) error
SaveAgentPackagePrice(ctx context.Context, in *model.TSimFlowPackagePriceAgentPackagePriceSaveParam) error
InheritAgentDefaultPackagePrice(ctx context.Context, in *model.TSimFlowPackagePriceAgentDefaultPackagePriceInheritParam) error
InheritAgentPackagePrice(ctx context.Context, in *model.TSimFlowPackagePriceAgentPackagePriceInheritParam) error
}
IIotTSimFlowPool interface {
// Model 流量池表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取流量池表列表
List(ctx context.Context, in *model.TSimFlowPoolListParam) (list []*model.TSimFlowPoolListModel, totalCount int, err error)
// Export 导出流量池表
Export(ctx context.Context, in *model.TSimFlowPoolListParam) (err error)
// Edit 修改/新增流量池表
Edit(ctx context.Context, in *model.TSimFlowPoolEditParam) (err error)
// Delete 删除流量池表
Delete(ctx context.Context, in *model.TSimFlowPoolDeleteParam) (err error)
// View 获取流量池表指定信息
View(ctx context.Context, in *model.TSimFlowPoolViewParam) (res *model.TSimFlowPoolViewModel, err error)
// SyncPoolCard 流量池同步卡信息(调用计算方法)
SyncPoolCard(ctx context.Context, deptId int64) (err error)
// GetCardsByPackageCodes 根据套餐编码列表获取卡列表
GetCardsByPackageCodes(ctx context.Context, req *model.GetCardsByPackageCodesParam) (list []*model.TSimCardInfoListModel, totalCount int, err error)
}
IIotTSimPackageCategory interface {
// Model 套餐分类表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取套餐分类表列表
List(ctx context.Context, in *model.TSimPackageCategoryListParam) (list []*model.TSimPackageCategoryListModel, totalCount int, err error)
// Export 导出套餐分类表
Export(ctx context.Context, in *model.TSimPackageCategoryListParam) (err error)
// Edit 修改/新增套餐分类表
Edit(ctx context.Context, in *model.TSimPackageCategoryEditParam) (err error)
// Delete 删除套餐分类表
Delete(ctx context.Context, in *model.TSimPackageCategoryDeleteParam) (err error)
// View 获取套餐分类表指定信息
View(ctx context.Context, in *model.TSimPackageCategoryViewParam) (res *model.TSimPackageCategoryViewModel, err error)
}
IIotTSimPoolBindPackage interface {
// Model 卡池加油包订购表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取卡池加油包订购表列表
List(ctx context.Context, in *model.TSimPoolBindPackageListParam) (list []*model.TSimPoolBindPackageListModel, totalCount int, err error)
// Export 导出卡池加油包订购表
Export(ctx context.Context, in *model.TSimPoolBindPackageListParam) (err error)
// Edit 修改/新增卡池加油包订购表
Edit(ctx context.Context, in *model.TSimPoolBindPackageEditParam) (err error)
// Delete 删除卡池加油包订购表
Delete(ctx context.Context, in *model.TSimPoolBindPackageDeleteParam) (err error)
// View 获取卡池加油包订购表指定信息
View(ctx context.Context, in *model.TSimPoolBindPackageViewParam) (res *model.TSimPoolBindPackageViewModel, err error)
AddPackageOptions(ctx context.Context, in *model.TSimPoolAddPackageOptionsParam) (*model.TSimAddPackageOptionsRes, error)
AddPackagePaymentContext(ctx context.Context) (*model.TSimAddPackageOptionsRes, error)
DownloadExcelTemplate(ctx context.Context) error
SubmitExcel(ctx context.Context, in *model.TSimPoolBindPackageAddPackageExcelSubmitParam) (*model.TSimPoolBindPackageAddPackageExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimPoolBindPackageAddPackageInputSubmitParam) (*model.TSimPoolBindPackageAddPackageInputSubmitRes, error)
PrepareInput(ctx context.Context, in *model.TSimPoolBindPackageAddPackageInputPrepareParam) (*model.TSimPoolBindPackageAddPackageInputPrepareRes, error)
PrepareResult(ctx context.Context, batchNo string) (*model.TSimPoolBindPackageAddPackagePrepareResultRes, error)
ConfirmBatch(ctx context.Context, in *model.TSimPoolBindPackageAddPackageBatchConfirmParam) (*model.TSimPoolBindPackageAddPackageBatchConfirmRes, error)
}
IIotTSimPoolWarnConfig interface {
// Model 流量池预警配置表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取流量池预警配置表列表
List(ctx context.Context, in *model.TSimPoolWarnConfigListParam) (list []*model.TSimPoolWarnConfigListModel, totalCount int, err error)
// Export 导出流量池预警配置表
Export(ctx context.Context, in *model.TSimPoolWarnConfigListParam) (err error)
// Edit 修改/新增流量池预警配置表
Edit(ctx context.Context, in *model.TSimPoolWarnConfigEditParam) (err error)
// Delete 删除流量池预警配置表
Delete(ctx context.Context, in *model.TSimPoolWarnConfigDeleteParam) (err error)
// View 获取流量池预警配置表指定信息
View(ctx context.Context, in *model.TSimPoolWarnConfigViewParam) (res *model.TSimPoolWarnConfigViewModel, err error)
}
IIotTUpstreamPackage interface {
// Model 上游套餐表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取上游套餐表列表
List(ctx context.Context, in *model.TUpstreamPackageListParam) (list []*model.TUpstreamPackageListModel, totalCount int, err error)
// Export 导出上游套餐表
Export(ctx context.Context, in *model.TUpstreamPackageListParam) (err error)
// Edit 修改/新增上游套餐表
Edit(ctx context.Context, in *model.TUpstreamPackageEditParam) (err error)
// Delete 删除上游套餐表
Delete(ctx context.Context, in *model.TUpstreamPackageDeleteParam) (err error)
// View 获取上游套餐表指定信息
View(ctx context.Context, in *model.TUpstreamPackageViewParam) (res *model.TUpstreamPackageViewModel, err error)
}
IIotTSimWarningConfig interface {
DownloadExcelTemplate(ctx context.Context, itemType int) error
SendEmailCode(ctx context.Context, in *model.TSimWarningConfigEmailCodeParam) error
SubmitExcel(ctx context.Context, in *model.TSimWarningConfigExcelSubmitParam) (*model.TSimWarningConfigExcelSubmitRes, error)
SubmitInput(ctx context.Context, in *model.TSimWarningConfigInputSubmitParam) (*model.TSimWarningConfigInputSubmitRes, error)
SubmitRange(ctx context.Context, in *model.TSimWarningConfigRangeSubmitParam) (*model.TSimWarningConfigRangeSubmitRes, error)
}
)
var (
localIotTFlowPackageConfig IIotTFlowPackageConfig
localIotTOrder IIotTOrder
localIotTSimCardAllocate IIotTSimCardAllocate
localIotTSimCardBindPkg IIotTSimCardBindPkg
localIotTSimCardCancel IIotTSimCardCancel
localIotTSimCardCancellation IIotTSimCardCancellation
localIotTSimCardChange IIotTSimCardChange
localIotTSimCardDataCut IIotTSimCardDataCut
localIotTSimCardDataStart IIotTSimCardDataStart
localIotTSimCardDataStop IIotTSimCardDataStop
localIotTSimCardInbound IIotTSimCardInbound
localIotTSimCardInfo IIotTSimCardInfo
localIotTSimCardOutbound IIotTSimCardOutbound
localIotTSimCardRenew IIotTSimCardRenew
localIotTSimCardRestart IIotTSimCardRestart
localIotTSimCardStart IIotTSimCardStart
localIotTSimCardStock IIotTSimCardStock
localIotTSimCardStop IIotTSimCardStop
localIotTSimCardTrafficCutoff IIotTSimCardTrafficCutoff
localIotTSimCardUnsub IIotTSimCardUnsub
localIotTSimChannelTemplate IIotTSimChannelTemplate
localIotTSimChannels IIotTSimChannels
localIotTSimDiagnose IIotTSimDiagnose
localIotTSimFlowPackageInfo IIotTSimFlowPackageInfo
localIotTSimFlowPackagePrice IIotTSimFlowPackagePrice
localIotTSimFlowPool IIotTSimFlowPool
localIotTSimPackageCategory IIotTSimPackageCategory
localIotTSimPoolBindPackage IIotTSimPoolBindPackage
localIotTSimPoolWarnConfig IIotTSimPoolWarnConfig
localIotTUpstreamPackage IIotTUpstreamPackage
localIotTSimWarningConfig IIotTSimWarningConfig
)
func IotTFlowPackageConfig() IIotTFlowPackageConfig {
if localIotTFlowPackageConfig == nil {
panic("implement not found for interface IIotTFlowPackageConfig, forgot register?")
}
return localIotTFlowPackageConfig
}
func RegisterIotTFlowPackageConfig(i IIotTFlowPackageConfig) {
localIotTFlowPackageConfig = i
}
func IotTOrder() IIotTOrder {
if localIotTOrder == nil {
panic("implement not found for interface IIotTOrder, forgot register?")
}
return localIotTOrder
}
func RegisterIotTOrder(i IIotTOrder) {
localIotTOrder = i
}
func IotTSimCardAllocate() IIotTSimCardAllocate {
if localIotTSimCardAllocate == nil {
panic("implement not found for interface IIotTSimCardAllocate, forgot register?")
}
return localIotTSimCardAllocate
}
func RegisterIotTSimCardAllocate(i IIotTSimCardAllocate) {
localIotTSimCardAllocate = i
}
func IotTSimCardBindPkg() IIotTSimCardBindPkg {
if localIotTSimCardBindPkg == nil {
panic("implement not found for interface IIotTSimCardBindPkg, forgot register?")
}
return localIotTSimCardBindPkg
}
func RegisterIotTSimCardBindPkg(i IIotTSimCardBindPkg) {
localIotTSimCardBindPkg = i
}
func IotTSimCardCancel() IIotTSimCardCancel {
if localIotTSimCardCancel == nil {
panic("implement not found for interface IIotTSimCardCancel, forgot register?")
}
return localIotTSimCardCancel
}
func RegisterIotTSimCardCancel(i IIotTSimCardCancel) {
localIotTSimCardCancel = i
}
func IotTSimCardCancellation() IIotTSimCardCancellation {
if localIotTSimCardCancellation == nil {
panic("implement not found for interface IIotTSimCardCancellation, forgot register?")
}
return localIotTSimCardCancellation
}
func RegisterIotTSimCardCancellation(i IIotTSimCardCancellation) {
localIotTSimCardCancellation = i
}
func IotTSimCardChange() IIotTSimCardChange {
if localIotTSimCardChange == nil {
panic("implement not found for interface IIotTSimCardChange, forgot register?")
}
return localIotTSimCardChange
}
func RegisterIotTSimCardChange(i IIotTSimCardChange) {
localIotTSimCardChange = i
}
func IotTSimCardDataCut() IIotTSimCardDataCut {
if localIotTSimCardDataCut == nil {
panic("implement not found for interface IIotTSimCardDataCut, forgot register?")
}
return localIotTSimCardDataCut
}
func RegisterIotTSimCardDataCut(i IIotTSimCardDataCut) {
localIotTSimCardDataCut = i
}
func IotTSimCardDataStart() IIotTSimCardDataStart {
if localIotTSimCardDataStart == nil {
panic("implement not found for interface IIotTSimCardDataStart, forgot register?")
}
return localIotTSimCardDataStart
}
func RegisterIotTSimCardDataStart(i IIotTSimCardDataStart) {
localIotTSimCardDataStart = i
}
func IotTSimCardDataStop() IIotTSimCardDataStop {
if localIotTSimCardDataStop == nil {
panic("implement not found for interface IIotTSimCardDataStop, forgot register?")
}
return localIotTSimCardDataStop
}
func RegisterIotTSimCardDataStop(i IIotTSimCardDataStop) {
localIotTSimCardDataStop = i
}
func IotTSimCardInbound() IIotTSimCardInbound {
if localIotTSimCardInbound == nil {
panic("implement not found for interface IIotTSimCardInbound, forgot register?")
}
return localIotTSimCardInbound
}
func RegisterIotTSimCardInbound(i IIotTSimCardInbound) {
localIotTSimCardInbound = i
}
func IotTSimCardInfo() IIotTSimCardInfo {
if localIotTSimCardInfo == nil {
panic("implement not found for interface IIotTSimCardInfo, forgot register?")
}
return localIotTSimCardInfo
}
func RegisterIotTSimCardInfo(i IIotTSimCardInfo) {
localIotTSimCardInfo = i
}
func IotTSimCardOutbound() IIotTSimCardOutbound {
if localIotTSimCardOutbound == nil {
panic("implement not found for interface IIotTSimCardOutbound, forgot register?")
}
return localIotTSimCardOutbound
}
func RegisterIotTSimCardOutbound(i IIotTSimCardOutbound) {
localIotTSimCardOutbound = i
}
func IotTSimCardRenew() IIotTSimCardRenew {
if localIotTSimCardRenew == nil {
panic("implement not found for interface IIotTSimCardRenew, forgot register?")
}
return localIotTSimCardRenew
}
func RegisterIotTSimCardRenew(i IIotTSimCardRenew) {
localIotTSimCardRenew = i
}
func IotTSimCardRestart() IIotTSimCardRestart {
if localIotTSimCardRestart == nil {
panic("implement not found for interface IIotTSimCardRestart, forgot register?")
}
return localIotTSimCardRestart
}
func RegisterIotTSimCardRestart(i IIotTSimCardRestart) {
localIotTSimCardRestart = i
}
func IotTSimCardStart() IIotTSimCardStart {
if localIotTSimCardStart == nil {
panic("implement not found for interface IIotTSimCardStart, forgot register?")
}
return localIotTSimCardStart
}
func RegisterIotTSimCardStart(i IIotTSimCardStart) {
localIotTSimCardStart = i
}
func IotTSimCardStock() IIotTSimCardStock {
if localIotTSimCardStock == nil {
panic("implement not found for interface IIotTSimCardStock, forgot register?")
}
return localIotTSimCardStock
}
func RegisterIotTSimCardStock(i IIotTSimCardStock) {
localIotTSimCardStock = i
}
func IotTSimCardStop() IIotTSimCardStop {
if localIotTSimCardStop == nil {
panic("implement not found for interface IIotTSimCardStop, forgot register?")
}
return localIotTSimCardStop
}
func RegisterIotTSimCardStop(i IIotTSimCardStop) {
localIotTSimCardStop = i
}
func IotTSimCardTrafficCutoff() IIotTSimCardTrafficCutoff {
if localIotTSimCardTrafficCutoff == nil {
panic("implement not found for interface IIotTSimCardTrafficCutoff, forgot register?")
}
return localIotTSimCardTrafficCutoff
}
func RegisterIotTSimCardTrafficCutoff(i IIotTSimCardTrafficCutoff) {
localIotTSimCardTrafficCutoff = i
}
func IotTSimCardUnsub() IIotTSimCardUnsub {
if localIotTSimCardUnsub == nil {
panic("implement not found for interface IIotTSimCardUnsub, forgot register?")
}
return localIotTSimCardUnsub
}
func RegisterIotTSimCardUnsub(i IIotTSimCardUnsub) {
localIotTSimCardUnsub = i
}
func IotTSimChannelTemplate() IIotTSimChannelTemplate {
if localIotTSimChannelTemplate == nil {
panic("implement not found for interface IIotTSimChannelTemplate, forgot register?")
}
return localIotTSimChannelTemplate
}
func RegisterIotTSimChannelTemplate(i IIotTSimChannelTemplate) {
localIotTSimChannelTemplate = i
}
func IotTSimChannels() IIotTSimChannels {
if localIotTSimChannels == nil {
panic("implement not found for interface IIotTSimChannels, forgot register?")
}
return localIotTSimChannels
}
func RegisterIotTSimChannels(i IIotTSimChannels) {
localIotTSimChannels = i
}
func IotTSimDiagnose() IIotTSimDiagnose {
if localIotTSimDiagnose == nil {
panic("implement not found for interface IIotTSimDiagnose, forgot register?")
}
return localIotTSimDiagnose
}
func RegisterIotTSimDiagnose(i IIotTSimDiagnose) {
localIotTSimDiagnose = i
}
func IotTSimFlowPackageInfo() IIotTSimFlowPackageInfo {
if localIotTSimFlowPackageInfo == nil {
panic("implement not found for interface IIotTSimFlowPackageInfo, forgot register?")
}
return localIotTSimFlowPackageInfo
}
func RegisterIotTSimFlowPackageInfo(i IIotTSimFlowPackageInfo) {
localIotTSimFlowPackageInfo = i
}
func IotTSimFlowPackagePrice() IIotTSimFlowPackagePrice {
if localIotTSimFlowPackagePrice == nil {
panic("implement not found for interface IIotTSimFlowPackagePrice, forgot register?")
}
return localIotTSimFlowPackagePrice
}
func RegisterIotTSimFlowPackagePrice(i IIotTSimFlowPackagePrice) {
localIotTSimFlowPackagePrice = i
}
func IotTSimFlowPool() IIotTSimFlowPool {
if localIotTSimFlowPool == nil {
panic("implement not found for interface IIotTSimFlowPool, forgot register?")
}
return localIotTSimFlowPool
}
func RegisterIotTSimFlowPool(i IIotTSimFlowPool) {
localIotTSimFlowPool = i
}
func IotTSimPackageCategory() IIotTSimPackageCategory {
if localIotTSimPackageCategory == nil {
panic("implement not found for interface IIotTSimPackageCategory, forgot register?")
}
return localIotTSimPackageCategory
}
func RegisterIotTSimPackageCategory(i IIotTSimPackageCategory) {
localIotTSimPackageCategory = i
}
func IotTSimPoolBindPackage() IIotTSimPoolBindPackage {
if localIotTSimPoolBindPackage == nil {
panic("implement not found for interface IIotTSimPoolBindPackage, forgot register?")
}
return localIotTSimPoolBindPackage
}
func RegisterIotTSimPoolBindPackage(i IIotTSimPoolBindPackage) {
localIotTSimPoolBindPackage = i
}
func IotTSimPoolWarnConfig() IIotTSimPoolWarnConfig {
if localIotTSimPoolWarnConfig == nil {
panic("implement not found for interface IIotTSimPoolWarnConfig, forgot register?")
}
return localIotTSimPoolWarnConfig
}
func RegisterIotTSimPoolWarnConfig(i IIotTSimPoolWarnConfig) {
localIotTSimPoolWarnConfig = i
}
func IotTUpstreamPackage() IIotTUpstreamPackage {
if localIotTUpstreamPackage == nil {
panic("implement not found for interface IIotTUpstreamPackage, forgot register?")
}
return localIotTUpstreamPackage
}
func RegisterIotTUpstreamPackage(i IIotTUpstreamPackage) {
localIotTUpstreamPackage = i
}
func IotTSimWarningConfig() IIotTSimWarningConfig {
if localIotTSimWarningConfig == nil {
panic("implement not found for interface IIotTSimWarningConfig, forgot register?")
}
return localIotTSimWarningConfig
}
func RegisterIotTSimWarningConfig(i IIotTSimWarningConfig) {
localIotTSimWarningConfig = i
}
@@ -0,0 +1,202 @@
// ================================================================================
// 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-admin-svr/internal/model"
"github.com/gogf/gf/v2/database/gdb"
)
type (
IMemoryDB interface {
Init(ctx context.Context) error
// Rebuild replaces all cached tables in one SQLite transaction. The single
// connection keeps readers from observing partially loaded tables, and any
// failure rolls the entire rebuild back.
Rebuild(ctx context.Context) error
EventHandler(ctx context.Context, chg *model.BroadcastDbChgCache) error
DB(ctx context.Context) gdb.DB
Ctx(ctx context.Context) gdb.DB
}
IMemDBSysConfig interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysDept interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysDictData interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysDictType interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysMenu interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysPost interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysRole interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
IMemDBSysTenant interface {
Init(ctx context.Context) error
EventHandler(ctx context.Context) error
DB(ctx context.Context) gdb.DB
TableName(ctx context.Context) string
CreateTable(ctx context.Context) error
LoadData(ctx context.Context, pk int64) error
DeleteData(ctx context.Context, ids []int64) error
}
)
var (
localMemoryDB IMemoryDB
localMemDBSysConfig IMemDBSysConfig
localMemDBSysDept IMemDBSysDept
localMemDBSysDictData IMemDBSysDictData
localMemDBSysDictType IMemDBSysDictType
localMemDBSysMenu IMemDBSysMenu
localMemDBSysPost IMemDBSysPost
localMemDBSysRole IMemDBSysRole
localMemDBSysTenant IMemDBSysTenant
)
func MemoryDB() IMemoryDB {
if localMemoryDB == nil {
panic("implement not found for interface IMemoryDB, forgot register?")
}
return localMemoryDB
}
func RegisterMemoryDB(i IMemoryDB) {
localMemoryDB = i
}
func MemDBSysConfig() IMemDBSysConfig {
if localMemDBSysConfig == nil {
panic("implement not found for interface IMemDBSysConfig, forgot register?")
}
return localMemDBSysConfig
}
func RegisterMemDBSysConfig(i IMemDBSysConfig) {
localMemDBSysConfig = i
}
func MemDBSysDept() IMemDBSysDept {
if localMemDBSysDept == nil {
panic("implement not found for interface IMemDBSysDept, forgot register?")
}
return localMemDBSysDept
}
func RegisterMemDBSysDept(i IMemDBSysDept) {
localMemDBSysDept = i
}
func MemDBSysDictData() IMemDBSysDictData {
if localMemDBSysDictData == nil {
panic("implement not found for interface IMemDBSysDictData, forgot register?")
}
return localMemDBSysDictData
}
func RegisterMemDBSysDictData(i IMemDBSysDictData) {
localMemDBSysDictData = i
}
func MemDBSysDictType() IMemDBSysDictType {
if localMemDBSysDictType == nil {
panic("implement not found for interface IMemDBSysDictType, forgot register?")
}
return localMemDBSysDictType
}
func RegisterMemDBSysDictType(i IMemDBSysDictType) {
localMemDBSysDictType = i
}
func MemDBSysMenu() IMemDBSysMenu {
if localMemDBSysMenu == nil {
panic("implement not found for interface IMemDBSysMenu, forgot register?")
}
return localMemDBSysMenu
}
func RegisterMemDBSysMenu(i IMemDBSysMenu) {
localMemDBSysMenu = i
}
func MemDBSysPost() IMemDBSysPost {
if localMemDBSysPost == nil {
panic("implement not found for interface IMemDBSysPost, forgot register?")
}
return localMemDBSysPost
}
func RegisterMemDBSysPost(i IMemDBSysPost) {
localMemDBSysPost = i
}
func MemDBSysRole() IMemDBSysRole {
if localMemDBSysRole == nil {
panic("implement not found for interface IMemDBSysRole, forgot register?")
}
return localMemDBSysRole
}
func RegisterMemDBSysRole(i IMemDBSysRole) {
localMemDBSysRole = i
}
func MemDBSysTenant() IMemDBSysTenant {
if localMemDBSysTenant == nil {
panic("implement not found for interface IMemDBSysTenant, forgot register?")
}
return localMemDBSysTenant
}
func RegisterMemDBSysTenant(i IMemDBSysTenant) {
localMemDBSysTenant = i
}
@@ -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"
"github.com/gogf/gf/v2/net/ghttp"
)
type (
IMiddleware interface {
ResponseHandler(r *ghttp.Request)
Ctx(r *ghttp.Request)
CORS(r *ghttp.Request)
Auth(r *ghttp.Request)
IsExceptLogin(ctx context.Context, path string) bool
OperationLog(r *ghttp.Request)
ResponseHandlerRaw(r *ghttp.Request)
}
)
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
}
@@ -0,0 +1,44 @@
// ================================================================================
// 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-admin-svr/internal/model"
)
type (
IMonitorServer interface {
GetGoInfo(ctx context.Context) (res *model.GoRunInfo)
// GetHostInfo 获取主机信息
GetHostInfo(ctx context.Context) (data []byte)
// GetSysLoad 获取系统负载信息
GetSysLoad(ctx context.Context) (data []byte)
// GetCpuInfo 获取CPU信息
GetCpuInfo(ctx context.Context) (data []byte)
// GetMemInfo 获取内存信息
GetMemInfo(ctx context.Context) (data []byte)
// GetDiskInfo 获取磁盘信息
GetDiskInfo(ctx context.Context) (data []byte)
// GetNetStatusInfo 获取网络信息
GetNetStatusInfo(ctx context.Context) (data []byte)
}
)
var (
localMonitorServer IMonitorServer
)
func MonitorServer() IMonitorServer {
if localMonitorServer == nil {
panic("implement not found for interface IMonitorServer, forgot register?")
}
return localMonitorServer
}
func RegisterMonitorServer(i IMonitorServer) {
localMonitorServer = i
}
@@ -0,0 +1,8 @@
// ================================================================================
// 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
type ()
@@ -0,0 +1,24 @@
package service
import "context"
type (
IPackageLifecycle interface {
Sync(ctx context.Context)
}
)
var (
localPackageLifecycle IPackageLifecycle
)
func PackageLifecycle() IPackageLifecycle {
if localPackageLifecycle == nil {
panic("implement not found for interface IPackageLifecycle, forgot register?")
}
return localPackageLifecycle
}
func RegisterPackageLifecycle(i IPackageLifecycle) {
localPackageLifecycle = i
}
+30
View File
@@ -0,0 +1,30 @@
package service
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
)
type (
IAlipay interface {
Pay(ctx context.Context, req *model.AlipayPayInput) (res *model.AlipayPayOutput, err error)
Notify(ctx context.Context, req *model.AlipayNotifyInput) (res *model.AlipayNotifyOutput, err error)
Return(ctx context.Context, req *model.AlipayReturnInput) (res *model.AlipayReturnOutput, err error)
Query(ctx context.Context, req *model.AlipayTradeQueryInput) (res *model.AlipayTradeQueryOutput, err error)
Refund(ctx context.Context, req *model.AlipayRefundInput) (res *model.AlipayRefundOutput, err error)
}
)
var localAlipay IAlipay
func Alipay() IAlipay {
if localAlipay == nil {
panic("implement not found for interface IAlipay, forgot register?")
}
return localAlipay
}
func RegisterAlipay(i IAlipay) {
localAlipay = i
}
@@ -0,0 +1,29 @@
package service
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
)
// ISimStatusQueue publishes the additive status-sync queue protocol. It is
// deliberately separate from the existing synchronous status service.
type ISimStatusQueue interface {
StartFullSync(context.Context) error
StartFullSyncRun(context.Context) (string, error)
// StartFullSyncRunScoped narrows the run to a channel whitelist; a nil or
// empty scope is a full sync.
StartFullSyncRunScoped(context.Context, *model.SyncScope) (string, error)
EnqueueCard(context.Context, model.SimStatusQueueTaskMessage) error
}
var localSimStatusQueue ISimStatusQueue
func SimStatusQueue() ISimStatusQueue {
if localSimStatusQueue == nil {
panic("implement not found for interface ISimStatusQueue, forgot register?")
}
return localSimStatusQueue
}
func RegisterSimStatusQueue(i ISimStatusQueue) { localSimStatusQueue = i }
@@ -0,0 +1,38 @@
package service
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
)
type (
ISimWarning interface {
Scan(ctx context.Context)
ScanTraffic(ctx context.Context)
ScanFlowPool(ctx context.Context)
ScanExpire(ctx context.Context)
PreloadExpireCandidates(ctx context.Context)
ScanExpireCandidates(ctx context.Context)
NotifyMonthlyExpiry(ctx context.Context)
ConfigList(ctx context.Context, in *model.SimWarningConfigListParam) (list []*model.SimWarningConfigModel, totalCount int, err error)
ConfigView(ctx context.Context, in *model.SimWarningConfigViewParam) (res *model.SimWarningConfigModel, err error)
ConfigSave(ctx context.Context, in *model.SimWarningConfigSaveParam) (res *model.SimWarningConfigSaveModel, err error)
ConfigStatus(ctx context.Context, in *model.SimWarningConfigStatusParam) (err error)
ConfigDelete(ctx context.Context, in *model.SimWarningConfigDeleteParam) (err error)
}
)
var (
localSimWarning ISimWarning
)
func SimWarning() ISimWarning {
if localSimWarning == nil {
panic("implement not found for interface ISimWarning, forgot register?")
}
return localSimWarning
}
func RegisterSimWarning(i ISimWarning) {
localSimWarning = i
}
+673
View File
@@ -0,0 +1,673 @@
// ================================================================================
// 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"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/system/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/net/ghttp"
)
type (
ISysAuth interface {
Login(ctx context.Context, param *model.LoginParams) (res *model.LoginUserOut, token string, err error)
// 生成Token
GenerateToken(ctx context.Context, user *model.LoginUserOut) (claims *model.CustomClaims, token string, err error)
// 解析Token
ParseToken(ctx context.Context, token string) (claims *model.CustomClaims, err error)
// 删除Token
DeleteToken(ctx context.Context, token string) (err error)
// 获取token
GetAccessToken(ctx context.Context) (token string, err error)
// 根据Token获取当前登录用户信息
GetCurrentUser(ctx context.Context) (claims *model.CustomClaims, err error)
// 获取用户权限码
GetUserAccessCodeList(ctx context.Context, userId int64) (accessCodeList []string, menuRoleAccessCodeList []string, err error)
HasAccessCode(ctx context.Context, requiredCode string) (bool, error)
// 根据openId登录
LoginByOpenId(ctx context.Context, social *model.SysSocialListModel) (res *model.LoginUserOut, token string, err error)
// 发送手机验证码登录短信
SendSmsLoginCode(ctx context.Context, phone string) (err error)
// 手机验证码登录
LoginByPhoneCode(ctx context.Context, phone string, code string) (res *model.LoginUserOut, token string, err error)
}
ISysCaptcha interface {
// 生成验证码
GenerateCaptcha(ctx context.Context) (key string, image string, err error)
// 验证验证码
VerifyCaptcha(ctx context.Context, key string, value string) (err error)
}
ISysClient interface {
List(ctx context.Context, query *model.SysClientListParam) (items []*model.SysClientListModel, total int, err error)
View(ctx context.Context, param *model.SysClientViewParam) (item *model.SysClientViewModel, err error)
Add(ctx context.Context, param *model.SysClientAddParam) (output *model.SysClientAddModel, err error)
Edit(ctx context.Context, param *model.SysClientEditParam) (output *model.SysClientEditModel, err error)
Delete(ctx context.Context, param *model.SysClientDeleteParam) (output *model.SysClientDeleteModel, err error)
Status(ctx context.Context, param *model.SysClientStatusParam) (output *model.SysClientStatusModel, err error)
}
ISysConfig interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysConfigListParam) (items []*model.SysConfigListModel, total int, err error)
Add(ctx context.Context, param *model.SysConfigAddParam) (output *model.SysConfigAddModel, err error)
Edit(ctx context.Context, param *model.SysConfigEditParam) (output *model.SysConfigEditModel, err error)
Delete(ctx context.Context, param *model.SysConfigDeleteParam) (output *model.SysConfigDeleteModel, err error)
View(ctx context.Context, param *model.SysConfigViewParam) (output *model.SysConfigViewModel, err error)
GetConfigByKey(ctx context.Context, configKey string) (config *entity.SysConfig, err error)
}
ISysDept interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
// GetDeptList 获取部门列表
GetDeptList(ctx context.Context, query model.SysDeptListParam) (items []*model.SysDeptListModel, total int, err error)
// GetDeptById 获取部门详情
GetDeptById(ctx context.Context, id int64) (dept *model.SysDeptViewModel, err error)
// 构建树结构
DeptTree(ctx context.Context, parentDept *model.SysDeptTreeModel, deptList []*model.SysDeptListModel, ancestors string) (data []*model.SysDeptTreeModel, err error)
// GetDeptTree 获取部门树
GetDeptTree(ctx context.Context, query model.SysDeptTreeParam) (items []*model.SysDeptTreeModel, err error)
// GetDeptFullTree 获取组织管理页专用的完整部门树(含全部列表字段,支持搜索与筛选)
GetDeptFullTree(ctx context.Context, query model.SysDeptFullTreeParam) (items []*model.SysDeptFullTreeModel, err error)
// 递归构建结构
RecursionDeptIds(ctx context.Context, parentId int64, deptList []*model.SysDeptListModel, data *[]int64) (err error)
// 根据父部门id获取部门列表
GetDeptIdsByParentId(ctx context.Context, parentId int64) (ids []int64, err error)
// AddDept 添加部门
AddDept(ctx context.Context, dept *model.SysDeptAddModel) (deptId int64, err error)
// EditDept 编辑部门
EditDept(ctx context.Context, dept *model.SysDeptEditModel) (deptId int64, err error)
// DeleteDept 删除部门
DeleteDept(ctx context.Context, dept *model.SysDeptDeleteModel) (deptId int64, err error)
// 刷新部门 ancestors
RefreshDeptAncestors(ctx context.Context) (err error)
// GetParentIDAncestors 获取部门祖先
GetParentIDAncestors(ctx context.Context, depts []*model.SysDeptViewModel, printId int64, ancestors *string) (err error)
// GetDeptListByIds 根据部门ID列表获取部门列表
GetDeptListByIds(ctx context.Context, ids []int64) (depts []*model.SysDeptListModel, err error)
// 验证上级是否是公司
ValidateParentIsCompany(ctx context.Context, parentId int64) (isCompany bool, err error)
// 获取组织公司Map
GetDeptCompanyMap(ctx context.Context) (map[int64]string, error)
// 获取上级公司组织信息
GetParentCompanyInfo(ctx context.Context, deptId int64) *model.SysDeptListModel
}
ISysDictData interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysDictDataListParam) (items []model.SysDictDataListModel, total int, err error)
View(ctx context.Context, param *model.SysDictDataViewParam) (data *model.SysDictDataViewModel, err error)
Add(ctx context.Context, param *model.SysDictDataAddParam) (output *model.SysDictDataAddModel, err error)
Edit(ctx context.Context, param *model.SysDictDataEditParam) (output *model.SysDictDataEditModel, err error)
Delete(ctx context.Context, param *model.SysDictDataDeleteParam) (output *model.SysDictDataDeleteModel, err error)
GetDictLabel(ctx context.Context, dictType string, dictCode string) string
GetDictListByTypes(ctx context.Context, dictTypes []string) (dictDataList []model.SysDictDataListModel, err error)
}
ISysDictType interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysDictTypeListParam) (items []model.SysDictTypeListModel, total int, err error)
View(ctx context.Context, param *model.SysDictTypeViewParam) (data *model.SysDictTypeViewModel, err error)
Add(ctx context.Context, param *model.SysDictTypeAddParam) (output *model.SysDictTypeAddModel, err error)
Edit(ctx context.Context, param *model.SysDictTypeEditParam) (output *model.SysDictTypeEditModel, err error)
Delete(ctx context.Context, param *model.SysDictTypeDeleteParam) (output *model.SysDictTypeDeleteModel, err error)
}
ISysJob interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, query *model.SysJobListParam, pageInfo *request.PageInfo) (Data []*model.SysJobListModel, total int, err error)
View(ctx context.Context, jobId int64) (Data *model.SysJobViewModel, err error)
Add(ctx context.Context, jobAdd *model.SysJobAddModel) (LastInsertId int64, err error)
Update(ctx context.Context, jobUpdate *model.SysJobUpdateModel) (RowsAffected int64, err error)
UpdateStatus(ctx context.Context, jobUpdate *model.SysJobUpdateStatusModel) (RowsAffected int64, err error)
Delete(ctx context.Context, jobDelete *model.SysJobDeleteModel) (RowsAffected int64, err error)
Exec(ctx context.Context, jobId int64) error
// 查询所有的状态正常的任务列表,并进行初始注册
InitRegister() error
}
ISysLogininfor interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysLogininforListParam) (items []*model.SysLogininforListModel, total int, err error)
AddLogininfor(ctx context.Context, logininfor *model.SysLogininforAddModel) (id int64, err error)
Delete(ctx context.Context, param *model.SysLogininforDeleteParam) (output *model.SysLogininforDeleteModel, err error)
}
ISysMenu interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysMenuListParam) (data []*model.SysMenuListModel, total int, err error)
// 获取租户菜单列表, 系统租户返回所有菜单,其他租户返回当前租户菜单
GetTenantMenu(ctx context.Context, query *model.SysMenuListParam) (data []*model.SysMenuListModel, total int, err error)
// 获取租户菜单树:后端一次性建好嵌套结构,供菜单管理页直接渲染,避免前端二次建树
GetTenantMenuTree(ctx context.Context, query *model.SysMenuListParam) (items []*model.SysMenuFullTreeModel, err error)
// 构建树结构
MenuTree(ctx context.Context, parentMenu *model.SysMenuTree, menuList []*entity.SysMenu) (data []*model.SysMenuTree, err error)
// 获取用户动态路由列表
GetUserMenu(ctx context.Context) (data []*entity.SysMenu, err error)
// 构建用户动态路由树
BuildUserMenuTree(ctx context.Context, parentMenu *v1.RouteMenu, menuList []*entity.SysMenu, allPath string) (data v1.MenuAllRes, err error)
// 获取用户动态路由树
GetUserMenuTree(ctx context.Context) (data v1.MenuAllRes, err error)
GetSysMenuView(ctx context.Context, menuId int64) (data *model.SysMenuViewModel, err error)
UpdateSysMenu(ctx context.Context, menu *model.SysMenuUpdateModel) (data *model.SysMenuViewModel, err error)
AddSysMenu(ctx context.Context, menu *model.SysMenuAddModel) (data *model.SysMenuViewModel, err error)
DeleteSysMenu(ctx context.Context, menuId int64) (err error)
GetFastList(ctx context.Context) (res map[int64]*entity.SysMenu, err error)
}
ISysNotice interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysNoticeListParam) (items []*model.SysNoticeListModel, total int, err error)
Add(ctx context.Context, param *model.SysNoticeAddParam) (err error)
Edit(ctx context.Context, param *model.SysNoticeEditParam) (err error)
Delete(ctx context.Context, param *model.SysNoticeDeleteParam) (err error)
View(ctx context.Context, param *model.SysNoticeViewParam) (data *model.SysNoticeViewModel, err error)
}
ISysNoticeUser interface {
// Model 用户通知公告表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取用户通知公告表列表
List(ctx context.Context, in *model.SysNoticeUserListParam) (list []*model.SysNoticeUserListModel, totalCount int, err error)
// Export 导出用户通知公告表
Export(ctx context.Context, in *model.SysNoticeUserListParam) (err error)
// Edit 修改/新增用户通知公告表
Edit(ctx context.Context, in *model.SysNoticeUserEditParam) (err error)
// Delete 删除用户通知公告表
Delete(ctx context.Context, in *model.SysNoticeUserDeleteParam) (err error)
// View 获取用户通知公告表指定信息
View(ctx context.Context, in *model.SysNoticeUserViewParam) (res *model.SysNoticeUserViewModel, err error)
// Status 更新用户通知公告表状态
Status(ctx context.Context, in *model.SysNoticeUserStatusParam) (err error)
// Read 已读
Read(ctx context.Context, in *model.SysNoticeUserReadParam) (err error)
}
ISysOperLog interface {
GetOperLogList(ctx context.Context, query *model.SysOperLogListParam, page *request.PageInfo) (items []*model.SysOperLogListModel, total int, err error)
AnalysisLog(ctx context.Context) (data *model.SysOperLogAddParam, err error)
ClearOperationLogByDays(ctx context.Context, days int) error
RealWrite(ctx context.Context, data entity.SysOperLog) (err error)
}
ISysOss interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysOssListParam, pageInfo *request.PageInfo) (items []*model.SysOssListModel, total int, err error)
View(ctx context.Context, param *model.SysOssViewParam) (output *model.SysOssViewModel, err error)
Download(ctx context.Context, param *model.SysOssDownloadParam) (output *model.SysOssDownloadModel, err error)
Delete(ctx context.Context, param *model.SysOssDeleteParam) (output *model.SysOssDeleteModel, err error)
Upload(ctx context.Context, param *model.SysOssUploadParam) (output *model.SysOssUploadModel, err error)
UploadWithBizName(ctx context.Context, param *model.SysOssUploadParam) (output *model.SysOssUploadModel, err error)
MoveFile(ctx context.Context, param *model.SysOssMoveFileParam) (output *model.SysOssMoveFileModel, err error)
SaveContent(ctx context.Context, param *model.SysOssSaveContentParam) (output *model.SysOssSaveContentModel, err error)
GetSaveFilePathConfig(ctx context.Context, newFileType int, notAddDate int) (string, error)
MoveFileLocal(ctx context.Context, filePath string, newFileType int, useOriginalName int, subDirName string, isAddDate int) (result model.UploadResponse, err error)
// 保存内容
SaveContentLocal(ctx context.Context, content []byte, newFileType int, fileName string, subDirName string, isAddDate int) (result model.UploadResponse, err error)
UploadLocal(ctx context.Context, file *ghttp.UploadFile, newFileType int, useOriginalName int, subDirName string, notAddDate int) (result model.UploadResponse, err error)
UploadLocalWithFileName(ctx context.Context, file *ghttp.UploadFile, newFileType int, fileName string, subDirName string, notAddDate int) (result model.UploadResponse, err error)
DownloadLocal(ctx context.Context, file *entity.SysOss, beforeSend ...func() error) (err error)
DeleteLocal(ctx context.Context, file *entity.SysOss) (err error)
CheckType(ctx context.Context, checkFileType string, file *ghttp.UploadFile) (err error)
CheckSize(ctx context.Context, checkFileType string, file *ghttp.UploadFile) (err error)
GetAllUrl(ctx context.Context, url string) (allUrl string, ossId int64, fileSize int64, OriginalName string, md5 string, hmac string, err error)
}
ISysOssConfig interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, param *model.SysOssConfigListParam) (items []*model.SysOssConfigListModel, total int, err error)
View(ctx context.Context, param *model.SysOssConfigViewParam) (item *model.SysOssConfigViewModel, err error)
Add(ctx context.Context, param *model.SysOssConfigAddParam) (item *model.SysOssConfigAddModel, err error)
Edit(ctx context.Context, param *model.SysOssConfigEditParam) (item *model.SysOssConfigEditModel, err error)
Delete(ctx context.Context, param *model.SysOssConfigDeleteParam) (item *model.SysOssConfigDeleteModel, err error)
GetAllUrlByService(ctx context.Context, path string, tenantId string, ossService string) (allUrl string, err error)
}
ISysPost interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, query *model.SysPostListParam) (items []*model.SysPostListModel, total int, err error)
View(ctx context.Context, param *model.SysPostViewParam) (post *model.SysPostViewModel, err error)
Add(ctx context.Context, param *model.SysPostAddParam) (post *model.SysPostAddModel, err error)
Edit(ctx context.Context, param *model.SysPostEditParam) (post *model.SysPostEditModel, err error)
Delete(ctx context.Context, param *model.SysPostDeleteParam) (post *model.SysPostDeleteModel, err error)
Export(ctx context.Context, param *model.SysPostExportParam) (post *model.SysPostExportModel, err error)
}
ISysQrcode interface {
// 获取登录二维码
GetQrcodeLogin(ctx context.Context) (res *model.QrcodeLoginModel, err error)
// 获取登录二维码扫码结果
GetQrcodeLoginStatus(ctx context.Context, tempUserId string) (res *model.QrcodeLoginModel, err error)
// 获取绑定二维码
GetQrcodeBind(ctx context.Context) (res *model.QrcodeCacheModel, err error)
// 获取绑定二维码扫码结果
GetQrcodeBindStatus(ctx context.Context) (res *model.QrcodeBindStatusModel, err error)
// 扫码回调
QrcodeScanCallback(ctx context.Context, param *model.QrcodeScanCallbackParam) (err error)
// 扫码后选择用户登录
QrcodeLoginSelectUserId(ctx context.Context, param *model.QrcodeLoginSelectUserIdParam) (res *model.QrcodeLoginAndBindOpenIdModel, err error)
// 登录并绑定
QrcodeLoginAndBindOpenId(ctx context.Context, param *model.QrcodeLoginAndBindOpenIdParam) (res *model.QrcodeLoginAndBindOpenIdModel, err error)
// 注册并绑定
QrcodeRegisterAndBindOpenId(ctx context.Context, param *model.QrcodeRegisterAndBindOpenIdParam) (res *model.QrcodeLoginAndBindOpenIdModel, err error)
}
ISysRole interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
// 获取租户下角色列表
List(ctx context.Context, param *model.SysRoleListParam) (res []*model.SysRoleListModel, total int, err error)
// 获取角色详情
View(ctx context.Context, param *model.SysRoleViewParam) (res *model.SysRoleViewModel, err error)
// 获取角色菜单
GetRoleMenu(ctx context.Context, id int64) (res []*entity.SysMenu, err error)
// 获取角色部门
GetRoleDept(ctx context.Context, id int64) (res []*entity.SysDept, err error)
// 获取角色列表对应菜单
GetRoleListMenu(ctx context.Context, ids []int64) (res []*entity.SysRoleMenu, err error)
// 新增角色
Add(ctx context.Context, param *model.SysRoleAddParam) (role *model.SysRoleAddModel, err error)
// 编辑角色
Edit(ctx context.Context, param *model.SysRoleEditParam) (role *model.SysRoleEditModel, err error)
// 删除角色
Delete(ctx context.Context, param *model.SysRoleDeleteParam) (role *model.SysRoleDeleteModel, err error)
RoleMenu(ctx context.Context, roleId int64, menuIds []int64, dataScopes map[int64]string) (err error)
// 自定义角色部门数据权限
RoleDept(ctx context.Context, roleId int64, deptIds []int64) (err error)
// 编辑角色数据权限
EditRoleDataScope(ctx context.Context, model *model.SysRoleDataScopeEditParam) (err error)
}
ISysSocial interface {
// 查询社会化关系表
List(ctx context.Context, query *model.SysSocialListParam, page *request.PageInfo) (items []*model.SysSocialListModel, total int, err error)
// 删除社会化关系表
Delete(ctx context.Context, id int64) (err error)
Create(ctx context.Context, social *model.SysSocialSaveParam) (err error)
}
ISysTenant interface {
ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model
// 获取租户信息
View(ctx context.Context, param *model.SysTenantViewParam) (data *model.SysTenantViewModel, err error)
// 获取租户列表
List(ctx context.Context, param *model.SysTenantListParam) (data []*model.SysTenantListModel, total int, err error)
Add(ctx context.Context, param *model.SysTenantAddParam) (output *model.SysTenantAddModel, err error)
Edit(ctx context.Context, param *model.SysTenantEditParam) (output *model.SysTenantEditModel, err error)
Delete(ctx context.Context, param *model.SysTenantDeleteParam) (output *model.SysTenantDeleteModel, err error)
Status(ctx context.Context, param *model.SysTenantStatusParam) (output *model.SysTenantStatusModel, err error)
// 新建租户插入系统参数表数据
BatchInsertSysParam(ctx context.Context, tx gdb.TX, tenantId string, createdBy int64, createdDept int64) (ids []int64, err error)
// 同步租户菜单
SyncTenantMenu(ctx context.Context, tenantId string) (err error)
// 查询用户ID是否是租户管理员
IsTenantAdmin(ctx context.Context, userIds []int64) (isAdminUserIds []int64, err error)
}
ISysTenantPackage interface {
// 获取租户套餐
View(ctx context.Context, param *model.SysTenantPackageViewParam) (data *model.SysTenantPackageViewModel, err error)
List(ctx context.Context, param *model.SysTenantPackageListParam) (data []*model.SysTenantPackageListModel, total int, err error)
Add(ctx context.Context, param *model.SysTenantPackageAddParam) (output *model.SysTenantPackageAddModel, err error)
Edit(ctx context.Context, param *model.SysTenantPackageEditParam) (output *model.SysTenantPackageEditModel, err error)
Delete(ctx context.Context, param *model.SysTenantPackageDeleteParam) (output *model.SysTenantPackageDeleteModel, err error)
Status(ctx context.Context, param *model.SysTenantPackageStatusParam) (output *model.SysTenantPackageStatusModel, err error)
}
ISysUser interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// 根据用户名获取用户信息,不验证当前租户
GetUserByUsername(ctx context.Context, username string, tenantId string) (user *entity.SysUser, err error)
// 根据邮箱获取用户信息,不验证当前租户
GetUserByEmail(ctx context.Context, email string, tenantId string) (user *entity.SysUser, err error)
// 根据手机号获取用户信息,不验证当前租户
GetUserByPhone(ctx context.Context, phone string, tenantId string) (user *entity.SysUser, err error)
// 跨租户按手机号查询用户列表
ListUsersByPhone(ctx context.Context, phone string) (users []*entity.SysUser, err error)
// 根据用户名和密码获取用户信息
GetUserByUsernameAndPassword(ctx context.Context, tenantId string, username string, password string) (user *entity.SysUser, err error)
// 根据用户ID获取用户信息
GetUserById(ctx context.Context, id int64) (user *model.SysUserViewModel, err error)
// 获取用户列表
List(ctx context.Context, page *request.PageInfo, query *model.UserListParam) (items []*model.SysUserListModel, total int, err error)
// 新增用户
AddUser(ctx context.Context, req *model.SysUserAddModel) (data *model.SysUserViewModel, err error)
Profile(ctx context.Context) (user *model.UserProfileModel, err error)
UpdateCurrentUser(ctx context.Context, req *model.UpdateCurrentUserModel) (user *model.SysUserViewModel, err error)
UpdateCurrentUserPassword(ctx context.Context, req *model.UpdateCurrentUserPasswordModel) (err error)
SendCurrentUserEmailCode(ctx context.Context, req *model.SendCurrentUserEmailCodeModel) (err error)
UpdateCurrentUserEmail(ctx context.Context, req *model.UpdateCurrentUserEmailModel) (err error)
SendCurrentUserPhoneCode(ctx context.Context, req *model.SendCurrentUserPhoneCodeModel) (err error)
UpdateCurrentUserPhone(ctx context.Context, req *model.UpdateCurrentUserPhoneModel) (err error)
UpdateUser(ctx context.Context, req *model.SysUserUpdateModel) (err error)
DeleteUser(ctx context.Context, userIds []int64) (err error)
ResetPassword(ctx context.Context, userId int64, password string) (err error)
UpdateLoginInfo(ctx context.Context, userId int64, loginIp string) (err error)
// 获取用户角色ID列表
GetUserRoleIds(ctx context.Context, userId int64) (roleIds []int64, err error)
// 获取用户岗位ID列表
GetUserPostIds(ctx context.Context, userId int64) (postIds []int64, err error)
Register(ctx context.Context, param *model.SysUserRegisterModel) (err error)
// Status 更新用户状态
Status(ctx context.Context, param *model.SysUserStatusParam) (err error)
// 批量查询用户迷你信息
BatchGetUserMiniInfo(ctx context.Context, userIds []int64) (users []*model.SysUserMiniModel, err error)
// 登录时查看是否开启mfa验证
IsMfaEnabled(ctx context.Context) (mfaEnabledModel model.SysUserMfaEnabledModel, err error)
// 是否开启 mfa验证
SetMfaEnabled(ctx context.Context) (uuid string, err error)
// mfa验证
MfaVerify(ctx context.Context, param *model.SysUserIsMfaEnabledModel) (err error)
}
ISysUserOnline interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
Add(ctx context.Context, userOnline *model.SysUserOnlineAddModel) (err error)
List(ctx context.Context, query *model.SysUserOnlineListParam, page *request.PageInfo) (items []*model.SysUserOnlineListModel, total int, err error)
Delete(ctx context.Context, ids []int64) (err error)
DeleteByToken(ctx context.Context, token string) (err error)
}
ISysTTplatformSetting interface {
// Model 二级域名站点个性化配置表ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取二级域名站点个性化配置表列表
List(ctx context.Context, in *model.TTplatformSettingListParam) (list []*model.TTplatformSettingListModel, totalCount int, err error)
// Export 导出二级域名站点个性化配置表
Export(ctx context.Context, in *model.TTplatformSettingListParam) (err error)
// Edit 修改/新增二级域名站点个性化配置表
Edit(ctx context.Context, in *model.TTplatformSettingEditParam) (err error)
// Delete 删除二级域名站点个性化配置表
Delete(ctx context.Context, in *model.TTplatformSettingDeleteParam) (err error)
// MaxSort 获取二级域名站点个性化配置表最大排序
MaxSort(ctx context.Context, in *model.TTplatformSettingMaxSortParam) (res *model.TTplatformSettingMaxSortModel, err error)
// View 获取二级域名站点个性化配置表指定信息
View(ctx context.Context, in *model.TTplatformSettingViewParam) (res *model.TTplatformSettingViewModel, err error)
// Status 更新二级域名站点个性化配置表状态
Status(ctx context.Context, in *model.TTplatformSettingStatusParam) (err error)
}
)
var (
localSysAuth ISysAuth
localSysCaptcha ISysCaptcha
localSysClient ISysClient
localSysConfig ISysConfig
localSysDept ISysDept
localSysDictData ISysDictData
localSysDictType ISysDictType
localSysJob ISysJob
localSysLogininfor ISysLogininfor
localSysMenu ISysMenu
localSysNotice ISysNotice
localSysNoticeUser ISysNoticeUser
localSysOperLog ISysOperLog
localSysOss ISysOss
localSysOssConfig ISysOssConfig
localSysPost ISysPost
localSysQrcode ISysQrcode
localSysRole ISysRole
localSysSocial ISysSocial
localSysTenant ISysTenant
localSysTenantPackage ISysTenantPackage
localSysUser ISysUser
localSysUserOnline ISysUserOnline
localSysTTplatformSetting ISysTTplatformSetting
)
func SysAuth() ISysAuth {
if localSysAuth == nil {
panic("implement not found for interface ISysAuth, forgot register?")
}
return localSysAuth
}
func RegisterSysAuth(i ISysAuth) {
localSysAuth = i
}
func SysCaptcha() ISysCaptcha {
if localSysCaptcha == nil {
panic("implement not found for interface ISysCaptcha, forgot register?")
}
return localSysCaptcha
}
func RegisterSysCaptcha(i ISysCaptcha) {
localSysCaptcha = i
}
func SysClient() ISysClient {
if localSysClient == nil {
panic("implement not found for interface ISysClient, forgot register?")
}
return localSysClient
}
func RegisterSysClient(i ISysClient) {
localSysClient = i
}
func SysConfig() ISysConfig {
if localSysConfig == nil {
panic("implement not found for interface ISysConfig, forgot register?")
}
return localSysConfig
}
func RegisterSysConfig(i ISysConfig) {
localSysConfig = i
}
func SysDept() ISysDept {
if localSysDept == nil {
panic("implement not found for interface ISysDept, forgot register?")
}
return localSysDept
}
func RegisterSysDept(i ISysDept) {
localSysDept = i
}
func SysDictData() ISysDictData {
if localSysDictData == nil {
panic("implement not found for interface ISysDictData, forgot register?")
}
return localSysDictData
}
func RegisterSysDictData(i ISysDictData) {
localSysDictData = i
}
func SysDictType() ISysDictType {
if localSysDictType == nil {
panic("implement not found for interface ISysDictType, forgot register?")
}
return localSysDictType
}
func RegisterSysDictType(i ISysDictType) {
localSysDictType = i
}
func SysJob() ISysJob {
if localSysJob == nil {
panic("implement not found for interface ISysJob, forgot register?")
}
return localSysJob
}
func RegisterSysJob(i ISysJob) {
localSysJob = i
}
func SysLogininfor() ISysLogininfor {
if localSysLogininfor == nil {
panic("implement not found for interface ISysLogininfor, forgot register?")
}
return localSysLogininfor
}
func RegisterSysLogininfor(i ISysLogininfor) {
localSysLogininfor = i
}
func SysMenu() ISysMenu {
if localSysMenu == nil {
panic("implement not found for interface ISysMenu, forgot register?")
}
return localSysMenu
}
func RegisterSysMenu(i ISysMenu) {
localSysMenu = i
}
func SysNotice() ISysNotice {
if localSysNotice == nil {
panic("implement not found for interface ISysNotice, forgot register?")
}
return localSysNotice
}
func RegisterSysNotice(i ISysNotice) {
localSysNotice = i
}
func SysNoticeUser() ISysNoticeUser {
if localSysNoticeUser == nil {
panic("implement not found for interface ISysNoticeUser, forgot register?")
}
return localSysNoticeUser
}
func RegisterSysNoticeUser(i ISysNoticeUser) {
localSysNoticeUser = i
}
func SysOperLog() ISysOperLog {
if localSysOperLog == nil {
panic("implement not found for interface ISysOperLog, forgot register?")
}
return localSysOperLog
}
func RegisterSysOperLog(i ISysOperLog) {
localSysOperLog = i
}
func SysOss() ISysOss {
if localSysOss == nil {
panic("implement not found for interface ISysOss, forgot register?")
}
return localSysOss
}
func RegisterSysOss(i ISysOss) {
localSysOss = i
}
func SysOssConfig() ISysOssConfig {
if localSysOssConfig == nil {
panic("implement not found for interface ISysOssConfig, forgot register?")
}
return localSysOssConfig
}
func RegisterSysOssConfig(i ISysOssConfig) {
localSysOssConfig = i
}
func SysPost() ISysPost {
if localSysPost == nil {
panic("implement not found for interface ISysPost, forgot register?")
}
return localSysPost
}
func RegisterSysPost(i ISysPost) {
localSysPost = i
}
func SysQrcode() ISysQrcode {
if localSysQrcode == nil {
panic("implement not found for interface ISysQrcode, forgot register?")
}
return localSysQrcode
}
func RegisterSysQrcode(i ISysQrcode) {
localSysQrcode = i
}
func SysRole() ISysRole {
if localSysRole == nil {
panic("implement not found for interface ISysRole, forgot register?")
}
return localSysRole
}
func RegisterSysRole(i ISysRole) {
localSysRole = i
}
func SysSocial() ISysSocial {
if localSysSocial == nil {
panic("implement not found for interface ISysSocial, forgot register?")
}
return localSysSocial
}
func RegisterSysSocial(i ISysSocial) {
localSysSocial = i
}
func SysTenant() ISysTenant {
if localSysTenant == nil {
panic("implement not found for interface ISysTenant, forgot register?")
}
return localSysTenant
}
func RegisterSysTenant(i ISysTenant) {
localSysTenant = i
}
func SysTenantPackage() ISysTenantPackage {
if localSysTenantPackage == nil {
panic("implement not found for interface ISysTenantPackage, forgot register?")
}
return localSysTenantPackage
}
func RegisterSysTenantPackage(i ISysTenantPackage) {
localSysTenantPackage = i
}
func SysUser() ISysUser {
if localSysUser == nil {
panic("implement not found for interface ISysUser, forgot register?")
}
return localSysUser
}
func RegisterSysUser(i ISysUser) {
localSysUser = i
}
func SysUserOnline() ISysUserOnline {
if localSysUserOnline == nil {
panic("implement not found for interface ISysUserOnline, forgot register?")
}
return localSysUserOnline
}
func RegisterSysUserOnline(i ISysUserOnline) {
localSysUserOnline = i
}
func SysTTplatformSetting() ISysTTplatformSetting {
if localSysTTplatformSetting == nil {
panic("implement not found for interface ISysTTplatformSetting, forgot register?")
}
return localSysTTplatformSetting
}
func RegisterSysTTplatformSetting(i ISysTTplatformSetting) {
localSysTTplatformSetting = i
}
@@ -0,0 +1,28 @@
package service
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
)
type (
ITrade interface {
CreateRechargePending(ctx context.Context, outTradeNo, totalAmount string) error
// Recharge 余额充值(支付宝回调时调用)
Recharge(ctx context.Context, in *model.TBalanceDetailRechargeModel) (err error)
MarkRechargeFailed(ctx context.Context, outTradeNo string) error
}
)
var localTrade ITrade
func Trade() ITrade {
if localTrade == nil {
panic("implement not found for interface ITrade, forgot register?")
}
return localTrade
}
func RegisterTrade(i ITrade) {
localTrade = i
}
@@ -0,0 +1,24 @@
package service
import "context"
type (
ITrafficCutoff interface {
Check(ctx context.Context)
}
)
var (
localTrafficCutoff ITrafficCutoff
)
func TrafficCutoff() ITrafficCutoff {
if localTrafficCutoff == nil {
panic("implement not found for interface ITrafficCutoff, forgot register?")
}
return localTrafficCutoff
}
func RegisterTrafficCutoff(i ITrafficCutoff) {
localTrafficCutoff = i
}
@@ -0,0 +1,147 @@
// ================================================================================
// 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-admin-svr/internal/model"
"time"
)
type (
ITrafficUsage interface {
// WriteDaily 批量写入日流量数据。
// 每个 ICCID 会落到独立子表,子表通过 t_sim_card_usage_daily 超级表自动创建。
WriteDaily(ctx context.Context, items []model.TrafficUsageDailyItem) error
// WriteMonthly 批量写入月流量数据。
// 月流量和日流量共用同一个 TDengine database,但使用不同超级表。
WriteMonthly(ctx context.Context, items []model.TrafficUsageMonthlyItem) error
// WritePoolUsageDaily 批量写入流量池的流量使用记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_usage_daily 超级表自动创建。
WritePoolUsageDaily(ctx context.Context, items []model.TrafficPoolUsageItem) error
// WritePoolUsageMonthly 批量写入流量池的流量使用记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_usage_monthly 超级表自动创建。
WritePoolUsageMonthly(ctx context.Context, items []model.TrafficPoolUsageItem) error
// WritePoolCardCountDaily 批量写入流量池的卡数量记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_card_count_daily 超级表自动创建。
WritePoolCardCountDaily(ctx context.Context, items []model.TrafficPoolCardCountItem) error
// WritePoolCardCountMonthly 批量写入流量池的卡数量记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_card_count_monthly 超级表自动创建。
WritePoolCardCountMonthly(ctx context.Context, items []model.TrafficPoolCardCountItem) error
// UpdateDaily 更新日流量数据。
UpdateDaily(ctx context.Context, items []model.TrafficUsageDailyItem) error
// UpdateMonthly 更新月流量数据。
UpdateMonthly(ctx context.Context, items []model.TrafficUsageMonthlyItem) error
// DeleteDaily 删除日流量数据。
DeleteDaily(ctx context.Context, input model.TrafficUsageDeleteInput) error
// DeleteMonthly 删除月流量数据。
DeleteMonthly(ctx context.Context, input model.TrafficUsageDeleteInput) error
// QueryDaily 查询日流量数据。
QueryDaily(ctx context.Context, input model.TrafficUsageQueryInput) ([]model.TrafficUsageDailyRecord, int, error)
// QueryMonthly 查询月流量数据。
QueryMonthly(ctx context.Context, input model.TrafficUsageQueryInput) ([]model.TrafficUsageMonthlyRecord, int, error)
// AggregatePoolUsageDaily 汇总日流量数据。
AggregatePoolUsageDaily(ctx context.Context, date time.Time, cards []model.TrafficPoolCard) ([]model.TrafficPoolUsageAggregate, error)
// AggregatePoolUsageMonthly 汇总月流量数据。
AggregatePoolUsageMonthly(ctx context.Context, month time.Time, cards []model.TrafficPoolCard) ([]model.TrafficPoolUsageAggregate, error)
// GetTopUsageCardsYesterday 查询前一天流量使用前五名的卡片
GetTopUsageCardsYesterday(ctx context.Context) ([]model.TopUsageCard, error)
}
ITrafficUsageDailySync interface {
// StartDaily publishes a command for Worker to run the previous-day usage
// full sync. This is the production entry point.
StartDaily(ctx context.Context) error
StartDailyRun(ctx context.Context) (string, error)
// StartDailyRunScoped narrows the run to a channel whitelist; a nil or
// empty scope is a full sync.
StartDailyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error)
// StartDailyRunScopedAt starts a run for a specific day (yyyyMMdd). An
// empty queryDate behaves exactly like StartDailyRunScoped.
StartDailyRunScopedAt(ctx context.Context, scope *model.SyncScope, queryDate string) (string, error)
// SyncDaily is the legacy in-process scan, kept only as the rollback path
// until the Worker chain is verified in production.
SyncDaily(ctx context.Context)
}
ITrafficUsageMonthlySync interface {
SyncMonthly(ctx context.Context)
// StartMonthly publishes a command for Worker to run the full monthly usage sync.
StartMonthly(ctx context.Context) error
StartMonthlyRun(ctx context.Context) (string, error)
// StartMonthlyRunScoped narrows the run to a channel whitelist; a nil or
// empty scope is a full sync.
StartMonthlyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error)
// StartMonthlyHistory publishes a command for Worker to backfill the
// previous month into the TDengine monthly table. This is distinct from
// StartMonthly, which fills the MySQL current-month snapshot.
StartMonthlyHistory(ctx context.Context) error
StartMonthlyHistoryRun(ctx context.Context) (string, error)
// StartMonthlyHistoryRunScoped narrows the run to a channel whitelist; a
// nil or empty scope is a full sync.
StartMonthlyHistoryRunScoped(ctx context.Context, scope *model.SyncScope) (string, error)
// StartMonthlyHistoryRunScopedAt starts a run for a specific month
// (yyyyMM). An empty queryMonth behaves exactly like
// StartMonthlyHistoryRunScoped.
StartMonthlyHistoryRunScopedAt(ctx context.Context, scope *model.SyncScope, queryMonth string) (string, error)
}
ITrafficPoolUsageSync interface {
// TODO: 流量池查询逻辑还未确定
// SyncDaily 同步流量池的流量使用记录
SyncDaily(ctx context.Context)
// SyncMonthly 同步流量池的流量使用记录
SyncMonthly(ctx context.Context)
}
)
var (
localTrafficUsage ITrafficUsage
localTrafficUsageDailySync ITrafficUsageDailySync
localTrafficUsageMonthlySync ITrafficUsageMonthlySync
localTrafficPoolUsageSync ITrafficPoolUsageSync
)
func TrafficUsage() ITrafficUsage {
if localTrafficUsage == nil {
panic("implement not found for interface ITrafficUsage, forgot register?")
}
return localTrafficUsage
}
func RegisterTrafficUsage(i ITrafficUsage) {
localTrafficUsage = i
}
func TrafficUsageDailySync() ITrafficUsageDailySync {
if localTrafficUsageDailySync == nil {
panic("implement not found for interface ITrafficUsageDailySync, forgot register?")
}
return localTrafficUsageDailySync
}
func RegisterTrafficUsageDailySync(i ITrafficUsageDailySync) {
localTrafficUsageDailySync = i
}
func TrafficUsageMonthlySync() ITrafficUsageMonthlySync {
if localTrafficUsageMonthlySync == nil {
panic("implement not found for interface ITrafficUsageMonthlySync, forgot register?")
}
return localTrafficUsageMonthlySync
}
func RegisterTrafficUsageMonthlySync(i ITrafficUsageMonthlySync) {
localTrafficUsageMonthlySync = i
}
func TrafficPoolUsageSync() ITrafficPoolUsageSync {
if localTrafficPoolUsageSync == nil {
panic("implement not found for interface ITrafficPoolUsageSync, forgot register?")
}
return localTrafficPoolUsageSync
}
func RegisterTrafficPoolUsageSync(i ITrafficPoolUsageSync) {
localTrafficPoolUsageSync = i
}
@@ -0,0 +1,65 @@
// ================================================================================
// 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-admin-svr/internal/model"
)
type (
IUpstreamChan interface {
GetUpstreamChanConfig(ctx context.Context) (output model.UpstreamChanConfig, err error)
RefreshGatewayChannel(ctx context.Context, chanKey string) error
RefreshProxyChannel(ctx context.Context, chanKey string) error
TestChannel(ctx context.Context, input *model.UpstreamChannelTestRequest) (*model.TSimChannelsTestOutput, 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)
QuerySimStopReason(ctx context.Context, input *model.SimStopReasonInput) ([]model.SimBaseRes[model.SimStopReasonItem], error)
QuerySimFrozenState(ctx context.Context, input *model.SimFrozenStateInput) ([]model.SimBaseRes[model.SimFrozenStateItem], 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)
// 查询达量限速档位
QuerySimDataDiagnosis(ctx context.Context, input *model.SimDataDiagnosisInput) ([]model.SimBaseRes[model.SimDataDiagnosisItem], 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
}
@@ -0,0 +1,8 @@
// ================================================================================
// 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
type ()
@@ -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-admin-svr/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/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
}