bingo 7 лет назад
Родитель
Сommit
fab767e8a7

+ 90 - 6
app/Http/Controllers/TicketController.php

@@ -2,18 +2,30 @@
 
 namespace App\Http\Controllers;
 
+use App\Components\ServerChan;
 use App\Http\Models\Ticket;
 use App\Http\Models\TicketReply;
+use App\Mail\closeTicket;
+use App\Mail\replyTicket;
 use Illuminate\Http\Request;
 use Response;
+use Mail;
 
 /**
  * 工单控制器
  * Class TicketController
+ *
  * @package App\Http\Controllers
  */
 class TicketController extends Controller
 {
+    protected static $config;
+
+    public function __construct()
+    {
+        self::$config = $this->systemConfig();
+    }
+
     // 工单列表
     public function ticketList(Request $request)
     {
@@ -26,7 +38,6 @@ class TicketController extends Controller
     public function replyTicket(Request $request)
     {
         $id = $request->get('id');
-
         $user = $request->session()->get('user');
 
         if ($request->method() == 'POST') {
@@ -41,7 +52,43 @@ class TicketController extends Controller
 
             if ($obj->id) {
                 // 将工单置为已回复
-                Ticket::query()->where('id', $id)->update(['status' => 1]);
+                $ticket = Ticket::query()->where('id', $id)->first();
+                $ticket->status = 1;
+                $ticket->save();
+
+
+                $title = "工单回复提醒";
+                $content = "标题:" . $ticket->title . "<br>管理员回复:" . $content;
+
+                // 发通知邮件
+                if ($user['is_admin']) {
+                    if (self::$config['crash_warning_email']) {
+                        try {
+                            Mail::to(self::$config['crash_warning_email'])->send(new replyTicket(self::$config['website_name'], $title, $content));
+                            $this->sendEmailLog(1, $title, $content);
+                        } catch (\Exception $e) {
+                            $this->sendEmailLog(1, $title, $content, 0, $e->getMessage());
+                        }
+                    }
+                } else {
+                    try {
+                        Mail::to($user['username'])->send(new replyTicket(self::$config['website_name'], $title, $content));
+                        $this->sendEmailLog(1, $title, $content);
+                    } catch (\Exception $e) {
+                        $this->sendEmailLog(1, $title, $content, 0, $e->getMessage());
+                    }
+                }
+
+                // 通过ServerChan发微信消息提醒管理员
+                if (!$user['is_admin'] && self::$config['is_server_chan'] && self::$config['server_chan_key']) {
+                    $serverChan = new ServerChan();
+                    $result = $serverChan->send($title, $content, self::$config['server_chan_key']);
+                    if ($result->errno > 0) {
+                        $this->sendEmailLog(1, '[ServerChan]' . $title, $content);
+                    } else {
+                        $this->sendEmailLog(1, '[ServerChan]' . $title, $content, 0, $result->errmsg);
+                    }
+                }
 
                 return Response::json(['status' => 'success', 'data' => '', 'message' => '回复成功']);
             } else {
@@ -59,13 +106,50 @@ class TicketController extends Controller
     public function closeTicket(Request $request)
     {
         $id = $request->get('id');
+        $user = $request->session()->get('user');
 
-        $ret = Ticket::query()->where('id', $id)->update(['status' => 2]);
-        if ($ret) {
-            return Response::json(['status' => 'success', 'data' => '', 'message' => '关闭成功']);
-        } else {
+        $ticket = Ticket::query()->where('id', $id)->first();
+        $ticket->status = 2;
+        $ret = $ticket->save();
+        if (!$ret) {
             return Response::json(['status' => 'fail', 'data' => '', 'message' => '关闭失败']);
         }
+
+        $title = "工单关闭提醒";
+        $content = "工单【" . $ticket->title . "】已关闭";
+
+        // 发邮件通知用户
+        if (self::$config['crash_warning_email']) {
+            try {
+                Mail::to($user['username'])->send(new closeTicket(self::$config['website_name'], $title, $content));
+                $this->sendEmailLog(1, $title, $content);
+            } catch (\Exception $e) {
+                $this->sendEmailLog(1, $title, $content, 0, $e->getMessage());
+            }
+        }
+
+        // 发邮件通知管理员
+        if (self::$config['crash_warning_email']) {
+            try {
+                Mail::to(self::$config['crash_warning_email'])->send(new closeTicket(self::$config['website_name'], $title, $content));
+                $this->sendEmailLog(1, $title, $content);
+            } catch (\Exception $e) {
+                $this->sendEmailLog(1, $title, $content, 0, $e->getMessage());
+            }
+        }
+
+        // 通过ServerChan发微信消息提醒管理员
+        if (self::$config['is_server_chan'] && self::$config['server_chan_key']) {
+            $serverChan = new ServerChan();
+            $result = $serverChan->send($title, $content, self::$config['server_chan_key']);
+            if ($result->errno > 0) {
+                $this->sendEmailLog(1, '[ServerChan]' . $title, $content);
+            } else {
+                $this->sendEmailLog(1, '[ServerChan]' . $title, $content, 0, $result->errmsg);
+            }
+        }
+
+        return Response::json(['status' => 'success', 'data' => '', 'message' => '关闭成功']);
     }
 
 }

+ 61 - 7
app/Http/Controllers/UserController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Components\ServerChan;
 use App\Http\Models\Article;
 use App\Http\Models\Coupon;
 use App\Http\Models\CouponLog;
@@ -24,6 +25,9 @@ use App\Http\Models\UserTrafficDaily;
 use App\Http\Models\UserTrafficHourly;
 use App\Http\Models\Verify;
 use App\Mail\activeUser;
+use App\Mail\newTicket;
+use App\Mail\closeTicket;
+use App\Mail\replyTicket;
 use App\Mail\resetPassword;
 use Illuminate\Http\Request;
 use Redirect;
@@ -224,10 +228,10 @@ class UserController extends Controller
                 }
 
                 $data = [
-                    'passwd'   => $passwd,
-                    'method'   => $method,
+                    'passwd' => $passwd,
+                    'method' => $method,
                     'protocol' => $protocol,
-                    'obfs'     => $obfs
+                    'obfs' => $obfs
                 ];
 
                 $ret = User::query()->where('id', $user['id'])->update($data);
@@ -329,7 +333,7 @@ class UserController extends Controller
     // 添加工单
     public function addTicket(Request $request)
     {
-        $title = clean($request->get('title'));
+        $title = $request->get('title');
         $content = clean($request->get('content'));
 
         $user = $request->session()->get('user');
@@ -347,6 +351,30 @@ class UserController extends Controller
         $obj->save();
 
         if ($obj->id) {
+            $emailTitle = "新工单提醒";
+            $content = "标题:【" . $title . "】<br>内容:" . $content;
+
+            // 发邮件通知管理员
+            try {
+                if (self::$config['crash_warning_email']) {
+                    Mail::to(self::$config['crash_warning_email'])->send(new newTicket(self::$config['website_name'], $emailTitle, $content));
+                    $this->sendEmailLog(1, $emailTitle, $content);
+                }
+            } catch (\Exception $e) {
+                $this->sendEmailLog(1, $emailTitle, $content, 0, $e->getMessage());
+            }
+
+            // 通过ServerChan发微信消息提醒管理员
+            if (self::$config['is_server_chan'] && self::$config['server_chan_key']) {
+                $serverChan = new ServerChan();
+                $result = $serverChan->send($emailTitle, $content, self::$config['server_chan_key']);
+                if ($result->errno > 0) {
+                    $this->sendEmailLog(1, '[ServerChan]' . $emailTitle, $content);
+                } else {
+                    $this->sendEmailLog(1, '[ServerChan]' . $emailTitle, $content, 0, $result->errmsg);
+                }
+            }
+
             return Response::json(['status' => 'success', 'data' => '', 'message' => '提交成功']);
         } else {
             return Response::json(['status' => 'fail', 'data' => '', 'message' => '提交失败']);
@@ -356,7 +384,7 @@ class UserController extends Controller
     // 回复工单
     public function replyTicket(Request $request)
     {
-        $id = $request->get('id');
+        $id = intval($request->get('id'));
 
         $user = $request->session()->get('user');
 
@@ -371,6 +399,32 @@ class UserController extends Controller
             $obj->save();
 
             if ($obj->id) {
+                $ticket = Ticket::query()->where('id', $id)->first();
+
+                $title = "工单回复提醒";
+                $content = "标题:【" . $ticket->title . "】<br>用户回复:" . $content;
+
+                // 发邮件通知管理员
+                try {
+                    if (self::$config['crash_warning_email']) {
+                        Mail::to(self::$config['crash_warning_email'])->send(new replyTicket(self::$config['website_name'], $title, $content));
+                        $this->sendEmailLog(1, $title, $content);
+                    }
+                } catch (\Exception $e) {
+                    $this->sendEmailLog(1, $title, $content, 0, $e->getMessage());
+                }
+
+                // 通过ServerChan发微信消息提醒管理员
+                if (self::$config['is_server_chan'] && self::$config['server_chan_key']) {
+                    $serverChan = new ServerChan();
+                    $result = $serverChan->send($title, $content, self::$config['server_chan_key']);
+                    if ($result->errno > 0) {
+                        $this->sendEmailLog(1, '[ServerChan]' . $title, $content);
+                    } else {
+                        $this->sendEmailLog(1, '[ServerChan]' . $title, $content, 0, $result->errmsg);
+                    }
+                }
+
                 return Response::json(['status' => 'success', 'data' => '', 'message' => '回复成功']);
             } else {
                 return Response::json(['status' => 'fail', 'data' => '', 'message' => '回复失败']);
@@ -747,8 +801,8 @@ class UserController extends Controller
         }
 
         $data = [
-            'type'     => $coupon->type,
-            'amount'   => $coupon->amount / 100,
+            'type' => $coupon->type,
+            'amount' => $coupon->amount / 100,
             'discount' => $coupon->discount
         ];
 

+ 33 - 0
app/Mail/closeTicket.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Mail;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Mail\Mailable;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Contracts\Queue\ShouldQueue;
+
+class closeTicket extends Mailable
+{
+    use Queueable, SerializesModels;
+
+    protected $websiteName;
+    protected $title;
+    protected $content;
+
+    public function __construct($websiteName, $title, $content)
+    {
+        $this->websiteName = $websiteName;
+        $this->title = $title;
+        $this->content = $content;
+    }
+
+    public function build()
+    {
+        return $this->view('emails.closeTicket')->subject('工单关闭提醒')->with([
+            'websiteName' => $this->websiteName,
+            'title'       => $this->title,
+            'content'     => $this->content
+        ]);
+    }
+}

+ 33 - 0
app/Mail/newTicket.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Mail;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Mail\Mailable;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Contracts\Queue\ShouldQueue;
+
+class newTicket extends Mailable
+{
+    use Queueable, SerializesModels;
+
+    protected $websiteName;
+    protected $title;
+    protected $content;
+
+    public function __construct($websiteName, $title, $content)
+    {
+        $this->websiteName = $websiteName;
+        $this->title = $title;
+        $this->content = $content;
+    }
+
+    public function build()
+    {
+        return $this->view('emails.newTicket')->subject('新工单提醒')->with([
+            'websiteName' => $this->websiteName,
+            'title'       => $this->title,
+            'content'     => $this->content
+        ]);
+    }
+}

+ 33 - 0
app/Mail/replyTicket.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Mail;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Mail\Mailable;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Contracts\Queue\ShouldQueue;
+
+class replyTicket extends Mailable
+{
+    use Queueable, SerializesModels;
+
+    protected $websiteName;
+    protected $title;
+    protected $content;
+
+    public function __construct($websiteName, $title, $content)
+    {
+        $this->websiteName = $websiteName;
+        $this->title = $title;
+        $this->content = $content;
+    }
+
+    public function build()
+    {
+        return $this->view('emails.replyTicket')->subject('工单回复提醒')->with([
+            'websiteName' => $this->websiteName,
+            'title'       => $this->title,
+            'content'     => $this->content
+        ]);
+    }
+}

+ 1 - 1
resources/lang/zh-CN/home.php

@@ -88,7 +88,7 @@ return [
     'invoice_table_expired' => '已过期',
 
     // 工单
-    'ticket_title' => '工单列表',
+    'ticket_title' => '我的工单',
     'ticket_table_title' => '标题',
     'ticket_table_status' => '状态',
     'ticket_table_none' => '暂无数据',

+ 2 - 2
resources/views/admin/system.blade.php

@@ -435,7 +435,7 @@
                                                             </div>
                                                         </div>
                                                         <div class="col-md-6">
-                                                            <label for="crash_warning_email" class="col-md-3 control-label">宕机收信地址</label>
+                                                            <label for="crash_warning_email" class="col-md-3 control-label">管理员收信地址</label>
                                                             <div class="col-md-9">
                                                                 <div class="input-group">
                                                                     <input class="form-control" type="text" name="crash_warning_email" value="{{$crash_warning_email}}" id="crash_warning_email" placeholder="[email protected]" />
@@ -443,7 +443,7 @@
                                                                         <button class="btn btn-success" type="button" onclick="setCrashWarningEmail()">修改</button>
                                                                     </span>
                                                                 </div>
-                                                                <span class="help-block"> 启用节点宕机提醒后如果不填写此值,则不发信 </span>
+                                                                <span class="help-block"> 填写此值则节点宕机、工单回复会自动提醒 </span>
                                                             </div>
                                                         </div>
                                                     </div>

+ 87 - 0
resources/views/emails/closeTicket.blade.php

@@ -0,0 +1,87 @@
+<table class="body" style="Margin:0;background:#FAFAFA;border-collapse:collapse;border-spacing:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;width:100%">
+    <tbody>
+    <tr style="padding:0;text-align:left;vertical-align:top">
+        <td class="center" align="center" valign="top" style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+            <center data-parsed="" style="min-width:580px;width:100%">
+                <table align="center" class="container no-bg float-center" style="Margin:0 auto;background:0 0;border:0;border-collapse:collapse;border-radius:3px;border-spacing:0;box-shadow:none;float:none;margin:0 auto;margin-top:20px;padding:0;text-align:center;vertical-align:top;width:580px">
+                    <tbody>
+                    <tr style="padding:0;text-align:left;vertical-align:top">
+                        <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+                            <table class="row" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+
+                                    <th class="small-11 large-11 columns last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:8px;padding-right:16px;text-align:left;width:515.67px">
+                                        <table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
+                                            <tbody>
+                                            <tr style="padding:0;text-align:left;vertical-align:top">
+                                                <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                                    <h3 style="Margin:0;Margin-bottom:10px;color:inherit;font-family:Helvetica,Arial,sans-serif;font-size:28px;font-weight:400;line-height:1.3;margin:0;margin-bottom:0;padding:0;text-align:left;word-wrap:normal">
+                                                        <a href="#" style="Margin:0;color:#40253b;font-family:Helvetica,Arial,sans-serif;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none" target="_blank">
+                                                            SSRPanel
+                                                        </a>
+                                                    </h3>
+                                                </th>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+                <table align="center" class="container float-center" style="Margin:0 auto;background:#fefefe;border:1px solid #cdcdcd;border-collapse:collapse;border-radius:3px;border-spacing:0;float:none;margin:0 auto;margin-top:20px;padding:0;text-align:center;vertical-align:top;width:580px">
+                    <tbody>
+                    <tr style="padding:0;text-align:left;vertical-align:top">
+                        <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+                            <table class="row container-header-row" style="background-color:#5c97bd;border-collapse:collapse;border-spacing:0;color:#f3f3f3;display:table;padding:0;padding-bottom:8px;padding-top:8px;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th class="small-12 large-12 columns first last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:16px;padding-right:16px;text-align:left;width:564px">
+                                        <table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
+                                            <tbody>
+                                            <tr style="padding:0;text-align:left;vertical-align:top">
+                                                <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                                    <h6 style="Margin:0;Margin-bottom:10px;color:#f3f3f3;font-family:Helvetica,Arial,sans-serif;font-size:18px;font-weight:400;line-height:1.3;margin:0;margin-bottom:8px;margin-top:8px;padding:0;text-align:left;word-wrap:normal">
+                                                        <a href="#" style="Margin:0;color:#f3f3f3;font-family:Helvetica,Arial,sans-serif;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none" target="_blank">
+                                                            工单关闭提醒
+                                                        </a>
+                                                    </h6>
+                                                </th>
+                                                <th class="expander" style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></th>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                            <table class="row" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th class="small-12 large-12 columns first last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:16px;padding-right:16px;text-align:left;width:564px">
+                                        <p style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%"></p>
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                        <div class="release" style="padding-top:5px;padding-left:20px;padding-bottom:20px;">
+                                            <p>{{$content}}</p>
+                                        </div>
+                                    </th>
+                                    <th class="expander" style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></th>
+                                </tr>
+                                </tbody>
+                                </th></tr></tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </center>
+        </td>
+    </tr>
+    </tbody>
+</table>

+ 87 - 0
resources/views/emails/newTicket.blade.php

@@ -0,0 +1,87 @@
+<table class="body" style="Margin:0;background:#FAFAFA;border-collapse:collapse;border-spacing:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;width:100%">
+    <tbody>
+    <tr style="padding:0;text-align:left;vertical-align:top">
+        <td class="center" align="center" valign="top" style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+            <center data-parsed="" style="min-width:580px;width:100%">
+                <table align="center" class="container no-bg float-center" style="Margin:0 auto;background:0 0;border:0;border-collapse:collapse;border-radius:3px;border-spacing:0;box-shadow:none;float:none;margin:0 auto;margin-top:20px;padding:0;text-align:center;vertical-align:top;width:580px">
+                    <tbody>
+                    <tr style="padding:0;text-align:left;vertical-align:top">
+                        <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+                            <table class="row" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+
+                                    <th class="small-11 large-11 columns last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:8px;padding-right:16px;text-align:left;width:515.67px">
+                                        <table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
+                                            <tbody>
+                                            <tr style="padding:0;text-align:left;vertical-align:top">
+                                                <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                                    <h3 style="Margin:0;Margin-bottom:10px;color:inherit;font-family:Helvetica,Arial,sans-serif;font-size:28px;font-weight:400;line-height:1.3;margin:0;margin-bottom:0;padding:0;text-align:left;word-wrap:normal">
+                                                        <a href="#" style="Margin:0;color:#40253b;font-family:Helvetica,Arial,sans-serif;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none" target="_blank">
+                                                            SSRPanel
+                                                        </a>
+                                                    </h3>
+                                                </th>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+                <table align="center" class="container float-center" style="Margin:0 auto;background:#fefefe;border:1px solid #cdcdcd;border-collapse:collapse;border-radius:3px;border-spacing:0;float:none;margin:0 auto;margin-top:20px;padding:0;text-align:center;vertical-align:top;width:580px">
+                    <tbody>
+                    <tr style="padding:0;text-align:left;vertical-align:top">
+                        <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+                            <table class="row container-header-row" style="background-color:#5c97bd;border-collapse:collapse;border-spacing:0;color:#f3f3f3;display:table;padding:0;padding-bottom:8px;padding-top:8px;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th class="small-12 large-12 columns first last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:16px;padding-right:16px;text-align:left;width:564px">
+                                        <table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
+                                            <tbody>
+                                            <tr style="padding:0;text-align:left;vertical-align:top">
+                                                <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                                    <h6 style="Margin:0;Margin-bottom:10px;color:#f3f3f3;font-family:Helvetica,Arial,sans-serif;font-size:18px;font-weight:400;line-height:1.3;margin:0;margin-bottom:8px;margin-top:8px;padding:0;text-align:left;word-wrap:normal">
+                                                        <a href="#" style="Margin:0;color:#f3f3f3;font-family:Helvetica,Arial,sans-serif;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none" target="_blank">
+                                                            新工单提醒
+                                                        </a>
+                                                    </h6>
+                                                </th>
+                                                <th class="expander" style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></th>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                            <table class="row" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th class="small-12 large-12 columns first last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:16px;padding-right:16px;text-align:left;width:564px">
+                                        <p style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%"></p>
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                        <div class="release" style="padding-top:5px;padding-left:20px;padding-bottom:20px;">
+                                            {!! $content !!}
+                                        </div>
+                                    </th>
+                                    <th class="expander" style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></th>
+                                </tr>
+                                </tbody>
+                                </th></tr></tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </center>
+        </td>
+    </tr>
+    </tbody>
+</table>

+ 87 - 0
resources/views/emails/replyTicket.blade.php

@@ -0,0 +1,87 @@
+<table class="body" style="Margin:0;background:#FAFAFA;border-collapse:collapse;border-spacing:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;width:100%">
+    <tbody>
+    <tr style="padding:0;text-align:left;vertical-align:top">
+        <td class="center" align="center" valign="top" style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+            <center data-parsed="" style="min-width:580px;width:100%">
+                <table align="center" class="container no-bg float-center" style="Margin:0 auto;background:0 0;border:0;border-collapse:collapse;border-radius:3px;border-spacing:0;box-shadow:none;float:none;margin:0 auto;margin-top:20px;padding:0;text-align:center;vertical-align:top;width:580px">
+                    <tbody>
+                    <tr style="padding:0;text-align:left;vertical-align:top">
+                        <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+                            <table class="row" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+
+                                    <th class="small-11 large-11 columns last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:8px;padding-right:16px;text-align:left;width:515.67px">
+                                        <table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
+                                            <tbody>
+                                            <tr style="padding:0;text-align:left;vertical-align:top">
+                                                <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                                    <h3 style="Margin:0;Margin-bottom:10px;color:inherit;font-family:Helvetica,Arial,sans-serif;font-size:28px;font-weight:400;line-height:1.3;margin:0;margin-bottom:0;padding:0;text-align:left;word-wrap:normal">
+                                                        <a href="#" style="Margin:0;color:#40253b;font-family:Helvetica,Arial,sans-serif;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none" target="_blank">
+                                                            SSRPanel
+                                                        </a>
+                                                    </h3>
+                                                </th>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+                <table align="center" class="container float-center" style="Margin:0 auto;background:#fefefe;border:1px solid #cdcdcd;border-collapse:collapse;border-radius:3px;border-spacing:0;float:none;margin:0 auto;margin-top:20px;padding:0;text-align:center;vertical-align:top;width:580px">
+                    <tbody>
+                    <tr style="padding:0;text-align:left;vertical-align:top">
+                        <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:19px;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+                            <table class="row container-header-row" style="background-color:#5c97bd;border-collapse:collapse;border-spacing:0;color:#f3f3f3;display:table;padding:0;padding-bottom:8px;padding-top:8px;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th class="small-12 large-12 columns first last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:16px;padding-right:16px;text-align:left;width:564px">
+                                        <table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
+                                            <tbody>
+                                            <tr style="padding:0;text-align:left;vertical-align:top">
+                                                <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                                    <h6 style="Margin:0;Margin-bottom:10px;color:#f3f3f3;font-family:Helvetica,Arial,sans-serif;font-size:18px;font-weight:400;line-height:1.3;margin:0;margin-bottom:8px;margin-top:8px;padding:0;text-align:left;word-wrap:normal">
+                                                        <a href="#" style="Margin:0;color:#f3f3f3;font-family:Helvetica,Arial,sans-serif;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none" target="_blank">
+                                                            工单回复提醒
+                                                        </a>
+                                                    </h6>
+                                                </th>
+                                                <th class="expander" style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></th>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                            <table class="row" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th class="small-12 large-12 columns first last" style="Margin:0 auto;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0 auto;padding:0;padding-bottom:0;padding-left:16px;padding-right:16px;text-align:left;width:564px">
+                                        <p style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%"></p>
+                                <tbody>
+                                <tr style="padding:0;text-align:left;vertical-align:top">
+                                    <th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
+                                        <div class="release" style="padding-top:5px;padding-left:20px;padding-bottom:20px;">
+                                            {!! $content !!}
+                                        </div>
+                                    </th>
+                                    <th class="expander" style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></th>
+                                </tr>
+                                </tbody>
+                                </th></tr></tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </center>
+        </td>
+    </tr>
+    </tbody>
+</table>

+ 11 - 12
resources/views/user/addOrder.blade.php

@@ -84,12 +84,13 @@
                 data: {_token:'{{csrf_token()}}', coupon_sn:coupon_sn},
                 dataType: 'json',
                 beforeSend: function () {
-                    layerIndex = layer.load(1, {
+                    index = layer.load(1, {
                         shade: [0.7,'#CCC']
                     });
                 },
                 success: function (ret) {
                     console.log(ret);
+                    layer.close(index);
                     $("#coupon_sn").parent().removeClass("has-error");
                     $("#coupon_sn").parent().removeClass("has-success");
                     $(".input-group-addon").remove();
@@ -112,9 +113,6 @@
                         $("#coupon_sn").parent().remove('.input-group-addon');
                         $("#coupon_sn").parent().prepend('<span class="input-group-addon"><i class="fa fa-remove fa-fw"></i></span>');
                     }
-                },
-                complete: function () {
-                    layer.close(layerIndex);
                 }
             });
         }
@@ -131,7 +129,7 @@
                 data: {_token:'{{csrf_token()}}', goods_id:goods_id, coupon_sn:coupon_sn},
                 dataType: 'json',
                 beforeSend: function () {
-                    layerIndex = layer.load(1, {
+                    index = layer.load(1, {
                         shade: [0.7,'#CCC']
                     });
                 },
@@ -139,12 +137,14 @@
                     layer.msg(ret.message, {time:1300}, function() {
                         if (ret.status == 'success') {
                             window.location.href = '{{url('payment')}}' + "/" + ret.data;
+                        } else {
+                            layer.close(index);
                         }
                     });
-                },
-                complete: function () {
-                    layer.close(layerIndex);
                 }
+                //complete: function () {
+                    //
+                //}
             });
         }
 
@@ -160,7 +160,7 @@
                 data: {_token:'{{csrf_token()}}', goods_id:goods_id, coupon_sn:coupon_sn},
                 dataType: 'json',
                 beforeSend: function () {
-                    layerIndex = layer.load(1, {
+                    index = layer.load(1, {
                         shade: [0.7,'#CCC']
                     });
                 },
@@ -168,11 +168,10 @@
                     layer.msg(ret.message, {time:1300}, function() {
                         if (ret.status == 'success') {
                             window.location.href = '{{url('user/orderList')}}';
+                        } else {
+                            layer.close(index);
                         }
                     });
-                },
-                complete: function () {
-                    layer.close(layerIndex);
                 }
             });
         }

+ 1 - 1
resources/views/user/ticketList.blade.php

@@ -36,7 +36,7 @@
                                 <tbody>
                                 @if($ticketList->isEmpty())
                                     <tr>
-                                        <td colspan="4" style="text-align: center;" {{trans('home.ticket_table_none')}} </td>
+                                        <td colspan="4" style="text-align: center;"> {{trans('home.ticket_table_none')}} </td>
                                     </tr>
                                 @else
                                     @foreach($ticketList as $key => $ticket)