Files
iotlcm/server/internal/library/xgen/gen_model/gen_config.go
T
MiFaZhan 2ed5dfa6a1 chore: 初始开源发布
iotlcm-app:小程序端 + 用户端服务。

- app/:uni-app 小程序前端(基于 unibest,MIT)
  - 微信 AppID → YOUR_WX_APPID,uni-app AppID → __UNI__YOURAPPID
  - 内网后端地址 → admin.iotlcm.example.com
  - 应用标题与 unibest 模板 README 重写(保留上游致谢与 MIT 声明)
- server/:GoFrame 用户端服务(基于 XiuAdmin,Apache-2.0)
  - module xiuadmin → git.5iot.com/iotlcm-public/iotlcm-app(360 文件)
  - 支付回调地址 → app.iotlcm.example.com,商户名与应用名泛化
  - 真实手机号 → 合法 11 位编造号(保留号段前 3 位 + 后 4 位)
  - 依赖号码尾部的断言同步更新
  - 补 server/LICENSE(Apache-2.0)
- 移除内部资产:CI 触发器
- 补根 README,LF 行尾 + .gitattributes

已知:TestSysDept_RefreshDeptAncestors 在源仓同一提交上同样失败,属既有缺陷。
2026-10-26 14:01:25 +08:00

127 lines
4.3 KiB
Go

// package genmodel
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <li@xiujie.cn>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package genmodel
import (
genconsts "git.5iot.com/iotlcm-public/iotlcm-app/internal/library/xgen/gen_consts"
"github.com/gogf/gf/v2/util/gconv"
)
// 模板配置 config/config.yaml xgen.application.crud.templates
type GenCodesConfigCrudTemplate struct {
Group string `name:"group" json:"group"`
IsAddon bool `name:"isAddon" json:"isAddon"`
MasterPackage string `name:"masterPackage" json:"masterPackage"`
TemplatePath string `name:"templatePath" json:"templatePath"`
ApiPath string `name:"apiPath" json:"apiPath"`
InputPath string `name:"inputPath" json:"inputPath"`
ControllerPath string `name:"controllerPath" json:"controllerPath"`
LogicPath string `name:"logicPath" json:"logicPath"`
RouterPath string `name:"routerPath" json:"routerPath"`
SqlPath string `name:"sqlPath" json:"sqlPath"`
WebApiPath string `name:"webApiPath" json:"webApiPath"`
WebViewsPath string `name:"webViewsPath" json:"webViewsPath"`
}
type GenCodesConfigTreeTemplate struct {
Group string `json:"group"`
TemplatePath string `json:"templatePath"`
}
type GenCodesConfigBuildAddon struct {
SrcPath string `json:"srcPath"`
WebApiPath string `json:"webApiPath"`
WebViewsPath string `json:"webViewsPath"`
}
// 工具生成配置 hack/config.yaml gfcli.gen.dao
type GenDaoConfig struct {
Group string `name:"group" json:"group"`
Link string `name:"link" json:"link"`
DbName string `name:"dbName" json:"dbName"`
TableName string `name:"tableName" json:"tableName"`
JsonCase string `name:"jsonCase" json:"jsonCase"`
StdTime bool `name:"stdTime" json:"stdTime"`
GJsonSupport bool `name:"gJsonSupport" json:"gJsonSupport"`
}
// 工具生成配置 hack/config.yaml gfcli.gen.service
type GenServiceConfig struct {
SrcFolder string `name:"srcFolder"`
DstFolder string `name:"dstFolder"`
DstFileNameCase string `name:"dstFileNameCase"`
WatchFile string `name:"watchFile" `
StPattern string `name:"stPattern" `
Packages []string `name:"packages" `
ImportPrefix string `name:"importPrefix" `
Clear bool `name:"clear" `
}
// 模板配置 config/config.yaml xgen
type GenCodesConfig struct {
AllowedIPs []string `json:"allowedIPs"`
Application struct {
Crud struct {
Templates []*GenCodesConfigCrudTemplate `json:"templates"`
} `json:"crud"`
Tree struct {
Templates []*GenCodesConfigTreeTemplate `json:"templates"`
} `json:"tree"`
} `json:"application"`
Delimiters []string `json:"delimiters"`
DevPath string `json:"devPath"`
DisableTables []string `json:"disableTables"`
SelectDbs []string `json:"selectDbs"`
Addon *GenCodesConfigBuildAddon `json:"addon"`
}
// ConvType 类型转换
func ConvType(val interface{}, t string) interface{} {
switch t {
case genconsts.ConfigTypeString:
val = gconv.String(val)
case genconsts.ConfigTypeInt:
val = gconv.Int(val)
case genconsts.ConfigTypeInt8:
val = gconv.Int8(val)
case genconsts.ConfigTypeInt16:
val = gconv.Int16(val)
case genconsts.ConfigTypeInt32:
val = gconv.Int32(val)
case genconsts.ConfigTypeInt64:
val = gconv.Int64(val)
case genconsts.ConfigTypeUint:
val = gconv.Uint(val)
case genconsts.ConfigTypeUint8:
val = gconv.Uint8(val)
case genconsts.ConfigTypeUint16:
val = gconv.Uint16(val)
case genconsts.ConfigTypeUint32:
val = gconv.Uint32(val)
case genconsts.ConfigTypeUint64:
val = gconv.Uint64(val)
case genconsts.ConfigTypeFloat32:
val = gconv.Float32(val)
case genconsts.ConfigTypeFloat64:
val = gconv.Float64(val)
case genconsts.ConfigTypeBool:
val = gconv.Bool(val)
case genconsts.ConfigTypeDate:
val = gconv.Time(val, "Y-m-d")
case genconsts.ConfigTypeDateTime:
val = gconv.Time(val, "Y-m-d H:i:s")
case genconsts.ConfigTypeSliceInt:
val = gconv.SliceInt(val)
case genconsts.ConfigTypeSliceInt64:
val = gconv.SliceInt64(val)
case genconsts.ConfigTypeSliceString:
val = gconv.SliceStr(val)
default:
val = gconv.String(val)
}
return val
}