Commit a6e4648f authored by zhuwei's avatar zhuwei

验证器修改

parent facc7c39
......@@ -184,17 +184,17 @@ class User extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"user_id" => 59089,
"agent_id" => 9,
"type" => "next",
);*/
$checkResult = $this->validate($params, "UserGetLastOrNextUserIdValidate.verifyStatus");
$checkResult = $this->validate($params, "UserValidate.getLastOrNextUserID");
if (true !== $checkResult) {
return $this->response("300", $checkResult);
}
/*$params = array(
"user_id" => 59089,
"agent_id" => 9,
"type" =>"next",
);*/
$type = -1;
//APP状态
......@@ -501,18 +501,16 @@ class User extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$checkResult = $this->validate($params, "UserGetLastOrNextUserIdPhoneFollowPuValidate.verifyStatus");
/*$params = array(
"id" => 1956,
"agent_id" => 9,
"type" => "next",
);*/
$checkResult = $this->validate($params, "UserValidate.getLastOrNextUserIDPhoneFollowPu");
if (true !== $checkResult) {
return $this->response("300", $checkResult);
}
// $params = array(
// "id" => 1956,
// "agent_id" => 9,
// "type" =>"next",
// );
$last_month = date("Y-m-d", strtotime("-1 month"));
if (!empty($this->params['start_date']) && empty($this->params['end_date'])) {
if (strtotime($last_month) > strtotime($this->params['start_date'])) {
......@@ -642,9 +640,9 @@ class User extends Basic
return $this->response("201", "24小时保护期内", [ 'id' => $model_res[0]['id'] ]);
}
}
// dump($model_res);exit();
//dump($model_res);exit();
$where = [];
// $where['city'] = trim($this->city);
//$where['city'] = trim($this->city);
if (!empty($this->params['end_date']) && !empty($this->params['start_date'])) {
if (strtotime($last_month) > strtotime($this->params['start_date'])) {
$start_date = $last_month;
......
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/8/7
* Time: 13:54:12
*/
class UserGetLastOrNextUserIdPhoneFollowPuValidate extends Validate{
protected $rule = [
'type' => 'require',
'agent_id' => 'require|number|gt:0',
'id' => 'require|number|gt:0'
];
protected $message = [
'type.require' => '网络异常!错误代码:uv1',//type为必填字段
'agent_id.require' => 'agent_id为必填字段',//agent_id为必填字段
'agent_id.number' => '网络异常!错误代码:uv4',//agent_id只能为数字
'agent_id.gt' => '网络异常!错误代码:uv5',//agent_id必须大于0
'id.require' => 'id为必填字段',//user_id为必填字段
'id.number' => '网络异常!错误代码:uv7',//user_id只能为数字
'id.gt' => '网络异常!错误代码:uv8',//user_id必须大于0
];
protected $scene = [
'add_phone_follow_up_verify' => [ 'id', 'agent_id', 'type'],
];
}
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/8/7
* Time: 13:54:12
*/
class UserGetLastOrNextUserIdValidate extends Validate{
protected $rule = [
'type' => 'require',
'agent_id' => 'require|number|gt:0',
'user_id' => 'require|number|gt:0'
];
protected $message = [
'type.require' => '网络异常!错误代码:uv1',//type为必填字段
'agent_id.require' => 'agent_id为必填字段',//agent_id为必填字段
'agent_id.number' => '网络异常!错误代码:uv4',//agent_id只能为数字
'agent_id.gt' => '网络异常!错误代码:uv5',//agent_id必须大于0
'user_id.require' => 'user_id为必填字段',//user_id为必填字段
'user_id.number' => '网络异常!错误代码:uv7',//user_id只能为数字
'user_id.gt' => '网络异常!错误代码:uv8',//user_id必须大于0
];
protected $scene = [
'add_phone_follow_up_verify' => [ 'user_id', 'agent_id', 'type'],
];
}
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/8/7
* Time: 13:54:12
*/
class UserValidate extends Validate{
protected $rule = [
'type' => 'require',
'agent_id' => 'require|number|gt:0',
'user_id' => 'require|number|gt:0',
'id' => 'require|number|gt:0'
];
protected $message = [
'type.require' => 'type为必填字段',
'agent_id.require' => 'agent_id为必填字段',
'agent_id.number' => 'agent_id只能为数字',
'agent_id.gt' => 'agent_id必须大于0',
'user_id.require' => 'user_id为必填字段',
'user_id.number' => 'user_id只能为数字',
'user_id.gt' => 'user_id必须大于0',
'id.require' => 'id为必填字段',
'id.number' => 'id只能为数字',
'id.gt' => 'id必须大于0',
];
protected $scene = [
'getLastOrNextUserID' => [ 'user_id', 'agent_id', 'type' ],
'getLastOrNextUserIDPhoneFollowPu' => [ 'id', 'agent_id', 'type' ],
];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment