Browse Source

优化市场经理可见商户

master
lanzu_qinsheng 5 years ago
parent
commit
04a42fcb5d
  1. 9
      app/Admin/Controllers/LanzuFinancialRecord.php
  2. 11
      app/Admin/Controllers/v3/StoreController.php

9
app/Admin/Controllers/LanzuFinancialRecord.php

@ -42,10 +42,15 @@ class LanzuFinancialRecord extends AdminController
if ($this->user_type == 1) {
$name = ImsCjdcUser::find($this->user_id)->name;
} else {
$name = AdminUsers::find($this->user_id)->name;
if ($this->user_id){
$name = AdminUsers::find($this->user_id)->name;
}else{
$name = '<span style="color: #ff0000">数据错误</span>';
}
}
return $name;
});
})->style('danger');
$grid->money('金额');
$grid->desc('说明');
$grid->created_at('创建时间')->display(function ($time) {

11
app/Admin/Controllers/v3/StoreController.php

@ -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);

Loading…
Cancel
Save