You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
zhishifufei_php/application/institution/controller/kefu/Feedback.php

95 lines
3.2 KiB

<?php
// +----------------------------------------------------------------------
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\institution\controller\kefu;
use app\institution\controller\AuthController;
use app\admin\model\user\UserBill;
use service\JsonService as Json;
use app\admin\model\finance\FinanceModel;
use app\admin\model\merchant\MerchantFlowingWater;
use app\admin\model\merchant\MerchantBill;
use app\admin\model\merchant\Merchant;
use service\SystemConfigService;
use service\FormBuilder as Form;
use service\HookService;
use think\Url;
use app\admin\model\user\User;
use app\admin\model\user\UserExtract;
use app\admin\model\kefu\KefuModel;
use app\kefu\model\KefuFeedBackModel;
use think\Request;
use service\JwtService;
class Feedback extends AuthController
{
public function list()
{
return $this->fetch();
}
private function create_feedback_query($search = '', $start_time = '', $end_time = '')
{
$model = new KefuFeedBackModel;
return $model->where(function ($q) use ($search, $start_time, $end_time) {
if ($search) {
$q->where('real_name|phone|content', 'like', '%' . $search . '%');
}
if ($start_time && $end_time) {
$q->whereTime('add_time', 'between', [$start_time, $end_time]);
}
});
}
public function get_feedback_list($page = 1, $limit = 20, $search = '', $start_time = '', $end_time = '')
{
$count = $this->create_feedback_query($search, $start_time, $end_time)->count();
$data = $this->create_feedback_query($search, $start_time, $end_time)
->page($page, $limit)
->where('mer_id',$this->agent)
->order('id', 'desc')
->select();
return Json::successlayui(compact("count", "data"));
}
public function delete($id)
{
$feedback = KefuFeedBackModel::get($id);
if (!$feedback) return Json::fail("留言不存在!");
$feedback->delete();
return Json::successful("删除成功!");
}
public function mark($id)
{
$feedback = KefuFeedBackModel::get($id);
if (!$feedback) return Json::fail("留言不存在!");
$this->assign("feedback", $feedback);
return $this->fetch();
}
public function save_mark($id, $status = 0, $mark = '')
{
$feedback = KefuFeedBackModel::get($id);
if (!$feedback) return Json::fail("留言不存在!");
if (!$mark) return Json::fail("请输入备注!");
$feedback->status = $status == 0 ? 0 : 1;
$feedback->mark = $mark;
$feedback->save();
return Json::successful("保存成功!");
}
}