|
@@ -120,4 +120,26 @@ class TopicGroupRepository {
|
|
public function view($request){
|
|
public function view($request){
|
|
return $this->topicGroup->where(['id'=>$request['id']])->first();
|
|
return $this->topicGroup->where(['id'=>$request['id']])->first();
|
|
}
|
|
}
|
|
|
|
+ //删除
|
|
|
|
+ public function delete($request){
|
|
|
|
+ $topicGroup = $this->topicGroup->where(['id'=>$request['id']])->first();
|
|
|
|
+ DB::beginTransaction();
|
|
|
|
+ try{
|
|
|
|
+ if($topicGroup){
|
|
|
|
+ $res = $this->topicGroup->where(['id'=>$request['id']])->delete();
|
|
|
|
+ if($res){
|
|
|
|
+ $this->topicGroupInfo->where(['topic_group_id'=>$topicGroup->id])->delete();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }catch (QueryException $exception){
|
|
|
|
+ DB::rollBack();
|
|
|
|
+ Log::debug('删除推荐话题组:'.$exception->getMessage());
|
|
|
|
+ return Response::create([
|
|
|
|
+ 'message' => '删除推荐话题组失败,请重试',
|
|
|
|
+ 'error' => $exception->getMessage(),
|
|
|
|
+ 'status_code' => 500
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|