From e447159971d19b6acaf4f026c3ccbb38a1850de0 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 14:20:57 +0800
Subject: [PATCH 01/51] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E5=88=86=E6=88=90?=
=?UTF-8?q?=E7=AE=A1=E7=90=86--=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Admin/Common/function.php | 10 +
.../PromoteGameRatioController.class.php | 27 +-
.../Controller/QueryController.class.php | 352 ++++++----
.../Admin/Model/WithdrawModel.class.php | 9 +-
Application/Admin/View/Query/settlement.html | 630 +++++-------------
Application/Admin/View/Query/withdraw.html | 32 +-
Application/Common/Common/function.php | 11 +
Data/update.sql | 11 +-
8 files changed, 467 insertions(+), 615 deletions(-)
diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php
index 3664cde6a..9b749034f 100644
--- a/Application/Admin/Common/function.php
+++ b/Application/Admin/Common/function.php
@@ -775,4 +775,14 @@ function camelize($str, $separator = '_', $littleHump = false)
function unCamelize($str, $separator = '_')
{
return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $str));
+}
+
+//获取管理员账号
+function getAdminNickname($adminId)
+{
+ $adminId = intval($adminId);
+ if ($adminId) {
+ return M('member')->where(array('id' => $adminId))->getField('nickname');
+ }
+ return '未知';
}
\ No newline at end of file
diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php
index 7952b4fa2..a31929b24 100644
--- a/Application/Admin/Controller/PromoteGameRatioController.class.php
+++ b/Application/Admin/Controller/PromoteGameRatioController.class.php
@@ -62,7 +62,7 @@ class PromoteGameRatioController extends ThinkController
$thisPromoteAccount = '未知';
$thisPromoteMobilePhone = '未知';
$thisPromoteCreateTime = '未知';
- $thisPromoteStatus = '未知';
+ $thisPromoteStatus = '待审核';
$thisPromoteVerStatus = '未知';
$thisGameName = '未知';
$thisGameRatio = '0.00';
@@ -79,9 +79,9 @@ class PromoteGameRatioController extends ThinkController
$thisPromoteAccount = $promotes[$thisPromoteId]['account'];
$thisPromoteMobilePhone = $promotes[$thisPromoteId]['mobile_phone'];
$thisPromoteCreateTime = date('Y-m-d H:i:s', $promotes[$thisPromoteId]['create_time']);
- $thisPromoteStatus = get_status_title($promotes[$thisPromoteId]['status']);
- $thisPromoteStatus = $thisPromoteStatus ?? '未知';
- $thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['status'], 2);
+ $thisPromoteStatus = get_info_status($promotes[$thisPromoteId]['status'], 3);
+ $thisPromoteStatus = $thisPromoteStatus ?? '待审核';
+ $thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['ver_status'], 2);
}
if ($issetGame) {
$thisGameName = $games[$thisGameId]['game_name'];
@@ -146,16 +146,19 @@ class PromoteGameRatioController extends ThinkController
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
+ if ($save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) {
+ $promoteId = $promoteGameRatio['promote_id'];
+ $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据
- $promoteId = $promoteGameRatio['promote_id'];
- $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据
-
- if ($promoteGameRatio['status'] == 1) {
- $save['last_ratio'] = $promoteGameRatio['ratio'];
- $save['last_ratio_status'] = 1;
+ if ($promoteGameRatio['status'] == 1) {
+ $save['last_ratio'] = $promoteGameRatio['ratio'];
+ $save['last_ratio_status'] = 1;
+ }
+ $save['id'] = intval($params['id']);
+ $result = D(self::MODEL_NAME)->save($save);
+ } else {
+ $result = true;
}
- $save['id'] = intval($params['id']);
- $result = D(self::MODEL_NAME)->save($save);
} else {//新增
if (empty($params['promote_id'])) {
$this->error('请选择会长账号');
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 99a3a3e77..49bf60ecb 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -3,6 +3,7 @@
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
+use Admin\Model\WithdrawModel;
/**
* 推广查询控制器
@@ -10,164 +11,238 @@ use User\Api\UserApi as UserApi;
*/
class QueryController extends ThinkController
{
- public function settlement($p = 0)
+ //生成提现单号
+ private function produceWithdrawNumber()
{
+ $prefix = 'WD_';
+ $number = '';
+ while (true) {
+ $randomNum = rand(10, 99);
+ $number = $prefix . time() . $randomNum;
+ $map['widthdraw_number'] = $number;
+ $res = M('withdraw', 'tab_')->where($map)->getField('id');
+ if (!$res) {
+ break;
+ }
+ }
+ return $number;
+ }
+ public function settlement($p = 0)
+ {
+ $page = intval(I('p', 1)); //默认显示第一页数据
+ $row = intval(I('row', 10));
$group = I('group', 1);
$this->assign('group', $group);
- if (isset($_REQUEST['total_status'])) {
- unset($_REQUEST['total_status']);
- }
-
- $this->m_title = '推广结算';
- $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Query/settlement', 'status' => 1])->find());
+ $promoteId = I('promote_id', 0);
if ($group == 1) {
- if ($_REQUEST['unum'] == 2) {
- $order = 'unum';
- $order_type = SORT_ASC;
- } else if ($_REQUEST['unum'] == 1) {
- $order = 'unum';
- $order_type = SORT_DESC;
- }
- if ($_REQUEST['spay_amount'] == 2) {
- $order = 'spay_amount';
- $order_type = SORT_ASC;
- } else if ($_REQUEST['spay_amount'] == 1) {
- $order = 'spay_amount';
- $order_type = SORT_DESC;
- }
- $model = array(
- 'title' => '渠道结算',
- 'template_list' => 'settlement',
- 'order' => $order,
- 'order_type' => $order_type//0倒序 1 正序
- );
- $start = $_REQUEST['timestart'];
- $end = $_REQUEST['timeend'];
- if (I('group') != '') {
- if ($start == '' || $end == '' && $_REQUEST['promote_account'] == '') {
- $this->error('结算周期、所属渠道不能为空!', '', 1);
+ if (empty($promoteId)) {
+ $this->display();
+ } else {
+ $promoteIds = M('promote', 'tab_')->where(['chain' => ['like', "/{$promoteId}/%"]])->getField('id', true);
+ $promoteIds[] = $promoteId;
+ $beginTime = I('timestart', get_lastweek_name(7));
+ $endTime = I('timeend', get_lastweek_name(1));
+ $sortBy = I('sort_by', '');
+ $sortColumn = I('sort_column', '');
+ $order = 'tab_spend.pay_time';
+ $orderType = 'desc';
+
+ if (in_array($sortColumn, ['user_num', 'sum_amount'])) {
+ $order = $sortColumn;
}
- if ($start == '' || $end == '') {
- $this->error('请选择结算周期!', '', 1);
+ if ($sortBy == 1) {
+ $orderType = 'desc';
+ } elseif ($sortBy == 2) {
+ $orderType = 'asc';
}
- if ($_REQUEST['promote_account'] == '') {
- $this->error('请选择渠道!', '', 1);
+ $beginTime = strtotime($beginTime);
+ $endTime = strtotime($endTime) + 3600 * 24 - 1;
+
+ $spendMap['tab_spend.pay_status'] = 1;
+ $spendMap['tab_spend.selle_status'] = 0;
+ $spendMap['tab_spend.pay_time'] = ['between', [$beginTime, $endTime]];
+ $spendMap['tab_spend.promote_id'] = ['in', $promoteIds];
+ $spendField = 'tab_spend.promote_account, tab_spend.game_name, sum(tab_spend.pay_amount) as sum_amount, tab_spend.selle_ratio, sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount';
+ $userMap['tab_user.promote_id'] = ['in', $promoteIds];
+ $userMap['_string'] = 'tab_user.promote_id = tab_spend.promote_id';
+ $userField = M('user', 'tab_')->field('count(tab_user.id) as user_num')
+ ->where($userMap)
+ ->buildSql();
+ $field = "{$spendField}, {$userField} as user_num";
+
+ $query = M('spend', 'tab_')->field($field)
+ ->where($spendMap)
+ ->group('tab_spend.selle_ratio, tab_spend.game_id, tab_spend.promote_id')
+ ->order("{$order} {$orderType}")
+ ->page($page, $row)
+ ->buildSql();
+ $records = M()->table($query)
+ ->alias('record')
+ ->select();
+ $countQuery = M('spend', 'tab_')->field('tab_spend.id')
+ ->where($spendMap)
+ ->group('tab_spend.selle_ratio, tab_spend.game_id, tab_spend.promote_id')
+ ->buildSql();
+ $count = M()->table($countQuery)
+ ->alias('tab_spend')
+ ->count();
+ $page = set_pagination($count, $row);
+
+ if (!empty($records)) {
+ $promote = M('promote', 'tab_')->find($promoteId);
+ foreach ($records as &$record) {
+ $record['promote_account'] = $promote['account'] ?? '未知';
+ $record['settlement_amount'] = bcdiv($record['settlement_amount'], 100, 2);
+ }
}
- }
- $smap['tab_spend.pay_status'] = 1;
- //判断是否结算绑币
- if ($_REQUEST['bind_coin'] == 0) {
- $smap['tab_spend.pay_way'] = array('neq', -1);
- }
- $this->meta_title = '渠道结算列表';
- $this->assign('setdate', date("Y-m-d", strtotime("-1 day")));
- $this->assign('is_admin', is_administrator());
- if ($start && $end) {
- if ((strtotime($end) + 24 * 60 * 60 - 1) < strtotime($start)) {
- $this->error('时间选择不正确!', U('Query/settlement'), '');
- }
- $umap['register_time'] = array('BETWEEN', array(strtotime($start), strtotime($end) + 24 * 60 * 60 - 1));
- if (isset($_REQUEST['game_name']) && $_REQUEST['game_name'] != '') {
- $umap['fgame_id'] = get_game_id($_REQUEST['game_name']);
- $smap['tab_spend.game_id'] = get_game_id($_REQUEST['game_name']);
- }
- if (isset($_REQUEST['promote_account']) && $_REQUEST['promote_account'] != '') {
- $allid = get_subordinate_promote_($_REQUEST['promote_account']);
- $allid[] = $_REQUEST['promote_account'];
- $umap['tab_user.promote_account'] = array('in', $allid);
- $smap['tab_spend.promote_account'] = array('in', $allid);
- } else {
- $this->error('未选择渠道!', '', 1);
+ $totalField = 'sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount';
+ $total = array_sum(array_column($records, 'settlement_amount'));//当页
+ $zTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//累计
+ $zTotal = bcdiv($zTotal, 100 ,2);
+ unset($spendMap['tab_spend.pay_time']);
+ $spendMap['_string'] = 'tab_spend.pay_time' . total(1);
+ $tTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//今日
+ $tTotal = bcdiv($tTotal, 100 ,2);
+ $spendMap['_string'] = 'tab_spend.pay_time' . total(5);
+ $yTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//昨日
+ $yTotal = bcdiv($yTotal, 100 ,2);
+
+ if($page) {
+ $this->assign('_page', $page);
}
- $umap['is_check'] = 1;
- $umap['settle_check'] = 0;
- $smap['pay_time'] = array('BETWEEN', array(strtotime($start), strtotime($end) + 24 * 60 * 60 - 1));
- $smap['is_check'] = 1;
- $smap['settle_check'] = 0;
- //为数据权限添加
- setPowerPromoteIds($umap, 'tab_user.promote_id');
- setPowerPromoteIds($smap, 'tab_spend.promote_id');
- $map['umap'] = $umap;
- $map['smap'] = $smap;
-
- $user = A('Settlement', 'Event');
-
-
- $user->settlement($model, $p, $map);
- } else {
+ $this->assign('records', $records);
+ $this->assign('total', $total);
+ $this->assign('tTotal', $tTotal);
+ $this->assign('yTotal', $yTotal);
+ $this->assign('zTotal', $zTotal);
+ $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Query/settlement', 'status' => 1])->find());
+ $this->m_title = '推广结算';
$this->display();
}
- }
- if ($group == 2) {
- if (isset($_REQUEST['stimestart']) && isset($_REQUEST['stimeend'])) {
- $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['stimestart']), strtotime($_REQUEST['stimeend']) + 24 * 60 * 60 - 1));
- } elseif (isset($_REQUEST['stimestart'])) {
- $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['stimestart']), time()));
- } elseif (isset($_REQUEST['stimeend'])) {
- $map['create_time'] = array('LT', (strtotime($_REQUEST['stimeend']) + 24 * 60 * 60 - 1));
- }
- if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
- $map['starttime'] = ['GT', strtotime($_REQUEST['timestart'])];
- $map['endtime'] = ['LT', strtotime($_REQUEST['timeend']) + 24 * 60 * 60];
- } elseif (isset($_REQUEST['timestart'])) {
- $map['starttime'] = ['GT', strtotime($_REQUEST['timestart'])];
- } elseif (isset($_REQUEST['timeend'])) {
- $map['endtime'] = ['LT', strtotime($_REQUEST['timeend']) + 24 * 60 * 60];
- }
- if (isset($_REQUEST['game_name'])) {
- if ($_REQUEST['game_name'] == '全部') {
- unset($_REQUEST['game_name']);
- } else {
- $map['game_name'] = $_REQUEST['game_name'];
- }
- }
- if (isset($_REQUEST['promote_account'])) {
- if ($_REQUEST['promote_account'] == '全部') {
- unset($_REQUEST['promote_account']);
- } else {
- $map['promote_account'] = $_REQUEST['promote_account'];
- }
+ } elseif ($group == 2) {
+ $createTime = strtotime(I('create_time', ''));
+ if ($createTime) {
+ $createTimeEnd = $createTime + 3600 * 24 - 1;
+ $map['create_time'] = ['between', [$createTime, $createTimeEnd]];
}
- if (!empty($_REQUEST['settlement_number'])) {
- $map['settlement_number'] = $_REQUEST['settlement_number'];
+ if ($promoteId) {
+ $map['promote_id'] = $promoteId;
}
- $map['developers'] = 0;
+ $records = M('withdraw', 'tab_');
+ $this->display();
+ }
+ }
- $model = array(
- 'm_name' => 'settlement',
- 'fields' => array(
- 'settlement_number',
- 'starttime', 'endtime',
- 'promote_id', 'promote_account',
- 'sum(total_money) as total_money',
- 'sum(total_number) as total_number',
- 'sum(sum_money) as sum_money',
- 'bind_coin_status',
- 'create_time'),
- 'group' => 'promote_id,starttime,endtime,create_time,bind_coin_status',
- 'order' => 'create_time desc ',
- 'title' => '结算账单',
- 'template_list' => 'settlement',
- );
- //为数据权限添加
- setPowerPromoteIds($map);
- $map1 = $map;
+ public function settlementWithdraw()
+ {
+ $beginTime = strtotime(I('begin_time', ''));
+ $endTime = strtotime(I('end_time', ''));
+ $promoteId = intval(I('promote_id', 0));
+ if ($beginTime == 0 || $endTime == 0) {
+ $data['status'] = 0;
+ $data['msg'] = '时间参数错误';
+ $this->ajaxReturn($data);
+ }
+ if ($beginTime > $endTime) {
+ $data['status'] = 0;
+ $data['msg'] = '开始时间必须小于等于结束时间';
+ $this->ajaxReturn($data);
+ }
+ if ($promoteId == 0) {
+ $data['status'] = 0;
+ $data['msg'] = '请选择会长账号';
+ $this->ajaxReturn($data);
+ }
+
+ $promote = M('promote', 'tab_')->find($promoteId);
+ if (empty($promote)) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+ if ($promote['level'] != 1) {
+ $data['status'] = 0;
+ $data['msg'] = '非会长账号,无法执行此操作';
+ $this->ajaxReturn($data);
+ }
+ if ($promote['ver_status'] != 1) {
+ $data['status'] = 0;
+ $data['msg'] = '该会长未通过资质认证审核,暂时无法提现';
+ $this->ajaxReturn($data);
+ }
+
+ $endTime += 3600 * 24 - 1;
+ $spendModel = M('spend', 'tab_');
+ $map['chain'] = ['like', $promote['chain'] . $promote['id'] . '/%'];
+ $promoteIds = M('promote', 'tab_')->where($map)->getField('id', true);
+ $promoteIds[] = $promote['id'];
+ $promoteIds = implode(',', $promoteIds);
+
+ $map = [];
+ $map['pay_status'] = 1;
+ $map['selle_status'] = 0;
+ $map['promote_id'] = ['in', $promoteIds];
+ $map['pay_time'] = ['between', [$beginTime, $endTime]];
+ $balance = $spendModel->field("sum(pay_amount * selle_ratio) as balance")
+ ->where($map)
+ ->find()['balance'];
+ $balance = bcdiv($balance, 100, 2);
+ if ($balance < 100) {
+ $data['status'] = 0;
+ $data['msg'] = '累计结算低于100元,无法提现!';
+ $this->ajaxReturn($data);
+ }
+ $spendIds = $spendModel->where($map)->getField('id', true);
+ if (empty($spendIds)) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
- $ztotal = null_to_0(D('settlement')->where($map1)->sum('sum_money*10000') / 10000);
- $this->assign('ztotal', $ztotal);
- $ttotal = null_to_0(D('settlement')->where('create_time' . total(1))->sum('sum_money*10000') / 10000);
- $this->assign('ttotal', $ttotal);
- $ytotal = null_to_0(D('settlement')->where('create_time' . total(5))->sum('sum_money*10000') / 10000);
- $this->assign('ytotal', $ytotal);
- $user = A('Bill', 'Event');
+ $thisTime = time();
+ $add['sum_money'] = $balance;
+ $add['promote_id'] = $promote['id'];
+ $add['promote_account'] = $promote['account'];
+ $add['create_time'] = $thisTime;
+ $add['status'] = 0;
+ $add['widthdraw_number'] = $this->produceWithdrawNumber();
+ $add['settlement_begin_time'] = $beginTime;
+ $add['settlement_end_time'] = $endTime;
+ $add['spend_ids'] = '';
+ $add['op_id'] = is_login();
+ $add['op_type'] = 2;
+
+ M()->startTrans();//开启事物
+ $withdrawId = M('withdraw', 'tab_')->add($add);
+ if (!$withdrawId) {
+ M()->rollback();//事物回滚
+ $data['status'] = 0;
+ $data['msg'] = '提现失败';
+ $this->ajaxReturn($data);
+ }
- $user->money_list($model, $p, $map);
+ $map = [];
+ $map['id'] = ['in', $spendIds];
+ $save['selle_status'] = 1;
+ $save['selle_time'] = $thisTime;
+ $save['withdraw_id'] = $withdrawId;
+ $res = $spendModel->where($map)->save($save);
+ if ($res === false) {
+ M('withdraw', 'tab_')->delete($withdrawId);
+ M()->rollback();//事物回滚
+ $data['status'] = 0;
+ $data['msg'] = '提现失败';
+ $this->ajaxReturn($data);
}
+ M()->commit();//事物提交
+ $data['status'] = 1;
+ $data['msg'] = '提现成功';
+ $this->ajaxReturn($data);
}
public function cpsettlement($p = 0)
@@ -664,6 +739,9 @@ class QueryController extends ThinkController
if (isset($_REQUEST['ti_status'])) {
$map['status'] = $_REQUEST['ti_status'];
}
+ if (isset($_REQUEST['op_type'])) {
+ $map['op_type'] = $_REQUEST['op_type'];
+ }
if (isset($_REQUEST['promote_account'])) {
if ($_REQUEST['promote_account'] == '全部') {
unset($_REQUEST['promote_account']);
diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php
index 324bd151c..dd9b57847 100644
--- a/Application/Admin/Model/WithdrawModel.class.php
+++ b/Application/Admin/Model/WithdrawModel.class.php
@@ -15,6 +15,9 @@ use Think\Model;
*/
class WithdrawModel extends Model{
+ const OP_TYPE_PROMOTE = 1;
+ const OP_TYPE_ADMIN = 2;
+
/**
* 构造函数
* @param string $name 模型名称
@@ -28,8 +31,10 @@ class WithdrawModel extends Model{
parent::__construct($name, $tablePrefix, $connection);
}
-
-
+ public static $opTypeList = [
+ self::OP_TYPE_PROMOTE => '推广员',
+ self::OP_TYPE_ADMIN => '管理员',
+ ];
/*
* 开发者提现未处理列表
diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html
index 12512b82d..4e409a67a 100644
--- a/Application/Admin/View/Query/settlement.html
+++ b/Application/Admin/View/Query/settlement.html
@@ -30,98 +30,69 @@
-
-
-
-
推广结算
-
-
- 说明:此功能是针对推广员下面的用户注册充值进行结算,充值数据是指消费到游戏的所有订单记录
-
- 说明:此功能是查看所有的推广员结算记录
-
+
+
推广结算
+
+ 说明:此功能是查看所有的会长未提现订单,并可进行后台提现
+
+ 说明:此功是查看并管理混服申请的功能
+
-
-
-
-
-
-
-
-
-
+
+
-
-
@@ -130,21 +101,13 @@
-
-
- |
- 结算周期 |
- 推广员账号 |
- 游戏名称 |
- 总充值 |
-
- 总注册 |
- 结算模式 |
- 分成比例 |
- 注册单价 |
- 结算金额 |
- 状态 |
-
+ 推广员账号 |
+ 游戏名称 |
+ 总充值 |
+ 总注册 |
+ 结算模式 |
+ 分成比例 |
+ 结算金额 |
@@ -154,205 +117,57 @@
.data-table tbody td{border-right:1px solid #DDDDDD;}
.d_list .drop-down ul {z-index:999;}
-
+
aOh! 暂时还没有内容! |
-
-
-
-
- |
- {:I('timestart')} 至 {:I('timeend')} |
- {:get_promote_name($data['pid'])} |
- {:get_game_name($data['game_id'])} |
- {$data['spay_amount']|default=0} |
- {$data['unum']|default=0} |
-
-
- |
-
- {$data.ratio}0%
- 修改
- |
-
- {$data.money}0
- 修改
- |
-
- {:round($data['spay_amount'] * $data['ratio']/100,2)}
- |
-
- 已结算 |
-
- 可结算 |
-
-
+
+
+ {$record.promote_account} |
+ {$record.game_name} |
+ {$record['sum_amount']|default=0} |
+ {$record['user_num']|default=0} |
+ CPS |
+ {$record['selle_ratio']|default=0}% |
+
+ {$record['settlement_amount']}
+ |
+
+
+ 汇总 |
+ 当页结算:{$total}元 ; 今日结算:{$tTotal}元 ; 昨日结算:{$yTotal}元 ; 累计结算:{$zTotal}元 |
+
-
- 推广员账号 |
- 结算周期 |
- 结算单号 |
- 总充值 |
- 总注册 |
- 结算金额 |
- 结算范畴 |
- 结算时间 |
- 详情 |
+ 推广员账号 |
+ 结算单号 |
+ 结算金额 |
+ 结算开始时间 |
+ 结算截止时间 |
+ 提现时间 |
+ 详情 |
+ 操作 |
-
-
- {:get_promote_name($data['promote_id'])}
-
- {:encryptStr(get_promote_name($data['promote_id']))}
-
- |
- {$data.starttime|date='Y-m-d',###}至{$data.endtime|date='Y-m-d',###} |
+ |
{$data.settlement_number} |
{$data.total_money} |
- {$data.total_number} |
-
- {$data.sum_money}
- |
- {:get_bind_coin_status($data['bind_coin_status'])} |
-
- {$data.create_time|date='Y-m-d',###}
- |
-
- 查看
- |
+ {$data.create_time|date='Y-m-d',###} |
+ {$data.create_time|date='Y-m-d',###} |
+ {$data.create_time|date='Y-m-d',###} |
+ {$data.create_time|date='Y-m-d',###} |
+ {$data.create_time|date='Y-m-d',###} |
@@ -369,7 +184,7 @@
-
+
diff --git a/Application/Admin/View/Query/withdraw.html b/Application/Admin/View/Query/withdraw.html
index 4a3131a7e..204c990a7 100644
--- a/Application/Admin/View/Query/withdraw.html
+++ b/Application/Admin/View/Query/withdraw.html
@@ -78,13 +78,21 @@
-
+
+
+
+ $value) :?>
+
+
+
+
diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php
index c7d4909d2..30fbe85f3 100644
--- a/Application/Common/Common/function.php
+++ b/Application/Common/Common/function.php
@@ -1430,6 +1430,7 @@ if (!function_exists('dd')) {
function promoteWithdrawStatus($status = null)
{
$statusData = [
+ -2 => '已撤销',
-1 => '审核未通过',
0 => '待审核',
1 => '汇款中',
@@ -1443,3 +1444,13 @@ function promoteWithdrawStatus($status = null)
return $statusData;
}
+//获取提现操作人类型
+function getPromoteWithdrawOpType($opType = null)
+{
+ if ($opType) {
+ return Admin\Model\WithdrawModel::$opTypeList[$opType] ?? '未知';
+ } else {
+ return Admin\Model\WithdrawModel::$opTypeList;
+ }
+}
+
diff --git a/Data/update.sql b/Data/update.sql
index 391c988f2..15cae4410 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -915,4 +915,13 @@ ADD COLUMN `beta_url` varchar(150) NOT NULL DEFAULT '' COMMENT 'Beta链接';
-- 游戏支付方式渠道配置
ALTER TABLE `tab_game`
-ADD COLUMN `pay_config` varchar(255) NOT NULL COMMENT '支付渠道 wx 微信 zfb 支付宝 quick 快捷 (gf 官方 sq 双乾';
\ No newline at end of file
+ADD COLUMN `pay_config` varchar(255) NOT NULL COMMENT '支付渠道 wx 微信 zfb 支付宝 quick 快捷 (gf 官方 sq 双乾';
+
+-- 2019-12-30
+-- 会长管理后台提现 cxj
+ALTER TABLE `tab_withdraw`
+ADD COLUMN `settlement_begin_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算开始时间' AFTER `old_promote_account`;
+ALTER TABLE `tab_withdraw`
+ADD COLUMN `op_id` int(11) NOT NULL DEFAULT 0 COMMENT '操作id';
+ALTER TABLE `tab_withdraw`
+ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人:1-推广员 2-管理员';
\ No newline at end of file
From cda8e4c1c0ad8b7d509a8058313f94b9e228243a Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 14:33:12 +0800
Subject: [PATCH 02/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=93=E7=AE=97--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/QueryController.class.php | 16 +++++++++++++-
Application/Admin/View/Query/settlement.html | 21 +++++++++++--------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 49bf60ecb..22631c5e9 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -123,6 +123,7 @@ class QueryController extends ThinkController
$this->display();
}
} elseif ($group == 2) {
+ $map = '1 = 1';
$createTime = strtotime(I('create_time', ''));
if ($createTime) {
$createTimeEnd = $createTime + 3600 * 24 - 1;
@@ -132,7 +133,20 @@ class QueryController extends ThinkController
$map['promote_id'] = $promoteId;
}
- $records = M('withdraw', 'tab_');
+ $records = M('withdraw', 'tab_')->where($map)->select();
+ if (!empty($records)) {
+ foreach ($records as &$record) {
+ $record['settlement_begin_time'] = date('Y-m-d H:i:s', $record['settlement_begin_time']);
+ $record['settlement_end_time'] = date('Y-m-d H:i:s', $record['settlement_end_time']);
+ $record['create_time'] = date('Y-m-d H:i:s', $record['create_time']);
+ $record['status_text'] = promoteWithdrawStatus($record['status']);
+ if ($record['status'] == -2) {
+ $record['status_text'] = '' . $record['status_text'] . '';
+ }
+ }
+ }
+
+ $this->assign('records', $records);
$this->display();
}
}
diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html
index 4e409a67a..3bc44d840 100644
--- a/Application/Admin/View/Query/settlement.html
+++ b/Application/Admin/View/Query/settlement.html
@@ -152,22 +152,25 @@
结算开始时间 |
结算截止时间 |
提现时间 |
- 详情 |
+ 提现状态 |
+ 说明 |
操作 |
-
+
|
- {$data.settlement_number} |
- {$data.total_money} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
+ {$record.promote_account} |
+ {$record.widthdraw_number} |
+ {$record.sum_money} |
+ {$record.settlement_begin_time} |
+ {$record.settlement_end_time} |
+ {$record.create_time} |
+ {$record.status_text} |
+ {$record.respond} |
+ |
From 053417f7f894e6ea6de3664a6b9bacbbf35d373f Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 14:37:05 +0800
Subject: [PATCH 03/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=93=E7=AE=97--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Admin/View/Query/settlement.html | 21 +++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html
index 4e409a67a..3bc44d840 100644
--- a/Application/Admin/View/Query/settlement.html
+++ b/Application/Admin/View/Query/settlement.html
@@ -152,22 +152,25 @@
结算开始时间 |
结算截止时间 |
提现时间 |
- 详情 |
+ 提现状态 |
+ 说明 |
操作 |
-
+
|
- {$data.settlement_number} |
- {$data.total_money} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
- {$data.create_time|date='Y-m-d',###} |
+ {$record.promote_account} |
+ {$record.widthdraw_number} |
+ {$record.sum_money} |
+ {$record.settlement_begin_time} |
+ {$record.settlement_end_time} |
+ {$record.create_time} |
+ {$record.status_text} |
+ {$record.respond} |
+ |
From 311aeffbb7c0335574897959092c5323bf97df9b Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 14:37:31 +0800
Subject: [PATCH 04/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=93=E7=AE=97--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/QueryController.class.php | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 49bf60ecb..22631c5e9 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -123,6 +123,7 @@ class QueryController extends ThinkController
$this->display();
}
} elseif ($group == 2) {
+ $map = '1 = 1';
$createTime = strtotime(I('create_time', ''));
if ($createTime) {
$createTimeEnd = $createTime + 3600 * 24 - 1;
@@ -132,7 +133,20 @@ class QueryController extends ThinkController
$map['promote_id'] = $promoteId;
}
- $records = M('withdraw', 'tab_');
+ $records = M('withdraw', 'tab_')->where($map)->select();
+ if (!empty($records)) {
+ foreach ($records as &$record) {
+ $record['settlement_begin_time'] = date('Y-m-d H:i:s', $record['settlement_begin_time']);
+ $record['settlement_end_time'] = date('Y-m-d H:i:s', $record['settlement_end_time']);
+ $record['create_time'] = date('Y-m-d H:i:s', $record['create_time']);
+ $record['status_text'] = promoteWithdrawStatus($record['status']);
+ if ($record['status'] == -2) {
+ $record['status_text'] = '' . $record['status_text'] . '';
+ }
+ }
+ }
+
+ $this->assign('records', $records);
$this->display();
}
}
From 15174f85477f1d50ff4cc7f3acafa8dabebe57d2 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 16:41:12 +0800
Subject: [PATCH 05/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=93=E7=AE=97--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Admin/Common/function.php | 10 --
.../Controller/QueryController.class.php | 124 +++++++++++++++-
Application/Admin/View/Query/settlement.html | 132 +++++++++++++++---
Application/Admin/View/Query/withdraw.html | 10 ++
Application/Common/Common/function.php | 9 ++
.../Controller/FinanceController.class.php | 7 +-
.../View/default/Finance/withdrawRecord.html | 10 ++
Data/update.sql | 5 +-
8 files changed, 275 insertions(+), 32 deletions(-)
diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php
index 9b749034f..3664cde6a 100644
--- a/Application/Admin/Common/function.php
+++ b/Application/Admin/Common/function.php
@@ -775,14 +775,4 @@ function camelize($str, $separator = '_', $littleHump = false)
function unCamelize($str, $separator = '_')
{
return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $str));
-}
-
-//获取管理员账号
-function getAdminNickname($adminId)
-{
- $adminId = intval($adminId);
- if ($adminId) {
- return M('member')->where(array('id' => $adminId))->getField('nickname');
- }
- return '未知';
}
\ No newline at end of file
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 22631c5e9..ecc99b178 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -2,6 +2,7 @@
namespace Admin\Controller;
+use Home\Controller\FileController;
use User\Api\UserApi as UserApi;
use Admin\Model\WithdrawModel;
@@ -123,8 +124,11 @@ class QueryController extends ThinkController
$this->display();
}
} elseif ($group == 2) {
- $map = '1 = 1';
+ $map['_string'] = '1 = 1';
$createTime = strtotime(I('create_time', ''));
+ $withdrawNumber = I('widthdraw_number', '');
+ $status = intval(I('status', ''));
+ $opType = intval(I('op_type', 0));
if ($createTime) {
$createTimeEnd = $createTime + 3600 * 24 - 1;
$map['create_time'] = ['between', [$createTime, $createTimeEnd]];
@@ -132,11 +136,27 @@ class QueryController extends ThinkController
if ($promoteId) {
$map['promote_id'] = $promoteId;
}
+ if ($withdrawNumber) {
+ $map['widthdraw_number'] = ['like', "{$withdrawNumber}%"];
+ }
+ if (isset($_REQUEST['status'])) {
+ $map['status'] = $status;
+ }
+ if ($opType) {
+ $map['op_type'] = $opType;
+ }
- $records = M('withdraw', 'tab_')->where($map)->select();
+ $records = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond')
+ ->where($map)
+ ->order('')
+ ->page($page, $row)
+ ->select();
+ $count = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond')
+ ->where($map)
+ ->count();
if (!empty($records)) {
foreach ($records as &$record) {
- $record['settlement_begin_time'] = date('Y-m-d H:i:s', $record['settlement_begin_time']);
+ $record['settlement_begin_time'] = $record['settlement_begin_time'] ? date('Y-m-d H:i:s', $record['settlement_begin_time']) : '--';
$record['settlement_end_time'] = date('Y-m-d H:i:s', $record['settlement_end_time']);
$record['create_time'] = date('Y-m-d H:i:s', $record['create_time']);
$record['status_text'] = promoteWithdrawStatus($record['status']);
@@ -146,6 +166,10 @@ class QueryController extends ThinkController
}
}
+ $page = set_pagination($count, $row);
+ if($page) {
+ $this->assign('_page', $page);
+ }
$this->assign('records', $records);
$this->display();
}
@@ -229,6 +253,8 @@ class QueryController extends ThinkController
$add['spend_ids'] = '';
$add['op_id'] = is_login();
$add['op_type'] = 2;
+ $add['last_op_id'] = $add['op_id'];
+ $add['last_op_type'] = 2;
M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add);
@@ -259,6 +285,98 @@ class QueryController extends ThinkController
$this->ajaxReturn($data);
}
+ public function renewReview()
+ {
+ $id = intval(I('id', 0));
+ $data = M('withdraw', 'tab_')->find($id);
+ if (empty($data) || $data['status'] != -1) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+
+ $save['id'] = $id;
+ $save['status'] = 0;
+ $save['last_up_update_time'] = time();
+ $save['last_op_id'] = is_login();
+ $save['last_op_type'] = 2;
+ $res = M('withdraw', 'tab_')->save($save);
+ if ($res === false) {
+ $data['status'] = 0;
+ $data['msg'] = '提交失败';
+ } else {
+ $data['status'] = 1;
+ $data['msg'] = '提交成功';
+ }
+ $this->ajaxReturn($data);
+ }
+
+ public function cancelWithdraw()
+ {
+ $id = intval(I('id', 0));
+ $data = M('withdraw', 'tab_')->find($id);
+ if (empty($data) || !in_array($data['status'], [-1, 0])) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+
+ $spendMap['withdraw_id'] = $id;
+ $spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true);
+ if (empty($spendIds)) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+ $spendIds = implode(',', $spendIds);
+ $time = time();
+ $withdrawSave['id'] = $id;
+ $withdrawSave['status'] = -2;
+ $withdrawSave['spend_ids'] = $spendIds;
+ $withdrawSave['last_up_update_time'] = $time;
+ $withdrawSave['last_op_id'] = is_login();
+ $withdrawSave['last_op_type'] = 2;
+
+ M('withdraw', 'tab_')->startTrans();//开启事物
+ $withdrawRes = M('withdraw', 'tab_')->save($withdrawSave);
+ if ($withdrawRes === false) {
+ M('withdraw', 'tab_')->rollback();//事物回滚
+ $data['status'] = 0;
+ $data['msg'] = '撤销失败';
+ $this->ajaxReturn($data);
+ }
+
+ $spendSave['selle_status'] = 0;
+ $spendSave['withdraw_id'] = 0;
+ $spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave);
+ if ($spendRes === false) {
+ M('withdraw', 'tab_')->rollback();//事物回滚
+ $data['status'] = 0;
+ $data['msg'] = '撤销失败';
+ } else {
+ M('withdraw', 'tab_')->commit();//事物提交
+ $data['status'] = 1;
+ $data['msg'] = '撤销成功';
+ }
+ $this->ajaxReturn($data);
+ }
+
+ public function downloadProve()
+ {
+ $id = intval(I('id', 0));
+ if ($id) {
+ $withdraw = M('withdraw', 'tab_')->find($id);
+ if (empty($withdraw) || $withdraw['status'] != 2 || !$withdraw['transfer_proof']) {
+ $this->error('网络异常');
+ }
+
+ $file = new FileController();
+ $file->download($withdraw['transfer_proof']);
+ } else {
+ $this->error('参数异常');
+ }
+ }
+
public function cpsettlement($p = 0)
{
$page = intval($p);
diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html
index 3bc44d840..f059ca622 100644
--- a/Application/Admin/View/Query/settlement.html
+++ b/Application/Admin/View/Query/settlement.html
@@ -45,7 +45,9 @@
-
+
+
+
+
+
+
+ $value) :?>
+
+
+
+
+
+
+
+ $value) :?>
+
+
+
+
@@ -149,6 +169,10 @@
推广员账号 |
结算单号 |
结算金额 |
+ 操作人 |
+ 操作人类型 |
+ 最后操作人 |
+ 最后操作人类型 |
结算开始时间 |
结算截止时间 |
提现时间 |
@@ -161,22 +185,42 @@
- |
- {$record.promote_account} |
- {$record.widthdraw_number} |
- {$record.sum_money} |
- {$record.settlement_begin_time} |
- {$record.settlement_end_time} |
- {$record.create_time} |
- {$record.status_text} |
- {$record.respond} |
- |
+ {$record.promote_account} |
+ {$record.widthdraw_number} |
+ {$record.sum_money} |
+
+
+ {:get_promote_name($record['op_id'])}
+
+ {:getAdminNickname($record['op_id'])}
+
+ |
+ {:getPromoteWithdrawOpType($record['op_type'])} |
+
+
+ {:get_promote_name($record['last_op_id'])}
+
+ {:getAdminNickname($record['last_op_id'])}
+
+ |
+ {:getPromoteWithdrawOpType($record['last_op_type'])} |
+ {$record.settlement_begin_time} |
+ {$record.settlement_end_time} |
+ {$record.create_time} |
+ {$record.status_text} |
+ {$record.respond} |
+
+
+ 汇款证明
+
+ 重新审核
+
+
+ 撤销提现
+
+ |
-
- 汇总 |
- 当页结算:{$total}元 ; 今日结算:{$ttotal}元 ; 昨日结算:{$ytotal}元 ; 累计结算:{$ztotal}元 |
-
@@ -239,7 +283,8 @@
var url = $(this).attr('url');
var query = $('.top_nav_list').find('input').serialize();
var promoteId = $('#promote_id').val();
- if (promoteId == '') {
+ var group = parseInt("{$group}");
+ if (promoteId == '' && group === 1) {
layer.msg('请选择推广员', {time: 1000});
return false;
}
@@ -378,5 +423,58 @@
});
});
});
+
+ $('.renew-review').click(function () {
+ var id = parseInt($(this).attr('data-id'));
+
+ $.ajax({
+ type: 'post',
+ url: '{:U("renewReview")}',
+ dataType: 'json',
+ data: {id:id},
+ success: function (data) {
+ if (data.status == 1) {
+ layer.msg(data.msg, {icon: 1});
+ setTimeout(function(){
+ window.location.reload();
+ },2000);
+ } else {
+ layer.msg(data.msg, {icon: 5});
+ }
+ },
+ error: function (result) {
+ layer.msg('网络异常', {icon: 5});
+ }
+ });
+ });
+
+ $('.cancel-withdraw').click(function () {
+ var id = parseInt($(this).attr('data-id'));
+ var msg = "确定要撤销提现吗?";
+ layer.confirm(msg, {
+ title: '提示',
+ btn: ['确定', '取消'],
+ }, function () {
+ $.ajax({
+ type: 'post',
+ url: '{:U("cancelWithdraw")}',
+ dataType: 'json',
+ data: {id:id},
+ success: function (data) {
+ if (data.status == 1) {
+ layer.msg(data.msg, {icon: 1});
+ setTimeout(function(){
+ window.location.reload();
+ },2000);
+ } else {
+ layer.msg(data.msg, {icon: 5});
+ }
+ },
+ error: function (result) {
+ layer.msg('网络异常', {icon: 5});
+ }
+ });
+ });
+ });
diff --git a/Application/Admin/View/Query/withdraw.html b/Application/Admin/View/Query/withdraw.html
index 204c990a7..326afd8e5 100644
--- a/Application/Admin/View/Query/withdraw.html
+++ b/Application/Admin/View/Query/withdraw.html
@@ -118,6 +118,8 @@
推广员账号 |
操作人 |
操作人类型 |
+ 最后操作人 |
+ 最后操作人类型 |
结算开始时间 |
结算截止时间 |
申请时间 |
@@ -162,6 +164,14 @@
{:getPromoteWithdrawOpType($data['op_type'])} |
+
+
+ {:get_promote_name($data['last_op_id'])}
+
+ {:getAdminNickname($data['last_op_id'])}
+
+ |
+ {:getPromoteWithdrawOpType($data['last_op_type'])} |
{$data.settlement_begin_time|date='Y-m-d H:i:s',###}--- |
{$data.settlement_end_time|date='Y-m-d H:i:s',###}--- |
{$data.create_time|date='Y-m-d H:i:s',###}--- |
diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php
index 30fbe85f3..b45da22c6 100644
--- a/Application/Common/Common/function.php
+++ b/Application/Common/Common/function.php
@@ -1454,3 +1454,12 @@ function getPromoteWithdrawOpType($opType = null)
}
}
+//获取管理员账号
+function getAdminNickname($adminId)
+{
+ $adminId = intval($adminId);
+ if ($adminId) {
+ return M('member')->where(array('id' => $adminId))->getField('nickname');
+ }
+ return '未知';
+}
diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php
index c0c245b2e..8b2a1d423 100644
--- a/Application/Home/Controller/FinanceController.class.php
+++ b/Application/Home/Controller/FinanceController.class.php
@@ -414,7 +414,7 @@ class FinanceController extends BaseController
}
}
- $data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof')
+ $data = $model->field('id, widthdraw_number, create_time, settlement_begin_time, settlement_end_time, sum_money, status, respond, transfer_proof, op_id, op_type, last_op_id, last_op_type')
->where($map)
->order('id desc')
->page($page, $row)
@@ -426,8 +426,13 @@ class FinanceController extends BaseController
if (!empty($data)) {
foreach ($data as &$list) {
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
+ $list['settlement_begin_time'] = $list['settlement_begin_time'] ? date('Y-m-d H:i:s', $list['settlement_begin_time']) : '--';
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status_name'] = FinanceController::$withdrawStatus[$list['status']];
+ $list['op_id'] = ($list['op_type'] == 1) ? get_promote_name($list['op_id']) : getAdminNickname($list['op_id']);
+ $list['last_op_id'] = ($list['last_op_type'] == 1) ? get_promote_name($list['last_op_id']) : getAdminNickname($list['last_op_id']);
+ $list['op_type'] = getPromoteWithdrawOpType($list['op_type']);
+ $list['last_op_type'] = getPromoteWithdrawOpType($list['last_op_type']);
switch ($list['status']) {
case -2:
$list['status_name'] = '' . $list['status_name'] . '';
diff --git a/Application/Home/View/default/Finance/withdrawRecord.html b/Application/Home/View/default/Finance/withdrawRecord.html
index 6ab8a8c20..4faee0fe9 100644
--- a/Application/Home/View/default/Finance/withdrawRecord.html
+++ b/Application/Home/View/default/Finance/withdrawRecord.html
@@ -149,7 +149,12 @@
提现订单 |
提现日期 |
+ 结算开始日期 |
结算截止日期 |
+ 操作人 |
+ 操作人类型 |
+ 最后操作人 |
+ 最后操作人类型 |
收益金额 |
实际提现金额 |
提现状态 |
@@ -168,7 +173,12 @@
{$vo.widthdraw_number} |
{$vo.create_time} |
+ {$vo.settlement_begin_time} |
{$vo.settlement_end_time} |
+ {$vo.op_id} |
+ {$vo.op_type} |
+ {$vo.last_op_id} |
+ {$vo.last_op_type} |
{$vo.sum_money} |
{$vo.sum_money} |
{$vo.status_name} |
diff --git a/Data/update.sql b/Data/update.sql
index 15cae4410..9356224cc 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -924,4 +924,7 @@ ADD COLUMN `settlement_begin_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算开
ALTER TABLE `tab_withdraw`
ADD COLUMN `op_id` int(11) NOT NULL DEFAULT 0 COMMENT '操作id';
ALTER TABLE `tab_withdraw`
-ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人:1-推广员 2-管理员';
\ No newline at end of file
+ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人:1-推广员 2-管理员';
+ALTER TABLE `tab_withdraw`
+ADD COLUMN `last_op_id` int(11) NOT NULL DEFAULT 0 COMMENT '最后操作人id',
+ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人:1-推广员 2-管理员';
\ No newline at end of file
From 936240d06aec5bc707eeccfae4b10f2d684cd063 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 16:55:12 +0800
Subject: [PATCH 06/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=93=E7=AE=97--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Admin/Controller/AutoController.class.php | 7 +++++++
Application/Home/Controller/FinanceController.class.php | 3 +++
Application/Home/View/default/Finance/index.html | 2 +-
Application/Home/View/default/Finance/withdrawRecord.html | 4 ++--
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php
index c704aec94..0045ae56b 100644
--- a/Application/Admin/Controller/AutoController.class.php
+++ b/Application/Admin/Controller/AutoController.class.php
@@ -1034,4 +1034,11 @@ public function auto_rrdae(){
];
return $ret;
}
+
+ //会长提现
+ public function promoteWithdraw()
+ {
+ $promoteMap['level'] = 1;
+ $promotes = M('promote', 'tab_')->where();
+ }
}
diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php
index 8b2a1d423..1ee9e1c2f 100644
--- a/Application/Home/Controller/FinanceController.class.php
+++ b/Application/Home/Controller/FinanceController.class.php
@@ -284,6 +284,7 @@ class FinanceController extends BaseController
//提现
public function withdraw()
{
+ $this->error('无法执行此操作');
//是否是会长
$this->purview();
//验证安全密码
@@ -589,6 +590,7 @@ class FinanceController extends BaseController
//审核拒绝 重新审核
public function renewReview()
{
+ $this->error('无法执行此操作');
//是否是会长
$this->purview();
//验证安全密码
@@ -629,6 +631,7 @@ class FinanceController extends BaseController
//撤销提现
public function cancelWithdraw()
{
+ $this->error('无法执行此操作');
//是否是会长
$this->purview();
//验证安全密码
diff --git a/Application/Home/View/default/Finance/index.html b/Application/Home/View/default/Finance/index.html
index c85e547f4..39dc54177 100644
--- a/Application/Home/View/default/Finance/index.html
+++ b/Application/Home/View/default/Finance/index.html
@@ -35,7 +35,7 @@
-
+
{$meta_title}
diff --git a/Application/Home/View/default/Finance/withdrawRecord.html b/Application/Home/View/default/Finance/withdrawRecord.html
index 4faee0fe9..7bd43e1ef 100644
--- a/Application/Home/View/default/Finance/withdrawRecord.html
+++ b/Application/Home/View/default/Finance/withdrawRecord.html
@@ -188,11 +188,11 @@
汇款证明
- 重新审核
+
结算单
- 撤销提现
+
From 35ea788ed0234f79dc8580518fed7350275b2199 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 16:59:05 +0800
Subject: [PATCH 07/51] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E5=88=86=E6=88=90?=
=?UTF-8?q?=E7=AE=A1=E7=90=86--=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/PromoteGameRatioController.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php
index a31929b24..e362834c7 100644
--- a/Application/Admin/Controller/PromoteGameRatioController.class.php
+++ b/Application/Admin/Controller/PromoteGameRatioController.class.php
@@ -146,7 +146,7 @@ class PromoteGameRatioController extends ThinkController
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
- if ($save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) {
+ if ($promoteGameRatio['status'] == -1 || $save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) {
$promoteId = $promoteGameRatio['promote_id'];
$this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据
From 0758062837b4951863a8a804c749ce80311296e2 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 18:04:38 +0800
Subject: [PATCH 08/51] =?UTF-8?q?=E4=BC=9A=E9=95=BF=E6=8F=90=E7=8E=B0--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/AutoController.class.php | 87 ++++++++++++++++++-
.../Controller/QueryController.class.php | 6 +-
.../Admin/Model/WithdrawModel.class.php | 18 ++++
Application/Admin/View/Query/settlement.html | 8 +-
Application/Admin/View/Query/withdraw.html | 8 +-
Data/update.sql | 4 +-
6 files changed, 120 insertions(+), 11 deletions(-)
diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php
index 0045ae56b..ff30dda40 100644
--- a/Application/Admin/Controller/AutoController.class.php
+++ b/Application/Admin/Controller/AutoController.class.php
@@ -1038,7 +1038,90 @@ public function auto_rrdae(){
//会长提现
public function promoteWithdraw()
{
- $promoteMap['level'] = 1;
- $promotes = M('promote', 'tab_')->where();
+ $map['level'] = 1;
+ $map['ver_status'] = 1;
+ $promotes = M('promote', 'tab_')->field('id, account, chain')->where($map)->select();
+ $success = 0;
+ $error_withdraw = 0;
+ $error_spend = 0;
+ $error_balance = 0;
+
+ if (!empty($promotes)) {
+ foreach ($promotes as $promote) {
+ $result = $this->promoteWithdrawByPromote($promote);
+ switch ($result) {
+ case -2:
+ $error_balance++;
+ break;
+ case -1:
+ $error_spend++;
+ break;
+ case 0:
+ $error_withdraw++;
+ break;
+ case 1:
+ $success++;
+ break;
+ }
+ }
+ }
+
+ echo "success:{$success} error_withdraw:{$error_withdraw} error_spend:{$error_spend} error_balance:{$error_balance}";
+ }
+
+ private function promoteWithdrawByPromote($promote)
+ {
+ $promoteMap['chain'] = ['like', "{$promote['chain']}{$promote['id']}/%"];
+ $promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true);
+ $promoteIds[] = $promote['id'];
+ $settlementEndTime = strtotime(date('Y-m-d')) - 1;
+
+ $spendMap['pay_status'] = 1;
+ $spendMap['selle_status'] = 0;
+ $spendMap['promote_id'] = ['in', $promoteIds];
+ $spendMap['pay_time'] = ['elt', $settlementEndTime];
+ $spendModel = M('spend', 'tab_');
+ $balance = $spendModel->field("sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as balance")
+ ->where($spendMap)
+ ->find()['balance'];
+ $balance = bcdiv($balance, 100, 2);
+ if ($balance < 100) {
+ return -2;//余额不足
+ }
+
+ $thisTime = time();
+ $add['sum_money'] = $balance;
+ $add['promote_id'] = $promote['id'];
+ $add['promote_account'] = $promote['account'];
+ $add['create_time'] = $thisTime;
+ $add['status'] = 0;
+ $add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber();
+ $add['settlement_begin_time'] = 0;
+ $add['settlement_end_time'] = $settlementEndTime;
+ $add['spend_ids'] = '';
+ $add['op_id'] = 0;
+ $add['op_type'] = 3;
+ $add['last_op_id'] = $add['op_id'];
+ $add['last_op_type'] = 3;
+
+ M()->startTrans();//开启事物
+ $withdrawId = D('withdraw')->add($add);
+ if (!$withdrawId) {
+ M()->rollback();//事物回滚
+ return 0;//提现失败
+ }
+
+ $save['selle_status'] = 1;
+ $save['selle_time'] = $thisTime;
+ $save['withdraw_id'] = $withdrawId;
+ $res = $spendModel->where($spendMap)->save($save);
+ if ($res === false) {
+ D('withdraw')->delete($withdrawId);
+ M()->rollback();//事物回滚
+ return -1;
+ }
+
+ M()->commit();//事物提交
+ return 1;
}
}
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index ecc99b178..fde9a8bc0 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -13,7 +13,7 @@ use Admin\Model\WithdrawModel;
class QueryController extends ThinkController
{
//生成提现单号
- private function produceWithdrawNumber()
+ public function produceWithdrawNumber()
{
$prefix = 'WD_';
$number = '';
@@ -148,7 +148,7 @@ class QueryController extends ThinkController
$records = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond')
->where($map)
- ->order('')
+ ->order('create_time desc')
->page($page, $row)
->select();
$count = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond')
@@ -247,7 +247,7 @@ class QueryController extends ThinkController
$add['promote_account'] = $promote['account'];
$add['create_time'] = $thisTime;
$add['status'] = 0;
- $add['widthdraw_number'] = $this->produceWithdrawNumber();
+ $add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber();
$add['settlement_begin_time'] = $beginTime;
$add['settlement_end_time'] = $endTime;
$add['spend_ids'] = '';
diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php
index dd9b57847..87d60eb32 100644
--- a/Application/Admin/Model/WithdrawModel.class.php
+++ b/Application/Admin/Model/WithdrawModel.class.php
@@ -17,6 +17,7 @@ class WithdrawModel extends Model{
const OP_TYPE_PROMOTE = 1;
const OP_TYPE_ADMIN = 2;
+ const OP_TYPE_AUTO = 3;
/**
* 构造函数
@@ -34,6 +35,7 @@ class WithdrawModel extends Model{
public static $opTypeList = [
self::OP_TYPE_PROMOTE => '推广员',
self::OP_TYPE_ADMIN => '管理员',
+ self::OP_TYPE_AUTO => '自动',
];
/*
@@ -107,4 +109,20 @@ class WithdrawModel extends Model{
}
+ //生成提现单号
+ public function produceWithdrawNumber()
+ {
+ $prefix = 'WD_';
+ $number = '';
+ while (true) {
+ $randomNum = rand(10, 99);
+ $number = $prefix . time() . $randomNum;
+ $map['widthdraw_number'] = $number;
+ $res = $this->where($map)->getField('id');
+ if (!$res) {
+ break;
+ }
+ }
+ return $number;
+ }
}
diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html
index f059ca622..e704735ff 100644
--- a/Application/Admin/View/Query/settlement.html
+++ b/Application/Admin/View/Query/settlement.html
@@ -191,16 +191,20 @@
{:get_promote_name($record['op_id'])}
-
+
{:getAdminNickname($record['op_id'])}
+
+ 自动
|
{:getPromoteWithdrawOpType($record['op_type'])} |
{:get_promote_name($record['last_op_id'])}
-
+
{:getAdminNickname($record['last_op_id'])}
+
+ 自动
|
{:getPromoteWithdrawOpType($record['last_op_type'])} |
diff --git a/Application/Admin/View/Query/withdraw.html b/Application/Admin/View/Query/withdraw.html
index 326afd8e5..c675cae0b 100644
--- a/Application/Admin/View/Query/withdraw.html
+++ b/Application/Admin/View/Query/withdraw.html
@@ -159,16 +159,20 @@
{:get_promote_name($data['op_id'])}
-
+
{:getAdminNickname($data['op_id'])}
+
+ 自动
|
{:getPromoteWithdrawOpType($data['op_type'])} |
{:get_promote_name($data['last_op_id'])}
-
+
{:getAdminNickname($data['last_op_id'])}
+
+ 自动
|
{:getPromoteWithdrawOpType($data['last_op_type'])} |
diff --git a/Data/update.sql b/Data/update.sql
index 9356224cc..12a8ead50 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -924,7 +924,7 @@ ADD COLUMN `settlement_begin_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算开
ALTER TABLE `tab_withdraw`
ADD COLUMN `op_id` int(11) NOT NULL DEFAULT 0 COMMENT '操作id';
ALTER TABLE `tab_withdraw`
-ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人:1-推广员 2-管理员';
+ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人:1-推广员 2-管理员 3-自动';
ALTER TABLE `tab_withdraw`
ADD COLUMN `last_op_id` int(11) NOT NULL DEFAULT 0 COMMENT '最后操作人id',
-ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人:1-推广员 2-管理员';
\ No newline at end of file
+ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人:1-推广员 2-管理员 3-自动';
\ No newline at end of file
From 731e4d29f75a9008a4feab28769515bf65c51d18 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Mon, 30 Dec 2019 18:08:49 +0800
Subject: [PATCH 09/51] =?UTF-8?q?=E4=BC=9A=E9=95=BF=E6=8F=90=E7=8E=B0--?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/FinanceController.class.php | 21 +++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php
index 1ee9e1c2f..a61cc0b36 100644
--- a/Application/Home/Controller/FinanceController.class.php
+++ b/Application/Home/Controller/FinanceController.class.php
@@ -430,8 +430,8 @@ class FinanceController extends BaseController
$list['settlement_begin_time'] = $list['settlement_begin_time'] ? date('Y-m-d H:i:s', $list['settlement_begin_time']) : '--';
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status_name'] = FinanceController::$withdrawStatus[$list['status']];
- $list['op_id'] = ($list['op_type'] == 1) ? get_promote_name($list['op_id']) : getAdminNickname($list['op_id']);
- $list['last_op_id'] = ($list['last_op_type'] == 1) ? get_promote_name($list['last_op_id']) : getAdminNickname($list['last_op_id']);
+ $list['op_id'] = $this->getOpIdByType($list['op_id'], $list['op_type']);
+ $list['last_op_id'] = $this->getOpIdByType($list['last_op_id'], $list['last_op_type']);
$list['op_type'] = getPromoteWithdrawOpType($list['op_type']);
$list['last_op_type'] = getPromoteWithdrawOpType($list['last_op_type']);
switch ($list['status']) {
@@ -460,6 +460,23 @@ class FinanceController extends BaseController
$this->display();
}
+ private function getOpIdByType($opId, $opType)
+ {
+ switch ($opType) {
+ case 1:
+ $opId = get_promote_name($opId);
+ break;
+ case 2:
+ $opId = getAdminNickname($opId);
+ break;
+ case 3:
+ $opId = '自动';
+ break;
+ }
+
+ return $opId;
+ }
+
//提现明细
public function withdrawDtl()
{
From 8652c19f5c795d86e8c88735d835b0006235b0ae Mon Sep 17 00:00:00 2001
From: zhengyongxing
Date: Tue, 31 Dec 2019 11:45:24 +0800
Subject: [PATCH 10/51] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=B8=81=E5=85=85?=
=?UTF-8?q?=E5=80=BC=E6=B7=BB=E5=8A=A0=E6=8E=A8=E5=B9=BF=E5=91=98=E5=85=85?=
=?UTF-8?q?=E5=80=BC=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/DepositController.class.php | 50 +++++++++--
.../Controller/ExportController.class.php | 90 +++++++++++++------
Application/Admin/View/Deposit/lists.html | 52 +++++------
3 files changed, 131 insertions(+), 61 deletions(-)
diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php
index b386cddb7..181ef0ba5 100644
--- a/Application/Admin/Controller/DepositController.class.php
+++ b/Application/Admin/Controller/DepositController.class.php
@@ -10,7 +10,7 @@ use User\Api\UserApi as UserApi;
class DepositController extends ThinkController {
const model_name = 'Deposit';
- public function lists(){
+ public function lists($p = 1){
if(isset($_REQUEST['user_account'])){
$map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%');
unset($_REQUEST['user_account']);
@@ -38,16 +38,10 @@ class DepositController extends ThinkController {
}else if(isset($_REQUEST['promote_id']) && $_REQUEST['promote_id']==0){
$map['promote_id']=array('elt',0);
- unset($_REQUEST['promote_id']);
- unset($_REQUEST['promote_name']);
}elseif(isset($_REQUEST['promote_name'])&&$_REQUEST['promote_id']==-1){
$map['promote_id']=get_promote_id($_REQUEST['promote_name']);
- unset($_REQUEST['promote_id']);
- unset($_REQUEST['promote_name']);
}else{
$map['promote_id']=$_REQUEST['promote_id'];
- unset($_REQUEST['promote_id']);
- unset($_REQUEST['promote_name']);
}
if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){
$map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1));
@@ -94,6 +88,47 @@ class DepositController extends ThinkController {
$map1=$map;
$map1['pay_status']=1;
+
+ if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') {
+ $page = intval($p);
+ $page = $page ? $page : 1; //默认显示第一页数据
+ if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
+ $map1['order_status'] = 1;
+ unset($map1['pay_status']);
+ if ($map['pay_status']) {
+ $map['order_status']=$map['pay_status'];
+ }
+
+ $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount'));
+ $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount'));
+ $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount'));
+ $this->assign('total',$total);
+ $this->assign('ttotal',$ttotal);
+ $this->assign('ytotal',$ytotal);
+
+ $data = D('coin_pay_order')
+ /* 查询指定字段,不指定则查询所有字段 */
+ ->field('*,order_status as pay_status')
+ // 查询条件
+ ->where($map)
+ /* 默认通过id逆序排列 */
+ ->order("id desc")
+ /* 数据分页 */
+ ->page($page, $row)
+ /* 执行查询 */
+ ->select();
+
+ /* 查询记录总数 */
+ $count = D('coin_pay_order')->where($map)->count();
+
+ $page = set_pagination($count,$row);
+ if($page) {$this->assign('_page', $page);}
+
+ $this->assign('list_data', $data);
+ $this->meta_title = '平台币充值列表';
+ $this->display('lists');die();
+ }
+
$total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount'));
$ttotal=null_to_0(D(self::model_name)->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount'));
$ytotal=null_to_0(D(self::model_name)->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount'));
@@ -105,6 +140,7 @@ class DepositController extends ThinkController {
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Deposit/lists','status'=>1])->find());
$this->assign("is_admin",is_administrator());
+
parent::lists(self::model_name,$_GET["p"],$map);
}
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 1fa5726cf..cb51513f8 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -1235,16 +1235,10 @@ class ExportController extends Controller
} else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) {
$map['promote_id'] = array('elt', 0);
- unset($_REQUEST['promote_id']);
- unset($_REQUEST['promote_name']);
} elseif (isset($_REQUEST['promote_name']) && $_REQUEST['promote_id'] == -1) {
$map['promote_id'] = get_promote_id($_REQUEST['promote_name']);
- unset($_REQUEST['promote_id']);
- unset($_REQUEST['promote_name']);
} else {
$map['promote_id'] = $_REQUEST['promote_id'];
- unset($_REQUEST['promote_id']);
- unset($_REQUEST['promote_name']);
}
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
@@ -1266,30 +1260,70 @@ class ExportController extends Controller
}
$map1 = $map;
$map1['pay_status'] = 1;
- $total = D('Deposit')->where($map1)->sum('pay_amount');
- if (isset($map['pay_status']) && $map['pay_status'] == 0) {
- $total = sprintf("%.2f", 0);
+
+ if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') {
+
+ $map1['order_status'] = 1;
+ unset($map1['pay_status']);
+ if ($map['pay_status']) {
+ $map['order_status']=$map['pay_status'];
+ }
+
+ $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount'));
+
+ if (isset($map['pay_status']) && $map['pay_status'] == 0) {
+ $total = sprintf("%.2f", 0);
+ } else {
+ $total = sprintf("%.2f", $total);
+ }
+ $xlsCell = array(
+ array('pay_order_number', "订单号"),
+ array('promote_account', L('Subordinate_channel')),
+ array('pay_amount', "充值平台币"),
+ array('pay_way', "充值方式", 'get_pay_way', '*'),
+ array('create_time', "充值时间"),
+ array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
+ array('', "共计充值{$total}"),
+ );
+ $xlsData = D('coin_pay_order')
+ /* 查询指定字段,不指定则查询所有字段 */
+ ->field('*,order_status as pay_status')
+ // 查询条件
+ ->where($map)
+ /* 默认通过id逆序排列 */
+ ->order("id desc")
+ /* 执行查询 */
+ ->select();
+// var_dump($xlsData);die();
+ foreach ($xlsData as $key => $value) {
+ $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
+ }
} else {
- $total = sprintf("%.2f", $total);
- }
+ $total = D('Deposit')->where($map1)->sum('pay_amount');
+ if (isset($map['pay_status']) && $map['pay_status'] == 0) {
+ $total = sprintf("%.2f", 0);
+ } else {
+ $total = sprintf("%.2f", $total);
+ }
- $xlsCell = array(
- array('pay_order_number', "订单号"),
- array('user_account', "玩家账号"),
- array('promote_account', L('Subordinate_channel')),
- array('pay_amount', "充值平台币"),
- array('pay_way', "充值方式", 'get_pay_way', '*'),
- array('pay_ip', "充值ip"),
- array('create_time', "充值时间"),
- array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
- array('', "共计充值{$total}"),
- );
- $xlsData = D('Deposit')
- ->where($map)
- ->order('id DESC')
- ->select();
- foreach ($xlsData as $key => $value) {
- $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
+ $xlsCell = array(
+ array('pay_order_number', "订单号"),
+ array('user_account', "玩家账号"),
+ array('promote_account', L('Subordinate_channel')),
+ array('pay_amount', "充值平台币"),
+ array('pay_way', "充值方式", 'get_pay_way', '*'),
+ array('pay_ip', "充值ip"),
+ array('create_time', "充值时间"),
+ array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
+ array('', "共计充值{$total}"),
+ );
+ $xlsData = D('Deposit')
+ ->where($map)
+ ->order('id DESC')
+ ->select();
+ foreach ($xlsData as $key => $value) {
+ $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
+ }
}
// dd($xlsData);
break;
diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html
index 2f11a20f0..fa8e433dd 100644
--- a/Application/Admin/View/Deposit/lists.html
+++ b/Application/Admin/View/Deposit/lists.html
@@ -78,21 +78,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 0ebe11027e1791286d6f26eebc0a49accfa2761b Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Thu, 16 Jan 2020 10:00:47 +0800
Subject: [PATCH 42/51] upt
---
.../Admin/Controller/GameController.class.php | 63 +++++-
.../Admin/View/Game/devide_warn_edit.html | 36 ++-
.../Admin/View/Game/devide_warn_list.html | 205 ++++++++++++++++++
3 files changed, 290 insertions(+), 14 deletions(-)
create mode 100644 Application/Admin/View/Game/devide_warn_list.html
diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php
index 859dd8682..1ce81082f 100644
--- a/Application/Admin/Controller/GameController.class.php
+++ b/Application/Admin/Controller/GameController.class.php
@@ -775,14 +775,47 @@ class GameController extends ThinkController
var_dump($games);
}
- public function devide_warn_list()
+ public function devide_warn_list($row = 10, $p = 1)
{
-
+ $map = ['pdw.status'=>1];
+ if (!empty($_GET['partner_id'])) {
+ $map['pdw.partner_id'] = $_GET['partner_id'];
+ }
+ if (!empty($_GET['relation_game_id'])) {
+ $partner = M('Game', 'tab_')->field('partner_id')->where(['relation_game_id'=>$_GET['relation_game_id']])->find();
+ $map['pdw.partner_id'] = $partner['partner_id'];
+ }
+ $list = M('partner_divide_warn', 'tab_')
+ ->alias('pdw')->field("pdw.*, p.partner, sum(s.pay_amount) as total_amount, group_concat(distinct(g.relation_game_name)) as game_name")
+ ->join("tab_partner p on p.id = pdw.partner_id")
+ ->join("tab_game g on pdw.partner_id = g.partner_id", 'left')
+ ->join('tab_spend s on s.game_id = g.id', 'left')
+ ->where(array_merge($map, ['s.pay_status'=>1]))
+ ->group('pdw.id, p.partner')
+ ->page($p, $row)->select();
+ $count = M('partner_divide_warn', 'tab_')->alias('pdw')->join("tab_game g on pdw.partner_id = g.partner_id", 'left')->where($map)->count();
+ // if (!empty($list)) {
+ // foreach ($list as &$item) {
+ // $item['create_time'] = date('Y-m-d', $item['create_time']);
+ // $item['upt_time'] = date('Y-m-d', $item['upt_time']);
+ // }
+ // }
+ $page = set_pagination($count, $row);
+ if ($page) {
+ $this->assign('_page', $page);
+ }
+ $partners = M('partner', 'tab_')->field("id, partner")->where(['status'=>1])->order('last_up_time desc')->select();
+ $this->assign('partners', $partners);
+ $this->assign('list_data', $list);
+ $this->display();
}
- public function devide_warn_edit($id=0)
+ public function devide_warn_edit($id=0, $delete=0)
{
if (IS_POST) {
+ if (empty($_POST['advance_amount']) || empty($_POST['warming_amount']) || empty($_POST['warn_frequency']) || empty($_POST['phones'])) {
+ return $this->error("请填写必填数据");
+ }
if ($_POST['phones']) {
$_POST['phones'] = array_unique($_POST['phones']);
foreach ($_POST['phones'] as $phone) {
@@ -805,10 +838,16 @@ class GameController extends ThinkController
}
if ($id) {
+ $_POST['upt_time'] = $_POST['create_time'] = time();
+ $_POST['operater_id'] = is_login();
$upt = M('partner_divide_warn', 'tab_')->where(['id'=>$id])->save($_POST);
return $upt ? $this->success("更新成功") : $this->error("更新失败");
} else {
- if (M('partner_divide_warn', 'tab_')->where(['partner_id'=>$_POST['partner_id']]))
+ if (M('partner_divide_warn', 'tab_')->where(['partner_id'=>$_POST['partner_id'], 'status'=>1])->find()) {
+ return $this->error('已有当前合作伙伴的预警设置');
+ }
+ $_POST['upt_time'] = $_POST['create_time'] = time();
+ $_POST['operater_id'] = is_login();
$ins = M('partner_divide_warn', 'tab_')->add($_POST);
return $ins ? $this->success("新增成功") : $this->error("新增失败");
}
@@ -816,10 +855,18 @@ class GameController extends ThinkController
$partners = M('partner', 'tab_')->field("id, partner")->where(['status'=>1])->order('last_up_time desc')->select();
$this->assign('partners', $partners);
if ($id) {
- $warnInfo = M('partner_divide_warn', 'tab_')->where(['id'=>$id])->find();
- if (!$warnInfo) return $this->error('未找到该记录');
- $warnInfo['phones'] = json_decode($warnInfo['phones'], true);
- $this->assign('warnInfo', $warnInfo);
+ if ($delete) {
+ $_POST['upt_time'] = $_POST['create_time'] = time();
+ $_POST['operater_id'] = is_login();
+ $_POST['status'] = 2;
+ $del = M('partner_divide_warn', 'tab_')->where(['id'=>$id])->save($_POST);
+ return $del ? $this->success("删除成功") : $this->error("删除失败");
+ } else {
+ $warnInfo = M('partner_divide_warn', 'tab_')->where(['id'=>$id])->find();
+ if (!$warnInfo) return $this->error('未找到该记录');
+ $warnInfo['phones'] = json_decode($warnInfo['phones'], true);
+ $this->assign('warnInfo', $warnInfo);
+ }
}
$this->display();
}
diff --git a/Application/Admin/View/Game/devide_warn_edit.html b/Application/Admin/View/Game/devide_warn_edit.html
index e0de85749..ad8a2c464 100644
--- a/Application/Admin/View/Game/devide_warn_edit.html
+++ b/Application/Admin/View/Game/devide_warn_edit.html
@@ -23,6 +23,28 @@
color: #4DB361;
}
+
@@ -39,28 +61,28 @@
-
+
-
+ *
-
+ *
-
+ *
$phone):?>
-
+ *
@@ -74,12 +96,13 @@
-
+ *
+
@@ -97,6 +120,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 预警对象 |
+ 游戏名称 |
+ 游戏总流水 |
+ 预付金额 |
+ 预警金额 |
+ 预警金额频率 |
+ 预警手机号 |
+ 修改时间 |
+ 创建时间 |
+ 操作人 |
+ 操作 |
+
+
+
+
+
+ aOh! 暂时还没有内容! |
+
+
+
+
+ {$data.partner} |
+ {$data.game_name} |
+ {$data.total_amount} |
+ {$data.advance_amount} |
+ {$data.warming_amount} |
+ {$data.warn_frequency} |
+ |
+ {$data.upt_time|date='Y-m-d H:i:s',###} |
+ {$data.create_time|date='Y-m-d H:i:s',###} |
+ {:get_admin_nickname($data['operater_id'])} |
+
+ 编辑
+ 解除
+ |
+
+
+
+
+
+
+
+
+ {$_page|default=''}
+
+
+
+
+
+
+
+
+ if(C('COLOR_STYLE')=='blue_color') echo '
+
+ ';
+
+
+
+
+
+
+
+
From 6daf38aa43df1bc1c2d709e7c1d82a0ef0587752 Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Thu, 16 Jan 2020 11:14:32 +0800
Subject: [PATCH 43/51] upt
---
.../Controller/ConsoleController.class.php | 34 +++++++++++++++++++
.../Admin/View/Game/devide_warn_edit.html | 1 -
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php
index 69a182a70..07d87d314 100644
--- a/Application/Admin/Controller/ConsoleController.class.php
+++ b/Application/Admin/Controller/ConsoleController.class.php
@@ -324,4 +324,38 @@ class ConsoleController extends Think {
}
);
}
+
+ public function divideWarnCheck()
+ {
+ $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
+ $warns = M('partner_divide_warn', 'tab_')->alias('pdw')
+ ->field('pdw.*, cgr.ratio, sum(s.pay_amount) as total_amount')
+ ->join('tab_game g on pdw.partner_id = g.partner_id')
+ ->join('tab_cp_game_ratio cgr on cgr.game_id = g.id and begin_total_amount = 0 and is_del = 0')
+ ->join('tab_spend s on s.game_id = g.id')
+ ->where(['pdw.status'=>1, 's.pay_status'=>1])
+ ->group('pdw.id')
+ ->select();
+ if (!$warns) return;
+ foreach ($warns as $info) {
+ if (!$info['ratio']) return;
+ $total_amount = ceil(($info['ratio'] / 100) * $info['total_amount']);
+ $cacheKey = "divide:warn:check:{$info['partner_id']}";
+ if (!($lastStep = $redis->get($cacheKey))) {
+ $lastStep = 0;
+ }
+ if ($total_amount >= $info['warming_amount']) {
+ if ($total_amount - $lastStep >= $info['warn_frequency']) { // 达到预警
+ // 发送预警短信
+ echo "发送短信";
+ // 变换缓存值,如果为0,需要设置过期时间
+ if ($lastStep) {
+ $redis->set($cacheKey, $total_amount);
+ } else {
+ $redis->setex($cacheKey, 86400 * 30, $total_amount);
+ }
+ }
+ }
+ }
+ }
}
diff --git a/Application/Admin/View/Game/devide_warn_edit.html b/Application/Admin/View/Game/devide_warn_edit.html
index ad8a2c464..4b06f87c7 100644
--- a/Application/Admin/View/Game/devide_warn_edit.html
+++ b/Application/Admin/View/Game/devide_warn_edit.html
@@ -120,7 +120,6 @@
+
+
+
+
+
+
+
\ No newline at end of file
From 30c40d004b8ac0fca2dcf5a2833a5abbe1bd45c9 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Thu, 16 Jan 2020 18:10:58 +0800
Subject: [PATCH 46/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E6=8C=87?=
=?UTF-8?q?=E6=A0=87=E7=AE=A1=E7=90=86--=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Home/Controller/QueryController.class.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index da0bac1ea..c7777c09b 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -2374,13 +2374,13 @@ class QueryController extends BaseController
if (!isset($map['game_id'])) {
$sdkVersionText = getSDKTypeName($map['sdk_version'], true);
} elseif (!isset($map['sdk_version'])) {
- $where['game_id'] = $map['game_id'];
+ $where['id'] = $map['game_id'];
$gameName = M('game', 'tab_')->where($where)->getField('relation_game_name');
if (isset($map['server_id'])) {
$serverName = $this->getServerName($map['game_id'], 0, $map['server_id']);
}
} else {
- $where['game_id'] = $map['game_id'];
+ $where['id'] = $map['game_id'];
$where['sdk_version'] = $map['sdk_version'];
$gameName = M('game', 'tab_')->where($where)->getField('game_name');
$sdkVersionText = getSDKTypeName($map['sdk_version'], true);
From 8780b57f450db777b66d6405e6a8807dd4317eac Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Thu, 16 Jan 2020 18:13:58 +0800
Subject: [PATCH 47/51] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E6=8C=87?=
=?UTF-8?q?=E6=A0=87=E7=AE=A1=E7=90=86--=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Home/View/default/Query/promoteQuota.html | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Application/Home/View/default/Query/promoteQuota.html b/Application/Home/View/default/Query/promoteQuota.html
index e499234fe..a941f9c6e 100644
--- a/Application/Home/View/default/Query/promoteQuota.html
+++ b/Application/Home/View/default/Query/promoteQuota.html
@@ -16,7 +16,7 @@
-
当前位置:数据管理>团队推广业绩
+
当前位置:数据管理>{$meta_title}
{$meta_title}
@@ -56,6 +56,12 @@
+
+
+
+
+
+
From 2195bb4c5553e9f8f463a9d980da3abb2854da0d Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Thu, 16 Jan 2020 18:57:57 +0800
Subject: [PATCH 48/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?=
=?UTF-8?q?=E5=8F=91=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/PublicController.class.php | 2 +-
Application/Base/Tool/TaskClient.class.php | 22 +++++++++++++++++--
.../Controller/CommonController.class.php | 2 +-
.../Mobile/Controller/SsgController.class.php | 2 +-
.../Controller/UserController.class.php | 2 +-
5 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/Application/Admin/Controller/PublicController.class.php b/Application/Admin/Controller/PublicController.class.php
index 0b76890d8..a7a43a3ea 100644
--- a/Application/Admin/Controller/PublicController.class.php
+++ b/Application/Admin/Controller/PublicController.class.php
@@ -345,7 +345,7 @@ class PublicController extends \Think\Controller
public function telsafecode($phone = '', $delay = 10, $flag = true)
{
$taskClient = new TaskClient();
- $result = $taskClient->sendSms($phone, get_client_ip());
+ $result = $taskClient->sendSmsCode($phone, get_client_ip());
$data = [];
if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1;
diff --git a/Application/Base/Tool/TaskClient.class.php b/Application/Base/Tool/TaskClient.class.php
index 0b8371c94..f65f50949 100644
--- a/Application/Base/Tool/TaskClient.class.php
+++ b/Application/Base/Tool/TaskClient.class.php
@@ -28,9 +28,27 @@ class TaskClient
return json_decode($result, true);
}
- public function sendSms($mobile, $clientIp, $type = 'common')
+ public function sendSmsCode(string $mobile, string $clientIp)
{
- return $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type, 'client_ip' => $clientIp]);
+ $options = ['type' => 'code', 'client_ip' => $clientIp];
+ return $this->sendSms($mobile, $options);
+ }
+
+ public function sendSmsContent(string $mobile, string $content)
+ {
+ $options = ['type' => 'content', 'content' => $content];
+ return $this->sendSms($mobile, $options);
+ }
+
+ public function sendSmsBatch(array $mobiles, string $content)
+ {
+ $options = ['type' => 'batch', 'content' => $content];
+ return $this->sendSms($mobiles, $options);
+ }
+
+ private function sendSms($mobile, array $options)
+ {
+ return $this->post('/message/sms-send', ['mobile' => $mobile, 'options' => $options]);
}
public function checkSms($mobile, $code)
diff --git a/Application/Mobile/Controller/CommonController.class.php b/Application/Mobile/Controller/CommonController.class.php
index 34778e276..d1b0e631a 100644
--- a/Application/Mobile/Controller/CommonController.class.php
+++ b/Application/Mobile/Controller/CommonController.class.php
@@ -220,7 +220,7 @@ class CommonController extends BaseController {
{
$phone = I('phone');
$taskClient = new TaskClient();
- $result = $taskClient->sendSms($phone, get_client_ip());
+ $result = $taskClient->sendSmsCode($phone, get_client_ip());
$data = [];
if ($result['code'] == TaskClient::SUCCESS) {
$this->respondSuccess('发送成功');
diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php
index 7ff8cae37..3d41bf19c 100644
--- a/Application/Mobile/Controller/SsgController.class.php
+++ b/Application/Mobile/Controller/SsgController.class.php
@@ -409,7 +409,7 @@ class SsgController extends BaseController {
{
$phone = I('phone');
$taskClient = new TaskClient();
- $result = $taskClient->sendSms($phone, get_client_ip());
+ $result = $taskClient->sendSmsCode($phone, get_client_ip());
$data = [];
if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1;
diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php
index fffb9cd55..afdfcdbde 100644
--- a/Application/Mobile/Controller/UserController.class.php
+++ b/Application/Mobile/Controller/UserController.class.php
@@ -581,7 +581,7 @@ class UserController extends BaseController
public function telsafecode($phone = '', $delay = 10, $flag = true)
{
$taskClient = new TaskClient();
- $result = $taskClient->sendSms($phone, get_client_ip());
+ $result = $taskClient->sendSmsCode($phone, get_client_ip());
$data = [];
if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1;
From 45b3c2729258b5d96b14f9b210317b22fad4c4a1 Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Fri, 17 Jan 2020 10:23:43 +0800
Subject: [PATCH 49/51] upt
---
.../Admin/Controller/ConsoleController.class.php | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php
index 07d87d314..e0cd49d15 100644
--- a/Application/Admin/Controller/ConsoleController.class.php
+++ b/Application/Admin/Controller/ConsoleController.class.php
@@ -6,6 +6,7 @@ namespace Admin\Controller;
use Admin\Model\SpendModel;
use Think\Think;
use Base\Tool\Printer;
+use Base\Tool\TaskClient;
use Base\Service\PromoteService;
use GuzzleHttp\Client;
@@ -329,7 +330,8 @@ class ConsoleController extends Think {
{
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
$warns = M('partner_divide_warn', 'tab_')->alias('pdw')
- ->field('pdw.*, cgr.ratio, sum(s.pay_amount) as total_amount')
+ ->field('pdw.*, cgr.ratio, sum(s.pay_amount) as total_amount, p.partner')
+ ->join('tab_partner p on pdw.partner_id = p.id')
->join('tab_game g on pdw.partner_id = g.partner_id')
->join('tab_cp_game_ratio cgr on cgr.game_id = g.id and begin_total_amount = 0 and is_del = 0')
->join('tab_spend s on s.game_id = g.id')
@@ -337,6 +339,8 @@ class ConsoleController extends Think {
->group('pdw.id')
->select();
if (!$warns) return;
+ $taskClient = new TaskClient();
+ $current_time = date('Y-m-d H:i:s');
foreach ($warns as $info) {
if (!$info['ratio']) return;
$total_amount = ceil(($info['ratio'] / 100) * $info['total_amount']);
@@ -344,10 +348,14 @@ class ConsoleController extends Think {
if (!($lastStep = $redis->get($cacheKey))) {
$lastStep = 0;
}
- if ($total_amount >= $info['warming_amount']) {
+ if ((intval($info['advance_amount']) - intval($total_amount)) <= $info['warming_amount']) {
if ($total_amount - $lastStep >= $info['warn_frequency']) { // 达到预警
// 发送预警短信
- echo "发送短信";
+ $content = "{$info['partner']}的预付分成款已于{$current_time}余额不足{$info['warming_amount']}元,请尽快进行充值。";
+ $sendRes = $taskClient->sendSmsBatch(json_decode($info['phones'], true), $content);
+ if ($sendRes['code'] != TaskClient::SUCCESS) {
+ continue;
+ }
// 变换缓存值,如果为0,需要设置过期时间
if ($lastStep) {
$redis->set($cacheKey, $total_amount);
From 7b2a60147a8c14c97428763e55c8cb0d89d16a55 Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Fri, 17 Jan 2020 10:25:14 +0800
Subject: [PATCH 50/51] upt
---
Data/update.sql | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/Data/update.sql b/Data/update.sql
index 09504f5c4..b7ce1dc74 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -1089,4 +1089,19 @@ ADD COLUMN `relation_game_id` int(11) NOT NULL DEFAULT 0 COMMENT '关联游戏id
ALTER TABLE `tab_spend`
MODIFY COLUMN `selle_status` int(11) NOT NULL DEFAULT 0 COMMENT '渠道结算 0未结算1 结算',
-MODIFY COLUMN `selle_ratio` double(5, 2) DEFAULT 0.00 COMMENT '渠道分成比例';
\ No newline at end of file
+MODIFY COLUMN `selle_ratio` double(5, 2) DEFAULT 0.00 COMMENT '渠道分成比例';
+
+-- 预付款预警
+CREATE TABLE `tab_partner_divide_warn` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '公司预警表',
+ `partner_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '公司ID',
+ `advance_amount` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '预付款',
+ `warming_amount` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '预警金额',
+ `phones` json DEFAULT NULL,
+ `warn_frequency` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '预警金额频率',
+ `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态 1正常 2删除',
+ `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
+ `upt_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
+ `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
\ No newline at end of file
From 33a19fbb6a673c1f19d54676702d9a28fbd1d234 Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Fri, 17 Jan 2020 10:31:04 +0800
Subject: [PATCH 51/51] upt
---
Application/Admin/View/Game/devide_warn_edit.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Application/Admin/View/Game/devide_warn_edit.html b/Application/Admin/View/Game/devide_warn_edit.html
index 4b06f87c7..7a6a246d0 100644
--- a/Application/Admin/View/Game/devide_warn_edit.html
+++ b/Application/Admin/View/Game/devide_warn_edit.html
@@ -119,7 +119,7 @@