Explorar o código

复购区 - 养老金
1、消费者本人获得复购PV养老金
2、直接推广者获得复购PV养老金
3、间接推广者获得复购PV养老金

family hai 1 ano
pai
achega
db7fac938c

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1503 - 1500
app/common/repositories/store/order/StoreOrderRepository.php


+ 45 - 0
app/common/repositories/user/UserThirdRepository.php

@@ -288,6 +288,51 @@ class UserThirdRepository extends BaseRepository
288 288
             throw new ValidateException($e->getMessage());
289 289
         }
290 290
     }
291
+    /*处理订单预估反养老金逻辑
292
+     *$order_id 订单id
293
+     *$commission 佣金
294
+     * $pid  用户广告位id
295
+     * $order_sn   订单号
296
+     * $table 表名
297
+    */
298
+    public function repurchaseAreaEstimateAnnuityOrder($order_id, $commission, $pid, $order_sn, $type, $table)
299
+    {
300
+        //用户商家信息
301
+        $user_mer = $this->getMer($pid);
302
+        try {
303
+            $money=$commission;
304
+            //返佣比例
305
+            $base_commission= floatval(systemConfig('extension_tao_rate'));
306
+
307
+            //刷卡手续费
308
+            $souxufees=0;
309
+            $souxufee =floatval(systemConfig('yanglao'));
310
+            if ($souxufee){
311
+                $souxufees = bcmul($money, $souxufee * 0.01, 3);
312
+            }
313
+            //返佣总额 返利总额=(交易金额-手续费)*返利比例
314
+            $moneys=bcmul($money-$souxufees,$base_commission/100,3);
315
+
316
+            $extension_one=$moneys;
317
+            $order=[
318
+                "order_sn"=>$order_sn,
319
+                "order_id"=>$order_id,
320
+                "uid"=>$pid,
321
+                "mer_id"=>$user_mer,
322
+                "total_price"=>$commission,
323
+                "extension_one"=>$extension_one,
324
+                "type_shop"=>$type,
325
+                "table"=>$table
326
+            ];
327
+
328
+            /** @var StoreOrderRepository $StoreOrderRepository */
329
+            $StoreOrderRepository = app()->make(StoreOrderRepository::class);
330
+            // @todo 复购区养老金
331
+            $StoreOrderRepository->repurchaseAreaEstimateAnnuity($order);
332
+        } catch (\Exception $e) {
333
+            throw new ValidateException($e->getMessage());
334
+        }
335
+    }
291 336
 
292 337
     /**
293 338
      * 平台账单记录