diff --git a/b/baiduc/baidu_users_get_post_pay.dspy b/b/baiduc/baidu_users_get_post_pay.dspy
index d66fe76..aaafa24 100644
--- a/b/baiduc/baidu_users_get_post_pay.dspy
+++ b/b/baiduc/baidu_users_get_post_pay.dspy
@@ -645,8 +645,8 @@ async def baidu_users_get_post_pay(ns={}):
userid = baidu_user['user_id']
baidu_id = baidu_user['baidu_id']
- # if baidu_id != 'dcf0fa1519d24de893b186e52d733bd2':
- # continue
+ if baidu_id != 'a6f0dbc20f074ea18b4d3ac3ec77d537':
+ continue
try:
user_orgid = (await sor.R('users', {'id': userid}))[0]['orgid']
user_parentid = (await sor.R('organization', {'id': user_orgid}))[0]['parentid']
diff --git a/b/baiduc/update_user_orders_interval.dspy b/b/baiduc/update_user_orders_interval.dspy
new file mode 100644
index 0000000..8c09478
--- /dev/null
+++ b/b/baiduc/update_user_orders_interval.dspy
@@ -0,0 +1,53 @@
+async def update_user_orders_interval(ns={}):
+ """
+ 更新用户订单列表
+ """
+ domain_name = ns.get('domain_name')
+ db = DBPools()
+ async with db.sqlorContext('kboss') as sor:
+ sql = """select bo.orderid, bs.user_id from baidu_orders as bo inner join baidu_users as bs on bo.accountid = bs.baidu_id inner join users as u on bs.user_id = u.id inner join organization as o on o.id = u.orgid where o.parentid = '%s' and bo.ordertype = 'RENEW' and bo.status = 'NEED_CONFIRM' and bo.del_flg = '0';""" % ns.get('orgid')
+ order_list = await sor.sqlExe(sql, {})
+ try:
+ for order in order_list:
+ orderid = order['orderid']
+ user_id = order['user_id']
+ url = 'https://%s/baiducloud/get_baidu_orderlist.dspy' % domain_name
+ params = {
+ 'order_id': orderid,
+ 'userid': user_id
+ }
+ method = 'POST'
+ async with aiohttp_client.request(
+ method=method,
+ url=url,
+ json=params) as res:
+ order_result = await res.text()
+ with open('update_baidu_renew.log', 'a+') as f:
+ # 行首添加时间
+ f.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + orderid + ':' + order_result + '\n')
+
+ url_update = 'https://%s/baiduc/update_baidu_order_list.dspy' % domain_name
+ params_update = {
+ 'orgid': ns.get('orgid')
+ }
+ method = 'POST'
+ async with aiohttp_client.request(
+ method=method,
+ url=url_update,
+ json=params_update) as res:
+ data_text = await res.text()
+ with open('update_baidu_renew.log', 'a+') as f:
+ # 行首添加时间
+ f.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + data_text + '\n')
+ return {
+ 'status': True,
+ 'msg': '更新成功'
+ }
+ except Exception as e:
+ import traceback
+ with open('update_baidu_renew.log', 'a+') as f:
+ f.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + str(e) + traceback.format_exc() + '\n')
+ traceback.print_exc()
+
+ret = await update_user_orders_interval(params_kw)
+return ret
\ No newline at end of file
diff --git a/b/product/publish_product_search_detail.dspy b/b/product/publish_product_search_detail.dspy
index 6d7a632..00ddc23 100644
--- a/b/product/publish_product_search_detail.dspy
+++ b/b/product/publish_product_search_detail.dspy
@@ -24,44 +24,57 @@ async def get_user_role(ns={}):
return role
async def user_browse_history_add(ns={}):
- # ns = {
- # 'userid': '9KVhsVCJsW_29q3hRhMAr', # 用户ID
- # 'product_id': 'p2s2YPPU7uquza3gGw9k2', # 产品ID
- # 'ip_address': '192.168.1.1', # IP地址
- # 'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/98.0.4758.102' # 用户代理
- # }
# 必要参数校验
- if not ns.get('userid') or not ns.get('product_id'):
+ if not ns.get('userid') or not ns.get('productid'):
return {
'status': False,
- 'msg': 'userid and product_id are required'
+ 'msg': 'userid and productid are required'
}
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
# 根据timestamp时间字段:browse_time去重 查找10个小时内是否存在
- browse_time = datetime.datetime.now() - datetime.timedelta(hours=10)
+ # browse_time = datetime.datetime.now() - datetime.timedelta(hours=10)
+
+ # 检查产品的publish_type
+ product_sql = """
+ SELECT publish_type FROM user_publish_product
+ WHERE id = '%s' AND del_flg = '0';
+ """ % ns.get('productid')
+ product_result = await sor.sqlExe(product_sql, {})
+ if product_result:
+ publish_type = product_result[0]['publish_type']
+ else:
+ publish_type = 99
+
check_sql = """
SELECT * FROM user_browse_history
- WHERE userid = '%s' AND product_id = '%s' AND del_flg = '0' AND browse_time >= '%s';
- """ % (ns.get('userid'), ns.get('product_id'), browse_time)
+ WHERE userid = '%s' AND productid = '%s' AND del_flg = '0';
+ """ % (ns.get('userid'), ns.get('productid'))
check_result = await sor.sqlExe(check_sql, {})
if check_result:
+ # 数据库更新browse_time字段
+ update_sql = """
+ UPDATE user_browse_history
+ SET browse_time = '%s'
+ WHERE id = '%s';
+ """ % (datetime.datetime.now(), check_result[0]['id'])
+ await sor.sqlExe(update_sql, {})
return {
- 'status': False,
- 'msg': 'The user has browsed this product within the last 10 hours'
+ 'status': True,
+ 'msg': 'Browse history recorded successfully',
+ 'data': {'record_id': check_result[0]['id']}
}
# 生成记录ID
record_id = uuid()
- # 插入浏览记录
insert_sql = """
INSERT INTO user_browse_history (
- id, userid, product_id, ip_address, user_agent, del_flg
- ) VALUES ('%s', '%s', '%s', '%s', '%s', '0');
- """ % (record_id, ns.get('userid'), ns.get('product_id'),
- ns.get('ip_address', ''), ns.get('user_agent', ''))
+ id, userid, productid, ip_address, user_agent, del_flg, tag, publish_type
+ ) VALUES ('%s', '%s', '%s', '%s', '%s', '0', '%s', '%s');
+ """ % (record_id, ns.get('userid'), ns.get('productid'),
+ ns.get('ip_address', ''), ns.get('user_agent', ''), ns.get('tag', ''), publish_type)
await sor.sqlExe(insert_sql, {})
return {
'status': True,
@@ -115,7 +128,7 @@ async def publish_product_search_detail(ns={}):
# 保存浏览记录
if userid:
- await user_browse_history_add({'userid': userid, 'product_id': ns.get('id')})
+ res = await user_browse_history_add({'userid': userid, 'productid': ns.get('id'), 'tag': 'upp', 'publish_type': product_list[0]['publish_type']})
return {
'status': True,
diff --git a/b/product/publish_product_search_first_page.dspy b/b/product/publish_product_search_first_page.dspy
index e905e59..74eda95 100644
--- a/b/product/publish_product_search_first_page.dspy
+++ b/b/product/publish_product_search_first_page.dspy
@@ -1,3 +1,43 @@
+async def favorite_check(ns={}):
+ """
+ 检查用户是否已收藏某个商品/需求
+ :param ns: 包含userid, productid, favorite_type参数
+ :return: 检查结果
+ """
+ db = DBPools()
+ async with db.sqlorContext('kboss') as sor:
+ try:
+ if not ns.get('userid') or not ns.get('productid'):
+ return {
+ 'status': False,
+ 'msg': '缺少必要参数'
+ }
+
+ check_sql = """
+ SELECT id FROM user_favorite
+ WHERE userid = '%s' AND productid = '%s' AND del_flg = '0'
+ """ % (ns.get('userid'), ns.get('productid'))
+
+ check_result = await sor.sqlExe(check_sql, {})
+ if check_result:
+ return {
+ 'status': True,
+ 'msg': '查询成功',
+ 'data': {
+ 'is_favorite': True,
+ 'id': check_result[0]['id']
+ }
+ }
+ else:
+ return {
+ 'status': False
+ }
+ except Exception as e:
+ return {
+ 'status': False,
+ 'msg': '查询失败, %s' % str(e)
+ }
+
async def publish_product_search_first_page(ns={}):
"""
普通客户查看
@@ -6,6 +46,13 @@ async def publish_product_search_first_page(ns={}):
:param ns:
:return:
"""
+ # 处理userid
+ if ns.get('userid'):
+ userid = ns.get('userid')
+ else:
+ userid = await get_user()
+
+ ns['userid'] = userid
publish_type = ns.get('publish_type')
page_size = int(ns['page_size']) if ns.get('page_size') else 8
current_page_param = int(ns['current_page']) if ns.get('current_page') else 1
@@ -52,6 +99,13 @@ async def publish_product_search_first_page(ns={}):
res['img'] = 'https://' + domain_name + '/idfile?path=' + res['img']
else:
res['img'] = None
+
+ # 是否收藏关注
+ check_status_li = await favorite_check({'userid': ns.get('userid'), 'productid': res.get('id')})
+ if check_status_li['status']:
+ res['favorite'] = '1'
+ else:
+ res['favorite'] = '0'
# 电话和邮箱模糊化处理
if res.get('phone_number'):
diff --git a/b/reseller/get_ipc_logo.dspy b/b/reseller/get_ipc_logo.dspy
index 512062a..6f3ecb9 100644
--- a/b/reseller/get_ipc_logo.dspy
+++ b/b/reseller/get_ipc_logo.dspy
@@ -46,7 +46,7 @@ async def get_ipc_logo(ns={}):
if '?domain_name=' in url_link:
domain_url = url_link.split('?domain_name=')[1]
# 如果是业主机构
- if ('ncmatch' in domain_url or '9527' in domain_url or '8889' in domain_url or '8891' in domain_url or domain_url in ['xterm.kaiyuancloud.cn','www.kaiyuancloud.cn', 'dev.kaiyuancloud.cn', 'dev.opencomputing.cn', 'test.kaiyuancloud.cn', 'localhost']) and '/domain/' not in url_link:
+ if ('ncmatch' in domain_url or '9527' in domain_url or '8889' in domain_url or '8891' in domain_url or domain_url in ['xterm.kaiyuancloud.cn','www.kaiyuancloud.cn', 'dev.kaiyuancloud.cn', 'dev.opencomputing.cn', 'test.kaiyuancloud.cn', 'localhost', 'www.opencomputing.cn', 'opencomputing.cn']) and '/domain/' not in url_link:
yezhu_info = (await sor.R('organization', {'org_type': '0'}))[0]
domain_res = (await sor.R('params', {'pname': '业主机构域名'}))[0]['pvalue']
# yezhu = {
diff --git a/b/user/favorite_add.dspy b/b/user/favorite_add.dspy
new file mode 100644
index 0000000..1df42f5
--- /dev/null
+++ b/b/user/favorite_add.dspy
@@ -0,0 +1,59 @@
+async def favorite_add(ns={}):
+ """
+ 添加用户收藏
+ :param ns: 包含userid, productid, favorite_type等参数
+ :return: 操作结果
+ """
+ ns_dic = {
+ 'id': uuid(), # 生成32位ID
+ 'userid': ns.get('userid'),
+ 'productid': ns.get('productid'),
+ 'favorite_type': ns.get('favorite_type', '1'), # 默认为商品收藏
+ 'tag': ns.get('tag') # 标签
+ }
+
+ # 处理userid
+ if ns.get('userid'):
+ ns_dic['userid'] = ns.get('userid')
+ else:
+ ns_dic['userid'] = await get_user()
+
+ if not ns_dic.get('userid'):
+ server_error(401)
+
+ db = DBPools()
+ async with db.sqlorContext('kboss') as sor:
+ try:
+ # 检查是否已收藏 处理tag是NULL的情况
+ conditions = [
+ "userid = '%s'" % ns_dic['userid'],
+ "productid = '%s'" % ns_dic['productid'],
+ "favorite_type = '%s'" % ns_dic['favorite_type'] if ns_dic['favorite_type'] is not None else "favorite_type IS NULL",
+ "del_flg = '0'",
+ "tag = '%s'" % ns_dic['tag'] if ns_dic['tag'] is not None else "tag IS NULL"
+ ]
+ check_sql = "SELECT id FROM user_favorite WHERE " + " AND ".join(conditions)
+
+ check_result = await sor.sqlExe(check_sql, {})
+
+ if check_result:
+ return {
+ 'status': False,
+ 'msg': '已收藏关注'
+ }
+
+ # 执行收藏操作
+ await sor.C('user_favorite', ns_dic)
+ return {
+ 'status': True,
+ 'msg': '关注收藏成功'
+ }
+ except Exception as e:
+ await sor.rollback()
+ return {
+ 'status': False,
+ 'msg': '关注收藏失败, %s' % str(e)
+ }
+
+ret = await favorite_add(params_kw)
+return ret
\ No newline at end of file
diff --git a/b/user/favorite_delete.dspy b/b/user/favorite_delete.dspy
new file mode 100644
index 0000000..b4a78b2
--- /dev/null
+++ b/b/user/favorite_delete.dspy
@@ -0,0 +1,43 @@
+async def favorite_delete(ns={}):
+ """
+ 删除用户收藏(软删除)
+ :param ns: 包含id或userid+productid+favorite_type参数
+ :return: 操作结果
+ """
+ # 处理userid
+ if ns.get('userid'):
+ ns['userid'] = ns.get('userid')
+ else:
+ ns['userid'] = await get_user()
+ if not ns.get('userid'):
+ server_error(401)
+ db = DBPools()
+ async with db.sqlorContext('kboss') as sor:
+ try:
+ if ns.get('id'):
+ # 根据收藏ID删除
+ update_sql = """
+ UPDATE user_favorite
+ SET del_flg = '1'
+ WHERE userid = '%s' AND productid = '%s'
+ """ % (ns.get('userid'), ns.get('id'))
+ await sor.sqlExe(update_sql, {})
+ else:
+ return {
+ 'status': False,
+ 'msg': '缺少必要参数'
+ }
+
+ return {
+ 'status': True,
+ 'msg': '取消关注收藏成功'
+ }
+ except Exception as e:
+ await sor.rollback()
+ return {
+ 'status': False,
+ 'msg': '取消关注收藏失败, %s' % str(e)
+ }
+
+ret = await favorite_delete(params_kw)
+return ret
\ No newline at end of file
diff --git a/b/user/favorite_search.dspy b/b/user/favorite_search.dspy
new file mode 100644
index 0000000..c85253a
--- /dev/null
+++ b/b/user/favorite_search.dspy
@@ -0,0 +1,108 @@
+async def favorite_search(ns={}):
+ """
+ 查询用户收藏列表
+ :param ns: 包含userid, favorite_type等查询参数
+ :return: 查询结果
+ """
+ # 处理userid
+ if ns.get('userid'):
+ ns['userid'] = ns.get('userid')
+ else:
+ ns['userid'] = await get_user()
+ if not ns.get('userid'):
+ server_error(401)
+
+ db = DBPools()
+ async with db.sqlorContext('kboss') as sor:
+ try:
+ # 分页参数
+ current_page = int(ns.get('current_page', 1))
+ page_size = int(ns.get('page_size', 1000))
+ offset = (current_page - 1) * page_size
+
+ # 构建查询条件
+ where_conditions = ["f.del_flg = '0'"]
+ if ns.get('userid'):
+ where_conditions.append("f.userid = '%s'" % ns.get('userid'))
+ if ns.get('publish_type'):
+ where_conditions.append("f.favorite_type = '%s'" % ns.get('publish_type'))
+
+ where_clause = " AND ".join(where_conditions)
+
+ # 查询总数
+ count_sql = """
+ SELECT COUNT(*) AS total_count
+ FROM user_favorite f
+ WHERE %s
+ """ % where_clause
+
+ count_result = await sor.sqlExe(count_sql, {})
+ total_count = count_result[0]['total_count'] if count_result else 0
+
+ # 查询数据
+ query_sql = """
+ SELECT *
+ FROM user_favorite f
+ WHERE %s
+ ORDER BY f.create_at DESC
+ LIMIT %s OFFSET %s
+ """ % (where_clause, page_size, offset)
+ result = await sor.sqlExe(query_sql, {})
+
+ # 通过查询数据中的productid, 查询product表, 增加product_info
+ for product in result:
+ product_sql = f"""
+ SELECT * FROM user_publish_product
+ WHERE id = '{product['productid']}' AND del_flg = '0' AND listing_status = 'listing';
+ """
+ product_info_li = await sor.sqlExe(product_sql, {})
+ if product_info_li:
+ product['product_info'] = product_info_li[0]
+ # 增加收藏状态
+ product['product_info']['favorite'] = '1'
+ # 手机号加*
+ if product['product_info'].get('phone_number'):
+ product['product_info']['phone_number'] = '**************'
+ if product['product_info'].get('img'):
+ product['product_info']['img'] = 'https://' + product['product_info']['domain_name'] + '/idfile?path=' + product['product_info']['img']
+
+ else:
+ product['product_info'] = None
+
+ date_groups = {}
+ for item in result:
+ # 提取日期部分(如"2025-08-22 15:58:52" → "2025-08-22")
+ browse_date = datetime.datetime.strptime(item["create_at"], "%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%d")
+ if browse_date not in date_groups:
+ date_groups[browse_date] = []
+
+ date_groups[browse_date].append(item)
+
+ # 按日期升序排序并添加序号
+ sorted_dates = sorted(date_groups.keys(), reverse=True) # 按日期升序排列
+ result = []
+ for idx, date in enumerate(sorted_dates, start=1):
+ result.append({
+ "id": str(idx), # 序号从1开始
+ "browse_date": date,
+ "products": date_groups[date] # 该日期下的所有浏览记录
+ })
+
+ return {
+ 'status': True,
+ 'msg': '查询成功',
+ 'data': {
+ 'total_count': total_count,
+ 'current_page': current_page,
+ 'page_size': page_size,
+ 'favorites': result
+ }
+ }
+ except Exception as e:
+ return {
+ 'status': False,
+ 'msg': '查询失败, %s' % str(e)
+ }
+
+ret = await favorite_search(params_kw)
+return ret
\ No newline at end of file
diff --git a/b/user/user_browse_history_add.dspy b/b/user/user_browse_history_add.dspy
index bbdd7b0..921a51f 100644
--- a/b/user/user_browse_history_add.dspy
+++ b/b/user/user_browse_history_add.dspy
@@ -1,42 +1,43 @@
async def user_browse_history_add(ns={}):
- # ns = {
- # 'userid': '9KVhsVCJsW_29q3hRhMAr', # 用户ID
- # 'product_id': 'p2s2YPPU7uquza3gGw9k2', # 产品ID
- # 'ip_address': '192.168.1.1', # IP地址
- # 'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/98.0.4758.102' # 用户代理
- # }
# 必要参数校验
- if not ns.get('userid') or not ns.get('product_id'):
+ if not ns.get('userid') or not ns.get('productid'):
return {
'status': False,
- 'msg': 'userid and product_id are required'
+ 'msg': 'userid and productid are required'
}
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
# 根据timestamp时间字段:browse_time去重 查找10个小时内是否存在
- browse_time = datetime.datetime.now() - datetime.timedelta(hours=10)
+ # browse_time = datetime.datetime.now() - datetime.timedelta(hours=10)
check_sql = """
SELECT * FROM user_browse_history
- WHERE userid = '%s' AND product_id = '%s' AND del_flg = '0' AND browse_time >= '%s';
- """ % (ns.get('userid'), ns.get('product_id'), browse_time)
+ WHERE userid = '%s' AND productid = '%s' AND del_flg = '0';
+ """ % (ns.get('userid'), ns.get('productid'))
check_result = await sor.sqlExe(check_sql, {})
if check_result:
+ # 数据库更新browse_time字段
+ update_sql = """
+ UPDATE user_browse_history
+ SET browse_time = '%s'
+ WHERE id = '%s';
+ """ % (datetime.datetime.now(), check_result[0]['id'])
+ await sor.sqlExe(update_sql, {})
return {
- 'status': False,
- 'msg': 'The user has browsed this product within the last 10 hours'
+ 'status': True,
+ 'msg': 'Browse history recorded successfully',
+ 'data': {'record_id': check_result[0]['id']}
}
# 生成记录ID
record_id = uuid()
- # 插入浏览记录
insert_sql = """
INSERT INTO user_browse_history (
- id, userid, product_id, ip_address, user_agent, del_flg
- ) VALUES ('%s', '%s', '%s', '%s', '%s', '0');
- """ % (record_id, ns.get('userid'), ns.get('product_id'),
- ns.get('ip_address', ''), ns.get('user_agent', ''))
+ id, userid, productid, ip_address, user_agent, del_flg, tag
+ ) VALUES ('%s', '%s', '%s', '%s', '%s', '0', '%s');
+ """ % (record_id, ns.get('userid'), ns.get('productid'),
+ ns.get('ip_address', ''), ns.get('user_agent', ''), ns.get('tag', ''))
await sor.sqlExe(insert_sql, {})
return {
'status': True,
diff --git a/b/user/user_browse_history_search.dspy b/b/user/user_browse_history_search.dspy
index 9df8083..46a4dc5 100644
--- a/b/user/user_browse_history_search.dspy
+++ b/b/user/user_browse_history_search.dspy
@@ -1,20 +1,24 @@
-async def user_browse_history_search(ns={}):
+async def user_browse_history_search(ns={}):
+ # 处理url_link转换成domain_name
+ if ns.get('url_link'):
+ domain_name = ns.get('url_link').split("//")[1].split("/")[0]
+ else:
+ domain_name = None
+
# 处理userid
if ns.get('userid'):
userid = ns.get('userid')
else:
userid = await get_user()
if not userid:
- return {
- 'status': False,
- 'msg': 'no match user'
- }
+ server_error(401)
# 参数处理
- product_id = ns.get('product_id')
+ productid = ns.get('productid')
+ publish_type = ns.get('publish_type')
start_time = ns.get('start_time')
end_time = ns.get('end_time')
- page_size = int(ns.get('page_size', 10))
+ page_size = int(ns.get('page_size', 10000))
current_page = int(ns.get('current_page', 1))
offset = (current_page - 1) * page_size
@@ -25,8 +29,10 @@ async def user_browse_history_search(ns={}):
base_conditions = ["del_flg = '0'"]
if userid:
base_conditions.append(f"userid = '{userid}'")
- if product_id:
- base_conditions.append(f"product_id = '{product_id}'")
+ if productid:
+ base_conditions.append(f"productid = '{productid}'")
+ if publish_type:
+ base_conditions.append(f"publish_type = '{publish_type}'")
if start_time and end_time:
end_time += ' 23:59:59'
base_conditions.append(f"browse_time BETWEEN '{start_time}' AND '{end_time}'")
@@ -34,8 +40,6 @@ async def user_browse_history_search(ns={}):
# 构建查询SQL
where_clause = " AND ".join(base_conditions)
- # 根据product_id查询product_info
-
find_sql = f"""
SELECT * FROM user_browse_history
WHERE {where_clause}
@@ -51,6 +55,54 @@ async def user_browse_history_search(ns={}):
# 执行查询
result = await sor.sqlExe(find_sql, {})
total_count = (await sor.sqlExe(count_sql, {}))[0]['total_count']
+
+ # 根据result中productid查询product_info
+ for product in result:
+ # 查询product_info
+ product_sql = f"""
+ SELECT * FROM user_publish_product
+ WHERE id = '{product['productid']}' AND del_flg = '0' AND listing_status = 'listing';
+ """
+ favorite_sql = f"""
+ SELECT * FROM user_favorite
+ WHERE productid = '{product['productid']}' AND userid = '{userid}' AND del_flg = '0';
+ """
+ favorite_status = await sor.sqlExe(favorite_sql, {})
+ product_info_li = await sor.sqlExe(product_sql, {})
+ if product_info_li:
+ product['product_info'] = product_info_li[0]
+
+ if favorite_status:
+ product['product_info']['favorite'] = '1'
+ else:
+ product['product_info']['favorite'] = '0'
+
+ if product['product_info'].get('phone_number'):
+ product['product_info']['phone_number'] = '***************'
+ if product['product_info'].get('img'):
+ product['product_info']['img'] = 'https://' + product['product_info']['domain_name'] + '/idfile?path=' + product['product_info']['img']
+ else:
+ product['product_info'] = None
+
+ date_groups = {}
+ for item in result:
+ # 提取日期部分(如"2025-08-22 15:58:52" → "2025-08-22")
+ browse_date = datetime.datetime.strptime(item["browse_time"], "%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%d")
+ if browse_date not in date_groups:
+ date_groups[browse_date] = []
+
+ date_groups[browse_date].append(item)
+
+ # 按日期升序排序并添加序号
+ sorted_dates = sorted(date_groups.keys(), reverse=True) # 按日期升序排列
+ result = []
+ for idx, date in enumerate(sorted_dates, start=1):
+ result.append({
+ "id": str(idx), # 序号从1开始
+ "browse_date": date,
+ "products": date_groups[date] # 该日期下的所有浏览记录
+ })
+
return {
'status': True,
diff --git a/f/web-kboss/src/api/ncmatch/index.js b/f/web-kboss/src/api/ncmatch/index.js
index 86a39d5..587f4d7 100644
--- a/f/web-kboss/src/api/ncmatch/index.js
+++ b/f/web-kboss/src/api/ncmatch/index.js
@@ -219,4 +219,60 @@ export function reqSupplyAndDemandSecondCategory(data){
headers: { 'Content-Type': 'application/json' },
data
})
+}
+
+//收藏 /product/publish_product_collect.dspy
+export function reqPublishProductCollect(data){
+ return request({
+ url: '/user/favorite_add.dspy',
+ method: 'post',
+ headers: { 'Content-Type': 'application/json' },
+ data
+ })
+}
+//取消收藏 /user/favorite_delete.dspy
+export function reqFavoriteDelete(data){
+ return request({
+ url: '/user/favorite_delete.dspy',
+ method: 'post',
+ headers: { 'Content-Type': 'application/json' },
+ data
+ })
+}
+//浏览记录 /user/user_browse_history_search.dspy
+export function reqUserBrowseHistorySearch(data){
+ return request({
+ url: '/user/user_browse_history_search.dspy',
+ method: 'post',
+ headers: { 'Content-Type': 'application/json' },
+ data
+ })
+}
+//删除浏览记录 /user/user_browse_history_delete.dspy
+export function reqUserBrowseHistoryDeleteById(data){
+ return request({
+ url: '/user/user_browse_history_delete.dspy',
+ method: 'post',
+ headers: { 'Content-Type': 'application/json' },
+ data
+ })
+}
+
+//删除关注记录 /user/favorite_delete.dspy
+export function reqFavoriteDeleteById(data){
+ return request({
+ url: '/user/favorite_delete.dspy',
+ method: 'post',
+ headers: { 'Content-Type': 'application/json' },
+ data
+ })
+}
+//全部收藏列表 /user/favorite_search.dspy
+export function reqFavoriteSearch(data){
+ return request({
+ url: '/user/favorite_search.dspy',
+ method: 'post',
+ headers: { 'Content-Type': 'application/json' },
+ data
+ })
}
\ No newline at end of file
diff --git a/f/web-kboss/src/permission.js b/f/web-kboss/src/permission.js
index fe87c84..2531e77 100644
--- a/f/web-kboss/src/permission.js
+++ b/f/web-kboss/src/permission.js
@@ -106,7 +106,7 @@ router.beforeEach(async (to, from, next) => {
// NProgress.done();
// return
// }
- if (to.path.includes("/ncmatchHome")||to.path.includes("/kyyForm") || to.path.includes("/screen") || to.path.includes("/beforeLogin") || to.path.includes("/wxDetailPage") || to.path.includes("/wxPage") || to.path.includes("/login") || to.path.includes("/homePage") || to.path.includes("/registrationPage") || to.path.includes("/payPage") || to.path.includes("/paySuccess") || to.path.includes("/homePageImage")) {
+ if (to.path.includes("/demoDify")||to.path.includes("/ncmatchHome")||to.path.includes("/kyyForm") || to.path.includes("/screen") || to.path.includes("/beforeLogin") || to.path.includes("/wxDetailPage") || to.path.includes("/wxPage") || to.path.includes("/login") || to.path.includes("/homePage") || to.path.includes("/registrationPage") || to.path.includes("/payPage") || to.path.includes("/paySuccess") || to.path.includes("/homePageImage")) {
console.log("to", to)
try {
if (to.path.includes("/beforeLogin") || to.path.includes("/registrationPage")) {
diff --git a/f/web-kboss/src/router/index.js b/f/web-kboss/src/router/index.js
index a470274..e8199b2 100644
--- a/f/web-kboss/src/router/index.js
+++ b/f/web-kboss/src/router/index.js
@@ -65,6 +65,12 @@ export const constantRoutes = [
component: () => import('@/views/beforeLogin/index.vue'),
hidden: true
},
+ {
+ path: '/demoDify',
+ name: 'DemoDify',
+ title: 'DemoDify',
+ component: () => import('@/views/demoDify/index.vue'),
+ },
{
path: '/wxPage',
@@ -192,6 +198,20 @@ export const constantRoutes = [
hidden: true,
meta: { title: "产品查询", fullPath: "/ncmatch/searchBox" },
},
+ {
+ path: "historyBox",
+ component: () => import("@/views/homePage/ncmatch/historyBox/index.vue"),
+ name: "historyBox",
+ hidden: true,
+ meta: { title: "浏览记录", fullPath: "/ncmatch/historyBox" },
+ },
+ {
+ path: "favoriteBox",
+ component: () => import("@/views/homePage/ncmatch/favoriteBox/index.vue"),
+ name: "favoriteBox",
+ hidden: true,
+ meta: { title: "我的关注", fullPath: "/ncmatch/favoriteBox" },
+ },
]
},
{
diff --git a/f/web-kboss/src/views/demoDify/index.vue b/f/web-kboss/src/views/demoDify/index.vue
new file mode 100644
index 0000000..8d14328
--- /dev/null
+++ b/f/web-kboss/src/views/demoDify/index.vue
@@ -0,0 +1,17 @@
+
+
浏览记录
我的收藏