소스 검색

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

liugc 1 년 전
부모
커밋
5eb4577fbc

+ 3 - 1
app/adminapi/lists/property/PropertyOrderLists.php

@@ -21,6 +21,7 @@ use app\common\model\property\PropertyOrder;
 use app\common\lists\ListsSearchInterface;
 use app\common\model\property\PropertyUser;
 use app\common\model\sale\Sale;
+use think\db\Query;
 
 
 /**
@@ -94,7 +95,8 @@ class PropertyOrderLists extends BaseAdminDataLists implements ListsSearchInterf
      */
     public function lists(): array
     {
-        return PropertyOrder::with(['propertyHead','propertyUser','propertyOrderCustomerLog','saleInfo','saleGroupInfo'])->where($this->searchWhere)->where($this->queryWhere())
+        return PropertyOrder::with(['propertyHead','propertyUser','propertyOrderCustomerLog','saleInfo','saleGroupInfo','allocateWorkerLog'
+            ])->where($this->searchWhere)->where($this->queryWhere())
             ->where($this->queryDataWhere())
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])

+ 6 - 0
app/common/model/property/PropertyOrder.php

@@ -19,6 +19,7 @@ use app\common\model\BaseModel;
 use app\common\model\sale\Sale;
 use app\common\model\sale\SaleGroup;
 use app\common\model\works\ServiceWork;
+use app\common\model\works\ServiceWorkAllocateWorkerLog;
 use think\facade\Log;
 
 
@@ -31,6 +32,11 @@ class PropertyOrder extends BaseModel
 {
     
     protected $name = 'property_order';
+    //分配记录
+    public function allocateWorkerLog()
+    {
+        return $this->hasMany(ServiceWorkAllocateWorkerLog::class,'work_id','work_id')->field('*');
+    }
     public function saleGroupInfo()
     {
         return $this->hasOne(SaleGroup::class, 'id', 'sale_group_id')

+ 12 - 11
app/workerapi/logic/MasterWorkerMessageLogic.php

@@ -54,7 +54,7 @@ class MasterWorkerMessageLogic extends  BaseLogic
                     case 1:
                         $val['total'] = ServiceWorkLog::where(['master_worker_id'=>$userId,'show_type'=>YesNoEnum::NO])->count();
                         if($val['total']){
-                            $log = ServiceWorkLog::where(['master_worker_id'=>$userId,'show_type'=>YesNoEnum::NO])->order(['id'=>'desc'])->find()->toArray();
+                            $log = ServiceWorkLog::where(['master_worker_id'=>$userId,'show_type'=>YesNoEnum::NO])->order(['id'=>'desc'])->find();
                             $log = self::formatMsg($log,1);
                             $val['title'] = $log['title'];
                             $val['date'] = $log['date'];
@@ -63,7 +63,7 @@ class MasterWorkerMessageLogic extends  BaseLogic
                     case 3:
                         $val['total'] = MasterWorkerAccountLog::where(['worker_id'=>$userId,'show_type'=>YesNoEnum::NO ] )->count();
                         if($val['total']){
-                            $log = MasterWorkerAccountLog::where(['worker_id'=>$userId,'show_type'=>YesNoEnum::NO])->append(['action_text'])->order(['id'=>'desc'])->find()->toArray();
+                            $log = MasterWorkerAccountLog::where(['worker_id'=>$userId,'show_type'=>YesNoEnum::NO])->append(['action_text'])->order(['id'=>'desc'])->find();
                             $log = self::formatMsg($log,3);
                             $val['title'] = $log['title'];
                             $val['date'] = $log['date'];
@@ -72,7 +72,7 @@ class MasterWorkerMessageLogic extends  BaseLogic
                     case 4:
                         $val['total'] = Article::where(['is_show'=>YesNoEnum::YES])->count();
                         if($val['total']){
-                            $log = Article::where('is_show',YesNoEnum::YES)->order(['id'=>'desc'])->find()->toArray();
+                            $log = Article::where(['is_show'=>YesNoEnum::YES,'cid'=>3])->order(['id'=>'desc'])->find();
                             $log = self::formatMsg($log,4);
                             $val['title'] = $log['title'];
                             $val['date'] = $log['date'];
@@ -93,18 +93,19 @@ class MasterWorkerMessageLogic extends  BaseLogic
     public static function formatMsg($item,$type){
         switch ($type){
             case 1:
-                $item['title'] = $item['opera_log'];
-                $item['describe'] = $item['opera_log'];
-                $item['date'] =date("Y-m-d", is_string($item['create_time']) ? strtotime($item['create_time']): $item['create_time']);
+                $item['title'] = !empty($item['opera_log'])?$item['opera_log']:"";
+                $item['describe'] = !empty($item['opera_log'])?$item['opera_log']:"";
+                $item['date'] = !empty($item['create_time'])?date("Y-m-d", is_string($item['create_time']) ? strtotime($item['create_time']): $item['create_time']):date('Y-m-d');
                 break;
             case 3:
-                $item['describe'] =  $item['title'] . ' ' . $item['action_text'] . ' '. $item['change_amount'];
-                $item['title'] = $item['describe'];
-                $item['date'] =date("Y-m-d", is_string($item['create_time']) ? strtotime($item['create_time']): $item['create_time']);
+                $item['describe'] =  !empty($item['title'])?$item['title'] . ' ' . $item['action_text'] . ' '. $item['change_amount']:'';
+                $item['title'] = !empty($item['describe'])?$item['describe']:'';
+                $item['date'] =!empty($item['create_time'])?date("Y-m-d", is_string($item['create_time']) ? strtotime($item['create_time']): $item['create_time']):date('Y-m-d');
                 break;
             case 4:
-                $item['describe'] = $item['desc'];
-                $item['date'] =date("Y-m-d", is_string($item['create_time']) ? strtotime($item['create_time']): $item['create_time']);
+                $item['title'] = !empty($item['describe'])?$item['describe']:'';
+                $item['describe'] = !empty($item['desc'])?$item['desc']:'';
+                $item['date'] =!empty($item['create_time'])?date("Y-m-d", is_string($item['create_time']) ? strtotime($item['create_time']): $item['create_time']):date('Y-m-d');
                 break;
         }
         return $item;