mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 11:13:26 +00:00
no message
This commit is contained in:
parent
ebf9686a05
commit
2c99033f1a
@ -7,6 +7,7 @@ use App\Models\UmengAlias;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\UserEmailVerification;
|
use App\Models\UserEmailVerification;
|
||||||
use App\Models\UserTransfer;
|
use App\Models\UserTransfer;
|
||||||
|
use App\Models\WebSocket;
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
use Arr;
|
use Arr;
|
||||||
use Cache;
|
use Cache;
|
||||||
@ -734,4 +735,29 @@ class UsersController extends AbstractController
|
|||||||
return Base::retError('添加错误');
|
return Base::retError('添加错误');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {get} api/users/ws/exist 15. websocket是否存在
|
||||||
|
*
|
||||||
|
* @apiDescription 查询websocket连接是否存在
|
||||||
|
* @apiVersion 1.0.0
|
||||||
|
* @apiGroup users
|
||||||
|
* @apiName ws__exist
|
||||||
|
*
|
||||||
|
* @apiSuccess {Number} ret 返回状态码(1存在、0不存在)
|
||||||
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
|
* @apiSuccess {Object} data 返回数据(同"获取我的信息"接口)
|
||||||
|
*/
|
||||||
|
public function ws__exist()
|
||||||
|
{
|
||||||
|
$fd = Request::header('fd');
|
||||||
|
if (empty($fd)) {
|
||||||
|
return Base::retError('empty');
|
||||||
|
}
|
||||||
|
if (WebSocket::whereFd($fd)->exists()) {
|
||||||
|
return Base::retError('not exist');
|
||||||
|
} else {
|
||||||
|
return Base::retSuccess('success');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
36ad3964512174cc
|
d7ef78c75bbce249
|
||||||
|
|||||||
@ -252,18 +252,20 @@ export default {
|
|||||||
if (this.$openVlog) {
|
if (this.$openVlog) {
|
||||||
console.log('onPagePause');
|
console.log('onPagePause');
|
||||||
}
|
}
|
||||||
|
this.$store.dispatch("getBasicData", -1)
|
||||||
}
|
}
|
||||||
// 页面激活
|
// 页面激活
|
||||||
window.__onPageResume = (num) => {
|
window.__onPageResume = (num) => {
|
||||||
if (this.$openVlog) {
|
if (this.$openVlog) {
|
||||||
console.log('onPageResume', num);
|
console.log('onPageResume', num);
|
||||||
console.log('ws', this.ws);
|
console.log('ws', this.ws, this.ws ? this.ws.readyState : null);
|
||||||
console.log('ws.readyState', this.ws ? this.ws.readyState : null);
|
|
||||||
}
|
}
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
if (this.ws === null || this.ws.readyState === WebSocket.CLOSED) {
|
this.$store.dispatch("call", {
|
||||||
|
url: 'users/ws/exist',
|
||||||
|
}).catch(_ => {
|
||||||
this.$store.dispatch("websocketConnection");
|
this.$store.dispatch("websocketConnection");
|
||||||
}
|
});
|
||||||
this.$store.dispatch("getBasicData", 5000)
|
this.$store.dispatch("getBasicData", 5000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
40
resources/assets/js/app.js
vendored
40
resources/assets/js/app.js
vendored
@ -103,21 +103,30 @@ Vue.prototype.goBack = function (number) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Vue.prototype.$A = $A;
|
// 全局对象/变量
|
||||||
Vue.prototype.$Electron = null;
|
$A.Electron = null;
|
||||||
Vue.prototype.$Platform = "web";
|
$A.Platform = "web";
|
||||||
Vue.prototype.$isMainElectron = false;
|
$A.isMainElectron = false;
|
||||||
Vue.prototype.$isSubElectron = false;
|
$A.isSubElectron = false;
|
||||||
Vue.prototype.$isEEUiApp = isEEUiApp;
|
$A.isEEUiApp = isEEUiApp;
|
||||||
Vue.prototype.$isDesktop = $A.isDesktop();
|
$A.isDesktop = $A.isDesktop();
|
||||||
Vue.prototype.$openVlog = $A.getStorageString("vlog::open") === "open";
|
$A.openVlog = $A.getStorageString("vlog::open") === "open";
|
||||||
if (isElectron) {
|
if (isElectron) {
|
||||||
Vue.prototype.$Electron = electron;
|
$A.Electron = electron;
|
||||||
Vue.prototype.$Platform = /macintosh|mac os x/i.test(navigator.userAgent) ? "mac" : "win";
|
$A.Platform = /macintosh|mac os x/i.test(navigator.userAgent) ? "mac" : "win";
|
||||||
Vue.prototype.$isMainElectron = /\s+MainTaskWindow\//.test(window.navigator.userAgent);
|
$A.isMainElectron = /\s+MainTaskWindow\//.test(window.navigator.userAgent);
|
||||||
Vue.prototype.$isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent);
|
$A.isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vue.prototype.$A = $A;
|
||||||
|
Vue.prototype.$Electron = $A.Electron;
|
||||||
|
Vue.prototype.$Platform = $A.Platform;
|
||||||
|
Vue.prototype.$isMainElectron = $A.isMainElectron;
|
||||||
|
Vue.prototype.$isSubElectron = $A.isSubElectron;
|
||||||
|
Vue.prototype.$isEEUiApp = $A.isEEUiApp;
|
||||||
|
Vue.prototype.$isDesktop = $A.isDesktop;
|
||||||
|
Vue.prototype.$openVlog = $A.openVlog;
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
@ -138,13 +147,6 @@ $A.Modal = app.$Modal;
|
|||||||
$A.store = app.$store;
|
$A.store = app.$store;
|
||||||
$A.L = app.$L;
|
$A.L = app.$L;
|
||||||
|
|
||||||
$A.Electron = app.$Electron;
|
|
||||||
$A.Platform = app.$Platform;
|
|
||||||
$A.isMainElectron = app.$isMainElectron;
|
|
||||||
$A.isSubElectron = app.$isSubElectron;
|
|
||||||
$A.isEEUiApp = app.$isEEUiApp;
|
|
||||||
$A.isDesktop = app.$isDesktop;
|
|
||||||
$A.openVlog = app.$openVlog;
|
|
||||||
$A.execMainDispatch = (action, data) => {
|
$A.execMainDispatch = (action, data) => {
|
||||||
if ($A.isSubElectron) {
|
if ($A.isSubElectron) {
|
||||||
$A.Electron.sendMessage('sendForwardMain', {
|
$A.Electron.sendMessage('sendForwardMain', {
|
||||||
|
|||||||
2
resources/assets/js/store/actions.js
vendored
2
resources/assets/js/store/actions.js
vendored
@ -259,10 +259,12 @@ export default {
|
|||||||
if (typeof timeout === "number") {
|
if (typeof timeout === "number") {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
window.__getBasicData && clearTimeout(window.__getBasicData)
|
window.__getBasicData && clearTimeout(window.__getBasicData)
|
||||||
|
if (timeout > -1) {
|
||||||
window.__getBasicData = setTimeout(() => {
|
window.__getBasicData = setTimeout(() => {
|
||||||
dispatch("getBasicData", null)
|
dispatch("getBasicData", null)
|
||||||
resolve()
|
resolve()
|
||||||
}, timeout)
|
}, timeout)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dispatch("getProjects").catch(() => {});
|
dispatch("getProjects").catch(() => {});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user