示例#1
0
文件: getList.py 项目: wjstk16/Hyfast
def getUserList(id_num):

    _total_records = 0
    _offset = request.form['offset']

    data = call_db_manager('sp_GetListByUser' , (id_num ,_offset,  _total_records))

    return json.dumps(data)
示例#2
0
文件: getList.py 项目: wjstk16/Hyfast
def showSearch(id_num , p_num):

    data = call_db_manager('sp_GetProductById' , (p_num , id_num))
    print(data[0][0])



    return render_template('detail.html' , id_num = id_num , product_id=data[0][0] ,product_title=data[0][1],product_description=data[0][2],product_user_id=data[0][3],product_date=data[0][4],product_state=data[0][5],product_price=data[0][6],product_file_path=data[0][7] ,product_file_path2=data[0][8] , product_file_path3=data[0][9])
示例#3
0
文件: getList.py 项目: wjstk16/Hyfast
def getTimeList(id_num):

    _total_records = 0
    _offset = request.form['offset']

    data = call_db_manager('sp_getTimeList' , (_offset,  _total_records))

    return json.dumps(data)
示例#4
0
文件: getList.py 项目: wjstk16/Hyfast
def getWishById(id_num):

            _id = request.form['id']
            _user = id_num
            data = call_db_manager('sp_GetProductById' , (_id, _user))
            product_data = []
            product_data.append({'product_id':data[0][0],'product_title':data[0][1],'product_description':data[0][2] , 'product_file_path' : data[0][7] })

            return json.dumps(product_data)
示例#5
0
def search(id_num):
    _title = request.form['inputtitle']
    strdata = request.form['inputsearch']
    fildata = request.form['inputfilter']

    if _title:
        datas = json.dumps(call_db_manager('sp_noneFilter', (_title, )))
        print(datas)
        return render_template('searchRes.html', datas=datas)
    elif strdata and fildata == 0:
        datas = json.dumps(call_db_manager('sp_filter', (_title, )))
        return render_template('searchRes.html', datas=datas)
    elif strdata and fildata == 1:
        datas = json.dumps(call_db_manager('sp_filterOrderPop', (_title, )))
        return render_template('searchRes.html', datas=datas)
    elif strdata and fildata == 2:
        datas = json.dumps(call_db_manager('sp_filterOrderPrice', (_title, )))
        return render_template('searchRes.html', datas=datas)
    elif strdata and fildata == 3:
        datas = json.dumps(call_db_manager('sp_filterOrderDate', (_title, )))
        return render_template('searchRes.html', datas=datas)
示例#6
0
def deleteProduct(id_num):


            _id = request.form['id']
            _user = id_num

            booltype = call_db_manager('sp_deleteProduct' , (_id, _user))

            if booltype:

                return json.dumps({'status': 'OK'})
            else:


                return json.dumps({'status': 'ERROR'})
示例#7
0
def like(id_num):

    _id  = request.form['id']
    _user = id_num
    print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#')
    print(_id)
    print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#')
    booltype = call_db_manager('sp_AddUpdateLikes', (_id, _user))
    print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#')

    if booltype:

        return json.dumps({'status': 'OK'})
    else:

        return json.dumps({'status': 'ERROR'})
示例#8
0
def addProduct(id_num):
    if request.method == 'POST':

        _title = request.form['inputTitle']
        _description = request.form['inputDescription']
        _user_id = id_num
        _state = request.form['inputState']
        _price = request.form['inputPrice']
        if len(request.form.get('filePath'))==0:
            _filePath = 'http://microdcn.com:9002/static/Uploads/noimage.png'
        else:
            _filePath = request.form.get('filePath')
        if len(request.form.get('filePath2'))==0:
            _filePath2 = 'http://microdcn.com:9002/static/Uploads/noimage.png'
        else:
            _filePath2 = request.form.get('filePath2')
        if len(request.form.get('filePath3'))==0:
            _filePath3 = 'http://microdcn.com:9002/static/Uploads/noimage.png'
        else:
            _filePath3 = request.form.get('filePath3')

        data = (_title, _description, _user_id , _state , _price , _filePath , _filePath2 , _filePath3)

        print(data)



        if _title and _description and _user_id and _state and _price:
            booltype = call_db_manager('sp_addWish' , data)
            if booltype:

            # return json.dumps({'message': 'Add product successfully !'})
            # return render_template(''  , id_num = id_num)
            # return redirect('http://microdcn.com:3000/userHome/' + id_num)
                return render_template('s_add.html'  , id_num = id_num)


            else:
                return json.dumps({'error': _title})


        else:
            return json.dumps({'html': '<span>Enter the required fields</span>'})

    else:
        return render_template('s_add.html', id_num=id_num)
示例#9
0
def updateProduct(id_num):


    _user = id_num
    _title = request.form['title']
    _description = request.form['description']
    _p_id = request.form['id']
    _filePath = request.form['filePath']

    booltype = call_db_manager('sp_updateProduct' , (_title, _description , _p_id , _user , _filePath))

    if booltype :
        # return render_template('s_update.html' , id_num=id_num)
        return json.dumps({'status': 'OK'})
    else:
        # return render_template('f_updata.html' , id_num = id_num)

        return json.dumps({'status': 'ERROR'})
示例#10
0
def signUp():



    _name = request.form['inputName']
    _email = request.form['inputEmail']
    _password = request.form['inputPassword']
    _phonenumber = request.form['inputPhonenumber']

    _hashed_password = generate_password_hash(_password)

    if _name and _email and _password and _phonenumber:
        booltype = call_db_manager('sp_createUser' , (_name, _email, _hashed_password , _phonenumber))
        if booltype:
            return json.dumps({'message': 'User created successfully !'})
        else:
            return json.dumps({'error': _name})

    else:
         return json.dumps({'html': '<span>Enter the required fields</span>'})
示例#11
0
def validateLogin():
    try:
        _username = request.form['inputEmail']
        _password = request.form['inputPassword']

        data = call_db_manager('sp_validateLogin', (_username, ))
        print(data)
        if len(data) > 0:
            if check_password_hash(str(data[0][3]), _password):

                return redirect('http://microdcn.com/userHome/' +
                                str(data[0][1]))

            else:
                return render_template(
                    'error.html', error='Wrong Email address or Password.')
        else:
            return render_template('error.html',
                                   error='Wrong Email address or Password.')

    except Exception as e:
        return render_template('error.html', error=str(e))
示例#12
0
文件: getList.py 项目: wjstk16/Hyfast
def getDash(id_num):


    data = call_db_manager('sp_getProductByLike' , (id_num,))
    return json.dumps(data)
示例#13
0
文件: getList.py 项目: wjstk16/Hyfast
def getList(id_num):

    data = call_db_manager('sp_getList' , (id_num,))
    return json.dumps(data)