|
@@ -0,0 +1,55 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\admin\controller\smart_devices;
|
|
|
+
|
|
|
+use app\admin\validate\smart_devices\ProductValidate;
|
|
|
+use app\controller\Curd;
|
|
|
+use app\model\SmartDevicesProduct;
|
|
|
+use support\Request;
|
|
|
+use support\Response;
|
|
|
+
|
|
|
+class ProductController extends Curd
|
|
|
+{
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $this->model = new SmartDevicesProduct();
|
|
|
+ $this->validate = true;
|
|
|
+ $this->validateClass = new ProductValidate();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Desc 列表
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/3/8 13:34
|
|
|
+ *
|
|
|
+ * @param Request $request
|
|
|
+ * @return Response
|
|
|
+ * @throws \support\exception\BusinessException
|
|
|
+ */
|
|
|
+ public function select(Request $request): Response
|
|
|
+ {
|
|
|
+ [$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
|
|
+ $order = $request->get('order', 'desc');
|
|
|
+ $field = $field ?? 'product_add_time';
|
|
|
+ $where['product_is_del'] = 0;
|
|
|
+ $query = $this->doSelect($where, $field, $order);
|
|
|
+ return $this->doFormat($query, $format, $limit);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Desc 删除
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/3/8 13:34
|
|
|
+ *
|
|
|
+ * @param Request $request
|
|
|
+ * @return Response
|
|
|
+ * @throws \support\exception\BusinessException
|
|
|
+ */
|
|
|
+ public function delete(Request $request): Response
|
|
|
+ {
|
|
|
+ $ids = $this->deleteInput($request);
|
|
|
+ $this->doSoftDelete($ids, ['product_is_del' => 1]);
|
|
|
+
|
|
|
+ return json_success('success');
|
|
|
+ }
|
|
|
+}
|