有没有办法限制yii模型中的n个内容,我的代码是
if($user_type==1){
$query->andFilterWhere([['id' => SORT_DESC])->one();]);
}
如果用户在免费计划中必须只显示一个产品,或者必须根据计划数量显示产品,这是一个列出产品的模型将改变我不知道如何添加条件我需要像< / p>
Dim t As DateTime = DateTime.Now
Dim m as Integer = t.Minute
If m < 3 Then
m = 3 - m 'we should call timer soon before next hour
Else
m = (60 - m) + 3 'here (60-m) counts minutes left in this hour
If m = 3 Then DoMyTasks() 'execute your code... 'remove this based on your needs!
End If
tmrDPL.Interval = (m * 60 - t.Second) * 1000 'specify first interval in millisec.
答案 0 :(得分:1)
Raul Sauco已经提到你可以使用类似的东西
$query->andFilterWhere([['id' => SORT_DESC])->limit($user_type == 1 ? 1 : 20);