first commit
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
<?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\api\BaseController;
|
||||
use app\oa\model\Schedule;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Api extends BaseController
|
||||
{
|
||||
//获取工作日志列表
|
||||
public function get_schedule()
|
||||
{
|
||||
$param = get_params();
|
||||
$project_id = isset($param['project_id']) ? $param['project_id'] : 0;
|
||||
$task_id = isset($param['task_id']) ? $param['task_id'] : 0;
|
||||
if ($project_id>0) {
|
||||
$task_ids = Db::name('ProjectTask')->where(['delete_time' => 0, 'project_id' => $project_id])->column('id');
|
||||
$where[] = ['a.tid', 'in', $task_ids];
|
||||
}
|
||||
if ($task_id>0) {
|
||||
$where[] = ['a.tid', '=', $task_id];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$model = new Schedule();
|
||||
$list = $model->datalist($param,$where);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//调整工时
|
||||
public function update_schedule()
|
||||
{
|
||||
$param = get_params();
|
||||
$is_leader = isLeader($this->uid);
|
||||
$role_auth = isAuth($this->uid,'office_admin','conf_1');
|
||||
$hour_auth = valueAuth('office_admin','conf_2');
|
||||
$edit_role = false;
|
||||
if($hour_auth==4 && $role_auth > 0){
|
||||
$edit_role = true;
|
||||
}
|
||||
if($hour_auth==3 && $is_leader > 0){
|
||||
$edit_role = true;
|
||||
}
|
||||
if($hour_auth==2){
|
||||
$admin_id = Db::name('Schedule')->where('id',$param['id'])->value('admin_id');
|
||||
if($admin_id == $this->uid){
|
||||
$edit_role = true;
|
||||
}
|
||||
}
|
||||
if($edit_role == false){
|
||||
return to_assign(1, "您无权限编辑");
|
||||
}
|
||||
|
||||
if (isset($param['start_time_a'])) {
|
||||
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
|
||||
}
|
||||
if (isset($param['end_time_a'])) {
|
||||
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
|
||||
}
|
||||
if($param['start_time']>time()){
|
||||
return to_assign(1, "开始时间不能大于当前时间");
|
||||
}
|
||||
if ($param['end_time'] <= $param['start_time']) {
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
$where1[] = ['delete_time', '=', 0];
|
||||
$where1[] = ['id', '<>', $param['id']];
|
||||
$where1[] = ['admin_id', '=', $param['admin_id']];
|
||||
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
|
||||
|
||||
$where2[] = ['delete_time', '=', 0];
|
||||
$where2[] = ['id', '<>', $param['id']];
|
||||
$where2[] = ['admin_id', '=', $param['admin_id']];
|
||||
$where2[] = ['start_time', '<=', $param['start_time']];
|
||||
$where2[] = ['start_time', '>=', $param['end_time']];
|
||||
|
||||
$where3[] = ['delete_time', '=', 0];
|
||||
$where3[] = ['id', '<>', $param['id']];
|
||||
$where3[] = ['admin_id', '=', $param['admin_id']];
|
||||
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
|
||||
|
||||
$record = Db::name('Schedule')
|
||||
->where(function ($query) use ($where1) {
|
||||
$query->where($where1);
|
||||
})
|
||||
->whereOr(function ($query) use ($where2) {
|
||||
$query->where($where2);
|
||||
})
|
||||
->whereOr(function ($query) use ($where3) {
|
||||
$query->where($where3);
|
||||
})
|
||||
->count();
|
||||
if ($record > 0) {
|
||||
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
|
||||
}
|
||||
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
|
||||
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
|
||||
if ($res !== false) {
|
||||
return to_assign(0, "操作成功");
|
||||
add_log('edit', $param['id'], $param);
|
||||
} else {
|
||||
return to_assign(1, "操作失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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\MeetingRecords as MeetingRecordsModel;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Meeting extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new MeetingRecordsModel();
|
||||
}
|
||||
|
||||
//会议纪要
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where=[];
|
||||
$whereOr = [];
|
||||
$uid = $this->uid;
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['anchor_id'])) {
|
||||
$where[] = ['anchor_id', '=', $param['anchor_id']];
|
||||
}
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['meeting_date', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
|
||||
}
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$whereOr[] = ['recorder_id|anchor_id','=',$uid];
|
||||
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',join_uids)")];
|
||||
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',sign_uids)")];
|
||||
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',share_uids)")];
|
||||
$list = $this->model->datalist($param,$where,$whereOr);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//查看会议纪要
|
||||
public function view($id)
|
||||
{
|
||||
View::assign('detail', $this->model->getById($id));
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/meeting_view');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,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\News as NewsModel;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class News extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new NewsModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where=[];
|
||||
$where[]=['delete_time','=',0];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|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/news_view');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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];
|
||||
$where[]=['a.status','=',1];
|
||||
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'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
<?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\oa\model\Plan as PlanList;
|
||||
use schedule\Schedule as ScheduleIndex;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Plan extends BaseController
|
||||
{
|
||||
function datalist() {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
//按时间检索
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['a.start_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
|
||||
}
|
||||
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.title', 'like', '%' . trim($param['keywords']) . '%'];
|
||||
}
|
||||
if (!empty($param['uid'])) {
|
||||
$where[] = ['a.admin_id', '=', $param['uid']];
|
||||
} else {
|
||||
$where[] = ['a.admin_id', '=', $this->uid];
|
||||
}
|
||||
if (!empty($param['type'])) {
|
||||
$where[] = ['a.type', '=', $param['type']];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$plan = PlanList::where($where)
|
||||
->field('a.*,u.name as create_admin')
|
||||
->alias('a')
|
||||
->join('admin u', 'u.id = a.admin_id', 'LEFT')
|
||||
->order('a.id desc')
|
||||
->paginate(['list_rows'=> $rows])
|
||||
->each(function ($item, $key) {
|
||||
$item->remind_time = empty($item->remind_time) ? '-' : to_date($item->remind_time,'Y-m-d H:i');
|
||||
$item->start_time = empty($item->start_time) ? '' : to_date($item->start_time,'Y-m-d H:i');
|
||||
$item->end_time = empty($item->end_time) ? '': to_date($item->end_time,'Y-m-d H:i');
|
||||
});
|
||||
return table_assign(0, '', $plan);
|
||||
} else {
|
||||
View::assign('is_leader', isLeader($this->uid));
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//工作记录
|
||||
public function calendar()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$uid = $this->uid;
|
||||
if (!empty($param['uid'])) {
|
||||
$uid = $param['uid'];
|
||||
}
|
||||
$where = [];
|
||||
|
||||
$where[] = ['start_time','<=',strtotime($param['end'])];
|
||||
$where[] = ['end_time','>=',strtotime($param['start'])];
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$where[] = ['admin_id', '=', $uid];
|
||||
|
||||
$schedule = Db::name('Plan')
|
||||
->where($where)
|
||||
->field('id,title,type,remind_type,start_time,end_time')
|
||||
->select()->toArray();
|
||||
$events = [];
|
||||
$bg_array=['#ECECEC','#FFD3D3','#F6F6C7','#D7EBFF','#CCEBCC','#E9E9CB'];
|
||||
$border_array=['#CCCCCC','#FF9999','#E8E89B','#99CCFF','#99CC99','#CCCC99'];
|
||||
foreach ($schedule as $k => $v) {
|
||||
$v['backgroundColor'] = $bg_array[$v['type']];
|
||||
$v['borderColor'] = $border_array[$v['type']];
|
||||
$v['title'] = $v['title'];
|
||||
$v['start'] = date('Y-m-d H:i', $v['start_time']);
|
||||
$v['end'] = date('Y-m-d H:i', $v['end_time']);
|
||||
unset($v['start_time']);
|
||||
unset($v['end_time']);
|
||||
$events[] = $v;
|
||||
}
|
||||
$input_arrays = $events;
|
||||
$range_start = parseDateTime($param['start']);
|
||||
$range_end = parseDateTime($param['end']);
|
||||
$timeZone = null;
|
||||
if (isset($_GET['timeZone'])) {
|
||||
$timeZone = new DateTimeZone($_GET['timeZone']);
|
||||
}
|
||||
|
||||
// Accumulate an output array of event data arrays.
|
||||
$output_arrays = array();
|
||||
foreach ($input_arrays as $array) {
|
||||
// Convert the input array into a useful Event object
|
||||
$event = new ScheduleIndex($array, $timeZone);
|
||||
// If the event is in-bounds, add it to the output
|
||||
if ($event->isWithinDayRange($range_start, $range_end)) {
|
||||
$output_arrays[] = $event->toArray();
|
||||
}
|
||||
}
|
||||
return json($output_arrays);
|
||||
} else {
|
||||
View::assign('is_leader', isLeader($this->uid));
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//保存日志数据
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
$admin_id = $this->uid;
|
||||
if (isset($param['start_time'])) {
|
||||
$param['start_time'] = strtotime($param['start_time']);
|
||||
}
|
||||
if (isset($param['end_time'])) {
|
||||
$param['end_time'] = strtotime($param['end_time']);
|
||||
}
|
||||
if (isset($param['start_time_a'])) {
|
||||
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
|
||||
}
|
||||
if (isset($param['end_time_a'])) {
|
||||
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
|
||||
}
|
||||
if ($param['end_time'] <= $param['start_time']) {
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
/*
|
||||
if ($param['start_time'] <= time()) {
|
||||
return to_assign(1, "开始时间需要大于当前时间");
|
||||
}
|
||||
*/
|
||||
if (isset($param['remind_type'])) {
|
||||
if($param['remind_type']==1){
|
||||
$param['remind_time'] = $param['start_time']-5*60;
|
||||
}
|
||||
if($param['remind_type']==2){
|
||||
$param['remind_time'] = $param['start_time']-15*60;
|
||||
}
|
||||
if($param['remind_type']==3){
|
||||
$param['remind_time'] = $param['start_time']-30*60;
|
||||
}
|
||||
if($param['remind_type']==4){
|
||||
$param['remind_time'] = $param['start_time']-60*60;
|
||||
}
|
||||
if($param['remind_type']==5){
|
||||
$param['remind_time'] = $param['start_time']-120*60;
|
||||
}
|
||||
if($param['remind_type']==6){
|
||||
$param['remind_time'] = $param['start_time']-1440*60;
|
||||
}
|
||||
}
|
||||
if ($param['id'] == 0) {
|
||||
$param['admin_id'] = $admin_id;
|
||||
$param['did'] = get_admin($admin_id)['did'];
|
||||
$param['create_time'] = time();
|
||||
$addid = Db::name('Plan')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($addid > 0) {
|
||||
add_log('add', $addid, $param);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
} else {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Plan')->strict(false)->field(true)->update($param);
|
||||
if ($res !== false) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除工作记录
|
||||
public function del()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$data['id'] = $id;
|
||||
$data['delete_time'] = time();
|
||||
if (Db::name('Plan')->update($data) !== false) {
|
||||
add_log('delete', $data['id'], $data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
public function detail()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$schedule = Db::name('Plan')->where(['id' => $id])->find();
|
||||
if (!empty($schedule)) {
|
||||
$schedule['remind_time'] = $schedule['remind_time'] == 0?'-':date('Y-m-d H:i', $schedule['remind_time']);
|
||||
$schedule['start_time_a'] = date('Y-m-d', $schedule['start_time']);
|
||||
$schedule['end_time_a'] = date('Y-m-d', $schedule['end_time']);
|
||||
$schedule['start_time_b'] = date('H:i', $schedule['start_time']);
|
||||
$schedule['end_time_b'] = date('H:i', $schedule['end_time']);
|
||||
$schedule['start_time'] = date('Y-m-d H:i', $schedule['start_time']);
|
||||
$schedule['end_time'] = date('Y-m-d H:i', $schedule['end_time']);
|
||||
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
|
||||
$schedule['user'] = Db::name('Admin')->where(['id' => $schedule['admin_id']])->value('name');
|
||||
}
|
||||
return $schedule;
|
||||
}
|
||||
|
||||
//读取日程弹层详情
|
||||
public function view()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$schedule = $this->detail($id);
|
||||
if (request()->isAjax()) {
|
||||
return to_assign(0, "", $schedule);
|
||||
} else {
|
||||
return $schedule;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
<?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\oa\model\Schedule as ScheduleModel;
|
||||
use schedule\Schedule as ScheduleIndex;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Schedule extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new ScheduleModel();
|
||||
}
|
||||
|
||||
function datalist() {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
$whereOr = [];
|
||||
$uid= $this->uid;
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.title', 'like', '%' . trim($param['keywords']) . '%'];
|
||||
}
|
||||
if (!empty($param['labor_type'])) {
|
||||
$where[] = ['a.labor_type', '=',$param['labor_type']];
|
||||
}
|
||||
if (!empty($param['cid'])) {
|
||||
$where[] = ['a.cid', '=',$param['cid']];
|
||||
}
|
||||
//按时间检索
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['a.start_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
if (!empty($param['uid'])) {
|
||||
$where[] = ['a.admin_id', '=', $param['uid']];
|
||||
} else {
|
||||
$whereOr[] = ['a.admin_id', '=', $uid];
|
||||
$dids_a = get_leader_departments($uid);
|
||||
$dids_b = get_role_departments($uid);
|
||||
$dids = array_merge($dids_a, $dids_b);
|
||||
if(!empty($dids)){
|
||||
$whereOr[] = ['a.did','in',$dids];
|
||||
}
|
||||
}
|
||||
$list = $this->model->datalist($param,$where,$whereOr);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
View::assign('is_leader', isLeader($this->uid));
|
||||
View::assign('role_auth', isAuth($this->uid,'office_admin','conf_1'));
|
||||
View::assign('hour_auth', valueAuth('office_admin','conf_2'));
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//工作记录
|
||||
public function calendar()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$uid = $this->uid;
|
||||
if (!empty($param['uid'])) {
|
||||
$uid = $param['uid'];
|
||||
}
|
||||
$where = [];
|
||||
$where[] = ['start_time', '>=', strtotime($param['start'])];
|
||||
$where[] = ['end_time', '<=', strtotime($param['end'])];
|
||||
$where[] = ['admin_id', '=', $uid];
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$schedule = Db::name('Schedule')->where($where)->field('id,title,labor_time,start_time,end_time')->select()->toArray();
|
||||
$events = [];
|
||||
$countEvents = [];
|
||||
foreach ($schedule as $k => $v) {
|
||||
$v['backgroundColor'] = '#12bb37';
|
||||
$v['borderColor'] = '#12bb37';
|
||||
$v['title'] = '[' . $v['labor_time'] . '工时] ' . $v['title'];
|
||||
$v['start'] = date('Y-m-d H:i', $v['start_time']);
|
||||
$v['end'] = date('Y-m-d H:i', $v['end_time']);
|
||||
$temData = date('Y-m-d', $v['start_time']);
|
||||
if (array_key_exists($temData, $countEvents)) {
|
||||
$countEvents[$temData]['times'] += $v['labor_time'];
|
||||
} else {
|
||||
$countEvents[$temData]['times'] = $v['labor_time'];
|
||||
$countEvents[$temData]['start'] = date('Y-m-d', $v['start_time']);
|
||||
}
|
||||
unset($v['start_time']);
|
||||
unset($v['end_time']);
|
||||
$events[] = $v;
|
||||
}
|
||||
foreach ($countEvents as $kk => $vv) {
|
||||
$vv['backgroundColor'] = '#eeeeee';
|
||||
$vv['borderColor'] = '#eeeeee';
|
||||
$vv['title'] = '【当天总工时:' . $vv['times'] . '】';
|
||||
$vv['end'] = $vv['start'];
|
||||
$vv['id'] = 0;
|
||||
unset($vv['times']);
|
||||
$events[] = $vv;
|
||||
}
|
||||
$input_arrays = $events;
|
||||
$range_start = parseDateTime($param['start']);
|
||||
$range_end = parseDateTime($param['end']);
|
||||
$timeZone = null;
|
||||
if (isset($_GET['timeZone'])) {
|
||||
$timeZone = new DateTimeZone($_GET['timeZone']);
|
||||
}
|
||||
|
||||
// Accumulate an output array of event data arrays.
|
||||
$output_arrays = array();
|
||||
foreach ($input_arrays as $array) {
|
||||
// Convert the input array into a useful Event object
|
||||
$event = new ScheduleIndex($array, $timeZone);
|
||||
// If the event is in-bounds, add it to the output
|
||||
if ($event->isWithinDayRange($range_start, $range_end)) {
|
||||
$output_arrays[] = $event->toArray();
|
||||
}
|
||||
}
|
||||
return json($output_arrays);
|
||||
} else {
|
||||
View::assign('is_leader', isLeader($this->uid));
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//保存日志数据
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
$admin_id = $this->uid;
|
||||
if ($param['id'] == 0) {
|
||||
if (isset($param['start_time'])) {
|
||||
$param['start_time'] = strtotime($param['start_time']);
|
||||
}
|
||||
if (isset($param['end_time'])) {
|
||||
$param['end_time'] = strtotime($param['end_time']);
|
||||
}
|
||||
if (isset($param['end_time_a'])) {
|
||||
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
|
||||
}
|
||||
if (isset($param['start_time_a'])) {
|
||||
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
|
||||
}
|
||||
if (isset($param['end_time_a'])) {
|
||||
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
|
||||
}
|
||||
if($param['start_time']>time()){
|
||||
return to_assign(1, "开始时间不能大于现在时间");
|
||||
}
|
||||
if ($param['end_time'] <= $param['start_time']) {
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
if (date('d',$param['end_time']) != date('d',$param['start_time'])) {
|
||||
return to_assign(1, "结束时间与开始时间必须是同一天");
|
||||
}
|
||||
$where1[] = ['delete_time', '=', 0];
|
||||
$where1[] = ['admin_id', '=', $admin_id];
|
||||
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
|
||||
|
||||
$where2[] = ['delete_time', '=', 0];
|
||||
$where2[] = ['admin_id', '=', $admin_id];
|
||||
$where2[] = ['start_time', '<=', $param['start_time']];
|
||||
$where2[] = ['start_time', '>=', $param['end_time']];
|
||||
|
||||
$where3[] = ['delete_time', '=', 0];
|
||||
$where3[] = ['admin_id', '=', $admin_id];
|
||||
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
|
||||
|
||||
$record = Db::name('Schedule')
|
||||
->where(function ($query) use ($where1) {
|
||||
$query->where($where1);
|
||||
})
|
||||
->whereOr(function ($query) use ($where2) {
|
||||
$query->where($where2);
|
||||
})
|
||||
->whereOr(function ($query) use ($where3) {
|
||||
$query->where($where3);
|
||||
})
|
||||
->count();
|
||||
if ($record > 0) {
|
||||
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
|
||||
}
|
||||
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
|
||||
$param['admin_id'] = $admin_id;
|
||||
$param['did'] = get_admin($admin_id)['did'];
|
||||
$param['create_time'] = time();
|
||||
$sid = Db::name('Schedule')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid > 0) {
|
||||
add_log('add', $sid, $param);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
} else {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
|
||||
if ($res !== false) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除工作记录
|
||||
public function del()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$data['id'] = $id;
|
||||
$data['delete_time'] = time();
|
||||
if (Db::name('schedule')->update($data) !== false) {
|
||||
add_log('delete', $data['id'], $data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$id = get_params('id');
|
||||
$schedule = Db::name('Schedule')->where(['id' => $id])->find();
|
||||
if (!empty($schedule)) {
|
||||
$schedule['start_time_1'] = date('H:i', $schedule['start_time']);
|
||||
$schedule['end_time_1'] = date('H:i', $schedule['end_time']);
|
||||
$schedule['start_time'] = date('Y-m-d', $schedule['start_time']);
|
||||
$schedule['end_time'] = date('Y-m-d', $schedule['end_time']);
|
||||
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
|
||||
$schedule['name'] = Db::name('Admin')->where(['id' => $schedule['admin_id']])->value('name');
|
||||
$schedule['labor_type_string'] = '案头工作';
|
||||
if($schedule['labor_type'] == 2){
|
||||
$schedule['labor_type_string'] = '外勤工作';
|
||||
}
|
||||
$schedule['department'] = get_admin($schedule['admin_id'])['department'];
|
||||
$schedule['work_cate'] = Db::name('WorkCate')->where(['id' => $schedule['cid']])->value('title');
|
||||
if($schedule['tid']>0){
|
||||
$task = Db::name('ProjectTask')->where(['id' => $schedule['tid']])->find();
|
||||
$schedule['task'] = $task['title'];
|
||||
if($task['project_id']>0){
|
||||
$schedule['project'] = Db::name('Project')->where(['id' => $task['project_id']])->value('name');
|
||||
}
|
||||
else{
|
||||
$schedule['project'] ='-';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$schedule['task'] ='-';
|
||||
}
|
||||
}
|
||||
if (request()->isAjax()) {
|
||||
return to_assign(0, "", $schedule);
|
||||
} else {
|
||||
View::assign('detail',$schedule);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/schedule_view');
|
||||
}
|
||||
return $schedule;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
<?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\oa\model\Work as WorkModel;
|
||||
use app\oa\model\WorkRecord;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Work extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new WorkModel();
|
||||
}
|
||||
//获取接收汇报列表
|
||||
public function get_accept($map = [], $param = [])
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$Work = WorkRecord::alias('a')
|
||||
->field('a.id,a.from_uid,a.to_uid,a.send_time,a.read_time,w.id as wid,w.types,w.works,w.file_ids,w.start_date,w.end_date')
|
||||
->join('Work w','a.work_id = w.id','left')
|
||||
->where($map)
|
||||
->order('a.send_time desc')
|
||||
->paginate(['list_rows'=> $rows])
|
||||
->each(function ($item, $key) {
|
||||
$item->send_time = empty($item->send_time) ? '-' : to_date($item->send_time,'Y-m-d H:i:s');
|
||||
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
|
||||
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
|
||||
if($item->start_date>0){
|
||||
$item->start_date = date('Y-m-d',$item->start_date);
|
||||
}
|
||||
if($item->end_date>0){
|
||||
$item->end_date = date('Y-m-d',$item->end_date);
|
||||
}
|
||||
$item->files = Db::name('File')->where('id', 'in', $item->file_ids)->count();
|
||||
});
|
||||
return $Work;
|
||||
}
|
||||
|
||||
//汇报列表
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$map = [];
|
||||
//按关键字检索
|
||||
if( !empty($param['keywords']) ){
|
||||
$map[] = ['works', 'like', '%'.$param['keywords'].'%'];
|
||||
}
|
||||
if($param['send']==1){
|
||||
if (!empty($param['types'])) {
|
||||
$map[] = ['types', '=', $param['types']];
|
||||
}
|
||||
//按时间检索
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$map[] = ['start_date', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
|
||||
}
|
||||
$map[] = ['admin_id', '=', $this->uid];
|
||||
$map[] = ['delete_time', '=', 0];
|
||||
$list = $this->model->get_send($param,$map);
|
||||
}
|
||||
else{
|
||||
if (!empty($param['read'])) {
|
||||
if($param['read']==1){
|
||||
$map[] = ['a.read_time', '=', 0];
|
||||
}else{
|
||||
$map[] = ['a.read_time', '>', 0];
|
||||
}
|
||||
}
|
||||
if (!empty($param['types'])) {
|
||||
$map[] = ['w.types', '=', $param['types']];
|
||||
}
|
||||
$map[] = ['a.to_uid', '=', $this->uid];
|
||||
$map[] = ['a.delete_time', '=', 0];
|
||||
//按时间检索
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$map[] = ['a.send_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
|
||||
}
|
||||
$list = $this->get_accept($map, $param);
|
||||
}
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
$send = empty(get_params('send')) ? 1 : get_params('send');
|
||||
return view('datalist_'.$send);
|
||||
}
|
||||
}
|
||||
|
||||
//新增&编辑
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$id = $param['id'] ? $param['id'] : 0;
|
||||
if(!empty($param['start_date'])){
|
||||
$param['start_date'] = strtotime($param['start_date']);
|
||||
}
|
||||
if(!empty($param['end_date'])){
|
||||
$param['end_date'] = strtotime($param['end_date']);
|
||||
}
|
||||
if(!empty($param['range_date'])){
|
||||
$range_date =explode('~', $param['range_date']);
|
||||
$param['start_date'] = strtotime(urldecode($range_date[0]));
|
||||
$param['end_date'] = strtotime(urldecode($range_date[1]));
|
||||
}
|
||||
if($id>0){
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Work')->strict(false)->field(true)->update($param);
|
||||
if ($res !== false) {
|
||||
add_log('edit',$id,$param);
|
||||
if($param['send']==1){
|
||||
$users = explode(',',$param['to_uids']);
|
||||
//组合要发的消息
|
||||
$send_data = [];
|
||||
foreach ($users as $key => $value) {
|
||||
if (!$value || ($value == $this->uid)) {
|
||||
continue;
|
||||
}
|
||||
$send_data[] = array(
|
||||
'work_id' => $id,//关联id
|
||||
'to_uid' => $value,//接收人
|
||||
'from_uid' => $this->uid,//发送人
|
||||
'send_time' => time()
|
||||
);
|
||||
}
|
||||
Db::name('WorkRecord')->strict(false)->field(true)->insertAll($send_data);
|
||||
Db::name('Work')->strict(false)->field('send_time')->update(['id' => $id,'send_time' => time()]);
|
||||
add_log('send',$id);
|
||||
$msg=[
|
||||
'from_uid'=>$this->uid,//发送人
|
||||
'to_uids'=>$param['to_uids'],//接收人
|
||||
'template_id'=>'work',//消息模板标识
|
||||
'content'=>[ //消息内容
|
||||
'send_time'=>date('Y-m-d H:i:s'),
|
||||
'action_id'=>$id
|
||||
]
|
||||
];
|
||||
event('SendMessage',$msg);
|
||||
return to_assign(0, '发送成功');
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(1,'操作失败');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$param['admin_id'] = $this->uid;
|
||||
$param['create_time'] = time();
|
||||
$wid = Db::name('Work')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($wid !== false) {
|
||||
add_log('add',$wid,$param);
|
||||
if($param['send']==1){
|
||||
$users = explode(',',$param['to_uids']);
|
||||
//组合要发的内容
|
||||
$send_data = [];
|
||||
foreach ($users as $key => $value) {
|
||||
if (!$value || ($value == $this->uid)) {
|
||||
continue;
|
||||
}
|
||||
$send_data[] = array(
|
||||
'work_id' => $wid,//关联id
|
||||
'to_uid' => $value,//接收人
|
||||
'from_uid' => $this->uid,//发送人
|
||||
'send_time' => time()
|
||||
);
|
||||
}
|
||||
Db::name('WorkRecord')->strict(false)->field(true)->insertAll($send_data);
|
||||
Db::name('Work')->strict(false)->field('send_time')->update(['id' => $wid,'send_time' => time()]);
|
||||
add_log('send',$wid);
|
||||
$msg=[
|
||||
'from_uid'=>$this->uid,//发送人
|
||||
'to_uids'=>$param['to_uids'],//接收人
|
||||
'template_id'=>'work',//消息模板ID
|
||||
'content'=>[ //消息内容
|
||||
'create_time'=>date('Y-m-d H:i:s'),
|
||||
'action_id'=>$wid
|
||||
]
|
||||
];
|
||||
event('SendMessage',$msg);
|
||||
return to_assign(0, '发送成功');
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(1,'操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = empty(get_params('id')) ? 0 : get_params('id');
|
||||
$types = empty(get_params('types')) ? 1 : get_params('types');
|
||||
if ($id > 0) {
|
||||
$detail = $this->model->detail($id);
|
||||
$types = $detail['types'];
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
View::assign('types', $types);
|
||||
return view('add_'.$types);
|
||||
}
|
||||
}
|
||||
|
||||
//查看
|
||||
public function view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = $param['id'];
|
||||
$detail = $this->model->detail($id);
|
||||
//已读人查询
|
||||
$read_user_names = [];
|
||||
if($detail['admin_id'] !=$this->uid){
|
||||
$record = Db::name('WorkRecord')->where(['work_id' => $detail['id'],'to_uid' => $this->uid])->count();
|
||||
if ($record == 0) {
|
||||
echo '<div style="text-align:center;color:red;margin-top:20%;">该汇报不存在</div>';exit;
|
||||
}
|
||||
else{
|
||||
Db::name('WorkRecord')->where(['work_id' => $detail['id'],'to_uid' => $this->uid])->update(['read_time' => time()]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$read_user_ids= Db::name('WorkRecord')->where([['work_id','=',$detail['id']],['read_time','>',0]])->column('to_uid');
|
||||
$read_user_names = Db::name('Admin')->where('id', 'in', $read_user_ids)->column('name');
|
||||
}
|
||||
$sender = get_admin($detail['admin_id']);
|
||||
$detail['person_name'] = $sender['name'];
|
||||
if($detail['send_time']>0){
|
||||
$detail['send_time'] = to_date($detail['send_time']);
|
||||
}
|
||||
//接收人查询
|
||||
$user_names = Db::name('Admin')->where('status', 1)->where('id', 'in', $detail['to_uids'])->column('name');
|
||||
$detail['users'] = implode(",", $user_names);
|
||||
$detail['read_users'] = implode(",", $read_user_names);
|
||||
$detail['comment_auth'] = 0;
|
||||
$type_user_array = explode(",", $detail['to_uids']);
|
||||
if (in_array($this->uid, $type_user_array)) {
|
||||
$detail['comment_auth'] = 1;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/work_view');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
|
||||
//删除汇报
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = $param['id'];
|
||||
$detail = Db::name('Work')->where(['id' => $id])->find();
|
||||
if($detail['admin_id'] == $this->uid){
|
||||
$res = Db::name('Work')->where('id',$detail['id'])->update(['delete_time' => time()]);
|
||||
if($res!==false){
|
||||
Db::name('WorkRecord')->where('work_id',$detail['id'])->update(['delete_time' => time()]);
|
||||
add_log('delete', $param['id']);
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
}
|
||||
else{
|
||||
return to_assign(1, '无权限删除');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user