Example #1
0
 /**
  * 个人作品
  */
 public function actionPersonart()
 {
     //暂时不开放公益项目的分布
     $errorarray = array(0 => 'fail', 1 => '暂时不开放当前类型项目发布!', 2 => 'reurl', 3 => Yii::app()->request->urlReferrer, 4 => '/notice/errors.html');
     //跳转到错误的页面
     parent::toUrl($errorarray);
     Yii::app()->end();
     $this->layout = "//layouts/member_html5";
     $error = "";
     if (isset($_POST['title'])) {
         //发布项目处理
         $_POST['type'] = 2;
         $va_param = $_POST;
         unset($va_param['publis_submit']);
         unset($va_param['picname']);
         Yii::import("application.models.form.ProjectForm", true);
         //形象图片处理
         $attch = CUploadedFile::getInstanceByName("picname");
         $error = "";
         if ($attch == null) {
             $name = Yii::app()->theme->baseUrl . "/images/projectdefault.png";
         } elseif ($attch->size > 1024 * 1024) {
             $error = "形象图片不超过1M";
         } elseif (!in_array(strtolower($attch->extensionName), array("jpeg", "jpg", "gif", "png"))) {
             $error = "上传的图片格式不正确";
         } else {
             $filename = "user_" . Yii::app()->user->getId() . "_" . time() . "." . strtolower($attch->extensionName);
             $path = "/data/upload/project/" . date("Y-m-d") . "/";
             $filepath = Yii::getPathOfAlias('webroot') . $path . $filename;
             $name = $path . $filename;
             if (BaseTool::createFolder($path)) {
                 if (!$attch->saveAs($filepath)) {
                     $error = "形象图片上传出错";
                 }
             }
         }
         if (empty($error)) {
             $va_param['litt_pic'] = $name;
             $oneProjectForm = new ProjectForm();
             $oneProjectForm->scenario = 'art';
             $oneProjectForm->setAttributes($va_param);
             if ($oneProjectForm->validate()) {
                 $oneProjectForm->save($va_param);
                 $this->redirect("/member/projects/publishing.html");
                 Yii::app()->end();
             } else {
                 $errorarray = $oneProjectForm->getErrors();
                 $error = current(current($errorarray));
             }
         }
     }
     $this->pageTitle = "发布项目-" . Yii::app()->name;
     $this->render('personart', array("publish_error" => $error));
 }
Example #2
0
 /**
  * 锁定赞助列表
  */
 public function actionLock()
 {
     if (!isset($_REQUEST['projectid']) || !isset($_REQUEST['tenderid'])) {
         $errorarray = array(0 => 'fail', 1 => '错误的操作!', 2 => 'reurl', 3 => Yii::app()->request->urlReferrer, 4 => '/notice/errors.html');
         //跳转到错误的页面
         parent::toUrl($errorarray);
     } else {
         if (empty($_REQUEST['projectid']) || empty($_REQUEST['tenderid'])) {
             $errorarray = array(0 => 'fail', 1 => '错误的操作!', 2 => 'reurl', 3 => Yii::app()->request->urlReferrer, 4 => '/notice/errors.html');
             //跳转到错误的页面
             parent::toUrl($errorarray);
         }
     }
     $user_id = Yii::app()->user->getId();
     try {
         $conn = Yii::app()->db;
         $command = $conn->createCommand('call p_lock_oneTender(:user_id,:project_id,:tender_id,@out_status,@out_remark)');
         $command->bindParam(":user_id", $user_id, PDO::PARAM_INT);
         $command->bindParam(":project_id", $_REQUEST['projectid'], PDO::PARAM_INT);
         $command->bindParam(":tender_id", $_REQUEST['tenderid'], PDO::PARAM_INT);
         $command->execute();
         $result = $conn->createCommand("select @out_status as status,@out_remark as remark")->queryRow(true);
         if ($result['status'] == 1) {
             $errorarray = array(0 => 'success', 1 => "处理成功", 2 => 'reurl', 3 => Yii::app()->request->urlReferrer, 4 => '/notice/success.html');
             //跳转到错误的页面
             parent::toUrl($errorarray);
         } else {
             $errorarray = array(0 => 'fail', 1 => $result['remark'], 2 => 'reurl', 3 => Yii::app()->request->urlReferrer, 4 => '/notice/errors.html');
             //跳转到错误的页面
             parent::toUrl($errorarray);
         }
     } catch (Exception $e) {
         $errorarray = array(0 => 'fail', 1 => '系统繁忙,暂时无法处理!', 2 => 'reurl', 3 => Yii::app()->request->urlReferrer, 4 => '/notice/errors.html');
         //跳转到错误的页面
         parent::toUrl($errorarray);
     }
 }