Beispiel #1
0
 function getResourceInfo($type, $id = 0, $localId = 0, $name = "")
 {
     $tblEntrance = new DB_Sso_Entrance();
     $tblResource = new DB_Sso_Resource();
     switch ($type) {
         case Common_Config::PUBLIC_SCHOOL_TYPE:
             $entrance = $tblEntrance->scalar("customer_name,customer_title,logo", "where id = {$id}");
             return $entrance;
         case Common_Config::PUBLIC_COURSE_TYPE || Common_Config::PUBLIC_CHAPTER_TYPE || Common_Config::PUBLIC_SECTION_TYPE:
             if ($id) {
                 $course = $tblResource->scalar("name,entrance_id", "where id = {$id}");
                 $logo = $tblEntrance->scalar("logo", "where id = {$id}");
                 $course = array_merge($course, $logo);
                 return $course;
             } else {
                 $schoolId = $tblResource->scalar("entrance_id", "where name='{$name}' and local_id = {$localId}");
                 //print_r($schoolId);
                 $logo = $tblEntrance->scalar("logo,customer_name", "where id = {$schoolId['entrance_id']}");
                 return $logo;
             }
     }
 }
Beispiel #2
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;
 }