- 要求每次打开看到的都是不同的热卖商品
- 商品依旧是热卖,是随机的
- 随机时不能出现两个一模一样的商品
/**
* 热卖商品
* 刷新随机展示四条
* @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;
}