|
@@ -0,0 +1,98 @@
|
|
|
+package com.dgtly.member.controller;
|
|
|
+
|
|
|
+import com.dgtly.apiframework.util.TokenUtil;
|
|
|
+import com.dgtly.common.annotation.ApiNoCheckSign;
|
|
|
+import com.dgtly.common.annotation.ApiPassToken;
|
|
|
+import com.dgtly.common.core.controller.ApiBaseController;
|
|
|
+import com.dgtly.common.core.domain.AjaxResult;
|
|
|
+import com.dgtly.common.core.domain.ParameterObject;
|
|
|
+import com.dgtly.common.utils.DateUtils;
|
|
|
+import com.dgtly.common.utils.StringUtils;
|
|
|
+import com.dgtly.member.domain.MemberFollow;
|
|
|
+import com.dgtly.member.service.IMemberFollowService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @descption: 会员关注商户相关API接口
|
|
|
+ * @author LiuLingChao
|
|
|
+ * @version 1.0
|
|
|
+ * @company 神州数码通用软件(洛阳)有限公司
|
|
|
+ * @copyright (c) 2019 LuoYang DGT Co'Ltd Inc. All rights reserved.
|
|
|
+ * @date 2020-2-27 15:10
|
|
|
+ * @since JDK1.8
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/member/follow")
|
|
|
+@ApiPassToken/* 不用验证token 方法上可用*/
|
|
|
+@ApiNoCheckSign/* 不用验证 签名 方法上可用*/
|
|
|
+public class MemberFollowApi extends ApiBaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMemberFollowService iMemberFollowService;
|
|
|
+ /**
|
|
|
+ * @descption: 网站会员关注添加
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @auther: LiuLingChao
|
|
|
+ * @date: 2020-2-27 15:11
|
|
|
+ */
|
|
|
+ @PostMapping("/addMemberFollow")
|
|
|
+ public Object addMemberFollow(){
|
|
|
+ //获取token中用户id
|
|
|
+ String userId = TokenUtil.getTokenUserId();
|
|
|
+ if(StringUtils.isNotEmpty(userId)){
|
|
|
+ ParameterObject obj = getParameterObject();
|
|
|
+ MemberFollow memberFollow = obj.parseBean(MemberFollow.class);
|
|
|
+ memberFollow.setMemberId(Long.parseLong(userId));
|
|
|
+ memberFollow.setFollowDate(DateUtils.getNowDate());
|
|
|
+ int flag = iMemberFollowService.insertMemberFollow(memberFollow);
|
|
|
+ return toAjax(flag);
|
|
|
+ }else{
|
|
|
+ return AjaxResult.error(301,"获取token出错");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @descption: 网站用户取消关注
|
|
|
+ * @param: 关注id
|
|
|
+ * @return:
|
|
|
+ * @auther: LiuLingChao
|
|
|
+ * @date: 2020-2-27 15:35
|
|
|
+ */
|
|
|
+ @PostMapping("/cancleMemberFollow")
|
|
|
+ public Object cancleMemberFollow(){
|
|
|
+ ParameterObject obj = getParameterObject();
|
|
|
+ MemberFollow memberFollow = obj.parseBean(MemberFollow.class);
|
|
|
+ int flag = iMemberFollowService.deleteMemberFollowById(memberFollow.getId());
|
|
|
+ return toAjax(flag);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @descption: 获取网站会员关注的商户列表
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @auther: LiuLingChao
|
|
|
+ * @date: 2020-2-27 15:57
|
|
|
+ */
|
|
|
+ @PostMapping("/getMemberFollowList")
|
|
|
+ public Object getMemberFollowList(){
|
|
|
+ String userId = TokenUtil.getTokenUserId();
|
|
|
+ if(StringUtils.isNotEmpty(userId)){
|
|
|
+ ParameterObject obj = getParameterObject();
|
|
|
+ startPage(obj);
|
|
|
+ MemberFollow memberFollow = new MemberFollow();
|
|
|
+ memberFollow.setMemberId(Long.parseLong(userId));
|
|
|
+
|
|
|
+ List<MemberFollow> memberFollowList = iMemberFollowService.getMemberFollowList(memberFollow);
|
|
|
+ return AjaxResult.success(getDataTable(memberFollowList));
|
|
|
+ }else{
|
|
|
+ return AjaxResult.error(301,"获取token出错");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|