|
|
|
@ -3,6 +3,8 @@ |
|
|
|
namespace App\Admin\Controllers\v3; |
|
|
|
|
|
|
|
use App\Admin\Repositories\v3\Store; |
|
|
|
use App\Models\LanzuMmInfo; |
|
|
|
use Dcat\Admin\Admin; |
|
|
|
use Dcat\Admin\Form; |
|
|
|
use Dcat\Admin\Grid; |
|
|
|
use Dcat\Admin\Show; |
|
|
|
@ -26,7 +28,14 @@ class StoreController extends AdminController |
|
|
|
*/ |
|
|
|
protected function grid() |
|
|
|
{ |
|
|
|
return Grid::make(new Store(), function (Grid $grid) { |
|
|
|
$user = Admin::user(); |
|
|
|
$builder = new Store(); |
|
|
|
if ($user->isRole('lanzu_mm')) { |
|
|
|
//如果登陆角色为市场经理,获取市场经理id
|
|
|
|
$mm = LanzuMmInfo::where(['admin_user_id' => $user->id])->first(); |
|
|
|
$builder = StoreModel::where(['mm_user_id' => $mm->user_id]); |
|
|
|
} |
|
|
|
return Grid::make($builder, function (Grid $grid) { |
|
|
|
$grid->model()->orderBy('id','desc'); |
|
|
|
$grid->id->sortable(); |
|
|
|
$grid->logo_url->image('',50); |
|
|
|
@ -141,7 +150,7 @@ class StoreController extends AdminController |
|
|
|
$userList = UserModel::getUserArray(); |
|
|
|
// 绑定了店铺的用户
|
|
|
|
$userHas = StoreModel::pluck('admin_id')->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
foreach($userList as $ku => $uv){ |
|
|
|
if($ku != 0 && in_array($ku,$userHas)){ |
|
|
|
unset($userList[$ku]); |
|
|
|
@ -277,7 +286,7 @@ class StoreController extends AdminController |
|
|
|
for ($i = 0; $i < $length; ++$i) { |
|
|
|
$hash .= $seed[mt_rand(0, $max)]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $hash; |
|
|
|
} |
|
|
|
} |