feat(commission): 优化分润计算逻辑,移除冗余代码,提高可读性和性能
This commit is contained in:
parent
df9ed597fc
commit
63c90c8bbf
@ -677,67 +677,28 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
||||||
$comm = new CommissionProductLogic();
|
$comm = new CommissionProductLogic();
|
||||||
foreach ($info as $k => $v) {
|
try {
|
||||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
foreach ($info as $k => $v) {
|
||||||
}
|
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
||||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
return true;
|
|
||||||
if (isset($user) && $order['store_id'] == getenv('ACTIVITY_STORE_ID') && !in_array($user['user_ship'], [4, 6, 7])) {
|
|
||||||
try {
|
|
||||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
|
||||||
$comm = new CommissionProductLogic();
|
|
||||||
foreach ($info as $k => $v) {
|
|
||||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
|
||||||
}
|
|
||||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
return true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('活动分润报错' . $e->getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
||||||
switch ($user_ship) {
|
} catch (\Throwable $e) {
|
||||||
case 1: // 厨师
|
Log::error('分润报错' . $e->getMessage());
|
||||||
//case 4: // 商户
|
return false;
|
||||||
//case 5: // 种养殖
|
|
||||||
// case 6: // 酒店
|
|
||||||
// case 7: // 食堂
|
|
||||||
case 8: // 一条龙
|
|
||||||
CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
break;
|
|
||||||
case 2: // 村长
|
|
||||||
CommissionLogic::setVillage($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
break;
|
|
||||||
case 3: // 队长
|
|
||||||
CommissionLogic::setBrigade($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
CommissionLogic::setStore($order, $transaction_id);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
try {
|
||||||
$comm = new CommissionProductLogic();
|
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
||||||
foreach ($info as $k => $v) {
|
$comm = new CommissionProductLogic();
|
||||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
foreach ($info as $k => $v) {
|
||||||
}
|
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
||||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
return true;
|
|
||||||
if (isset($user) && $order['store_id'] == getenv('ACTIVITY_STORE_ID') && !in_array($user['user_ship'], [4, 6, 7])) {
|
|
||||||
try {
|
|
||||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
|
||||||
$comm = new CommissionProductLogic();
|
|
||||||
foreach ($info as $k => $v) {
|
|
||||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
|
||||||
}
|
|
||||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
|
||||||
return true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('活动分润报错' . $e->getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Log::error('分润报错' . $e->getMessage());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
CommissionLogic::setStore($order, $transaction_id);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user