feat: 更新了异常处理机制,优化了代码结构
This commit is contained in:
parent
218aa8c23f
commit
bb562f86ee
@ -351,7 +351,7 @@ class OrderLogic extends BaseLogic
|
||||
|
||||
Db::commit();
|
||||
return $order;
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollback();
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
|
@ -120,7 +120,9 @@ class CommissionProductLogic extends BaseLogic
|
||||
$data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
|
||||
}
|
||||
} elseif ($user['user_ship'] == 1) {
|
||||
if(bcsub($user['total_recharge_amount'],$user['purchase_funds'],2)>$user['first_purchase_funds']){
|
||||
if($order['pay_type']==18 && bcsub($user['total_recharge_amount'],$user['purchase_funds'],2)<$user['first_purchase_funds']){
|
||||
|
||||
}else{
|
||||
$vip_number = bcmul($total_price, 0.06, 2); //会员利润
|
||||
$data[] = $this->vip_user('零售会员', $order, $find, $uid, $price, $total_price, $vip_number,0.06);
|
||||
$number1 = bcadd($number1, $vip_number, 2);
|
||||
@ -158,7 +160,6 @@ class CommissionProductLogic extends BaseLogic
|
||||
if ($rose >= 6) {
|
||||
$data[] = $this->platform('零售平台', $order, $find, $price, $total_price,$platform_number);
|
||||
}
|
||||
|
||||
(new StoreFinanceFlowProduct())->saveAll($data);
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,12 @@ class StoreBranchProduct extends BaseModel
|
||||
{
|
||||
try {
|
||||
$where = $data->getWhere();
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find, $where),'branch_product','更新前');
|
||||
if($data){
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if($find){
|
||||
channelLog(array_merge($find->toArray(), $where),'branch_product','更新前');
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
Log::error('branch_product:' . $e->getMessage());
|
||||
}
|
||||
|
@ -105,10 +105,14 @@ class StoreOrder extends BaseModel
|
||||
{
|
||||
try {
|
||||
$where = $data->getWhere();
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find, $where),'store_order','更新前');
|
||||
if($data){
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if($find){
|
||||
channelLog(array_merge($find->toArray(), $where),'store_order','更新前');
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
Log::error('store_order:' . $e->getMessage());
|
||||
Log::error('store_order:更新前' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +120,7 @@ class StoreOrder extends BaseModel
|
||||
try{
|
||||
channelLog($data->toArray(),'store_order','更新后');
|
||||
}catch(Throwable $e){
|
||||
Log::error('store_order:'.$e->getMessage());
|
||||
Log::error('store_order:更新后'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,12 @@ class StoreOrderCartInfo extends BaseModel
|
||||
{
|
||||
try {
|
||||
$where = $data->getWhere();
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find, $where),'store_order_cart_info','更新前');
|
||||
if($data){
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if($find){
|
||||
channelLog(array_merge($find->toArray(),$where),'store_order_cart_info','更新前');
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
Log::error('store_order_cart_info:' . $e->getMessage());
|
||||
}
|
||||
|
@ -37,8 +37,12 @@ class StoreProduct extends BaseModel
|
||||
{
|
||||
try {
|
||||
$where = $data->getWhere();
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find, $where),'product','更新前');
|
||||
if($data){
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if ($find) {
|
||||
channelLog(array_merge($find->toArray(), $where), 'product', '更新前');
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
Log::error('product:' . $e->getMessage());
|
||||
}
|
||||
|
@ -200,8 +200,12 @@ class User extends BaseModel
|
||||
public static function onBeforeWrite($data){
|
||||
try{
|
||||
$where=$data->getWhere();
|
||||
$find=self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find,$where),'user','更新前');
|
||||
if($data){
|
||||
$find=self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if($find){
|
||||
channelLog(array_merge($find->toArray(),$where),'user','更新前');
|
||||
}
|
||||
}
|
||||
}catch(Throwable $e){
|
||||
Log::error('user:'.$e->getMessage());
|
||||
}
|
||||
|
@ -23,8 +23,12 @@ class WarehouseProduct extends BaseModel
|
||||
{
|
||||
try {
|
||||
$where = $data->getWhere();
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find, $where),'warehouse_product','更新前');
|
||||
if($data){
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if($find){
|
||||
channelLog(array_merge($find->toArray(), $where),'warehouse_product','更新前');
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
Log::error('warehouse_product:' . $e->getMessage());
|
||||
}
|
||||
|
@ -23,8 +23,12 @@ class WarehouseProductStorege extends BaseModel
|
||||
{
|
||||
try {
|
||||
$where = $data->getWhere();
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
|
||||
channelLog(array_merge($find, $where), 'warehouse_product_storege', '更新前');
|
||||
if($data){
|
||||
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
||||
if($find){
|
||||
channelLog(array_merge($find->toArray(), $where), 'warehouse_product_storege', '更新前');
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
Log::error('warehouse_product_storege:' . $e->getMessage());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user