增加docke部署

This commit is contained in:
2026-04-10 16:44:13 +08:00
parent e2f8054794
commit cd4ddb606d
5076 changed files with 701092 additions and 0 deletions

View File

@@ -0,0 +1,390 @@
<?php
/******************************************************************************************
* ================ summer 2017/11/6 Handel 管理部分业务 ====================== *
*****************************************************************************************/
class manage extends BaseMethod
{
##------------ 公告管理[curd]
##------------[ct_agent_notice] ------------------------->
/**
* 发布公告
* @param RequestParameter $inParam
* @param ReturnParameter $outParam
* @return bool
*/
public function addAgentNotice($inParam, $outParam)
{
// 1、系统非空数据配置初始化
$config = array(
# 代理商id
'agentID' => array(
'name' => 'agentid',
'errcode' => ERRORCODE_AGENTIDERROR,
'errinfo' => ERRORINFO_AGENTIDERROR,
),
# 渠道商id
'channelID' => array(
'name' => 'channelid',
'errcode' => ERRORCODE_CHANNELIDERROR,
'errinfo' => ERRORINFO_CHANNELIDERROR,
),
# 个人代理id
'salesID' => array(
'name' => 'salesid',
'errcode' => ERRORCODE_SALESIDERROR,
'errinfo' => ERRORINFO_SALESIDERROR,
),
# 公告内容
'noticeInfo' => array(
'name' => 'content',
'errcode' => 'H00001',
'errinfo' => '公告内容不能为空',
),
);
// 2、数据处理后的结果集 异常标志errtrue false
$param = $this->inParamHandel($inParam, $outParam, $config);
if (!$param)
{
return false;
}
// 验证总代权限
$auth = $this->checkAgentAuth($inParam, $outParam, $param['agentID'], $param['channelID'], $param['salesID']);
if (!$auth)
{
return false;
}
// 通知入库
$res = $this->PDO_Execute(
'
INSERT INTO
ct_agent_notice(agent_id, channel_id, notice_info, create_time, status)
VALUES (?, ?, ?, ?, ?)',
$param['agentID'], $param['channelID'], $param['noticeInfo'], date('Y-m-d H:i:s', time()), 1
);
if (!$res)
{
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
return false;
}
return true;
}
/**
* [改]修改公告内容 公告状态
* author summer
*/
public function editAgentNotice($inParam, $outParam)
{
$config = array(
# 代理商id
'agentID' => array(
'name' => 'agentid',
'errcode' => ERRORCODE_AGENTIDERROR,
'errinfo' => ERRORINFO_AGENTIDERROR,
),
# 渠道商id
'channelID' => array(
'name' => 'channelid',
'errcode' => ERRORCODE_CHANNELIDERROR,
'errinfo' => ERRORINFO_CHANNELIDERROR,
),
# 个人代理id
'salesID' => array(
'name' => 'salesid',
'errcode' => ERRORCODE_SALESIDERROR,
'errinfo' => ERRORINFO_SALESIDERROR,
),
# 操作记录id
'id' => array(
'name' => 'id',
'errcode' => 'H00001',
'errinfo' => 'id不能为空',
)
);
// 2、数据处理后的结果集 异常标志errtrue false
$param = $this->inParamHandel($inParam, $outParam, $config);
if (!$param)
{
return false;
}
// 3、权限验证
$auth = $this->checkAgentAuth($inParam, $outParam, $param['agentID'], $param['channelID'], $param['salesID']);
if (!$auth)
{
return false;
}
// 4、业务逻辑部分
#a.查看公告是否存在
$item = $this->PDO_Request(
'
select
*
from
ct_agent_notice
where
id = ?; ', $param['id']
);
if (!$item)
{
$outParam->SetErrors(ERRORCODE_COMMISSIONNOTEXISTERROR, ERRORINFO_COMMISSIONNOTEXISTERROR);
return false;
}
// 传了几个改几个
$status = isset($param['_params']['status']) ? $param['_params']['status'] : $item[0]['status']; // 修改状态
$content = isset($param['_params']['content']) ? $param['_params']['content'] : $item[0]['notice_info']; // 内容
// 更新公告
$this->PDO_Execute(
'
update
ct_agent_notice
set
notice_info = ?, status = ?
where
id = ?; ', $content, $status, $param['id']
);
if (!$this->PDO_IsDone())
{
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
return false;
}
return true;
}
/**
* [查]查询公告 pc后台
* author summer
*/
public function getAgentNotice($inParam, $outParam)
{
// 1、系统非空数据配置初始化
$config = array(
# 代理商id
'agentID' => array(
'name' => 'agentid',
'errcode' => ERRORCODE_AGENTIDERROR,
'errinfo' => ERRORINFO_AGENTIDERROR,
),
# 渠道商id
'channelID' => array(
'name' => 'channelid',
'errcode' => ERRORCODE_CHANNELIDERROR,
'errinfo' => ERRORINFO_CHANNELIDERROR,
),
# 个人代理id
'salesID' => array(
'name' => 'salesid',
'errcode' => ERRORCODE_SALESIDERROR,
'errinfo' => ERRORINFO_SALESIDERROR,
),
);
// 2、数据处理后的结果集 异常标志errtrue false
$param = $this->inParamHandel($inParam, $outParam, $config);
if (!$param)
{
return false;
}
//3.1 可选参数获取
$beginTime = empty($param['_params']['begintime']) ? false : $param['_params']['begintime']; // 查询开始时间
$endTime = empty($param['_params']['endtime']) ? false : $param['_params']['endtime']; // 查询结束时间
$status = empty($param['_params']['status']) ? 5 : $param['_params']['status']; // 查询状态
switch ($status)
{
// 当前状态(0: 关闭;1: 开启)
case '0':
$where_status = ' AND status = 0';
break;
case '1':
$where_status = ' AND status = 1';
break;
default:
$where_status = '';
break;
}
$keyword = empty($param['_params']['keyword']) ? false : $param['_params']['keyword']; // 查询关键字
if ($keyword)
{
$where_keyword = ' AND notice_info like "%' . trim($keyword) . '%"';
}
else
{
$where_keyword = '';
}
# 分页信息
$page_index = empty($param['_params']['page_index']) ? 1 : intval($param['_params']['page_index']); // 当前页
$page_size = empty($param['_params']['page_size']) ? 10 : intval($param['_params']['page_size']); // 单页容量
$start = ($page_index - 1) * $page_size;
$strPage = '';
if (!empty($page_index))
{
$strPage .= " LIMIT {$start},{$page_size} ";
}
if ($beginTime)
{
$where_begin = ' AND create_time >= "' . $beginTime . ' 00:00:00"';
}
else
{
$where_begin = '';
}
if ($endTime)
{
$where_end = ' AND create_time <= "' . $endTime . ' 23:59:59"';
}
else
{
$where_end = '';
}
$items = $this->PDO_Request(
'
SELECT
*
FROM
ct_agent_notice
WHERE
agent_id = ? AND channel_id = ? AND status != -1' . $where_begin . $where_end . $where_keyword . $where_status . '
ORDER BY
create_time desc ' . $strPage . ';', $param['agentID'], $param['channelID']
);
if (!is_array($items))
{
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
return false;
}
# 分页计算
$dbData = $this->PDO_Request(
'
SELECT
count(1) num
FROM
ct_agent_notice
WHERE
agent_id = ? AND channel_id = ? AND status != -1' . $where_begin . $where_end . $where_keyword . $where_status . ';',
$param['agentID'], $param['channelID']
);
if (!is_array($dbData) || count($dbData) < 1)
{
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
return false;
}
$data_count = intval($dbData[0]['num']);
$page_count = $data_count / $page_size + 1; // 总页数
// 5、数据返回部分
$outParam->biz_content = array(
'data' => $items,
'page_index' => $page_index,
'page_size' => $page_size,
'page_count' => intval($page_count),
'data_count' => $data_count,
);
return true;
}
##------------ 工具方法[curd]
##------------[summer 2017/11/6 Handel] ----------------------->
/**
* 输入参数标准化处理
* @param RequestParameter $inParam
* @param ReturnParameter $outParam
* @param array $config 待处理变量配置文件
*
* @return array data
*
* authorsummer 2017/11/6
*/
public function inParamHandel($inParam, $outParam, $config)
{
foreach ($config as $k => $v)
{
// 1、全局校验
$data['_params'] = $request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
if (!is_array($request_data))
{
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
return false;
}
// 2、单元校验
$data[$k] = isset($request_data[$v['name']]) ? $request_data[$v['name']] : '';
if (empty($data[$k]))
{
$outParam->SetErrors($v['errcode'], $v['errinfo']);
return false;
}
}
// 3、返回处理后的数据
return $data;
}
/**
* 代理权限认证
* @param RequestParameter $agentid 代理商id
* @param RequestParameter $channelid 渠道商id
* @param RequestParameter $salesid 代理人id
*
* @return array data
*
* authorsummer 2017/11/6
*/
public function checkAgentAuth($inParam, $outParam, $agentID, $channelID, $salesID)
{
//只有总代理才有权限
$dbSalesInfo = $this->PDO_Request(
'
SELECT idx, global_power
FROM sales_user
WHERE saus_agentid=? AND saus_channelid=? AND saus_salesid=?', $agentID, $channelID, $salesID
);
if (!is_array($dbSalesInfo))
{
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
return false;
}
// 代理不存在
if (count($dbSalesInfo) < 1)
{
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
return false;
}
// 不是总代理,没有权限
if (intval($dbSalesInfo[0]['global_power']) != 1)
{
$outParam->SetErrors(ERRORCODE_NOPOWERERROR, ERRORINFO_NOPOWERERROR);
return false;
}
return true;
}
}