Esempio n. 1
0
def findbyid():
    # 获得搜索框的内容
    eid = request.args.get('id')
    userservice = userService()
    ds = userservice.findbyid(eid)
    dict = {}
    dict['result'] = ds
    return dict
Esempio n. 2
0
def search():
    # 获得搜索框的内容
    str = request.args.get('str')
    userservice = userService()
    ds = userservice.search(str)
    dict = {}
    dict['result'] = ds
    return dict
def changeUserName():
    if request.method == 'POST':
        uid = request.form.get("userid", type=str, default=None)
        username = request.form.get('username', type=str, default=None)
        service = userService()
        out = service.changeUserName(uid, username)
        if out == 1:
            return {"status": "1"}
        else:
            return {"status": "0"}
def changePhone():
    if request.method == 'POST':
        uid = request.form.get("userid", type=str, default=None)
        passward = request.form.get('passward', type=str, default=None)
        phone = request.form.get('phone', type=str, default=None)
        service = userService()
        out = service.changePhone(uid, passward, phone)
        if out == 1:
            return {"status": "1"}
        else:
            return {"status": "0"}
def changeMail():
    if request.method == 'POST':
        uid = request.form.get("userid", type=str, default=None)
        mail = request.form.get('mail', type=str, default=None)
        varifycode = request.form.get('varifycode', type=str, default=None)
        service = userService()
        out = service.changeMail(uid, mail, varifycode)
        if out == 1:
            return {"status": "1"}
        else:
            return {"status": "0"}
def changePassward():
    if request.method == 'POST':
        uid = request.form.get("userid", type=str, default=None)
        oldPassward = request.form.get("oldpassward", type=str, default=None)
        newPassward1 = request.form.get("newpassward1", type=str, default=None)
        newPassward2 = request.form.get("newpassward2", type=str, default=None)
        service = userService()
        out = service.changePassward(uid, oldPassward, newPassward1, newPassward2)
        if out == 1:
            return {"status": "1"}
        else:
            return {"status": "0"}
def login():
    if request.method == 'POST':
        phone = request.form.get('phone', type=str, default=None)
        passward = request.form.get('passward', type=str, default=None)
        varifiycode = request.form.get('verificationCode', type=str, default=None)
        service = userService()
        status, userId, identify = service.login(phone, passward, varifiycode)
        return {
            "status": status,
            "userid": userId,
            "identify": identify
        }
def register():
    if request.method == 'POST':
        username = request.form.get('username', type=str, default=None)
        passward = request.form.get('passward', type=str, default=None)
        phone = request.form.get('phone', type=str, default=None)
        mail = request.form.get('mail', type=str, default=None)
        varifycode = request.form.get('verificationCode', type=str, default=None)
        service = userService()
        out = service.register(username, passward, phone, mail, varifycode)
        if out == 1:
            return {"status": "1"}
        else:
            return {"status": "0"}
def getVarifyCode():
    if request.method == 'GET':
        service = userService()
        out = service.getVarifyCode()
        if out == 1:
            return {
                "status": "1",
                "GetVarifyCode": "1234"
            }
        else:
            return {
                "status": "0",
                "GetVarifyCode": "1234"
            }
def applyExpert():
    if request.method == 'POST':
        byte = request.data
        data = byte.decode(encoding="utf-8")
        try:
            dic = json.loads(data)
            name = dic['name']
            degreee = dic['degree']
            pic1 = dic['pic1']
            pic2 = dic['pic2']
            pic3 = dic['pic3']
            userId = dic['userid']
        except Exception as r:
            current_app.logger.info('专家申请接口json参数错误')
            return {"status": "0"}
        service = userService()
        out = service.applyExpert(name, degreee, userId, pic1, pic2, pic3)
        if out == 1:
            return {"status": "1"}
        else:
            return {"status": "0"}
Esempio n. 11
0
def expertlist():
    userservice = userService()
    ds = userservice.expertlist()
    dict = {}
    dict['result'] = ds
    return dict