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);
|
}
|
}
|