|
|
|
|
@ -178,14 +178,14 @@ class StockCompanyController extends BaseController
|
|
|
|
|
$all['admin_id'] = $this->getUserId();
|
|
|
|
|
$all['department_id'] = $this->getUser()->department_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果提供了上市时间和入学时间,自动计算是否入学后上市
|
|
|
|
|
if (isset($all['stock_date']) && isset($all['enrollment_date'])) {
|
|
|
|
|
$stockDate = strtotime($all['stock_date']);
|
|
|
|
|
$enrollmentDate = strtotime($all['enrollment_date']);
|
|
|
|
|
$all['is_after_enrollment'] = ($stockDate > $enrollmentDate) ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$original = $model->getOriginal();
|
|
|
|
|
$model->fill($all);
|
|
|
|
|
$model->save();
|
|
|
|
|
@ -218,62 +218,5 @@ class StockCompanyController extends BaseController
|
|
|
|
|
return parent::destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/admin/stock-company/this-year-new",
|
|
|
|
|
* tags={"上市公司管理"},
|
|
|
|
|
* summary="今年新增上市公司",
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Parameter(name="year", in="query", @OA\Schema(type="string"), required=false, description="年份,默认为当前年份"),
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="暂无"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function thisYearNew()
|
|
|
|
|
{
|
|
|
|
|
$all = request()->all();
|
|
|
|
|
$year = $all['year'] ?? date('Y');
|
|
|
|
|
$startDate = $year . '-01-01';
|
|
|
|
|
$endDate = $year . '-12-31';
|
|
|
|
|
|
|
|
|
|
$list = $this->model->whereBetween('stock_date', [$startDate, $endDate])
|
|
|
|
|
->orderBy('stock_date', 'desc')
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
return $this->success([
|
|
|
|
|
'year' => $year,
|
|
|
|
|
'total' => $list->count(),
|
|
|
|
|
'list' => $list
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/admin/stock-company/after-enrollment",
|
|
|
|
|
* tags={"上市公司管理"},
|
|
|
|
|
* summary="入学后新上市公司数据显示",
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="暂无"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function afterEnrollment()
|
|
|
|
|
{
|
|
|
|
|
$list = $this->model->where('is_after_enrollment', 1)
|
|
|
|
|
->orderBy('stock_date', 'desc')
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
return $this->success([
|
|
|
|
|
'total' => $list->count(),
|
|
|
|
|
'list' => $list
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|