57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package uniss
|
|
|
|
import (
|
|
"dashboard/dao/dadis/unisd"
|
|
"dashboard/models"
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
type commonService struct {
|
|
comm *communicateService
|
|
}
|
|
|
|
func newcommonService(comm *communicateService) *commonService {
|
|
res := new(commonService)
|
|
|
|
res.comm = comm
|
|
|
|
res.comm.httpServerHandler.pushHandle(string(models.UNIS_HTTP_ID_CONFIG_ADD), res.stationConfig)
|
|
|
|
return res
|
|
}
|
|
|
|
func (c *commonService) stationConfig(reqest *models.UnisHttpRequest, respons *models.UnisHttpResponse) error {
|
|
req := reqest.Msg.(*models.StationConfigParams)
|
|
fmt.Println(req)
|
|
|
|
var addres []*rpcIdAddres
|
|
for _, sc := range req.StationConfig.Screens {
|
|
add := new(rpcIdAddres)
|
|
|
|
add.host = sc.NodeIP
|
|
add.id = sc.NodeID
|
|
|
|
addres = append(addres, add)
|
|
}
|
|
|
|
c.comm.rpcClientStub.flushRpcClients(addres)
|
|
|
|
fmt.Println(c.comm.rpcClientStub.getConfig(addres[0].id, models.UnisRpcRequest{Id: "zhangshuo"}))
|
|
|
|
// res := &models.UnisHttpResponse{
|
|
// Code: int(models.CodeSuccess),
|
|
// Msg: "config ok",
|
|
// }
|
|
respons.SetResParam(int(models.CodeSuccess), "config ok", nil)
|
|
|
|
unisd.UnisDataSet(unisd.DadisKey_UnisStationInfo.KeyWithChannel(0), req, 0)
|
|
|
|
c.comm.httpClientHandler.curl(&models.UnisHttpClientRequest{
|
|
Url: "http://192.168.177.7:8080/api/unis/source-list/v1/update",
|
|
Methord: http.MethodGet,
|
|
})
|
|
|
|
return nil
|
|
}
|