Преглед изворни кода

越南渠道允许名字存在空格

gitxsm пре 1 недеља
родитељ
комит
a4cccb5367
2 измењених фајлова са 15 додато и 5 уклоњено
  1. 4 1
      script/common/CommonDefine.lua
  2. 11 4
      script/common/FilterUtil.lua

+ 4 - 1
script/common/CommonDefine.lua

@@ -17,11 +17,14 @@ CHANNEL_TAG_WX = 11              -- 微信小程序,抖音游戏, 圣扬IOS
 CHANNEL_TAG_HP = 14              -- 虎扑
 CHANNEL_TAG_720 = 15             -- 720
 CHANNEL_TAG_MINNIGAME = 17       -- 美团, 华为, 淘宝
-CHANNEL_TAG_FT = 18             -- 繁体
+CHANNEL_TAG_FT = 18              -- 繁体
 
 CHANNEL_TAG_GUILD1 = 23         -- 公会渠道1
 CHANNEL_TAG_GUILD2 = 24         -- 公会渠道2
 
+CHANNEL_TAG_VN = 27             -- 越南渠道
+CHANNEL_TAG_XIAOQI = 28         -- 小七渠道
+
 
 SEA_CHANNEL_ARR = {13, 18}  -- 海外渠道列表
 

+ 11 - 4
script/common/FilterUtil.lua

@@ -5,6 +5,12 @@
 ----------------------------------
 local Dict = require("common.Dict")
 local Dict2 = require("common.Dict2")
+local Config = require("Config")
+local CommonDefine = require("common.CommonDefine")
+
+local function isAllowSpaceInName()
+	return table.find(Config.SVR_CHANEL or {}, CommonDefine.CHANNEL_TAG_VN) ~= nil
+end
 
 -- 初始
 local dict_maxx = 0
@@ -143,20 +149,21 @@ end
 local fk_letter = {
 "[","]","\\","\"","'","/"," "," "," ","@","&","`","~","$","%","^","*","(",")","-","{","}",":",";","|","<",">","?",".","="}
 function filterName(name)
-	local ret = filter_spec_chars(name)
+	local allowSpace = isAllowSpaceInName()
+	local ret = filter_spec_chars(name, allowSpace)
 	if ret ~= name then
 		return
 	end
 
 	for _, v in ipairs(fk_letter) do
-		if string.find(name, v, 1, true) then
+		if not (allowSpace and v == " ") and string.find(name, v, 1, true) then
 			return
 		end
 	end
 	return filter(name)
 end
 
-function filter_spec_chars(s)
+function filter_spec_chars(s, allowSpace)
     local ss = {}
     local k = 1
     while true do
@@ -164,7 +171,7 @@ function filter_spec_chars(s)
         local c = string.byte(s,k)
         if not c then break end
         if c<192 then
-            if (c>=48 and c<=57) or (c>= 65 and c<=90) or (c>=97 and c<=122) then
+            if (c>=48 and c<=57) or (c>= 65 and c<=90) or (c>=97 and c<=122) or (allowSpace and c == 32) then
                 table.insert(ss, string.char(c))
             end
             k = k + 1