|
@@ -24,7 +24,7 @@ func (gs *GatewayService) CreateIfNotExist(isn string) (*app.Gateway, error) {
|
|
|
if gate != nil {
|
|
|
return gate, ExistError
|
|
|
}
|
|
|
- var gateway = &app.Gateway{Isn: isn}
|
|
|
+ var gateway = &app.Gateway{Isn: isn, State: 1}
|
|
|
err = global.Db.Create(gateway).Debug().Error
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
@@ -39,7 +39,10 @@ func (gs *GatewayService) List(req request.GatewayRequest) (list []response.Gate
|
|
|
// c.`name` AS camera_name, RIGHT(c.sn,9) AS sn,stream_id,stream_url,
|
|
|
// l.device_id AS ls_id,l.`status` AS ls_status
|
|
|
//FROM gateway g LEFT JOIN camera c ON g.id = c.gid LEFT JOIN loudspeaker l ON g.id = l.gid ;
|
|
|
- db := global.Db.Select("g.id,g.gateway_name,g.osn,g.description,c.name AS camera_name, RIGHT(c.sn,9) AS camera_sn,c.stream_id,c.stream_url,i.device_id AS ipcast_id,i.state AS ipcast_state").
|
|
|
+ db := global.Db.Select("g.id,g.gateway_name,g.isn,g.osn,g.state AS gateway_state,g.description," +
|
|
|
+ "c.name AS camera_name, RIGHT(c.sn,9) AS camera_sn,c.stream_id,c.stream_url,c.state AS camera_state," +
|
|
|
+ //"i.device_id AS ipcast_id," +
|
|
|
+ "i.state AS ipcast_state").
|
|
|
Table("gateway g LEFT JOIN camera c ON g.id = c.gid LEFT JOIN ipcast i ON g.id = i.gid").
|
|
|
Where("g.is_deleted = 0")
|
|
|
//条件查询设备,网关名,网关osn,摄像头sn,ip音柱devid,
|