|
@@ -161,7 +161,7 @@ class Activity extends Base{
|
|
}
|
|
}
|
|
public function info(){
|
|
public function info(){
|
|
$param=$this->request->param(["id"=>""],"post","trim");
|
|
$param=$this->request->param(["id"=>""],"post","trim");
|
|
- $info= $this->model->with(["act","platformYz"=>["platform","good"=>['unit','brand','category']],"promocode"])->findOrEmpty($param['id']);
|
|
|
|
|
|
+ $info= $this->model->with(["act","platformYz"=>["platform","good"=>['unit','brand','category']],"promocode"])->where(['is_del' => 0])->findOrEmpty($param['id']);
|
|
if($info->isEmpty()){
|
|
if($info->isEmpty()){
|
|
$this->error("信息有误");
|
|
$this->error("信息有误");
|
|
}
|
|
}
|
|
@@ -258,19 +258,20 @@ class Activity extends Base{
|
|
if($info->isEmpty()){
|
|
if($info->isEmpty()){
|
|
$this->error("信息有误");
|
|
$this->error("信息有误");
|
|
}
|
|
}
|
|
|
|
+ if($info->act_good_id!=0){
|
|
|
|
+ $act = $this->model->with(['act'])->where(['is_del' => 0, 'id' => $info->act_good_id])->findOrEmpty();
|
|
|
|
+ if (time()<=strtotime($act->endTime) && time()>=strtotime($act->startTime)) $this->error('活动正在进行中,不能删除');
|
|
|
|
+ }
|
|
$info->is_del=1;
|
|
$info->is_del=1;
|
|
try{
|
|
try{
|
|
$save= $info->save();
|
|
$save= $info->save();
|
|
if(!$save)throw new \Exception('删除失败');
|
|
if(!$save)throw new \Exception('删除失败');
|
|
- if($info->act_good_id!==0){
|
|
|
|
- $act= $this->model->with(["act"])->where(['is_del'=>0,'id'=>$info->act_good_id])->findOrEmpty();
|
|
|
|
- if(!$act->isEmpty()){
|
|
|
|
|
|
+ if(isset($act) && !$act->isEmpty()){
|
|
if(time()<strtotime($act->startTime)){ //活动未开始
|
|
if(time()<strtotime($act->startTime)){ //活动未开始
|
|
- $act->promocode_id=0;
|
|
|
|
- $act->status=1;
|
|
|
|
- $act->save();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ $act->promocode_id=0;
|
|
|
|
+ $act->status=1;
|
|
|
|
+ $act->save();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
}catch (\Exception $e){
|
|
$this->error($e->getMessage());
|
|
$this->error($e->getMessage());
|