Merge pull request 'dev' (#473) from dev into main

Reviewed-on: #473
This commit is contained in:
mkm 2025-01-20 11:25:22 +08:00
commit f0b7f234f4
11 changed files with 201 additions and 74 deletions

View File

@ -176,4 +176,11 @@ class BeforehandOrderCartInfoController extends BaseAdminController
return $this->success('操作成功', [], 1, 1); return $this->success('操作成功', [], 1, 1);
} }
public function setStoreSale()
{
$params = $this->request->post();
BeforehandOrderCartInfoLogic::setStoreSale($params);
return $this->success('操作成功', [], 1, 1);
}
} }

View File

@ -42,9 +42,21 @@ class PurchaseProductOfferController extends BaseAdminController
$params['admin_id'] = $this->adminId; $params['admin_id'] = $this->adminId;
$result = PurchaseProductOfferLogic::add($params); $result = PurchaseProductOfferLogic::add($params);
return $this->success('设置成功', [], 1, 1); return $this->success('设置成功', [], 1, 1);
} }
/**
* @notes 一键添加往期采购商品
* @return \think\response\Json
* @author admin
* @date 2024/08/14 15:06
*/
public function add_purchases_one_click()
{
$params = $this->request->post();
$params['admin_id'] = $this->adminId;
$result = PurchaseProductOfferLogic::AddPurchasesOneClick($params);
return $this->success('设置成功', [], 1, 1);
}
/** /**
* @notes 编辑采购商品 * @notes 编辑采购商品

View File

@ -114,11 +114,13 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
$item->order_type_name = '仓库补货'; $item->order_type_name = '仓库补货';
$item->outbound = '无须出库'; $item->outbound = '无须出库';
} elseif ($item->order_type == 6) { } elseif ($item->order_type == 6) {
$item->order_type_name = '往期补单'; $item->order_type_name = '往期补单-出库';
} elseif ($item->order_type == 7) { } elseif ($item->order_type == 7) {
$item->order_type_name = '采购订单'; $item->order_type_name = '采购订单';
} elseif ($item->order_type == 8) { } elseif ($item->order_type == 8) {
$item->order_type_name = '其他订单'; $item->order_type_name = '其他订单';
}elseif ($item->order_type == 9) {
$item->order_type_name = '往期补单-入库';
} }
$item->msg = ''; $item->msg = '';
$count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id'); $count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id');

View File

@ -77,7 +77,7 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
} }
} }
$list = BeforehandOrderCartInfo::where($this->searchWhere) $list = BeforehandOrderCartInfo::where($this->searchWhere)
->field(['id', 'bhoid', 'package', 'store_info', 'marques', 'gross_weight', 'net_weight', 'accept_num', 'after_sales', 'loss', 'uid', 'pay_price', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark','create_time', 'procurement_order_id']) ->field(['id', 'bhoid', 'package', 'store_info', 'marques', 'gross_weight', 'net_weight', 'accept_num', 'after_sales', 'loss', 'uid', 'pay_price', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark','create_time', 'procurement_order_id', 'store_sale'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item) use ($system_store, $order_mark) { ->select()->each(function ($item) use ($system_store, $order_mark) {

View File

@ -2,6 +2,7 @@
namespace app\admin\logic\beforehand_order; namespace app\admin\logic\beforehand_order;
use app\admin\logic\store_branch_product\StoreBranchProductLogic;
use app\admin\logic\store_product\StoreProductLogic; use app\admin\logic\store_product\StoreProductLogic;
use app\admin\logic\warehouse_product\WarehouseProductLogic; use app\admin\logic\warehouse_product\WarehouseProductLogic;
use app\api\logic\order\CartLogic; use app\api\logic\order\CartLogic;
@ -329,12 +330,16 @@ class BeforehandOrderLogic extends BaseLogic
try { try {
$find = BeforehandOrder::where('id', $params['id'])->find(); $find = BeforehandOrder::where('id', $params['id'])->find();
$other_data = $params['other_data']; $other_data = $params['other_data'];
$find->save([ $data=[
'other_data' => json_encode($other_data, true), 'other_data' => json_encode($other_data, true),
'file' => $params['file'], 'file' => $params['file'],
'store_id' => $params['store_id'], 'store_id' => $params['store_id'],
'mark' => $params['mark'] 'mark' => $params['mark']
]); ];
if(!empty($params['order_type']) && $params['order_type']>0){
$data['order_type'] = $params['order_type'];
}
$find->save($data);
Db::commit(); Db::commit();
return true; return true;
} catch (\Throwable $e) { } catch (\Throwable $e) {
@ -397,6 +402,7 @@ class BeforehandOrderLogic extends BaseLogic
]; ];
$arr['delivery_time'] = strtotime($delivery_time); $arr['delivery_time'] = strtotime($delivery_time);
$res = WarehouseOrder::create($arr); $res = WarehouseOrder::create($arr);
$totalPrice = '0.00';
foreach ($info as $key => $arr) { foreach ($info as $key => $arr) {
if ($user_ship == 0) { if ($user_ship == 0) {
$price = 0; $price = 0;
@ -421,11 +427,16 @@ class BeforehandOrderLogic extends BaseLogic
'code' => $res['code'], 'code' => $res['code'],
'unit' => $arr['unit'] ?? 0, 'unit' => $arr['unit'] ?? 0,
]; ];
WarehouseProductLogic::setOutbound($data, 1, $admin_id); $totalPrice = bcadd($totalPrice, $arr['total_price'], 2);
if ($arr['store_sale'] == 1) {
StoreBranchProductLogic::decStock($store_id, $arr['product_id'], $arr['cart_num']);
} else {
WarehouseProductLogic::setOutbound($data, 1, $admin_id);
}
} }
$finds = WarehouseProduct::where('oid', $res['id'])->field('sum(nums) as nums,sum(total_price) as total_price')->find(); $finds = WarehouseProduct::where('oid', $res['id'])->field('sum(nums) as nums,sum(total_price) as total_price')->find();
WarehouseOrder::where('id', $res['id'])->update(['total_price' => $finds['total_price'], 'nums' => $finds['nums']]); WarehouseOrder::where('id', $res['id'])->update(['total_price' => $totalPrice, 'nums' => $finds['nums']]);
$order->save(['outbound_id' => $res['id'], 'is_outbound' => 1, 'pay_price' => $finds['total_price']]); $order->save(['outbound_id' => $res['id'], 'is_outbound' => 1, 'pay_price' => $totalPrice]);
BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->update(['is_buyer' => -1]); BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->update(['is_buyer' => -1]);
Db::commit(); Db::commit();
return true; return true;

View File

@ -205,6 +205,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
$arr = [ $arr = [
'warehouse_id' => $params['warehouse_id'], 'warehouse_id' => $params['warehouse_id'],
'supplier_id' => 0, 'supplier_id' => 0,
'order_type' => $beforehandOrder['order_type']??0,
'oid' => $beforehandOrder['id'], 'oid' => $beforehandOrder['id'],
'admin_id' => $params['admin_id'], 'admin_id' => $params['admin_id'],
'financial_pm' => 1, 'financial_pm' => 1,
@ -217,16 +218,6 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
]; ];
$res = WarehouseOrder::create($arr); $res = WarehouseOrder::create($arr);
foreach ($offer_list as $k => $v) { foreach ($offer_list as $k => $v) {
if (!empty($v['source_order_info'])) {
// 采购单来源于往期补单,需要减少对应订单的入库数量
$sourceOrderInfo = reset_index($v['source_order_info'], 'source_order_id');
$orders = BeforehandOrder::field('id,order_type')->whereIn('id', array_keys($sourceOrderInfo))->select()->toArray();
foreach ($orders as $order) {
if ($order['order_type'] == 6) {
$v['buyer_nums'] = $v['buyer_nums'] - $sourceOrderInfo[$order['id']]['need_num'];
}
}
}
$data['admin_id'] = $params['admin_id']; $data['admin_id'] = $params['admin_id'];
$data['order_type'] = $beforehandOrder['order_type']; $data['order_type'] = $beforehandOrder['order_type'];
$data['store_id'] = 0; $data['store_id'] = 0;
@ -339,4 +330,15 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
(new BeforehandOrderCartInfo())->saveAll($update); (new BeforehandOrderCartInfo())->saveAll($update);
} }
public static function setStoreSale($params)
{
$cartInfo = BeforehandOrderCartInfo::where('id', $params['id'])->find();
if ($cartInfo['store_sale'] == 1) {
$update = ['store_sale' => 0];
} else {
$update = ['store_sale' => 1];
}
BeforehandOrderCartInfo::where('id', $params['id'])->update($update);
}
} }

View File

@ -60,7 +60,7 @@ class PurchaseProductOfferLogic extends BaseLogic
if ($mark == '') { if ($mark == '') {
$mark = BeforehandOrderCartInfo::where('bhoid', $params['order_id'])->where('product_id', $params['product_id'])->value('mark'); $mark = BeforehandOrderCartInfo::where('bhoid', $params['order_id'])->where('product_id', $params['product_id'])->value('mark');
} }
$find=StoreProduct::where('id',$params['product_id'])->find(); $find = StoreProduct::where('id', $params['product_id'])->find();
$purchaseProductOffer = PurchaseProductOffer::where(['order_id' => $procurementOrder['id'], 'product_id' => $params['product_id']])->find(); $purchaseProductOffer = PurchaseProductOffer::where(['order_id' => $procurementOrder['id'], 'product_id' => $params['product_id']])->find();
if ($purchaseProductOffer) { if ($purchaseProductOffer) {
$purchaseProductOffer->need_num = $purchaseProductOffer['need_num'] + $params['need_num']; $purchaseProductOffer->need_num = $purchaseProductOffer['need_num'] + $params['need_num'];
@ -107,7 +107,61 @@ class PurchaseProductOfferLogic extends BaseLogic
throw new BusinessException($e->getMessage()); throw new BusinessException($e->getMessage());
} }
} }
/**
* @notes 一键添加往期采购商品
* @param array $params
* @return bool
* @author admin
* @date 2024/08/14 15:06
*/
public static function AddPurchasesOneClick(array $params): bool
{
Db::startTrans();
try {
$arr=BeforehandOrderCartInfo::where('bhoid',$params['order_id'])->select();
$data_arr=[];
$procurementOrder = new BeforehandOrder();
$procurementOrder->order_id = getNewOrderId('CG');
$procurementOrder->buyer_id = $params['buyer_id'];
$procurementOrder->admin_id = $params['admin_id'];
$procurementOrder->order_type = 9;
$procurementOrder->total_price = 0;
$procurementOrder->pay_price = 0;
$procurementOrder->save();
foreach ($arr as $k=>$v){
$data_arr[]=[
'order_id' => $procurementOrder['id'],
'product_id' => $v['product_id'],
'unit' => $v['unit'],
'is_buyer' => $v['is_buyer'],
'need_num' => $v['cart_num'],
'buyer_id' => $params['buyer_id'],
'mark' => '往期补单采购',
'package' => '',
'store_info' => '',
'marques' => '',
'after_sales' => '',
'status' => 0,
'source_order_info' => [
[
'source_order_id' => $params['order_id'],
'product_id' => $v['product_id'],
'need_num' => $v['cart_num'],
'mark' => '往期补单采购',
]
]
];
}
(new PurchaseProductOffer())->saveAll($data_arr);
BeforehandOrderCartInfo::where(['bhoid' => $params['order_id']])->update(['is_buyer' => 1, 'procurement_order_id' => $procurementOrder['id']]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new BusinessException($e->getMessage());
}
}
/** /**
* @notes 编辑采购商品 * @notes 编辑采购商品
@ -182,53 +236,53 @@ class PurchaseProductOfferLogic extends BaseLogic
'manufacture' => $params['manufacture'], 'manufacture' => $params['manufacture'],
'expiration_date' => $params['expiration_date'], 'expiration_date' => $params['expiration_date'],
]); ]);
// $find = StoreProductPrice::where(['offer_id' => $params['id']])->find(); // $find = StoreProductPrice::where(['offer_id' => $params['id']])->find();
$product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id,cate_id')->find(); $product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id,cate_id')->find();
$unit_name=StoreProductUnit::where('id', $offer['unit'])->value('name'); $unit_name = StoreProductUnit::where('id', $offer['unit'])->value('name');
$order = BeforehandOrder::where('id', $params['bhoid'])->find(); $order = BeforehandOrder::where('id', $params['bhoid'])->find();
$order->pay_price = PurchaseProductOffer::where('order_id', $order['id'])->sum('total_price'); $order->pay_price = PurchaseProductOffer::where('order_id', $order['id'])->sum('total_price');
$order->total_price = $order->pay_price; $order->total_price = $order->pay_price;
$order->save(); $order->save();
self::setProductGroupPrice($params, $product); self::setProductGroupPrice($params, $product);
// $data = []; // $data = [];
// $dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select(); // $dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select();
// $data['bhoid'] = $offer['order_id']; // $data['bhoid'] = $offer['order_id'];
// $data['offer_id'] = $params['id']; // $data['offer_id'] = $params['id'];
// $data['product_id'] = $offer['product_id']; // $data['product_id'] = $offer['product_id'];
// $data['purchase_price'] = $params['purchase']; // $data['purchase_price'] = $params['purchase'];
// $data['status'] = 0; // $data['status'] = 0;
// if ($dict_data) { // if ($dict_data) {
// foreach ($dict_data as $k => $v) { // foreach ($dict_data as $k => $v) {
// if ($v['name'] == 'purchase') { // if ($v['name'] == 'purchase') {
// $data['purchase_lv'] = $v['value']; // $data['purchase_lv'] = $v['value'];
// $lv = bcmul($v['value'], $params['purchase'], 2); // $lv = bcmul($v['value'], $params['purchase'], 2);
// $data['purchase'] = bcadd($lv, $params['purchase'], 2); // $data['purchase'] = bcadd($lv, $params['purchase'], 2);
// } elseif ($v['name'] == 'cost') { // } elseif ($v['name'] == 'cost') {
// $data['cost_lv'] = $v['value']; // $data['cost_lv'] = $v['value'];
// $lv = bcmul($v['value'], $params['purchase'], 2); // $lv = bcmul($v['value'], $params['purchase'], 2);
// $data['cost'] = bcadd($lv, $params['purchase'], 2); // $data['cost'] = bcadd($lv, $params['purchase'], 2);
// } elseif ($v['name'] == 'price') { // } elseif ($v['name'] == 'price') {
// $data['price_lv'] = $v['value']; // $data['price_lv'] = $v['value'];
// $lv = bcmul($v['value'], $params['purchase'], 2); // $lv = bcmul($v['value'], $params['purchase'], 2);
// $data['price'] = bcadd($lv, $params['purchase'], 2); // $data['price'] = bcadd($lv, $params['purchase'], 2);
// } // }
// } // }
// } // }
// if ($find) { // if ($find) {
// $find->save($data); // $find->save($data);
// } else { // } else {
// StoreProductPrice::create($data); // StoreProductPrice::create($data);
// } // }
Db::commit(); Db::commit();
$offer['store_name']=$product['store_name']; $offer['store_name'] = $product['store_name'];
$offer['unit_name']=$unit_name; $offer['unit_name'] = $unit_name;
$offer['buyer_name']=DeliveryService::where('uid',$offer['buyer_id'])->value('nickname'); $offer['buyer_name'] = DeliveryService::where('uid', $offer['buyer_id'])->value('nickname');
if($offer['pay_type']==1){ if ($offer['pay_type'] == 1) {
$offer['pay_type_name']='赊账'; $offer['pay_type_name'] = '赊账';
}elseif($offer['pay_type']==2){ } elseif ($offer['pay_type'] == 2) {
$offer['pay_type_name']='现金'; $offer['pay_type_name'] = '现金';
}else{ } else {
$offer['pay_type_name']='没设置'; $offer['pay_type_name'] = '没设置';
} }
ProductOffer::push($offer); ProductOffer::push($offer);
return true; return true;
@ -283,19 +337,19 @@ class PurchaseProductOfferLogic extends BaseLogic
Db::startTrans(); Db::startTrans();
try { try {
PurchaseProductOffer::where('id', $params['id'])->update(['is_accept' => 1]); PurchaseProductOffer::where('id', $params['id'])->update(['is_accept' => 1]);
$find=BeforehandOrderCartInfo::where(['bhoid' => $params['bhoid'], 'product_id' => $params['product_id']])->find(); $find = BeforehandOrderCartInfo::where(['bhoid' => $params['bhoid'], 'product_id' => $params['product_id']])->find();
$data=[ $data = [
'gross_weight' => $params['gross_weight'] ?? 0, 'gross_weight' => $params['gross_weight'] ?? 0,
'net_weight' => $params['net_weight'] ?? 0, 'net_weight' => $params['net_weight'] ?? 0,
'accept_num' => $params['accept_num'] ?? 0, 'accept_num' => $params['accept_num'] ?? 0,
]; ];
if($params['accept_num']!=$find['cart_num']){ if ($params['accept_num'] != $find['cart_num']) {
$pay_price=bcmul($params['accept_num'], $find['price'], 2); $pay_price = bcmul($params['accept_num'], $find['price'], 2);
$data['pay_price']=$pay_price; $data['pay_price'] = $pay_price;
} }
$find->save($data); $find->save($data);
if($params['accept_num']!=$find['cart_num']){ if ($params['accept_num'] != $find['cart_num']) {
$pay_price=BeforehandOrderCartInfo::where(['bhoid' => $params['bhoid']])->sum('pay_price'); $pay_price = BeforehandOrderCartInfo::where(['bhoid' => $params['bhoid']])->sum('pay_price');
BeforehandOrder::where('id', $params['bhoid'])->update(['pay_price' => $pay_price]); BeforehandOrder::where('id', $params['bhoid'])->update(['pay_price' => $pay_price]);
} }
Db::commit(); Db::commit();
@ -368,13 +422,13 @@ class PurchaseProductOfferLogic extends BaseLogic
if (!empty($productCatePriceRate)) { if (!empty($productCatePriceRate)) {
$storeProductGroupPrice = StoreProductGroupPrice::where('product_id', $product['id'])->select()->toArray(); $storeProductGroupPrice = StoreProductGroupPrice::where('product_id', $product['id'])->select()->toArray();
$storeProductGroupPrice = reset_index($storeProductGroupPrice, 'group_id'); $storeProductGroupPrice = reset_index($storeProductGroupPrice, 'group_id');
$purchase=0; $purchase = 0;
foreach ($productCatePriceRate as $k => $v) { foreach ($productCatePriceRate as $k => $v) {
if ($v['id'] == 100001 || $v['id'] == 21) { if ($v['id'] == 100001 || $v['id'] == 21) {
//供货 //供货
$data['purchase_lv'] = bcdiv($v['rate'], 100, 2); $data['purchase_lv'] = bcdiv($v['rate'], 100, 2);
$data['purchase'] = bcmul($params['purchase'], bcadd($data['purchase_lv'], 1, 2), 2); $data['purchase'] = bcmul($params['purchase'], bcadd($data['purchase_lv'], 1, 2), 2);
$purchase=$data['purchase']; $purchase = $data['purchase'];
break; break;
} }
} }
@ -383,12 +437,12 @@ class PurchaseProductOfferLogic extends BaseLogic
if (empty($v['rate'])) { if (empty($v['rate'])) {
continue; continue;
} }
if ($v['id'] == 4 &&$purchase>0) { if ($v['id'] == 4 && $purchase > 0) {
//商户 //商户
$data['cost_lv'] = bcdiv($v['rate'], 100, 2); $data['cost_lv'] = bcdiv($v['rate'], 100, 2);
$data['cost'] = bcmul($purchase, bcadd($data['cost_lv'], 1, 2), 2); $data['cost'] = bcmul($purchase, bcadd($data['cost_lv'], 1, 2), 2);
continue; continue;
}elseif (($v['id'] == 100002 || $v['id'] == 22) &&$purchase>0) { } elseif (($v['id'] == 100002 || $v['id'] == 22) && $purchase > 0) {
//零售 //零售
$data['price_lv'] = bcdiv($v['rate'], 100, 2); $data['price_lv'] = bcdiv($v['rate'], 100, 2);
$data['price'] = bcmul($purchase, bcadd($data['price_lv'], 1, 2), 1); $data['price'] = bcmul($purchase, bcadd($data['price_lv'], 1, 2), 1);
@ -405,7 +459,7 @@ class PurchaseProductOfferLogic extends BaseLogic
continue; continue;
} }
$baseRate = ($v['id'] == 100001 || $v['id'] == 21) ? 100 : 100 + $v['rate']; $baseRate = ($v['id'] == 100001 || $v['id'] == 21) ? 100 : 100 + $v['rate'];
if($purchase>0){ if ($purchase > 0) {
$item = [ $item = [
'product_id' => $product['id'], 'product_id' => $product['id'],
'group_id' => $v['id'], 'group_id' => $v['id'],
@ -461,5 +515,4 @@ class PurchaseProductOfferLogic extends BaseLogic
} }
return $res; return $res;
} }
} }

View File

@ -120,4 +120,27 @@ class StoreBranchProductLogic extends BaseLogic
{ {
return StoreBranchProduct::findOrEmpty($params['id'])->toArray(); return StoreBranchProduct::findOrEmpty($params['id'])->toArray();
} }
public static function decStock($storeId, $productId, $num)
{
$branchProduct = StoreBranchProduct::where('store_id', $storeId)->where('product_id', $productId)->find();
if ($branchProduct) {
$stock = bcsub($branchProduct['stock'], $num, 2);
StoreBranchProduct::update([
'stock' => $stock,
'total_price' => bcmul($stock, $branchProduct['purchase'], 2),
'sales' => bcadd($branchProduct['sales'], $num, 2)
], ['id' => $branchProduct['id']]);
SqlChannelLog('StoreBranchProduct',$branchProduct['id'], $num, -1, Request()->url());
} else {
$storeProduct = StoreProduct::where('id', $productId)->find();
$branchProduct = StoreProductLogic::ordinary(['id' => $productId], $storeId, 0, $storeProduct);
StoreBranchProduct::update([
'stock' => -$num,
'sales' => $num
], ['product_id' => $productId,'store_id'=>$storeId]);
SqlChannelLog('StoreBranchProduct',$branchProduct['id'], $num, -1, Request()->url());
}
}
} }

View File

@ -38,7 +38,7 @@ class WarehouseProductLogic extends BaseLogic
// Db::startTrans(); // Db::startTrans();
try { try {
$after_nums = 0; $after_nums = 0;
if ($params['order_type'] != 6) { if (!in_array($params['order_type'],[6,7,9])) {
$storege = WarehouseProductStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find(); $storege = WarehouseProductStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find();
if ($storege) { if ($storege) {
$after_nums = $storege['nums'] + $params['nums']; $after_nums = $storege['nums'] + $params['nums'];
@ -138,6 +138,8 @@ class WarehouseProductLogic extends BaseLogic
'type' => 1, 'type' => 1,
'product_id' => $params['product_id'], 'product_id' => $params['product_id'],
'nums' => $params['nums'], 'nums' => $params['nums'],
'outbound_id' => $params['oid'] ?? 0,
'warehouse_id' =>1,
'status' => 0 'status' => 0
]); ]);
} }

View File

@ -253,7 +253,13 @@ class PayNotifyLogic extends BaseLogic
UserProductStorageLogic::add($order); UserProductStorageLogic::add($order);
} }
if ($order->pay_type != 10) { if ($order->pay_type != 10) {
$order->pay_price = bcdiv($extra['amount']['payer_total'], 100, 2); $payerTotal = $extra['amount']['payer_total'];
if (!empty($extra['promotion_detail'])) {
foreach ($extra['promotion_detail'] as $v) {
$payerTotal += $v['amount'];
}
}
$order->pay_price = bcdiv($payerTotal, 100, 2);
} else { } else {
$extra['transaction_id'] = time(); $extra['transaction_id'] = time();
} }
@ -671,6 +677,9 @@ class PayNotifyLogic extends BaseLogic
//积分写入 //积分写入
if (isset($user) && $user['user_ship'] == 0) { if (isset($user) && $user['user_ship'] == 0) {
UserSignLogic::OrderWrite($order); UserSignLogic::OrderWrite($order);
if (SystemStore::isActivityStore($order['store_id']) && $order['pay_price'] >= 19.9) {
User::where('id', $order['uid'])->update(['user_ship' => 43]);
}
} }
if ($off_activity == 1) { if ($off_activity == 1) {
//-----活动价结算更改 //-----活动价结算更改

View File

@ -42,4 +42,10 @@ class SystemStore extends BaseModel
Log::error('system_store:'.$e->getMessage()); Log::error('system_store:'.$e->getMessage());
} }
} }
public static function isActivityStore($storeId)
{
return in_array($storeId, [5]);
}
} }