Skip to content

Commit 2366601

Browse files
author
guofang
committed
Merge branch 'dev_jlzhang' into 'dev_2.10.1'
解决Bug IOV-363 分类一和视频id无冲突,视频id的投放未展示,视频id有误,不应该去掉前面的0 See merge request Mobile/VideoOS-Android-SDK!31
2 parents ecff455 + 06f996e commit 2366601

File tree

3 files changed

+106
-20
lines changed

3 files changed

+106
-20
lines changed

VideoOS/LuaViewSDK/src/com/taobao/luaview/util/LuaUtil.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313
import com.taobao.luaview.userdata.ui.UDSpannableString;
1414

15+
import org.luaj.vm2.LuaBoolean;
16+
import org.luaj.vm2.LuaDouble;
1517
import org.luaj.vm2.LuaFunction;
18+
import org.luaj.vm2.LuaInteger;
1619
import org.luaj.vm2.LuaNumber;
20+
import org.luaj.vm2.LuaString;
1721
import org.luaj.vm2.LuaTable;
1822
import org.luaj.vm2.LuaUserdata;
1923
import org.luaj.vm2.LuaValue;
@@ -804,16 +808,18 @@ public static HashMap<String, String> toMap(LuaTable table) {
804808
String value = null;
805809
if (luaValue.istable()) {
806810
value = JsonUtil.toString(luaValue);
807-
} else if (luaValue.isint()) {
808-
value = String.valueOf(luaValue.optint(0));
809-
} else if (luaValue.islong()) {
810-
value = String.valueOf(luaValue.optlong(0));
811-
} else if (luaValue.isnumber()) {
812-
value = String.valueOf(luaValue.optint(0));
813-
} else if (luaValue.isboolean()) {
814-
value = String.valueOf(luaValue.optboolean(false));
815-
} else if (luaValue.isstring()) {
816-
value = String.valueOf(luaValue.optstring(null));
811+
} else {
812+
if (luaValue instanceof LuaBoolean) {
813+
value = String.valueOf(luaValue.optboolean(false));
814+
} else if (luaValue instanceof LuaInteger) {
815+
value = String.valueOf(luaValue.optint(0));
816+
} else if (luaValue instanceof LuaDouble) {
817+
value = String.valueOf(luaValue.optdouble(0));
818+
} else if (luaValue instanceof LuaString) {
819+
value = String.valueOf(luaValue.optstring(null));
820+
} else {
821+
value = String.valueOf(luaValue);
822+
}
817823
}
818824
if (value != null) {
819825
result.put(key.optjstring(null), value);

VideoOS/VenvyLibrary/src/main/assets/lua/main.lua

Lines changed: 87 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ local function checkHotspotShow(data)
163163
commonParam = Native:commonParam()
164164
}
165165

166+
local videoInfo = Native:getVideoInfo()
167+
168+
if videoInfo["extendDict"] ~= nil then
169+
paramData["videoInfo"] = videoInfo["extendDict"]
170+
end
171+
166172
local paramDataString = Native:tableToJson(paramData)
167173
-- local OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/notice"
168174

@@ -177,10 +183,15 @@ local function checkHotspotShow(data)
177183
}, function(response, errorInfo)
178184
-- print("luaview getVoteCountInfo")
179185

186+
if (errorInfo ~= nil) then
187+
Native:logReport("[http request failed], url:" .. OS_HTTP_POST_CHECK_HOTSPOT .. ", msg:" .. errorInfo, 1, true)
188+
return
189+
end
190+
180191
local requestType = 0
181192
local playStatus = 0
182193
local isShow = 0
183-
if (response ~= nil) then
194+
if (response ~= nil and response.encryptData ~= nil) then
184195
requestType = 1
185196
-- print("luaview getVoteCountInfo 11"..Native:tableToJson(response))
186197
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
@@ -197,7 +208,11 @@ local function checkHotspotShow(data)
197208
isShow = 1
198209
end
199210
end
211+
else
212+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_POST_CHECK_HOTSPOT .. ", msg:" .. "Response data code failed, code:" .. tostring(response.resCode) .. ", msg:" .. tostring(response.resMsg), 1, true)
200213
end
214+
else
215+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_POST_CHECK_HOTSPOT .. ", msg:Response data parsing failure", 1, true)
201216
end
202217
trackNotice(data, requestType, playStatus, isShow)
203218
end)
@@ -365,6 +380,13 @@ local function getTaglist()
365380
title = Native:getVideoTitle(),
366381
commonParam = Native:commonParam()
367382
}
383+
384+
local videoInfo = Native:getVideoInfo()
385+
386+
if videoInfo["extendDict"] ~= nil then
387+
paramData["videoInfo"] = videoInfo["extendDict"]
388+
end
389+
368390
local paramDataString = Native:tableToJson(paramData)
369391
--print("[LuaView] "..paramDataString)
370392
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
@@ -374,13 +396,22 @@ local function getTaglist()
374396
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
375397
}, function(response, errorInfo)
376398
--print("luaview getTaglist")
377-
if (response == nil) then
399+
400+
if (errorInfo ~= nil) then
401+
Native:logReport("[http request failed], url:" .. OS_HTTP_GET_TAG_LIST .. ", msg:" .. errorInfo, 1, true)
402+
return
403+
end
404+
405+
if (response == nil or response.encryptData == nil) then
406+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_POST_CHECK_HOTSPOT .. ", msg:Response data parsing failure", 1, true)
378407
return
379408
end
380409
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
410+
print("luaview "..responseData)
381411

382412
response = toTable(responseData)
383413
if (response.resCode ~= "00") then
414+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_TAG_LIST .. ", msg:" .. "Response data code failed, code:" .. tostring(response.resCode) .. ", msg:" .. tostring(response.resMsg), 1, true)
384415
return
385416
end
386417
local dataTable = response.launchInfoList
@@ -428,8 +459,15 @@ local function getSimulationTag()
428459
videoId = Native:nativeVideoID(),
429460
commonParam = Native:commonParam()
430461
}
431-
local extendJson = Native:getConfigExtendJSONString()
432-
local extendTable = toTable(extendJson)
462+
463+
local extendTable = nil
464+
465+
local videoInfo = Native:getVideoInfo()
466+
467+
if videoInfo["extendDict"] ~= nil then
468+
paramData["videoInfo"] = videoInfo["extendDict"]
469+
extendTable = videoInfo["extendDict"]
470+
end
433471

434472
if extendTable["creativeName"] ~= nil then
435473
paramData["creativeName"] = extendTable["creativeName"]
@@ -443,13 +481,22 @@ local function getSimulationTag()
443481
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
444482
}, function(response, errorInfo)
445483
--print("luaview getSimulationTag")
446-
if (response == nil) then
484+
485+
if (errorInfo ~= nil) then
486+
Native:logReport("[http request failed], url:" .. OS_HTTP_GET_SIMULATION_TAG .. ", msg:" .. errorInfo, 1, true)
447487
return
448488
end
489+
490+
if (response == nil or response.encryptData == nil) then
491+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_SIMULATION_TAG .. ", msg:Response data parsing failure", 1, true)
492+
return
493+
end
494+
449495
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
450496
--print("luaview "..responseData)
451497
response = toTable(responseData)
452498
if (response.resCode ~= "00") then
499+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_SIMULATION_TAG .. ", msg:" .. "Response data code failed, code:" .. tostring(response.resCode) .. ", msg:" .. tostring(response.resMsg), 1, true)
453500
return
454501
end
455502
local dataTable = response.launchInfoList
@@ -486,6 +533,13 @@ local function getResourcelist()
486533
videoId = Native:nativeVideoID(),
487534
commonParam = Native:commonParam()
488535
}
536+
537+
local videoInfo = Native:getVideoInfo()
538+
539+
if videoInfo["extendDict"] ~= nil then
540+
paramData["videoInfo"] = videoInfo["extendDict"]
541+
end
542+
489543
local paramDataString = Native:tableToJson(paramData)
490544
-- print("[LuaView] getResourcelist")
491545
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
@@ -494,7 +548,15 @@ local function getResourcelist()
494548
device_type = deviceType,
495549
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
496550
}, function(response, errorInfo)
497-
if (response == nil) then
551+
552+
if (errorInfo ~= nil) then
553+
Native:logReport("[http request failed], url:" .. OS_HTTP_GET_RESOURCE_LIST .. ", msg:" .. errorInfo, 1, true)
554+
reloadGetResourcelist()
555+
return
556+
end
557+
558+
if (response == nil or response.encryptData == nil) then
559+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_RESOURCE_LIST .. ", msg:Response data parsing failure", 1, true)
498560
reloadGetResourcelist()
499561
return
500562
end
@@ -503,11 +565,13 @@ local function getResourcelist()
503565
-- print("luaview "..responseData)
504566

505567
response = toTable(responseData)
568+
506569
if (response == nil) then
507570
reloadGetResourcelist()
508571
return
509572
end
510573
if (response.resCode ~= "00") then
574+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_RESOURCE_LIST .. ", msg:" .. "Response data code failed, code:" .. tostring(response.resCode) .. ", msg:" .. tostring(response.resMsg), 1, true)
511575
reloadGetResourcelist()
512576
return
513577
end
@@ -561,6 +625,13 @@ function show(args)
561625
videoId = Native:nativeVideoID(),
562626
commonParam = Native:commonParam()
563627
}
628+
629+
local videoInfo = Native:getVideoInfo()
630+
631+
if videoInfo["extendDict"] ~= nil then
632+
paramData["videoInfo"] = videoInfo["extendDict"]
633+
end
634+
564635
local paramDataString = Native:tableToJson(paramData)
565636
--print("luaview "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
566637
mainNode.request:post(OS_HTTP_GET_CONFIG, {
@@ -569,13 +640,22 @@ function show(args)
569640
target_id = roomId,
570641
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
571642
}, function(response, errorInfo)
572-
if (response == nil) then
643+
644+
if (errorInfo ~= nil) then
645+
Native:logReport("[http request failed], url:" .. OS_HTTP_GET_CONFIG .. ", msg:" .. errorInfo, 1, true)
646+
return
647+
end
648+
649+
if (response == nil or response.encryptData == nil) then
650+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_CONFIG .. ", msg:Response data parsing failure", 1, true)
573651
return
574652
end
653+
575654
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
576655
--print("luaview "..responseData)
577656
response = toTable(responseData)
578657
if (response.resCode ~= "00") then
658+
Native:logReport("[HTTP response incorrect], url:" .. OS_HTTP_GET_CONFIG .. ", msg:" .. "Response data code failed, code:" .. tostring(response.resCode) .. ", msg:" .. tostring(response.resMsg), 1, true)
579659
return
580660
end
581661

VideoOS/VenvyLibrary/src/main/assets/lua/os_string.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ OS_HTTP_HOST = Native:videoOShost()
55
-- OS_HTTP_HOST = "http://dev-videopublicapi.videojj.com/videoos-api/"
66

77
OS_HTTP_GET_CONFIG = OS_HTTP_HOST .. "/api/config"
8-
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/v2/queryLaunchInfo"
8+
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/v3/queryLaunchInfo"
99
OS_HTTP_GET_RESOURCE_LIST = OS_HTTP_HOST .. "/api/preloadLaunchInfo"
1010
OS_HTTP_GET_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileQuery"
1111
OS_HTTP_POST_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileModify"
1212
OS_HTTP_GET_COMMON_QUERY = OS_HTTP_HOST .. "/api/commonQuery"
1313
OS_HTTP_GET_SIMULATION_TAG = OS_HTTP_HOST .. "/simulation/queryInfo"
14-
OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/notice"
14+
OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/v3/notice"
1515
OS_HTTP_POST_CHECK_HOTSPOT_TRACK = OS_HTTP_HOST .. "/statisticConfirmLaunch"
1616

1717
--数据统计网络相关
@@ -30,4 +30,4 @@ OS_ICON_BUBBLE_PROMPT_LEFT = OS_ICON_HEAD .. "[email protected]"
3030
OS_ICON_BUBBLE_PROMPT_RIGHT = OS_ICON_HEAD .. "[email protected]"
3131
OS_ICON_WEDGE_BACK = OS_ICON_HEAD .. "[email protected]"
3232
OS_ICON_WEDGE_CLOSE = OS_ICON_HEAD .. "[email protected]"
33-
OS_ICON_WIN_LINK_BACK = OS_ICON_HEAD .. "[email protected]"
33+
OS_ICON_WIN_LINK_BACK = OS_ICON_HEAD .. "[email protected]"

0 commit comments

Comments
 (0)