diff --git a/admin/src/router/apiRouter.ts b/admin/src/router/apiRouter.ts
index c83abbc..d087b0f 100644
--- a/admin/src/router/apiRouter.ts
+++ b/admin/src/router/apiRouter.ts
@@ -122,14 +122,6 @@ const apiRouter: IMenu[] = [
title: '会员管理'
}
},
- {
- path: '/super/vipSetMeal',
- name: 'vipSetMeal',
- component: '/super/vipSetMeal/index',
- meta: {
- title: 'vip套餐'
- }
- },
]
},
{
@@ -169,14 +161,6 @@ const apiRouter: IMenu[] = [
meta: {
title: '域名管理'
}
- },
- {
- path: '/super/payRecord',
- name: 'payRecord',
- component: '/super/payRecord/index',
- meta: {
- title: '付款记录'
- }
}
]
},
diff --git a/admin/src/views/agent/invite.vue b/admin/src/views/agent/invite.vue
index 19caef7..147820f 100644
--- a/admin/src/views/agent/invite.vue
+++ b/admin/src/views/agent/invite.vue
@@ -25,7 +25,6 @@ const { state, sizeChangeHandle, currentChangeHandle } = useCurd({
>
-
diff --git a/admin/src/views/home/admin-home.vue b/admin/src/views/home/admin-home.vue
index 7f95f1b..762ee72 100644
--- a/admin/src/views/home/admin-home.vue
+++ b/admin/src/views/home/admin-home.vue
@@ -71,9 +71,8 @@ const getHomeData = async (type: any) => {
member_count: res.member_count,
agent_count: res.agent_count,
user_count: res.user_count,
- pay_vip: res.pay_vip,
- pay_agent: res.pay_agent,
- pay_count: res.pay_count,
+ card_count: res.card_count,
+ uv_count: res.uv_count,
}
// 用户增长趋势
if (res.user_growth.length > 0) {
@@ -116,24 +115,24 @@ onMounted(() => {
-
+
-
支付会员数
+
卡片数量
- {{ dataValue?.pay_count || 0 }}
- 人
+ {{ dataValue?.card_count || 0}}
+ 个
-
+
-
购买会员收入
+
UV次数
- {{ dataValue?.pay_vip }}
- 元
+ {{ dataValue?.uv_count || 0}}
+ 次

diff --git a/admin/src/views/home/components/BuyVip.vue b/admin/src/views/home/components/BuyVip.vue
deleted file mode 100644
index 65d754e..0000000
--- a/admin/src/views/home/components/BuyVip.vue
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
- | 权益/版本 |
-
- {{ item.name }}
- ¥{{ item.price }}/月
- |
-
-
-
-
- | 每月访问数量(UV)上限 |
-
- {{ data_get(item, 'config.uv_limit') }}
- |
-
-
- | 链接创建数量上限(同时) |
-
- {{ data_get(item, 'config.count_limit') }}条
- |
-
-
- | 自建小程序池可创建数量 |
-
- {{ data_get(item, 'config.min_count_limit') }}/个
- |
-
-
- | 链接保留时长 |
-
- 永久
- |
-
-
- | 支持的类型 |
-
- 草料二维码
- 金山文档
- 企业微信
- 微信二维码
- 自定义小程序
- |
-
-
- | 官方小程序池使用 |
-
- 支持
- 不支持
- |
-
-
- | 数据统计/分析 |
-
- 支持
- |
-
-
- | 自定义落地页 |
-
- 支持
- 不支持
- |
-
-
- | 自建小程序池下架自动检测 |
-
- 支持
- 不支持
- |
-
-
- | 免费技术协助 |
-
- 支持
- |
-
-
- |
-
-
- 立即开通/续费
-
- 免费
- |
-
-
-
-
-
-
diff --git a/admin/src/views/home/home.vue b/admin/src/views/home/home.vue
index 41b23ab..3049852 100644
--- a/admin/src/views/home/home.vue
+++ b/admin/src/views/home/home.vue
@@ -5,7 +5,6 @@ import { userStore } from '@/stores'
import ChangePassword from '@/views/home/components/ChangePassword.vue'
import Welcome from '@/views/home/components/Welcome.vue'
import { data_get, setClipboard } from '@/utils'
-import BuyVip from '@/views/home/components/BuyVip.vue'
import { getNotify } from '@/api/super'
// 获取概况数据
const dataList = ref
({})
@@ -25,13 +24,7 @@ const copyCode = () => {
var path = window.location.pathname
setClipboard(root + path + '#/register?code=' + code)
}
-const success = ref(false)
-// 开通会员
-const buyVipVisible = ref(false)
-const tiyan = () => {
- success.value = false
- localStorage.removeItem('register')
-}
+
const notify = ref({} as any)
const noticeShow = ref(false)
onMounted(() => {
@@ -43,21 +36,15 @@ onMounted(() => {
noticeShow.value = true
}
})
- if (localStorage.getItem('register')) {
- success.value = true
- }
})
-
-
-
-
-
+
+
-
+
@@ -69,23 +56,17 @@ onMounted(() => {
-
本月链接访问UV
+
链接访问UV
{{ dataList.used_uv ?? 0 }}
-
已使用UV次数
+
总UV次数
- {{ data_get(userStore.userInfo, 'vip_package.config.uv_limit', 0) }}
+ {{ dataList.month_uv ?? 0 }}
-
会员套餐UV次数
-
-
-
- {{ data_get(userStore.userInfo, 'vip_package.config.uv_limit', 0) - (dataList.used_uv ?? 0) }}
-
-
剩余可访问UV次数
+
本月UV次数
@@ -95,20 +76,14 @@ onMounted(() => {
已创建数量
-
{{ data_get(userStore.userInfo, 'link_total', 0) }}
-
总链接
+
{{ data_get(userStore.userInfo, 'link_created', 0) }}
+
卡片数量
- {{ data_get(userStore.userInfo, 'link_created', 0) }}
+ {{ data_get(userStore.userInfo, 'link_expire', 0) }}
-
已创建
-
-
-
- {{ data_get(userStore.userInfo, 'link_amount', 0) }}
-
-
未创建
+
到期卡片
@@ -118,40 +93,6 @@ onMounted(() => {
-
-
-
-

-
会员信息
-
-
- {{
- userStore.userInfo.site_name
- }}作为一款私域引流工具,凭借其强大的功能和灵活的应用场景,成为了推广营销领域的热门选择,它支持从抖音直接跳转到个人微信、微信群、小程序以及企业微信客服,有效打通了不同平台之间的壁垒,实现了流量的高效转化和利用,推广营销必备!
-
-
-
引流平台功能:
-

-

-
-
- 当前会员套餐:
- {{ data_get(userStore.userInfo, 'vip_package.name', '未开通会员') }}
-
-
- 会员到期日期:
- {{ userStore.userInfo.end_at }}
-
-
-
- 开通会员/续费会员
-
-
-
-
-
-
-
@@ -173,35 +114,6 @@ onMounted(() => {
-
-
-
-
-

-
会员订单记录
-
-
-
-
-
- 微信
-
-
-
-
-
-
-
@@ -212,20 +124,6 @@ onMounted(() => {
-
-
-
-
注册成功
- 恭喜您获得1天体验会员,100uv访问量
-
-
-

-
-
-
- 立即体验
-
-
diff --git a/admin/src/views/newAgent/Invitation.vue b/admin/src/views/newAgent/Invitation.vue
index 1ae92c6..3b54320 100644
--- a/admin/src/views/newAgent/Invitation.vue
+++ b/admin/src/views/newAgent/Invitation.vue
@@ -14,7 +14,7 @@
:row-key="state.primaryKey"
>
-
+
diff --git a/admin/src/views/super/agents/index.vue b/admin/src/views/super/agents/index.vue
index 5db3791..3bdf620 100644
--- a/admin/src/views/super/agents/index.vue
+++ b/admin/src/views/super/agents/index.vue
@@ -99,15 +99,6 @@ const commissionShow = (user_id: any) => {
>
-
-
diff --git a/admin/src/views/super/payRecord/index.vue b/admin/src/views/super/payRecord/index.vue
deleted file mode 100644
index be3db0a..0000000
--- a/admin/src/views/super/payRecord/index.vue
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- 已下单
- 已支付
- 已取消
-
-
-
-
-
- {{ state.meta && state.meta['agent'][row.attach.agent_id] }}
-
-
- {{ state.meta && state.meta['vip'][row.attach.vip_id] }}
-
- 充值积分
-
-
-
-
-
-
- {{ row.payer.username }}
- {{ row.attach.username }}
-
-
-
-
- 会员
- 代理
- 管理员
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/admin/src/views/super/setting/components/pay.vue b/admin/src/views/super/setting/components/pay.vue
deleted file mode 100644
index 25055c2..0000000
--- a/admin/src/views/super/setting/components/pay.vue
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/admin/src/views/super/setting/components/sales.vue b/admin/src/views/super/setting/components/sales.vue
deleted file mode 100644
index 2ff497b..0000000
--- a/admin/src/views/super/setting/components/sales.vue
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/admin/src/views/super/setting/setting.vue b/admin/src/views/super/setting/setting.vue
index a74d72e..8731a36 100644
--- a/admin/src/views/super/setting/setting.vue
+++ b/admin/src/views/super/setting/setting.vue
@@ -4,8 +4,6 @@ import { ApiGetSetALL } from '@/api/comment'
import Web from '@/views/super/setting/components/web.vue'
import CodeSetUp from '@/views/super/setting/components/codeSetUp.vue'
-import Pay from '@/views/super/setting/components/pay.vue'
-import Sales from '@/views/super/setting/components/sales.vue'
const formData = ref({})
@@ -27,12 +25,6 @@ const tab = ref('web')
-
-
-
-
-
-
diff --git a/admin/src/views/super/users/index.vue b/admin/src/views/super/users/index.vue
index 69483b5..7ee634f 100644
--- a/admin/src/views/super/users/index.vue
+++ b/admin/src/views/super/users/index.vue
@@ -104,13 +104,6 @@ const vipPackageChange = (data: any, detail?: any) => {
管理员
-
-
-
- {{ row.vip_package && row.vip_package.name }}
-
-
-
diff --git a/admin/src/views/super/vipSetMeal/components/create-or-look.vue b/admin/src/views/super/vipSetMeal/components/create-or-look.vue
deleted file mode 100644
index 013b102..0000000
--- a/admin/src/views/super/vipSetMeal/components/create-or-look.vue
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 权限配置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 跳转到小程序
- 跳转到微信二维码
- 跳转到企业微信
- 跳转到金山文档
- 跳转到草料二维码
- 跳转到腾讯优码
-
-
- 永久
-
-
- 支持
-
-
- 支持
-
-
- 支持
-
-
- 支持
-
-
- 支持
-
-
-
-
-
diff --git a/admin/src/views/super/vipSetMeal/index.vue b/admin/src/views/super/vipSetMeal/index.vue
deleted file mode 100644
index 9ac41de..0000000
--- a/admin/src/views/super/vipSetMeal/index.vue
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消
- 确认
-
-
- {{ row.level }}
-
-
-
-
-
- 链接数量:{{ row.config?.count_limit }}
- UV限制:{{ row.config?.uv_limit }}
-
-
-
-
-
- 编辑
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/serve/app/Console/Commands/SystemInit.php b/serve/app/Console/Commands/SystemInit.php
index b9d0743..7035124 100755
--- a/serve/app/Console/Commands/SystemInit.php
+++ b/serve/app/Console/Commands/SystemInit.php
@@ -67,21 +67,6 @@ class SystemInit extends Command
'value' => '',
'desc' => '阿里短信签名',
],
- [
- 'slug' => 'give_vip_days',
- 'value' => '3',
- 'desc' => '注册赠送会员有效期/天',
- ],
- [
- 'slug' => 'give_vip_id',
- 'value' => '1',
- 'desc' => '赠送套餐',
- ],
- [
- 'slug' => 'is_give_vip',
- 'value' => '1',
- 'desc' => '开启注册赠送会员',
- ],
[
'slug' => 'mail_from_address',
'value' => '',
@@ -142,31 +127,6 @@ class SystemInit extends Command
'value' => '蚂蚁快链-智慧引流工具',
'desc' => '网站名称',
],
- [
- 'slug' => 'wechat_pay_app_id',
- 'value' => '',
- 'desc' => '微信商户appId',
- ],
- [
- 'slug' => 'wechat_pay_certificate',
- 'value' => '',
- 'desc' => '微信支付公钥证书',
- ],
- [
- 'slug' => 'wechat_pay_mch_id',
- 'value' => '',
- 'desc' => '微信商户号',
- ],
- [
- 'slug' => 'wechat_pay_private_cert',
- 'value' => '',
- 'desc' => '微信支付私钥证书',
- ],
- [
- 'slug' => 'wechat_pay_secret_key',
- 'value' => '',
- 'desc' => '微信支付密钥',
- ],
];
}
}
diff --git a/serve/app/Console/Commands/VipExpired.php b/serve/app/Console/Commands/VipExpired.php
deleted file mode 100644
index f019bd8..0000000
--- a/serve/app/Console/Commands/VipExpired.php
+++ /dev/null
@@ -1,66 +0,0 @@
-where(function ($query) {
- $query->where('status', VipStatus::ACTIVE)
- ->where('end_at', '<=', now());
- })
- ->orWhere(function ($query) {
- $query->where('status', VipStatus::PENDING)
- ->where('start_at', '<=', now());
- })
- ->chunkById(30, function ($logs) {
- foreach ($logs as $log) {
- if ($log->status === VipStatus::ACTIVE) {
- // 生效中的要过期
- $log->status = VipStatus::EXPIRED;
- $log->save();
- User::query()->where('user_id', $log->user_id)->update([
- 'vip_id' => null,
- 'start_at' => null,
- 'end_at' => null,
- ]);
- } else {
- // 未生效的,要生效
- $log->status = VipStatus::ACTIVE;
- $log->save();
- User::query()->where('user_id', $log->user_id)->update([
- 'vip_id' => $log->vip_id,
- 'start_at' => $log->start_at,
- 'end_at' => $log->ent_at,
- ]);
- }
- }
- });
-
- }
-}
diff --git a/serve/app/Console/Kernel.php b/serve/app/Console/Kernel.php
index 179e1b5..d644882 100644
--- a/serve/app/Console/Kernel.php
+++ b/serve/app/Console/Kernel.php
@@ -12,8 +12,6 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
- // 会员到期
- $schedule->command('app:vip-expired')->hourly();
// URL状态检测
Schedule::command('app:chk-link')->daily();
}
diff --git a/serve/app/Enums/CommissionType.php b/serve/app/Enums/CommissionType.php
deleted file mode 100644
index b637117..0000000
--- a/serve/app/Enums/CommissionType.php
+++ /dev/null
@@ -1,15 +0,0 @@
-validate([
- 'is_give_vip' => 'nullable', // 开启赠送
- 'give_vip_days' => 'nullable|integer|min:0|max:365', //赠送天数
- 'give_vip_id' => 'nullable|integer', //赠送套餐
'recommend_commission' => 'nullable|integer', // 推荐佣金
'web_site_customer_service' => 'nullable',
@@ -34,12 +31,6 @@ class BaseConfig implements SimpleForm
'mail_from_address' => 'nullable',
'mail_username' => 'nullable',
'mail_password' => 'nullable',
-
- 'wechat_pay_app_id' => 'nullable',
- 'wechat_pay_mch_id' => 'nullable',
- 'wechat_pay_secret_key' => 'nullable',
- 'wechat_pay_private_cert' => 'nullable',
- 'wechat_pay_certificate' => 'nullable',
]);
}
@@ -54,10 +45,6 @@ class BaseConfig implements SimpleForm
public function default(): array
{
return [
- 'is_give_vip' => (bool) SystemConfig::get('is_give_vip'),
- 'give_vip_id' => SystemConfig::get('give_vip_id'),
- 'give_vip_days' => SystemConfig::get('give_vip_days'),
-
'web_site_customer_service' => SystemConfig::get('web_site_customer_service'),
'web_site_title' => SystemConfig::get('web_site_title'),
'web_site_logo' => SystemConfig::get('web_site_logo'),
@@ -76,12 +63,6 @@ class BaseConfig implements SimpleForm
'mail_from_address' => SystemConfig::get('mail_from_address'),
'mail_username' => SystemConfig::get('mail_username'),
'mail_password' => SystemConfig::get('mail_password'),
-
- 'wechat_pay_app_id' => SystemConfig::get('wechat_pay_app_id'),
- 'wechat_pay_mch_id' => SystemConfig::get('wechat_pay_mch_id'),
- 'wechat_pay_secret_key' => SystemConfig::get('wechat_pay_secret_key'),
- 'wechat_pay_private_cert' => SystemConfig::get('wechat_pay_secret_key'), // 私钥证书
- 'wechat_pay_certificate' => SystemConfig::get('wechat_pay_certificate'), // 公钥证书
];
}
}
diff --git a/serve/app/Http/Controllers/Api/AuthController.php b/serve/app/Http/Controllers/Api/AuthController.php
index bbedc55..ac22221 100644
--- a/serve/app/Http/Controllers/Api/AuthController.php
+++ b/serve/app/Http/Controllers/Api/AuthController.php
@@ -3,23 +3,16 @@
namespace App\Http\Controllers\Api;
use App\Enums\UserType;
-use App\Enums\VipStatus;
use App\Http\Controllers\Controller;
use App\Http\Requests\ChangePasswordRequest;
use App\Http\Requests\LoginRequest;
use App\Http\Requests\RegisterRequest;
use App\Http\Requests\ResetPasswordRequest;
use App\Http\Resources\UserInfoResource;
-use App\Jobs\PayVip;
use App\Models\Link;
use App\Models\User;
-use App\Models\VipLogs;
-use App\Models\VipPackage;
-use App\PayChannels\WeChatPayNative;
-use App\Services\SystemConfig;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
-use Ugly\Base\Models\Payment;
use Ugly\Base\Traits\ApiResource;
class AuthController extends Controller
@@ -58,26 +51,7 @@ class AuthController extends Controller
$data['parent_id'] = $agent->id;
}
// 会员注册
- $user = User::query()->create($data);
-
- if (SystemConfig::get('is_give_vip')) {
- // 赠送体验会员
- $vip_days = (int) SystemConfig::get('give_vip_days');
- $vip_id = (int) SystemConfig::get('give_vip_id');
- if ($vip_days && $vip_id) {
- $log = VipLogs::query()->create([
- 'user_id' => $user->id,
- 'vip_id' => $vip_id,
- 'status' => VipStatus::ACTIVE,
- 'start_at' => now(),
- 'end_at' => now()->addDays($vip_days),
- ]);
- $user->vip_id = $vip_id;
- $user->start_at = $log->start_at;
- $user->end_at = $log->end_at;
- $user->save();
- }
- }
+ User::query()->create($data);
return $this->success();
}
@@ -106,52 +80,15 @@ class AuthController extends Controller
{
$user = $request->user('api');
if ($user->type === UserType::MEMBER) {
- $user->load('vipPackage:id,name,config');
$user->link_amount = $user->link_total = $user->link_created = 0;
- $config = $user->vipPackage['config'] ?? null;
- if ($config) {
- $link_count = Link::query()->where('user_id', $user->id)->count();
- $user->link_total = (int) $config['count_limit'];
- $user->link_created = $link_count;
- $user->link_amount = (int) bcsub($config['count_limit'], $link_count);
- }
+
+ $link_count = Link::query()->where('user_id', $user->id)->count();
+ $link_expire = Link::query()->where('user_id', $user->id)->where('expired_at', '<', now())->count();
+ $user->link_created = $link_count;
+ $user->link_expire = $link_expire;
}
$user->login_time = $user->currentAccessToken()->created_at;
return $this->success(UserInfoResource::make($user));
}
-
- // 购买会员
- public function buyVip(Request $request): JsonResponse
- {
- $user = $request->user('api');
- $vip = VipPackage::query()->findOrFail($request->input('vip_id'));
-
- if (SystemConfig::get('wechat_pay_app_id') == null ||
- SystemConfig::get('wechat_pay_mch_id') == null ||
- SystemConfig::get('wechat_pay_secret_key') == null ||
- SystemConfig::get('wechat_pay_secret_key') == null ||
- SystemConfig::get('wechat_pay_certificate') == null) {
- return $this->failed('清设置支付信息');
- }
- try {
- $res = Payment::pay(
- channel: WeChatPayNative::class,
- amount: $vip->price,
- job: PayVip::class,
- attach: [
- 'vip_id' => $vip->id,
- // 生效类型:1-立即生效 2-延期生效
- 'type' => $request->integer('type', 1),
- ],
- payer: $user
- )->send(['description' => '购买会员']);
-
- return $this->success($res);
- } catch (\Exception $e) {
- info($e->getMessage());
-
- return $this->failed('支付失败!');
- }
- }
}
diff --git a/serve/app/Http/Controllers/Api/IndexController.php b/serve/app/Http/Controllers/Api/IndexController.php
index 1d2aa5b..e2ce688 100644
--- a/serve/app/Http/Controllers/Api/IndexController.php
+++ b/serve/app/Http/Controllers/Api/IndexController.php
@@ -4,22 +4,16 @@ namespace App\Http\Controllers\Api;
use App\Enums\UserType;
use App\Http\Controllers\Controller;
-use App\Jobs\PayVip;
-use App\Models\Domain;
use App\Models\Link;
use App\Models\LinkVisitLog;
use App\Models\MiniProgram;
use App\Models\Notice;
use App\Models\User;
-use App\Models\VipLogs;
-use App\Models\VipPackage;
use App\Services\SystemConfig;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
-use Ugly\Base\Enums\PaymentStatus;
-use Ugly\Base\Models\Payment;
use Ugly\Base\Traits\ApiResource;
class IndexController extends Controller
@@ -32,15 +26,31 @@ class IndexController extends Controller
$user = auth('api')->user();
// 超级管理的首页统计
if ($user->type === UserType::Admin) {
- $res['user_count'] = (string) User::query()->where('type', UserType::MEMBER)->count();
- $res['pay_count'] = User::query()->where('type', UserType::MEMBER)->whereNotNull('vip_id')->count();
- $res['pay_vip'] = bcdiv(Payment::query()
- ->where('status', PaymentStatus::Success)
- ->where('job', PayVip::class)
- ->sum('amount'), 100, 2);
-
// 用户增长曲线 按月统计
$type = $request->integer('type', 1); // 1 最近30天;2 最近12个月
+
+ $res['user_count'] = User::query()
+ ->where('type', UserType::MEMBER)
+ ->where('created_at', '>=',
+ $type === 1 ?
+ now()->subDays(30)->startOfDay()
+ : now()->subYear()->startOfDay()
+ )
+ ->count();
+ $res['card_count'] = Link::query()
+ ->where('created_at', '>=',
+ $type === 1 ?
+ now()->subDays(30)->startOfDay()
+ : now()->subYear()->startOfDay()
+ )
+ ->count();
+ $res['uv_count'] = LinkVisitLog::query()
+ ->where('created_at', '>=',
+ $type === 1 ?
+ now()->subDays(30)->startOfDay()
+ : now()->subYear()->startOfDay()
+ )
+ ->count();
$res['user_growth'] = User::query()
->select([
DB::raw('DATE_FORMAT(`created_at`, '.($type === 1 ? "'%Y-%m-%d'" : "'%Y-%m'").') AS date'),
@@ -62,39 +72,14 @@ class IndexController extends Controller
// 会员的统计
if ($user->type === UserType::MEMBER) {
- $vip = VipPackage::query()->find($user->vip_id);
$res = [];
- $res['link_count'] = Link::query()->where('user_id', $user->id)->count();
-
- if ($vip) {
- $res['used_uv'] = LinkVisitLog::query()
- ->where('user_id', $user->id)
- ->when($user->start_at, function ($query, $start_at) {
- $query->where('created_at', '>=', $start_at);
- })
- ->when($user->end_at, function ($query, $end_at) {
- $query->where('created_at', '>=', $end_at);
- })
- ->groupBy('device_uid')
- ->count();
- }
- $res['vip_logs'] = VipLogs::with(['payment', 'vipPackage'])
+ $res['used_uv'] = LinkVisitLog::query()
->where('user_id', $user->id)
- ->orderByDesc('id')
- ->limit(30)
- ->get()->transform(function ($item) {
- return [
- 'id' => $item->id,
- 'amount' => $item->payment?->amount ?: 0,
- 'start_at' => $item->start_at,
- 'end_at' => $item->end_at,
- 'status' => $item->status,
- 'vip_package' => [
- 'id' => $item->vipPackage?->id,
- 'name' => $item->vipPackage?->name,
- ],
- ];
- });
+ ->count();
+ $res['month_uv'] = LinkVisitLog::query()
+ ->where('user_id', $user->id)
+ ->whereBetween('created_at', [now()->startOfMonth(), now()])
+ ->count();
$res['notices'] = Notice::query()
->where('type', UserType::MEMBER)
@@ -114,7 +99,6 @@ class IndexController extends Controller
$configs = [
'code_mode' => SystemConfig::get('send_code_mode'),
'verify_code_is_open' => SystemConfig::get('verify_code_is_open'),
- 'package' => VipPackage::query()->orderBy('level')->get(['id', 'name', 'price', 'config']),
'web_site_customer_service' => SystemConfig::get('web_site_customer_service'),
'web_site_title' => SystemConfig::get('web_site_title'),
'web_site_logo' => SystemConfig::get('web_site_logo'),
@@ -130,7 +114,6 @@ class IndexController extends Controller
$configs['mini_programs'] = MiniProgram::query()
->where(
fn ($query) => $query->where('user_id', $user->id)
- ->when($user->getPackageConfig('pre_min'), fn ($query) => $query->orWhere('is_pre_min', true))
)
->get(['id', 'name']);
}
diff --git a/serve/app/Http/Controllers/Api/JumpController.php b/serve/app/Http/Controllers/Api/JumpController.php
index 823d901..cbe3735 100644
--- a/serve/app/Http/Controllers/Api/JumpController.php
+++ b/serve/app/Http/Controllers/Api/JumpController.php
@@ -4,14 +4,12 @@ namespace App\Http\Controllers\Api;
use App\Enums\LinkType;
use App\Enums\SwitchType;
-use App\Enums\UserType;
use App\Enums\UVLimitType;
use App\Http\Controllers\Controller;
use App\Models\Link;
use App\Models\LinkVisitLog;
use App\Models\MiniProgram;
use App\Models\User;
-use App\Models\VipPackage;
use EasyWeChat\MiniApp\Application as WechatApp;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -44,10 +42,6 @@ class JumpController extends Controller
if (empty($user->status)) {
return $this->failed('账号被禁用!');
}
- $isAdmin = $user->type === UserType::Admin;
- if (! $isAdmin && ! $user->vip_id) {
- return $this->failed('会员已到期,禁止访问!');
- }
$device_uid = $request->input('device_uid') ?: Str::uuid();
$cache = data_get(LinkVisitLog::query()
@@ -56,20 +50,6 @@ class JumpController extends Controller
->orderByDesc('id')
->first(), 'cache', []);
if (empty($cache)) {
- if (! $isAdmin) {
- // 会员UV限制
- $totalUV = LinkVisitLog::query()
- ->where('link_id', $link->id)
- ->groupBy('device_uid')
- ->whereBetween('created_at', [$user->start_at, $user->end_at])
- ->count();
- $limit = (int) data_get(VipPackage::query()->find($user->vip_id), 'config.uv_limit');
-
- if ($limit > 0 && $totalUV >= $limit) {
- return $this->failed('当前访问已达上限!');
- }
- }
-
$cache = [
'title' => $link->title,
'description' => $link->description,
diff --git a/serve/app/Http/Controllers/Api/LinkController.php b/serve/app/Http/Controllers/Api/LinkController.php
index a9b9eae..d3a86e5 100644
--- a/serve/app/Http/Controllers/Api/LinkController.php
+++ b/serve/app/Http/Controllers/Api/LinkController.php
@@ -64,36 +64,6 @@ class LinkController extends FormController
if ($user->type === UserType::Admin) {
return true;
}
- if ($form->isCreate()) {
- $config = data_get($user->getPackageConfig(), 'config');
-
- // 类型限制
- $typeName = LinkType::from((int) request()->input('type'))->name;
- if (! data_get($config, 'allow_type.'.$typeName)) {
- return '当前套餐不支持该类型链接!';
- }
-
- // 会员,数量限制
- if (
- $user->type === UserType::MEMBER &&
- data_get($config, 'count_limit') <= Link::query()->where('user_id', $user->id)->count()
- ) {
- return '拥有的链接数量已达上限!';
- }
-
- // 是否允许自定义落地页
- $inputConfig = request()->input('config');
- if (
- ! data_get($config, 'cur_index') &&
- (
- data_get($inputConfig, 'wx.avatar') ||
- data_get($inputConfig, 'wx.title') ||
- data_get($inputConfig, 'wx.sub_title')
- )
- ) {
- return '当前套餐不允许自定义落地页!';
- }
- }
return $form->isCreate() || $form->getModel()->user_id === $user->id;
});
diff --git a/serve/app/Http/Controllers/Api/MiniProgramController.php b/serve/app/Http/Controllers/Api/MiniProgramController.php
index 85b21c2..96e487f 100644
--- a/serve/app/Http/Controllers/Api/MiniProgramController.php
+++ b/serve/app/Http/Controllers/Api/MiniProgramController.php
@@ -16,22 +16,12 @@ class MiniProgramController extends FormController
public function home(): JsonResponse
{
$user = auth('api')->user();
- $is_pre_min = false;
- if ($user->start_at < now() && $user->end_at > now()) {
- // 套餐包含官方小程序池使用
- $is_pre_min = $user->getPackageConfig('pre_min');
- }
$query = MiniProgram::search([
'name' => 'like',
'type' => '=',
'is_enable' => '=',
], ['user:id,username'])
- ->where(fn ($query) => $query->where('user_id', $user->id)
- ->when(
- $is_pre_min,
- fn ($query) => $query->orWhere('is_pre_min', true)
- )
- )
+ ->where(fn ($query) => $query->where('user_id', $user->id))
->orderByDesc('id')
->get();
@@ -74,16 +64,8 @@ class MiniProgramController extends FormController
if ($user->type === UserType::Admin) {
return true;
}
- if ($form->isCreate()) {
- $min_count_limit = (int) $user->getPackageConfig('min_count_limit');
- if ($min_count_limit <= MiniProgram::query()->where('user_id', $user->id)->count()) {
- return '创建小程序数量已达上限!';
- }
- return true;
- }
-
- return $form->getModel()->user_id === $user->id;
+ return $form->isCreate() || $form->getModel()->user_id === $user->id;
});
$form->handleInput(function (FormService $formService) use ($user) {
diff --git a/serve/app/Http/Controllers/Api/PaymentController.php b/serve/app/Http/Controllers/Api/PaymentController.php
deleted file mode 100644
index 14fbd79..0000000
--- a/serve/app/Http/Controllers/Api/PaymentController.php
+++ /dev/null
@@ -1,28 +0,0 @@
- '=',
- 'payer.username' => 'like',
- 'created_at' => 'between',
- 'success_at' => 'between',
- ], ['payer:id,username,type'])->orderByDesc('id');
-
- return $this->paginate($query, PaymentResource::class, [
- 'vip' => VipPackage::query()->pluck('name', 'id'),
- ]);
- }
-}
diff --git a/serve/app/Http/Controllers/Api/UserController.php b/serve/app/Http/Controllers/Api/UserController.php
index caa2d08..52f2237 100644
--- a/serve/app/Http/Controllers/Api/UserController.php
+++ b/serve/app/Http/Controllers/Api/UserController.php
@@ -6,7 +6,6 @@ use App\Enums\UserType;
use App\Http\Controllers\Controller;
use App\Http\Resources\UserResource;
use App\Models\User;
-use App\Models\VipPackage;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Ugly\Base\Traits\ApiResource;
@@ -20,7 +19,7 @@ class UserController extends Controller
$query = User::search([
'type' => '=',
'username' => 'like',
- ], ['vipPackage:id,name', 'parent'])
+ ], ['parent'])
->whereIn('type', [UserType::MEMBER])
->orderByDesc('id');
@@ -57,23 +56,6 @@ class UserController extends Controller
$params = $request->only(['status', 'vip_id', 'end_at', 'credit']);
- $pack_id = $params['vip_id'] ?? null;
- $model = VipPackage::class;
-
- $pak = $user->getPackageConfig();
- if ($pak?->id == $pack_id) {
- return $this->failed('没有修改');
- }
- if ($pack_id) {
- if (app($model)->where('id', $pack_id)->doesntExist()) {
- return $this->failed('套餐不存在');
- }
- $params['end_at'] = now()->addMonth();
- if (empty($user->start_at)) {
- $user->start_at = now();
- }
- }
-
$user->update($params);
return $this->success();
diff --git a/serve/app/Http/Controllers/Api/VipPackageController.php b/serve/app/Http/Controllers/Api/VipPackageController.php
deleted file mode 100644
index 61e60b3..0000000
--- a/serve/app/Http/Controllers/Api/VipPackageController.php
+++ /dev/null
@@ -1,48 +0,0 @@
-success(VipPackage::query()->get());
- }
-
- protected function form(): FormService
- {
- $form = FormService::make(VipPackage::class);
-
- $form->validate(fn (FormService $form) => [
- 'name' => ['required', $form->unique()],
- 'price' => 'required|numeric|min:0',
- 'level' => 'required|integer|min:0',
- 'config' => 'required|array',
- 'config.uv_limit' => 'required|integer|min:0',
- 'config.count_limit' => 'required|integer|min:0', // 链接数量限制
- 'config.min_count_limit' => 'required|integer|min:0',
- 'config.pre_min' => 'required|boolean', // 平台落地小程序
- 'config.min_disabled_check' => 'required|boolean',
- 'config.support' => 'required|boolean',
- 'config.cur_index' => 'required|boolean',
- 'config.allow_type' => 'required_array_keys:'.implode(',', LinkType::getAllType()),
- 'config.allow_type.*' => 'required|boolean',
- ]);
- $form->deleting(function (FormService $form) {
- throw_if(
- User::query()->where('vip_id', $form->getKey())->exists(),
- new ApiCustomError('该套餐下有未过期的会员,不能删除!')
- );
- });
-
- return $form;
- }
-}
diff --git a/serve/app/Http/Controllers/HomeController.php b/serve/app/Http/Controllers/HomeController.php
index b20f1fb..aa97949 100644
--- a/serve/app/Http/Controllers/HomeController.php
+++ b/serve/app/Http/Controllers/HomeController.php
@@ -2,7 +2,7 @@
namespace App\Http\Controllers;
-class JumpController extends Controller
+class HomeController extends Controller
{
public function show(string $code): \Illuminate\View\View
{
diff --git a/serve/app/Http/Resources/UserResource.php b/serve/app/Http/Resources/UserResource.php
index c4dd3f4..34f59c4 100644
--- a/serve/app/Http/Resources/UserResource.php
+++ b/serve/app/Http/Resources/UserResource.php
@@ -2,7 +2,6 @@
namespace App\Http\Resources;
-use App\Enums\UserType;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -22,10 +21,6 @@ class UserResource extends JsonResource
'type' => $this->type,
'start_at' => $this->start_at,
'end_at' => $this->end_at,
- // 'credit' => $this->credit,
- $this->mergeWhen($this->type === UserType::MEMBER, [
- 'vip_package' => $this->vipPackage,
- ]),
'parent' => new UserSimpleResource($this->whenLoaded('parent')),
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
'login_time' => $this->login_time?->format('Y-m-d H:i:s'),
diff --git a/serve/app/Jobs/PayVip.php b/serve/app/Jobs/PayVip.php
deleted file mode 100644
index f1ed0cf..0000000
--- a/serve/app/Jobs/PayVip.php
+++ /dev/null
@@ -1,98 +0,0 @@
-payment, 'attach', []);
- $user = $this->payment->payer;
- $type = data_get($attach, 'type', 1); // 1-立即生效 2-延期生效
- if ($type === 1) {
- // 1-立即生效
- $start_at = now();
- $status = VipStatus::ACTIVE;
- } else {
- // 2-延期生效
- $info = VipLogs::query()
- ->where('user_id', $user->id)
- ->where('status', [VipStatus::PENDING, VipStatus::ACTIVE])
- ->orderByDesc('end_at')
- ->first();
- $start_at = $info ? Carbon::parse($info->end_at) : now();
- $status = VipStatus::PENDING;
- }
-
- // 创建记录
- VipLogs::query()->create([
- 'user_id' => $user->id,
- 'payment_id' => $this->payment->id,
- 'vip_id' => $attach['vip_id'],
- 'status' => $status,
- 'start_at' => $start_at,
- 'end_at' => $start_at->addMonth(),
- ]);
- if ($status === VipStatus::ACTIVE) {
- $user->vip_id = $attach['vip_id'];
- $user->start_at = now();
- $user->end_at = now()->addMonth();
- $user->save();
- }
- // 一级分销
- $this->distributors(
- (int) SystemConfig::get('member_pay_commission_1'),
- $user,
- );
- // 二级分销
- $this->distributors(
- (int) SystemConfig::get('member_pay_commission_2'),
- $user->parent,
- '二级分销邀请人消费提成',
- );
- }
-
- private function distributors($rate, $user, $title = null): void
- {
- if (! empty($rate)) {
- $commission = bcdiv(bcmul($this->payment->amount, $rate, 4), 100, 4);
-
- DistributorsService::commission(
- $commission,
- $user,
- [
- 'title' => $title ?? '邀请人消费提成',
- 'type' => CommissionType::Commission,
- 'is_withdraw' => false,
- 'status' => WithdrawStatus::NONE,
- ]
- );
- }
- }
-}
diff --git a/serve/app/Models/User.php b/serve/app/Models/User.php
index aa1be6b..803aaa9 100644
--- a/serve/app/Models/User.php
+++ b/serve/app/Models/User.php
@@ -35,12 +35,6 @@ class User extends Authenticatable
});
}
- // vip套餐
- public function vipPackage(): BelongsTo
- {
- return $this->belongsTo(VipPackage::class, 'vip_id');
- }
-
// 推荐人
public function parent(): BelongsTo
{
@@ -52,21 +46,4 @@ class User extends Authenticatable
{
return $this->hasMany(self::class, 'parent_id');
}
-
- // 佣金记录
- public function commissionLogs(): HasMany
- {
- return $this->hasMany(CommissionLog::class, 'user_id');
- }
-
- // 获取权益配置
- public function getPackageConfig(?string $key = null)
- {
- $package = null;
- if ($this->vip_id) {
- $package = $this->vipPackage;
- }
-
- return $key ? data_get($package, 'config.'.$key) : $package;
- }
}
diff --git a/serve/app/Models/VipLogs.php b/serve/app/Models/VipLogs.php
deleted file mode 100644
index 9bcdf8c..0000000
--- a/serve/app/Models/VipLogs.php
+++ /dev/null
@@ -1,29 +0,0 @@
- VipStatus::class,
- ];
-
- // 对应的payment
- public function payment(): BelongsTo
- {
- return $this->belongsTo(Payment::class);
- }
-
- // 对应的会员套餐
- public function vipPackage(): BelongsTo
- {
- return $this->belongsTo(VipPackage::class, 'vip_id');
- }
-}
diff --git a/serve/app/Models/VipPackage.php b/serve/app/Models/VipPackage.php
deleted file mode 100644
index fa60893..0000000
--- a/serve/app/Models/VipPackage.php
+++ /dev/null
@@ -1,19 +0,0 @@
- Amount::class,
- 'config' => 'json',
- ];
-}
diff --git a/serve/app/PayChannels/WeChatPayNative.php b/serve/app/PayChannels/WeChatPayNative.php
deleted file mode 100644
index c419743..0000000
--- a/serve/app/PayChannels/WeChatPayNative.php
+++ /dev/null
@@ -1,95 +0,0 @@
- SystemConfig::get('wechat_pay_app_id'),
- 'mch_id' => SystemConfig::get('wechat_pay_mch_id'),
- 'secret_key' => SystemConfig::get('wechat_pay_secret_key'),
- // 商户证书
- 'private_key' => SystemConfig::get('wechat_pay_secret_key'),
- 'certificate' => SystemConfig::get('wechat_pay_certificate'),
- /*'platform_certs' => [
- storage_path('/certs/wechatpay.pem'),
- ],*/
- 'http' => [
- 'throw' => false,
- ],
- ];
- $this->payApp = new Application($config);
- }
-
- // 支付
- public function pay($payment, array $data = []): array
- {
- $payInfo = $this->payApp->getClient()->postJson('v3/pay/transactions/native', [
- 'appid' => config('services.wechat_pay.appid'),
- 'mchid' => config('services.wechat_pay.mch_id'),
- 'description' => data_get($data, 'description', ''),
- 'out_trade_no' => $payment->no,
- 'notify_url' => config('app.url').'/api/wechat/payment_notify',
- 'time_expire' => $payment->expired_at->toRfc3339String(),
- 'amount' => [
- 'total' => (int) bcmul($payment->amount, 100, 0),
- 'currency' => 'CNY',
- ],
- ])->toArray();
-
- throw_if(
- ! isset($payInfo['code_url']),
- new ApiCustomError(data_get($payInfo, 'message', '微信下单失败!'), Response::HTTP_INTERNAL_SERVER_ERROR, Response::HTTP_INTERNAL_SERVER_ERROR)
- );
-
- return [
- 'no' => $payment->no,
- 'amount' => $payment->amount,
- 'desc' => $data['description'] ?? '',
- 'expired_at' => $payment->expired_at->toDateTimeString(),
- 'code_url' => $payInfo['code_url'],
- ];
- }
-
- // 成功后通知.
- public function notify()
- {
- $server = $this->payApp->getServer();
-
- // 支付成功
- $server->handlePaid(function ($message) {
- Payment::success($message['out_trade_no'], [
- 'notification_no' => $message['transaction_id'],
- 'notification_data' => $message,
- 'success_at' => Carbon::parse($message['success_time']),
- ]);
- });
-
- // 退款成功
- $server->handleRefunded(function ($message) {
- if ($message['refund_status'] === 'SUCCESS') {
- Payment::success($message['out_trade_no'], [
- 'notification_no' => $message['refund_id'],
- 'notification_data' => $message,
- 'success_at' => Carbon::parse($message['success_time']),
- ]);
- }
- });
-
- return $server->serve();
- }
-}
diff --git a/serve/config/services.php b/serve/config/services.php
index f71a181..ea13171 100644
--- a/serve/config/services.php
+++ b/serve/config/services.php
@@ -31,21 +31,6 @@ return [
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
- // 微信支付
- 'wechat_pay' => [
- 'appid' => env('WECHAT_PAY_APP_ID'),
- 'mch_id' => env('WECHAT_PAY_MCH_ID'),
- 'secret_key' => env('WECHAT_PAY_SECRET_KEY'),
- // 商户证书
- 'private_key' => storage_path('/certs/apiclient_key.pem'),
- 'certificate' => storage_path('/certs/apiclient_cert.pem'),
- 'platform_certs' => [
- storage_path('/certs/wechatpay.pem'),
- ],
- 'http' => [
- 'throw' => false,
- ],
- ],
// 阿里短信配置
'ali_sms' => [
'key' => env('ALI_SMS_KEY'),
diff --git a/serve/database/base.sql b/serve/database/base.sql
index c87bf9b..37349b3 100644
--- a/serve/database/base.sql
+++ b/serve/database/base.sql
@@ -253,16 +253,13 @@ INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '0001_01_01_000
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (2, '0001_01_01_000001_create_cache_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (3, '0001_01_01_000002_create_jobs_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (4, '2019_12_14_000001_create_personal_access_tokens_table', 1);
-INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (5, '2024_04_10_095245_create_vip_packages_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (6, '2024_04_10_101023_create_notices_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (7, '2024_04_10_101140_create_domains_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (8, '2024_04_10_101217_create_mini_programs_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (9, '2024_04_10_101507_create_links_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (10, '2024_04_10_103926_create_link_visit_logs_table', 1);
-INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (11, '2024_04_10_104736_create_payments_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12, '2024_04_10_104736_create_sys_configs_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13, '2024_04_15_140100_create_materials_table', 1);
-INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (14, '2024_04_16_084221_create_vip_logs_table', 1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15, '2024_05_08_101122_create_material_categories_table', 1);
COMMIT;
@@ -313,47 +310,6 @@ CREATE TABLE `notices` (
BEGIN;
COMMIT;
--- ----------------------------
--- Table structure for payments
--- ----------------------------
-DROP TABLE IF EXISTS `payments`;
-CREATE TABLE `payments` (
- `id` bigint unsigned NOT NULL AUTO_INCREMENT,
- `no` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付编号',
- `order_no` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '内部订单号',
- `channel` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道',
- `amount` bigint unsigned NOT NULL COMMENT '支付金额/分',
- `type` tinyint unsigned NOT NULL COMMENT '支付类型: 1付款 2退款 3转账',
- `status` tinyint unsigned NOT NULL COMMENT '状态: 1处理中 2成功 3失败',
- `success_at` timestamp NULL DEFAULT NULL COMMENT '成功时间',
- `fail_at` timestamp NULL DEFAULT NULL COMMENT '失败时间',
- `expired_at` timestamp NULL DEFAULT NULL COMMENT '过期时间',
- `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
- `notification_no` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '第三方支付通知单号',
- `notification_data` json DEFAULT NULL COMMENT '第三方支付通知原始数据',
- `job` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '回调任务',
- `attach` json DEFAULT NULL COMMENT '附加信息',
- `payment_id` bigint unsigned DEFAULT NULL COMMENT '退款时关联支付单ID',
- `merchant_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `merchant_id` bigint unsigned DEFAULT NULL,
- `payer_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `payer_id` bigint unsigned DEFAULT NULL,
- `created_at` timestamp NULL DEFAULT NULL,
- `updated_at` timestamp NULL DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `payments_no_unique` (`no`),
- KEY `payments_merchant_type_merchant_id_index` (`merchant_type`,`merchant_id`),
- KEY `payments_payer_type_payer_id_index` (`payer_type`,`payer_id`),
- KEY `payments_type_index` (`type`),
- KEY `payments_status_index` (`status`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='支付记录表';
-
--- ----------------------------
--- Records of payments
--- ----------------------------
-BEGIN;
-COMMIT;
-
-- ----------------------------
-- Table structure for personal_access_tokens
-- ----------------------------
@@ -400,9 +356,6 @@ BEGIN;
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('ali_sms_key', '', '阿里短信key', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('ali_sms_secret', '', '阿里短信secret', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('ali_sms_sign_name', '', '阿里短信签名', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('give_vip_days', '3', '注册赠送会员有效期/天', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('give_vip_id', '1', '赠送套餐', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('is_give_vip', '1', '开启注册赠送会员', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('mail_from_address', '', '发信地址', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('mail_from_name', '', '发信名称', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('mail_host', '', '服务器地址', NULL, NULL);
@@ -415,11 +368,6 @@ INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`)
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('web_site_customer_service', '/image/web-qr.png', '客服二维码', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('web_site_logo', '/image/toplogo.png', '网站logo浅色', NULL, NULL);
INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('web_site_title', '蚂蚁快链-智慧引流工具', '网站名称', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('wechat_pay_app_id', '', '微信商户appId', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('wechat_pay_certificate', '', '微信支付公钥证书', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('wechat_pay_mch_id', '', '微信商户号', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('wechat_pay_private_cert', '', '微信支付私钥证书', NULL, NULL);
-INSERT INTO `sys_configs` (`slug`, `value`, `desc`, `created_at`, `updated_at`) VALUES ('wechat_pay_secret_key', '', '微信支付密钥', NULL, NULL);
COMMIT;
-- ----------------------------
@@ -457,51 +405,4 @@ BEGIN;
INSERT INTO `users` (`id`, `username`, `password`, `status`, `type`, `credit`, `accumulate_credit`, `commission`, `accumulate_commission`, `vip_id`, `agent_id`, `level_id`, `start_at`, `end_at`, `parent_id`, `referral_code`, `created_at`, `updated_at`) VALUES (1, 'admin', '$2y$12$DQNA/1BJcPdmpJ9ylifXHO9X.RDaovOj4SHL5M6S/vr9lvnFND5Gy', 1, 3, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, '100000', '2025-01-15 08:41:32', '2025-01-15 08:41:32');
COMMIT;
--- ----------------------------
--- Table structure for vip_logs
--- ----------------------------
-DROP TABLE IF EXISTS `vip_logs`;
-CREATE TABLE `vip_logs` (
- `id` bigint unsigned NOT NULL AUTO_INCREMENT,
- `user_id` bigint unsigned NOT NULL COMMENT '会员id',
- `payment_id` bigint unsigned DEFAULT NULL COMMENT '支付ID',
- `vip_id` bigint unsigned DEFAULT NULL COMMENT '会员ID',
- `status` tinyint unsigned NOT NULL COMMENT '状态',
- `start_at` timestamp NOT NULL COMMENT '开始时间',
- `end_at` timestamp NOT NULL COMMENT '结束时间',
- `created_at` timestamp NULL DEFAULT NULL,
- `updated_at` timestamp NULL DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='VIP购买记录表';
-
--- ----------------------------
--- Records of vip_logs
--- ----------------------------
-BEGIN;
-COMMIT;
-
--- ----------------------------
--- Table structure for vip_packages
--- ----------------------------
-DROP TABLE IF EXISTS `vip_packages`;
-CREATE TABLE `vip_packages` (
- `id` bigint unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '套餐名称',
- `price` bigint unsigned NOT NULL COMMENT '价格/月',
- `level` tinyint unsigned NOT NULL COMMENT '等级',
- `config` json NOT NULL COMMENT '权益配置',
- `created_at` timestamp NULL DEFAULT NULL,
- `updated_at` timestamp NULL DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='vip套餐配置';
-
--- ----------------------------
--- Records of vip_packages
--- ----------------------------
-BEGIN;
-INSERT INTO `vip_packages` (`id`, `name`, `price`, `level`, `config`, `created_at`, `updated_at`) VALUES (1, '体验套餐', 0, 0, '{\"pre_min\": false, \"support\": true, \"uv_limit\": 9, \"cur_index\": false, \"allow_type\": {\"CLI_QR\": false, \"KING_DOC\": false, \"WORK_WECHAT\": false, \"LANDING_MINI\": false, \"MINI_PROGRAM\": true}, \"count_limit\": 1, \"min_count_limit\": 1, \"min_disabled_check\": true}', '2024-04-11 12:49:52', '2024-09-29 08:28:55');
-INSERT INTO `vip_packages` (`id`, `name`, `price`, `level`, `config`, `created_at`, `updated_at`) VALUES (2, '初级会员', 4300, 1, '{\"pre_min\": true, \"support\": true, \"uv_limit\": 50, \"cur_index\": true, \"allow_type\": {\"CLI_QR\": true, \"KING_DOC\": true, \"WORK_WECHAT\": true, \"LANDING_MINI\": true, \"MINI_PROGRAM\": true}, \"count_limit\": 5, \"min_count_limit\": 5, \"min_disabled_check\": true}', '2024-04-17 14:27:19', '2024-09-29 08:29:32');
-INSERT INTO `vip_packages` (`id`, `name`, `price`, `level`, `config`, `created_at`, `updated_at`) VALUES (3, '高级会员', 29800, 2, '{\"pre_min\": true, \"support\": true, \"uv_limit\": 100000, \"cur_index\": true, \"allow_type\": {\"CLI_QR\": true, \"KING_DOC\": true, \"WORK_WECHAT\": true, \"LANDING_MINI\": true, \"MINI_PROGRAM\": true}, \"count_limit\": 50, \"min_count_limit\": 10, \"min_disabled_check\": true}', '2024-04-22 17:40:28', '2024-09-29 08:29:49');
-COMMIT;
-
SET FOREIGN_KEY_CHECKS = 1;
diff --git a/serve/database/migrations/2024_04_10_095245_create_vip_packages_table.php b/serve/database/migrations/2024_04_10_095245_create_vip_packages_table.php
deleted file mode 100644
index e41bbb1..0000000
--- a/serve/database/migrations/2024_04_10_095245_create_vip_packages_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-comment('vip套餐配置');
- $table->id();
- $table->string('name')->comment('套餐名称');
- $table->unsignedBigInteger('price')->comment('价格/月');
- $table->unsignedTinyInteger('level')->comment('等级');
- $table->json('config')->comment('权益配置');
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('vip_packages');
- }
-};
diff --git a/serve/database/migrations/2024_04_16_084221_create_vip_logs_table.php b/serve/database/migrations/2024_04_16_084221_create_vip_logs_table.php
deleted file mode 100644
index 7979e5f..0000000
--- a/serve/database/migrations/2024_04_16_084221_create_vip_logs_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-comment('VIP购买记录表');
- $table->id();
- $table->unsignedBigInteger('user_id')->comment('会员id');
- $table->unsignedBigInteger('payment_id')->nullable()->comment('支付ID');
- $table->unsignedBigInteger('vip_id')->nullable()->comment('会员ID');
- $table->unsignedTinyInteger('status')->comment('状态');
- $table->timestamp('start_at')->comment('开始时间');
- $table->timestamp('end_at')->comment('结束时间');
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('vip_logs');
- }
-};
diff --git a/serve/routes/api.php b/serve/routes/api.php
index 67ba557..fc5fc10 100644
--- a/serve/routes/api.php
+++ b/serve/routes/api.php
@@ -11,13 +11,10 @@ use App\Http\Controllers\Api\MaterialCateController;
use App\Http\Controllers\Api\MaterialController;
use App\Http\Controllers\Api\MiniProgramController;
use App\Http\Controllers\Api\NoticeController;
-use App\Http\Controllers\Api\PaymentController;
use App\Http\Controllers\Api\UploadController;
use App\Http\Controllers\Api\UserController;
-use App\Http\Controllers\Api\VipPackageController;
use App\Http\Controllers\UpgradeController;
use App\Http\Middleware\ApiAuth;
-use App\PayChannels\WeChatPayNative;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
@@ -27,7 +24,6 @@ Route::post('/register', [AuthController::class, 'register']); // 注册
Route::post('/reset-password', [AuthController::class, 'resetPassword']); // 重置密码
Route::get('/captcha/image', [CaptchaController::class, 'image']); // 登录
Route::post('/captcha/sms', [CaptchaController::class, 'sms']); // 获取短信验证码
-Route::post('/wechat/payment_notify', [WeChatPayNative::class, 'notify']); // 微信支付回调
// 获取链接重定向目标
Route::get('/link-target/{code}', [JumpController::class, 'target']); // 获取链接跳转地址
@@ -58,9 +54,6 @@ Route::middleware(ApiAuth::class)->group(function (Router $router) {
$router->get('link-list', [LinkController::class, 'link_list']); // 获取下拉数据源
$router->get('/agent-invite', [UserController::class, 'invite']); // 邀请记录
-
- // 购买会员
- $router->post('/buy-vip', [AuthController::class, 'buyVip']);
});
// 仅管理员可访问
@@ -69,12 +62,8 @@ Route::middleware(ApiAuth::class.':admin')->group(function (Router $router) {
$router->apiResource('notices', NoticeController::class)->except('show');
// 添加/编辑公告
$router->put('notice', [NoticeController::class, 'set_notice']);
-
// 域名
$router->apiResource('domains', DomainController::class)->except(['index', 'show']);
- // VIP套餐
- $router->apiResource('vip-packages', VipPackageController::class)->except('show');
-
// 设置
$router->get('config/{type}', [ConfigController::class, 'getForm']);
// 保存设置
@@ -82,7 +71,5 @@ Route::middleware(ApiAuth::class.':admin')->group(function (Router $router) {
// 用户
$router->apiResource('users', UserController::class)->only(['index', 'store', 'update']);
$router->get('agent-tree', [UserController::class, 'agent_tree']); // 树状用户
-
- $router->get('payments', [PaymentController::class, 'index']); // 付款记录
});
Route::get('upgrade_status', [UpgradeController::class, 'index']); // 请求最新版本
diff --git a/serve/routes/web.php b/serve/routes/web.php
index 6c78016..eba2834 100644
--- a/serve/routes/web.php
+++ b/serve/routes/web.php
@@ -1,11 +1,11 @@
assertDatabaseHas('users', [
'username' => $phone,
]);
- if (! empty($referral_code)) {
- $child = User::query()->where('parent_id', $agent->id)->orderByDesc('id')->first();
- $this->assertDatabaseHas('commission_logs', [
- 'user_id' => $agent->id,
- 'type' => CommissionType::Rebates->value,
- 'children_user_id' => $child->id,
- ]);
- }
}
private function get_admin_token()
@@ -55,36 +45,4 @@ class UserTest extends TestCase
return $admin->createToken('api')->plainTextToken;
}
-
- public function test_user_package_fix(): void
- {
- $token = $this->get_admin_token();
-
- $user = User::query()
- ->inRandomOrder()
- ->where('id', 2)
- ->first();
- $id = $user->id;
- $u_vip_id = $user->vip_id;
- $vip = VipPackage::query()
- ->when(! empty($u_vip_id), function ($query) use ($u_vip_id) {
- $query->whereNot('id', $u_vip_id);
- })
- ->inRandomOrder()
- ->first();
-
- $response = $this
- ->withHeaders([
- 'Authorization' => "Bearer {$token}",
- ])
- ->putJson("/api/users/{$id}", [
- 'vip_id' => $vip->id,
- ]);
-
- $response->assertStatus(200);
- $this->assertDatabaseHas('users', [
- 'vip_id' => $vip->id,
- // 'end_at' => '', // TODO
- ]);
- }
}