更新工作记录
This commit is contained in:
parent
5eeb6ec3dd
commit
10a20967df
|
@ -240,45 +240,15 @@ class OaSchedule extends ApiController
|
|||
//删除工作记录
|
||||
public function delete()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$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, "删除成功");
|
||||
$this->apiSuccess('删除成功');
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
$this->apiError('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$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'];
|
||||
$schedule['project'] = Db::name('Project')->where(['id' => $task['project_id']])->value('name');
|
||||
}
|
||||
}
|
||||
if (request()->isAjax()) {
|
||||
return to_assign(0, "", $schedule);
|
||||
} else {
|
||||
return $schedule;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue