/** * @param $params * @param $jpMemberId * @return array */ public static function getJpLibrary($params, $jpMemberId) { $order_field = intval($params['order_field']) > 0 ? 'category' : 'update_time'; $order_sort = intval($params['order_sort']) > 0 ? 'desc' : 'asc'; $category = isset($params['category']) ? $params['category'] : 0; $buildingId = intval($params['bi']); $publicImages = array(); if ($category == 0) { $publicImages = self::getBuildingImg($buildingId); } //office $house_type = false; $arrAllCates = Model_Image_Category::get_img_cates_by_type('office'); //shop if ($params['ao'] == 1) { $house_type = true; $arrAllCates = Model_Image_Category::get_img_cates_by_type('shop'); } $imgs = self::listGallery($jpMemberId, $buildingId, $category, $house_type, $order_field, $order_sort, 20); if (empty($imgs) && empty($publicImages)) { $return = array(); } else { $re1 = array(); if (!empty($publicImages)) { foreach ($publicImages as $img) { $temp = array(); $temp['url'] = BLL_House_JpProperty::build_img_url($img['hostId'], $img['key'], 400, 300); $temp['name'] = '来自公共图库'; $temp['type'] = 5; $temp['selected'] = false; $temp['id'] = $img['key']; $temp['key'] = $img['key']; $temp['hostId'] = $img['hostId']; $temp['imgWidth'] = $img['imgWidth']; $temp['imgHeight'] = $img['imgHeight']; $temp['imgSize'] = $img['imgSize']; $temp['public'] = 1; $temp['pid'] = $img['id']; //公共图库表自增长ID $re1[] = $temp; } } $re2 = array(); if (!empty($imgs)) { foreach ($imgs as $img) { $temp = array(); $temp['url'] = BLL_House_JpProperty::build_img_url($img['host_id'], $img['key'], 400, 300); $temp['name'] = $arrAllCates[$img['category']]; $temp['type'] = $img['category']; $temp['selected'] = false; $temp['key'] = $img['key']; $temp['id'] = $img['key']; $temp['hostId'] = $img['host_id']; $temp['category'] = $img['category']; $temp['imgWidth'] = $img['width']; $temp['imgHeight'] = $img['height']; $temp['imgSize'] = $img['size']; $temp['public'] = 0; $temp['gid'] = $img['id']; //公共图库表自增长ID $re2[] = $temp; } } $return = array_merge($re1, $re2); } return $return; }