def post(self, params): result = UserBlackModel.update_black_status(g.account["user_id"], params["black_user_id"], params["status"]) if not result: return json_fail_response(2110) UserBlackModel.query_black_people(g.account["user_id"], True) return json_success_response(result)
def before_request(): # 当前接口是否需要进行安全检查 from config.setting import REQUEST_SECRET_CHECK, WHITE_LIST if not REQUEST_SECRET_CHECK or request.path in WHITE_LIST: return # 查询salt salt = "" sign = generate_request_sign(request.values.items(), salt) # 参数校验不通过 if request.headers.get("sign", "") != sign: return json_fail_response(502)
def post(self): upload_video = UploadVideo() upload_image = UploadImage() if not upload_video.videos: return json_fail_response(2202) if not upload_image.images: return json_fail_response(2203) upload_video.save_videos() upload_image.save_images() img_model = upload_image.images[0]["image"] video_model = upload_video.videos[0]["video"] video_model.cover_id = img_model.image_id db.session.commit() video_info = VideoModel.format_video_info(video_model) video_info["video_id"] = video_model.video_id video_info["tiny_img"] = ImageModel.generate_image_url(img_model, "e") return json_success_response(video_info)
def post(self, params): if params["user_id"] == g.account["user_id"]: return json_fail_response(2411) result = dict() RedisModel.add_new_message( params["user_id"], RedisModel.private_image_want if params["type"] == 11 else RedisModel.private_video_want) result["data"] = 1 result["message"] = "邀请成功" return json_success_response(result)
def post(self, params): img_uploader = UploadImage() result = [] if params["type"] == 11: if not img_uploader.images: return json_fail_response(2402) img_uploader.save_images() result = UploadPrivateLibraryHandler.upload_private_images( img_uploader.images, g.account["user_id"]) RedisModel.reset_new_message(g.account["user_id"], RedisModel.private_image_want) elif params["type"] == 31: if not img_uploader.images: return json_fail_response(2203) video_uploader = UploadVideo() if not video_uploader.videos: return json_fail_response(2410) img_uploader.save_images() video_uploader.save_videos() result = UploadPrivateLibraryHandler.upload_private_video( video_uploader.videos[0]["video"], img_uploader.images[0]["image"], g.account["user_id"], params["price"]) RedisModel.reset_new_message(g.account["user_id"], RedisModel.private_video_want) PrivateLibraryHandler.random_private_library_offset( params["type"], g.account["user_id"], True) return json_success_response(result)
def post(self, *args): return json_fail_response(501)