id = empty($id) ? input('id') : $id; $this->news = MediaService::instance()->news($this->id); $this->fetch(); } /** * 文章展示 * @param integer $id 文章ID * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function view($id = 0) { $where = ['id' => empty($id) ? input('id') : $id]; $this->app->db->name('WechatNewsArticle')->where($where)->update([ 'read_num' => $this->app->db->raw('read_num+1'), ]); $this->info = $this->app->db->name('WechatNewsArticle')->where($where)->find(); $this->fetch(); } /** * 文本展示 */ public function text() { $this->content = strip_tags(input('content', ''), ''); $this->fetch(); } /** * 图片展示 */ public function image() { $this->content = strip_tags(input('content', ''), ''); $this->fetch(); } /** * 视频展示 */ 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(); } }