考勤的lua脚本
ngx.header.content_type = "text/plain;charset=utf-8"
local cjson = require "cjson" local request_method = ngx.var.request_method;
local args = nil;
args = ngx.req.get_uri_args(); if args["SN"] == nil or args["SN"]=="" then
ngx.print("{\"success\":\"false\",\"info\":\"参数SN不能为空!\"}");
return;
end
local count=; if args["table"]=="ATTLOG" then
ngx.req.read_body();
local body = ngx.req.get_body_data()
local lines=string.split(body,"\n");
count=#lines-; for i=,#lines- do
local l=string.split(lines[i],"\t");
local personId=l[];
local kqTime=l[];
ngx.log(ngx.ERR,"****HuangHai****===>人员id:"..personId,"考勤时间:"..kqTime);
end
end ngx.say("HTTP/1.1 200 OK");
ngx.say("Server: DsidealSuperServer/1.9.0");
local now = os.date("%Y-%m-%d %H:%M:%S", os.time()) ngx.say(now);
ngx.say("Content-Type: text/plain");
ngx.say("Connection: close");
ngx.say("Content-Length:4"); ngx.say("Pragma: no-cache");
ngx.say("Cache-Control: no-store");
ngx.say("");
ngx.say("OK:"..tostring(count)); function string.split(str, delimiter)
if str==nil or str=='' or delimiter==nil then
return nil
end local result = {}
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
vi /usr/local/openresty/nginx/lua/lua_script/kaoqin.lua
在配置文件中添加如下内容:
location /iclock/
{
content_by_lua_file /usr/local/openresty/nginx/lua/lua_script/kaoqin.lua;
}
示例代码在199上。
查看日志:
tail -f /usr/local/openresty/nginx/logs/error.log | grep ****HuangHai****
考勤的lua脚本的更多相关文章
- 在redis中使用lua脚本让你的灵活性提高5个逼格
在redis的官网上洋洋洒洒的大概提供了200多个命令,貌似看起来很多,但是这些都是别人预先给你定义好的,但你却不能按照自己的意图进行定制, 所以是不是感觉自己还是有一种被束缚的感觉,有这个感觉就对了 ...
- 《转》Unity3D研究院编辑器之创建Lua脚本模板
Unity里能创建 c#脚本模板,但是如果我想创建Lua脚本模板怎么办呢?拓展一下编辑器吧. 设置一下Lua脚本的模板地址 : Assets/Editor/Lua/Template/lua.lua ...
- StackExchange.Redis加载Lua脚本进行模糊查询的批量删除和修改
前言 使用StackExchange.Redis没有直接相关的方法进行模糊查询的批量删除和修改操作,虽然可以通过Scan相关的方法进行模糊查询,例如:HashScan("hashkey&qu ...
- 使用Lua脚本语言开发出高扩展性的系统,AgileEAS.NET SOA中间件Lua脚本引擎介绍
一.前言 AgileEAS.NET SOA 中间件平台是一款基于基于敏捷并行开发思想和Microsoft .Net构件(组件)开发技术而构建的一个快速开发应用平台.用于帮助中小型软件企业建立一条适合市 ...
- redisTemplate的spring配置以及lua脚本驱动
最近在使用spring-data-redis的redisTemplate,所以写篇使用记录吧. 1.不用多说,使用maven引入相关依赖,因为项目已经引入其他的 <dependency> ...
- redis原子性读写操作之LUA脚本和watch机制
最近在开发电商平台的子系统--储值卡系统,系统核心业务涉及到金额消费以及库存控制,因此为了解决建立在内存上高并发情况下的事务控制,使用了spring封装的RedisTemplate执行lua脚本进行原 ...
- online_jf.lua --累计在线时间领取物品(积分)的lua脚本
原作者: ayase 8-27修正 修复首次使用后的红字不需要额外进数据库导入计分表,这lua全自动生成 ----------------------------------------------- ...
- Redis执行Lua脚本的情况
第一个测试: 往Redis里面存入1000个Hash,每个Hash里面有100个元素(Key 0-99,值是Key^2). PHP代码,执行33s左右 <?php $redis = new Re ...
- C程序与Lua脚本相互调用
Lua脚本是一种可用于C程序开发/测试的工具,本篇介绍一下C程序与Lua脚本如何进行相互调用,更加详细的操作参见<Programing in Lua>.本文分为3个部分:1.Windows ...
随机推荐
- BZOJ [Poi2012]Fibonacci Representation
找最近的数 记忆化 (我也不知道为什么对的) #include<cstdio> #include<algorithm> #include<map> using na ...
- gradle编译很慢解决方法
1.升级内存,内存最好在8g以上. 我的12g,编译运行,2s22ms,不到3s. 2.设置Android staido 不要 打开instant run
- 哪些工具能有效管理Azure Active Directory?
[TechTarget中国原创] 管理Azure Active Directory有四种常见的工具:Azure Web门户.Azure PowerShell.Azure命令行接口和Azure Mana ...
- 《Cracking the Coding Interview》——第3章:栈和队列——题目6
2014-03-19 03:01 题目:给定一个栈,设计一个算法,在只使用栈操作的情况下将其排序.你可以额外用一个栈.排序完成后,最大元素在栈顶. 解法:我在草稿纸上试了试{1,4,2,3}之类的小例 ...
- 放映PPT幻灯片演示文稿如何让演讲者备注不投影到屏幕上(转载)
ps files/ps.rar 放映PPT幻灯片演示文稿如何让演讲者备注不投影到屏幕上 如题,在PPT幻灯片的演示文稿中加入演讲者备注(使用PPT讲座时苦于有时会忘记一些要讲的数字,文字等),但是在 ...
- jsp页面提示“Multiple annotations found at this line: - The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path”解决方案
Multiple annotations found at this line: - The superclass "javax.servlet.http.HttpServlet" ...
- UVALive 5029 字典树
E - Encoded Barcodes Crawling in process...Crawling failedTime Limit:3000MS Memory Limit:0KB 6 ...
- Servlet 返回Json数据格式
其实就是把数据库中的数据查询出来拼接成一个Json数据 import dao.UserDao; import endy.User; import javax.servlet.ServletExcept ...
- CodeForces D. Concatenated Multiples
http://codeforces.com/contest/1029/problem/D You are given an array aa, consisting of nn positive in ...
- ThreadPoolExecutor源码解析
LZ目前正在做一个批量生成报表的系统,需要定时批量生成多张报表,便考虑使用线程池来完成.JDK自带的Executors工具类只提供创建固定线程和可伸展但无上限的两个静态方法,并不能满足LZ想自定制线程 ...