def select_google_pkg_info(): conn = connections('DictRemoteCursor') cursor = conn.cursor() rows = tuple() try: # sql = """ # SELECT game_id, icon_url, screen_shot_urls # FROM iplay_game_pkg_info # # WHERE market_channel = "google" # WHERE market_channel in ("GG官方", "三星", "高通版", "英伟达", "PowerVR", "Mali", "全球版", "GG官方原包", "三星原包", "高通版原包", "英伟达原包", "PowerVR原包", "Mali原包") # AND enabled = 1 # AND icon_url like '%ggpht.com%' # """ sql = """ SELECT game_id, icon_url, screen_shot_urls FROM iplay_game_pkg_info # WHERE market_channel = "google" WHERE enabled = 1 AND icon_url like '%ggpht.com%' """ cursor.execute(sql) rows = cursor.fetchall() except Exception as e: logger.debug("select_google_pkg_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def udpate_label_and_pkg_info(game_id): conn = connections('RemoteCursor') cursor = conn.cursor() try: label_sql = """ UPDATE iplay_game_label_info SET enabled = 0 where game_id = %s; """ pkg_sql = """ UPDATE iplay_game_pkg_info SET enabled = 0 where game_id = %s; """ cursor.executemany(label_sql, game_id) cursor.executemany(pkg_sql, game_id) conn.commit() except Exception as e: conn.rollback() logger.debug("udpate_label_and_pkg_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def get_common_pkg_name(): conn = connections('Cursor') cursor = conn.cursor() sql = """SELECT pkgName, count(pkgName) as cnt, is_parse, is_merge FROM crawler_info GROUP BY pkgName HAVING cnt>1 AND is_parse=1 # AND is_merge=0 AND pkgName != "" AND pkgName IS NOT NULL """ result = [] try: cursor.execute(sql) rows = cursor.fetchall() for row in rows: pkg_name = row[0] result.append(pkg_name) except Exception as e: logger.debug("get_common_pkg_name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return result
def select_google_pkg_info(): conn = connections('DictRemoteCursor') cursor = conn.cursor() rows = tuple() try: # sql = """ # SELECT game_id, icon_url, screen_shot_urls # FROM iplay_game_pkg_info # # WHERE market_channel = "google" # WHERE market_channel in ("GG官方", "三星", "高通版", "英伟达", "PowerVR", "Mali", "全球版", "GG官方原包", "三星原包", "高通版原包", "英伟达原包", "PowerVR原包", "Mali原包") # AND enabled = 1 # AND icon_url like '%ggpht.com%' # """ sql = """ SELECT game_id, icon_url, screen_shot_urls FROM iplay_game_pkg_info # WHERE market_channel = "google" WHERE enabled = 1 AND icon_url like '%ggpht.com%' """ cursor.execute(sql) rows = cursor.fetchall() except Exception as e: logger.debug("select_google_pkg_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def udpate_label_and_pkg_info(game_id): conn = connections('RemoteCursor') cursor = conn.cursor() try: label_sql = """ UPDATE iplay_game_label_info SET enabled = 0 where game_id = %s; """ pkg_sql = """ UPDATE iplay_game_pkg_info SET enabled = 0 where game_id = %s; """ cursor.executemany(label_sql, game_id) cursor.executemany(pkg_sql, game_id) conn.commit() except Exception as e: conn.rollback() logger.debug("udpate_label_and_pkg_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def update_label_and_pkg_img(info): conn = connections('RemoteCursor') cursor = conn.cursor() print info try: label_sql = """ UPDATE iplay_game_label_info SET screen_shot_urls = %(screen_shot_urls)s , icon_url = %(icon_url)s where game_id = %(game_id)s; """ pkg_sql = """ UPDATE iplay_game_pkg_info SET screen_shot_urls = %(screen_shot_urls)s , icon_url = %(icon_url)s where game_id = %(game_id)s; """ cursor.execute(label_sql, info) cursor.execute(pkg_sql, info) conn.commit() except Exception as e: conn.rollback() logger.debug("update_label_and_pkg_img: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def get_game_name(): conn = connections('Cursor') cursor = conn.cursor() sql = "SELECT distinct name FROM crawler_info;" rows = None try: cursor.execute(sql) rows = cursor.fetchall() except Exception as e: logger.debug("get_game_name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def udpate_label_info(info): conn = connections('Cursor') cursor = conn.cursor() try: label_sql = """ UPDATE iplay_game_label_info SET developer = %(developer)s where game_id = %(game_id)s; """ cursor.execute(label_sql, info) conn.commit() print "update game_id: %s success." % info['game_id'] except Exception as e: conn.rollback() logger.debug("udpate_label_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def check_developer(developer): """ 检查新增游戏厂商是否在厂商列表内 :param infos: """ conn = connections('Cursor') cursor = conn.cursor() try: sql = """ INSERT INTO iplay_game_developer(developer) VALUES("%s") ON DUPLICATE KEY UPDATE developer = VALUES(developer);""" % developer cursor.execute(sql) conn.commit() except Exception as e: conn.rollback() logger.debug("insert_developer name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def select_google_ver_code(): conn = connections('DictRemoteCursor') cursor = conn.cursor() rows = tuple() try: sql = """ SELECT pkg_name, max(ver_code) as ver_code FROM forum.iplay_game_pkg_info WHERE source = 3 GROUP BY pkg_name; """ cursor.execute(sql) rows = cursor.fetchall() except Exception as e: logger.debug("select_google_pkg_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def select_google_ver_code(): conn = connections('DictRemoteCursor') cursor = conn.cursor() rows = tuple() try: sql = """ SELECT pkg_name, max(ver_code) as ver_code FROM forum.iplay_game_pkg_info WHERE source = 3 GROUP BY pkg_name; """ cursor.execute(sql) rows = cursor.fetchall() except Exception as e: logger.debug("select_google_pkg_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def check_developer(developer): """ 检查新增游戏厂商是否在厂商列表内 :param infos: """ conn = connections('Cursor') cursor = conn.cursor() try: sql = """ INSERT INTO iplay_game_developer(developer) VALUES("%s") ON DUPLICATE KEY UPDATE developer = VALUES(developer);""" % developer cursor.execute(sql) conn.commit() except Exception as e: conn.rollback() logger.debug("insert_developer name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def select_label_info(): conn = connections('DictCursor') cursor = conn.cursor() rows = tuple() try: sql = """ SELECT label.game_id, pkg.pkg_name FROM forum.iplay_game_label_info label LEFT JOIN forum.iplay_game_pkg_info pkg ON pkg.game_id = label.game_id WHERE label.`source` = 3 """ cursor.execute(sql) rows = cursor.fetchall() print len(rows) except Exception as e: logger.debug("select_label_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def select_label_info_by_name(game_name): conn = connections('RemoteCursor') cursor = conn.cursor() rows = tuple() try: sql = """ SELECT game_id FROM iplay_game_label_info WHERE game_name like %s AND enabled = 1 """ cursor.execute(sql, ("%" + game_name + "%", )) rows = cursor.fetchall() except Exception as e: logger.debug("select_label_info_by_name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def select_label_info_by_name(game_name): conn = connections('RemoteCursor') cursor = conn.cursor() rows = tuple() try: sql = """ SELECT game_id FROM iplay_game_label_info WHERE game_name like %s AND enabled = 1 """ cursor.execute(sql, ("%" + game_name + "%",)) rows = cursor.fetchall() except Exception as e: logger.debug("select_label_info_by_name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
def get_crawlers_info(game_name): conn = connections('DictCursor') cursor = conn.cursor() sql = """SELECT id, channel, name, gameName, pkgName, verCode, verName, filesize, downloadUrl, gameDesc, gameTypes, screenShotUrls, iconUrl, starNum, downloadCounts, gameLanguage, is_merge FROM crawler_info WHERE is_parse = 1 AND is_merge = 0 AND name = %s ORDER BY FIELD(channel, '应用宝', '360', '豌豆荚', '安卓市场', '小米', '91', '百度') """ rows = None try: cursor.execute(sql, (game_name,)) rows = cursor.fetchall() except Exception as e: logger.debug("get_crawlers_info: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close() return rows
host = 'http://192.168.1.45' threadurlbase = 'forum/forum.php?mod=viewthread&tid=' args = { 'loginurl': host + '/forum/member.php?mod=logging&action=login', 'loginsubmiturl': host + '/forum/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LUPyq&inajax=1', 'posturl': host + '/forum/forum.php?mod=post&action=newthread&fid=%s', 'postsubmiturl': host + '/forum/forum.php?mod=post&action=newthread&fid=%s&extra=&topicsubmit=yes', 'referer': host + '/forum/index' } dz = Discuz(username, password, args) fid = '52' # tid = dz.post(fid, "第5帖", "第一帖第一帖第一帖第一帖第一帖") conn = conn = connections('Cursor') cursor = conn.cursor() #查询 and game_id = '9e48c7dd' cursor.execute("select * from iplay_game_label_info where (source = 1 or source = 3 or source = 4) and tid = 0 and enabled = 1") n = 0 for row in cursor.fetchall(): gameId = row[0] gameName = row[1] gameDesc = row[10] tid = row[8] if gameName == '/ ESCAPE \\': gameName = 'ESCAPE' html = cgi.escape(gameName) print tid
if IS_TEST: host = 'http://192.168.1.45' args = { 'loginurl': host + '/forum/member.php?mod=logging&action=login', 'loginsubmiturl': host + '/forum/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LUPyq&inajax=1', 'posturl': host + '/forum/forum.php?mod=post&action=newthread&fid=%s', 'postsubmiturl': host + '/forum/forum.php?mod=post&action=newthread&fid=%s&extra=&topicsubmit=yes', 'referer': host + '/forum/index' } dz = Discuz(username, password, args) fid = '53' # tid = dz.post(fid, "第5帖", "第一帖第一帖第一帖第一帖第一帖") conn = conn = connections('Cursor') cursor = conn.cursor() #查询 and apk_id = 'c8129d3d' cursor.execute("select * from iplay_game_pkg_info where (source = 1 or source = 3 or source = 4) and tid = 0 and enabled = 1") n = 0 for row in cursor.fetchall(): apkId = row[0] gameId = row[1] marketChannel = row[2] gameName = row[3] pkgName = row[4] verCode = row[6] verName = row[7] gameDesc = row[14]
def insert_pkg_info(infos): """ download_url_type: 1普通, 2百度盘 数据来源(source): 1 抓取数据 2 论坛数据 3 google play 数据, GG官方 is_plugin_required: 0不需要, 1需要 :param infos: """ conn = connections('RemoteCursor') cursor = conn.cursor() try: sql = """ INSERT INTO iplay_game_pkg_info( apk_id , game_id , market_channel , game_name , pkg_name , ver_code , ver_name , file_size , download_url , game_desc , game_types , downloaded_cnts , game_language , screen_shot_urls , icon_url , save_timestamp , is_crack_apk , min_sdk , download_url_type , source , is_plugin_required , signature_md5 , file_md5 , update_timestamp , origin_types , url4details , gpu_vender , ver_code_by_gg , update_desc , is_max_version , save_user ) VALUES ( %(apk_id)s , %(game_id)s , %(market_channel)s , %(game_name)s , %(pkg_name)s , %(ver_code)s , %(ver_name)s , %(file_size)s , %(download_urls)s , %(game_desc)s , %(game_types)s , %(downloaded_cnts)s , %(game_language)s , %(screen_shot_urls)s , %(icon_url)s , %(now)s , %(is_crack_apk)s , %(min_sdk_version)s , 2 , 3 , 1 , %(signature_md5)s , %(file_md5)s , %(now)s , %(origin_types)s , %(url4details)s , %(gpu_vender)s , %(ver_code_by_gg)s , %(update_desc)s , 1 , %(save_user)s ) ON DUPLICATE KEY UPDATE enabled = 1 , icon_url = VALUES(icon_url) , save_timestamp = VALUES(save_timestamp) , update_timestamp = VALUES(update_timestamp) , ver_code = VALUES (ver_code) , ver_name = VALUES (ver_name) , file_size = VALUES (file_size) , download_url = VALUES (download_url) , gpu_vender = VALUES (gpu_vender) """ cursor.execute(sql, infos) conn.commit() except Exception as e: conn.rollback() logger.debug("insert_pkg_info name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def post_plugin(release_all, target_name_only, target_version_only, upload_plugin): target_version_only = int(target_version_only) username = '******' password = '******' authorid = 68 host = 'http://www.ggzs.me' fid = '55' # on server sortid = '1' resource_type = 'plugin' if IS_TEST: host = 'http://192.168.1.45' logger.debug(host) args = { 'loginurl': host + '/forum/member.php?mod=logging&action=login', 'loginsubmiturl': host + '/forum/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LUPyq&inajax=1', 'posturl': host + '/forum/forum.php?mod=post&action=newthread&fid=' + fid, 'postsubmiturl': host + '/forum/forum.php?mod=post&action=newthread&fid=%s&extra=&topicsubmit=yes', 'referer': host + '/forum/index', 'newposturl': host + '/forum/forum.php?mod=post&action=newthread&fid=' + fid + '&extra=page%3D1%26filter%3Dsortid%26sortid%3D1&sortid=' + sortid, 'upload_url': host + '/forum/misc.php?mod=swfupload&action=swfupload&operation=upload&fid=' + fid, 'post_attach_thread': host + '/forum/forum.php?mod=post&action=newthread&fid=' + fid + '&extra=&topicsubmit=yes', 'post_attach_load': host + '/forum/forum.php?mod=post&action=newthread&fid=' + fid + '&extra=page%3D1&sortid=' + sortid } dz = Discuz(username, password, args) rethinkdb.connect(host='ga-storage.lbesec.com', port=65306, db='plugins').repl() #all_plugin = rethinkdb.table('PluginDef').filter({"storageId": "d2015549-3fb3-4748-b170-c258635df41d"}).run() #all_plugin = rethinkdb.table('PluginDef').filter({"pluginName": "com.gameassist.autoplugin.com.com2us.inotia3.normal.freefull.google.global.android.common"}).run() #all_plugin = rethinkdb.table('PluginDef').filter({"pluginName": "com.gameassist.autoplugin.com.gameloft.android.ANMP.GloftA8HM"}).run() if release_all: all_plugin = rethinkdb.table('PluginDef').run() else: all_plugin = rethinkdb.table('PluginDef').filter({ "targetName": target_name_only, "targetVersion": target_version_only }).run() mysql_conn = connections('Cursor') mysql_cursor = mysql_conn.cursor() storageId = "" rel_num = 0 plugin_pkg_name = '' plugin_ver_code = '' msg = 101 for def_doc in all_plugin: logger.debug(def_doc) plugin_pkg_name = def_doc['pluginName'] plugin_ver_code = def_doc['pluginVersion'] storageId = def_doc['storageId'] plugin_name = def_doc['pluginName'] cursor = rethinkdb.table('PluginStore').filter({"id": storageId}).run() target_name = def_doc['targetName'] for doc in cursor: logger.debug('select PluginStore') tmp_path = r"/tmp/%s.tmp" % plugin_name apk_path = r"/tmp/%s.apk" % plugin_name apk_name = "%s.apk" % plugin_name open(tmp_path, "wb").write(doc['data']) base64.decode(open(tmp_path, "rb"), open(apk_path, "wb")) subject = plugin_name + "[" + str(def_doc['pluginVersion']) + "]" message = def_doc['label'].encode('UTF-8') format_subject = cgi.escape(subject) tcnt = mysql_cursor.execute( "select * from forum.pre_forum_thread " "where subject = \"%s\" and authorid = %d and fid = %d and displayorder >= 0" % (format_subject, authorid, int(fid))) logger.debug(subject) logger.debug(message) if tcnt > 0: #print 'has thread for this plugin : %s' % subject rel_num += 1 msg = 102 logger.debug('has thread for this plugin : %s' % subject) continue aid = dz.post_attach(apk_name, apk_path, authorid) dz.login() tid = dz.post_thread(aid, subject, message, sortid, resource_type) logger.debug("plugin_name[version]: %s aid: %s tid: %s" % (subject, aid, tid)) msg = 199 if tid != '0': rel_num += 1 if mysql_conn: mysql_conn.close() upload_plugin['plugin_pkg_name'] = plugin_pkg_name upload_plugin['plugin_ver_code'] = plugin_ver_code upload_plugin['update_timestamp'] = int(time.time()) upload_plugin['msg'] = msg upload_plugin['is_finished'] = 1 logger.debug('POST SUCCESS')
def insert_label_info(infos): """ 数据来源(source),1 抓取数据 2 论坛数据 3 google play 数据 :param infos: """ conn = connections('RemoteCursor') cursor = conn.cursor() try: sql = """ INSERT INTO iplay_game_label_info( game_id , game_name , game_types , screen_shot_urls , icon_url , detail_desc , star_num , download_counts , game_language , save_timestamp , min_apk_size , max_apk_size , min_ver_name , max_ver_name , source , short_desc , display_name , update_timestamp , origin_types , developer , save_user , update_user ) VALUES ( %(game_id)s , %(game_name)s , %(game_types)s , %(screen_shot_urls)s , %(icon_url)s , %(detail_desc)s , %(star_num)s , %(download_counts)s , %(game_language)s , %(now)s , %(file_size)s , %(file_size)s , %(ver_name)s , %(ver_name)s , 3 , %(short_desc)s , %(game_name)s , %(now)s , %(origin_types)s , %(developer)s , %(save_user)s , %(save_user)s ) ON DUPLICATE KEY UPDATE enabled = 1 , icon_url = VALUES(icon_url) , save_timestamp = VALUES(save_timestamp) , update_timestamp = VALUES(update_timestamp) """ cursor.execute(sql, infos) conn.commit() except Exception as e: conn.rollback() logger.debug("insert_label_info name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def insert_pkg_info(infos): """ download_url_type: 1普通, 2百度盘 数据来源(source): 1 抓取数据 2 论坛数据 3 google play 数据, GG官方 is_plugin_required: 0不需要, 1需要 :param infos: """ conn = connections('RemoteCursor') cursor = conn.cursor() try: sql = """ INSERT INTO iplay_game_pkg_info( apk_id , game_id , market_channel , game_name , pkg_name , ver_code , ver_name , file_size , download_url , game_desc , game_types , downloaded_cnts , game_language , screen_shot_urls , icon_url , save_timestamp , is_crack_apk , min_sdk , download_url_type , source , is_plugin_required , signature_md5 , file_md5 , update_timestamp , origin_types , url4details , gpu_vender , ver_code_by_gg , update_desc , is_max_version , save_user ) VALUES ( %(apk_id)s , %(game_id)s , %(market_channel)s , %(game_name)s , %(pkg_name)s , %(ver_code)s , %(ver_name)s , %(file_size)s , %(download_urls)s , %(game_desc)s , %(game_types)s , %(downloaded_cnts)s , %(game_language)s , %(screen_shot_urls)s , %(icon_url)s , %(now)s , %(is_crack_apk)s , %(min_sdk_version)s , 2 , 3 , 1 , %(signature_md5)s , %(file_md5)s , %(now)s , %(origin_types)s , %(url4details)s , %(gpu_vender)s , %(ver_code_by_gg)s , %(update_desc)s , 1 , %(save_user)s ) ON DUPLICATE KEY UPDATE enabled = 1 , icon_url = VALUES(icon_url) , save_timestamp = VALUES(save_timestamp) , update_timestamp = VALUES(update_timestamp) , ver_code = VALUES (ver_code) , ver_name = VALUES (ver_name) , file_size = VALUES (file_size) , download_url = VALUES (download_url) , gpu_vender = VALUES (gpu_vender) """ cursor.execute(sql, infos) conn.commit() except Exception as e: conn.rollback() logger.debug("insert_pkg_info name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()
def post_plugin(release_all, target_name_only, target_version_only, upload_plugin): target_version_only = int(target_version_only) username = '******' password = '******' authorid = 68 host = 'http://www.ggzs.me' fid = '55' # on server sortid = '1' resource_type = 'plugin' if IS_TEST: host = 'http://192.168.1.45' logger.debug(host) args = { 'loginurl': host + '/forum/member.php?mod=logging&action=login', 'loginsubmiturl': host + '/forum/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LUPyq&inajax=1', 'posturl': host + '/forum/forum.php?mod=post&action=newthread&fid=' + fid, 'postsubmiturl': host + '/forum/forum.php?mod=post&action=newthread&fid=%s&extra=&topicsubmit=yes', 'referer': host + '/forum/index', 'newposturl': host + '/forum/forum.php?mod=post&action=newthread&fid='+fid + '&extra=page%3D1%26filter%3Dsortid%26sortid%3D1&sortid=' + sortid, 'upload_url': host + '/forum/misc.php?mod=swfupload&action=swfupload&operation=upload&fid=' + fid, 'post_attach_thread': host + '/forum/forum.php?mod=post&action=newthread&fid='+fid + '&extra=&topicsubmit=yes', 'post_attach_load': host + '/forum/forum.php?mod=post&action=newthread&fid='+fid + '&extra=page%3D1&sortid=' + sortid } dz = Discuz(username, password, args) rethinkdb.connect(host = 'ga-storage.lbesec.com', port = 65306, db = 'plugins').repl() #all_plugin = rethinkdb.table('PluginDef').filter({"storageId": "d2015549-3fb3-4748-b170-c258635df41d"}).run() #all_plugin = rethinkdb.table('PluginDef').filter({"pluginName": "com.gameassist.autoplugin.com.com2us.inotia3.normal.freefull.google.global.android.common"}).run() #all_plugin = rethinkdb.table('PluginDef').filter({"pluginName": "com.gameassist.autoplugin.com.gameloft.android.ANMP.GloftA8HM"}).run() if release_all: all_plugin = rethinkdb.table('PluginDef').run() else: all_plugin = rethinkdb.table('PluginDef').filter({"targetName": target_name_only, "targetVersion": target_version_only}).run() mysql_conn = connections('Cursor') mysql_cursor = mysql_conn.cursor() storageId = "" rel_num = 0 plugin_pkg_name = '' plugin_ver_code = '' msg = 101 for def_doc in all_plugin: logger.debug(def_doc) plugin_pkg_name = def_doc['pluginName'] plugin_ver_code = def_doc['pluginVersion'] storageId = def_doc['storageId'] plugin_name = def_doc['pluginName'] cursor = rethinkdb.table('PluginStore').filter({"id": storageId}).run() target_name = def_doc['targetName'] for doc in cursor: logger.debug('select PluginStore') tmp_path = r"/tmp/%s.tmp" % plugin_name apk_path = r"/tmp/%s.apk" % plugin_name apk_name = "%s.apk" % plugin_name open(tmp_path, "wb").write(doc['data']) base64.decode(open(tmp_path, "rb"), open(apk_path, "wb")) subject = plugin_name + "[" + str(def_doc['pluginVersion']) + "]" message = def_doc['label'].encode('UTF-8') format_subject = cgi.escape(subject) tcnt = mysql_cursor.execute("select * from forum.pre_forum_thread " "where subject = \"%s\" and authorid = %d and fid = %d and displayorder >= 0" % (format_subject, authorid, int(fid))) logger.debug(subject) logger.debug(message) if tcnt > 0: #print 'has thread for this plugin : %s' % subject rel_num += 1 msg = 102 logger.debug('has thread for this plugin : %s' % subject) continue aid = dz.post_attach(apk_name, apk_path, authorid) dz.login() tid = dz.post_thread(aid, subject, message, sortid, resource_type) logger.debug("plugin_name[version]: %s aid: %s tid: %s" % (subject, aid, tid)) msg = 199 if tid != '0': rel_num += 1 if mysql_conn: mysql_conn.close() upload_plugin['plugin_pkg_name'] = plugin_pkg_name upload_plugin['plugin_ver_code'] = plugin_ver_code upload_plugin['update_timestamp'] = int(time.time()) upload_plugin['msg'] = msg upload_plugin['is_finished'] = 1 logger.debug('POST SUCCESS')
def insert_label_info(infos): """ 数据来源(source),1 抓取数据 2 论坛数据 3 google play 数据 :param infos: """ conn = connections('RemoteCursor') cursor = conn.cursor() try: sql = """ INSERT INTO iplay_game_label_info( game_id , game_name , game_types , screen_shot_urls , icon_url , detail_desc , star_num , download_counts , game_language , save_timestamp , min_apk_size , max_apk_size , min_ver_name , max_ver_name , source , short_desc , display_name , update_timestamp , origin_types , developer , save_user , update_user ) VALUES ( %(game_id)s , %(game_name)s , %(game_types)s , %(screen_shot_urls)s , %(icon_url)s , %(detail_desc)s , %(star_num)s , %(download_counts)s , %(game_language)s , %(now)s , %(file_size)s , %(file_size)s , %(ver_name)s , %(ver_name)s , 3 , %(short_desc)s , %(game_name)s , %(now)s , %(origin_types)s , %(developer)s , %(save_user)s , %(save_user)s ) ON DUPLICATE KEY UPDATE enabled = 1 , icon_url = VALUES(icon_url) , save_timestamp = VALUES(save_timestamp) , update_timestamp = VALUES(update_timestamp) """ cursor.execute(sql, infos) conn.commit() except Exception as e: conn.rollback() logger.debug("insert_label_info name: %s" % str(e.args)) finally: if cursor: cursor.close() if conn: conn.close()