添加商品详情的获取

This commit is contained in:
wangxiaowei 2024-08-23 09:31:23 +08:00
parent 1c20d90a86
commit b4eb4fbe0c
2 changed files with 27 additions and 0 deletions

@ -9,6 +9,7 @@ use app\common\server\JsonServer;
class LocalStoreGoods extends Api
{
// 商品列表
public function lists()
{
$get = $this->request->get();
@ -36,4 +37,16 @@ class LocalStoreGoods extends Api
}
return JsonServer::success('提交成功', [], 1, 1);
}
public function details()
{
$get = $this->request->get();
$get['user_id'] = $this->user_id;
$result = LocalStoreGoodsLogic::details($get);
if ($result) {
return JsonServer::success('获取成功', $result);
}
return JsonServer::error('获取失败');
}
}

@ -10,6 +10,7 @@ use think\facade\Config;
class LocalStoreGoodsLogic extends Logic
{
// 获取商品列表
public static function lists($get)
{
$list = LocalStoreGoods::with('pic')
@ -49,6 +50,7 @@ class LocalStoreGoodsLogic extends Logic
return $result;
}
// 添加商品
public static function addGoods($form, $user_id)
{
try {
@ -74,4 +76,16 @@ class LocalStoreGoodsLogic extends Logic
return false;
}
}
// 获取商品详情
public static function details($get)
{
return LocalStoreGoods::with('pic')
->where([
'id' => $get['id'],
'user_id' => $get['user_id'],
'lstore_id' => $get['lstore_id'],
'delete_time' => 0,
])->find();
}
}