|
@@ -103,7 +103,13 @@ class Index extends Api
|
|
|
if (!$info) {
|
|
|
$this->error('活动不存在');
|
|
|
}
|
|
|
- if ($info['signupendtime'] < time() || $info['status'] != 0) {
|
|
|
+ if ($info['status'] == 2) {
|
|
|
+ $this->error('活动已经结束');
|
|
|
+ }
|
|
|
+ if ($info['status'] == 3) {
|
|
|
+ $this->error('活动已经取消');
|
|
|
+ }
|
|
|
+ if ($info['signupendtime'] < time()) {
|
|
|
$this->error('活动报名已经截止');
|
|
|
}
|
|
|
if ($info['currentperson'] >= $info['maxperson']) {
|
|
@@ -177,7 +183,13 @@ class Index extends Api
|
|
|
if (!$info) {
|
|
|
$this->error('活动不存在');
|
|
|
}
|
|
|
- if ($info['signupendtime'] < time() || $info['status'] != 0) {
|
|
|
+ if ($info['status'] == 2) {
|
|
|
+ $this->error('活动已经结束');
|
|
|
+ }
|
|
|
+ if ($info['status'] == 3) {
|
|
|
+ $this->error('活动已经取消');
|
|
|
+ }
|
|
|
+ if ($info['signupendtime'] < time()) {
|
|
|
$this->error('活动报名已经截止');
|
|
|
}
|
|
|
if ($info['currentperson'] >= $info['maxperson']) {
|
|
@@ -468,11 +480,16 @@ class Index extends Api
|
|
|
$order_data['number'] = count($active_people_arr);
|
|
|
$order_data['status'] = $paytype == 1 ? 0 : 1;
|
|
|
$order_data['createtime'] = time();
|
|
|
+ //构建活动信息
|
|
|
+ $active_data['currentperson'] = $info['currentperson'] + count($active_people_arr);
|
|
|
+ if ($info['currentperson'] + count($active_people_arr) >= $info['minperson'] && $info['status'] == 0) {
|
|
|
+ $active_data['status'] = 1;
|
|
|
+ }
|
|
|
|
|
|
//开始事务
|
|
|
Db::startTrans();
|
|
|
//修改活动表数据
|
|
|
- $active_rs = Db::name('active')->where(['id' => $id, 'status' => 0,'currentperson' => $info['currentperson']])->setField('currentperson', $info['currentperson'] + count($active_people_arr));
|
|
|
+ $active_rs = Db::name('active')->where(['id' => $id, 'status' => $info['status'],'currentperson' => $info['currentperson']])->setField($active_data);
|
|
|
if (!$active_rs) {
|
|
|
Db::rollback();
|
|
|
$this->error('网络延迟,请稍后再试');
|