Browse Source

feat:钱包和获取项目信息逻辑优化

景好勇win11 3 months ago
parent
commit
c3789716f8

+ 2 - 1
.gitignore

@@ -19,7 +19,8 @@ yarn-error.log
 /.idea
 /.zed
 /.scribe
-/resources/views/vendor/scribe
+/resources/views/
+vendor/scribe
 /public/docs
 .user.ini
 public/admin-assets

+ 1 - 0
app/Http/Controllers/Coach/AccountController.php

@@ -602,6 +602,7 @@ class AccountController extends Controller
      */
     public function updateBasicInfo(UpdateBasicInfoRequest $request)
     {
+        Log::error($request);
         return $this->success(
             $this->service->updateBasicInfo(Auth::user()->coach, $request->validated())
         );

+ 2 - 2
app/Services/Client/CoachLocationService.php

@@ -45,7 +45,7 @@ class CoachLocationService
         $longitude = $data['longitude'];
         $latitude = $data['latitude'];
         $type = $data['type'];
-        $locationName = $coach->id.'_'.$type; // 假设数据中有一个名称字段
+        $locationName = $coach->id . '_' . $type; // 假设数据中有一个名称字段
 
         // 使用 Redis 的 GEOADD 命令
         Redis::geoadd('coach_locations', $longitude, $latitude, $locationName);
@@ -70,7 +70,7 @@ class CoachLocationService
         $location?->delete();
 
         // 从 Redis 中删除地理位置记录
-        $locationName = $coachId.'_'.$type;
+        $locationName = $coachId . '_' . $type;
         Redis::zrem('coach_locations', $locationName);
 
         return response()->json(['message' => 'Deleted successfully']);

+ 3 - 3
app/Services/Client/WalletService.php

@@ -2,14 +2,14 @@
 
 namespace App\Services\Client;
 
+use App\Models\Wallet;
 use App\Enums\UserStatus;
-use App\Enums\WithdrawStatus;
 use App\Models\MemberUser;
-use App\Models\Wallet;
+use App\Enums\WithdrawStatus;
 use App\Models\WalletTransRecord;
-use App\Models\WalletWithdrawRecord;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
+use App\Models\WalletWithdrawRecord;
 
 class WalletService
 {

+ 23 - 10
app/Services/Coach/AccountService.php

@@ -1246,6 +1246,7 @@ class AccountService
      *        - gender: ?int 性别(1:男 2:女)
      *        - mobile: ?string 手机号
      *        - code: ?string 验证码(修改手机号时必填)
+     *        - avatar: ?string 头像
      * @return array 返回结果
      */
     public function updateBasicInfo(CoachUser $coach, array $data): array
@@ -1269,6 +1270,7 @@ class AccountService
                 'nickname' => '',
                 'gender' => '',
                 'mobile' => '',
+                'avatar' => ''
             ]);
 
             // 如果没有要更新的字段,直接返回
@@ -1414,17 +1416,28 @@ class AccountService
             return [
                 'id' => $item->id,
                 'project_id' => $item->project_id,
-                'project_name' => $item->project?->name,
-                'category_id' => $item->project?->category_id,
+                'project_name' => $item->project?->title,
+                'category_id' => $item->project?->cate_id,
                 'category_name' => $item->project?->category?->name,
-                'duration' => $item->project?->duration,          // 服务时长(分钟)
-                'price' => $item->project?->price,               // 项目价格
-                'discount_amount' => $item->discount_amount,      // 优惠金额
-                'final_price' => $item->project?->price - $item->discount_amount,  // 最终价格
-                'service_gender' => $item->service_gender,        // 服务性别
-                'service_distance' => $item->service_distance,    // 服务距离(米)
-                'traffic_fee_type' => $item->traffic_fee_type,   // 路费类型
-                'traffic_fee' => $item->traffic_fee,             // 路费金额
+                'cover' => $item->project?->cover,
+                'subtitle' => $item->project?->subtitle,
+                'duration' => $item->project?->duration,
+                'price' => $item->project?->price,
+                'original_price' => $item->project?->original_price,
+                'sales' => $item->project?->sales,
+                'project_desc' => $item->project?->project_desc,
+                'service_desc' => $item->project?->service_desc,
+                'service_posture' => $item->project?->service_posture,
+                'service_process' => $item->project?->service_process,
+                'suitable_population' => $item->project?->suitable_population,
+                'taboo_symptoms' => $item->project?->taboo_symptoms,
+                'discount_amount' => $item->discount_amount,
+                'service_gender' => $item->service_gender,
+                'service_distance' => $item->service_distance,
+                'traffic_fee_type' => $item->traffic_fee_type,
+                'traffic_fee' => $item->traffic_fee,
+                'voucher' => $item->voucher,
+                'state' => $item->state,
                 'created_at' => $item->created_at?->format('Y-m-d H:i:s'),
                 'updated_at' => $item->updated_at?->format('Y-m-d H:i:s'),
             ];

+ 13 - 0
app/Services/Coach/ProjectService.php

@@ -259,6 +259,19 @@ class ProjectService
         return [
             'project_id' => $projectId,
             'project_name' => $project->title,
+            'project_info' => [
+                'cover' => $project->cover,
+                'subtitle' => $project->subtitle,
+                'price' => $project->price,
+                'original_price' => $project->original_price,
+                'duration' => $project->duration,
+                'project_desc' => $project->project_desc,
+                'service_desc' => $project->service_desc,
+                'service_posture' => $project->service_posture,
+                'service_process' => $project->service_process,
+                'suitable_population' => $project->suitable_population,
+                'taboo_symptoms' => $project->taboo_symptoms
+            ],
             'settings' => [
                 'voucher' => $coachProject->discount_amount,
                 'gender' => $coachProject->service_gender,

+ 4 - 3
app/Services/Coach/WalletService.php

@@ -2,13 +2,13 @@
 
 namespace App\Services\Coach;
 
-use App\Enums\WithdrawStatus;
-use App\Models\MemberUser;
 use App\Models\Wallet;
+use App\Models\MemberUser;
+use App\Enums\WithdrawStatus;
 use App\Models\WalletTransRecord;
-use App\Models\WalletWithdrawRecord;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
+use App\Models\WalletWithdrawRecord;
 
 class WalletService
 {
@@ -26,6 +26,7 @@ class WalletService
 
             // 获取技师钱包
             $wallet = $user->coach->wallet;
+            abort_if(! $wallet, 404, '钱包信息不存在');
 
             // 获取钱包流水统计
             $statistics = $this->getWalletStatistics($wallet->id);

+ 3 - 0
doc/系统设计/数据库设计/数据库备份/New_Query_1735613396410.sql

@@ -0,0 +1,3 @@
+-- Active: 1735126617549@@192.168.110.85@3306@xiaoding_dev
+
+