Commit 63dbf8f4 by yink

fix: 修复代收点经纬度参数错误并添加日志记录

修复前端传递的经纬度参数错误问题,将lat和lng参数互换位置
在商品库存更新和距离计算中添加日志记录
更新代购产品表单提示信息
优化订单控制器注释说明
parent a1a99506
...@@ -186,7 +186,7 @@ protected function form() ...@@ -186,7 +186,7 @@ protected function form()
->limit(9) ->limit(9)
->autoUpload()->saveAsJson(); ->autoUpload()->saveAsJson();
$form->switch('is_show', '上架状态')->default(1); $form->switch('is_show', '上架状态')->default(1);
$form->switch('goods_type', '是否代购产品')->default(0); $form->switch('goods_type', '是否代购产品(代购才会有代购价)')->default(0);
$form->switch('is_hot', '是否推荐')->default(0); $form->switch('is_hot', '是否推荐')->default(0);
$form->text('sort', '排序')->default(0)->help('越大越靠前'); $form->text('sort', '排序')->default(0)->help('越大越靠前');
$form->disableCreatingCheck(); $form->disableCreatingCheck();
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
class OrderController extends BaseController class OrderController extends BaseController
{ {
//立即购买-确认订单【好像没什么用 //立即购买-确认订单【提供前端一些订单信息
public function CheckoutBuyOrder(Request $request) public function CheckoutBuyOrder(Request $request)
{ {
$userObj = $request->user(); $userObj = $request->user();
...@@ -51,6 +51,7 @@ public function CheckoutBuyOrder(Request $request) ...@@ -51,6 +51,7 @@ public function CheckoutBuyOrder(Request $request)
$goods_price = ($arrObj && $goodsObj->goods_type && $merchant_id) ? $arrObj->cg_price : $arrObj->market_price; $goods_price = ($arrObj && $goodsObj->goods_type && $merchant_id) ? $arrObj->cg_price : $arrObj->market_price;
} }
$data = []; $data = [];
$data['goods_id'] = $goods_id; $data['goods_id'] = $goods_id;
$data['goods_name'] = $goodsObj->goods_name; $data['goods_name'] = $goodsObj->goods_name;
......
...@@ -20,9 +20,10 @@ public function getList() ...@@ -20,9 +20,10 @@ public function getList()
//代收点列表 //代收点列表
public function getDeliveryList(Request $request) public function getDeliveryList(Request $request)
{ {
//疑似前端搞返了这两个值,外包前端,改完还要提审,不找他算了直接用
$mid = $request->user()->merchant_id; $mid = $request->user()->merchant_id;
$lat1 = $request->lat ?? ''; $lat1 = $request->lng ?? '';
$lng1 = $request->lng ?? ''; $lng1 = $request->lat ?? '';
$list = []; $list = [];
if ($mid) { if ($mid) {
$list = Store::where(['merchant_id' => $mid]) $list = Store::where(['merchant_id' => $mid])
...@@ -97,7 +98,7 @@ public function testHaversineDistance(Request $request) ...@@ -97,7 +98,7 @@ public function testHaversineDistance(Request $request)
function haversineDistance($lat1, $lng1, $lat2, $lng2) function haversineDistance($lat1, $lng1, $lat2, $lng2)
{ {
Log::info(['lat1' => $lat1, 'lng1' => $lng1, 'lat2' => $lat2, 'lng2' => $lng2]);
// 地球半径(单位:千米) // 地球半径(单位:千米)
$radius = 6371; $radius = 6371;
......
...@@ -750,6 +750,13 @@ public static function updateGoodsStock($orderObj, $isIncreaseStock = false) ...@@ -750,6 +750,13 @@ public static function updateGoodsStock($orderObj, $isIncreaseStock = false)
'merchant_id' => $orderObj->merchant_id 'merchant_id' => $orderObj->merchant_id
])->first(); ])->first();
// Log::add('更新商品规格库存', [
// 'mgsObj' => $mgsObj,
// 'merchant_id' => $orderObj->merchant_id,
// 'isIncreaseStock' => $isIncreaseStock,
// ]);
// 如果订单有商户ID且找到对应的商户规格库存记录,则更新商户规格库存 // 如果订单有商户ID且找到对应的商户规格库存记录,则更新商户规格库存
if ($orderObj->merchant_id && $mgsObj) { if ($orderObj->merchant_id && $mgsObj) {
// 根据参数决定是增加还是减少库存 // 根据参数决定是增加还是减少库存
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment