|
@@ -6,6 +6,7 @@ use catcher\base\CatchRequest as Request;
|
|
|
use catcher\CatchResponse;
|
|
|
use catcher\base\CatchController;
|
|
|
use catchAdmin\fan\model\Fan as fanModel;
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
class Fan extends CatchController
|
|
|
{
|
|
@@ -13,6 +14,7 @@ class Fan extends CatchController
|
|
|
|
|
|
public function __construct(FanModel $fanModel)
|
|
|
{
|
|
|
+
|
|
|
$this->fanModel = $fanModel;
|
|
|
}
|
|
|
|
|
@@ -23,6 +25,7 @@ class Fan extends CatchController
|
|
|
*/
|
|
|
public function index(Request $request) : \think\Response
|
|
|
{
|
|
|
+
|
|
|
return CatchResponse::paginate($this->fanModel->getList());
|
|
|
}
|
|
|
|
|
@@ -33,7 +36,14 @@ class Fan extends CatchController
|
|
|
*/
|
|
|
public function save(Request $request) : \think\Response
|
|
|
{
|
|
|
- return CatchResponse::success($this->fanModel->storeBy($request->post()));
|
|
|
+ $data = $request->post();
|
|
|
+ if($data['production_date']){
|
|
|
+ $data['production_date'] = date('Y-m-d',$data['production_date']);
|
|
|
+ }
|
|
|
+ if($data['install_date']){
|
|
|
+ $data['install_date'] = date('Y-m-d',$data['install_date']);
|
|
|
+ }
|
|
|
+ return CatchResponse::success($this->fanModel->storeBy($data));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -66,4 +76,5 @@ class Fan extends CatchController
|
|
|
{
|
|
|
return CatchResponse::success($this->fanModel->deleteBy($id));
|
|
|
}
|
|
|
+
|
|
|
}
|