浏览代码

fix:公司名称显示错误

zoie 4 天之前
父节点
当前提交
aba246ceec
共有 4 个文件被更改,包括 20 次插入12 次删除
  1. 5 5
      Nats/NatsServer/NatsUser.go
  2. 3 3
      conf/app.conf
  3. 5 1
      controllers/Order.go
  4. 7 3
      routers/filter.go

+ 5 - 5
Nats/NatsServer/NatsUser.go

@@ -13,19 +13,19 @@ import (
 )
 
 // 验证TOKEY
-func Verification(GetCookie string, GetString string) (bool, Account.User, int) {
+func Verification(GetCookie string, GetString string) (error, Account.User, int) {
 
 	User_tokey := GetString
 	if len(User_tokey) == 0 {
 		User_tokey = GetCookie
 	}
 	if len(User_tokey) == 0 {
-		return false, Account.User{}, 0
+		return errors.New("请重新登录!"), Account.User{}, 0
 	}
 	// 请求-响应, 向 verification 发布一个 `ToKey` 请求数据,设置超时间3秒,如果有多个响应,只接收第一个收到的消息
 	msg, err := lib.Nats.Request("Cold_User_verification", []byte(User_tokey), 3*time.Second)
 	if err != nil {
-		return false, Account.User{}, 0
+		return errors.New("请稍后重试"), Account.User{}, 0
 	}
 	fmt.Printf("Cold_User_verification : %s\n", string(msg.Data))
 	type T_R struct {
@@ -39,10 +39,10 @@ func Verification(GetCookie string, GetString string) (bool, Account.User, int)
 
 	err = msgpack.Unmarshal(msg.Data, &t_R)
 	if err != nil {
-		return false, Account.User{}, 0
+		return errors.New("请稍后重试"), Account.User{}, 0
 	}
 
-	return true, t_R.Data, t_R.Pid
+	return nil, t_R.Data, t_R.Pid
 
 }
 

+ 3 - 3
conf/app.conf

@@ -8,18 +8,18 @@ copyrequestbody = true
 version = "/v3"
 
 # Redis
-Redis_address = "203.34.49.130:6379"
+Redis_address = "8.148.211.203:6379"
 Redis_password = "redis_JJ56d5"
 Redis_dbNum = "1"
 # Mysql
-MysqlServer_UrlPort = "203.34.49.130:3306"
+MysqlServer_UrlPort = "8.148.211.203:3306"
 MysqlServer_Database = "cold"
 MysqlServer_Username = "cold"
 MysqlServer_Password = "yjwyEckZS7rE5H"
 MysqlServer_MaxIdleConnections = 100
 MysqlServer_MaxOpenConnections = 200
 # Nats
-NatsServer_Url = "203.34.49.130:4222"
+NatsServer_Url = "8.148.211.203:4222"
 
 # 静态资源
 Qiniu_AccessKey = "-8ezB_d-8-eUFTMvhOGbGzgeQRPeKQnaQ3DBcUxo"

+ 5 - 1
controllers/Order.go

@@ -517,7 +517,11 @@ func (c *OrderController) Order_PDF() {
 	x = 22.0
 	w1 = 80.0
 	w2 = 195.0*2 + 80
-	ShippingUnit := fmt.Sprintf("%s", Order_r.ShippingUnit)
+	shippingName := Order_r.ShippingName
+	if len(Order_r.ShippingName) == 0 {
+		shippingName = Order_r.ShippingUnit
+	}
+	ShippingUnit := fmt.Sprintf("%s", shippingName)
 	lib.RectFillColor(pdf, "发货单位:", 12, x, 140, w1, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
 	x += w1
 	lib.RectFillColor(pdf, ShippingUnit, 12, x, 140, w2, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)

+ 7 - 3
routers/filter.go

@@ -15,9 +15,13 @@ func RBACFilter(ctx *context.Context) {
 	if strings.Contains(ctx.Request.URL.String(), "/v3/Order/GetDeviceDataNot") || strings.Contains(ctx.Request.URL.String(), "/Cold_GoodsOrder/v3/Order/Test") {
 		return
 	}
-	b_, User_r, T_pid := NatsServer.Verification(ctx.GetCookie("User_tokey"), ctx.Input.Query("User_tokey"))
-	if !b_ {
-		ctx.Output.JSON(lib.JSONS{Code: 201, Msg: "请重新登陆!"}, true, false)
+	err, User_r, T_pid := NatsServer.Verification(ctx.Input.Query("User_tokey"), ctx.GetCookie("User_tokey"))
+	if err != nil {
+		if err.Error() == "请重新登录!" {
+			ctx.Output.JSON(lib.JSONS{Code: 201, Msg: err.Error()}, true, false)
+		} else {
+			ctx.Output.JSON(lib.JSONS{Code: 202, Msg: err.Error()}, true, false)
+		}
 		return
 	}