Evan
Evan - 认证专家

注册于 5年前

回答
310
文章
36
关注者
39

4.1版本可以使用scriptStop() 4.1以下使用os.exit()

根据你的分辨率调整的.无法手动拉高.下个版本修改此问题

#触摸精灵下载&安装方式 开发环境连接手机的功能只能用于4.0版本以下.4.0以上用控制中心来代替#触摸精灵控制中心社区版V1.1

function main()
    local ftp = require("socket.ftp")
    ftp.TIMEOUT = 20 --设置超时时间
    ret = ftp.get("ftp://123:123@192.192.192.192/a.txt;type=i")
    local file = io.open("/var/touchelf/a.txt ","w")
    file:write(ret)
    file:close()
end

有的时候无法下载是服务器设置问题,具体错误看服务器的连接日志

function main()
    while true do 
        local t = os.date("*t",os.time())
        -- t.wday 是星期 星期天为1 星期1为2 以此类推
        -- t.hour 是小时 0-23
        -- t.min 分钟 0-59
        if (t.wday == 4 or  t.wday == 6 or t.wday == 1) and (t.hour >= 18 or t.hour <=20) and t.min == 30 then
            start()
        else
            mSleep(1000)
        end
    end

end
function start()
    --实际脚本内容
end

function main()
    if checkIP() then 
        logDebug("ip重复")
    end
end
function checkIP()
    local http = require("socket.http")
    --不知道你获取ip的接口,我就随便找了一个
    local ret = http.request("http://pv.sohu.com/cityjson?ie=utf-8")
    ret = ret and jsonDecode(string.sub(ret,string.find(ret,'{'),#ret-1))
    --不知道你黑名单的格式,假设是文本文件,格式为 ip-地区 每行一个
    local str =string.format("%s-%s",ret.cip,ret.cname)
    local t = false
    local f = io.open("文本路径","r");
    if f then
        for l in f:lines() do
            if string.find(l,str) then 
                t = true
                break
            end
        end
        f:close();
    end
    return t
end

抓抓不支持4.0以上版本,4.0以上版本使用控制中心

function main()
    local str = "关键字"
    local t = "";
    local f = io.open("文本路径","r");
    if f then
        for l in f:lines() do
            if string.find(l,str) then 
                t = l
                break
            end
        end
        f:close();
    end
    logDebug(t)
end

a = '{"code":1,"msg":"获取成功","data":[{"id":"3","orderid":"20190124183943365140494","phoneNumber":"432465475"}],"url":"","wait":3}'
 a = jsonDecode(a)
logDebug(a.data[1].orderid)

发布
问题