feat: 添加云端函数HTTP请求、SMTP邮件、数据库操作能力

- 添加HTTP客户端工具支持GET/POST请求
- 添加SMTP邮件发送功能
- 添加数据库操作(db.getRecords, db.deleteRecord, db.deleteRecords)
- 添加订单管理云端函数(读取、接收、筛选、成功、失败)
- 添加测试推送和邮件通知云端函数
- 修复云端函数编辑页面预览代码换行显示
- 云端变量数据模型重构(合并数据类型)
This commit is contained in:
2026-04-30 20:54:02 +08:00
parent a4df9e91a0
commit 10044b474f
46 changed files with 15249 additions and 250 deletions
+4 -14
View File
@@ -398,7 +398,6 @@ func handleCreateCloudVariable(c *gin.Context) {
Key string `json:"key"`
DefaultValue string `json:"default_value"`
VarType string `json:"var_type"`
DataType string `json:"data_type"`
MaxRecords int `json:"max_records"`
Scope string `json:"scope"`
WritePermission string `json:"write_permission"`
@@ -431,17 +430,12 @@ func handleCreateCloudVariable(c *gin.Context) {
req.VarType = "string"
}
if req.DataType != "single" && req.DataType != "stream" {
req.DataType = "single"
}
variable := model.CloudVariable{
UserID: userID,
AppID: &req.AppID,
Key: req.Key,
DefaultValue: req.DefaultValue,
VarType: req.VarType,
DataType: req.DataType,
MaxRecords: req.MaxRecords,
Scope: req.Scope,
WritePermission: req.WritePermission,
@@ -464,7 +458,6 @@ func handleUpdateCloudVariable(c *gin.Context) {
Key string `json:"key"`
DefaultValue string `json:"default_value"`
VarType string `json:"var_type"`
DataType string `json:"data_type"`
MaxRecords int `json:"max_records"`
WritePermission string `json:"write_permission"`
Description string `json:"description"`
@@ -485,9 +478,6 @@ func handleUpdateCloudVariable(c *gin.Context) {
variable.Key = req.Key
variable.DefaultValue = req.DefaultValue
variable.VarType = req.VarType
if req.DataType == "single" || req.DataType == "stream" {
variable.DataType = req.DataType
}
variable.MaxRecords = req.MaxRecords
if req.WritePermission == "admin" || req.WritePermission == "user" || req.WritePermission == "app_user" {
variable.WritePermission = req.WritePermission
@@ -715,8 +705,8 @@ func handleGetCloudVariableRecords(c *gin.Context) {
return
}
if variable.DataType != "stream" {
response.Error(c, 400, "该变量不是流水类型")
if variable.VarType != "stream" {
response.Error(c, 400, "该变量不是记录类型")
return
}
@@ -794,8 +784,8 @@ func handleDeleteCloudVariableRecords(c *gin.Context) {
return
}
if variable.DataType != "stream" {
response.Error(c, 400, "该变量不是流水类型")
if variable.VarType != "stream" {
response.Error(c, 400, "该变量不是记录类型")
return
}