Pārlūkot izejas kodu

Merge branch 'dev2.3' of ssh://192.168.3.207:10022/qmx/qfw into dev2.3

wcj 6 gadi atpakaļ
vecāks
revīzija
2ceb50197e

+ 8 - 3
core/src/config.json

@@ -1,5 +1,5 @@
 {
-    "webServerPort": "8081",
+    "webServerPort": "8080",
     "redisServers": "enterprise=192.168.3.18:3379,service=192.168.3.18:3379,other=192.168.3.18:3379,sso=192.168.3.18:3379,credit=192.168.3.18:3379,session=192.168.3.18:3379",
     "useRedis": false,
     "mongodbServers": "192.168.3.18:27080",	
@@ -56,7 +56,7 @@
 		"s_avatar": [8,99]
     },
 	"jyWebdomain":"http://192.168.110.101:82",
-	"qmxWebdomain":"http://wxws.qmx.top",
+	"qmxWebdomain":"http://wxlxl.qmx.top",
 	"jyadd":"http://webws.qmx.top/jyapp/free/message/",
 	"jyopSmtp":{
 		"addr": "smtp.exmail.qq.com",
@@ -71,5 +71,10 @@
 		"port": 1483
 	},
 	"per_del_openid":["o5Z_R0nlDnwkXdFHTQHgWBY0uJZc","o5Z_R0nlDnwkXdFHTQHgWBY0uJZc"],
-	"appPushServiceRpc":"127.0.0.1:5566"
+	"appPushServiceRpc":"127.0.0.1:5566",
+    "pcHelper":{
+      "version":"V2.5.1",
+      "rpcPushServer":"127.0.0.1:8082",
+      "rpcSericeMethod":"Service.PushVersionMsg"
+    }
 }

+ 8 - 0
core/src/qfw/coreconfig/SysConfig.go

@@ -45,6 +45,8 @@ type config struct {
 	UdpHandle          udphandle              `json:"udpHandle"`
 	Per_del_openid     []string               `json:"per_del_openid"`
 	AppPushServiceRpc  string                 `json:"appPushServiceRpc"`
+	Pchelper 		   Pchelper 			  `json:"pcHelper"`
+
 }
 type smtp struct {
 	Addr     string `json:"addr"`
@@ -65,4 +67,10 @@ type udphandle struct {
 	Port int    `json:"port"`
 }
 
+type Pchelper struct{
+	Version 			string `json:"version"` //版本号
+	RpcPushServer 		string `json:"rpcPushServer"`
+	RpcSericeMethod 	string `json:"rpcSericeMethod"`
+}
+
 var SysConfig config

+ 50 - 0
core/src/qfw/manage/pchelper.go

@@ -0,0 +1,50 @@
+package manage
+
+import (
+	"github.com/go-xweb/xweb"
+	"log"
+	"qfw/coreconfig"
+	"net/rpc"
+	"qfw/util"
+	"encoding/json"
+)
+
+type PcHelper struct {
+	*xweb.Action
+	pushVersion xweb.Mapper `xweb:"/manage/message/pushVersion"` //pc助手 版本更新
+}
+
+func init() {
+	xweb.AddAction(&PcHelper{})
+}
+
+func (l *PcHelper) PushVersion() error {
+	version := coreconfig.SysConfig.Pchelper.Version
+	repl := pushVersionMsg(map[string]interface{}{
+		"Version": version,
+	})
+	result := map[string]interface{}{
+		"repl":    repl,
+		"version": version,
+	}
+	l.ServeJson(result)
+	return nil
+}
+
+func pushVersionMsg(m map[string]interface{}) bool {
+	defer util.Catch()
+	var repl string
+	client, err := rpc.DialHTTP("tcp", coreconfig.SysConfig.Pchelper.RpcPushServer)
+	if err != nil {
+		log.Println(err.Error())
+		return false
+	}
+	defer client.Close()
+	b, _ := json.Marshal(m)
+	err = client.Call(coreconfig.SysConfig.Pchelper.RpcSericeMethod, b, &repl)
+	if err != nil {
+		log.Println(err.Error())
+		return false
+	}
+	return repl == "y"
+}

+ 16 - 0
core/src/web/templates/manage/slider.html

@@ -9,8 +9,24 @@
 		<li id="count"  class="list-group-item"><a style=" font-weight:normal;" href="/manage/count"><i class="glyphicon glyphicon-euro"></i> <span>数据统计</span></a></li>
 		<li id="cauditbar"  class="list-group-item"><a style=" font-weight:normal;" href="/manage/caudit"><i class="glyphicon glyphicon-euro"></i> <span>开发者认证</span></a></li>
 		<li id="message"  class="list-group-item"><a style=" font-weight:normal;" href="/manage/message/index"><i class="glyphicon glyphicon-euro"></i> <span>消息管理</span></a></li>
+        <li id="message"  class="list-group-item"><a style=" font-weight:normal;" onclick="pushVersion()"><i class="glyphicon glyphicon-euro"></i> <span>PC助手版本更新</span></a></li>
 		<!-- <li id="jydata"  class="list-group-item"><a style=" font-weight:normal;" href="/manage/data/index"><i class="glyphicon glyphicon-euro"></i> <span>剑鱼数据管理</span></a></li>
 		<li id="databack"  class="list-group-item"><a style=" font-weight:normal;" href="/manage/data/back"><i class="glyphicon glyphicon-euro"></i> <span>剑鱼备份数据</span></a></li> -->
 	</ul>
  <style type="text/css">.glyphicon{font-family:'Glyphicons Halflings';}</style>
+	 <script>
+		 function pushVersion() {
+		     var con = confirm("您确定要更新PC助手版本吗?");
+		     if(con){
+                 $.post("/manage/message/pushVersion",{},function(data){
+                     console.log(data);
+                     if (data.repl){
+                         alert("版本号:"+data.version+",更新成功!");
+                     }else{
+                         alert("更新失败");
+                     }
+                 })
+			 }
+         }
+	 </script>
 </div>