抖音矩阵源码

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));
                break;
            case 'tou_tiao' :
                $plugin = new App_Plugin_Douyin_OpenPlugin($this->manager['ds_agent_id']);
                $app_info = $plugin->getAppInfo();

                $toutiao_scope = plum_parse_config('toutiao_scope', 'douyin');
                $redirect_uri = $app_info['douyin_domain'] . '/dydqtclient/user/xtAccountLogin';
                $url = $plugin->getToutiaoCode($redirect_uri, join(',', $toutiao_scope), json_encode($state));
                break;
            case 'bili_bili' :
                $plugin = new App_Plugin_Bilibili_OpenPlugin($this->manager['ds_agent_id']);
                $app_info = $plugin->getAppInfo();

                $redirect_uri = $app_info['douyin_domain'] . '/dydqtclient/user/blAccountLogin';
                $url = $plugin->getOauthCode($redirect_uri, json_encode($state));
                break;
        }
        if (!empty($link)) {
            return [
                'url'   => $url,
                'link'  => $link,
            ];
        } else {
            return $url;
        }
    }

  

抖音矩阵源码_第1张图片

  /*
     * 添加账号/刷新授权
     */
    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' 

总结:

以上为部分源码展示,代码为源头开发,开源搭建

开发语言:PHP

你可能感兴趣的:(抖音seo源码,抖音矩阵源码,账号矩阵源码,数学建模,开发语言,java,sass,php)