Commit eac956b3 authored by zw's avatar zw Committed by hujun

带看

parent 27296d99
......@@ -19,14 +19,14 @@ class Report extends Basic
{
private $service_;
private $fulModel;
private $oReportModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->service_ = new ReportService();
$this->fulModel = new FollowUpLogModel();
$this->oReportModel = new OReportModel();
}
/**
......@@ -66,8 +66,6 @@ class Report extends Basic
if (!$userArr) {
return $this->response("101", "不存在此用户");
}
$is_ok = $this->service_->verifyReport($agent_id, $this->agentName, $store_id, $user_id, $userArr["user_phone"],
$userArr["user_name"], $house_ids, $vehicle, $intro, $predict_see_time);
if ($is_ok > 0) {
......@@ -84,26 +82,26 @@ class Report extends Basic
* @return \think\Response
*/
public function reportList(){
/* $params = array(
$params = array(
"agent_id" =>1,
);*/
$params = $this->params;
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1,
"page_size"=>15
);
//$params = $this->params;
if(!isset($params["agent_id"])){
return $this->response("101", "请求参数错误");
}
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,b.house_id,b.house_title";
$params["report_agent_id"] = $params["agent_id"];
$result = $this->oReportModel->selectReportList($field,$params);
$result = $this->service_->orderList($field,$params,$pageNo,$pageSize);
if(count($result) > 0){
foreach ($result as $k=>$v){
$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/','$1****$2',$v["user_phone"]);
}
}
return $this->response("200","request success",$result);
......
......@@ -9,7 +9,6 @@ namespace app\api_broker\extend;
* Time: 9:35
* 基类
*/
use app\api\untils\JwtUntils;
use app\model\AAgents;
use app\model\Users;
use app\model\GOperatingRecords;
......@@ -42,7 +41,6 @@ class Basic extends Controller
'broker/token',
'broker/getShopList',
'broker/getShopDetail',
'broker/login'
);
/**
......@@ -65,22 +63,14 @@ class Basic extends Controller
} elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null;
}
/*临时验证 start*/
if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT();
$jwt = new JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array('HS256')); //解码token
$this->timeStamp_ = $result->timeStamp_;
if (isset($result->data->phone)) {
$phone = $result->data->phone;
} else {
$phone = $result->data;
}
$is = Db::table('agents')->where('phone', $result->data)->count();
$is = Db::table('agents')->where('phone', $phone)->count();
$this->agentPhone = $result->data;
if ($is == 0) {
echo json_encode(array("code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json"));
exit;
......@@ -91,7 +81,6 @@ class Basic extends Controller
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
}
unset($this->params["AuthToken"]);
/*临时验证 end*/
......@@ -122,7 +111,7 @@ class Basic extends Controller
echo json_encode(array( "code" => "300", "msg" => "AuthToken不能为空!", "data" => [], "type" => "json" ));
exit;
}
// $this->verifyAgentInfo();
//$this->verifyAgentInfo();
$this->verifyTime();
}
......
......@@ -20,11 +20,13 @@ class ReportService
private $reportModel;
private $orderModel;
private $oReportModel;
function __construct()
{
$this->reportModel = new OReportModel();
$this->orderModel = new OrderModel();
$this->oReportModel = new OReportModel();
}
/**
......@@ -81,6 +83,29 @@ class ReportService
}
public function orderList($field,$params,$pageNo,$pageSize){
$result = $this->oReportModel->selectReportList($field,$params,$pageNo,$pageSize);
$ids_str = "";
if(count($result) > 0){
foreach ($result as $k=>$v){
$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/','$1****$2',$v["user_phone"]);
$ids_str += $v["order_id"] + ",";
}
$ids_str = rtrim($ids_str, ",");
$sign_arr = $this->orderSign($ids_str);
dump($sign_arr);
return $result;
}
return null;
}
public function orderSign($ids_str){
return $this->orderModel->selectSign($ids_str);
}
/**
* 订单号
......
......@@ -76,9 +76,11 @@ class OReportModel extends Model
/**
* @param string $filed
* @param $params
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectReportList($filed = "id", $params){
public function selectReportList($filed = "id", $params,$pageNo,$pageSize){
$where_ = [];
if (isset($params["report_agent_id"])) {
......@@ -92,6 +94,8 @@ class OReportModel extends Model
->alias("a")
->join("o_order b","a.id= b.f_id","left")
->where($where_)
->limit($pageSize)
->page($pageNo)
->select();
}
}
\ No newline at end of file
......@@ -54,4 +54,18 @@ class OrderModel extends Model
->select();
}
/**
* @param $ids
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectSign($ids){
return $this->db_
->field('id as order_id,1 as type')
->where(["id",["in",$ids]])
->union('SELECT order_id,2 as type FROM o_march_in where order_id in ('.$ids.') group by order_id')
->union('SELECT order_id,3 as type FROM o_paylog where order_id in ('.$ids.') group by order_id')
->union('SELECT order_id,4 as type FROM o_bargain where order_id in ('.$ids.') group by order_id')
->select();
}
}
\ 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