customers_620

This commit is contained in:
dengbw
2022-06-20 16:58:05 +08:00
committed by lccsw
parent ad78844a8b
commit cb55b4c512
7 changed files with 74 additions and 18 deletions
+15 -4
View File
@@ -23,25 +23,24 @@ class Customerlogs extends Wxapp
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model');
$this->load->model('receiver/receiver_comments_model', 'mdComments');
$this->load->model('receiver/receiver_xz_model');
}
protected function get()
{
$uid = $this->session['uid'];
$id = $this->input_param('id');
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 20;
$where = [
'customer_id' => $id
];
$count = $this->customer_oplogs_model->count($where);
$lists = [];
if ($count) {
$rows = $this->customer_oplogs_model->select($where, 'id desc', $page, $size, 'log,uname,type,c_time,imgs');
$rows = $this->customer_oplogs_model->select($where, 'id desc', $page, $size, 'id,log,uname,type,c_time,imgs');
foreach ($rows as $key => $val) {
$record = '';
$second = 0;
@@ -60,12 +59,24 @@ class Customerlogs extends Wxapp
$rec_row['rec_url'] && $record = $rec_row['rec_url'];
$rec_row['duration'] && $second = intval($rec_row['duration'] / 1000);
}
$comments = [];
$res = $this->mdComments->select(['pid' => $val['id'], 'status' => 1, 'type' => 0], 'id desc', 0, 0
, 'uname,content');
foreach ($res as $key2 => $val2) {
$comments[] = [
'uname' => $val2['uname'],
'content' => $val2['content']
];
}
$lists[] = [
'id' => $val['id'],
'content' => "{$val['uname']}" . $content,
'record_url' => $record,
'second' => $second,
'imgs' => $imgs,
'c_time' => date('Y.m.d', $val['c_time'])
'comments' => $comments,
'type_name' => $this->customer_oplogs_model->typeAry($val['type']),
'c_time' => date('Y.m.d H:i', $val['c_time'])
];
}
}
@@ -327,6 +327,34 @@ class Customers extends Wxapp
}
}
/**
* Notes:用户评论
* Created on: 2022/6/20 14:05
* Created by: dengbw
* @throws Exception
*/
protected function post_comments()
{
$pid = $this->input_param('id');
$content = $this->input_param('content');
if (!$pid) {
throw new Exception('参数错误', API_CODE_FAIL);
}
if (!$content) {
throw new Exception('请输入评论内容', API_CODE_FAIL);
}
$this->load->model('receiver/receiver_comments_model', 'mdComments');
$uid = $this->session['uid'];
$uname = $this->session['uname'];
$add_data = ['pid' => $pid, 'content' => $content, 'uid' => $uid, 'uname' => $uname, 'c_time' => time()];
$id = $this->mdComments->add($add_data);
if ($id) {
throw new Exception('评论成功', API_CODE_SUCCESS);
} else {
throw new Exception('评论失败', ERR_PARAMS_ERROR);
}
}
//客户跟进
protected function put()
{
+4 -5
View File
@@ -268,19 +268,18 @@ class HD_Model extends CI_Model {
$offset = null;
$limit = null;
}
$result = $this->db->get($this->table_name, $limit, $offset)->result_array();
$this->db->from($this->table_name);
$this->db->limit($limit, $offset);
$query = $this->db->get();
$result = $query ? $query->result_array() : [];
if($obj && file_exists($class = APPPATH.'libraries/entity/'.ucfirst($obj).'.php'))
{
require_once $class;
if(class_exists($obj))
{
$result = $this->db->get($this->table_name, $limit, $offset)->custom_result_object($obj);
}
}
return $result;
}
@@ -0,0 +1,19 @@
<?php
/**
* Notes:用户评论表
* Created on: 2022/6/20 10:31
* Created by: dengbw
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_comments_model extends HD_Model
{
private $table_name = 'lc_receiver_comments';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -21,14 +21,14 @@ class Receiver_customer_oplogs_model extends HD_Model
* Notes:类型
* Created on: 2022/4/12 16:51
* Created by: dengbw
* @param int $id
* @param string $id
* @return array|mixed
*/
public function typeAry($id = 0)
public function typeAry($id = '')
{
$arr = [0 => '小记', 1 => '发短信', 2 => '拨打号码', 3 => '创建', 4 => '到店', 5 => '试驾', 6 => '订单', 7 => '战败'
, 8 => '企微跟进', 9 => '系统'];
if ($id) {
if (strlen($id)) {
return $arr[$id];
} else {
return $arr;
@@ -20,7 +20,7 @@ class Receiver_owners_oplogs_model extends HD_Model
* Notes:类型
* Created on: 2022/6/15 16:51
* Created by: dengbw
* @param int $id
* @param string $id
* @return array|mixed
*/
public function typeAry($id = '')
+4 -5
View File
@@ -235,19 +235,18 @@ class HD_Model extends CI_Model {
$offset = null;
$limit = null;
}
$result = $this->db->get($this->table_name, $limit, $offset)->result_array();
$this->db->from($this->table_name);
$this->db->limit($limit, $offset);
$query = $this->db->get();
$result = $query ? $query->result_array() : [];
if($obj && file_exists($class = APPPATH.'libraries/entity/'.ucfirst($obj).'.php'))
{
require_once $class;
if(class_exists($obj))
{
$result = $this->db->get($this->table_name, $limit, $offset)->custom_result_object($obj);
}
}
return $result;
}