xxxrrrdddd 3 years ago
parent
commit
553bd9b130
1 changed files with 5 additions and 9 deletions
  1. 5 9
      application/common/model/UserOrder.php

+ 5 - 9
application/common/model/UserOrder.php

@@ -229,7 +229,7 @@ class UserOrder extends Model
         }
         if($data['status']==1){
             $this['status']=self::STATUS_SET;
-            foreach ($this->currentSenderOrder as $senderOrder){
+            foreach ($this->currentSenderOrder()->select() as $senderOrder){
                 if(is_null($senderOrder['fee_total'])){
                     throw_user('有配送员尚未申请结算,请稍后再试');
                 }
@@ -320,7 +320,7 @@ class UserOrder extends Model
     }
     /** 是否能接单 */
     public function checkGet(User $user){
-        if(count($this->currentSenderOrder)>1){
+        if($this->currentSenderOrder()->count()>1){
             throw_user('订单已被接单,您暂时无法接单(1)');
         }
         $type=$user->getSendType($this);
@@ -432,7 +432,7 @@ class UserOrder extends Model
     }
     /** 结算金额 */
     public function getSettleAmountAttr($v,$data){
-        $sender_order=$this->currentSenderOrder;
+        $sender_order=$this->currentSenderOrder()->select();
         $amount=0;
         foreach ($sender_order as $order){
             $amount=bcadd($amount,$order['fee_total']);
@@ -441,7 +441,7 @@ class UserOrder extends Model
     }
     /** 配送员 */
     public function getSendersAttr($v,$data){
-        $sender_order=$this->currentSenderOrder;
+        $sender_order=$this->currentSenderOrder()->select();
         foreach ($sender_order as $item){
             $item->append(['user']);
         }
@@ -467,11 +467,7 @@ class UserOrder extends Model
     }
     /** 是否相同接单人 */
     public function getIsSameUserAttr(){
-        dump($this->currentSenderOrder->toArray());
-        dump($this->currentSenderOrder->count());
-        dump(count(array_unique($this->currentSenderOrder->column('user_id'))));
-        dd($this->currentSenderOrder->count()==2 && count(array_unique($this->currentSenderOrder->column('user_id')))==1);
-        return $this->currentSenderOrder->count()==2 && count(array_unique($this->currentSenderOrder->column('user_id')))==1;
+        return $this->currentSenderOrder()->count()==2 && count(array_unique($this->currentSenderOrder()->column('user_id')))==1;
     }
     protected function getCreatedAtAttr($a){
         return date('Y-m-d H:i:s',$a)?:'';