创建版本
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php namespace Gdoo\Project\Controllers;
|
||||
|
||||
use DB;
|
||||
use Auth;
|
||||
use Request;
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
use Gdoo\Index\Services\InfoService;
|
||||
|
||||
class WidgetController extends DefaultController
|
||||
{
|
||||
public $permission = ['info'];
|
||||
|
||||
/**
|
||||
* 项目任务信息
|
||||
*/
|
||||
public function infoAction()
|
||||
{
|
||||
$config = InfoService::getInfo('project_task');
|
||||
|
||||
$count = DB::table('project_task')
|
||||
->where('user_id', Auth::id())
|
||||
->whereRaw('isnull(progress, 0) < 1')
|
||||
->whereRaw('('.$config['sql'].')')
|
||||
->count();
|
||||
$count2 = DB::table('project_task')
|
||||
->where('user_id', Auth::id())
|
||||
->whereRaw('isnull(progress, 0) < 1')
|
||||
->whereRaw('('.$config['sql2'].')')
|
||||
->count();
|
||||
$rate = 0;
|
||||
if ($count2 > 0) {
|
||||
$rate = $count / $count2 * 100;
|
||||
}
|
||||
$res = [
|
||||
'count' => $count,
|
||||
'count2' => $count2,
|
||||
'rate' => $rate,
|
||||
];
|
||||
return $this->render([
|
||||
'dates' => $config['dates'],
|
||||
'info' => $config['info'],
|
||||
'res' => $res,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user