在后台怎么获取api接口进行测试????????????
8 回复
这个接口怎么进行测试啊???
@At
@Ok("json")
@POST
public Object publishArticle(@Param("..") NutMap map, HttpServletRequest req) {
String userId = map.getString("userId","");
if (Strings.isBlank(userId)) {
return Result.error("用户不存在");
}
Iff_user iffUser = iffUserService.fetch(userId);
if (iffUser == null) {
return Result.error("用户不存在");
}
String title = map.getString("title","");
String info = map.getString("info","");
String picurl = map.getString("picurl","");
String vedioUrl = map.getString("vedioUrl","");
String content = map.getString("content","");
String[] picList = map.getString("picList","").split(",");
Trans.exec(new Atom() {
public void run() {
// 创建文章
Iff_article iffArticle = new Iff_article();
iffArticle.setAuthor(iffUser);
iffArticle.setTitle(title);
iffArticle.setInfo(info);
iffArticle.setPicurl(picurl);
iffArticle.setVedioUrl(vedioUrl);
iffArticle.setContent(content);
iffArticleService.insert(iffArticle);
// 储存图片数组
for (String url : picList) {
Iff_article_pic iffArticlePic = new Iff_article_pic();
iffArticlePic.setArticleId(iffArticle.getId());
iffArticlePic.setPicUrl(url);
iffArticlePicService.insert(iffArticlePic);
}
}
});
return Result.success("文章发布成功");
}
添加回复
请先登陆