From 25a3e9bb63fe83f7c82180a7d373a331b2f41acb Mon Sep 17 00:00:00 2001
From: huangsijun <1773182001@qq.com>
Date: Thu, 06 Nov 2025 11:33:03 +0800
Subject: [PATCH] 更新前端订单详情获取的处理,增加判断是不是订单号过来的

---
 admin/app/common/model/plus/business/Business.php |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/admin/app/common/model/plus/business/Business.php b/admin/app/common/model/plus/business/Business.php
index def8eaf..58a6405 100644
--- a/admin/app/common/model/plus/business/Business.php
+++ b/admin/app/common/model/plus/business/Business.php
@@ -65,7 +65,7 @@
     public function logoImage()
     {
         $model = self::getCalledModule() ?: 'common';
-        return $this->hasOne("app\\$model\\model\\file\\UploadFile", 'file_id', 'logo')->bind(['file_path']);
+        return $this->hasOne("app\\$model\\model\\file\\UploadFile", 'file_id', 'logo');
     }
 
     /**
@@ -76,6 +76,11 @@
     {
         $model = self::getCalledModule() ?: 'common';
         return $this->hasOne("app\\$model\\model\\plus\\business\\Grade", 'grade_id', 'grade_id');
+    }
+    public function industry()
+    {
+        $model = self::getCalledModule() ?: 'common';
+        return $this->hasOne("app\\$model\\model\\plus\\business\\Industry", 'industry_id', 'industry_id');
     }
 
     /**
@@ -136,9 +141,23 @@
                 $order = ['unit' => "asc"];
             }
         } else {
-            $order = ['is_top' => 'desc', 'create_time' => 'desc'];
+            // 检查置顶时间是否过期,如果过期则设置为非置顶
+            $this->checkTopExpire();
+            
+            // 按置顶状态和创建时间排序
+            $order = ['is_top' => 'desc', 'top_time' => 'desc', 'create_time' => 'desc'];
         }
         return $this->with(['user', 'image', 'logoImage', 'grade'])->order($order)->where($where)->paginate($paramr);
+    }
+
+    /**
+     * 检查并更新过期的置顶名片
+     */
+    private function checkTopExpire()
+    {
+        $this->where('is_top', 1)
+            ->where('top_time', '<', time())
+            ->update(['is_top' => 0]);
     }
 
     /**
@@ -149,6 +168,6 @@
      */
     public static function detail($business_card_id)
     {
-        return (new self())->with(['user', 'image', 'logoImage', 'grade'])->where(['business_card_id' => $business_card_id])->find();
+        return (new self())->with(['user', 'image', 'logoImage', 'grade', 'industry'])->where(['business_card_id' => $business_card_id])->find();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.2