发表于: 2019-11-29 20:29:13

1 1072


今天做了什么

后台-文章管理,前台-文章,学生证部分假数据.

/**
* @description:假数据
* @authoer:Wang
* @create_at:2019-11-29 09:34
**/
@RestController
public class Mock_Data {
   Random random =new Random(10);
   @Autowired
   InitializeClass initializeClass;
   /*
   * 文章后台
   * */
   //获取文章列表
   @RequestMapping(value = "/all/articles",method = RequestMethod.GET)
   @ResponseBody
   public JSONObject getAllArticles(){
       Article article = initializeClass.getBArticle();
       JSONObject object = new JSONObject();
       ArrayList<Article> articles = new ArrayList<>();
       for (int i=0;i<random.nextInt(10);i++){
           articles.add(article);
       }
       object.put("code","200");
       object.put("message","文章列表");
       object.put("data",articles);
       return object;
   }

   @RequestMapping(value = "/article",method = RequestMethod.GET)
   public JSONObject getA(Long id){
       Article article =initializeClass.getBArticle();
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","单篇文章详情");
       object.put("data",article);
       return object;
   }
   @RequestMapping(value = "/hello",method = RequestMethod.GET)
   public String hello(){
       System.out.println("hello");
       return "hello";
   }
   //文章新增
   @RequestMapping(value = "/article",method = RequestMethod.POST)
   @ResponseBody
   public JSONObject postA(@RequestBody Article article){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","文章新增成功:"+article.toString());
       System.out.println(article);
       return object;
   }
   //文章编辑
   @RequestMapping(value = "/article",method = RequestMethod.PUT)
   public JSONObject putA(@RequestBody Article article){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","文章编辑成功:"+article.toString());
       return object;
   }
   //文章删除
   @RequestMapping(value = "/article",method = RequestMethod.DELETE)
   public JSONObject deleteA(Long id){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","成功删除了id"+id+"的文章");
       return object;
   }
   //文章上架
   @RequestMapping(value = "/article/up",method = RequestMethod.PUT)
   public JSONObject putAU(@RequestBody Long id){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","成功上架了id"+id+"的文章");
       return object;
   }
   //文章下架
   @RequestMapping(value = "/article/down",method = RequestMethod.PUT)
   public JSONObject putAD(@RequestBody Long id){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","成功上架了id"+id+"的文章");
       return object;
   }
   //动态搜索文章
   @RequestMapping(value = "/some/articles",method = RequestMethod.GET)
   public JSONObject methodName(){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","搜索结果如下:");
       Article article =initializeClass.getBArticle();
       ArrayList<Article> articles = new ArrayList<>();
       for (int i = 0; i< random.nextInt(7); i++){
           articles.add(article);
       }
       object.put("data",articles);
       return object;
   }
   /*
   文章前台
   */
   //文章列表
   @RequestMapping(value = "/all/frontArticles",method = RequestMethod.GET)
   public JSONObject getfA(){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","成功获取文章列表:");
       ArrayList<Article> articles = new ArrayList<>();
       Article article =initializeClass.getFArticle();
       for (int i = 0; i< random.nextInt(10); i++){
           articles.add(article);
       }
       object.put("data",articles);
       return object;
   }
   //文章详情
   @RequestMapping(value = "/frontArticle",method = RequestMethod.GET)
   public JSONObject getsfA(Long id){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","文章详情:");
       Article article =initializeClass.getFArticle();
       object.put("data",article);
       return object;
   }
   //文章点赞
   @RequestMapping(value = "/article/like",method = RequestMethod.PUT)
   public JSONObject putALike(@RequestBody Long id){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","点赞成功,文章id:"+id);
       return object;
   }
   //文章收藏
   @RequestMapping(value = "/article/collection",method = RequestMethod.PUT)
   public JSONObject putACol(@RequestBody Long id){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","收藏成功,文章id:"+id);
       return object;
   }
   /*
   * 学生证
   * */
   //点击授权登录
   @RequestMapping(value = "/firstLogin",method = RequestMethod.POST)
   public JSONObject firstL(@RequestBody String code){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","code有效,用户注册成功");
       object.put("data",random.nextInt(400));
       return object;
   }
   //获取用户信息
   @RequestMapping(value = "/my/Info",method = RequestMethod.GET)
   public JSONObject myInfo(Long OpenID){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","获取用户信息成功");
       Student student = initializeClass.getFStudent();
       object.put("data",student);
       return object;
   }
   //编辑用户信息
   @RequestMapping(value = "/my/Info",method = RequestMethod.PUT)
   public JSONObject putMyInfo(@RequestBody Student student){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","编辑用户信息成功");
       return object;
   }
   //文章收藏列表
   @RequestMapping(value = "/my/articleCollection",method = RequestMethod.GET)
   public JSONObject myArticleCollection(Long OpenID){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","成功获取文章收藏列表:");
       ArrayList<Article> articles = new ArrayList<>();
       Article article =initializeClass.getFArticle();
       for (int i = 0; i< random.nextInt(10); i++){
           articles.add(article);
       }
       object.put("data",articles);
       return object;
   }
   //视频收藏列表
   @RequestMapping(value = "/my/videoCollection",method = RequestMethod.GET)
   public JSONObject myVideoCollection(Long OpenID){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","成功获取视频收藏列表:");
       ArrayList<Video> videos = new ArrayList<>();
       Video video = initializeClass.getFVideo();
       for (int i = 0; i< random.nextInt(10); i++){
           videos.add(video);
       }
       object.put("data",videos);
       return object;
   }
   //绑定手机
   @RequestMapping(value = "/phone",method = RequestMethod.PUT)
   public JSONObject putPhone(@RequestBody Long OpenID,Long phone){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","绑定手机成功");
       return object;
   }
   //绑定邮箱
   @RequestMapping(value = "/email",method = RequestMethod.PUT)
   public JSONObject putEmail(@RequestBody Long OpenID,String email){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","绑定邮箱成功");
       return object;
   }
   //修改绑定手机
   @RequestMapping(value = "/phone/again",method = RequestMethod.PUT)
   public JSONObject putPhoneAgain(@RequestBody Long OpenID,Long phone){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","修改绑定手机成功");
       return object;
   }
   //修改绑定邮箱
   @RequestMapping(value = "/email/again",method = RequestMethod.PUT)
   public JSONObject putEmailAgain(@RequestBody Long OpenID,String email){
       JSONObject object = new JSONObject();
       object.put("code","200");
       object.put("message","修改绑定邮箱成功");
       return object;
   }
   /*
   * 签到
   * */
   //后台管理
}

收获

问题

明天的计划

完成假数据.

开始后台文章管理模块的开发.











返回列表 返回列表
评论

    分享到