Kaynağa Gözat

物业下单详细地址-新增当前单最新地址

liugc 1 yıl önce
ebeveyn
işleme
0f8a8d33df

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

@@ -70,7 +70,7 @@ class PropertyOrderLists extends BaseAdminDataLists implements ListsSearchInterf
     public function lists(): array
     {
         return PropertyOrder::with(['propertyHead','propertyUser'])->where($this->searchWhere)->where($this->queryWhere())
-            ->field(['id', 'property_head_id', 'property_user_id', 'remark', 'order_status', 'work_id'])
+            ->field(['id', 'property_head_id', 'property_user_id', 'remark', 'order_status', 'work_id','address'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()

+ 4 - 0
app/api/logic/PropertyOrderLogic.php

@@ -16,6 +16,7 @@ namespace app\api\logic;
 
 
 use app\adminapi\logic\property\PropertyUserLogic;
+use app\common\model\property\PropertyHead;
 use app\common\model\property\PropertyOrder;
 use app\common\logic\BaseLogic;
 use think\Exception;
@@ -43,10 +44,13 @@ class PropertyOrderLogic extends BaseLogic
         $propertyUserId = PropertyUserLogic::getPropertyUserIdByMobile($params);
         Db::startTrans();
         try {
+            $propertyAddress = PropertyHead::where('id',$params['property_head_id'])->value('address');
+            $address = $params['address']?(($propertyAddress?$propertyAddress.$params['address']:'')):'';
             PropertyOrder::create([
                 'property_head_id' => $params['property_head_id'],
                 'property_user_id' => $propertyUserId,
                 'remark' => $params['remark']??'',
+                'address' => $address??'',
             ]);
             Db::commit();
             return true;