Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thinkjs

Package Overview
Dependencies
Maintainers
1
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thinkjs - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

14

lib/Lib/Core/Controller.class.js

@@ -280,2 +280,16 @@ /**

/**
* 获取对应的模型
* 默认获取当前controller对应的模型
* @param {[type]} name [description]
* @return {[type]} [description]
*/
model: function(name){
if (!name) {
var filename = this.__filename;
name = filename.split("/").pop().replace(C('class_file_suffix'), "");
name = name.substr(0, name.length - 10);
};
return D(name);
},
/**
* 下载文件

@@ -282,0 +296,0 @@ * @return {[type]} [description]

6

lib/Lib/Core/Filter.class.js

@@ -51,3 +51,7 @@ /**

if (is_number(value)) {
return this.id(value);
value = this.id(value);
if (value) {
return [value];
};
return [];
};

@@ -54,0 +58,0 @@ if (is_string(value)) {

@@ -23,3 +23,3 @@ /**

this._response();
var method = this.req.method;
var method = this.req.method.toLowerCase();
var methods = ["post", "put", "patch"];

@@ -33,2 +33,11 @@ if (methods.indexOf(method) > -1) {

/**
* 检测含有post数据
* @return {Boolean} [description]
*/
hasBody: function(){
var encoding = 'transfer-encoding' in this.req.headers;
var length = 'content-length' in this.req.headers && this.req.headers['content-length'] !== '0';
return encoding || length;
},
/**
* 获取POST过来的数据,包含上传的文件

@@ -40,5 +49,25 @@ * 依赖multiparty库

getData: function(callback){
//没有post数据,直接回调
if (!this.hasBody()) {
return callback && callback(this.http);
};
var self = this;
var contentType = this.req.headers["content-type"] || "";
var ajaxContentType = "application/x-www-form-urlencoded";
//ajax数据提交
if (contentType.indexOf(ajaxContentType) === 0) {
var buffer = "";
this.req.setEncoding(C('encoding'));
this.req.on("data", function(chunk){
buffer += chunk;
})
this.req.on("end", function(){
self.http.post = querystring.parse(buffer) || {};
callback && callback(self.http);
})
return;
};
//表单数据提交
var multiparty = require("multiparty");
var form = new multiparty.Form();
var self = this;
form.on("file", function(name, value){

@@ -45,0 +74,0 @@ self.http.file[name] = value;

2

lib/Lib/Core/Model.class.js

@@ -587,3 +587,3 @@ var util = require('util');

update: function(data, options){
if (!data) {
if (is_empty(data)) {
if (this._data) {

@@ -590,0 +590,0 @@ data = this._data;

{
"name": "thinkjs",
"description": "thinkphp web framework for nodejs",
"version": "0.1.13",
"version": "0.1.14",
"author": {

@@ -6,0 +6,0 @@ "name": "welefen",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc