sdModuel.lua 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. -- pm.wake("sdcard")
  2. local comSize = 4 --每个公共目录下文件大小 单位 kb
  3. -- 挂载SD卡,返回值0表示失败,1表示成功
  4. -- local sdcard = io.mount(io.SDCARD)
  5. -- log.info('mount sd card', sdcard)
  6. local sdCardTotalSize = rtos.get_fs_total_size(1, 1)
  7. log.info("sd card total size " .. sdCardTotalSize .. " KB")
  8. local delimiter = '\0'
  9. if io.opendir("/sdcard0/common") then
  10. for i=1,100 do
  11. local fType,fName,fSize = io.readdir()
  12. log.info("fname",fName)
  13. if fType==32 then
  14. -- log.info("sd card file",fName,fSize)
  15. elseif fType == nil then
  16. break
  17. end
  18. end
  19. io.closedir("/sdcard0/commmon")
  20. end
  21. -- 删除目录
  22. -- local rmfile = rtos.remove_dir('/sdcard0/common')
  23. -- log.info('delete', rmfile)
  24. -- rtos.make_dir('/sdcard0/log')
  25. -- debug_log('写入测试日志')
  26. -- local del = os.remove(comDir .. '/user')
  27. -- log.info('del user file', del)
  28. -- local readval = readfile() -- 参数:完整路径文件名 不传或者传'/sdcard0/log/0'都是获取最新日志文件
  29. -- print(readval)
  30. --获取table长度
  31. function table_leng(t)
  32. local leng=0
  33. for k, v in pairs(t) do
  34. leng=leng+1
  35. end
  36. return leng;
  37. end
  38. -- 分割字符串
  39. ---@param str string 元字符串
  40. ---@param seq string 分割字符
  41. ---@return table
  42. function split(str, seq)
  43. local nFindStartIndex = 1
  44. local nSplitIndex = 1
  45. local nSplitArray = {}
  46. while true do
  47. local nFindLastIndex = string.find(str, seq, nFindStartIndex)
  48. if not nFindLastIndex then
  49. nSplitArray[nSplitIndex] = string.sub(str, nFindStartIndex, string.len(str))
  50. break
  51. end
  52. nSplitArray[nSplitIndex] = string.sub(str, nFindStartIndex, nFindLastIndex - 1)
  53. nFindStartIndex = nFindLastIndex + string.len(seq)
  54. nSplitIndex = nSplitIndex + 1
  55. end
  56. return nSplitArray
  57. end
  58. --数组去重
  59. function table.unique(t, bArray, mainKey)
  60. local check = {}
  61. local n = {}
  62. local idx = 1
  63. for k, v in pairs(t) do
  64. local judgeKey = v
  65. if mainKey then
  66. judgeKey = v[mainKey] or v
  67. end
  68. if not check[judgeKey] then
  69. if bArray then
  70. n[idx] = v
  71. idx = idx + 1
  72. else
  73. n[k] = v
  74. end
  75. check[judgeKey] = true
  76. end
  77. end
  78. return n
  79. end
  80. --循环创建文件夹
  81. function createAllFolder(path)
  82. -- print(path)
  83. local path_tb={}
  84. local new_path=""
  85. -- 分割路径保存到table
  86. for i,s in pairs(split(path,'/')) do
  87. if s~=nil then
  88. table.insert(path_tb,s)
  89. end
  90. end
  91. -- print(json.encode(path_tb))
  92. local cdir = false --创建结果
  93. -- 遍历并拼接路径检测是否存在,不存在则新建
  94. for k,v in ipairs(path_tb) do
  95. if v ~= '' then
  96. if k==1 then
  97. new_path=v
  98. else
  99. new_path=new_path.."/"..v
  100. end
  101. -- print(new_path,io.opendir(new_path))
  102. local opflag = io.opendir(new_path)
  103. if opflag ~= 1 then
  104. cdir = rtos.make_dir(new_path)
  105. log.info("path:", new_path, "flag:",cdir)
  106. end
  107. end
  108. end
  109. io.closedir()
  110. return cdir
  111. end
  112. -- 打开sd卡公共目录,不存在则创建 获取最新文件,
  113. function getComLastFile(dirPath,filename)
  114. local lastfile = filename --返回最新文件
  115. -- log.info('func:getComLastFile open dir', io.opendir(dirPath))
  116. if io.opendir(dirPath) ~= 0 then
  117. local file = {} -- 该目录所有文件名
  118. for i = 1, 999 do
  119. local fType, fName, fSize = io.readdir()
  120. -- log.info("file or dir",fType, fName, fSize)
  121. if fType == 32 then
  122. -- log.info("func getComLastFile common file", fName, fSize)
  123. local tname = split(fName,'-')
  124. -- log.debug('func:getComLastFile tname',tname,tname[1],tname[2])
  125. if tname[1] == filename then
  126. if tname[2] then
  127. table.insert(file,tname[2])
  128. end
  129. end
  130. -- local c = io.readFile(dirPath..'/'..fName)
  131. -- log.info('文件内容',c)
  132. elseif fType == nil then
  133. break
  134. end
  135. end
  136. -- log.error('files',json.encode(file))
  137. --获取文件名后缀最大值
  138. local max = nil -- 最新的文件 即数字名称值最大的文件
  139. for i, v in pairs(file) do
  140. v = tonumber(v) --数组中是string类型 比较会有问题
  141. if max == nil then max = v end
  142. if max < v then max = v end
  143. end
  144. -- print(max)
  145. if max then
  146. -- 判断该最新文件大小
  147. local cnt = io.fileSize(dirPath .. '/' .. filename..'-'..max)
  148. if cnt then
  149. if cnt >= (comSize * 1024) then -- 文件大于设置的文件大小 新建新文件
  150. max = max + 1
  151. end
  152. lastfile = filename..'-'..max
  153. end
  154. else
  155. -- 判断该最新文件大小
  156. local cnt = io.fileSize(dirPath .. '/' .. filename)
  157. if cnt then
  158. if cnt >= (comSize * 1024) then -- 文件大于设置的文件大小 新建新文件
  159. lastfile = filename..'-1'
  160. end
  161. end
  162. end
  163. -- print(lastfile)
  164. log.debug('func:getComLastFile lastfile',lastfile)
  165. io.closedir()
  166. return lastfile
  167. else
  168. local cdir = createAllFolder(dirPath)
  169. if cdir then
  170. log.info('创建公共目录成功', dirPath)
  171. else
  172. log.error('创建公共目录失败',dirPath)
  173. end
  174. return lastfile
  175. end
  176. end
  177. --根据某个目录下文件名获取该类型所有文件 返回table
  178. function getAllFiles( dir, file )
  179. local fs = {}
  180. if not file then
  181. return false,'fun:getAllFiles,desc:file not found'
  182. end
  183. log.error('open dir',io.opendir(dir))
  184. if io.opendir(dir) ~= 0 then
  185. for i = 1, 999 do
  186. local fType, fName, fSize = io.readdir()
  187. -- log.info("file or dir",fType, fName, fSize)
  188. if fType == 32 then
  189. -- log.info("common file", fName, fSize)
  190. local tname = split(fName,'-')
  191. -- log.debug('func:getAllFiles tname',tname,tname[1],tname[2])
  192. if tname[1] == file then
  193. table.insert(fs,fName)
  194. end
  195. elseif fType == nil then
  196. break
  197. end
  198. end
  199. else
  200. io.closedir()
  201. return false,'fun:getAllFiles,desc:dir not found'
  202. end
  203. io.closedir()
  204. return fs,'fun:getAllFiles,desc:get all files is ok'
  205. end
  206. -- 保存基础信息所有扳手信息
  207. -- 文件 所有扳手信息 查询条件扳手编号 wrench
  208. -- 文件 所有风场信息 wind
  209. -- 文件 部件列表 unit
  210. -- 文件 用户信息 user 查询条件用户名+密码
  211. -- 文件 任务计划 task 查询条件任务编号
  212. -- 文件 工作位置列表 workspace 查询条件风机型号+部件号
  213. -- 文件 待上传信息
  214. -- 文件 配置信息 比如最后一次使用时间 用于存储空间不够时删除
  215. --参数[filename] 文件名称 如wrench、wind、unit。。。[data] 保存数据 table类型
  216. function saveBaseInfo( filename,data,dirPath)
  217. -- print(filename)
  218. if not filename then
  219. log.error('savebaseinfo','filename not fount')
  220. return false,'filename not fount'
  221. end
  222. if not data then
  223. log.error('savebaseinfo','data not fount')
  224. return false,'data not fount'
  225. end
  226. if not dirPath then
  227. log.error('savebaseinfo','dirPath not fount')
  228. return false,'dirPath not fount'
  229. end
  230. --最新文件名称
  231. local filename = getComLastFile(dirPath,filename)
  232. log.debug('func:saveBaseInfo last file',filename)
  233. local path = dirPath..'/'..filename
  234. log.info('save path',path)
  235. data = json.encode(data)..delimiter
  236. local c = io.writeFile(path,data, "a+b")
  237. if c then
  238. log.info('write result', c)
  239. return true
  240. else
  241. log.error('error', '基础信息写入失败')
  242. return false,'基础信息写入失败'
  243. end
  244. end
  245. -- 保存基础信息
  246. -- local wrench = {id=1,name='测试设备'}
  247. -- local res,desc= saveBaseInfo('wrench',wrench)
  248. -- log.debug('save result',res,desc)
  249. -- 模拟数据
  250. -- for i=113,150 do
  251. -- local user = {id=i,name='小亮'..i,pwd='49BA59ABBE56E057',time=os.time()} --password md5加密 16位大写 123456
  252. -- local res,desc= saveBaseInfo('user',user,'/sdcard0/wind/12345')
  253. -- log.debug('save result',res,desc)
  254. -- break
  255. -- end
  256. --查询设备信息
  257. --参数[filename] 文件名称 如wrench、wind、unit。。。[param] 保存数据 table类型 nil查询所有数据
  258. --返回结果 result 结果 值true/false count--查询文件数量 desc --结果描述
  259. function getBaseInfo( filename,param,dirPath)
  260. local selectRes = {} --查询结果
  261. local count = 0 --查询文件个数
  262. if not filename then
  263. log.error('func:getBaseInfo','filename not fount')
  264. return false,count,'filename not fount'
  265. end
  266. if not dirPath then
  267. log.error('func:getBaseInfo','dirPath not fount')
  268. return false,count,'dirPath not fount'
  269. end
  270. --获取所有该文件及副本文件
  271. local files,desc = getAllFiles(dirPath,filename)
  272. local filevals = nil --文件内容
  273. if not files then
  274. return false,count,desc
  275. end
  276. for i,file in pairs(files) do
  277. local path = dirPath..'/'..file
  278. local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
  279. if not filehandle then -- 判断文件是否存在
  280. break --不存在 跳过 查询下个文件
  281. end
  282. fileval = filehandle:read("*all") -- 读出文件内容
  283. -- print(fileval)
  284. if not fileval then
  285. break --空文件 跳过读取下一个文件
  286. end
  287. local filevaltable = split(fileval,delimiter)
  288. local table_length = table_leng(filevaltable)
  289. if table_length <= 1 then
  290. break --无'-'标识符 跳过读取下一个文件
  291. end
  292. local isBreak = false
  293. for a = 1,table_length-1 do
  294. local val = json.decode(filevaltable[a])
  295. if param then --有查询参数
  296. local p_length = table_leng(param) --条件长度
  297. local succ_cnt = 0; --比较成功个数
  298. for p,s in pairs(param) do
  299. if filename == "Users" then
  300. if p == 'pwd' then
  301. s = string.sub(string.upper(crypto.md5(s,#s,16)),9,24) --密码加密 加密结果32位 取16位(第9-24)字符
  302. end
  303. end
  304. if val[p] == s then
  305. succ_cnt = succ_cnt + 1
  306. else
  307. break
  308. end
  309. end
  310. if p_length == succ_cnt then --找到结果 停止继续查找下个文件
  311. selectRes[i] = val
  312. isBreak = true
  313. break
  314. end
  315. else --无查询参数 查询所有
  316. selectRes[i] = val
  317. end
  318. end
  319. count = i
  320. if isBreak then --找到结果 停止继续查找下个文件
  321. break;
  322. end
  323. filehandle:close() -- 关闭文件
  324. end
  325. print(table_leng(selectRes),json.encode(selectRes))
  326. if table_leng(selectRes) > 0 then
  327. --去重
  328. local result = table.unique(selectRes,true,'id')
  329. return result,count,'select success'
  330. else
  331. return false,count,'this data is not found'
  332. end
  333. end
  334. -- 查询文件内容复数
  335. function getBaseInfo_ununique( filename,param,dirPath)
  336. local selectRes = {} --查询结果
  337. local count = 0 --查询文件个数
  338. if not filename then
  339. log.error('func:getBaseInfo','filename not fount')
  340. return false,count,'filename not fount'
  341. end
  342. if not dirPath then
  343. log.error('func:getBaseInfo','dirPath not fount')
  344. return false,count,'dirPath not fount'
  345. end
  346. --获取所有该文件及副本文件
  347. local files,desc = getAllFiles(dirPath,filename)
  348. local filevals = nil --文件内容
  349. if not files then
  350. return false,count,desc
  351. end
  352. for i,file in pairs(files) do
  353. local path = dirPath..'/'..file
  354. local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
  355. if not filehandle then -- 判断文件是否存在
  356. break --不存在 跳过 查询下个文件
  357. end
  358. fileval = filehandle:read("*all") -- 读出文件内容
  359. -- print(fileval)
  360. if not fileval then
  361. break --空文件 跳过读取下一个文件
  362. end
  363. local filevaltable = split(fileval,delimiter)
  364. local table_length = table_leng(filevaltable)
  365. if table_length <= 1 then
  366. break --无'-'标识符 跳过读取下一个文件
  367. end
  368. local isBreak = false
  369. for a = 1,table_length-1 do
  370. local val = json.decode(filevaltable[a])
  371. if param then --有查询参数
  372. local p_length = table_leng(param) --条件长度
  373. local succ_cnt = 0; --比较成功个数
  374. for p,s in pairs(param) do
  375. if val[p] == s then
  376. succ_cnt = succ_cnt + 1
  377. else
  378. break
  379. end
  380. end
  381. if p_length == succ_cnt then --找到结果 停止继续查找下个文件
  382. table.insert(selectRes, val)
  383. end
  384. else --无查询参数 查询所有
  385. table.insert(selectRes, val)
  386. end
  387. end
  388. count = i
  389. -- if isBreak then --找到结果 停止继续查找下个文件
  390. -- break;
  391. -- end
  392. filehandle:close() -- 关闭文件
  393. end
  394. print(table_leng(selectRes),json.encode(selectRes))
  395. if table_leng(selectRes) > 0 then
  396. --去重
  397. local result = table.unique(selectRes,true,'id')
  398. return result,count,'select success'
  399. else
  400. return false,count,'this data is not found'
  401. end
  402. end
  403. -- local res,cnt,desc = getBaseInfo('user',{pwd="123456",name="小亮113"},'/sdcard0/wind/12345')
  404. -- log.info('select result',res,cnt,desc)
  405. -- for i,j in ipairs(res) do
  406. -- for m,n in pairs(j) do
  407. -- print(m,n)
  408. -- end
  409. -- end
  410. --删除基本信息
  411. --参数[filename] 文件名称 如wrench、wind、unit。。。[id] 删除数据id
  412. function delBaseInfo(filename,id,dirPath)
  413. local res = false --删除结果
  414. local count = 0 --查询文件个数
  415. log.info("del process:",filename,id,dirPath)
  416. if not filename then
  417. log.error('func:delBaseInfo','filename not fount')
  418. return res,count,'filename not fount'
  419. end
  420. if not id then
  421. log.error('func:delBaseInfo','id not fount')
  422. return res,count,'id not fount'
  423. end
  424. if not dirPath then
  425. log.error('func:delBaseInfo','dirPath not fount')
  426. return res,count,'dirPath not fount'
  427. end
  428. --获取所有该文件及副本文件
  429. local files,desc = getAllFiles(dirPath,filename)
  430. local filevals = nil --文件内容
  431. if not files then
  432. return res,count,desc
  433. end
  434. local isCurFile = false --要删除文件是否找到
  435. for i,file in pairs(files) do
  436. local path = dirPath..'/'..file
  437. local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
  438. if not filehandle then -- 判断文件是否存在
  439. break --不存在 跳过 查询下个文件
  440. end
  441. fileval = filehandle:read("*all") -- 读出文件内容
  442. if not fileval then
  443. break --空文件 跳过读取下一个文件
  444. end
  445. local filevaltable = split(fileval,delimiter)
  446. local table_lenght = table_leng(filevaltable)
  447. if table_lenght <= 1 then
  448. break --无'-'标识符 跳过读取下一个文件
  449. end
  450. local newfileval = "" --删除后文件内容
  451. for a = 1,table_lenght-1 do
  452. local val = json.decode(filevaltable[a])
  453. if val.id ~= id then
  454. data = json.encode(val)
  455. if newfileval ~= "" then
  456. newfileval = newfileval..data..delimiter
  457. else
  458. newfileval = data..delimiter
  459. end
  460. else
  461. isCurFile = true
  462. end
  463. end
  464. filehandle:close() -- 关闭文件
  465. if isCurFile then
  466. --删除旧文件
  467. local del = os.remove(path)
  468. log.debug('func:delBaseInfo del file', del)
  469. --保存删除后的内容
  470. local c = io.writeFile(path,newfileval, "a+b")
  471. if c then
  472. count = i
  473. log.info('func:delBaseInfo save file', c)
  474. return true,count,'del success'
  475. else
  476. log.error('error', '基础信息写入失败')
  477. return false,count,'del ok,but save fail'
  478. end
  479. break
  480. else
  481. count = i
  482. end
  483. end
  484. if not isCurFile then
  485. return false,count,'this data not found where id='..id
  486. end
  487. end
  488. -- local res,cnt,desc = delBaseInfo('user',113,'/sdcard0/wind/12345')
  489. -- log.info('del result',res,cnt,desc)
  490. --修改基本信息
  491. --参数[filename] 文件名称 如wrench、wind、unit。。。[data] 要修改的数据 table类型 要包含数据id
  492. --返回结果 result 结果 值true/false count--查询文件数量 desc --结果描述
  493. function updateBaseInfo( filename,data,dirPath)
  494. local res = false --修改结果
  495. local count = 0 --查询文件个数
  496. if not filename then
  497. log.error('func:updateBaseInfo','filename not fount')
  498. return res,count,'filename not fount'
  499. end
  500. if not data.id then
  501. log.error('func:updateBaseInfo','data not fount')
  502. return res,count,'the id of data is not fount'
  503. end
  504. --获取所有该文件及副本文件
  505. local files,desc = getAllFiles(dirPath,filename)
  506. local filevals = nil --文件内容
  507. if not files then
  508. return res,count,desc
  509. end
  510. local isCurFile = false --要修改数据文件是否找到
  511. for i,file in pairs(files) do
  512. local path = dirPath..'/'..file
  513. local filehandle = io.open(path, "r") -- 第一个参数是文件名,第二个是打开方式,'r'读模式,'w'写模式,对数据进行覆盖,'a'附加模式,'b'加在模式后面表示以二进制形式打开
  514. if not filehandle then -- 判断文件是否存在
  515. break --不存在 跳过 查询下个文件
  516. end
  517. fileval = filehandle:read("*all") -- 读出文件内容
  518. if not fileval then
  519. break --空文件 跳过读取下一个文件
  520. end
  521. local filevaltable = split(fileval,delimiter)
  522. local table_length = table_leng(filevaltable)
  523. if table_length <= 1 then
  524. break --无'-'标识符 跳过读取下一个文件
  525. end
  526. local newfileval = nil --删除后文件内容
  527. for a = 1,table_length-1 do
  528. local val = json.decode(filevaltable[a])
  529. if val.id ~= data.id then --过滤要修改的那条数据
  530. dataStr = json.encode(val)
  531. if newfileval then
  532. newfileval = newfileval..dataStr..delimiter
  533. else
  534. newfileval = dataStr..delimiter
  535. end
  536. else
  537. --将新数据放入新的文件内容中
  538. local newData = json.encode(data)
  539. if newfileval then
  540. newfileval = newfileval..newData..delimiter
  541. else
  542. newfileval = newData..delimiter
  543. end
  544. isCurFile = true
  545. end
  546. end
  547. filehandle:close() -- 关闭文件
  548. if isCurFile then
  549. if newfileval then
  550. --删除旧文件
  551. local del = os.remove(path)
  552. if not del then
  553. return false,count,'func:updateBaseInfo del fail,please reoperate'
  554. end
  555. --保存删除后的内容
  556. local c = io.writeFile(path,newfileval, "a+b")
  557. if c then
  558. count = i
  559. return true,count,'func:updateBaseInfo update success'
  560. else
  561. return false,count,'func:updateBaseInfo del success,but save fail'
  562. end
  563. else
  564. return false,count,'the file content after del create fail'
  565. end
  566. break
  567. else
  568. count = i
  569. end
  570. end
  571. if not isCurFile then
  572. return false,count,'this data not found where id='..data.id
  573. end
  574. end
  575. sys.taskInit(function()
  576. -- while true do
  577. -- log.info("test00")
  578. -- led.blinkPwm(blueLed,2000,1000)
  579. -- led.blinkPwm(redLed,3000,1000)
  580. -- sys.wait(2000)
  581. -- end
  582. sys.wait(5000)
  583. local moutedFlag = io.mount(io.SDCARD)
  584. log.info('mount sd card', moutedFlag)
  585. local sdCardTotalSize = rtos.get_fs_total_size(1,1)
  586. log.info("sd card total size "..sdCardTotalSize.." KB")
  587. if moutedFlag == 1 then
  588. -- body
  589. sys.publish("IO_SDCARD_MOUTED")
  590. end
  591. end)
  592. -- saveBaseInfo("test", {id=1, name="test", time=os.time()}, "/sdcard0/test")
  593. -- local user = {id=112,name='小亮xxx',pwd='49BA59ABBE56E057',time=os.time()} --password md5加密 16位大写 123456
  594. -- local res,desc= updateBaseInfo('user',user,'/sdcard0/wind/12345')
  595. -- log.debug('update result',res,desc)
  596. -- local del = os.remove(comDir .. '/user-1')
  597. -- log.info('del user file', del)
  598. -- local del = os.remove(comDir .. '/user-2')
  599. -- log.info('del user file', del)
  600. -- local del = os.remove(comDir .. '/user-3')
  601. -- log.info('del user file', del)
  602. -- local del = os.remove(comDir .. '/user-4')
  603. -- log.info('del user file', del)
  604. -- local del = os.remove(comDir .. '/user-5')
  605. -- log.info('del user file', del)
  606. -- local del = os.remove(comDir .. '/user-6')
  607. -- log.info('del user file', del)
  608. -- local del = os.remove(comDir .. '/user-8')
  609. -- log.info('del user file', del)
  610. -- local del = os.remove(comDir .. '/user')
  611. -- log.info('del user file', del)
  612. -- sys.init(0, 0)
  613. -- sys.run()