feat: 合并应用->电子名片->增加视频号资源管理的功能
This commit is contained in:
@@ -168,7 +168,117 @@ class Enterprise extends BaseShop
|
||||
if (request()->isJson()) {
|
||||
$video_id = input('video_id', 0);
|
||||
$model = new EnterpriseModel();
|
||||
return $model->deleteVideo([ [ 'video_id', '=', $video_id],['site_id','=',$this->site_id] ]);
|
||||
return $model->deleteVideo([ [ 'video_id', '=', $video_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************视频号部分****************************************/
|
||||
/**
|
||||
* 视频号列表
|
||||
*/
|
||||
public function channellists(){
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_text', '');
|
||||
$channel_type = input('channel_type', '');
|
||||
$is_show = input('is_show', '');
|
||||
$order = input('order', '');
|
||||
$condition = [ [ 'site_id', '=', $this->site_id ] ];
|
||||
if ($search_text) {
|
||||
$condition[] = [ 'channel_name', 'like', '%' . $search_text . '%' ];
|
||||
}
|
||||
if ($channel_type) {
|
||||
$condition[] = [ 'channel_type', '=', $channel_type ];
|
||||
}
|
||||
if ($is_show !== '') {
|
||||
$condition[] = [ 'is_show', '=', $is_show ];
|
||||
}
|
||||
$order_by = $order ? $order : 'create_time desc';
|
||||
$model = new EnterpriseModel();
|
||||
$list = $model->getChannelPageList($condition, $page, $page_size, $order_by);
|
||||
return $list;
|
||||
} else {
|
||||
return $this->fetch('enterprise/channel/lists');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加视频号
|
||||
*/
|
||||
public function channeladd()
|
||||
{
|
||||
$model = new EnterpriseModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'site_id' => $this->site_id,
|
||||
'channel_type' => input('channel_type', 'wechat'),
|
||||
'channel_name' => input('channel_name', ''),
|
||||
'avatar_image_type' => input('avatar_image_type', 'upload'),
|
||||
'avatar_url' => input('avatar_url', ''),
|
||||
'video_title' => input('video_title', ''),
|
||||
'feed_id' => input('feed_id', ''),
|
||||
'cover_image_type' => input('cover_image_type', 'upload'),
|
||||
'cover_url' => input('cover_url', ''),
|
||||
'sort' => input('sort', 0),
|
||||
'is_show' => input('is_show', 1),
|
||||
'feed_token' => input('feed_token', ''),
|
||||
'view_count' => input('view_count', 0),
|
||||
'show_view_count' => input('show_view_count', 0),
|
||||
'show_follow' => input('show_follow', 0),
|
||||
'create_time' => time()
|
||||
];
|
||||
return $model->addChannel($data);
|
||||
} else {
|
||||
return $this->fetch('enterprise/channel/edit');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑视频号
|
||||
*/
|
||||
public function channeledit()
|
||||
{
|
||||
$channel_id = input('channel_id', 0);
|
||||
$model = new EnterpriseModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'channel_id' => $channel_id,
|
||||
'site_id' => $this->site_id,
|
||||
'channel_type' => input('channel_type', 'wechat'),
|
||||
'channel_name' => input('channel_name', ''),
|
||||
'avatar_image_type' => input('avatar_image_type', 'upload'),
|
||||
'avatar_url' => input('avatar_url', ''),
|
||||
'video_title' => input('video_title', ''),
|
||||
'feed_id' => input('feed_id', ''),
|
||||
'cover_image_type' => input('cover_image_type', 'upload'),
|
||||
'cover_url' => input('cover_url', ''),
|
||||
'sort' => input('sort', 0),
|
||||
'is_show' => input('is_show', 1),
|
||||
'feed_token' => input('feed_token', ''),
|
||||
'view_count' => input('view_count', 0),
|
||||
'show_view_count' => input('show_view_count', 0),
|
||||
'show_follow' => input('show_follow', 0),
|
||||
];
|
||||
return $model->editChannel($data);
|
||||
} else {
|
||||
$this->assign('channel_id', $channel_id);
|
||||
$article_info = $model->getChannelInfo([ [ 'channel_id', '=', $channel_id ] ]);
|
||||
$this->assign('info', $article_info[ 'data' ]);
|
||||
// 返回统一的 add.html 模板,前端会根据 channel_id 判断是否为编辑模式
|
||||
return $this->fetch('enterprise/channel/edit');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频号
|
||||
*/
|
||||
public function channeldelete()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$channel_id = input('channel_id', 0);
|
||||
$model = new EnterpriseModel();
|
||||
return $model->deleteChannel([ [ 'channel_id', '=', $channel_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user