fix
This commit is contained in:
parent
7249178972
commit
f2e2aefe28
|
@ -10,7 +10,7 @@ logger = Logger(service_name, log_dir=log_dir)
|
||||||
|
|
||||||
access_key_id = "LTAI5tAdu5LRvZwm4LJa21Fo"
|
access_key_id = "LTAI5tAdu5LRvZwm4LJa21Fo"
|
||||||
access_key_secret = "WGvSQsDralTfFAAxhEqLBOgbXqflHo"
|
access_key_secret = "WGvSQsDralTfFAAxhEqLBOgbXqflHo"
|
||||||
endpoint_internal = "https://oss-cn-hangzhou.aliyuncs.com"
|
endpoint_internal = "https://oss-cn-hangzhou-internal.aliyuncs.com"
|
||||||
bucket_name = "wishpal-ironfan-media"
|
bucket_name = "wishpal-ironfan-media"
|
||||||
|
|
||||||
HorizontalView = 1 # 横图
|
HorizontalView = 1 # 横图
|
||||||
|
@ -143,16 +143,6 @@ class S:
|
||||||
oss_src_download_path = cur_dir + src_id_python_type + ".{}".format(fmt)
|
oss_src_download_path = cur_dir + src_id_python_type + ".{}".format(fmt)
|
||||||
try:
|
try:
|
||||||
self.save_img_from_oss(oss_src_id, oss_src_download_path)
|
self.save_img_from_oss(oss_src_id, oss_src_download_path)
|
||||||
src_size = os.path.getsize(oss_src_download_path)
|
|
||||||
q = {
|
|
||||||
"src_id": oss_src_id
|
|
||||||
}
|
|
||||||
up = {
|
|
||||||
"$set": {
|
|
||||||
"size_src": src_size,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bulk_reqs.append(UpdateOne(q, up))
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.Error("save_img_from_oss fail, err: {}, src_id: {}".format(str(e), oss_src_id))
|
logger.Error("save_img_from_oss fail, err: {}, src_id: {}".format(str(e), oss_src_id))
|
||||||
continue
|
continue
|
||||||
|
@ -178,13 +168,18 @@ class S:
|
||||||
else:
|
else:
|
||||||
bulk_reqs.append(uo1440)
|
bulk_reqs.append(uo1440)
|
||||||
|
|
||||||
|
src_size = os.path.getsize(oss_src_download_path)
|
||||||
q1 = {
|
q1 = {
|
||||||
"src_id": oss_src_id,
|
"src_id": oss_src_id,
|
||||||
}
|
}
|
||||||
up1 = {
|
up1 = {
|
||||||
|
"$set": {
|
||||||
|
"size_src": src_size,
|
||||||
"resize_t": int(time.time()),
|
"resize_t": int(time.time()),
|
||||||
"status": 100
|
"status": 100
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
bulk_reqs.append(UpdateOne(q1, up1))
|
||||||
|
|
||||||
os.remove(oss_src_download_path)
|
os.remove(oss_src_download_path)
|
||||||
mongo_ret = self.col_image.bulk_write(bulk_reqs)
|
mongo_ret = self.col_image.bulk_write(bulk_reqs)
|
||||||
|
|
Loading…
Reference in New Issue