示例#1
0
 public function findBodyModel($contentId = null)
 {
     if ($contentId === null) {
         return new ContentPost();
     } else {
         $ret = ContentPost::findOne(['content_id' => $contentId]);
         if ($ret === null) {
             $ret = new ContentPost();
             $ret->content_id = $contentId;
             $ret->body = '';
             $ret->save();
         }
         return $ret;
     }
 }
 public function init()
 {
     parent::init();
     $this->content_type = 'post';
     $this->bodyClass = ContentPost::className();
     $this->pageSize_index = 10;
 }
示例#3
0
 public function getDetail($id)
 {
     $model = Content::getBody(ContentPost::className(), [
         'a.id' => $id
     ])->one();
    
     return [
         'model' => $model
     ];
 }