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 {
......
......@@ -19,7 +19,7 @@ class ChatVerifyValidate extends Validate
* $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,8 +1491,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")
......@@ -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