From 6017f46b762663b9393cdae8422e0de1ed3db218 Mon Sep 17 00:00:00 2001
From: guifei zhu <guifeizhu@guifeideiMac.local>
Date: 星期三, 27 十一月 2024 13:30:06 +0800
Subject: [PATCH] 添加mqtt数据接口

---
 common/api.js |   98 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 79 insertions(+), 19 deletions(-)

diff --git a/common/api.js b/common/api.js
index bb159dc..7da8c93 100644
--- a/common/api.js
+++ b/common/api.js
@@ -1,27 +1,87 @@
-import {fly} from '@/common/request/fly.js'
- //閰嶇疆璇锋眰鍩哄湴鍧�
-fly.config.baseURL= "https://dev.shlanbao.cn:8800/herb"
-
-// 娴嬭瘯
-function test(params) {
-  return fly.get('/test/jeecgDemo/queryById',params);
+import {
+	fly
+} from '@/common/request/fly.js'
+//閰嶇疆璇锋眰鍩哄湴鍧�
+fly.config.baseURL = "http://192.168.12.20:9999"
+const url = uni.getStorageSync('baseurl');
+if (url) {
+	fly.config.baseURL = url + "/herb"
 }
 
-function getRealTimeData(params) {
-	fly.config.loading = false
-  return fly.get('/dry/real/getRealTimeData',params);
+const mqttBaseUrl = "223.241.221.20"; 
+const emqxBaseUrl = "http://"+mqttBaseUrl +":18083/api/v5"
+
+// 娴嬭瘯
+function test(params) {
+	return fly.get('/test/jeecgDemo/queryById', params);
+}
+
+function login(params) {
+	fly.config.loading = true
+	return fly.post('/sys/mLogin', params);
+}
+
+//瀹炴椂鏁版嵁
+function getRealTimeData(params) {
+	fly.config.loading = false
+	return fly.get('/dry/real/getRealTimeData', params);
+}
+
+//鍒嗘瀽鏁版嵁
+function getAnalyList(params) {
+	fly.config.loading = true
+	return fly.get('/dry/dryResult/list', params);
+}
+
+//璁㈠崟鏁版嵁
+function getOrderList(params) {
+	fly.config.loading = true
+	return fly.get('/dry/dryOrder/list', params);
 }
-
-function getAnalyList(params) {
+//璁惧鍒楄〃
+function queryEquList(params){
 	fly.config.loading = true
-  return fly.get('/dry/dryResult/list',params);
+	return fly.get('/mobile/equ/list', params);
+}
+
+//
+function getMonth(params) {
+	fly.config.loading = true
+	return fly.get('/dry/dryOrder/monthOverview', params);
+}
+
+function sendCommand(params) {
+	fly.config.loading = true
+	return fly.post('/dry/real/sendCommand', params);
 }
 
 
-
-
+//emqx 鎺ュ彛
+function emqxClients() {
+	fly.config.loading = true
+	return fly.get(emqxBaseUrl + "/clients", {
+		auth: {
+		  username: "a3dc6758f6abc41a",
+		  password: "FvBwJcmqhAuQ0aBg4FLl5gQA9A9BE64bpl0oJTg9A6I0bK"
+		},
+		headers: {
+      'Content-Type': 'application/json',
+    },
+	});
+}
+
+
+
 export default {
-	test,
-	getRealTimeData,
-	getAnalyList
-}
+	test,
+	login,
+	getRealTimeData,
+	getAnalyList,
+	getOrderList,
+	queryEquList,
+	getMonth,
+	sendCommand,
+	
+	emqxClients,
+	mqttBaseUrl
+}
\ No newline at end of file

--
Gitblit v1.9.3