Пример #1
0
def sellData():
    """
        修改产品售卖数量信息
    """
    if request.method=='POST':
        rowid=request.form["product_id"]
        productName=request.form["product_name"]
        sellNumber=request.form["sell_number"]
        productCategory=request.form["product_category"]
        productProfit=request.form["product_price"]
        operator="system"
        operatorTime=datetime.today().strftime("%Y-%m-%d %H:%M:%S")
        sql3="insert  into product_history(productName, productCategory, productSaleNumber, productProfit, operator, operatorTime) values (?,?,?,?,?,?)"
        DB.execute_sql(sql3,(productName, productCategory, int(sellNumber), productProfit, operator, operatorTime))
        sql="select productSaleNumber from product_list where rowid=?"
        productSaleNumber=DB.query_sql(sql,(rowid,),single_strip=True)
        productSaleNumber=int(productSaleNumber[0])+int(sellNumber)
        sql2="update product_list set productSaleNumber=?  where rowid=?;"
        DB.execute_sql(sql2,(productSaleNumber,rowid))
        return redirect(url_for("sell.sellList"))
Пример #2
0
def submit_profile():
    header_png=None
    if  "header_png" in request.files:
        header_png=request.files["header_png"]
        if allowed_file(header_png.filename):
            img_path=datetime.now().strftime("%Y%m%d%H%M%f")+os.path.splitext(header_png.filename)[1]
            header_png.save(os.path.join(UPLOAD_FOLDER,img_path))
    username=request.form["username"]
    birthdate=datetime(int(request.form['year']),int(request.form['month']),int(request.form['days'])).date()
    address=request.form.get('address')
    email=request.form.get('email')
    phone=request.form.get('phone')
    freelance=request.form.get('freelance')
    profile_title=request.form.get('profile-title')
    profile_content=request.form.get('profile-text')
    sql="update personal set name=?,birthdate=?,address=?,email=?,phone=?,freelance=?,profile_title=?,profile_content=? ,head_portrait=? where rowid=2;"
    DB.execute_sql(sql,(username,birthdate,address,email,phone,freelance,profile_title,profile_content,img_path))
    return redirect(url_for("index"))