diff --git a/app/Http/Controllers/Mobile/SupplyDemandController.php b/app/Http/Controllers/Mobile/SupplyDemandController.php index 949cfee..ad0ed55 100755 --- a/app/Http/Controllers/Mobile/SupplyDemandController.php +++ b/app/Http/Controllers/Mobile/SupplyDemandController.php @@ -86,6 +86,9 @@ class SupplyDemandController extends CommonController $detail = SupplyDemand::with(['user' => function ($query) { $query->select('id', 'nickname', 'name', 'headimgurl'); }])->find($all['id']); + // 增加view_count + $detail->increment('view_count'); + $detail->save(); return $this->success($detail); } @@ -103,6 +106,7 @@ class SupplyDemandController extends CommonController * @OA\Parameter(name="wechat", in="query", @OA\Schema(type="string"), required=false, description="微信号"), * @OA\Parameter(name="mobile", in="query", @OA\Schema(type="string"), required=false, description="电话"), * @OA\Parameter(name="email", in="query", @OA\Schema(type="string"), required=false, description="邮箱"), + * @OA\Parameter(name="expire_time", in="query", @OA\Schema(type="string"), required=false, description="过期时间"), * @OA\Parameter(name="status", in="query", @OA\Schema(type="integer"), required=false, description="审核状态(0:待审核;1:通过;2:拒绝)"), * @OA\Response( * response="200", @@ -231,6 +235,9 @@ class SupplyDemandController extends CommonController 'content' => $all['content'], 'is_read' => 0 ]); + // 增加view_count + $model->increment('contact_count'); + $model->save(); return $this->success('删除成功'); } diff --git a/database/migrations/2025_06_20_100410_create_supply_demands_table.php b/database/migrations/2025_06_20_100410_create_supply_demands_table.php index 546c855..6b73473 100644 --- a/database/migrations/2025_06_20_100410_create_supply_demands_table.php +++ b/database/migrations/2025_06_20_100410_create_supply_demands_table.php @@ -32,6 +32,12 @@ return new class extends Migration { $table->string('email')->nullable()->comment('邮箱'); // 审核状态 $table->tinyInteger('status')->default(0)->comment('状态0待审核1通过2拒绝'); + // 浏览次数 + $table->integer('view_count')->default(0)->comment('浏览次数'); + // 联系次数 + $table->integer('contact_count')->default(0)->comment('联系次数'); + // 有效期 + $table->string('expire_time')->nullable()->comment('有效期'); $table->timestamps(); $table->softDeletes(); });