phalcon在model查询find中使用in查询

上代码比较直接。希望对大家有用,phalcon的文档是在令人诟病

$types = [1,2,3,4]
$prizeList = Prize::find([
                    "conditions" => 'status = ?0 and app_config_id =?1 and city_id =?2 and game_code =?3 and level =?4 and type IN ({typeList:array})',
                    "order" => 'get_probability DESC, sort DESC',
                    "bind"       => [
                        0 => 1,
                        1 => GOB::APP_CONFIG_ID,
                        2 => $city_id,
                        3 => $gameCode,
                        4 => $this->level,
                        'typeList'=>$type
                    ]
                ]);

使用这种查询方式就查询出类似这样的效果

select * from `prize` where type in ($typeList);

猜你喜欢

转载自blog.csdn.net/qq_27295403/article/details/84637403
今日推荐