INIT
This commit is contained in:
parent
d9a1837f3b
commit
ebd2f05ae2
69 changed files with 2335 additions and 451 deletions
37
backend.old/priority.go
Normal file
37
backend.old/priority.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// ///////// Priority
|
||||
func (w *Webapp) GetPriority(c *gin.Context) {
|
||||
log.Printf("send priority %s", w.Stream.StatusPriority)
|
||||
|
||||
c.JSON(http.StatusOK, w.Stream.StatusPriority)
|
||||
}
|
||||
|
||||
func (w *Webapp) SetPriority(c *gin.Context) {
|
||||
var msg Message
|
||||
var err error
|
||||
|
||||
log.Printf("set priority %s", c.Request.Body)
|
||||
|
||||
err = c.ShouldBind(&msg)
|
||||
if err != nil {
|
||||
log.Printf("req error: %+v", err)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, "OK")
|
||||
|
||||
log.Printf("msg %+v", msg)
|
||||
|
||||
w.Stream.StatusPriority = msg.Priority
|
||||
|
||||
w.Stream.SendPriority(msg.Priority)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue