xxxrrrdddd 2 年之前
父节点
当前提交
b014a0d052
共有 3 个文件被更改,包括 19 次插入1 次删除
  1. 3 1
      application/admin/controller/Ad.php
  2. 15 0
      application/admin/model/Ad.php
  3. 1 0
      public/assets/js/backend/ad.js

+ 3 - 1
application/admin/controller/Ad.php

@@ -22,7 +22,7 @@ class Ad extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\common\model\Ad;
+        $this->model = new \app\admin\model\Ad;
         $this->view->assign('pos',\app\common\model\Ad::$pos);
     }
 
@@ -35,9 +35,11 @@ class Ad extends Backend
             if ($this->request->request('keyField')) {
                 return $this->selectpage();
             }
+            $this->relationSearch=true;
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             $list = $this->model
+                ->with(['admin'])
                 ->where($where)
                 ->where(function (Query $query){
                     if($this->admin('is_sub')){

+ 15 - 0
application/admin/model/Ad.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace app\admin\model;
+
+use app\admin\model\Admin;
+use think\Model;
+
+/**
+ */
+class Ad extends \app\common\model\Ad
+{
+    public function admin(){
+        return $this->belongsTo(Admin::class);
+    }
+}

+ 1 - 0
public/assets/js/backend/ad.js

@@ -34,6 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         /*{field: 'link_type', title: __('Link_type'), operate: false},
                         {field: 'link_id', title: __('Link_id'), operate: false},*/
                         {field: 'sort', title: __('Sort'), operate: false},
+                        {field: 'admin.nickname', title: __('上传用户'), operate: 'like'},
                         {field: 'link', title: __('链接'), operate: false,formatter:Table.api.formatter.url},
                         {field: 'created_at', title: __('Created_at'), operate: false,formatter: Table.api.formatter.datetime},
                         {field: 'updated_at', title: __('Updated_at'), operate: false,formatter: Table.api.formatter.datetime},