thinkphp 随机查询出数据(每次数据不同)
2023-03-29 23:03:03
137
{{single.collect_count}}
  1. 要求每次打开看到的都是不同的热卖商品
  2. 商品依旧是热卖,是随机的
  3. 随机时不能出现两个一模一样的商品
/** * 热卖商品 * 刷新随机展示四条 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */public static function hot(){$data = \app\home\model\Goods::where('is_hot',1)->orderRaw('rand()')->limit(4)->select()->toArray();return $data;}
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}