Commits

zuroc committed 6d7acd0

fix

Comments (0)

Files changed (1)

 from _urlmap import urlmap
 from model.vps_sell import VpsOrder , vps_order_count, vps_order_by_state, vps_one_list_by_vps_order, vps_one_open, vps_order_open, VPS_ORDER_STATE_PAY, vps_one_by_state, vps_order_cancel
 from zkit.page import page_limit_offset
+import re
 
 @urlmap('/vps/order/open/(\d+)')
 class OrderOpen(Base):
     def get(self, id):
         vps_order = self._vps_order(id)
-        if vps_order: 
+        if vps_order:
             self.render(vps_order=vps_order)
- 
+
     def _vps_order(self, id):
         vps_order = VpsOrder.get(id)
         if vps_order.state != VPS_ORDER_STATE_PAY:
-            self.redirect("/vps/order/%s"%id)
-            return 
+            self.redirect('/vps/order/%s'%id)
+            return
         return vps_order
 
 
     def post(self, id):
         vps_order = self._vps_order(id)
-        if vps_order: 
-            id_list = self.get_arguments("vps",())
+        if vps_order:
+            id_list = self.get_arguments('vps', ())
 
             for vps_id in id_list:
-                ip = self.get_argument("ip%s"%vps_id, "")
-                ip_inter = self.get_argument("ip_inter%s"%vps_id, "")
-                txt = self.get_argument("txt%s"%vps_id, None)
+                ip = self.get_argument('ip%s'%vps_id, '')
+                ip_inter = self.get_argument('ip_inter%s'%vps_id, '')
+                txt = self.get_argument('txt%s'%vps_id, None)
                 vps_one_open(vps_id, ip_inter, ip, txt)
 
 
             mail = self.get_argument('mail', False)
             vps_order_open(vps_order, mail)
 
-            return self.redirect("/vps/order/%s"%id)
+            return self.redirect('/vps/order/%s'%id)
 
 @urlmap('/vps/order/(\d+)')
 class Order(Base):
 class OrderCancel(Base):
     def get(self, id):
         vps_order_cancel(id)
-        self.redirect("/vps")
+        self.redirect('/vps')
 
 @urlmap('/vps')
 class Index(Base):
             20
         )
         self.render(
-            page = page,
-            ol = vps_order_by_state(
+            page=page,
+            ol=vps_order_by_state(
                 state,
                 limit,
                 offset
-            ) 
+            )
         )
 
 
             20
         )
         self.render(
-            page = page,
-            ol = vps_one_by_state(
+            page=page,
+            ol=vps_one_by_state(
                 state,
                 limit,
                 offset
-            ) 
+            )
         )
 
 
 
+@urlmap('/vps/search')
+class Vps(Base):
+    def get(self):
+        q = self.get_argument('q', '')
+        if q:
+            if '@' in q:
+                pass
+            elif '.' in q:
+                pass
+            else:
+                q = re.search('\d+', q).group()
+                if q:
+                    pass
+        self.render()
+        #<form method="POST" action="/zsite/user_search" class="search"><input type="text" id="search" name="q" placeholder="IP / 编号 / 用户邮箱" value=""><input type="submit" value="" class="search_btn"></form>
 
 
 
 
 
 
+
+
+
+