|
|
@ -38,6 +38,8 @@ class ResourceLogic extends Logic |
|
|
|
|
|
|
|
|
if(isset($get['pid']) ){ |
|
|
if(isset($get['pid']) ){ |
|
|
$where[] = ['pid','=',$get['pid']]; |
|
|
$where[] = ['pid','=',$get['pid']]; |
|
|
|
|
|
}else{ |
|
|
|
|
|
$where[] = ['pid','=',0]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $model->field(['id', 'name']) |
|
|
return $model->field(['id', 'name']) |
|
|
@ -51,6 +53,7 @@ class ResourceLogic extends Logic |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Notes: 文章列表 |
|
|
* @Notes: 文章列表 |
|
|
* @Author: 张无忌 |
|
|
* @Author: 张无忌 |
|
|
@ -73,6 +76,7 @@ class ResourceLogic extends Logic |
|
|
$where[] = ['a.title', 'like', "%".$get['keyword']."%"]; |
|
|
$where[] = ['a.title', 'like', "%".$get['keyword']."%"]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($get['cid']) && !empty($get['cid']) && $get['cid']>0 && !strstr($get['cid'],"city_") ) { |
|
|
if(isset($get['cid']) && !empty($get['cid']) && $get['cid']>0 && !strstr($get['cid'],"city_") ) { |
|
|
$where[] = ['cid', '=', $get['cid']]; |
|
|
$where[] = ['cid', '=', $get['cid']]; |
|
|
} |
|
|
} |
|
|
@ -109,7 +113,7 @@ class ResourceLogic extends Logic |
|
|
|
|
|
|
|
|
$list = $model->alias('a') |
|
|
$list = $model->alias('a') |
|
|
->join('resource_category c', 'c.id = a.cid') |
|
|
->join('resource_category c', 'c.id = a.cid') |
|
|
->field(['a.id', 'a.title', 'a.image', 'a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) |
|
|
->field(['a.id', 'a.title', 'a.image', 'a.base_visit','a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) |
|
|
->where($where) |
|
|
->where($where) |
|
|
->order($order) |
|
|
->order($order) |
|
|
->page($get['page_no'], $get['page_size']) |
|
|
->page($get['page_no'], $get['page_size']) |
|
|
@ -117,6 +121,7 @@ class ResourceLogic extends Logic |
|
|
->toArray(); |
|
|
->toArray(); |
|
|
foreach ($list as &$item){ |
|
|
foreach ($list as &$item){ |
|
|
$item['price_str'] = $item['type']==0? "免费":($item['type']==1?"VIP会员免费":round($item['price'],2)); |
|
|
$item['price_str'] = $item['type']==0? "免费":($item['type']==1?"VIP会员免费":round($item['price'],2)); |
|
|
|
|
|
$item['visit'] = $item['visit'] +$item['base_visit'] ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -136,7 +141,7 @@ class ResourceLogic extends Logic |
|
|
$list = $model->alias('b') |
|
|
$list = $model->alias('b') |
|
|
->join('resource a', 'b.resource_id = a.id') |
|
|
->join('resource a', 'b.resource_id = a.id') |
|
|
->join('resource_category c', 'c.id = a.cid') |
|
|
->join('resource_category c', 'c.id = a.cid') |
|
|
->field(['a.id', 'a.title', 'a.image', 'a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) |
|
|
->field(['a.id', 'a.title', 'a.image','a.image', 'a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) |
|
|
->where($where) |
|
|
->where($where) |
|
|
->order($order) |
|
|
->order($order) |
|
|
->page($get['page_no'], $get['page_size']) |
|
|
->page($get['page_no'], $get['page_size']) |
|
|
@ -206,6 +211,7 @@ class ResourceLogic extends Logic |
|
|
$pattern = '/<a[^>]+href=["\'](.*?\.(?:mp4|wav))["\'][^>]*>(.*?)<\/a>/i'; |
|
|
$pattern = '/<a[^>]+href=["\'](.*?\.(?:mp4|wav))["\'][^>]*>(.*?)<\/a>/i'; |
|
|
$replacement = '<video src="$1"></video>'; |
|
|
$replacement = '<video src="$1"></video>'; |
|
|
$article['content'] = preg_replace($pattern, $replacement, $article['content']); |
|
|
$article['content'] = preg_replace($pattern, $replacement, $article['content']); |
|
|
|
|
|
$article['visit'] = $article['visit'] +$article['base_visit'] ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $article; |
|
|
return $article; |
|
|
|