Exemple #1
0
 public function filterPrimary($uid)
 {
     $tblSchoolSta = new DB_Udo_SchoolStatistics();
     $tblAd = new DB_Udo_Ad();
     $adList = [];
     $primary = $tblSchoolSta->query("select schoolId,userId from udo_school_statistics where (schoolId = 12 or schoolId = 2746) and userId = {$uid}");
     if ($primary) {
         $ad = $tblAd->scalar("id,price,url", "where description = 'kaixinzuowen'");
         array_push($adList, $ad);
         return $adList;
     } else {
         return -1;
     }
 }
Exemple #2
0
 function getSubscribe($array, $uid, $type)
 {
     $tblSub = new DB_Udo_SchoolSubscribe();
     $tblSta = new DB_Udo_SchoolStatistics();
     //获取到所有已订阅的频道id
     $subSchools = $tblSub->fetchAll("id,schoolId", "where userId = {$uid} and isValid = 1");
     //print_r($subSchools);
     $sub_array = [];
     //根据频道操作日志表中的最近时间排序已知的id(需要确保)
     $subIds = $tblSub->columnRow($subSchools, "schoolId");
     //print_r($subIds);
     //$sta = $tblSta->fetchAll("id,schoolId","where userId = {$uid} and schoolId in (".implode(",",$subIds).") group by schoolId","order by createTime desc");
     $sta = $tblSta->fetchAll("id,schoolId", "where userId = {$uid} and schoolId in (" . implode(",", $subIds) . ") ", "order by createTime desc");
     //$sta = $tblSta->fetchAll("id,schoolId","where userId = {$uid} group by schoolId","order by createTime desc");
     //$stas =  $tblSta->fetchAll("id,schoolId","where userId = {$uid}","order by createTime desc");
     $staIds = $tblSta->columnRow($sta, "schoolId");
     //print_r($staIds);
     //print_r($stas);
     $orderIds = array_unique($staIds);
     //print_r($orderIds);
     //print_r(count($orderIds));
     //根据id过滤已订阅信息
     /*        foreach ($array['entrances'] as $k=>$value){
                 foreach ($orderIds as $l){
     
                 }
                 if (count($sub_array) == count($orderIds))
                     break;
             }*/
     foreach ($orderIds as $l) {
         foreach ($array as $k => $value) {
             if ($value['id'] == $l) {
                 array_push($sub_array, $value);
             }
         }
         if (count($sub_array) == count($orderIds)) {
             break;
         }
     }
     //如果是获取前三个订阅信息
     if ($type == 2) {
         $sub_array = array_slice($sub_array, 0, 3);
     }
     //print_r($sub_array);
     return $sub_array;
 }
Exemple #3
0
 function searchBought($uid, $key)
 {
     //$key = "金";
     $tblBought = new DB_Udo_UserBought();
     $tblResource = new DB_Sso_Resource();
     $tblEntrance = new DB_Sso_Entrance();
     $tblSta = new DB_Udo_SchoolStatistics();
     $tradeModel = new TradeModel();
     //首先获取用户购买的课程和所在的频道
     $bought = $tblBought->fetchAll("id,resourceId,schoolId", "where userId ={$uid} and resourceType = 2 ", "order by id asc");
     //print_r($bought);
     //print_r($bought);
     $resultArray = [];
     //接下来对逐个课程,获取频道的具体信息和课程的具体信息
     foreach ($bought as $k => $value) {
         $entrance = $tblEntrance->scalar("customer_name,customer_title,logo,api_udo_url", "where id = {$value['schoolId']} and (customer_name like '%{$key}%'\r\n            or customer_title like '%{$key}%')");
         $resource = $tblResource->scalar("name", "where id = {$value['resourceId']} and name like '%{$key}%'");
         //如果搜索到了频道或课程包含关键词,再显示该条信息
         if ($entrance || $resource) {
             $sta = $tblSta->queryCount("where schoolId = {$value['schoolId']} group by userId");
             if (!$sta) {
                 $sta = 0;
             }
             $entrance = $tblEntrance->scalar("customer_name,customer_title,logo,api_udo_url", "where id = {$value['schoolId']}");
             $resource = $tblResource->scalar("name", "where id = {$value['resourceId']} ");
             $info = $sta . "人已学";
             //获取课程的localId供在列表中进行跳转
             $localId = $tradeModel->getLocalId($value['resourceId'], $value['schoolId']);
             array_push($resultArray, array("id" => $value['resourceId'], "localId" => $localId['local_id'], "logo" => $entrance['logo'], "name" => $resource['name'], "schoolName" => $entrance['customer_name'], "schoolTitle" => $entrance['customer_title'], "info" => $info, "schoolId" => $value['schoolId'], "apiUdoUrl" => $entrance['api_udo_url'], "courseType" => 0));
         }
     }
     return $resultArray;
 }