This commit is contained in:
weiz 2024-05-14 10:55:06 +08:00
parent ba26f89ed8
commit ad0b0fc6a4
6 changed files with 21 additions and 8 deletions

View File

@ -26,7 +26,8 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array
{
return [
'=' => ['pid', 'name', 'data', 'pic', 'sort'],
'=' => ['pid', 'pic', 'sort'],
'%like%' => ['name','data']
];
}

View File

@ -5,6 +5,7 @@ namespace app\admin\lists\user;
use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\user\User;
use app\common\model\user\UserFeedback;
@ -47,7 +48,10 @@ class UserFeedbackLists extends BaseAdminDataLists implements ListsSearchInterfa
->field(['id', 'uid', 'content', 'images', 'name', 'contact'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->select()->each(function($data){
$user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty();
$data['user_name'] = !$user->isEmpty() ? $user['nickname'] : '';
})
->toArray();
}

View File

@ -25,6 +25,10 @@
public function add()
{
$params = (new UserFeedbackValidate())->post()->goCheck('add');
$user = $this->request->userInfo;
if($params['uid'] != $user['user_id']){
return $this->fail('用户信息错误');
}
$result = UserFeedbackLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);

View File

@ -48,13 +48,13 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
->where('pid', 0)
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->order(['sort' => 'desc','id' => 'desc'])
->select()->toArray();
}else{
$lists = Goodsclass::where($this->searchWhere)
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->order(['sort' => 'desc','id' => 'desc'])
->select()->toArray();
}
// ->each(function ($item) {

View File

@ -4,6 +4,7 @@
use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\user\User;
use app\common\model\user\UserFeedback;
class UserFeedbackLists extends BaseAdminDataLists implements ListsSearchInterface
@ -38,10 +39,13 @@
{
$uid = $this->request->userInfo['user_id'];
return UserFeedback::where($this->searchWhere)->where('uid',$uid)
->field(['id', 'uid', 'content', 'images', 'name', 'contact'])
->field(['id', 'uid', 'content', 'images', 'name', 'contact','create_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->select()->each(function($data){
$user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty();
$data['user_name'] = !$user->isEmpty() ? $user['nickname'] : '';
})
->toArray();
}

View File

@ -41,9 +41,9 @@ abstract class Server
if (empty($this->file)) {
throw new Exception('未找到上传文件的信息');
}
$this->file->extension = pathinfo($this->file->getUploadName(), PATHINFO_EXTENSION);
@$this->file->extension = pathinfo($this->file->getUploadName(), PATHINFO_EXTENSION);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$this->file->getMime = finfo_file($finfo, $this->file->getPathname());
@$this->file->getMime = finfo_file($finfo, $this->file->getPathname());
// 校验上传文件后缀
$limit = array_merge(config('project.file_image'), config('project.file_video'));
if (!in_array(strtolower($this->file->extension), $limit)) {