2
0

api_title_index.py 527 B

123456789101112131415
  1. from .tool.func import *
  2. def api_title_index():
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if flask.request.args.get('count', '1') == '1':
  6. curs.execute(db_change('select data from other where name = "count_all_title"'))
  7. title_count = curs.fetchall()
  8. if title_count:
  9. return flask.jsonify({ 'count' : title_count[0][0] })
  10. else:
  11. return flask.jsonify({ 'count' : '0' })
  12. else:
  13. return flask.jsonify({})