1
This commit is contained in:
@@ -97,5 +97,63 @@ public class SocialMediaController extends BaseController
|
||||
return AjaxResult.error("生成完整内容失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提示词模板列表
|
||||
*/
|
||||
@GetMapping("/prompt/list")
|
||||
public AjaxResult listPromptTemplates()
|
||||
{
|
||||
try {
|
||||
return socialMediaService.listPromptTemplates();
|
||||
} catch (Exception e) {
|
||||
logger.error("获取提示词模板列表失败", e);
|
||||
return AjaxResult.error("获取失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个提示词模板
|
||||
*/
|
||||
@GetMapping("/prompt/{key}")
|
||||
public AjaxResult getPromptTemplate(@PathVariable String key)
|
||||
{
|
||||
try {
|
||||
return socialMediaService.getPromptTemplate(key);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取提示词模板失败", e);
|
||||
return AjaxResult.error("获取失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存提示词模板
|
||||
*/
|
||||
@Log(title = "保存提示词模板", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/prompt/save")
|
||||
public AjaxResult savePromptTemplate(@RequestBody Map<String, Object> request)
|
||||
{
|
||||
try {
|
||||
return socialMediaService.savePromptTemplate(request);
|
||||
} catch (Exception e) {
|
||||
logger.error("保存提示词模板失败", e);
|
||||
return AjaxResult.error("保存失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除提示词模板(恢复默认)
|
||||
*/
|
||||
@Log(title = "删除提示词模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/prompt/{key}")
|
||||
public AjaxResult deletePromptTemplate(@PathVariable String key)
|
||||
{
|
||||
try {
|
||||
return socialMediaService.deletePromptTemplate(key);
|
||||
} catch (Exception e) {
|
||||
logger.error("删除提示词模板失败", e);
|
||||
return AjaxResult.error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user