diff --git a/b/product/product_category_search.dspy b/b/product/product_category_search.dspy index 3f37b8a..aefc157 100644 --- a/b/product/product_category_search.dspy +++ b/b/product/product_category_search.dspy @@ -40,7 +40,10 @@ async def product_category_search(ns={}): async with db.sqlorContext('kboss') as sor: # 首页不登录 通过域名筛选 if to_page == 'show': - find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' ORDER BY priority;""" % domain_name + if ns.get('first_level_id'): + find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' AND parentid = '%s' ORDER BY priority;""" % (domain_name, ns.get('first_level_id')) + else: + find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' AND parentid is NULL ORDER BY priority;""" % domain_name result = await sor.sqlExe(find_sql, {}) return { 'status': True, @@ -64,7 +67,7 @@ async def product_category_search(ns={}): orgid = user_list[0]['orgid'] user_role = await get_user_role({'userid': userid, 'sor': sor}) try: - if user_role == '客户' or user_role == '管理员': + if user_role == '客户' or user_role == '管理员': find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND permission = '1' AND del_flg = '0' ORDER BY priority;""" % domain_name else: find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' ORDER BY priority;""" % domain_name