Commit c64e7970 authored by gxx's avatar gxx

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

parent 75932c50
......@@ -18,7 +18,7 @@ interface GroupServiceContract
public function get($group_id);
public function getAll($page);
public function ajax($name);
public function ajax($phone);
public function simpleSearch($search_content,$page);
......
......@@ -22,10 +22,7 @@ class GroupController extends Controller
public function getAll()
{
$groups= $this->mGroup->getAll(8);
if (count($groups) > 0){
return view('admin/group/grouptables',compact('groups'));
}
return Message::makeError('查找失败');
return view('admin/group/grouptables',compact('groups'));
}
......@@ -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){
return $result['id'];
}
......
......@@ -74,11 +74,7 @@ class UserController extends Controller
public function getAll()
{
$result = $this->mUser->getAll(8);
if ($result){
return view('admin/usertables',compact('result'));
}else{
return Message::makeError('获取失败');
}
return view('admin/usertables',compact('result'));
}
......@@ -107,4 +103,9 @@ class UserController extends Controller
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
{
$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){
return null;
}else{
......@@ -132,8 +119,7 @@ class GroupService implements GroupServiceContract
public function getAll($page)
{
$groups = Group::paginate($page);
if(count($groups) < 0){
if($groups->isEmpty()){
return null;
}else{
return $groups;
......@@ -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 ){
return $result;
}
......@@ -155,11 +141,9 @@ class GroupService implements GroupServiceContract
public function simpleSearch($search_content, $page)
{
$group =Group::where('name','like','%'.$search_content.'%')->paginate($page);
if (count($group) > 0){
return $group;
if ($group->isEmpty()){
return null;
}
$result = null;
return $result;
return $group;
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@ class UserService implements UserServiceContract
public function getAll($page)
{
$users = User::paginate($page);
if (count($users ) < 0){
if ($users->isEmpty()){
return null;
}
return $users;
......
......@@ -98,13 +98,17 @@
<li><a href="#timeline" data-toggle="tab">Timeline</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul>
<div class="tab-content">
<div class="tab-content" style="height: 600px">
<div class="active tab-pane" id="activity" style="overflow: hidden">
@if(count($groups->usergroup) == 0)
<h3> 团队还没有成员加入 </h3>
<h5> 团队暂无成员 </h5>
<h2></h2>
@else
@foreach($groups->usergroup as $user)
......
......@@ -57,7 +57,7 @@
@if($groups == null)
<tbody>
<tr>
<td colspan="8" style="text-align: center;color: red"> 数据暂无 </td>
<td colspan="8" style="text-align: center;color: red"> 查询失败,相关数据! </td>
</tr>
</tbody>
</table>
......
......@@ -24,7 +24,7 @@
</div>
<div class="form-group">
<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: green; display: none" id="pp1" >*用户存在可以转让</p>
<p style="color: green; display: none" id="pp2" >*请输入转让人真实姓名</p>
......@@ -54,10 +54,10 @@
})
var a = $('#asd').click(function () {
var real_name = $('#exampleInputPassword1').val();
var user_phone = $('#exampleInputPassword1').val();
$.ajax({
type:'get',
url:'{{url('group/ajax')}}/' + real_name ,
url:'{{url('group/ajax')}}/' + user_phone ,
success:function(data){
if (data){
// 设置 新的拥有者的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 @@
<th>操作</th>
</tr>
</thead>
@if($result == null)
@if($result->isEmpty())
<tbody>
<tr>
<td colspan="9" style="text-align: center;color: red"> 数据暂无 </td>
<td colspan="9" style="text-align: center;color: red"> 用户查询失败,无相关用户 </td>
</tr>
</tbody>
</table>
......
......@@ -26,18 +26,10 @@ Route::get('admin',function (){
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
// 短信
Route::get('sms','SMSController@surplus');
......@@ -50,8 +42,10 @@ Route::group(['prefix'=> 'user'],function (){
Route::get('get/{id}','UserController@get')->name('user.get');
Route::get('updatePage/{id}','UserController@updatePage')->name('user.updatePage');
Route::post('update','UserController@update')->name('user.update');
Route::get('search','UserController@simpleSearch')->name('user.search');
Route::get('notification','UserController@notification')->name('notification');
});
......@@ -65,9 +59,10 @@ Route::group(['prefix'=> 'group'],function (){
Route::post('update','GroupController@update')->name('group.update');
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::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