|
|
|
|
@ -16,6 +16,7 @@ use App\Models\SupplyDemand;
|
|
|
|
|
use App\Models\SupplyDemandKeep;
|
|
|
|
|
use App\Notifications\BirthdayNotify;
|
|
|
|
|
use App\Notifications\SupplyDemandNotify;
|
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
|
@ -32,11 +33,12 @@ class SupplyDemandController extends CommonController
|
|
|
|
|
* @OA\Parameter(name="myself", in="query", @OA\Schema(type="integer"), required=true, description="是否只看自己的0否1是"),
|
|
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="integer"), required=true, description="类型"),
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="integer"), required=true, description="关键词"),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", @OA\Schema(type="integer"), required=true, description="状态0待审核1通过2拒绝"),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", @OA\Schema(type="integer"), required=true, description="状态0待审核1通过2拒绝3退回修改4永久隐藏"),
|
|
|
|
|
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
|
|
|
|
|
* @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"),
|
|
|
|
|
* @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"),
|
|
|
|
|
* @OA\Parameter(name="expire_type", in="query", @OA\Schema(type="string"), required=false, description="有效期类型1有效期内2失效的"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="暂无"
|
|
|
|
|
@ -63,6 +65,15 @@ class SupplyDemandController extends CommonController
|
|
|
|
|
if (isset($all['myself']) && $all['myself'] == 1) {
|
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['expire_type'])) {
|
|
|
|
|
if ($all['expire_type'] == 1) {
|
|
|
|
|
$query->where(function ($q) {
|
|
|
|
|
$q->whereNull('expire_time')->orWhere('expire_time', '>', Carbon::now());
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
$query->where('expire_time', '<', Carbon::now());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
|
|
|
|
|
->paginate($all['page_size'] ?? 20);
|
|
|
|
|
return $this->success(compact('supplyDemands'));
|
|
|
|
|
@ -100,6 +111,8 @@ class SupplyDemandController extends CommonController
|
|
|
|
|
// 增加view_count
|
|
|
|
|
$detail->increment('view_count');
|
|
|
|
|
$detail->save();
|
|
|
|
|
// 判断是否发送过私信
|
|
|
|
|
$detail->messages_count = Message::where('supply_demand_id', $detail->id)->where('user_id', $this->getUserId())->count();
|
|
|
|
|
return $this->success($detail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -118,7 +131,10 @@ class SupplyDemandController extends CommonController
|
|
|
|
|
* @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\Parameter(name="public_way", in="query", @OA\Schema(type="string"), required=false, description="公开模式1直接公开2私信后自动公开3不公开"),
|
|
|
|
|
* @OA\Parameter(name="file_ids", in="query", @OA\Schema(type="string"), required=false, description="文件id数组"),
|
|
|
|
|
* @OA\Parameter(name="contact_name", 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拒绝3退回修改4永久隐藏"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="暂无"
|
|
|
|
|
|