chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
func init() {
|
||||
RegisterInnerTask("sync_flow_pool_card", "SyncFlowPoolCard")
|
||||
}
|
||||
|
||||
func (t Task) SyncFlowPoolCard(deptId int64) {
|
||||
ctx := context.Background()
|
||||
if deptId <= 0 {
|
||||
g.Log().Errorf(ctx, "SyncFlowPoolCard failed: invalid deptId %d", deptId)
|
||||
return
|
||||
}
|
||||
|
||||
ctx = contexts.Set(ctx, &model.Context{
|
||||
User: &model.Identity{
|
||||
BaseClaims: model.BaseClaims{
|
||||
ID: consts.SuperAdminRoleId,
|
||||
Username: "system",
|
||||
NickName: "system",
|
||||
DeptId: deptId,
|
||||
TenantId: consts.DefaultSystemTenantCode,
|
||||
Roles: []model.Role{
|
||||
{RoleId: consts.SuperAdminRoleId, DataScope: consts.SysRoleDataScopeAll},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err := service.IotTSimFlowPool().SyncPoolCard(ctx, deptId); err != nil {
|
||||
g.Log().Errorf(ctx, "SyncFlowPoolCard failed, deptId:%d, err:%+v", deptId, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user