zbb378@sohu.com
2024-11-04 b2bad51be3c8d3e78d7f81a19415faeac2d0297c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.nova.sankuai.controller.v2;
 
import com.fasterxml.jackson.core.JsonProcessingException;
import com.nova.sankuai.domain.api.weiyaquanyi.WeiYaRespVO;
import com.nova.sankuai.domain.vo.MemberRightAutoLoginVo;
import com.nova.sankuai.infra.utils.ResultJson;
import com.nova.sankuai.infra.utils.UserUtil;
import com.nova.sankuai.security.UserDetail;
import com.nova.sankuai.service.IMemberRightService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 * @Description 会员权益Controller
 * @Author CWR
 * @Date 2022/4/4 16:02
 */
@Api(tags = "会员权益")
@RestController
@RequestMapping(value = "/api/v2/memberRight")
@AllArgsConstructor
@Slf4j
public class MemberRightController {
    private final IMemberRightService memberRightService;
 
 
    /**
     * 联登接口(AES加密请求参数并返回)
     *
     * @return
     */
    @PostMapping("/autoLogin")
    @ApiOperation(value = "联登接口")
    public ResultJson autoLogin(@RequestBody MemberRightAutoLoginVo vo) throws JsonProcessingException {
        return ResultJson.ok(this.memberRightService.autoLogin(vo));
    }
 
 
    /**
     * 通知纬雅做会员与权益绑定
     *
     * @param userId
     * @param channelMemberId
     * @return
     */
    @GetMapping("/channelMemberNotify")
    @ApiOperation(value = "通知纬雅做会员与权益绑定")
    public ResultJson channelMemberNotify(@RequestParam String userId,
                                          @RequestParam String channelMemberId) {
        // 渠道商用户开通会员卡回调
        WeiYaRespVO vo = this.memberRightService.channelMemberNotify(userId, channelMemberId);
        return ResultJson.ok(vo);
    }
 
 
    @GetMapping("/getChannelMemberId")
    @ApiOperation(value = "获取会员卡ID")
    public ResultJson getChannelMemberId(HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        UserDetail user = UserUtil.getUser(token);
        String channelMemberId = this.memberRightService.getChannelMemberId(user);
        return ResultJson.ok(channelMemberId);
    }
 
    @ApiOperation(value = "会员权益对接")
    @GetMapping("/tongBaoMembershipInterests")
    public ResultJson tongBaoMembershipInterests(@RequestParam String phone){
        String result = this.memberRightService.membershipInterests(phone);
        return ResultJson.ok(result);
    }
}