wangshan 7 tahun lalu
induk
melakukan
9c0ec5b08d
5 mengubah file dengan 8 tambahan dan 12 penghapusan
  1. TEMPAT SAMPAH
      pkg/windows_amd64/apiservice/config.a
  2. TEMPAT SAMPAH
      pkg/windows_amd64/apiservice/oamanager.a
  3. TEMPAT SAMPAH
      pkg/windows_amd64/apiservice/tools.a
  4. 8 12
      src/apiservice/oamanager/content.go
  5. TEMPAT SAMPAH
      src/src.exe

TEMPAT SAMPAH
pkg/windows_amd64/apiservice/config.a


TEMPAT SAMPAH
pkg/windows_amd64/apiservice/oamanager.a


TEMPAT SAMPAH
pkg/windows_amd64/apiservice/tools.a


+ 8 - 12
src/apiservice/oamanager/content.go

@@ -2,6 +2,7 @@ package oamanager
 
 import (
 	"net"
+	"net/http"
 	"qfw/util"
 	elastic "qfw/util/elastic"
 	"regexp"
@@ -26,15 +27,13 @@ func init() {
 	xweb.AddAction(&Content{})
 }
 func (c *Content) Article(id string) {
-	bm := false
+	defer util.Catch()
 	client := c.Header("User-Agent")
-	c.Request.Proto = GetIp(c)
-	addLog(c)
+	c.Request.Proto = GetIp(c.Request) //ip
+	addLog(c.Request)
+	bm := false //访问日志
 	bm = regex.MatchString(client)
-	//解密id
-	sid_openid := util.DecodeArticleId2ByCheck(id)[0]
-	//sid_openid = "596c129d5d11e1c74547e6ff"
-	//查询数据
+	sid_openid := util.DecodeArticleId2ByCheck(id)[0] //解密id
 	data := *elastic.GetByIdField("bidding", "bidding", sid_openid, `"detail","title","projectname","publishtime"`)
 	timeF := data["publishtime"].(float64)
 	time := time.Unix(int64(timeF), 0).Format("2006-01-02 15:04")
@@ -43,7 +42,6 @@ func (c *Content) Article(id string) {
 	c.T["title"] = data["title"]
 	c.T["detail"] = detail
 	c.T["projectname"] = data["projectname"]
-	//返回页面
 	if bm { //手机访问
 		c.Render("/app/app.html", &c.T)
 	} else { //pc端访问
@@ -51,8 +49,7 @@ func (c *Content) Article(id string) {
 	}
 }
 
-func addLog(c *Content) {
-	req := c.Request
+func addLog(req *http.Request) {
 	timeNow := time.Now()
 	agent := req.Header.Get("user-agent")
 	ref := req.Referer()
@@ -127,8 +124,7 @@ func GetBrowse(userbrowser string) string {
 }
 
 //获取请求ip
-func GetIp(c *Content) string {
-	req := c.Request
+func GetIp(req *http.Request) string {
 	ip_for := req.Header.Get("x-forwarded-for")
 	ip_client := req.Header.Get("http_client_ip")
 	ip_addr := req.Header.Get("Remote_addr")

TEMPAT SAMPAH
src/src.exe