コード例 #1
0
ファイル: AreaDao.php プロジェクト: dreamingodd/casarover
 /**
  * draguo
  * return area_id
  * $content_arr is array
  */
 public function update($area_id, $name, $titlepic, $some_pics, $content_arr, $raiders_content, $position, $tier)
 {
     $contentAttachmentDao = new ContentAttachmentDao();
     $some_pic_arr = explode(';', $some_pics);
     if (count($some_pic_arr) < 5) {
         echo "更新失败,介绍内容图片不足";
         exit;
     }
     // 更新基础信息
     $this->UpdataArea($area_id, $name, $parentid, $tier, $position);
     $titlepic_id = $this->addPhoto($titlepic);
     /**
      * 对area_content表重新进行绑定,但是之前的数据并没有被删除
      * 下次进行更正
      */
     $this->delAreaContact($area_id);
     foreach ($content_arr as $value) {
         $content_id = $this->addContent($area_id, $value);
         $this->addAreaContact($area_id, $content_id);
     }
     // title图片和介绍内容最后一个绑定
     $contentAttachmentDao->delByContentId($content_id);
     $contentAttachmentDao->add($content_id, $titlepic_id);
     $content_id = $this->addContent($area_id, $raiders_content, $type = 1);
     $this->addAreaContact($area_id, $content_id);
     // 其余的四张和攻略进行绑定
     foreach ($some_pic_arr as $value) {
         if (!empty($value)) {
             $pic_id = $this->addPhoto($value);
             $contentAttachmentDao->add($content_id, $pic_id);
         }
     }
     return true;
 }