diff --git a/Build_God_Api/Build_God_Api/Controllers/CharacterController.cs b/Build_God_Api/Build_God_Api/Controllers/CharacterController.cs
index 280f217..198af99 100644
--- a/Build_God_Api/Build_God_Api/Controllers/CharacterController.cs
+++ b/Build_God_Api/Build_God_Api/Controllers/CharacterController.cs
@@ -46,6 +46,20 @@ namespace Build_God_Api.Controllers
return await characterService.GetCharacterById(characterId);
}
+ ///
+ /// 获取角色详情(包含境界和灵根信息)
+ ///
+ [HttpGet("{characterId}/detail")]
+ [Authorize]
+ public async Task> GetCharacterDetail(int characterId)
+ {
+ var characters = await characterService.GetCharacterListWithDetails(currentUserService.UserId);
+ var character = characters.FirstOrDefault(c => c.Id == characterId);
+ if (character == null)
+ return NotFound("角色不存在");
+ return character;
+ }
+
[HttpPost("register")]
[Authorize]
public async Task> RegisterCharacter([FromBody] CharacterRegisterDto dto)
diff --git a/Build_God_Api/Build_God_Api/Services/BattleService.cs b/Build_God_Api/Build_God_Api/Services/BattleService.cs
index 7e7a776..858a496 100644
--- a/Build_God_Api/Build_God_Api/Services/BattleService.cs
+++ b/Build_God_Api/Build_God_Api/Services/BattleService.cs
@@ -241,6 +241,24 @@ namespace Build_God_Api.Services
}
}
}
+
+ // 检查任务是否全部完成
+ var allProgresses = await _db.Queryable()
+ .Where(cp => cp.CharacterId == characterId && cp.MissionId == dailyMission.MissionId)
+ .ToListAsync();
+
+ var missionConfigProgresses = await _db.Queryable()
+ .Where(p => p.MissionId == dailyMission.MissionId)
+ .ToListAsync();
+
+ bool allCompleted = missionConfigProgresses.All(p =>
+ allProgresses.Any(cp => cp.MissionProgressId == p.Id && cp.IsCompleted));
+
+ if (allCompleted)
+ {
+ dailyMission.Status = DailyMissionStatus.Completed;
+ await _db.Updateable(dailyMission).ExecuteCommandAsync();
+ }
}
}
}
diff --git a/Build_God_Game/src/api/character.ts b/Build_God_Game/src/api/character.ts
index dd1d06a..f41dc12 100644
--- a/Build_God_Game/src/api/character.ts
+++ b/Build_God_Game/src/api/character.ts
@@ -49,6 +49,9 @@ export const characterApi = {
getCharacterList: (): Promise => {
return http.get('/character/list')
},
+ getCharacterDetail: (characterId: number): Promise => {
+ return http.get(`/character/${characterId}/detail`)
+ },
createCharacter: (data: CreateCharacterRequest): Promise => {
return http.post('/character/register', data)
},
diff --git a/Build_God_Game/src/assets/images/bag.svg b/Build_God_Game/src/assets/images/bag.svg
index 24ca49d..6849739 100644
--- a/Build_God_Game/src/assets/images/bag.svg
+++ b/Build_God_Game/src/assets/images/bag.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Build_God_Game/src/assets/images/character.svg b/Build_God_Game/src/assets/images/character.svg
index f8c8b73..353e7e3 100644
--- a/Build_God_Game/src/assets/images/character.svg
+++ b/Build_God_Game/src/assets/images/character.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Build_God_Game/src/assets/images/meditation.svg b/Build_God_Game/src/assets/images/meditation.svg
index 2a067a7..eafca06 100644
--- a/Build_God_Game/src/assets/images/meditation.svg
+++ b/Build_God_Game/src/assets/images/meditation.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Build_God_Game/src/assets/images/mission.svg b/Build_God_Game/src/assets/images/mission.svg
index 5439787..85ae9ab 100644
--- a/Build_God_Game/src/assets/images/mission.svg
+++ b/Build_God_Game/src/assets/images/mission.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Build_God_Game/src/assets/images/monster.svg b/Build_God_Game/src/assets/images/monster.svg
index 907ca5d..d171647 100644
--- a/Build_God_Game/src/assets/images/monster.svg
+++ b/Build_God_Game/src/assets/images/monster.svg
@@ -1,11 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Build_God_Game/src/assets/images/shop.svg b/Build_God_Game/src/assets/images/shop.svg
index 24ca49d..bd9091c 100644
--- a/Build_God_Game/src/assets/images/shop.svg
+++ b/Build_God_Game/src/assets/images/shop.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Build_God_Game/src/stores/character.ts b/Build_God_Game/src/stores/character.ts
index f10e66c..4b5f19d 100644
--- a/Build_God_Game/src/stores/character.ts
+++ b/Build_God_Game/src/stores/character.ts
@@ -91,6 +91,24 @@ export const useCharacterStore = defineStore('character', () => {
}
}
+ const refreshCurrentCharacter = async (): Promise => {
+ if (!currentCharacter.value) return false
+ isLoading.value = true
+ try {
+ const updatedChar = await characterApi.getCharacterDetail(currentCharacter.value.id)
+ if (updatedChar) {
+ currentCharacter.value = updatedChar
+ localStorage.setItem('current_character', JSON.stringify(updatedChar))
+ }
+ return true
+ } catch (error) {
+ console.error('Failed to refresh character:', error)
+ return false
+ } finally {
+ isLoading.value = false
+ }
+ }
+
const clearCurrentCharacter = () => {
currentCharacter.value = null
localStorage.removeItem('current_character')
@@ -166,6 +184,7 @@ export const useCharacterStore = defineStore('character', () => {
deleteCharacter,
selectCharacter,
initCurrentCharacter,
+ refreshCurrentCharacter,
clearCurrentCharacter,
startTraining,
stopTraining,
diff --git a/Build_God_Game/src/views/GameView.vue b/Build_God_Game/src/views/GameView.vue
index 35a76f5..ff85aff 100644
--- a/Build_God_Game/src/views/GameView.vue
+++ b/Build_God_Game/src/views/GameView.vue
@@ -9,7 +9,7 @@ import GlareHover from '@/components/GlareHover/GlareHover.vue'
import ChatBox from '@/components/ChatBox.vue'
import ShinyText from '@/components/ShinyText/ShinyText.vue'
import StarBorder from '@/components/StarBorder/StarBorder.vue'
-import trainingIcon from '@/assets/images/training.svg'
+import meditationIcon from '@/assets/images/meditation.svg'
import missionIcon from '@/assets/images/mission.svg'
import scrapIcon from '@/assets/images/scrap.svg'
import characterIco from '@/assets/images/character.svg'
@@ -44,7 +44,7 @@ const showBreakthroughMessage = ref(false)
const menuItems = computed(() => [
{ label: '任务', icon: missionIcon, useImage: true },
{ label: '角色', icon: characterIco, useImage: true },
- { label: isTraining.value ? '打坐中' : '打坐', icon: trainingIcon, useImage: true, isTraining: isTraining.value },
+ { label: isTraining.value ? '打坐中' : '打坐', icon: meditationIcon, useImage: true, isTraining: isTraining.value },
{ label: '背包', icon: bagIcon, useImage: true },
{ label: '捡垃圾', icon: scrapIcon, useImage: true },
{ label: '商店', icon: shopIcon, useImage: true },
diff --git a/Build_God_Game/src/views/ShopView.vue b/Build_God_Game/src/views/ShopView.vue
index 07d7a13..be3d559 100644
--- a/Build_God_Game/src/views/ShopView.vue
+++ b/Build_God_Game/src/views/ShopView.vue
@@ -108,7 +108,7 @@ const goBack = () => {
}
onMounted(async () => {
- await characterStore.fetchCharacters()
+ await characterStore.refreshCurrentCharacter()
await fetchShop()
})