2024-03-05 20:42:12 +08:00
|
|
|
{
|
|
|
|
"properties" : { },
|
|
|
|
"id" : "ac35656c8123461e8c01e5bfa604a0ee",
|
|
|
|
"script" : null,
|
|
|
|
"groupId" : "6f106ebdee21489db34b956f7770ff03",
|
|
|
|
"name" : "保存代码",
|
|
|
|
"createTime" : null,
|
2024-03-10 23:11:35 +08:00
|
|
|
"updateTime" : 1710083195471,
|
2024-03-05 20:42:12 +08:00
|
|
|
"lock" : null,
|
|
|
|
"createBy" : null,
|
|
|
|
"updateBy" : null,
|
|
|
|
"path" : "/saveCode",
|
|
|
|
"method" : "POST",
|
|
|
|
"parameters" : [ ],
|
2024-03-10 23:11:35 +08:00
|
|
|
"options" : [ {
|
|
|
|
"name" : "permission",
|
|
|
|
"value" : "component:save:code",
|
|
|
|
"description" : "允许拥有该权限的访问",
|
|
|
|
"required" : false,
|
|
|
|
"dataType" : "String",
|
|
|
|
"type" : null,
|
|
|
|
"defaultValue" : null,
|
|
|
|
"validateType" : null,
|
|
|
|
"error" : null,
|
|
|
|
"expression" : null,
|
|
|
|
"children" : null
|
|
|
|
} ],
|
2024-03-05 20:42:12 +08:00
|
|
|
"requestBody" : "",
|
|
|
|
"headers" : [ ],
|
|
|
|
"paths" : [ ],
|
|
|
|
"responseBody" : null,
|
|
|
|
"description" : null,
|
|
|
|
"requestBodyDefinition" : null,
|
|
|
|
"responseBodyDefinition" : null
|
|
|
|
}
|
|
|
|
================================
|
2024-03-07 20:37:55 +08:00
|
|
|
import 'cn.dev33.satoken.stp.StpUtil';
|
|
|
|
|
|
|
|
var currentUserId = StpUtil.getLoginId()
|
2024-03-05 20:42:12 +08:00
|
|
|
|
|
|
|
if(db.selectInt("select count(1) from sys_dynamic_component where id = #{id} and is_del = 0") == 0){
|
|
|
|
exit 0, '文件不存在'
|
|
|
|
}
|
|
|
|
|
2024-03-07 20:37:55 +08:00
|
|
|
db.table("sys_dynamic_component_history").insert({
|
|
|
|
id: uuid(),
|
|
|
|
componentId: id,
|
|
|
|
sourceCode,
|
|
|
|
createBy: currentUserId
|
|
|
|
})
|
|
|
|
|
2024-03-05 20:42:12 +08:00
|
|
|
return db.table("sys_dynamic_component").where().eq("id",id).update({
|
|
|
|
sourceCode,
|
|
|
|
compileJs,
|
|
|
|
compileCss
|
|
|
|
})
|