Merge remote-tracking branch 'origin/feature/promote' into feature/promote

master
“用lww 5 years ago
commit 4a926a85b0

@ -541,4 +541,19 @@ function getPartnerList($id = 0)
function getPartnerName($id = 0)
{
return M('Partner', 'tab_')->where(array('id' => intval($id)))->getField('partner');
}
function getTopPromote($promote_id)
{
$promoter = M('promote', 'tab_')->where(['id' => $promote_id])->find();
if (!$promoter) {
return [];
}
$chain = trim($promoter['chain'], '/');
if ($chain == '') {
return $promoter;
} else {
$topPromoteId = explode('/', $chain)[0];
return M('promote', 'tab_')->where(['id' => $topPromoteId])->find();
}
}

@ -2,6 +2,7 @@
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
use Base\Service\PromoteService as PromoteService;
/**
* 后台首页控制器
@ -57,6 +58,8 @@ class MendController extends ThinkController {
public function edit($id = null)
{
// $promoteService = new PromoteService();
if (IS_POST) {
if ($_POST['prmoote_id_to'] == -1){
$_POST['prmoote_id_to'] = 0;
@ -68,12 +71,14 @@ class MendController extends ThinkController {
$this->error('没有变更数据');
}
$create = $_REQUEST;
dump($create);
$map['id'] = $create['user_id'];
$map_['user_id'] = $create['user_id'];
$data['promote_id'] = $create['prmoote_id_to'];
$data['promote_account'] = get_promote_name($create['prmoote_id_to']);
// 加入补链时间
$data['rebind_time'] = $create['rebind_time'];
dump($data);
$user_data = $data;
$promote = M('promote', 'tab_')->where(array("id"=>I('prmoote_id_to')))->find();
if ($promote['parent_id'] != "0") {
@ -85,24 +90,24 @@ class MendController extends ThinkController {
$user_data['parent_name']=get_promote_name($user_data['parent_id']);
$user = M('user', 'tab_')->where($map)->save($user_data);
$user_ = M('UserPlay', 'tab_')->where($map_)->save($data);
$puser_ = M('UserPlayInfo', 'tab_')->where($map_)->save($data);
$spend = M('Spend', 'tab_')->where($map_)->where(array('is_check'=>array('in','1,2')))->save($data);// spend只改未对账的数据
$depost = M('Deposit', 'tab_')->where($map_)->save($data);
$Bind_spend = M('Bind_spend', 'tab_')->where($map_)->save($data);
$create['user_account'] = get_user_account($create['user_id']);
$create['promote_account'] = get_promote_name($create['promote_id']);
$create['promote_id_to'] = $create['prmoote_id_to'];
$create['promote_account_to'] = get_promote_name($create['prmoote_id_to']);
$create['create_time'] = time();
$create['op_id'] = UID;
$create['op_account'] = session('user_auth.username');
$create['bind_type'] = $create['bind_type'];
$mend = M('mend', 'tab_')->add($create);
if ($mend) {
$this->success('补链成功', U('lists'), 2);
}
// $user = M('user', 'tab_')->where($map)->save($user_data);
// $user_ = M('UserPlay', 'tab_')->where($map_)->save($data);
// $puser_ = M('UserPlayInfo', 'tab_')->where($map_)->save($data);
// $spend = M('Spend', 'tab_')->where($map_)->where(array('is_check'=>array('in','1,2')))->save($data);// spend只改未对账的数据
// $depost = M('Deposit', 'tab_')->where($map_)->save($data);
// $Bind_spend = M('Bind_spend', 'tab_')->where($map_)->save($data);
// $create['user_account'] = get_user_account($create['user_id']);
// $create['promote_account'] = get_promote_name($create['promote_id']);
// $create['promote_id_to'] = $create['prmoote_id_to'];
// $create['promote_account_to'] = get_promote_name($create['prmoote_id_to']);
// $create['create_time'] = time();
// $create['op_id'] = UID;
// $create['op_account'] = session('user_auth.username');
// $create['bind_type'] = $create['bind_type'];
// $mend = M('mend', 'tab_')->add($create);
// if ($mend) {
// $this->success('补链成功', U('lists'), 2);
// }
} else {
$user = A('User', 'Event');
$user_data = $user->user_entity($id);

@ -31,36 +31,14 @@ class PromoteController extends ThinkController {
$promoteid = $_REQUEST['promote_id'];
unset($_REQUEST['promote_id']);
if(isset($_REQUEST['parent_id'])) {
$parent_id = $_REQUEST['parent_id'];
unset($_REQUEST['parent_id']);
if($promoteid == $parent_id) {
$map['id'] = $promoteid;
} else {
$maps['parent_id'] = $parent_id;
$maps['grand_id'] = $parent_id;
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select();
if (!empty($pro_ids)){
$map['id'] = array('eq',-1);
}
}
} else {
$map['id'] = $promoteid;
/* $maps['parent_id'] = $promoteid;
$maps['grand_id'] = $promoteid;
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id,account')->where($maps)->select();
$pro_ids = array_column($pro,'id');
$pro_ids[] = $promoteid;
if (!empty($pro_ids)){
$map['id'] = ['in',$pro_ids];
}else{
$map['id'] = array('eq',-1);
} */
}
} else {
@ -315,32 +293,9 @@ unset($_REQUEST['parent_id']);
} else {
$parent_id = get_promote_id($_REQUEST['parent_id']);
$maps['parent_id'] = $parent_id;
$maps['grand_id'] = $parent_id;
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select();
if (!empty($pro_ids)){
$map['tab_user.promote_id'] = array('eq',-1);
}
}
} else {
/*$maps['parent_id'] = $promoteid;
$maps['grand_id'] = $promoteid;
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id,account')->where($maps)->select();
$pro_ids = array_column($pro,'id');
$pro_ids[] = $promoteid;
if (!empty($pro_ids)){
$map['tab_user.promote_id'] = ['in',$pro_ids];
}else{
$map['tab_user.promote_id'] = array('eq',-1);
}*/
$map['tab_user.promote_id'] = $promoteid;
}
}
@ -348,10 +303,7 @@ unset($_REQUEST['parent_id']);
if(isset($_REQUEST['parent_id'])){
$parent_id = get_promote_id($_REQUEST['parent_id']);
$maps['parent_id'] = $parent_id;
$maps['grand_id'] = $parent_id;
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id,account')->where($maps)->select();
$pro = M('promote','tab_')->field('id,account')->where("chain like '%/{$parent_id}/%'")->select();
$pro_ids = array_column($pro,'id');
$pro_ids[] = get_promote_id($_REQUEST['parent_id']);
if (!empty($pro_ids)){
@ -510,10 +462,7 @@ unset($_REQUEST['parent_id']);
} else {
$maps['parent_id'] = I('parent_id');
$maps['grand_id'] =I('parent_id');
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id')->where([array('id'=>$map['promote_id']),$maps])->select();
$pro = M('promote','tab_')->field('id')->where("chain like '%/{$_REQUEST['parent_id']}/%' or id={$_REQUEST['parent_id']}")->select();
if(!$pro) {
$map['promote_id'] = array('eq',999999999);
@ -522,20 +471,6 @@ unset($_REQUEST['parent_id']);
}
} else {
/*$maps['parent_id'] = $map['promote_id'];
$maps['grand_id'] =$map['promote_id'];
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id')->where($maps)->select();
$pro_ids = array_column($pro,'id');
$pro_ids[] = $map['promote_id'];
if (!empty($pro_ids)){
$map['promote_id'] = ['in',$pro_ids];
}else{
$map['promote_id'] = array('eq',999999999);
}
*/
}
}
@ -543,10 +478,7 @@ unset($_REQUEST['parent_id']);
}else{
if(!empty(I('parent_id'))){
$maps['parent_id'] = I('parent_id');
$maps['grand_id'] =I('parent_id');
$maps['_logic'] = 'or';
$pro = M('promote','tab_')->field('id')->where($maps)->select();
$pro = M('promote','tab_')->field('id')->where("chain like '%/{$_REQUEST['parent_id']}/%'")->select();
$pro_ids = array_column($pro,'id');
$pro_ids[] = I('parent_id');
if (!empty($pro_ids)){
@ -832,11 +764,7 @@ unset($_REQUEST['parent_id']);
public function del_promote(){
if(IS_AJAX){
M()->startTrans();
$map['id'] = $_POST['id'];
$map['parent_id'] = $_POST['id'];
$map['grand_id'] = $_POST['id'];
$map['_logic'] = 'or';
$result = M('promote','tab_')->where($map)->delete();
$result = M('promote','tab_')->where("chain like '%/{$_POST['id']}/%' or id={$_POST['id']} ")->delete();
if($result){
M()->commit();
$this->ajaxReturn(array('status'=>1,'msg'=>'删除成功'));

@ -84,7 +84,7 @@
<empty name='show_status'>
<div class="input-list input-list-parent search_label_rehab">
<select id="parent_id" name="parent_id" class="select_gallery" >
<option value="">线推广员</option>
<option value="">推广员</option>
<volist name=":get_all_toppromote()" id="vo">
<option parent-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
</volist>
@ -157,7 +157,7 @@
<th ><a class="paixu" data-order='create_time'>注册时间</a></th>
<th ><a class="paixu" data-order='last_login_time'>最后登录时间</a></th>
<th>渠道类型</th>
<th>上线推广员</th>
<th>上线会长</th>
<th>商务专员</th>
<th>状态</th>
<th>可申请游戏</th>
@ -184,7 +184,7 @@
<td>{:set_show_time($data['create_time'])}</td>
<td>{:set_show_time($data['last_login_time'])}</td>
<td>{:get_promote_levels($data['id'])}</td>
<td><empty name="data.grand_id">{:get_top_promote($data['id'],$data['parent_id'])}<else/>{:get_top_promote($data['id'],$data['grand_id'])}</empty></td>
<td>{:getTopPromote($data['id'])['account']}</td>
<td>{:get_business_affairs_account($data['ba_id'])}</td>
<td><if condition="$data['status'] eq 0">
<span class="preview_status">{:get_info_status($data['status'],3)}</span>

@ -76,14 +76,16 @@ class ApplyService {
public function getDownloadUrl($apply)
{
$host = Request::getHost();
$host = C('DOMAIN_DOWNLOAD');
$host = $host ? $host : Request::getHost();
$code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_DOWNLOAD);
return $host . '/index.php?s=/Home/Download/index/code/' . $code;
}
public function getLandingPageUrl($apply)
{
$host = Request::getHost();
$host = C('DOMAIN_DOWNLOAD');
$host = $host ? $host : Request::getHost();
$code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_LANDING_PAGE);
return $host . '/index.php?s=/Home/Home/landingPage/code/' . $code;
}

@ -5,6 +5,7 @@ use Base\Model\PromoteModel;
use Base\Model\UserPlayInfoModel;
use Base\Model\UserPlayModel;
use Base\Model\UserModel;
use Base\Tool\IdCard;
use Think\Model;
class PromoteService {
@ -91,6 +92,7 @@ class PromoteService {
$balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0;
$type = isset($params['type']) ? $params['type'] : 0;
$shiftIds = isset($params['shift_ids']) && $params['shift_ids'] ? $params['shift_ids'] : [];
$create_promote_id = empty(session('promote_auth.pid')) ? 0 : session('promote_auth.pid');
if ($fromPromoteId == $toPromoteId) {
return [
@ -122,32 +124,17 @@ class PromoteService {
'order_time' => strtotime($orderTime),
'balance_coin_mode' => $balanceCoinMode,
'create_time' => time(),
'create_promote_id' => session('promote_auth.pid'),
'create_promote_id' => $create_promote_id,
'status' => 0,
'type' => $type,
'shift_ids' => json_encode($shiftIds)
];
if (M('ShiftTask')->add($data)) {
$id = M()->getLastInsID();
$data['id'] = $id;
if ($isFuture) {
return [
'status' => true,
'msg'=>'迁移任务创建成功'
];
} else {
if ($type == 1) {
return $this->shiftPromote($data);
} elseif ($type == 2) {
return $this->shiftPlayer($data);
} else {
return [
'status' => false,
'msg'=>'数据异常'
];
}
}
return [
'status' => true,
'msg'=>'迁移任务创建成功'
];
} else {
return [
'status' => false,
@ -196,7 +183,7 @@ class PromoteService {
return ['status' => false, 'msg' => '系统异常修改推广员CHAIN失败'];
}
$status1 = M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1]);
$status1 = M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1, 'handle_time' => time()]);
if (!$status1) {
$model->rollback();
return ['status' => false, 'msg' => '系统异常,修改迁移任务状态失败'];
@ -300,22 +287,25 @@ class PromoteService {
public function shiftPlayer($task)
{
/**
* @todo 加事务
*/
$toPromoteId = $task['to_promote_id'];
$fromPromoteId = $task['from_promote_id'];
$shiftIds = json_decode($task['shift_ids'], true) ?? [];
$createPromote = D('promote')->where(['create_promote_id' => $task['create_promote_id']])->find();
$createPromote = M('promote', 'tab_')->where(['create_promote_id' => $task['create_promote_id']])->find();
$toPromote = D('promote')->where(['id' => $toPromoteId])->find();
$fromPromote = D('promote')->where(['id' => $fromPromoteId])->find();
$toPromote = M('promote', 'tab_')->where(['id' => $toPromoteId])->find();
$fromPromote = M('promote', 'tab_')->where(['id' => $fromPromoteId])->find();
$user1 = new UserModel();
$users = $user1->field(['id', 'account', 'nickname'])->where('promote_id=' . $fromPromoteId)->select();
$map = ['promote_id' => $fromPromote['id']];
if (count($shiftIds) > 0) {
$map['id'] = ['in', $shiftIds];
}
$users = M('user', 'tab_')->field(['id', 'account', 'nickname'])->where($map)->select();
$mends = [];
foreach ($users as $item) {
$data = [
$mends[] = [
'user_id' => $item['id'],
'user_account' => $item['account'],
'user_nickname' => $item['nickname'],
@ -330,20 +320,57 @@ class PromoteService {
'op_type' => 1,
'bind_type' => 1,
];
M('Mend', 'tab_')->add($data);
}
$user = new UserModel();
$user->where('promote_id=' . $fromPromoteId)->save(['promote_id' => $toPromoteId, 'promote_account' => $toPromote['account']]);
$model = new Model();
$model->startTrans();
$status = M('mend', 'tab_')->addAll($mends);
if (!$status) {
$model->rollback();
return ['status' => false, 'msg' => '系统异常,添加变更记录失败'];
}
$userPlayer = new UserPlayModel();
$userPlayer->where('promote_id=' . $fromPromoteId)->save(['promote_id' => $toPromoteId, 'promote_account' => $toPromote['account']]);
$updateData = [
'promote_id' => $toPromote['id'],
'promote_account' => $toPromote['account']
];
$map = $otherMap = ['promote_id' => $fromPromote['id']];
if (count($shiftIds) > 0) {
$map['id'] = ['in', $shiftIds];
$otherMap['user_id'] = ['in', $shiftIds];
}
$userPlayerInfo = new UserPlayInfoModel();
$userPlayerInfo->where('promote_id=' . $fromPromoteId)->save(['promote_id' => $toPromoteId, 'promote_account' => $toPromote['account']]);
$status = M('user', 'tab_')->where($map)->save($updateData);
if (!$status) {
$model->rollback();
return ['status' => false, 'msg' => '系统异常,修改用户推广员失败'];
}
M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1]);
$status = M('user_play', 'tab_')->where($otherMap)->save($updateData);
if (!$status) {
$model->rollback();
return ['status' => false, 'msg' => '系统异常,修改玩家推广员失败'];
}
$status = M('user_play_info', 'tab_')->where($otherMap)->save($updateData);
if (!$status) {
$model->rollback();
return ['status' => false, 'msg' => '系统异常,修改角色推广员失败'];
}
M('spend', 'tab_')->where($otherMap)->where(['is_check' => ['in','1,2']])->save($updateData); // 只改未对账的数据
M('deposit', 'tab_')->where($otherMap)->save($updateData);
M('bind_spend', 'tab_')->where($otherMap)->save($updateData);
$status = M('shift_task', 'sys_')->where('id=' . $task['id'])->save(['status' => 1, 'handle_time' => time()]);
if (!$status) {
$model->rollback();
return ['status' => false, 'msg' => '系统异常,修改迁移任务失败'];
}
$model->commit();
return ['status' => true, 'msg' => '玩家迁移成功'];
}
@ -784,6 +811,45 @@ class PromoteService {
'message' => '账号长度为6-15个字符',
];
}
if ($mobile == '') {
return [
'status' => false,
'message' => '请输入手机号',
];
} else {
if (!preg_match("/^1[3456789]{1}\d{9}$/", $mobile)) {
return [
'status' => false,
'message' => '手机号格式错误',
];
}
}
if ($idcard == '') {
return [
'status' => false,
'message' => '请输入身份证号',
];
} else {
if (!IdCard::isIdcard($idcard)) {
return [
'status' => false,
'message' => '身份证格式错误',
];
}
}
if ($realName == '') {
return [
'status' => false,
'message' => '请输入姓名',
];
} else {
if (mb_strlen($realName) < 2 || mb_strlen($realName) > 4) {
return [
'status' => false,
'message' => '姓名长度为2-4个字符',
];
}
}
if ($password == '') {
return [
'status' => false,

@ -0,0 +1,52 @@
<?php
namespace Base\Tool;
class IdCard
{
public static function isIdcard($id)
{
$id = strtoupper($id);
$regx = "/(^\d{15}$)|(^\d{17}([0-9]|X)$)/";
$arr_split = array();
if (!preg_match($regx, $id)) {
return false;
}
if (15 == strlen($id)) {
$regx = "/^(\d{6})+(\d{2})+(\d{2})+(\d{2})+(\d{3})$/";
@preg_match($regx, $id, $arr_split);
//检查生日日期是否正确
$dtm_birth = "19" . $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4];
if (!strtotime($dtm_birth)) {
return false;
} else {
return true;
}
} else {
$regx = "/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/";
@preg_match($regx, $id, $arr_split);
$dtm_birth = $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4];
if (!strtotime($dtm_birth)) {
return false;
} else {
//检验18位身份证的校验码是否正确。
//校验位按照ISO 7064:1983.MOD 11-2的规定生成X可以认为是数字10。
$arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
$arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
$sign = 0;
for ($i = 0; $i < 17; $i++) {
$b = (int)$id{$i};
$w = $arr_int[$i];
$sign += $b * $w;
}
$n = $sign % 11;
$val_num = $arr_ch[$n];
if ($val_num != substr($id, 17, 1)) {
return false;
} else {
return true;
}
}
}
}
}

@ -252,7 +252,7 @@ class BaseController extends HomeController
}
//验证安全密码--视图
public function verifyPasswordView($modelList, $metaTitle)
public function verifyPasswordView($modelList, $show = true)
{
$securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码
$model = new \User\Api\PromoteApi();
@ -260,11 +260,14 @@ class BaseController extends HomeController
if ($res) {
return true;
}
if ($show) {
$this->assign('modelList', $modelList);
$this->assign('meta_title', '安全密码');
$this->display('Public/verify_password');
exit;
}
$this->assign('modelList', $modelList);
$this->assign('metaTitle', $metaTitle);
$this->display('Public/verify_password');
exit;
return false;
}
//验证安全密码

@ -2,6 +2,7 @@
namespace Home\Controller;
use Base\Model\Model;
use OT\DataDictionary;
use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
@ -12,12 +13,144 @@ use Base\Repository\UserRepository;
*/
class FinanceController extends BaseController
{
//提现状态
public static $withdrawStatus = [
-1 => '审核未通过',
0 => '待审核',
1 => '汇款中',
2 => '已汇款',
];
//权限过滤
private function purview()
{
$this->loginPromote = $this->getLoginPromote();
if ($this->loginPromote['level'] != 1) {
$this->error('权限异常');
}
return true;
}
private function getDayList($beginTime, $endTime)
{
$dayList = [];
do {
$dayList[] = date('Y-m-d', $beginTime);
$beginTime += 24 * 60 * 60;
} while ($beginTime < $endTime);
return $dayList;
}
private function assembleRecords($items, $keys, $valueColumn, $keyColumn = 'day')
{
$records = [];
foreach ($keys as $key) {
$value = 0;
foreach ($items as $item) {
if ($item[$keyColumn] == $key) {
$value = $item[$valueColumn];
}
}
$records[$key] = $value;
}
return $records;
}
//生成提现单号
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 index()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList);
$model = M('spend', 'tab_');
$thisDay = strtotime(date('Y-m-d'));
$thisMonth = strtotime(date('Y-m'));
$yesterday = strtotime(date('Y-m-d', strtotime('-1 day', time())));
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initEndTime = $nowTime;
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$endTime = $endTime + 3600 * 24;
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$promoteIds = M('promote', 'tab_')->where($map)->getField('id', true);
$promoteIds[] = $this->loginPromote['id'];
$promoteIds = implode(',', $promoteIds);
$map = [];
$map['pay_status'] = 1;
$map['promote_id'] = ['in', $promoteIds];
$income = $model->field("sum(if(pay_time < $thisDay, if(selle_ratio > 0, pay_amount * selle_ratio, 0), 0)) as history_income,
sum(if(pay_time >= $thisMonth, if(selle_ratio > 0, pay_amount * selle_ratio, 0), 0)) as this_month_income,
sum(if((pay_time >= $yesterday and pay_time < $thisDay), if(selle_ratio > 0, pay_amount * selle_ratio, 0), 0)) as yesterday_income,
sum(if(pay_time < $thisDay, if(selle_status = 0, pay_amount * selle_ratio, 0), 0)) as balance")
->where($map)
->find();
foreach ($income as &$value) {
$value = bcdiv($value, 100, 2);
}
$map['pay_time'] = ['between', [$begTime, $endTime]];
$dayList = $this->getDayList($begTime, $endTime);
$data = $model->field('FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,
sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as income')
->where($map)
->group('day')
->select();
$data = $this->assembleRecords($data, $dayList, 'income');
foreach ($dayList as $day) {
$date = date('Ymd', strtotime($day));
$records[] = [
'day' => $date,
'income' => bcdiv($data[$day], 100, 2),
'url' => U('settlementDtl', array('begtime' => $day, 'endtime' => $day))
];
}
$this->assign('income', $income);
$this->assign('listData', $records);
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('yesterday', date('Y-m-d', $yesterday));
$this->assign('meta_title', $metaTitle);
$this->display();
}
//结算明细
public function settlementDtl()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList, $metaTitle);
$this->verifyPasswordView($modelList);
$model = M('spend', 'tab_');
$page = intval(I('get.p', 1));
@ -31,7 +164,6 @@ class FinanceController extends BaseController
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$loginPromote = $this->getLoginPromote();
$parameter['p'] = $page;
$parameter['row'] = $row;
@ -39,9 +171,9 @@ class FinanceController extends BaseController
$parameter['begtime'] = $initBegTime;
$parameter['endtime'] = $initEndTime;
$map['chain'] = ['like', $loginPromote['chain'] . $loginPromote['id'] . '/%'];
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$ids[] = $loginPromote['id'];
$ids[] = $this->loginPromote['id'];
$ids = implode(',', $ids);
$map = [];
@ -57,22 +189,44 @@ class FinanceController extends BaseController
$map['pay_time'] = ['between', [$begTime, $endTime + 86399]];
}
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,convert(pay_amount*if(selle_ratio >= 0,selle_ratio,0),decimal(10,2)) as income,pay_time,selle_status')
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id')
->where($map)
->order('id desc')
->page($page, $row)
->select();
$count = $model->where($map)->count();
//提现状态
$withdrawIds = [];
foreach ($data as $key => $value) {
if ($value['withdraw_id'] > 0 && !in_array($value['withdraw_id'], $withdrawIds)) {
$withdrawIds[] = $value['withdraw_id'];
}
}
$withdrawStatus = M('withdraw', 'tab_')
->where(array('id' => ['in', $withdrawIds]))
->getField('id,status');
foreach ($data as &$list) {
switch ($list['selle_status']) {
case 0:
$list['selle_status'] = '未提现';
break;
default:
$list['selle_status'] = '';
break;
//提现状态
if ($list['pay_status'] == 1) {
switch ($list['selle_status']) {
case 0:
$list['selle_status'] = '未提现';
break;
default:
if ($list['withdraw_id'] > 0) {
$list['selle_status'] = FinanceController::$withdrawStatus[$withdrawStatus[$list['withdraw_id']]];
} else {
$list['selle_status'] = '';
}
break;
}
} else {
$list['selle_status'] = '支付失败';
}
$list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2);
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
}
@ -83,7 +237,252 @@ class FinanceController extends BaseController
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('_page', $page);
$this->assign('meta_title', '结算明细');
$this->assign('meta_title', $metaTitle);
$this->assign('modelList', $modelList);
$this->display();
}
//提现
public function withdraw()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
$data['msg'] = '权限异常';
$this->ajaxReturn($data);
}
$spendModel = M('spend', 'tab_');
$thisDay = strtotime(date('Y-m-d'));
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$promoteIds = M('promote', 'tab_')->where($map)->getField('id', true);
$promoteIds[] = $this->loginPromote['id'];
$promoteIds = implode(',', $promoteIds);
$map = [];
$map['pay_status'] = 1;
$map['selle_status'] = 0;
$map['promote_id'] = ['in', $promoteIds];
$map['pay_time'] = ['lt', $thisDay];
$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);
}
$thisTime = time();
$add['sum_money'] = $balance;
$add['promote_id'] = $this->loginPromote['id'];
$add['promote_account'] = $this->loginPromote['account'];
$add['create_time'] = $thisTime;
$add['status'] = 0;
$add['widthdraw_number'] = $this->produceWithdrawNumber();
$add['settlement_end_time'] = $thisDay - 1;
M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add);
if (!$withdrawId) {
M()->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '提现失败';
$this->ajaxReturn($data);
}
$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 withdrawRecord()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '提现记录';
$modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList);
$model = M('withdraw', 'tab_');
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
$withdrawNumber = I('widthdraw_number', '');
$initBegTime = I('begtime', '');
$initEndTime = I('endtime', '');
$begTime = strtotime(date('Y-m-d', strtotime($initBegTime)));
$endTime = strtotime(date('Y-m-d', strtotime($initEndTime))) + 3600 * 24;
$status = '';
$parameter['p'] = $page;
$parameter['row'] = $row;
$parameter['widthdraw_number'] = $withdrawNumber;
$parameter['begtime'] = $initBegTime;
$parameter['endtime'] = $initEndTime;
$map['promote_id'] = $this->loginPromote['id'];
if (!empty($withdrawNumber)) {
$map['widthdraw_number'] = $withdrawNumber;
}
if (!empty($initBegTime) && empty($initEndTime)) {
$map['create_time'] = ['egt', $begTime];
} elseif (empty($initBegTime) && !empty($initEndTime)) {
$map['create_time'] = ['lt', $endTime];
} elseif (!empty($initBegTime) && !empty($initEndTime)) {
$map['create_time'] = ['between', [$begTime, $endTime - 1]];
}
if (isset($_GET['status']) && $_GET['status'] !== '') {
$status = intval($_GET['status']);
if (!isset(FinanceController::$withdrawStatus[$status])) {
if (!isset(FinanceController::$withdrawStatus[$status])) {
$this->error('参数异常');
}
$map['status'] = $status;
}
}
$data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond')
->where($map)
->order('id desc')
->page($page, $row)
->select();
$count = $model
->where($map)
->count();
if (!empty($data)) {
foreach ($data as &$list) {
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status'] = FinanceController::$withdrawStatus[$list['status']];
}
}
$page = set_pagination($count, $row, $parameter);
$this->assign('listData', $data);
$this->assign('count', $count);
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('status', $status);
$this->assign('_page', $page);
$this->assign('meta_title', $metaTitle);
$this->assign('modelList', $modelList);
$this->display();
}
//提现明细
public function withdrawDtl()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '提现明细';
$modelList = ['财务管理', '提现记录', $metaTitle];
$this->verifyPasswordView($modelList);
$model = M('withdraw', 'tab_');
$spendModel = M('spend', 'tab_');
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
$withdrawId = intval(I('get.id', 0));
if ($withdrawId == 0) {
$this->error('参数异常');
}
$withdraw = $model->field('promote_id,status')->where(array('id' => $withdrawId))->find();
if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) {
$this->error('参数异常');
}
$gameId = intval(I('game_id', 0));
$userAccount = I('user_account', '');
$payOrderNumber = I('pay_order_number', '');
$parameter['p'] = $page;
$parameter['row'] = $row;
$parameter['id'] = $withdrawId;
$parameter['game_id'] = $gameId;
$parameter['user_account'] = $userAccount;
$parameter['pay_order_number'] = $payOrderNumber;
$map['withdraw_id'] = $withdrawId;
if (!empty($gameId)) {
$map['game_id'] = $gameId;
}
if (!empty($userAccount)) {
$map['user_account'] = $userAccount;
}
if (!empty($payOrderNumber)) {
$map['pay_order_number'] = $payOrderNumber;
}
$data = $spendModel
->field('id,pay_order_number,game_name,sdk_version,user_account,pay_amount,pay_way,selle_ratio,pay_time')
->where($map)
->order('id desc')
->page($page, $row)
->select();
$count = $spendModel
->where($map)
->count();
if (!empty($data)) {
foreach ($data as &$list) {
$list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2);
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
switch ($list['pay_way']) {
case 2:
case 3:
case 4:
$list['pay_way_name'] = QueryController::$payWay[2];
break;
default:
$list['pay_way_name'] = QueryController::$payWay[$list['pay_way']];
break;
}
}
}
$page = set_pagination($count, $row, $parameter);
$this->assign('listData', $data);
$this->assign('count', $count);
$this->assign('status', FinanceController::$withdrawStatus[$withdraw['status']]);
$this->assign('_page', $page);
$this->assign('meta_title', $metaTitle);
$this->assign('modelList', $modelList);
$this->display();
}
}

@ -22,7 +22,7 @@ class GameDivideController extends BaseController
//验证安全密码
$metaTitle = '分成比例';
$modelList = ['游戏管理', $metaTitle];
$this->verifyPasswordView($modelList, $metaTitle);
$this->verifyPasswordView($modelList);
$map['tab_game.online_status'] = 1;//开发者游戏上线状态
$map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请
@ -78,6 +78,7 @@ class GameDivideController extends BaseController
$this->assign('count', $count);
$this->assign('serverType', I('server_type', 0));
$this->meta_title = $metaTitle;
$this->assign('modelList', $modelList);
$this->display();
}
}

@ -66,14 +66,14 @@ class PromoteController extends BaseController
$promote_id = get_pid();
$field = 'id,game_name,server_name,user_account,nickname,promote_account,detail,create_time as update_time';
$rz_list = M("protect_log","tab_")->field($field)->where("promote_id = {$promote_id}")->limit('0,5')->order("create_time desc")->select(); //日志管理
$rz_list = M("protect_log", "tab_")->field($field)->where("promote_id = {$promote_id}")->limit('0,5')->order("create_time desc")->select(); //日志管理
$logCount = M('protect_log','tab_')->where("promote_id = {$promote_id}")->count();
$readLogCount = M('protect_log_read','tab_')->where("promote_id = {$promote_id}")->count();
$logCount = M('protect_log', 'tab_')->where("promote_id = {$promote_id}")->count();
$readLogCount = M('protect_log_read', 'tab_')->where("promote_id = {$promote_id}")->count();
$gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select();
$gg_Count = count($gg_data);
$gg_data = implode(',',array_column($gg_data,'id'));
$gg_data = implode(',', array_column($gg_data, 'id'));
$gg_where = "promote_id = {$promote_id} and category_id=56";
if ($gg_data) {
@ -85,7 +85,7 @@ class PromoteController extends BaseController
$zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select();
$zx_Count = count($zx_data);
$zx_data = implode(',',array_column($zx_data,'id'));
$zx_data = implode(',', array_column($zx_data, 'id'));
$zx_where = "promote_id = {$promote_id} and category_id=51";
if ($zx_data) {
$zx_where .= " and document_id IN({$zx_data})";
@ -97,8 +97,8 @@ class PromoteController extends BaseController
$today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$today_open_server_list = M("server as sv", "tab_")
->where(
array("sv.start_time" => array("BETWEEN", array($today_start, $today_end)),
"sv.show_status" => 1))
array("sv.start_time" => array("BETWEEN", array($today_start, $today_end)),
"sv.show_status" => 1))
->join("left join tab_game gm on gm.id=sv.game_id")
->field('sv.*,gm.icon')
->order("sv.start_time desc")
@ -122,29 +122,29 @@ class PromoteController extends BaseController
//计算当日用户充值数据
$map['_string'] = "promote_id = {$promote_id} or tab_promote.parent_id = {$promote_id} or tab_promote.chain like '%/{$promote_id}/%' ";
$pay_time = " between 0 and ".time();
$spendData = $this->caculateSpend($pay_time,$map['_string']);
$pay_time = " between 0 and " . time();
$spendData = $this->caculateSpend($pay_time, $map['_string']);
$promoteId = implode(',',$promoteId);
$promoteId = implode(',', $promoteId);
if ($promoteId) {
$user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count();
} else {
$user_count = 0;
}
$today=total(1);
$today = total(1);
$yesterdays = total(5);
$week=total(2);
$mounth=total(3);
$week = total(2);
$mounth = total(3);
//计算今日的统计数据
$data=M('User','tab_')
$data = M('User', 'tab_')
->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count,
IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 ,
count(IF(register_time '.$yesterdays.',1,null)) as yesterday,
count(IF(register_time '.$today.',1,null)) as today,
count(IF(register_time '.$week.',1,null)) as week,
count(IF(register_time '.$mounth.',1,null)) as mounth')
->join('tab_promote on promote_id = tab_promote.id','left')
count(IF(register_time ' . $yesterdays . ',1,null)) as yesterday,
count(IF(register_time ' . $today . ',1,null)) as today,
count(IF(register_time ' . $week . ',1,null)) as week,
count(IF(register_time ' . $mounth . ',1,null)) as mounth')
->join('tab_promote on promote_id = tab_promote.id', 'left')
->where($map)
->group('promote_id1')
->having('promote_id != 0')
@ -152,42 +152,42 @@ class PromoteController extends BaseController
->find();
// echo M('User','tab_')->_sql();die();
$total_money = $this->pay_total(0, 0,$promoteId);
$today_add_user_money = $this->pay_total(1,1,$promoteId);
$month_add_user_money = $this->pay_total(3,1,$promoteId);
$total_money = $this->pay_total(0, 0, $promoteId);
$today_add_user_money = $this->pay_total(1, 1, $promoteId);
$month_add_user_money = $this->pay_total(3, 1, $promoteId);
$yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
$yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
//计算昨天用户的统计数据,当日用户充值数据
$pay_time = " between {$yesterday_start} and {$yesterday_end}";
$createTime = ['between',array($yesterday_start,$yesterday_end-1)];
$yesterdaySpendData = $this->caculateSpend($pay_time,$map['_string'],$createTime);
$createTime = ['between', array($yesterday_start, $yesterday_end - 1)];
$yesterdaySpendData = $this->caculateSpend($pay_time, $map['_string'], $createTime);
$todayAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],1);
$todayAddSpendData = $this->caculateSpend($pay_time, $map['_string'], [], 1);
$mounthAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],2);
$mounthAddSpendData = $this->caculateSpend($pay_time, $map['_string'], [], 2);
$yesterday_user_regist_count = M("user", "tab_")->where(
array("promote_id" => array('in',$promoteId),
array("promote_id" => array('in', $promoteId),
"register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end))))
->count();
$yesterday_total_money = $this->pay_total(5, 0,$promoteId);
$yesterday_total_money = $this->pay_total(5, 0, $promoteId);
$today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$today_regist_user_count = M("user", "tab_")
->where(array("promote_id" => array('in',$promoteId),
->where(array("promote_id" => array('in', $promoteId),
"register_time" => array("BETWEEN", array($today_start, $today_end))))
->count();
$today_total_money = $this->pay_total(1, 0,$promoteId);
$today_total_money = $this->pay_total(1, 0, $promoteId);
$this->assign('data',$data);
$this->assign('data', $data);
// $this->assign('yesterdayData',$yesterdayData);
$this->assign('spendData',$spendData);
$this->assign('yesterdaySpendData',$yesterdaySpendData);
$this->assign('todayAddSpendData',$todayAddSpendData);
$this->assign('mounthAddSpendData',$mounthAddSpendData);
$this->assign('spendData', $spendData);
$this->assign('yesterdaySpendData', $yesterdaySpendData);
$this->assign('todayAddSpendData', $todayAddSpendData);
$this->assign('mounthAddSpendData', $mounthAddSpendData);
$this->assign("user_count", $user_count);
@ -202,106 +202,107 @@ class PromoteController extends BaseController
$this->assign("menu_list", $quick_menu_list);
$this->assign("gg_list", $gg_list);
$this->assign("gg_count", $gg_Count-$gg_ReadDocument);
$this->assign("gg_count", $gg_Count - $gg_ReadDocument);
$this->assign("zx_list", $zx_list);
$this->assign("zx_count", $zx_Count-$zx_ReadDocument);
$this->assign("zx_count", $zx_Count - $zx_ReadDocument);
$this->assign("xx_list", $xx_list);
$this->assign('rz_list', $rz_list);
$this->assign("rz_count", $logCount-$readLogCount);
$this->assign("rz_count", $logCount - $readLogCount);
$this->assign("today_open_server_list", $today_open_server_list);
$this->assign("game_list", $game_list);
$this->meta_title = "首页";
$this->display();
}
private function caculateSpend($pay_time,$condition,$create = [],$type = 0) {
$spend=M('Spend','tab_');
$today=total(1);
$week=total(2);
$mounth=total(3);
$map1['promote_id'] = $map['promote_id']=array('gt',0);
$map1['pay_status'] = $map['pay_status']=1;
$map1['pay_way'] = $map['pay_way'] = array('gt',0);
private function caculateSpend($pay_time, $condition, $create = [], $type = 0)
{
$spend = M('Spend', 'tab_');
$today = total(1);
$week = total(2);
$mounth = total(3);
$map1['promote_id'] = $map['promote_id'] = array('gt', 0);
$map1['pay_status'] = $map['pay_status'] = 1;
$map1['pay_way'] = $map['pay_way'] = array('gt', 0);
$userId = [];
$promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid()." or grand_id=". get_pid())->select();
$promoteId = array_column($promoteId,'id');
$promoteId = implode(',',$promoteId).",".get_pid();
$whereUser['promote_id'] = ['IN',$promoteId];
$promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid() . " or grand_id=" . get_pid())->select();
$promoteId = array_column($promoteId, 'id');
$promoteId = implode(',', $promoteId) . "," . get_pid();
$whereUser['promote_id'] = ['IN', $promoteId];
if ($type == 1) {
$start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$whereUser['register_time'] = ['between',array($start,$end-1)];
$userId = M('user','tab_')->field('id')->where($whereUser)->select();
$whereUser['register_time'] = ['between', array($start, $end - 1)];
$userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
} else if ($type == 2) {
$start = mktime(0, 0, 0, date('m'), 1, date('Y'));
$end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1;
$whereUser['register_time'] = ['between',array($start,$end-1)];
$userId = M('user','tab_')->field('id')->where($whereUser)->select();
$whereUser['register_time'] = ['between', array($start, $end - 1)];
$userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
}
$userId = implode(',',array_column($userId,'id'));
$userId = implode(',', array_column($userId, 'id'));
if ($userId) {
$map1['user_id'] = $map['user_id']=['IN',$userId];
} else if (!$userId&&$type!=0) {
return array('today'=>0,'mounth'=>0);
$map1['user_id'] = $map['user_id'] = ['IN', $userId];
} else if (!$userId && $type != 0) {
return array('today' => 0, 'mounth' => 0);
}
if ($create) {
$map['create_time'] = $create;
}
$bindrecharge_data = M('bind_recharge','tab_')
$bindrecharge_data = M('bind_recharge', 'tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
floor(sum(IF(create_time '.$pay_time.',real_amount,0))*100) as scount,
floor(sum(IF(create_time '.$today.',real_amount,0))*100) as today,
floor(sum(IF(create_time '.$week.',real_amount,0))*100) as week,
floor(sum(IF(create_time '.$mounth.',real_amount,0))*100) as mounth')
floor(sum(IF(create_time ' . $pay_time . ',real_amount,0))*100) as scount,
floor(sum(IF(create_time ' . $today . ',real_amount,0))*100) as today,
floor(sum(IF(create_time ' . $week . ',real_amount,0))*100) as week,
floor(sum(IF(create_time ' . $mounth . ',real_amount,0))*100) as mounth')
->where($map1)
->group('promote_id')
->select(false);
$deposit_data = M('deposit','tab_')
$deposit_data = M('deposit', 'tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
floor(sum(IF(create_time '.$pay_time.',pay_amount,0))*100) as scount,
floor(sum(IF(create_time '.$today.',pay_amount,0))*100) as today,
floor(sum(IF(create_time '.$week.',pay_amount,0))*100) as week,
floor(sum(IF(create_time '.$mounth.',pay_amount,0))*100) as mounth')
floor(sum(IF(create_time ' . $pay_time . ',pay_amount,0))*100) as scount,
floor(sum(IF(create_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(create_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(create_time ' . $mounth . ',pay_amount,0))*100) as mounth')
// ->join('tab_user on tab_user.id = tab_spend.user_id','left')
->where($map1)
->group('promote_id')
->select(false);
$spendData=$spend
$spendData = $spend
->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time,
floor(sum(IF(pay_time '.$pay_time.',pay_amount,0))*100) as scount,
floor(sum(IF(pay_time '.$today.',pay_amount,0))*100) as today,
floor(sum(IF(pay_time '.$week.',pay_amount,0))*100) as week,
floor(sum(IF(pay_time '.$mounth.',pay_amount,0))*100) as mounth')
floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as scount,
floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
// ->join('tab_user on tab_user.id = tab_spend.user_id','left')
->where($map)
->union(' ('.$bindrecharge_data.') ')
->union(' ('.$deposit_data.') ')
->union(' (' . $bindrecharge_data . ') ')
->union(' (' . $deposit_data . ') ')
->group('promote_id')
->select(false);
$spendData = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.scount) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1')
->join('tab_promote on promote_id = tab_promote.id','left')
->join('tab_promote on promote_id = tab_promote.id', 'left')
->where($condition)
->table('('.$spendData.') as a')->group('promote_id1')->order('count desc,a.ordertime')->find();
$spendData['rand']=1;
$spendData['count']=$spendData['count']/100;
$spendData['today']=$spendData['today']/100;
$spendData['week']=$spendData['week']/100;
$spendData['mounth']=$spendData['mounth']/100;
->table('(' . $spendData . ') as a')->group('promote_id1')->order('count desc,a.ordertime')->find();
$spendData['rand'] = 1;
$spendData['count'] = $spendData['count'] / 100;
$spendData['today'] = $spendData['today'] / 100;
$spendData['week'] = $spendData['week'] / 100;
$spendData['mounth'] = $spendData['mounth'] / 100;
return $spendData;
}
private function pay_total($type = 0, $newadd = 1,$promoteId="")
private function pay_total($type = 0, $newadd = 1, $promoteId = "")
{
if ($_REQUEST['promote_id'] === null || $_REQUEST['promote_id'] === '0') {
$map['parent_id'] = get_pid();
@ -482,7 +483,7 @@ class PromoteController extends BaseController
} else {
$menuData = M("promote_quick_menu ", "tab_")->where(array("promote_id" => get_pid()))->count();
if ($menuData>=10) {
if ($menuData >= 10) {
$this->ajaxReturn(['status' => 1, 'info' => '快捷菜单只能有10个'], "JSON");
}
M("promote_quick_menu ", "tab_")->add(
@ -524,12 +525,12 @@ class PromoteController extends BaseController
$count = M("document", "sys_")->where("category_id=56 and status=1")->count();
}
$promote_id = get_pid();
$logCount = M('protect_log','tab_')->count();
$readLogCount = M('protect_log_read','tab_')->where("promote_id = {$promote_id}")->count();
$logCount = M('protect_log', 'tab_')->count();
$readLogCount = M('protect_log_read', 'tab_')->where("promote_id = {$promote_id}")->count();
$gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select();
$gg_Count = count($gg_data);
$gg_data = implode(',',array_column($gg_data,'id'));
$gg_data = implode(',', array_column($gg_data, 'id'));
$gg_where = "promote_id = {$promote_id} and category_id=56";
if ($gg_data) {
@ -541,7 +542,7 @@ class PromoteController extends BaseController
$zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select();
$zx_Count = count($zx_data);
$zx_data = implode(',',array_column($zx_data,'id'));
$zx_data = implode(',', array_column($zx_data, 'id'));
$zx_where = "promote_id = {$promote_id} and category_id=51";
if ($zx_data) {
$zx_where .= " and document_id IN({$zx_data})";
@ -558,9 +559,9 @@ class PromoteController extends BaseController
$this->meta_title = "公告列表";
$this->assign("type", $type);
$this->assign("data_list", $data_list);
$this->assign("gg_count", $gg_Count-$gg_ReadDocument);
$this->assign("zx_count", $zx_Count-$zx_ReadDocument);
$this->assign("rz_count", $logCount-$readLogCount);
$this->assign("gg_count", $gg_Count - $gg_ReadDocument);
$this->assign("zx_count", $zx_Count - $zx_ReadDocument);
$this->assign("rz_count", $logCount - $readLogCount);
$this->display();
}
@ -837,7 +838,7 @@ class PromoteController extends BaseController
$map = [];
$map['chain'] = ['like', $loginer['chain'] . $loginer['id'] . '/%'];
if ($promoteType == 0) {
$map['level'] = 2;
} elseif ($promoteType == 1) {
@ -863,7 +864,7 @@ class PromoteController extends BaseController
}
$query = M('promote', 'tab_')->where($map);
list($records, $pagination, $count) = $this->paginate($query);
$ids = array_column($records, 'id');
$countList = [];
@ -917,7 +918,7 @@ class PromoteController extends BaseController
}
$status = $promoteService->addPromote($params, $parent);
if ($status) {
$this->ajaxReturn(['status' => 1, 'msg' => '添加成功']);
$this->ajaxReturn(['status' => 1, 'msg' => '添加成功']);
} else {
$this->ajaxReturn(['status' => 0, 'msg' => '添加失败']);
}
@ -926,7 +927,7 @@ class PromoteController extends BaseController
$loginer = $this->getLoginPromote();
$promotes = null;
$promoteColumns = ['id', 'account', 'real_name'];
$promoteMap = ['chain' => ['like', $loginer['chain'] . $loginer['id'] . '/' . '%']];
$promoteMap = ['chain' => ['like', $loginer['chain'] . $loginer['id'] . '/' . '%']];
if ($loginer['level'] == 1) {
if ($promoteType == 1) {
$promoteMap['level'] = 2;
@ -962,99 +963,6 @@ class PromoteController extends BaseController
}
}
public function add_chlid()
{
if (IS_POST) {
$parentId = 0;
if (isset($_POST['promote_type']) && $_POST['promote_type'] == 2 && isset($_POST['parent_id'])) {
if ($_POST['parent_id'] == 0) {
$this->ajaxReturn(array('status' => -1, 'msg' => '请选择上级渠道'));
}
$parentId = $_POST['parent_id'];
} else {
$parentId = session('promote_auth.pid');
}
$user = new PromoteApi();
$promote = D('promote')->where(['id' => $parentId])->find();
$status = promoteCan(session('promote_auth.pid'), function ($level) use ($promote) {
if ($level == 1) {
return true;
} elseif ($level == 2) {
return true;
} elseif ($level == 3) {
return false;
}
});
if (!$status) {
$this->ajaxReturn(array('status' => -1, 'msg' => '无权限操作'));
}
$_POST['ba_id'] = $promote['ba_id'];
$_POST['parent_id'] = $parentId;
$_POST['parent_account'] = $promote['account'];
//三级渠道
if ($promote['parent_id'] > 0) {
$_POST['grand_id'] = $promote['parent_id'];
$_POST['grand_account'] = $promote['promote_account'];
}
if (isset($_POST['mobile_phone'])) {
if (!preg_match("/^1[3456789]{1}\d{9}$/", $_POST['mobile_phone'])) {
$this->ajaxReturn(array('status' => -1, 'msg' => '手机号格式错误'));
}
}
if (isset($_POST['idcard'])) {
if (!$this->isIdcard($_POST['idcard'])) {
$this->ajaxReturn(array('status' => -1, 'msg' => '身份证格式错误'));
}
}
if (mb_strlen($_POST['account']) < 6 || mb_strlen($_POST['account']) > 15) {
$this->error('账号长度为6-15个字符', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0))));
return false;
}
if (mb_strlen($_POST['real_name']) < 2 || mb_strlen($_POST['real_name']) > 4) {
$this->error('姓名长度为2-4个字符', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0))));
return false;
}
$res = $user->promote_add($_POST);
if (is_numeric($res)) {
$ba = new \Admin\Model\BusinessAffairsModel();
$ba->add_child($_POST['ba_id'], $res);
$this->ajaxReturn(array('status' => 1, 'msg' => "添加成功"));
} else {
$msg = $res == "渠道账号已存在" ? "子渠道账号已存在" : $res;
$this->ajaxReturn(array('status' => -1, 'msg' => $msg));
}
} else {
$type = I('type', 0);
$status = promoteCan(session('promote_auth.pid'), function ($level) use ($type) {
if ($level == 1) {
return true;
} elseif ($level == 2) {
if ($type == 1) {
return false;
}
return true;
} elseif ($level == 3) {
return false;
}
});
if (!$status) {
$this->error('无权限操作');
}
$model = new PromoteModel();
$promotes = $model->field(['id', 'account'])->where('parent_id=' . session("promote_auth.pid"))->select();
$this->assign('promotes', $promotes);
$this->meta_title = "添加子渠道";
$this->display();
}
}
public function resetPassword()
{
$promoteId = I('promote_id', 0);
@ -1163,7 +1071,7 @@ class PromoteController extends BaseController
$res = $user->edit($_POST);
if ($res !== false) {
$this->success("子账号修改成功", U('Promote/mychlid'));
$this->success("子账号修改成功", U('Promote/children'));
} else {
$this->error("修改子账号失败");
}
@ -1922,54 +1830,6 @@ class PromoteController extends BaseController
$this->ajaxReturn(['status' => true, 'msg' => '下架成功']);
}
public function isIdcard($id)
{
$id = strtoupper($id);
$regx = "/(^\d{15}$)|(^\d{17}([0-9]|X)$)/";
$arr_split = array();
if (!preg_match($regx, $id)) {
return false;
}
if (15 == strlen($id)) {
$regx = "/^(\d{6})+(\d{2})+(\d{2})+(\d{2})+(\d{3})$/";
@preg_match($regx, $id, $arr_split);
//检查生日日期是否正确
$dtm_birth = "19" . $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4];
if (!strtotime($dtm_birth)) {
return false;
} else {
return true;
}
} else {
$regx = "/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/";
@preg_match($regx, $id, $arr_split);
$dtm_birth = $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4];
if (!strtotime($dtm_birth)) {
return false;
} else {
//检验18位身份证的校验码是否正确。
//校验位按照ISO 7064:1983.MOD 11-2的规定生成X可以认为是数字10。
$arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
$arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
$sign = 0;
for ($i = 0; $i < 17; $i++) {
$b = (int)$id{$i};
$w = $arr_int[$i];
$sign += $b * $w;
}
$n = $sign % 11;
$val_num = $arr_ch[$n];
if ($val_num != substr($id, 17, 1)) {
return false;
} else {
return true;
}
}
}
}
function ajax_page($count, $row, $ajax_func = 'index', $current = 1)
{
$aside = '<select id="pagechange" name="row" onchange="seach(this)"><option value="5">每页5条</option><option value="10">每页10条</option><option value="25">每页25条</option><option value="50">每页50条</option><option value="100">每页100条</option></select>';
@ -1998,9 +1858,15 @@ class PromoteController extends BaseController
//验证安全密码
$metaTitle = '设置';
$modelList = ['游戏管理', $metaTitle];
$this->verifyPasswordView($modelList, $metaTitle);
$res = $this->verifyPasswordView($modelList, ($_POST ? false : true));
if ($_POST) {
if ($res === false) {
$data['status'] = 0;
$data['msg'] = '权限异常';
$this->ajaxReturn($data);
}
$save['child_game_permission'] = I('post.child_game_permission');
$saveRes = D('Promote')->where(array('id' => PID))->save($save);
if ($saveRes === false) {
@ -2018,6 +1884,7 @@ class PromoteController extends BaseController
$this->assign('data', $promoteData);
$this->meta_title = $metaTitle;
$this->assign('modelList', $modelList);
$this->display();
}
}

@ -108,7 +108,7 @@ class PromoteModel extends Model{
}
public function get_child_promote($pid,$field=true) {
public function get_child_promote($pid, $field=true) {
$map['parent_id'] = $pid;
$map['grand_id'] = $pid;
$map['_logic'] = 'or';

@ -0,0 +1,184 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/index/index.new.css" rel="stylesheet" >
<style>
.form-group {
display: flex;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 120px;
height: 34px;
color: #515974;
}
.withdraw {
width: 200px;
height: 2.4rem;
border: 0;
border-radius: 5px;
color: #fff;
background-color: #358fe4;
cursor: pointer;
}
</style>
</block>
<block name="body">
<div class="page-overview promote-index-overview index-overview clearfix poll">
<ul>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi1.png"/></span></div> <div class="text text2"><p>历史收益</p><span>¥{$income.history_income}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi2.png"/></span></div> <div class="text text1"><p>本月收益</p><span>¥{$income.this_month_income}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi3.png"/></span></div> <div class="text text3"><p>昨日收益</p><span>¥{$income.yesterday_income}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi5.png"/></span></div> <div class="text text5"><p>账户余额</p><span>¥{$income.balance}</span></div> </li>
</ul>
</div>
<div style="margin-top: 2.4vh;">
<button class="withdraw" id="withdraw">提现</button>
</div>
<div class="page-list promote-index-list promote-index-list-news">
<div class="trunk-title-main"><span>{$meta_title}</span></div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<div class="form-group fl">
<label class="form-title select-title" style="position: relative;">时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="" value="{$initBegTime}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="" value="{$initEndTime}">
</div>
</div>
<div class="form-group normal_space fl">
<input type="submit" class="submit" id='submit' url="{:U('Finance/index','model='.$model['name'],false)}"
value="查询">
</div>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th>时间</th>
<th>收益</th>
<th>操作</th>
</tr>
<empty name="listData">
<tr><td colspan="3" style="text-align: center;height: 38vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<else />
<volist name="listData" id="data">
<tr>
<td>{$data.day}</td>
<td>{$data.income}</td>
<td><a href="{$data.url}">明细</a></td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/index/jquery.fxTab.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script>
$(function(){
var date = "";
$('#sdate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#edate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#submit').click(function () {
var sdate = Date.parse($('#sdate').val()) / 1000;
var edate = Date.parse($('#edate').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间', {icon: 5});
return false;
}
if ((edate - sdate) > 2505600) {
layer.msg('时间间隔不能超过30天请重新选择日期', {icon: 5});
return false;
}
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$('#withdraw').click(function () {
var balance = parseFloat("{$income.balance}");
if (balance < 100) {
layer.msg('账户余额低于100元无法提现', {icon: 5});
return false;
}
var msg = "收益结算截止时间:{$yesterday}";
msg += "<br>";
msg += "提现金额:{$income.balance}元";
layer.confirm(msg, {
title: '信息',
btn: ['提交', '取消'],
}, function () {
$.ajax({
type: 'post',
url: '{:U("withdraw")}',
dataType: 'json',
data: {},
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});
}
});
});
});
$(".select_gallery").select2();
});
</script>
</block>

@ -66,7 +66,15 @@
<div class="page-search normal_list query-recharge-search jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>财务管理></span><span>{$meta_title}</span></div>
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">{$meta_title}</span>
@ -77,7 +85,7 @@
</div>
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group normal_space" style="margin-left: 0;">
<input type="text" name="pay_order_number" class="txt normal_txt" placeholder="请输入游戏订单号"
<input type="text" name="pay_order_number" class="txt normal_txt" placeholder="游戏订单号"
value="{:I('pay_order_number','')}">
</div>

@ -0,0 +1,223 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<link href="__CSS__/game_detailed.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
</block>
<block name="body">
<style>
@media screen and (max-width: 1500px) {
.normal_form {
padding-top: 45px;
}
.trunk-search .normal_txt {
width: 100px
}
.select2-container--default .select2-selection--single {
width: 125px;
}
.trunk-search .select-time .txt {
width: 100px;
}
.form-group .submit {
width: 55px;
}
}
.selected-color {
color: #2bd8ed;
}
.pointer-hand {
cursor: pointer;
}
.icon-spend {
position: relative;
font-size: 1.2rem;
top: 3px;
float: right;
right: 10px;
}
.th-hide {
display: none;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
.trunk-search {
padding-bottom: 10px;
}
.btn-role-border {
border-left: 0;
}
.normal_table tr td a {
cursor: pointer;
}
</style>
<div class="page-search normal_list query-recharge-search">
<div style="position: absolute;margin-top: -25px;color: #6a7082;">
<span class="back-btn" style="cursor: pointer;"><i class="iconfont iconreply"></i> 返回</span>
</div>
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">{$meta_title}</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group normal_space" style="margin-left: 0;">
<label>游戏名称:</label>
<select id="game_id" name="game_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<volist name=":getPromoteSearchGame()" id="vo">
<option value="{$vo.id}" title="{$vo.game_name}"
<if condition="I('game_id') eq $vo['id']">selected</if>
>{$vo.game_name} </option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<input type="text" name="user_account" class="txt normal_txt" placeholder="玩家账号"
value="{:I('user_account','')}">
</div>
<div class="form-group normal_space">
<input type="text" name="pay_order_number" class="txt normal_txt" placeholder="充值订单号"
value="{:I('pay_order_number','')}">
</div>
<div class="form-group normal_space">
<input type="hidden" name="id" value="{:I('get.id')}">
<input type="submit" class="submit" id='submit' url="{:U('Finance/withdrawDtl','model='.$model['name'],false)}"
value="查询">
</div>
<!-- </form> -->
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article" style="margin-left: 0;margin-right: 0;">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>充值订单号</th>
<th>游戏</th>
<th>平台</th>
<th>玩家账号</th>
<th>订单总额</th>
<th>现金分成基数</th>
<th>平台币分成基数</th>
<th>平台币分成比例(直充|内充)</th>
<th>现金支付通道</th>
<th>收益</th>
<th>订单状态</th>
<th>充值时间</th>
</tr>
<empty name="listData">
<tr class="num2">
<td colspan="99" style="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else/>
<volist name="listData" id="vo">
<tr class="num2">
<td>{$vo.pay_order_number}</td>
<td>{$vo.game_name}</td>
<td>{:getSDKTypeName($vo['sdk_version'])}</td>
<td>{$vo.user_account}</td>
<td>{$vo.pay_amount}</td>
<if condition="$vo.pay_way eq -1">
<td>0</td>
<td>{$vo.pay_amount}</td>
<else/>
<td>{$vo.pay_amount}</td>
<td>0</td>
</if>
<td>{$vo.selle_ratio}%|{$vo.selle_ratio}%</td>
<td>{$vo.pay_way_name}</td>
<td>{$vo.income}</td>
<td>{$status}</td>
<td>{$vo.pay_time}</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
$().ready(function () {
$('.back-btn').on('click', function () {
location.href = "{:U('withdrawRecord')}";
});
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$(".select_gallery").select2();
});
</script>
</block>

@ -0,0 +1,267 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<link href="__CSS__/game_detailed.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
</block>
<block name="body">
<style>
@media screen and (max-width: 1500px) {
.normal_form {
padding-top: 45px;
}
.trunk-search .normal_txt {
width: 100px
}
.select2-container--default .select2-selection--single {
width: 125px;
}
.trunk-search .select-time .txt {
width: 100px;
}
.form-group .submit {
width: 55px;
}
}
.selected-color {
color: #2bd8ed;
}
.pointer-hand {
cursor: pointer;
}
.icon-spend {
position: relative;
font-size: 1.2rem;
top: 3px;
float: right;
right: 10px;
}
.th-hide {
display: none;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
.trunk-search {
padding-bottom: 10px;
}
.btn-role-border {
border-left: 0;
}
.normal_table tr td a {
cursor: pointer;
}
</style>
<div class="page-search normal_list query-recharge-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">{$meta_title}</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group normal_space" style="margin-left: 0;">
<input type="text" name="widthdraw_number" class="txt normal_txt" placeholder="提现订单号"
value="{:I('widthdraw_number','')}">
</div>
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">充值时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{$initBegTime}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{$initEndTime}">
</div>
</div>
<div class="form-group normal_space">
<input type="hidden" name="status" id="status" value="{$status}">
<input type="submit" class="submit" id='submit' url="{:U('Finance/withdrawRecord','model='.$model['name'],false)}"
value="查询">
</div>
<!-- </form> -->
</div>
<div class="tab marg_top20" style="margin-bottom: 20px;">
<div style="display: flex;">
<div class="btn btn-role <if condition='$status heq ""'>highlight</if>" status="">
<p>全部</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status heq 0'>highlight</if>" status="0">
<p>待审核</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq -1'>highlight</if>" status="-1">
<p>审核未通过</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq 1'>highlight</if>" status="1">
<p>汇款中</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq 2'>highlight</if>" status="2">
<p>已汇款</p>
</div>
</div>
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article" style="margin-left: 0;margin-right: 0;">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>提现订单</th>
<th>提现日期</th>
<th>结算截止日期</th>
<th>收益金额</th>
<th>实际提现金额</th>
<th>提现状态</th>
<th>说明</th>
<th>操作</th>
</tr>
<empty name="listData">
<tr class="num2">
<td colspan="99" style="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else/>
<volist name="listData" id="vo">
<tr class="num2">
<td>{$vo.widthdraw_number}</td>
<td>{$vo.create_time}</td>
<td>{$vo.settlement_end_time}</td>
<td>{$vo.sum_money}</td>
<td>{$vo.sum_money}</td>
<td>{$vo.status}</td>
<td>{$vo.respond}</td>
<td>
<a href="{:U('withdrawDtl', array('id'=>$vo['id']))}">提现明细</a>
<a>汇款证明</a>
<a>结算单</a>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
$().ready(function () {
var date = "{$setdate}";
$('#sdate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#edate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('.btn-role').on('click', function () {
var thisElement = $(this);
if (!thisElement.hasClass('highlight')) {
var status = thisElement.attr('status');
$('#status').val(status);
$('.btn-role').removeClass('highlight');
thisElement.addClass('highlight');
$('#submit').trigger('click');
}
});
$('#submit').click(function () {
var sdate = $('#sdate').val();
var edate = $('#edate').val();
if (Date.parse(sdate) > Date.parse(edate)) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$(".select_gallery").select2();
});
</script>
</block>

@ -111,7 +111,15 @@
<div class="page-list normal_list apply-index-list jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>游戏管理></span><span>{$meta_title}</span></div>
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span>
</div>

@ -1,182 +0,0 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-add_chlid-form">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>管理中心></span><span><if condition="I('type') == 1">添加组长<else/>添加推广员</if></span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main"><if condition="I('type') == 1">添加组长<else/>添加推广员</if></span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('Promote/add_chlid')}" novalidate="novalidate" method="post" class="base_info" id="form_reg">
<table class="table2">
<if condition="($parent_id eq 0) and ($grand_id eq 0) and (I('type') == 1)">
<input type="hidden" name="promote_type" value="1">
<else/>
<input type="hidden" name="promote_type" value="2">
<if condition="($parent_id eq 0) and ($grand_id eq 0)">
<tr>
<td class="l"><span class="req">*</span>上级渠道:</td>
<td class="r">
<select id="parent_id" name="parent_id" class="reselect select_gallery" style="width: 252px;" >
<option value="0">请选择上级渠道</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</td>
</tr>
</if>
</if>
<tr>
<td class="l"><span class="req">*</span>帐号:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="account" id="account" maxlength="15" minlength="6" placeholder="请输入帐号">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>姓名:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="real_name" id="real_name" maxlength="4" minlength="2" placeholder="请输入姓名">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>身份证:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="idcard" id="idcard" placeholder="请输入身份证">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>手机号:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="mobile_phone" id="mobile_phone" placeholder="请输入手机号">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>密码:</td>
<td class="r">
<input type="password" class="name txt" name="password" id="password" placeholder="请输入子渠道密码">
<span id="password_tip"></span>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>确认密码:</td>
<td class="r">
<input type="password" class="name txt" name="repassword" id="repassword" placeholder="请输入确认密码">
<span id="repassword_tip"></span>
</td>
</tr>
<tr>
<td class="l">昵称:</td>
<td class="r">
<input type="text" class="name txt" name="nickname" id="nickname" placeholder="请输入子渠道昵称">
<span id="nickname_tip"></span>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="button" class="tj btn ajax-post" onclick="check()" value="确认添加" title="" target-form="base_info">
<a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
$(".select_gallery").select2();
function check() {
data = validation();
if(data.status !=1){layer.msg(data.msg,{icon:2}); return false;};
var account = $('#account').val();
var password = $('#password').val();
var nickname = $('#nickname').val();
var idcard = $('#idcard').val();
var mobile_phone = $('#mobile_phone').val();
var real_name = $('#real_name').val();
var promote_type = $('[name=promote_type]').val();
var repassword = $('#repassword').val();
var parent_id = $('#parent_id').val();
$.ajax({
type:"POST",
url:"{:U('add_chlid')}",
data:{
account: account,
password: password,
real_name: real_name,
repassword: repassword,
promote_type: promote_type,
parent_id: parent_id,
mobile_phone: mobile_phone,
idcard: idcard,
nickname: nickname,
},
success:function(res){
if(res.status == 1){
layer.msg(res.msg);
setTimeout(function(){
window.location.href="{:U(I('type') == 2 ? 'mygrand' : 'mychlid')}";
},1000);
}else{
layer.msg(res.msg);
}
}
});
// $('#form_reg').submit();
}
function validation(){
var json_data = "";
if($('#account').val()==""){
return json_data = {'status':0,'msg':'子渠道账号不能为空'}
}
// if($.trim($('#account').val()).length < 6){
// return json_data = {'status':0,'msg':'子渠道账号不能小于6位字符'}
// }
if($.trim($('#account').val()).length < 6 || $.trim($('#account').val()).length > 15){
return json_data = {'status':0,'msg':'子渠道账号长度为6-15位字符'}
}
if($.trim($('#real_name').val()).length < 2 || $.trim($('#real_name').val()).length > 4){
return json_data = {'status':0,'msg':'子渠道姓名长度为2-4位字符'}
}
if($('#password').val()==""){
return json_data = {'status':0,'msg':'子渠道密码不能为空'}
}
if($.trim($('#password').val()).length < 6){
return json_data = {'status':0,'msg':'子渠道密码不能小于6位字符'}
}
if($('#repassword').val()==""){
return json_data = {'status':0,'msg':'确认密码不能为空'}
}
if($('#repassword').val()!==$('#password').val()){
return json_data = {'status':0,'msg':'子渠道密码和确认密码不一致'}
}
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
// if(!myreg.test($('#mobile_phone').val())){
// return json_data = {'status':0,'msg':'请输入正确的手机号'}
// }
// var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
// if(!myreg.test($('#email').val())){
// return json_data = {'status':0,'msg':'请输入正确的邮箱'}
// }
// if($.trim($('#nickname').val()).length == 0){
// return json_data = {'status':0,'msg':'昵称不能为空'};
// }
return json_data = {'status':1,'msg':'成功'};
}
</script>
</block>

@ -27,7 +27,15 @@
<div class="page-list normal_list apply-index-list">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>游戏管理></span><span>{$meta_title}</span></div>
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span>
</div>

@ -69,15 +69,14 @@
</div>
<?php endif;?>
<?php if ($loginer['level'] == 1) :?>
<div class="subNav jssubNav"><i class="prev_icon icon_caiwu"></i><span>财务管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Finance/settlementDtl')}" class="<if condition='CONTROLLER_NAME eq Finance and ACTION_NAME eq settlementDtl '>active</if> ">结算明细</a>
<lt name="Think.const.PRO_GRADE" value="3">
<a href="{:U('Query/son_earning')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq son_earning or ACTION_NAME eq son_list)'>active</if> ">子渠道结算</a>
</lt>
<a href="{:U('Finance/index')}" class="<if condition='CONTROLLER_NAME eq Finance and ACTION_NAME eq index '>active</if> ">结算中心</a>
<a href="{:U('Finance/settlementDtl')}" class="<if condition='CONTROLLER_NAME eq Finance and ACTION_NAME eq settlementDtl '>active</if> ">结算明细</a>
<a href="{:U('Finance/withdrawRecord')}" class="<if condition='CONTROLLER_NAME eq Finance and (ACTION_NAME eq withdrawRecord or ACTION_NAME eq withdrawDtl) '>active</if> ">提现记录</a>
</div>
<?php endif ;?>
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>游戏管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<!-- <a href="{:U('Apply/app_index')}" class="<if condition='CONTROLLER_NAME eq Apply and ACTION_NAME eq app_index '>active</if> ">APP列表</a>-->

@ -59,7 +59,6 @@
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span>
<span class="title_main">安全密码</span>
</div>
<div class="trunk-content article">

@ -336,3 +336,6 @@ CREATE TABLE `tab_spend_user_count` (
KEY `count_date` (`count_date`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表';
-- 2019-11-6 cxj
ALTER TABLE `tab_spend` ADD COLUMN `withdraw_id` int(11) NOT NULL DEFAULT 0 COMMENT '提现ID' AFTER `pay_url`;
ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`;
Loading…
Cancel
Save