Why does the deletion of the channel not work when the EasyGBS of the GB28181 protocol video platform is cascaded upwards?

The cascading function of EasyGBS, the national standard GB28181 video platform, has been well received by many users. You can read " How EasyGBS Realizes Upward Cascading of Video Streams " to learn about the cascading process of EasyGBS.

GBS product architecture 3 plane definition.png

A few days ago, our R&D staff tested the function of selecting channels under EasyGBS cascade, and found that after adding a channel into the test, and then deleting the channel, the channel was not deleted and the delete function was invalid.

332.png

So we started to investigate the code. The workflow of the front-end code is to add the channel first, and then delete the channel:

333.png

When the operation type opt is add, the id is passed to the backend when the empty array []

if opt == "add" {
		if len(ids) > 0 {
			for i, v := range ids {
				ids := strings.Split(v, ",")
				if len(ids) != 2 {
					break
				}
				if i == 0 {
					sql = fmt.Sprintf(`(id = '%s' and device_id = '%s')`, ids[0], ids[1])
				} else {
					sql = fmt.Sprintf(` %s or (id = '%s' and device_id = '%s')`, sql, ids[0], ids[1])
				}
			}
			var channels []models.Channel

Here, when the array is empty, all cascaded records will be queried by default and all cascaded channels will be added in, so the illusion that the function of deleting the channel is invalid is caused on the display.

The problem is still solved from the front end. The judgment of adding the length of the id array is len(ids)> 0. If the front end does not pass the array that needs to be added, then there is no need to add it.

334.png

EasyGBS can not only cascade with the national standard platforms of major surveillance manufacturers, but also with the EasyNVR video platform. We have written a few blog posts before to introduce you to everyone. You can review: " How to register and cancel EasyNVR to EasyGBS the "," EasyGBS EasyNVR how to achieve access to the video channel . "

If any friends still have questions about this, please contact us to discuss. All video-related solutions can visit TSINGSEE Qingxi Video , you can contact us to get a demonstration program, intuitive experience, or you can download and test by yourself .

Guess you like

Origin blog.csdn.net/EasyGBS/article/details/108594552