|
@@ -5,6 +5,7 @@ import (
|
|
|
"duoduo/models/petsLy"
|
|
|
"duoduo/tools"
|
|
|
"duoduo/tools/app"
|
|
|
+ "fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"strconv"
|
|
|
"time"
|
|
@@ -24,6 +25,8 @@ func PetsList(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ fmt.Println("indata = %+v", inData)
|
|
|
+
|
|
|
if inData.PageSize != 0 {
|
|
|
pageSize = inData.PageSize
|
|
|
}
|
|
@@ -32,6 +35,10 @@ func PetsList(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
pets.OpenId = inData.OpenId
|
|
|
+ pets.IsFee = inData.IsFee
|
|
|
+ pets.Status = inData.Status
|
|
|
+ pets.City = inData.City
|
|
|
+ pets.Pet = inData.Pet
|
|
|
petsList, petsCount, err := pets.GetPetsList(pageSize, pageIndex)
|
|
|
if err != nil {
|
|
|
app.Error(c, 500, err, "")
|
|
@@ -46,7 +53,7 @@ func PetsList(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
timeDiff := time.Now().Unix() - petsList[i].CreateTime.Unix()
|
|
|
- if timeDiff > 0 && timeDiff < 60 { //秒前
|
|
|
+ if timeDiff >= 0 && timeDiff < 60 { //秒前
|
|
|
pet.TimeDiff = strconv.FormatInt(timeDiff, 10)
|
|
|
pet.TimeDiff = pet.TimeDiff + "秒前"
|
|
|
} else if timeDiff >= 60 && timeDiff < 60*60 { //分钟前
|