feishu_form.py 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # -*- coding: utf-8 -*-
  2. import json
  3. import os
  4. import sys
  5. from utils.feishu_utils import Feishu
  6. sys.path.append(os.getcwd())
  7. class Material():
  8. """
  9. 获取品类对应负责人任务明细
  10. """
  11. @classmethod
  12. def get_carry_data(cls, dt, FS_SHEET,NAME):
  13. data = Feishu.get_values_batch( "Wj0TsRKc0hZrHQtmtg4cZZIwn0c", FS_SHEET )
  14. processed_list = []
  15. try:
  16. for row in data[2:]:
  17. activate_data = row[4] # 启动日期
  18. if not activate_data:
  19. continue
  20. if int(activate_data) != int(dt):
  21. continue
  22. channel_mark = row[0]
  23. pq_ids = row[2]
  24. pq_label = row[3] # 站内标签
  25. video_url = row[5]
  26. title_category = row[6] #标题类别
  27. tag_transport_channel = row[7] # 搬运平台
  28. tag_transport_scene = row[8] # 搬运场景
  29. tag_transport_keyword = row[9] # 关键词
  30. tag = row[10] # 标签
  31. transform_rule = row[11] # 改造规则
  32. video_share = row[12] # 片中分享
  33. trailer_share = row[13] # 片尾分享
  34. trailer_share_audio = row[14] # 片尾分享声音
  35. trailer_share_bgm = row[15] # 片尾分享bgm
  36. video_clipping = row[16] # 剪裁
  37. video_clipping_time = row[17] # 秒数剪裁
  38. title_transform = row[18] # 标题改造
  39. number_dict = {
  40. "channel_mark": channel_mark,
  41. "name":NAME,
  42. "pq_ids": pq_ids,
  43. "pq_label": pq_label,
  44. "activate_data": activate_data,
  45. "video_url": video_url,
  46. "title_category": title_category,
  47. "tag_transport_channel": tag_transport_channel,
  48. "tag_transport_scene": tag_transport_scene,
  49. "tag_transport_keyword": tag_transport_keyword,
  50. "tag": tag,
  51. "transform_rule": transform_rule,
  52. "video_share": video_share,
  53. "trailer_share": str(trailer_share),
  54. "trailer_share_audio": trailer_share_audio,
  55. "video_clipping": video_clipping,
  56. "video_clipping_time": video_clipping_time,
  57. "title_transform": title_transform,
  58. "trailer_share_bgm": str(trailer_share_bgm),
  59. "dt":dt
  60. }
  61. processed_list.append(json.dumps(number_dict, ensure_ascii=False))
  62. return processed_list
  63. except:
  64. return processed_list
  65. @classmethod
  66. def get_propmt_data(cls, trailer_share):
  67. try:
  68. if "AI片尾引导" not in trailer_share:
  69. trailer_share = "AI片尾引导"
  70. data = Feishu.get_values_batch( "Wj0TsRKc0hZrHQtmtg4cZZIwn0c", "Yxg7EK" )
  71. for row in data[1:]:
  72. name = row[0]
  73. if trailer_share == name:
  74. return row[1]
  75. return
  76. except:
  77. return None