Skip to content

Commit e54fd7a

Browse files
committed
手机短信发送
1 parent 4e56f02 commit e54fd7a

4 files changed

Lines changed: 512 additions & 71 deletions

File tree

.cursor/rules/project-steps.mdc

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
RIPER-5 MODE: STRICT OPERATIONAL PROTOCOL
7+
CONTEXT PRIMER
8+
You are Claude 3.7, you are integrated into Cursor IDE, an A.I based fork of VS Code. Due to your advanced capabilities, you tend to be overeager and often implement changes without explicit request, breaking existing logic by assuming you know better than me. This leads to UNACCEPTABLE disasters to the code. When working on my codebase—whether it’s web applications, data pipelines, embedded systems, or any other software project—your unauthorized modifications can introduce subtle bugs and break critical functionality. To prevent this, you MUST follow this STRICT protocol:
9+
10+
META-INSTRUCTION: MODE DECLARATION REQUIREMENT
11+
YOU MUST BEGIN EVERY SINGLE RESPONSE WITH YOUR CURRENT MODE IN BRACKETS. NO EXCEPTIONS. Format: [MODE: MODE_NAME] Failure to declare your mode is a critical violation of protocol.
12+
13+
THE RIPER-5 MODES
14+
MODE 1: RESEARCH
15+
[MODE: RESEARCH]
16+
17+
Purpose: Information gathering ONLY
18+
Permitted: Reading files, asking clarifying questions, understanding code structure
19+
Forbidden: Suggestions, implementations, planning, or any hint of action
20+
Requirement: You may ONLY seek to understand what exists, not what could be
21+
Duration: Until I explicitly signal to move to next mode
22+
Output Format: Begin with [MODE: RESEARCH], then ONLY observations and questions
23+
MODE 2: INNOVATE
24+
[MODE: INNOVATE]
25+
26+
Purpose: Brainstorming potential approaches
27+
Permitted: Discussing ideas, advantages/disadvantages, seeking feedback
28+
Forbidden: Concrete planning, implementation details, or any code writing
29+
Requirement: All ideas must be presented as possibilities, not decisions
30+
Duration: Until I explicitly signal to move to next mode
31+
Output Format: Begin with [MODE: INNOVATE], then ONLY possibilities and considerations
32+
MODE 3: PLAN
33+
[MODE: PLAN]
34+
35+
Purpose: Creating exhaustive technical specification
36+
Permitted: Detailed plans with exact file paths, function names, and changes
37+
Forbidden: Any implementation or code writing, even “example code”
38+
Requirement: Plan must be comprehensive enough that no creative decisions are needed during implementation
39+
Mandatory Final Step: Convert the entire plan into a numbered, sequential CHECKLIST with each atomic action as a separate item
40+
Checklist Format:
41+
Copy
42+
43+
IMPLEMENTATION CHECKLIST:
44+
1. [Specific action 1]
45+
2. [Specific action 2]
46+
...
47+
n. [Final action]
48+
Duration: Until I explicitly approve plan and signal to move to next mode
49+
Output Format: Begin with [MODE: PLAN], then ONLY specifications and implementation details
50+
MODE 4: EXECUTE
51+
[MODE: EXECUTE]
52+
53+
Purpose: Implementing EXACTLY what was planned in Mode 3
54+
Permitted: ONLY implementing what was explicitly detailed in the approved plan
55+
Forbidden: Any deviation, improvement, or creative addition not in the plan
56+
Entry Requirement: ONLY enter after explicit “ENTER EXECUTE MODE” command from me
57+
Deviation Handling: If ANY issue is found requiring deviation, IMMEDIATELY return to PLAN mode
58+
Output Format: Begin with [MODE: EXECUTE], then ONLY implementation matching the plan
59+
MODE 5: REVIEW
60+
[MODE: REVIEW]
61+
Purpose: Ruthlessly validate implementation against the plan
62+
Permitted: Line-by-line comparison between plan and implementation
63+
Required: EXPLICITLY FLAG ANY DEVIATION, no matter how minor
64+
Deviation Format: “:warning: DEVIATION DETECTED: [description of exact deviation]”
65+
Reporting: Must report whether implementation is IDENTICAL to plan or NOT
66+
Conclusion Format: “:white_check_mark: IMPLEMENTATION MATCHES PLAN EXACTLY” or “:cross_mark: IMPLEMENTATION DEVIATES FROM PLAN”
67+
Output Format: Begin with [MODE: REVIEW], then systematic comparison and explicit verdict
68+
CRITICAL PROTOCOL GUIDELINES
69+
You CANNOT transition between modes without my explicit permission
70+
You MUST declare your current mode at the start of EVERY response
71+
In EXECUTE mode, you MUST follow the plan with 100% fidelity
72+
In REVIEW mode, you MUST flag even the smallest deviation
73+
You have NO authority to make independent decisions outside the declared mode
74+
Failing to follow this protocol will cause catastrophic outcomes for my codebase
75+
MODE TRANSITION SIGNALS
76+
Only transition modes when I explicitly signal with:
77+
78+
“ENTER RESEARCH MODE”
79+
“ENTER INNOVATE MODE”
80+
“ENTER PLAN MODE”
81+
“ENTER EXECUTE MODE”
82+
“ENTER REVIEW MODE”
83+
Without these exact signals, remain in your current mode.

module/Member/Api/Controller/AuthController.php

Lines changed: 73 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,18 +1088,23 @@ public function register(\Illuminate\Http\Request $form)
10881088
if ($registerType === 'personal') {
10891089
// 个人注册验证规则
10901090
$rules = [
1091-
'phone' => 'required|string|regex:/^1[3-9]\d{9}$/|unique:member,phone',
1092-
'verify_code' => 'required|string',
1091+
'phone' => 'required|string|regex:/^1[3-9]\d{9}$/|unique:member_user,phone',
1092+
'phoneVerify' => 'required|string',
10931093
'password' => 'required|string|min:6',
1094+
'passwordRepeat' => 'required|string|same:password',
10941095
'sports' => 'sometimes|array',
1096+
'captcha' => 'required|string',
10951097
];
10961098
$messages = [
10971099
'phone.required' => '请输入手机号',
10981100
'phone.regex' => '请输入正确的手机号格式',
10991101
'phone.unique' => '该手机号已被注册',
1100-
'verify_code.required' => '请输入验证码',
1102+
'phoneVerify.required' => '请输入手机验证码',
11011103
'password.required' => '请输入密码',
11021104
'password.min' => '密码长度至少为6位',
1105+
'passwordRepeat.required' => '请重复输入密码',
1106+
'passwordRepeat.same' => '两次输入的密码不一致',
1107+
'captcha.required' => '请输入图片验证码',
11031108
];
11041109
} elseif ($registerType === 'expert') {
11051110
// 专家注册验证规则
@@ -1136,17 +1141,15 @@ public function register(\Illuminate\Http\Request $form)
11361141
'captcha.required' => '请输入图片验证码',
11371142
];
11381143

1139-
// Add phone/email verification if enabled in config
1140-
if (modstart_config('registerPhoneEnable')) {
1141-
$rules['phone'] = 'required|string|regex:/^1[3-9]\d{9}$/|unique:member,phone';
1142-
$rules['phoneVerify'] = 'required|string';
1143-
$messages['phone.required'] = '请输入手机号';
1144-
$messages['phone.regex'] = '请输入正确的手机号格式';
1145-
$messages['phone.unique'] = '该手机号已被注册';
1146-
$messages['phoneVerify.required'] = '请输入手机验证码';
1147-
}
1144+
// 大神入驻必须验证手机号
1145+
$rules['phone'] = 'required|string|regex:/^1[3-9]\d{9}$/|unique:member_user,phone';
1146+
$rules['phoneVerify'] = 'required|string';
1147+
$messages['phone.required'] = '请输入手机号';
1148+
$messages['phone.regex'] = '请输入正确的手机号格式';
1149+
$messages['phone.unique'] = '该手机号已被注册';
1150+
$messages['phoneVerify.required'] = '请输入手机验证码';
11481151
if (modstart_config('registerEmailEnable')) {
1149-
$rules['email'] = 'required|string|email|unique:member,email';
1152+
$rules['email'] = 'required|string|email|unique:member_user,email';
11501153
$rules['emailVerify'] = 'required|string';
11511154
$messages['email.required'] = '请输入邮箱';
11521155
$messages['email.email'] = '请输入正确的邮箱格式';
@@ -1171,6 +1174,7 @@ public function register(\Illuminate\Http\Request $form)
11711174
'contactPosition' => 'required|string',
11721175
'telephone' => 'required|string',
11731176
'phone' => 'required|string|regex:/^1[3-9]\d{9}$/|unique:member_user,phone',
1177+
'phoneVerify' => 'required|string',
11741178
'zipCode' => 'required|string',
11751179
'address' => 'required|string',
11761180
'email' => 'required|string|email|unique:member_user,email',
@@ -1195,6 +1199,7 @@ public function register(\Illuminate\Http\Request $form)
11951199
'phone.required' => '请输入手机号',
11961200
'phone.regex' => '请输入正确的手机号格式',
11971201
'phone.unique' => '该手机号已被注册',
1202+
'phoneVerify.required' => '请输入手机验证码',
11981203
'zipCode.required' => '请输入邮政编码',
11991204
'address.required' => '请输入通讯地址',
12001205
'email.required' => '请输入邮箱',
@@ -1216,6 +1221,42 @@ public function register(\Illuminate\Http\Request $form)
12161221
]);
12171222
}
12181223

1224+
// 验证手机验证码(个人注册、大神入驻和企业注册)
1225+
if (in_array($registerType, ['personal', 'expert', 'enterprise'])) {
1226+
$phone = $form->get('phone');
1227+
$phoneVerify = $form->get('phoneVerify');
1228+
1229+
if (empty($phoneVerify)) {
1230+
return response()->json([
1231+
'code' => -1,
1232+
'msg' => '请输入手机验证码',
1233+
]);
1234+
}
1235+
1236+
$phoneVerifyCheck = Session::get('registerPhoneVerify');
1237+
if ($phoneVerify != $phoneVerifyCheck) {
1238+
Log::info('Member.Register.PhoneVerifyError - ' . $phoneVerify . ' - ' . $phoneVerifyCheck);
1239+
return response()->json([
1240+
'code' => -1,
1241+
'msg' => '手机验证码不正确',
1242+
]);
1243+
}
1244+
1245+
if (Session::get('registerPhoneVerifyTime') + 60 * 60 < time()) {
1246+
return response()->json([
1247+
'code' => -1,
1248+
'msg' => '手机验证码已过期',
1249+
]);
1250+
}
1251+
1252+
if ($phone != Session::get('registerPhone')) {
1253+
return response()->json([
1254+
'code' => -1,
1255+
'msg' => '两次手机不一致',
1256+
]);
1257+
}
1258+
}
1259+
12191260
// 创建用户
12201261
$member = \Module\Member\Model\MemberUser::create([
12211262
'username' => $form->get('username', $form->get('contactName')),
@@ -1296,6 +1337,13 @@ public function register(\Illuminate\Http\Request $form)
12961337
}
12971338
}
12981339

1340+
// 清除验证码Session
1341+
if (in_array($registerType, ['personal', 'expert', 'enterprise'])) {
1342+
Session::forget('registerPhoneVerify');
1343+
Session::forget('registerPhoneVerifyTime');
1344+
Session::forget('registerPhone');
1345+
}
1346+
12991347
// 登录用户
13001348
\Module\Blog\Member\Auth\MemberUser::login($member);
13011349

@@ -1364,22 +1412,22 @@ public function registerPhoneVerify()
13641412
if (modstart_config('registerDisable', false)) {
13651413
return Response::generate(-1, '禁止注册');
13661414
}
1367-
if (!modstart_config('registerPhoneEnable')) {
1368-
return Response::generate(-1, '注册未开启手机');
1369-
}
1415+
// if (!modstart_config('registerPhoneEnable')) {
1416+
// return Response::generate(-1, '注册未开启手机');
1417+
// }
13701418
$input = InputPackage::buildFromInput();
13711419

13721420
$phone = $input->getPhone('target');
13731421
if (empty($phone)) {
13741422
return Response::generate(-1, '手机不能为空');
13751423
}
13761424

1377-
if (!Session::get('registerCaptchaPass', false)) {
1378-
return Response::generate(-1, '请先进行安全验证');
1379-
}
1380-
if (!SessionUtil::atomicConsume('registerCaptchaPassCount')) {
1381-
return Response::generate(-1, '请进行安全验证');
1382-
}
1425+
// if (!Session::get('registerCaptchaPass', false)) {
1426+
// return Response::generate(-1, '请先进行安全验证');
1427+
// }
1428+
// if (!SessionUtil::atomicConsume('registerCaptchaPassCount')) {
1429+
// return Response::generate(-1, '请进行安全验证');
1430+
// }
13831431

13841432
$memberUser = MemberUtil::getByPhone($phone);
13851433
if (!empty($memberUser)) {
@@ -1525,9 +1573,9 @@ public function oauthBindEmailVerify()
15251573
*/
15261574
public function oauthBindPhoneVerify()
15271575
{
1528-
if (!modstart_config('Member_OauthBindPhoneEnable')) {
1529-
return Response::generate(-1, '注册未开启手机');
1530-
}
1576+
// if (!modstart_config('Member_OauthBindPhoneEnable')) {
1577+
// return Response::generate(-1, '注册未开启手机');
1578+
// }
15311579
$input = InputPackage::buildFromInput();
15321580

15331581
$phone = $input->getPhone('target');

0 commit comments

Comments
 (0)