@name 取项目列表 @author lkq<2021-08-27> @param domain 域名 @return string
(self, get)
| 3515 | return ret |
| 3516 | |
| 3517 | def get_project_list(self, get): |
| 3518 | ''' |
| 3519 | @name 取项目列表 |
| 3520 | @author lkq<2021-08-27> |
| 3521 | @param domain 域名 |
| 3522 | @return string |
| 3523 | ''' |
| 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'] |
nothing calls this directly
no test coverage detected