59eb34976a
iotlcm-admin-svr:管理后台服务。 - Go module:iotlcm → git.5iot.com/iotlcm-public/iotlcm-admin-svr(729 文件) - 凭据与地址脱敏:JWT signingKey(含代码里的 MustGet 默认值)、 MySQL DSN、Redis 口令、告警邮件发件人邮箱全部改为占位; 私网 IP → 文档地址段;库名 xiujie_admin → iotlcm - 真实手机号/邮箱 → 合法 11 位编造号 / example.com - 移除内部资产:CI 触发器、过时 DDL(sql/db_iotlcm.sql)、 私有依赖 go get 行、明文 registry 登录口令 - 启动 banner 统一 IOTLCM 方块字 + 社区惯例署名 - Dockerfile 改用公共基础镜像 - 拼错的 RADEME.md → README.md,README 重写 - 需要真实数据库的用例改为可用 IOTLCM_TEST_WITH_DB=1 显式启用 - 补 Apache-2.0 LICENSE,LF 行尾 + .gitattributes 数据库 schema 不随本仓发布(生产 DDL 已过时),README 已说明。
169 lines
6.4 KiB
Go
169 lines
6.4 KiB
Go
package iot
|
|
|
|
import (
|
|
"context"
|
|
|
|
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
|
)
|
|
|
|
// List 查看订购表列表
|
|
func (c *ControllerV1) TSimCardBindPkgList(ctx context.Context, req *v1.TSimCardBindPkgListReq) (res *v1.TSimCardBindPkgListRes, err error) {
|
|
list, totalCount, err := service.IotTSimCardBindPkg().List(ctx, &req.TSimCardBindPkgListParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.TSimCardBindPkgListModel{}
|
|
}
|
|
|
|
res = new(v1.TSimCardBindPkgListRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
// Export 导出订购表列表
|
|
func (c *ControllerV1) TSimCardBindPkgExport(ctx context.Context, req *v1.TSimCardBindPkgExportReq) (res *v1.TSimCardBindPkgExportRes, err error) {
|
|
err = service.IotTSimCardBindPkg().Export(ctx, &req.TSimCardBindPkgListParam)
|
|
return
|
|
}
|
|
|
|
// Edit 更新订购表
|
|
func (c *ControllerV1) TSimCardBindPkgEdit(ctx context.Context, req *v1.TSimCardBindPkgEditReq) (res *v1.TSimCardBindPkgEditRes, err error) {
|
|
err = service.IotTSimCardBindPkg().Edit(ctx, &req.TSimCardBindPkgEditParam)
|
|
return
|
|
}
|
|
|
|
// View 获取指定订购表信息
|
|
func (c *ControllerV1) TSimCardBindPkgView(ctx context.Context, req *v1.TSimCardBindPkgViewReq) (res *v1.TSimCardBindPkgViewRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().View(ctx, &req.TSimCardBindPkgViewParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = new(v1.TSimCardBindPkgViewRes)
|
|
res.TSimCardBindPkgViewModel = data
|
|
return
|
|
}
|
|
|
|
// Delete 删除订购表
|
|
func (c *ControllerV1) TSimCardBindPkgDelete(ctx context.Context, req *v1.TSimCardBindPkgDeleteReq) (res *v1.TSimCardBindPkgDeleteRes, err error) {
|
|
err = service.IotTSimCardBindPkg().Delete(ctx, &req.TSimCardBindPkgDeleteParam)
|
|
return
|
|
}
|
|
|
|
// GetPkgInfo 套餐详情查询
|
|
func (c *ControllerV1) TSimCardBindPkgGetPkgInfo(ctx context.Context, req *v1.TSimCardBindPkgGetPkgInfoReq) (res *v1.TSimCardBindPkgGetPkgInfoRes, err error) {
|
|
list, totalCount, err := service.IotTSimCardBindPkg().GetPkgInfo(ctx, &req.TSimCardBindPkgInfoParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.TSimCardBindPkgListModel{}
|
|
}
|
|
|
|
res = new(v1.TSimCardBindPkgGetPkgInfoRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
// GetChangePkg 变更套餐查询
|
|
func (c *ControllerV1) TSimCardBindPkgGetChangePkg(ctx context.Context, req *v1.TSimCardBindPkgGetChangePkgReq) (res *v1.TSimCardBindPkgGetChangePkgRes, err error) {
|
|
list, totalCount, err := service.IotTSimCardBindPkg().GetChangePkg(ctx, &req.TSimCardBindPkgInfoParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.TSimCardBindPkgListModel{}
|
|
}
|
|
|
|
res = new(v1.TSimCardBindPkgGetChangePkgRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgAddPackagePaymentContext(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePaymentContextReq) (res *v1.TSimCardBindPkgAddPackagePaymentContextRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().AddPackagePaymentContext(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if data == nil {
|
|
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
|
|
}
|
|
return &v1.TSimCardBindPkgAddPackagePaymentContextRes{TSimAddPackageOptionsRes: data}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgAddPackageOptions(ctx context.Context, req *v1.TSimCardBindPkgAddPackageOptionsReq) (res *v1.TSimCardBindPkgAddPackageOptionsRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().AddPackageOptions(ctx, &req.TSimCardAddPackageOptionsParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if data == nil {
|
|
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
|
|
}
|
|
if data.Items == nil {
|
|
data.Items = []*model.TSimAddPackageOptionModel{}
|
|
}
|
|
return &v1.TSimCardBindPkgAddPackageOptionsRes{TSimAddPackageOptionsRes: data}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgDownloadExcelTemplate(ctx context.Context, req *v1.TSimCardBindPkgDownloadExcelTemplateReq) (res *v1.TSimCardBindPkgDownloadExcelTemplateRes, err error) {
|
|
err = service.IotTSimCardBindPkg().DownloadExcelTemplate(ctx)
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgSubmitExcel(ctx context.Context, req *v1.TSimCardBindPkgSubmitExcelReq) (res *v1.TSimCardBindPkgSubmitExcelRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().SubmitExcel(ctx, &req.TSimCardBindPkgAddPackageExcelSubmitParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
res = &v1.TSimCardBindPkgSubmitExcelRes{TSimCardBindPkgAddPackageExcelSubmitRes: data}
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgSubmitInput(ctx context.Context, req *v1.TSimCardBindPkgSubmitInputReq) (res *v1.TSimCardBindPkgSubmitInputRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().SubmitInput(ctx, &req.TSimCardBindPkgAddPackageInputSubmitParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
res = &v1.TSimCardBindPkgSubmitInputRes{TSimCardBindPkgAddPackageInputSubmitRes: data}
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgAddPackageInputPrepare(ctx context.Context, req *v1.TSimCardBindPkgAddPackageInputPrepareReq) (res *v1.TSimCardBindPkgAddPackageInputPrepareRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().PrepareInput(ctx, &req.TSimCardBindPkgAddPackageInputPrepareParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardBindPkgAddPackageInputPrepareRes{TSimCardBindPkgAddPackageInputPrepareRes: data}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgAddPackagePrepareResult(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePrepareResultReq) (res *v1.TSimCardBindPkgAddPackagePrepareResultRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().PrepareResult(ctx, req.BatchNo)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardBindPkgAddPackagePrepareResultRes{TSimCardBindPkgAddPackagePrepareResultRes: data}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardBindPkgAddPackageBatchConfirm(ctx context.Context, req *v1.TSimCardBindPkgAddPackageBatchConfirmReq) (res *v1.TSimCardBindPkgAddPackageBatchConfirmRes, err error) {
|
|
data, err := service.IotTSimCardBindPkg().ConfirmBatch(ctx, &req.TSimCardBindPkgAddPackageBatchConfirmParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardBindPkgAddPackageBatchConfirmRes{TSimCardBindPkgAddPackageBatchConfirmRes: data}, nil
|
|
}
|