Bläddra i källkod

Merge branch 'master' of e.coding.net:zdap/weixiu/weixiu_api into service_area-m

liugc 1 år sedan
förälder
incheckning
ac74a5f3cd

+ 4 - 0
app/adminapi/listener/OperationLog.php

@@ -21,6 +21,10 @@ class OperationLog
     {
         $request = request();
 
+        if(env('APP_DEBUG', false)){
+            return;
+        }
+
         //需要登录的接口,无效访问时不记录
         if (!$request->controllerObject->isNotNeedLogin() && empty($request->adminInfo)) {
             return;

+ 2 - 2
app/adminapi/lists/master_commission/MasterWorkerCommissionNoticeLists.php

@@ -62,8 +62,8 @@ class MasterWorkerCommissionNoticeLists extends BaseAdminDataLists implements Li
             ->field([
                 'n.id', 'n.commission_config_id', 'n.master_worker_id', 'n.day_num', 'n.order_num', 'n.signing_date', 'n.signing_date_end',
                 'mw.real_name', 'mw.nickname', 'mw.worker_number', 'mw.mobile',
-                Db::raw("COUNT(sw.id) AS order_count"),
-                Db::raw("MAX(sw.finished_time) max_time")
+                Db::raw("COUNT(CASE WHEN sw.service_status = 3 THEN sw.id ELSE null END) AS order_count"),
+                Db::raw("MAX(CASE WHEN sw.service_status = 3 THEN sw.finished_time ELSE null END) max_time")
             ])
             ->where($this->searchWhere)
             ->group('n.master_worker_id, n.id')

+ 2 - 2
app/adminapi/lists/master_worker/MasterWorkerServiceOrderLists.php

@@ -96,8 +96,8 @@ class MasterWorkerServiceOrderLists extends BaseAdminDataLists implements ListsS
                 Db::raw("COUNT(b.id) AS all_count"),
                 Db::raw("SUM(CASE WHEN b.service_status = 3 THEN 1 ELSE 0 END) AS success_count"),
                 Db::raw("SUM(CASE WHEN b.service_status = 4 OR b.service_status = 5 THEN 1 ELSE 0 END) AS fail_count"),
-                Db::raw("SUM(b.work_total) work_total"),
-                Db::raw("SUM(b.worker_price) worker_price"),
+                Db::raw("SUM(CASE WHEN b.service_status = 3 THEN b.work_total ELSE 0 END) work_total"),
+                Db::raw("SUM(CASE WHEN b.service_status = 3 THEN b.worker_price ELSE 0 END) worker_price"),
             ])
             ->leftJoin('service_work b', 'a.id = b.master_worker_id'.$this->sqlJoin)
             ->where($queryWhere)

+ 1 - 1
app/adminapi/lists/property/PropertyOrderAnalysis.php

@@ -76,7 +76,7 @@ class PropertyOrderAnalysis extends BaseAdminDataLists implements ListsSearchInt
             ])
             ->leftJoin('service_work b', 'a.work_id = b.id')
             ->leftJoin('property_head c', 'a.property_head_id = c.id')
-            ->where([['b.work_pay_status','=',2],['b.approval','=',1]])
+            ->where([['b.service_status','=',3],['b.approval','=',1]])
             ->where('b.finished_time','>',0)
             ->where($this->queryWhere())
             ->group('a.property_head_id,month_format')

+ 2 - 1
app/adminapi/lists/sale/PropertyHeadAnalysisLists.php

@@ -74,7 +74,8 @@ class PropertyHeadAnalysisLists extends BaseAdminDataLists implements ListsSearc
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
             ])
             ->where('a.sale_type', 'in', [1, 2])
-            ->where('a.order_status', 3)
+            //->where('a.order_status', 3)
+            ->where('b.service_status', 3)
             ->group('a.property_head_id')
             ->limit($this->limitOffset, $this->limitLength)
             ->select()->toArray();

+ 2 - 1
app/adminapi/lists/sale/SaleAnalysisLists.php

@@ -75,7 +75,8 @@ class SaleAnalysisLists extends BaseAdminDataLists implements ListsSearchInterfa
             ])
             ->where($this->queryWhere())
             ->where('a.sale_type', 'in', [1, 2])
-            ->where('a.order_status', 3)
+            //->where('a.order_status', 3)
+            ->where('b.service_status', 3)
             ->group('a.sale_id')
             ->limit($this->limitOffset, $this->limitLength)
             ->select()->toArray();

+ 2 - 1
app/adminapi/lists/sale/SaleGroupAnalysisLists.php

@@ -73,7 +73,8 @@ class SaleGroupAnalysisLists extends BaseAdminDataLists implements ListsSearchIn
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
             ])
             ->where('a.sale_type', 'in', [1, 2])
-            ->where('a.order_status', 3)
+            //->where('a.order_status', 3)
+            ->where('b.service_status', 3)
             ->group('a.sale_group_id')
             ->limit($this->limitOffset, $this->limitLength)
             ->select()->toArray();

+ 18 - 0
app/api/logic/ActivityLogic.php

@@ -8,6 +8,9 @@ use app\common\model\coupon\CouponRules;
 use app\common\model\goods\Goods;
 use app\common\model\goods_category\GoodsCategory;
 use app\common\model\property\PropertyActivity;
+use app\common\model\property\PropertyHead;
+use app\common\model\property\PropertyOrder;
+use app\common\model\property\PropertyUser;
 use app\common\model\user\User;
 use think\facade\Db;
 use think\facade\Log;
@@ -200,6 +203,21 @@ class ActivityLogic extends BaseLogic
                     if ($result === false) {
                         throw new \Exception('生成代理单失败');
                     }
+                }else{
+                    //判断当前用户是否是物业代理用户
+                    $property_user = PropertyUser::where(['user_id'=>$params['user_id']])->findOrEmpty();
+                    if(!$property_user->isEmpty()){
+                        $property_order = PropertyOrder::where(['property_user_id'=>$property_user['id'],'order_status'=>0,'work_id'=>0])->findOrEmpty();
+                        if(!$property_order->isEmpty()){
+                            $property_head = PropertyHead::where('id',$property_order->property_head_id)->findOrEmpty();
+                            if(!$property_head->isEmpty() && (((time()-strtotime($property_order['create_time']))<=($property_head['bind_date']*24*3600)) || ($property_head['bind_date']==0))){
+                                //绑定物业代理
+                                $property_order->work_id = $serviceOrder['work_id'];
+                                $property_order->order_status = 1;
+                                $property_order->save();
+                            }
+                        }
+                    }
                 }
             }
             return true;

+ 2 - 1
app/common/command/QueryRefund.php

@@ -203,8 +203,9 @@ class QueryRefund extends Command
         //更新工单退款状态以及处理工程师金额和物业金额
         $order = RechargeOrder::where('id',$order_id)->findOrEmpty();
         $work = ServiceWork::where('id',$order->work_id)->findOrEmpty();
+        Log::channel('re_fund')->info('工单ID'.$order->work_id.':'.json_encode($work,JSON_UNESCAPED_UNICODE));
         if(!$work->isEmpty()){
-            if(($work->work_pay_status == '1' || $work->work_pay_status == '2') and $work->work_status != '9'){
+            if(($work->work_pay_status == '1' || $work->work_pay_status == '2') and $work->work_status != '9' and $work->refund_approval != '2' and $work->work_status > '6'){
                 //工程师余额变动
                 $change_amount = MasterWorkerAccountLog::where(['work_sn'=>$work->work_sn,'action'=>1])->value('change_amount');
                 WorkerAccountLogLogic::addAccountLog($work,$change_amount,WorkerAccountLogEnum::UM_DEC_ADMIN,WorkerAccountLogEnum::DEC);

+ 2 - 2
app/common/service/ExcelExportService.php

@@ -192,8 +192,8 @@ class ExcelExportService
                 Db::raw("COUNT(b.id) AS all_count"),
                 Db::raw("SUM(CASE WHEN b.service_status = 3 THEN 1 ELSE 0 END) AS success_count"),
                 Db::raw("SUM(CASE WHEN b.service_status = 4 OR b.service_status = 5 THEN 1 ELSE 0 END) AS fail_count"),
-                Db::raw("SUM(b.work_total) work_total"),
-                Db::raw("SUM(b.worker_price) worker_price"),
+                Db::raw("SUM(CASE WHEN b.service_status = 3 THEN b.work_total ELSE 0 END) work_total"),
+                Db::raw("SUM(CASE WHEN b.service_status = 3 THEN b.worker_price ELSE 0 END) worker_price"),
             ])
                 ->leftJoin('service_work b', 'a.id = b.master_worker_id'.$sqlJoin)
                 ->where($where)