Commit 33daad04 authored by zhuwei's avatar zhuwei

1

parent f1cc3988
......@@ -728,10 +728,51 @@ class Shop extends Basic
}
}
//独家方
// $result['exclusive_info'] = $this->getExclusiveInfo($result['id'], 3);
//案场权限人
$result['stronghold_info'] = $this->getExclusiveInfo($result['id']);
unset($result['external_image_id']);
return $this->response("200", 'request success', $result);
}
public function getExclusiveInfo($house_id)
{
// $m_agent_house = new GHousesToAgents();
// $exclusive_info = [];
// $params['a.houses_id'] = $house_id;
// $params['a.type'] = $type;
// $params['a.is_del'] = 0;
// $res = $m_agent_house->getAgentsHouses('b.id,name,a.type,b.phone', $params);
// if ($res) {
// $exclusive_info['name'] = $res[0]['name'];
// $exclusive_info['phone'] = $res[0]['phone'];
// } else {
// return null;
// }
// return $exclusive_info ;
$houseToAgentModel = new GHousesToAgents();
$params["a.houses_id"] = $house_id;
$params["a.type"] = array("in", '1'); //案场权限人,盘方和独家
$params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseNameByAgentId("b.name", $params);
$ids = "";
foreach ($house_arr as $item) {
$ids .= $item["name"] . ",";
}
$ids = rtrim($ids, ",");
if (!$ids) { //代表没有案场
return null;
}
return $ids;
}
/**
* 是否显示对内地址
* @param $panPartyArr
......
......@@ -309,6 +309,20 @@ class GHousesToAgents extends BaseModel
return $result;
}
public function getHouseNameByAgentId($field, $params)
{
$result = Db::name($this->table)
->field($field)
->alias("a")
->join('a_agents b', 'a.agents_id = b.id', 'left')
->where($params)
->group("houses_id")
->select();
//echo Db::name($this->table)->getLastSql();
return $result;
}
/**
* @param $field
* @param $params
......
<?php
namespace app\model;
use think\Db;
use think\Model;
class GReceiptOperatingRecords extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'g_receipt_operating_records';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
// public function saveReceiptOperatingRecord($data) {
// $time = date("Y-m-d H:i:s", time());
// $data['create_time'] = $time;
// $data['update_time'] = $time;
// $data['is_del'] = 0;
// return $this->db_ ->insert($data);
// }
//
// /**
// * 查询数据
// */
// public function getReceiptOperatingRecord($field,$params)
// {
// $params["a.is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->where($params)
// ->find();
// //echo $this->getLastSql();
// return $result;
// }
//
// /**
// * 查客方
// * @param $field
// * @param $params
// * @return array|false|\PDOStatement|string|Model
// */
// public function getReceiptOperatingRecordId($field,$params)
// {
// $params["is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('a_agents b', 'a.agent_id = b.id', 'left')
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
//
// public function selectReceiptOperatingRecord($field,$params)
// {
// $params["a.is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->join('a_site d', 'a.site_id = d.id', 'left')
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
//
// public function selectUser($field,$params)
// {
// $params["is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
// /**
// * 更新数据
// */
// public function updateReceiptOperatingRecord($where,$params)
// {
// $result = $this->db_ ->where($where)->update($params);
// //dump($this->getLastSql());
// return $result;
//
// }
//
// /**
// * @param $field
// * @param $params
// * @return array
// */
// public function getReceiptOperatingRecordColumn($field, $params) {
// $params['is_del'] = 0;
// return $this->db_->where($params)
// ->column($field);
// }
//
// /**
// * 统计客方
// * @param $params
// * @return false|\PDOStatement|string|\think\Collection
// * @throws \think\db\exception\DataNotFoundException
// * @throws \think\db\exception\ModelNotFoundException
// * @throws \think\exception\DbException
// */
// public function getAddUserNumGroupTimeNew($params)
// {
// $field = "count(1) as num";
// $where_['is_del'] = 0;
// if (isset($params["agent_id"])) {
// $where_["agent_id"] = $params["agent_id"];
// }
// if (isset($params["create_time"])) {
// $where_["create_time"] = $params["create_time"];
// }
// return $this->db_
// ->field($field)
// ->where($where_)
// ->select();
// }
//
// public function moveHouseInsertAll($data)
// {
// $result = Db::table($this->table)
// ->insertAll($data);
// return $result;
// }
//
// /**
// * @param $field
// * @param $where
// * @return false|\PDOStatement|string|\think\Collection
// */
// public function getAllData($field, $where)
// {
// $where['is_del'] = 0;
// return $this->db_->field($field)
// ->where($where)
// ->select();
// }
//
// public function getAddUserList($params, $field, $page_no, $page_size)
// {
// $where_ = [];
// if (isset($params["agent_id"])) {
// $where_["a.agent_id"] = $params["agent_id"];
// }
// if (isset($params["create_time"])) {
// $where_["a.create_time"] = $params["create_time"];
// }
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->where($where_)
// ->limit($page_size)
// ->page($page_no)
// ->select();
// return $result;
// }
}
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