翻页
This commit is contained in:
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -16,6 +17,20 @@ func (ids IDS) ToString() (str string) {
|
||||
|
||||
type ImageList []Image
|
||||
|
||||
// 按照ID排序
|
||||
func (image *ImageList) SortByIDList(id_list []string) {
|
||||
var sortedImageList ImageList
|
||||
for _, id := range id_list {
|
||||
id_number, _ := strconv.Atoi(id)
|
||||
for _, image := range *image {
|
||||
if image.ID == id_number {
|
||||
sortedImageList = append(sortedImageList, image)
|
||||
}
|
||||
}
|
||||
}
|
||||
*image = sortedImageList
|
||||
}
|
||||
|
||||
// 取到所有的文章ID, 去除重复
|
||||
func (images *ImageList) ToAllArticleID() (uniqueIds IDS) {
|
||||
article_ids := make(map[int]bool)
|
||||
|
Reference in New Issue
Block a user