appid_check.lua 464 B

1234567891011121314151617181920212223
  1. --
  2. -- Created by IntelliJ IDEA.
  3. -- User: Bear
  4. -- Date: 2019/4/30
  5. -- Time: 下午4:05
  6. -- To change this template use File | Settings | File Templates.
  7. --
  8. lfs=require("lfs")
  9. expire_time = 10
  10. appid = string.match(ngx.var.request_uri, "/api/wechat/mpapi/appid/(%w+)")
  11. if not appid then
  12. return
  13. end
  14. attr = lfs.attributes("/tmp/TPL_CALLBACK_" .. appid)
  15. if type(attr) == "table" and os.time() - attr.change < expire_time then
  16. ngx.say("")
  17. ngx.exit(200)
  18. end