228 lines
9.0 KiB
PHP
228 lines
9.0 KiB
PHP
<?php
|
|
/**
|
|
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
|
* ==========================================================
|
|
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
|
* ----------------------------------------------------------
|
|
* 官方网址: https://www.zoomtk.com
|
|
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
|
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
|
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
|
* ==========================================================
|
|
*/
|
|
|
|
namespace addon\saas\shop\controller;
|
|
|
|
use app\model\system\Address as AddressModel;
|
|
use app\model\web\WebSite as WebsiteModel;
|
|
use addon\saas\model\WebSite;
|
|
|
|
class Agent extends SaasBase
|
|
{
|
|
|
|
/***
|
|
* 渠道列表
|
|
* @return array|mixed
|
|
*/
|
|
public function lists()
|
|
{
|
|
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', '=', 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');
|
|
}
|
|
} |