Upgrade to Pro — share decks privately, control downloads, hide ads and more …

pixivコミックで作品が公開されるってどういうこと?

imadoki
October 05, 2023

 pixivコミックで作品が公開されるってどういうこと?

PIXIV MEETUP2023のLTで発表した際の資料です

imadoki

October 05, 2023
Tweet

More Decks by imadoki

Other Decks in Programming

Transcript

  1. 普通にやってみる SELECT `stories`.* FROM `stories` INNER JOIN `works` `work` ON

    `work`.`id` = `stories`.`work_id` INNER JOIN `magazines` `magazine` ON `magazine`.`id` = `work`.`magazine_id` INNER JOIN `publish_all_story_campaign_works` ON `publish_all_story_campaign_works`.`work_id` = `work`.`id` INNER JOIN `publishing_settings` ON `publishing_settings`.`story_id` = `stories`.`id` WHERE `work`.`is_public` = 1 AND `magazine`.`is_public` = 1 AND ( (`publishing_settings`.`start_at` <= :now) AND (`publishing_settings`.`finish_at` < :now OR `publishing_settings`.`finish_at` IS NULL) OR `publish_all_story_campaigns`.`approved` = 1 )
  2. 購入情報を一括で取得する class Story < ApplicationRecord #... bulk_loader, :purchased? do |ids,

    user_id| next {} if user_id.nil? # APIで購入の有無を問い合わせ purchased_story_ids = Store::App::OrderedEpisodes.get(user_id, ids) # {id => purchased?} という形式のHashに変換 ids.index_with {|id| purchased_story_ids.include?(id) } end end