7 changed files with 159 additions and 9 deletions
-
37app/Admin/Controllers/HomeController.php
-
4app/Admin/Controllers/LanzuCsInfoController.php
-
32app/Admin/Metrics/Community/TotalAmount.php
-
34app/Admin/Metrics/Community/TotalCommunity.php
-
36app/Admin/Metrics/Community/TotalUser.php
-
4app/Admin/routes.php
-
21app/Models/LanzuUserRelationBind.php
@ -0,0 +1,32 @@ |
|||
<?php |
|||
namespace App\admin\Metrics\Community; |
|||
|
|||
|
|||
use App\Models\LanzuUserBalance; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Widgets\Metrics\Card; |
|||
|
|||
class TotalAmount extends Card |
|||
{ |
|||
protected function init() |
|||
{ |
|||
parent::init(); |
|||
$this->title = '可提现金额'; |
|||
$this->content(LanzuUserBalance::getBalance(Admin::user()->id,3)); |
|||
} |
|||
|
|||
/** |
|||
* 渲染卡片内容 |
|||
* @return string |
|||
*/ |
|||
public function renderContent() |
|||
{ |
|||
$content = parent::renderContent(); |
|||
return <<<HTML |
|||
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> |
|||
<h2 class="ml-1 font-large-1">{$content}</h2> |
|||
</div> |
|||
HTML; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\admin\Metrics\Community; |
|||
|
|||
|
|||
|
|||
use App\Models\LanzuCsInfo; |
|||
use Dcat\Admin\Widgets\Metrics\Card; |
|||
|
|||
class TotalCommunity extends Card |
|||
{ |
|||
protected function init() |
|||
{ |
|||
parent::init(); |
|||
$this->title = '社区总数'; |
|||
$this->content(LanzuCsInfo::count()); |
|||
} |
|||
|
|||
/** |
|||
* 渲染卡片内容. |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function renderContent() |
|||
{ |
|||
$content = parent::renderContent(); |
|||
return <<<HTML |
|||
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> |
|||
<h2 class="ml-1 font-large-1">{$content}</h2> |
|||
</div> |
|||
HTML; |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\admin\Metrics\Community; |
|||
|
|||
|
|||
use App\Models\LanzuUserRelationBind; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Widgets\Metrics\Card; |
|||
|
|||
class TotalUser extends Card |
|||
{ |
|||
protected function init() |
|||
{ |
|||
parent::init(); |
|||
$this->title = '绑定用户数'; |
|||
$adu = Admin::user(); |
|||
if ($adu->isRole('lanzu_cs')){ |
|||
$this->content(LanzuUserRelationBind::getCount($adu->id)); |
|||
}else{ |
|||
$this->content(LanzuUserRelationBind::getCount()); |
|||
} |
|||
|
|||
} |
|||
|
|||
public function renderContent() |
|||
{ |
|||
$content = parent::renderContent(); |
|||
return <<<HTML |
|||
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> |
|||
<h2 class="ml-1 font-large-1">{$content}</h2> |
|||
</div> |
|||
HTML; |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Models; |
|||
|
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class LanzuUserRelationBind extends Model |
|||
{ |
|||
protected $table = 'lanzu_user_relation_bind'; |
|||
|
|||
|
|||
public static function getCount($source_id=null) |
|||
{ |
|||
if ($source_id){ |
|||
return self::where('source_id',$source_id)->count(); |
|||
} |
|||
return self::count(); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue