Skip to content

Commit

Permalink
调整:称号授予、活动完成系统通知
Browse files Browse the repository at this point in the history
  • Loading branch information
Chef5 committed Jun 3, 2020
1 parent 4955939 commit 66e4621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions app/Console/Commands/GrantHonor.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public function __construct()
parent::__construct();
}

// 初始数据-等级称号
protected $honors = ['赤脚', '草鞋', '棉鞋', '布鞋', '板鞋', '高跟鞋', '球鞋', '运动鞋', '跑鞋'];

/**
* Execute the console command.
*
Expand Down Expand Up @@ -76,10 +79,8 @@ public function handle()
]
);
System::systemNotice([
'from' => 0,
'to' => $user->rid,
'type' => 0,
'msg' => "你已累计运动 $user->count 次,授予您新的的称号: lv".$hoid
'to' => $user->rid,
'msg' => "你已累计运动 $user->count 次,授予您新的的称号: lv".($hoid-1).' '.$this->honors[$hoid-1]
]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/RunController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private function checkMedals($rid, $distance){
// 活动成就
$timeNow = date('Y-m-d H:i:s');
$theLastestFinished = LinkUAs::join('r_activitys', 'link_u_as.acid', '=', 'r_activitys.acid')
->select('link_u_as.rid', 'link_u_as.acid', 'link_u_as.isfinished', 'r_activitys.distance', 'r_activitys.period', 'r_activitys.meid')
->select('link_u_as.rid', 'link_u_as.acid', 'link_u_as.isfinished', 'r_activitys.title', 'r_activitys.distance', 'r_activitys.period', 'r_activitys.meid')
->where('r_activitys.period', '>', $timeNow) //有效期内的活动
->where('link_u_as.rid', $rid) //已报名的活动
->where('link_u_as.isfinished', 0) //未完成的活动
Expand All @@ -75,7 +75,7 @@ private function checkMedals($rid, $distance){
DB::commit();
System::systemNotice([
'to' => $theLastestFinished->rid,
'msg' => "你新获得一枚勋章<".$medal->name.">"
'msg' => "恭喜您挑战完成活动《".$theLastestFinished->title."》,获得一枚勋章<".$medal->name.">"
]);
} catch (\Throwable $th) {
DB::rollback();
Expand Down

0 comments on commit 66e4621

Please sign in to comment.