Commit 65888024 authored by zhuwei's avatar zhuwei

entrust_type

parent 6f7e5c58
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\index\service\OfficeUserLogService;
use app\index\service\UserLogService;
use think\Request;
......@@ -14,10 +15,15 @@ use think\Request;
class UserLog extends Basic{
private $service_;
private $OfficeUserLogService;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new UserLogService();
$this->OfficeUserLogService = new OfficeUserLogService();
}
/**
......@@ -95,15 +101,21 @@ class UserLog extends Basic{
"page_no" => 1,
"page_size" => 15
);*/
if (!isset($params['user_id'])) {
return $this->response("101", "参数不全");
$checkResult = $this->validate($params, "UserLogValidate.followUpLog");
if (true !== $checkResult) {
return $this->response(101, $checkResult);
}
$user_id = $params['user_id'];
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->phoneFollowUpNew($user_id,$this->siteId,$pageNo,$pageSize);
if($params['entrust_type'] == 1){
$result = $this->OfficeUserLogService->phoneFollowUpNew($user_id,$this->siteId,$pageNo,$pageSize);
}else{
$result = $this->service_->phoneFollowUpNew($user_id,$this->siteId,$pageNo,$pageSize);
}
if(count($result) > 0){
return $this->response("200", "success!", $result);
}else{
......@@ -123,14 +135,20 @@ class UserLog extends Basic{
"page_no" => 1,
"page_size" => 15
);*/
if (!isset($params['user_id'])) {
return $this->response("101", "参数不全");
$checkResult = $this->validate($params, "UserLogValidate.followUpLog");
if (true !== $checkResult) {
return $this->response(101, $checkResult);
}
$user_id = $params['user_id'];
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->phoneFollowUp($user_id,$this->siteId,$pageNo,$pageSize);
if($params['entrust_type'] == 1){
$result = $this->OfficeUserLogService->phoneFollowUp($user_id,$this->siteId,$pageNo,$pageSize);
}else{
$result = $this->service_->phoneFollowUp($user_id,$this->siteId,$pageNo,$pageSize);
}
if(count($result) > 0){
return $this->response("200", "success!", $result);
......
<?php
namespace app\index\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2019年06月12日
* Time: 20:32:05
*/
class UserLogValidate extends Validate
{
protected $rule = [
'user_id' => 'require|number|gt:0',
'entrust_type' => 'require|number',
];
protected $message = [
'user_id.require' => 'user_id为必填字段',
'user_id.number' => 'user_id只能为数字',
'user_id.gt' => 'user_id必须大于0',
'entrust_type.require' => 'entrust_type为必填字段',
'entrust_type.number' => 'entrust_type只能为数字',
];
protected $scene = [
'followUpLog' => [ 'agent_id', 'entrust_type'],
];
}
\ No newline at end of file
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