feishu_form.py 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # -*- coding: utf-8 -*-
  2. import json
  3. import os
  4. import sys
  5. sys.path.append(os.getcwd())
  6. from common.feishu_utils import Feishu
  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. video_clipping = row[15] # 剪裁
  36. video_clipping_time = row[16] # 秒数剪裁
  37. title_transform = row[17] # 标题改造
  38. if transform_rule == "否" or transform_rule == "仅改造":
  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": 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. "dt":dt
  59. }
  60. processed_list.append(json.dumps(number_dict, ensure_ascii=False))
  61. else:
  62. transform_rule = ["否","仅改造"]
  63. for t_rule in transform_rule:
  64. number_dict = {
  65. "channel_mark": channel_mark,
  66. "name": NAME,
  67. "pq_ids": pq_ids,
  68. "pq_label": pq_label,
  69. "activate_data": activate_data,
  70. "video_url": video_url,
  71. "title_category": title_category,
  72. "tag_transport_channel": tag_transport_channel,
  73. "tag_transport_scene": tag_transport_scene,
  74. "tag_transport_keyword": tag_transport_keyword,
  75. "tag": tag,
  76. "transform_rule": t_rule,
  77. "video_share": video_share,
  78. "trailer_share": trailer_share,
  79. "trailer_share_audio": trailer_share_audio,
  80. "video_clipping": video_clipping,
  81. "video_clipping_time": video_clipping_time,
  82. "title_transform": title_transform,
  83. "dt":dt
  84. }
  85. processed_list.append(json.dumps(number_dict, ensure_ascii=False))
  86. return processed_list
  87. except:
  88. return processed_list