diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php
index 59f7e8482..7916130e1 100644
--- a/Application/Admin/Common/function.php
+++ b/Application/Admin/Common/function.php
@@ -706,16 +706,20 @@ function getPromoteAccount($promoteId)
return M('promote', 'tab_')->where($map)->getField('account');
}
-//获取推广员列表 $level 0-全部
-function getPromoteByLevel($level = 0)
+//获取推广员列表 $level 0-全部 $companyId 推广公司 0-全部
+function getPromoteByLevel($level = 0, $companyId = 0)
{
$field = 'id, account, real_name';
- if ($level) {
+ $map['_string'] = '1 = 1';
+ if ($level > 0) {
$map['level'] = $level;
- $promotes = M('promote', 'tab_')->field($field)->where($map)->select();
- } else {
- $promotes = M('promote', 'tab_')->field($field)->select();
}
+ if ($companyId > 0) {
+ $map['company_id'] = $companyId;
+ }
+
+ $promotes = M('promote', 'tab_')->field($field)->where($map)->select();
+
return $promotes;
}
diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php
index ba3504d8e..272a1192a 100644
--- a/Application/Admin/Controller/AutoController.class.php
+++ b/Application/Admin/Controller/AutoController.class.php
@@ -1073,7 +1073,7 @@ public function auto_rrdae(){
$map['level'] = 1;
$map['ver_status'] = 1;
$map['settlement_type'] = ($settlement == 3) ? 1 : $settlement;
- $promotes = M('promote', 'tab_')->field('id, account, chain, settlement_type')->where($map)->select();
+ $promotes = M('promote', 'tab_')->field('id, account, chain, settlement_type, auto_review_withdraw_status')->where($map)->select();
$success = 0;
$error_withdraw = 0;
$error_spend = 0;
diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php
index 0f6701687..a0db7e13b 100644
--- a/Application/Admin/Controller/PromoteGameRatioController.class.php
+++ b/Application/Admin/Controller/PromoteGameRatioController.class.php
@@ -22,22 +22,44 @@ class PromoteGameRatioController extends ThinkController
{
$params = I('get.');
$group = $params['group'] ?? 1;
+ $companyId = $params['company_id'] ?? 0;
+ $companyBelong = $params['company_belong'] ?? '';
$promoteId = $params['promote_id'] ?? 0;
$gameId = $params['game_id'] ?? 0;
+ $gameTypeId = $params['game_type_id'] ?? 0;
$status = $params['status'] ?? '';
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map['_string'] = 'game_id = relation_game_id';
+ $where['_string'] = '1 = 1';
+ if ($companyId || ($companyBelong !== '' && in_array($companyBelong, [0, 1]))) {
+ $promoteMap['_string'] = '1 = 1';
+ if ($companyId) {
+ $promoteMap['company_id'] = $companyId;
+ }
+ if ($companyBelong !== '' && in_array($companyBelong, [0, 1])) {
+ $promoteMap['company_belong'] = $companyBelong;
+ }
+ $promoteIds = D('promote')->where($promoteMap)->getField('id', true);
+ $promoteIds = $promoteIds ?? [-1];
+ $where['promote_id'] = ['in', $promoteIds];
+ }
if ($promoteId) {
$map['promote_id'] = intval($promoteId);
}
+ if ($gameTypeId) {
+ $gameIds = D('game')->where(['game_type_id' => $gameTypeId])->getField('id', true);
+ $gameIds = $gameIds ?? [-1];
+ $where['game_id'] = ['in', $gameIds];
+ }
if ($gameId) {
$map['game_id'] = intval($gameId);
}
if ($status !== '') {
$map['status'] = intval($status);
}
+ $map['_complex'] = $where;
$field = 'create_time, update_time';
if ($group == 1) {
@@ -68,8 +90,8 @@ class PromoteGameRatioController extends ThinkController
if ($promoteGameRatios) {
$promoteIds = array_column($promoteGameRatios, 'promote_id');
$gameIds = array_column($promoteGameRatios, 'game_id');
- $promoteFiled = 'id, account, mobile_phone, create_time, status, ver_status';
- $gameFiled = 'id, relation_game_name, ratio';
+ $promoteFiled = 'id, account, mobile_phone, create_time, status, ver_status, company_id, company_belong';
+ $gameFiled = 'id, relation_game_name, ratio, game_type_name';
$promotes = M('promote', 'tab_')->where(array('id' => ['in', $promoteIds]))->getField($promoteFiled, true);
$games = M('game', 'tab_')->where(array('id' => ['in', $gameIds]))->getField($gameFiled, true);
@@ -83,14 +105,22 @@ class PromoteGameRatioController extends ThinkController
$thisPromoteCreateTime = '未知';
$thisPromoteStatus = '待审核';
$thisPromoteVerStatus = '未知';
+ $thisCompanyName = '未知';
+ $thisCompanyBelong = '未知';
+ $thisGameTypeName = '未知';
$thisGameName = '未知';
$thisGameRatio = '0.00%';
$thisLastRatio = $promoteGameRatio['last_ratio'] . '%';
$thisLastTurnoverRatio = $promoteGameRatio['last_turnover_ratio'] ? json_decode($promoteGameRatio['last_turnover_ratio'], true) : [];
$thisLastRatio = $thisLastTurnoverRatio ? "{$thisLastRatio} - " . $thisLastTurnoverRatio[count($thisLastTurnoverRatio) - 1]['ratio'] . '%' : $thisLastRatio;
- $thisRatio = $promoteGameRatio['ratio'] . '%';
- $thisTurnoverRatio = $promoteGameRatio['turnover_ratio'] ? json_decode($promoteGameRatio['turnover_ratio'], true) : [];
- $thisRatio = $thisTurnoverRatio ? "{$thisRatio} - " . $thisTurnoverRatio[count($thisTurnoverRatio) - 1]['ratio'] . '%' : $thisRatio;
+ $thisTurnoverRatios = $promoteGameRatio['turnover_ratio'] ? json_decode($promoteGameRatio['turnover_ratio'], true) : [];
+ $thisRatioDtl = "默认:{$promoteGameRatio['ratio']}%";
+ if ($thisTurnoverRatios) {
+ foreach ($thisTurnoverRatios as $thisTurnoverRatio) {
+ $thisIntervalClosedStatusText = isset($thisTurnoverRatio['interval_closed_status']) ? ($thisTurnoverRatio['interval_closed_status'] == 1 ? '≥' : '>') : '≥';
+ $thisRatioDtl .= "
月流水{$thisIntervalClosedStatusText}{$thisTurnoverRatio['turnover']},比例:{$thisTurnoverRatio['ratio']}%";
+ }
+ }
$thisLastRatioStatus = $promoteGameRatio['last_ratio_status'];
$thisStatusText = self::$statusList[$promoteGameRatio['status']];
$thisStatusText = ($promoteGameRatio['status'] == -1) ? '' . $thisStatusText . '' : $thisStatusText;
@@ -106,11 +136,14 @@ class PromoteGameRatioController extends ThinkController
$thisPromoteStatus = get_info_status($promotes[$thisPromoteId]['status'], 3);
$thisPromoteStatus = $thisPromoteStatus ?? '待审核';
$thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['ver_status'], 2);
+ $thisCompanyName = getPromoteCompanyName($promotes[$thisPromoteId]['company_id']);
+ $thisCompanyBelong = $promotes[$thisPromoteId]['company_belong'] == 1 ? '外团' : '内团';
}
if ($issetGame) {
$thisGameName = $games[$thisGameId]['relation_game_name'];
$thisGameRatio = $games[$thisGameId]['ratio'];
$thisGameRatio = ($thisGameRatio ?? '0.00') . '%';
+ $thisGameTypeName = $games[$thisGameId]['game_type_name'];
}
$record = [
@@ -121,9 +154,12 @@ class PromoteGameRatioController extends ThinkController
'promote_create_time' => $thisPromoteCreateTime,
'promote_status_text' => $thisPromoteStatus,
'promote_ver_status_text' => $thisPromoteVerStatus,
+ 'company_name' => $thisCompanyName,
+ 'company_belong' => $thisCompanyBelong,
'game_name' => $thisGameName,
+ 'game_type_name' => $thisGameTypeName,
'last_ratio' => (($thisLastRatioStatus == 1 || $group != 1) ? $thisLastRatio : $thisGameRatio),
- 'ratio' => $thisRatio,
+ 'ratio_dtl' => $thisRatioDtl,
'valid_date' => $validDate,
'remark' => $promoteGameRatio['remark'],
'status_text' => $thisStatusText,
@@ -158,16 +194,20 @@ class PromoteGameRatioController extends ThinkController
exit;
}
+ $gameTypelist = getGameTypes();
+ $companys = getPromoteCompanys();
$reviewRule = $this->getReviewRule();
$page = set_pagination($count, $row);
if($page) {
$this->assign('_page', $page);
}
+ $this->assign('companys', $companys);
+ $this->assign('gameTypeList', $gameTypelist);
$this->assign('group', $group);
$this->assign('records', $records);
$this->assign('count', $count);
$this->assign('gameList', getAllGameList(true));
- $this->assign('promoteList', getPromoteByLevel(1));
+ $this->assign('promoteList', getPromoteByLevel(1, intval(I('company_id', 0))));
$this->assign('statusList', self::$statusList);
$this->assign('reviewRule', $reviewRule);
$this->assign('is_admin', is_administrator());
@@ -192,8 +232,8 @@ class PromoteGameRatioController extends ThinkController
$this->error('默认分成比例不能为空');
}
$save['turnover_ratio'] = [];
- if (!empty(array_filter($params['turnover'])) || !empty(array_filter($params['turnover_ratio']))) {
- if (is_array($params['turnover']) && is_array($params['turnover_ratio'])) {
+ if (!empty(array_filter($params['turnover'])) || !empty(array_filter($params['turnover_ratio'])) || !empty(array_filter($params['interval_closed_status']))) {
+ if (is_array($params['turnover']) && is_array($params['turnover_ratio']) && is_array($params['interval_closed_status'])) {
foreach ($params['turnover'] as $turnover) {
if (empty($turnover)) {
$this->error('月流水不能为空');
@@ -204,6 +244,11 @@ class PromoteGameRatioController extends ThinkController
$this->error('月流水分成比例不能为空');
}
}
+ foreach ($params['interval_closed_status'] as $intervalClosedStatus) {
+ if (!in_array($intervalClosedStatus, [1, 2])) {
+ $this->error('月流水分符号不能为空');
+ }
+ }
$turnoverCount = count($params['turnover']);
$sortTurnover = $params['turnover'];
sort($sortTurnover);
@@ -225,12 +270,14 @@ class PromoteGameRatioController extends ThinkController
$save['turnover_ratio'][] = [
'turnover' => bcdiv($turnover, 1, 2),
'ratio' => bcdiv($params['turnover_ratio'][$key], 1, 2),
+ 'interval_closed_status' => (isset($params['interval_closed_status'][$key]) ? $params['interval_closed_status'][$key] : 1),
];
}
$save['turnover_ratio'] = json_encode($save['turnover_ratio']);
}
}
+ $save['interval_closed_status'] = ($params['interval_closed_status'] ? ($params['interval_closed_status'] == 1 ? 1 : 2) : 1);
$save['ratio'] = $params['ratio'] ?? 0;
$save['begin_time'] = strtotime($params['begin_time']);
$save['end_time'] = $params['end_time'] ? (strtotime('+1 month', strtotime($params['end_time'])) - 1) : 0;
@@ -243,14 +290,15 @@ class PromoteGameRatioController extends ThinkController
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
- if ($promoteGameRatio['status'] == -1 || $save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark'] || $save['turnover_ratio'] != $promoteGameRatio['turnover_ratio']) {
- $this->isWithdraw($promoteGameRatio['promote_id'], $save['begin_time']);
+ if ($promoteGameRatio['status'] == -1 || $save['interval_closed_status'] != $promoteGameRatio['interval_closed_status'] || $save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark'] || $save['turnover_ratio'] != $promoteGameRatio['turnover_ratio']) {
+ $this->isWithdraw($promoteGameRatio['promote_id'], $save['begin_time'], $save['end_time']);
if ($promoteGameRatio['status'] == 1) {
$save['last_turnover_ratio'] = $promoteGameRatio['turnover_ratio'];
$save['last_ratio'] = $promoteGameRatio['ratio'];
$save['last_ratio_status'] = 1;
}
+ $saveMap['promote_id'] = $promoteGameRatio['promote_id'];
$saveMap['relation_game_id'] = $promoteGameRatio['relation_game_id'];
$result = D(self::MODEL_NAME)->where($saveMap)->save($save);
$logResult = $result;
@@ -293,7 +341,7 @@ class PromoteGameRatioController extends ThinkController
$this->error('参数异常');
}
- $this->isWithdraw($promoteId, $save['begin_time']);
+ $this->isWithdraw($promoteId, $save['begin_time'], $save['end_time']);
$map['promote_id'] = $promoteId;
$save['promote_id'] = $promoteId;
@@ -329,6 +377,7 @@ class PromoteGameRatioController extends ThinkController
$params = I('get.');
$id = $params['id'] ?? 0;
$id = intval($id);
+ $companyId = 0;
$metaTitle = '游戏分成比例申请';
if ($id) {
$metaTitle .= '--修改';
@@ -347,18 +396,30 @@ class PromoteGameRatioController extends ThinkController
$lastRatio = ($gameRatio ?? '0.00') . '%';
}
+ $companyId = $promoteGameRatio['company_id'];
+ $promoteGameRatio['company_id'] = D('promote')->where(['id' => $promoteGameRatio['promote_id']])->getField('company_id');
$this->assign('record', $promoteGameRatio);
$this->assign('lastRatio', $lastRatio);
}
+ $companys = getPromoteCompanys();
+ $this->assign('companys', $companys);
$this->assign('gameList', getAllGameList(true));
- $this->assign('promoteList', getPromoteByLevel(1));
+ $this->assign('promoteList', getPromoteByLevel(1, $companyId));
$this->meta_title = $metaTitle;
$this->display();
}
}
- private function isWithdraw($promoteId, $beginTime)
+ public function getPromotes()
+ {
+ $level = 1;
+ $companyId = intval(I('company_id', 0));
+ $promotes = getPromoteByLevel($level, $companyId);
+ $this->ajaxReturn($promotes);
+ }
+
+ private function isWithdraw($promoteId, $beginTime, $endTime)
{
$promote = M('promote', 'tab_')->find($promoteId);
if (empty($promote)) {
@@ -370,11 +431,38 @@ class PromoteGameRatioController extends ThinkController
$withdrawMap['promote_id'] = $promoteId;
$withdrawMap['status'] = ['neq', -2];
+ if (empty($endTime)) {
+ $withdrawWhere['settlement_begin_time'] = ['egt', $beginTime];
+ $withdrawWhere['settlement_end_time'] = ['egt', $beginTime];
+ } else {
+ $withdrawWhere['settlement_begin_time'] = ['between', [$beginTime, $endTime]];
+ $withdrawWhere['settlement_end_time'] = ['between', [$beginTime, $endTime]];
+ }
+ $withdrawWhere['_logic'] = 'or';
+ $withdrawMap['_complex'] = $withdrawWhere;
$withdrawMap['settlement_begin_time'] = ['egt', $beginTime];
- $withdraw = M('withdraw', 'tab_')->where($withdrawMap)->order('create_time desc')->find();
- if (!empty($withdraw) && $withdraw['status'] != -2) {
- $time = date('Y-m', $beginTime);
- $this->error("{$time}月已有订单申请提现, 无法变更分成比例,请重新选择开始时间");
+ $withdraws = M('withdraw', 'tab_')->field('settlement_begin_time, settlement_end_time')
+ ->where($withdrawMap)
+ ->order('settlement_begin_time asc, settlement_end_time asc')
+ ->select();
+ if (!empty($withdraws)) {
+ $times = [];
+ $text = '';
+ foreach ($withdraws as $withdraw) {
+ $settlementBeginTime = !empty($withdraw['settlement_begin_time']) ? date('Y-m', $withdraw['settlement_begin_time']) : '';
+ $settlementEndTime = date('Y-m', $withdraw['settlement_end_time']);
+ if ($settlementBeginTime && !in_array($settlementBeginTime, $times)) {
+ $times[] = $settlementBeginTime;
+ $text .= "{$settlementBeginTime}月、";
+ }
+ if (!in_array($settlementEndTime, $times)) {
+ $times[] = $settlementEndTime;
+ $text .= "{$settlementEndTime}月、";
+ }
+ }
+ $text = rtrim($text, '、');
+ $text .= '已有订单申请提现, 无法变更分成比例,请重新选择开始时间';
+ $this->error($text);
}
}
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index a346f441f..a28fb5f2e 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -2,6 +2,7 @@
namespace Admin\Controller;
+use Admin\Model\PromoteModel;
use Home\Controller\FileController;
use User\Api\UserApi as UserApi;
use Admin\Model\WithdrawModel;
@@ -1005,6 +1006,7 @@ class QueryController extends ThinkController
public function withdraw()
{
$page = I('p', 1);
+ $row = I('row', 10);
$map['_string'] = '1=1';
$adminid = C('USER_ADMINISTRATOR');//获取超管id
$adminmobile = M('UcenterMember')->field('mobile')->find($adminid);
@@ -1030,6 +1032,13 @@ class QueryController extends ThinkController
} else {
$map['promote_id'] = array('gt', 0);
}
+ if (!empty($_REQUEST['company_id'])) {
+ $promoteIds = D('promote')->where(['company_id' => $_REQUEST['company_id']])
+ ->getField('id', true);
+ $promoteIds = $promoteIds ?? [-1];
+ $where['promote_id'] = ['in', $promoteIds];
+ $map['_complex'] = $where;
+ }
$order = 'create_time desc';
if (isset($_REQUEST['data_order'])) {
@@ -1042,40 +1051,68 @@ class QueryController extends ThinkController
}
}
}
+
+ $fields = 'id, widthdraw_number, sum_money, promote_id, promote_account, op_id, op_type, last_op_id, last_op_type, settlement_type, settlement_begin_time, settlement_end_time, create_time, status, respond, audit_time';
+ $count = 0;
if (I('export', 0) == 1) {
- $records = D('withdraw')->field('widthdraw_number, sum_money, promote_account, op_id, op_type, last_op_id, last_op_type, settlement_type, settlement_begin_time, settlement_end_time, create_time, status, respond, audit_time')
+ $records = D('withdraw')->field($fields)
->where($map)
->order($order)
->select();
- if (!empty($records)) {
- $data = [];
- foreach ($records as $record) {
- $record['op_id_text'] = $this->getOpTypeText($record['op_type'], $record['op_id']);
- $record['last_op_id_text'] = $this->getOpTypeText($record['last_op_type'], $record['last_op_id']);
- $record['op_type_text'] = getPromoteWithdrawOpType($record['op_type']);
- $record['last_op_type_text'] = getPromoteWithdrawOpType($record['last_op_type']);
- $record['settlement_type_text'] = getPromoteWithdrawSettlementType($record['settlement_type']);
- $data[] = [
- 'widthdraw_number' => $record['widthdraw_number'],
- 'sum_money' => $record['sum_money'],
- 'promote_account' => $record['promote_account'],
- 'op_id_text' => $this->getOpTypeText($record['op_type'], $record['op_id']),
- 'last_op_id_text' => $this->getOpTypeText($record['last_op_type'], $record['last_op_id']),
- 'op_type_text' => getPromoteWithdrawOpType($record['op_type']),
- 'last_op_type_text' => getPromoteWithdrawOpType($record['last_op_type']),
- 'settlement_type_text' => getPromoteWithdrawSettlementType($record['settlement_type']),
- 'settlement_begin_time' => $record['settlement_begin_time'] ? date('Y-m-d H:i:s', $record['settlement_begin_time']) : '--',
- 'settlement_end_time' => date('Y-m-d H:i:s', $record['settlement_end_time']),
- 'create_time' => date('Y-m-d H:i:s', $record['create_time']),
- 'status_text' => promoteWithdrawStatus($record['status']),
- 'respond' => $record['respond'],
- 'audit_time' => $record['audit_time'] ? date('Y-m-d H:i:s', $record['audit_time']) : '--',
- ];
+ } else {
+ $records = D('withdraw')->field($fields)
+ ->where($map)
+ ->order($order)
+ ->page($page, $row)
+ ->select();
+ $count = D('withdraw')->field($fields)
+ ->where($map)
+ ->count();
+ }
+
+ $datas = [];
+ if (!empty($records)) {
+ $promoteIds = array_column($records, 'promote_id');
+ $promoteCompanys = D('promote')->join('tab_promote_company as company on tab_promote.company_id = company.id')
+ ->where(['tab_promote.id' => ['in', $promoteIds]])
+ ->getField('tab_promote.id, company.company_name', true);
+ foreach ($records as $record) {
+ $record['op_id_text'] = $this->getOpTypeText($record['op_type'], $record['op_id']);
+ $record['last_op_id_text'] = $this->getOpTypeText($record['last_op_type'], $record['last_op_id']);
+ $record['op_type_text'] = getPromoteWithdrawOpType($record['op_type']);
+ $record['last_op_type_text'] = getPromoteWithdrawOpType($record['last_op_type']);
+ $record['settlement_type_text'] = getPromoteWithdrawSettlementType($record['settlement_type']);
+ $record['company_name'] = isset($promoteCompanys[$record['promote_id']]) ? $promoteCompanys[$record['promote_id']] : '未知';
+
+ $data = [
+ 'widthdraw_number' => $record['widthdraw_number'],
+ 'sum_money' => $record['sum_money'],
+ 'company_name' => $record['company_name'],
+ 'promote_account' => $record['promote_account'],
+ 'op_id_text' => $this->getOpTypeText($record['op_type'], $record['op_id']),
+ 'last_op_id_text' => $this->getOpTypeText($record['last_op_type'], $record['last_op_id']),
+ 'op_type_text' => getPromoteWithdrawOpType($record['op_type']),
+ 'last_op_type_text' => getPromoteWithdrawOpType($record['last_op_type']),
+ 'settlement_type_text' => getPromoteWithdrawSettlementType($record['settlement_type']),
+ 'settlement_begin_time' => $record['settlement_begin_time'] ? date('Y-m-d H:i:s', $record['settlement_begin_time']) : '--',
+ 'settlement_end_time' => date('Y-m-d H:i:s', $record['settlement_end_time']),
+ 'create_time' => date('Y-m-d H:i:s', $record['create_time']),
+ 'status_text' => promoteWithdrawStatus($record['status']),
+ 'respond' => $record['respond'],
+ 'audit_time' => $record['audit_time'] ? date('Y-m-d H:i:s', $record['audit_time']) : '--',
+ ];
+ if (I('export', 0) != 1) {
+ $data['id'] = $record['id'];
+ $data['status'] = $record['status'];
}
+ $datas[] = $data;
+ }
+ if (I('export', 0) == 1) {
$field = [
'widthdraw_number' => '结算单号',
'sum_money' => '结算金额',
+ 'company_name' => '推广公司',
'promote_account' => '推广员账号',
'op_id_text' => '操作人',
'op_type_text' => '操作人类型',
@@ -1089,17 +1126,11 @@ class QueryController extends ThinkController
'respond' => '说明',
'audit_time' => '审核时间',
];
- data2csv($data,"推广结算", $field);
+ data2csv($datas,"推广结算", $field);
exit;
}
}
- $model = array(
- 'm_name' => 'withdraw',
- 'order' => $order,
- 'title' => '渠道提现',
- 'template_list' => 'withdraw',
- );
$map1 = array('status' => ['neq', -1]);
//为数据权限添加
setPowerPromoteIds($map1);
@@ -1110,15 +1141,21 @@ class QueryController extends ThinkController
$this->assign('total', $total);
$this->assign('ttotal', $ttotal);
$this->assign('ytotal', $ytotal);
- $user = A('Bill', 'Event');
$this->m_title = '推广提现';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Query/withdraw', 'status' => 1])->find());
+ $page = set_pagination($count, $row);
+ if($page) {
+ $this->assign('_page', $page);
+ }
//为数据权限添加
setPowerPromoteIds($map);
+ $companys = getPromoteCompanys();
+ $this->assign('companys', $companys);
$this->assign('is_admin', is_administrator());
- $user->money_list($model, $page, $map);
+ $this->assign('list_data', $datas);
+ $this->display();
}
public function getWithdraw()
@@ -1669,4 +1706,87 @@ class QueryController extends ThinkController
}
$this->ajaxReturn(['balance' => $balance]);
}
+
+ public function autoReview($autoStatus = 0)
+ {
+ if ($_POST) {
+ $promoteIds = I('ids', '');
+ $autoStatus = intval($autoStatus);
+ if (empty($promoteIds)) {
+ $this->error('请选择需要操作的数据');
+ }
+ if (!in_array($autoStatus, [0, 1])) {
+ $this->error('参数错误');
+ }
+
+ $map['id'] = ['in', $promoteIds];
+ $time = time();
+ $save['auto_review_withdraw_status'] = $autoStatus;
+ $save['auto_review_withdraw_updated_time'] = $time;
+
+ $result = D('promote')->where($map)->save($save);
+ if ($result === false) {
+ $this->error('操作失败');
+ } else {
+ $this->success('操作成功');
+ }
+ } else {
+ $page = intval(I('p', 1));
+ $row = intval(I('row', 10));
+ $companyId = intval(I('company_id', 0));
+ $promoteId = intval(I('promote_id', 0));
+ $autoReviewWithdrawStatus = I('status', '');
+
+ if ($companyId > 0) {
+ $map['company_id'] =$companyId;
+ }
+ if ($promoteId > 0) {
+ $map['id'] =$promoteId;
+ }
+ if ($autoReviewWithdrawStatus !== '') {
+ $map['auto_review_withdraw_status'] = $autoReviewWithdrawStatus;
+ }
+ $map['level'] = 1;
+ $field = 'id, account, company_id, auto_review_withdraw_status';
+ $promotes = D('promote')->field($field)
+ ->where($map)
+ ->order('auto_review_withdraw_updated_time desc')
+ ->page($page, $row)
+ ->select();
+ $count = D('promote')->field($field)
+ ->where($map)
+ ->count();
+
+ $companys = getPromoteCompanys();
+ $companyList = array_column($companys, 'company_name', 'id');
+ $promoteList = (new PromoteModel())->getPromotersByLevel();
+
+ $records = [];
+ if (!empty($promotes)) {
+ foreach ($promotes as $promote) {
+ $promote['company_name'] = $companyList[$promote['company_id']] ?? '未知';
+ if ($promote['auto_review_withdraw_status'] == 0) {
+ $className = 'auto-closed';
+ $text = '关闭';
+ } else {
+ $className = 'auto-open';
+ $text = '开启';
+ }
+ $promote['auto_review_withdraw_status_text'] = "{$text}";
+ $records[] = $promote;
+ }
+ }
+
+ $page = set_pagination($count, $row);
+ if($page) {
+ $this->assign('_page', $page);
+ }
+ $this->assign('meta_title', '推广提现自动审核管理');
+ $this->assign('records', $records);
+ $this->assign('count', $count);
+ $this->assign('companys', $companys);
+ $this->assign('promoteList', $promoteList);
+ $this->display('auto_review');
+ }
+ }
}
diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php
index d4efe6dd4..e937a96a6 100644
--- a/Application/Admin/Model/WithdrawModel.class.php
+++ b/Application/Admin/Model/WithdrawModel.class.php
@@ -193,7 +193,7 @@ class WithdrawModel extends Model{
$add['promote_id'] = $promote['id'];
$add['promote_account'] = $promote['account'];
$add['create_time'] = $thisTime;
- $add['status'] = 0;
+ $add['status'] = ($promote['auto_review_withdraw_status'] == 1) ? 1 : 0;
$add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber(1);
$add['settlement_begin_time'] = $settlementBeginTime;
$add['settlement_end_time'] = $settlementEndTime;
@@ -279,9 +279,16 @@ class WithdrawModel extends Model{
->find()['sum_amount'];
$sumAmount = $sumAmount ?? 0;
foreach ($turnoverRatios as $turnoverRatio) {
- if ($sumAmount >= $turnoverRatio['turnover']) {
- $ratio = $turnoverRatio['ratio'];
- break;
+ if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) {
+ if ($sumAmount >= $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
+ } else {
+ if ($sumAmount > $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
}
}
@@ -322,7 +329,7 @@ class WithdrawModel extends Model{
$add['promote_id'] = $promote['id'];
$add['promote_account'] = $promote['account'];
$add['create_time'] = $thisTime;
- $add['status'] = 0;
+ $add['status'] = ($promote['auto_review_withdraw_status'] == 1) ? 1 : 0;
$add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber(2);
$add['settlement_begin_time'] = $settlementBeginTime;
$add['settlement_end_time'] = $settlementEndTime;
@@ -400,9 +407,16 @@ class WithdrawModel extends Model{
$sumAmount = $sumAmount ?? 0;
$ratio = 0;
foreach ($turnoverRatios as $turnoverRatio) {
- if ($sumAmount >= $turnoverRatio['turnover']) {
- $ratio = $turnoverRatio['ratio'];
- break;
+ if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) {
+ if ($sumAmount >= $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
+ } else {
+ if ($sumAmount > $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
}
}
@@ -433,7 +447,7 @@ class WithdrawModel extends Model{
$add['promote_id'] = $promote['id'];
$add['promote_account'] = $promote['account'];
$add['create_time'] = $thisTime;
- $add['status'] = 0;
+ $add['status'] = ($promote['auto_review_withdraw_status'] == 1) ? 1 : 0;
$add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber(3);
$add['settlement_begin_time'] = $settlementBeginTime;
$add['settlement_end_time'] = $settlementEndTime;
@@ -486,9 +500,16 @@ class WithdrawModel extends Model{
$sumAmount = $sumAmount ?? 0;
$ratio = 0;
foreach ($turnoverRatios as $turnoverRatio) {
- if ($sumAmount >= $turnoverRatio['turnover']) {
- $ratio = $turnoverRatio['ratio'];
- break;
+ if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) {
+ if ($sumAmount >= $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
+ } else {
+ if ($sumAmount > $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
}
}
@@ -543,9 +564,16 @@ class WithdrawModel extends Model{
->find()['sum_amount'];
$sumAmount = $sumAmount ?? 0;
foreach ($turnoverRatios as $turnoverRatio) {
- if ($sumAmount >= $turnoverRatio['turnover']) {
- $ratio = $turnoverRatio['ratio'];
- break;
+ if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) {
+ if ($sumAmount >= $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
+ } else {
+ if ($sumAmount > $turnoverRatio['turnover']) {
+ $ratio = $turnoverRatio['ratio'];
+ break;
+ }
}
}
diff --git a/Application/Admin/View/PromoteGameRatio/applyRatio.html b/Application/Admin/View/PromoteGameRatio/applyRatio.html
index a75a45d7a..ddb97a3c4 100644
--- a/Application/Admin/View/PromoteGameRatio/applyRatio.html
+++ b/Application/Admin/View/PromoteGameRatio/applyRatio.html
@@ -81,8 +81,26 @@
*会长账号: | +*推广公司: | + + + | +||||||||||||||||||||||||||
*会长账号: | +{$data.widthdraw_number} | {$data.sum_money} | -- - {:get_promote_name($data['promote_id'])} - | -
- |
- {:getPromoteWithdrawOpType($data['op_type'])} | -
- |
- {:getPromoteWithdrawOpType($data['last_op_type'])} | -{:getPromoteWithdrawSettlementType($data['settlement_type'])} | -style="color: #999;">{:promoteWithdrawStatus($data['status'])} | +{$data.company_name} | +{$data.promote_account} | +{$data.op_id_text} | +{$data.op_type_text} | +{$data.last_op_id_text} | +{$data.last_op_type_text} | +{$data.settlement_type_text} | +{$data.settlement_begin_time} | +{$data.settlement_end_time} | +{$data.create_time} | +{$data.status_text} | {$data.respond} | -{$data.audit_time} |
|