瀏覽代碼

numpy.int64强制转化为int,解决写入数据库报错

mrstotoro 4 年之前
父節點
當前提交
a9b756f593
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      ai_strategy_request_func.py

+ 2 - 2
ai_strategy_request_func.py

@@ -374,7 +374,7 @@ class ParseAddCampaignOrAddGroupRequest(object):
                 single_creative_params_to_db = creative_params_to_db.copy()
                 single_creative_params_to_db['creative_uuid'] = creative_uuid
                 single_creative_params_to_db['creative_name'] = creative_name
-                single_creative_params_to_db['photo_id'] = video['photo_id']
+                single_creative_params_to_db['photo_id'] = int(video['photo_id'])
                 single_creative_params_to_db['image_md5'] = image_md5
                 single_creative_params_to_db['create_time'] = datetime.datetime.now()
                 df = pd.DataFrame.from_dict(single_creative_params_to_db, orient='index').T
@@ -386,7 +386,7 @@ class ParseAddCampaignOrAddGroupRequest(object):
                 single_creative_params_to_request = creative_params_to_request.copy()
                 single_creative_params_to_request['creative_uuid'] = creative_uuid
                 single_creative_params_to_request['creative_name'] = creative_name
-                single_creative_params_to_request['photo_id'] = video['photo_id']
+                single_creative_params_to_request['photo_id'] = int(video['photo_id'])
                 single_creative_params_to_request['image_md5'] = image_md5
 
                 # 单个创意信息加入到组里面的 creative_list 中