Browse Source

Merge branch 'develop' of http://git.caihongxingqiu.net/rainbow/config-manage into develop

zhangchangchun 5 years ago
parent
commit
d202999663

+ 27 - 1
app/Http/Controllers/ConfigController.php

@@ -90,7 +90,33 @@ class ConfigController extends Controller
                 'use_background' =>[
                     '1' => '社区后台',
                     '0' => 'CMS'
-                ]
+                ],
+                //通知群体
+                'notice_groups' =>[
+                    '1' => '原始用户',
+                    '0' => '全部',
+                    '2' => '正式用户',
+                ],
+                //消息类型
+                'message_type' =>[
+                    'star' => '星球活动消息',
+                    'system' => '系统通知消息'
+                ],
+                //展示类型
+                'message_show_type' =>[
+                    'only_show' => '纯展示',
+                    'user' => '用户',
+                    'post' => '内容',
+                    'activity' => '活动',
+                    'topic' => '话题',
+                ],
+                //消息状态
+                'message_status' =>[
+                    '1' => '发送中',
+                    '0' => '未发送',
+                    '2' => '已发送未隐藏',
+                    '3' => '已发送并隐藏',
+                ],
         ];
     }
 }

+ 146 - 0
app/Http/Controllers/MessageRuleController.php

@@ -0,0 +1,146 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/6/12
+ * Time: 9:08
+ */
+
+namespace App\Http\Controllers;
+
+use App\Repositories\MessageRuleRepository;
+use App\Transformers\MessageRuleDetailTransformer;
+use App\Transformers\MessageRuleListTransformer;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Validator;
+use App\Http\Controllers\Controller;
+use Illuminate\Validation\Rule;
+use League\Fractal\Manager;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Resource\Item;
+
+class MessageRuleController extends Controller
+{
+    public function __construct(MessageRuleRepository $messageRuleRepository)
+    {
+        $this->messageRuleRepository = $messageRuleRepository;
+    }
+
+    /**
+     * 消息规则列表
+     */
+    public function index(Request $request)
+    {
+        $productList = $this->messageRuleRepository->lists($request->all());
+        $fractal = new Manager();
+        $resource = new Collection($productList, new MessageRuleListTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($productList));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra'] = [
+            'filters' => [
+                'title',
+                'message_type'
+            ],
+            'columns' => [
+                'id',
+                'title',
+                'message_type',
+                'cover',
+                'updated_at',
+                'sent_count',
+                'open_count',
+                'notice_groups',
+                'message_status'
+            ]
+        ];
+        return $data;
+    }
+
+    /**
+     * 创建消息规则
+     */
+    public function create(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'title' => 'required|string|max:20',
+            'notice_groups' => 'required|string|max:31',
+            'message_type' => ['required',Rule::in('star', 'system')],
+            'message_show_type' => ['required',Rule::in('only_show', 'user', 'post', 'activity', 'topic')],
+            'activity_url' => 'required_unless:message_show_type,only_show|string|max:64',
+            'cover' => 'required|url',
+            'send_time' => 'nullable|date',
+            'activity_time' => 'nullable|string|max:24',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->messageRuleRepository->create($request->all());
+    }
+
+    /**
+     * 编辑消息规则
+     */
+    public function update(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:message_rule',
+            'title' => 'required|string|max:20',
+            'notice_groups' => 'required|string|max:31',
+            'message_type' => ['required',Rule::in('star', 'system')],
+            'message_show_type' => ['required',Rule::in('only_show', 'user', 'post', 'activity', 'topic')],
+            'activity_url' => 'required_unless:message_show_type,only_show|string|max:64',
+            'cover' => 'required|url',
+            'send_time' => 'nullable|date',
+            'activity_time' => 'nullable|string|max:24',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->messageRuleRepository->update($request->all());
+    }
+
+    /**
+     * 消息规则详情
+     */
+    public function detail(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:message_rule'
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+
+        $post = $this->messageRuleRepository->detail($request->all());
+        return $this->response->item($post, new MessageRuleDetailTransformer());
+    }
+
+    /**
+     * 发送消息规则
+     */
+    public function send(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:message_rule'
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->messageRuleRepository->send($request->all());
+    }
+
+    /**
+     * 隐藏消息规则
+     */
+    public function hide(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:message_rule'
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->messageRuleRepository->hide($request->all());
+    }
+}

+ 17 - 0
app/Models/MessageRule.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/6/12
+ * Time: 9:11
+ */
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class MessageRule extends Model
+{
+    protected $table = 'message_rule';
+    protected $guarded = [];
+}

+ 28 - 28
app/Repositories/BannerRepository.php

@@ -44,12 +44,12 @@ class BannerRepository
     public function bannerSets($request)
     {
         if ($request['use_background'] == 0){
-          $banner = [
-              'status' => 0,
-              'tpl_id' => $request['tpl_id'],
-              'area_type' => $request['area_type'],
-              'rule' => json_encode($request['rule']),
-          ];
+            $banner = [
+                'status' => 0,
+                'tpl_id' => $request['tpl_id'],
+                'area_type' => $request['area_type'],
+                'rule' => json_encode($request['rule']),
+            ];
         }else{
             $banner = [
                 'name' => $request['name'],
@@ -59,21 +59,21 @@ class BannerRepository
                 'is_open' => $request['is_open'] ?? '',
             ];
         }
-            $banner['use_background'] = $request['use_background'];
-            $banner['created_at'] = date('Y-m-d H:i:s');
-            $banner['updated_at'] = date('Y-m-d H:i:s');
+        $banner['use_background'] = $request['use_background'];
+        $banner['created_at'] = date('Y-m-d H:i:s');
+        $banner['updated_at'] = date('Y-m-d H:i:s');
 
-            $res = $this->banner->create($banner);
+        $res = $this->banner->create($banner);
 
-            if (!$res) {
-                throw new HttpException(500, '添加失败,请重试');
-            }
-            if ($request['use_background'] == 0){
-                $request['type'] = 0;//0表示新增
-                $request['id'] = $res['id'];
-                $request['rule'] = $res['rule'];
-                $this->bannerIds($request);
-            }
+        if (!$res) {
+            throw new HttpException(500, '添加失败,请重试');
+        }
+        if ($request['use_background'] == 0){
+            $request['type'] = 0;//0表示新增
+            $request['id'] = $res['id'];
+            $request['rule'] = $res['rule'];
+            $this->bannerIds($request);
+        }
     }
 
     public function edit($request)
@@ -86,10 +86,10 @@ class BannerRepository
         if ($request['use_background'] == 0){
             $request['old_rule'] = $banner->rule;
 
-                $banner->tpl_id = $request['tpl_id'];
-                $banner->area_type = $request['area_type'];
-                $banner->rule = json_encode($rule);
-                $banner->status = 0;
+            $banner->tpl_id = $request['tpl_id'];
+            $banner->area_type = $request['area_type'];
+            $banner->rule = json_encode($rule);
+            $banner->status = 0;
 
             $banner_update = $banner->save();
             if (!$banner_update) {
@@ -101,11 +101,11 @@ class BannerRepository
             $this->bannerIds($request);
 
         }else{
-                $banner->name = $request['name'];
-                $banner->link_content_id = $request['link_content_id'];
-                $banner->image = $request['image'];
-                $banner->type = $request['type'];
-                $banner->is_open = $request['is_open'] ?? '';
+            $banner->name = $request['name'];
+            $banner->link_content_id = $request['link_content_id'];
+            $banner->image = $request['image'];
+            $banner->type = $request['type'];
+            $banner->is_open = $request['is_open'] ?? '';
 
             $banner_update = $banner->save();
             if (!$banner_update) {

+ 237 - 0
app/Repositories/MessageRuleRepository.php

@@ -0,0 +1,237 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/6/12
+ * Time: 9:13
+ */
+
+namespace App\Repositories;
+
+use App\Models\MessageRule;
+use Illuminate\Database\QueryException;
+use Dingo\Api\Http\Response;
+use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Redis;
+use Symfony\Component\HttpKernel\Exception\HttpException;
+use Tymon\JWTAuth\Facades\JWTAuth;
+
+class MessageRuleRepository
+{
+    public function __construct(MessageRule $messageRule)
+    {
+        $this->messageRule = $messageRule;
+    }
+
+    /**
+     * 内容列表
+     */
+    public function lists($request)
+    {
+        $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
+        $where = [];
+        if(isset($request['title'])){
+            $where[] = ['title', 'like', "%{$request['title']}%"];
+        }
+        if(isset($request['message_type'])){
+            $where[] = ['message_type', $request['message_type']];
+        }
+        return $this->messageRule
+            ->where($where)
+            ->orderBy('id','desc')
+            ->paginate($perPage);
+    }
+
+    /**
+     * 创建消息规则
+     */
+    public function create($request)
+    {
+        $noticeGroups = explode(',', $request['notice_groups']);
+
+        if(in_array(0, $noticeGroups)){
+            $noticeGroups = 0;
+        } else {
+            if(array_diff($noticeGroups, [1,2])){
+                return Response::create([
+                    'message'  => '通知群体参数有误',
+                    'status_code'   => 500
+                ]);
+            }
+            $noticeGroups = implode(',', array_unique($noticeGroups));
+        }
+
+
+        $data = [
+            'title' => $request['title'],
+            'notice_groups' => $noticeGroups,
+            'message_type' => $request['message_type'],
+            'message_show_type' => $request['message_show_type'],
+            'activity_url' => $request['activity_url']??'',
+            'cover' => $request['cover'],
+            'message_status' => 0,
+            'send_time' => isset($request['send_time']) && $request['send_time']? $request['send_time']:null,
+            'activity_time' => $request['activity_time']??'',
+            'sent_count' => 0,
+            'open_count' => 0
+        ];
+
+        DB::beginTransaction();
+        try{
+            $this->messageRule->create($data);
+
+            DB::commit();
+            return Response::create();
+
+        }catch (QueryException $exception){
+            DB::rollBack();
+            Log::debug('创建消息规则:'.$exception->getMessage());
+            return Response::create([
+                'message'  => '添加失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code'   => 500
+            ]);
+        }
+    }
+
+    /**
+     * 编辑消息规则
+     */
+    public function update($request)
+    {
+        $message = $this->messageRule->find($request['id']);
+        if(!$message || $message->message_status != 0){
+            return Response::create([
+                'message'  => '只能编辑未发送消息',
+                'status_code'   => 500
+            ]);
+        }
+        $noticeGroups = explode(',', $request['notice_groups']);
+
+        if(in_array(0, $noticeGroups)){
+            $noticeGroups = 0;
+        } else {
+            if(array_diff($noticeGroups, [1,2])){
+                return Response::create([
+                    'message'  => '通知群体参数有误',
+                    'status_code'   => 500
+                ]);
+            }
+            $noticeGroups = implode(',', array_unique($noticeGroups));
+        }
+
+        $message->title = $request['title'];
+        $message->notice_groups = $noticeGroups;
+        $message->message_type = $request['message_type'];
+        $message->message_show_type = $request['message_show_type'];
+        $message->cover = $request['cover'];
+
+        if($request['activity_url']){
+            $message->notice_groups = $request['activity_url'];
+        }
+        if(isset($request['send_time'])){
+            if($request['send_time']){
+                $message->send_time = $request['send_time'];
+            }else{
+                $message->send_time = null;
+            }
+
+        }
+        if($request['activity_time']){
+            $message->activity_time = $request['activity_time'];
+        }
+
+        DB::beginTransaction();
+        try{
+            $message->save();
+
+            DB::commit();
+            return Response::create();
+
+        }catch (QueryException $exception){
+            DB::rollBack();
+            Log::debug('编辑消息规则:'.$exception->getMessage());
+            return Response::create([
+                'message'  => '编辑失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code'   => 500
+            ]);
+        }
+    }
+
+    /**
+     * 消息规则详情
+     */
+    public function detail($request)
+    {
+        return $this->messageRule->find($request['id']);
+    }
+
+    /**
+     * 发送消息规则
+     */
+    public function send($request)
+    {
+        $message = $this->messageRule->find($request['id']);
+        if(!$message || $message->message_status != 0){
+            return Response::create([
+                'message'  => '只能发送未发送消息',
+                'status_code'   => 500
+            ]);
+        }
+
+        $message->send_time = Carbon::now()->toDateTimeString();
+
+        DB::beginTransaction();
+        try{
+            $message->save();
+
+            DB::commit();
+            return Response::create();
+
+        }catch (QueryException $exception){
+            DB::rollBack();
+            Log::debug('发送消息规则:'.$exception->getMessage());
+            return Response::create([
+                'message'  => '发送失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code'   => 500
+            ]);
+        }
+    }
+
+    /**
+     * 隐藏消息规则
+     */
+    public function hide($request)
+    {
+        $message = $this->messageRule->find($request['id']);
+        if(!$message || $message->message_status != 2){
+            return Response::create([
+                'message'  => '只能隐藏已发送消息',
+                'status_code'   => 500
+            ]);
+        }
+
+        $message->message_status = 3;
+
+        DB::beginTransaction();
+        try{
+            $message->save();
+
+            DB::commit();
+            return Response::create();
+
+        }catch (QueryException $exception){
+            DB::rollBack();
+            Log::debug('隐藏消息规则:'.$exception->getMessage());
+            return Response::create([
+                'message'  => '隐藏失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code'   => 500
+            ]);
+        }
+    }
+}

+ 33 - 0
app/Transformers/MessageRuleDetailTransformer.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/6/12
+ * Time: 15:05
+ */
+
+namespace App\Transformers;
+
+use App\Models\MessageRule;
+use Illuminate\Support\Carbon;
+use League\Fractal\TransformerAbstract;
+
+class MessageRuleDetailTransformer extends TransformerAbstract
+{
+    public function transform(MessageRule $messageRule)
+    {
+        return [
+            'id' => $messageRule['id'],
+            'title' => $messageRule['title'],
+            'message_type' => $messageRule['message_type'],
+            'cover' => $messageRule['cover'],
+            'send_time' => $messageRule['send_time'] ? Carbon::parse($messageRule['send_time'])->toDateTimeString():'',
+            'sent_count' => $messageRule['sent_count'],
+            'open_count' => $messageRule['open_count'],
+            'notice_groups' => $messageRule['notice_groups'],
+            'message_status' => $messageRule['message_status'],
+            'message_show_type' => $messageRule['message_show_type'],
+            'activity_time' => $messageRule['activity_time'],
+        ];
+    }
+}

+ 31 - 0
app/Transformers/MessageRuleListTransformer.php

@@ -0,0 +1,31 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/6/12
+ * Time: 9:15
+ */
+
+namespace App\Transformers;
+
+use App\Models\MessageRule;
+use Illuminate\Support\Carbon;
+use League\Fractal\TransformerAbstract;
+
+class MessageRuleListTransformer extends TransformerAbstract
+{
+    public function transform(MessageRule $messageRule)
+    {
+        return [
+            'id' => $messageRule['id'],
+            'title' => $messageRule['title'],
+            'message_type' => $messageRule['message_type'],
+            'cover' => $messageRule['cover'],
+            'updated_at' => Carbon::parse($messageRule['updated_at'])->toDateTimeString(),
+            'sent_count' => $messageRule['sent_count'],
+            'open_count' => $messageRule['open_count'],
+            'notice_groups' => $messageRule['notice_groups'],
+            'message_status' => $messageRule['message_status'],
+        ];
+    }
+}

+ 30 - 0
database/migrations/2019_06_12_024409_modify_status_to_table_message_rule.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ModifyStatusToTableMessageRule extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        DB::statement("ALTER TABLE message_rule CHANGE  COLUMN `status` `message_status` TINYINT (4) NOT NULL DEFAULT 0 COMMENT '消息状态:0:未发送,1发送中,2已发送未隐藏,3已发送并隐藏'");
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('table_message_rule', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 35 - 0
database/migrations/2019_06_12_055639_add_acitvity_time_to_table_message_rule.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddAcitvityTimeToTableMessageRule extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('message_rule', function (Blueprint $table) {
+            $table->string('activity_time', 32)
+                ->default('')
+                ->after('send_time')
+                ->comment('活动时间');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('message_rule', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 30 - 0
database/migrations/2019_06_12_072636_modify_show_type_to_table_message_rule.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ModifyShowTypeToTableMessageRule extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        DB::statement("ALTER TABLE message_rule CHANGE  COLUMN `show_type` `message_show_type` varchar(16) NOT NULL DEFAULT 'only_show' COMMENT '展示类型:only_show纯展示;user用户;post内容;activity活动;topic话题'");
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('table_message_rule', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 19 - 0
resources/lang/en/auth.php

@@ -0,0 +1,19 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Authentication Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used during authentication for various
+    | messages that we need to display to the user. You are free to modify
+    | these language lines according to your application's requirements.
+    |
+    */
+
+    'failed' => 'These credentials do not match our records.',
+    'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
+
+];

+ 19 - 0
resources/lang/en/pagination.php

@@ -0,0 +1,19 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Pagination Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used by the paginator library to build
+    | the simple pagination links. You are free to change them to anything
+    | you want to customize your views to better match your application.
+    |
+    */
+
+    'previous' => '&laquo; Previous',
+    'next' => 'Next &raquo;',
+
+];

+ 22 - 0
resources/lang/en/passwords.php

@@ -0,0 +1,22 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Password Reset Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are the default lines which match reasons
+    | that are given by the password broker for a password update attempt
+    | has failed, such as for an invalid token or invalid new password.
+    |
+    */
+
+    'password' => 'Passwords must be at least six characters and match the confirmation.',
+    'reset' => 'Your password has been reset!',
+    'sent' => 'We have e-mailed your password reset link!',
+    'token' => 'This password reset token is invalid.',
+    'user' => "We can't find a user with that e-mail address.",
+
+];

+ 146 - 0
resources/lang/en/validation.php

@@ -0,0 +1,146 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Validation Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines contain the default error messages used by
+    | the validator class. Some of these rules have multiple versions such
+    | as the size rules. Feel free to tweak each of these messages here.
+    |
+    */
+
+    'accepted'             => 'The :attribute must be accepted.',
+    'active_url'           => 'The :attribute is not a valid URL.',
+    'after'                => 'The :attribute must be a date after :date.',
+    'after_or_equal'       => 'The :attribute must be a date after or equal to :date.',
+    'alpha'                => 'The :attribute may only contain letters.',
+    'alpha_dash'           => 'The :attribute may only contain letters, numbers, dashes and underscores.',
+    'alpha_num'            => 'The :attribute may only contain letters and numbers.',
+    'array'                => 'The :attribute must be an array.',
+    'before'               => 'The :attribute must be a date before :date.',
+    'before_or_equal'      => 'The :attribute must be a date before or equal to :date.',
+    'between'              => [
+        'numeric' => 'The :attribute must be between :min and :max.',
+        'file'    => 'The :attribute must be between :min and :max kilobytes.',
+        'string'  => 'The :attribute must be between :min and :max characters.',
+        'array'   => 'The :attribute must have between :min and :max items.',
+    ],
+    'boolean'              => 'The :attribute field must be true or false.',
+    'confirmed'            => 'The :attribute confirmation does not match.',
+    'date'                 => 'The :attribute is not a valid date.',
+    'date_format'          => 'The :attribute does not match the format :format.',
+    'different'            => 'The :attribute and :other must be different.',
+    'digits'               => 'The :attribute must be :digits digits.',
+    'digits_between'       => 'The :attribute must be between :min and :max digits.',
+    'dimensions'           => 'The :attribute has invalid image dimensions.',
+    'distinct'             => 'The :attribute field has a duplicate value.',
+    'email'                => 'The :attribute must be a valid email address.',
+    'exists'               => 'The selected :attribute is invalid.',
+    'file'                 => 'The :attribute must be a file.',
+    'filled'               => 'The :attribute field must have a value.',
+    'gt'                   => [
+        'numeric' => 'The :attribute must be greater than :value.',
+        'file'    => 'The :attribute must be greater than :value kilobytes.',
+        'string'  => 'The :attribute must be greater than :value characters.',
+        'array'   => 'The :attribute must have more than :value items.',
+    ],
+    'gte'                  => [
+        'numeric' => 'The :attribute must be greater than or equal :value.',
+        'file'    => 'The :attribute must be greater than or equal :value kilobytes.',
+        'string'  => 'The :attribute must be greater than or equal :value characters.',
+        'array'   => 'The :attribute must have :value items or more.',
+    ],
+    'image'                => 'The :attribute must be an image.',
+    'in'                   => 'The selected :attribute is invalid.',
+    'in_array'             => 'The :attribute field does not exist in :other.',
+    'integer'              => 'The :attribute must be an integer.',
+    'ip'                   => 'The :attribute must be a valid IP address.',
+    'ipv4'                 => 'The :attribute must be a valid IPv4 address.',
+    'ipv6'                 => 'The :attribute must be a valid IPv6 address.',
+    'json'                 => 'The :attribute must be a valid JSON string.',
+    'lt'                   => [
+        'numeric' => 'The :attribute must be less than :value.',
+        'file'    => 'The :attribute must be less than :value kilobytes.',
+        'string'  => 'The :attribute must be less than :value characters.',
+        'array'   => 'The :attribute must have less than :value items.',
+    ],
+    'lte'                  => [
+        'numeric' => 'The :attribute must be less than or equal :value.',
+        'file'    => 'The :attribute must be less than or equal :value kilobytes.',
+        'string'  => 'The :attribute must be less than or equal :value characters.',
+        'array'   => 'The :attribute must not have more than :value items.',
+    ],
+    'max'                  => [
+        'numeric' => 'The :attribute may not be greater than :max.',
+        'file'    => 'The :attribute may not be greater than :max kilobytes.',
+        'string'  => 'The :attribute may not be greater than :max characters.',
+        'array'   => 'The :attribute may not have more than :max items.',
+    ],
+    'mimes'                => 'The :attribute must be a file of type: :values.',
+    'mimetypes'            => 'The :attribute must be a file of type: :values.',
+    'min'                  => [
+        'numeric' => 'The :attribute must be at least :min.',
+        'file'    => 'The :attribute must be at least :min kilobytes.',
+        'string'  => 'The :attribute must be at least :min characters.',
+        'array'   => 'The :attribute must have at least :min items.',
+    ],
+    'not_in'               => 'The selected :attribute is invalid.',
+    'not_regex'            => 'The :attribute format is invalid.',
+    'numeric'              => 'The :attribute must be a number.',
+    'present'              => 'The :attribute field must be present.',
+    'regex'                => 'The :attribute format is invalid.',
+    'required'             => 'The :attribute field is required.',
+    'required_if'          => 'The :attribute field is required when :other is :value.',
+    'required_unless'      => 'The :attribute field is required unless :other is in :values.',
+    'required_with'        => 'The :attribute field is required when :values is present.',
+    'required_with_all'    => 'The :attribute field is required when :values is present.',
+    'required_without'     => 'The :attribute field is required when :values is not present.',
+    'required_without_all' => 'The :attribute field is required when none of :values are present.',
+    'same'                 => 'The :attribute and :other must match.',
+    'size'                 => [
+        'numeric' => 'The :attribute must be :size.',
+        'file'    => 'The :attribute must be :size kilobytes.',
+        'string'  => 'The :attribute must be :size characters.',
+        'array'   => 'The :attribute must contain :size items.',
+    ],
+    'string'               => 'The :attribute must be a string.',
+    'timezone'             => 'The :attribute must be a valid zone.',
+    'unique'               => 'The :attribute has already been taken.',
+    'uploaded'             => 'The :attribute failed to upload.',
+    'url'                  => 'The :attribute format is invalid.',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Custom Validation Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | Here you may specify custom validation messages for attributes using the
+    | convention "attribute.rule" to name the lines. This makes it quick to
+    | specify a specific custom language line for a given attribute rule.
+    |
+    */
+
+    'custom' => [
+        'attribute-name' => [
+            'rule-name' => 'custom-message',
+        ],
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Custom Validation Attributes
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used to swap attribute place-holders
+    | with something more reader friendly such as E-Mail Address instead
+    | of "email". This simply helps us make messages a little cleaner.
+    |
+    */
+
+    'attributes' => [],
+
+];

+ 17 - 0
resources/lang/zh-CN/auth.php

@@ -0,0 +1,17 @@
+<?php
+
+return [
+    /*
+    |--------------------------------------------------------------------------
+    | Authentication Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used during authentication for various
+    | messages that we need to display to the user. You are free to modify
+    | these language lines according to your application's requirements.
+    |
+    */
+
+    'failed' => '用户名或密码错误。',
+    'throttle' => '您的尝试登录次数过多,请 :seconds 秒后再试。',
+];

+ 17 - 0
resources/lang/zh-CN/pagination.php

@@ -0,0 +1,17 @@
+<?php
+
+return [
+    /*
+    |--------------------------------------------------------------------------
+    | Pagination Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used by the paginator library to build
+    | the simple pagination links. You are free to change them to anything
+    | you want to customize your views to better match your application.
+    |
+    */
+
+    'previous' => '&laquo; 上一页',
+    'next' => '下一页 &raquo;',
+];

+ 20 - 0
resources/lang/zh-CN/passwords.php

@@ -0,0 +1,20 @@
+<?php
+
+return [
+    /*
+    |--------------------------------------------------------------------------
+    | Password Reminder Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are the default lines which match reasons
+    | that are given by the password broker for a password update attempt
+    | has failed, such as for an invalid token or invalid new password.
+    |
+    */
+
+    'password' => '密码至少是六位字符并且匹配。',
+    'reset' => '密码重置成功!',
+    'sent' => '密码重置邮件已发送!',
+    'token' => '密码重置令牌无效。',
+    'user' => '找不到该邮箱对应的用户。',
+];

+ 113 - 0
resources/lang/zh-CN/validation.php

@@ -0,0 +1,113 @@
+<?php
+
+return [
+    /*
+    |--------------------------------------------------------------------------
+    | Validation Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines contain the default error messages used by
+    | the validator class. Some of these rules have multiple versions such
+    | as the size rules. Feel free to tweak each of these messages.
+    |
+    */
+
+    'accepted' => ':attribute 必须接受。',
+    'active_url' => ':attribute 不是一个有效的网址。',
+    'after' => ':attribute 必须要晚于 :date。',
+    'after_or_equal' => ':attribute 必须要等于 :date 或更晚。',
+    'alpha' => ':attribute 只能由字母组成。',
+    'alpha_dash' => ':attribute 只能由字母、数字和斜杠组成。',
+    'alpha_num' => ':attribute 只能由字母和数字组成。',
+    'array' => ':attribute 必须是一个数组。',
+    'before' => ':attribute 必须要早于 :date。',
+    'before_or_equal' => ':attribute 必须要等于 :date 或更早。',
+    'between' => [
+        'numeric' => ':attribute 必须介于 :min - :max 之间。',
+        'file' => ':attribute 必须介于 :min - :max kb 之间。',
+        'string' => ':attribute 必须介于 :min - :max 个字符之间。',
+        'array' => ':attribute 必须只有 :min - :max 个单元。',
+    ],
+    'boolean' => ':attribute 必须为布尔值。',
+    'confirmed' => ':attribute 两次输入不一致。',
+    'date' => ':attribute 不是一个有效的日期。',
+    'date_format' => ':attribute 的格式必须为 :format。',
+    'different' => ':attribute 和 :other 必须不同。',
+    'digits' => ':attribute 必须是 :digits 位的数字。',
+    'digits_between' => ':attribute 必须是介于 :min 和 :max 位的数字。',
+    'dimensions' => ':attribute 图片尺寸不正确。',
+    'distinct' => ':attribute 已经存在。',
+    'email' => ':attribute 不是一个合法的邮箱。',
+    'exists' => ':attribute 不存在。',
+    'file' => ':attribute 必须是文件。',
+    'filled' => ':attribute 不能为空。',
+    'image' => ':attribute 必须是图片。',
+    'in' => '已选的属性 :attribute 非法。',
+    'in_array' => ':attribute 没有在 :other 中。',
+    'integer' => ':attribute 必须是整数。',
+    'ip' => ':attribute 必须是有效的 IP 地址。',
+    'ipv4' => ':attribute 必须是有效的 IPv4 地址。',
+    'ipv6' => ':attribute 必须是有效的 IPv6 地址。',
+    'json' => ':attribute 必须是正确的 JSON 格式。',
+    'max' => [
+        'numeric' => ':attribute 不能大于 :max。',
+        'file' => ':attribute 不能大于 :max kb。',
+        'string' => ':attribute 不能大于 :max 个字符。',
+        'array' => ':attribute 最多只有 :max 个单元。',
+    ],
+    'mimes' => ':attribute 必须是一个 :values 类型的文件。',
+    'mimetypes' => ':attribute 必须是一个 :values 类型的文件。',
+    'min' => [
+        'numeric' => ':attribute 必须大于等于 :min。',
+        'file' => ':attribute 大小不能小于 :min kb。',
+        'string' => ':attribute 至少为 :min 个字符。',
+        'array' => ':attribute 至少有 :min 个单元。',
+    ],
+    'not_in' => '已选的属性 :attribute 非法。',
+    'numeric' => ':attribute 必须是一个数字。',
+    'present' => ':attribute 必须存在。',
+    'regex' => ':attribute 格式不正确。',
+    'required' => ':attribute 不能为空。',
+    'required_if' => '当 :other 为 :value 时 :attribute 不能为空。',
+    'required_unless' => '当 :other 不为 :value 时 :attribute 不能为空。',
+    'required_with' => '当 :values 存在时 :attribute 不能为空。',
+    'required_with_all' => '当 :values 存在时 :attribute 不能为空。',
+    'required_without' => '当 :values 不存在时 :attribute 不能为空。',
+    'required_without_all' => '当 :values 都不存在时 :attribute 不能为空。',
+    'same' => ':attribute 和 :other 必须相同。',
+    'size' => [
+        'numeric' => ':attribute 大小必须为 :size。',
+        'file' => ':attribute 大小必须为 :size kb。',
+        'string' => ':attribute 必须是 :size 个字符。',
+        'array' => ':attribute 必须为 :size 个单元。',
+    ],
+    'string' => ':attribute 必须是一个字符串。',
+    'timezone' => ':attribute 必须是一个合法的时区值。',
+    'unique' => ':attribute 已经存在。',
+    'uploaded' => ':attribute 上传失败。',
+    'url' => ':attribute 格式不正确。',
+
+
+    /*
+    |--------------------------------------------------------------------------
+    | Custom Validation Attributes
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used to swap attribute place-holders
+    | with something more reader friendly such as E-Mail Address instead
+    | of 'email'. This simply helps us make messages a little cleaner.
+    |
+    */
+
+    'attributes' => [
+        'title' => '标题',
+        'notice_groups' => '通知群体',
+        'message_type' => '消息类型',
+        'message_show_type' => '展示类型',
+        'activity_url' => '活动链接',
+        'cover' => '封面图',
+        'send_time' => '发送时间',
+        'activity_time' => '活动时间',
+    ],
+
+];

+ 13 - 0
routes/api.php

@@ -56,6 +56,19 @@ $api->version('v1', [
         //新增城市
         $api->post('/cityManagement/create', 'ConfigCityManagementController@create');
 
+        //消息规则列表
+        $api->get('message', 'MessageRuleController@index');
+        //创建消息规则
+        $api->post('message', 'MessageRuleController@create');
+        //编辑消息规则
+        $api->put('message', 'MessageRuleController@update');
+        //消息规则详情
+        $api->get('message/detail', 'MessageRuleController@detail');
+        //发送消息规则
+        $api->put('message/send', 'MessageRuleController@send');
+        //隐藏消息规则
+        $api->put('message/hide', 'MessageRuleController@hide');
+
     });
     //配置文件
     $api->get('/config', 'ConfigController@index');