Quellcode durchsuchen

Merge branch 'yang-send-email' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	app/Http/Controllers/TestController.php
LD vor 5 Jahren
Ursprung
Commit
0040933a17

+ 35 - 0
app/Events/SendEmailEvent.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Events;
+
+use Illuminate\Broadcasting\Channel;
+use Illuminate\Broadcasting\InteractsWithSockets;
+use Illuminate\Broadcasting\PresenceChannel;
+use Illuminate\Broadcasting\PrivateChannel;
+use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
+use Illuminate\Foundation\Events\Dispatchable;
+use Illuminate\Queue\SerializesModels;
+
+class SendEmailEvent
+{
+    use Dispatchable, InteractsWithSockets, SerializesModels;
+
+
+    /**
+     * SendEmailEvent constructor.
+     */
+    public function __construct()
+    {
+    }
+
+
+    /**
+     * Get the channels the event should broadcast on.
+     *
+     * @return \Illuminate\Broadcasting\Channel|array
+     */
+    public function broadcastOn()
+    {
+        return new PrivateChannel('channel-name');
+    }
+}

+ 75 - 0
app/Http/Controllers/SendEmailsController.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\MailEvent;
+use App\Role;
+use Illuminate\Http\Request;
+
+class SendEmailsController extends Controller
+{
+    //
+    public function index()
+    {
+        $roles = Role::all();
+        $emailEvents = MailEvent::query()->with('roles')->orderBy('id')->paginate();
+        foreach ($emailEvents as $emailEvent) {
+            $emailEvent->template = json_decode($emailEvent->template);
+            $emailEvent->remark_show = true;
+            $emailEvent->remark_edit = false;
+            $emailEvent->template_show = true;
+            $emailEvent->template_edit = false;
+            $emailEvent->role_selected = '';
+        }
+        return view('maintenance.emails.index', compact('roles', 'emailEvents'));
+    }
+
+    public function addRole(Request $request)
+    {
+        $roleId = $request->roleId;
+        $role = Role::find($roleId);
+        $eventMailId = $request->eventMailId;
+        if (MailEvent::query()->find($eventMailId)->roles()->where('roles.id', $roleId)->exists()) {
+            return ['success' => false, 'data' => '角色已存在'];
+        } else {
+            MailEvent::query()->find($eventMailId)->roles()->attach($role->id);
+            return ['success' => true, 'data' => ['role' => $role]];
+        }
+    }
+
+    public function deleteRole(Request $request)
+    {
+        $roleId = $request->roleId;
+        $role = Role::find($roleId);
+        $eventMailId = $request->eventMailId;
+        MailEvent::query()->find($eventMailId)->roles()->detach($role->id);
+        return ['success' => true, 'data' => $role];
+    }
+
+    public function updateTemplate(Request $request)
+    {
+        $model = MailEvent::query()->find($request->id);
+        $model->update([
+            'template' => $request->template,
+        ]);
+        return ['success' => true];
+    }
+
+    public function active(Request $request)
+    {
+        $model = MailEvent::query()->find($request->id);
+        $model->update([
+            'is_active' => !$model->is_active,
+        ]);
+        return ['success' => true, 'data' => !$model->is_active];
+    }
+
+    public function updateRemark(Request $request)
+    {
+        $model = MailEvent::query()->find($request->id);
+        $model->update([
+            'remark' => $request->remark,
+        ]);
+        return ['success' => true];
+    }
+}

+ 16 - 0
app/Http/Controllers/TestController.php

@@ -15,12 +15,17 @@ use App\Console\Commands\CreateOwnerReport;
 use App\Console\Commands\SyncWmsCommoditiesInformation;
 use App\Console\Commands\SyncWMSOrderTask;
 use App\Console\Commands\WasSyncWmsAsnInformation;
+use App\Events\CancelOrder;
+use App\Events\SendEmailEvent;
+use App\Http\Requests\ForeignHaiRobotic_taskUpdateRequest;
+use App\Http\Requests\TestAaRequest;
 use App\Imports\OrderTrackingImport;
 use App\InventoryAccount;
 use App\LaborReport;
 use App\Log;
 use App\Logistic;
 use App\Menu;
+use App\Notifications\SendEmailNotification;
 use App\OracleActAllocationDetails;
 use App\OracleBasCustomer;
 use App\OracleBasSKU;
@@ -1439,6 +1444,17 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         $service->clearCancelledOrderTask();
     }
 
+    public function sendEmail()
+    {
+        event(new SendEmailEvent());
+    }
+
+    public function y111()
+    {
+        $controller = new SendEmailsController();
+        $controller->index();
+    }
+
     public function processOrderIssueRejectedBill()
     {
         OrderIssue::query()->withTrashed()->whereNotNull('logistic_number_return')->chunkById(200,function($orderIssues){

+ 63 - 0
app/Listeners/SendEmailListener.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace App\Listeners;
+
+use App\Events\SendEmailEvent;
+use App\MailEvent;
+use App\Notifications\SendEmailNotification;
+use Tightenco\Collect\Support\Collection;
+
+/**
+ * 邮件发送监听器
+ * Class SendEmailListener
+ * @package App\Listeners
+ */
+class SendEmailListener
+{
+
+
+    /**
+     * SendEmailListener constructor.
+     */
+    public function __construct()
+    {
+
+    }
+
+
+    /**
+     * Handle the event.
+     *
+     * @param SendEmailEvent $event
+     * @return void
+     */
+    public function handle(SendEmailEvent $event)
+    {
+        //根据SendEmailEvent->className 从数据库中查找,判断状态是否开启
+        $emailEvent = MailEvent::query()
+            ->where('event_name', SendEmailEvent::class)
+            ->where('is_active', true)
+            ->first();
+        if ($emailEvent) {
+            /** @var MailEvent $emailEvent */
+            $users = $this->getUsers($emailEvent);
+            foreach ($users as $user) {//给这些用户发送通知
+                $user->notify(new SendEmailNotification($emailEvent->template));//邮件模板由数据库中定制的模板为准
+            }
+        }
+    }
+
+    /**
+     * 根據事件关联的角色,查询到用户
+     * @param MailEvent $emailEvent
+     * @return \Illuminate\Support\Collection|Collection
+     */
+    private function getUsers(MailEvent $emailEvent)
+    {
+        $users = collect();
+        foreach ($emailEvent->roles as $role) {
+            $users = $users->merge($role->users);
+        }
+        return $users;
+    }
+}

+ 23 - 0
app/MailEvent.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\LogModelChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
+
+class MailEvent extends Model
+{
+    use LogModelChanging;
+
+    protected $fillable = ['name', 'event_name', 'remark', 'is_active', 'template'];
+
+    /**
+     * @return BelongsToMany
+     */
+    public function roles(): BelongsToMany
+    {
+        return $this->belongsToMany(Role::class,'mail_event_role','mail_event_id','role_id');
+    }
+}

+ 63 - 0
app/Notifications/SendEmailNotification.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace App\Notifications;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Notifications\Notification;
+
+class SendEmailNotification extends Notification implements ShouldQueue
+{
+    use Queueable;
+
+    public $objToJson;
+
+    /**
+     * SendEmailNotification constructor.
+     * @param $objToJson
+     */
+    public function __construct($objToJson)
+    {
+        $this->objToJson = $objToJson;
+    }
+
+
+    /**
+     * Get the notification's delivery channels.
+     *
+     * @param  mixed  $notifiable
+     * @return array
+     */
+    public function via($notifiable): array
+    {
+        return ['mail'];
+    }
+
+    /**
+     * Get the mail representation of the notification.
+     *
+     * @param  mixed  $notifiable
+     * @return MailMessage
+     */
+    public function toMail($notifiable): MailMessage
+    {
+        $template = json_decode($this->objToJson);
+        return (new MailMessage)->view(
+            'emails.test', ['objToJson' => $template]
+        )->subject($template->title);
+    }
+
+    /**
+     * Get the array representation of the notification.
+     *
+     * @param  mixed  $notifiable
+     * @return array
+     */
+    public function toArray($notifiable)
+    {
+        return [
+            //
+        ];
+    }
+}

+ 3 - 0
app/Providers/EventServiceProvider.php

@@ -35,6 +35,9 @@ class EventServiceProvider extends ServiceProvider
         ModelChangedEvent::class =>[
             ModelChangedListener::class
         ],
+        'App\Events\SendEmailEvent' => [
+            'App\Listeners\SendEmailListener'
+        ],
     ];
 
     /**

+ 35 - 0
database/migrations/2021_01_08_101028_create_notifications_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNotificationsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('notifications', function (Blueprint $table) {
+            $table->uuid('id')->primary();
+            $table->string('type');
+            $table->morphs('notifiable');
+            $table->text('data');
+            $table->timestamp('read_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('notifications');
+    }
+}

+ 36 - 0
database/migrations/2021_01_08_110021_create_mail_events_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateMailEventsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('mail_events', function (Blueprint $table) {
+            $table->id();
+            $table->string('name');
+            $table->string('event_name');
+            $table->string('remark')->nullable();
+            $table->boolean('is_active')->default(true);
+            $table->text('template')->nullable()->comment('邮件模板,json格式');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('mail_events');
+    }
+}

+ 33 - 0
database/migrations/2021_01_08_110329_create_mail_event_role_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateMailEventRoleTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('mail_event_role', function (Blueprint $table) {
+            $table->id();
+            $table->integer('mail_event_id');
+            $table->integer('role_id');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('mail_event_role');
+    }
+}

+ 43 - 0
database/migrations/2021_01_08_110607_add_default_email.php

@@ -0,0 +1,43 @@
+<?php
+
+use App\Events\SendEmailEvent;
+use App\MailEvent;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddDefaultEmail extends Migration
+{
+    protected $mailEvent;
+
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        //
+        $this->mailEvent = (new MailEvent([
+            'name' => '发送默认邮件',
+            'event_name' => SendEmailEvent::class,
+            'remark' => null,
+            'is_active' => true,
+            'template' => json_encode([
+                'title' => '邮件测试',
+                'description' => '这是一封测试邮件,收到不用回复'
+            ]),
+        ]))->save();
+
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        $this->mailEvent->delete();
+    }
+}

+ 36 - 0
database/migrations/2021_01_08_112003_add_default_mail_event_role.php

@@ -0,0 +1,36 @@
+<?php
+
+use App\Events\SendEmailEvent;
+use App\MailEvent;
+use App\Role;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+class AddDefaultMailEventRole extends Migration
+{
+    protected $role;
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        $this->role =  Role::query()->firstOrCreate(['name'=>'发送邮件测试']);
+        $emailEvent = MailEvent::query()->where('name', '发送默认邮件')->first();
+        $emailEvent->roles()->attach($this->role->id);
+        $this->role->users()->attach(\App\User::query()->where('name','yang')->first()->id);
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        $this->role->delete();
+    }
+}

+ 2 - 0
resources/views/emails/test.blade.php

@@ -0,0 +1,2 @@
+{{  $objToJson->title }}
+{{  $objToJson->description }}

+ 243 - 0
resources/views/maintenance/emails/index.blade.php

@@ -0,0 +1,243 @@
+@extends('layouts.app')
+@section('title')邮件@endsection
+@section('content')
+    <div id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.log.menu')@endcomponent
+    </div>
+    <div class="container-fluid" id="container">
+        <div class="card">
+            <div id="form_div"></div>
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                @endif
+                <table class="table table-sm table-hover table-condensed">
+                    <tr>
+                        <th>序号</th>
+                        <th>事件名</th>
+                        <th>通知角色</th>
+                        <th>事件描述</th>
+                        <th>邮件模板</th>
+                        <th>操作</th>
+                    </tr>
+                    <tr v-for="(emailEvent,i) in emailEvents">
+                        <td width="50">@{{ i+1 }}</td>
+                        <td width="50">@{{ emailEvent.name }}</td>
+                        <td width="100">
+                            <table class="table table-sm">
+                                <tr colspan="2">
+                                    <td>
+                                        <select class="form-control form-control-sm" v-model="emailEvent.role_selected">
+                                            <option v-for="role in roles" :value="role.id"> @{{ role.name }}</option>
+                                        </select>
+                                    </td>
+                                    <td>
+                                        <button class="btn btn-sm btn-primary" @click="addRole(emailEvent)">添加</button>
+                                    </td>
+                                </tr>
+                                <tr v-for="(role,j) in emailEvent.roles" v-if="j<2 || emailEvent.isShowRole">
+                                    <td>@{{ role.name }}</td>
+                                    <td>
+                                        <button class="btn btn-sm btn-outline-danger"
+                                                @click="deleteRole(role,j,emailEvent)">
+                                            删除
+                                        </button>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td>
+                                        <div class="row" @click="showRole(i)" v-if="emailEvent.roles.length > 2">
+                                            <label class="text-center mt-0 p-0 cursor-pointer offset-5">
+                                        <span class="fa"
+                                              :class="emailEvent.isShowRole ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>
+                                                &nbsp;<span v-if="emailEvent.isShowRole">收起</span><span
+                                                    v-if="!emailEvent.isShowRole">展开</span>共@{{ emailEvent.roles.length
+                                                }} 条角色
+                                            </label>
+                                        </div>
+                                    </td>
+                                </tr>
+                            </table>
+                        </td>
+                        <td width="150">
+                            <span class="w-auto" v-show="emailEvents[i].remark_show&&emailEvent.remark"
+                                  @click="remarkShow(i,$event)">@{{ emailEvent.remark }}</span>
+                            <span v-show="emailEvents[i].remark_edit||!emailEvent.remark">
+                                <textarea width="150" class="form-control" rows="5" type="text"
+                                          @blur="remarkShow(i,$event)">@{{ emailEvent.remark }}</textarea>
+                                <button class="btn btn-sm btn-primary"
+                                        @click="updateRemark(emailEvent,$event)">修改</button>
+                            </span>
+                        </td>
+                        <td width="150">
+                        <span v-show="emailEvents[i].template_show&&emailEvent.template" @click="templateShow(i,$event)"
+                              class="w-auto">@{{ emailEvent.template }}</span>
+                            <span v-show="emailEvents[i].template_edit||!emailEvent.template">
+                            <textarea width="150" class="form-control" rows="5" type="text"
+                                      @blur="templateShow(i,$event)">@{{ emailEvent.template }}</textarea>
+                            <button class="btn btn-sm btn-primary"
+                                    @click="updateTemplate(emailEvent,$event)">修改</button>
+                        </span>
+                        </td>
+                        <td width="50">
+                            <button class="btn btn-success" v-if="emailEvent.is_active===0" @click="active(emailEvent)">
+                                启用
+                            </button>
+                            <button class="btn btn-secondary" v-if="emailEvent.is_active===1"
+                                    @click="active(emailEvent)">
+                                禁用
+                            </button>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+    </div>
+@stop
+@section('lastScript')
+    <script>
+        new Vue({
+            el: "#container",
+            data: {
+                emailEvents: {!!  $emailEvents->toJson() !!}['data'],
+                roles: {!!  $roles->toJson() !!},
+                addRolesFlag: false,
+            },
+            methods: {
+                /**
+                 * 添加角色,并将添加的角色添加到当前时间角色列表的顶部
+                 * @param emailEvent
+                 */
+                addRole(emailEvent) {
+                    window.tempTip.postBasicRequest("{{url('maintenance/mail/addRole')}}", {
+                        roleId: emailEvent.role_selected,
+                        eventMailId: emailEvent.id
+                    }, res => {
+                        let role = res.role;
+                        if (role) {
+                            emailEvent.roles.unshift(role);
+                            return "添加关联角色:" + role.name + " 成功!";
+                        }
+                    });
+                },
+                /**
+                 * 删除角色,当前事件的指定角色删除
+                 * @param role 要删除的角色
+                 * @param index 删除角色的索引
+                 * @param emailEvent 事件
+                 */
+                deleteRole(role, index, emailEvent) {
+                    window.tempTip.postBasicRequest("{{url('maintenance/mail/deleteRole')}}", {
+                        roleId: role.id,
+                        eventMailId: emailEvent.id
+                    }, res => {
+                        emailEvent.roles.splice(index, 1);
+                        return "取消关联角色:" + role.name + " 成功!";
+                    });
+                },
+                /**
+                 * 更新模板
+                 * 隐藏模板编辑,显示模板展示,更新前端显示
+                 * @param emailEvent
+                 * @param e
+                 */
+                updateTemplate(emailEvent, e) {
+                    let textarre = $(e.target).prev().val();
+                    window.tempTip.postBasicRequest("{{url('maintenance/mail/updateTemplate')}}", {
+                        id: emailEvent.id,
+                        template: textarre,
+                    }, res => {
+                        emailEvent.template = textarre;
+                        emailEvent.template_show = true;
+                        emailEvent.template_edit = false;
+                        return "修改模板成功!";
+                    });
+
+                },
+                /**
+                 * 更新备注
+                 * 隐藏备注编辑,显示备注展示,更新备注显示
+                 * @param emailEvent
+                 * @param e
+                 */
+                updateRemark(emailEvent, e) {
+                    let textarre = $(e.target).prev().val();
+                    window.tempTip.postBasicRequest("{{url('maintenance/mail/updateRemark')}}", {
+                        id: emailEvent.id,
+                        remark: textarre,
+                    }, res => {
+                        emailEvent.remark = textarre;
+                        emailEvent.remark_show = true;
+                        emailEvent.remark_edit = false;
+                        return "修改备注成功!";
+                    });
+
+                },
+                /**
+                 * 启用/禁用指定模板
+                 * @param emailEvent
+                 */
+                active(emailEvent) {
+                    window.tempTip.postBasicRequest("{{url('maintenance/mail/active')}}", {
+                        id: emailEvent.id,
+                    }, res => {
+                        if (res) {
+                            emailEvent.is_active = 0;
+                            return "模板启用禁用!";
+                        } else {
+                            emailEvent.is_active = 1;
+                            return "模板启用成功!";
+                        }
+                    });
+                },
+                /**
+                 * 展开折叠指定模板的角色列表
+                 * @param index
+                 */
+                showRole(index) {
+                    if (this.emailEvents[index].isShowRole) {
+                        this.emailEvents[index].isShowRole = false;
+                    } else {
+                        this.emailEvents[index].isShowRole = true;
+                    }
+                    this.$forceUpdate();
+                },
+                /**
+                 * 备注编辑/显示切换
+                 * 切换为编辑时,自动聚焦到textarea
+                 * @param index
+                 * @param $event
+                 */
+                remarkShow(index, $event) {
+                    let _this = this;
+                    setTimeout(function () {
+                        _this.emailEvents[index].remark_show = !_this.emailEvents[index].remark_show;
+                        _this.emailEvents[index].remark_edit = !_this.emailEvents[index].remark_edit;
+                        setTimeout(function () {
+                            let find = $($event.target).parent().find('textarea');
+                            find.focus();
+                        }, 100)
+                    }, 100);
+                },
+                /**
+                 * 模板编辑/显示切换
+                 * 切换为编辑时,自动聚焦到textarea
+                 * @param index
+                 * @param $event
+                 */
+                templateShow(index,$event) {
+                    let _this = this;
+                    setTimeout(function () {
+                        _this.emailEvents[index].template_show = !_this.emailEvents[index].template_show;
+                        _this.emailEvents[index].template_edit = !_this.emailEvents[index].template_edit;
+                        setTimeout(function () {
+                            let find = $($event.target).parent().find('textarea');
+                            find.focus();
+                        }, 100)
+                    }, 100);
+                },
+            }
+        })
+    </script>
+@stop

+ 12 - 0
resources/views/maintenance/emails/menu.blade.php

@@ -0,0 +1,12 @@
+
+<div class="container-fluid nav3">
+    <div class="card" >
+        <ul class="nav nav-pills">
+            @can('邮件-查询')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('maintenance/mail')}}" :class="{active:isActive('',3)}">查询</a>
+            </li> @endcan
+            {{$slot}}
+        </ul>
+    </div>
+</div>

+ 4 - 0
resources/views/maintenance/menu.blade.php

@@ -94,6 +94,10 @@
                 <li class="nav-item">
                     <a class="nav-link text-muted" href="{{url('maintenance/laborCompany')}}" :class="{active:isActive('laborCompany',2)}">劳务所</a>
                 </li> @endcan
+            {{--TODO 权限--}}
+                <li class="nav-item">
+                    <a class="nav-link text-muted" href="{{url('maintenance/mail')}}" :class="{active:isActive('mail',2)}">邮件</a>
+                </li>
             @can('日志')
                 <li class="nav-item">
                     <a class="nav-link text-muted" href="{{url('maintenance/log')}}" :class="{active:isActive('log',2)}">日志</a>

+ 6 - 0
routes/web.php

@@ -218,6 +218,12 @@ Route::group(['prefix'=>'maintenance'],function(){
     Route::resource('userOwnerGroup', 'UserOwnerGroupController');
     Route::resource('processMethod', 'ProcessMethodController');
     Route::resource('feature', 'FeatureController');
+    Route::resource('mail', 'SendEmailsController');
+    Route::post('mail/addRole', 'SendEmailsController@addRole')->name('mail.addRole');
+    Route::post('mail/deleteRole', 'SendEmailsController@deleteRole')->name('mail.deleteRole');
+    Route::post('mail/updateTemplate', 'SendEmailsController@updateTemplate')->name('mail.updateTemplate');
+    Route::post('mail/updateRemark', 'SendEmailsController@updateRemark')->name('mail.updateRemark');
+    Route::post('mail/active', 'SendEmailsController@active')->name('mail.active');
 });
 Route::get('maintenance', function () {return view('maintenance.index');});