fix: issues

This commit is contained in:
Rogee
2024-12-15 01:48:25 +08:00
parent 5da2894283
commit 77a3bd6af8
3 changed files with 13 additions and 11 deletions

BIN
backend/__debug_bin1556003867 Executable file

Binary file not shown.

View File

@@ -119,12 +119,13 @@ func (svc *Service) List(ctx context.Context, tenantId, userId int64, filter *Li
} }
if filter.Bought != nil && *filter.Bought { if filter.Bought != nil && *filter.Bought {
if len(boughtIDs) > 0 { if len(boughtIDs) == 0 {
cond = cond. return []*ListItem{}, nil
AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression {
return Int(item)
})...))
} }
cond = cond.
AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression {
return Int(item)
})...))
} else { } else {
cond = cond.AND(tbl.Publish.EQ(Bool(true))) cond = cond.AND(tbl.Publish.EQ(Bool(true)))
} }

View File

@@ -3,8 +3,8 @@
<van-back-top bottom="80" /> <van-back-top bottom="80" />
<van-list style="padding-bottom: 3em" v-model:loading="loading" :finished="finished" finished-text="没有更多了" <van-list style="padding-bottom: 3em" v-model:loading="loading" :finished="finished"
offset="100" @load="loadData"> :finished-text="bought ? '您还没有购买' : '没有更多了'" offset="100" @load="loadData">
<list-item-card v-for="item in items" :key="item" :item="item" :bought="bought" /> <list-item-card v-for="item in items" :key="item" :item="item" :bought="bought" />
</van-list> </van-list>
</template> </template>
@@ -55,16 +55,17 @@ export default defineComponent({
return; return;
} }
if (res.data.length < pageLimit.value) {
finished.value = true;
}
if (offset.value == "") { if (offset.value == "") {
items.value = res.data; items.value = res.data;
} else { } else {
items.value = items.value.concat(res.data); items.value = items.value.concat(res.data);
} }
offset.value = res.data[res.data.length - 1].hash; offset.value = res.data[res.data.length - 1]?.hash;
if (res.data.length < pageLimit.value) {
finished.value = true;
}
}) })
.catch((err) => { .catch((err) => {
console.error("ERROR", err); console.error("ERROR", err);