dyjh 6 rokov pred
rodič
commit
5adffec659

+ 9 - 8
app/Http/Controllers/Admin/Album/AgentController.php

xqd xqd xqd xqd xqd xqd
@@ -32,7 +32,7 @@ class AgentController extends Controller
         $query = $this->repository->pushCriteria(new AgentWhere($search,$this->getStoreId()));
 
         if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
-        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
+            $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
         }else{
             $query = $query->pushCriteria(new OrderBy('id','DESC'));
         }
@@ -53,7 +53,7 @@ class AgentController extends Controller
             }
             $user = AlbumUserModel::where('id', $item->user_id)->first();
             $item->nickname = $user->username;
-            $item->role = $user->role;
+            $item->is_boss = $user->is_boss;
         }
         return view('admin.album.agent.index',compact('list'));
     }
@@ -73,7 +73,7 @@ class AgentController extends Controller
 
     /**
      * 添加
-     * 
+     *
      */
     public function create(Request $request)
     {
@@ -98,12 +98,12 @@ class AgentController extends Controller
             return $this->showWarning('添加失败',$url);
         }
     }
-    
+
     /**
-     * 
+     *
      * 修改
-     * 
-     * 
+     *
+     *
      */
     public function update(Request $request) {
         if($request->method() == 'POST') {
@@ -155,7 +155,7 @@ class AgentController extends Controller
             return $this->showWarning('操作失败');
         }
     }
-    
+
     /**
      * 删除
      */
@@ -164,6 +164,7 @@ class AgentController extends Controller
         $id= $agent->user_id;
         $ok = $agent->delete();
         $save['is_dealer'] = 0;
+        $save['is_boss'] = 0;
         AlbumUserModel::where('id',$id)->update($save);
         if($ok) {
             return  $this->showMessage('操作成功');

+ 117 - 188
app/Http/Controllers/Admin/Base/UserController.php

xqd
@@ -1,250 +1,179 @@
 <?php
 /**
- *  
- *  @author  Mike <m@9026.com>
+ *  用户管理
+ *  @author  system
  *  @version    1.0
- *  @date 2015年10月12日
+ *  @date 2018-05-14 13:25:12
  *
  */
-namespace App\Http\Controllers\Admin\Base;
-
+namespace App\Http\Controllers\Admin\Album;
 use App\Http\Controllers\Admin\Controller;
-use App\Models\AdminUserModel;
-use App\Models\AlbumManufacturerModel;
+use App\Models\AlbumAgentModel;
 use App\Models\AlbumUserModel;
-use App\Services\Admin\Role;
-use App\Services\Admin\AdminUser;
-use Request;
+use App\Repositories\Album\Criteria\UserWhere;
+use Illuminate\Http\Request;
+use App\Repositories\Base\Criteria\OrderBy;
+use App\Repositories\Album\Criteria\MultiWhere;
+use App\Repositories\Album\UserRepository;
 
 class UserController extends Controller
 {
-    private $_service;
-    private $_role_service;
+    private $repository;
 
-    /**
-     * 初始化Service
-     */
-    public function __construct()
-    {
-        parent::__construct();
-        if(!$this->_service) $this->_service = new AdminUser();
-        if(!$this->_role_service) $this->_role_service = new Role();
+    public function __construct(UserRepository $repository) {
+        if(!$this->repository) $this->repository = $repository;
     }
-    
-    /**
-     * 列表
-     */
-    function index()
-    {
-        $request = Request::all();
-        $search['keyword'] = Request::input('keyword');
 
-        $orderby = array();
+    function index(Request $request) {
+        $search['keyword'] = $request->input('keyword');
+        $search['storeid'] = $this->getStoreId();
+
+        $order = array();
         if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
-            $orderby[$request['sort_field']] = $request['sort_field_by'];
-        }
-        if ($this->_user->is_root == 1) {
-            $store_id = 0;
-        } else {
-            $store_id = $this->getStoreId();
+            $order[$request['sort_field']] = $request['sort_field_by'];
+        }else{
+            $order['id']='DESC';
         }
-        $list = $this->_service->search($search, $orderby, $store_id);
+
+        $list = $this->repository->searchUser($search,$order);
         //dd($list);
-        foreach ($list as $item) {
-            $item->store = '暂无';
-            $store = AlbumManufacturerModel::where('store_id', $item->store_id)->first();
-            if ($store) {
-                $item->store = $store->name;
-            }
-        }
-        $roles = pairList($this->_getRoles(), 'id', 'name');
-        return view('admin.base.user.index', compact('list', 'roles'));
+//        dump($list);die;
+        return view('admin.album.user.index',compact('list'));
     }
 
-    /**
-     * 列表
-     */
-    function resetPwd()
-    {
-//        $pwd = '$2y$10$jRQGg4qdfDhdt.4TZpDaL.2pbgBJZqvdR.AMrE5rA2D3dgMyit8vS';
-//        var_dump(crypt('abcded', $pwd));exit;
-        $request = Request::all();
-        $search['keyword'] = Request::input('keyword');
-        $search['resetPwd'] =true;
+
+    function check(Request $request) {
+        $request = $request->all();
+        $search['keyword'] = $request->input('keyword');
         $orderby = array();
         if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
             $orderby[$request['sort_field']] = $request['sort_field_by'];
         }
-        $list = $this->_service->search($search, $orderby);
-        return view('admin.base.user.resetPwd', compact('list'));
+        $list = $this->repository->search($search,$orderby);
+        return view('admin.album.user.check',compact('list'));
     }
 
-    function resetPwdPass()
-    {
-        $ok = $this->_service->resetPwdPass(Request::get('id'));
-        if($ok) {
-            $this->showMessage('操作成功');
-        }else{
-            $this->showWarning('操作失败');
-        }
-    }
 
-    function resetPwdReject()
+    /**
+     * 添加
+     *
+     */
+    public function create(Request $request)
     {
-        $ok = $this->_service->resetPwdReject(Request::get('id'));
-        if($ok) {
-            $this->showMessage('操作成功');
-        }else{
-            $this->showWarning('操作失败');
+        if($request->method() == 'POST') {
+            return $this->_createSave();
         }
+        return view('admin.album.user.edit');
     }
 
-
-
     /**
-     * 更新
+     * 保存修改
      */
-    public function create()
-    {
-        if(Request::method() == 'POST'){
-            $data = Request::input('info');
-           // $data['store_id'] = $this->getStoreId();
-            if(isset($data['admin_role_id']))$data['admin_role_id'] = implode(',', $data['admin_role_id']);
-            if($this->_service->create($data)){
-                $this->showMessage('操作成功', urldecode(Request::input('_referer')));
-            }else{
-                $this->showWarning('操作失败'  . $this->_service->getMsg(), urldecode(Request::input('_referer')));
-            }
-        }
-        $data = $this->_service->find(Request::input('id'));
-
-        if($this->_user['is_root']){
-            $roles = $this->_getRoles();
+    private function _createSave(){
+        $data = (array) request('data');
+        $id = $this->repository->create($data);
+        if($id) {
+            $url[] = array('url'=>U( 'Album/User/index'),'title'=>'返回列表');
+            $url[] = array('url'=>U( 'Album/User/create'),'title'=>'继续添加');
+            $this->showMessage('添加成功',$url);
         }else{
-            $roles = $this->_getCurrentRoles();
+            $url[] = array('url'=>U( 'Album/User/index'),'title'=>'返回列表');
+            return $this->showWarning('添加失败',$url);
         }
-        return view('admin.base.user.edit', compact('data', 'roles'));
     }
 
-
     /**
-     * 更新
+     *
+     * 修改
+     *
+     *
      */
-    public function update()
-    {
-        if(Request::method() == 'POST')
-        {
-            $data = Request::input('info');
-            if ($data['password'] == null) {
-                unset($data['password']);
-            }
-          //  dd($data);
-            if(isset($data['admin_role_id']))$data['admin_role_id'] = implode(',', $data['admin_role_id']);
-            if($this->_service->update(Request::input('id'), $data)){
-                $this->showMessage('操作成功', urldecode(Request::input('_referer')));
+    public function update(Request $request) {
+        $data = $this->repository->find($request->get('id'));
+        if($data->is_dealer == 1){
+            return $this->showWarning('该用户已成为经销商');
+        }
+        $save['is_dealer'] = 1;
+        $ok = $this->repository->update(request('id'),$save);
+
+        if($ok){
+            $add['store_id'] = $this->getStoreId();
+            $add['user_id'] = $data->id;
+            $add['name'] = $data->username;
+            $add['status'] = 1;
+            $res = AlbumAgentModel::create($add);
+            if($res) {
+                return $this->showMessage('操作成功');
             }else{
-                $this->showWarning('操作失败' . $this->_service->getMsg(), urldecode(Request::input('_referer')));
+                return $this->showWarning('操作失败');
             }
         }
-        $data = $this->_service->find(Request::input('id'));
-        
-        if($this->_user['is_root']){
-            $roles = $this->_getRoles();
-        }else{
-            $roles = $this->_getCurrentRoles();
-        }
-        $store = AlbumManufacturerModel::where('store_id', $data['store_id'])->first(['store_id', 'name', 'phone'])->toArray();
-        return view('admin.base.user.edit', compact('data', 'roles', 'store'));
-    }
-    
-    public function auth() {
-        if(Request::method() == 'POST'){
-            $info = Request::input('info');
-            if(!empty($info['admin_role_id'])){
-                $info['admin_role_id'] = implode(',', $info['admin_role_id']);
-            }
-            if(!$info['id']) {
-                $this->showWarning('数据不全', urldecode(Request::input('_referer')));
-            }
-            if($this->_service->auth($info)){
-                $this->showMessage('操作成功', urldecode(Request::input('_referer')));
-            }else{
-                $this->showWarning('操作失败'. $this->_service->getMsg(), urldecode(Request::input('_referer')));
-            }
-        }
-        if($this->_user['is_root']){
-            $roles = $this->_getRoles();
-        }else{
-            $roles = $this->_getCurrentRoles();
-        }
-        return view('admin.base.user.auth', compact( 'roles'));
+        return view('admin.album.user.edit',compact('data'));
     }
 
-    public function status() {
-        $ok = $this->_service->updateStatus(Request::get('id'),Request::get('status'));
+    /**
+     * 保存修改
+     */
+    private function _updateSave() {
+        $data = (array) request('data');
+        $ok = $this->repository->update(request('id'),$data);
         if($ok) {
-            $this->showMessage('操作成功');
+            $url[] = array('url'=>U( 'Album/User/index'),'title'=>'返回列表');
+            return $this->showMessage('操作成功',urldecode(request('_referer')));
         }else{
-            $this->showWarning('操作失败' . $this->_service->getMsg());
+            $url[] = array('url'=>U( 'Album/User/index'),'title'=>'返回列表');
+            return $this->showWarning('操作失败',$url);
         }
     }
 
-
-    /**
-     * 得到当前角色所拥有的角色
-     */
-    private function _getCurrentRoles()
-    {
-        $_node = $this->_getRoleNode();
-        return $this->_role_service->getChildByLevel($_node['level'])->toArray();
-    }
-    
-    /**
-     * 获取角色权限节点(level越小权限越大)
-     */
-    private function _getRoleNode()
-    {
-        return $this->_role_service->getLevelNode($this->_user['admin_role_id'])->toArray();
+    public function view(Request $request) {
+        $data = $this->repository->find(request('id'));
+        return view('admin.album.user.view',compact('data'));
     }
 
-    public function searchStore()
-    {
-        $keyword = Request::post('keywords');
-        $query = AlbumManufacturerModel::where('id','>',0);
-        if(isset($keyword) && $keyword) {
-            $query = $query->where('id','like','%'.$keyword.'%')
-                ->orWhere('phone','like','%'.$keyword.'%')
-                ->orWhere('name','like','%'.$keyword.'%');
-        }
-        $list = $query->get(['name','id','phone'])->toArray();
-        if(empty($list)){
-            $list[0]=[
-                'id'=>0,
-                'name'=>'暂无'
-            ];
-        }
-        return response()->json(['code' => 0, 'message' => '', 'data' => $list]);
-    }
 
     /**
-     * 得到所有角色
+     *
+     * 状态改变
+     *
      */
-    private function _getRoles()
-    {
-        return $this->_role_service->get()->toArray();
+    public function status(Request $request) {
+        $ok = $this->repository->updateStatus(request('id'),request('status'));
+        if($ok) {
+            return $this->showMessage('操作成功');
+        }else{
+            return $this->showWarning('操作失败');
+        }
     }
 
     /**
      * 删除
      */
-    public function destroy()
-    {
-        $user = AdminUserModel::find(Request::get('id'));
-        $ok = $user->delete();
-        if ($ok) {
+    public function destroy(Request $request) {
+        $bool = $this->repository->destroy($request->get('id'));
+        if($bool) {
             return  $this->showMessage('操作成功');
-        } else {
+        }else{
             return  $this->showWarning("操作失败");
         }
     }
+
+    public function role(Request $request){
+        $id = request('id');
+        $role = request('role');
+        $user = AlbumUserModel::find($id);
+        if ($role == 4) {
+            $user->is_boss = 1;
+        } else if ($role == 5) {
+            $user->is_boss = 0;
+        } else {
+            $user->role = $role;
+        }
+        $ok = $user->save();
+        if($ok) {
+            return $this->showMessage('操作成功');
+        }else{
+            return $this->showWarning('操作失败');
+        }
+    }
 }

+ 12 - 12
app/Http/Controllers/Api/V1/AlbumBossController.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -68,7 +68,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -149,7 +149,7 @@ class AlbumBossController extends Controller
             'pageNum.required' => '缺少页码参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -245,7 +245,7 @@ class AlbumBossController extends Controller
             'agent_id.required' => '缺少经销商参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -353,7 +353,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -430,7 +430,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -454,7 +454,7 @@ class AlbumBossController extends Controller
             ['store_id', $store_id],
             ['updated_at','>=',$start],
             ['updated_at','<=',$end]
-            ])->count();
+        ])->count();
         $downloadCount = AlbumWatchRecord::where([
             ['store_id', $store_id],
             ['action', 9],
@@ -528,7 +528,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -598,7 +598,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -680,7 +680,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -770,7 +770,7 @@ class AlbumBossController extends Controller
             'store_id.required' => '缺少商户参数',
         ]);
 
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 
@@ -848,7 +848,7 @@ class AlbumBossController extends Controller
         ], [
             'store_id.required' => '缺少商户参数',
         ]);
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
         if ($validator->fails()) {
@@ -908,7 +908,7 @@ class AlbumBossController extends Controller
         ], [
             'store_id.required' => '缺少商户参数',
         ]);
-        if ($userAuth->role != 4) {
+        if ($userAuth->is_boss != 1) {
             return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
         }
 

+ 32 - 28
app/Http/Controllers/Api/V1/AlbumController.php

xqd xqd xqd xqd xqd xqd
@@ -217,7 +217,7 @@ class AlbumController extends Controller
                     ['agent_id', $userAuth->up_agent_id],['open_id', $check->open_id],['store_id', $datas['store_id']]
                 ])->first();
                 $check_user = AlbumWatchRecord::where([
-                  ['open_id', $check->open_id],['store_id', $datas['store_id']]
+                    ['open_id', $check->open_id],['store_id', $datas['store_id']]
                 ])->first();
                 \Log::info($check_user);
 
@@ -226,11 +226,11 @@ class AlbumController extends Controller
                 } else {
                     $add_record['is_new'] = 1;
                 }
-               // \Log::info($add_record);
+                // \Log::info($add_record);
                 AlbumWatchRecord::create($add_record);
-              //  dd($add_record);
+                //  dd($add_record);
                 $user_agent = AlbumAgentModel::where([['id',$add_record['agent_id']],['store_id',$datas['store_id']]])->first();
-               // dd($user_agent);
+                // dd($user_agent);
                 if ($user_agent) {
                     if (empty($check_new_customer)) {
                         $user_agent->get_count++;
@@ -249,7 +249,11 @@ class AlbumController extends Controller
             }
             $userAuth->save();
             $user['up_agent_id'] = $userAuth->up_agent_id;
-            $user['role'] = $userAuth->role;
+            if ($userAuth->is_boss == 1) {
+                $user['role'] = 4;
+            } else {
+                $user['role'] = 0;
+            }
             if (!file_exists(public_path() . '/base/poster/avatar/' . $datas['store_id'])) {
                 mkdir(public_path() . '/base/poster/avatar/' . $datas['store_id'], 0755, true);
             }
@@ -488,11 +492,11 @@ class AlbumController extends Controller
         $validator = Validator::make($request->all(), [
             'goods_id' => 'required',
             'store_id' => 'required',
-      //      'parent_id' => 'required',
+            //      'parent_id' => 'required',
         ], [
             'goods_id.required' => '缺少商品参数',
             'store_id.required' => '缺少STORE参数',
-      //      'parent_id.required' => '缺少PARENT参数',
+            //      'parent_id.required' => '缺少PARENT参数',
         ]);
         if ($validator->fails()) {
             return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
@@ -1881,11 +1885,11 @@ class AlbumController extends Controller
         \Log::info($value);\Log::info('2225');
         if ($open_id && !empty($weChatApp->wxaccount_template_id) && (!$value || ($value + 60) <= time())) {
             Cache::put($open_id, time(), 1);
-          /*  $config = [
-                'app_id' => $weChatApp->G_app_id,
-                'secret' => $weChatApp->G_app_secret,
-                'response_type' => 'array',
-            ];*/
+            /*  $config = [
+                  'app_id' => $weChatApp->G_app_id,
+                  'secret' => $weChatApp->G_app_secret,
+                  'response_type' => 'array',
+              ];*/
 
             $ac = $this->getAccessToken($weChatApp);
             $url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=" . $ac;
@@ -1905,28 +1909,28 @@ class AlbumController extends Controller
                         "keyword1" => array( "value" => $name, "color" => "#93c47d" ),
                         "keyword2" => array( "value" => $date, "color" => "#0000ff" ),
                         "remark" => array( "value" => $content, "color" => "#0000ff" ),
-                      //  "remark" => array( "value" => $date, "color" => "#45818e" )
+                        //  "remark" => array( "value" => $date, "color" => "#45818e" )
                     )
                 )
             );
             $data = json_encode($data, JSON_UNESCAPED_UNICODE);
             $res = $this->curlPost($url, $data);
             $res = json_decode($res, true);
-           /* $app = Factory::officialAccount($config);
-            $res = $app->template_message->send([
-                'touser' => $g_open_id,
-                'template_id' => $weChatApp->wxaccount_template_id,
-                'url' => '',
-                'data' => [
-                    'keyword1' => $name,
-                    'keyword2' => $content,
-                    'keyword3' => date('Y-m-d H:i'),
-                ],
-                'miniprogram' => [
-                    'appid' => $weChatApp->app_id,
-                    'pagepath' => 'pages/sell/sell'
-                ],
-            ]);*/
+            /* $app = Factory::officialAccount($config);
+             $res = $app->template_message->send([
+                 'touser' => $g_open_id,
+                 'template_id' => $weChatApp->wxaccount_template_id,
+                 'url' => '',
+                 'data' => [
+                     'keyword1' => $name,
+                     'keyword2' => $content,
+                     'keyword3' => date('Y-m-d H:i'),
+                 ],
+                 'miniprogram' => [
+                     'appid' => $weChatApp->app_id,
+                     'pagepath' => 'pages/sell/sell'
+                 ],
+             ]);*/
             return $res;
         } else {
             return false;

+ 33 - 0
database/migrations/2019_05_17_132117_add_is_boss_to_album_user.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddIsBossToAlbumUser extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_user', function (Blueprint $table) {
+            //
+            $table->unsignedInteger('is_boss')->nullable()->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_user', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 90 - 87
resources/views/admin/album/agent/index.blade.php

xqd
@@ -1,112 +1,115 @@
-@extends('admin.layout') 
+@extends('admin.layout')
 
 @section('content')
-<div class="wrapper wrapper-content animated fadeInRight">
-	<div class="row">
-		<div class="col-sm-12">
-			<div class="ibox float-e-margins">
-				<div class="ibox-title">
-					<h5>经销商管理</h5>
-					<div class="ibox-tools">
-						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-						</a>
+	<div class="wrapper wrapper-content animated fadeInRight">
+		<div class="row">
+			<div class="col-sm-12">
+				<div class="ibox float-e-margins">
+					<div class="ibox-title">
+						<h5>经销商管理</h5>
+						<div class="ibox-tools">
+							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+							</a>
+						</div>
 					</div>
-				</div>
-				<div class="ibox-content">
-				    <div class="row">
-				        <form method="GET" action="" accept-charset="UTF-8">
+					<div class="ibox-content">
+						<div class="row">
+							<form method="GET" action="" accept-charset="UTF-8">
 
-				        <div class="col-sm-4">
-				            <div class="input-group">
-								<input type="text" value="{{Request::get('keyword')}}"	placeholder="可搜索ID/电话/地址/名称" name="keyword"class="input-sm form-control">
-								<span class="input-group-btn">
+								<div class="col-sm-4">
+									<div class="input-group">
+										<input type="text" value="{{Request::get('keyword')}}"	placeholder="可搜索ID/电话/地址/名称" name="keyword"class="input-sm form-control">
+										<span class="input-group-btn">
 									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
 								</span>
-    						</div>
-				        </div>
-				        </form>
-						{{--@if(role('Album/Agent/create'))
-    					<div class="col-sm-3 pull-right">
-    					   <a href="{{ U('Album/Agent/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
-    					</div>
-						@endif--}}
-					</div>
-					
-					<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
-						<thead>
-    						<tr>
-								
-            <th class="sorting" data-sort="id"> ID </th>
-            <th> 微信昵称 </th>
-            <th class="sorting" data-sort="user_id"> 电话 </th>
-            <th class="sorting" data-sort="address"> 地址 </th>
-            <th class="sorting" data-sort="name"> 名称 </th>
-            <th class="sorting" data-sort="status"> 状态 </th>
+									</div>
+								</div>
+							</form>
+							{{--@if(role('Album/Agent/create'))
+                            <div class="col-sm-3 pull-right">
+                               <a href="{{ U('Album/Agent/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+                            </div>
+                            @endif--}}
+						</div>
+
+						<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+							<thead>
+							<tr>
+
+								<th class="sorting" data-sort="id"> ID </th>
+								<th> 微信昵称 </th>
+								<th class="sorting" data-sort="user_id"> 电话 </th>
+								<th class="sorting" data-sort="address"> 地址 </th>
+								<th class="sorting" data-sort="name"> 名称 </th>
+								<th class="sorting" data-sort="status"> 状态 </th>
 								<th>是否为boss</th>
-        						<th width="22%">相关操作</th>
-        					</tr>
-						</thead>
-						<tbody>
-						@if(isset($list))
-							@foreach($list as $key => $item)							<tr>
-								
-            <td>{{ $item->id }}</td>
-            <td>{{ $item->nickname }}</td>
-            <td>{{ $item->phone }}</td>
-            <td>{{ $item->address }}</td>
-            <td>{{ $item->name }}</td>
-            <td>{{ $item->status }}</td>
-								@if($item->role !== 4)
-									<td>不是</td>
-								@else
-									<td>是</td>
-								@endif
-								<td>
-									<div class="pull-left">
-										@if(role('Album/User/role-boss'))
-											@if($item->role !== 4)
-												<a href="{{ U('Album/User/role',['id'=>$item->user_id,'role'=>4]) }}" class="btn btn-sm btn-default pull-right">设为Boss
-												</a>
+								<th width="22%">相关操作</th>
+							</tr>
+							</thead>
+							<tbody>
+							@if(isset($list))
+								@foreach($list as $key => $item)							<tr>
+
+									<td>{{ $item->id }}</td>
+									<td>{{ $item->nickname }}</td>
+									<td>{{ $item->phone }}</td>
+									<td>{{ $item->address }}</td>
+									<td>{{ $item->name }}</td>
+									<td>{{ $item->status }}</td>
+									@if($item->is_boss != 1)
+										<td>不是</td>
+									@else
+										<td>是</td>
+									@endif
+									<td>
+										<div class="pull-left">
+											@if(role('Album/User/role-boss'))
+												@if($item->is_boss == 0)
+													<a href="{{ U('Album/User/role',['id'=>$item->user_id,'role'=>4]) }}" class="btn btn-sm btn-default pull-right">设为Boss
+													</a>
+												@else
+													<a href="{{ U('Album/User/role',['id'=>$item->user_id,'role'=>5]) }}" class="btn btn-sm btn-default pull-right">取消Boss
+													</a>
+												@endif
 											@endif
-										@endif
 
-										@if(role('Album/Agent/update'))
+											@if(role('Album/Agent/update'))
 												<a href="{{ U('Album/Agent/update',['id'=>$item->id])}}" class="btn btn-sm btn-warning pull-right">修改</a>
-										@endif
-										@if(role('Album/Agent/status'))
+											@endif
+											@if(role('Album/Agent/status'))
 												@if($item->status == '待审核')
 													<a href="{{ U('Album/Agent/status',['id'=>$item->id,'status'=>1])}}" onclick="return confirm('你确定通过审核?');" class="btn btn-sm btn-success pull-right">通过审核</a>
 												@endif
-										@endif
-										@if(role('Album/Agent/destroy'))
+											@endif
+											@if(role('Album/Agent/destroy'))
 												<a href="{{ U('Album/Agent/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');" class="btn btn-sm btn-danger pull-right">删除</a>
-										@endif
-										@if(role('Album/Product/Price/index'))
+											@endif
+											@if(role('Album/Product/Price/index'))
 												<a href="{{ U('Album/Product/Price/index',['id'=>$item->id])}}" class="btn btn-sm btn-primary pull-right">查看报价</a>
-										@endif
+											@endif
 
-									</div>
-								</td>
-							</tr>
-							@endforeach
+										</div>
+									</td>
+								</tr>
+								@endforeach
 							@endif
 
-						</tbody>
-					</table>
-					<div class="row">
-						<div class="col-sm-6">
-							<div class="dataTables_info" id="DataTables_Table_0_info"
-								role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
-						</div>
-						<div class="col-sm-6">
-						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
-						{!! $list->setPath('')->appends(Request::all())->render() !!}
-						</div>
+							</tbody>
+						</table>
+						<div class="row">
+							<div class="col-sm-6">
+								<div class="dataTables_info" id="DataTables_Table_0_info"
+									 role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+							</div>
+							<div class="col-sm-6">
+								<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+									{!! $list->setPath('')->appends(Request::all())->render() !!}
+								</div>
+							</div>
 						</div>
 					</div>
 				</div>
 			</div>
 		</div>
 	</div>
-</div>
 @endsection