Merge remote-tracking branch 'origin/dev' into hph
# Conflicts: # src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java
This commit is contained in:
@@ -75,6 +75,19 @@ public class LoginContoller {
|
||||
return loginService.wxBusinessLogin(openid,shopId);
|
||||
}
|
||||
|
||||
@GetMapping("/wx/business/openId")
|
||||
public Result getOpenId(
|
||||
@RequestParam String code
|
||||
) {
|
||||
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
|
||||
String openid = SessionKeyOpenId.getString("openid");
|
||||
if(Objects.isNull(openid)){
|
||||
return Result.fail("获取微信id失败");
|
||||
}
|
||||
|
||||
return Result.successWithData(openid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
*
|
||||
|
||||
@@ -147,6 +147,25 @@ public class NotifyController {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 点歌支付回调
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("songOrderCallBack")
|
||||
public String songOrderCallBack(HttpServletRequest request) {
|
||||
Map<String, Object> map = getParameterMap(request);
|
||||
log.info("点歌支付回调返回信息:{}", JSONUtil.toJsonStr(map));
|
||||
if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "000000".equals(map.get("code") + "")) {
|
||||
JSONObject object = JSONUtil.parseObj(map.get("bizData"));
|
||||
if (ObjectUtil.isNotEmpty(object) && object.containsKey("state") && "TRADE_SUCCESS".equals(object.getStr("state"))) {
|
||||
String orderNo = object.getStr("mchOrderNo");
|
||||
return payService.songOrderSuccess(orderNo, DateUtils.getTime(new Date()));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private Map getParameterMap(HttpServletRequest request) {
|
||||
RequestWrapper requestWrapper = new RequestWrapper(request);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopSongService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -24,8 +23,9 @@ public class ShopSongController {
|
||||
|
||||
/**
|
||||
* 获取所有歌曲,支持搜索及分页
|
||||
* @param page 页数
|
||||
* @param size 数量
|
||||
*
|
||||
* @param page 页数
|
||||
* @param size 数量
|
||||
* @param keyWord 搜索关键字
|
||||
* @return data
|
||||
*/
|
||||
@@ -42,20 +42,22 @@ public class ShopSongController {
|
||||
|
||||
@GetMapping("/detail")
|
||||
public Result getRecord(
|
||||
@RequestHeader("openId") String openId,
|
||||
@RequestParam Integer id
|
||||
) {
|
||||
return Result.successWithData(shopSongService.getDetail(TokenUtil.getUserId(), id));
|
||||
return Result.successWithData(shopSongService.getDetail(openId, id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/record")
|
||||
public Result getRecord(
|
||||
@RequestHeader("openId") String openId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) Integer state,
|
||||
@RequestParam(defaultValue = "true") boolean isDesc
|
||||
) {
|
||||
return Result.successWithData(shopSongService.getRecord(TokenUtil.getUserId(), page, size, state, isDesc));
|
||||
return Result.successWithData(shopSongService.getRecord(openId, page, size, state, isDesc));
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +66,6 @@ public class ShopSongController {
|
||||
@RequestHeader("openId") String openId,
|
||||
@RequestBody SongOrderDTO songOrderDTO
|
||||
) {
|
||||
return Result.successWithData(shopSongService.createOrder(TokenUtil.getUserId(), songOrderDTO, openId));
|
||||
return Result.successWithData(shopSongService.createOrder(songOrderDTO, openId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user