diff --git a/app/Admin/Controllers/ImsCjdcStoreController.php b/app/Admin/Controllers/ImsCjdcStoreController.php index f51fb87..21f2182 100644 --- a/app/Admin/Controllers/ImsCjdcStoreController.php +++ b/app/Admin/Controllers/ImsCjdcStoreController.php @@ -27,7 +27,7 @@ class ImsCjdcStoreController extends AdminController if ($user->isRole('lanzu_mm')) { //如果登陆角色为市场经理,获取市场经理id $mm = LanzuMmInfo::where(['admin_user_id' => $user->id])->first(); - $builder = modelStore::where(['mm_user_id' => $mm->id]); + $builder = modelStore::with('market')->where(['mm_user_id' => $mm->id]); } return Grid::make($builder, function (Grid $grid) { $grid->id->sortable(); diff --git a/app/Admin/Controllers/LanzuMmInfoController.php b/app/Admin/Controllers/LanzuMmInfoController.php index da6a4ea..5c0cb1b 100644 --- a/app/Admin/Controllers/LanzuMmInfoController.php +++ b/app/Admin/Controllers/LanzuMmInfoController.php @@ -50,7 +50,7 @@ class LanzuMmInfoController extends AdminController return $market->name; }); $grid->column('可提现金额')->display(function () { - return MpBalance::getBalance($this->user_id, 0); + return MpBalance::getBalance($this->admin_user_id, 2); }); $grid->id_frond->image('', 50, 50); $grid->id_back->image('', 50, 50); diff --git a/app/Admin/Controllers/LanzuMmWithdrawController.php b/app/Admin/Controllers/LanzuMmWithdrawController.php index 452fca1..6053e40 100644 --- a/app/Admin/Controllers/LanzuMmWithdrawController.php +++ b/app/Admin/Controllers/LanzuMmWithdrawController.php @@ -68,7 +68,7 @@ class LanzuMmWithdrawController extends AdminController $grid->money; $grid->status('提现状态')->using([-1 => '拒绝', 0 => '审核中', 1 => '通过']) ->label([-1 => 'danger', 0 => 'default', 1 => 'success']); - $grid->is_pay('是否到账')->using([0 => '否', 1 => '是']); + $grid->is_pay('是否到账')->using([0 => '否', 1 => '是'])->label([0 => 'danger', 1 => 'success']); $grid->created_at('提现时间')->display(function ($time) { return date('Y-m-d H:i', $time); }); diff --git a/app/Admin/Metrics/Examples/ServiceCard/TotalStore.php b/app/Admin/Metrics/Examples/ServiceCard/TotalStore.php index f3d01d4..b3a8714 100644 --- a/app/Admin/Metrics/Examples/ServiceCard/TotalStore.php +++ b/app/Admin/Metrics/Examples/ServiceCard/TotalStore.php @@ -4,15 +4,31 @@ namespace App\Admin\Metrics\Examples\ServiceCard; +use App\Models\LanzuMmInfo; +use App\Models\LanzuStore; +use Dcat\Admin\Admin; use Dcat\Admin\Widgets\Metrics\Card; class TotalStore extends Card { + protected function init() { parent::init(); $this->title = '商户数'; - $this->content(222); + $aud = Admin::user(); + $count = 0; + if ($aud->isRole('lanzu_mm')){ + $mm = LanzuMmInfo::where('admin_user_id',$aud->id)->first(); + if ($mm){ + $count = LanzuStore::where('mm_user_id',$mm->id)->count(); + } + }elseif($aud->isRole('lanzu_mp')){ + $count = 0; + }else{ + $count = LanzuStore::count(); + } + $this->content($count); } public function renderContent() diff --git a/app/Models/ImsCjdcStore.php b/app/Models/ImsCjdcStore.php index 2fa7a25..f25750f 100644 --- a/app/Models/ImsCjdcStore.php +++ b/app/Models/ImsCjdcStore.php @@ -10,12 +10,12 @@ use App\Models\StoreAccount; class ImsCjdcStore extends Model { use HasDateTimeFormatter; - protected $table = 'ims_cjdc_store'; + protected $table = 'lanzu_store'; public $timestamps = false; public function market(){ return $this->hasOne('\App\Models\ImsCjdcMarket','id','market_id'); } - + public function storeAccount(){ return $this->hasMany(StoreAccount::class,'store_id','id'); } diff --git a/app/Models/LanzuStore.php b/app/Models/LanzuStore.php index 43a0aaf..b3fa664 100644 --- a/app/Models/LanzuStore.php +++ b/app/Models/LanzuStore.php @@ -9,6 +9,6 @@ use Illuminate\Database\Eloquent\Model; class LanzuStore extends Model { use HasDateTimeFormatter; - protected $table = 'ims_cjdc_store'; + protected $table = 'lanzu_store'; protected $dateFormat = 'U'; }