MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_project_list

Method get_project_list

class/projectModel/nodejsModel.py:64–112  ·  view source on GitHub ↗

@name 获取项目列表 @author hwliang<2021-08-09> @param get { project_name: string<项目名称> } @return dict

(self, get)

Source from the content-addressed store, hash-verified

62 return public.GetNumLines(self._npm_exec_log, 20)
63
64 def get_project_list(self, get):
65 ''&#x27;
66 @name 获取项目列表
67 @author hwliang<2021-08-09>
68 @param get<dict_obj>{
69 project_name: string<项目名称>
70 }
71 @return dict
72 ''&#x27;
73
74 if not 'p' in get: get.p = 1
75 if not 'limit' in get: get.limit = 20
76 if not 'callback' in get: get.callback = ''
77 if not 'order' in get: get.order = 'id desc'
78 type_id = None
79 if "type_id" in get:
80 try:
81 type_id = int(get.type_id)
82 except:
83 type_id = None
84
85 if 'search' in get:
86 get.project_name = get.search.strip()
87 search = "%{}%".format(get.project_name)
88 if type_id is None:
89 count = public.M('sites').where('project_type=? AND (name LIKE ? OR ps LIKE ?)', ('Node', search, search)).count()
90 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
91 data['data'] = public.M('sites').where('project_type=? AND (name LIKE ? OR ps LIKE ?)', ('Node', search, search)).limit(data['shift'] + ',' + data['row']).order(get.order).select()
92 else:
93 count = public.M('sites').where('project_type=? AND (name LIKE ? OR ps LIKE ?) AND type_id = ?',
94 ('Node', search, search, type_id)).count()
95 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
96 data['data'] = public.M('sites').where('project_type=? AND (name LIKE ? OR ps LIKE ?) AND type_id = ?', ('Node', search, search, type_id)).limit(data['shift'] + ',' + data['row']).order(get.order).select()
97 else:
98 if type_id is None:
99 count = public.M('sites').where('project_type=?', 'Node').count()
100 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
101 data['data'] = public.M('sites').where('project_type=?', 'Node').limit(data['shift'] + ',' + data['row']).order(get.order).select()
102 else:
103 count = public.M('sites').where('project_type=? AND type_id = ?', ('Node', type_id)).count()
104 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
105 data['data'] = public.M('sites').where('project_type=? AND type_id = ?', ('Node', type_id)).limit(data['shift'] + ',' + data['row']).order(get.order).select()
106
107 if isinstance(data["data"], str) and data["data"].startswith("error"):
108 raise public.PanelError("数据库查询错误:" + data["data"])
109
110 for i in range(len(data['data'])):
111 data['data'][i] = self.get_project_stat(data['data'][i])
112 return data
113
114
115 def get_ssl_end_date(self,project_name):

Callers

nothing calls this directly

Calls 9

get_project_statMethod · 0.95
formatMethod · 0.45
countMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
get_pageMethod · 0.45
selectMethod · 0.45
orderMethod · 0.45
limitMethod · 0.45

Tested by

no test coverage detected