feat: 扫码签到功能
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -32,6 +32,34 @@ class Activity extends Base
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $append = [
|
||||
'actitity_state_trans'
|
||||
];
|
||||
|
||||
public function getActitityStateTransAttr($value, $data)
|
||||
{
|
||||
if ($data['activity_state'] < 3) {
|
||||
$now = time();
|
||||
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
|
||||
// 当前时间小于报名截止时间,状态流转处于:报名中
|
||||
if ($now < $data['apply_time']) $value = 1;
|
||||
// 当前时间大于等于报名截止时间小于开始时间,状态流转处于:未开始
|
||||
if ($now >= $data['apply_time'] && $now < $data['start_time']) $value = 2;
|
||||
// 当前时间大于等于开始时间小于等于结束时间,状态流转处于:进行中
|
||||
if ($now >= $data['start_time'] && $now <= $data['end_time']) {
|
||||
$value = 3;
|
||||
}
|
||||
// 当前时间大于结束时间,状态流转处于:已结束
|
||||
if ($now > $data['end_time']) {
|
||||
$value = 4;
|
||||
}
|
||||
} else {
|
||||
// 活动结束,状态流转就一直处理:已结束
|
||||
$value = 4;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterUpdate(function ($row) {
|
||||
@@ -65,7 +93,3 @@ class Activity extends Base
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user