Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
asundust authored Aug 10, 2022
1 parent 1e85838 commit 77e371c
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ composer require asundust/dcat-wechat-work-push
企业微信消息推送
└用户配置
```
- `用户配置`的表名默认为`wechat_work_push_users`,目前不可更改
- `用户配置`的表名默认为`dcat_wechat_work_push_users`,目前不可更改
- 默认中间件组为`web`,目前不可更改
- 目前不支持多语言,后期可以考虑增加

Expand Down
8 changes: 4 additions & 4 deletions src/Http/Actions/SendTestMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Asundust\DcatWechatWorkPush\Http\Actions;

use Asundust\DcatWechatWorkPush\DcatWechatWorkPushServiceProvider;
use Asundust\DcatWechatWorkPush\Http\Traits\WechatWorkPushSendMessageTrait;
use Asundust\DcatWechatWorkPush\Models\WechatWorkPushUser;
use Asundust\DcatWechatWorkPush\Http\Traits\DcatWechatWorkPushSendMessageTrait;
use Asundust\DcatWechatWorkPush\Models\DcatWechatWorkPushUser;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;

class SendTestMessage extends RowAction
{
use WechatWorkPushSendMessageTrait;
use DcatWechatWorkPushSendMessageTrait;

/**
* 标题.
Expand All @@ -31,7 +31,7 @@ public function title()
public function handle(Request $request)
{
$id = $this->getKey();
$user = WechatWorkPushUser::find($id);
$user = DcatWechatWorkPushUser::find($id);
if ($user->is_own_wechat_work) {
$config = [
'corp_id' => $user->corp_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace Asundust\DcatWechatWorkPush\Http\Controllers;

use Asundust\DcatWechatWorkPush\DcatWechatWorkPushServiceProvider;
use Asundust\DcatWechatWorkPush\Http\Traits\WechatWorkPushSendMessageTrait;
use Asundust\DcatWechatWorkPush\Models\WechatWorkPushUser;
use Asundust\DcatWechatWorkPush\Http\Traits\DcatWechatWorkPushSendMessageTrait;
use Asundust\DcatWechatWorkPush\Models\DcatWechatWorkPushUser;
use Dcat\Admin\Http\Controllers\AdminController;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
use Illuminate\Http\Request;

class WechatWorkPushHandleController extends AdminController
class DcatWechatWorkPushHandleController extends AdminController
{
use WechatWorkPushSendMessageTrait;
use DcatWechatWorkPushSendMessageTrait;

/**
* @param $secret
Expand All @@ -30,7 +30,7 @@ public function push($secret, Request $request): array
return ['code' => 1, 'message' => '消息标题为空'];
}

$user = WechatWorkPushUser::where('sc_secret', $secret)
$user = DcatWechatWorkPushUser::where('sc_secret', $secret)
->where('status', 1)
->first();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Asundust\DcatWechatWorkPush\Http\Controllers;

use Asundust\DcatWechatWorkPush\Http\Actions\SendTestMessage;
use Asundust\DcatWechatWorkPush\Models\WechatWorkPushUser;
use Asundust\DcatWechatWorkPush\Models\DcatWechatWorkPushUser;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\Displayers\Actions;
Expand All @@ -12,7 +12,7 @@
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str;

class WechatWorkPushUserController extends AdminController
class DcatWechatWorkPushUserController extends AdminController
{
/**
* Title for current resource.
Expand All @@ -28,15 +28,15 @@ class WechatWorkPushUserController extends AdminController
*/
protected function grid()
{
$grid = new Grid(new WechatWorkPushUser());
$grid = new Grid(new DcatWechatWorkPushUser());

$grid->column('id', '序号');
$grid->column('name', '推送账号')->copyable();
$grid->column('sc_secret', '推送密钥')->display(function ($scSecret) {
return '<a href="javascript:void(0);" class="grid-column-copyable text-muted" data-content="'.$scSecret.'" title="" data-placement="bottom" data-original-title="已复制!"><i class="fa fa-copy"></i></a>&nbsp;***';
});
$grid->column('api_address', '推送Api地址')->display(function () {
/* @var WechatWorkPushUser $this */
/* @var DcatWechatWorkPushUser $this */
$apiAddressShow = $this->api_address_show;
$apiAddress = $this->api_address;

Expand All @@ -53,7 +53,7 @@ protected function grid()

$grid->filter(function (Filter $filter) {
$filter->equal('status', '账号状态')
->radio(array_merge(['' => '全部'], WechatWorkPushUser::STATES));
->radio(array_merge(['' => '全部'], DcatWechatWorkPushUser::STATES));
$filter->equal('id', '序号');
$filter->like('name', '推送账号');
$filter->where('user_self_config', function (Builder $builder) {
Expand All @@ -70,7 +70,7 @@ protected function grid()
break;
}
}, '自定企业微信')
->radio(array_merge(['' => '全部'], WechatWorkPushUser::IS_OWN_WECHAT_WORK));
->radio(array_merge(['' => '全部'], DcatWechatWorkPushUser::IS_OWN_WECHAT_WORK));
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '创建时间')->datetime();
});
Expand All @@ -92,7 +92,7 @@ protected function grid()
*/
protected function form()
{
$form = new Form(new WechatWorkPushUser());
$form = new Form(new DcatWechatWorkPushUser());

$form->text('name', '推送账号')
->rules('required')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Asundust\DcatWechatWorkPush\DcatWechatWorkPushServiceProvider;

/**
* Trait WechatWorkPushSendMessageTrait.
* Trait DcatWechatWorkPushSendMessageTrait.
*/
trait WechatWorkPushSendMessageTrait
trait DcatWechatWorkPushSendMessageTrait
{
/**
* 使用自定配置发送消息.
Expand Down
4 changes: 2 additions & 2 deletions src/Http/push.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

use Asundust\DcatWechatWorkPush\Http\Controllers\WechatWorkPushHandleController;
use Asundust\DcatWechatWorkPush\Http\Controllers\DcatWechatWorkPushHandleController;

Route::match(['get', 'post'], 'push/{secret}', WechatWorkPushHandleController::class.'@push');
Route::match(['get', 'post'], 'push/{secret}', DcatWechatWorkPushHandleController::class.'@push');
4 changes: 2 additions & 2 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Asundust\DcatWechatWorkPush\Http\Controllers\WechatWorkPushUserController;
use Asundust\DcatWechatWorkPush\Http\Controllers\DcatWechatWorkPushUserController;
use Illuminate\Support\Facades\Route;

Route::resource('wechatWorkPushUsers', WechatWorkPushUserController::class)->except(['show']);
Route::resource('wechatWorkPushUsers', DcatWechatWorkPushUserController::class)->except(['show']);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Support\Carbon;

/**
* Asundust\DcatWechatWorkPush\Models\WechatWorkPushUser.
* Asundust\DcatWechatWorkPush\Models\DcatWechatWorkPushUser.
*
* @property int $id
* @property string $name 用户的账户
Expand All @@ -23,7 +23,7 @@
* @property Carbon|null $updated_at
* @mixin Eloquent
*/
class WechatWorkPushUser extends Model
class DcatWechatWorkPushUser extends Model
{
protected $fillable = ['name', 'sc_secret', 'status', 'corp_id', 'agent_id', 'secret'];

Expand Down Expand Up @@ -53,7 +53,7 @@ public function __construct($attributes = [])

$this->setConnection(config('admin.database.connection') ?: config('database.default'));

$this->setTable(config('admin.extensions.wechat-work-push.user_table', 'wechat_work_push_users'));
$this->setTable('dcat_wechat_work_push_users');
}

// is_own_wechat_work
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWechatWorkPushUsersTable extends Migration
class CreateDcatWechatWorkPushUsersTable extends Migration
{
/**
* @return \Illuminate\Config\Repository|\Illuminate\Contracts\Foundation\Application|mixed|string|null
Expand All @@ -21,7 +21,7 @@ public function getConnection()
*/
public function up()
{
$table = 'wechat_work_push_users';
$table = 'dcat_wechat_work_push_users';
Schema::create($table, function (Blueprint $table) {
$table->increments('id');
$table->string('name')->index()->comment('用户的账户');
Expand All @@ -41,7 +41,7 @@ public function up()
*/
public function down()
{
$table = 'wechat_work_push_users';
$table = 'dcat_wechat_work_push_users';
Schema::dropIfExists($table);
}
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
return [
'1.0.0' => [
'第一个版本',
'2021_02_09_084348_create_wechat_work_push_users_table.php',
'2021_02_09_084348_create_dcat_wechat_work_push_users_table.php',
],
];

0 comments on commit 77e371c

Please sign in to comment.