From 9ebc7d36557ec237734b931c75451b681c812b15 Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Tue, 19 Nov 2019 11:32:49 +0800
Subject: [PATCH 01/41] upt
---
.../Admin/Controller/StatController.class.php | 20 +++--
.../Admin/Controller/access_data_foldline.txt | 2 +-
Application/Admin/Model/UserModel.class.php | 74 +++++++++++--------
3 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php
index fad630ebd..96a7e4557 100644
--- a/Application/Admin/Controller/StatController.class.php
+++ b/Application/Admin/Controller/StatController.class.php
@@ -593,17 +593,19 @@ class StatController extends ThinkController
$map['tab_user.promote_id']=$map_list['promote_id'];
}
unset($map['promote_id']);
- $map["FROM_UNIXTIME(register_time,'%Y-%m-%d')"] = $time;
+ //$map["FROM_UNIXTIME(,'%Y-%m-%d')"] = $time;
+ $map["register_time"] = ['between', [strtotime($time), strtotime($time)+86399]];
$login_time = strtotime("+1 day",strtotime($time));
$login_time_end = $login_time+86399;
- $num = M('user','tab_')
- ->field('count(DISTINCT tab_user.id) as num')
+ $num_sql = M('user','tab_')
+ ->field('tab_user.id')
->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id
- and ur.login_time between $login_time and $login_time_end")
- ->where($map)
- ->group('user_id')
- ->find();
+ and ur.login_time between $login_time and $login_time_end")
+ ->where($map)
+ ->group('user_id')
+ ->select(false);
+ $num = M()->query("select count(*) as total from ({$num_sql}) t limit 1")[0]['total'];
$data[$key]['keep_num'] = round($num['num']/$data[$key]['register_num'],4)*100;
//充值
$map = $map_list;
@@ -1139,9 +1141,11 @@ class StatController extends ThinkController
$mapl['tab_user.promote_id']=$mapl['promote_id'];
unset($mapl['promote_id']);
$login_time = date('Y-m-d', strtotime("+1 day",strtotime($time)));
+ $login_start = strtotime($login_time);
+ $login_end = $login_start + 86399;
$num = $user
->field('count(DISTINCT tab_user.id) as num')
- ->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and FROM_UNIXTIME(ur.login_time,'%Y-%m-%d') = '{$login_time}'")
+ ->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and ur.login_time between {$login_start} and {$login_end}")
->where($mapl)
->find();
$data[$key]['keep_num'] = round($num['num']/$data[$key]['register_num'],4)*100;
diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt
index f2bc7fb38..06372c756 100644
--- a/Application/Admin/Controller/access_data_foldline.txt
+++ b/Application/Admin/Controller/access_data_foldline.txt
@@ -1 +1 @@
-{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":0,"player":0,"money":0},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]}
\ No newline at end of file
+{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":2,"player":0,"money":0},"active":[{"time":"0:00","count":1},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":1},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]}
\ No newline at end of file
diff --git a/Application/Admin/Model/UserModel.class.php b/Application/Admin/Model/UserModel.class.php
index e5529b227..b97b16d3c 100644
--- a/Application/Admin/Model/UserModel.class.php
+++ b/Application/Admin/Model/UserModel.class.php
@@ -1959,36 +1959,46 @@ class UserModel extends Model{
*/
public function activeRankOnPromote($timestr,$fieldname='count',$promoteid='',$row=0,$ordermark='desc') {
- $map['tab_user.promote_id']=array('gt',0);
+ $map['promote_id']=array('gt',0);
- if ($promoteid[0]) {$map['tab_user.promote_id']=array('in',$promoteid);}
+ if ($promoteid[0]) {$map['promote_id']=array('in',$promoteid);}
- $sql = $this->field('tab_user.promote_id,tab_promote.account as promote_account,tab_user.id')
- ->join('tab_promote on (tab_promote.id = tab_user.promote_id) ')
+ $sql = $this->field('promote_id,tab_user.id')
->where(['register_time'.$timestr,$map])
->select(false);
- $mid = $this->field('tab_user.promote_id,tab_promote.account as promote_account,tab_user.id')
- ->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
- ->join('tab_promote on(tab_user.promote_id = tab_promote.id)')
- ->union($sql)
- ->group('tab_user.promote_id,tab_user.id')
- ->where(['uu.login_time '.$timestr,$map])
- ->select(false);
-
- $last = $this->table('('.$mid.') as a')->field('a.promote_id,a.promote_account,GROUP_CONCAT(a.id),count(a.id) as '.$fieldname)
- ->group('a.promote_id')->select(false);
-
+ // $mid = $this->field('tab_user.promote_id,tab_promote.account as promote_account,tab_user.id')
+ // ->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
+ // ->join('tab_promote on(tab_user.promote_id = tab_promote.id)')
+ // ->union($sql)
+ // ->group('tab_user.promote_id,tab_user.id')
+ // ->where(['uu.login_time '.$timestr,$map])
+ // ->select(false);
+
+ $mid = M('user_login_record', 'tab_')->alias("uu")->field('uu.promote_id, uu.user_id as id')
+ ->union($sql)
+ ->group('uu.promote_id, uu.user_id')
+ ->where(['uu.login_time '.$timestr,$map])
+ ->select(false);
+
+ $last = $this->table('('.$mid.') as a')->field('a.promote_id,GROUP_CONCAT(a.id),count(a.id) as '.$fieldname)
+ ->group('a.promote_id')->select(false);
if($row>0) {
- $data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->select();
-
+ $data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
} else {
- $data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->select();
+ $data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
- }
+ }
+ if (!empty($data)) {
+ $promoters = M('promote', 'tab_')->field('id, account')->where(['id'=>['in', array_column($data, 'promote_id')]])->select();
+ $promoter_names = array_column($promoters, 'account', 'id');
+ foreach ($data as &$item) {
+ $item['promote_account'] = isset($promoter_names[$item['promote_id']]) ? $promoter_names[$item['promote_id']] : '';
+ }
+ }
return $data;
}
@@ -2012,27 +2022,33 @@ class UserModel extends Model{
->where(['register_time'.$timestr,$map2])
->select(false);
- $mid = $this->field('uu.game_id,game_name,tab_user.id')
- ->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
- ->union($sql)
- ->group('uu.game_id,tab_user.id')
- ->where(['uu.login_time '.$timestr,$map])
- ->select(false);
+ // $mid = $this->field('uu.game_id,game_name,tab_user.id')
+ // ->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
+ // ->union($sql)
+ // ->group('uu.game_id,tab_user.id')
+ // ->where(['uu.login_time '.$timestr,$map])
+ // ->select(false);
+
+ $mid = M('user_login_record', 'tab_')->alias("uu")->field('game_id,game_name,user_id as id')
+ ->union($sql)
+ ->group('uu.game_id, uu.user_id')
+ ->where(['uu.login_time '.$timestr,$map])
+ ->select(false);
$last = $this->table('('.$mid.') as a')->field('a.game_id,a.game_name,GROUP_CONCAT(a.id),count(a.id) as '.$fieldname)
->group('a.game_id')->select(false);
if($row>0) {
- $data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->select();
+ $data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
} else {
- $data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->select();
-
- }
+ $data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
+ }
+
return $data;
}
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 02/41] =?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 03/41] =?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 04/41] =?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 05/41] =?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 06/41] =?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 07/41] =?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 08/41] =?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 09/41] =?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 10/41] =?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 11/41] =?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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -197,27 +197,11 @@
{$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'])} |
- {:getPromoteWithdrawSettlementType($record['settlement_type'])} |
+ {$record.op_id_text} |
+ {$record.op_type_text} |
+ {$record.last_op_id_text} |
+ {$record.last_op_type_text} |
+ {$record.settlement_type_text} |
{$record.settlement_begin_time} |
{$record.settlement_end_time} |
{$record.create_time} |
@@ -242,18 +226,8 @@
-
- 导出
-
+ 导出
{$_page|default=''}
@@ -514,5 +488,10 @@
});
});
});
+
+ $(".export-btn").on("click",function(e){
+ e.preventDefault();
+ window.location.href=$(this).attr("href")
+ })
diff --git a/Application/Admin/View/Query/withdraw.html b/Application/Admin/View/Query/withdraw.html
index f253fe90b..2eb696c61 100644
--- a/Application/Admin/View/Query/withdraw.html
+++ b/Application/Admin/View/Query/withdraw.html
@@ -207,7 +207,7 @@
汇总 |
- 当页提现:{:null_to_0(array_sum(array_column(arrayPromoteWithdrawStatus('status','',$list_data),'sum_money')))}元 ; 今日提现:{:null_to_0(floor($ttotal*100)/100)}元 ; 昨日提现:{:null_to_0(floor($ytotal*100)/100)}元 ; 累计提现:{:null_to_0(floor($total*100)/100)}元 |
+ 累计提现:{:null_to_0(floor($total*100)/100)}元 |
@@ -215,7 +215,8 @@
- 导出
+ 导出
{$_page|default=''}
@@ -334,6 +335,11 @@
content: '/admin.php?s=/Query/withdrawDetails/id/'+id+'' //iframe的url
});
}
+
+ $(".export-btn").on("click",function(e){
+ e.preventDefault();
+ window.location.href=$(this).attr("href")
+ })
+
+
+
+

+
设置安全密码
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ThinkPHP/Library/Think/Controller.class.php b/ThinkPHP/Library/Think/Controller.class.php
index ce0f2a1f3..403b15ec5 100644
--- a/ThinkPHP/Library/Think/Controller.class.php
+++ b/ThinkPHP/Library/Think/Controller.class.php
@@ -199,6 +199,13 @@ abstract class Controller {
$this->dispatchJump($message,1,$jumpUrl,$ajax);
}
+ protected function tips($message='',$jumpUrl='') {
+ C('HTML_CACHE_ON',false);
+ $this->redirect('Promote/index',array('tips'=>1,'message'=>$message));
+ // $this->display(C('TMPL_ACTION_TIPS'));
+ exit ;
+ }
+
/**
* Ajax方式返回数据到客户端
* @access protected
diff --git a/ThinkPHP/Tpl/dispatch_jump.tpl b/ThinkPHP/Tpl/dispatch_jump.tpl
index 25d4e4ef9..70c7eb97d 100644
--- a/ThinkPHP/Tpl/dispatch_jump.tpl
+++ b/ThinkPHP/Tpl/dispatch_jump.tpl
@@ -30,7 +30,7 @@ body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16p
-页面自动 跳转 等待时间:
+页面自动 跳转11 等待时间:
+
+
if(C('COLOR_STYLE')=='blue_color') echo '';
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{$meta_title}
+
说明:该功能是用于录入工会所属的推广公司名称
+
+
+
返回
+
+ {$msg}
+
+
+
上游-汇总结算单
+
+
+
+
+
+ 平台 |
+ 时间 |
+ 游戏名称 |
+ 平台流水 |
+ 分成比例 |
+ 我方比例 |
+ 渠道费率 |
+ 税费费率 |
+ 合作方结算分成 |
+ 违规罚款 |
+ 奖励 |
+ 备注 |
+
+
+
+
+
+
+ aOh! 暂时还没有可结算内容! |
+
+ $item): ?>
+ $channel): ?>
+
+
+ {$item.company_name} |
+ 123 |
+ {$channel['relation_game_name']} |
+ {$channel['amount']} |
+ {$channel['game_ratio']}% |
+ {$channel['self_game_ratio']}% |
+ {$item['channel_rate']*100}% |
+ {$item['invoice_rate']*100}% |
+ {$channel['parter_settlement']} |
+ {$item['fine']} |
+ {$item['bonuses']} |
+ {$item['remark']} |
+
+
+
+ 123 |
+ {$channel['relation_game_name']} |
+ {$channel['amount']} |
+ {$channel['game_ratio']}% |
+ {$channel['self_game_ratio']}% |
+ {$channel['parter_settlement']} |
+
+
+
+
+
+
+
+
+
+
+
+
下游-汇总结算单
+
+
+
+
+
+
+ 排序 |
+ 平台 |
+ 会长账号 |
+ 游戏名称 |
+ 平台总额(元) |
+ 分成比例 |
+ 补点比例 |
+ 税费费率 |
+ 分成金额(元) |
+ 罚款 |
+ 奖励 |
+ 合计(元) |
+ 对账人 |
+ 时间 |
+ 备注 |
+
+
+
+
+
+
+ aOh! 暂时还没有可结算内容! |
+
+ $item): ?>
+ $channel): ?>
+
+
+ {$index+1} |
+ {$item.company_name} |
+ {$channel['account']} |
+ {$channel['relation_game_name']} |
+ {$channel['amount']} |
+ {$channel['game_ratio']}% |
+ {$channel['game_ratio_max']}% |
+ {$item['fax_ratio']*100}% |
+ {$channel['price']} |
+ {$item['fine']} |
+ {$item['bonuses']} |
+ {$item['total_amount']} |
+ {$item['settlement_contact']} |
+ 时间 |
+ 备注 |
+
+
+
+ {$channel['account']} |
+ {$channel['relation_game_name']} |
+ {$channel['amount']} |
+ {$channel['game_ratio']}% |
+ {$channel['game_ratio_max']}% |
+ {$channel['price']} |
+ 时间 |
+
+
+
+
+
+
+
+
+
+
+
下游-个人汇总结算单
+
+
+
+
+
+
+ 排序 |
+ 公司名称 |
+ 会长账号 |
+ 市场员 |
+ 下游类型 |
+ 下游性质 |
+ 游戏名称 |
+ 结算时间 |
+ 推广流水 |
+ 分成比例 |
+ 补点比例 |
+ 分成金额 |
+ 奖励 |
+ 罚款 |
+ 结算金额 |
+ 开户名 |
+ 银行卡号 |
+ 开户网点 |
+
+
+
+
+
+
+ aOh! 暂时还没有可结算内容! |
+
+ $item): ?>
+ $channel): ?>
+
+
+ {$index+1} |
+ {$item.company_name} |
+ {$channel['account']} |
+ {$channel['admin_name']} |
+ {$channel['company_relation_name']} |
+ {$channel['type_name']} |
+ {$channel['relation_game_name']} |
+ 结算时间 |
+ {$channel['amount']} |
+ {$channel['game_ratio']}% |
+ {$channel['game_ratio_max']}% |
+ {$channel['price']} |
+ {$item['bonuses']} |
+ {$item['fine']} |
+ {$item['total_amount']} |
+ {$item['settlement_contact']} |
+ {$item['bank_card']} |
+ {$item['bank_address']} |
+
+
+
+ {$channel['account']} |
+ {$channel['admin_name']} |
+ {$channel['company_relation_name']} |
+ {$channel['type_name']} |
+ {$channel['relation_game_name']} |
+ 结算时间 |
+ {$channel['amount']} |
+ {$channel['game_ratio']}% |
+ {$channel['game_ratio_max']}% |
+ {$channel['price']} |
+
+
+
+
+
+
+
+
+
+
+
+
+
请选择审核人:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
审核人:
+
+ $user_id):?>
+
+ {:get_admin_nickname($user_id)}
+ (
+
+ 通过
+
+
+
+ 待审核
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if(C('COLOR_STYLE')=='blue_color') echo '';
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Application/Admin/View/Settlement/sheetList.html b/Application/Admin/View/Settlement/sheetList.html
new file mode 100644
index 000000000..8514cb3bd
--- /dev/null
+++ b/Application/Admin/View/Settlement/sheetList.html
@@ -0,0 +1,254 @@
+
+
+
+
+
+
+
+
+
+
汇总结算单管理
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 结算单单号 |
+ 结算单类型 |
+ 时间 |
+ 结算方式 |
+ 申请时间 |
+ 申请人 |
+ 审核状态 |
+ 审核人 |
+ 备注 |
+ 操作 |
+
+
+
+
+
+ aOh! 暂时还没有内容! |
+
+
+
+
+ {$data.orderid} |
+ {$data.settlement_type_name} |
+ {:date('Y-m-d', $data['time_start'])} - {:date('Y-m-d', $data['time_end'])} |
+ {$data.settlement_time_type_name} |
+ {$data.create_time|date='Y-m-d H:i:s',###} |
+ {:get_admin_nickname($data['creater_id'])} |
+ {$data.status_name} |
+ {:get_admin_nickname($data['audit_users'][$data['step']-1])} |
+ {$data.remark} |
+
+ 查看
+ 解除
+ |
+
+
+
+
+
+
+
+
+ {$_page|default=''}
+
+
+
+
+
+
+
+
+
+
+ if(C('COLOR_STYLE')=='blue_color') echo '';
+
+
+
+
+
+
+
+
+
+
+
From 747bba16b0119c99f4ab06c4f7d4346bf075edce Mon Sep 17 00:00:00 2001
From: yulingwei <2436953959@qq.com>
Date: Mon, 17 Feb 2020 11:30:15 +0800
Subject: [PATCH 41/41] =?UTF-8?q?=E6=B1=87=E6=80=BB=E7=BB=93=E7=AE=97?=
=?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/MsgController.class.php | 11 +++-
.../Controller/SettlementController.class.php | 60 ++++++++++++++++---
Application/Admin/View/Msg/lists.html | 2 +-
.../Settlement/generatesettlementsheet.html | 24 +++++---
.../Admin/View/Settlement/sheetDetail.html | 10 ++--
.../Admin/View/Settlement/sheetList.html | 12 +++-
Data/update.sql | 23 ++++++-
7 files changed, 115 insertions(+), 27 deletions(-)
diff --git a/Application/Admin/Controller/MsgController.class.php b/Application/Admin/Controller/MsgController.class.php
index a23901b59..683bcaef4 100644
--- a/Application/Admin/Controller/MsgController.class.php
+++ b/Application/Admin/Controller/MsgController.class.php
@@ -70,8 +70,15 @@ class MsgController extends ThinkController{
}
$look= $model->where(['id'=>$ids])->find();
-
- redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']);
+ switch($look['type']) {
+ case 1:
+ redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']);
+ break;
+ case 3:
+ redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Settlement/sheetDetail/id/'.$look['game_id']);
+ break;
+ }
+
diff --git a/Application/Admin/Controller/SettlementController.class.php b/Application/Admin/Controller/SettlementController.class.php
index b13647e74..0068f55ca 100644
--- a/Application/Admin/Controller/SettlementController.class.php
+++ b/Application/Admin/Controller/SettlementController.class.php
@@ -19,13 +19,17 @@ class SettlementController extends ThinkController
if (I('creater_id')) {
$map['creater_id'] = I('creater_id');
}
+ if (I('all_status')) {
+ $map['all_status'] = I('all_status');
+ }
if (I('create_time_start')) {
$map['_string'] = "create_time >= ".strtotime(I('create_time_start'));
}
if (I('create_time_end')) {
$map['_string'] = "create_time <= ".strtotime(I('create_time_end'));
}
- $list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->select();
+ $login_uid = is_login();
+ $list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->order("if (audit_user ={$login_uid}, 0,1 ) and status = 3, all_status desc, create_time desc")->select();
$count = M('settlement_sheet', 'tab_')->where($map)->count();
if (!empty($list)) {
foreach ($list as &$item) {
@@ -79,11 +83,12 @@ class SettlementController extends ThinkController
// 生成结算单 月结算补点 周结不算
public function generateSettlementSheet($settlement_type = 0, $settlement_time_type = 0, $time_start=0, $time_end = 0, $delete=0, $id=0, $action='')
{
+ $msg = '';
$this->assign(I(''));
$this->assign('action', $action);
if ($delete) {
- $res = M('settlement_sheet', 'tab_'->where(['id'=>$id]))->delete();
- return $res ? $this->success('删除成功', true, true) : $this->success('删除失败', true, true);
+ $res = M('settlement_sheet', 'tab_')->where(['id'=>$id])->delete();
+ return $res ? $this->success('删除成功', '', true) : $this->success('删除失败', '', true);
}
$this->meta_title = '结算单管理';
if (empty($settlement_type)) {
@@ -106,14 +111,19 @@ class SettlementController extends ThinkController
$time_start = strtotime($settlement_time);
$time_end = strtotime('+1 month', $time_start) - 1;
}
+ if ($time_end > time()) {
+ $msg = "结算结算时间无法大于当前时间";
+ }
if (empty($time_start) || empty($time_end)) {
$msg = '请选择正确的时间区间';
}
if (IS_GET) {
- $msg = '';
// 判断结算时间是否冲突
-
+ $isExsist = M('settlement_sheet', 'tab_')->where(['settlement_type'=>$settlement_type, 'time_start'=>$time_start, 'time_end'=>$time_end, 'settlement_time_type'=>$settlement_time_type])->find();
+ if ($isExsist) {
+ $msg = "已存在此类型结算单";
+ }
// 生成结算单数据
$generate = false;
if (!$msg) {
@@ -153,6 +163,8 @@ class SettlementController extends ThinkController
'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
'channel_rate' => $item['channel_rate'], // 渠道费
'invoice_rate' => $item['invoice_rate'], // 税费
+ 'time_start' => date('Y-m-d', $time_start),
+ 'time_end' => date('Y-m-d', $time_end)
];
}
$data = [];
@@ -220,7 +232,9 @@ class SettlementController extends ThinkController
'bonuses'=>isset($reward[1]) ? $reward[1] : 0,
'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
'settlement_contact' => $item['settlement_contact'],
- 'create_time' => time()
+ 'create_time' => time(),
+ 'time_start' => date('Y-m-d', $time_start),
+ 'time_end' => date('Y-m-d', $time_end)
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
}
@@ -292,7 +306,9 @@ class SettlementController extends ThinkController
'settlement_contact' => $item['settlement_contact'],
'bank_card' => $item['bank_card'],
'bank_address' => $item['bank_address'],
- 'create_time' => time()
+ 'create_time' => time(),
+ 'time_start' => date('Y-m-d', $time_start),
+ 'time_end' => date('Y-m-d', $time_end)
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
}
@@ -362,7 +378,16 @@ class SettlementController extends ThinkController
$data['time_end'] = $time_end;
$data['audit_users'] = json_encode($_POST['audit_users']);
$data['settlement_sheet'] = json_encode($_POST['settlement_sheet']);
+ $data['audit_user'] = $_POST['audit_users'][0];
$res = M('settlement_sheet', 'tab_')->add($data);
+ // 生成消息
+ $notice['user_id'] = $_POST['audit_users'][0];
+ $notice['content'] = "结算单汇总审核:有一个结算单待你审核,请尽快处理!";
+ $notice['type'] = 3;
+ $notice['status'] = 2;
+ $notice['create_time'] = time();
+ $notice['game_id'] = $res;
+ M('msg', 'tab_')->add($notice);
return $res ? $this->success('生成成功', true, true) : $this->error('生成失败', true, true);
}
}
@@ -410,9 +435,26 @@ class SettlementController extends ThinkController
} else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) {
return $this->error('该结算单已经审核完毕', true, true);
}
+ $is_last = ($info['setp'] + 1 >= sizeof($info['audit_users']));
$update['remark'] = $remark;
- $update['status'] = $audit_type == 1 ? 3 : 2;
- $update['step'] = $audit_type == 1 ? $info['step'] + 1 : $info['step'];
+ $update['status'] = $audit_type == 1 ? ($is_last ? 1 : 3) : 2;
+ $update['step'] = ($audit_type == 1 && !$is_last) ? $info['step'] + 1 : $info['step'];
+ $update['audit_user'] = $login_uid;
+ if ($audit_type == 1 && $is_last) {
+ $update['all_status'] = 1;
+ } else if ($audit_type == 2) {
+ $update['all_status'] = 2;
+ }
+ // 通知审核
+ if ($update['status'] == 3 && !$is_last) {
+ $notice['user_id'] = $info['audit_users'][$info['step']];
+ $notice['content'] = "结算单汇总审核:有一个结算单待你审核,请尽快处理!";
+ $notice['type'] = 3;
+ $notice['status'] = 2;
+ $notice['create_time'] = time();
+ $notice['game_id'] = $id;
+ M('msg', 'tab_')->add($notice);
+ }
$upt = M('settlement_sheet', 'tab_')->where(['id'=>$id])->save($update);
return $upt ? $this->success('审核成功', true, true) : $this->error('审核失败', true, true);
}
diff --git a/Application/Admin/View/Msg/lists.html b/Application/Admin/View/Msg/lists.html
index 2e53f1a6a..26dc75f3f 100644
--- a/Application/Admin/View/Msg/lists.html
+++ b/Application/Admin/View/Msg/lists.html
@@ -58,7 +58,7 @@
{$data.id} |
-
+
{$data.content}
diff --git a/Application/Admin/View/Settlement/generatesettlementsheet.html b/Application/Admin/View/Settlement/generatesettlementsheet.html
index 30a6d247b..e4bdedc73 100644
--- a/Application/Admin/View/Settlement/generatesettlementsheet.html
+++ b/Application/Admin/View/Settlement/generatesettlementsheet.html
@@ -81,7 +81,6 @@
{$meta_title}
- 说明:该功能是用于录入工会所属的推广公司名称
@@ -123,7 +122,18 @@
- {$msg}
+
上游-汇总结算单
@@ -235,7 +245,7 @@
| {$item['bonuses']} |
{$item['total_amount']} |
{$item['settlement_contact']} |
- 时间 |
+ {$item['time_start']} 至 {$item['time_end']} |
备注 |
@@ -246,7 +256,7 @@
{$channel['game_ratio']}% |
{$channel['game_ratio_max']}% |
{$channel['price']} |
- 时间 |
+ {$item['time_start']} 至 {$item['time_end']} |
@@ -301,7 +311,7 @@
{$channel['company_relation_name']} |
{$channel['type_name']} |
{$channel['relation_game_name']} |
- 结算时间 |
+ {$item['time_start']} 至 {$item['time_end']} |
{$channel['amount']} |
{$channel['game_ratio']}% |
{$channel['game_ratio_max']}% |
@@ -320,7 +330,7 @@
{$channel['company_relation_name']} |
{$channel['type_name']} |
{$channel['relation_game_name']} |
- 结算时间 |
+ {$item['time_start']} 至 {$item['time_end']} |
{$channel['amount']} |
{$channel['game_ratio']}% |
{$channel['game_ratio_max']}% |
@@ -394,7 +404,7 @@