|
@@ -28,6 +28,9 @@ class Active extends Backend
|
|
|
$this->view->assign("isFreeList", $this->model->getIsFreeList());
|
|
|
$this->view->assign("isOverlyingList", $this->model->getIsOverlyingList());
|
|
|
$this->view->assign("statusList", $this->model->getStatusList());
|
|
|
+ $this->view->assign("showstatusList", $this->model->getShowstatusList());
|
|
|
+ $this->view->assign("isAutoshowList", $this->model->getIsAutoshowList());
|
|
|
+ $this->view->assign("isBannerList", $this->model->getIsBannerList());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -107,6 +110,9 @@ class Active extends Backend
|
|
|
$this->model->validateFailException(true)->validate($validate);
|
|
|
}
|
|
|
$result = $this->model->allowField(true)->save($params);
|
|
|
+
|
|
|
+ $id = $this->model->id;
|
|
|
+
|
|
|
Db::commit();
|
|
|
} catch (ValidateException $e) {
|
|
|
Db::rollback();
|
|
@@ -119,6 +125,15 @@ class Active extends Backend
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
if ($result !== false) {
|
|
|
+ if ($params['is_banner'] == 1) {
|
|
|
+ //在轮播图显示
|
|
|
+ $banner_data['title'] = $params['title'];
|
|
|
+ $banner_data['image'] = $params['image'];
|
|
|
+ $banner_data['url'] = '/pages/home/detail?id='.$id;
|
|
|
+ $banner_data['createtime'] = time();
|
|
|
+
|
|
|
+ Db::name('banner')->insertGetId($banner_data);
|
|
|
+ }
|
|
|
$this->success();
|
|
|
} else {
|
|
|
$this->error(__('No rows were inserted'));
|
|
@@ -151,9 +166,33 @@ class Active extends Backend
|
|
|
if ($row['status'] == 2 || $row['status'] == 3) {
|
|
|
$this->error('活动已经结束或取消');
|
|
|
}
|
|
|
+ if ($params['showstatus'] == 0) { //下架
|
|
|
+ $count = Db::name('active_order')->where(['active_id' => $ids, 'status' => ['neq', 3]])->count('id');
|
|
|
+ if ($count) {
|
|
|
+ $this->error('已经有人报名,不能下架');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$result = false;
|
|
|
Db::startTrans();
|
|
|
+
|
|
|
+ //是否在轮播图显示
|
|
|
+ if ($params['is_banner'] == 0) {
|
|
|
+ //不显示
|
|
|
+ Db::name('banner')->where(['title' => $row['title']])->delete();
|
|
|
+ } elseif ($params['is_banner'] == 1) {
|
|
|
+ //显示
|
|
|
+ $banner_count = Db::name('banner')->where(['title' => $row['title']])->count('id');
|
|
|
+ if (!$banner_count) {
|
|
|
+ $banner_data['title'] = $row['title'];
|
|
|
+ $banner_data['image'] = $row['image'];
|
|
|
+ $banner_data['url'] = '/pages/home/detail?id=' . $ids;
|
|
|
+ $banner_data['createtime'] = time();
|
|
|
+
|
|
|
+ Db::name('banner')->insertGetId($banner_data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
if (isset($params['status'])) {
|
|
|
if ($params['status'] == 2) {
|