Skip to content

Commit 248e0ef

Browse files
committed
update lua
1 parent 21f116b commit 248e0ef

File tree

91 files changed

+73692
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+73692
-170
lines changed

VideoOS-lua-app/Lua/main.lua

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ local function registerMedia()
182182
end
183183

184184
local function registerMqtt(data)
185-
if data == nil or data.emqConfig == nil then
185+
if data == nil then
186+
return
187+
end
188+
local emqConfigTable = data.emqConfig
189+
if emqConfigTable == nil then
186190
return
187191
end
188192
--osTypeVideoOS = 1, osTypeLiveOS = 2, 直播开启Mqtt,点播不开启
@@ -192,7 +196,22 @@ local function registerMqtt(data)
192196

193197
local mqtt = Mqtt()
194198
local topic = {}
195-
topic[Native:nativeVideoID()] = 0
199+
local topicConfig = emqConfigTable.topic
200+
local appKey = Native:appKey()
201+
local nativeVideoID = Native:nativeVideoID()
202+
local topicString
203+
if (appKey ~= '' and appKey ~= nil and topicConfig ~= '' and topicConfig ~= nil) then
204+
topicString = topicConfig .. '/' .. appKey .. "-" .. nativeVideoID
205+
-- elseif (appKey ~= '' and appKey ~= nil and topicConfig == nil) then
206+
-- topicString = appKey .. "-" .. nativeVideoID
207+
else
208+
topicString = nativeVideoID
209+
end
210+
211+
if System.ios() then
212+
topicString = topicString .. '/'
213+
end
214+
topic[topicString] = 0
196215
--print("register "..Native:nativeVideoID())
197216

198217
onMqttMessage = function(message)
@@ -229,7 +248,7 @@ local function getTaglist()
229248
local paramDataString = Native:tableToJson(paramData)
230249
--print("[LuaView] "..paramDataString)
231250
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
232-
Native:post(OS_HTTP_GET_TAG_LIST, {
251+
mainNode.request:post(OS_HTTP_GET_TAG_LIST, {
233252
bu_id = buId,
234253
device_type = deviceType,
235254
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
@@ -267,7 +286,7 @@ local function getTaglist()
267286
end
268287
end
269288
end
270-
end)
289+
end, mainNode.media)
271290
end
272291

273292
local function getSimulationTag()
@@ -285,7 +304,7 @@ local function getSimulationTag()
285304
local paramDataString = Native:tableToJson(paramData)
286305
--print("[LuaView] "..paramDataString)
287306
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
288-
Native:post(OS_HTTP_GET_SIMULATION_TAG, {
307+
mainNode.request:post(OS_HTTP_GET_SIMULATION_TAG, {
289308
bu_id = buId,
290309
device_type = deviceType,
291310
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
@@ -312,7 +331,7 @@ local function getSimulationTag()
312331
end
313332
end
314333
--print("getSimulationTag success")
315-
end)
334+
end, mainNode.media)
316335
end
317336

318337
function getTag()
@@ -337,7 +356,7 @@ local function getResourcelist()
337356
local paramDataString = Native:tableToJson(paramData)
338357
-- print("[LuaView] getResourcelist")
339358
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
340-
Native:post(OS_HTTP_GET_RESOURCE_LIST, {
359+
mainNode.request:post(OS_HTTP_GET_RESOURCE_LIST, {
341360
bu_id = buId,
342361
device_type = deviceType,
343362
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
@@ -380,13 +399,13 @@ local function getResourcelist()
380399
if (table_leng(imageList) > 0) then
381400
Native:preloadImage(imageList)
382401
end
383-
end)
402+
end, mainNode.media)
384403
end
385404

386405
--预加载接口重试5次,服务器错误也算失败
387406
function reloadGetResourcelist()
388407
preloadCount = preloadCount + 1
389-
408+
390409
if preloadCount > 5 then
391410
return
392411
end
@@ -401,6 +420,7 @@ function show(args)
401420
end
402421

403422
mainNode.media = registerMedia()
423+
mainNode.request = HttpRequest()
404424

405425
if System.ios() then
406426
deviceType = 1
@@ -412,7 +432,7 @@ function show(args)
412432
}
413433
local paramDataString = Native:tableToJson(paramData)
414434
--print("luaview "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
415-
Native:post(OS_HTTP_GET_CONFIG, {
435+
mainNode.request:post(OS_HTTP_GET_CONFIG, {
416436
bu_id = buId,
417437
device_type = deviceType,
418438
target_id = roomId,
@@ -431,7 +451,7 @@ function show(args)
431451
getTag()
432452
getResourcelist()
433453
--TODO 连接MQTT
434-
end)
454+
end, mainNode.media)
435455
--获取广告--
436456
--[[
437457
Native:get("http://mock.videojj.com/mock/5b029ad88e21c409b29a2114/api/getAds", {}, function(response, errorInfo)

VideoOS-lua-app/Lua/os_string.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OS_HTTP_GET_SIMULATION_TAG = OS_HTTP_HOST .. "/simulation/queryInfo"
1616
OS_HTTP_GET_STARTS = OS_HTTP_HOST .. "/statistic"
1717

1818
--网络请求RSA Public Key
19-
OS_HTTP_PUBLIC_KEY = "inekcndsaqwertyi" --"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCBlxdQe+B3bCL3+km31ABB23sXUB0A3owEBodWlPeikgfEw/JfbZXuiKFoIqAbjmzpDvAE4PYAU4wBjE01wRNLg4KLJyorGLkx6I6gHE67mZqLryepxZdwd8MwzQCsoN3+PAQYUJz54Flc6e14l/LVDyggw/HN/OD9iXC027IVDQIDAQAB"
19+
OS_HTTP_PUBLIC_KEY = Native:appSecret() --"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCBlxdQe+B3bCL3+km31ABB23sXUB0A3owEBodWlPeikgfEw/JfbZXuiKFoIqAbjmzpDvAE4PYAU4wBjE01wRNLg4KLJyorGLkx6I6gHE67mZqLryepxZdwd8MwzQCsoN3+PAQYUJz54Flc6e14l/LVDyggw/HN/OD9iXC027IVDQIDAQAB"
2020
--icon url
2121
local OS_ICON_HEAD = "http://videojj-mobile.oss-cn-beijing.aliyuncs.com/resource/os/"
2222
if Native:isDebug() == false then

VideoOS-lua-app/Lua/os_track.lua

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,27 @@ function osTrack(launchPlanId, eventType, type)
2626
if (type == nil) then
2727
return
2828
end
29-
Native:post(OS_HTTP_GET_STARTS, {
30-
videoId = vid,
31-
type = tostring(type),
32-
eventType = tostring(eventType),
33-
launchPlanId = tostring(launchPlanId)
34-
})
29+
30+
local params = {}
31+
local appkey = Native:appKey()
32+
if appkey ~= nil then
33+
params = {
34+
videoId = vid,
35+
type = tostring(type),
36+
eventType = tostring(eventType),
37+
launchPlanId = tostring(launchPlanId),
38+
appKey = tostring(appkey)
39+
}
40+
else
41+
params = {
42+
videoId = vid,
43+
type = tostring(type),
44+
eventType = tostring(eventType),
45+
launchPlanId = tostring(launchPlanId)
46+
}
47+
end
48+
49+
Native:post(OS_HTTP_GET_STARTS, params)
3550
end
3651

3752
function osThirdPartyTrack(url)

VideoOS-lua-app/template/red_envelope/hongbao.json renamed to VideoOS-lua-app/os_json/hongbao.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
"title": "素材名称",
1616
"type": "string"
1717
},
18-
"interactionTemplateId": {
19-
"title": "素材主题",
20-
"type": "integer",
21-
"enum": [],
22-
"enumNames": []
23-
},
2418
"imageUrl": {
2519
"type": "string",
2620
"title": "热点图片"
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,13 @@
1919
},
2020
"title": "",
2121
"type": "object",
22-
"required": ["creativeName", "interactionTemplateId", "hotspotArray"],
22+
"required": ["creativeName", "hotspotArray"],
2323
"properties": {
2424
"creativeName": {
2525
"title": "素材名称",
2626
"type": "string",
2727
"maxLength": 30
2828
},
29-
"interactionTemplateId": {
30-
"title": "素材主题",
31-
"type": "integer",
32-
"enum": [],
33-
"enumNames": []
34-
},
3529
"isShowAds": {
3630
"type": "boolean",
3731
"title": "关闭按钮是否可见",
@@ -54,7 +48,7 @@
5448
"collect": {
5549
"type": "object",
5650
"title": "3.收集成功后续",
57-
"required": ["imageUrl", "btnTitle", "linkType", "content"],
51+
"required": ["imageUrl", "btnTitle", "linkType"],
5852
"properties": {
5953
"content": {
6054
"type": "string",

VideoOS-lua-app/template/bubble/qipao.json renamed to VideoOS-lua-app/os_json/qipao.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,13 @@
3535
},
3636
"title": "",
3737
"type": "object",
38-
"required": ["creativeName", "interactionTemplateId", "messages"],
38+
"required": ["creativeName", "messages"],
3939
"properties": {
4040
"creativeName": {
4141
"title": "素材名称",
4242
"type": "string",
4343
"maxLength": 30
4444
},
45-
"interactionTemplateId": {
46-
"title": "素材主题",
47-
"type": "integer",
48-
"enum": [],
49-
"enumNames": []
50-
},
5145
"isShowAds": {
5246
"type": "boolean",
5347
"title": "广告标识是否可见",

VideoOS-lua-app/template/vote/toupiao.json renamed to VideoOS-lua-app/os_json/toupiao.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"type": "object",
2121
"required": [
2222
"creativeName",
23-
"interactionTemplateId",
2423
"imageUrl",
2524
"voteImageUrl",
2625
"voteTitle",
@@ -32,12 +31,6 @@
3231
"type": "string",
3332
"maxLength": 30
3433
},
35-
"interactionTemplateId": {
36-
"title": "素材主题",
37-
"type": "integer",
38-
"enum": [],
39-
"enumNames": []
40-
},
4134
"isShowAds": {
4235
"type": "boolean",
4336
"title": "关闭按钮是否可见",
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
{
22
"key": "yuntu",
33
"type": "object",
4-
"required": ["creativeName", "interactionTemplateId", "imageUrl"],
4+
"required": ["creativeName", "imageUrl"],
55
"properties": {
66
"creativeName": {
77
"title": "素材名称",
88
"type": "string",
99
"maxLength": 30
1010
},
11-
"interactionTemplateId": {
12-
"title": "素材主题",
13-
"type": "integer",
14-
"enum": [],
15-
"enumNames": []
16-
},
1711
"imageUrl": {
1812
"type": "string",
1913
"title": "图片"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"key": "zhongcha",
3+
"type": "object",
4+
"required": [
5+
"creativeName", "videoUrl"
6+
],
7+
"properties": {
8+
"SECTION": {
9+
"title": "基础配置",
10+
"type": "string"
11+
},
12+
"creativeName": {
13+
"title": "素材名称",
14+
"type": "string",
15+
"maxLength": 30
16+
},
17+
"videoUrl": {
18+
"type": "string",
19+
"title": "广告视频"
20+
},
21+
"isShowAds": {
22+
"type": "boolean",
23+
"title": "广告标识是否可见",
24+
"default": true
25+
},
26+
"isShowClose": {
27+
"type": "boolean",
28+
"title": "广告关闭按钮是否可见",
29+
"default": true
30+
},
31+
"linkUrl": {
32+
"type": "string",
33+
"title": "广告外链链接",
34+
"format": "uri"
35+
},
36+
"repeatTimes": {
37+
"type": "integer",
38+
"default": 1
39+
},
40+
"playerTimeType": {
41+
"type": "integer",
42+
"default": 1
43+
},
44+
"priority": {
45+
"type": "integer",
46+
"default": 10
47+
},
48+
"closeAfter": {
49+
"type": "integer",
50+
"title": "广告播放多久后可关闭"
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)