validate()){ return $this->getModelError(); } if(is_array($this->rule_id)){ foreach ($this->rule_id as $rule_id){ $model = RechargeRule::findOne([ 'id' => $rule_id, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id ]); if($model == null) continue; $model->is_delete = 1; if(!$model->save()){ return $this->getModelError($model); } } } else { $model = RechargeRule::findOne([ 'id' => $this->rule_id, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id ]); if($model == null){ return $this->apiReturnError('充值方案不存在或已经删除'); } $model->is_delete = 1; if(!$model->save()){ return $this->getModelError($model); } } return $this->apiReturnSuccess("删除成功"); } }