|
@@ -1,18 +1,40 @@
|
|
|
package com.ruoyi.business.xhn.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.ruoyi.business.config.SessionHelper;
|
|
|
+import com.ruoyi.business.config.WxPayConfig;
|
|
|
import com.ruoyi.business.domain.WxPay;
|
|
|
-import com.ruoyi.business.xhn.domain.WxUserInfo;
|
|
|
+import com.ruoyi.business.utils.AliyunSendSmsUtil;
|
|
|
+import com.ruoyi.business.xhn.domain.PayDomain;
|
|
|
+import com.ruoyi.business.xhn.domain.RegisteruserUnpaid;
|
|
|
import com.ruoyi.business.xhn.service.WxService;
|
|
|
+import com.ruoyi.business.xhn.service.impl.RedisService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.activityInfo.domain.XhnActivityInfo;
|
|
|
+import com.ruoyi.business.xhnnotsingle.activityInfo.service.IXhnActivityInfoService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.aliyunSms.domain.XhnAliyunSms;
|
|
|
+import com.ruoyi.business.xhnnotsingle.aliyunSms.service.IXhnAliyunSmsService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.gift.domain.XhnGift;
|
|
|
+import com.ruoyi.business.xhnnotsingle.gift.service.IXhnGiftService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.integral.domain.XhnIntegral;
|
|
|
+import com.ruoyi.business.xhnnotsingle.integral.service.IXhnIntegralService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.matchmaker.domain.XhnMatchmaker;
|
|
|
+import com.ruoyi.business.xhnnotsingle.matchmaker.service.IXhnMatchmakerService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.moneybyintegral.domain.XhnMoneybyintegral;
|
|
|
+import com.ruoyi.business.xhnnotsingle.moneybyintegral.service.IXhnMoneybyintegralService;
|
|
|
+import com.ruoyi.business.xhnnotsingle.registeruser.domain.XhnRegisterUser;
|
|
|
+import com.ruoyi.business.xhnnotsingle.registeruser.service.IXhnRegisterUserService;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import org.apache.shiro.SecurityUtils;
|
|
|
-import org.apache.shiro.subject.Subject;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
@@ -21,6 +43,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.io.PrintWriter;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -36,32 +59,186 @@ import java.util.Map;
|
|
|
@RequestMapping("/xhn")
|
|
|
public class XhnController extends BaseController {
|
|
|
|
|
|
- private String prefix = "xhn";
|
|
|
+ private static final Logger log = LoggerFactory.getLogger("app-xhn");
|
|
|
+
|
|
|
+ private String prefix = "appxhn";
|
|
|
|
|
|
@Autowired
|
|
|
private WxService wxService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IXhnMatchmakerService xhnMatchmakerService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IXhnRegisterUserService xhnRegisterUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxPayConfig wxPayConfig;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ protected RedisService redisService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ protected IXhnAliyunSmsService xhnAliyunSmsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ protected IXhnActivityInfoService xhnActivityInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ protected IXhnGiftService xhnGiftService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ protected IXhnIntegralService xhnIntegralService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ protected IXhnMoneybyintegralService xhnMoneybyintegralService;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
- * 进入程序登录页
|
|
|
+ * 启动页
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping("/login")
|
|
|
- public String login()
|
|
|
+ @GetMapping("/qidongye")
|
|
|
+ public String qidongye(HttpServletRequest request, HttpServletResponse response,ModelMap mmap)
|
|
|
{
|
|
|
- WxUserInfo user = SessionHelper.getCurrentUser();
|
|
|
+ XhnRegisterUser user = SessionHelper.getCurrentUser();
|
|
|
if(user != null){
|
|
|
- return prefix + "/xhnIndex";
|
|
|
+ try {
|
|
|
+ response.sendRedirect(request.getContextPath()+"/xhn/index");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
- return prefix + "/xhnlogin";
|
|
|
+ return prefix + "/qidongye";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 注册页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/register")
|
|
|
+ public String register(HttpServletRequest request, HttpServletResponse response,String code,String promoter,ModelMap mmap)
|
|
|
+ {
|
|
|
+ XhnRegisterUser user = wxService.wxLogin(code,promoter);
|
|
|
+ if(StringUtils.isNotBlank(user.getPhone())){//手机号不为空的情况是注册过的
|
|
|
+ try {
|
|
|
+ response.sendRedirect(request.getContextPath()+"/xhn/index");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mmap.put("user",user);
|
|
|
+ return prefix + "/register";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改个人信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/updateUser")
|
|
|
+ public String updateUser(ModelMap mmap)
|
|
|
+ {
|
|
|
+ mmap.put("user",SessionHelper.getCurrentUser());
|
|
|
+ return prefix + "/updateuser";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 余额充值页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/openRecharge")
|
|
|
+ public String openRecharge(ModelMap mmap)
|
|
|
+ {
|
|
|
+ mmap.put("brUser",SessionHelper.getCurrentUser());
|
|
|
+ mmap.put("jfList",xhnMoneybyintegralService.selectXhnMoneybyintegralList(new XhnMoneybyintegral()));
|
|
|
+ return prefix + "/openRecharge";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 进入程序首页
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/index")
|
|
|
- public String index()
|
|
|
+ public String index(ModelMap mmap)
|
|
|
+ {
|
|
|
+ XhnActivityInfo daohang = new XhnActivityInfo();
|
|
|
+ daohang.setType("1");
|
|
|
+ mmap.put("daohang",xhnActivityInfoService.selectXhnActivityInfoList(daohang));
|
|
|
+ RegisteruserUnpaid appuser = new RegisteruserUnpaid();
|
|
|
+ appuser.setOpenid(SessionHelper.getCurrentUserId());
|
|
|
+ PageInfo<RegisteruserUnpaid> pageInfo = xhnRegisterUserService.findXhnRegisterUserByApp(1, 10, appuser);
|
|
|
+ mmap.put("userList",pageInfo);
|
|
|
+ mmap.put("brUser",SessionHelper.getCurrentUser());
|
|
|
+ XhnActivityInfo xhnActivityInfo = new XhnActivityInfo();
|
|
|
+ xhnActivityInfo.setType("2");
|
|
|
+ mmap.put("huodongList",xhnActivityInfoService.selectXhnActivityInfoList(xhnActivityInfo));
|
|
|
+ mmap.put("hongniangList",xhnMatchmakerService.selectXhnMatchmakerList(new XhnMatchmaker()));
|
|
|
+ return prefix + "/index";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 活动页面详情页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/activityInfo")
|
|
|
+ public String activityInfo(ModelMap mmap,String huodongId)
|
|
|
{
|
|
|
- return prefix + "/xhnIndex";
|
|
|
+ XhnActivityInfo xhnActivityInfo = xhnActivityInfoService.selectXhnActivityInfoById(huodongId);
|
|
|
+ mmap.put("huodongInfo",xhnActivityInfo);
|
|
|
+ mmap.put("bmUserNum",xhnActivityInfoService.findApplicantsNumById(huodongId));
|
|
|
+ mmap.put("isBaoMing",xhnActivityInfoService.findApplicantsNumByIdAndOpenId(huodongId,SessionHelper.getCurrentUserId()));
|
|
|
+ mmap.put("brUser",SessionHelper.getCurrentUser());
|
|
|
+ mmap.put("date",new Date().compareTo(xhnActivityInfo.getActivityStartDate()) == -1 ? true:false);
|
|
|
+ return prefix + "/activity";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 进入盲盒详情页
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/chaitamh")
|
|
|
+ public String chaitamh(ModelMap mmap,String openid)
|
|
|
+ {
|
|
|
+ RegisteruserUnpaid user = wxService.findAppUserByOpenid(openid);
|
|
|
+ mmap.put("user",user);
|
|
|
+ mmap.put("bropenid",SessionHelper.getCurrentUserId());
|
|
|
+ XhnGift gift = new XhnGift();
|
|
|
+ gift.setState("Y");
|
|
|
+ mmap.put("giftList",xhnGiftService.selectXhnGiftList(gift));
|
|
|
+ return prefix + "/chaitamh";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 进入红娘详情页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/matchmaker")
|
|
|
+ public String matchmaker(ModelMap mmap,String hongniangid)
|
|
|
+ {
|
|
|
+ mmap.put("matchmaker",xhnMatchmakerService.selectXhnMatchmakerById(hongniangid));
|
|
|
+ return prefix + "/matchmaker";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 进入关于我们页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/goGywm")
|
|
|
+ public String goGywm(ModelMap mmap)
|
|
|
+ {
|
|
|
+ return prefix + "/gywm";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打开盲盒按钮跳转支付页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/openBox")
|
|
|
+ public String openBox(ModelMap mmap,String url,String boxOpenid)
|
|
|
+ {
|
|
|
+ mmap.put("brUser",SessionHelper.getCurrentUser());
|
|
|
+ mmap.put("hdUrl",url);
|
|
|
+ mmap.put("boxOpenid",boxOpenid);
|
|
|
+ return prefix + "/openBox";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -107,17 +284,367 @@ public class XhnController extends BaseController {
|
|
|
}
|
|
|
/**
|
|
|
* 微信登录授权获取用户微信信息
|
|
|
+ * code 微信授权所需code
|
|
|
+ * promoter 推广人id
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/wxLogin")
|
|
|
@ResponseBody
|
|
|
- public AjaxResult access_token(HttpServletRequest request, HttpServletResponse response, String code) throws ServletException, IOException {
|
|
|
-// `/xhn/access_token?appid=${this.APPID}&secret=${this.APPSECRET}&code=${code}&grant_type=authorization_code`
|
|
|
- /*
|
|
|
- * 参数
|
|
|
- * code 填写第一步获取的 code 参数
|
|
|
- */
|
|
|
- WxUserInfo ret = wxService.wxLogin(code);
|
|
|
+ public AjaxResult access_token(HttpServletRequest request, HttpServletResponse response, String code,String promoter) throws ServletException, IOException {
|
|
|
+ XhnRegisterUser ret = wxService.wxLogin(code,promoter);
|
|
|
+ return AjaxResult.success(ret);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 微信支付发起接口
|
|
|
+ * description 订单汉字描述
|
|
|
+ * total 金额(分)
|
|
|
+ * purpose 用途 0:放入盲盒;1:开盲盒;2:充值余额;3:活动报名
|
|
|
+ * boxOpenid 盲盒信息id
|
|
|
+ * @return 返回订单等信息
|
|
|
+ */
|
|
|
+ @PostMapping("/getPayPrepayId")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getPayPrepayId(HttpServletRequest request, HttpServletResponse response,String description,String total,String purpose,String boxOpenid) throws Exception {
|
|
|
+ XhnRegisterUser user = SessionHelper.getCurrentUser();
|
|
|
+ PayDomain ret = wxService.getPayPrepayId(user,description,total,purpose,boxOpenid);
|
|
|
return AjaxResult.success(ret);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 付款后回调函数接口
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/weixinotify")
|
|
|
+ public void weixinotify(HttpServletRequest request,HttpServletResponse response,ModelMap mmap) {
|
|
|
+ String ret = "";
|
|
|
+// //给微信的回应
|
|
|
+ Map<String, String> result = new HashMap<>(2);
|
|
|
+// //解密数据
|
|
|
+ String data = wxPayConfig.payRequestDecryption(request);
|
|
|
+ if (data == null){
|
|
|
+ result.put("code","FAILED");
|
|
|
+ result.put("message","失败");
|
|
|
+ String json = JSON.toJSONString(result);
|
|
|
+ }
|
|
|
+ log.info("微信支付处理后的数据data={}", data);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ //TODO .......业务逻辑处理
|
|
|
+ try {
|
|
|
+ wxService.payResult(jsonObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println("支付成功,逻辑处理失败---,支付返回的数据---"+jsonObject);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ log.info("微信支付回调成功");
|
|
|
+ result.put("code","SUCCESS");
|
|
|
+ result.put("message","成功");
|
|
|
+ log.info(ret);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 余额换积分接口
|
|
|
+ * openid 操作人id
|
|
|
+ * mbiId 对应兑换积分id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/moneyConvertedIntegral")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult moneyConvertedIntegral(String openid,String mbiId) {
|
|
|
+ try {
|
|
|
+ wxService.moneyConvertedIntegral(openid,mbiId);
|
|
|
+ return AjaxResult.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 余额开盲盒接口
|
|
|
+ * @param openid 消费人openid
|
|
|
+ * @param boxOpenid 盲盒人openid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/moneyOpenBlindBox")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult moneyOpenBlindBox(String openid,String boxOpenid) {
|
|
|
+ try {
|
|
|
+ wxService.moneyOpenBlindBox(openid,boxOpenid);
|
|
|
+ return AjaxResult.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 积分开盲盒接口
|
|
|
+ * @param openid 消费人openid
|
|
|
+ * @param boxOpenid 盲盒人openid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/integralOpenBlindBox")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult integralOpenBlindBox(String openid,String boxOpenid) {
|
|
|
+ try {
|
|
|
+ wxService.integralOpenBlindBox(openid,boxOpenid);
|
|
|
+ return AjaxResult.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 放入盲盒免费开盲盒一次接口
|
|
|
+ * @param openid 消费人openid
|
|
|
+ * @param boxOpenid 盲盒人openid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/freeOpenBlindBox")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult freeOpenBlindBox(String openid,String boxOpenid) {
|
|
|
+ try {
|
|
|
+ wxService.freeOpenBlindBox(openid,boxOpenid);
|
|
|
+ return AjaxResult.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 赠送礼物接口
|
|
|
+ * @param openid 赠送人openid
|
|
|
+ * @param bOpenid 被赠送人openid
|
|
|
+ * @param giftId 礼物id
|
|
|
+ * @param giftNum 礼物数量
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/giftGive")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult giftGive(String openid,String bOpenid,String giftId,Integer giftNum) {
|
|
|
+ try {
|
|
|
+ String ret = wxService.giftGive(openid,bOpenid,giftId,giftNum);
|
|
|
+ return AjaxResult.success(ret);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转购买记录页面查询本人开盲盒记录(购买记录)
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/lookBuy")
|
|
|
+ public String lookBuy(ModelMap mmap){
|
|
|
+ mmap.put("openid",SessionHelper.getCurrentUserId());
|
|
|
+ return prefix + "/lookBuy";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询本人开盲盒记录(购买记录)
|
|
|
+ * @param openid 消费人id(如果只有这个代表查询记录)
|
|
|
+ * @param boxOpenid 盲盒人id(如果有这个代表验证是否开过此人的盲盒)
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getOpenBlindBoxList")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getOpenBlindBoxList(String openid, String boxOpenid){
|
|
|
+ return AjaxResult.success(wxService.getOpenBlindBoxList(openid,boxOpenid));
|
|
|
+ }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 查询本人都收到过谁的礼物
|
|
|
+// * @param openid
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @GetMapping("/getReceivedGiftList")
|
|
|
+// @ResponseBody
|
|
|
+// public AjaxResult getReceivedGiftList(String openid){
|
|
|
+// return AjaxResult.success(wxService.getReceivedGiftList(openid));
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转推广记录页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/lookExtension")
|
|
|
+ public String lookExtension(ModelMap mmap){
|
|
|
+ mmap.put("openid",SessionHelper.getCurrentUserId());
|
|
|
+ return prefix + "/lookExtension";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 推广记录
|
|
|
+ * @param openid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getExtensionList")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getExtensionList(String openid){
|
|
|
+ XhnRegisterUser xhnRegisterUser = new XhnRegisterUser();
|
|
|
+ xhnRegisterUser.setPromoter(openid);
|
|
|
+ return AjaxResult.success( xhnRegisterUserService.selectXhnRegisterUserList(xhnRegisterUser));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转积分账单页面
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/lookGiveGift")
|
|
|
+ public String lookGiveGift(ModelMap mmap){
|
|
|
+ mmap.put("user",SessionHelper.getCurrentUser());
|
|
|
+ return prefix + "/lookGiveGift";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询积分账单列表(积分账单)
|
|
|
+ * @param openid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getGiveGiftList")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getGiveGiftList(String openid){
|
|
|
+ return AjaxResult.success(wxService.getGiveGiftList(openid));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*************************************************** 短信验证码 *****************************************************/
|
|
|
+ /**
|
|
|
+ * create by xqh on 2019/5/31 17:59
|
|
|
+ * 短信验证码
|
|
|
+ * @params
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/sendSmsVerify")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult sendSmsVerify(String phone){
|
|
|
+ XhnRegisterUser user = SessionHelper.getCurrentUser();
|
|
|
+ String json = (String) redisService.get(phone);
|
|
|
+ String s = Integer.toString((int)((Math.random()*9+1)*100000));
|
|
|
+ Map<String,String> data = new HashMap<>();
|
|
|
+ data.put("code",s);
|
|
|
+ try {
|
|
|
+ XhnAliyunSms xhnAliyunSms = AliyunSendSmsUtil.sendMsg((aliyunSms1)->{
|
|
|
+ aliyunSms1.setOpenid(user.getOpenid());
|
|
|
+ aliyunSms1.setCreateBy(user.getOpenid());
|
|
|
+ try {
|
|
|
+ long expireTime = 60 * 5;
|
|
|
+ Map<String, Object> map = new HashMap<>(2);
|
|
|
+ map.put("code", s);
|
|
|
+ map.put("date", System.currentTimeMillis());
|
|
|
+ redisService.set(phone, s, expireTime);
|
|
|
+ xhnAliyunSmsService.insertXhnAAliyunSms(aliyunSms1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } , AliyunSendSmsUtil.templCode.get("验证码"), data, phone);
|
|
|
+ return AjaxResult.success(xhnAliyunSms);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("发送失败,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*************************************************** 短信验证码end *****************************************************/
|
|
|
+ /**
|
|
|
+ * 注册修改用户资料
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/updateRegisterUser")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult updateRegisterUser(XhnRegisterUser xhnRegisterUser){
|
|
|
+ try{
|
|
|
+ //判断验证码
|
|
|
+ String code = (String) redisService.get(xhnRegisterUser.getPhone());
|
|
|
+ if (!xhnRegisterUser.getShortMsg().equals(code)) {
|
|
|
+ return AjaxResult.error("验证码错误");
|
|
|
+ }
|
|
|
+ redisService.remove(xhnRegisterUser.getPhone());
|
|
|
+ xhnRegisterUserService.updateXhnRegisterUser(xhnRegisterUser);
|
|
|
+ SessionHelper.setAttribute(SessionHelper.CURRENT_USER, xhnRegisterUser);//更新用户信息
|
|
|
+
|
|
|
+ return AjaxResult.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("发送失败,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取随机一条盲盒信息
|
|
|
+ * @param registeruserUnpaid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/getRandomBlindBox")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getRandomBlindBox(RegisteruserUnpaid registeruserUnpaid){
|
|
|
+ registeruserUnpaid.setTaLocation(registeruserUnpaid.getTaLocation().replaceAll("-undefined",""));
|
|
|
+ registeruserUnpaid.setOpenid(SessionHelper.getCurrentUserId());
|
|
|
+ return AjaxResult.success(wxService.getRandomBlindBox(registeruserUnpaid));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 每日签到增加积分
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/signIn")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult signIn(){
|
|
|
+ XhnRegisterUser user = SessionHelper.getCurrentUser();
|
|
|
+ user.setMemberIntegral(user.getMemberIntegral()+1);
|
|
|
+ user.setSignIn("1");
|
|
|
+ xhnRegisterUserService.updateXhnRegisterUser(user);
|
|
|
+ SessionHelper.setAttribute(SessionHelper.CURRENT_USER, user);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取开过的盲盒隐藏信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/boxUserInfo")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult boxUserInfo(String boxOpenid){
|
|
|
+ return AjaxResult.success(xhnRegisterUserService.selectXhnRegisterUserByOpenid(boxOpenid));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据查询条件获取盲盒列表
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/getBoxList")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getBoxList(RegisteruserUnpaid appuser){
|
|
|
+ if(StringUtils.isNotBlank(appuser.getWorkNature())){
|
|
|
+ appuser.setWorkNatureArray(appuser.getWorkNature().split(","));
|
|
|
+ }
|
|
|
+ appuser.setOpenid(SessionHelper.getCurrentUserId());
|
|
|
+ PageInfo<RegisteruserUnpaid> pageInfo = xhnRegisterUserService.findXhnRegisterUserByApp(appuser.getPageNum(), 10, appuser);
|
|
|
+ return AjaxResult.success(pageInfo.getList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转金额||积分消费账单
|
|
|
+ */
|
|
|
+ @GetMapping("/getIntegralBill")
|
|
|
+ public String getIntegralBill(ModelMap mmap)
|
|
|
+ {
|
|
|
+ XhnIntegral xhnIntegral = new XhnIntegral();
|
|
|
+ xhnIntegral.setUserOpenid(SessionHelper.getCurrentUserId());
|
|
|
+ mmap.put("bill",xhnIntegralService.selectXhnIntegralList(xhnIntegral));
|
|
|
+ return prefix + "/bill";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转金额||积分消费账单
|
|
|
+ */
|
|
|
+ @GetMapping("/getKefuInfo")
|
|
|
+ public String getKefuInfo(ModelMap mmap)
|
|
|
+ {
|
|
|
+ mmap.put("kefu",wxService.getKefuInfo());
|
|
|
+ return prefix + "/kefu";
|
|
|
+ }
|
|
|
+
|
|
|
}
|