'SUCCESS'], [['send_mail','send_pwd','send_name','receive_mail'],'trim'], [['send_mail','send_pwd','send_name','receive_mail'],'string'], [['status'],'in','range'=>[0,1]], ]; } public function save() { if (!$this->validate()) { return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0], ]; } if ($this->list->isNewRecord) { $this->list->is_delete = 0; $this->list->store_id = $this->store_id; $this->list->created_at = time(); } $this->list->send_mail = $this->send_mail; $this->list->send_pwd = $this->send_pwd; $this->list->send_name = $this->send_name; $this->receive_mail = str_replace(',', ',', $this->receive_mail); $this->list->receive_mail = $this->receive_mail; $this->list->status = $this->status; if ($this->list->save()) { return [ 'code'=>0, 'msg'=>'成功' ]; } else { foreach ($this->list->errors as $error) { return [ 'code' => 1, 'msg' => $error ]; } } } }