Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
e2714269
Commit
e2714269
authored
Aug 31, 2022
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openapi 震坤行邮件
parent
9f49efcd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
19 deletions
+54
-19
server/app/Jobs/ZhenkhJob.php
server/app/Jobs/ZhenkhJob.php
+1
-1
server/app/Mailer/MailService.php
server/app/Mailer/MailService.php
+12
-10
server/app/Services/ZhenKhService.php
server/app/Services/ZhenKhService.php
+11
-4
server/database/seeds/local/PlatformDataEntriesSeeder.php
server/database/seeds/local/PlatformDataEntriesSeeder.php
+29
-3
server/resources/views/emails/mail.blade.php
server/resources/views/emails/mail.blade.php
+1
-1
No files found.
server/app/Jobs/ZhenkhJob.php
View file @
e2714269
...
...
@@ -55,7 +55,7 @@ class ZhenkhJob extends Job
$service
->
hMUpdateOrdersList
();
break
;
case
'sendMail'
:
$service
->
sendMail
();
$service
->
sendMail
(
'订单确认邮件'
,
'订单号:未确认成功'
);
default
:
}
}
...
...
server/app/Mailer/MailService.php
View file @
e2714269
...
...
@@ -22,12 +22,12 @@ class MailService{
$this
->
registerProvider
(
$this
->
getMailAccountConfig
(
$this
->
type
));
}
public
function
getMailAccountConfig
(
$type
)
public
function
getMailAccountConfig
()
{
$username
=
env
(
"MAIL_
{
$type
}
_
USERNAME"
);
$password
=
env
(
"MAIL_
{
$type
}
_
PASSWORD"
);
$address
=
env
(
"MAIL_
{
$type
}
_
FROM_ADDRESS"
);
$fromName
=
env
(
"MAIL_
{
$type
}
_
FROM_NAME"
);
$username
=
env
(
"MAIL_USERNAME"
);
$password
=
env
(
"MAIL_PASSWORD"
);
$address
=
env
(
"MAIL_FROM_ADDRESS"
);
$fromName
=
env
(
"MAIL_FROM_NAME"
);
$config
=
config
(
'mail'
);
...
...
@@ -45,11 +45,13 @@ class MailService{
app
()
->
register
(
\Illuminate\Mail\MailServiceProvider
::
class
);
}
public
function
send
(
$typ
e
,
$toUser
,
$message
)
public
function
send
Mail
(
$titl
e
,
$toUser
,
$message
)
{
$this
->
setFromType
(
$type
)
->
initSendService
();
Mail
::
to
(
$toUser
)
->
send
(
new
MailTempl
([
'message'
=>
$message
]));
$this
->
setFromType
(
'zkh'
)
->
initSendService
();
Mail
::
raw
(
$message
,
function
(
$mail
)
use
(
$toUser
,
$title
){
$mail
->
to
(
$toUser
);
$mail
->
subject
(
$title
);
});
}
}
\ No newline at end of file
server/app/Services/ZhenKhService.php
View file @
e2714269
...
...
@@ -21,6 +21,7 @@ class ZhenKhService
$this
->
apiService
=
(
new
ZhenkhApiService
(
app
(
ThirdApiPlatformRepository
::
class
)));
$this
->
rhawnService
=
app
(
RhawnChemicalsService
::
class
);
$this
->
rhawnOrderService
=
app
(
RhawnOrdersService
::
class
);
$this
->
mailService
=
app
(
MailService
::
class
);
}
public
function
orderNoRollBack
()
...
...
@@ -331,6 +332,7 @@ class ZhenKhService
{
try
{
$orderDelivery
=
$this
->
rhawnOrderService
->
getSorderDeliveryDetail
(
$deliveryCode
);
$noMatchGoods
=
[];
if
(
$orderDelivery
){
$expressArray
=
$this
->
apiService
->
getPlatformDataEntries
(
'zkh_order_express'
,
'data_values'
);
if
(
empty
(
$expressArray
)){
...
...
@@ -389,6 +391,7 @@ class ZhenKhService
foreach
(
$orderDelivery
as
$delivery
){
$zkhGoods
=
$this
->
rhawnService
->
getZkhGoodsSku
(
$delivery
->
p_id
);
if
(
empty
(
$zkhGoods
)){
$noMatchGoods
[]
=
$orderNo
;
throw
new
\Exception
(
'对应震坤行商品数据未找到'
);
}
foreach
(
$zkhGoods
as
$goods
){
...
...
@@ -425,6 +428,10 @@ class ZhenKhService
$this
->
apiService
->
storePlatformDataEntries
(
'zkh_delivery_code_'
.
$deliveryCode
,[
'code'
=>
$deliveryResult
[
'data'
]]);
}
}
if
(
!
empty
(
$noMatchGoods
)){
//发送邮件
$this
->
sendMail
(
'订单同步邮件'
,
'订单号:'
.
implode
(
','
,
$orderNo
)
.
'未同步成功'
);
}
}
catch
(
\Throwable
$exception
){
SimpleLogs
::
writeLog
(
$exception
->
getMessage
(),
__CLASS__
.
':sendDeliveryOrder'
,
'error'
);
...
...
@@ -479,7 +486,7 @@ class ZhenKhService
}
if
(
!
$result
){
//发送邮件
$this
->
sendMail
(
'订单确认邮件'
,
'订单号:'
.
$orderNo
.
'未确认成功'
);
}
}
}
...
...
@@ -522,11 +529,11 @@ class ZhenKhService
}
}
public
function
sendMail
()
public
function
sendMail
(
$title
,
$message
)
{
$mailService
=
app
(
MailService
::
class
);
try
{
$mailService
->
send
(
'zkh'
,
'hangjun83@126.com'
,
'测试邮件'
);
$mailer
=
$this
->
apiService
->
getPlatformDataEntries
(
'zkh_send_mailer'
,
'data_values'
);
$this
->
mailService
->
sendMail
(
$title
,
$mailer
,
'震坤行【'
.
$message
.
'】,请人工操作!'
);
}
catch
(
\Throwable
$exception
){
SimpleLogs
::
writeLog
(
$exception
->
getMessage
(),
__CLASS__
.
':sendMail'
,
'error'
);
return
false
;
...
...
server/database/seeds/local/PlatformDataEntriesSeeder.php
View file @
e2714269
...
...
@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\DB;
class
PlatformDataEntriesSeeder
extends
Seeder
{
protected
$entries
=
[
[
/*
[
'platform_id' => 27,
'data_key' => 'zkh_order_invoice',
'data_values' => [
...
...
@@ -27,8 +27,34 @@ class PlatformDataEntriesSeeder extends Seeder
'address' => '上海浦东科苑路399号张江创新园5号楼',
'company_phone' => '400-680-9696'
]
]
];
],
[
'platform_id' => 27,
'data_key' => 'sys_delivery_logistics',
'data_values' => [
'JD'=>'京东',
'SF'=>'顺丰',
'ZT'=>'中通',
'YD'=>'韵达',
'ZJS'=>'宅急送',
'DBL'=>'德邦',
'YTO'=>'圆通',
'YZPY'=>'邮政',
'AN'=>'安能',
'STO'=>'申通',
'HHTT'=>'天天',
'WL'=>'物流',
'ziti'=>'自提'
]
],*/
[
'platform_id'
=>
27
,
'data_key'
=>
'zkh_send_mailer'
,
'data_values'
=>
[
'it@rhawn.cn'
,
'yuxiaohui@rhawn.cn'
,
'hangjun@rhawn.cn'
]
]
];
public
function
run
()
{
...
...
server/resources/views/emails/mail.blade.php
View file @
e2714269
@
component
(
'mail::message'
)
震坤行订单
{{
$message
}}
未同步成功
,
请人工下单
!
{{
$message
}}
@
endcomponent
\ No newline at end of file
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