Commit 7d8e7c47 authored by zw's avatar zw

bug

parent 0cb2bb2a
......@@ -20,21 +20,30 @@ class UPhoneFollowUpTemporary extends BaseModel
function __construct($site_id)
{
$date = date("Y-m-d", time());
$t_follow_up_task = new FollowUpTask();
if(!$t_follow_up_task->isExistTable($date, $site_id)){
return false;
}
$this->follow_up = Db($this->table."_".$site_id."_".$date);
$this->siteId = $site_id;
$this->table_name_string = '`'.$this->table."_".$site_id."_".$date.'`';
}
public function createTable(){
$date = date("Y-m-d", time());
$t_follow_up_task = new FollowUpTask();
if(!$t_follow_up_task->isExistTable($date, $this->siteId)){
return false;
}
return true;
}
/**
* 新增电话跟进-插入数据
* @param $params
* @return int|string
*/
public function savePhoneFollow($params) {
if(!$this->createTable()){
return null;
}
$arr = [];
if (isset($params["content"])) {
$arr["content"] = $params["content"];
......@@ -92,6 +101,9 @@ class UPhoneFollowUpTemporary extends BaseModel
}
public function getFollowList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
if(!$this->createTable()){
return null;
}
return $this->follow_up->field($field)
->where($params)
->order($order_)
......@@ -110,6 +122,9 @@ class UPhoneFollowUpTemporary extends BaseModel
* @return int|string
*/
public function insertDefaultFollow($agent_id, $user_id, $content, $type) {
if(!$this->createTable()){
return null;
}
$data['agent_id'] = $agent_id;
$data['user_id'] = $user_id;
$data['content'] = $content;
......@@ -125,6 +140,9 @@ class UPhoneFollowUpTemporary extends BaseModel
*/
public function getFollowTotal($params)
{
if(!$this->createTable()){
return null;
}
return $this->follow_up->where($params)
->count();
}
......@@ -135,6 +153,9 @@ class UPhoneFollowUpTemporary extends BaseModel
*/
public function getPhoneFollowData($field,$params,$order)
{
if(!$this->createTable()){
return null;
}
$result = $this->follow_up
->field($field)
->order($order)
......@@ -146,6 +167,9 @@ class UPhoneFollowUpTemporary extends BaseModel
}
public function getFollowListV2($site_id,$pageNo = 1, $pageSize = 15, $where, $filed = '`id`, `user_id`, `create_time`, `content`, `user_status`, `labels_id`, `agent_id`') {
if(!$this->createTable()){
return null;
}
$start_index = ($pageNo - 1) * $pageSize;
$sql = "SELECT * FROM
((SELECT
......@@ -167,6 +191,9 @@ class UPhoneFollowUpTemporary extends BaseModel
}
public function getFollowListV3($site_id,$pageNo = 1, $pageSize = 15, $where, $filed = '`id`, `user_id`, `create_time`, `content`, `user_status`, `labels_id`, `agent_id`') {
if(!$this->createTable()){
return null;
}
$sql = Db::table('u_phone_follow_up_'.$site_id)->field($filed)->where($where)->buildSql();
$sql_string = $this->table($this->table_name_string)->field($filed)->where($where)->union([$sql], true)->buildSql();
$data = Db::table($sql_string. ' a')
......@@ -179,6 +206,9 @@ class UPhoneFollowUpTemporary extends BaseModel
}
public function getUserFollowKey($field, $where, $order = 'id asc') {
if(!$this->createTable()){
return null;
}
return $this->UPhoneFollowUp->where($where)
->order($order)
->value($field);
......
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