set_time_limit(300);
Yii::$app->response->format = Response::FORMAT_JSON;
- $html = '';
+ $html = ' <!doctype html>
+ <html lang=3D"ru">
+ <head>
+ <meta name=3D"viewport" content=3D"width=3Ddevice-width, =
+initial-scale=3D1.0"/>
+ <meta http-equiv=3D"Content-Type" content=3D"text/html; =
+charset=3DUTF-8"/>
+ <title>=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9 =
+=D0=BE=D0=BF=D0=BB=D0=B0=D1=87=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9 =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7</title>
+ <link rel=3D"preconnect" href=3D"https://fonts.googleapis.com">
+ <link rel=3D"preconnect" href=3D"https://fonts.gstatic.com" =
+crossorigin>
+ <link =
+href=3D"https://fonts.googleapis.com/css2?family=3DNoto+Sans&display=3Dsw=
+ap" rel=3D"stylesheet">
+ <!--START STYLE-->
+ <style>
+ /* -------------------------------------
+ GLOBAL RESETS
+ ------------------------------------- */
+
+ /*All the styling goes here*/
+
+ img {
+ border: none;
+ -ms-interpolation-mode: bicubic;
+ max-width: 100%;
+ }
+
+ body {
+ background-color: #f6f6f6;
+ font-family: sans-serif;
+ -webkit-font-smoothing: antialiased;
+ font-size: 16px;
+ line-height: 1.4;
+ margin: 0;
+ padding: 0;
+ -ms-text-size-adjust: 100%;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ table {
+ border-collapse: separate;
+ mso-table-lspace: 0pt;
+ mso-table-rspace: 0pt;
+ width: 100%;
+ }
+
+ table td {
+ font-family: sans-serif;
+ font-size: 14px;
+ vertical-align: top;
+ }
+
+ /* -------------------------------------
+ BODY & CONTAINER
+ ------------------------------------- */
+
+ .body {
+ background-color: #f6f6f6;
+ width: 100%;
+ }
+
+ /* Set a max-width, and make it display as block so it will =
+automatically stretch to that width, but will also shrink down on a =
+phone or something */
+ .container {
+ display: block;
+ margin: 0 auto !important;
+ /* makes it centered */
+ max-width: 600px;
+ padding: 24px;
+ width: 600px;
+ }
+
+ /* This should also be a block element, so that it will fill =
+100% of the .container */
+ .content {
+ box-sizing: border-box;
+ display: block;
+ margin: 0 auto;
+ max-width: 600px;
+ padding: 16px;
+ }
+
+ /* -------------------------------------
+ HEADER, FOOTER, MAIN
+ ------------------------------------- */
+ .main {
+ background: #ffffff;
+ border-radius: 3px;
+ width: 100%;
+ }
+
+ .wrapper {
+ box-sizing: border-box;
+ padding: 20px;
+ }
+
+ .content-block {
+ padding-bottom: 8px;
+ padding-top: 8px;
+ }
+
+ .card-button {
+ padding-bottom: 12px;
+ padding-top: 12px;
+ padding-left: 16px;
+ padding-right: 16px;
+ background: #FAFAFA;
+ border-radius: 8px;
+ width: auto;
+ }
+
+ .footer {
+ text-align: left;
+ background: #ffffff;
+ padding-left: 24px;
+ padding-right: 24px;
+ padding-bottom: 24px;
+ }
+
+ .footer td,
+ .footer span,
+ .footer p {
+ color: #8c8c8c;
+ font-size: 16px;
+ text-align: left;
+ }
+
+ .footer a {
+ color: #5495ed;
+ font-size: 14px;
+ text-align: left;
+ }
+
+ /* -------------------------------------
+ TYPOGRAPHY
+ ------------------------------------- */
+ h1 {
+ font-size: 24px !important;
+ margin-bottom: 12px !important;
+ color: #111 !important;
+ font-family: sans-serif !important;
+ font-weight: bold;
+ }
+
+ h2,
+ h3,
+ h4 {
+ font-family: "Noto Sans", sans-serif;
+ font-style: normal;
+ font-weight: 700;
+ font-size: 14px;
+ line-height: 20px;
+ margin-bottom: 8px;
+ }
+
+ p,
+ ul,
+ ol {
+ color: #111;
+ font-family: sans-serif;
+ font-size: 16px;
+ font-weight: normal;
+ margin: 0;
+ margin-bottom: 12px;
+ }
+
+ p li,
+ ul li,
+ ol li {
+ list-style-position: inside;
+ margin-left: 5px;
+ }
+
+ a {
+ color: #5495ed;
+ text-decoration: underline;
+ }
+
+ /* -------------------------------------
+ BUTTONS
+ ------------------------------------- */
+ .btn {
+ box-sizing: border-box;
+ width: 100%;
+ }
+
+ .btn > tbody > tr > td {
+ padding-bottom: 16px;
+ }
+
+ .btn table {
+ width: auto;
+ }
+
+ .btn table td {
+ background-color: #ffffff;
+ border-radius: 6px;
+ text-align: center;
+ }
+
+ .btn a {
+ background-color: #ffffff;
+ border: solid 1px #111;
+ border-radius: 5px;
+ box-sizing: border-box;
+ color: #111;
+ cursor: pointer;
+ display: inline-block;
+ font-size: 14px;
+ font-weight: bold;
+ margin: 0;
+ padding: 12px 25px;
+ text-decoration: none;
+ }
+
+ .btn-primary table td {
+ background-color: #111;
+ }
+
+ .btn-primary a {
+ background-color: #111;
+ border-color: #111;
+ color: #ffffff;
+ }
+
+ /* -------------------------------------
+ OTHER STYLES THAT MIGHT BE USEFUL
+ ------------------------------------- */
+ .last {
+ margin-bottom: 0;
+ }
+
+ .first {
+ margin-top: 0;
+ }
+
+ .align-center {
+ text-align: center;
+ }
+
+ .align-right {
+ text-align: right;
+ }
+
+ .align-left {
+ text-align: left;
+ }
+
+ .clear {
+ clear: both;
+ }
+
+ .mt0 {
+ margin-top: 0;
+ }
+
+ .mb0 {
+ margin-bottom: 0;
+ }
+
+ .pre-header {
+ color: transparent;
+ display: none;
+ height: 0;
+ max-height: 0;
+ max-width: 0;
+ opacity: 0;
+ overflow: hidden;
+ mso-hide: all;
+ visibility: hidden;
+ width: 0;
+ }
+
+ .powered-by a {
+ text-decoration: none;
+ }
+
+ hr {
+ border: 0;
+ border-bottom: 1px solid #f6f6f6;
+ margin: 20px 0;
+ }
+
+ /* -------------------------------------
+ RESPONSIVE AND MOBILE FRIENDLY STYLES
+ ------------------------------------- */
+ @media only screen and (max-width: 620px) {
+ table.body h1 {
+ font-size: 24px !important;
+ margin-bottom: 12px !important;
+ }
+
+ table.body p,
+ table.body ul,
+ table.body ol,
+ table.body td,
+ table.body span,
+ table.body a {
+ font-size: 16px !important;
+ }
+
+ table.body .wrapper,
+ table.body .article {
+ padding: 12px !important;
+ }
+
+ table.body .content {
+ padding: 0 !important;
+ }
+
+ table.body .container {
+ padding: 0 !important;
+ width: 100% !important;
+ }
+
+ table.body .main {
+ border-left-width: 0 !important;
+ border-radius: 0 !important;
+ border-right-width: 0 !important;
+ }
+
+ table.body .btn table {
+ width: 100% !important;
+ }
+
+ table.body .btn a {
+ width: 100% !important;
+ }
+
+ table.body .img-responsive {
+ height: auto !important;
+ max-width: 100% !important;
+ width: auto !important;
+ }
+ }
+
+ /* -------------------------------------
+ PRESERVE THESE STYLES IN THE HEAD
+ ------------------------------------- */
+ @media all {
+ .ExternalClass {
+ width: 100%;
+ }
+
+ .ExternalClass,
+ .ExternalClass p,
+ .ExternalClass span,
+ .ExternalClass font,
+ .ExternalClass td,
+ .ExternalClass div {
+ line-height: 100%;
+ }
+
+ .apple-link a {
+ color: inherit !important;
+ font-family: inherit !important;
+ font-size: inherit !important;
+ font-weight: inherit !important;
+ line-height: inherit !important;
+ text-decoration: none !important;
+ }
+
+ #MessageViewBody a {
+ color: inherit;
+ text-decoration: none;
+ font-size: inherit;
+ font-family: inherit;
+ font-weight: inherit;
+ line-height: inherit;
+ }
+
+ .btn-primary table td:hover {
+ background-color: #5495ed !important;
+ }
+
+ .btn-primary a:hover {
+ background-color: #5495ed !important;
+ border-color: #5495ed !important;
+ }
+ }
+ </style>
+ <!-- END STYLE -->
+</head>
+ <body>
+ <span class=3D"pre-header"></span>
+ <table role=3D"presentation" border=3D"0" cellpadding=3D"0" =
+cellspacing=3D"0" class=3D"body">
+ <tr>
+ <td> </td>
+ <td class=3D"container">
+ <div class=3D"content">
+ <!-- START CENTERED WHITE CONTAINER -->
+ <table role=3D"presentation" class=3D"main">
+ <tr>
+ <td style=3D"width: 100%; padding-left: 24px; padding-top: 32px; =
+padding-bottom: 24px;">
+ <a =
+href=3D"https://email.flowwow.com/c/eJxci81q6zAQRp9G2lxukGZGlrzQIsY1FPoE3=
+Y1-3KR1qpI4dpunL1UJmG4OB873JT_m3FqQ2WuL0ACicTKf-Dg9lZfH5BuDVmkkefBAgQi0C8=
+waHSSOTjcBxhCCIdROHn0igxYzc6SAlkkZlXMCRSYCthYEqXEq61rWXSwnOfnDPH9cBO4FDAK=
+GbTv7Z37j2__AN45LnssCJEh98XvKn7vzVV6u4TXH2Yteibb_YfdQCaLXwnXV23-bMFT-BlVH=
+trqp7O_8e7b3gxLdfuNWLh6-AwAA___Jy1VE">
+ <img =
+src=3D"https://content3.flowwow-images.com/images/mail/new-logo.png" =
+width=3D"136"
+ alt=3D"Logo" border=3D"0" style=3D"max-width:136px;">
+ </a>
+ </td>
+</tr> <!-- START MAIN CONTENT AREA -->
+ <tr>
+ <td class=3D"wrapper">
+ <table role=3D"presentation" border=3D"0" cellpadding=3D"0" =
+cellspacing=3D"0">
+ <tr>
+ <td>
+ <h1 style=3D"margin: 0; margin-bottom: 12px; color: =
+#111;">
+ =D0=9D=D0=BE=D0=B2=D1=8B=D0=B9 =
+=D0=BE=D0=BF=D0=BB=D0=B0=D1=87=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9 =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7 =E2=84=9613785415 =
+</h1>
+ <p style=3D"margin-bottom: 16px;">
+ =
+=D0=9F=D0=BE=D0=B6=D0=B0=D0=BB=D1=83=D0=B9=D1=81=D1=82=D0=B0, =
+=D0=BF=D0=B5=D1=80=D0=B5=D0=B9=D0=B4=D0=B8=D1=82=D0=B5 =D0=BF=D0=BE =
+=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B5, =D1=87=D1=82=D0=BE=D0=B1=D1=8B =
+=D0=BF=D1=80=D0=B8=D0=BD=D1=8F=D1=82=D1=8C =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7 =D0=B8=D0=BB=D0=B8 =
+=D0=BE=D1=82=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D1=8C=D1=81=D1=8F =
+=D0=BE=D1=82 =D0=BD=D0=B5=D0=B3=D0=BE. </p>
+
+ <table role=3D"presentation" border=3D"0" =
+cellpadding=3D"0" cellspacing=3D"0" class=3D"btn btn-primary">
+ <tbody>
+ <tr>
+ <td align=3D"left">
+ <table role=3D"presentation" =
+border=3D"0" cellpadding=3D"0" cellspacing=3D"0">
+ <tbody>
+ <tr>
+ <td>
+ <a =
+href=3D"https://email.flowwow.com/c/eJxci0FOwzAQRU8z3iAqe2YcxwsvWoVISJyAn=
+WNPaKFpUJsm0NMjjCpFbJ6e9P7PoRfxDpUE4wgrJLK1kiEeji_j23MOlSWnDbHah8Sesu1q43=
+WP0ntjTOqI-2yZpKpqdQiZLTmSGBN35CJrq0UyarYJyTsE1v1xXJZx2aRxUMewn6bPC9AWsAV=
+sVw2wjXk4nABbdQ6v8SPeHrt4i2mWaZyRgfV3PGX52pyv6nLt3iVNARoNvvnl7qkQoTFQ74r7=
+h1VoC_-CLiNX3BY2d_4_u_tBw267cqfmgD8BAAD__9uEWHg" target=3D"_blank">
+ =
+=D0=9F=D0=B5=D1=80=D0=B5=D0=B9=D1=82=D0=B8 =D0=B2 =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7 =
+ </a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <!-- START ORDER LIST -->
+ <table>
+ <p style=3D"font-weight: 700;">
+ =D0=94=D0=B5=D1=82=D0=B0=D0=BB=D0=B8 =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0 </p>
+ <!-- START ITEM -->
+ <tr style=3D"margin-bottom: 12px;">
+ <td style=3D"width: 56px; =
+padding-right:12px;">
+ <img =
+src=3D"https://content3.flowwow-images.com/data/flowers/524x524/79/173101=
+9737_88267979.jpg" width=3D"" alt=3D"img" border=3D"0"
+ style=3D"max-width:56px;">
+ </td>
+ <td>
+ <p style=3D"margin-bottom: 4px;">
+ =D0=91=D1=83=D0=BA=D0=B5=D1=82 =
+=D0=B8=D0=B7 35 =D1=80=D0=BE=D0=B7 =D0=9A=D0=B5=D0=BD=D0=B8=D1=8F =
+=D0=BC=D0=B8=D0=BA=D1=81 </p>
+ <p style=3D"color: #8C8C8C;">
+ 1 =D1=88=D1=82. =
+ </p>
+ </td>
+ <td>
+ <p style=3D"text-align: right;">
+ 5 990₽ =
+ </p>
+ </td>
+ </tr>
+ <!-- END ITEM -->
+ <!-- START ITEM -->
+ <tr style=3D"margin-bottom: 12px;">
+ <td style=3D"width: 56px; =
+padding-right:12px;">
+ <img =
+src=3D"https://content3.flowwow-images.com/data/flowers/524x524/14/173131=
+7882_78547614.jpg" width=3D"" alt=3D"img" border=3D"0"
+ style=3D"max-width:56px;">
+ </td>
+ <td>
+ <p style=3D"margin-bottom: 4px;">
+ =
+=D0=9E=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=BA=D0=B0 =
+ </p>
+ <p style=3D"color: #8C8C8C;">
+ 1 =D1=88=D1=82. =
+ </p>
+ </td>
+ <td>
+ <p style=3D"text-align: right;">
+ 0₽ =
+ </p>
+ </td>
+ </tr>
+ <!-- END ITEM -->
+ </table>
+
+ <table>
+ <!-- START DELIVERY =
+-->
+ <tr>
+ <td style=3D"width: 70%;">
+ <p style=3D"margin-bottom: 4px;">
+ =
+=D0=94=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D0=B0 =
+ </p>
+ =
+ <p style=3D"color: #8C8C8C;">
+ =
+=D0=9F=D0=BE=D0=BB=D1=83=D1=87=D0=B0=D1=82=D0=B5=D0=BB=D1=8E =
+=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=81=D1=8F =
+=D1=81=D0=BC=D1=81 =D1=81 =
+=D0=BF=D1=80=D0=BE=D1=81=D1=8C=D0=B1=D0=BE=D0=B9 =
+=D1=83=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D1=8C =
+=D0=B0=D0=B4=D1=80=D0=B5=D1=81 =D0=B8 =D0=B2=D1=80=D0=B5=D0=BC=D1=8F =
+=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D0=B8. =
+ </p>
+ =
+</td>
+ <td style=3D"width: 30%;">
+ <p style=3D"text-align: right;">
+ 350₽ =
+ </p>
+ </td>
+ </tr>
+ <!-- END DELIVERY -->
+ =20
+ <!-- START TOTAL -->
+ <tr>
+ <td style=3D"width: 70%;">
+ <p style=3D"margin-bottom: 4px;">
+ =D0=98=D1=82=D0=BE=D0=B3=D0=BE =
+=D0=BE=D0=BF=D0=BB=D0=B0=D1=87=D0=B5=D0=BD=D0=BE =
+ </p>
+ </td>
+ <td style=3D"width: 30%;">
+ <p style=3D"text-align: right;">
+ 6 340₽ =
+ </p>
+ </td>
+ </tr>
+ <!-- END TOTAL -->
+ </table>
+ <p style=3D"margin-bottom: 16px; padding: 12px; =
+background-color:#FAFAFA;">
+ <b>=D0=92=D0=B0=D0=B6=D0=BD=D0=BE =
+=D1=80=D0=B5=D0=B0=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C =
+=D0=BD=D0=B0 =D0=B7=D0=B0=D0=BA=D0=B0=D0=B7 =D0=BA=D0=B0=D0=BA =
+=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE =
+=D0=B1=D1=8B=D1=81=D1=82=D1=80=D0=B5=D0=B5</b><br>
+ =D0=9A=D0=BB=D0=B8=D0=B5=D0=BD=D1=82 =
+=D1=83=D0=B6=D0=B5 =D0=BE=D0=BF=D0=BB=D0=B0=D1=82=D0=B8=D0=BB =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7 =D0=B8 =D0=B6=D0=B4=D0=B5=D1=82 =
+=D0=BF=D1=80=D0=B8=D0=BD=D1=8F=D1=82=D0=B8=D1=8F =
+=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0. =D0=B5=D1=81=D0=BB=D0=B8 =
+=D0=B2=D1=8B =
+=D0=BF=D1=80=D0=BE=D0=B8=D0=B3=D0=BD=D0=BE=D1=80=D0=B8=D1=80=D1=83=D0=B5=D1=
+=82=D0=B5 =D0=B7=D0=B0=D0=BA=D0=B0=D0=B7, =D1=82=D0=BE =
+=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD =
+=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B8=D1=82 =
+=D1=88=D1=82=D1=80=D0=B0=D1=84, =D1=82=D0=B0=D0=BA =D0=B6=D0=B5 =
+=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE =
+=D0=B1=D1=83=D0=B4=D0=B5=D1=82 =D1=81=D0=BA=D1=80=D1=8B=D1=82 =
+=D0=BE=D1=82 =D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=BE=D0=B2. =
+=D0=9F=D0=BE=D0=BC=D0=BD=D0=B8=D1=82=D0=B5, =D0=BE=D1=82 =
+=D0=B2=D0=B0=D1=81 =D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D1=82 =
+=D1=80=D0=B5=D0=BF=D1=83=D1=82=D0=B0=D1=86=D0=B8=D1=8F =
+=D0=B2=D0=B0=D1=88=D0=B5=D0=B3=D0=BE =
+=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D0=B0 =D0=B8 =
+=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D0=B0. </p>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+ <!-- END MAIN CONTENT AREA -->
+ </table>
+ <!-- END CENTERED WHITE CONTAINER -->
+ <!-- START FOOTER -->
+<div class=3D"footer">
+ <table role=3D"presentation" border=3D"0" cellpadding=3D"0" =
+cellspacing=3D"0">
+ <tr>
+ <td class=3D"card-button">
+ <table cellspacing=3D"0" cellpadding=3D"0" =
+border=3D"0" width=3D"100%">
+ <tr>
+ <td>
+ <table align=3D"left" cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td width=3D"100%">
+ <table cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0" width=3D"100%">
+ <tr>
+ <td>
+ <table =
+cellspacing=3D"0" cellpadding=3D"0" border=3D"0" width=3D"100%">
+ <tr>
+ <td =
+style=3D" text-align:left;">
+ <div =
+style=3D"line-height:20px">
+ =
+<a =
+href=3D"https://email.flowwow.com/c/eJxci0FOwzAQRU9jbxCVM7Y79sKLViESEidgN=
+7YnbSHFKE0T6OkRRpUiNk9P8-bn0DN7BMmhQQ1b0No6yWc6DS_l8JzD1mpUjTbyGHLy3CQXPS=
+bcup4c-EyWLKlMzkOUp5CN1aiZKJmokYyyijmDMjaB9gjCqH4oy1KWTSpnOYTjNH1ehN4J6AR=
+0qyagi0M51LvuS5l4lGN4pXe6PUa6UZp5KjMYYdQ3fWT-2oxXebnGN05TEK0Svv3l_qkSRNsI=
+t6_uH1ahq_wLqj5hdVvZ3vl_jPeBEvvdylHOAX4CAAD__wB1W_I"
+ =
+ style=3D"text-decoration: none;">
+ =
+ <span style=3D"color: #484848;line-height:20px;font-family:Noto Sans, =
+Helvetica, Arial, sans-serif; =
+font-size:14px;text-align:left;font-weight: =
+700;">=D0=96=D1=83=D1=80=D0=BD=D0=B0=D0=BB Flowwow</span>
+ =
+</a>
+ =
+</div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width=3D"20">
+ <table =
+width=3D"100%" cellspacing=3D"0" cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ =
+<table align=3D"left" cellspacing=3D"0" cellpadding=3D"0"
+ =
+ border=3D"0">
+ =
+<tr>
+ =
+ <td style=3D"padding-left:8px;">
+ =
+ <img =
+src=3D"https://content2.flowwow-images.com/images/mail/footer/chevron-rig=
+ht.png"
+ =
+ width=3D"20" border=3D"0"
+ =
+ style=3D"max-width:20px; =
+height:auto;margin:auto;display:inline; padding-left:8px;">
+ =
+ </td>
+ =
+</tr>
+ =
+</table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- END SUBHEAD -->
+
+ <!-- START TEXT -->
+ <tr>
+ <td>
+ <table cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0" width=3D"100%">
+ <tr>
+ <td style=3D"text-align:left;">
+ <div =
+style=3D"line-height:16px">
+ <span style=3D"color: =
+#8c8c8c;line-height:16px;font-family:Noto Sans, Helvetica, Arial, =
+sans-serif; font-size:12px;text-align:left;">
+ =
+=D0=A0=D0=B0=D1=81=D1=81=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D0=B5=D0=BC =
+=D0=BA=D0=B0=D0=BA =
+=D1=80=D0=B0=D0=B7=D0=B2=D0=B8=D0=B2=D0=B0=D1=82=D1=8C =
+=D1=81=D0=B2=D0=BE=D0=B9 =D0=B1=D1=80=D0=B5=D0=BD=D0=B4 =D0=B8 =
+=D0=BF=D1=80=D0=B8=D0=B2=D0=BB=D0=B5=D1=87=D1=8C =
+=D0=BF=D0=BE=D0=BA=D1=83=D0=BF=D0=B0=D1=82=D0=B5=D0=BB=D0=B5=D0=B9 =
+ </span>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- END TEXT -->
+ </table>
+ </td>
+ =20
+ <td width=3D"12">
+ <table cellspacing=3D"0" cellpadding=3D"0" border=3D"0">
+ <tr>
+ </tr>
+ </table>
+ </td>
+
+ <td class=3D"card-button">
+ <table cellspacing=3D"0" cellpadding=3D"0" =
+border=3D"0">
+ <tr>
+ <td>
+ <table align=3D"left" cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ <table cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ <table =
+cellspacing=3D"0" cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td =
+style=3D"text-align:left;">
+ <div =
+style=3D"line-height:20px">
+ =
+<a =
+href=3D"https://email.flowwow.com/c/eJxcy01LxDAQxvFPk1zEMp0kneaQw5ZaELzoY=
+UVveaut21rZ7YvupxcjC4uXH3-YeYJpY9SEPJqcBBYohCp5HG0_PExv98EUShDkQvLOBJm3qi=
+UVXKG1I-dd0OjIWl3o1gPw3gSpBIlorZdOkJWgIMaAIJVHoQmZhHaYtm3aMj-NfDDdPH-emNg=
+xbBg2czbGVFU5Lo_yGfZl93R4wX3Pj-bVHuz51tmz9WucpxUlk_BtP0L8yo4LPy3uPfrZsBqY=
+rn-t7pLI6pyVVWp9c3Vokn8HSE-UWiXri__HdBkAq3ZXTXw1-BMAAP__WchZRQ"
+ =
+ style=3D"text-decoration: none;">
+ =
+<span style=3D"color: #484848;line-height:20px;font-family:Noto Sans, =
+Helvetica, Arial, sans-serif; =
+font-size:14px;text-align:left;font-weight: 700;">=D0=A7=D0=B0=D1=82 =
+=D1=81=D0=B5=D0=BB=D0=BB=D0=B5=D1=80=D0=BE=D0=B2 Flowwow</span>
+ =
+</a>
+ =
+</div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width=3D"20">
+ <table =
+width=3D"100%" cellspacing=3D"0" cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ =
+<table align=3D"left" cellspacing=3D"0" cellpadding=3D"0"
+ =
+ border=3D"0">
+ =
+<tr>
+ =
+ <td style=3D"padding-left:8px;">
+ =
+ <img =
+src=3D"https://content2.flowwow-images.com/images/mail/footer/chevron-rig=
+ht.png"
+ =
+ width=3D"20" border=3D"0"
+ =
+ style=3D"max-width:20px; =
+height:auto;margin:auto;display:inline; padding-left:8px;">
+ =
+ </td>
+ =
+</tr>
+ =
+</table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0" width=3D"100%">
+ <tr>
+ <td style=3D"text-align:left;">
+ <div =
+style=3D"line-height:16px">
+ <span style=3D"color: =
+#8c8c8c;line-height:16px;font-family:Noto Sans, Helvetica, Arial, =
+sans-serif; =
+font-size:12px;text-align:left;">=D0=9E=D0=B1=D0=BC=D0=B5=D0=BD=D0=B8=D0=B2=
+=D0=B0=D0=B9=D1=82=D0=B5=D1=81=D1=8C =
+=D0=BE=D0=BF=D1=8B=D1=82=D0=BE=D0=BC =D0=B2 =
+=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D1=81=D1=82=D0=B2=D0=B5 =
+=D0=BF=D1=80=D0=B5=D0=B4=D0=BF=D1=80=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0=D1=82=D0=
+=B5=D0=BB=D0=B5=D0=B9</span>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr style=3D"height: 8px;"></tr>
+ <tr>
+ <td class=3D"card-button" colspan=3D"3">
+ <table cellspacing=3D"0" cellpadding=3D"0" =
+border=3D"0">
+ <tr>
+ <td>
+ <table align=3D"left" cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ <table cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ <table =
+cellspacing=3D"0" cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td =
+style=3D"text-align:left;">
+ <div =
+style=3D"line-height:20px">
+ =
+<a =
+href=3D"https://email.flowwow.com/c/eJxcy8FOwzAQBNCvsS-Iytm16_jgQ6sQCYkv4=
+Lax1zSQ1ChNE-jXI4wqRVyeRpqZ6BOzsyDZVxZhD4imljxSP7zkt-fo9watqlDLk8fKYe2cJt=
+XVFBlqTpqZYwpBEyDL3kdt0CITBd2hJa2MYo6gtAmAzoLQKg15XfO6C3mUgz_N8-dF4EFAK6D=
+tzynvNgMBbRppmuXkX-mDbo8d3SgsPOcFtNDqm86Rv3bTVV6u3TuH2YtGCdf8enwqgmgqUR9L=
+dg-boi3-FaqMbMmm2Nz9f7b3gxLHwyZbuXj4CQAA__8NgVq2"
+ =
+ style=3D"text-decoration: none;">
+ =
+<span style=3D"color: #484848;line-height:20px;font-family:Noto Sans, =
+Helvetica, Arial, sans-serif; =
+font-size:14px;text-align:left;font-weight: 700;">FMART by =
+flowwow</span>
+ =
+</a>
+ =
+</div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width=3D"20">
+ <table =
+width=3D"100%" cellspacing=3D"0" cellpadding=3D"0" border=3D"0">
+ <tr>
+ <td>
+ =
+<table align=3D"left" cellspacing=3D"0" cellpadding=3D"0"
+ =
+ border=3D"0">
+ =
+<tr>
+ =
+ <td style=3D"padding-left:8px;">
+ =
+ <img =
+src=3D"https://content3.flowwow-images.com/images/mail/footer/chevron-rig=
+ht.png"
+ =
+ width=3D"20" border=3D"0"
+ =
+ style=3D"max-width:20px; =
+height:auto;margin:auto;display:inline; padding-left:8px;">
+ =
+ </td>
+ =
+</tr>
+ =
+</table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing=3D"0" =
+cellpadding=3D"0" border=3D"0" width=3D"100%">
+ <tr>
+ <td style=3D"text-align:left;">
+ <div =
+style=3D"line-height:16px">
+ <span style=3D"color: =
+#8c8c8c;line-height:16px;font-family:Noto Sans, Helvetica, Arial, =
+sans-serif; =
+font-size:12px;text-align:left;">=D0=97=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=
+ =D0=B0=D0=BD=D0=BA=D0=B5=D1=82=D1=83 =D0=B8 =
+=D0=BE=D1=82=D0=BA=D1=80=D0=BE=D0=B9 =D1=81=D0=B2=D0=BE=D0=B9 =
+=D1=81=D0=BE=D0=B1=D1=81=D1=82=D0=B2=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9 =
+=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD FMART</span>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ =20
+ <table role=3D"presentation" border=3D"0" cellpadding=3D"0" =
+cellspacing=3D"0" style=3D"margin-top:16px;">
+ <tr>
+ <td class=3D"content-block">
+ <span =
+class=3D"p">=D0=9F=D0=BE=D0=BB=D0=B5=D0=B7=D0=BD=D1=8B=D0=B9 =
+=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=BD=D1=82</span>
+ </td>
+ <td style=3D"text-align:right; =
+vertical-align:middle; padding-right:8px;">
+ <a =
+href=3D"https://email.flowwow.com/c/eJxci01OwzAQRk9jbxCVMzPO1AsvGoVISJyAD=
+bKdKS1NCUrSBHp6VEOlqpunp--n9VsRx6DFF4xQAqJdazmGfffSvz-3vrTIpkDSO1_GKMkBOA=
+pgU3KUEExMwJGdCJHe-5YsMkoIiSJyIGONSAuGbAJ0DIrMtuuXpV9WqT_qzu-m6WtUuFHQKGj=
+mwyVW0PyP3kbpOhn04F_DIZwfYziHNMvUz0CKzE_4bOV7NZz0eIofkiavaqNcfWH1lAmqLtS6=
+yu4eboom868wecTZbWZ95f2Zrwejqs2Ns549_AYAAP__JElZ8A" =
+style=3D"text-decoration: none;">
+ <img =
+src=3D"https://content2.flowwow-images.com/images/mail/footer/vk-icon.png=
+"
+ alt=3D"VK" width=3D"32" =
+height=3D"32" border=3D"0"
+ style=3D"border:0; outline:none; =
+text-decoration:none; display:inline; padding-right:8px;">
+ </a>
+ <a =
+href=3D"https://email.flowwow.com/c/eJxcy89O8zAQBPCnWV8-fZGza8f2wYdGIRIST=
+8DNsTe0kDYozR_I0yMMlSouP400M8n3zM6gYF8awgqJtBV8DqfhaXx5TL7SZGRJShy9popKWw=
+XUVjkZbd_F3vWOyWrDGJM4-aQ0GeIQourIBCW1ZE4olY5IziAo2Q_jto1bEcezGPxxnt-vQAf=
+AFrBNO1-KaQFsf1di8s_hLez_u7CHuPI8rqhAyc9wSfxRTIu4Lt0rx9lDI8E139YPWYSmBFvn=
+7P7dFW32p5B5ZHLW2ebm37O5HSTUh7tsxOrxKwAA__8Yklc8" =
+style=3D"text-decoration: none;">
+ <img =
+src=3D"https://content3.flowwow-images.com/images/mail/footer/zen-logo.pn=
+g"
+ alt=3D"Zen" width=3D"62" =
+height=3D"32" border=3D"0"
+ style=3D"border:0; outline:none; =
+text-decoration:none; display:inline;">
+ </a>
+ =20
+ =20
+ </td>
+ </tr>
+ </table>
+ <table role=3D"presentation" border=3D"0" cellpadding=3D"0" =
+cellspacing=3D"0">
+ <tr>
+ <td class=3D"content-block">
+ <span =
+class=3D"p">=D0=A1=D0=BA=D0=B0=D1=87=D0=B0=D1=82=D1=8C =
+=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5</span>
+ </td>
+ <td style=3D"text-align:right; vertical-align:middle; =
+padding-right:8px;">
+ <a =
+href=3D"https://email.flowwow.com/c/eJxci8FugkAQhp9m9tJolpldBg570FCSJn2C3=
+sbdodpiIYDS-vSNWBPTy5c_882XQqNaMhoNGRPmSOQLo0c5tK_d-0sKuSe2GTmzD5i4yVKOuY=
+-cky0pk0x85KJobGpiNIeQnCcmFYluRyzOequa0DofkUpGcLZpu3nu5nXsjqYN-2nqR6ANYA1=
+YS9-Pa-n7Vq8asB5Otytg_detRm1bHQBrM4Q3-ZTLaicXiWedujM6cPZHvpJ-r4eTGU-7D41T=
+gMpCWV25fV6IUGVQbJddPj2IeuFN2OWJl-0XVnf-j_keWNhuHjabc8DfAAAA___i2GCi" =
+style=3D"text-decoration: none;">
+ <img =
+src=3D"https://content3.flowwow-images.com/images/mail/footer/app-store-i=
+con.png"
+ alt=3D"App Store" width=3D"32" =
+height=3D"32" border=3D"0"
+ style=3D"border:0; outline:none; =
+text-decoration:none; display:inline; padding-right:8px;">
+ </a>
+ <a =
+href=3D"https://email.flowwow.com/c/eJxci8Fq6zAQRb9mtHk8I89IVrzQIsEVFPoF3=
+Y2lceLWqUzsxE2-vsQlELo5XDj3JN-J1A6V-NIRVkhkN0qO3A9vef-afGXJ6ZKMOvjamspF03=
+ZdWTFVjsWU7T3QDsluOtX7ZCw5EuZoWnJstNUiCbWxEal2CEZ3Q16WvBQxH9XgD_M8TkBbwAA=
+YxoGvxT7n_SB3DximOZ8EMPA4ToAhycz9MAGFPgE1MR-LbuFxVCf_zp98-9_yjeNF5nxBA0Zf=
+-SvJd3E6q-ncfkicPTQa6ubO3ctKhKaEzW7d9b8nEVb-Cr2e3LrtyubBv7F7BBp226ft1MXjT=
+wAAAP__whlkTA" style=3D"text-decoration: none;">
+ <img =
+src=3D"https://content3.flowwow-images.com/images/mail/footer/google-play=
+-icon.png"
+ alt=3D"Google Play Store" width=3D"32" =
+height=3D"32" border=3D"0"
+ style=3D"border:0; outline:none; =
+text-decoration:none; display:inline;">
+ </a>
+ </td>
+ </tr>
+
+ <tr>
+ <td style=3D"padding-top: 8px;">
+ <a =
+href=3D"https://email.flowwow.com/c/eJxci8FOwzAMhp8muSCm1Hbq5pDDqlIJiSfg5=
+qQpG3QUtq6FPT1a0KRql0-f9fnvfJ-SY9DJF4xQAqKtdDrIfngZ3547X1pkUyDpnTchQF9Gx-=
+JCRZFdH8ARBKJQCADqve_IImMSiRSQhYw1KXVgyEZAx6DI9MO4LOOyieNBD343TV8nhVsFrYJ=
+21a6XfCto9dG_yodcHoNcJM5pGmcgReZXPrv0szme9ekc3lOcvGqMcs2V9VMmqKZQVZ3dPaxC=
+m_kfTH7i7DazufF-zLeBUfV25axnD38BAAD__xz_V8s">
+ <span style=3D"color: =
+#8c8c8c;line-height:20px;font-family:Noto Sans, Helvetica, Arial, =
+sans-serif; font-size:16px;text-decoration: underline;text-align:left;">
+ =D0=A6=D0=B5=D0=BD=D1=82=D1=80 =
+=D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D0=B8 </span>
+ </a>
+ </td>
+ </tr>
+ </table>
+ </table>
+</div>
+<!-- END FOOTER --> </div>
+ </td>
+ <td> </td>
+ </tr>
+ </table>
+ <img width=3D"1px" height=3D"1px" alt=3D"" =
+src=3D"https://email.flowwow.com/o/eJxcy8FKAzEQxvGnSS5imc3M7DSHHCyrIPgE3m=
+aTWa22Bmq7q316MVIoXn78YeYraTKLErylTjD0AZHX3va63T3Vl8eSekaBDsm_JgLoVYrwxNK=
+DFKYCGJFH7sokoH6bCjEKmmqmEUUJGMxKAOIcMEpwBNOuLktdVrnu_SE967ueb0c9a57tWOdA=
+juBbP4p9rQ4n_3ka3ywfkxvAxeHXzX0zuKFz603reHN1eGj-HaA9SWtuDhf_j-UyALe5u2rxc=
+wo_AQAA___mAUt0"></body>
+ </html>
+
+';
//$html = quoted_printable_decode($html);
if (!empty($html)) {
+ $html = quoted_printable_decode($html);
+ $html = preg_replace('/\s+/', ' ', $html);
+ // Декодируем HTML-сущности
$html = html_entity_decode($html, ENT_COMPAT, 'UTF-8');
- $doc = new HtmlDomParser($html);
-
+ $doc = new HtmlDomParser($html);
+ $orderNumber = '';
$main = $doc->findOneOrFalse("body");
if ($main !== false) {
}
}
$orderDetails['number'] = $orderNumber;
+ $orderDetails['date'] = date('Y-m-d H:m:s');
$deliveryText = '';
- $commentText = '';
$clientText = '';
- $recipientText = '';
$orderItems = [];
- $deliveryBlock = $main->findOne('p:contains("Доставить")');
+ $linkBlock = $main->findOneOrFalse('a:contains("Перейти в заказ ")');
+ if ($linkBlock) {
+ $link = $linkBlock->getAttribute('href');
+ $orderDetails['orderLink'] = $link;
+ }
+ $deliveryBlock = $main->findOne('p:contains("Доставить")');
$pickupBlock = $main->findOne('p:contains("Самовывоз")');
if ($deliveryBlock && $deliveryBlock->nextNonWhitespaceSibling()) {
$orderDetails['comment'] = trim($commentText);
}
-
-
$clientBlock = $main->findOne('p:contains("Клиент")');
$senderBlock = $main->findOne('p:contains("Отправитель")');
$orderDetails['recipient'] = $recipientText;
}
-
- $itemsBlock = $main->findOneOrFalse('h2:contains("Детали заказа")') ? $main->findOne('h2:contains("Детали заказа")') : $main->findOneOrFalse('p:contains("Детали заказа")');
+ $itemsBlock = false;
+ if ($main->findOneOrFalse('table h2:contains("Детали заказа")') != false) {
+ $itemsBlock = $main->findOneOrFalse('table h2:contains("Детали заказа")');
+ } elseif ($main->findOneOrFalse('table p:contains("Детали заказа")') != false) {
+ $itemsBlock = $main->findOneOrFalse('table p:contains("Детали заказа")');
+ }
if ($itemsBlock) {
- $itemsTable = $itemsBlock->parentNode()->find('table', 2);
+ // Yii::warning('Детали заказа 3: ' . json_encode($itemsBlock->parentNode()->innerText(), JSON_UNESCAPED_UNICODE), __METHOD__);
+ // $itemsTable = $itemsBlock->parentNode()->find('table', 2);
+ $itemsTable = $itemsBlock->parentNode();
$itemsRows = $itemsTable->find('tr');
foreach ($itemsRows as $itemsRow) {
- Yii::warning('Строка заказа: ' . json_encode($itemsRow->innerText(), JSON_UNESCAPED_UNICODE), __METHOD__);
+ // Yii::warning('Строка заказа: ' . json_encode($itemsRow->innerText(), JSON_UNESCAPED_UNICODE), __METHOD__);
$itemData = [
'name' => '',
'count' => '',
'price' => '',
];
-
// Извлекаем название и количество из второго <td>
$tds = $itemsRow->find('td');
if (count($tds) >= 2) {
$itemData['name'] = trim(str_replace("\u{00A0}", ' ', strip_tags(preg_replace('/\s+/', ' ',$tds[1]->find('p', 0)->innerText()))));
$itemData['count'] = trim(str_replace(["\u{00A0}", 'шт.'], '', strip_tags(preg_replace('/\s+/', '', $tds[1]->find('p', 1)->innerText()))));
}
-
// Извлекаем цену из третьего <td>
if (count($tds) >= 3) {
$itemData['price'] = (float)trim(str_replace(["\u{00A0}", '₽' , ' '], '', strip_tags(preg_replace('/\s+/', ' ', $tds[2]->find('p', 0)->innerText()))));
}
-
-
// Добавляем данные в массив
$orderItems[] = $itemData;
}
$totalSum = 0;
- $sumBlock = $itemsBlock->parentNode()->find('table', 3);
- $sumRow = $sumBlock->find('tr');
+
+ $sumBlock = $main->findOneOrFalse('p:contains("Итого оплачено")');
+
+ if ($sumBlock) {
+ $sumBlock = $sumBlock->parentNode()->nextNonWhitespaceSibling();
+ $totalSum = (float)trim(
+ str_replace(["\u{00A0}", '₽', ' '],
+ '',
+ strip_tags(preg_replace('/\s+/', ' ', $sumBlock->innerText())))
+ );
+ }
- $sumTds = $sumRow->find('td');
- if (count($sumTds) >= 2) {
- $totalSum = (float)trim(str_replace(["\u{00A0}", '₽' , ' '], '', strip_tags(preg_replace('/\s+/', ' ', $sumTds[1]->innerText()))));
+ $deliverySum = 0;
+ $devSumBlock = $main->findOneOrFalse('p:contains("Доставка")');
+
+ if ($devSumBlock) {
+ $devSumBlock = $devSumBlock->parentNode()->nextNonWhitespaceSibling();
+ $deliverySum = (float)trim(
+ str_replace(["\u{00A0}", '₽', ' '],
+ '',
+ strip_tags(preg_replace('/\s+/', ' ', $devSumBlock->innerText())))
+ );
}
+
$orderDetails['items'] = $orderItems;
- $orderDetails['totalSum'] = $totalSum;
+ $orderDetails['deliverySum'] = $deliverySum;
+ $orderDetails['totalSum'] = $totalSum;
}
-
+ $order[$orderNumber] = $orderDetails;
}
- $order[$orderNumber] = $orderDetails;
+
return [
'success' => true,
'order' => $order
]
];
- const SUBJECT_NEW = '/^Новый_оплаченный_заказ$/';
- const SUBJECT_APPROVED = '/^Заказ_№\d+_принят!$/';
- const SUBJECT_CANCELLED = '/^Заказ_№\d+_отменён$/';
- const SUBJECT_CHANGED = '/^Изменения_в_заказе_№\d+$/';
- const SUBJECT_DELIVERED = '/^Flowwow. Заказ_выполнен._Напишите_отзыв_о_клиенте$/';
+ const SUBJECT_NEW = '/^Новый оплаченный заказ$/';
+ const SUBJECT_APPROVED = '/^Заказ №\d+ принят!$/';
+ const SUBJECT_CANCELLED = '/^Заказ №\d+ отменён$/';
+ const SUBJECT_CHANGED = '/^Изменения в заказе №\d+$/';
+ const SUBJECT_DELIVERED = '/^Flowwow. Заказ выполнен. Напишите отзыв о клиенте$/';
const SUBJECT_INDEX = [
$useSince = false,
$useAlternateMailbox = false,
$progressCallback = null,
- $seen = false
+ $seen = false,
+ $unseen = false
) {
imap_errors();
imap_alerts();
imap_timeout(IMAP_CLOSETIMEOUT, 120);
$searchCriteria = '';
- $searchCriteria .= ($useSince ? 'SINCE ' : 'ON ');
+ $searchCriteria = ($useSince ? 'SINCE ' : 'ON ');
if (!$date) {
$date = date('d-M-Y');
$searchCriteria .= '"' . $date . '" ';
}
- $searchCriteria .= ($seen ? 'SEEN ' : 'UNSEEN ');
+ if ($seen) {
+ $searchCriteria .= 'SEEN ';
+ }
+
+ if ($unseen) {
+ $searchCriteria .= 'UNSEEN ';
+ }
$subjectPatterns = [
self::SUBJECT_NEW,
$messages = [];
foreach ($folders as $folder) {
+ if ($folder == '{imap.yandex.ru:993/imap/ssl}Drafts') {
+ continue;
+ }
$inbox = imap_open($folder, $username, $password);
if (!$inbox) {
$overview = imap_fetch_overview($inbox, $email_number, 0);
$structure = imap_fetchstructure($inbox, $email_number);
$htmlMessage = '';
+ if (!isset($overview[0]->subject)) {
+ continue;
+ }
$subject = mb_decode_mimeheader($overview[0]->subject);
+ // $subject = mb_convert_encoding($subject, 'UTF-8', mb_detect_encoding($subject, 'UTF-8, ISO-8859-1, Windows-1251', true));
+ $subject = str_replace('_', ' ', $subject);
+
$from = mb_decode_mimeheader($overview[0]->from);
- $to = mb_decode_mimeheader($overview[0]->to);
+ if (isset($overview[0]->to)) {
+ $to = mb_decode_mimeheader($overview[0]->to);
+ } else {
+ if ($useAlternateMailbox) {
+ $to = 'Zakaz-bazacvetov24@yandex.ru';
+ } else {
+ $to = 'flow@bazacvetov24.ru';
+ }
+ }
+
$date = date('Y-m-d H:i:s', strtotime(mb_decode_mimeheader($overview[0]->date)));
if (isset($structure->parts) && count($structure->parts)) {
foreach ($structure->parts as $partNum => $part) {
if (preg_match($pattern, $subject)) {
$subjectIndex = self::SUBJECT_INDEX[$pattern];
if ($savedEmail !== null) {
- $savedEmail->subject_pattern = $pattern;
+ $savedEmail->email_status = 1;
$savedEmail->save();
}
$messages[] = [
'date' => $date,
'body' => $htmlMessage,
];
- self::imap_debug_log("Установка флага SEEN для сообшения #" . $email_number, $debugMode, $progressCallback);
- $result = imap_setflag_full($inbox, $email_number, "\\Seen");
- if (!$result) {
- self::imap_debug_log("Не удалось установить SEEN flag: " . imap_last_error(), $debugMode, $progressCallback);
- } else {
- self::imap_debug_log("SEEN установлен успешно", $debugMode, $progressCallback);
- }
- self::check_imap_errors($debugMode, $progressCallback);
- $overview_after = imap_fetch_overview($inbox, $email_number, 0);
- if (isset($overview_after[0]->seen) && $overview_after[0]->seen) {
- self::imap_debug_log("Сообщение #" . $email_number . " помечено SEEN", $debugMode, $progressCallback);
- } else {
- self::imap_debug_log("WARNING: Сообщение #" . $email_number . " не удалось пометить как SEEN", $debugMode, $progressCallback);
+ if ($unseen) {
+ self::imap_debug_log("Установка флага SEEN для сообшения #" . $email_number, $debugMode, $progressCallback);
+ $result = imap_setflag_full($inbox, $email_number, "\\Seen");
+ if (!$result) {
+ self::imap_debug_log("Не удалось установить SEEN flag: " . imap_last_error(), $debugMode, $progressCallback);
+ } else {
+ self::imap_debug_log("SEEN установлен успешно", $debugMode, $progressCallback);
+ }
+ self::check_imap_errors($debugMode, $progressCallback);
+
+ $overview_after = imap_fetch_overview($inbox, $email_number, 0);
+ if (isset($overview_after[0]->seen) && $overview_after[0]->seen) {
+ self::imap_debug_log("Сообщение #" . $email_number . " помечено SEEN", $debugMode, $progressCallback);
+ } else {
+ self::imap_debug_log("WARNING: Сообщение #" . $email_number . " не удалось пометить как SEEN", $debugMode, $progressCallback);
+ }
}
if ($progressCallback) {
if (!$exists) {
$email = new MarketplaceFlowwowEmails();
$email->subject = $subject;
- $email->subject_pattern = $subjectPattern;
+ $email->email_status = 0;
$email->from = $from;
$email->to = $to;
$email->date = $date;
Yii::error('Письмо не сохранено' . json_encode($email->errors), __METHOD__);
return null;
}
-
}
}
if ($progressCallback) {
call_user_func($progressCallback, "DEBUG: " . $message);
}
- Yii::info($message, 'imap_debug');
+ Yii::warning($message, 'imap_debug');
}
}
$deliveryText = '';
$clientText = '';
$orderItems = [];
-
+ $totalSum = 0;
+ $deliverySum = 0;
$linkBlock = $main->findOneOrFalse('a:contains("Перейти в заказ ")');
if ($linkBlock) {
// Добавляем данные в массив
$orderItems[] = $itemData;
}
- $totalSum = 0;
- $sumBlock = $itemsBlock->parentNode()->nextNonWhitespaceSibling();
- $sumRow = $sumBlock->find('tr');
- $sumTds = $sumRow->find('td');
- if ($sumTds && count($sumTds) >= 2) {
- $totalSum = (float)trim(str_replace(["\u{00A0}", '₽' , ' '], '', strip_tags(preg_replace('/\s+/', ' ', $sumTds[1]->innerText()))));
+ $sumBlock = $main->findOneOrFalse('p:contains("Итого оплачено")');
+
+ if ($sumBlock) {
+ $sumBlock = $sumBlock->parentNode()->nextNonWhitespaceSibling();
+ $totalSum = (float)trim
+ (
+ str_replace(
+ ["\u{00A0}", '₽', ' '],
+ '',
+ strip_tags
+ (
+ preg_replace
+ (
+ '/\s+/',
+ ' ',
+ $sumBlock->innerText()
+ )
+ )
+ )
+ );
+ }
+
+ $devSumBlock = $main->findOneOrFalse('p:contains("Доставка")');
+
+ if ($devSumBlock) {
+ $devSumBlock = $devSumBlock->parentNode()->nextNonWhitespaceSibling();
+ $deliverySum = (float)trim(
+ str_replace(["\u{00A0}", '₽', ' '],
+ '',
+ strip_tags(preg_replace('/\s+/', ' ', $devSumBlock->innerText())))
+ );
}
- $orderDetails['items'] = $orderItems;
- $orderDetails['totalSum'] = $totalSum;
}
-
+ $orderDetails['items'] = $orderItems;
+ $orderDetails['deliverySum'] = $deliverySum;
+ $orderDetails['totalSum'] = $totalSum;
$order[$orderNumber] = $orderDetails;
return $order;
}
$marketplaceOrder->updated_at = date('Y-m-d H:i:s');
$marketplaceOrder->warehouse_guid = (string)$campaignId;
$marketplaceOrder->total = $order['totalSum'];
- $marketplaceOrder->delivery_total = 0;
+ $marketplaceOrder->delivery_total = $order['deliverySum'];
$marketplaceOrder->buyer_total_before_discount = $order['totalSum'];
$marketplaceOrder->tax_system = 'UNKNOWN';
$marketplaceOrder->payment_type = 'UNKNOWN';