category = Category.find_by(:name => "运动")
category.brands.each do |brand|
if brand.shops
brand.shops.each do |shop|
5.times{
comment = shop.comments.new
comment.created_at = rand((Time.now-2592000)..Time.now)
comment.user = User.where(:robot => true).sample
com = category.comment_stores.sample
if !shop.comment_stores.include?(com)
comment.content = com.content
else
comment.content = category.comment_stores.sample.content
end
comment.save
}
end
end
end
相关文章:
- 【20】淘宝sdk——入门实战之分类导航和店铺公告 2021-10-17
- 评论分类 2021-06-10
- ruby冒泡算法删除店铺下的重复评论 2022-02-16
- 店铺 开店 2021-09-13
- (4.3)基于机器学习(分类)的酒店评论倾向性分析 2022-03-05
- 酒店评论的情感分析 2021-08-07
- 采集 淘宝店铺的所有评论内容 的思路 2021-11-13