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:
@@ -0,0 +1,118 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) SysJobList(ctx context.Context, req *v1.SysJobListReq) (res *v1.SysJobListRes, err error) {
|
||||
data, total, err := service.SysJob().List(ctx, &req.SysJobListParam, &req.PageInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysJobListRes{
|
||||
Data: data,
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: total,
|
||||
},
|
||||
}, nil
|
||||
|
||||
}
|
||||
func (c *ControllerV1) SysJobView(ctx context.Context, req *v1.SysJobViewReq) (res *v1.SysJobViewRes, err error) {
|
||||
data, err := service.SysJob().View(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobViewRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
|
||||
}
|
||||
func (c *ControllerV1) SysJobAdd(ctx context.Context, req *v1.SysJobAddReq) (res *v1.SysJobAddRes, err error) {
|
||||
lastInserId, err := service.SysJob().Add(ctx, &req.SysJobAddModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data, err := service.SysJob().View(ctx, lastInserId)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobAddRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
|
||||
}
|
||||
func (c *ControllerV1) SysJobUpdate(ctx context.Context, req *v1.SysJobUpdateReq) (res *v1.SysJobUpdateRes, err error) {
|
||||
effectedRow, err := service.SysJob().Update(ctx, &req.SysJobUpdateModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if effectedRow == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "要更新的数据不存在")
|
||||
}
|
||||
|
||||
data, err := service.SysJob().View(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobUpdateRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysJobUpdateStatus(ctx context.Context, req *v1.SysJobUpdateStatusReq) (res *v1.SysJobUpdateStatusRes, err error) {
|
||||
effectedRow, err := service.SysJob().UpdateStatus(ctx, &req.SysJobUpdateStatusModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if effectedRow == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "要更新的数据不存在")
|
||||
}
|
||||
|
||||
data, err := service.SysJob().View(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SysJobUpdateStatusRes{
|
||||
SysJobViewModel: *data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysJobDelete(ctx context.Context, req *v1.SysJobDeleteReq) (res *v1.SysJobDeleteRes, err error) {
|
||||
if len(req.JobIds) == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeMissingParameter, "参数不能为空")
|
||||
}
|
||||
|
||||
_, err = service.SysJob().Delete(ctx, &model.SysJobDeleteModel{JobIds: req.JobIds})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysJobDeleteRes{
|
||||
JobIds: req.JobIds,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SysJobExec(ctx context.Context, req *v1.SysJobExecReq) (res *v1.SysJobExecRes, err error) {
|
||||
err = service.SysJob().Exec(ctx, req.JobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.SysJobExecRes{
|
||||
JobId: req.JobId,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user