Sfoglia il codice sorgente

增加手机号的判断

shish 6 anni fa
parent
commit
1ce085f915
1 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 6 3
      app/business/controllers/UserController.php

+ 6 - 3
app/business/controllers/UserController.php

@@ -78,10 +78,13 @@ class UserController extends BaseController
 	public function actionAdd()
 	{
 		$post = Yii::$app->request->post();
+		if (isset($post['mobile']) == false || stringUtil::isMobile($post['mobile'])) {
+			util::fail('请输入手机号');
+		}
 		if ($post['mobile'] != $post['confirmMobile']) {
 			util::fail('二次输入手机号不一样');
 		}
-
+		
 		$confirmPassword = isset($post['confirmPassword']) ? $post['confirmPassword'] : '';
 		AdminService::verifyConfirmPassword($this->adminId, $confirmPassword);
 		
@@ -90,11 +93,11 @@ class UserController extends BaseController
 		if (!empty($user)) {
 			util::fail('手机号已使用,客户已存在');
 		}
-
+		
 		$post['merchantId'] = $this->merchantId;
 		$post['member'] = $post['memberLevel'];
 		UserService::addUser($post);
-
+		
 		util::ok();
 	}