orderRaw('rand()');
/** * 随机获取一条商品信息 * @param [type] $condition * @param [type] $field * @param [type] $limit * @return void */ public function randSkuid($condition, $field, $limit) { $result = $this->where($condition)->field($field)->orderRaw('rand()')->limit($limit)->select(); return $result ? $result->toArray() : []; }