def __init__(self, params): self.shop_info = None self.validity = False self.params = params self.is_admin, self.is_user = False, False self.user_center_conn = conn.mongo_conn_user().user_web self.restaurant_conn = conn.mongo_conn().restaurant self.center_info = self.get_center_info() if self.center_info: self.user_center_id = str(self.center_info['_id']) else: self.user_center_id = None
__author__ = 'hcy' import jwt from bson import json_util from connect import conn from flask import Blueprint, jsonify, abort, render_template, request, json import base64 import hashlib import time import datetime import hashlib import tools.tools as tool mongo = conn.mongo_conn_user() auto_api = Blueprint('auto_api', __name__, template_folder='templates') @auto_api.route('/fm/merchant/v1/auto/', methods=['POST']) def auto(): baoming = request.form["baoming"] ident = request.form["ident"] type = request.form["type"] payload = {"baoming": baoming, "ident": ident, "type": type} msg = encodejwt(payload) decodejwt(msg) if decodejwt(msg): json = {"jwt": str(msg)} result = tool.return_json(0, "success", True, json) else: json = {"jwt": ""} result = tool.return_json(0, "success", False, json)
import sys import requests from bson import ObjectId reload(sys) sys.setdefaultencoding('utf8') from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.events import EVENT_JOB_EXECUTED, EVENT_JOB_ERROR import datetime import logging from connect import conn # datetime.datetime.now()-datetime.timedelta(seconds = timeout * 60) mongo = conn.mongo_conn() mongouser = conn.mongo_conn_user() logging.basicConfig( level=logging.INFO, format= '%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S', filename='log1.txt', filemode='a') # 检查是否发送过此推送 def checkmsg(data_id='', goto=''): print '检查' pass item = mongo.message.find({"data_id": data_id, "goto": goto}) flag = True
from connect.mongotool import MongoAPI import tools.tools as tool from bson import json_util, ObjectId import pymongo import datetime import hashlib __author__ = 'hcy' user_api = Blueprint("user_api", __name__, template_folder='templates', url_prefix='') # user_api = Blueprint("user_api", __name__, template_folder='templates',url_prefix='/fm/merchant') # mongo = conn.mongo_conn_user() mongo = MongoAPI(conn.mongo_conn_user().user_web) @user_api.route('/usercenter/v1/register/', methods=['POST']) def register(): if request.method == "POST": phone = request.form["phone"] password = request.form["password"] user_data = mongo.find({'phone': phone}) if user_data: # 判断是否存在用户数据 data = user_data[0] user_id = str(user_data[0]['_id']['$oid']) if '2' in data['appid']: # 如果已经注册 return json_util.dumps({ 'success': False,