Skip to content

Commit

Permalink
防止不同委员会搭档成功配对
Browse files Browse the repository at this point in the history
  • Loading branch information
CRH380B-6216L committed Jul 11, 2017
1 parent 113767f commit 046673c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 433 deletions.
8 changes: 5 additions & 3 deletions app/Delegate.php
Expand Up @@ -302,7 +302,7 @@ public function assignPartnerByName($option = null)
foreach ($partners_reg as $partner1)
{
if ($partner1->type != 'delegate') continue; // 排除非代表搭档
if ($partner1->delegate->committee != $this->committee) continue; // 排除非本委员会搭档
if ($partner1->delegate->committee_id != $this->committee_id) continue; // 排除非本委员会搭档
if (!in_array($partner1->delegate->status, ['paid', 'oVerified'])) continue;
if (is_object($partner))
{
Expand Down Expand Up @@ -339,7 +339,7 @@ public function assignPartnerByName($option = null)
$this->reg->addEvent('partner_auto_fail', $notes);
return "$myname 	$partner->id 	搭档姓名$partner_name	未缴费";
}
if ($delpartner->committee != $this->committee) //continue; // 排除非本委员会搭档
if ($delpartner->committee_id != $this->committee_id) //continue; // 排除非本委员会搭档
{
$notes = "{\"reason\":\"$partner_name" . "$myname" . "并非同一委员会\"}";
$this->reg->addEvent('partner_auto_fail', $notes);
Expand Down Expand Up @@ -380,7 +380,9 @@ public function assignPartnerByRid($rid, $admin = false)
{
$reg = Delegate::findOrFail($rid);
if (!empty($reg->partner_reg_id))
return "目标已有室友分配!";
return "目标已有搭档分配!";
if ($reg->committee_id != $this->committee_id)
return "目标与本人并不在同一委员会!";
$this->partner_reg_id = $reg->reg_id;
$name = $reg->user()->name;
$this->save();
Expand Down
4 changes: 4 additions & 0 deletions public/css/munpanel.css
Expand Up @@ -271,3 +271,7 @@ fieldset[mp-disabled] .btn-danger.active {
margin-top:7px;
margin-bottom:7px;
}

.no-padding {
padding: 0px;
}

0 comments on commit 046673c

Please sign in to comment.