Explorar el Código

从线上拉下来

lizhen_gitee hace 1 mes
commit
90ab21e13e
Se han modificado 100 ficheros con 6033 adiciones y 0 borrados
  1. BIN
      .DS_Store
  2. 15 0
      .editorconfig
  3. 5 0
      .gitattributes
  4. 40 0
      .gitignore
  5. 1 0
      .htaccess
  6. 13 0
      .styleci.yml
  7. 59 0
      README.md
  8. BIN
      app/.DS_Store
  9. 33 0
      app/Admin/Actions/AdminSetting.php
  10. 21 0
      app/Admin/Actions/Extensions/CaptchaButton.php
  11. 21 0
      app/Admin/Actions/Extensions/CollecterConfigButton.php
  12. 21 0
      app/Admin/Actions/Extensions/ImportCollectJsonButton.php
  13. 21 0
      app/Admin/Actions/Extensions/ImportRobotUserButton.php
  14. 17 0
      app/Admin/Actions/Extensions/Mp/CustomMenuButton.php
  15. 21 0
      app/Admin/Actions/Extensions/Mp/FreePublishFormButton.php
  16. 21 0
      app/Admin/Actions/Extensions/Mp/FreePublishNoticeButton.php
  17. 17 0
      app/Admin/Actions/Extensions/Mp/MpMaterialButton.php
  18. 17 0
      app/Admin/Actions/Extensions/Mp/MpMessageButton.php
  19. 17 0
      app/Admin/Actions/Extensions/Mp/MpMessageReplyButton.php
  20. 24 0
      app/Admin/Actions/Extensions/NavigaterUrlButton.php
  21. 17 0
      app/Admin/Actions/Extensions/Posts/CommentManualButton.php
  22. 17 0
      app/Admin/Actions/Extensions/Shop/ShopContactButton.php
  23. 16 0
      app/Admin/Actions/Extensions/ShopClassifyConfigButton.php
  24. 21 0
      app/Admin/Actions/Extensions/Tenant/MainSiteMetaButton.php
  25. 21 0
      app/Admin/Actions/Extensions/Tenant/PayModelCodeButton1.php
  26. 21 0
      app/Admin/Actions/Extensions/Tenant/PayModelCodeButton2.php
  27. 21 0
      app/Admin/Actions/Extensions/Tenant/PayModelCodeButton3.php
  28. 21 0
      app/Admin/Actions/Extensions/Tenant/PayModelCodeButton4.php
  29. 21 0
      app/Admin/Actions/Extensions/Tenant/TenantMetaButton.php
  30. 21 0
      app/Admin/Actions/Extensions/Tenant/TenantUrlReplaceButton.php
  31. 17 0
      app/Admin/Actions/Extensions/UniversityButton.php
  32. 21 0
      app/Admin/Actions/Extensions/User/UserInviteTmpCodeBatchButton.php
  33. 24 0
      app/Admin/Actions/Extensions/User/UserInviteTmpCodeBgButton.php
  34. 23 0
      app/Admin/Actions/Extensions/User/UserStudentCertifyButton.php
  35. 21 0
      app/Admin/Actions/Extensions/UserNoticeButton.php
  36. 21 0
      app/Admin/Actions/Extensions/userWithdrawalButton.php
  37. 76 0
      app/Admin/Actions/Grid/AuthenticationAction.php
  38. 68 0
      app/Admin/Actions/Grid/BatchCollecterProcessAction.php
  39. 76 0
      app/Admin/Actions/Grid/BatchCollecterpublishAction.php
  40. 95 0
      app/Admin/Actions/Grid/BatchCommentAction.php
  41. 77 0
      app/Admin/Actions/Grid/CircleAction.php
  42. 77 0
      app/Admin/Actions/Grid/CommentAction.php
  43. 42 0
      app/Admin/Actions/Grid/ExtensionUninstall.php
  44. 46 0
      app/Admin/Actions/Grid/GoodsTransferAction.php
  45. 112 0
      app/Admin/Actions/Grid/Mp/FreePublishMaterialAction.php
  46. 158 0
      app/Admin/Actions/Grid/Mp/FreePublishSubmitAction.php
  47. 78 0
      app/Admin/Actions/Grid/OrderAction.php
  48. 84 0
      app/Admin/Actions/Grid/OrderGoodsAction.php
  49. 111 0
      app/Admin/Actions/Grid/OrderSupplyAction.php
  50. 88 0
      app/Admin/Actions/Grid/PetsAdoptionPassAction.php
  51. 89 0
      app/Admin/Actions/Grid/PetsCommentsPassAction.php
  52. 78 0
      app/Admin/Actions/Grid/PostCommentLotteryAction.php
  53. 73 0
      app/Admin/Actions/Grid/PostDeleteAction.php
  54. 77 0
      app/Admin/Actions/Grid/PostMetaAction.php
  55. 89 0
      app/Admin/Actions/Grid/PostPassAction.php
  56. 61 0
      app/Admin/Actions/Grid/PostPushAction.php
  57. 62 0
      app/Admin/Actions/Grid/PostShelvesAction.php
  58. 62 0
      app/Admin/Actions/Grid/PostTopAction.php
  59. 62 0
      app/Admin/Actions/Grid/PostUnTopAction.php
  60. 77 0
      app/Admin/Actions/Grid/Posts/CommentApplyAction.php
  61. 77 0
      app/Admin/Actions/Grid/PostsAction.php
  62. 40 0
      app/Admin/Actions/Grid/ReplyTap.php
  63. 76 0
      app/Admin/Actions/Grid/Shop/ShopExamineAction.php
  64. 76 0
      app/Admin/Actions/Grid/Shop/ShopGuaranteeAction.php
  65. 88 0
      app/Admin/Actions/Grid/ShopOrderSupplyAction.php
  66. 67 0
      app/Admin/Actions/Grid/System/UniversityCanCertifyAction.php
  67. 67 0
      app/Admin/Actions/Grid/System/UniversityCancelCertifyAction.php
  68. 60 0
      app/Admin/Actions/Grid/Tap.php
  69. 76 0
      app/Admin/Actions/Grid/Tenant/TenantShareAction.php
  70. 91 0
      app/Admin/Actions/Grid/UsedCommentsPassAction.php
  71. 90 0
      app/Admin/Actions/Grid/UsedGoodsPassAction.php
  72. 77 0
      app/Admin/Actions/Grid/User/UserBanAndMuteAction.php
  73. 76 0
      app/Admin/Actions/Grid/User/UserChatReplyAction.php
  74. 77 0
      app/Admin/Actions/Grid/User/UserCoinAction.php
  75. 77 0
      app/Admin/Actions/Grid/User/UserFinancialAction.php
  76. 69 0
      app/Admin/Actions/Grid/User/UserGenderManAction.php
  77. 69 0
      app/Admin/Actions/Grid/User/UserGenderWomanAction.php
  78. 80 0
      app/Admin/Actions/Grid/User/UserInviteTmpCodeBgDownBatchAction.php
  79. 75 0
      app/Admin/Actions/Grid/User/UserInviteTmpCodeDownBatchAction.php
  80. 77 0
      app/Admin/Actions/Grid/User/UserJewelryAction.php
  81. 77 0
      app/Admin/Actions/Grid/User/UserMemberAction.php
  82. 77 0
      app/Admin/Actions/Grid/User/UserPaycodeUpdateAction.php
  83. 77 0
      app/Admin/Actions/Grid/User/UserRealNameAction.php
  84. 76 0
      app/Admin/Actions/Grid/User/UserShareAction.php
  85. 77 0
      app/Admin/Actions/Grid/User/UserStudentCertifyNoticeAction.php
  86. 76 0
      app/Admin/Actions/Grid/User/UserTempAction.php
  87. 77 0
      app/Admin/Actions/Grid/User/UserWithdrawalProcessAction.php
  88. 77 0
      app/Admin/Actions/Grid/Voter/RefusePlayerNoticeAction.php
  89. 77 0
      app/Admin/Actions/Grid/Voter/SimulateVoteAction.php
  90. 77 0
      app/Admin/Actions/Grid/Voter/VoterNoticeAction.php
  91. 164 0
      app/Admin/Actions/Tree/SyncToWeWeiXinMp.php
  92. 157 0
      app/Admin/Controllers/Admin/AdminToolsController.php
  93. 83 0
      app/Admin/Controllers/AdminMenuSearchController.php
  94. 10 0
      app/Admin/Controllers/AuthController.php
  95. 243 0
      app/Admin/Controllers/Circle/WxCircleController.php
  96. 99 0
      app/Admin/Controllers/Circle/WxCircleTagController.php
  97. 17 0
      app/Admin/Controllers/Collecter/CollecterController.php
  98. 222 0
      app/Admin/Controllers/Collecter/MiniCollecterCollectedController.php
  99. 75 0
      app/Admin/Controllers/Collecter/MiniCollecterUserMapController.php
  100. 84 0
      app/Admin/Controllers/FileController.php

BIN
.DS_Store


+ 15 - 0
.editorconfig

@@ -0,0 +1,15 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.{yml,yaml}]
+indent_size = 2

+ 5 - 0
.gitattributes

@@ -0,0 +1,5 @@
+* text=auto
+*.css linguist-vendored
+*.scss linguist-vendored
+*.js linguist-vendored
+CHANGELOG.md export-ignore

+ 40 - 0
.gitignore

@@ -0,0 +1,40 @@
+/node_modules
+/public/hot
+/storage/*.key
+.env.backup
+.phpunit.result.cache
+docker-compose.override.yml
+Homestead.json
+Homestead.yaml
+npm-debug.log
+yarn-error.logc
+
+
+
+/public/build
+/public/storage
+/public/robots.txt
+/public/nginx.htaccess
+/public/uploads
+
+
+.env
+
+.env.production
+
+.user.ini
+robots.txt
+
+auth.json
+
+/.fleet
+/.idea
+/.vscode
+.well-known
+.svn
+1ca
+composer.lock
+*.sql
+*.zip
+*.tar.gz
+*.rar

+ 1 - 0
.htaccess

@@ -0,0 +1 @@
+ 

+ 13 - 0
.styleci.yml

@@ -0,0 +1,13 @@
+php:
+  preset: laravel
+  disabled:
+    - no_unused_imports
+  finder:
+    not-name:
+      - index.php
+      - server.php
+js:
+  finder:
+    not-name:
+      - webpack.mix.js
+css: true

+ 59 - 0
README.md

@@ -0,0 +1,59 @@
+<p align="center"><a href="" target="_blank"><img  src="https://img.mini.minisns.cn/images/logo/minilogo.svg" width="200"></a></p>
+
+## 关于MiniSNS
+#### MiniSNS 专注于社区带货
+
+![](https://img.mini.minisns.cn/images/hbx/h/update_tip.jpg)   
+**关于作者**:本人工作岗位是NLP工程师,俗称炼丹侠的ai工程师一种,所以我擅长的是逻辑,算法,后端,并不擅长前端的UI美化,这里真诚的邀请前端大佬和我一起打磨这个产品。我一直想做一个可以永远运营下去的App,无关赚钱,只是读书时候的理想。   
+目前市面上真正完善运营级的社交程序不多,很难满足自己的要求,那我们就创造一个吧。   
+**关于代理**:有两种方式,具体请看[https://doc.minisns.cn/doc/99/](https://doc.minisns.cn/doc/99/ "https://doc.minisns.cn/doc/99/")
+
+
+### 一、演示
+
+1、安卓APP端:  [https://down.minisns.cn/app.apk](https://down.minisns.cn/app.apk "https://down.minisns.cn/app.apk")   
+2、IOS appstore搜索“宠也”   
+3、小程序端:微信小程序搜索:宠也网  
+4、pc端:[https://www.minisns.cn](https://www.minisns.cn "https://www.minisns.cn")   
+![](https://img.mini.minisns.cn/images/hbx/h/minipro.jpg)  
+5、后台:[https://test.minisns.cn/admin](https://test.minisns.cn/admin "https://test.minisns.cn/admin")  
+账号:admin  
+密码:minisns666
+### 二、费用
+
+| 类型 | 高级源码授权 | 源码授权 | 普通授权 |
+| --- | --- | --- | --- |
+| 费用 | 6w/永久 | 1.5w/永久 | 900/永久/单域名 |
+| 方式 | 提供后端源码,即使你二开了,也包更新新功能 | 提供后端源码,不包更新 | 提供后端加密编译后源码,消耗性能低,甚至响应更快 |
+| 功能 | 完全相同 | 完全相同 | 完全相同 |
+| 前端 | 完全开源 | 完全开源 | 完全开源 |
+
+### 三、截图
+
+| 界面 | 界面 |
+| --- | --- |
+| ![](https://img.mini.minisns.cn/hbx/h/0.jpg) | ![](https://img.mini.minisns.cn/hbx/h/1.jpg) |
+| ![](https://img.mini.minisns.cn/hbx/h/2.jpg) | ![](https://img.mini.minisns.cn/hbx/h/3.jpg) |
+| ![](https://img.mini.minisns.cn/hbx/h/4.jpg) | ![](https://img.mini.minisns.cn/hbx/h/5.jpg) |
+
+
+### 四、开始
+1、整个项目分为前端和后端,后端地址:[https://gitee.com/wen-open/mini_back](https://gitee.com/wen-open/mini_back "https://gitee.com/wen-open/mini_back")  
+2、前端文档:[https://doc.minisns.cn/project-2/](https://doc.minisns.cn/project-2/ "https://doc.minisns.cn/project-2/")  
+后端文档:[https://doc.minisns.cn/project-1/](https://doc.minisns.cn/project-1/ "https://doc.minisns.cn/project-1/")  
+3、本项目前端是基于“轻航”的微信小程序源码重写为uniapp代码二开而来,轻航官网:[https://qinghang.supengjun.com/index.html](https://qinghang.supengjun.com/index.html "https://qinghang.supengjun.com/index.html")   
+4、进项目交流群请加我微信:ShaoWenSir  
+![](https://img.mini.minisns.cn/images/mmqrcode1677495496626%281%29.png)
+
+### 五、开源致谢(排名不分先后)
+laravel   
+uniapp   
+elastic search   
+dcat_admin   
+linui   
+gateway work (workerman)   
+mp_html   
+轻航小程序   
+scss   
+laravel-admin   
+...

BIN
app/.DS_Store


+ 33 - 0
app/Admin/Actions/AdminSetting.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Admin\Actions;
+
+use App\Admin\Forms\AdminSetting as AdminSettingForm;
+use Dcat\Admin\Actions\Action;
+use Dcat\Admin\Widgets\Modal;
+
+class AdminSetting extends Action
+{
+    /**
+     * @return string
+     */
+	protected $title = '<i class="feather icon-edit" style="font-size: 1.5rem"></i> 网站设置';
+
+    public function render()
+    {
+        $modal = Modal::make()
+            ->id('admin-setting-config') // 导航栏显示弹窗,必须固定ID,随机ID会在刷新后失败
+            ->title($this->title())
+            ->body(AdminSettingForm::make())
+            ->lg()
+            ->button(
+                <<<HTML
+<ul class="nav navbar-nav">
+     <li class="nav-item"> &nbsp;{$this->title()} &nbsp;</li>
+</ul>
+HTML
+            );
+
+        return $modal->render();
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/CaptchaButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use App\Admin\Forms\CaptchaForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class CaptchaButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '验证策略')
+            ->body(CaptchaForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa  fa-gears\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/CollecterConfigButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use App\Admin\Forms\Collecter\CollecterConfigForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class CollecterConfigButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '收集配置')
+            ->body(CollecterConfigForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-fw fa-bed\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/ImportCollectJsonButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use App\Admin\Forms\Collecter\ImportCollectJsonForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class ImportCollectJsonButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '导入文件')
+            ->body(ImportCollectJsonForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-fw fa-paw\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/ImportRobotUserButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use App\Admin\Forms\ImportRobotUserForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class ImportRobotUserButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '导入机器人')
+            ->body(ImportRobotUserForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-fw fa-paw\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/Mp/CustomMenuButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Mp;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class CustomMenuButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('mp_custom_menu').'" target="_blank"><i class="fa fa-map-signs"></i><span class="d-none d-sm-inline">&nbsp; 自定义菜单</span></a>
+</button>';
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Mp/FreePublishFormButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Mp;
+
+use App\Admin\Forms\Mp\FreePublishForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class FreePublishFormButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '推送默认值')
+            ->body(FreePublishForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-gears\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Mp/FreePublishNoticeButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Mp;
+
+use App\Admin\Forms\Mp\FreePublishNoticeForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class FreePublishNoticeButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '推送策略')
+            ->body(FreePublishNoticeForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-gears\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/Mp/MpMaterialButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Mp;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class MpMaterialButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('mp_material').'" target="_blank"><i class="fa fa-picture-o"></i><span class="d-none d-sm-inline">&nbsp; 素材库</span></a>
+</button>';
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/Mp/MpMessageButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Mp;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class MpMessageButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('mp_message').'" target="_blank"><i class="fa fa-newspaper-o"></i><span class="d-none d-sm-inline">&nbsp; 消息库</span></a>
+</button>';
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/Mp/MpMessageReplyButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Mp;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class MpMessageReplyButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('mp_message_reply').'" target="_blank"><i class="fa fa-puzzle-piece"></i><span class="d-none d-sm-inline">&nbsp; 自动回复</span></a>
+</button>';
+    }
+}

+ 24 - 0
app/Admin/Actions/Extensions/NavigaterUrlButton.php

@@ -0,0 +1,24 @@
+<?php
+namespace App\Admin\Actions\Extensions;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class NavigaterUrlButton extends AbstractTool{
+    protected $style = 'btn btn-primary';
+
+    protected $route = '';
+    protected $icon = '';
+    protected $name = '';
+
+    public function __construct($route, $icon, $name) {
+        parent::__construct();
+        $this->name = $name;
+        $this->icon = $icon;
+        $this->route = $route;
+    }
+
+    public function html()
+    {
+        return "<a href='".admin_url($this->route)."' target='_blank'><button class='btn btn-primary'><i class=\"".$this->icon."\"></i>&nbsp;".$this->name."</button></a>";
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/Posts/CommentManualButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Posts;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class CommentManualButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('posts/comment/manual').'" target="_blank"><i class="fa fa-edit"></i><span class="d-none d-sm-inline">&nbsp; 人工模拟评论</span></a>
+</button>';
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/Shop/ShopContactButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Shop;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class ShopContactButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('shop/contact').'" target="_blank"><i class="fa fa-flag"></i><span class="d-none d-sm-inline">&nbsp; 店铺经营地址</span></a>
+</button>';
+    }
+}

+ 16 - 0
app/Admin/Actions/Extensions/ShopClassifyConfigButton.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class ShopClassifyConfigButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return "<a href='".admin_url('shop/classifys')."' target='_blank'><button class='btn btn-primary'><i class=\"fa fa-reorder\"></i> &nbsp;三层结构配置</button></a> &nbsp;";
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/MainSiteMetaButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\MainSiteMetaForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class MainSiteMetaButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '主站配置')
+            ->body(MainSiteMetaForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-codiepie\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/PayModelCodeButton1.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\PayModelCodeForm1;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class PayModelCodeButton1 extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '模块1-10')
+            ->body(PayModelCodeForm1::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-opencart\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/PayModelCodeButton2.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\PayModelCodeForm2;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class PayModelCodeButton2 extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '模块11-20')
+            ->body(PayModelCodeForm2::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-opencart\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/PayModelCodeButton3.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\PayModelCodeForm3;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class PayModelCodeButton3 extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '模块21-30')
+            ->body(PayModelCodeForm3::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-opencart\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/PayModelCodeButton4.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\PayModelCodeForm4;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class PayModelCodeButton4 extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '模块31-40')
+            ->body(PayModelCodeForm4::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-opencart\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/TenantMetaButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\TenantMetaForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class TenantMetaButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '分站配置')
+            ->body(TenantMetaForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-clone\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/Tenant/TenantUrlReplaceButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\Tenant;
+
+use App\Admin\Forms\Tenant\TenantUrlReplaceForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class TenantUrlReplaceButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '链接替换')
+            ->body(TenantUrlReplaceForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-clone\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 17 - 0
app/Admin/Actions/Extensions/UniversityButton.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use Dcat\Admin\Grid\Tools\AbstractTool;
+
+class UniversityButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('universities').'" target="_blank"><i class="fa fa-university"></i><span class="d-none d-sm-inline">&nbsp; 2023高等学校库</span></a>
+</button>';
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/User/UserInviteTmpCodeBatchButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\User;
+
+use App\Admin\Forms\User\UserInviteTepCodeBatchForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class UserInviteTmpCodeBatchButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '批量生成并下载')
+            ->body(UserInviteTepCodeBatchForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-copy\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 24 - 0
app/Admin/Actions/Extensions/User/UserInviteTmpCodeBgButton.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\User;
+
+use App\Admin\Forms\User\UserInviteTepCodeBgForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class UserInviteTmpCodeBgButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return '<button class="btn btn-primary grid-refresh btn-mini btn-outline" style="margin-right:3px">
+    <a href="'.admin_url('invite_benefit/itc_bg_config').'" target="_blank"><i class="fa fa-file-image-o"></i><span class="d-none d-sm-inline">&nbsp; 背景图设置</span></a>
+</button>';
+        return Modal::make()
+            ->lg()
+            ->title($title = '背景图设置')
+            ->body(UserInviteTepCodeBgForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa  fa-file-image-o\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 23 - 0
app/Admin/Actions/Extensions/User/UserStudentCertifyButton.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Admin\Actions\Extensions\User;
+
+use App\Admin\Forms\User\UserStudentCertifyForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class UserStudentCertifyButton extends AbstractTool
+{
+
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '审核配置')
+            ->body(UserStudentCertifyForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-gear\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+
+}

+ 21 - 0
app/Admin/Actions/Extensions/UserNoticeButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use App\Admin\Forms\User\UserNoticeForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class UserNoticeButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '发送通知')
+            ->body(UserNoticeForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-commenting\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 21 - 0
app/Admin/Actions/Extensions/userWithdrawalButton.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\Extensions;
+
+use App\Admin\Forms\User\userWithdrawalForm;
+use Dcat\Admin\Grid\Tools\AbstractTool;
+use Dcat\Admin\Widgets\Modal;
+
+class userWithdrawalButton extends AbstractTool
+{
+    protected $style = 'btn btn-primary';
+
+    public function html()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($title = '提现配置')
+            ->body(userWithdrawalForm::make())
+            ->button("<button class='btn btn-primary'><i class=\"fa fa-jpy\"></i> &nbsp;{$title}</button> &nbsp;");
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/AuthenticationAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Admin\Forms\AuthenticationForms;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Http\Request;
+
+class AuthenticationAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核';
+
+
+    public function render()
+    {
+
+        $form = AuthenticationForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 68 - 0
app/Admin/Actions/Grid/BatchCollecterProcessAction.php

@@ -0,0 +1,68 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Jobs\CollecterMediaProcessJob;
+use App\Wen\Utils\CollecterUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class BatchCollecterProcessAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '重新尝试处理';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+                CollecterMediaProcessJob::dispatch($id);
+            });
+        }
+
+        return $this->response()
+            ->success('已提交给处理程序: '.json_encode($this->getKey()))->refresh();
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        return ['确认重新处理?若重新处理还是一直处于处理中,说明有图片下载不下来,只能把该篇删掉'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/BatchCollecterpublishAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Wen\Utils\CollecterUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class BatchCollecterpublishAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '发布';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+                DB::beginTransaction();
+                try {
+                    // todo:
+                    CollecterUtils::publish($id);
+                    DB::commit();
+                } catch (\Exception $e) {
+                    DB::rollBack();
+                    return $this->response()
+                        ->error($e->getMessage())->refresh();
+                }
+            });
+        }
+
+        return $this->response()
+            ->success('已提交给发布程序: '.json_encode($this->getKey()))->refresh();
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        return ['确认发布?'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 95 - 0
app/Admin/Actions/Grid/BatchCommentAction.php

@@ -0,0 +1,95 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Wen\Utils\UserUtils;
+use App\Wen\Utils\Utils;
+use App\Http\Controllers\Api\Repositories\WxCommentRepositores;
+use App\Models\Posts\WxComment;
+use App\Models\Posts\WxPost;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class BatchCommentAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核通过';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+                $comment = WxComment::where([['id', '=', $id], ['comment_state', '!=', 1]])->first();
+
+                if($comment){
+                    $uid = $comment->user_id;
+                    $posts_id = $comment->posts_id;
+                    $msg = UserUtils::reward_user_coin($uid, 'comment');
+                    if($msg){
+                        UserUtils::add_user_notice(3001, $uid,'评论审核通知','您发表的评论(id:<a href="/pages/sticky/sticky?id='.$posts_id.'">'.$id.'</a>)已经审核通过,并获得评论奖励:'.$msg,100);
+                    }else {
+                        UserUtils::add_user_notice(3001, $uid, '评论审核通知', '您发表的评论(id:<a href="/pages/sticky/sticky?id=' . $posts_id . '">' . $id . '</a>)已经审核通过', 100);
+                    }
+                    WxComment::where('id',$id)->update(['comment_state'=>1]);
+
+                    $comment_count = WxCommentRepositores::commentCount($comment->posts_id) ?: 0;//评论数量
+                    $weight = WxPost::where('id', $comment->posts_id)->value('weight');
+                    $weight += ( Utils::getDecayCoefficient($comment_count, 5) * 1000);
+                    if($weight > time()){
+                        $weight = time();
+                    }
+                    WxPost::withoutSyncingToSearch(function () use ($comment,$weight){
+                        WxPost::where('id', $comment->posts_id)->update(['last_reply_at' => $comment->created_at, 'weight'=>timetostr($weight)]);
+                    });
+
+                }
+
+            });
+        }
+
+        return $this->response()
+            ->success('Processed successfully: '.json_encode($this->getKey()))->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+        return ['确认审核通过?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/CircleAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Admin\Forms\CircleForms;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class CircleAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核';
+
+
+    public function render()
+    {
+
+        $form = CircleForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/CommentAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Admin\Forms\CommentForms;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class CommentAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核评论';
+
+
+    public function render()
+    {
+
+        $form = CommentForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 42 - 0
app/Admin/Actions/Grid/ExtensionUninstall.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use Dcat\Admin\Admin;
+use Dcat\Admin\Grid\RowAction;
+
+class ExtensionUninstall extends RowAction
+{
+
+    public function title()
+    {
+        $label = trans('admin.uninstall');
+
+        return "<span class='text-danger'>{$label}</span>";
+    }
+
+    public function confirm()
+    {
+        return [trans('admin.confirm_uninstall'), $this->getKey()];
+    }
+
+    public function handle()
+    {
+        // 删除数据
+        $manager = Admin::extension()
+            ->updateManager()
+            ->rollback($this->getKey());
+
+
+        // 删除菜单
+        Admin::extension()->get($this->getKey())->uninstall();
+
+        // 删除代码
+        __system__del__dir(admin_extension_path('/'.Admin::extension()->get($this->getKey())->getPackageName()));
+
+        return $this
+            ->response()
+            ->success(implode('<br>', ($manager ? $manager->notes : ['卸载成功', $this->getKey()]) ))
+            ->refresh();
+    }
+}

+ 46 - 0
app/Admin/Actions/Grid/GoodsTransferAction.php

@@ -0,0 +1,46 @@
+<?php
+namespace App\Admin\Actions\Grid;
+
+use Dcat\Admin\Grid\BatchAction;
+use App\Admin\Forms\ShopGoodsTransferForm;
+use Dcat\Admin\Widgets\Modal;
+
+class GoodsTransferAction extends BatchAction{
+    /**
+     * @return string
+     */
+    protected $title = '批量转移分类';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+
+    public function render()
+    {
+        // 实例化表单类并传递自定义参数
+        $form = ShopGoodsTransferForm::make();
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            ->onLoad($this->getModalScript())
+            ->button($this->title);
+    }
+
+
+    protected function getModalScript()
+    {
+        // 弹窗显示后往隐藏的id表单中写入批量选中的行ID
+        return <<<JS
+// 获取选中的ID数组
+var key = {$this->getSelectedKeysScript()}
+//batchsp-id 与 之前弹窗隐藏的绑定的id一致
+$('#transfer-goods-ids').val(key);
+JS;
+    }
+}

+ 112 - 0
app/Admin/Actions/Grid/Mp/FreePublishMaterialAction.php

@@ -0,0 +1,112 @@
+<?php
+namespace App\Admin\Actions\Grid\Mp;
+
+use App\Lib\WeApp\WeApp;
+use App\Models\Mp\WxMpFreePublish;
+use Dcat\Admin\Grid\RowAction;
+use Illuminate\Http\Request;
+use Illuminate\Database\Eloquent\Model;
+
+class FreePublishMaterialAction extends RowAction
+{
+
+    /**
+     * 标题
+     *
+     * @return string
+     */
+    public function title()
+    {
+        if($this->row->parent_id === 0){
+            if(!_empty_($this->row->media_id)){
+                return '更新草稿';
+            }else{
+                if(!_empty_($this->row->article_id)){
+                    return '重发草稿';
+                }else{
+                    return '新增草稿';
+                }
+            }
+        }else{
+
+        }
+    }
+
+    /**
+     * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
+     *
+     * 允许返回字符串或数组类型
+     *
+     * @return array|string|void
+     */
+    public function confirm()
+    {
+        if($this->row->parent_id === 0) {
+            if (!_empty_($this->row->media_id)) {
+                return [
+                    // 确认弹窗 title
+                    "确定修改这个对应的公众号草稿吗?",
+                    // 确认弹窗 content
+                    $this->row->title,
+                ];
+            } else {
+                return [
+                    // 确认弹窗 title
+                    "确定新增一个公众号草稿吗?",
+                    // 确认弹窗 content
+                    $this->row->title,
+                ];
+            }
+        }
+        return '';
+    }
+
+    /**
+     * 处理请求
+     *
+     * @param Request $request
+     *
+     * @return \Dcat\Admin\Actions\Response
+     */
+    public function handle(Request $request)
+    {
+        // 获取当前行ID
+        $id = $this->getKey();
+        $free_publish = WxMpFreePublish::find($id);
+        if($free_publish->parent_id === 0){
+            $weapp = new WeApp('mp');
+            $mp = $weapp->getMpServicer();
+            if(_empty_($free_publish->media_id)){
+                $res = $mp->addOrUpdateDraft($free_publish->id);
+            }else{
+                $mp->addOrUpdateDraft($free_publish->id);
+                WxMpFreePublish::where('parent_id', $free_publish->id)->orderBy('order', 'asc')->orderBy('id', 'asc')->map(function ($v) use (&$mp){
+                    try {
+                        $mp->addOrUpdateDraft($v->id);
+                    }catch (\Exception $e){
+                        _logger_(__file__, __line__, $e->getMessage());
+                    }
+                });
+            }
+            if($res['code'] == 200){
+                return $this->response()->success("同步成功")->refresh();
+            }else{
+                return $this->response()->error($res['msg']);
+            }
+        }else{
+            return $this->response()->warning('不要点子级');
+        }
+    }
+
+    /**
+     * 设置要POST到接口的数据
+     *
+     * @return array
+     */
+    public function parameters()
+    {
+        return [
+            'title' => $this->row->title,
+        ];
+    }
+}

+ 158 - 0
app/Admin/Actions/Grid/Mp/FreePublishSubmitAction.php

@@ -0,0 +1,158 @@
+<?php
+namespace App\Admin\Actions\Grid\Mp;
+
+use App\Lib\WeApp\WeApp;
+use App\Models\Mp\WxMpFreePublish;
+use Dcat\Admin\Grid\RowAction;
+use Illuminate\Http\Request;
+use Illuminate\Database\Eloquent\Model;
+
+class FreePublishSubmitAction extends RowAction
+{
+
+    /**
+     * 标题
+     *
+     * @return string
+     */
+    public function title()
+    {
+        if($this->row->parent_id === 0) {
+            if (_empty_($this->row->article_id)) {
+                return '发布文章';
+            } else {
+                if (in_array($this->row->publish_status, [2, 3, 4, 5, 6])) {
+                    return '重新发布';
+                } else if ($this->row->publish_status == 1) {
+                    return '发布中,请等待';
+                } else if ($this->row->publish_status === 0) {
+                    return '删除文章';
+                }
+            }
+        }else{
+            $update_article_id = WxMpFreePublish::where('id', $this->row->parent_id)->value('article_id');
+            if ($update_article_id) {
+                return '删除子级文章';
+            }
+        }
+        return '';
+    }
+
+    /**
+     * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
+     *
+     * 允许返回字符串或数组类型
+     *
+     * @return array|string|void
+     */
+    public function confirm()
+    {
+        if($this->row->parent_id === 0) {
+            if (_empty_($this->row->article_id)) {
+                return [
+                    // 确认弹窗 title
+                    "确定新增一个公众号文章吗?",
+                    // 确认弹窗 content
+                    $this->row->title,
+                ];
+            } else {
+                if (in_array($this->row->publish_status, [2, 3, 4, 5, 6])) {
+                    return [
+                        // 确认弹窗 title
+                        "确定重新发布这个公众号文章吗?",
+                        // 确认弹窗 content
+                        $this->row->title,
+                    ];
+                } else if ($this->row->publish_status == 1) {
+                    return [
+                        // 确认弹窗 title
+                        "已在发布中,请等待微信发布完成",
+                        // 确认弹窗 content
+                        $this->row->title,
+                    ];
+                } else if ($this->row->publish_status === 0) {
+                    return [
+                        // 确认弹窗 title
+                        "确定删除微信公众号的这篇文章?",
+                        // 确认弹窗 content
+                        $this->row->title,
+                    ];
+                }
+            }
+        }else{
+            $update_article_id = WxMpFreePublish::where('id', $this->row->parent_id)->value('article_id');
+            if ($update_article_id) {
+                return [
+                    // 确认弹窗 title
+                    "确定删除这个微信公众号的子级文章?",
+                    // 确认弹窗 content
+                    $this->row->title,
+                ];
+            }
+        }
+        return '';
+    }
+
+    /**
+     * 处理请求
+     *
+     * @param Request $request
+     *
+     * @return \Dcat\Admin\Actions\Response
+     */
+    public function handle(Request $request)
+    {
+        // 获取当前行ID
+        $id = $this->getKey();
+        $free_publish = WxMpFreePublish::find($id);
+
+        $weapp = new WeApp('mp');
+        $mp = $weapp->getMpServicer();
+
+        if($free_publish->parent_id === 0) {
+            if (_empty_($free_publish->article_id)) {
+                $res = $mp->freePublishSubmit($free_publish->id);
+            } else{
+                if (in_array($free_publish->publish_status, [2, 3, 4, 5, 6])) {
+                    $res = $mp->freePublishSubmit($free_publish->id);
+                } else if ($free_publish->publish_status == 1) {
+                    return $this->response()->warning("已在发布中,请等待微信发布完成");
+                } else if ($free_publish->publish_status === 0) {
+                    $res = $mp->deleteFreePublish($free_publish->article_id);
+                }
+            }
+        }else{
+            // 删除子级文章
+            $update_index = 0;
+            $update_article_id = WxMpFreePublish::where('id', $free_publish->parent_id)->value('article_id');
+            if(_empty_($update_article_id)){
+                return $this->response()->warning("还没有发布");
+            }
+            if($free_publish->parent_id > 0) {
+                $pluck_ids = WxMpFreePublish::where('parent_id', $free_publish->parent_id)->orderBy('order', 'asc')->orderBy('id', 'asc')->pluck('id')->toArray();
+                if ($pluck_ids) {
+                    $update_index = array_search($free_publish->id, $pluck_ids) + 1;
+                }
+            }
+            $res = $mp->deleteFreePublish($update_article_id, $update_index);
+        }
+
+        if($res['code'] == 200){
+            return $this->response()->success("操作成功")->refresh();
+        }else{
+            return $this->response()->error($res['msg']);
+        }
+    }
+
+    /**
+     * 设置要POST到接口的数据
+     *
+     * @return array
+     */
+    public function parameters()
+    {
+        return [
+            'title' => $this->row->title,
+        ];
+    }
+}

+ 78 - 0
app/Admin/Actions/Grid/OrderAction.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use App\Admin\Forms\OrderForms;
+
+
+class OrderAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '发货';
+
+
+    public function render()
+    {
+
+        $form = OrderForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 84 - 0
app/Admin/Actions/Grid/OrderGoodsAction.php

@@ -0,0 +1,84 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use App\Admin\Forms\OrderGoodsForms;
+
+
+class OrderGoodsAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '处理售后状态';
+	protected $goods_type = 0;
+
+    public function __construct($goods_type = 0) {
+        parent::__construct(); // 调用父级的构造函数
+
+        // 子类特有的初始化逻辑
+        $this->goods_type = $goods_type;
+    }
+
+    public function render()
+    {
+        $form = OrderGoodsForms::make()->payload(["id"=>$this->getKey(), 'goods_type'=>$this->goods_type]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 111 - 0
app/Admin/Actions/Grid/OrderSupplyAction.php

@@ -0,0 +1,111 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Http\Controllers\Api\NotifyController;
+use App\Http\Controllers\Api\Repositories\WxUserRepositores;
+use App\Models\WxOrder;
+use App\Wen\Utils\OrderUtils;
+use App\Wen\Utils\Settings;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class OrderSupplyAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '批量补单';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        $supply_ids = [];
+        foreach ($ids as $id){
+            $WxOrder = WxOrder::find($id);
+            if($WxOrder->order_state == 1){
+                continue;
+            }
+
+            WxOrder::where('id', $id)->update(['order_state' => 1]);
+            $type = $WxOrder->order_type;
+            $uid = $WxOrder->user_id;
+            $order_price = $WxOrder->order_price;
+            // 开会员
+            if ($type == 1) {
+                $vip_options = json_decode(Settings::get('app_vip_options', '[]'), true);
+                if(_empty_($vip_options)){
+                    continue;
+                }
+                $flag = false;
+                $days = 0;
+                $coins = 0;
+                foreach ($vip_options as $option){
+                    if($option && $option['price'] == $order_price){
+                        $flag = true;
+                        $days = $option['days'];
+                        $coins = $option['coins'];
+                        break;
+                    }
+                }
+                if($flag){
+                    WxUserRepositores::vip($uid, $days);
+                    if($coins > 0){
+                        UserUtils::update_user_coins($uid,13, $coins, '开通'.$days.'天会员,赠送您'.Settings::get('app_coin_name', '硬币').'+'.$coins);
+                    }
+                }
+
+            }
+            // 充电
+            if ($type == 2) {
+                OrderUtils::exceptional($WxOrder);
+            }
+            if ($type == 3) {
+                UserUtils::update_user_financial($uid, 6, $order_price, '充值了'.$order_price.'余额');
+            }
+            $supply_ids[] = $id;
+        }
+
+        return $this->response()
+            ->success('如下订单补单成功'.json_encode($supply_ids))
+            ->refresh();
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        return ['确认补单?'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 88 - 0
app/Admin/Actions/Grid/PetsAdoptionPassAction.php

@@ -0,0 +1,88 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Pets\WxPetsAdoption;
+use App\Wen\Utils\GatewayUtils;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class PetsAdoptionPassAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量审核通过';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+
+                $adoption = WxPetsAdoption::find($id);
+
+                if(!in_array($adoption->adopt_status, [3])){
+                    return;
+                }
+
+                $uid = $adoption->user_id;
+                // 发送通知
+
+                $msg = UserUtils::reward_user_coin($uid, 'pets-adoption');
+                if($msg){
+//                    GatewayUtils::info_message(GatewayUtils::uid2client_id($uid), '恭喜,获得系统的发布闲置奖励:'.$msg);
+                    UserUtils::assistant_notice($uid, '您发布的宠物领养(id:<a href="/pagesP/pet-adoption/details/index?id='.$id.'">'.$id.'</a>)已经审核通过,并获得发布奖励:'.$msg);
+                }else{
+                    UserUtils::assistant_notice($uid, '您发布的宠物领养(id:<a href="/pagesP/pet-adoption/details/index?id='.$id.'">'.$id.'</a>)已经审核通过');
+                }
+                WxPetsAdoption::where('id',$id)->update(['adopt_status'=>0]);
+
+            });
+
+        }
+
+        return $this->response()
+            ->success('操作成功'.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认审核通过?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 89 - 0
app/Admin/Actions/Grid/PetsCommentsPassAction.php

@@ -0,0 +1,89 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Pets\WxPetsComment;
+use App\Wen\Utils\GatewayUtils;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class PetsCommentsPassAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量审核通过';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+
+                $pets_comment = WxPetsComment::find($id);
+
+                if(!in_array($pets_comment->comment_state, [0, 2])){
+                    return;
+                }
+
+                $uid = $pets_comment->user_id;
+                $comment_content = $pets_comment->comment_content;
+                $used_good_id = $pets_comment->used_good_id;
+                // 发送通知
+
+                $msg = UserUtils::reward_user_coin($uid, 'pets-comment');
+                if($msg){
+                    GatewayUtils::info_message(GatewayUtils::uid2client_id($uid), '恭喜,获得领养系统的发布留言:'.$msg);
+                    UserUtils::assistant_notice($uid, '您发表的留言(id:<a href="/pagesU/used-mall/detail/index?id='.$used_good_id.'">'.$id.'</a>)已经审核通过,并获得留言奖励:'.$msg);
+                }else{
+                    UserUtils::assistant_notice($uid, '您发表的留言(id:<a href="/pagesU/used-mall/detail/index?id='.$used_good_id.'">'.$id.'</a>)已经审核通过');
+                }
+                WxPetsComment::where('id',$id)->update(['comment_state'=>1]);
+            });
+
+        }
+
+        return $this->response()
+            ->success('操作成功'.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认审核通过?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 78 - 0
app/Admin/Actions/Grid/PostCommentLotteryAction.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Admin\Forms\PostCommentLotteryForm;
+use App\Admin\Forms\PostMetaForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class PostCommentLotteryAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '评论抽奖';
+
+
+    public function render()
+    {
+
+        $form = PostCommentLotteryForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 73 - 0
app/Admin/Actions/Grid/PostDeleteAction.php

@@ -0,0 +1,73 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class PostDeleteAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '批量删除';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+                $uid = WxPost::where('id',$id)->value('user_id');
+                WxPost::where('id',$id)->update(['deleted_at'=>1]);
+                // 发送通知
+                UserUtils::add_user_notice(2004, $uid,'笔记被删除通知','您好,您发表的笔记id为'.$id.'被管理员删除',100);
+            });
+        }
+
+
+        return $this->response()
+            ->success('操作成功'.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        return ['真的要删除吗?可恢复不了'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/PostMetaAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Admin\Forms\PostMetaForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class PostMetaAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '标题封面';
+
+
+    public function render()
+    {
+
+        $form = PostMetaForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 89 - 0
app/Admin/Actions/Grid/PostPassAction.php

@@ -0,0 +1,89 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use App\Wen\Utils\GatewayUtils;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class PostPassAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量审核通过';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+                $wx_post = WxPost::find($id);
+
+                if(!in_array($wx_post->is_examine, [0, 2])){
+                    return;
+                }
+
+                $uid = $wx_post->user_id;
+                $post_content = $wx_post->posts_content;
+                // 发送通知
+
+                $msg = UserUtils::reward_user_coin($uid, 'publish');
+                if($msg){
+                    GatewayUtils::info_message(GatewayUtils::uid2client_id($uid), '恭喜,获得发布奖励:'.$msg);
+                    UserUtils::assistant_notice($uid, '您发表的笔记(id:<a href="/pages/sticky/sticky?id='.$id.'">'.$id.'</a>)已经审核通过,并获得发布奖励:'.$msg);
+                }else{
+                    UserUtils::assistant_notice($uid, '您发表的笔记(id:<a href="/pages/sticky/sticky?id='.$id.'">'.$id.'</a>)已经审核通过');
+                }
+                _mini_aite($uid, $post_content, 1, true, $id);
+
+                WxPost::where('id',$id)->update(['is_examine'=>1]);
+            });
+
+        }
+
+        return $this->response()
+            ->success('操作成功'.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认审核通过?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 61 - 0
app/Admin/Actions/Grid/PostPushAction.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class PostPushAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量推送';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        WxPost::whereIn('id',$ids)->update(['posts_state'=>0]);
+        return $this->response()
+            ->success('操作成功: '.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 62 - 0
app/Admin/Actions/Grid/PostShelvesAction.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class PostShelvesAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量下架';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        WxPost::whereIn('id',$ids)->update(['posts_state'=>2]);
+        return $this->response()
+            ->success('操作成功: '.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 62 - 0
app/Admin/Actions/Grid/PostTopAction.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class PostTopAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量置顶';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        WxPost::whereIn('id',$ids)->update(['is_sticky'=>1]);
+        return $this->response()
+            ->success('操作成功: '.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 62 - 0
app/Admin/Actions/Grid/PostUnTopAction.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class PostUnTopAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量取消置顶';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+
+        WxPost::whereIn('id',$ids)->update(['is_sticky'=>0]);
+        return $this->response()
+            ->success('操作成功: '.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/Posts/CommentApplyAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Posts;
+
+use App\Admin\Forms\Posts\CommentReplayForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class CommentApplyAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '回复';
+
+
+    public function render()
+    {
+
+        $form = CommentReplayForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/PostsAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use App\Admin\Forms\PostsForms;
+
+
+class PostsAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核';
+
+
+    public function render()
+    {
+
+        $form = PostsForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 40 - 0
app/Admin/Actions/Grid/ReplyTap.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Admin\Forms\ReplyForms;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Illuminate\Http\Request;
+use Dcat\Admin\Widgets\Modal;
+
+
+class ReplyTap extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '回复用户';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function render()
+    {
+
+        $form = ReplyForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+}

+ 76 - 0
app/Admin/Actions/Grid/Shop/ShopExamineAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Shop;
+
+use App\Admin\Forms\Shop\ShopExamineForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Http\Request;
+
+class ShopExamineAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核';
+
+
+    public function render()
+    {
+
+        $form = ShopExamineForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/Shop/ShopGuaranteeAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Shop;
+
+use App\Admin\Forms\Shop\ShopGuaranteeForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Http\Request;
+
+class ShopGuaranteeAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '保证金';
+
+
+    public function render()
+    {
+
+        $form = ShopGuaranteeForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 88 - 0
app/Admin/Actions/Grid/ShopOrderSupplyAction.php

@@ -0,0 +1,88 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Http\Controllers\Api\NotifyController;
+use App\Models\Shop\WxShopOrder;
+use App\Wen\Utils\ShopUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class ShopOrderSupplyAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '批量补单';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        $supply_ids = [];
+        foreach ($ids as $id){
+            // 处理重复通知
+            if(WxShopOrder::where([
+                ['id','=', $id],
+                ['pay_status', '=', 2]
+            ])->exists()){
+                continue;
+            }
+            $WxShopOrder = WxShopOrder::where('id', $id)->first();
+            if($WxShopOrder){
+                //SHOP
+                WxShopOrder::where('id', $WxShopOrder->id)
+                    ->update(['pay_status' => 2, 'status' => 1]);
+
+                ShopUtils::paied_content_process($WxShopOrder->id);
+                ShopUtils::split_shop_order_by_seller($WxShopOrder->id);
+                ShopUtils::split_shop_order_by_type($WxShopOrder->id);
+                ShopUtils::order_buys_and_stock($WxShopOrder->id);
+
+            }else{
+                continue;
+            }
+            $supply_ids[] = $id;
+        }
+
+        return $this->response()
+            ->success('如下订单补单成功'.json_encode($supply_ids))
+            ->refresh();
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        return ['确认补单?'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 67 - 0
app/Admin/Actions/Grid/System/UniversityCanCertifyAction.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace App\Admin\Actions\Grid\System;
+
+use App\Models\WxUniversity;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class UniversityCanCertifyAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '一键开放认证';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $sids = $this->getKey();
+        DB::transaction(function () use ($sids){
+            foreach ($sids as $sid){
+                WxUniversity::where('sid', $sid)->update(['is_certify'=>1]);
+            }
+        });
+
+        return $this->response()
+            ->success('操作成功'.json_encode($sids))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确定开放选中的大学认证?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 67 - 0
app/Admin/Actions/Grid/System/UniversityCancelCertifyAction.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace App\Admin\Actions\Grid\System;
+
+use App\Models\WxUniversity;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class UniversityCancelCertifyAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '一键取消认证';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $sids = $this->getKey();
+        DB::transaction(function () use ($sids){
+            foreach ($sids as $sid){
+                WxUniversity::where('sid', $sid)->update(['is_certify'=>0]);
+            }
+        });
+
+        return $this->response()
+            ->success('操作成功'.json_encode($sids))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确定取消选中的大学认证?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 60 - 0
app/Admin/Actions/Grid/Tap.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class Tap extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = 'Title';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/Tenant/TenantShareAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Tenant;
+
+use App\Admin\Forms\Tenant\TenantShareForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Http\Request;
+
+class TenantShareAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '链接二维码';
+
+
+    public function render()
+    {
+
+        $form = TenantShareForm::make()->payload(["tenant_id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 91 - 0
app/Admin/Actions/Grid/UsedCommentsPassAction.php

@@ -0,0 +1,91 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use App\Models\Used\WxUsedComment;
+use App\Models\Used\WxUsedGood;
+use App\Wen\Utils\GatewayUtils;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class UsedCommentsPassAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量审核通过';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+
+                $used_comment = WxUsedComment::find($id);
+
+                if(!in_array($used_comment->comment_state, [0, 2])){
+                    return;
+                }
+
+                $uid = $used_comment->user_id;
+                $comment_content = $used_comment->comment_content;
+                $used_good_id = $used_comment->used_good_id;
+                // 发送通知
+
+                $msg = UserUtils::reward_user_coin($uid, 'used-comment');
+                if($msg){
+                    GatewayUtils::info_message(GatewayUtils::uid2client_id($uid), '恭喜,获得系统的发布留言:'.$msg);
+                    UserUtils::assistant_notice($uid, '您发表的留言(id:<a href="/pagesU/used-mall/detail/index?id='.$used_good_id.'">'.$id.'</a>)已经审核通过,并获得留言奖励:'.$msg);
+                }else{
+                    UserUtils::assistant_notice($uid, '您发表的留言(id:<a href="/pagesU/used-mall/detail/index?id='.$used_good_id.'">'.$id.'</a>)已经审核通过');
+                }
+                WxUsedComment::where('id',$id)->update(['comment_state'=>1]);
+            });
+
+        }
+
+        return $this->response()
+            ->success('操作成功'.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认审核通过?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 90 - 0
app/Admin/Actions/Grid/UsedGoodsPassAction.php

@@ -0,0 +1,90 @@
+<?php
+
+namespace App\Admin\Actions\Grid;
+
+use App\Models\Posts\WxPost;
+use App\Models\Used\WxUsedGood;
+use App\Wen\Utils\GatewayUtils;
+use App\Wen\Utils\UserUtils;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class UsedGoodsPassAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量审核通过';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        foreach ($ids as $id){
+            DB::transaction(function () use ($id){
+
+                $used_good = WxUsedGood::find($id);
+
+                if(!in_array($used_good->status, [0, 4])){
+                    return;
+                }
+
+                $uid = $used_good->user_id;
+                $title = $used_good->title;
+                // 发送通知
+
+                $msg = UserUtils::reward_user_coin($uid, 'used-good');
+                if($msg){
+                    GatewayUtils::info_message(GatewayUtils::uid2client_id($uid), '恭喜,获得系统的发布闲置奖励:'.$msg);
+                    UserUtils::assistant_notice($uid, '您发布的闲置商品(id:<a href="/pagesU/used-mall/detail/index?id='.$id.'">'.$id.'</a>)已经审核通过,并获得发布奖励:'.$msg);
+                }else{
+                    UserUtils::assistant_notice($uid, '您发布的闲置商品(id:<a href="/pagesU/used-mall/detail/index?id='.$id.'">'.$id.'</a>)已经审核通过');
+                }
+                WxUsedGood::where('id',$id)->update(['status'=>1]);
+
+            });
+
+        }
+
+        return $this->response()
+            ->success('操作成功'.json_encode($this->getKey()))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认审核通过?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserBanAndMuteAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserBanAndMuteForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserBanAndMuteAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '封禁';
+
+
+    public function render()
+    {
+
+        $form = UserBanAndMuteForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/User/UserChatReplyAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserChatReplyForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Http\Request;
+
+class UserChatReplyAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '回复Ta';
+
+
+    public function render()
+    {
+
+        $form = UserChatReplyForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserCoinAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserCoinForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserCoinAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '金币';
+
+
+    public function render()
+    {
+
+        $form = UserCoinForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserFinancialAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserFinancialForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserFinancialAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '余额';
+
+
+    public function render()
+    {
+
+        $form = UserFinancialForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 69 - 0
app/Admin/Actions/Grid/User/UserGenderManAction.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Models\User\WxUser;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\DB;
+
+class UserGenderManAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '一键修改性别-男';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        DB::transaction(function () use ($ids){
+            foreach ($ids as $id){
+                WxUser::where('id', $id)->update(['gender'=>1]);
+                Cache::forget('get:cached:user:'.$id);
+            }
+        });
+
+        return $this->response()
+            ->success('操作成功'.json_encode($ids))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认修改选中用户的性别为男?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 69 - 0
app/Admin/Actions/Grid/User/UserGenderWomanAction.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Models\User\WxUser;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\DB;
+
+class UserGenderWomanAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '一键修改性别-女';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        DB::transaction(function () use ($ids){
+            foreach ($ids as $id){
+                WxUser::where('id', $id)->update(['gender'=>2]);
+                Cache::forget('get:cached:user:'.$id);
+            }
+        });
+
+        return $this->response()
+            ->success('操作成功'.json_encode($ids))
+            ->refresh();
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确认修改选中用户的性别为女?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 80 - 0
app/Admin/Actions/Grid/User/UserInviteTmpCodeBgDownBatchAction.php

@@ -0,0 +1,80 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Utils\DownUtils;
+use App\Models\User\WxUserInviteTempCode;
+use App\Wen\Utils\Settings;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserInviteTmpCodeBgDownBatchAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量下载(带背景)';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        if(_empty_($ids)){
+            return $this->response()->warning('没有勾选');
+        }
+        $temp_code_bg = Settings::get('app_user_invite_temp_code_bg', []);
+        if(_empty_($temp_code_bg)){
+            return $this->response()->warning('你还没有配置背景图');
+        }
+        $codes = WxUserInviteTempCode::whereIn('id', $ids)
+            ->get(['id', 'code'])
+            ->map(function ($item) {
+                return [
+                    'name' => 'id-'.$item->id,
+                    'url' => $item->code
+                ];
+            })->toArray();
+        if($codes){
+            $zip_file_path = DownUtils::down_invite_temp_code_with_bg($codes, $temp_code_bg[0]);
+            return $this->response()->download($zip_file_path);
+        }else{
+            return $this->response()->error('下载程序出错');
+        }
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确定下载选中的推广码?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 75 - 0
app/Admin/Actions/Grid/User/UserInviteTmpCodeDownBatchAction.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Utils\DownUtils;
+use App\Models\User\WxUserInviteTempCode;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\BatchAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserInviteTmpCodeDownBatchAction extends BatchAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '批量下载';
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $ids = $this->getKey();
+        if(_empty_($ids)){
+            return $this->response()->warning('没有勾选');
+        }
+        $codes = WxUserInviteTempCode::whereIn('id', $ids)
+            ->get(['id', 'code'])
+            ->map(function ($item) {
+                return [
+                    'name' => 'id-'.$item->id,
+                    'url' => $item->code
+                ];
+            })->toArray();
+        if($codes){
+            $zip_file_path = DownUtils::down_invite_temp_code($codes);
+            return $this->response()->download($zip_file_path);
+        }else{
+            return $this->response()->error('下载程序出错');
+        }
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		 return ['确定下载选中的推广码?'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserJewelryAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserJewelryForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserJewelryAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '饰品';
+
+
+    public function render()
+    {
+
+        $form = UserJewelryForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+//         return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserMemberAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserMemberForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserMemberAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '会员';
+
+
+    public function render()
+    {
+
+        $form = UserMemberForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserPaycodeUpdateAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserPaycodeForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserPaycodeUpdateAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '支付密码';
+
+
+    public function render()
+    {
+
+        $form = UserPaycodeForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserRealNameAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserRealNameForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserRealNameAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '实名';
+
+
+    public function render()
+    {
+
+        $form = UserRealNameForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+//         return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/User/UserShareAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserShareForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Http\Request;
+
+class UserShareAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '推广';
+
+
+    public function render()
+    {
+
+        $form = UserShareForm::make()->payload(["user_id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserStudentCertifyNoticeAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserStudentCertifyNoticeForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserStudentCertifyNoticeAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '发送通知';
+
+
+    public function render()
+    {
+
+        $form = UserStudentCertifyNoticeForm::make()->payload(["user_id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+//         return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 76 - 0
app/Admin/Actions/Grid/User/UserTempAction.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\User\UserTempForms;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Http\Request;
+
+class UserTempAction extends RowAction
+{
+    /**
+     * @return string
+     */
+	protected $title = '审核';
+
+
+    public function render()
+    {
+
+        $form = UserTempForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/User/UserWithdrawalProcessAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\User;
+
+use App\Admin\Forms\WithdrawalProcessForms;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class UserWithdrawalProcessAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '提现处理';
+
+
+    public function render()
+    {
+
+        $form = WithdrawalProcessForms::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+        // return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/Voter/RefusePlayerNoticeAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Voter;
+
+use App\Admin\Forms\Voter\RefusePlayerNoticeForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class RefusePlayerNoticeAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '发送通知';
+
+
+    public function render()
+    {
+
+        $form = RefusePlayerNoticeForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+//         return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/Voter/SimulateVoteAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Voter;
+
+use App\Admin\Forms\Voter\SimulateVoteForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class SimulateVoteAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '模拟投票';
+
+
+    public function render()
+    {
+
+        $form = SimulateVoteForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+//         return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 77 - 0
app/Admin/Actions/Grid/Voter/VoterNoticeAction.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace App\Admin\Actions\Grid\Voter;
+
+use App\Admin\Forms\Voter\VoterNoticeForm;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Widgets\Modal;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class VoterNoticeAction extends RowAction
+{
+    /**
+     * @return string
+     */
+    protected $title = '发送通知';
+
+
+    public function render()
+    {
+
+        $form = VoterNoticeForm::make()->payload(["id"=>$this->getKey()]);
+
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法
+            // 如果是非异步方式加载表单,则需要改成 onShow 方法
+            ->button($this->title);
+    }
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        // dump($this->getKey());
+
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * @return string|array|void
+     */
+    public function confirm()
+    {
+//         return ['Confirm?', 'contents'];
+    }
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array
+     */
+    protected function parameters()
+    {
+        return [];
+    }
+}

+ 164 - 0
app/Admin/Actions/Tree/SyncToWeWeiXinMp.php

@@ -0,0 +1,164 @@
+<?php
+
+namespace App\Admin\Actions\Tree;
+
+use App\Lib\WeApp\WeApp;
+use App\Models\Mp\WxMpCustomMenu;
+use Dcat\Admin\Actions\Response;
+use Dcat\Admin\Traits\HasPermissions;
+use Dcat\Admin\Tree\AbstractTool;
+use Illuminate\Contracts\Auth\Authenticatable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class SyncToWeWeiXinMp extends AbstractTool
+{
+    /**
+     * @return string
+     */
+	protected $title = '<i class="fa fa-wechat"></i> 同步到微信';
+
+	public function itemProces(WxMpCustomMenu $menu){
+	    if($menu){
+	        if(in_array($menu->type, ['click', 'scancode_push', 'scancode_waitmsg', 'pic_sysphoto', 'pic_weixin', 'pic_photo_or_album', 'location_select'])){
+                if(_empty_($menu->key)){
+                    throw new \Exception($menu->name.': key不能为空');
+                }
+	            return [
+                    'type' => $menu->type,
+                    'name' => $menu->name,
+                    'key' => $menu->key
+                ];
+            }else if($menu->type == 'view'){
+	            if(_empty_($menu->url)){
+	                throw new \Exception($menu->name.': 链接不能为空');
+                }
+                return [
+                    'type' => 'view',
+                    'name' => $menu->name,
+                    'url' => $menu->url
+                ];
+            }else if($menu->type == 'media_id'){
+                if(_empty_($menu->media_id)){
+                    throw new \Exception($menu->name.': media_id不能为空');
+                }
+                return [
+                    'type' => 'media_id',
+                    'name' => $menu->name,
+                    'media_id' => $menu->media_id
+                ];
+            }else if(in_array($menu->type, ['article_id', 'article_view_limited'])){
+                if(_empty_($menu->article_id)){
+                    throw new \Exception($menu->name.': article_id不能为空');
+                }
+                return [
+                    'type' => $menu->type,
+                    'name' => $menu->name,
+                    'article_id' => $menu->article_id
+                ];
+            }else if( $menu->type == 'miniprogram'){
+                if(_empty_($menu->url)){
+                    throw new \Exception($menu->name.': url不能为空');
+                }
+                if(_empty_($menu->appid)){
+                    throw new \Exception($menu->name.': appid不能为空');
+                }
+                if(_empty_($menu->pagepath)){
+                    throw new \Exception($menu->name.': pagepath不能为空');
+                }
+                return [
+                    'type' => 'miniprogram',
+                    'name' => $menu->name,
+                    'url' => trim($menu->url, '/'),
+                    'appid' => $menu->appid,
+                    'pagepath' => $menu->pagepath,
+                ];
+            }
+        }
+	}
+
+    /**
+     * Handle the action request.
+     *
+     * @param Request $request
+     *
+     * @return Response
+     */
+    public function handle(Request $request)
+    {
+        $weapp = new WeApp('mp');
+        if($weapp){
+            $mp = $weapp->getMpServicer();
+            if($mp){
+                try {
+                    $buttons = [];
+                    WxMpCustomMenu::where('parent_id', 0)->orderBy('order', 'asc')->limit(3)->get()->map(function ($v) use (&$buttons){
+                        // 先判断有没有下级
+                        $subs = WxMpCustomMenu::where('parent_id', $v->id)->orderBy('order', 'asc')->limit(5)->get();
+                        if($subs->isNotEmpty()){
+                            $sub_buttons = [];
+                            $subs->map(function ($sub) use (&$sub_buttons){
+                                $s_subs = WxMpCustomMenu::where('parent_id', $sub->id)->orderBy('order', 'asc')->limit(5)->get();
+                                if($s_subs->isNotEmpty()){
+                                    $sub_sub_buttons = [];
+                                    $s_subs->map(function ($s_sub) use (&$sub_sub_buttons){
+                                        $sub_sub_buttons[] = $this->itemProces($s_sub);
+                                    });
+                                    $sub_buttons[] = [
+                                        'name' => $sub->name,
+                                        'sub_button' => $sub_sub_buttons
+                                    ];
+                                }else{
+                                    $sub_buttons[] = $this->itemProces($sub);
+                                }
+                            });
+                            $buttons[] = [
+                                'name' => $v->name,
+                                'sub_button' => $sub_buttons
+                            ];
+                        }else{
+                            $buttons[] = $this->itemProces($v);
+                        }
+                    });
+                    $res = $mp->SyncCustomMenu($buttons);
+                    if($res['code'] == 200){
+                        return $this->response()
+                            ->success('同步成功');
+                    }else{
+                        return $this->response()->error($res['msg']);
+                    }
+                }catch (\Exception $e){
+                    return $this->response()->error($e->getMessage());
+                }
+
+            }
+        }
+        return $this->response()->warning('错误');
+    }
+
+    /**
+     * @return string|void
+     */
+    protected function href()
+    {
+        // return admin_url('auth/users');
+    }
+
+    /**
+	 * @return string|array|void
+	 */
+	public function confirm()
+	{
+		// return ['Confirm?', 'contents'];
+	}
+
+    /**
+     * @param Model|Authenticatable|HasPermissions|null $user
+     *
+     * @return bool
+     */
+    protected function authorize($user): bool
+    {
+        return true;
+    }
+}

+ 157 - 0
app/Admin/Controllers/Admin/AdminToolsController.php

@@ -0,0 +1,157 @@
+<?php
+
+namespace App\Admin\Controllers\Admin;
+
+use App\Models\User\WxUser;
+use App\Models\WxChat;
+use App\Wen\Utils\StrUtils;
+use Dcat\Admin\Http\Controllers\AdminController;
+use Dcat\Admin\Layout\Content;
+use Dcat\Admin\Form;
+use Dcat\Admin\Traits\HasFormResponse;
+use Illuminate\Http\Request;
+use Dcat\Admin\Admin;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\DB;
+
+class AdminToolsController extends AdminController
+{
+    use HasFormResponse;
+
+    public function imgDomainReplaceHandler(Request $request){
+        $old_str = $request->old_str;
+        $new_str = $request->new_str;
+
+        if(_empty_($old_str)){
+            return $this->response()->error('请输入旧字符串');
+        }
+        if(_empty_($new_str)){
+            $new_str = '';
+        }
+        $admin_user = Admin::user();
+        if(!($admin_user && $admin_user->isAdministrator())){
+            return $this->response()->error('你不是超级管理员');
+        }
+
+        DB::beginTransaction();
+        try {
+            // todo:
+            $tables = DB::select('SHOW TABLES');
+            $tableNames = array_map('current', $tables);
+            if($tableNames){
+                foreach ($tableNames as $table_name){
+                    if(StrUtils::startsWith($table_name, 'admin_')){
+                        continue;
+                    }
+                    if(!StrUtils::startsWith($table_name, 'wx_') && !StrUtils::startsWith($table_name, 'mini_')){
+                        continue;
+                    }
+                    $table_info_columns = DB::select( DB::raw('SHOW COLUMNS FROM '.$table_name));
+                    foreach($table_info_columns as $column){
+                        if(in_array($column->Field, ['id', 'deleted_at', 'created_at', 'updated_at']) || StrUtils::endsWith($column->Field, '_id')){
+                            continue;
+                        }
+                        if(strpos($column->Type, 'int') !== false){
+                            continue;
+                        }
+                        if(in_array($column->Field, ['desc', 'right', 'condition', 'key'])){
+                            continue;
+                        }
+                        DB::select("UPDATE ".$table_name." SET ".$column->Field." = REPLACE(".$column->Field.", '".$old_str."', '".$new_str."') WHERE ".$column->Field." LIKE '%".$old_str."%'");
+                    }
+                }
+            }
+
+            Cache::tags('st')->flush();
+
+            DB::commit();
+            return $this->response()->success('替换成功!')->refresh();
+        } catch (\Exception $e) {
+            DB::rollBack();
+            _logger_(__file__, __line__, $e->getMessage());
+            return $this->response()->error($e->getMessage());
+        }
+    }
+
+    public function imgDomainReplaceForm(Content $content)
+    {
+        return Form::make('',function (Form $form) {
+
+            $form->text('old_str', '旧字符串')->required();
+            $form->text('new_str', '新字符串');
+
+            $form->disableResetButton();
+            $form->action('admin/tools/img_domain_replace');
+        });
+    }
+
+    public function chatRecordChangeHandler(Request $request){
+        $user_1 = (int)($request->user_1);
+        $user_2 = (int)($request->user_2);
+
+        if(_empty_($user_1) || $user_1 <= 0){
+            return $this->response()->error('账号A参数错误');
+        }
+        if(_empty_($user_2) || $user_2 <= 0){
+            return $this->response()->error('账号B参数错误');
+        }
+
+        $user_model_1 = WxUser::find($user_1);
+        $user_model_2 = WxUser::find($user_2);
+
+        if(!($user_model_1 && $user_model_2)){
+            return $this->response()->error('账号实际不存在');
+        }
+
+        $admin_user = Admin::user();
+        if(!($admin_user && $admin_user->isAdministrator())){
+            return $this->response()->error('你不是超级管理员');
+        }
+
+        DB::beginTransaction();
+        try {
+            WxChat::where('user_id', $user_1)->update(['user_id' => $user_2]);
+            WxChat::where('object_id', $user_1)->update(['object_id' => $user_2]);
+            DB::commit();
+            return $this->response()->success('迁移成功!')->refresh();
+        } catch (\Exception $e) {
+            DB::rollBack();
+            _logger_(__file__, __line__, $e->getMessage());
+            return $this->response()->error($e->getMessage());
+        }
+    }
+
+    public function chatRecordChangeForm(Content $content)
+    {
+        return Form::make('',function (Form $form) {
+
+            $form->text('user_1', '账号A')->help('A账号的所有聊天记录转移到B账号')->required();
+            $form->text('user_2', '账号B')->required();
+
+            $form->disableResetButton();
+            $form->action('admin/tools/chat_record_change');
+        });
+    }
+
+    public function tools(Content $content)
+    {
+        Form::dialog('数据库字符串替换')
+            ->click('#img-domain-replace') // 绑定点击按钮
+            ->url('admin/tools/img_domain_replace') // 表单页面链接,此参数会被按钮中的 “data-url” 属性替换。。
+            ->height('650px;overflow: hidden;') // 指定弹窗高度,可填写百分比,默认 690px
+            ->success('Dcat.reload()'); // 新增成功后刷新页面
+
+        Form::dialog('聊天记录迁移')
+            ->click('#chat-record-change') // 绑定点击按钮
+            ->url('admin/tools/chat_record_change') // 表单页面链接,此参数会被按钮中的 “data-url” 属性替换。。
+            ->height('650px;overflow: hidden;') // 指定弹窗高度,可填写百分比,默认 690px
+            ->success('Dcat.reload()'); // 新增成功后刷新页面
+
+        return $content
+            ->title('管理员工具箱')
+            ->description('注意:操作之前先<b style="color: red;">备份数据库</b>,世上没有后悔药,这里面都是属于高危操作,没事少碰,如果没有备份数据库就进行操作,中间出现了的问题,群主不会解答')
+            ->body(admin_view('admin.pages.admin-tools', [
+                'paycode_0' => true,
+            ]));
+    }
+}

+ 83 - 0
app/Admin/Controllers/AdminMenuSearchController.php

@@ -0,0 +1,83 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Repositories\AdminMenuSearch;
+use App\Models\Posts\WxUserCircle;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Models\Menu;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+
+class AdminMenuSearchController extends AdminController
+{
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        return Grid::make(new AdminMenuSearch(), function (Grid $grid) {
+            $grid->quickSearch(['id', 'parent_id','menu_id','keyword', 'lower'])->placeholder('搜索...')->width(50);
+
+            $grid->model()->orderBy('id', 'desc');
+            $grid->column('id')->sortable();
+            $grid->column('parent_id')->editable();
+            $grid->column('menu_id')->editable();
+            $grid->column('keyword')->editable();
+            $grid->column('lower')->editable();
+
+            $grid->filter(function (Grid\Filter $filter) {
+                $filter->equal('id');
+
+            });
+        });
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new AdminMenuSearch(), function (Show $show) {
+            $show->field('id');
+            $show->field('parent_id');
+            $show->field('menu_id');
+            $show->field('keyword');
+            $show->field('lower');
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new AdminMenuSearch(), function (Form $form) {
+            $form->display('id');
+            $form->select('parent_id')->options(Menu::where('parent_id', 0)->pluck('title', 'id'));
+            $form->text('menu_id');
+            $form->text('keyword');
+            $form->text('lower');
+            $form->saving(function (Form $form){
+                $form->lower = strtolower($form->keyword);
+            });
+
+            $form->deleting(function (Form $form){
+                global $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                    return $form->response()->error('权限不足,不可以删除其他分站对象');
+                }
+            });
+
+        });
+    }
+}

+ 10 - 0
app/Admin/Controllers/AuthController.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
+
+class AuthController extends BaseAuthController
+{
+    protected $view = 'admin.login';
+}

+ 243 - 0
app/Admin/Controllers/Circle/WxCircleController.php

@@ -0,0 +1,243 @@
+<?php
+
+namespace App\Admin\Controllers\Circle;
+
+use App\Admin\Actions\Extensions\NavigaterUrlButton;
+use App\Admin\Actions\Grid\CircleAction;
+use App\Admin\Renderable\IconRender;
+use App\Admin\Repositories\Circle\WxCircle;
+use App\Jobs\UpdateCircleInfoJob;
+use App\Models\User\WxUser;
+use App\Models\WxIcon;
+use App\Models\WxPlate;
+use App\Models\WxTenant;
+use App\Wen\Utils\AdminUtils;
+use App\Wen\Utils\Settings;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+use Illuminate\Support\Facades\Cache;
+
+class WxCircleController extends AdminController
+{
+    protected $tenants_arr = null;
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        global $__MINI_GLOBAL_TENANT_ID__;
+        if($this->tenants_arr === null){
+            $tenant_arr_ = [
+                '-1' => '全域'
+            ];
+            if($__MINI_GLOBAL_TENANT_ID__ === 0){
+                $tenant_arr = WxTenant::orderBy('order', 'desc')->pluck('name', 'tenant_id')->toArray();
+            }else{
+                $tenant_arr = WxTenant::where('tenant_id', $__MINI_GLOBAL_TENANT_ID__)->orderBy('order', 'desc')->pluck('name', 'tenant_id')->toArray();
+            }
+            foreach ($tenant_arr as $key => $val){
+                $tenant_arr_[$key.''] = $val;
+            }
+
+            $this->tenants_arr = $tenant_arr_;
+        }
+        return Grid::make(new WxCircle(['wxPlate','wxUser']), function (Grid $grid) {
+            // tenant_id代表在哪个分站创建 tenant_show代表希望展现在哪个分站
+            global $__MINI_GLOBAL_TENANT_ID__;
+            if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                $grid->model()->where('tenant_id', '=', $__MINI_GLOBAL_TENANT_ID__)->where('tenant_show', $__MINI_GLOBAL_TENANT_ID__);
+            }
+            $grid->simplePaginate();
+            $grid->model()->orderBy('id', 'desc');
+            $grid->quickSearch(['circle_name', 'circle_introduce', 'wxUser.user_name'])->placeholder('搜索圈子名称,介绍,圈主名字...')->width(35);
+            $grid->column('id');
+            $grid->column('owers', env('circle_user_call', '圈主'))->display(function ($v) {
+                if($this->ower['user_avatar'] ?? ''){
+                    return '<img src="' . ($this->ower['user_avatar'] ?? Settings::get('img_default', 'https://img.mini.minisns.cn/icons/dafault.png'))  . '"  style="border-radius:50px;width:30px;" />';
+                }
+                return '';
+            })->width('50px');
+            $grid->column('ower', ' ')->display(function ($v) {
+                if($v && $v['user_name']){
+                    return '<a target="_blank" href="'.admin_url('users?id='.$v['id']).'">'.$v['user_name'].'</a>' ?? '用户已删除';
+                }
+                return '';
+            })->width('100px');
+            $grid->column('circle_name');
+            $grid->column('sort')->editable()->sortable();
+            $grid->column('list_style')->select([0=>'跟随全局', 1=>'列表式', 2=>'瀑布流']);
+            if($__MINI_GLOBAL_TENANT_ID__ === 0){
+                $grid->column('tenant_show', '展示分站&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')->select($this->tenants_arr);
+            }else{
+
+            }
+            $grid->column('circle_introduce')->sortable()->limit(9);
+            $grid->column('head_portrait')->image('','80');
+            $grid->column('background_maps')->image('','80');
+            $grid->column('wxPlate.plate_name')->label('default');
+            $grid->column('is_top_recommend')->switch()->sortable();
+            $grid->column('is_hot')->switch()->sortable();
+            $grid->column('circle_state')->using([0=>'审核中',1=>'审核通过',2=>'驳回'])->label([
+                0=>'red',
+                1=>'green',
+                2=>'default'
+            ])->sortable();
+            $grid->column('created_at')->sortable();
+            $grid->filter(function (Grid\Filter $filter) {
+                $filter->like('circle_name');
+                $filter->equal('circle_state')->select([0=>'审核中',1=>'审核通过',2=>'驳回']);
+            });
+//            $grid->disableCreateButton();
+            // 禁用详情按钮
+//            $grid->disableViewButton();
+//            $grid->disableBatchDelete();
+            $grid->actions(function (Grid\Displayers\Actions $actions) {
+                $actions->append((new CircleAction())->setKey($this->id));
+            });
+
+            $grid->tools([
+                new NavigaterUrlButton('circle_tag', '', '圈子话题')
+            ]);
+
+            if($__MINI_GLOBAL_TENANT_ID__ === 0){
+                $grid->header(function ($collection) {
+                    return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;display: inline-block;margin-top: 20px;">圈子分为<b style="color: red">全站圈子</b>和<b style="color: red">分站圈子</b>。全站圈子:可在所有分站展示,有“仅看本站”的开关,在<b>所有圈子</b>里唯一。分站圈子:仅在某个分站展示,没有“仅看本站”的开关,仅在当前分站唯一</div>';
+                });
+            }
+
+        });
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new WxCircle(), function (Show $show) {
+            $show->field('id');
+            $show->field('list_style');
+            $show->field('tenant_show');
+            $show->field('circle_name');
+            $show->field('circle_introduce');
+            $show->field('head_portrait');
+            $show->field('background_maps');
+            $show->field('plate_id');
+            $show->field('user_id');
+            $show->field('is_top_recommend');
+            $show->field('is_hot');
+            $show->field('circle_state');
+            $show->field('tenant_id');
+            $show->field('created_at');
+            $show->field('updated_at');
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        global $__MINI_GLOBAL_TENANT_ID__;
+        if($this->tenants_arr === null){
+            $tenant_arr_ = [
+                '-1' => '全域'
+            ];
+            if($__MINI_GLOBAL_TENANT_ID__ === 0){
+                $tenant_arr = WxTenant::orderBy('order', 'desc')->pluck('name', 'tenant_id')->toArray();
+            }else{
+                $tenant_arr = WxTenant::where('tenant_id', $__MINI_GLOBAL_TENANT_ID__)->orderBy('order', 'desc')->pluck('name', 'tenant_id')->toArray();
+            }
+            foreach ($tenant_arr as $key => $val){
+                $tenant_arr_[$key.''] = $val;
+            }
+
+            $this->tenants_arr = $tenant_arr_;
+        }
+        return Form::make(new WxCircle(), function (Form $form) {
+            global $__MINI_GLOBAL_TENANT_ID__;
+            $old_circle_name = $form->model()->circle_name;
+            $form->display('id');
+            $form->text('circle_name')->required();
+            $form->number('sort');
+            $form->radio('list_style')->options([0=>'跟随全局', 1=>'列表式', 2=>'瀑布流'])->default(Settings::get('app_circle_list_style', 0, true));
+            if($__MINI_GLOBAL_TENANT_ID__ === 0){
+                $form->select('tenant_show')->options($this->tenants_arr)->default(-1)->required();
+            }
+            $form->text('circle_introduce')->required();
+            $form->image('head_portrait')->url('files/uploads')->uniqueName()->autoUpload()->required();
+            $form->image('background_maps')->help('<a href="https://img.mini.minisns.cn/images/topci/bg.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->required()->default(Settings::get('img_default_circle_bg', ''));
+            $form->select('plate_id')->options(WxPlate::pluck('plate_name', 'id'))->required();
+
+            $form->select('user_id', env('circle_user_call', '圈主'))->options(function ($id) {
+                if($id){
+                    $user = WxUser::find($id);
+                    if ($user) {
+                        return [$user->id => $user->user_name];
+                    }
+                }
+            })->ajax('select/users');
+
+            $form->multipleSelectTable('square_list', '格子菜单')
+                ->title('图标库')
+                ->max(100)
+                ->from(IconRender::make())
+                ->model(WxIcon::class, 'id', 'name', 'selectTable:WxCircleController:circle_square_list')
+                ->help('各个圈子自己额外的格子菜单, <a href="'.admin_url('settings/icons').'" target="_blank">管理图标库>></a><a href="https://doc.minisns.cn/doc/70/" target="_blank" style="color: red;">(ps:如何控制顺序?)&nbsp;</a>')
+                ->saveAsJson();
+
+            $form->switch('is_top_recommend');
+            $form->switch('is_hot');
+            $form->switch('is_publish_admin');
+            $form->radio('is_city_select')->options([0=>'关闭',1=>'开启'])->default(0);
+            $form->radio('is_tenant_select')->help('仅[展示分站为全域]时起作用,也就是只有全站圈子会显示这个按钮,自然也只有全站圈子可以关闭')->options([0=>'关闭',1=>'开启'])->default(0);
+            $form->radio('circle_state')->options([0=>'审核中',1=>'审核通过',2=>'驳回'])->default(1);
+
+            global $__MINI_GLOBAL_TENANT_ID__;
+            if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                $form->text('tenant_id', '本站分应用id')->help('忽略这个配置')->default($__MINI_GLOBAL_TENANT_ID__);
+            }
+
+            $form->saving(function (Form $form){
+                global $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0 && $form->getKey() > 0){
+                    if(\App\Models\Circle\WxCircle::where('id', $form->getKey())->value('tenant_id') != $__MINI_GLOBAL_TENANT_ID__){
+                        return $form->response()->error('权限不足,不可以修改其他分站对象');
+                    }
+                }
+                if($form->input('user_id') > 0){
+                    $form->user_id = (int)($form->input('user_id'));
+                }
+                $form->tenant_id = $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                    $form->deleteInput('tenant_show');
+                }
+                $form->input('square_list', AdminUtils::_multipleSelectTable_order_process('selectTable:WxCircleController:circle_square_list', $form->input('square_list')));
+            });
+
+            $form->saved(function (Form $form){
+                Cache::forget('circle:list:style:'.$form->getKey());
+            });
+
+            $form->deleting(function (Form $form){
+                global $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                    if(\App\Models\Circle\WxCircle::where('id', $form->getKey())->value('tenant_id') != $__MINI_GLOBAL_TENANT_ID__){
+                        return $form->response()->error('权限不足,不可以删除其他分站对象');
+                    }
+                }
+            });
+
+        });
+    }
+
+}

+ 99 - 0
app/Admin/Controllers/Circle/WxCircleTagController.php

@@ -0,0 +1,99 @@
+<?php
+
+namespace App\Admin\Controllers\Circle;
+
+use App\Admin\Repositories\Circle\WxCircleTag;
+use App\Models\Circle\WxCircle;
+use App\Models\Posts\WxTag;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+
+class WxCircleTagController extends AdminController
+{
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        return Grid::make(new WxCircleTag(), function (Grid $grid) {
+//            $grid->column('id')->sortable();
+            $grid->quickSearch(['id', 'circle_id','tag_id'])->placeholder('搜索圈子ID,话题id...')->width(50);
+            $grid->model()->orderBy('times', 'desc');
+            $grid->column('circle_id')->sortable();
+            $grid->column('circle_name', '圈子名称')->display(function ($v){
+                return $v;
+            });
+            $grid->column('tag_id')->sortable();
+            $grid->column('tag_name', '话题名称')->display(function ($v){
+                return $v;
+            });
+            $grid->column('times')->editable()->sortable();
+//            $grid->column('created_at');
+//            $grid->column('updated_at')->sortable();
+
+            $grid->filter(function (Grid\Filter $filter) {
+//                $filter->equal('id');
+                $filter->equal('circle_id')->select(WxCircle::pluck('circle_name', 'id'));
+            });
+            $grid->disableActions();
+        });
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new WxCircleTag(), function (Show $show) {
+            $show->field('id');
+            $show->field('circle_id');
+            $show->field('tag_id');
+            $show->field('times');
+            $show->field('created_at');
+            $show->field('updated_at');
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new WxCircleTag(), function (Form $form) {
+            $form->display('id');
+            $form->select('circle_id')->options(WxCircle::pluck('circle_name', 'id'));
+            $form->select('tag_id', '话题')->options(function ($id) {
+                if(!is_array($id) && $id) {
+                    $tag = WxTag::find($id);
+                    if (!_empty_($tag)) {
+                        return [$tag->id => $tag->tags_name];
+                    }
+                }else{
+                    return null;
+                }
+            })->ajax('select/tags');
+            $form->text('times')->default(1);
+
+            $form->display('created_at');
+            $form->display('updated_at');
+
+            $form->deleting(function (Form $form){
+                global $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                    return $form->response()->error('权限不足,不可以删除其他分站对象');
+                }
+            });
+
+        });
+    }
+}

+ 17 - 0
app/Admin/Controllers/Collecter/CollecterController.php

@@ -0,0 +1,17 @@
+<?php
+namespace App\Admin\Controllers\Collecter;
+
+use Dcat\Admin\Layout\Content;
+use Dcat\Admin\Admin;
+use Illuminate\Routing\Controller;
+
+class CollecterController extends Controller
+{
+    public function index(Content $content)
+    {
+        return $content
+            ->title('Title')
+            ->description('Description')
+            ->body(Admin::view('mini.collecter::index'));
+    }
+}

+ 222 - 0
app/Admin/Controllers/Collecter/MiniCollecterCollectedController.php

@@ -0,0 +1,222 @@
+<?php
+
+namespace App\Admin\Controllers\Collecter;
+
+use App\Admin\Actions\Extensions\CollecterConfigButton;
+use App\Admin\Actions\Extensions\ImportCollectJsonButton;
+use App\Admin\Actions\Grid\BatchCollecterProcessAction;
+use App\Admin\Actions\Grid\BatchCollecterpublishAction;
+use App\Admin\Metrics\Collecter\collectedStatus;
+use App\Models\Circle\WxCircle;
+use App\Models\Collecter\MiniCollecterCollected;
+use App\Models\User\WxUser;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Layout\Content;
+use Dcat\Admin\Layout\Row;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+use App\Admin\Metrics\Users\RobotUsers;
+use Illuminate\Support\Facades\DB;
+
+class MiniCollecterCollectedController extends AdminController
+{
+    public function index(Content $content)
+    {
+        return $content
+            ->header('收集数据')
+            ->description('收集的数据在处理完成之后,你可以手动勾选发布,也可以等程序自动发布(10分站一次)')
+            ->body(function (Row $row) {
+                $row->column(6,new RobotUsers());
+                $row->column(6,new collectedStatus());
+            })
+            ->body($this->grid());
+    }
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        return Grid::make(new MiniCollecterCollected(), function (Grid $grid) {
+
+            $counts = DB::table('wx_user')
+                ->select(
+                    DB::raw('SUM(CASE WHEN is_robot > 0 THEN 1 ELSE 0 END) AS robot_count'),
+                    DB::raw('SUM(CASE WHEN is_robot = 1 THEN 1 ELSE 0 END) AS free_robot_count'),
+                )->first();
+            if($counts){
+                if($counts->robot_count <= 0){
+                    $grid->header(function ($collection) {
+                        return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;display: inline-block;margin-top: 20px;">你还一个机器人都没有呢,无法做任何操作,先去<a href="'.admin_url('users').'">用户管理</a>添加机器人</div>';
+                    });
+                }else if($counts->free_robot_count <= 0){
+                    $grid->header(function ($collection) {
+                        return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;display: inline-block;margin-top: 20px;">可绑定的机器人不足,你可以去<a href="'.admin_url('users').'">用户管理</a>添加机器人, 默认一个机器人账号绑定一个第三方账号,你也可以设置一个机器人账号绑定多个第三方账号</div>';
+                    });
+                }
+            }
+
+
+            $grid->simplePaginate();
+            $grid->quickSearch(['id', 'link','author','title', 'content'])->placeholder('搜索文章ID,标题,内容,作者...')->width(50);
+            $grid->column('id')->sortable();
+            $grid->model()->orderBy('id', 'desc');
+//            $grid->column('post_unique');
+//            $grid->column('author_unique');
+            $grid->column('link')->display(function ($v){
+                return '<a href="'.$v.'" target="_blank">查看</a>';
+            });
+            $grid->column('author');
+            $grid->column('title_or_content', '预览')->display(function ($v){
+                if($this->title){
+                    return $this->title;
+                }
+                if($this->content){
+                    return mb_substr(strip_tags($this->content), 0, 40) . '...';
+                }
+                return '';
+            })->limit(20);
+            $grid->column('imgs')->display(function ($v){
+                return count(json_decode($v, true));
+            });
+            $grid->column('comments')->display(function ($v){
+                if(is_string($v)){
+                    $com_arr = json_decode($v, true);
+                    if($com_arr && is_array($com_arr)){
+                        return count($com_arr);
+                    }
+                }else if(is_array($v)){
+                    return count($v);
+                }
+
+            });
+            $grid->column('tags')->display(function ($v){
+                return count(json_decode($v, true));
+            });
+            $grid->column('musics');
+            $grid->column('videos')->display(function ($v){
+                if(is_string($v)){
+                    return count(json_decode($v, true));
+                }else if(is_array($v)){
+                    return count($v);
+                }
+                return 0;
+            });
+            $grid->column('post_id');
+            $grid->column('status')->using([0 => '待处理', 1 => '待发布', 2 => '已发布', 3 => '处理中', 4 => '处理失败'])->label([
+                0=>'red',
+                1=>'green',
+                2=>'default',
+                3 => 'red',
+                4 => 'darkred'
+            ])->sortable();
+            $grid->column('tenant_id')->editable();
+//            $grid->column('created_at');
+            $grid->column('updated_at')->sortable();
+
+            $grid->filter(function (Grid\Filter $filter) {
+                $filter->equal('id');
+            });
+
+            $grid->tools([
+                new CollecterConfigButton(),
+                new ImportCollectJsonButton()
+            ]);
+
+            $grid->disableCreateButton();
+
+            $grid->batchActions(function ($batch) {
+                $batch->add((new BatchCollecterpublishAction()));
+                $batch->add((new BatchCollecterProcessAction()));
+            });
+
+            $grid->actions(function (Grid\Displayers\Actions $actions) {
+//                $actions->append((new PostCommentLotteryAction())->setKey($this->id));
+            });
+
+        });
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new MiniCollecterCollected(), function (Show $show) {
+            $show->field('id');
+            $show->field('post_unique');
+            $show->field('author_unique');
+            $show->field('link');
+            $show->field('author');
+            $show->field('title');
+            $show->field('content');
+            $show->field('imgs');
+            $show->field('comments');
+            $show->field('tags');
+            $show->field('musics');
+            $show->field('videos');
+            $show->field('post_id');
+            $show->field('circle_id');
+            $show->field('user_id');
+            $show->field('tenant_id');
+            $show->field('status');
+            $show->field('created_at');
+            $show->field('updated_at');
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new MiniCollecterCollected(), function (Form $form) {
+            $form->display('id');
+            $form->text('post_unique');
+            $form->text('author_unique');
+            $form->text('link');
+            $form->text('author');
+            $form->text('title');
+            if(__system_is_model_enable('laradocs', 'dcat-neditor')){
+                $form->neditor('content');
+            }else{
+                $form->editor('content');
+            }
+//            $form->text('imgs');
+//            $form->text('comments');
+//            $form->text('tags');
+//            $form->text('musics');
+//            $form->text('videos');
+            $form->text('post_id');
+            $form->select('circle_id', '发布圈子')->options(WxCircle::pluck('circle_name','id'));
+            $form->select('user_id', '用户')->options(function ($id) {
+                if($id){
+                    $user = \App\Models\User\WxUser::find($id);
+                    if ($user) {
+                        return [$user->id => $user->user_name];
+                    }
+                }
+            })->ajax('select/users');
+//            $form->text('status');
+            $form->text('tenant_id');
+            $form->display('created_at');
+            $form->display('updated_at');
+
+            $form->deleting(function (Form $form){
+                global $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                    return $form->response()->error('权限不足,不可以删除其他分站对象');
+                }
+            });
+
+        });
+    }
+}

+ 75 - 0
app/Admin/Controllers/Collecter/MiniCollecterUserMapController.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace App\Admin\Controllers\Collecter;
+
+use App\Models\Collecter\MiniCollecterUserMap;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+
+class MiniCollecterUserMapController extends AdminController
+{
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        return Grid::make(new MiniCollecterUserMap(), function (Grid $grid) {
+            $grid->column('user_unique')->sortable();
+            $grid->column('user_id')->sortable();
+            $grid->filter(function (Grid\Filter $filter) {
+                $filter->equal('user_unique');
+
+            });
+
+            $grid->disableCreateButton();
+            $grid->disableDeleteButton();
+            $grid->disableBatchActions();
+            $grid->disableActions();
+
+        });
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new MiniCollecterUserMap(), function (Show $show) {
+            $show->field('user_unique');
+            $show->field('user_id');
+            $show->field('user_uniqu1');
+            $show->field('user_uniqu2');
+            $show->disableDeleteButton();
+            $show->disableEditButton();
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new MiniCollecterUserMap(), function (Form $form) {
+            $form->display('user_unique');
+            $form->text('user_id');
+
+            $form->deleting(function (Form $form){
+                global $__MINI_GLOBAL_TENANT_ID__;
+                if($__MINI_GLOBAL_TENANT_ID__ > 0){
+                    return $form->response()->error('权限不足,不可以删除其他分站对象');
+                }
+            });
+
+        });
+    }
+}

+ 84 - 0
app/Admin/Controllers/FileController.php

@@ -0,0 +1,84 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Lib\Uploads\UploadHandler;
+use App\Models\WxAttachment;
+use App\Wen\Utils\ImageUtils;
+use Dcat\Admin\Traits\HasUploadedFile;
+use Illuminate\Http\Request;
+
+
+/**
+ * 后台自定义上传接口
+ */
+class FileController
+{
+    use HasUploadedFile;
+
+    public function handle(Request $request)
+    {
+        // 判断是否是删除文件请求
+        if ($this->isDeleteRequest()) {
+            $disk = $this->disk('local');
+            // 删除文件并响应
+            return $this->deleteFileAndResponse($disk);
+        }
+        $file = $this->file();
+        if(_empty_($file)){
+            $file = $request->file('file');
+        }
+        $result = UploadHandler::handle($file, -1);
+
+//        $filePath = $this->file();
+//        $storePath = date('Y/m/d',time());
+//        $disk = config('admin.upload.disk');
+//        $path = $filePath->store($storePath,$disk);
+//        $domain = config('filesystems.disks.'.$disk.'.domains.https');
+//        if (_empty_($model)) {
+//            $model = new WxAttachment();
+//            $model->path = $path;
+//            $result = $model->save();
+//        }
+
+
+        return $result
+            ? ['data'=>[
+                'id'=>$result['url'],
+                'name'=>$result['name'],
+                'path'=>$result['path'],
+                'url'=>$result['url']
+            ],'status'=>true]
+            : $this->responseErrorMessage('文件上传失败');
+    }
+
+    public function batch_download(Request $request){
+        $images = $request->images;
+        $result = [
+            'status' => false,
+            'list' => [],
+            'responseText' => ''
+        ];
+        if(_empty_($images)){
+            return $result;
+        }
+        foreach ($images as $url){
+            $obj = [
+              'source' => $url,
+                'url' => '',
+                'status' => false,
+            ];
+            $path = ImageUtils::upload_url_img($url,  '', [], [], true, 1, 1, 3);
+            if($path){
+                if($result['status'] == false){
+                    $result['status'] = true;
+                }
+                $obj['url'] = $path['url'];
+                $obj['status'] = true;
+            }
+            $result['list'][] = $obj;
+        }
+        return $result;
+    }
+
+}

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio