Commit d1881a4b authored by tangtuo's avatar tangtuo

新增查询发行中的nft的接口

parent a628a19d
......@@ -183,6 +183,14 @@ public interface NftService extends IService<Nft> {
*/
void delete(Integer id);
/**
* 获取当前用户正在发行中的nft列表
* @return
*/
List<Nft> getPublishingList();
// void republish();
}
......@@ -258,6 +258,17 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
this.removeById(id);
}
@Override
public List<Nft> getPublishingList() {
String token = request.getHeader("Authorization");
Integer userId = JwtUtil.getUserIdFromToken(token);
QueryWrapper<Nft> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId).
eq("publish_status", PublishStatus.PUBLISHING.getCode()).
orderByDesc("publish_time");
return this.list(queryWrapper);
}
// @Override
// public void republish() {
// List<Nft> nfts = nftMapper.get();
......
......@@ -195,4 +195,9 @@ public class NftController {
return ResponseModel.success(nftService.getById(id));
}
@GetMapping("/publishing-list")
@ApiOperation(value = "获取当前用户正在发行中的nft列表")
public ResponseModel<List<Nft>> getPublishingList() {
return ResponseModel.success(nftService.getPublishingList());
}
}
package com.fzm.portal.listener;
import com.fzm.common.entity.Nft;
import com.fzm.common.entity.dto.OrderProcessMsg;
import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.PayScene;
import com.fzm.common.enums.PublishStatus;
import com.fzm.common.enums.RefundLaunchChannel;
import com.fzm.common.service.CopyrightApplyService;
import com.fzm.common.service.NftService;
......@@ -45,6 +47,13 @@ public class OrderListener {
} catch (Exception e) {
// 处理失败,需要主动发起退款
wxPayService.refund(msg.getOrderId(), RefundLaunchChannel.USER.getCode());
// nft发行时发生异常,则需要把nft的状态改成发行失败
if (msg.getPayScene().equals(PayScene.NFT.getCode())) {
Nft nft = new Nft();
nft.setId(msg.getProductId());
nft.setPublishStatus(PublishStatus.FAILED.getCode());
nftService.updateById(nft);
}
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment