WIN-2308041133\Administrator 5 months ago
parent
commit
8c2f0f2e9e

+ 24 - 0
app/common/repositories/store/order/StoreOrderRepository.php

@@ -13,9 +13,11 @@ namespace app\common\repositories\store\order;
 
 
 use app\common\model\store\order\StoreCart;
 use app\common\model\store\order\StoreCart;
 use app\common\model\store\product\Product;
 use app\common\model\store\product\Product;
+use app\common\model\system\merchant\Merchant;
 use app\common\model\user\AwardLake;
 use app\common\model\user\AwardLake;
 use app\common\model\user\GiftLevel;
 use app\common\model\user\GiftLevel;
 use app\common\model\user\OilLevel;
 use app\common\model\user\OilLevel;
+use app\common\repositories\user\AwardIntegralPriceRepository;
 use app\controller\api\server\StoreProduct;
 use app\controller\api\server\StoreProduct;
 use think\facade\Cache;
 use think\facade\Cache;
 use app\common\dao\store\order\StoreOrderDao;
 use app\common\dao\store\order\StoreOrderDao;
@@ -1255,6 +1257,25 @@ class StoreOrderRepository extends BaseRepository
             User::where('uid', $user['spread_uid'])->update(['award_integral'=>$after]);
             User::where('uid', $user['spread_uid'])->update(['award_integral'=>$after]);
         }
         }
     }
     }
+//    服务中心核销节能油
+    public function confirmOil($order){
+        $MerchantRepository = app()->make(MerchantRepository::class);
+        $uid = Merchant::where('mer_id',$order['mer_id'])->value('uid');
+        $award_integral = User::where('uid',$uid)->value('award_integral');
+        $integral_prcie =app()->make(AwardIntegralPriceRepository::class)->getPrice();  //积分价格
+        $integral =bcmul(bcdiv(2,$integral_prcie,2),$order['total_num'],2);  //价值2元的积分
+        $make = app()->make(UserBillRepository::class);
+        $after = bcadd($award_integral, $integral, 2);
+        $make->incBill($uid, 'award_integral', 'confirm_oil_integral', [
+            'number' => $order['pay_price'],
+            'title' => '核销节能油获得分红积分',
+            'balance' => $after,
+            'status' => 1,
+            'link_id' => $order['order_id'],
+            'mark' => '服务中心核销节能油获得分红积分' . $integral,
+        ]);
+        User::where('uid', $uid)->update(['award_integral'=>$after]);
+    }
 
 
     /**
     /**
      *  获取订单列表头部统计数据
      *  获取订单列表头部统计数据
@@ -2873,6 +2894,7 @@ class StoreOrderRepository extends BaseRepository
         // 触发小程序发货管理事件,用于后续的发货操作
         // 触发小程序发货管理事件,用于后续的发货操作
         // 小程序发货管理
         // 小程序发货管理
         event('mini_order_shipping', ['product', $order, 7, '', '']);
         event('mini_order_shipping', ['product', $order, 7, '', '']);
+        $this->confirmOil($order);
     }
     }
 
 
     /**
     /**
@@ -3969,6 +3991,8 @@ class StoreOrderRepository extends BaseRepository
                     $storeOrderStatusRepository->createAdminLog($orderStatus);
                     $storeOrderStatusRepository->createAdminLog($orderStatus);
                 }
                 }
             });
             });
+            @file_put_contents('quanju.txt', "-村上春树111\r\n", 8);
+            $this->getOrderAward($order);
             return true;
             return true;
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             throw new ValidateException('失败:' . $e->getMessage());
             throw new ValidateException('失败:' . $e->getMessage());

+ 1 - 0
app/common/repositories/user/UserBillRepository.php

@@ -99,6 +99,7 @@ class UserBillRepository extends BaseRepository
             'award/ordinary_integral' =>'下单普通商品获得分红积分',
             'award/ordinary_integral' =>'下单普通商品获得分红积分',
             'award/oil_integral' =>'节能油分红积分',
             'award/oil_integral' =>'节能油分红积分',
             'award/pack_integral' =>'礼包分红积分',
             'award/pack_integral' =>'礼包分红积分',
+            'award/confirm_oil_integral' =>'核销节能油获得积分',
         ]
         ]
     ];
     ];