예제 #1
0
 public function e_upload()
 {
     $upload = new \LfUpload('/Picture');
     $path = $upload->upload('file');
     if (!$path) {
         $return = array('status' => 0, 'info' => $upload->getErr());
     } else {
         $return = array('status' => 1, 'info' => 'Uploads' . $path);
     }
     $this->ajaxReturn(json_encode($return));
 }
예제 #2
0
 function Summary()
 {
     //e_auth();
     $isSalon = \LfRequest::inStr('salon');
     if (IS_POST) {
         $e_id = \LfRequest::inNum('e_id');
         $summary = M('e_summary');
         $summary->user_id = session('user_id');
         $summary->e_id = $e_id;
         $isSummary = M('e_summary')->where(array('e_id' => $e_id, 'is_iteam' => 0, 'user_id' => session('user_id')))->find();
         if (!empty($isSummary)) {
             $this->error("你已总结该活动");
             exit;
         }
         $summary->stars = \LfRequest::inNum('stars');
         $summary->comment = \LfRequest::inStr('comment');
         if (strlen($summary->comment) > 900) {
             $this->error('总结字数需在300字以内');
             exit;
         }
         if ($isSalon == '1') {
             $summary->is_iteam = 0;
         } else {
             $summary->is_iteam = 1;
         }
         if ($_FILES['file']['size'] / (1024 * 1024) > 3) {
             $this->error('图片大小在3M以内');
             exit;
         }
         $upload = new \LfUpload('/Picture');
         $path = $upload->upload('file');
         if (!$path) {
             $this->error("图片上传错误 " . $upload->getErr());
             exit;
         }
         $summary->picture = '/Uploads' . $path;
         $res = $summary->add();
         if ($res) {
             /*
              * 当所有人都总结后设置iteam为已总结
             $SummaryNumber = $summary->where('e_id = '.$e_id)->count();
             $iteam = M('e_iteam')->find($e_id);
             if($iteam['participated_number'] == $SummaryNumber) {
             	M('e_iteam')->where('id ='.$e_id)->save(array('summary'=>1));
             }
             */
             /*
              * 暂定为有一人总结则该iteam为已总结
              */
             M('e_salon')->where('id =' . $e_id)->save(array('summary' => 1));
             $url = addons_url('Salon://Salon/CheckSalon', array('id' => $e_id));
             $this->success('总结成功,审核通过后可显示', $url);
             exit;
         } else {
             $this->error('总结失败');
             exit;
         }
     } else {
         $id = \LfRequest::inNum('e_id');
         $iteam = M('e_iteam')->find($id);
         $this->e_id = $id;
         $this->assign('iteam', $iteam);
         $this->title = "活动总结";
         $this->display();
     }
 }