def products_edit(form): app_id = int(form.app_id.data) product_id = int(form.product_id.data) product_name = set_default(form.product_name.data) product_detail = set_default(form.product_detail.data) product_price = set_default(form.product_price.data) inapp_id = set_default(form.inapp_id.data) service_platform = int(form.service_platform.data) currency = int(form.currency.data) status = int(form.status.data) con, cur = sqlrelay_cursor() cur.execute(""" UPDATE ms_app_product SET product_name = '%s' , product_detail = '%s' , product_price = '%s' , inapp_id = '%s' , service_platform = %d , currency = %d , status = %d WHERE product_id = %d AND app_id = %d """ % (product_name, product_detail, product_price, inapp_id, service_platform, currency, status, product_id, app_id)) sqlrelay_close(cur, con)
def products_new(form): app_id = int(form.app_id.data) product_name = set_default(form.product_name.data) product_detail = set_default(form.product_detail.data) product_price = set_default(form.product_price.data) inapp_id = set_default(form.inapp_id.data) service_platform = int(form.service_platform.data) currency = int(form.currency.data) status = int(form.status.data) con, cur = sqlrelay_cursor() cur.execute(""" INSERT INTO ms_app_product ( app_id , product_name , product_detail , product_price , inapp_id , service_platform , currency , status ) VALUES ( %d , '%s' , '%s' , '%s' , '%s' , %d , %d , %d )""" % (app_id, product_name, product_detail, product_price, inapp_id, service_platform, currency, status)) sqlrelay_close(cur, con)
def get_bot(self) -> dict: """Synchronously retrieves the bot data stored in the database""" # Defaults data = { "_id": "bot_information", "developers": ["373317798430244864"], "testers": ["373317798430244864"], "owner": "373317798430244864", "updates": [], "pending_update": {}, "tasks": [], "restart": { "send": False }, "disabled_commands": [], "disabled_cogs": [], "notifications": { "update": [], "new_feature": [] } } # Get the bot data from the data base bot_data = self.bot.find_one({"_id": "bot_information"}) if bot_data is None: self.set_bot(data, insert=True) bot_data = self.get_bot() bot_data = set_default(data, bot_data) return bot_data
def apps_new(form): app_key = _hash_app_key(form.app_name.data) app_secret = _hash_app_secret(app_key) app_name = set_default(form.app_name.data) support_android = set_support(form.support_android.data) support_ios = set_support(form.support_ios.data) support_playstore = set_support(form.support_playstore.data) support_appstore = set_support(form.support_appstore.data) support_gameflier = set_support(form.support_gameflier.data) playstore_url = set_default(form.playstore_url.data) appstore_url = set_default(form.appstore_url.data) gameflier_url = set_default(form.gameflier_url.data) gcm_sender_id = set_default(form.gcm_sender_id.data) gcm_server_api_key = set_default(form.gcm_server_api_key.data) gcm_config_path = '' if form.gcm_config_path.data: gcm_config_path = to_utf8(form.gcm_config_path.data.filename) facebook_app_name = set_default(form.facebook_app_name.data) facebook_app_id = set_default(form.facebook_app_id.data) facebook_app_secret = set_default(form.facebook_app_secret.data) facebook_api_version = facebook_api_version_value(form.facebook_api_version.data) status = form.status.data con, cur = sqlrelay_client_cursor() cur.prepareQuery('CALL create_app(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)') cur.inputBind("1", app_key) cur.inputBind("2", app_secret) cur.inputBind("3", app_name) cur.inputBind("4", support_android) cur.inputBind("5", support_ios) cur.inputBind("6", support_playstore) cur.inputBind("7", support_appstore) cur.inputBind("8", support_gameflier) cur.inputBind("9", playstore_url) cur.inputBind("10", appstore_url) cur.inputBind("11", gameflier_url) cur.inputBind("12", gcm_sender_id) cur.inputBind("13", gcm_server_api_key) cur.inputBind("14", gcm_config_path) cur.inputBind("15", facebook_app_id) cur.inputBind("16", facebook_app_name) cur.inputBind("17", facebook_app_secret) cur.inputBind("18", facebook_api_version) cur.inputBind("19", status) cur.executeQuery() app_id = cur.getField(0,0) sqlrelay_client_close(cur, con) if form.gcm_config_path.data: # GCM Config 파일저장 _app_save_file(form.gcm_config_path.data, app_id)
def apps_edit(form): app_id = form.app_id.data app_name = set_default(form.app_name.data) support_android = set_support(form.support_android.data) support_ios = set_support(form.support_ios.data) support_playstore = set_support(form.support_playstore.data) support_appstore = set_support(form.support_appstore.data) support_gameflier = set_support(form.support_gameflier.data) playstore_url = set_default(form.playstore_url.data) appstore_url = set_default(form.appstore_url.data) gameflier_url = set_default(form.gameflier_url.data) gcm_sender_id = set_default(form.gcm_sender_id.data) gcm_server_api_key = set_default(form.gcm_server_api_key.data) gcm_config_path = _app_save_file(form.gcm_config_path.data, app_id) facebook_app_name = set_default(form.facebook_app_name.data) facebook_app_id = set_default(form.facebook_app_id.data) facebook_app_secret = set_default(form.facebook_app_secret.data) facebook_api_version = facebook_api_version_value(form.facebook_api_version.data) status = form.status.data con, cur = sqlrelay_client_cursor() cur.prepareQuery('CALL update_app(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)') cur.inputBind("1", app_id) cur.inputBind("2", app_name) cur.inputBind("3", support_android) cur.inputBind("4", support_ios) cur.inputBind("5", support_playstore) cur.inputBind("6", support_appstore) cur.inputBind("7", support_gameflier) cur.inputBind("8", playstore_url) cur.inputBind("9", appstore_url) cur.inputBind("10", gameflier_url) cur.inputBind("11", gcm_sender_id) cur.inputBind("12", gcm_server_api_key) cur.inputBind("13", gcm_config_path) cur.inputBind("14", facebook_app_id) cur.inputBind("15", facebook_app_name) cur.inputBind("16", facebook_app_secret) cur.inputBind("17", facebook_api_version) cur.inputBind("18", status) cur.executeQuery() sqlrelay_client_close(cur, con)