Commit 1345d92a authored by clone's avatar clone

bug

parent 28082f5b
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\PerformanceUtilService;
use think\Exception;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/8
* Time : 14:02
* Intro:
*/
class PerformanceStatistics extends Basic{
private $service_;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new PerformanceUtilService();
}
/**
* 个人业绩
* @return \think\Response
*/
public function agentPerformanceBySearch()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["is_case"])) {
return $this->response("101", "请求参数错误");
}
$house_id = 0;
if (isset($params["house_id"])) {
$house_id = $params["house_id"];
}
try {
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"],
$params["is_case"], $house_id);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
}
}
\ No newline at end of file
......@@ -145,12 +145,12 @@ class PerformanceService
$result = [];
switch ($is_case) {
case 1:
$now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {
/* $now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {*/
$params["agent_id"] = $agent_id;
$params['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$result = $this->nowTimeSum($params, 1);
} else {
/*} else {
$field = "agent_id,sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,
sum(performance) as performance,sum(official_receipts) as official_receipts,sum(look_at_num) as look_at_num,
sum(march_in_num) as march_in_num , sum(paylog) as paylog , sum(bargain_sum) as bargain_sum";
......@@ -162,7 +162,7 @@ class PerformanceService
if (count($list) > 0) {
$result = $list[0];
}
}
}*/
break;
case 2: //案场
$house_id_arr = [];
......@@ -339,11 +339,11 @@ class PerformanceService
$params["district_id"] = $result[0]["district_id"];
}
$list = [];
//$list = [];
$now_date = date("Y-m-d", time());
//$now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {
// if ($start_time == $now_date && $end_time == $now_date) {
$verify = new VerifyService();
$agent_ids = $verify->getAgentsByAgentId($agent_id);
......@@ -353,7 +353,7 @@ class PerformanceService
$list = $this->sumDistrictPerformance($where_);
// dump($list);exit;
} else {
/* } else {
$field = "sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,
sum(performance) as performance,sum(official_receipts) as official_receipts,sum(look_at_num) as look_at_num,
sum(march_in_num) as march_in_num,sum(paylog) as paylog,sum(supervision_num) as supervision_num";
......@@ -365,7 +365,7 @@ class PerformanceService
if (count($list) > 0) {
$list = $list[0];
}
}
}*/
if (count($list) > 0) {
return $list;
......
......@@ -2,13 +2,8 @@
namespace app\api_broker\service;
use app\model\AAgents;
use app\model\ASuperviseModel;
use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OPayLogModel;
use app\model\OReportModel;
use app\model\TAgentTotalModel;
use app\model\Users;
......@@ -24,6 +19,8 @@ class PerformanceUtilService
{
private $totalModel;
private $agentModel;
private $agentsModel;
private $tAgentTotalModel;
private $houseModel;
private $userModel;
private $bargainModel;
......@@ -37,6 +34,8 @@ class PerformanceUtilService
{
$this->totalModel = new TAgentTotalModel();
$this->agentModel = new AAgents();
$this->agentsModel = new AAgents();
$this->tAgentTotalModel = new TAgentTotalModel();
$this->houseModel = new GHouses();
$this->userModel = new Users();
$this->bargainModel = new OBargainModel();
......@@ -47,22 +46,10 @@ class PerformanceUtilService
$this->superviseModel = new ASuperviseModel();
}
private function isExcuseToday($time) : bool {
$now_date = date("Y-m-d", time());
if ($time == $now_date) {
return true;
}
return false;
}
public function HouseNum($start_time,$end_time,$agent_ids)
public function HouseNum()
{
$is_today = $this->isExcuseToday($end_time);
if($is_today){
}
}
private function sumDistrictPerformance($params)
{
......
......@@ -698,7 +698,7 @@ class OBargainModel extends Model
->join("o_order b", "a.order_id = b.id", "left")
->where($where_)
->select();
//dump($this->getLastSql());
//echo $this->getLastSql();
return $return;
}
......
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