<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                1. 初始化模型 (我們以 `api_1_0` 模塊為例進行演示) 在 `api_1_0` 目錄下的 `model` 目錄下的 ` __init__ `文件錄入如下代碼 ``` #!/usr/bin/env?python3 #?-*-?encoding:?utf-8?-*- from?app?import?db import?datetime,time class BaseModel(object): ????now_date_time?=?datetime.datetime.now()?+?datetime.timedelta(hours=8) ????create_time?=?db.Column(db.DateTime,?nullable=False,?default=now_date_time,?comment='創建時間')? ????update_time?=?db.Column(db.DateTime,?nullable=False,?default=now_date_time,?onupdate=now_date_time,?comment='更新時間') ``` 2. 在 `api_1_0` 目錄下的 `model` 目錄下新建 `user.py` 模型,錄入一下代碼 ``` #!/usr/bin/env?python3 #?-*-?encoding:?utf-8?-*- from?app?import?db from?.?import?BaseModel from?werkzeug.security?import?generate_password_hash,?check_password_hash import?datetime,time class UserModel(BaseModel,?db.Model): ????__tablename__?=?"base_user" id?=?db.Column(db.BigInteger,?comment='pk',?primary_key=True)?#?用戶id ????username?=?db.Column(db.String(50),?nullable=False,?default='')?#?用戶名 ????mobile?=?db.Column(db.String(11),?nullable=False,?unique=True)?#?手機號 ????password_hash?=?db.Column(db.String(128),?nullable=False)?#?密碼 ????avatar_url?=?db.Column(db.String(255),?nullable=False,?default='')?#?密碼 #?添加?property?裝飾器之后,會把函數變為屬性,屬性名即為函數名 @property def password(self): raise AttributeError("can't?read") @password.setter def password(self,?origin_password): self.password_hash?=?generate_password_hash(origin_password) defcheck_password(self,?origin_password): return?check_password_hash(self.password_hash,?origin_password) def to_dict(self): return { "user_id":?self.id, "username":?self.username, "create_time":?self.create_time.strftime("%Y-%m-%d?%H:%M:%S"), "update_time":?int(time.mktime(self.update_time.timetuple()))? } ``` base_user 表結構
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看