链式的闭包or查询

$info = gM('Consult')->settype($type)
                    ->limit(($page - 1) * $size, $size)
                    ->order('id', 'desc')
                    ->where($where)
                    ->where('faker', 0)
                    ->where(function ($query) use($ispay) {
                        if($ispay){
                            $query->where('isplatform', '=', 1)
                                ->whereOr('ispay', '=', $ispay);
                        }else{
                            $query->where('ispay', '=', $ispay)->where('isplatform', '=', 0);
                        }
                    })
                    ->select()
                    ->toArray();

您可以自由的转载和修改,但请务必注明文章来源并且不可用于商业目的。
本站大部分内容收集于互联网,如果有侵权内容、不妥之处,请联系删除。敬请谅解!

  Previous post mysql处理高库存超卖
Next post   go chan 缓冲却别 code

  关于博主【WANG-FEiHU】

Replicate
-----------Complicate
--------------------------Appreciate
----------------------------------------[Fate]
-----------------------------------------------Elevate

三人行 有吾师

-------------花有重开日 梦无止境时-------------

  分类目录

  monitor(TD)

不放弃

不怕万人阻挡,只怕自己投降。

人家的时间都用在了努力,而你的时间却用在了选择,当你将放弃当作一种习惯,你一辈子也不会有出息。

知其所以然

鲜衣怒马,绝代风华。 we are the world

Je le sais continue c'est pas bon,A la fin tu restes pas longtemps