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 在源仓同一提交上同样失败,属既有缺陷。
This commit is contained in:
MiFaZhan
2026-10-26 14:01:25 +08:00
commit 2ed5dfa6a1
1013 changed files with 138466 additions and 0 deletions
+191
View File
@@ -0,0 +1,191 @@
// package system
// @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 system
import (
"context"
"errors"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/contexts"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/event"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/do"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/entity"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv"
)
type sSysConfig struct {
}
func NewSysConfig() *sSysConfig {
return &sSysConfig{}
}
func init() {
service.RegisterSysConfig(NewSysConfig())
}
func (l *sSysConfig) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
if len(option) == 0 {
option = append(option, &handler.Option{
FilterTenant: true,
FilterAuth: false,
})
}
return handler.Model(dao.SysConfig.Ctx(ctx), option...)
}
func (l *sSysConfig) ModelQuery(ctx context.Context, option ...*handler.Option) *gdb.Model {
if len(option) == 0 {
option = append(option, &handler.Option{
FilterTenant: true,
FilterAuth: false,
})
}
return handler.Model(service.MemoryDB().DB(ctx).Ctx(ctx).Model(dao.SysConfig.Table()), option...)
}
func (s *sSysConfig) List(ctx context.Context, param *model.SysConfigListParam) (items []*model.SysConfigListModel, total int, err error) {
m := s.ModelQuery(ctx)
if param.ConfigName != "" {
m = m.WhereLike(dao.SysConfig.Columns().ConfigName, "%"+param.ConfigName+"%")
}
if param.ConfigKey != "" {
m = m.WhereLike(dao.SysConfig.Columns().ConfigKey, "%"+param.ConfigKey+"%")
}
if param.ConfigType != "" {
m = m.Where(dao.SysConfig.Columns().ConfigType, param.ConfigType)
}
if param.ConfigValue != "" {
m = m.WhereLike(dao.SysConfig.Columns().ConfigValue, "%"+param.ConfigValue+"%")
}
if len(param.CreatedAt) > 0 {
startTime := gtime.NewFromStr(param.CreatedAt[0])
endTime := gtime.NewFromStr(param.CreatedAt[1])
m = m.WhereBetween(dao.SysConfig.Columns().CreatedAt, startTime, endTime.EndOfDay())
}
total, err = m.Count()
if err != nil {
return nil, 0, err
}
err = m.Page(param.Page, param.PageSize).Order(dao.SysConfig.Columns().ConfigId, "ASC").Scan(&items)
if err != nil {
return nil, 0, err
}
return
}
func (s *sSysConfig) Add(ctx context.Context, param *model.SysConfigAddParam) (output *model.SysConfigAddModel, err error) {
if param == nil || param.ConfigName == "" {
return nil, errors.New("配置名称不能为空")
}
m := s.Model(ctx)
data := &do.SysConfig{}
gconv.Struct(param, data)
data.TenantId = contexts.GetTenantId(ctx)
data.CreatedDept = contexts.GetDeptId(ctx)
data.CreatedBy = contexts.GetUserId(ctx)
data.CreatedAt = gtime.Now()
data.UpdatedBy = contexts.GetUserId(ctx)
data.UpdatedAt = gtime.Now()
lastInsertId, err := m.Data(data).InsertAndGetId()
if err != nil {
return nil, err
}
output = &model.SysConfigAddModel{
ConfigId: lastInsertId,
}
event.EventsInstance().Emit(ctx, consts.EventKeyDBSysConfigCreate, lastInsertId, data.TenantId, data.ConfigKey)
return
}
func (s *sSysConfig) Edit(ctx context.Context, param *model.SysConfigEditParam) (output *model.SysConfigEditModel, err error) {
if param == nil || param.ConfigId == 0 {
return nil, errors.New("配置ID不能为空")
}
data := &do.SysConfig{}
gconv.Struct(param, data)
data.UpdatedBy = contexts.GetUserId(ctx)
data.UpdatedAt = gtime.Now()
data.ConfigId = nil
m := s.Model(ctx)
_, err = m.Data(data).Where(dao.SysConfig.Columns().ConfigId, param.ConfigId).Update()
if err != nil {
return nil, err
}
output = &model.SysConfigEditModel{
ConfigId: param.ConfigId,
}
event.EventsInstance().Emit(ctx, consts.EventKeyDBSysConfigUpdate, param.ConfigId, contexts.GetTenantId(ctx), data.ConfigKey)
return
}
func (s *sSysConfig) Delete(ctx context.Context, param *model.SysConfigDeleteParam) (output *model.SysConfigDeleteModel, err error) {
m := s.Model(ctx)
if len(param.ConfigIds) == 0 {
return nil, errors.New("请选择要删除的配置")
}
m = m.WhereIn(dao.SysConfig.Columns().ConfigId, param.ConfigIds)
data := make([]entity.SysConfig, 0)
err = m.Scan(&data)
if err != nil {
return nil, err
}
for _, v := range data {
if v.ConfigType == "Y" {
return nil, errors.New("系统内置配置不能删除")
}
}
_, err = m.Delete()
if err != nil {
return nil, err
}
event.EventsInstance().Emit(ctx, consts.EventKeyDBSysConfigDelete, param.ConfigIds, contexts.GetTenantId(ctx))
return &model.SysConfigDeleteModel{
ConfigIds: param.ConfigIds,
}, nil
}
func (s *sSysConfig) View(ctx context.Context, param *model.SysConfigViewParam) (output *model.SysConfigViewModel, err error) {
m := s.ModelQuery(ctx)
err = m.Where(dao.SysConfig.Columns().ConfigId, param.ConfigId).Scan(&output)
if err != nil {
return nil, err
}
return
}
func (s *sSysConfig) GetConfigByKey(ctx context.Context, configKey string) (config *entity.SysConfig, err error) {
m := s.ModelQuery(ctx)
err = m.Where(dao.SysConfig.Columns().ConfigKey, configKey).Scan(&config)
if err != nil {
return nil, err
}
return
}