|
@@ -473,7 +473,6 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询网站的广告
|
|
|
* @param array $data
|
|
@@ -481,6 +480,7 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
*/
|
|
|
public function getWebsiteAdvertisement(array $data): array
|
|
|
{
|
|
|
+
|
|
|
$where = [
|
|
|
'website_id' => 1,
|
|
|
'id' => $data['ad_placeid']
|
|
@@ -502,29 +502,27 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
return Result::success($result);
|
|
|
}else{
|
|
|
//查找在生效时间的广告
|
|
|
- $today = Carbon::now();
|
|
|
+ $today = Carbon::now();
|
|
|
foreach($ad as $i)
|
|
|
- {
|
|
|
+ {
|
|
|
$starttime=Carbon::parse($i['fromtime']);
|
|
|
$endtime=Carbon::parse($i['totime']);
|
|
|
- $time=$today->between($starttime,$endtime);
|
|
|
+ $time=$today->between($starttime,$endtime);
|
|
|
if($time)
|
|
|
{
|
|
|
- $result=$i;
|
|
|
+ $result=$i;
|
|
|
}
|
|
|
}
|
|
|
if(empty($result)){
|
|
|
$result=$ad;
|
|
|
return Result::success($result);
|
|
|
}else{
|
|
|
- return Result::success($result);
|
|
|
+ return Result::success($result);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
*
|
|
|
* @param array $data
|
|
@@ -534,21 +532,21 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
public function selectWebsiteDepartment(array $data): array
|
|
|
{
|
|
|
|
|
|
- $depart = Department::where('pid',0)->orderBy('id','asc')->limit(10)->get();
|
|
|
- if(isset($data['keyword']) && !empty($data['keyword'])){
|
|
|
+ $depart = Department::where('pid',0)->orderBy('id','asc')->limit(10)->get();
|
|
|
+ if(isset($data['keyword']) && !empty($data['keyword'])){
|
|
|
$departments= Department::where('name', 'like', '%' . $data['keyword'] . '%')->get();
|
|
|
if(empty($departments)){
|
|
|
- $result['message']="未查询到与此相关职能部门";
|
|
|
- }else{
|
|
|
+ $result['message']="未查询到与此相关职能部门";
|
|
|
+ }else{
|
|
|
$count = Department::where('name','like',"%{$data['keyword']}%")->count();
|
|
|
$m = [
|
|
|
- 'department'=>$depart,
|
|
|
+ 'department'=>$depart,
|
|
|
'type'=>$departments,
|
|
|
'count'=>$count
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- $result['sele'] = $m;
|
|
|
+ $result['sele'] = $m;
|
|
|
return Result::success($result['sele']);
|
|
|
|
|
|
}
|
|
@@ -557,36 +555,32 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
/**
|
|
|
* 搜索地区
|
|
|
- */
|
|
|
- public function selectWebsiteArea(array $data): array
|
|
|
- {
|
|
|
-
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function selectWebsiteArea(array $data): array
|
|
|
+ {
|
|
|
$provinces=District::where('pid',0)->where('status',1)->get();
|
|
|
|
|
|
- if(isset($data['province'])){
|
|
|
+ if(isset($data['province'])){
|
|
|
$province=District::where('pid',0)->where('status',1)->where('id',$data['province'])->orderBy('id')->get();
|
|
|
- $province=$province->toArray();
|
|
|
+ $province=$province->toArray();
|
|
|
if(!empty($province)){
|
|
|
$citys=District::where('pid',$data['province'])->where('status',1)->orderBy('id')->get();
|
|
|
if(!empty($citys) && isset($data['city']) && !empty($data['city'])){
|
|
|
// $province = $province->toArray();
|
|
|
$province_id=[];
|
|
|
foreach($province as $val){
|
|
|
- array_push($province_id,$val['id']);
|
|
|
+ array_push($province_id,$val['id']);
|
|
|
}
|
|
|
// var_dump($province_id);
|
|
|
$city=District::whereIn('pid',$province_id)->where('status',1)->where('id',$data['city'])->orderBy('id')->get();
|
|
|
if(!empty($city)){
|
|
|
$city_id=[];
|
|
|
foreach($city as $val){
|
|
|
- array_push($city_id,$val['id']);
|
|
|
+ array_push($city_id,$val['id']);
|
|
|
}
|
|
|
$regions=District::whereIn('pid',$city_id)->where('status',1)->orderBy('id')->get();
|
|
|
|
|
@@ -596,9 +590,9 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
'region' => $regions
|
|
|
];
|
|
|
}else{
|
|
|
- return Result::error("未查询到此城市",0);
|
|
|
+ return Result::error("未查询到此城市",0);
|
|
|
}
|
|
|
- }else{
|
|
|
+ }else{
|
|
|
$result=[
|
|
|
'province' => $province,
|
|
|
'city' => $citys,
|
|
@@ -606,61 +600,61 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
];
|
|
|
}
|
|
|
}else{
|
|
|
- return Result::error("未查询到此省份",0);
|
|
|
+ return Result::error("未查询到此省份",0);
|
|
|
}
|
|
|
}else{
|
|
|
// $keys = array('data');
|
|
|
$result = $provinces;
|
|
|
- }
|
|
|
- return Result::success($result);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取栏目
|
|
|
* @param array $data
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function getWebsiteModelCategory(array $data): array
|
|
|
+
|
|
|
+ public function getWebsiteModelCategory(array $data): array
|
|
|
{
|
|
|
- $website_id=[
|
|
|
- 'website_id' => $data['website_id']
|
|
|
+ $website_id=[
|
|
|
+ 'website_id' => $data['website_id']
|
|
|
];
|
|
|
- $placeid=$data['placeid']-1;
|
|
|
+ $placeid=$data['placeid']-1;
|
|
|
$pid=[
|
|
|
- 'pid' => $data['pid'],
|
|
|
+ 'pid' => $data['pid'],
|
|
|
];
|
|
|
$num = $data['num'];
|
|
|
|
|
|
$result=WebsiteCategory::where($website_id)->where($pid)->orderBy('sort')->offset($placeid)->limit($num)->get();
|
|
|
- $result = $result->toArray();
|
|
|
- if(!empty($result)){
|
|
|
- return Result::success($result);
|
|
|
- }else{
|
|
|
- return Result::error("本网站暂无栏目",0);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ $result = $result->toArray();
|
|
|
+ if(!empty($result)){
|
|
|
+ return Result::success($result);
|
|
|
+ }else{
|
|
|
+ return Result::error("本网站暂无栏目",0);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取友情链接
|
|
|
* @param array $data
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function selectWebsiteLinks(array $data): array
|
|
|
- {
|
|
|
- $where = [
|
|
|
- 'website_id' => $data['website_id'],
|
|
|
+
|
|
|
+ public function selectWebsiteLinks(array $data): array
|
|
|
+ {
|
|
|
+ $where = [
|
|
|
+ 'website_id' => $data['website_id'],
|
|
|
'status' => 1,
|
|
|
- 'type' => $data['type']
|
|
|
- ];
|
|
|
+ 'type' => $data['type']
|
|
|
+ ];
|
|
|
$num=$data['num'];
|
|
|
- $result=Link::where($where)->orderBy('id')->limit($num)->get();
|
|
|
- if(!empty($result)){
|
|
|
- return Result::success($result);
|
|
|
- }else{
|
|
|
- return Result::error("本网站暂无此类型友情链接",0);
|
|
|
+ $result=Link::where($where)->orderBy('id')->limit($num)->get();
|
|
|
+ if(!empty($result)){
|
|
|
+ return Result::success($result);
|
|
|
+ }else{
|
|
|
+ return Result::error("本网站暂无此类型友情链接",0);
|
|
|
}
|
|
|
}
|
|
|
|