Browse Source

增加item的个性域名显示

star7th 9 years ago
parent
commit
1400ce0415

+ 13 - 4
Application/Home/Controller/ItemController.class.php

@@ -42,12 +42,21 @@ class ItemController extends BaseController {
             $item_name = I("item_name");
 			$item_domain = I("item_domain");
 
-            if(!ctype_alnum($item_domain)){
-                //echo '个性域名只能是字母或数字的组合';exit;
-                $this->message(L('item_domain_illegal'));
-                return false;
+            if ($item_domain) {
+                $item = D("Item")->where("item_domain = '$item_domain' ")->find();
+                if ($item) {
+                    //个性域名已经存在
+                    $this->message(L('domain_already_exists'));
+                    return false;
+                }
+                if(!ctype_alnum($item_domain)){
+                    //echo '个性域名只能是字母或数字的组合';exit;
+                    $this->message(L('item_domain_illegal'));
+                    return false;
+                }
             }
 
+
             $password = I("password");
 			$item_description = I("item_description");
             if ($item_id > 0 ) {

+ 2 - 1
Application/Home/Lang/en-us.php

@@ -37,7 +37,8 @@ return array(
     'item_name' => "Item's name",
     'item_description' => "Item's description",
     'item_domain' => '(Optional)domain hack',
-    'item_domain_illegal' => 'domain hack must be a combination of letters and numbers',
+    'item_domain_illegal' => 'Domain hack must be a combination of letters and numbers',
+    'domain_already_exists' => 'Domain already exists',
     'visit_password_placeholder' => 'Access password(Optional: private project required)',
     'submit' => 'Submit',
     'goback' => 'Goback',

+ 1 - 0
Application/Home/Lang/zh-cn.php

@@ -38,6 +38,7 @@ return array(
     'item_description' => '项目描述',
     'item_domain' => '(可选)个性域名',
     'item_domain_illegal' => '个性域名只能是字母或数字的组合',
+    'domain_already_exists' => '个性域名已经存在',
     'visit_password_placeholder' => '访问密码(可选,私密项目请设置密码)',
     'submit' => '提交',
     'goback' => '返回',