Пример #1
0
 /**
  * 添加新报表
  */
 public function action()
 {
     $contnt = $this->isP('content', '请填写您要提交的内容');
     if (!\Model\Report::addReport($contnt)) {
         $this->error('提交报表失败');
     }
     $this->success('提交报表成功', $this->url('Team-Index-dynamic'));
 }
Пример #2
0
 /**
  * 提交任务日志
  */
 public function diary()
 {
     $data['task_id'] = $this->isP('task_id', '请选择任务');
     $task = \Model\Content::findContent('task', $data['task_id'], 'task_id');
     if (empty($task) || $_SESSION['team']['user_id'] != $task['task_user_id'] || $task['task_delete'] == '1') {
         $this->error('任务不存在或者您不是本任务执行人');
     }
     $data['diary_content'] = $this->isP('content', '请填写任务日志');
     $data['diary_time'] = time();
     $this->db()->transaction();
     $addResult = $this->db('task_diary')->insert($data);
     if (empty($addResult)) {
         $this->db()->rollBack();
         $this->error('添加日志失败');
     }
     //追加为报表
     if (!\Model\Report::addReport($data['diary_content'], $task['task_id'])) {
         $this->db()->rollBack();
         $this->error('添加报表失败');
     }
     $this->db()->commit();
     $this->success('发表任务日志成功!', $this->url('Team-Task-view', array('id' => $data['task_id'])));
 }