ming 3 yıl önce
ebeveyn
işleme
39793f79d1
1 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  1. 4 3
      api/main.py

+ 4 - 3
api/main.py

@@ -427,8 +427,9 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar,user_id):
             shutil.copy(tmp_video_dir+top1['name_hash']+'.mp4',video_dest+top1['name_hash']+'.mp4')
             os.remove(tmp_video_dir+top1['name_hash']+'.mp4')
             vid_duration = VideoFileClip(video_dest+top1['name_hash']+'.mp4').duration
-            left_time = first(db.query('SELECT * FROM users where id ="'+str(user_id)+'"'))['left_time']
-            email = first(db.query('SELECT * FROM users where id ="'+str(user_id)+'"'))['email']
+            user_obj = first(db.query('SELECT * FROM users where id ="'+str(user_id)+'"'))
+            left_time = user_obj['left_time']
+            email = user_obj['email']
             print('left_time is '+str(left_time))
             if left_time is None:
                 left_time = 5*60
@@ -436,7 +437,7 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar,user_id):
                 msg = '您本月額度剩下'+str(left_time)+'秒,此部影片有'+str(vid_duration)+'秒, 若要繼續產生影片請至 http://192.168.1.106:8007/confirm_add_value?name_hash='+name_hash+' 加值'
                 print(msg)
                 msg =msg.encode(encoding='utf-8')
-                mailer.send(msg, )
+                mailer.send(msg, email)
             else:
                 left_time = left_time - vid_duration
                 db.query('UPDATE users SET left_time ='+str(left_time)+' WHERE id='+str(user_id)+';')