|
@@ -101,6 +101,7 @@ class TopicRepository {
|
|
'status_code' => 500
|
|
'status_code' => 500
|
|
]);
|
|
]);
|
|
}
|
|
}
|
|
|
|
+ $oldName = $topic->name;
|
|
$_topic = $this->topic->where(['name'=>$request['name']])->where('id','<>',$topic->id)->first();
|
|
$_topic = $this->topic->where(['name'=>$request['name']])->where('id','<>',$topic->id)->first();
|
|
if($_topic){
|
|
if($_topic){
|
|
return Response::create([
|
|
return Response::create([
|
|
@@ -135,6 +136,10 @@ class TopicRepository {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
DB::commit();
|
|
DB::commit();
|
|
|
|
+ if($oldName != $topic->name){
|
|
|
|
+ Redis::zrem('topic.name', $oldName);
|
|
|
|
+ Redis::zadd('topic.name', $topic->id, $topic->name);
|
|
|
|
+ }
|
|
return Response::create();
|
|
return Response::create();
|
|
}catch (QueryException $exception){
|
|
}catch (QueryException $exception){
|
|
DB::rollBack();
|
|
DB::rollBack();
|