修改错误信息返回格式

This commit is contained in:
wangxiaowei 2024-10-30 17:07:03 +08:00
parent 52e5758c6d
commit 8154460c5b
2 changed files with 6 additions and 3 deletions

@ -136,8 +136,11 @@ class LocalStoreGoods extends Api
(new LocalStoreGoodsCartValidate())->goCheck('change', ['user_id' => $this->user_id]);
try {
$result = LocalStoreGoodsCartLogic::modifyCart($form, $this->user_id);;
return JsonServer::success('操作成功', $result);
$result = LocalStoreGoodsCartLogic::modifyCart($form, $this->user_id);
if ($result) {
return JsonServer::success('操作成功', $result);
}
return JsonServer::error('操作失败');
} catch (\Exception $e) {
return JsonServer::error($e->getMessage());
}

@ -113,7 +113,7 @@ class LocalStoreGoodsCartLogic extends Logic
}
}
$price = number_format($post['num'] * $item['price'], 2, '.', '');
$price = number_format($post['goods_num'] * $item['price'], 2, '.', '');
$goods_num = $cart['goods_num'] + $post['goods_num'];
LocalStoreGoodsCart::where('id', $post['cart_id'])->update([