初始
This commit is contained in:
		
							
								
								
									
										57
									
								
								api/video_hat/photomange10/get_pictures.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								api/video_hat/photomange10/get_pictures.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,57 @@ | ||||
| package photomange10 | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"encoding/json" | ||||
| 	"github.com/gogf/gf/v2/frame/g" | ||||
| 	"github.com/gogf/gf/v2/util/gconv" | ||||
| 	"github.com/tiger1103/gfast/v3/api/constant" | ||||
| 	"io" | ||||
| 	"net/http" | ||||
| 	"net/url" | ||||
| ) | ||||
|  | ||||
| // 获取照片 | ||||
| type GetPicturesReq struct { | ||||
| 	g.Meta  `path:"/getpictures" method:"post" tags:"视频安全帽相关" summary:"获取照片"` | ||||
| 	DevNum  string `json:"devNum" dc:"设备号"` | ||||
| 	Date    string `json:"date" dc:"格式 yyyy-mm-dd(不是必填参数)"` | ||||
| 	PageNum string `json:"pageNum" dc:"当前页数"` | ||||
| } | ||||
|  | ||||
| // 获取照片相应 | ||||
| type GetPicturesRes struct { | ||||
| 	ResponseData ResponseData `json:"responseData"` | ||||
| } | ||||
|  | ||||
| func (v Pictures) GetPictures(ctx context.Context, req *GetPicturesReq) (res *GetPicturesRes, err error) { | ||||
| 	var userId string | ||||
| 	id, _ := g.Model("device_video_hat").Fields("uid AS userId").Where("dev_num", req.DevNum).Value() | ||||
| 	userId = gconv.String(id) | ||||
| 	res = new(GetPicturesRes) | ||||
| 	data := url.Values{} | ||||
| 	data.Set("user_id", userId) | ||||
| 	if req.Date != "" { | ||||
| 		data.Set("date", req.Date) | ||||
| 	} | ||||
| 	data.Set("p", req.PageNum) | ||||
| 	data.Set("token", constant.Token) | ||||
|  | ||||
| 	resp, err := http.PostForm("https://caps.runde.pro/api/index.php?ctl=report&act=get_user_image", data) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer resp.Body.Close() | ||||
|  | ||||
| 	respBody, err := io.ReadAll(resp.Body) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	err = json.Unmarshal(respBody, &res.ResponseData) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return res, nil | ||||
| } | ||||
							
								
								
									
										4
									
								
								api/video_hat/photomange10/pictures.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								api/video_hat/photomange10/pictures.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| package photomange10 | ||||
|  | ||||
| type Pictures struct { | ||||
| } | ||||
							
								
								
									
										23
									
								
								api/video_hat/photomange10/pictures_model.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								api/video_hat/photomange10/pictures_model.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| package photomange10 | ||||
|  | ||||
| // 获取照片 | ||||
| type ResponseData struct { | ||||
| 	Status  bool        `json:"status"` | ||||
| 	Message string      `json:"msg"` | ||||
| 	Data    []ImageInfo `json:"data"` | ||||
| 	MsgCode string      `json:"msg_code"` | ||||
| } | ||||
|  | ||||
| type ImageInfo struct { | ||||
| 	ID          string `json:"i_id"` | ||||
| 	UserID      string `json:"user_id" dc:""` | ||||
| 	ImageURL    string `json:"image_url"` | ||||
| 	XCoordinate string `json:"x_point"` // 将经纬度转换为浮点数类型 | ||||
| 	YCoordinate string `json:"y_point"` | ||||
| 	Timestamp   string `json:"time" ` // 需要使用time.Unix()反序列化时间戳 | ||||
| 	Extra       string `json:"extra"` | ||||
| 	TaskID      string `json:"task_id"` | ||||
| 	Content     string `json:"content"` | ||||
| 	FaceName    string `json:"face_name"` | ||||
| 	Temperature string `json:"temperature"` // 温度可能是字符串类型,如果需要转为数值类型请相应调整 | ||||
| } | ||||
		Reference in New Issue
	
	Block a user