Browse Source

增加服务商卡片数据

master
lanzu_qsy 5 years ago
parent
commit
fed490fa4c
  1. 2
      app/Admin/Controllers/ImsCjdcStoreController.php
  2. 2
      app/Admin/Controllers/LanzuMmInfoController.php
  3. 2
      app/Admin/Controllers/LanzuMmWithdrawController.php
  4. 18
      app/Admin/Metrics/Examples/ServiceCard/TotalStore.php
  5. 4
      app/Models/ImsCjdcStore.php
  6. 2
      app/Models/LanzuStore.php

2
app/Admin/Controllers/ImsCjdcStoreController.php

@ -27,7 +27,7 @@ class ImsCjdcStoreController extends AdminController
if ($user->isRole('lanzu_mm')) { if ($user->isRole('lanzu_mm')) {
//如果登陆角色为市场经理,获取市场经理id //如果登陆角色为市场经理,获取市场经理id
$mm = LanzuMmInfo::where(['admin_user_id' => $user->id])->first(); $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) { return Grid::make($builder, function (Grid $grid) {
$grid->id->sortable(); $grid->id->sortable();

2
app/Admin/Controllers/LanzuMmInfoController.php

@ -50,7 +50,7 @@ class LanzuMmInfoController extends AdminController
return $market->name; return $market->name;
}); });
$grid->column('可提现金额')->display(function () { $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_frond->image('', 50, 50);
$grid->id_back->image('', 50, 50); $grid->id_back->image('', 50, 50);

2
app/Admin/Controllers/LanzuMmWithdrawController.php

@ -68,7 +68,7 @@ class LanzuMmWithdrawController extends AdminController
$grid->money; $grid->money;
$grid->status('提现状态')->using([-1 => '拒绝', 0 => '审核中', 1 => '通过']) $grid->status('提现状态')->using([-1 => '拒绝', 0 => '审核中', 1 => '通过'])
->label([-1 => 'danger', 0 => 'default', 1 => 'success']); ->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) { $grid->created_at('提现时间')->display(function ($time) {
return date('Y-m-d H:i', $time); return date('Y-m-d H:i', $time);
}); });

18
app/Admin/Metrics/Examples/ServiceCard/TotalStore.php

@ -4,15 +4,31 @@
namespace App\Admin\Metrics\Examples\ServiceCard; namespace App\Admin\Metrics\Examples\ServiceCard;
use App\Models\LanzuMmInfo;
use App\Models\LanzuStore;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Card; use Dcat\Admin\Widgets\Metrics\Card;
class TotalStore extends Card class TotalStore extends Card
{ {
protected function init() protected function init()
{ {
parent::init(); parent::init();
$this->title = '商户数'; $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() public function renderContent()

4
app/Models/ImsCjdcStore.php

@ -10,12 +10,12 @@ use App\Models\StoreAccount;
class ImsCjdcStore extends Model class ImsCjdcStore extends Model
{ {
use HasDateTimeFormatter; use HasDateTimeFormatter;
protected $table = 'ims_cjdc_store';
protected $table = 'lanzu_store';
public $timestamps = false; public $timestamps = false;
public function market(){ public function market(){
return $this->hasOne('\App\Models\ImsCjdcMarket','id','market_id'); return $this->hasOne('\App\Models\ImsCjdcMarket','id','market_id');
} }
public function storeAccount(){ public function storeAccount(){
return $this->hasMany(StoreAccount::class,'store_id','id'); return $this->hasMany(StoreAccount::class,'store_id','id');
} }

2
app/Models/LanzuStore.php

@ -9,6 +9,6 @@ use Illuminate\Database\Eloquent\Model;
class LanzuStore extends Model class LanzuStore extends Model
{ {
use HasDateTimeFormatter; use HasDateTimeFormatter;
protected $table = 'ims_cjdc_store';
protected $table = 'lanzu_store';
protected $dateFormat = 'U'; protected $dateFormat = 'U';
} }
Loading…
Cancel
Save