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
@@ -0,0 +1,89 @@
package iot_excelize
import (
"context"
"fmt"
"io"
"strings"
"time"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/entity"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-app/utility/uuid32"
"github.com/xuri/excelize/v2"
)
// SaveLocal saves an Excel workbook through SysOss local storage and records it
// in the sys_oss table.
func SaveLocal(ctx context.Context, f *excelize.File, fileName string, category string) (*entity.SysOss, error) {
if category == "" {
category = "export"
}
category = safePathName(category)
if fileName == "" {
fileName = "excel"
}
fileName = uniqueExcelFileName(fileName)
reader, err := ToReadSeeker(f)
if err != nil {
return nil, err
}
if _, err = reader.Seek(0, io.SeekStart); err != nil {
return nil, err
}
content, err := io.ReadAll(reader)
if err != nil {
return nil, err
}
result, err := service.SysOss().SaveContent(ctx, &model.SysOssSaveContentParam{
Content: content,
FileName: fileName,
NewFileType: consts.SysUploadNewFileTypeUserFile,
SubDirName: "excel/" + category,
NotAddDate: 0,
})
if err != nil {
return nil, err
}
if result == nil {
return nil, nil
}
return result.SysOss, nil
}
func safeExcelFileName(fileName string) string {
fileName = strings.TrimSpace(fileName)
if fileName == "" {
fileName = "excel"
}
fileName = strings.TrimSuffix(fileName, ".xlsx")
for _, old := range []string{"\\", "/", ":", "*", "?", "\"", "<", ">", "|"} {
fileName = strings.ReplaceAll(fileName, old, "_")
}
return fileName + ".xlsx"
}
func uniqueExcelFileName(fileName string) string {
fileName = strings.TrimSuffix(safeExcelFileName(fileName), ".xlsx")
uid := uuid32.S()
if len(uid) > 8 {
uid = uid[:8]
}
return fmt.Sprintf("%s_%s_%s.xlsx", time.Now().Format("20060102150405000"), uid, fileName)
}
func safePathName(name string) string {
name = strings.TrimSpace(name)
if name == "" {
return "export"
}
for _, old := range []string{"\\", "/", ":", "*", "?", "\"", "<", ">", "|", "."} {
name = strings.ReplaceAll(name, old, "_")
}
return name
}