Commit 2f33d47a authored by clone's avatar clone

Merge branch '0618-v3.3.2' of https://gitee.com/zwyjjc/tl_estate into 0618-v3.3.2

parents 4d0b9d32 37a47b62
......@@ -39,7 +39,7 @@ class Statement extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// big_log('日报周报获取新增数据-dayStatement');
big_log($params);
// big_log(json_encode($params));
if (!isset($params["agent_id"]) || !isset($params["time_start"]) || !isset($params["time_end"])) {
return $this->response("101", "请求参数错误");
......@@ -248,18 +248,19 @@ class Statement extends Basic
$field = "id,store_id,district_id,level,name,phone,sex,status";
$agentModel = new AAgents();
$agent_result = $agentModel->getAgentById($field, [ "agent_id" => $params["agent_id"] ]);
if(!$agent_result){
return $this->response("200", "request is null");
}
$store_id = $agent_result[0]["store_id"];
$district_id = $agent_result[0]["district_id"];
switch ($agent_result[0]["level"]) {
case 10:
#业务员
$agent_level = 0;
$result = $this->service_->selectStatementForClerk($params["agent_id"],$this->siteId);
$result = $this->service_->selectStatementForClerk($params["agent_id"], $agent_level, $store_id,
$district_id);
break;
case 20:
#店长
......@@ -276,8 +277,7 @@ class Statement extends Basic
#总监
$agent_level = 2;
if($params["type"] == 0 ){ #日报
$result = $this->service_->selectStatementForDistrictWithDay($params["agent_id"], $agent_level,
$store_id,$district_id);
$result = $this->service_->selectStatementForDistrictWithDay($agent_level, $district_id);
}else{ #周报
$result = $this->service_->selectStatementForDistrictWithWeek($params["agent_id"], $agent_level,
$store_id,$district_id);
......
......@@ -275,7 +275,7 @@ class User extends Basic
$return_user_list[$k]['user_phone'] = substr_replace($return_user_list[$k]['user_phone'], '****', 3, 4);
$return_user_list[$k]['site_ids_name'] = $user_service->userSiteName($v["site_ids"]);
$return_user_list[$k]['user_name'] = $v['user_name'] && $v['entrust_type'] == 0 ?"[{$v['concrete_industry']}]{$v['user_name']}":$v['user_name'];
$return_user_list[$k]['user_name'] = $v['user_name'] && $v['entrust_type'] == 0 ?"{$v['concrete_industry']},{$v['user_name']}":$v['user_name'];
}
......@@ -844,7 +844,7 @@ class User extends Basic
}
$s_index_user = new UserService();
//新增
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']);
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id'],$this->agentId);
if ($add_res === true) {
return $this->response("200", "绑定成功");
} else {
......
......@@ -31,6 +31,7 @@ class StatementService
private $reportModel;
private $marchInModel;
private $bargainModel;
private $partialCommission;
const USER_LEVEL_FIST = 0; //经纪人
const USER_LEVEL_SECOND = 1; //店长
......@@ -46,6 +47,7 @@ class StatementService
$this->reportModel = new OReportModel();
$this->marchInModel = new OMarchInModel();
$this->bargainModel = new OBargainModel();
$this->partialCommission = new OPartialCommission();
}
......@@ -183,8 +185,7 @@ class StatementService
$performanceSum = $this->bargainModel->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$result["performance_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$m_partial = new OPartialCommission();
$real_performanceSum = $m_partial->getReceived($where_);
$real_performanceSum = $this->partialCommission->getReceived($where_);
$result["real_performance_month"] = isset($real_performanceSum[0]["num"]) ? $real_performanceSum[0]["num"] : 0;
//本周业绩
......@@ -247,7 +248,7 @@ class StatementService
$end_time = $start_time;
$where_["agent_id"] = $agent_id;
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// dump($where_);
// dump($where_);
$performanceSum = $this->bargainModel->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$result["bargain_sum_store"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
......@@ -259,8 +260,8 @@ class StatementService
$where_["agent_id"] = $agent_id;
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
//dump($where_);
// $reportNum = $this->reportModel->getAddReportNum($where_);
// $result["look_at_num_day_store"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
// $reportNum = $this->reportModel->getAddReportNum($where_);
// $result["look_at_num_day_store"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$result["look_at_num_day_store"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
......@@ -293,7 +294,7 @@ class StatementService
$where_ = [];
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
// $where_["district_id"] = $district_id;
// $where_["district_id"] = $district_id;
$where_["agent_id"] = $conditions["agent_id"];
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
......@@ -337,7 +338,7 @@ class StatementService
$where_ = [];
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
// $where_["district_id"] = $district_id;
// $where_["district_id"] = $district_id;
$where_["agent_id"] = $conditions["agent_id"];
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
......@@ -404,7 +405,7 @@ class StatementService
$where_['status'] =array( "in", '10, 11, 13, 20' );
$obargain = new OBargainModel();
// dump($where_);
// dump($where_);
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$store_list["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
......@@ -477,7 +478,7 @@ class StatementService
foreach ($results as $key => $value) {
// dump($value);
// dump($value);
$last_week_total += $value["agent_num"];
$paramArr["store_id"] = $value["store_id"];
$paramArr["level"] = array( "in", [ 20, 40 ] );
......@@ -572,57 +573,54 @@ class StatementService
}
/**
* 查询业务员日报数据
* @param $agent_id
* @param $site_id
* @return mixed
* @param $agent_level
* @param $store_id
* @param $district_id
* @return mixed user 朱伟
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=698
*/
public function selectStatementForClerk($agent_id, $site_id)
public function selectStatementForClerk($agent_id, $agent_level, $store_id, $district_id)
{
$time_ = date("Y-m-d", time());
$conditions['agent_id'] = $agent_id;
$conditions['create_time'] = array( 'between', array( $time_ . " 00:00:00", $time_ . " 23:59:59" ) );
/*** 日数据 **/
// 房源
$result["house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源
$result["user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
$result["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions);
// 带看 (报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//跟进
$m_phone_follow_up = new UPhoneFollowUpTemporary($site_id);
$result["phone_follow_up_num"] = $m_phone_follow_up->getFollowTotal($conditions);
/*** 月数据 **/
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$result["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 本月-业绩
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// 房源
$result["month_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源
$result["month_user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
// 带看 (报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["month_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$result["month_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//成交单数
$result["performance_for_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 本月-成交单数
$performanceSum = $this->bargainModel->getAddBargainNumV2($conditions, 3);//1表示业绩 2表示实收
$result["month_bargain_sum"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$result["bargain_sum_for_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
return $result;
}
/**
* 店长日报 6666666
* 店长日报 2019年06月17日 线上
* @param $agent_id
* @param $agent_level
* @param $store_id
......@@ -634,11 +632,10 @@ class StatementService
{
$time_ = date("Y-m-d", time());
$agent_res = $this->getAgentIDsByDistrictId($store_id,$agent_level,0);
$agent_res = $this->getAgentIDsByDistrictId($store_id,$agent_level);
############################## 当日数据 ################################################
$conditions['agent_id'] = array( "in", $agent_res['agent_ids'] );
$conditions['create_time'] = array( 'between', array( $time_ . " 00:00:00", $time_ . " 23:59:59" ) );
// 房源
$result["team_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
......@@ -648,13 +645,13 @@ class StatementService
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["team_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$performanceSum = $this->bargainModel->getAddBargainNumV3($conditions, 1);//1表示业绩 2表示实收
$result["team_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 实收
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 2);//1表示业绩 2表示实收
$result["team_real_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$real_performanceSum = $this->partialCommission->getReceived($conditions);
$result["team_real_performance"] = isset($real_performanceSum[0]["num"]) ? $real_performanceSum[0]["num"] : 0;
// 本月-业绩
############################## 本月数据 ################################################
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
......@@ -667,19 +664,16 @@ class StatementService
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["team_month_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$performanceSum = $this->bargainModel->getAddBargainNumV3($conditions, 1);//1表示业绩 2表示实收
$result["team_month_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 实收666666666666
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 2);//1表示业绩 2表示实收
$result["team_month_real_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 实收
$real_performanceSum = $this->partialCommission->getReceived($conditions);
$result["team_month_real_performance"] = isset($real_performanceSum[0]["num"]) ? $real_performanceSum[0]["num"] : 0;
// 本月-成交单数
$performanceSum = $this->bargainModel->getAddBargainNumV2($conditions, 3);//1表示业绩 2表示实收
$result["team_month_bargain_sum"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
/**查询店长个人数据**/
#店长个人
############################## 店长个人数据 ################################################
$time_ = date("Y-m-d", time());
$conditions['agent_id'] = $agent_id;
$conditions['create_time'] = array( 'between', array( $time_ . " 00:00:00", $time_ . " 23:59:59" ) );
......@@ -697,7 +691,7 @@ class StatementService
$result["self_phone_follow_up_num"] = $m_phone_follow_up->getFollowTotal($conditions);
/**查询店长旗下业务员数据**/
$agent_res = $this->getAgentIDsByDistrictId($store_id,$agent_level,1);
foreach ($agent_res['store_list'] as $k => $v) {
$conditions['agent_id'] = $v["id"];
// 房源
......@@ -708,7 +702,7 @@ class StatementService
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$agent_res['store_list'][$k]["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$performanceSum = $this->bargainModel->getAddBargainNumV3($conditions, 1);//1表示业绩 2表示实收
$agent_res['store_list'][$k]["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
}
$result["store_list"] = $agent_res['store_list'];
......@@ -806,34 +800,35 @@ class StatementService
}
/**
* 查询总监日报数据
* @param $agent_id
* 总监日报 2019年06月28日 线上
* @param $agent_level
* @param $store_id
* @param $district_id
* @return mixed
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=701
*/
public function selectStatementForDistrictWithDay($agent_id, $agent_level, $store_id, $district_id)
public function selectStatementForDistrictWithDay($agent_level, $district_id)
{
$agent_res = $this->getAgentIDsByDistrictId($district_id,$agent_level);
$agent_res = $this->getAgentIDsByDistrictId($district_id, $agent_level, 0);
$conditions['agent_id'] = array( "in", $agent_res['agent_ids'] );
// 本月-业绩
############################## 本月数据 ###############################################
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$result["performance_for_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNumV3($conditions, 1);//1表示业绩 2表示实收
$result["district_month_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 实收
$real_performanceSum = $this->partialCommission->getReceived($conditions);
$result["district_month_real_performance"] = isset($real_performanceSum[0]["num"]) ? $real_performanceSum[0]["num"] : 0;
// 本月-成交单数
$performanceSum = $this->bargainModel->getAddBargainNumV2($conditions, 3);//1表示业绩 2表示实收
$result["bargain_sum_for_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$result["district_month_bargain_sum"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//人数
$agent_res = $this->getAgentIDsByDistrictId($district_id, $agent_level, 1);
$result["district_team_num"] = $agent_res['store_list_num'];
return $result;
}
......@@ -965,9 +960,10 @@ class StatementService
* 查询门店或者区域下所有经纪人id
* @param $district_or_store_id
* @param $type
* @return string
* @param int $agent_list_type
* @return mixed
*/
public function getAgentIDsByDistrictId($district_or_store_id,$type)
public function getAgentIDsByDistrictId($district_or_store_id,$type,$agent_list_type=0)
{
//查询总监下面门店的所有经纪人
$params = [];
......@@ -976,12 +972,18 @@ class StatementService
}else{
$params["district_id"] = $district_or_store_id;
}
$params["status"] = 0; //只查询正常状态的经纪人
if($agent_list_type == 0){//业绩统计 需要包括 0正常 1长假 2离职
$params["status"] = array('in','0,1,2');
}else{//员工列表只显示 0正常
$params["status"] = 0;
}
$agentModel = new AAgents();
$agentsArr = $agentModel->getAgentsByStoreId($params);
$agent_total = count($agentsArr);
$agentIds = "";
if ($agent_total > 0) {
$agentIds = "";
foreach ($agentsArr as $key1 => $value1) {
$agentIds .= $value1["id"] . ",";
}
......
......@@ -15,11 +15,11 @@ class ChatVerifyValidate extends Validate
{
/**
* $target_type = $params['target_type']; // 消息类型 users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息
* $target_type = $params['target_type']; // 消息类型 users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息
* $target = $params['target']; //接受人 if target_type 群 者表示群id
* $source = $params['source']; //消息来源 1c端app 2b端app 3其他
* $is_user = $params['is_user']; //发送人是否是会员 0是1经济人
* $type = $params['type']; //消息类型 1文字 2图片 3楼盘 4经纪人
* $type = $params['type']; //消息类型 1文字 2图片 3楼盘 4客户 5 办公楼
* $msg_content = $params['msg_content'];
* $from = $params['from']; //消息发送人
* @var array
......@@ -29,7 +29,7 @@ class ChatVerifyValidate extends Validate
'target' => 'require',
'source' => 'require|in:1,2,3',
'is_user' => 'require|in:0,1',
'type' => 'require|in:1,2,3,4',
'type' => 'require|in:1,2,3,4,5',
'msg_content' => 'require',
'from' => 'require',
];
......
......@@ -2791,7 +2791,7 @@ class Finance extends Basic
if (!empty($where)) {
//获取被修改人信息
$m_agent = new AAgents();
$agent_data = $m_agent->agentBargainOfficeAll('a.id,a.store_id,a.district_id,d.income_time,b.create_time', $where);
$agent_data = $m_agent->agentBargainAll('a.id,a.store_id,a.district_id,d.income_time,b.create_time', $where);
foreach ($agent_data as $k=>$v) {
$income_time = date('Y-m-d', strtotime($v['income_time']));
$create_time = date('Y-m-d', strtotime($v['create_time']));
......
......@@ -615,7 +615,7 @@ class Member extends Basic{
}
$s_index_user = new UserService();
//新增
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']);
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id'],$this->userId);
if ($add_res === true) {
return $this->response("200", "绑定成功");
} else {
......
......@@ -65,7 +65,7 @@ class OfficeFinance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$where = [];
// $where['a.confirm_status'] = 1;
$where['a.confirm_status'] = 1;
$where['a.is_del'] = $select = 0;
$where['b.status'] = ['in','10,11,13'];
......
......@@ -698,6 +698,10 @@ class OfficeRoomService
$result['is_collect'] = $this->isCollect($result['id'], $agent_id);
//是否可编辑
$result['is_can_edit'] = $this->isCanEdit($result['id'], $agent_id);
//微信分享图 原来的随机图
$external_image = $this->getCarouselImageByOne($result['id'], 2);
$result['external_image'] = $external_image ? $external_image['image_path'] : null;
return ['status' => 200, 'msg' => 'success', 'data' => $result];
}
......
......@@ -240,7 +240,7 @@ class UserLogService
if (count($result) <= 0) {
return ["code" => 101, "msg" => "没找到此条用户信息"];
}
$result['user_name'] = $result['user_name']&& $result['entrust_type'] == 0 ?"[{$result['concrete_industry']}]{$result['user_name']}":$result['user_name'];
$result['user_name'] = $result['user_name']&& $result['entrust_type'] == 0 ?"{$result['concrete_industry']},{$result['user_name']}":$result['user_name'];
$result['user_pic'] = !empty($result["user_pic"]) ? HEADERIMGURL . $result["user_pic"] : $result["other_pic"];
#判断是否纯房东 0:否 1:是
......
......@@ -714,7 +714,7 @@ class UserService
* @param $bind_id
* @return int
*/
public function addUserBind($user_id,$bind_id){
public function addUserBind($user_id,$bind_id,$agent_id){
if(!$user_id or !$bind_id){
return '参数不全';
}
......@@ -752,7 +752,8 @@ class UserService
$params_['bind_id'] = $params_bind_id;
$res = $this->user->updateUsers($params_user_id,$params_);
if($res ==1){
$this->userDoLog($user_id,$params_user_id,$params_bind_id,1);
$this->userDoLog($params_user_id,$params_bind_id,$agent_id,1);
$this->userDoLog($params_bind_id,$params_user_id,$agent_id,1);
$redis_service = new RedisCacheService();
$redis_service->userCache($user_id);
return true;
......@@ -761,6 +762,22 @@ class UserService
}
}
/**
* 记录操作日志
* @param $user_id
* @param $remove_bind_id
* @param $agent_id
* @param int $type
*/
private function userDoLog($user_id, $remove_bind_id,$agent_id,$type=0)
{
$records = new GOperatingRecords();
$remark = '与ID: '.$remove_bind_id.'解除绑定关系';
if($type == 1){
$remark = '与ID: '.$remove_bind_id.'添加绑定';
}
$records->record($agent_id, 8, $remark, '',$user_id);
}
/**
* 解除绑定关系
* @param $now_user_id //当前详情页客户
......@@ -805,6 +822,9 @@ class UserService
return 0;
}
/**
* 客户绑定详情
* @param $user_id
......@@ -831,21 +851,6 @@ class UserService
return $user_info_list;
}
/**
* 记录操作日志
* @param $id
* @param $remove_bind_id
* @param $agent_id
*/
private function userDoLog($id, $remove_bind_id,$agent_id,$type=0)
{
$records = new GOperatingRecords();
$remark = '与ID: '.$remove_bind_id.'解除绑定关系';
if($type == 1){
$remark = '与ID: '.$remove_bind_id.'添加绑定';
}
$records->record($agent_id, 8, $remark, '',$id);
}
/**
......
......@@ -640,7 +640,7 @@ class OBargainModel extends Model
if (isset($params["create_time"])) {
$where_["c.income_time"] = $params["create_time"];
}
$where_["a.status"] = array( "in", "10,11,13" );
return Db::table($this->table)
->field($field)
->alias("a")
......@@ -825,6 +825,45 @@ class OBargainModel extends Model
->select();
return $return;
}
public function getAddBargainNumV3($params, $type)
{
$where_ = [];
$field = "";
$join = [];
if ($type == 1) {
$field = "sum(scale_fee) as num";
$where_["a.status"] = array( "in", '10,11,13');
} elseif ($type == 2) {
$field = "sum(practical_fee) as num";
} elseif ($type == 3) {
$field = "count(1) as num";
$where_["a.role"] = 3;//必须是反签方1
$where_["a.status"] = array( "in", '10,11,13');
}
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
array_push($join, [ ' o_order b', 'a.order_id = b.id', 'left' ]);
}
$return = Db::table($this->table)
->field($field)
->alias("a")
->join($join)
->where($where_)
->select();
return $return;
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
......@@ -1367,7 +1406,6 @@ class OBargainModel extends Model
->field($filed)
->alias("a")
->join("o_partial_commission b", "a.id = b.bargain_id", "left")
->join("o_real_income c", "b.real_income_id = c.id", "left")
->where($where_)
->whereOr($whereOr_)
->order("a.id asc")
......@@ -1453,15 +1491,15 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
->order("Obargain.create_time desc")
->limit($pageSize)
->page($pageNo)
->select();
//echo $this->db_->getLastSql();
//echo $this->db_->getLastSql();
return $result;
}
......@@ -1474,8 +1512,8 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
->order("Obargain.create_time desc")
......@@ -1493,8 +1531,8 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
->order("Obargain.create_time desc")
......@@ -1517,8 +1555,8 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
......@@ -1588,7 +1626,7 @@ class OBargainModel extends Model
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$params["a.role"] = 3;//必须是反签方
$params['c.shop_type'] = $type == 0 ? 0 : 1;
// dump($params);
// dump($params);
$return = Db::table($this->table)
->field($field)
->alias("a")
......@@ -1632,24 +1670,6 @@ class OBargainModel extends Model
->select();
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentBargainIncome($field, $where) {
return $this->db_->alias('a')
->field($field)
->join('a_agents b', 'a.agent_id = b.id', 'left')
->join('office_o_partial_commission c', 'a.id = c.bargain_id', 'left')
->join('office_o_real_income d', 'c.real_income_id = d.id', 'left')
->where($where)
->select();
}
/**
* @param $field
* @param $where
......
......@@ -42,6 +42,7 @@ class OPartialCommission extends BaseModel
->limit($pageSize)
->page($pageNo)
->select();
big_log($this->getLastSql());
$m_agent = new AAgents();
$fields_str = 'a.id,a.name,a.phone,b.store_name';
foreach ($data as $k => $v) {
......
......@@ -147,7 +147,7 @@ class ORealIncome extends BaseModel
$params['a.is_del'] = 0;
return $this->field($field)
->alias('a')
->join('office_o_partial_commission b', 'a.id = b.real_income_id', 'left')
->join('o_partial_commission b', 'a.id = b.real_income_id', 'left')
->join('a_agents c', 'b.agent_id = c.id', 'left')
->where($params)
->select();
......
......@@ -191,11 +191,11 @@ define(['doT', 'text!temp/inspectionRecordAllOffice_list_template_tpl.html', 'cs
$("#is_show_store").hide();
}
if (!check_auth('index/inspectionRecordDistrict/2')) {
if (!check_auth('office_index/inspectionRecordDistrict/2')) {
$("#is_show_district").hide();
}
if (!check_auth('index/inspectionRecordAll/3')) {
if (!check_auth('office_index/inspectionRecordAll/3')) {
$("#is_show_all").hide();
}
$("#our").click(function () {
......
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