Commit 8481d1f5 authored by hujun's avatar hujun

楼盘报备

parent 36c3d883
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
namespace app\model;
/**
* Created by PhpStorm.
* User: zw
* Date: 2017/12/21
* Time: 14:41
*/
use think\Db;
use think\Model;
class OfficeFollowUpLogModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'office_o_follow_up_log';
private $db_;
function __construct()
{
$this->db_ = Db::name($this->table);
}
/**
* 新增跟进
* @param $params
* @return int
*/
public function addFollowUpLog($params)
{
$params["create_time"] = date("Y-m-d H:i:s", time());
$params["update_time"] = date("Y-m-d H:i:s", time());
Db::startTrans();
try {
$this->db_->insert($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 获取跟进数据
* @param $field_
* @param $where_
* @param $order_
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectFollowUpList($field_, $where_, $order_)
{
if (isset($where_["agent_id"])) {
$data = $this->db_
->field($field_)
->where($where_)
->order($order_)
->select();
} else {
$data = $this->db_
->field($field_)
->where($where_)
->order($order_)
->limit(1)
->select();
}
return $data;
}
/**
* 查询跟进记录
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectFollowUpListByReportId($field, $params)
{
$where_ = [];
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
return $this->db_
->field($field)
->where($where_)
->select();
}
public function getFollowUpByOrderId($field,$params){
$where_ = [];
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
return Db::table($this->table)
->field($field)
->alias("a")
->join("a_agents b","a.agent_id = b.id","left")
->join("a_store c","b.store_id = c.id","left")
->join("o_report d","a.report_id = d.id","left")
->where($where_)
->select();
}
/**
* 获取经纪人新增带看数量
* @param $params
* @return int|string
*/
public function getAddFollowUpNumByAgentId($params){
$where_ = [];
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_
->where($where_)
->count();
}
}
\ No newline at end of file
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