Przeglądaj źródła

添加保命、还原

DESKTOP-NE65RNK\Citrus_limon 1 rok temu
rodzic
commit
bc27555095

+ 2 - 2
.env.development

@@ -1,5 +1,5 @@
 VITE_APP_ENV = development
 
-VITE_API_BASE_URL = "http://cc.skyfffire.com/api"
-# VITE_API_BASE_URL = "http://tcc.skyfffire.com/api"
+# VITE_API_BASE_URL = "http://cc.skyfffire.com/api"
+VITE_API_BASE_URL = "http://tcc.skyfffire.com/api"
 # VITE_API_BASE_URL = "http://192.168.1.2:81"

+ 12 - 1
src/api/index.ts

@@ -113,13 +113,24 @@ export const update_robot_batch = (params: any, callback: any) => {
     if (data) callback && callback(data);
   });
 };
-
 // 机器人管理-删除机器人
 export const delete_robot = (params: any, callback: any) => {
   return http.request("/robot/delete", "post", params).then((data) => {
     if (data) callback && callback(data);
   });
 };
+// 机器人管理-保命
+export const survive_robot = (params: any, callback: any) => {
+  return http.request("/robot/protectLife", "post", params).then((data) => {
+    if (data) callback && callback(data);
+  });
+};
+// 机器人管理-还原
+export const restore_robot = (params: any, callback: any) => {
+  return http.request("/robot/restore", "post", params).then((data) => {
+    if (data) callback && callback(data);
+  });
+};
 
 // 策略管理
 // 策略管理-策略列表

+ 45 - 4
src/views/bot/manage/index.vue

@@ -52,7 +52,17 @@
         <div class="custom-group">
           <lay-space>
             <lay-button v-if="apiList?.includes('/robot/update')" :border="'green'" size="xs" @click="handleBatchUpdate(selectedKeys)">批量设置</lay-button>
-            <lay-button :border="'green'" size="xs" @click="handleCopyParams(selectedKeys)">复制参数</lay-button>
+            <lay-button v-if="apiList?.includes('/robot/update')" :border="'green'" size="xs" @click="handleCopyParams(selectedKeys)">复制参数</lay-button>
+          </lay-space>
+        </div>
+        <div class="custom-group">
+          <lay-space>
+            <lay-tooltip position="bottom" content="把所有机器人杠杆调整成0.1,这样停机可以防止遗留仓位。">
+              <lay-button :border="'red'" size="xs" @click="handleSurviveRobot()"> 保命 </lay-button>
+            </lay-tooltip>
+            <lay-tooltip position="bottom" content="还原杠杆,可能会有的机器人没有开机成功,要检查下。">
+              <lay-button :border="'red'" size="xs" @click="handleRestoreRobot()"> 还原 </lay-button>
+            </lay-tooltip>
           </lay-space>
         </div>
       </div>
@@ -134,7 +144,7 @@ import Transfers from "./components/Transfers.vue";
 import Copy from "./components/Copy.vue";
 import TableButton from "@/components/TableButton.vue";
 import { timeConverts } from "@/utils/index";
-import { get_robot_list, delete_robot, set_robot_status, set_robot_reset_capital, update_robot_batch } from "@/api";
+import { get_robot_list, delete_robot, set_robot_status, set_robot_reset_capital, update_robot_batch, survive_robot, restore_robot } from "@/api";
 
 const ROBOT_STATUS: any = reactive({
   STOPPED: "已停止",
@@ -178,7 +188,7 @@ interface TablePage {
   limit: number;
   total: number;
 }
-const tablePage: TablePage = reactive({ current: 1, limit: 20, total: 0 });
+const tablePage: TablePage = reactive({ current: 1, limit: 20, total: 0, limits: [20, 50, 100, 200, 500] });
 const columns = ref([
   { title: "选项", width: "44px", type: "checkbox" },
   { title: "ID", width: "60px", key: "id" },
@@ -295,7 +305,6 @@ const handleCopyParams = async (ids: any) => {
       robotConfigs: [...configs, ...botConfigs],
     };
   });
-  pageConfig.loading = true;
   update_robot_batch(params, (data: any) => {
     pageConfig.loading = false;
     if (data.code == 200) {
@@ -305,6 +314,38 @@ const handleCopyParams = async (ids: any) => {
   });
 };
 
+// 保命方法
+const handleSurviveRobot = async () => {
+  let result = await proxy.$waitingConfirm("是否确认要执行保命操作?");
+  if (!result) return;
+
+  const params = {};
+  pageConfig.loading = true;
+  survive_robot(params, (data: any) => {
+    pageConfig.loading = false;
+    if (data.code == 200) {
+      proxy.$message(`执行成功!`);
+      getPageInfo();
+    }
+  });
+};
+
+// 还原方法
+const handleRestoreRobot = async () => {
+  let result = await proxy.$waitingConfirm("是否确认要执行还原操作?");
+  if (!result) return;
+
+  const params = {};
+  pageConfig.loading = true;
+  restore_robot(params, (data: any) => {
+    pageConfig.loading = false;
+    if (data.code == 200) {
+      proxy.$message(`执行成功!`);
+      getPageInfo();
+    }
+  });
+};
+
 const handleResetCapital = async (ids: any) => {
   if (ids.length == 0) return proxy.$message(`请先选择要复位本金机器!`, 7);
   let result = await proxy.$waitingConfirm("是否确认要复位机器本金?");

+ 4 - 0
src/views/server/manage/index.vue

@@ -16,6 +16,9 @@
           <lay-form-item label="名称" prop="title">
             <lay-input v-model="pageParams.title" />
           </lay-form-item>
+          <lay-form-item label="IP" prop="ip">
+            <lay-input v-model="pageParams.ip" />
+          </lay-form-item>
           <div class="form-button-wp">
             <lay-button @click="getPageInfo(true)">搜索</lay-button>
           </div>
@@ -87,6 +90,7 @@ interface FormItem {
   pageNum?: Number;
   pageSize?: Number;
   title?: String;
+  ip?: String;
 }
 const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10 });