예제 #1
0
    $tagId = intval($tagId);
    array_push($tag_ids, $tagId);
}
// 自定义标签
$user_tags = $casa->user_tags;
if (!empty($user_tags)) {
    $customizedTagIds = $tagDao->addCustomizedTags($user_tags);
    if (!$customizedTagIds) {
        db_error("更新自定义标签失败!");
    }
    foreach ($customizedTagIds as $tagId) {
        array_push($tag_ids, $tagId);
    }
}
// 关联标签和民宿
if (!$casaService->combineCasaTags($casa_id, $tag_ids)) {
    db_error("关联民宿和标签失败!");
}
/** 4.添加内容 */
if (!$contentService->delContentsRelated($casa_id)) {
    db_error("删除原有内容失败!");
}
$contents = $casa->contents;
$i = 1;
foreach ($contents as $content) {
    $content_id = $contentDao->add($casa_id, $content->name, $content->text, i * 10);
    if (!$content_id) {
        db_error("添加内容失败!");
    }
    foreach ($content->photos as $filename) {
        $attachment_id = $attachmentDao->addSimple($filename);