From 72118a360ffb64c04a7993590f042dd8dd222947 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Tue, 12 Mar 2024 13:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E8=BF=94=E5=88=A9=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/rebate/README.md | 1 + plugins/rebate/callbacks.php | 14 +++ plugins/rebate/lang/en/locale.js | 8 ++ plugins/rebate/lang/en/test.php | 5 + plugins/rebate/lang/zh-CN/locale.js | 6 + plugins/rebate/lang/zh-CN/test.php | 5 + plugins/rebate/package.json | 11 ++ plugins/rebate/src/PluginApplication.php | 80 ++++++++++++ plugins/rebate/src/admin/IndexController.php | 49 ++++++++ plugins/rebate/views/config.tpl | 0 plugins/rebate/views/index/index.blade.php | 120 ++++++++++++++++++ plugins/rebate/views/index/set.blade.php | 124 +++++++++++++++++++ 12 files changed, 423 insertions(+) create mode 100644 plugins/rebate/README.md create mode 100644 plugins/rebate/callbacks.php create mode 100644 plugins/rebate/lang/en/locale.js create mode 100644 plugins/rebate/lang/en/test.php create mode 100644 plugins/rebate/lang/zh-CN/locale.js create mode 100644 plugins/rebate/lang/zh-CN/test.php create mode 100644 plugins/rebate/package.json create mode 100644 plugins/rebate/src/PluginApplication.php create mode 100644 plugins/rebate/src/admin/IndexController.php create mode 100644 plugins/rebate/views/config.tpl create mode 100644 plugins/rebate/views/index/index.blade.php create mode 100644 plugins/rebate/views/index/set.blade.php diff --git a/plugins/rebate/README.md b/plugins/rebate/README.md new file mode 100644 index 00000000..27a7e8ed --- /dev/null +++ b/plugins/rebate/README.md @@ -0,0 +1 @@ +## 消费返利 diff --git a/plugins/rebate/callbacks.php b/plugins/rebate/callbacks.php new file mode 100644 index 00000000..6e5f447d --- /dev/null +++ b/plugins/rebate/callbacks.php @@ -0,0 +1,14 @@ + function ($plugins) { + \Artisan::call('migrate',['--path'=>'plugins/rebate/migrations','--force'=>true]); + }, + app\common\events\PluginWasDisabled::class => function ($plugin) { + + + }, + app\common\events\PluginWasDeleted::class => function () { + \Artisan::call('migrate:rollback',['--path'=>'plugins/rebate/migrations']); + } +]; diff --git a/plugins/rebate/lang/en/locale.js b/plugins/rebate/lang/en/locale.js new file mode 100644 index 00000000..6f5de3aa --- /dev/null +++ b/plugins/rebate/lang/en/locale.js @@ -0,0 +1,8 @@ + +"use strict"; + +$.extend($.locales['en'], { + 'welfare': { + test: "JavaScript i18n test: English" + } +}); diff --git a/plugins/rebate/lang/en/test.php b/plugins/rebate/lang/en/test.php new file mode 100644 index 00000000..8999558a --- /dev/null +++ b/plugins/rebate/lang/en/test.php @@ -0,0 +1,5 @@ +'this is test title' +]; \ No newline at end of file diff --git a/plugins/rebate/lang/zh-CN/locale.js b/plugins/rebate/lang/zh-CN/locale.js new file mode 100644 index 00000000..1be84a97 --- /dev/null +++ b/plugins/rebate/lang/zh-CN/locale.js @@ -0,0 +1,6 @@ + +$.extend($.locales['zh-CN'], { + 'welfare': { + test: "JavaScript i18n test: 简体中文" + } +}); diff --git a/plugins/rebate/lang/zh-CN/test.php b/plugins/rebate/lang/zh-CN/test.php new file mode 100644 index 00000000..14fbcffc --- /dev/null +++ b/plugins/rebate/lang/zh-CN/test.php @@ -0,0 +1,5 @@ +'测试标题' +]; \ No newline at end of file diff --git a/plugins/rebate/package.json b/plugins/rebate/package.json new file mode 100644 index 00000000..4d4d4f58 --- /dev/null +++ b/plugins/rebate/package.json @@ -0,0 +1,11 @@ +{ + "name": "rebate", + "terminal": "wechat|min|wap", + "version": "1.0.1", + "title": "消费返利", + "description": "消费返利", + "author": "wuhui", + "url": "", + "namespace": "Yunshop\\Rebate", + "config": "config.tpl" +} \ No newline at end of file diff --git a/plugins/rebate/src/PluginApplication.php b/plugins/rebate/src/PluginApplication.php new file mode 100644 index 00000000..dd2a74db --- /dev/null +++ b/plugins/rebate/src/PluginApplication.php @@ -0,0 +1,80 @@ +setPluginMenu('rebate', [ + 'name' => '消费返利', + 'type' => 'marketing', + 'url' => 'plugin.rebate.admin.index.index',// url 可以填写http 也可以直接写路由 + 'url_params' => '',//如果是url填写的是路由则启用参数否则不启用 + 'permit' => 1,//如果不设置则不会做权限检测 + 'menu' => 1,//如果不设置则不显示菜单,子菜单也将不显示 + 'icon' => '',//菜单图标 + 'list_icon' => 'rebate', + 'parents' => [], + 'top_show' => 0, + 'left_first_show' => 0, + 'left_second_show' => 1, + 'child' => [ + 'plugin_rebate_index' => [ + 'name' => '返利列表', + 'permit' => 1, + 'menu' => 1, + 'icon' => '', + 'url' => 'plugin.rebate.admin.index.index', + 'url_params' => '', + 'item' => 'plugin_rebate_index', + 'parents' => ['rebate'], + 'child' => [ + // 权限补充 + 'plugin_rebate_index_index' => [ + 'name' => '返利列表', + 'url' => 'plugin.rebate.admin.index.index', + 'url_params' => '', + 'permit' => 1, + 'menu' => 0, + 'icon' => '', + 'item' => 'plugin_rebate_index_index', + 'parents' => ['rebate','plugin_rebate_index'] + ], + ] + ], + 'plugin_rebate_set' => [ + 'name' => '基本设置', + 'permit' => 1, + 'menu' => 1, + 'icon' => '', + 'url' => 'plugin.rebate.admin.index.set', + 'url_params' => '', + 'parents' => ['rebate'], + 'child' => [ + // 权限补充 + 'plugin_rebate_index_set' => [ + 'name' => '基本设置', + 'url' => 'plugin.rebate.admin.index.set', + 'url_params' => '', + 'permit' => 1, + 'menu' => 0, + 'icon' => '', + 'item' => 'plugin_rebate_index_set', + 'parents' => ['rebate', 'plugin_rebate_set'], + ], + ] + ], + ] + ]); + } + + + public function boot(){ + $events = app('events'); + + + } + + + +} \ No newline at end of file diff --git a/plugins/rebate/src/admin/IndexController.php b/plugins/rebate/src/admin/IndexController.php new file mode 100644 index 00000000..3fd3ecf3 --- /dev/null +++ b/plugins/rebate/src/admin/IndexController.php @@ -0,0 +1,49 @@ +input('page_size',10); + $search = request()->input('search'); + // 获取列表信息 + // $field = ['id','member_id','unique_number','created_at']; + // $result = CollectionRoomModel::getList($pageSize,$search,$field); + // $data = [ + // 'list' => $result['data'], + // 'pager' => PaginationHelper::show($result['total'],$result['current_page'],$result['per_page']), + // 'search' => $search + // ]; + + + return view('Yunshop\Rebate::index.index',$data)->render(); + } + + // 基本设置 + public function set(){ + // 获取设置信息 判断是否为设置 + $setInfo = request()->input('rebate'); + if ($setInfo) { + // 设置信息 + if (Setting::set('plugin.rebate', $setInfo)) return $this->successJson('编辑成功'); + else return $this->errorJson('设置失败'); + }else{ + // 获取信息 + $set = Setting::get('plugin.rebate'); + + return view('Yunshop\Rebate::index.set',[ + 'set' => $set, + ])->render(); + } + } + + + +} diff --git a/plugins/rebate/views/config.tpl b/plugins/rebate/views/config.tpl new file mode 100644 index 00000000..e69de29b diff --git a/plugins/rebate/views/index/index.blade.php b/plugins/rebate/views/index/index.blade.php new file mode 100644 index 00000000..8e47de19 --- /dev/null +++ b/plugins/rebate/views/index/index.blade.php @@ -0,0 +1,120 @@ + +@extends('layouts.base') + +@section('content') +
| ID | +用户信息 | +唯一编号 | +获得时间 | +操作 | +
|---|---|---|---|---|
| {{ $item['id'] }} | +
+
+
+
+
+
+ |
+ {{ $item['unique_number'] }} | +{{ $item['created_at'] }} | ++ + | +