|
@@ -17,11 +17,16 @@ class TopicForm extends BaseForm
|
|
|
*/
|
|
|
public $name;
|
|
|
|
|
|
+ public $name1;
|
|
|
+
|
|
|
+ public $name2;
|
|
|
+
|
|
|
public function rules()
|
|
|
{
|
|
|
return [
|
|
|
//create_queue delete_queue
|
|
|
- [['name'], 'required', 'message' => 1100, 'on' => ['create_topic', 'delete_topic']],
|
|
|
+ [['name'], 'required', 'message' => 1100, 'on' => ['create_topic', 'delete_topic']],
|
|
|
+ [['name1','name2'], 'required', 'message' => 1100, 'on' => ['update_topic']],
|
|
|
['name', 'string', 'message' => 1101, 'on' => ['create_topic', 'delete_topic']],
|
|
|
['name', 'filter', 'filter' => 'trim', 'on' => ['create_topic', 'delete_topic']],
|
|
|
];
|
|
@@ -109,6 +114,23 @@ class TopicForm extends BaseForm
|
|
|
return ['count' => count($rows), 'rows' => $rows];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * [修改队列]
|
|
|
+ * @author: hanguangxu
|
|
|
+ * @return array
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public function updateTopic()
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $connect = $this->getConnect();
|
|
|
+ $channel = $connect->channel();
|
|
|
+ $channel->exchange_delete($this->name1, false, false );
|
|
|
+ list($topic,,) = $channel->exchange_declare($this->name2, 'topic', false, true, false);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ throw new Exception(1001, $e->getMessage());
|
|
|
+ }
|
|
|
+ return $data = ['TopicName' => empty($topic)?$this->name2:$topic];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|