...
|
...
|
@@ -24,6 +24,13 @@ class ActivityController extends AdminBaseController |
|
|
$param = $this->request->param();
|
|
|
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
|
|
|
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
|
|
|
|
|
|
$team_id=$this->getAdminTeamId();
|
|
|
if (!empty($team_id)){
|
|
|
$where['a.team_id']=$team_id;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!empty($startTime) && !empty($endTime)) {
|
|
|
$where['a.create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
|
|
|
} else {
|
...
|
...
|
@@ -70,6 +77,10 @@ class ActivityController extends AdminBaseController |
|
|
public function news(){
|
|
|
$where=[];
|
|
|
$param = $this->request->param();
|
|
|
$team_id=$this->getAdminTeamId();
|
|
|
if (!empty($team_id)){
|
|
|
$where['team_id']=$team_id;
|
|
|
}
|
|
|
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
|
|
|
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
|
|
|
if (!empty($startTime) && !empty($endTime)) {
|
...
|
...
|
@@ -141,6 +152,9 @@ class ActivityController extends AdminBaseController |
|
|
Db::name('activity')
|
|
|
->where('id',$id)
|
|
|
->update($param);
|
|
|
if ($teamId>0){
|
|
|
$this->addTeamLog($teamId,'活动','编辑活动',$param);
|
|
|
}
|
|
|
$this->success('更新成功!');
|
|
|
}else{
|
|
|
$data=Db::name('activity')
|
...
|
...
|
@@ -196,6 +210,9 @@ class ActivityController extends AdminBaseController |
|
|
Db::name('activity_news')
|
|
|
->where('id',$id)
|
|
|
->update($param);
|
|
|
if ($teamId>0){
|
|
|
$this->addTeamLog($teamId,'活动新闻','编辑活动新闻',$param);
|
|
|
}
|
|
|
$this->success('更新成功!');
|
|
|
}else{
|
|
|
$data=Db::name('activity_news')
|
...
|
...
|
@@ -227,6 +244,7 @@ class ActivityController extends AdminBaseController |
|
|
$teamId=$this->getAdminTeamId();
|
|
|
if($this->request->isPost()){
|
|
|
$param=$this->request->param();
|
|
|
$param['team_id']=$teamId;
|
|
|
$param['create_time']=time();
|
|
|
$param['update_time']=time();
|
|
|
$param['time']=strtotime($param['time']);
|
...
|
...
|
@@ -252,6 +270,9 @@ class ActivityController extends AdminBaseController |
|
|
}
|
|
|
Db::name('activity')
|
|
|
->insert($param);
|
|
|
if ($teamId>0){
|
|
|
$this->addTeamLog($teamId,'活动','添加活动',$param);
|
|
|
}
|
|
|
$this->success('添加成功!');
|
|
|
}else{
|
|
|
$activity_type=\db('activity_type')->where('delete_time','0')->select()->toArray();
|
...
|
...
|
@@ -275,10 +296,13 @@ class ActivityController extends AdminBaseController |
|
|
}
|
|
|
|
|
|
public function addNews(){
|
|
|
$teamId=$this->getAdminTeamId();
|
|
|
if($this->request->isPost()){
|
|
|
$param=$this->request->param();
|
|
|
$param['item_id']=$this->getAdminTeamId();
|
|
|
$param['create_time']=time();
|
|
|
$param['update_time']=time();
|
|
|
$param['team_id']=$teamId;
|
|
|
$param['time']=strtotime($param['time']);
|
|
|
$validate = new Validate([
|
|
|
'activity_name' => 'require',
|
...
|
...
|
@@ -301,6 +325,10 @@ class ActivityController extends AdminBaseController |
|
|
}
|
|
|
Db::name('activity_news')
|
|
|
->insert($param);
|
|
|
|
|
|
if ($teamId>0){
|
|
|
$this->addTeamLog($teamId,'活动新闻','编辑新闻',$param);
|
|
|
}
|
|
|
$this->success('添加成功!');
|
|
|
}else{
|
|
|
$activity_type=\db('news_type')->select()->toArray();
|
...
|
...
|
@@ -352,13 +380,16 @@ class ActivityController extends AdminBaseController |
|
|
}
|
|
|
public function deleteNews(){
|
|
|
$param = $this->request->param();
|
|
|
|
|
|
$teamId=$this->getAdminTeamId();
|
|
|
if (isset($param['id'])) {
|
|
|
$id = $this->request->param('id', 0, 'intval');
|
|
|
$resultPortal = Db::name('activity_news')
|
|
|
->where(['id' => $id])
|
|
|
->update(['delete_time' => time()]);
|
|
|
if($resultPortal){
|
|
|
if ($teamId>0){
|
|
|
$this->addTeamLog($teamId,'活动新闻','删除新闻',$id);
|
|
|
}
|
|
|
$this->success("删除成功!", '');
|
|
|
}else{
|
|
|
$this->error("删除失败!", '');
|
...
|
...
|
@@ -371,6 +402,9 @@ class ActivityController extends AdminBaseController |
|
|
->where(['id' => ['in', $ids]])
|
|
|
->update(['delete_time' => time()]);
|
|
|
if ($result) {
|
|
|
if ($teamId>0){
|
|
|
$this->addTeamLog($teamId,'活动新闻','删除新闻',$id);
|
|
|
}
|
|
|
$this->success("删除成功!", '');
|
|
|
}else{
|
|
|
$this->error("删除失败!", '');
|
...
|
...
|
|