소스 검색

fixed:用户端-生成邀请链接

刘学玺 4 달 전
부모
커밋
4446466403
4개의 변경된 파일11개의 추가작업 그리고 13개의 파일을 삭제
  1. 2 2
      app/Models/CoachInfoRecord.php
  2. 2 0
      app/Models/CoachUser.php
  3. 5 11
      app/Services/Client/UserService.php
  4. 2 0
      app/Traits/HasStateText.php

+ 2 - 2
app/Models/CoachInfoRecord.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(encoding='UTF-8');
+
 namespace App\Models;
 
 use App\Enums\TechnicianAuthStatus;
@@ -35,8 +37,6 @@ class CoachInfoRecord extends Model
 
     /**
      * 获取状态文本
-     *
-     * @return string
      */
     public function getStateTextAttribute(): string
     {

+ 2 - 0
app/Models/CoachUser.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(encoding='UTF-8');
+
 namespace App\Models;
 
 use App\Enums\TechnicianStatus;

+ 5 - 11
app/Services/Client/UserService.php

@@ -52,12 +52,6 @@ class UserService
             // 加载技师信息
             $user->load('coach:id,user_id,state');
 
-            // 如果有技师信息,添加状态文本
-            if ($user->coach) {
-                $user->coach->makeVisible(['state']);
-                $user->coach->state_text = TechnicianStatus::fromValue($user->coach->state)?->label() ?? '未知状态';
-            }
-
             return $user;
         } catch (\Exception $e) {
             // 记录错误日志
@@ -93,7 +87,7 @@ class UserService
             abort_if(MemberUser::where('mobile', $mobile)->exists(), 422, '该手机号已注册');
 
             // 验证短信验证码
-            abort_if(! $this->verifySmsCode($mobile, $code), 422, '验证码错或已过期');
+            abort_if(! $this->verifySmsCode($mobile, $code), 422, '验证码错或已过期');
 
             // 创建用户
             $user = MemberUser::create([
@@ -316,7 +310,7 @@ class UserService
      *    - 关联技师记录和申请记录
      *
      * @param  MemberUser  $user  用户模型
-     * @param  string  $mobile  手机号
+     * @param  string  $mobile  联系电话
      * @param  int  $gender  性别(1:男/2:女)
      * @param  int  $age  年龄
      * @param  string  $work_years  工作年限
@@ -383,7 +377,7 @@ class UserService
      * @param  Coach  $coach  技师模型
      * @return bool 如果可以申请返回 true
      *
-     * @throws \Illuminate\Http\Exceptions\HttpResponseException 当不能申请抛出异常
+     * @throws \Illuminate\Http\Exceptions\HttpResponseException 当不能申请抛出异常
      */
     private function validateExistingApplication($coach): bool
     {
@@ -463,7 +457,7 @@ class UserService
      * 2. 根据用户型生成邀请码
      * 3. 生成包含邀请参数的接
      * 4. 生成邀请维码
-     * 5. 记录邀请码生日志
+     * 5. 记录邀请码生���日志
      *
      * @param  string  $type  邀请码类型(user/coach)
      * @return array 返回邀请码和二维码信息
@@ -559,7 +553,7 @@ class UserService
      * 根据类型生成邀请码
      *
      * 业务逻辑:
-     * 1. ��合类型和ID
+     * 1. 合类型和ID
      * 2. 生成格式化的邀请码
      *
      * @param  string  $type  邀请类型(user/coach)

+ 2 - 0
app/Traits/HasStateText.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(encoding='UTF-8');
+
 namespace App\Traits;
 
 /**