From 6a093d4e3e027a832f6b2d11df7094b7487f1ce7 Mon Sep 17 00:00:00 2001 From: hdm Date: Fri, 1 Jul 2022 11:53:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=AF=BB=E5=8F=96=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Index.php | 3 ++- app/article/model/Article.php | 27 +++++++++++++-------------- app/message/controller/Index.php | 10 +++++----- app/oa/controller/Work.php | 8 ++++---- app/project/controller/Task.php | 6 ++++-- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index b26a00a..b9027ea 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -278,11 +278,12 @@ class Index extends BaseController $exist = Db::query('show tables like "'.$prefix.'project"'); $res['data'] = []; if($exist){ + $project_ids = Db::name('ProjectUser')->where(['uid' => $this->uid, 'delete_time' => 0])->column('project_id'); $list = Db::name('Project') ->field('a.id,a.name,a.status,a.create_time,a.start_time,a.end_time,u.name as director_name') ->alias('a') ->join('Admin u', 'a.director_uid = u.id') - ->where([['a.delete_time','=',0]]) + ->where([['a.delete_time', '=', 0], ['a.id', 'in', $project_ids]]) ->order('a.id desc') ->limit(10) ->select()->toArray(); diff --git a/app/article/model/Article.php b/app/article/model/Article.php index 39ee551..27b0acd 100644 --- a/app/article/model/Article.php +++ b/app/article/model/Article.php @@ -17,21 +17,20 @@ class Article extends Model public function detail($id) { $article = Db::name('Article')->where(['id' => $id])->find(); - if (empty($article)) { - return $this->error('文章知识不存在'); - } - $keywrod_array = Db::name('ArticleKeywords') - ->field('i.aid,i.keywords_id,k.title') - ->alias('i') - ->join('Keywords k', 'k.id = i.keywords_id', 'LEFT') - ->order('i.create_time asc') - ->where(array('i.aid' => $id, 'k.status' => 1)) - ->select()->toArray(); + if (!empty($article)) { + $keywrod_array = Db::name('ArticleKeywords') + ->field('i.aid,i.keywords_id,k.title') + ->alias('i') + ->join('Keywords k', 'k.id = i.keywords_id', 'LEFT') + ->order('i.create_time asc') + ->where(array('i.aid' => $id, 'k.status' => 1)) + ->select()->toArray(); - $article['keyword_ids'] = implode(",", array_column($keywrod_array, 'keywords_id')); - $article['keyword_names'] = implode(',', array_column($keywrod_array, 'title')); - $article['user'] = Db::name('Admin')->where(['id' => $article['uid']])->value('name'); - $article['department'] = Db::name('Department')->where(['id' => $article['did']])->value('title'); + $article['keyword_ids'] = implode(",", array_column($keywrod_array, 'keywords_id')); + $article['keyword_names'] = implode(',', array_column($keywrod_array, 'title')); + $article['user'] = Db::name('Admin')->where(['id' => $article['uid']])->value('name'); + $article['department'] = Db::name('Department')->where(['id' => $article['did']])->value('title'); + } return $article; } diff --git a/app/message/controller/Index.php b/app/message/controller/Index.php index fb83ad9..027773c 100644 --- a/app/message/controller/Index.php +++ b/app/message/controller/Index.php @@ -190,7 +190,7 @@ class Index extends BaseController if ($id > 0) { $detail = Db::name('Message')->where(['id' => $id, 'from_uid' => $this->uid])->find(); if (empty($detail)) { - $this->error('该信息不存在'); + echo '
该信息不存在
';exit; } $fid = $detail['fid']; $person_name = []; @@ -244,10 +244,10 @@ class Index extends BaseController $type = empty(get_params('type')) ? 0 : get_params('type'); $detail = Db::name('Message')->where(['id' => $id, 'template' => 0])->find(); if (empty($detail)) { - $this->error('该信息不存在'); + echo '
该信息不存在
';exit; } if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) { - $this->error('该信息不存在'); + echo '
该信息不存在
';exit; } $sender = get_admin($detail['from_uid']); $detail['person_name'] = $sender['name']; @@ -274,10 +274,10 @@ class Index extends BaseController $id = $param['id']; $detail = Db::name('Message')->where(['id' => $id])->find(); if (empty($detail)) { - $this->error('该信息不存在'); + echo '
该信息不存在
';exit; } if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) { - $this->error('该信息不存在'); + echo '
该信息不存在
';exit; } Db::name('Message')->where(['id' => $id])->update(['read_time' => time()]); if($detail['from_uid']==0){ diff --git a/app/oa/controller/Work.php b/app/oa/controller/Work.php index 116ec13..26aca1c 100644 --- a/app/oa/controller/Work.php +++ b/app/oa/controller/Work.php @@ -141,7 +141,7 @@ class Work extends BaseController if ($id > 0) { $detail = Db::name('Work')->where(['id' => $id,'admin_id' => $this->uid])->find(); if (empty($detail)) { - $this->error('该汇报不存在'); + echo '
该汇报不存在
';exit; } $person_name = Db::name('Admin')->where('status', 1)->where('id', 'in', $detail['type_user'])->column('name'); $detail['person_name'] = implode(",", $person_name); @@ -171,14 +171,14 @@ class Work extends BaseController $id = $param['id']; $detail = Db::name('Work')->where(['id' => $id,'status' => 1])->find(); if (empty($detail)) { - $this->error('该汇报不存在'); + echo '
该汇报不存在
';exit; } //已读人查询 $read_user_names = []; if($detail['admin_id'] !=$this->uid){ $record = Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->count(); if ($record == 0) { - $this->error('该汇报不存在'); + echo '
该汇报不存在
';exit; } else{ Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->update(['read_time' => time()]); @@ -220,7 +220,7 @@ class Work extends BaseController $id = $param['id']; $detail = Db::name('Work')->where(['id' => $id,'status' => 1])->find(); if (empty($detail)) { - $this->error('该汇报不存在'); + echo '
该汇报不存在
';exit; } if($detail['admin_id'] !=$this->uid){ $res = Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->update(['status' => -1]); diff --git a/app/project/controller/Task.php b/app/project/controller/Task.php index a45edd7..cbc2d62 100644 --- a/app/project/controller/Task.php +++ b/app/project/controller/Task.php @@ -105,7 +105,9 @@ class Task extends BaseController $id = isset($param['id']) ? $param['id'] : 0; $detail = (new TaskList())->detail($id); if (empty($detail)) { - return to_assign(1, '任务不存在'); + if (empty($detail)) { + echo '
该任务不存在
';exit; + } } else { $role_uid = [$detail['admin_id'], $detail['director_uid']]; $role_edit = 'view'; @@ -130,7 +132,7 @@ class Task extends BaseController return view(); } else{ - return to_assign(1, '您没权限查看该任务'); + echo '
您没权限查看该任务
';exit; } } }