@@ -61,14 +61,33 @@ local function hotspotPriority(data)
6161 return tonumber (dataTable .priority )
6262end
6363
64+ local function hotspotLevel (data )
65+ if (data == nil ) then
66+ return nil
67+ end
68+ local dataTable = data .data
69+ if (dataTable == nil ) then
70+ return nil
71+ end
72+ if (dataTable .level == nil ) then
73+ return nil
74+ end
75+ return tonumber (dataTable .level )
76+ end
77+
6478local function sendActionWedge (data ) -- 跳转中插处理
6579 if (data == nil ) then
6680 return
6781 end
6882 local repeatTimes = wedgeRepeatTimes (data )
6983 local priority = hotspotPriority (data )
84+ local level = hotspotLevel (data )
7085 if (repeatTimes == - 1 ) then
71- Native :sendAction (Native :base64Encode (" LuaView://defaultLuaView?template=" .. data .template .. " &id=" .. data .id .. " &priority=" .. tostring (priority )), data )
86+ if (level == osTopLevel ) then
87+ Native :sendAction (Native :base64Encode (" LuaView://topLuaView?template=" .. data .miniAppInfo .template .. " &id=" .. data .id .. " &priority=" .. tostring (priority ) .. " &miniAppId=" .. data .miniAppInfo .miniAppId ), data )
88+ else
89+ Native :sendAction (Native :base64Encode (" LuaView://defaultLuaView?template=" .. data .miniAppInfo .template .. " &id=" .. data .id .. " &priority=" .. tostring (priority ) .. " &miniAppId=" .. data .miniAppInfo .miniAppId ), data )
90+ end
7291 print (" =response==跳转=" .. tostring (data .template ) .. " ==id==" .. tostring (data .id ) .. " ==key=" .. tostring (key ))
7392 return
7493 end
@@ -87,7 +106,13 @@ local function sendActionWedge(data) --跳转中插处理
87106 end
88107 playWedgeCount = playWedgeCount + 1
89108 dataTable .playWedgeCount = playWedgeCount
90- Native :sendAction (Native :base64Encode (" LuaView://defaultLuaView?template=" .. data .template .. " &id=" .. data .id .. " &priority=" .. tostring (priority )), data )
109+
110+ if (level == osTopLevel ) then
111+ Native :sendAction (Native :base64Encode (" LuaView://topLuaView?template=" .. data .miniAppInfo .template .. " &id=" .. data .id .. " &priority=" .. tostring (priority ) .. " &miniAppId=" .. data .miniAppInfo .miniAppId ), data )
112+ else
113+ Native :sendAction (Native :base64Encode (" LuaView://defaultLuaView?template=" .. data .miniAppInfo .template .. " &id=" .. data .id .. " &priority=" .. tostring (priority ) .. " &miniAppId=" .. data .miniAppInfo .miniAppId ), data )
114+ end
115+
91116 print (" =response==跳转=" .. tostring (data .template ) .. " ==id==" .. tostring (data .id ) .. " ==key=" .. tostring (key ))
92117end
93118
@@ -109,8 +134,6 @@ local function trackNotice(data, requestType, status, isShow)
109134 return nil
110135 end
111136
112- -- local OS_HTTP_POST_CHECK_HOTSPOT_TRACK = OS_HTTP_HOST .. "/statisticConfirmLaunch"
113-
114137 local paramData = {
115138 videoId = Native :nativeVideoID (),
116139 id = data .id ,
@@ -119,23 +142,10 @@ local function trackNotice(data, requestType, status, isShow)
119142 timestamp = data .videoStartTime ,
120143 type = requestType ,
121144 status = status ,
122- isShow = isShow ,
123- commonParam = Native :commonParam ()
145+ isShow = isShow
124146 }
125-
126- local paramDataString = Native :tableToJson (paramData )
127-
128- -- print("[LuaView] "..paramDataString)
129- -- print("[LuaView] "..OS_HTTP_POST_CHECK_HOTSPOT_TRACK)
130-
131- mainNode .request :post (OS_HTTP_POST_CHECK_HOTSPOT_TRACK , {
132- bu_id = buId ,
133- device_type = deviceType ,
134- data = Native :aesEncrypt (paramDataString , OS_HTTP_PUBLIC_KEY , OS_HTTP_PUBLIC_KEY )
135- }, function (response , errorInfo )
136- -- print("luaview getVoteCountInfo")
137-
138- end )
147+ -- 接口参数文档http://wiki.videojj.com/pages/viewpage.action?pageId=2215044
148+ Native :commonTrack (4 , paramData )
139149end
140150
141151local function checkHotspotShow (data )
@@ -275,6 +285,20 @@ local function registerMedia()
275285 return media
276286end
277287
288+ local function downloadAndRunLua (data )
289+ if (data == nil ) then
290+ return
291+ end
292+ for k ,v in pairs (data ) do
293+ Native :preloadMiniAppLua (v .miniAppInfo , function (status )
294+ print (" preloadMiniAppLua " .. tostring (status ))
295+ if (status == true ) then
296+ sendNativeViewAction (data )
297+ end
298+ end )
299+ end
300+ end
301+
278302local function registerMqtt (data )
279303 if data == nil then
280304 return
@@ -319,11 +343,11 @@ local function registerMqtt(data)
319343 return
320344 end
321345 for key , value in pairs (dataTable ) do
322- if (value .id ~= nil and value .template ~= nil ) then
346+ if (value .id ~= nil and value .miniAppInfo ~= nil ) then
323347 local showAd = {}
324348 value .from = " mqtt"
325349 showAd [value .id ] = value
326- sendNativeViewAction (showAd )
350+ downloadAndRunLua (showAd )
327351 -- 在此关闭中插有问题
328352 end
329353 end
@@ -337,6 +361,8 @@ local function getTaglist()
337361
338362 local paramData = {
339363 videoId = Native :nativeVideoID (),
364+ episode = Native :getVideoEpisode (),
365+ title = Native :getVideoTitle (),
340366 commonParam = Native :commonParam ()
341367 }
342368 local paramDataString = Native :tableToJson (paramData )
@@ -366,13 +392,10 @@ local function getTaglist()
366392 -- 下载投放的lua文件
367393 local luaList = {}
368394 for i ,v in ipairs (dataTable ) do
369- if (v .luaList ~= nil ) then
370- for i ,v in ipairs (v .luaList ) do
371- table.insert (luaList , v )
372- end
395+ if (v .miniAppInfo ~= nil ) then
396+ Native :preloadMiniAppLua (v .miniAppInfo )
373397 end
374398 end
375- Native :preloadLuaList (luaList )
376399
377400 -- osTypeVideoOS = 1, osTypeLiveOS = 2, 点播按时间点加载,直播直接加载
378401 if Native :osType () < osTypeLiveOS then
@@ -385,10 +408,10 @@ local function getTaglist()
385408 else
386409 print (" osTypeLiveOS" )
387410 for key , value in pairs (dataTable ) do
388- if (value .id ~= nil and value .template ~= nil ) then
411+ if (value .id ~= nil and value .miniAppInfo ~= nil ) then
389412 local showAd = {}
390413 showAd [value .id ] = value
391- sendNativeViewAction (showAd )
414+ downloadAndRunLua (showAd )
392415 end
393416 end
394417 end
@@ -430,10 +453,10 @@ local function getSimulationTag()
430453 return
431454 end
432455 for key , value in pairs (dataTable ) do
433- if (value .id ~= nil and value .template ~= nil ) then
456+ if (value .id ~= nil and value .miniAppInfo ~= nil ) then
434457 local showAd = {}
435458 showAd [value .id ] = value
436- sendNativeViewAction (showAd )
459+ downloadAndRunLua (showAd )
437460 end
438461 end
439462 -- print("getSimulationTag success")
0 commit comments