function getSchoolPrice($priceType = 0, $isPriced = 2, $isPublic = 2, $keyword = "", $schoolId = 0) { $tblEntrance = new DB_Sso_Entrance(); $tblSchoolPrice = new DB_Udo_SchoolPrice(); $schoolModel = new SchoolModel(); //构造筛选条件 $where = "where open_status = 1"; if ($keyword) { $where .= " and (customer_name like '%{$keyword}%' or customer_title like '%{$keyword}%')"; } if ($schoolId) { $where .= " and id ={$schoolId}"; } if ($isPublic != 2) { $where .= " and is_public = {$isPublic}"; } //默认按照频道发布的先后顺序排 $entrance = $tblEntrance->fetchAll("id,customer_name,customer_title,is_public,created_on", $where, "order by created_on desc"); $resultArr = []; foreach ($entrance as $k => $val) { $price = $tblSchoolPrice->scalar("resourceId,priceType,price", "where resourceId = {$val['id']}"); if (!$price) { $val['priceType'] = 0; $val['price'] = 0; } else { $val['price'] = $price['price']; $val['priceType'] = $price['priceType']; } //根据定价类型和是否定价的条件筛选掉不符合的项目 if ($priceType) { if ($val['priceType'] != $priceType) { continue; } } if ($isPriced == 1) { if (!$price) { continue; } } if ($isPriced == 0) { if ($price) { continue; } } //通过筛选的频道获取消费者人次和课程数量 $val['cusNumber'] = $this->getCustomerNumber($val['id']); $val['courseNumber'] = $schoolModel->getCourseNumber($val['id']); //跟据数字类型的priceType给类型命名 $val['type'] = $this->getPriceTypeName($price['priceType']); $val['public'] = $val['is_public'] ? "公开" : "私有"; array_push($resultArr, $val); } return $resultArr; }