闫增涛
2025-04-08 b41630280b49408824feb333849d51d83fa06fca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
 
declare (strict_types = 1);
 
namespace app\oa\controller;
 
use app\base\BaseController;
use app\adm\model\Note as NoteModel;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
 
class Note extends BaseController
{
    /**
     * 构造函数
     */
    protected $model;
    public function __construct()
    {
        parent::__construct(); // 调用父类构造函数
        $this->model = new NoteModel();
    }
    
    /**
    * 数据列表
    */
    public function datalist()
    {
        $param = get_params();
        if (request()->isAjax()) {
            $where=[];
            $where[]=['a.delete_time','=',0];
            if (!empty($param['keywords'])) {
                $where[] = ['a.id|a.title', 'like', '%' . $param['keywords'] . '%'];
            }
            $list = $this->model->datalist($where, $param);
            return table_assign(0, '', $list);
        }
        else{
            return view();
        }
    }
    
    /**
    * 查看
    */
    public function view($id)
    {
        $detail = $this->model->getById($id);
        if (!empty($detail)) {
            $detail['cate'] = Db::name('NoteCate')->where(['id' => $detail['cate_id']])->value('title');
            $detail['admin_name'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
            if($detail['file_ids'] !=''){
                $file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
                $detail['file_array'] = $file_array;
            }
            View::assign('detail', $detail);
            if(is_mobile()){
                return view('qiye@/index/note_view');
            }
            return view();
        }
        else{
            return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
        }
    }
 
}