fix(fe+be): 我的页去重宠物墙 + 养宠天数按到家日算

- 养宠天数原来按建档日算,重新建档会被重置成 1(和首页「第869天」矛盾);
  改成按最早那只的到家日算(无到家日退建档日),和首页口径一致
- 「我的」页 profile-head 传 hideWall,藏掉社交宠物墙(下面「我的毛孩子」
  卡更详细,重复了);宠物墙只在别人访问/预览时出现,受「展示我的毛孩子」
  开关控制,语义更对(那开关本来就是给别人看的)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-31 15:11:59 +08:00
parent 4a1b5e66d3
commit 4c9fbc4a88
4 changed files with 19 additions and 6 deletions
+13 -3
View File
@@ -123,9 +123,19 @@ func (s *Service) keepStats(userID string, withPets bool) (*KeepStats, []PetCard
cards = nil cards = nil
} }
// 养宠天数按最早那只的建档日算。用建档日而不是生日:这里要表达的是 // 养宠天数按最早那只的到家日算(没填到家日就退回建档日),和首页
// 「你在这个 App 上照顾它多久了」,不是宠物活了多久 // 「一起生活的第 N 天」口径一致。用建档日会因为重新建档而被重置成 1,很怪
st.Days = int(time.Since(pets[0].CreatedAt).Hours()/24) + 1 earliest := time.Now()
for _, p := range pets {
start := p.CreatedAt
if p.ArrivedAt != nil && !p.ArrivedAt.IsZero() {
start = *p.ArrivedAt
}
if start.Before(earliest) {
earliest = start
}
}
st.Days = int(time.Since(earliest).Hours()/24) + 1
var total int64 var total int64
s.db.Model(&model.HealthRecord{}).Where("pet_id IN ?", ids).Count(&total) s.db.Model(&model.HealthRecord{}).Where("pet_id IN ?", ids).Count(&total)
+1
View File
@@ -7,6 +7,7 @@ Component({
card: { type: Object, value: null }, card: { type: Object, value: null },
// 装扮页的实时预览:只看效果,不要底部那排按钮 // 装扮页的实时预览:只看效果,不要底部那排按钮
preview: { type: Boolean, value: false }, preview: { type: Boolean, value: false },
hideWall: { type: Boolean, value: false }, // 「我的」页藏掉社交宠物墙,避免和「我的毛孩子」卡重复
}, },
data: { initial: '', theme: 'warm' }, data: { initial: '', theme: 'warm' },
observers: { observers: {
+4 -2
View File
@@ -29,8 +29,10 @@
<view class="pf-keep-i"><text class="pf-kn">{{card.stats.streak || 0}}</text><text class="pf-kl">连续打卡</text></view> <view class="pf-keep-i"><text class="pf-kn">{{card.stats.streak || 0}}</text><text class="pf-kl">连续打卡</text></view>
</view> </view>
<!-- 宠物名片墙。可以在装扮里关掉 --> <!-- 宠物名片墙:给别人看的(受「展示我的毛孩子」开关控制)。「我的」页传
<scroll-view wx:if="{{card.show_pets && card.pets.length}}" class="pf-wall" hideWall 把它藏掉(下面有更详细的「我的毛孩子」卡,避免重复),
别人访问 / 预览时照常显示 -->
<scroll-view wx:if="{{card.show_pets && card.pets.length && !hideWall}}" class="pf-wall"
scroll-x="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}"> scroll-x="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
<view wx:for="{{card.pets}}" wx:key="id" class="pf-pet" data-id="{{item.id}}" bindtap="onPet"> <view wx:for="{{card.pets}}" wx:key="id" class="pf-pet" data-id="{{item.id}}" bindtap="onPet">
<view class="pf-pet-av"> <view class="pf-pet-av">
+1 -1
View File
@@ -3,7 +3,7 @@
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}"> <scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
<view class="page-body tab-nofab"> <view class="page-body tab-nofab">
<!-- 和「宠友主页」同一个组件。自己看到的就是别人看到的,装扮才有意义 --> <!-- 和「宠友主页」同一个组件。自己看到的就是别人看到的,装扮才有意义 -->
<profile-head card="{{card}}" bind:relations="goRelations" <profile-head card="{{card}}" hide-wall="{{true}}" bind:relations="goRelations"
bind:decorate="goDecorate" bind:pet="onPickPet"></profile-head> bind:decorate="goDecorate" bind:pet="onPickPet"></profile-head>
<view class="btn btn-ghost btn-block me-preview" bindtap="previewPublic"> <view class="btn btn-ghost btn-block me-preview" bindtap="previewPublic">