mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 10:16:50 +00:00
ENH: [STUDIO-3151] Optimize scoring entry
Jira: STUDIO-3151 Change-Id: I6ffd236faea7de9f1e35b77f818f926f2477939a
This commit is contained in:
@@ -106,6 +106,9 @@ func_track_event NetworkAgent::track_event_ptr = nullptr;
|
||||
func_track_header NetworkAgent::track_header_ptr = nullptr;
|
||||
func_track_update_property NetworkAgent::track_update_property_ptr = nullptr;
|
||||
func_track_get_property NetworkAgent::track_get_property_ptr = nullptr;
|
||||
func_put_model_mall_rating_url NetworkAgent::put_model_mall_rating_url_ptr = nullptr;
|
||||
func_get_oss_config NetworkAgent::get_oss_config_ptr = nullptr;
|
||||
func_put_rating_picture_oss NetworkAgent::put_rating_picture_oss_ptr = nullptr;
|
||||
|
||||
|
||||
NetworkAgent::NetworkAgent()
|
||||
@@ -258,6 +261,9 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||
track_header_ptr = reinterpret_cast<func_track_header>(get_network_function("bambu_network_track_header"));
|
||||
track_update_property_ptr = reinterpret_cast<func_track_update_property>(get_network_function("bambu_network_track_update_property"));
|
||||
track_get_property_ptr = reinterpret_cast<func_track_get_property>(get_network_function("bambu_network_track_get_property"));
|
||||
put_model_mall_rating_url_ptr = reinterpret_cast<func_put_model_mall_rating_url>(get_network_function("bambu_network_put_model_mall_rating"));
|
||||
get_oss_config_ptr = reinterpret_cast<func_get_oss_config>(get_network_function("bambu_network_get_oss_config"));
|
||||
put_rating_picture_oss_ptr = reinterpret_cast<func_put_rating_picture_oss>(get_network_function("bambu_network_put_rating_picture_oss"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -363,6 +369,9 @@ int NetworkAgent::unload_network_module()
|
||||
track_header_ptr = nullptr;
|
||||
track_update_property_ptr = nullptr;
|
||||
track_get_property_ptr = nullptr;
|
||||
get_oss_config_ptr = nullptr;
|
||||
put_rating_picture_oss_ptr = nullptr;
|
||||
put_model_mall_rating_url_ptr = nullptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1269,4 +1278,35 @@ int NetworkAgent::track_get_property(std::string name, std::string& value, std::
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetworkAgent::put_model_mall_rating(
|
||||
int design_id, int score, std::string content, std::vector<std::string> images, unsigned int &http_code, std::string &http_error)
|
||||
{
|
||||
int ret = 0;
|
||||
if (network_agent && get_model_publish_url_ptr) {
|
||||
ret = put_model_mall_rating_url_ptr(network_agent, design_id, score, content, images, http_code, http_error);
|
||||
if (ret) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetworkAgent::get_oss_config(std::string &config, std::string country_code, unsigned int &http_code, std::string &http_error)
|
||||
{
|
||||
int ret = 0;
|
||||
if (network_agent && get_oss_config_ptr) {
|
||||
ret = get_oss_config_ptr(network_agent, config, country_code, http_code, http_error);
|
||||
if (ret) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetworkAgent::put_rating_picture_oss(std::string &config, std::string &pic_oss_path, std::string model_id, int profile_id, unsigned int &http_code, std::string &http_error)
|
||||
{
|
||||
int ret = 0;
|
||||
if (network_agent && put_rating_picture_oss_ptr) {
|
||||
ret = put_rating_picture_oss_ptr(network_agent, config, pic_oss_path, model_id, profile_id, http_code, http_error);
|
||||
if (ret) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} //namespace
|
||||
|
||||
@@ -86,6 +86,11 @@ typedef int (*func_track_event)(void *agent, std::string evt_key, std::string co
|
||||
typedef int (*func_track_header)(void *agent, std::string header);
|
||||
typedef int (*func_track_update_property)(void *agent, std::string name, std::string value, std::string type);
|
||||
typedef int (*func_track_get_property)(void *agent, std::string name, std::string& value, std::string type);
|
||||
typedef int (*func_put_model_mall_rating_url)(
|
||||
void *agent, int design_id, int score, std::string content, std::vector<std::string> images, unsigned int &http_code, std::string &http_error);
|
||||
typedef int (*func_get_oss_config)(void *agent, std::string &config, std::string country_code, unsigned int &http_code, std::string &http_error);
|
||||
typedef int (*func_put_rating_picture_oss)(
|
||||
void *agent, std::string &config, std::string &pic_oss_path, std::string model_id, int profile_id, unsigned int &http_code, std::string &http_error);
|
||||
|
||||
|
||||
//the NetworkAgent class
|
||||
@@ -180,6 +185,9 @@ public:
|
||||
int track_header(std::string header);
|
||||
int track_update_property(std::string name, std::string value, std::string type = "string");
|
||||
int track_get_property(std::string name, std::string& value, std::string type = "string");
|
||||
int put_model_mall_rating(int design_id, int score, std::string content, std::vector<std::string> images, unsigned int &http_code, std::string &http_error);
|
||||
int get_oss_config(std::string &config, std::string country_code, unsigned int &http_code, std::string &http_error);
|
||||
int put_rating_picture_oss(std::string &config, std::string &pic_oss_path, std::string model_id, int profile_id, unsigned int &http_code, std::string &http_error);
|
||||
bool get_track_enable() { return enable_track; }
|
||||
private:
|
||||
bool enable_track = false;
|
||||
@@ -264,6 +272,9 @@ private:
|
||||
static func_track_header track_header_ptr;
|
||||
static func_track_update_property track_update_property_ptr;
|
||||
static func_track_get_property track_get_property_ptr;
|
||||
static func_put_model_mall_rating_url put_model_mall_rating_url_ptr;
|
||||
static func_get_oss_config get_oss_config_ptr;
|
||||
static func_put_rating_picture_oss put_rating_picture_oss_ptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user