package petsLy import ( "duoduo/models/mysqlLy" "duoduo/models/petsLy" "duoduo/tools" "duoduo/tools/app" "fmt" "github.com/gin-gonic/gin" ) func PetsDetails(c *gin.Context) { var inData petsLy.PetsDetailsRequest var pets mysqlLy.Pets var outData petsLy.PetsDetailsResponse var user mysqlLy.User err := c.ShouldBindJSON(&inData) if err != nil { app.Error(c, 400, err, err.Error()) return } pets.ID = inData.PetsId petsInfo, err := pets.Get() if err != nil { app.Error(c, 500, err, "查询数据失败") return } user.OpenID = petsInfo.OpenId userInfo,err := user.Get() if err != nil{ app.Error(c,500,err,"获取用户信息失败") return } if petsInfo.Status == 2{ userInfo.Phone = "***********" userInfo.WxCode = "***********" } outData.PetsInfo = petsInfo outData.Phone = userInfo.Phone outData.WxCode = userInfo.WxCode outData.DepositDate = outData.PetsInfo.DepositDate.Format("2006-01-02") err = tools.JsonUnmarshal(outData.PetsInfo.Pictures,&outData.Pictures) if err != nil{ fmt.Println(err.Error()) app.Error(c,500,err,"解析图片失败") return } app.OK(c, outData, app.Success) }