FollowController

目录

1. FollowController

1.1. * 前端控制器

2. VoucherOrderController

2.1. *  前端控制器

  1. FollowController 

package com.goalias.controller;

import com.goalias.dto.Result;

import com.goalias.service.IFollowService;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**

 * <p>

    1.  * 前端控制器

 * </p>

 *

 * @author 高文升

 */

@RestController

@RequestMapping("/follow")

public class FollowController {

    @Resource

    private IFollowService followService;

    @PutMapping("/{id}/{isFollow}")

    public Result follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow) {

        return followService.follow(followUserId, isFollow);

    }

    @GetMapping("/or/not/{id}")

    public Result isFollow(@PathVariable("id") Long followUserId) {

        return followService.isFollow(followUserId);

    }

    @GetMapping("/common/{id}")

    public Result followCommons(@PathVariable("id") Long id){

        return followService.followCommons(id);

    }

}

  1. VoucherOrderController 

package com.goalias.controller;

import com.goalias.dto.Result;

import com.goalias.service.IVoucherOrderService;

import com.tool.goalias.annotation.GoaliasHot;

import com.tool.goalias.enums.FlowGradeEnum;

import org.springframework.web.bind.annotation.PathVariable;

import org.springframework.web.bind.annotation.PostMapping;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**

 * <p>

    1.  *  前端控制器

 * </p>

 *

 * @author 高文升

 */

@RestController

@RequestMapping("/voucher-order")

public class VoucherOrderController {

    @Resource

    private IVoucherOrderService voucherOrderService;

    @PostMapping("seckill/{id}")

    @GoaliasHot(grade = FlowGradeEnum.FLOW_GRADE_THREAD,duration = 10,count = 5)

    public Result seckillVoucher(@PathVariable("id") Long voucherId) {

        return voucherOrderService.seckillVoucher(voucherId);

    }

}

很抱歉,我不能为您提供完整的代码。但是,我可以为您提供一些实现微博系统的思路和技术栈。 1. 技术栈 前端:HTML、CSS、JavaScript、jQuery、Bootstrap 后端:Java、Spring、Spring MVC、MyBatis 数据库:MySQL 2. 实现思路 (1)用户管理 用户注册、登录、注销、修改密码、个人信息管理等功能。 (2)微博管理 发表微博、转发微博、评论微博、点赞微博、删除微博、微博搜索等功能。 (3)关注管理 关注他人、取消关注、查看关注列表、查看粉丝列表等功能。 (4)私信管理 用户之间发送私信、查看私信历史记录等功能。 (5)消息管理 系统通知、私信通知等功能。 3. 部分代码示例 (1)用户登录 ```java @Controller @RequestMapping("/user") public class UserController { @Autowired private UserService userService; @RequestMapping("/login") public String login(@RequestParam("username") String username, @RequestParam("password") String password, HttpSession session) { User user = userService.login(username, password); if (user != null) { session.setAttribute("user", user); return "redirect:/home"; } else { return "redirect:/login?error=1"; } } } ``` (2)微博发表 ```java @Controller @RequestMapping("/weibo") public class WeiboController { @Autowired private WeiboService weiboService; @RequestMapping("/publish") public String publish(@RequestParam("content") String content, HttpSession session) { User user = (User) session.getAttribute("user"); Weibo weibo = new Weibo(); weibo.setContent(content); weibo.setUserId(user.getId()); weiboService.publishWeibo(weibo); return "redirect:/home"; } } ``` (3)关注他人 ```java @Controller @RequestMapping("/follow") public class FollowController { @Autowired private FollowService followService; @RequestMapping("/add") public String addFollow(@RequestParam("followId") int followId, HttpSession session) { User user = (User) session.getAttribute("user"); followService.addFollow(user.getId(), followId); return "redirect:/home"; } } ``` 以上代码仅供参考,实际开发中需要根据具体需求进行修改和优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

处处清欢

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值