项目数据列表数据读取权限修改
This commit is contained in:
parent
fb89644555
commit
6a093d4e3e
@ -278,11 +278,12 @@ class Index extends BaseController
|
|||||||
$exist = Db::query('show tables like "'.$prefix.'project"');
|
$exist = Db::query('show tables like "'.$prefix.'project"');
|
||||||
$res['data'] = [];
|
$res['data'] = [];
|
||||||
if($exist){
|
if($exist){
|
||||||
|
$project_ids = Db::name('ProjectUser')->where(['uid' => $this->uid, 'delete_time' => 0])->column('project_id');
|
||||||
$list = Db::name('Project')
|
$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')
|
->field('a.id,a.name,a.status,a.create_time,a.start_time,a.end_time,u.name as director_name')
|
||||||
->alias('a')
|
->alias('a')
|
||||||
->join('Admin u', 'a.director_uid = u.id')
|
->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')
|
->order('a.id desc')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
|
@ -17,21 +17,20 @@ class Article extends Model
|
|||||||
public function detail($id)
|
public function detail($id)
|
||||||
{
|
{
|
||||||
$article = Db::name('Article')->where(['id' => $id])->find();
|
$article = Db::name('Article')->where(['id' => $id])->find();
|
||||||
if (empty($article)) {
|
if (!empty($article)) {
|
||||||
return $this->error('文章知识不存在');
|
$keywrod_array = Db::name('ArticleKeywords')
|
||||||
}
|
->field('i.aid,i.keywords_id,k.title')
|
||||||
$keywrod_array = Db::name('ArticleKeywords')
|
->alias('i')
|
||||||
->field('i.aid,i.keywords_id,k.title')
|
->join('Keywords k', 'k.id = i.keywords_id', 'LEFT')
|
||||||
->alias('i')
|
->order('i.create_time asc')
|
||||||
->join('Keywords k', 'k.id = i.keywords_id', 'LEFT')
|
->where(array('i.aid' => $id, 'k.status' => 1))
|
||||||
->order('i.create_time asc')
|
->select()->toArray();
|
||||||
->where(array('i.aid' => $id, 'k.status' => 1))
|
|
||||||
->select()->toArray();
|
|
||||||
|
|
||||||
$article['keyword_ids'] = implode(",", array_column($keywrod_array, 'keywords_id'));
|
$article['keyword_ids'] = implode(",", array_column($keywrod_array, 'keywords_id'));
|
||||||
$article['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
|
$article['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
|
||||||
$article['user'] = Db::name('Admin')->where(['id' => $article['uid']])->value('name');
|
$article['user'] = Db::name('Admin')->where(['id' => $article['uid']])->value('name');
|
||||||
$article['department'] = Db::name('Department')->where(['id' => $article['did']])->value('title');
|
$article['department'] = Db::name('Department')->where(['id' => $article['did']])->value('title');
|
||||||
|
}
|
||||||
return $article;
|
return $article;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class Index extends BaseController
|
|||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$detail = Db::name('Message')->where(['id' => $id, 'from_uid' => $this->uid])->find();
|
$detail = Db::name('Message')->where(['id' => $id, 'from_uid' => $this->uid])->find();
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
$this->error('该信息不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
|
||||||
}
|
}
|
||||||
$fid = $detail['fid'];
|
$fid = $detail['fid'];
|
||||||
$person_name = [];
|
$person_name = [];
|
||||||
@ -244,10 +244,10 @@ class Index extends BaseController
|
|||||||
$type = empty(get_params('type')) ? 0 : get_params('type');
|
$type = empty(get_params('type')) ? 0 : get_params('type');
|
||||||
$detail = Db::name('Message')->where(['id' => $id, 'template' => 0])->find();
|
$detail = Db::name('Message')->where(['id' => $id, 'template' => 0])->find();
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
$this->error('该信息不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
|
||||||
}
|
}
|
||||||
if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) {
|
if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) {
|
||||||
$this->error('该信息不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
|
||||||
}
|
}
|
||||||
$sender = get_admin($detail['from_uid']);
|
$sender = get_admin($detail['from_uid']);
|
||||||
$detail['person_name'] = $sender['name'];
|
$detail['person_name'] = $sender['name'];
|
||||||
@ -274,10 +274,10 @@ class Index extends BaseController
|
|||||||
$id = $param['id'];
|
$id = $param['id'];
|
||||||
$detail = Db::name('Message')->where(['id' => $id])->find();
|
$detail = Db::name('Message')->where(['id' => $id])->find();
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
$this->error('该信息不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
|
||||||
}
|
}
|
||||||
if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) {
|
if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) {
|
||||||
$this->error('该信息不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
|
||||||
}
|
}
|
||||||
Db::name('Message')->where(['id' => $id])->update(['read_time' => time()]);
|
Db::name('Message')->where(['id' => $id])->update(['read_time' => time()]);
|
||||||
if($detail['from_uid']==0){
|
if($detail['from_uid']==0){
|
||||||
|
@ -141,7 +141,7 @@ class Work extends BaseController
|
|||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$detail = Db::name('Work')->where(['id' => $id,'admin_id' => $this->uid])->find();
|
$detail = Db::name('Work')->where(['id' => $id,'admin_id' => $this->uid])->find();
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
$this->error('该汇报不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该汇报不存在</div>';exit;
|
||||||
}
|
}
|
||||||
$person_name = Db::name('Admin')->where('status', 1)->where('id', 'in', $detail['type_user'])->column('name');
|
$person_name = Db::name('Admin')->where('status', 1)->where('id', 'in', $detail['type_user'])->column('name');
|
||||||
$detail['person_name'] = implode(",", $person_name);
|
$detail['person_name'] = implode(",", $person_name);
|
||||||
@ -171,14 +171,14 @@ class Work extends BaseController
|
|||||||
$id = $param['id'];
|
$id = $param['id'];
|
||||||
$detail = Db::name('Work')->where(['id' => $id,'status' => 1])->find();
|
$detail = Db::name('Work')->where(['id' => $id,'status' => 1])->find();
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
$this->error('该汇报不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该汇报不存在</div>';exit;
|
||||||
}
|
}
|
||||||
//已读人查询
|
//已读人查询
|
||||||
$read_user_names = [];
|
$read_user_names = [];
|
||||||
if($detail['admin_id'] !=$this->uid){
|
if($detail['admin_id'] !=$this->uid){
|
||||||
$record = Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->count();
|
$record = Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->count();
|
||||||
if ($record == 0) {
|
if ($record == 0) {
|
||||||
$this->error('该汇报不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该汇报不存在</div>';exit;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->update(['read_time' => time()]);
|
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'];
|
$id = $param['id'];
|
||||||
$detail = Db::name('Work')->where(['id' => $id,'status' => 1])->find();
|
$detail = Db::name('Work')->where(['id' => $id,'status' => 1])->find();
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
$this->error('该汇报不存在');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该汇报不存在</div>';exit;
|
||||||
}
|
}
|
||||||
if($detail['admin_id'] !=$this->uid){
|
if($detail['admin_id'] !=$this->uid){
|
||||||
$res = Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->update(['status' => -1]);
|
$res = Db::name('WorkRecord')->where(['wid' => $detail['id'],'to_uid' => $this->uid,'status' => 1])->update(['status' => -1]);
|
||||||
|
@ -105,7 +105,9 @@ class Task extends BaseController
|
|||||||
$id = isset($param['id']) ? $param['id'] : 0;
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
$detail = (new TaskList())->detail($id);
|
$detail = (new TaskList())->detail($id);
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
return to_assign(1, '任务不存在');
|
if (empty($detail)) {
|
||||||
|
echo '<div style="text-align:center;color:red;margin-top:20%;">该任务不存在</div>';exit;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$role_uid = [$detail['admin_id'], $detail['director_uid']];
|
$role_uid = [$detail['admin_id'], $detail['director_uid']];
|
||||||
$role_edit = 'view';
|
$role_edit = 'view';
|
||||||
@ -130,7 +132,7 @@ class Task extends BaseController
|
|||||||
return view();
|
return view();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return to_assign(1, '您没权限查看该任务');
|
echo '<div style="text-align:center;color:red;margin-top:20%;">您没权限查看该任务</div>';exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user