考勤的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 ...
随机推荐
- SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID
如题: SDK location not found. Define location with sdk.dir in the local.properties file or with an AND ...
- Android stadio 工具使用
android staido 有logcat窗口,她可以显示log信息.还有run窗口. 我以前一直忽略了run窗口,其实蛮重要,蛮好用的.他只会显示你当前运行的进程的log,不用你再去设置filld ...
- RegisterWindowMessage
RegisterWindowMessage function Defines a new window message that is guaranteed to be unique throug ...
- react基本知识点合集
妹子UI里面有React的相关组件与用法:http://amazeui.org/react/components React官方网站:https://facebook.github.io/react/ ...
- Pascal小游戏 双人射击
一个双人的游戏 Pascal源码附上 只要俩人不脑残,一下午玩不完...又是控制台游戏中的一朵奇葩. Free Pascal 射击游戏 Program shooting_game; uses crt; ...
- Python 模块:random 随机数生成
Python中的random模块用于生成随机数. 使用该模块之前需要 import random 几个常用的函数用法: 1.random.random 函数原型: random.random() 用于 ...
- 剑指offer-从尾到头打印链表03
class Solution: # 返回从尾部到头部的列表值序列,例如[1,2,3] def printListFromTailToHead(self, listNode): # write code ...
- Kd-Tree&Ransac笔记
关于sift资源总结: http://blog.csdn.net/masibuaa/article/details/9191309 两个比较好的资源: https://my.oschina.net/k ...
- Scala 基础(5)—— 构建函数式对象
有了 Scala 基础(4)—— 类和对象 的前提,现在就可以来构建一个基于 Scala 的函数式对象. 下面开始构造一个有理数对象 Rational. 1. 主构造方法和辅助构造方法 对于每一个类的 ...
- Oracle设置用户密码永不过期
1.查看用户的profile是那个,一般是default: select username, profile from dba_users; 2.查看指定概要文件(如default)的密码有效期设置: ...