id = $id ?: input('id', 0); $this->news = MediaService::news($this->id); $this->fetch(); } /** * 文章内容展示. * @param int|string $id 文章ID编号 * @throws DbException */ public function item($id = 0) { $map = ['id' => $id ?: input('id', 0)]; $modal = WechatNewsArticle::mk()->where($map)->findOrEmpty(); $modal->isExists() && $modal->newQuery()->where($map)->setInc('read_num'); $this->fetch('item', ['info' => $modal->toArray()]); } /** * 文本展示. */ public function text() { $text = strip_tags(input('content', ''), ''); $this->fetch('text', ['content' => $text]); } /** * 图片展示. */ public function image() { $text = strip_tags(input('content', ''), ''); $this->fetch('image', ['content' => $text]); } /** * 视频展示. */ public function video() { $this->url = strip_tags(input('url', ''), ''); $this->title = strip_tags(input('title', ''), ''); $this->fetch(); } /** * 语音展示. */ public function voice() { $this->url = strip_tags(input('url', ''), ''); $this->fetch(); } /** * 音乐展示. */ public function music() { $this->url = strip_tags(input('url', ''), ''); $this->desc = strip_tags(input('desc', ''), ''); $this->title = strip_tags(input('title', ''), ''); $this->fetch(); } }