'保洁姓名', 'mobile' => '保洁联系方式', ]; } public function edit() { if (!$this->validate()) { return $this->getModelError(); } if (!$this->verifyMobile($this->mobile)) { return $this->apiReturnError('请输入正确的手机号'); } if ($this->model->isNewRecord) { $this->model->is_delete = 0; $this->model->deleted_at = 0; $this->model->created_at = time(); } $this->model->updated_at = time(); $this->model->name = $this->name; $this->model->mobile = $this->mobile; $this->model->store_id = $this->store_id; $this->model->status = $this->status; if (!$this->model->save()) { return $this->getModelError($this->model); } return $this->apiReturnSuccess('保存成功'); } private function verifyMobile($mobile) { if (preg_match("/^1[34578]\d{9}$/", $mobile)) { return true; } else { return false; } } }