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.
yanzong/app/admin/controller/Feedback.php

92 lines
2.9 KiB

7 months ago
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\admin\controller;
use app\common\model\store\StoreSettle;
use app\api\service\User as UserService;
use think\response\Json;
use app\admin\model\Feedback as feedbackModel;
use app\common\model\UploadFile;
use app\common\model\Channel;
/**
* 意见反馈
* Class Store
* @package app\store\controller
*/
class Feedback extends Controller
{
/**
* @notes:新增文章
* @return Json
* @throws BaseException
* @author: wanghousheng
*/
public function add(): Json
{
$suggest = $this->request->post('suggest');
if (!$suggest) {
return $this->renderError('内容不能为空');
}
$data = $this->postData();
//$data['merchant_id'] = $this->merchantId;
if ((new feedbackModel)->add($data)) {
return $this->renderSuccess('添加成功');
}
return $this->renderError('添加失败');
}
7 months ago
public function edit(): Json
{
// 商城详情
$model = feedbackModel::detail($this->postForm()['feedback_id']);
// 更新记录
7 months ago
$data = [];
$data['answer'] = $this->postForm()['answer'];
$data['feedback_id'] = $this->postForm()['feedback_id'];
$data['deal_time'] = time();
7 months ago
if (!$model->edit($data)) {
7 months ago
return $this->renderError($model->getError() ?: '更新失败');
}
return $this->renderSuccess('更新成功');
}
7 months ago
/**
* 列表
*/
public function list(): Json {
$pageSize = $this->request->param('pageSize');
$pageSize = empty($pageSize) ? 15 : $pageSize;
$model = new feedbackModel;
$params = $this->request->param();
$list = $model->getList($params, intval($pageSize))->toArray();
foreach ($list['data'] as $kr => $r) {
7 months ago
$list['data'][$kr]['imgsInfo'] = [];
7 months ago
if ($r['imgs']) {
$img_ids = explode(",", $r['imgs']);
7 months ago
$files = UploadFile::getFileListBySuper($img_ids);
7 months ago
$list['data'][$kr]['imgsInfo'] = $files ?: null;
7 months ago
}
7 months ago
$list['data'][$kr]['deal_time'] = !empty($r['deal_time']) ? Date("Y-m-d H:i:s", $r['deal_time']) : '';
7 months ago
}
return $this->renderSuccess($list);
}
}