|
@@ -417,12 +417,15 @@ def anchor_video_v2(name_hash,name,text_content, image_urls,avatar):
|
|
|
is_left_time = update_user_left_time(user_id, duration)
|
|
|
|
|
|
# 1.餘額足 2. 餘額不足
|
|
|
+ # 找到user-line群組token
|
|
|
+ email, line_token = get_user_line_token_email(user_id)
|
|
|
+
|
|
|
if is_left_time:
|
|
|
- notify_group(name+"的影片已經產生完成囉! www.choozmo.com:8168/"+video_sub_folder+name_hash+".mp4")
|
|
|
+ notify_group(name+"的影片已經產生完成囉! www.choozmo.com:8168/"+video_sub_folder+name_hash+".mp4", glist=[line_token, 'WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD'])
|
|
|
contents = f""" 影片下載網址: {video_link}"""
|
|
|
mail_to_users(user_id, f'您好,您的影片 "{name}" 已經完成', contents=contents)
|
|
|
else:
|
|
|
- notify_group(msg="您的餘額不足,請去...儲值,才能取得影片唷!")
|
|
|
+ notify_group(msg="您的餘額不足,請去...儲值,才能取得影片唷!", glist=[line_token, 'WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD'])
|
|
|
contents = f""" 餘額不足,請往: ...儲值url儲值 """
|
|
|
mail_to_users(user_id, f'您好,您的餘額不足', contents)
|
|
|
|
|
@@ -572,12 +575,15 @@ def anchor_video_eng(name_hash,name,text_content, image_urls,sub_titles,avatar):
|
|
|
is_left_time = update_user_left_time(user_id, duration)
|
|
|
|
|
|
# 1.餘額足 2. 餘額不足
|
|
|
+ # 找到user-line群組token
|
|
|
+ email, line_token = get_user_line_token_email(user_id)
|
|
|
+
|
|
|
if is_left_time:
|
|
|
- notify_group(name+", Your video is complete! www.choozmo.com:8168/"+video_sub_folder+name_hash+".mp4")
|
|
|
+ notify_group(name+", Your video is complete! www.choozmo.com:8168/"+video_sub_folder+name_hash+".mp4", glist=[line_token, 'WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD'])
|
|
|
contents = f""" The download address: {video_link}"""
|
|
|
mail_to_users(user_id, f'Hi, your video "{name}" is complete', contents=contents)
|
|
|
else:
|
|
|
- notify_group(msg="The left money is not enough, please deposit to get the video!")
|
|
|
+ notify_group(msg="The left money is not enough, please deposit to get the video!", glist=[line_token, 'WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD'])
|
|
|
contents = f""" The left money is not enough, please go to ... to deposit. """
|
|
|
mail_to_users(user_id, f'Hi, your remain deposit is not enough', contents)
|
|
|
|
|
@@ -627,6 +633,26 @@ def update_user_left_time(user_id, duration):
|
|
|
return True
|
|
|
|
|
|
|
|
|
+def get_user_line_token_email(user_id):
|
|
|
+ """ 取得使用者line-token、email用以通知用。 """
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
+ query = f"""
|
|
|
+ select
|
|
|
+ A.user_id, A.link, B.email, B.line_token
|
|
|
+ from
|
|
|
+ ((select link, user_id, duration
|
|
|
+ from AI_anchor.history_input ) as A
|
|
|
+ inner join (select id, email, line_token from AI_anchor.users where id={user_id}) as B
|
|
|
+ on A.user_id=B.id);
|
|
|
+ """
|
|
|
+ rows = db.query(query)
|
|
|
+ for row in rows:
|
|
|
+ line_token = row['line_token']
|
|
|
+ email = row['email']
|
|
|
+ break
|
|
|
+ return line_token, email
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
from rpyc.utils.server import ThreadedServer
|