|
|
|
|
@ -106,3 +106,38 @@ func UpdateDeviceStatusV2(c *gin.Context) {
|
|
|
|
|
rsp.Data = dv
|
|
|
|
|
c.JSON(http.StatusOK, rsp)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @Tags 设备相关 /api/device/v2/
|
|
|
|
|
// @Summary 查询设备
|
|
|
|
|
// @Description 根据udid查询设备
|
|
|
|
|
// @accept x-www-form-urlencoded
|
|
|
|
|
// @Param udid query string true "设备udid"
|
|
|
|
|
// @Success 200 {object} models.Response "返回设备信息"
|
|
|
|
|
// @Router /api/device/v2/get_device [get]
|
|
|
|
|
func GetDeviceByUdidV2(c *gin.Context) {
|
|
|
|
|
rsp := controllers.NewResponse()
|
|
|
|
|
|
|
|
|
|
udid := c.DefaultQuery("udid", "")
|
|
|
|
|
if udid == "" {
|
|
|
|
|
c.JSON(http.StatusOK, rsp.Error("udid error"))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
db, err := dbsql.GetConn(dbsql.DSN_qaoms())
|
|
|
|
|
if err != nil {
|
|
|
|
|
c.JSON(http.StatusOK, rsp.Error(err.Error()))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
defer dbsql.Close(db)
|
|
|
|
|
|
|
|
|
|
var dv models.DeviceV2
|
|
|
|
|
|
|
|
|
|
db.Model(models.DeviceV2{}).Where("udid = ?", udid).Last(&dv)
|
|
|
|
|
|
|
|
|
|
if dv.ID < 1 {
|
|
|
|
|
c.JSON(http.StatusOK, rsp.Error("没有找到该设备,udid-"+udid))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rsp.Data = dv
|
|
|
|
|
c.JSON(http.StatusOK, rsp.Success())
|
|
|
|
|
}
|
|
|
|
|
|