提交代码

2.0-dev
胡锐 7 months ago
parent 1e8853383a
commit 70fce1b0c1
  1. 22
      hai-cweb/src/main/java/com/cweb/controller/tPigController.java

@ -2,13 +2,18 @@ package com.cweb.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig; import com.hai.config.QianZhuConfig;
import com.hai.entity.HighUser; import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighUserService; import com.hai.service.HighUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -56,15 +61,26 @@ public class tPigController {
@RequestMapping(value = "/getTPigCinemaToken", method = RequestMethod.GET) @RequestMapping(value = "/getTPigCinemaToken", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "【小程序】电影票获取千猪Token") @ApiOperation(value = "【小程序】电影票获取千猪Token")
public ResponseData getTPigCinemaToken(@RequestParam(name = "userId", required = true) Long userId) { public ResponseData queryCinemaUrl() {
try { try {
HighUser highUser = highUserService.findByUserId(userId); HighUserModel sessionModel = userCenter.getSessionModel(HighUserModel.class);
if (sessionModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
// 查询用户
HighUser user = sessionModel.getHighUser();
if (user == null || sessionModel.getHighUser() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
JSONObject token = QianZhuConfig.getToken(highUser.getId().toString() , highUser.getName() , highUser.getPhone()); // 获取token
JSONObject token = QianZhuConfig.getToken(""+user.getId() , user.getName() , user.getPhone());
String url = ""; String url = "";
if (token.getBoolean("success")) { if (token.getBoolean("success")) {
JSONObject data = token.getJSONObject("data"); JSONObject data = token.getJSONObject("data");
url = CommonSysConst.getSysConfig().getQinzhuHtmlUrl()+"/cinema/?platformId="+CommonSysConst.getSysConfig().getQinzhuPlatformId()+"&token="+data.getString("accessToken"); url = CommonSysConst.getSysConfig().getQinzhuHtmlUrl()+"/cinema/?platformId="+CommonSysConst.getSysConfig().getQinzhuPlatformId()+"&token="+data.getString("accessToken");
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取地址失败");
} }
return ResponseMsgUtil.success(url); return ResponseMsgUtil.success(url);
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save