Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李洋
/
消息系统
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9b0ada11
authored
Dec 05, 2022
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增通知系统-完成更新之后的数据修改
parent
54be437d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
app/Logic/SystemNoticeLogic.php
app/Logic/SystemNoticeLogic.php
View file @
9b0ada11
...
...
@@ -153,9 +153,13 @@ class SystemNoticeLogic
$sendData
[
'content'
]
=
''
;
$sendData
[
'host'
]
=
''
;
$time
=
date
(
'Y-m-d'
);
$now
=
time
();
if
(
$data
[
'type'
]
==
'system_update'
){
$sendInfo
=
(
new
SystemUpdateModel
())
->
where
(
'smue_id'
,
$data
[
'id'
])
->
first
();
$modelObj
=
(
new
SystemUpdateModel
());
$sendInfo
=
$modelObj
->
where
(
'smue_id'
,
$data
[
'id'
])
->
first
();
$sendData
[
'user_info'
]
=
DB
::
table
(
't_user_perm'
)
->
where
(
'begDate'
,
'<='
,
$time
)
->
where
(
'endDate'
,
'>='
,
$time
)
...
...
@@ -170,7 +174,9 @@ class SystemNoticeLogic
}
else
if
(
$data
[
'type'
]
==
'system_preach'
){
$sendInfo
=
(
new
SystemPreachModel
())
->
where
(
'smph_id'
,
$data
[
'id'
])
->
first
();
$modelObj
=
(
new
SystemUpdateModel
());
$sendInfo
=
$modelObj
->
where
(
'smph_id'
,
$data
[
'id'
])
->
first
();
$sendData
[
'user_info'
]
=
DB
::
table
(
't_user_perm'
)
->
where
(
'begDate'
,
'<='
,
$time
)
->
where
(
'endDate'
,
'>='
,
$time
)
...
...
@@ -185,7 +191,9 @@ class SystemNoticeLogic
}
else
if
(
$data
[
'type'
]
==
'system_bulletin'
){
$sendInfo
=
(
new
SystemBulletinModel
())
->
where
(
'smbn_id'
,
$data
[
'id'
])
->
first
();
$modelObj
=
(
new
SystemUpdateModel
());
$sendInfo
=
$modelObj
->
where
(
'smbn_id'
,
$data
[
'id'
])
->
first
();
$sendData
[
'user'
]
=
[
'all@ichunt.com'
];
...
...
@@ -196,14 +204,34 @@ class SystemNoticeLogic
throw
new
\Exception
(
'暂无该种类型'
);
}
$emailSendCount
=
0
;
$bulletinSendCount
=
0
;
foreach
(
$data
[
'notice_type'
]
as
$value
){
if
(
intval
(
$value
)
===
1
){
$this
->
sendEmail
(
$sendData
);
$emailSendCount
++
;
}
else
{
//rabbitmq 方法不行
$this
->
sendRedisNotice
(
$sendData
);
$bulletinSendCount
++
;
}
}
//发送成功之后就行修改
if
(
$data
[
'type'
]
==
'system_update'
){
$modelObj
->
where
(
'smue_id'
,
$data
[
'id'
])
->
update
([
'update_time'
=>
$now
]);
$modelObj
->
where
(
'smue_id'
,
$data
[
'id'
])
->
increment
(
'bulletin_count'
,
$bulletinSendCount
);
$modelObj
->
where
(
'smue_id'
,
$data
[
'id'
])
->
increment
(
'bulletin_count'
,
$emailSendCount
);
}
else
if
(
$data
[
'type'
]
==
'system_preach'
){
$modelObj
->
where
(
'smph_id'
,
$data
[
'id'
])
->
update
([
'update_time'
=>
$now
]);
}
else
if
(
$data
[
'type'
]
==
'system_bulletin'
){
$modelObj
->
where
(
'smbn_id'
,
$data
[
'id'
])
->
update
([
'update_time'
=>
$now
,
'is_send'
=>
'已发送'
]);
}
else
{
throw
new
\Exception
(
'暂无该种类型'
);
}
}
...
...
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