Commits

zuroc committed 7b2fef6

fix

Comments (0)

Files changed (2)

 # -*- coding: utf-8 -*-
 from _handler import Base
 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 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, VpsOne, VpsOneIp
 from zkit.page import page_limit_offset
+from zkit.ip import ip2int
+from model.user_mail import user_id_by_mail
 import re
 
+
 @urlmap('/vps/order/open/(\d+)')
 class OrderOpen(Base):
     def get(self, id):
 
         if q:
             if '@' in q:
-                pass
+                user_id = user_id_by_mail(q)
+                if user_id:
+                    vps_list = VpsOne.where(user_id=user_id)
             elif '.' in q:
-                pass
+                ip = ip2int(q)
+                vps_list = VpsOne.mc_get_list(VpsOneIp.where(ip=ip).col_list(col='vps_one_id'))
+                vps = VpsOne.get(ip_inter=ip)
+                if vps:
+                    vps_list.append(vps)
             else:
                 q = re.search('\d+', q)
                 if q:
                     q = q.group()
                     if q:
-                        pass
+                        vps = VpsOne.mc_get(q)
+                        vps_list = [vps]
+        if vps_list:
+            vps_list = set(vps_list)
 
-        self.render(q=keyword, vps_list=None)
+        self.render(q=keyword, vps_list=vps_list)
 
 
 

htm/god/vps/_base.htm

 <a style="border-top:0" class="cola tc" href="/">返回后台</a>
 
 <form action="/vps/search" class="search">\
-<input type="text" id="search" name="q" placeholder="IP / 编号 / 用户邮箱" value="${q or ''}">\
+<input autocomplete="off" type="text" id="search" name="q" placeholder="IP / 编号 / 用户邮箱" value="${q or ''}">\
 <input type="submit" value="" class="search_btn">\
 </form>