isAjax()) { $page = input('page', 1); $page_size = input('page_size', PAGE_LIST_ROWS); $search_text = input('search_text', ''); $states = input('status', ''); $WebsiteModel = new WebSite(); $condition = [ ['agent_pid', '=', $this->site_id], ['is_apply', '=', 1], ]; $info = $WebsiteModel->getWebSiteList($condition, $page, $page_size); return $info; } $this->forthMenu(); return $this->fetch('agent/lists'); } /*** * 获取审核列表 * @return array|mixed */ public function applylist() { if (request()->isAjax()) { $page = input('page', 1); $page_size = input('page_size', PAGE_LIST_ROWS); $search_text = input('search_text', ''); $states = input('status', ''); $WebsiteModel = new WebSite(); $condition = [ ['agent_pid', '=', $this->site_id], ['is_apply', '=', 0], ]; $info = $WebsiteModel->getWebSiteList($condition, $page, $page_size); return $info; } $this->forthMenu(); return $this->fetch('agent/applylists'); } /*** * 添加渠道商 * @return array|mixed */ public function adduser() { $address_model = new AddressModel(); $list = $address_model->getAreaList([["pid", "=", 0], ["level", "=", 1]]); if (request()->isAjax()) { $info = $this->AgentInfo; $site_id = input('site_id'); if (empty($site_id)) return error(-1, '请选择需要开通的商家'); if (empty($info) || $info['status'] != 1) return error(-1, '权限不足'); $data = [ 'site_id' => $site_id, 'user_id' => $this->uid, 'agent_pid' => $this->site_id, 'title' => input('title', ''), 'agent_type' => input('agent_type', 'divideAndSitefee'), 'is_agent' => 1, 'is_apply' => 0, 'status' => 0, 'channel_settled_money' => input('channel_settled_money',1500), 'level_id' => input('level_id', 0), 'level_name' => input('level_name', ''), 'province_id' => input('province_id'), 'city_id' => input('city_id'), 'district_id' => input('district_id'), 'full_address' => input('full_address'), 'address' => input('address'), 'apply_reason' => input('apply_reason', ''), 'keywords' => input('keywords', ''), 'web_address' => input('web_address', ''), 'web_qrcode' => input('web_qrcode', ''), 'web_email' => input('web_email', ''), 'web_contacts' => input('web_contacts', ''), 'web_phone' => input('web_phone', ''), 'web_qq' => input('web_qq', ''), 'web_weixin' => input('web_weixin', ''), 'wap_status' => input('wap_status', ''), 'agent_money' => 0, 'appreg_rate' => 0, 'site_rate' => 0, ]; $website_model = new WebsiteModel(); $res = $website_model->addWebsite($data); return $res; } $this->assign("agentInfo", $this->AgentInfo); $this->assign("apply_info", ['agent_type'=>'divideAndSitefee']); $this->assign("province_list", $list["data"]); return $this->fetch('agent/add'); } /*** * 编辑审核渠道 * @return array|mixed|null */ public function edituser() { $id = input('id'); $status = input('status', ''); if (empty($id)) return $this->error('id无权限'); $website_model = new WebsiteModel(); if (request()->isAjax()) { $data = [ 'user_id' => $this->uid, 'title' => input('title', ''), 'level_id' => input('level_id', 0), 'level_name' => input('level_name', ''), 'province_id' => input('province_id'), 'city_id' => input('city_id'), 'district_id' => input('district_id'), 'full_address' => input('full_address'), 'address' => input('address'), 'apply_reason' => input('apply_reason', ''), 'keywords' => input('keywords', ''), 'web_address' => input('web_address', ''), 'web_qrcode' => input('web_qrcode', ''), 'web_email' => input('web_email', ''), 'web_contacts' => input('web_contacts', ''), 'web_phone' => input('web_phone', ''), 'web_qq' => input('web_qq', ''), 'web_weixin' => input('web_weixin', ''), 'wap_status' => input('wap_status', ''), ]; if ($status) { $data['is_apply'] = input('is_apply', -1); $data['refuse'] = input('refuse'); if (input('is_apply') != 1) { $data['status'] = -1; } } $website_model = new WebsiteModel(); $res = $website_model->setWebSite($data, ['id' => $id, 'agent_pid' => $this->site_id]); return $res; } $info = $website_model->getWebSite(['id' => $id, 'agent_pid' => $this->site_id], '*', false)['data']; if (empty($info)) return $this->error('id无权限'); $address_model = new AddressModel(); $list = $address_model->getAreaList([["pid", "=", 0], ["level", "=", 1]]); $this->assign("province_list", $list["data"]); $this->assign("apply_info", $info); $this->assign("id", $id); $this->assign("status", $status); return $this->fetch('agent/editagent'); } /*** * 渠道申请 */ public function apply() { //查询省级数据列表 $address_model = new AddressModel(); $list = $address_model->getAreaList([["pid", "=", 0], ["level", "=", 1]]); $info = $this->AgentInfo; if (request()->isAjax()) { if (input('is_agree') != 1) return error(-1, '申请无效'); $data = [ 'site_id' => $this->site_id, 'user_id' => $this->uid, 'agent_pid' => $this->shop_info['agent_id'] ?: 1, 'title' => input('title', ''), 'is_agent' => 1, 'is_apply' => 0, 'status' => -1, 'level_id' => input('level_id', 0), 'level_name' => input('level_name', ''), 'province_id' => input('province_id'), 'city_id' => input('city_id'), 'district_id' => input('district_id'), 'full_address' => input('full_address'), 'address' => input('address'), 'apply_reason' => input('apply_reason', ''), 'keywords' => input('keywords', ''), 'web_address' => input('web_address', ''), 'web_qrcode' => input('web_qrcode', ''), 'web_email' => input('web_email', ''), 'web_contacts' => input('web_contacts', ''), 'web_phone' => input('web_phone', ''), 'web_qq' => input('web_qq', ''), 'web_weixin' => input('web_weixin', ''), 'wap_status' => input('wap_status', ''), 'agent_money' => 0, 'site_rate' => 0, ]; $website_model = new WebsiteModel(); if (empty($this->AgentInfo)) { $res = $website_model->addWebsite($data); } else { $res = $website_model->setWebSite($data, ['id' => $this->AgentInfo['id']]); } return $res; } $this->assign("apply_info", $info); $this->assign("province_list", $list["data"]); return $this->fetch('agent/apply'); } }