Commit 2e996b01 2e996b01b85bfbde41a09a251b212c97b7d0cdd2 by 杨俊

fix(develop): Init

1 parent bd6a9388
......@@ -35,21 +35,8 @@ MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
JPUSH_KEY=860a3d4ecfaf3c38eb539c4e
JPUSH_SECRET=df208c0eb485ed3ab3b18ff2
IM_KEY=
IM_SECRET=
WECHAT_OFFICIAL_ACCOUNT_APPID=
WECHAT_OFFICIAL_ACCOUNT_SECRET=
WECHAT_OFFICIAL_ACCOUNT_TOKEN=
WECHAT_OFFICIAL_ACCOUNT_AES_KEY=
WECHAT_MINI_APP_APPID=
WECHAT_MINI_APP_SECRET=
WECHAT_MINI_APP_TOKEN=
WECHAT_MINI_APP_AES_KEY=
OCTANE_SERVER=swoole
OCTANE_HTTPS=true
......
<?php
namespace App\Channels;
use App\Models\User;
use Illuminate\Notifications\Notification;
class JPushNotificationChannel
{
public function send(User $notifiable, Notification $notification): void
{
// @phpstan-ignore-next-line
$notification->toJPush($notifiable);
}
}
<?php
namespace App\Channels;
use App\Models\User;
use Illuminate\Notifications\Notification;
class WechatNotificationChannel
{
public function send(User $notifiable, Notification $notification): void
{
// @phpstan-ignore-next-line
$notification->toWechat($notifiable);
}
}
......@@ -6,8 +6,6 @@
use App\Helpers\OperationLog;
use App\Http\Container\AdminSection\Requests\User\CertifyUpdateRequest;
use App\Http\Service\UserService;
use App\Jobs\UserSingerLimitJob;
use App\Models\User;
use App\Models\UserCertify;
use App\Models\Views\UserLastCertify;
use App\Notifications\UserCertifyFailNotification;
......@@ -79,15 +77,6 @@ public function update(CertifyUpdateRequest $request, UserCertify $certify): Res
};
} catch (SingerLimitException $exception) {
DB::rollBack();
$master = User::query()->find($exception->masterId, ['id', 'nick_name']);
UserSingerLimitJob::dispatch([
'title' => sprintf('%s:歌手额度已满', $master?->getAttribute('nick_name')),
'content' => sprintf('审核歌手认证:%s', $user->getAttribute('nick_name'))
], [
'title' => sprintf('%s:同意歌手加入', $master->getAttribute('nick_name')),
'content' => sprintf('歌手:%s', $user->getAttribute('nick_name')),
'limit' => $exception->maxSingerNum
]);
return $this->fail(ApiCode::VALIDATION_ERROR, '团队内歌手名额已满');
} catch (RuntimeException $exception) {
......
......@@ -12,7 +12,6 @@
use App\Http\Request\BooleanStatusRequest;
use App\Http\Request\UserChangePwdRequest;
use App\Http\Service\UserService;
use App\Jobs\UserSingerLimitJob;
use App\Jobs\UserSyncIMJob;
use App\Models\Activity;
use App\Models\GroupHasMember;
......@@ -127,15 +126,6 @@ public function update(UserUpdateRequest $request, User $user): Response
return $this->successWithData($user->load(['authTags:id,name', 'roles:id,name', 'projects:id,name']), ApiCode::UPDATE_SUCCESS);
} catch (SingerLimitException $exception) {
DB::rollBack();
$master = User::query()->find($exception->masterId, ['id', 'nick_name']);
UserSingerLimitJob::dispatch([
'title' => sprintf('%s:歌手额度已满', $master?->getAttribute('nick_name')),
'content' => sprintf('编辑歌手信息:%s', $user->getAttribute('nick_name'))
], [
'title' => sprintf('%s:编辑成员信息', $user->getAttribute('nick_name')),
'content' => sprintf('经纪人:%s', $master->getAttribute('nick_name')),
'limit' => $exception->maxSingerNum
]);
return $this->fail(ApiCode::VALIDATION_ERROR, '团队内歌手名额已满');
} catch (RuntimeException $exception) {
DB::rollBack();
......
......@@ -12,7 +12,6 @@
use App\Http\Service\GroupDataService;
use App\Http\Service\GroupInviteService;
use App\Http\Service\UserService;
use App\Jobs\UserSingerLimitJob;
use App\Models\Activity;
use App\Models\ActivityUser;
use App\Models\GroupHasMember;
......@@ -190,15 +189,7 @@ public function gropuInvite(GroupInviteRequest $request)
}
//判断歌手额度
$maxSingerNum = User::query()->whereKey($invite_id)->value('business_singer_limit');
if ($is_singer_tag and $singer_tag_count >= $maxSingerNum) {
UserSingerLimitJob::dispatch([
'title' => $title1,
'content' => $content1
], [
'title' => $title2,
'content' => $content2,
'limit' => $maxSingerNum
]);
if ($is_singer_tag && $singer_tag_count >= $maxSingerNum) {
return JsonResource::fail(JsonResource::TEAM_INVITE_SINGER_LIMIT, code: 403);
}
......@@ -295,14 +286,6 @@ public function handleInvite(HandleInviteRequest $request, GroupInviteService $g
$maxSingerNum = User::query()->whereKey($invite_id)->value('business_singer_limit');
if ($is_singer_tag and $singer_tag_count >= $maxSingerNum) {
GroupInvite::query()->where(['invite_id' => $invite_id, 'user_id' => $member_id, 'type' => $type, 'status' => 1])->update(['status' => 4]);
UserSingerLimitJob::dispatch([
'title' => $title1,
'content' => $content1
], [
'title' => $title2,
'content' => $content2,
'limit' => $maxSingerNum
]);
return JsonResource::fail(JsonResource::TEAM_JOIN_SINGER_LIMIT, code: 403);
}
}
......
......@@ -11,7 +11,6 @@
use App\Http\Container\AppSection\Requests\UserAuthExamineRequests;
use App\Http\Service\UserService;
use App\Jobs\UserApplyCertifyJob;
use App\Jobs\UserSingerLimitJob;
use App\Models\GroupHasMember;
use App\Models\SystemTag;
use App\Models\User;
......@@ -53,15 +52,6 @@ public function story(UserAuthCreateRequest $request)
if ($masterId) {
$maxSingerNum = User::query()->whereKey($masterId)->value('business_singer_limit');
if ($is_singer_tag && $singer_tag_count >= $maxSingerNum) {
$master = User::query()->find($masterId, ['id', 'nick_name']);
UserSingerLimitJob::dispatch([
'title' => sprintf('%s:歌手额度已满', $master?->getAttribute('nick_name')),
'content' => sprintf('%s:提交歌手认证', $user?->getAttribute('nick_name'))
], [
'title' => sprintf('%s:提交歌手认证', $user?->getAttribute('nick_name')),
'content' => sprintf('经纪人:%s', $master->getAttribute('nick_name')),
'limit' => $maxSingerNum
]);
return JsonResource::fail(JsonResource::TEAM_INVITE_SINGER_LIMIT, code: 403);
}
}
......@@ -144,15 +134,6 @@ public function examine(UserAuthExamineRequests $request)
return JsonResource::success(JsonResource::UPDATE_SUCCESS);
} catch (SingerLimitException $exception) {
DB::rollBack();
$master = User::query()->find($exception->masterId, ['id', 'nick_name']);
UserSingerLimitJob::dispatch([
'title' => sprintf('%s:歌手额度已满', $master?->getAttribute('nick_name')),
'content' => sprintf('审核歌手认证:%s', $user->getAttribute('nick_name'))
], [
'title' => sprintf('%s:审核歌手认证', $user->getAttribute('nick_name')),
'content' => sprintf('经纪人:%s', $master->getAttribute('nick_name')),
'limit' => $exception->maxSingerNum
]);
return JsonResource::fail(JsonResource::TEAM_INVITE_SINGER_LIMIT, code: 403);
......
<?php
namespace App\Jobs;
use App\Enums\UserOfficialStatusEnum;
use App\Models\SystemConfig;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Arr;
class UserSingerLimitJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public array $jPushMessage;
public array $wechatMessage;
public int $defaultLimit;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(array $jPushMessage, array $wechatMessage)
{
$this->jPushMessage = $jPushMessage;
$this->wechatMessage = $wechatMessage;
$this->defaultLimit = SystemConfig::query()->where('identifier', 'svMC9TNFz2Acx8ccPdAIH')->value('content') ?? 3;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(): void
{
}
}
......@@ -49,16 +49,4 @@ public function via(mixed $notifiable): array
}
private function getProjectName(): string
{
return Arr::get($this->activity, 'project.name', '');
}
/**
* @return bool
*/
private function hasProject(): bool
{
return !empty($this->getProjectName());
}
}
......
......@@ -42,17 +42,4 @@ public function via(mixed $notifiable): array
{
return [];
}
private function getProjectName(): string
{
return Arr::get($this->activity, 'project.name', '');
}
/**
* @return bool
*/
private function hasProject(): bool
{
return !empty($this->getProjectName());
}
}
......
......@@ -35,17 +35,4 @@ public function via(mixed $notifiable): array
{
return [];
}
private function getProjectName(): string
{
return Arr::get($this->activity, 'project.name', '');
}
/**
* @return bool
*/
private function hasProject(): bool
{
return !empty($this->getProjectName());
}
}
......
......@@ -53,12 +53,4 @@ public function via(mixed $notifiable): array
{
return [];
}
/**
* @return string
*/
protected function formatChangeLabel(): string
{
return collect($this->change)->map(fn($item) => sprintf('[%s]', $item))->join('、');
}
}
......
......@@ -2,9 +2,7 @@
namespace App\Providers;
use App\Channels\JPushNotificationChannel;
use App\Channels\SmsNotificationChannel;
use App\Channels\WechatNotificationChannel;
use App\Support\Model;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Support\Facades\DB;
......@@ -22,8 +20,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function register(): void
{
Notification::extend('wechat', static fn() => new WechatNotificationChannel);
Notification::extend('jPush', static fn() => new JPushNotificationChannel);
Notification::extend('sms', static fn() => new SmsNotificationChannel);
if (!$this->app->isProduction()) {
......
......@@ -25,7 +25,6 @@
"hikoon/laravel-api": "0.1.4.9",
"hikoon/laravel-jwt": "^0.1.3",
"inertiajs/inertia-laravel": "^0.6.11",
"jpush/jpush": "^3.6",
"laravel/framework": "^9.52.4",
"laravel/horizon": "^5.19",
"laravel/octane": "^1.3",
......@@ -33,7 +32,6 @@
"laravel/tinker": "^2.7",
"lorisleiva/laravel-actions": "^2.7",
"overtrue/laravel-easy-sms": "^2.1",
"overtrue/laravel-wechat": "^7.1",
"pbmedia/laravel-ffmpeg": "^8.3",
"tencent/tls-sig-api-v2": "^1.1",
"torann/geoip": "^3.0",
......
......@@ -213,8 +213,7 @@
*/
'aliases' => Facade::defaultAliases()->merge([
'EasyWeChat' => Overtrue\LaravelWeChat\EasyWeChat::class,
'GeoIP' => \Torann\GeoIP\Facades\GeoIP::class,
'GeoIP' => \Torann\GeoIP\Facades\GeoIP::class,
// 'ExampleClass' => App\Example\ExampleClass::class,
])->toArray(),
......
<?php
return [
/*
* 默认配置,将会合并到各模块中
*/
'defaults' => [
'http' => [
'timeout' => 5.0,
],
],
/*
* 公众号
*/
'official_account' => [
'default' => [
'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID', ''), // AppID
'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', ''), // AppSecret
'token' => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', ''), // Token
'aes_key' => env('WECHAT_OFFICIAL_ACCOUNT_AES_KEY', ''), // EncodingAESKey
/*
* OAuth 配置
*
* scopes:公众平台(snsapi_userinfo / snsapi_base),开放平台:snsapi_login
* callback:OAuth授权完成后的回调页地址(如果使用中间件,则随便填写。。。)
* enforce_https:是否强制使用 HTTPS 跳转
*/
// 'oauth' => [
// 'scopes' => array_map('trim', explode(',', env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_SCOPES', 'snsapi_userinfo'))),
// 'callback' => env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_CALLBACK', '/examples/oauth_callback.php'),
// 'enforce_https' => true,
// ],
/**
* 接口请求相关配置,超时时间等,具体可用参数请参考:
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
*/
'http' => [
'timeout' => 5.0,
'base_uri' => 'https://api.weixin.qq.com/',
],
],
],
/*
* 开放平台第三方平台
*/
// 'open_platform' => [
// 'default' => [
// 'app_id' => env('WECHAT_OPEN_PLATFORM_APPID', ''),
// 'secret' => env('WECHAT_OPEN_PLATFORM_SECRET', ''),
// 'token' => env('WECHAT_OPEN_PLATFORM_TOKEN', ''),
// 'aes_key' => env('WECHAT_OPEN_PLATFORM_AES_KEY', ''),
/**
* 接口请求相关配置,超时时间等,具体可用参数请参考:
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
*/
// 'http' => [
// 'timeout' => 5.0,
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
// 'base_uri' => 'https://api.weixin.qq.com/',
// ],
// ],
// ],
/*
* 小程序
*/
'mini_app' => [
'default' => [
'app_id' => env('WECHAT_MINI_APP_APPID', ''),
'secret' => env('WECHAT_MINI_APP_SECRET', ''),
'token' => env('WECHAT_MINI_APP_TOKEN', ''),
'aes_key' => env('WECHAT_MINI_APP_AES_KEY', ''),
/**
* 接口请求相关配置,超时时间等,具体可用参数请参考:
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
*/
'http' => [
'timeout' => 5.0,
'base_uri' => 'https://api.weixin.qq.com/',
],
],
],
/*
* 微信支付
*/
// 'pay' => [
// 'default' => [
// 'app_id' => env('WECHAT_PAY_APPID', ''),
// 'mch_id' => env('WECHAT_PAY_MCH_ID', 'your-mch-id'),
// 'private_key' => '/data/private/certs/apiclient_key.pem',
// 'certificate' => '/data/private/certs/apiclient_cert.pem',
// 'notify_url' => 'http://example.com/payments/wechat-notify', // 默认支付结果通知地址
// /**
// * 证书序列号,可通过命令从证书获取:
// * `openssl x509 -in application_cert.pem -noout -serial`
// */
// 'certificate_serial_no' => '6F2BADBE1738B07EE45C6A85C5F86EE343CAABC3',
//
// 'http' => [
// 'base_uri' => 'https://api.mch.weixin.qq.com/',
// ],
//
// // v2 API 秘钥
// //'v2_secret_key' => '26db3e15cfedb44abfbb5fe94fxxxxx',
//
// // v3 API 秘钥
// //'secret_key' => '43A03299A3C3FED3D8CE7B820Fxxxxx',
//
// // 注意 此处为微信支付平台证书 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/wechatpay5_1.shtml
// 'platform_certs' => [
// '/data/private/certs/platform_key.pem',
// ],
// ],
// ],
/*
* 企业微信
*/
// 'work' => [
// 'default' => [
// 'corp_id' => env('WECHAT_WORK_CORP_ID', ''),
// 'secret' => env('WECHAT_WORK_SECRET', ''),
// 'token' => env('WECHAT_WORK_TOKEN', ''),
// 'aes_key' => env('WECHAT_WORK_AES_KEY', ''),
/**
* 接口请求相关配置,超时时间等,具体可用参数请参考:
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
*/
// 'http' => [
// 'timeout' => 5.0,
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
// 'base_uri' => 'https://api.weixin.qq.com/',
// ],
// ],
// ],
/*
* 企业微信开放平台
*/
// 'open_work' => [
// 'default' => [
// 'corp_id' => env('WECHAT_OPEN_WORK_CORP_ID', ''),
// 'provider_secret' => env('WECHAT_OPEN_WORK_SECRET', ''),
// 'token' => env('WECHAT_OPEN_WORK_TOKEN', ''),
// 'aes_key' => env('WECHAT_OPEN_WORK_AES_KEY', ''),
/**
* 接口请求相关配置,超时时间等,具体可用参数请参考:
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
*/
// 'http' => [
// 'timeout' => 5.0,
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
// 'base_uri' => 'https://api.weixin.qq.com/',
// ],
// ],
// ],
];
......@@ -117,18 +117,6 @@
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'wechat' => [
'driver' => 'daily',
'path' => storage_path('logs/wechat.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 7,
],
'jpush' => [
'driver' => 'daily',
'path' => storage_path('logs/jpush.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 7,
],
'im' => [
'driver' => 'daily',
'path' => storage_path('logs/im.log'),
......
......@@ -37,12 +37,6 @@
'secret' => env('IM_SECRET', ''),
'prefix' => env('IM_PREFIX', ''),
],
'jpush' => [
'key' => env('JPUSH_KEY', ''),
'secret' => env('JPUSH_SECRET', ''),
'apns_production' => env('JPUSH_APNS_PRODUCTION', false),
'prefix' => env('JPUSH_PREFIX', '')
],
'easy-sms' => [
'timeout' => 5.0,
'default' => [
......