Commit 7c9823db authored by clone's avatar clone

业绩

parent 3c954e64
...@@ -64,13 +64,18 @@ class Performance extends Basic ...@@ -64,13 +64,18 @@ class Performance extends Basic
"agent_id" => 1, "agent_id" => 1,
"start_time" => "2018-03-23", "start_time" => "2018-03-23",
"end_time" => "2018-03-23", "end_time" => "2018-03-23",
"is_case" => 1,//1经纪人 2案场 "is_case" => 2,//1经纪人 2案场
"house_id" => 22
); );
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"])) { if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$house_id = 0;
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"], $params["is_case"]); if (isset($params["house_id"])) {
$house_id = $params["house_id"];
}
$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); return $this->response("200", "request success", $result);
} }
......
...@@ -136,30 +136,52 @@ class PerformanceService ...@@ -136,30 +136,52 @@ class PerformanceService
} }
public function personagePerformance($agent_id, $start_time, $end_time, $is_case) public function personagePerformance($agent_id, $start_time, $end_time, $is_case,$house_id)
{ {
$field = "agent_id,sum(look_at_num) as look_at_num,sum(march_in_num) as march_in_num , sum(paylog) as paylog , $field = "agent_id,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"; sum(bargain_sum) as bargain_sum";
$result = []; $result = [];
if($is_case == 2 ){ //案场
$vService = new VerifyService(); switch ($is_case){
$house_id_arr = $vService->getAgentsByAgentId($agent_id); case 1:
$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);
} else {
$where_["agent_id"] = $agent_id;
$where_['total_time'] = array( 'between', array( $start_time, $end_time ) );
$list = $this->totalModel->personagePerformance($field, $where_);
if (count($list) > 0) {
$result = $list[0];
}
}
break;
case 2: //案场
if($house_id > 0){ // 如果有传楼盘id证明是筛选
$condition["house_ids"] = $house_id;
}else{
$vService = new VerifyService();
$house_id_arr = $vService->getCaseHouseIdByAgentId($agent_id);
$ids = "";
foreach ($house_id_arr as $item){
$ids .= $item["houses_id"] .",";
}
$ids = rtrim($ids, ",");
$condition["house_ids"] = $ids;
}
$condition['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$result = $this->nowTimeSum($condition);
if(count($result) > 0 ){
$result["house_arr"] = $house_id_arr;
}
break;
} }
$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);
} else {
$where_["agent_id"] = $agent_id;
$where_['total_time'] = array( 'between', array( $start_time, $end_time ) );
$list = $this->totalModel->personagePerformance($field, $where_);
if (count($list) > 0) {
$result = $list[0];
}
}
if (count($result) > 0) { if (count($result) > 0) {
return $result; return $result;
} else { } else {
......
...@@ -59,11 +59,12 @@ class VerifyService ...@@ -59,11 +59,12 @@ class VerifyService
public function getCaseHouseIdByAgentId($agent_id) public function getCaseHouseIdByAgentId($agent_id)
{ {
$houseToAgentModel = new GHousesToAgents(); $houseToAgentModel = new GHousesToAgents();
$params["agents_id"] = $agent_id; $params["a.agents_id"] = $agent_id;
$params["type"] = 1; //案场权限人 $params["a.type"] = 1; //案场权限人
$params["is_del"] = 0; $params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params);
$house_arr = $houseToAgentModel->getHouseByAgentId("houses_id", $params);
if (count($house_arr) > 0) { if (count($house_arr) > 0) {
return $house_arr; return $house_arr;
} }
......
...@@ -145,10 +145,15 @@ class GHousesToAgents extends BaseModel ...@@ -145,10 +145,15 @@ class GHousesToAgents extends BaseModel
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function getHouseByAgentId($field,$params){ public function getHouseByAgentId($field,$params){
return Db::name($this->table) $result = Db::name($this->table)
->field($field) ->field($field)
->alias("a")
->join("g_houses b","a.houses_id = b.id","left")
->where($params) ->where($params)
->select(); ->select();
echo Db::name($this->table)->getLastSql();
return $result;
} }
/** /**
......
...@@ -329,14 +329,20 @@ class OBargainModel extends Model ...@@ -329,14 +329,20 @@ class OBargainModel extends Model
$field = "count(1) as num"; $field = "count(1) as num";
if(isset($params["agent_id"])){ if(isset($params["agent_id"])){
$where_["agent_id"] = $params["agent_id"]; $where_["a.agent_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -100,13 +100,18 @@ class OMarchInModel extends Model ...@@ -100,13 +100,18 @@ class OMarchInModel extends Model
$field = "count(1) as num"; $field = "count(1) as num";
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if(isset($params["agent_id"])){
$where_["reception_id"] = $params["agent_id"]; $where_["a.reception_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -98,13 +98,18 @@ class OPayLogModel extends Model ...@@ -98,13 +98,18 @@ class OPayLogModel extends Model
$field = "count(1) as num"; $field = "count(1) as num";
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if(isset($params["agent_id"])){
$where_["agent_id"] = $params["agent_id"]; $where_["a.agent_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -167,12 +167,14 @@ class OReportModel extends Model ...@@ -167,12 +167,14 @@ class OReportModel extends Model
$where_["b.house_id"] = array("in",$params["house_ids"]); $where_["b.house_id"] = array("in",$params["house_ids"]);
} }
$where_["a.status"] = 0; $where_["a.status"] = 0;
return Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b","a.id = b.f_id","left")
->where($where_) ->where($where_)
->select(); ->select();
//echo Db::table($this->table)->getLastSql();
return $result;
} }
} }
\ No newline at end of file
<?php
//000000000000
exit();?>
s:36:"86a953c0-baf4-11e7-8d16-b9611e223e5e";
\ No newline at end of file
<?php
//000000000000
exit();?>
i:1517210994;
\ No newline at end of file
<?php
//000000000000
exit();?>
i:5184000;
\ No newline at end of file
<?php
//000000000000
exit();?>
s:130:"YWMtM3qCFgTGEeiq48OmjaoPWwAAAAAAAAAAAAAAAAAAAAGGqVPAuvQR540WuWEeIj5eAgMAAAFhQNKIogBPGgCgBPFRepsGUeewmkWAwIW9ScggRB9YqETjARTSkU5hXg";
\ No newline at end of file
<?php if (!defined('THINK_PATH')) exit(); /*a:5:{s:77:"C:\xampp\htdocs\tl_estate\public/../application/index\view\banner\banner.html";i:1517824281;s:80:"C:\xampp\htdocs\tl_estate\public/../application/index\view\global\frame_tpl.html";i:1517824281;s:81:"C:\xampp\htdocs\tl_estate\public/../application/index\view\global\header_tpl.html";i:1517824281;s:81:"C:\xampp\htdocs\tl_estate\public/../application/index\view\global\navigation.html";i:1517824281;s:81:"C:\xampp\htdocs\tl_estate\public/../application/index\view\global\footer_tpl.html";i:1517824281;}*/ ?>
<!DOCTYPE html>
<html lang="en-us">
<head>
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="/resource/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="/resource/css/public.css" type="text/css" />
<link rel="stylesheet" href="//qidian.gtimg.com/lulu/theme/peak/css/common/ui/Pagination.css">
<link rel="stylesheet" href="/resource/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/resource/css/bootstrap-datetimepicker.min.css">
<title>同联商业</title>
</head>
<body>
<div class="navbar" style="background: #ff9419 !important;">
<div class="container-fluid">
<a class="brand">
<i><img src="/resource/image/houtai_footer_icon1.png" class="houtai_footer_icon1"></i>
<span class="hidden-phone">同联商业后台管理中心</span>
</a>
</div>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
管理员vip
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a href="#">修改密码</a></li>
<li role="separator" class="divider"></li>
<li><a href="/index/logout">退出登录</a></li>
</ul>
</div>
</div>
<div id="wrapper">
<nav class="navbar navbar-inverse" id="sidebar-wrapper" role="navigation">
<ul class="nav sidebar-nav">
<!--便于后期更改使用-->
<!--<li class="sidebar-brand">-->
<!--<a href="#">-->
<!--Bootstrap 3-->
<!--</a>-->
<!--</li>-->
<!--<li class="dropdown">-->
<!--<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-fw fa-plus"></i> Dropdown <span class="caret"></span></a>-->
<!--<ul class="dropdown-menu" role="menu">-->
<!--<li class="dropdown-header">Dropdown heading</li>-->
<!--<li><a href="#">Action</a></li>-->
<!--<li><a href="#">Another action</a></li>-->
<!--<li><a href="#">Something else here</a></li>-->
<!--<li><a href="#">Separated link</a></li>-->
<!--<li><a href="#">One more separated link</a></li>-->
<!--</ul>-->
<!--</li>-->
<li role="presentation" class="active">
<a href="/admin.php/index/banner.html"> 首页轮播图</a>
</li>
<li role="presentation" class="active">
<a href="/admin.php/index/advertising"> 首页弹窗</a>
</li>
<li role="presentation">
<a href="/admin.php/index/users_list.html"> 用户列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/watch_shop.html"> 预约看铺列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/transfer_list.html"> 委托转铺列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/version.html"> 版本号管理</a>
</li>
<li role="presentation">
<a href="/admin.php/index/auth.html">角色管理</a>
</li>
<li role="presentation">
<a href="/admin.php/index/agent.html">经纪人列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/districtList.html">总监列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/authRuleIndex.html">权限管理</a>
</li>
<li role="presentation">
<a href="/admin.php/index/houseList.html">商铺列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/houseEdit.html">新增商铺</a>
</li>
<li role="presentation">
<a href="/admin.php/index/BusinessDistrict.html">商圈列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/editBusinessDistrict.html">编辑商圈</a>
</li>
</ul>
</nav>
<!-- 提示成功模态框(Modal) -->
<div class="successModel">
<div class="successModel-center">
<p>
<!--提交成功!-->
</p>
</div>
</div>
<!--<script>-->
<!--$(document).ready(function(),2000);//2秒后执行该方法-->
<!--});-->
<!--</script>-->
<input type="hidden" class="page-load" id="banner" />
<!--导航star-->
<!-- Sidebar -->
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="col-lg-10 col-lg-offset-0">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">首页轮播图</a></li>
<li class="active">新增广告</li>
<div class="pull-right">
<ul class="bread_btn">
<li>
<a href="#modal-add-do" data-toggle="modal" id="add_banner" class="btn btn-default"><i class="icon-plus"></i>
新增广告</a>
</li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>标题</th>
<th>图片</th>
<th>链接</th>
<th>排序</th>
<th>点击</th>
<th>修改人</th>
<th>操作</th>
</tr>
</thead>
<tbody id="banner_list">
</tbody>
</table>
<!-- /#page-content-wrapper -->
<div style="float:right" id="pagediv">
</div>
</div>
</div>
</div>
<input type="hidden" value="0" id="type" />
</div>
</div>
</div>
</div>
<script src='/resource/lib/js/require.min.js' data-main='/resource/js/main?version=123' charset='utf-8'></script>
</div>
</body>
</html>
<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:75:"C:\xampp\htdocs\tl_estate\public/../application/index\view\login\login.html";i:1517824281;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>同联地产管理后台</title>
<link rel="stylesheet" href="/resource/css/login.css" type="text/css"/>
</head>
<body>
<div class="main-container">
<div class="main-content">
<div class="login-container">
<div class="center">
<h1>
<i class="ace-icon fa fa-leaf green"></i>
<span class="red">同联地产</span>
<span class="white" id="id-text2">管理后台</span>
</h1>
</div>
<div class="loginbox">
<form action="/admin.php/index/loginVerify" method="post">
<div class="input-icon">
<input class="input-block" type="text" id="username" name="username" autofocus
placeholder="请输入用户名" maxlength="16" required>
</div>
<div class="input-icon">
<input class="input-block" type="password" id="passwd" name="passwd" placeholder="请输入登录密码"
maxlength="16" required>
<span style="color: #fff;display: block;text-align: center;font-size: 12px"><?php echo $msg; ?></span>
</div>
<div class="center" style="margin-top: 15px">
<button type="submit" style="background: #87b1ff;">立即登陆</button>
</div>
</form>
</div>
</div>
</div>
</div>
<canvas></canvas>
<script src="/resource/lib/js/jquery-2.0.3.min.js"></script>
<script src="/resource/js/login.js"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
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