| | |
| | | package com.nq.controller; |
| | | |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.nq.common.ServerResponse; |
| | | |
| | | import com.nq.dao.SiteBannerMapper; |
| | | import com.nq.dao.UserMapper; |
| | | import com.nq.pojo.SiteBanner; |
| | | import com.nq.pojo.SiteSpread; |
| | | import com.nq.pojo.User; |
| | | import com.nq.service.ISiteSpreadService; |
| | | import com.nq.service.IUserService; |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Controller |
| | |
| | | IUserService iUserService; |
| | | |
| | | @Autowired |
| | | UserMapper userMapper; |
| | | |
| | | @Autowired |
| | | ISiteSpreadService iSiteSpreadService; |
| | | |
| | | @Autowired |
| | | SiteBannerMapper siteBannerMapper; |
| | | |
| | | //注册 |
| | | @RequestMapping(value = {"reg.do"}, method = {RequestMethod.POST}) |
| | | @ResponseBody |
| | | public ServerResponse reg(@RequestParam("agentCode") String agentCode, @RequestParam("phone") String phone, @RequestParam(value = "yzmCode", defaultValue = "") String yzmCode, @RequestParam("userPwd") String userPwd, HttpServletRequest httpServletRequest) { |
| | | return this.iUserService.reg(yzmCode, agentCode, phone, userPwd, httpServletRequest); |
| | | } |
| | | public ServerResponse reg( @RequestParam("phone") String phone, @RequestParam("userPwd") String userPwd, HttpServletRequest httpServletRequest) { |
| | | return this.iUserService.reg(phone, userPwd, httpServletRequest); |
| | | } |
| | | |
| | | //修改头像 |
| | | @RequestMapping(value = {"updatePhoto.do"}, method = {RequestMethod.POST}) |
| | | @ResponseBody |
| | | public ServerResponse updatePhoto(@RequestParam("userId") String userId, @RequestParam("photoUrl") String photoUrl,HttpServletRequest httpServletRequest) { |
| | | User user = userMapper.selectById(userId); |
| | | if(ObjectUtil.isEmpty(user)){ |
| | | return ServerResponse.createByErrorMsg("用户不存在!"); |
| | | } |
| | | user.setPhotoUrl(photoUrl); |
| | | userMapper.updateById(user); |
| | | return ServerResponse.createBySuccess(); |
| | | } |
| | | |
| | | //登录 |
| | | @RequestMapping(value = {"login.do"}, method = {RequestMethod.POST}) |
| | |
| | | return ServerResponse.createBySuccess("获取成功", siteSpread); |
| | | } |
| | | |
| | | @RequestMapping({"getSiteBanner.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getSiteBanner() { |
| | | List<SiteBanner> siteBanners = this.siteBannerMapper.listByAdmin(); |
| | | return ServerResponse.createBySuccess(siteBanners); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |