dyjh il y a 6 ans
Parent
commit
3e169cee0c

+ 1 - 1
app/Http/Controllers/Admin/Album/IndexController.php

xqd
@@ -20,7 +20,7 @@ use App\Repositories\Album\UserRepository;
 
 class IndexController extends Base\IndexController
 {
-    function index(Request $request)
+    function index()
     {
         $_user = $this->_user;
         if(request('isalbum') ==1 ){

+ 4 - 3
app/Http/Controllers/Admin/Album/ManufacturerController.php

xqd
@@ -156,11 +156,12 @@ class ManufacturerController extends Controller
     /**
      * 删除
      */
-    public function destroy(Request $request) {
+    public function destroy(Request $request)
+    {
         $bool = $this->repository->destroy($request->get('id'));
-        if($bool) {
+        if ($bool) {
             return  $this->showMessage('操作成功');
-        }else{
+        } else {
             return  $this->showWarning("操作失败");
         }
     }

+ 9 - 3
app/Http/Controllers/Admin/Base/IndexController.php

xqd xqd xqd
@@ -23,6 +23,7 @@ use App\Services\Base\Tree;
 use App\Services\Base\BaseArea;
 use App\Services\Admin\Menus;
 use App\Services\Admin\Acl;
+use Auth;
 
 class IndexController extends Controller
 {
@@ -32,13 +33,14 @@ class IndexController extends Controller
         parent::__construct();
     }
 
-    function index() {
-        if($this->_user['is_root']) {
+    function index()
+    {
+        if ($this->_user['is_root']) {
             $obj = new Menus();
             $menus = $obj->search(array('level'=>2,'display'=>1),$orderby=array('sort'=>'desc'),$pagesize = 100000);
             $menus = $menus->toArray();
             $menus = list_to_tree($menus['data']);
-        }else{
+        } else {
             $obj = new Acl();
             $data = $obj->getRoleMenu($this->_user['admin_role_id']);
             $menus = list_to_tree($data);
@@ -47,6 +49,10 @@ class IndexController extends Controller
     }
     function welcome()
     {
+        $userAuth = Auth::guard('admin')->user();
+        if ($userAuth->is_root == 1 && !empty(request('store_id'))) {
+            session()->put('store_id', request('store_id'));
+        }
         $time = mktime(24, 60, 60, date('m'), date('d'), date('Y'));
         $day = '[';
         $count = '[';

+ 31 - 2
app/Http/Controllers/Admin/Base/UserController.php

xqd xqd xqd xqd
@@ -9,6 +9,9 @@
 namespace App\Http\Controllers\Admin\Base;
 
 use App\Http\Controllers\Admin\Controller;
+use App\Models\AdminUserModel;
+use App\Models\AlbumManufacturerModel;
+use App\Models\AlbumUserModel;
 use App\Services\Admin\Role;
 use App\Services\Admin\AdminUser;
 use Request;
@@ -41,6 +44,15 @@ class UserController extends Controller
             $orderby[$request['sort_field']] = $request['sort_field_by'];
         }
         $list = $this->_service->search($search, $orderby);
+        //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'));
     }
@@ -116,8 +128,12 @@ class UserController extends Controller
      */
     public function update()
     {
-        if(Request::method() == 'POST'){
+        if(Request::method() == 'POST')
+        {
             $data = Request::input('info');
+            if ($data['password'] == null) {
+                unset($data['password']);
+            }
             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')));
@@ -192,5 +208,18 @@ class UserController extends Controller
     {
         return $this->_role_service->get()->toArray();
     }
-    
+
+    /**
+     * 删除
+     */
+    public function destroy()
+    {
+        $user = AdminUserModel::find(Request::get('id'));
+        $ok = $user->delete();
+        if ($ok) {
+            return  $this->showMessage('操作成功');
+        } else {
+            return  $this->showWarning("操作失败");
+        }
+    }
 }

+ 1 - 1
database/migrations/2018_05_11_095832_create_album_banner.php

xqd
@@ -18,7 +18,7 @@ class CreateAlbumBanner extends Migration
             $table->integer('store_id')->comment('商户id');
             $table->longText('pic_url')->comment('图标url');
             $table->string('title',100)->comment('标题');
-            $table->longText('page_url')->comment('页面路径');
+            $table->longText('page_url')->nullable()->default(null)->comment('页面路径');
             $table->unsignedInteger('sort')->comment('排序');
             $table->unsignedInteger('addtime');
             $table->unsignedTinyInteger('is_delete');

+ 9 - 2
resources/views/admin/album/manufacturer/index.blade.php

xqd
@@ -62,11 +62,18 @@
                                         <td>{{ $item->address }}</td>
                                         <td>
                                             <div class="btn-group">
-                                                <button onclick="window.open('{{ U('/Album/Index/index',['store_id'=>$item->store_id,'isalbum' => $isalbum])}}','_blank')"
+                                                <button onclick="window.open('{{ U('/Base/Index/welcome',['store_id'=>$item->store_id])}}','_blank')"
                                                         class="btn btn-warning btn-sm "
                                                         aria-expanded="false">
-                                                    编辑
+                                                    进入
                                                 </button>
+                                                <ul class="dropdown-menu">
+                                                    @if(role('Album/Manufacturer/destroy'))
+                                                        <li class="divider"></li>
+                                                        <li><a href="{{ U('Album/Manufacturer/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作,该操作将会删除厂家所有数据?');">删除</a></li>
+                                                    @endif
+
+                                                </ul>
                                             </div>
                                             @if(role('Album/Manufacturer/view'))
                                                 <button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Manufacturer/view',['id'=>$item->id])}}'});"

+ 6 - 0
resources/views/admin/base/user/edit.blade.php

xqd
@@ -52,6 +52,12 @@
 
                                 </div>
 
+                                <div class="form-group">
+                                    <label class="control-label col-sm-3">商户ID</label>
+                                    <div class="col-sm-9"><input id="txt_mobile" name="info[store_id]" class="form-control" value="{{ $data['store_id'] or ''}}" placeholder="手机"></div>
+
+                                </div>
+
                                 <div class="form-group">
                                     <label class="control-label col-sm-3">密码</label>
                                     <div class="col-sm-9">

+ 7 - 1
resources/views/admin/base/user/index.blade.php

xqd xqd xqd
@@ -35,6 +35,7 @@
 							<tr>
 								<th class="sorting" data-sort="name">用户名</th>
 								<th class="sorting" data-sort="username">账号</th>
+								<th>厂家</th>
 								<th class="sorting" data-sort="email">邮箱</th>
 								<th class="sorting" data-sort="mobile">电话</th>
 								<th class="sorting" data-sort="admin_role_id">角色</th>
@@ -47,6 +48,7 @@
 							<tr>
 								<td>{{ $item->name or '' }}</td>
 								<td>{{ $item->username or '' }}</td>
+								<td>{{ $item->store }}</td>
 								<td>{{ $item->email or '' }}</td>
 								<td>{{ $item->mobile or '' }}</td>
 								<td>
@@ -68,7 +70,11 @@
 										</button>
 										<ul class="dropdown-menu">
 											@if(role('Foundation/User/update'))
-											<li><a href="{{ U('Base/User/update')}}?id={{ $item->id }}" class="font-bold">修改</a></li>
+												<li><a href="{{ U('Base/User/update')}}?id={{ $item->id }}" class="font-bold">修改</a></li>
+											@endif
+											@if(role('Base/User/destroy'))
+												<li class="divider"></li>
+												<li><a href="{{ U('Base/User/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
 											@endif
 										</ul>
 									</div>