更新
This commit is contained in:
@@ -26,4 +26,46 @@ class AdService{
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取广告位信息
|
||||
*
|
||||
* @param [type] $request
|
||||
* @return void
|
||||
*/
|
||||
public function getAdPlaceDetail($request){
|
||||
$id = $request->param('id', 0);
|
||||
$place = AdPlace::where('id', '=', $id)->findOrEmpty();
|
||||
return $place->isEmpty() ? [] : $place;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 创建广告位
|
||||
*
|
||||
* @param [type] $request
|
||||
* @return void
|
||||
*/
|
||||
public function createAdPlace($request){
|
||||
$data = $request->post();
|
||||
|
||||
return AdPlace::create($data);
|
||||
}
|
||||
|
||||
public function updateAdPlace($request){
|
||||
$data = $request->post();
|
||||
|
||||
return AdPlace::update($data, ['id' => $data['id']]);
|
||||
}
|
||||
|
||||
public function getAdByPlace($request){
|
||||
$param = $request->param();
|
||||
$order = "id desc";
|
||||
|
||||
if(isset($param['id']) && $param['id']){
|
||||
$map[] = ['place_id', '=', $param['id']];
|
||||
}
|
||||
|
||||
$list = Ad::where($map)->order($order)->paginate($request->pageConfig);
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user