fix: issues
This commit is contained in:
BIN
backend/__debug_bin1556003867
Executable file
BIN
backend/__debug_bin1556003867
Executable file
Binary file not shown.
@@ -119,12 +119,13 @@ func (svc *Service) List(ctx context.Context, tenantId, userId int64, filter *Li
|
||||
}
|
||||
|
||||
if filter.Bought != nil && *filter.Bought {
|
||||
if len(boughtIDs) > 0 {
|
||||
cond = cond.
|
||||
AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression {
|
||||
return Int(item)
|
||||
})...))
|
||||
if len(boughtIDs) == 0 {
|
||||
return []*ListItem{}, nil
|
||||
}
|
||||
cond = cond.
|
||||
AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression {
|
||||
return Int(item)
|
||||
})...))
|
||||
} else {
|
||||
cond = cond.AND(tbl.Publish.EQ(Bool(true)))
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
<van-back-top bottom="80" />
|
||||
|
||||
<van-list style="padding-bottom: 3em" v-model:loading="loading" :finished="finished" finished-text="没有更多了"
|
||||
offset="100" @load="loadData">
|
||||
<van-list style="padding-bottom: 3em" v-model:loading="loading" :finished="finished"
|
||||
:finished-text="bought ? '您还没有购买' : '没有更多了'" offset="100" @load="loadData">
|
||||
<list-item-card v-for="item in items" :key="item" :item="item" :bought="bought" />
|
||||
</van-list>
|
||||
</template>
|
||||
@@ -55,16 +55,17 @@ export default defineComponent({
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.data.length < pageLimit.value) {
|
||||
finished.value = true;
|
||||
}
|
||||
|
||||
if (offset.value == "") {
|
||||
items.value = res.data;
|
||||
} else {
|
||||
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) => {
|
||||
console.error("ERROR", err);
|
||||
|
||||
Reference in New Issue
Block a user