89 lines
2.3 KiB
PHP
89 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* 评价管理控制器
|
|
* Created by 北京捷讯佳音.
|
|
* User: sam
|
|
* Date: 2019/4/1
|
|
* Time: 15:04
|
|
*/
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
class Rate extends Base
|
|
{
|
|
|
|
// 获取 客服评价 - 客服列表
|
|
public function getKfList()
|
|
{
|
|
if(request()->isAjax()){
|
|
$user_name = input('user_name');
|
|
|
|
$count = 0;
|
|
$data = [];
|
|
$where = [];
|
|
if ($user_name !== '' && $user_name !== null) {
|
|
$where['u.user_name'] = ['LIKE', '%'.$user_name.'%'];
|
|
}
|
|
$list = db('kf_rate')->alias('r')->join('users u', 'u.id = r.kf_id')
|
|
->field('r.kf_id, u.user_name, u.rank_num, u.rate_num')
|
|
->where($where)->where($this->where)->group('r.kf_id')->paginate(20)->toArray();
|
|
|
|
if ($list) {
|
|
$count = $list['total'];
|
|
$data = $list['data'];
|
|
}
|
|
|
|
return json(['code' => 0, 'msg' => '获取成功', 'count' => $count, 'data'=> $data]);
|
|
}
|
|
|
|
return $this->fetch('kflist');
|
|
}
|
|
|
|
// 获取 客服评价列表
|
|
public function getRateList()
|
|
{
|
|
$kfId = input('kf_id');
|
|
|
|
if(request()->isAjax()){
|
|
$count = 0;
|
|
$data = [];
|
|
$where = [];
|
|
|
|
if (!$kfId) {
|
|
return json(['code' => 1, 'msg' => '获取失败', 'count' => $count, 'data'=> $data]);
|
|
}
|
|
|
|
$user_id = input('user_id');
|
|
$order_id = input('order_id');
|
|
$start = input('start');
|
|
$end = input('end');
|
|
|
|
$where['kf_id'] = $kfId;
|
|
if ($user_id) {
|
|
$where['user_id'] = $user_id;
|
|
}
|
|
if ($order_id) {
|
|
$where['order_id'] = $order_id;
|
|
}
|
|
if ($start && $end) {
|
|
$where['created_time'] = ['BETWEEN', [strtotime($start), strtotime($end . ' 23:59:59')]];
|
|
}
|
|
|
|
$list = db('kf_rate')->where($where)->paginate(20)->toArray();
|
|
|
|
if ($list) {
|
|
$count = $list['total'];
|
|
$data = $list['data'];
|
|
}
|
|
|
|
return json(['code' => 0, 'msg' => '获取成功', 'count' => $count, 'data'=> $data]);
|
|
}
|
|
|
|
$this->assign([
|
|
'kf_id' => $kfId
|
|
]);
|
|
|
|
return $this->fetch('getratelist');
|
|
}
|
|
} |