From c9635ae13e45cdb3af46ad45f62ba54463cd774b Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 04 十二月 2019 16:37:57 +0800
Subject: [PATCH] fix argname

---
 syssetApi.go |  142 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 131 insertions(+), 11 deletions(-)

diff --git a/syssetApi.go b/syssetApi.go
index 93a561c..3739d03 100644
--- a/syssetApi.go
+++ b/syssetApi.go
@@ -4,14 +4,29 @@
 	"basic.com/pubsub/protomsg.git"
 	"encoding/json"
 	"fmt"
+	"strconv"
 )
 
 type SysSetApi struct {
+	Ip string
+	Port int
+}
 
+func (api SysSetApi) getBasicUrl() string {
+	if api.Ip == "" {
+		return BASIC_URL
+	}
+	if api.Ip == "" {
+		api.Ip = DEFAULT_IP
+	}
+	if api.Port == 0 {
+		api.Port = DEFAULT_PORT
+	}
+	return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
 }
 //鑾峰彇鏈嶅姟鍣ㄦ湰鏈洪厤缃俊鎭�
 func (api SysSetApi) GetServerInfo() (flag bool,sysconf protomsg.LocalConfig){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/getServerInfo"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/getServerInfo"
 	client := NewClient()
 
 	body, err := client.DoGetRequest(url, nil, nil)
@@ -38,7 +53,7 @@
 }
 //淇濆瓨杞閰嶇疆
 func (api SysSetApi) SavePollPeriod(period int) (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollPeriod"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/savePollPeriod"
 	client := NewClient()
 	paramBody := make(map[string]interface{},0)
 	paramBody["period"] = period
@@ -57,7 +72,7 @@
 }
 
 func (api SysSetApi) SavePollDelay(delay int) (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollDelay"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/savePollDelay"
 	client := NewClient()
 	paramBody := make(map[string]interface{},0)
 	paramBody["delay"] = delay
@@ -77,7 +92,7 @@
 
 //鑾峰彇杞閰嶇疆
 func (api SysSetApi) GetPollConfig() (flag bool,config protomsg.PollConfig) {
-	url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/getPollConfig"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/getPollConfig"
 	client := NewClient()
 
 	body, err := client.DoGetRequest(url, nil, nil)
@@ -105,7 +120,7 @@
 
 //鍒囨崲杞鏄惁寮�鍚拰鍏抽棴
 func (api SysSetApi) UpdatePollEnable(enable bool) bool{
-	url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/updateEnable"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/updateEnable"
 	client := NewClient()
 	paramBody :=make(map[string]interface{},0)
 	paramBody["enable"] = enable
@@ -122,8 +137,27 @@
 	return res.Success
 }
 
+func (api SysSetApi) UpdateChannelCount(pollChannelCount int, videoChannelCount int) bool{
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/updateChannelCount"
+	client := NewClient()
+	paramBody :=make(map[string]interface{},0)
+	paramBody["pollChannelCount"] = pollChannelCount
+	paramBody["videoChannelCount"] = videoChannelCount
+	body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
+	if err != nil {
+		return false
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return false
+	}
+
+	return res.Success
+}
+
 func (api SysSetApi) AlarmEdit(paramBody map[string]interface{}) (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/alarmEdit"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/alarmEdit"
 	client := NewClient()
 	body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
 	if err != nil {
@@ -139,7 +173,7 @@
 }
 
 func (api SysSetApi) VideoLenShow() (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/videoLenShow"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/videoLenShow"
 	client := NewClient()
 
 	body, err := client.DoGetRequest(url, nil, nil)
@@ -155,7 +189,7 @@
 }
 
 func (api SysSetApi) VideoLenEdit(maxVideoLen string,minVideoLen string) (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/videoLenEdit"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/videoLenEdit"
 	client := NewClient()
 	paramBody :=make(map[string]interface{},0)
 	paramBody["max_video_len"] = maxVideoLen
@@ -174,7 +208,7 @@
 }
 
 func (api SysSetApi) SaveServerInfo(paramBody map[string]interface{}) (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/saveServerInfo"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/saveServerInfo"
 	client := NewClient()
 	body,err := client.DoPostRequest(url,CONTENT_TYPE_FORM, paramBody,nil,nil)
 	if err != nil {
@@ -190,7 +224,7 @@
 }
 
 func (api SysSetApi) Gb28181ConfigShow() (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/gb28181ConfigShow"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/gb28181ConfigShow"
 	client := NewClient()
 
 	body, err := client.DoGetRequest(url, nil, nil)
@@ -206,7 +240,7 @@
 }
 
 func (api SysSetApi) Gb28181ConfigEdit(paramBody map[string]interface{}) (bool,interface{}){
-	url := BASIC_URL + DATA_URL_PREFIX + "/sysset/gb28181ConfigEdit"
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/gb28181ConfigEdit"
 	client := NewClient()
 	body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
 	if err != nil {
@@ -219,4 +253,90 @@
 	}
 
 	return res.Success,res.Data
+}
+
+
+func (api SysSetApi) GetRemoteFullServerInfo(headers map[string]string) (flag bool,d interface{}){
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/getDevInfo"
+	client := NewClient()
+
+	body, err := client.DoGetRequest(url, nil, headers)
+	if err != nil {
+		return false, nil
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return false, nil
+	}
+
+	return res.Success,res.Data
+}
+
+func (api SysSetApi) GetClockInfo(headers map[string]string) (flag bool,d interface{}){
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/clockInfo"
+	client := NewClient()
+
+	body, err := client.DoGetRequest(url, nil, headers)
+	if err != nil {
+		return false, nil
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return false, nil
+	}
+
+	return res.Success,res.Data
+}
+
+func (api SysSetApi) TestNTPServer(query map[string]string,headers map[string]string) (flag bool,d interface{}){
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/ntpTest"
+	client := NewClient()
+
+	body, err := client.DoGetRequest(url, query, headers)
+	if err != nil {
+		return false, nil
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return false, nil
+	}
+
+	return res.Success,res.Data
+}
+
+func (api SysSetApi) SetSysClock(paramBody map[string]interface{},headers map[string]string) (flag bool,d interface{}){
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/updateClock"
+	client := NewClient()
+
+	body, err := client.DoPostRequest(url, CONTENT_TYPE_JSON,paramBody,nil, headers)
+	if err != nil {
+		return false, nil
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return false, nil
+	}
+
+	return res.Success,res.Data
+}
+
+func (api SysSetApi) GetSysInfo(headers map[string]string) (flag bool,d interface{}){
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/sysinfo"
+	client := NewClient()
+
+	body, err := client.DoGetRequest(url, nil, headers)
+	if err != nil {
+		return false, nil
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return false, nil
+	}
+
+	return res.Success,res.Data
 }
\ No newline at end of file

--
Gitblit v1.8.0