Commit c64e7970 authored by gxx's avatar gxx

修改collection 判断方式 修改查询无数据时 页面样式

parent 75932c50
...@@ -18,7 +18,7 @@ interface GroupServiceContract ...@@ -18,7 +18,7 @@ interface GroupServiceContract
public function get($group_id); public function get($group_id);
public function getAll($page); public function getAll($page);
public function ajax($name); public function ajax($phone);
public function simpleSearch($search_content,$page); public function simpleSearch($search_content,$page);
......
...@@ -22,11 +22,8 @@ class GroupController extends Controller ...@@ -22,11 +22,8 @@ class GroupController extends Controller
public function getAll() public function getAll()
{ {
$groups= $this->mGroup->getAll(8); $groups= $this->mGroup->getAll(8);
if (count($groups) > 0){
return view('admin/group/grouptables',compact('groups')); return view('admin/group/grouptables',compact('groups'));
} }
return Message::makeError('查找失败');
}
...@@ -148,9 +145,9 @@ class GroupController extends Controller ...@@ -148,9 +145,9 @@ class GroupController extends Controller
} }
public function ajax($name) public function ajax($phone)
{ {
$result = $this->mGroup->ajax($name); $result = $this->mGroup->ajax($phone);
if ($result != null){ if ($result != null){
return $result['id']; return $result['id'];
} }
......
...@@ -74,11 +74,7 @@ class UserController extends Controller ...@@ -74,11 +74,7 @@ class UserController extends Controller
public function getAll() public function getAll()
{ {
$result = $this->mUser->getAll(8); $result = $this->mUser->getAll(8);
if ($result){
return view('admin/usertables',compact('result')); return view('admin/usertables',compact('result'));
}else{
return Message::makeError('获取失败');
}
} }
...@@ -107,4 +103,9 @@ class UserController extends Controller ...@@ -107,4 +103,9 @@ class UserController extends Controller
return view('admin/user/userlike',['result'=>$result,'params'=>$search_content]); return view('admin/user/userlike',['result'=>$result,'params'=>$search_content]);
} }
public function notification()
{
return view('admin\notification');
}
} }
...@@ -107,19 +107,6 @@ class GroupService implements GroupServiceContract ...@@ -107,19 +107,6 @@ class GroupService implements GroupServiceContract
{ {
$group = Group::find($group_id); $group = Group::find($group_id);
// $groups = Group::find($group_id)->usergroup;
//
// foreach ($groups as $v)
// {
// echo ($v->users[0]['user_name']);
// }
//
// dd($group);
if ($group == null){ if ($group == null){
return null; return null;
}else{ }else{
...@@ -132,8 +119,7 @@ class GroupService implements GroupServiceContract ...@@ -132,8 +119,7 @@ class GroupService implements GroupServiceContract
public function getAll($page) public function getAll($page)
{ {
$groups = Group::paginate($page); $groups = Group::paginate($page);
if($groups->isEmpty()){
if(count($groups) < 0){
return null; return null;
}else{ }else{
return $groups; return $groups;
...@@ -141,9 +127,9 @@ class GroupService implements GroupServiceContract ...@@ -141,9 +127,9 @@ class GroupService implements GroupServiceContract
} }
public function ajax($name) public function ajax($phone)
{ {
$result = User::where('real_name','=',$name)->first(); $result = User::where('phone','=',$phone)->first();
if ($result != null ){ if ($result != null ){
return $result; return $result;
} }
...@@ -155,11 +141,9 @@ class GroupService implements GroupServiceContract ...@@ -155,11 +141,9 @@ class GroupService implements GroupServiceContract
public function simpleSearch($search_content, $page) public function simpleSearch($search_content, $page)
{ {
$group =Group::where('name','like','%'.$search_content.'%')->paginate($page); $group =Group::where('name','like','%'.$search_content.'%')->paginate($page);
if ($group->isEmpty()){
if (count($group) > 0){ return null;
return $group;
} }
$result = null; return $group;
return $result;
} }
} }
\ No newline at end of file
...@@ -32,7 +32,7 @@ class UserService implements UserServiceContract ...@@ -32,7 +32,7 @@ class UserService implements UserServiceContract
public function getAll($page) public function getAll($page)
{ {
$users = User::paginate($page); $users = User::paginate($page);
if (count($users ) < 0){ if ($users->isEmpty()){
return null; return null;
} }
return $users; return $users;
......
...@@ -98,13 +98,17 @@ ...@@ -98,13 +98,17 @@
<li><a href="#timeline" data-toggle="tab">Timeline</a></li> <li><a href="#timeline" data-toggle="tab">Timeline</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li> <li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content" style="height: 600px">
<div class="active tab-pane" id="activity" style="overflow: hidden"> <div class="active tab-pane" id="activity" style="overflow: hidden">
@if(count($groups->usergroup) == 0) @if(count($groups->usergroup) == 0)
<h3> 团队还没有成员加入 </h3> <h5> 团队暂无成员 </h5>
<h2></h2>
@else @else
@foreach($groups->usergroup as $user) @foreach($groups->usergroup as $user)
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
@if($groups == null) @if($groups == null)
<tbody> <tbody>
<tr> <tr>
<td colspan="8" style="text-align: center;color: red"> 数据暂无 </td> <td colspan="8" style="text-align: center;color: red"> 查询失败,相关数据! </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="exampleInputPassword1">转让</label> <label for="exampleInputPassword1">转让</label>
<input type="text" class="form-control" id="exampleInputPassword1" placeholder="name" value="" > <input type="text" class="form-control" id="exampleInputPassword1" placeholder="用户手机号码" value="" >
<p style="color: red; display: none" id="pp" >*无此用户请重新填写</p> <p style="color: red; display: none" id="pp" >*无此用户请重新填写</p>
<p style="color: green; display: none" id="pp1" >*用户存在可以转让</p> <p style="color: green; display: none" id="pp1" >*用户存在可以转让</p>
<p style="color: green; display: none" id="pp2" >*请输入转让人真实姓名</p> <p style="color: green; display: none" id="pp2" >*请输入转让人真实姓名</p>
...@@ -54,10 +54,10 @@ ...@@ -54,10 +54,10 @@
}) })
var a = $('#asd').click(function () { var a = $('#asd').click(function () {
var real_name = $('#exampleInputPassword1').val(); var user_phone = $('#exampleInputPassword1').val();
$.ajax({ $.ajax({
type:'get', type:'get',
url:'{{url('group/ajax')}}/' + real_name , url:'{{url('group/ajax')}}/' + user_phone ,
success:function(data){ success:function(data){
if (data){ if (data){
// 设置 新的拥有者的ID // 设置 新的拥有者的ID
......
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>biu~biu~biu~ 暂时没有数据</h1>
</body>
</html>
\ No newline at end of file
...@@ -54,10 +54,10 @@ ...@@ -54,10 +54,10 @@
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
@if($result == null) @if($result->isEmpty())
<tbody> <tbody>
<tr> <tr>
<td colspan="9" style="text-align: center;color: red"> 数据暂无 </td> <td colspan="9" style="text-align: center;color: red"> 用户查询失败,无相关用户 </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -26,18 +26,10 @@ Route::get('admin',function (){ ...@@ -26,18 +26,10 @@ Route::get('admin',function (){
}); });
Auth::routes(); Auth::routes();
Route::get('/home', 'HomeController@index')->name('home'); Route::get('/home', 'HomeController@index')->name('home');
// 短信 // 短信
Route::get('sms','SMSController@surplus'); Route::get('sms','SMSController@surplus');
...@@ -50,8 +42,10 @@ Route::group(['prefix'=> 'user'],function (){ ...@@ -50,8 +42,10 @@ Route::group(['prefix'=> 'user'],function (){
Route::get('get/{id}','UserController@get')->name('user.get'); Route::get('get/{id}','UserController@get')->name('user.get');
Route::get('updatePage/{id}','UserController@updatePage')->name('user.updatePage'); Route::get('updatePage/{id}','UserController@updatePage')->name('user.updatePage');
Route::post('update','UserController@update')->name('user.update'); Route::post('update','UserController@update')->name('user.update');
Route::get('search','UserController@simpleSearch')->name('user.search'); Route::get('search','UserController@simpleSearch')->name('user.search');
Route::get('notification','UserController@notification')->name('notification');
}); });
...@@ -65,9 +59,10 @@ Route::group(['prefix'=> 'group'],function (){ ...@@ -65,9 +59,10 @@ Route::group(['prefix'=> 'group'],function (){
Route::post('update','GroupController@update')->name('group.update'); Route::post('update','GroupController@update')->name('group.update');
Route::get('transferPage','GroupController@transferPage')->name('group.transferPage'); Route::get('transferPage','GroupController@transferPage')->name('group.transferPage');
Route::get('ajax/{name}','GroupController@ajax')->name('group.ajax'); Route::get('ajax/{phone}','GroupController@ajax')->name('group.ajax');
Route::post('transfer','GroupController@transfer')->name('group.transfer'); Route::post('transfer','GroupController@transfer')->name('group.transfer');
Route::get('search','GroupController@simpleSearch')->name('group.search'); Route::get('search','GroupController@simpleSearch')->name('group.search');
}); });
// 项目 // 项目
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment