songxingwei 2 年之前
父節點
當前提交
6498711cd7
共有 3 個文件被更改,包括 12 次插入2 次删除
  1. 0 1
      application/api/controller/Index.php
  2. 11 0
      application/common/model/KdModel.php
  3. 1 1
      application/common/model/SiteModel.php

+ 0 - 1
application/api/controller/Index.php

@@ -184,7 +184,6 @@ class Index extends Api
         $date = input('date');   //日期
         $list = SiteModel::where('is_del',1)
             ->with('towns,kd')
-
             ->field('id,code,name')
             ->select();
         dump($list);

+ 11 - 0
application/common/model/KdModel.php

@@ -0,0 +1,11 @@
+<?php
+namespace app\common\model;
+
+use think\Db;
+use think\db\Query;
+use think\Model;
+class KdModel extends Model{
+    protected $name='system_kd';
+    public $autoWriteTimestamp=true;
+
+}

+ 1 - 1
application/common/model/SiteModel.php

@@ -11,7 +11,7 @@ class SiteModel extends Model{
 
 
     public function kd(){
-        return $this->hasMany(ValuesModel::class,'name');
+        return KdModel::select();
     }
     public function towns(){
         return $this->hasOne(TownsModel::class,'id');