diff --git a/application/common/Model/ProjectMember.php b/application/common/Model/ProjectMember.php index 68b5494..e18f2ee 100644 --- a/application/common/Model/ProjectMember.php +++ b/application/common/Model/ProjectMember.php @@ -55,6 +55,9 @@ public function removeMember($memberCode, $projectCode) // throw new \Exception('该成员尚未加入项目', 1); return true; } + if ($hasJoined['is_owner']) { + throw new \Exception('不能移除创建者', 1); + } $result = $hasJoined->delete(); Project::projectHook(getCurrentMember()['code'], $projectCode, 'removeMember', $memberCode); return $result; diff --git a/application/common/Model/ProjectReport.php b/application/common/Model/ProjectReport.php index c902eed..2e87129 100644 --- a/application/common/Model/ProjectReport.php +++ b/application/common/Model/ProjectReport.php @@ -51,12 +51,12 @@ public static function getReportByDay($projectCode, $day = 10) } } if ($max) { - $each = ceil($max / ($day - 1)); + $each = round($max / ($day - 1), 1); $current = $max; for ($i = 1; $i <= $day; $i++) { + ($current < 0 || $day == $i) && $current = 0; $baseLineList[] = $current; $current -= $each; - $current < 0 && $current = 0; } } return ['date' => $dateList, 'task' => $taskList, 'undoneTask' => $undoneTaskList, 'baseLineList' => $baseLineList]; diff --git a/application/project/controller/Project.php b/application/project/controller/Project.php index 75ad8ab..0cd1945 100644 --- a/application/project/controller/Project.php +++ b/application/project/controller/Project.php @@ -56,32 +56,24 @@ public function index() $orgCode = getCurrentOrganizationCode(); if ($type == 'my' || $type == 'other') { - $sql = "select * from {$prefix}project as pp join {$prefix}project_member as pm on pm.project_code = pp.code where pp.organization_code = '{$orgCode}' and (pm.member_code = '{$memberCode}' or pp.private = 0) group by pp.`code` order by pp.id desc"; - $list = CommonModel::limitByQuery($sql, $page, $pageSize); + $sql = "select * from {$prefix}project as pp left join {$prefix}project_member as pm on pm.project_code = pp.code where pp.organization_code = '{$orgCode}' and (pm.member_code = '{$memberCode}' or pp.private = 0)"; } else { - $sql = "select * from {$prefix}project as pp join {$prefix}project_collection as pc on pc.project_code = pp.code where pp.organization_code = '{$orgCode}' and pc.member_code = '{$memberCode}' group by pp.`code` order by pc.id desc"; - $list = CommonModel::limitByQuery($sql, $page, $pageSize); + $sql = "select * from {$prefix}project as pp left join {$prefix}project_collection as pc on pc.project_code = pp.code where pp.organization_code = '{$orgCode}' and pc.member_code = '{$memberCode}'"; } + if ($type != 'other') { + $sql .= " and pp.deleted = 0"; + } + if (isset($data['archive'])) { + $sql .= " and pp.archive = 1"; + } + if (isset($data['recycle'])) { + $sql .= " and pp.deleted = 1"; + } + $sql .= " group by pp.`code` order by pp.id desc"; + $list = CommonModel::limitByQuery($sql, $page, $pageSize); $newList = []; if ($list['list']) { foreach ($list['list'] as $key => &$item) { - $delete = false; - if ($type != 'other') { - if ($item['deleted']) { - $delete = true; - } - } - if (isset($data['archive']) && !$item['archive']) { - $delete = true; - } - - if (isset($data['recycle']) && !$item['deleted']) { - $delete = true; - } - if ($delete) { - continue; - } - $item['collected'] = 0; $item['owner_name'] = '-'; $collected = ProjectCollection::where(['project_code' => $item['code'], 'member_code' => $currentMember['code']])->field('id')->find(); diff --git a/composer.json b/composer.json index 3322fbb..c3bd8c9 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,6 @@ "endroid/qr-code": "^1.9", "topthink/framework": "5.1.*", "aliyuncs/oss-sdk-php": "^2.2", - "zoujingli/ip2region": "dev-master", "topthink/think-image": "^1.0", "workerman/gateway-worker-for-win" : ">=3.0.0", "workerman/gateway-worker" : ">=3.0.0", @@ -28,7 +27,8 @@ "phpoffice/phpspreadsheet": "^1.5", "firebase/php-jwt": "^5.0", "phpmailer/phpmailer": "^6.0", - "mingyoung/dingtalk": "2.0" + "mingyoung/dingtalk": "2.0", + "zoujingli/ip2region": "^1.0" }, "autoload": { "psr-4": { diff --git a/config/app.php b/config/app.php index f8f7dd8..8377dff 100644 --- a/config/app.php +++ b/config/app.php @@ -6,7 +6,7 @@ // 应用名称 'app_name' => 'pearProject', // 应用版本 - 'app_version' => '2.8.9', + 'app_version' => '2.8.10', // 应用地址 'app_host' => '', // 应用调试模式