|
@@ -81,11 +81,24 @@ def get_channel(arg):
|
|
db = MysqlUtils()
|
|
db = MysqlUtils()
|
|
user_id = arg.get('user_id')
|
|
user_id = arg.get('user_id')
|
|
name = arg.get('name')
|
|
name = arg.get('name')
|
|
|
|
+ pitcher_id = arg.get('pitcher_id')
|
|
|
|
+
|
|
|
|
+ # 获取公众号列表
|
|
|
|
+ rsp = requests.get('http://api.zanxiangnet.com/system/api/mp/mpAccount/search/3')
|
|
|
|
+ channel_list = []
|
|
|
|
+ channel_dict = {}
|
|
|
|
+ for _ in rsp.json()['data']:
|
|
|
|
+ channel_list.append((_['id'], _['nickName']))
|
|
|
|
+ channel_dict[_['id']] = _['nickName']
|
|
if user_id in super_auth():
|
|
if user_id in super_auth():
|
|
- sql = f"select id,nick_name from t_mp_account where nick_name like '%{name}%' and del_flag=0"
|
|
|
|
- return db.zx.getData_json(sql)
|
|
|
|
|
|
+ return channel_list[:100]
|
|
|
|
+ select_id = user_id
|
|
|
|
+ # 通过pitcher_id,来添加
|
|
|
|
+ if pitcher_id:
|
|
|
|
+ select_id = pitcher_id
|
|
|
|
+
|
|
# 普通权限------java,获取本人对应拥有的公众号
|
|
# 普通权限------java,获取本人对应拥有的公众号
|
|
- rsp = requests.get(f'http://api.zanxiangnet.com/system/api/mp/mpAccount/subAccountWithUser/3/{user_id}')
|
|
|
|
|
|
+ rsp = requests.get(f'http://api.zanxiangnet.com/system/api/mp/mpAccount/subAccountWithUser/3/{select_id}')
|
|
channel_list = rsp.json()['data']
|
|
channel_list = rsp.json()['data']
|
|
data1 = []
|
|
data1 = []
|
|
for _ in channel_list:
|
|
for _ in channel_list:
|
|
@@ -94,17 +107,17 @@ def get_channel(arg):
|
|
|
|
|
|
# # 加上配置的号
|
|
# # 加上配置的号
|
|
sql2 = f"""select GROUP_CONCAT(channel_ids) from user_channel_group_auth a
|
|
sql2 = f"""select GROUP_CONCAT(channel_ids) from user_channel_group_auth a
|
|
- left join channel_group b on a.channel_group_id=b.id
|
|
|
|
- where user_id={user_id}"""
|
|
|
|
|
|
+ left join channel_group b on a.channel_group_id=b.id
|
|
|
|
+ where user_id={select_id}"""
|
|
data2 = db.quchen_text.getOne(sql2)
|
|
data2 = db.quchen_text.getOne(sql2)
|
|
-
|
|
|
|
|
|
+ data3 = []
|
|
if data2:
|
|
if data2:
|
|
data2_2 = tuple(data2.split(','))
|
|
data2_2 = tuple(data2.split(','))
|
|
- sql3 = f"""select id,nick_name from t_mp_account where nick_name like '%{name}%' and id in {str(data2_2)}"""
|
|
|
|
- data3 = db.zx.getData_json(sql3)
|
|
|
|
- else:
|
|
|
|
- data3 = []
|
|
|
|
|
|
+ for _ in data2_2:
|
|
|
|
+ data3.append(channel_dict[int(_)])
|
|
data4 = data1 + data3
|
|
data4 = data1 + data3
|
|
|
|
+
|
|
|
|
+
|
|
return data4[:100] # 给100个
|
|
return data4[:100] # 给100个
|
|
|
|
|
|
|
|
|