美文网首页
tp框架union的闭包写法记录

tp框架union的闭包写法记录

作者: 王玉伟的伟 | 来源:发表于2019-12-11 10:52 被阅读0次
    $get_act = Db::field($field)
                ->table('yook_activity')
                ->where($wheresss)
                ->where('act_sign_end_time','gt',time())
                ->order("toptime desc")
                ->page($page, $limit)
                ->union(function ($query) use($wheresss, $field){
    //                d($wheresss);
                    $wheresss['act_sign_end_time'] = ['lt',time()];
                    $wheresss['act_start_time'] = ['gt',time()];
                    $wheresss['act_end_time'] = ['gt',time()];
                    $query->field($field)
                        ->table('yook_activity')
                        ->where($wheresss)
                        ->order("toptime desc");
                })
                ->union(function ($query) use ($wheresss, $field) {
                    $wheresss['act_end_time'] = ['lt',time()];
                    $query->field($field)
                        ->table('yook_activity')
                        ->where($wheresss)
                        ->order("toptime desc");
                })
                ->select();
    

    相关文章

      网友评论

          本文标题:tp框架union的闭包写法记录

          本文链接:https://www.haomeiwen.com/subject/cylogctx.html