Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
3fb88233
Commit
3fb88233
authored
May 17, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
3ddb6c09
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
13 deletions
+84
-13
center-manage/app/base/db/impl/msg/msghistoryDao.js
+26
-0
center-manage/app/base/db/impl/msg/msgnoticeDao.js
+55
-0
center-manage/app/base/service/impl/msg/msghistorySve.js
+1
-9
center-manage/app/base/service/impl/msg/msgnoticeSve.js
+2
-4
No files found.
center-manage/app/base/db/impl/msg/msghistoryDao.js
0 → 100644
View file @
3fb88233
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
MsgHistoryDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
MsgHistoryDao
));
}
extraWhere
(
obj
,
w
){
if
(
obj
.
ukstr
&&
obj
.
ukstr
!=
""
){
// w={[this.db.Op.or]:[
// {[this.db.Op.and]:[{sender:obj.ukstr},{target:obj.extra}]},
// {[this.db.Op.and]:[{sender:obj.extra},{target:obj.ukstr}]},
// ]
// };
w
[
this
.
db
.
Op
.
or
]
=
[
{[
this
.
db
.
Op
.
and
]:[{
sender
:
obj
.
ukstr
},{
target
:
obj
.
extra
}]},
{[
this
.
db
.
Op
.
and
]:[{
sender
:
obj
.
extra
},{
target
:
obj
.
ukstr
}]},
];
}
return
w
;
}
orderBy
(){
//return {"key":"include","value":{model:this.db.models.app}};
return
[[
"id"
,
"DESC"
]];
}
}
module
.
exports
=
MsgHistoryDao
;
center-manage/app/base/db/impl/msg/msgnoticeDao.js
0 → 100644
View file @
3fb88233
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
MsgNoticeDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
MsgNoticeDao
));
}
async
saveNotice
(
msg
,
t
)
{
var
noticeFrom
=
await
super
.
findOne
({
fromId
:
msg
.
senderId
,
toId
:
msg
.
targetId
});
if
(
noticeFrom
)
{
var
set
=
{
lastMsgId
:
msg
.
id
};
if
(
msg
.
businessLicense_id
)
{
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
}
await
super
.
updateByWhere
(
set
,
{
where
:{
id
:
noticeFrom
.
id
}},
t
);
}
else
{
noticeFrom
=
{
fromuser
:
msg
.
sender
,
fromId
:
msg
.
senderId
,
touser
:
msg
.
target
,
toId
:
msg
.
targetId
,
isAccepted
:
true
,
lastMsgId
:
msg
.
id
,
businessLicense_id
:
msg
.
businessLicense_id
||
0
};
await
super
.
create
(
noticeFrom
,
t
);
}
var
noticeTo
=
await
super
.
findOne
({
fromId
:
msg
.
targetId
,
toId
:
msg
.
senderId
});
if
(
noticeTo
)
{
var
set
=
{
lastMsgId
:
msg
.
id
};
if
(
msg
.
businessLicense_id
)
{
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
}
await
super
.
updateByWhere
(
set
,
{
where
:{
id
:
noticeTo
.
id
}},
t
);
}
else
{
noticeTo
=
{
fromuser
:
msg
.
target
,
fromId
:
msg
.
targetId
,
touser
:
msg
.
sender
,
toId
:
msg
.
senderId
,
isAccepted
:
true
,
lastMsgId
:
msg
.
id
,
businessLicense_id
:
msg
.
businessLicense_id
||
0
};
await
super
.
create
(
noticeTo
,
t
);
}
}
orderBy
(){
//return {"key":"include","value":{model:this.db.models.app}};
return
[[
"id"
,
"DESC"
]];
}
}
module
.
exports
=
MsgNoticeDao
;
center-manage/app/base/service/impl/msg/msghistorySve.js
View file @
3fb88233
...
...
@@ -3,17 +3,10 @@ const ServiceBase=require("../../sve.base");
class
MsgHistoryService
extends
ServiceBase
{
constructor
(){
super
(
ServiceBase
.
getDaoName
(
MsgHistoryService
));
this
.
msgnoticeDao
=
system
.
getObject
(
"db.msgnoticeDao"
);
this
.
msgnoticeDao
=
system
.
getObject
(
"db.msg
.msg
noticeDao"
);
this
.
userDao
=
system
.
getObject
(
"db.auth.userDao"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
this
.
businesslicenseDao
=
system
.
getObject
(
"db.businesslicenseDao"
);
}
getApp
(
appkey
){
return
this
.
cacheManager
[
"AppCache"
].
cacheApp
(
appkey
);
}
async
saveMsg
(
msg
)
{
var
self
=
this
;
console
.
log
(
"save msg "
,
msg
);
...
...
@@ -24,7 +17,6 @@ class MsgHistoryService extends ServiceBase{
// 2.保存好友信息
await
self
.
msgnoticeDao
.
saveNotice
(
msg
,
t
);
});
return
msg
;
}
...
...
center-manage/app/base/service/impl/msg/msgnoticeSve.js
View file @
3fb88233
...
...
@@ -3,10 +3,8 @@ const ServiceBase = require("../../sve.base");
class
MsgNoticeService
extends
ServiceBase
{
constructor
()
{
super
(
ServiceBase
.
getDaoName
(
MsgNoticeService
));
//this.appDao=system.getObject("db.appDao");
this
.
userDao
=
system
.
getObject
(
"db.userDao"
);
this
.
businesslicenseDao
=
system
.
getObject
(
"db.businesslicenseDao"
);
this
.
msghistoryDao
=
system
.
getObject
(
"db.msghistoryDao"
);
this
.
userDao
=
system
.
getObject
(
"db.auth.userDao"
);
this
.
msghistoryDao
=
system
.
getObject
(
"db.msg.msghistoryDao"
);
}
getApp
(
appkey
)
{
return
this
.
cacheManager
[
"AppCache"
].
cacheApp
(
appkey
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment