正在显示
1 个修改的文件
包含
20 行增加
和
8 行删除
@@ -41,22 +41,20 @@ class SellerTalk extends Backend | @@ -41,22 +41,20 @@ class SellerTalk extends Backend | ||
41 | $this->relationSearch = true; | 41 | $this->relationSearch = true; |
42 | //设置过滤方法 | 42 | //设置过滤方法 |
43 | $this->request->filter(['strip_tags', 'trim']); | 43 | $this->request->filter(['strip_tags', 'trim']); |
44 | - if ($this->request->isAjax()) | ||
45 | - { | 44 | + if ($this->request->isAjax()) { |
46 | //如果发送的来源是Selectpage,则转发到Selectpage | 45 | //如果发送的来源是Selectpage,则转发到Selectpage |
47 | - if ($this->request->request('keyField')) | ||
48 | - { | 46 | + if ($this->request->request('keyField')) { |
49 | return $this->selectpage(); | 47 | return $this->selectpage(); |
50 | } | 48 | } |
51 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 49 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); |
52 | $total = $this->model | 50 | $total = $this->model |
53 | - ->with(['user','seller']) | 51 | + ->with(['user', 'seller']) |
54 | ->where($where) | 52 | ->where($where) |
55 | ->order($sort, $order) | 53 | ->order($sort, $order) |
56 | ->count(); | 54 | ->count(); |
57 | 55 | ||
58 | $list = $this->model | 56 | $list = $this->model |
59 | - ->with(['user','seller']) | 57 | + ->with(['user', 'seller']) |
60 | ->where($where) | 58 | ->where($where) |
61 | ->order($sort, $order) | 59 | ->order($sort, $order) |
62 | ->limit($offset, $limit) | 60 | ->limit($offset, $limit) |
@@ -64,9 +62,13 @@ class SellerTalk extends Backend | @@ -64,9 +62,13 @@ class SellerTalk extends Backend | ||
64 | 62 | ||
65 | foreach ($list as $row) { | 63 | foreach ($list as $row) { |
66 | 64 | ||
67 | - $row->getRelation('user')->visible(['avatar','nickname']); | ||
68 | - $row->getRelation('seller')->visible(['title','avatar']); | 65 | + $row->getRelation('user')->visible(['avatar', 'nickname']); |
66 | + $row->getRelation('seller')->visible(['title', 'avatar']); | ||
69 | } | 67 | } |
68 | +// foreach ($list as $k => $v) { | ||
69 | +// } | ||
70 | + dump($list); | ||
71 | + die; | ||
70 | $list = collection($list)->toArray(); | 72 | $list = collection($list)->toArray(); |
71 | $result = array("total" => $total, "rows" => $list); | 73 | $result = array("total" => $total, "rows" => $list); |
72 | 74 | ||
@@ -74,4 +76,14 @@ class SellerTalk extends Backend | @@ -74,4 +76,14 @@ class SellerTalk extends Backend | ||
74 | } | 76 | } |
75 | return $this->view->fetch(); | 77 | return $this->view->fetch(); |
76 | } | 78 | } |
79 | + | ||
80 | + | ||
81 | + function substr_format($text, $length, $replace = '...', $encoding = 'UTF-8') | ||
82 | + { | ||
83 | + if ($text && mb_strlen($text, $encoding) > $length) { | ||
84 | + return mb_substr($text, 0, $length, $encoding) . $replace; | ||
85 | + } | ||
86 | + return $text; | ||
87 | + } | ||
88 | + | ||
77 | } | 89 | } |
-
请 注册 或 登录 后发表评论