Browse Source

工单结算

whitefang 1 year ago
parent
commit
4d8c21eb6b

+ 20 - 0
app/api/logic/PerformanceLogic.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace app\api\logic;
+
+use app\common\logic\BaseLogic;
+
+
+/**
+ *  师傅业绩逻辑层
+ * Class PerformanceLogic
+ * @package app\api\logic
+ */
+class PerformanceLogic extends BaseLogic
+{
+    public static function calculatePerformance($param)
+    {
+        //工单已完结,进行结算,结算完成后设置work_pay_status为2,已结算
+
+    }
+}

+ 1 - 2
app/api/logic/ServiceOrderLogic.php

@@ -285,9 +285,8 @@ class ServiceOrderLogic extends BaseLogic
             //确认所有订单总金额和结算金额
             //若订单是全款已支付订单
             if(count($orders)==1 and $orders[0]['payment_type']=0 and $orders[0]['pay_status']==1){
-                $service_work->work_status = 7;// todo 已完结---调用师傅金额结算端口
+                $service_work->work_status = 7;
                 $service_work->user_confirm_status = 5;
-
                 $service_work->work_total = $orders[0]['order_total'];
                 $service_work->work_amount = $orders[0]['order_amount'];
             }else{

+ 9 - 0
app/common/model/works/ServiceWork.php

@@ -15,6 +15,7 @@
 namespace app\common\model\works;
 
 
+use app\api\logic\PerformanceLogic;
 use app\common\model\BaseModel;
 use app\common\model\master_worker\MasterWorker;
 
@@ -28,6 +29,14 @@ class ServiceWork extends BaseModel
 {
     
     protected $name = 'service_work';
+
+    public static function onAfterUpdate($model)
+    {
+        if($model->user_confirm_status == 5 and $model->work_status == 7 and $model->work_pay_status==1){
+            //工单已完结,进行结算,结算完成后设置work_pay_status为2,已结算
+            PerformanceLogic::calculatePerformance($model);
+        }
+    }
     
     public function worker()
     {