v1.0.10
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 需求详情接口 GET /api/need/detail.php?id=1
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
|
||||
checkPermission('need');
|
||||
|
||||
$id = (int)($_REQUEST['id'] ?? 0);
|
||||
if ($id <= 0) {
|
||||
Response::error('参数错误', 400);
|
||||
}
|
||||
|
||||
$pdo = DB::getInstance()->getPdo();
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT cn.*, c.display_name, c.industry, c.country, c.website
|
||||
FROM company_needs cn
|
||||
LEFT JOIN companies c ON c.id = cn.company_id
|
||||
WHERE cn.id = ?"
|
||||
);
|
||||
$stmt->execute([$id]);
|
||||
$need = $stmt->fetch();
|
||||
if (!$need) {
|
||||
Response::error('需求不存在');
|
||||
}
|
||||
|
||||
Response::success(['need' => $need]);
|
||||
Reference in New Issue
Block a user