|
|
@ -1,16 +1,13 @@ |
|
|
|
package com.cweb.controller; |
|
|
|
package com.cweb.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.alipay.api.domain.Data; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.cweb.config.SysConst; |
|
|
|
|
|
|
|
import com.hai.common.pay.util.sdk.WXPayConstants; |
|
|
|
|
|
|
|
import com.hai.common.security.SessionObject; |
|
|
|
|
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
|
|
|
|
import com.hai.common.utils.MD5Util; |
|
|
|
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.WxUtils; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
|
|
|
|
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.service.HighUserService; |
|
|
|
import com.hai.service.HighUserService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
@ -23,10 +20,7 @@ import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
@ -40,33 +34,43 @@ public class tPigController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private UserCenter userCenter; |
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getTPigToken", method = RequestMethod.GET) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getTPigKFCToken", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "【小程序】KFC获取千猪Token") |
|
|
|
|
|
|
|
public ResponseData getH5AccessToken(@RequestParam(name = "userId", required = true) Long userId) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HighUser highUser = highUserService.findByUserId(userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject token = QianZhuConfig.getToken(highUser.getUnionId() , highUser.getName() , highUser.getPhone()); |
|
|
|
|
|
|
|
String url = ""; |
|
|
|
|
|
|
|
if (token.getBoolean("success")) { |
|
|
|
|
|
|
|
JSONObject data = token.getJSONObject("data"); |
|
|
|
|
|
|
|
url = "https://m.qianzhu8.com/kfc/?platformId=" + CommonSysConst.getSysConfig().getQinzhuPlatformId() + "&token=" + data.getString("accessToken"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(url); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getTPigCinemaToken", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "【小程序】获取千猪Token") |
|
|
|
@ApiOperation(value = "【小程序】电影票获取千猪Token") |
|
|
|
public ResponseData getH5AccessToken(HttpServletRequest request) { |
|
|
|
public ResponseData getTPigCinemaToken(@RequestParam(name = "userId", required = true) Long userId) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
HighUser highUser = highUserService.findByUserId(userId); |
|
|
|
|
|
|
|
|
|
|
|
// 用户
|
|
|
|
JSONObject token = QianZhuConfig.getToken(highUser.getUnionId() , highUser.getName() , highUser.getPhone()); |
|
|
|
// SessionObject sessionObject = userCenter.getSessionObject(request);
|
|
|
|
String url = ""; |
|
|
|
// HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
|
|
|
|
if (token.getBoolean("success")) { |
|
|
|
//
|
|
|
|
JSONObject data = token.getJSONObject("data"); |
|
|
|
// HighUser highUser = highUserService.findByUserId(userInfoModel.getHighUser().getId());
|
|
|
|
url = "https://m.qianzhu8.com/cinema/?platformId=" + CommonSysConst.getSysConfig().getQinzhuPlatformId() + "&token=" + data.getString("accessToken"); |
|
|
|
|
|
|
|
} |
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
|
|
|
|
|
// params.put("platformUniqueId", highUser.getUnionId());
|
|
|
|
|
|
|
|
// params.put("nickname", highUser.getName());
|
|
|
|
|
|
|
|
// params.put("mobile", highUser.getPhone());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
params.put("platformUniqueId", "oArhO6WlHsR2e5LuPUbxTcGo4nsQ"); |
|
|
|
|
|
|
|
params.put("nickname", "Sum1Dream"); |
|
|
|
|
|
|
|
params.put("platformId", "10376"); |
|
|
|
|
|
|
|
params.put("mobile", "18090580471"); |
|
|
|
|
|
|
|
// params.put("timestamp", String.valueOf(new Date().getTime()));
|
|
|
|
|
|
|
|
params.put("timestamp", "1624793550754"); |
|
|
|
|
|
|
|
String sign = WxUtils.generateSignaturePig(params, "ktxb49sh2jfhgn8g" , WXPayConstants.SignType.MD5); |
|
|
|
|
|
|
|
params.put("sign", sign); |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(HttpsUtils.doGet("https://live-test.qianzhu8.com/api/v2/platform/getToken", params , "")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(url); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|