diff --git a/app/api/controller/LocalStoreGoods.php b/app/api/controller/LocalStoreGoods.php index d6ace722..9dc60b0c 100755 --- a/app/api/controller/LocalStoreGoods.php +++ b/app/api/controller/LocalStoreGoods.php @@ -62,4 +62,12 @@ class LocalStoreGoods extends Api } return JsonServer::error('获取失败'); } + + public function setState() + { + $form = $this->request->post(); + dump($form);die; +// $result = LocalStoreGoodsLogic::setState($form); + + } } \ No newline at end of file diff --git a/app/api/logic/LocalStoreGoodsLogic.php b/app/api/logic/LocalStoreGoodsLogic.php index ccb4970e..6f7713c6 100644 --- a/app/api/logic/LocalStoreGoodsLogic.php +++ b/app/api/logic/LocalStoreGoodsLogic.php @@ -10,7 +10,10 @@ use think\facade\Config; class LocalStoreGoodsLogic extends Logic { - private static $SHELVES = 1; + private static $STATUS = [ + 'shelves' => 1, + 'status_sold_out' => 2 + ]; // 获取商品列表 public static function lists($get) @@ -66,7 +69,7 @@ class LocalStoreGoodsLogic extends Logic 'price' => $form['price'], 'desc' => isset($form['desc']) ?? '', 'details' => isset($form['details']) ?? '', - 'state' => self::$SHELVES, + 'state' => self::$STATUS['shelves'], 'create_time' => time(), ]); } else if ($form['type'] === 'edit') { @@ -129,7 +132,7 @@ class LocalStoreGoodsLogic extends Logic // 获取商品详情 public static function details($get) { - $data = LocalStoreGoods::with('pic') + $data = LocalStoreGoods::with('pic') ->where([ 'id' => $get['id'], 'user_id' => $get['user_id'], @@ -147,4 +150,10 @@ class LocalStoreGoodsLogic extends Logic return false; } + + // 设置状态 + public static function setState($form) + { + + } } \ No newline at end of file