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

Method get_project_list

class/projectModel/javaModel.py:3517–3618  ·  view source on GitHub ↗

@name 取项目列表 @author lkq<2021-08-27> @param domain 域名 @return string

(self, get)

Source from the content-addressed store, hash-verified

3515 return ret
3516
3517 def get_project_list(self, get):
3518 ''&#x27;
3519 @name 取项目列表
3520 @author lkq<2021-08-27>
3521 @param domain 域名
3522 @return string
3523 ''&#x27;
3524 if not 'p' in get: get.p = 1
3525 if not 'limit' in get: get.limit = 20
3526 if not 'callback' in get: get.callback = ''
3527 if not 'order' in get: get.order = 'id desc'
3528 type_id = None
3529 if "type_id" in get:
3530 try:
3531 type_id = int(get.type_id)
3532 except:
3533 type_id = None
3534
3535 if 'search' in get:
3536 get.project_name = get.search.strip()
3537 search = "%{}%".format(get.project_name)
3538 if type_id is None:
3539 count = public.M('sites').where(
3540 'project_type=? AND (name LIKE ? OR ps LIKE ?)',
3541 ('Java', search, search)
3542 ).count()
3543 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
3544 data['data'] = public.M('sites').where(
3545 'project_type=? AND (name LIKE ? OR ps LIKE ?)',
3546 ('Java', search, search)
3547 ).limit(
3548 data['shift'] + ',' + data['row']
3549 ).order(get.order).select()
3550 else:
3551 count = public.M('sites').where(
3552 'project_type=? AND (name LIKE ? OR ps LIKE ?) AND type_id = ?',
3553 ('Java', search, search, type_id)
3554 ).count()
3555 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
3556 data['data'] = public.M('sites').where(
3557 'project_type=? AND (name LIKE ? OR ps LIKE ?) AND type_id = ?',
3558 ('Java', search, search, type_id)
3559 ).limit(
3560 data['shift'] + ',' + data['row']
3561 ).order(get.order).select()
3562
3563 else:
3564 if type_id is None:
3565 count = public.M('sites').where('project_type=?', 'Java').count()
3566 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
3567 data['data'] = public.M('sites').where('project_type=?', 'Java').limit(
3568 data['shift'] + ',' + data['row']
3569 ).order(get.order).select()
3570 else:
3571 count = public.M('sites').where('project_type=? AND type_id = ?', ('Java', type_id)).count()
3572 data = public.get_page(count, int(get.p), int(get.limit), get.callback)
3573 data['data'] = public.M('sites').where('project_type=? AND type_id = ?', ('Java', type_id)).limit(
3574 data['shift'] + ',' + data['row']

Callers

nothing calls this directly

Calls 15

InitializationMethod · 0.95
get_vhostMethod · 0.95
Initialization2Method · 0.95
get_project_statMethod · 0.95
use_project_watchFunction · 0.90
formatMethod · 0.45
countMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
get_pageMethod · 0.45
selectMethod · 0.45
orderMethod · 0.45

Tested by

no test coverage detected