소스 검색

保修卡

whitefang 2 년 전
부모
커밋
e78b6f76e7
2개의 변경된 파일과 10개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      app/api/lists/OrderEffectiveLogLists.php
  2. 7 0
      app/common/model/orders/OrderEffectiveLog.php

+ 3 - 1
app/api/lists/OrderEffectiveLogLists.php

@@ -18,7 +18,9 @@ class OrderEffectiveLogLists  extends BaseApiDataLists
 
    public function  lists():array
    {
-       return OrderEffectiveLog::where($this->queryWhere())
+       return OrderEffectiveLog::with(['goods'=>function ($query) {
+           $query->field(['id','goods_name','goods_image']);
+       }])->where($this->queryWhere())
            ->limit($this->limitOffset, $this->limitLength)
            ->field(['id','goods_id','sn','effective_unit','effective_num','remark','end_effective_time'])
            ->append(['effective_unit_text'])

+ 7 - 0
app/common/model/orders/OrderEffectiveLog.php

@@ -1,6 +1,8 @@
 <?php
 namespace app\common\model\orders;
 use app\common\model\BaseModel;
+use app\common\model\goods\Goods;
+
 /**
  * @author 林海涛
  * @date 2024/7/17 下午5:23
@@ -9,6 +11,11 @@ class OrderEffectiveLog extends BaseModel
 {
     protected $name = 'order_effective_log';
 
+    public function goods()
+    {
+        return $this->hasOne(Goods::class, 'id', 'goods_id');
+    }
+
 
     public function getEndEffectiveTimeAttr($value,$data)
     {