<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 基礎BaselModel ``` ~~~ <?php namespace app\api\model; use think\Model; use traits\model\SoftDelete; class BaseModel extends Model { // 軟刪除,設置后在查詢時要特別注意whereOr // 使用whereOr會將設置了軟刪除的記錄也查詢出來 // 可以對比下SQL語句,看看whereOr的SQL use SoftDelete; protected $hidden = ['delete_time']; protected function prefixImgUrl($value, $data){ $finalUrl = $value; if($data['from'] == 1){ $finalUrl = config('setting.img_prefix').$value; } return $finalUrl; } } ~~~ ``` ## 其他的model繼承 ~~~ <?php namespace app\api\model; use think\Model; class Category extends BaseModel { public function products() { return $this->hasMany('Product', 'category_id', 'id'); } public function img() { return $this->belongsTo('Image', 'topic_img_id', 'id'); } public static function getCategories($ids) { $categories = self::with('products') ->with('products.img') ->select($ids); return $categories; } public static function getCategory($id) { $category = self::with('products') ->with('products.img') ->find($id); return $category; } } ~~~ ## 控制器里面調用 ## ``` ~~~ public function getCategory($id) { $validate = new IDMustBePositiveInt(); $validate->goCheck(); $category = CategoryModel::getCategory($id); if(empty($category)){ throw new MissException([ 'msg' => 'category not found' ]); } return $category; } ~~~ ```
                  <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>

                              哎呀哎呀视频在线观看