public function addstep4()
 {
     $id = $_GET['id'];
     $project = $this->can_edit($id);
     $where = array('project_id' => $id);
     if (IS_POST) {
         $uid = is_login();
         // 如果指定了宣传图片,录入数据库
         $project_temp = $_POST['temp'];
         if (!isset($project_temp)) {
             $this->error('请至少添加一张宣传图片。');
         }
         M('ProjectTemp')->where($where)->delete();
         if (isset($project_temp)) {
             foreach ($project_temp as $key => $value) {
                 $temp = array('project_id' => $id, 'temp_type' => '1', 'info_key' => $value, 'sort' => $key, 'create_time' => NOW_TIME, 'create_id' => $uid, 'update_time' => NOW_TIME, 'update_id' => $uid);
                 M('ProjectTemp')->add($temp);
             }
         }
         // 如果指定了视频的URL,视频数据录入数据库
         $temp_move = $_POST['temp-move'];
         if (isset($temp_move) && !empty($temp_move)) {
             $temp = array('project_id' => $id, 'temp_type' => '0', 'info_key' => getswf($temp_move), 'sort' => 0, 'describe' => $temp_move, 'create_time' => NOW_TIME, 'create_id' => $uid, 'update_time' => NOW_TIME, 'update_id' => $uid);
             M('ProjectTemp')->add($temp);
         }
         $this->success('处理成功', U('addstep5', array('id' => $id)));
     } else {
         $temp = M('ProjectTemp')->where($where)->order('temp_type, sort')->select();
         $temp_move = null;
         foreach ($temp as $key => $v) {
             if ($v['temp_type'] == 0) {
                 $temp_move = $v['describe'];
                 unset($temp[$key]);
                 break;
             }
         }
         $this->project_id = $id;
         $this->temp = $temp;
         $this->temp_move = $temp_move;
         $this->display();
     }
 }
 public function editDatum()
 {
     $uid = is_login();
     if (IS_POST) {
         $id = $_POST['id'];
         $project = $this->can_edit($id);
         // 如果指定了宣传图片,录入数据库
         $project_temp = $_POST['temp'];
         if (!isset($project_temp)) {
             $this->error('请至少添加一张宣传图片。');
         }
         $where = array('project_id' => $id);
         M('ProjectTemp')->where($where)->delete();
         if (isset($project_temp)) {
             foreach ($project_temp as $key => $value) {
                 $temp = array('project_id' => $id, 'temp_type' => '1', 'info_key' => $value, 'sort' => $key, 'update_time' => NOW_TIME, 'update_id' => $uid);
                 M('ProjectTemp')->add($temp);
             }
         }
         // 如果指定了视频的URL,视频数据录入数据库
         $temp_move = $_POST['temp-move'];
         if (isset($temp_move) && !empty($temp_move)) {
             $temp = array('project_id' => $id, 'temp_type' => '0', 'info_key' => getswf($temp_move), 'sort' => 0, 'describe' => $temp_move, 'update_time' => NOW_TIME, 'update_id' => $uid);
             M('ProjectTemp')->add($temp);
         }
         $this->success('处理成功!', U('edit', array('id' => $_POST['id'], 'step' => 5)));
     }
 }