Skip to content

Commit

Permalink
Merge pull request #11 from a54552239/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
a54552239 authored Feb 25, 2020
2 parents 6739f68 + 1b3e336 commit e00580b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
3 changes: 3 additions & 0 deletions application/common/Model/ProjectMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions application/common/Model/ProjectReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
34 changes: 13 additions & 21 deletions application/project/controller/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"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",
"overtrue/easy-sms": "^1.1",
"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": {
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// 应用名称
'app_name' => 'pearProject',
// 应用版本
'app_version' => '2.8.9',
'app_version' => '2.8.10',
// 应用地址
'app_host' => '',
// 应用调试模式
Expand Down

0 comments on commit e00580b

Please sign in to comment.