zoukankan      html  css  js  c++  java
  • 机智的查询

    $uid = $_GET['uid'];
    if ($uid) { // 很机智
        vendor("Func.Func");
        if (Func::checkMobile($uid)) {
            $uid = $user->where(['telphone' => $uid])->getField('id');
        }
        $where['uid'] = $uid;
        $this->assign('uid', $_GET['uid']);
        $tail .= '&uid=' . $_GET['uid'];
    }
    
    $act_name   = trim($_GET['act_name']);
    $groupModel = M('group_purchase');
    if ($act_name) {
        $this->assign('act_name', $act_name);
        $tail       .= '&act_name=' . $act_name;
        $group_flag = $groupModel->where(['title' => ['like', '%' . $act_name . '%']])->field('id')->select();
    
        $group_ids = [];
        foreach ($group_flag as $v) {
            $group_ids[] = $v['id'];
        }
    
        $where['group_id'] = ['in', $group_ids];
    }
    
    $group_id = trim($_GET['group_id']);
    if ($group_id) {
        $this->assign('group_id', $group_id);
        $tail                  .= '&group_id=' . $group_id;
        $where['group_id'] = $group_id;
    }
    

    这段查询,很机智。
    灵活判断,分别处理。
    直接查不到,那就间接查询。

  • 相关阅读:
    day13
    day11作业
    day12
    小结2
    iOS-常见问题
    iOS-ASIHTTPRequest缓存机制
    iOS-文件断点续传
    iOS-Http : GET : POST
    iOS-通信录
    iOS-汉字排序
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/10945986.html
Copyright © 2011-2022 走看看