赞
踩
抖音seo源码,抖音矩阵源码,短视频矩阵,短视频seo;
public function accountLink($platform)
{
//携带状态
$state = [
'agent_id' => $this->manager['ds_agent_id'],
's_id' => $this->sid,
'platform' => $platform,
'host' => $this->response->responseHost(),
];
/************生成url************/
switch ($platform) {
case 'dou_yin' :
$plugin = new App_Plugin_Douyin_OpenPlugin($this->manager['ds_agent_id']);
$app_info = $plugin->getAppInfo();
$redirect_uri = $app_info['douyin_domain'] . '/dydqtclient/user/dyAccountLogin';
$url = $plugin->getOauthCode($redirect_uri, $app_info['douyin_scope'], json_encode($state));
$link = $state['host']."/auth/link/?suid=".$this->suid;
break;
case 'kuai_shou' :
$plugin = new App_Plugin_Kuaishou_OpenPlugin($this->manager['ds_agent_id']);
$app_info = $plugin->getAppInfo();
$redirect_uri = $app_info['kuaishou_domain'] . '/dydqtclient/user/ksAccountLogin';
$url = $plugin->getMobOauthCode($redirect_uri, $app_info['kuaishou_scope'], json_encode($state));
break;
case 'xi_gua' :
$plugin = new App_Plugin_Douyin_OpenPlugin($this->manager['ds_agent_id']);
$app_info = $plugin->getAppInfo();
$xigua_scope = plum_parse_config('xigua_scope', 'douyin');
$redirect_uri = $app_info['douyin_domain'] . '/dydqtclient/user/xtAccountLogin';
$url = $plugin->getXiguaCode($redirect_uri, join(',', $xigua_scope), json_encode($state));
* 添加账号/刷新授权
*/
public function addAccountAction()
{
$type = $this->request->getStrParam('platform', 'bai_jia_hao');
$this->useLayout('dydqtshoppc-head.html');
switch ($type) {
case 'bai_jia_hao':
$this->displaySmarty('dydqtshoppc/account/addBjhAuth.html');
break;
}
}
##region 抖音
/*
* 抖音账号列表
*/
public function dyUserListAction()
{
$url = $this->accountLink('dou_yin');
$this->output['link_url'] = $url;
//应用类型输出
$this->outputOpenTypes('dou_yin');
$keyword_type = $this->request->getStrParam('keyword_type');
$keyword = $this->request->getStrParam('keyword');
$time_range = $this->request->getStrParam('time_range');
$this->output['time_range'] = $time_range;
$group_id = $this->request->getStrParam('group_id');
$store_id = $this->request->getStrParam('store_id');
$auth_status = $this->request->getIntParam('auth_status', 0);
$this->output['auth_status'] = $auth_status;
#$this->output['group_id'] = $group_id;
$where = [
['name' => 'da_s_id', 'oper' => '=', 'value' => $this->sid],
['name' => 'da_aa_id', 'oper' => '>', 'value' => 0],//企业号显示与否的判断
//['name' => 'da_account_role', 'oper' => '=', 'value' => 'normal'],
];
$group_model = new App_Model_Douyin_MysqlAccountGroupStorage();
$store_model = new App_Model_Shop_MysqlSaleStoreStorage();
if ($this->admin_role > 1) {
$role = $this->getAdminRole();
if ($role['role'] == 3) {//普通员工
$where[] = ['name' => 'da_admin_id', 'oper' => '=', 'value' => $this->admin_id];
} else {//部门管理
$where[] = ['name' => 'da_admin_id', 'oper' => 'in', 'value' => $role['list']];
}
}
if (!empty($keyword_type)) {
$where[] = ['name' => $keyword_type, 'oper' => 'like', 'value' => "%{$keyword}%"];
}
if (!empty($time_range)) {
$time_range_arr = explode('~', $time_range);
$where[] = ['name' => 'da_update_time', 'oper' => '>=', 'value' => strtotime($time_range_arr[0])];
$where[] = ['name' => 'da_update_time', 'oper' => '<', 'value' => strtotime($time_range_arr[1]) + 86400];
}
$gids = [];
if (!empty($group_id)) {
$group_id = explode(',', $group_id);
if (count($group_id) > 1) {
$gids = $group_id;
} else {
$gids = $group_model->getAllChildredNode(current($group_id));
}
$this->output['gids'] = join(',', $gids);
$where[] = ['name' => 'da_group_id', 'oper' => 'in', 'value' => $gids];
}
if (!empty($store_id)) {
if ($store_id > 1000000) {
$store_list = $store_model->getStoreByDepart($store_id - 1000000);
$store_ids = array_column($store_list, 'ss_id');
} else {
$store_ids = explode(',', $store_id);
#$store_ids = [$store_id];
}
if (!empty($store_ids)) {
$where[] = ['name' => 'da_store_id', 'oper' => 'in', 'value' => $store_ids];
}
$this->output['sids'] = join(',', $store_ids);
}
if ($auth_status > 0) {
$curr_time = time();
switch ($auth_status) {
case 1 :
$where[] = ['name' => 'da_auth_status', 'oper' => '=', 'value' => 0]; //正常授权
$where[] = ['name' => 'da_access_expire', 'oper' => '>', 'value' => $curr_time];
break;
case 2 : //授权即将到期
$expire = $curr_time + 10 * 24 * 60 * 60;
$where[] = ['name' => 'da_auth_status', 'oper' => '=', 'value' => 0]; //正常授权
$where[] = ['name' => 'da_refresh_expire', 'oper' => '=', 'value' => 0];
$where[] = ['name' => 'da_access_expire', 'oper' => '<>', 'value' => 0];
$where[] = ['name' => 'da_access_expire', 'oper' => '<', 'value' => $expire];
break;
case 3 :
$where[] = ['name' => 'da_auth_status', 'oper' => '=', 'value' => 0]; //正常授权
$where[] = ['name' => 'da_refresh_expire', 'oper' => '=', 'value' => 0];
$where[] = ['name' => 'da_access_expire', 'oper' => '=', 'value' => 0];
break;
case 4 :
$where[] = ['name' => 'da_auth_status', 'oper' => '=', 'value' => 1]; //取消授权
break;
case 5 :
$where[] = ['name' => 'da_creator_status', 'oper' => '=', 'value' => 0]; //未授权创作者中心
break;
}
}
$sort = ['da_update_time' => 'DESC'];
$dy_account = new App_Model_Douyin_MysqlDyAccountStorage($this->manager['ds_agent_id'], $this->sid);
$result = $dy_account->getListWithAdmin($where, $this->index, $this->count, $sort);
$curr_time = time();
$live_model = new App_Model_Douyin_MysqlLiveRecordStorage();
$admin_model = new App_Model_Douyin_MysqlStoreAdminStorage();
$tips = 0;
$device_model = new App_Model_Device_MysqlActiveCodeStorage();
$bind_model = new App_Model_Device_MysqlDeviceBindStorage();
foreach ($result as &$item) {
$item['access_status'] = $item['da_access_expire'] > $curr_time ? 1 : 0;
$item['refresh_status'] = $item['da_refresh_expire'] > $curr_time ? 1 : 0;
if ($item['da_group_id']) {
$item['group'] = $group_model->getRowByIdSid($item['da_group_id'], $this->sid);
}
if ($item['da_store_id']) {
$item['store'] = $store_model->getRowByIdSid($item['da_store_id'], $this->sid);
}
//获取账号直播统计数据
$lr_where = [
['name' => 'dl_ds_id', 'oper' => '=', 'value' => $this->sid],
['name' => 'dl_da_id', 'oper' => '=', 'value' => $item['da_id']],
];
$item['da_live_count'] = $live_model->getCount($lr_where);
if ($item['da_admin_id']) {
$item['admin'] = $admin_model->getRowById($item['da_admin_id']);
}
$item['show_tips'] = $item['da_auth_status'] ? $tips : ++$tips;
$item['device'] = $device_model->findDeviceByBindId($item['da_bind_id'], $this->sid);
if ($item['device']) {
$item['bind'] = $bind_model->findBindByDeviceType($item['device']['da_id'], 'dyzhbd');
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。