This commit is contained in:
PC-20230316NUNE\Administrator 2024-01-09 12:00:32 +08:00
parent b2a5a6c491
commit 61767ea93f

View File

@ -169,15 +169,25 @@ public class GPlayerEquipController {
@PostMapping("/wear/{petId}/{equipId}")
public NewsContext<PetEquip> wear(@CurrentPlayer Player player, @PathVariable Integer petId, @PathVariable Integer equipId){
//获取装备信息
PetEquip info = petEquipService.getById(equipId);
if(Objects.isNull(info)) NewsContext.onFail("背包里没有这个装备");
if(!Objects.equals(info.getEquipPlayerId(), player.getPlayerId())) NewsContext.onFail("这个装备不是你的");
//脱掉之前的部位装备
petEquipService.update(Wrappers.lambdaQuery(PetEquip.class)
.eq(PetEquip::getEquipPlayerId,player.getPlayerId())
.eq(PetEquip::getEquipPetId,petId)
.eq(PetEquip::getEquipPosition,info.getEquipPosition())
);
// PetEquip before = new PetEquip();
// //脱掉之前的部位装备
// PetEquip info = new PetEquip();
// info.setEquipPlayerId(player.getPlayerId());
// info.setEquipPetId(petId);
// petEquipService.update(Wrappers.lambdaQuery(PetEquip.class).eq(
// PetEquip::getEquipPlayerId,player.getPlayerId(),
// PetEquip::getEquipPetId,petId,
// PetEquip::getEquipPetId,petId,
// );
//
// if(Objects.isNull(info)){
// return NewsContext.onFail("没有找到锻造台");