Merge branch 'dev' of 47.111.118.107:/srv/git/platform into dev

master
yulingwei 5 years ago
commit c6779497c2

@ -296,7 +296,7 @@ class AutoPackController extends Think
private function channel() {
$map = [];
$map['status'] = 1;
$map['enable_status'] = ['in', '0,2,3'];
$map['enable_status'] = ['in', '0,2'];
$applys = M('apply', 'tab_')->field('id,game_id,game_name,promote_id,promote_account,sdk_version')
->where($map)
@ -309,6 +309,9 @@ class AutoPackController extends Think
}
$applyIds = array_column($applys, 'id');
M('apply', 'tab_')->where(['id' => ['in', $applyIds]])->save(['enable_status' => 3]);
$gameIds = array_unique(array_column($applys, 'game_id'));
$games = M('game', 'tab_')->field(['id', 'game_appid', 'game_name', 'icon', 'sdk_version'])->where(['id' => ['in', $gameIds]])->select();
$games = index_by_column('id', $games);

@ -8,6 +8,7 @@ class SdkMenuController extends ThinkController{
'0' => 'h5页面',
'1' => '原生',
'2' => '外部链接',
'3' => 'h5资源',
];
public $menu_version = [
@ -56,6 +57,8 @@ class SdkMenuController extends ThinkController{
if(IS_POST)
{
$post = I('post.');
$cover = $_REQUEST['icon'];
$post['cover'] = $cover;
$post['id'] = $id;
array_push($config,$post);
$sdkMenus['config'] = json_encode($config);
@ -97,10 +100,14 @@ class SdkMenuController extends ThinkController{
{
if($key == 'icon')
{
$config[$k][$key] = strstr($val,'/Upload');
$picRes = M('picture')->where(['id'=>intval($val)])->find();
$path = $picRes['path'];
$config[$k][$key] = $path;
$config[$k]['cover'] = $val;
}else
{
$config[$k][$key] = $val;
$config[$k]['cover'] = '';
}
}
break;
@ -124,9 +131,11 @@ class SdkMenuController extends ThinkController{
{
$this->error('菜单不存在','lists');
}
$img[0] = $data['cover'];
$this->meta_title = '悬浮球菜单';
$this->assign('type','edit');
$this->assign('data',$data);
$this->assign('img',$img);
$this->assign('menu_name',$menu_name);
$this->assign('but_type',$this->but_type);
$this->assign('menu_version',$this->menu_version);

@ -1,8 +1,10 @@
<extend name="Public/base"/>
<block name="body">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
<p class="description_text"></p>
@ -93,16 +95,33 @@
<td class="l noticeinfo">菜单图标</td>
<td class="r table_radio">
<span class="form_icon table_btn table_upload">
<input type="file" id="upload_picture_icon">
<input type="hidden" name="icon" id="cover_id_icon" value="{$data.icon}" />
<div class="upload-img-box">
<notempty name="data['icon']">
<div class="upload-pre-item">
<span class="placeholder-graphic placeholder-graphic_icon"><img src="{$data['icon']}"/></span>
</div>
</notempty>
</div>
</span>
<!-- <input type="hidden" name="icon" id="cover_id_icon" value=""/>
<div id="uploader-demo" >
<div id="icon">
<div class="webuploader-pick" style="line-height: 13px">上传图片</div></div>
<div id="iconList" class="uploader-list" style="display: flex;"></div>
</div>-->
<!-- <div class="upload-img-box">
<notempty name="data['icon']">
<div class="upload-pre-item">
<span class="placeholder-graphic placeholder-graphic_icon"><img src="{$data['icon']}"/></span>
</div>
</notempty>
</div>-->
<input type="hidden" name="id" value="{$data['id']}" />
<input type="hidden" name="icon" value="{$data['icon']}" />
<div id="uploadImg" class="wu-example">
<div class="btns">
<div id="icon">
<div class="webuploader-pick" style="line-height: 14px">上传图片</div>
</div>
</div>
<!--用来存放文件信息-->
<div id="icon_thelist" class="uploader-list" style="display: flex;">
</div>
</div>
</span>
<span class="notice-text" style="left:215px;">菜单图标</span>
</td>
</tr>
@ -117,37 +136,37 @@
/* 初始化上传插件 */
//上传游戏图标
/* 初始化上传插件 */
$("#upload_picture_icon").uploadify({
"height" : 30,
"swf" : "__STATIC__/uploadify/uploadify.swf",
"fileObjName" : "download",
"buttonText" : "上传图标",
"uploader" : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
"width" : 120,
'removeTimeout' : 1,
'fileTypeExts' : '*.jpg; *.jpeg; *.png; *.gif;',
"onUploadSuccess" : upload_picture_icon{$field.name},
'onFallback' : function() {
alert('未检测到兼容版本的Flash.');
}
});
function upload_picture_icon{$field.name}(file, data){
var data = $.parseJSON(data);
var src = '';
if(data.status){
src = data.path || data.url;
$("#cover_id_icon").val(src);
$("#cover_id_icon").parent().find('.upload-img-box').html(
'<div class="upload-pre-item"><span class="placeholder-graphic placeholder-graphic_icon"><img src="' + src + '"/></span></div>'
);
} else {
updateAlert(data.info);
setTimeout(function(){
$('#top-alert').find('button').click();
$(that).removeClass('disabled').prop('disabled',false);
},1500);
}
}
//$("#upload_picture_icon").uploadify({
// "height" : 30,
// "swf" : "__STATIC__/uploadify/uploadify.swf",
// "fileObjName" : "download",
// "buttonText" : "上传图标",
// "uploader" : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
// "width" : 120,
// 'removeTimeout' : 1,
// 'fileTypeExts' : '*.jpg; *.jpeg; *.png; *.gif;',
// "onUploadSuccess" : upload_picture_icon{$field.name},
// 'onFallback' : function() {
// alert('未检测到兼容版本的Flash.');
// }
//});
//function upload_picture_icon{$field.name}(file, data){
// var data = $.parseJSON(data);
// var src = '';
// if(data.status){
// src = data.path || data.url;
// $("#cover_id_icon").val(src);
// $("#cover_id_icon").parent().find('.upload-img-box').html(
// '<div class="upload-pre-item"><span class="placeholder-graphic placeholder-graphic_icon"><img src="' + src + '"/></span></div>'
// );
// } else {
// updateAlert(data.info);
// setTimeout(function(){
// $('#top-alert').find('button').click();
// $(that).removeClass('disabled').prop('disabled',false);
// },1500);
// }
//}
</script>
</form>
<div class="form-item cf">
@ -167,4 +186,259 @@ function upload_picture_icon{$field.name}(file, data){
//导航高亮
highlight_subnav('{:U('SdkMenu/lists')}');
</script>
<script>
var userInfo = {userId:"kazaff", md5:""}; //用户会话信息
var chunkSize = 5000 * 1024; //分块大小
var uniqueFileName = null; //文件唯一标识符
var md5Mark = null;
var backEndUrl = "{:U('File/shard_upload',array('type'=>1,'session_id'=>session_id()))}";
WebUploader.Uploader.register({
"before-send-file" : "beforeSendFile",
"before-send" : "beforeSend",
"after-send-file" : "afterSendFile"
}, {
beforeSendFile: function(file){
//秒传验证
if (file['source']['ext'] === 'zip' || file['source']['ext'] === 'rar') {
var task = new $.Deferred();
var start = new Date().getTime();
(new WebUploader.Uploader()).md5File(file, 0, 10*1024*1024).progress(function(percentage){
//console.log(percentage);
}).then(function(val){
//console.log("总耗时: "+((new Date().getTime()) - start)/1000);
md5Mark = val;
userInfo.md5 = val;
$.ajax({
type: "POST"
, url: backEndUrl
, data: {status: "md5Check", md5: val}
, cache: false
, timeout: 1000 //todo 超时的话,只能认为该文件不曾上传过
, dataType: "json"
}).then(function(data, textStatus, jqXHR){
alert(data.chunk);
//console.log(data);
if(data.ifExist){ //若存在这返回失败给WebUploader表明该文件不需要上传
task.reject();
uploader.skipFile(file);
file.path = data.path;
}else{
task.resolve();
//拿到上传文件的唯一名称,用于断点续传
uniqueFileName = md5(''+userInfo.userId+file.name+file.type+file.lastModifiedDate+file.size);
}
}, function(jqXHR, textStatus, errorThrown){ //任何形式的验证失败,都触发重新上传
task.resolve();
//拿到上传文件的唯一名称,用于断点续传
uniqueFileName = md5(''+userInfo.userId+file.name+file.type+file.lastModifiedDate+file.size);
});
});
return $.when(task);
}
}
, beforeSend: function(block){
//分片验证是否已传过,用于断点续传
if (block['file']['source']['ext'] === 'zip' || block['file']['source']['ext'] === 'rar') {
var task = new $.Deferred();
$.ajax({
type: "POST"
, url: backEndUrl
, data: {
status: "chunkCheck"
, name: uniqueFileName
, chunkIndex: block.chunk
, size: block.end - block.start
}
, cache: false
, timeout: 1000 //todo 超时的话,只能认为该分片未上传过
, dataType: "json"
}).then(function(data, textStatus, jqXHR){
if(data.ifExist){ //若存在返回失败给WebUploader表明该分块不需要上传
task.reject();
}else{
task.resolve();
}
}, function(jqXHR, textStatus, errorThrown){ //任何形式的验证失败,都触发重新上传
task.resolve();
});
return $.when(task);
}
}
, afterSendFile: function(file){
if (file['source']['ext'] === 'zip' || file['source']['ext'] === 'rar') {
var chunksTotal = 0;
if((chunksTotal = Math.ceil(file.size/chunkSize)) > 1){
//合并请求
var task = new $.Deferred();
$.ajax({
type: "POST"
, url: backEndUrl
, data: {
status: "chunksMerge"
, name: uniqueFileName
, chunks: chunksTotal
, ext: file.ext
, md5: md5Mark
}
, cache: false
, dataType: "json"
}).then(function(data, textStatus, jqXHR){
//todo 检查响应是否正常
task.resolve();
file.path = data.path;
$("#file_name").val(data.name);
$("#file_url").val(data.path+'/'+data.name);
$("#file_size").val(file.size);
}, function(jqXHR, textStatus, errorThrown){
task.reject();
});
return $.when(task);
}else{
//UploadComlate(file);
}
}
}
});
var uploaderImgIcon = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
// swf文件路径
swf: '__STATIC__/webuploader/Uploader.swf',
// 文件接收服务端。
server: "{:U('File/uploadPicture',array('session_id'=>session_id(),'flag'=>true))}",
// 选择文件的按钮。可选。
// 内部根据当前运行是创建可能是input元素也可能是flash.
pick: {
id:'#icon',
multiple:true
},
// dnd: false,
paste: document.body,
accept: {
title: '图片',
extensions: 'png,gif,jpg,jpeg,bmp',
mimeTypes: '.png,.gif,.jpg,.jpeg,.bmp',
},
// 不压缩image, 默认如果是jpeg文件上传前会压缩一把再上传
resize: false,
disableGlobalDnd: true,
fileNumLimit:1,
threads:5,
thumb:true,
compress:false,
prepareNextFile: true,
formData: function(){return $.extend(true, {}, userInfo);},
chunked:false,
duplicate: true
});
var imgListIconData = [];
<?php if (!empty($img)) :?>
var html = '';
$('#icon_thelist').css('margin-top','10px');
<?php foreach ($img as $value3) { ?>
<?php $value3 = (int)$value3; ?>
imgListIconData.push(<?=$value3?>);
html += '<div id="' + <?=$value3?> + '" class="item flooring_page_img_box" style="margin-right: 10px;">';
html += '<a href="javascript:;"><img src="<?=get_cover($value3,"path")?>" style="width: 100px;height: 100px;cursor: move;"></a>';
html += '<h4 class="info" style="text-align: center;">';
html += '<a href="javascript:;" class="jsdelzip table_click" style="float:none;display:inline-block;" img-id="' + <?=$value3?> + '">删除</a>';
html += '</h4>';
html += '<div class="progress progress-striped active" style="display: none;">';
html += '<div class="progress-bar" role="progressbar" style="width: 100%;">100%</div>';
html += '</div>';
html += '</div>';
<?php }?>
$('#icon_thelist').html(html);
$('#icon_thelist').children().children('h4').children('.jsdelzip').on('click', function() {
var thisId = $(this).attr('img-id');
$(this).parent().parent().remove();
$.each(imgListIconData,function(index, item) {
if (thisId == item) {
imgListIconData.splice(index,1);
return false;
}
});
setIconVal();
});
<?php endif ;?>
var thisIndex2 = 0;
var imgIconList = $("#icon_thelist");
uploaderImgIcon.on( 'fileQueued', function( file ) {
var html = '';
html += '<div id="' + file.id + '" class="item" style="margin-right: 10px;">';
html += '<a href="javascript:;"><img src="" style="width: 100px;height: 100px;cursor: move;"></a>';
html += '<h4 class="info">' + file.name + '</h4>';
html += '<p class="state">等待上传...</p>';
html += '</div>';
imgIconList.append(html);
imgIconList.css('margin-top','10px');
var img2 = imgIconList.children('#'+file.id).find('img');
uploaderImgIcon.makeThumb(file, function (error, src) {
if (error) {
return;
}
img2.attr('src', src);
}, 300, 300);
});
// 文件上传过程中创建进度条实时显示。
uploaderImgIcon.on( 'uploadProgress', function( file, percentage ) {
var $li = $( '#'+file.id ),
$percent = $li.find('.progress .progress-bar');
// 避免重复创建
if ( !$percent.length ) {
$percent = $('<div class="progress progress-striped active">' +
'<div class="progress-bar" role="progressbar" style="width: 0%">' +
'</div>' +
'</div>').appendTo( $li ).find('.progress-bar');
}
$li.find('p.state').text('上传中');
$percent.css( 'width', percentage * 100 + '%' );
$percent.text( (percentage * 100).toFixed(0) + '%' );
});
uploaderImgIcon.on( 'uploadSuccess', function( file , response) {
imgListIconData.push(Number(response.id));
console.log(response)
setIconVal();
$( '#'+file.id ).find('p.state').text('已上传').fadeOut(800);
//alert(JSON.stringify(response));
$('#'+file.id).find('h4.info').append('<a href="javascript:;" class="jsdelzip table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a>');
$('#'+file.id).find('.jsdelzip').on('click',function() {
uploaderImgIcon.removeFile( file.id );
$('#'+file.id).remove();
$.each(imgListIconData,function(index, item) {
if (response.id == item) {
imgListIconData.splice(index,1);
return false;
}
});
setIconVal();
return false;
});
});
function setIconVal()
{
var icon = '';
$.each(imgListIconData,function(index, item) {
icon += item + ',';
});
icon = icon.substring(0, icon.length - 1);
$('input[name=icon]').val(icon);
console.log(icon)
}
</script>
</block>

@ -0,0 +1,23 @@
<?php
namespace Base\Service;
use Base\Facade\Request;
class AgentService {
public function addRecord($params)
{
$data = M('agent', 'tab_')->create($params);
if(!$data){
return $this->getError();
}
$status = M('agent', 'tab_')->add($data);
if ($status) {
$id = M()->getLastInsID();
return $id;
} else {
return 0;
}
}
}

@ -263,7 +263,7 @@ class GameSourceService {
$debugTime4 = microtime(true);
$distFilePath = 'GamePack/' . $fileName;
$result = $this->uploadPackage($localPath, $distFilePath, false);
$result = $this->uploadPackage($localPath, $distFilePath, true);
if ($result['status']) {
$packageUrl = $result['data']['url'];
$packageUrl = $packageUrl == '@' ? $relativePath : $packageUrl;

@ -6,13 +6,67 @@ use Base\Model\ApplyModel;
class PromoteCoinRecordService {
private $model;
public static $types = [
1 => '收入',
2 => '支出',
];
public static $targetTypes = [
1 => '推广员',
2 => '玩家',
3 => '管理员',
];
public static $subTypes = [
1 => '平台充值',
2 => '线下转账',
3 => '推广转账',
4 => '玩家转账',
5 => '后台扣除',
6 => '迁移回收',
7 => '迁移扣除',
8 => '后台发放',
];
public function __construct()
{
}
public function getTypeText($type)
{
return self::$types[$type] ?? '未知';
}
public function getSubTypeText($subType)
{
return self::$subTypes[$subType] ?? '未知';
}
public function getTargetTypeText($targetType, $targetLevel)
{
if ($targetType == 1) {
return PromoteService::$levels[$targetLevel] ?? '未知';
} else {
return self::$targetTypes[$targetType] ?? '未知';
}
}
public function getTargetTypeLevels()
{
$items = [];
foreach (self::$targetTypes as $key => $name) {
if ($key == 1) {
foreach (PromoteService::$levels as $level => $levelName) {
$items[$key . '_' . $level] = $levelName . '[推广]';
}
} else {
$items[$key] = $name;
}
}
return $items;
}
public function addRecord($params) {
$data = $this->createRecord($params);
return M('PromoteCoinRecord', 'tab_')->add($data);
@ -25,14 +79,99 @@ class PromoteCoinRecordService {
'type' => $params['type'],
'sub_type' => $params['sub_type'],
'ref_id' => $params['ref_id'],
'promote_id' => $params['promote_id'],
'target_id' => $params['target_id'],
'target_type' => $params['target_type'],
'target_level' => $params['target_level'] ?? 0,
'coin' => $params['coin'],
'balance_coin' => $params['balance_coin'],
'game_id' => $params['game_id'] ?? 0,
'create_time' => isset($params['create_time']) ? $params['create_time'] : time(),
'description' => $params['description'],
'remark' => isset($params['remark']) ? $params['remark'] : '',
];
return $data;
}
public function getRef($record)
{
$ref = null;
if ($record['sub_type'] == 1) {
$ref = M('coin_pay_order', 'tab_')->where(['id' => $record['id']])->find();
} else if ($record['sub_type'] == 2) {
$ref = M('coin_pay_order', 'tab_')->where(['id' => $record['id']])->find();
} else if ($record['sub_type'] == 3) {
$ref = M('promote_coin_transfer_log', 'tab_')->where(['id' => $record['id']])->find();
} else if ($record['sub_type'] == 4) {
$ref = M('promote_coin_transfer_log', 'tab_')->where(['id' => $record['id']])->find();
} else if ($record['sub_type'] == 5) {
//
} else if ($record['sub_type'] == 6) {
//
} else if ($record['sub_type'] == 7) {
//
} else if ($record['sub_type'] == 8) {
//
}
return $ref;
}
public function getRefDetail($record)
{
$ref = $this->getRef($record);
if (!$ref) {
return null;
}
$refTitle = '';
$items = [];
if (in_array($record['sub_type'], [1, 2])) {
$refTitle = '充值订单信息';
$payWays = [1 => '支付宝', 2 => '微信', 3 => '银联转账'];
$payTypes = [1 => '线上充值', 2 => '线下充值'];
$items = [
['name' => '充值订单号', 'value' => $ref['order_number']],
['name' => '付款时间', 'value' => date('Y-m-d H:i:s', $ref['pay_time'])],
['name' => '充值类型', 'value' => $payWays[$ref['pay_type']]],
['name' => '支付方式', 'value' => $payWays[$ref['pay_way']]],
['name' => '支付金额', 'value' => $ref['pay_amount']],
['name' => '平台币数量', 'value' => $ref['coin_num']],
];
} elseif ($record['sub_type'] == 3) {
$promote = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => $ref['target_id']])->find();
$preWord = $record['type'] == 1 ? '来源' : '目标';
$refTitle = '推广员转账信息';
$items = [
['name' => '转账订单号', 'value' => $ref['sn']],
['name' => '转账时间', 'value' => date('Y-m-d H:i:s', $ref['create_time'])],
['name' => '平台币数量', 'value' => $ref['num']],
['name' => '适用游戏', 'value' => $game ? $game['game_name'] : '所有游戏'],
['name' => '转账描述', 'value' => $ref['description']],
['name' => '转账备注', 'value' => $ref['remark']],
['name' => $preWord . '推广账号', 'value' => $promote['account']],
['name' => $preWord . '推广账号类型', 'value' => PromoteService::$levels[$ref['target_level']]],
];
} elseif ($record['sub_type'] == 4) {
$refTitle = '玩家转账信息';
$game = null;
if ($ref['game_id'] > 0) {
$game = M('game', 'tab_')->field(['id', 'game_name'])->where(['id' => $ref['game_id']])->find();
}
$user = M('user', 'tab_')->field(['id', 'account'])->where(['id' => $ref['target_id']])->find();
$items = [
['name' => '转账订单号', 'value' => $ref['sn']],
['name' => '转账时间', 'value' => date('Y-m-d H:i:s', $ref['create_time'])],
['name' => '平台币数量', 'value' => $ref['num']],
['name' => '适用游戏', 'value' => $game ? $game['game_name'] : '所有游戏'],
['name' => '转账描述', 'value' => $ref['description']],
['name' => '转账备注', 'value' => $ref['remark']],
['name' => '玩家账号', 'value' => $user['account']],
];
}
return [
'refTitle' => $refTitle,
'items' => $items,
];
}
}

@ -0,0 +1,55 @@
<?php
namespace Base\Service;
class PromoteCoinTransferLogService {
public static $targetTypes = [
1 => '推广员',
2 => '玩家',
3 => '管理员',
];
public function addRecord($params)
{
$data = $this->createRecord($params);
$status = M('promote_coin_transfer_log', 'tab_')->add($data);
if ($status) {
$id = M()->getLastInsID();
return $id;
} else {
return 0;
}
}
public function getTargetTypeText($targetType, $targetLevel)
{
if ($targetType == 1) {
return PromoteService::$levels[$targetLevel] ?? '未知';
} else {
return self::$targetTypes[$targetType] ?? '未知';
}
}
public function createRecord($params)
{
$sn = '';
if (isset($params['sn'])) {
$sn = $params['sn'];
} else {
$sn = date('YmdHis').strtoupper(substr(md5(json_encode($params) . 'PromoteCoinTransferLog' . rand(0, 99999)), 8, 16));
}
$data = [];
$data['sn'] = $sn;
$data['promote_id'] = $params['promote_id'];
$data['target_type'] = $params['target_type'];
$data['target_level'] = $params['target_level'];
$data['target_id'] = $params['target_id'];
$data['game_id'] = $params['game_id'];
$data['num'] = $params['num'];
$data['status'] = 1;
$data['create_time'] = time();
$data['remark'] = isset($params['remark']) ? $params['remark'] : '';
$data['description'] = isset($params['description']) ? $params['description'] : '';
return $data;
}
}

@ -229,9 +229,14 @@ class PromoteService {
if (count($shiftIds) > 0) {
$map['id'] = ['in', $shiftIds];
}
$subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin'])->where($map)->select();
$ids = array_column($subPromotes, 'id');
$ids[] = $promote['id'];
$subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin', 'level'])->where($map)->select();
$subPromotes = index_by_column('id', $subPromotes);
$ids = array_keys($subPromotes);
// $ids[] = $promote['id'];
if (count($ids) == 0) {
return true;
}
$promoteCoins = [];
$balances = M('PromoteBalanceCoin', 'tab_')->where(['promote_id' => ['in', $ids]])->select();
@ -244,50 +249,32 @@ class PromoteService {
if ($balance['num'] == 0) {
continue;
}
$sourceId = 0;
if ($task['balance_coin_mode'] == 1 && $balance['game_id'] == 0) {
$sourceId = $topPromote['id'];
}
$item = [
'game_id' => $balance['game_id'],
'banlan_type' => $balance['game_id'] > 0 ? 2 : 1,
'num' => $balance['num'],
'promote_id' => $balance['promote_id'],
'source_id' => $sourceId,
'type' => 2,
'op_id' => $task['create_promote_id']
];
$refId = $promoteCoinService->addRecord($item);
$records[] = $coinRecordService->createRecord([
'type' => 2,
'sub_type' => $balance['game_id'] > 0 ? 5 : 7,
'ref_id' => $refId,
'target_id' => $balance['promote_id'],
'sub_type' => 7,
'ref_id' => 0,
'promote_id' => $balance['promote_id'],
'target_id' => $topPromote['id'],
'target_level' => $topPromote['level'],
'target_type' => 1,
'game_id' => $balance['game_id'],
'coin' => $balance['num'],
'balance_coin' => 0,
'description' => $balance['game_id'] > 0 ? '绑定币回收' : '迁移扣除',
]);
if ($task['balance_coin_mode'] == 1 && $balance['game_id'] == 0) {
$item = [
'game_id' => 0,
'banlan_type' => 1,
'num' => $balance['num'],
'promote_id' => $topPromote['id'],
'source_id' => $balance['promote_id'],
'type' => 1,
'op_id' => $task['create_promote_id'],
];
$refId = $promoteCoinService->addRecord($item);
$topBalanceCoin += $balance['num'];
$topBalancePlus += $balance['num'];
$records[] = $coinRecordService->createRecord([
'type' => 1,
'sub_type' => 6,
'ref_id' => $refId,
'target_id' => $topPromote['id'],
'ref_id' => 0,
'promote_id' => $topPromote['id'],
'target_id' => $balance['promote_id'],
'target_type' => 1,
'target_level' => $subPromotes[$balance['promote_id']]['level'],
'game_id' => $balance['game_id'],
'coin' => $balance['num'],
'balance_coin' => $topBalanceCoin,
'description' => '迁移回收',
@ -415,17 +402,17 @@ class PromoteService {
{
$model = new Model();
$model->startTrans();
$promoteId = $params['promote_id'];
$promoteId = $params['from_promote_id'];
$userId = $params['user_id'];
$remark = $params['remark'];
$num = $params['num'];
$gameId = $params['game_id'];
$isUseBind = $params['is_use_bind'];
$promote = D('promote')->where(['id' => $promoteId])->find();
$user = D('User')->where(['id' => $userId])->find();
$userPlay = D('UserPlay')->where(['user_id' => $userId])->find();
$game = M('Game', 'tab_')->where(['id' => $gameId])->find();
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$user = M('user', 'tab_')->where(['id' => $userId])->find();
$userPlay = M('user_play', 'tab_')->where(['user_id' => $userId])->find();
$game = M('game', 'tab_')->where(['id' => $gameId])->find();
$fromBalanceCoin = 0;
if ($isUseBind) {
$fromBalanceCoin = $this->getBalanceCoin($promoteId, $gameId);
@ -460,18 +447,17 @@ class PromoteService {
$fromParams = [];
$fromParams['game_id'] = $gameId;
$fromParams['banlan_type'] = $isUseBind ? 2 : 1;
$fromParams['num'] = $num;
$fromParams['promote_id'] = $promoteId;
$fromParams['source_id'] = $userId;
$fromParams['type'] = 2;
$fromParams['source_type'] = 2;
$fromParams['target_id'] = $userId;
$fromParams['target_type'] = 2;
$fromParams['remark'] = $remark;
$fromParams['description'] = $isUseBind ? '绑定币转账' : '通用币转账';
$agentRefId = D('Agent')->addRecord($agentParams);
$promoteCoinService = new PromoteCoinService();
$formRefId = $promoteCoinService->addRecord($fromParams);
$agentService = new AgentService();
$transferLogService = new PromoteCoinTransferLogService();
$agentRefId = $agentService->addRecord($agentParams);
$formRefId = $transferLogService->addRecord($fromParams);
if ($formRefId == 0 || $agentRefId == 0) {
$model->rollback();
@ -485,30 +471,19 @@ class PromoteService {
$fromRecord = [
'type' => 2,
'sub_type' => 4,
'promote_id' => $promoteId,
'ref_id' => $formRefId,
'target_id' => $promoteId,
'target_type' => 1,
'coin' => $num,
'balance_coin' => $fromBalanceCoin - $num,
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
'remark' => $remark,
];
$promoteCoinRecordService->addRecord($fromRecord);
$toRecord = [
'type' => 1,
'sub_type' => 3,
'ref_id' => $agentRefId,
'target_id' => $userId,
'target_type' => 2,
'game_id' => $gameId,
'coin' => $num,
'balance_coin' => $userPlay['bind_balance'] + $num,
'balance_coin' => $fromBalanceCoin - $num,
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
'remark' => $remark,
];
$promoteCoinRecordService->addRecord($toRecord);
$promoteCoinRecordService->addRecord($fromRecord);
$incStatus = M('UserPlay', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num);
$incStatus = M('user_play', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num);
$decStatus = $this->decCoin($promoteId, $num, $isUseBind ? $gameId : 0);
if (!$incStatus || !$decStatus) {
$model->rollback();
@ -525,25 +500,39 @@ class PromoteService {
];
}
public function shiftCoin($params)
public function shiftPromoteCoin($params)
{
$toPromoteId = $params['to_promote_id'];
$toPromoteId = $params['promote_id'];
$fromPromoteId = $params['from_promote_id'];
$remark = $params['remark'];
$num = $params['num'];
$gameId = $params['game_id'];
$gameId = $params['game_id'] ?? 0;
$isUseBind = $params['is_use_bind'];
$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();
$toBalanceCoin = $this->getBalanceCoin($toPromoteId, $gameId);
$fromBalanceCoin = 0;
if ($isUseBind && $gameId == 0) {
return [
'msg' => '请选择游戏',
'status' => false,
];
}
if ($isUseBind) {
$fromBalanceCoin = $this->getBalanceCoin($fromPromoteId, $gameId);
} else {
$fromBalanceCoin = $this->getBalanceCoin($fromPromoteId, 0);
}
if ($isUseBind && $gameId) {
return [
'msg' => '平台币不足',
'status' => false,
];
}
if ($fromBalanceCoin < $num) {
return [
'msg' => '平台币不足',
@ -553,30 +542,20 @@ class PromoteService {
$model = new Model();
$model->startTrans();
$params = [];
$params['game_id'] = $gameId;
$params['banlan_type'] = $gameId > 0 ? 2 : 1;
$params['promote_id'] = $fromPromoteId;
$params['num'] = $num;
$params['source_type'] = 1;
$params['target_type'] = 1;
$params['target_id'] = $toPromoteId;
$params['target_level'] = $toPromote['level'];
$params['remark'] = $remark;
$params['description'] = $isUseBind ? '绑定币转账' : '通用币转账';
$fromParams = $params;
$fromParams['promote_id'] = $fromPromoteId;
$fromParams['source_id'] = $toPromoteId;
$fromParams['type'] = 2;
$toParams = $params;
$toParams['promote_id'] = $toPromoteId;
$toParams['source_id'] = $fromPromoteId;
$toParams['type'] = 1;
$transferLogService = new PromoteCoinTransferLogService();
$refId = $transferLogService->addRecord($params);
$promoteCoinService = new PromoteCoinService();
$formRefId = $promoteCoinService->addRecord($fromParams);
$toRefId = $promoteCoinService->addRecord($toParams);
if ($formRefId == 0 || $toRefId == 0) {
if ($refId == 0) {
$model->rollback();
return [
'msg' => '系统异常',
@ -587,10 +566,13 @@ class PromoteService {
$promoteCoinRecordService = new PromoteCoinRecordService();
$fromRecord = [
'type' => 2,
'sub_type' => 4,
'ref_id' => $formRefId,
'target_id' => $fromPromoteId,
'sub_type' => 3,
'ref_id' => $refId,
'promote_id' => $fromPromoteId,
'target_id' => $toPromoteId,
'target_type' => 1,
'target_level' => $toPromote['level'],
'game_id' => $gameId,
'coin' => $num,
'balance_coin' => $fromBalanceCoin - $num,
'description' => '平台币转账',
@ -601,9 +583,12 @@ class PromoteService {
$toRecord = [
'type' => 1,
'sub_type' => 3,
'ref_id' => $toRefId,
'target_id' => $toPromoteId,
'ref_id' => $refId,
'promote_id' => $toPromoteId,
'target_id' => $fromPromote['id'],
'target_type' => 1,
'target_level' => $fromPromote['level'],
'game_id' => $gameId,
'coin' => $num,
'balance_coin' => $toBalanceCoin + $num,
'description' => '平台币转账',
@ -694,6 +679,7 @@ class PromoteService {
{
$balanceCoin = $this->getBalanceCoin($promoteId, $gameId);
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$model = new Model();
$model->startTrans();
@ -702,7 +688,7 @@ class PromoteService {
$log['game_id'] = $gameId;
$log['banlan_type'] = $gameId > 0 ? 2 : 1;
$log['num'] = $num;
$log['promote_id'] = $promoteId;
$log['promote_id'] = $promote['id'];
$log['source_id'] = 0;
$log['type'] = 2;
$log['op_id'] = $adminId;
@ -715,16 +701,19 @@ class PromoteService {
'type' => 2,
'sub_type' => 5,
'ref_id' => $refId,
'target_id' => $promoteId,
'target_type' => 1,
'promote_id' => $promote['id'],
'target_id' => $adminId,
'target_type' => 3,
'target_level' => $promote['level'],
'game_id' => $gameId,
'coin' => $num,
'balance_coin' => $balanceCoin - $num,
'description' => '后台回收',
'description' => '后台回收平台币',
'remark' => '',
];
$promoteCoinRecordService->addRecord($record);
$status = $this->decCoin($promoteId, $num, $gameId);
$status = $this->decCoin($promote['id'], $num, $gameId);
if ($refId && $status) {
$model->commit();
return true;
@ -739,6 +728,8 @@ class PromoteService {
public function adminIncCoin($promoteId, $num, $adminId, $gameId = 0)
{
$balanceCoin = $this->getBalanceCoin($promoteId, $gameId);
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$model = new Model();
$model->startTrans();
@ -746,28 +737,31 @@ class PromoteService {
$log['game_id'] = $gameId;
$log['banlan_type'] = $gameId > 0 ? 2 : 1;
$log['num'] = $num;
$log['promote_id'] = $promoteId;
$log['promote_id'] = $promote['id'];
$log['source_id'] = 0;
$log['type'] = 1;
$log['op_id'] = $adminId;
$promoteCoinService = new PromoteCoinService();
$refId = $promoteCoinService->addRecord($log);
$status = $this->incCoin($promote['id'], $num, $gameId);
$status = $this->incCoin($promoteId, $num, $gameId);
$promoteCoinRecordService = new PromoteCoinRecordService();
$record = [
'type' => 1,
'sub_type' => 2,
'sub_type' => 8,
'ref_id' => $refId,
'target_id' => $promoteId,
'target_type' => 1,
'promote_id' => $promote['id'],
'target_id' => $adminId,
'target_type' => 3,
'target_level' => $promote['level'],
'coin' => $num,
'game_id' => $gameId,
'balance_coin' => $balanceCoin + $num,
'description' => '后台发放',
'description' => '后台发放平台币',
'remark' => '',
];
$promoteCoinRecordService = new PromoteCoinRecordService();
$promoteCoinRecordService->addRecord($record);
if ($refId && $status) {

@ -188,18 +188,21 @@ class Notify3Controller extends BaseController
}
// 添加流水
public function coin_record_add($order,$balance){
public function coin_record_add($order, $balance){
$promote = M('promote', 'tab_')->field(['id', 'level'])->where(['id' => $order['promote_id']])->find();
$data['sn']=date('Ymd') . date('His') . sp_random_num(6);
$data['type']=1;
$data['sub_type'] =1;
$data['target_id'] = $order['promote_id'];
$data['type'] = 1;
$data['sub_type'] = 1;
$data['target_id'] = $promote['id'];
$data['target_level'] = $promote['level'];
$data['target_type'] = 1;
$data['ref_id'] = $order['id'];
$data['game_id'] = 0;
$data['coin'] = $order['real_amount'];
$data['balance_coin'] = $balance['num']+$order['coin_num'];
$data['remark'] = $order['remark'];
$data['create_time']=time();
$data['description']='线上充值';
$data['create_time'] = time();
$data['description'] = '线上充值';
M('promote_coin_record', 'tab_')->data($data)->add();
}

@ -10,6 +10,8 @@ use Base\Repository\UserRepository;
use Base\Service\PromoteService;
use Base\Facade\Request;
use Base\Service\ApplyService;
use Base\Service\PromoteCoinRecordService;
use Base\Service\PromoteCoinTransferLogService;
/**
* @author elf<360197197@qq.com>
@ -70,20 +72,34 @@ class DownloadController extends BaseController {
}
public function listsIndex($p = 0) {
$childPromoteIds = getAllChildPromoteList(3);
if (empty($childPromoteIds)) {
$map1['admin_id'] = PID;
$promote = PID;
} else {
$childPromoteIds .= ','.PID;
$map1['admin_id'] = ['in', $childPromoteIds];
$promote = $childPromoteIds;
}
$pro = $_REQUEST['pid'];
if(empty($pro)) {
$map['admin_id'] = $map1['admin_id'];
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$res = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
if(empty($res)) {
$map['tab_downloadlog.admin_id'] = PID;
}else {
$map['admin_id'] = intval($pro);
foreach ($res as $rsKey => $rsValue) {
$id = $rsValue['id'];
$childPromoteIds .= $id.',';
}
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['tab_downloadlog.admin_id'] = ['in', $childPromoteIds];
}
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$map2[] = [
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$childPromoteIds = M('promote', 'tab_')->where($map2)->getField('id', true);
$map = [];
if (count($childPromoteIds) > 0) {
$map = ['admin_id' => ['in', $childPromoteIds]];
} else {
$map['_string'] = '1<>1';
}
if(!empty($_REQUEST['dataname'])) {
$map['dataname'] = ['like','%'.$_REQUEST['dataname'].'%'];
@ -110,7 +126,7 @@ class DownloadController extends BaseController {
$rs[$key]['actor'] = $getNameRs['real_name'];
}
$promoteArr = explode(',', $promote);
$promoteArr = explode(',', $childPromoteIds);
$promoteNameArr = [];
foreach ($promoteArr as $key1 => $value1) {
$promoteName = M('promote','tab_')->field("real_name")->where(['id' => intval($value1)])->find();
@ -920,70 +936,40 @@ class DownloadController extends BaseController {
* @author sunke
*/
public function coinrecord_data_export() {
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
if(empty($rs)) {
$map['promote_id'] = PID;
}else {
foreach ($rs as $rsKey => $rsValue) {
$id = $rsValue['id'];
$childPromoteIds .= $id.',';
$gameId = I('game_id', -1);
$account = I('account', '');
$sn = I('sn', '');
$startTime = I('time_end', '');
$endTime = I('time_start', '');
$loginPromote = $this->getLoginPromote();
$map = ['promote_id' => $loginPromote['id']];
if ($startTime != '' || $endTime != '') {
if ($startTime != '') {
$map['create_time'] = ['egt', strtotime($startTime. ' 00:00:00')];
}
if ($endTime != '') {
$map['create_time'] = ['elt', strtotime($endTime. ' 23:59:59')];
}
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['promote_id'] = ['in', $childPromoteIds];
}
$map["type"] = 2;
$end_time = strtotime(I('time_end'));
$start_time = strtotime(I('time_start'));
if (!empty($end_time) && !empty($start_time)) {
$map['create_time'] = ['between', [$start_time, $end_time + 86400 - 1]];
} elseif (!empty($start_time)) {
$map['create_time'] = array('gt', $start_time);
} elseif (!empty($end_time)) {
$map['create_time'] = array('lt', $end_time + 86400 - 1);
}
$account = I('account');
$sn = I('sn');
if($sn) {
$map['sn'] = ['like','%'.$sn.'%'];
$map['sn'] = $sn;
}
if($account) {
$searchUsers = M('User', 'tab_')->field('id')->where(['account' => ['like', '%' . $account . '%']])->select();
$searchPromotes = M('Promote', 'tab_')->field('id')->where(['account' => ['like', '%' . $account . '%']])->select();
if (empty($searchUsers) && empty($searchPromotes)) {
$map['_string'] = '1<>1';
}
if (empty($searchUsers) && !empty($searchPromotes)) {
$map['source_id'] = ['in', array_column($searchPromotes, 'id')];
}
if (!empty($searchUsers) && empty($searchPromotes)) {
$map['source_id'] = ['in', array_column($searchUsers, 'id')];
}
if (!empty($searchUsers) && !empty($searchPromotes)) {
$map['_string'] = '(source_id in (' . implode(',', array_column($searchUsers, 'id')) . ') or'
. '(source_id in (' . implode(',', array_column($searchPromotes, 'id')) . '))';
}
}
$searchHandleType = I('handle_type', 0);
if ($searchHandleType) {
if ($searchHandleType == 2) {
$map['source_type'] = 2;
} else {
}
}
$searchGameId = I('game_id', -1);
if ($searchGameId != -1) {
$map['game_id'] = $searchGameId;
}
$map1['account'] = ['like','%'.$account.'%'];
$promotesRs = M('promote','tab_')->field('id')->where($map1)->select();
$idArr = "";
foreach ($promotesRs as $key => $value) {
$idArr .= intval($value['id']).',';
}
$idArr1 = rtrim($idArr,',');
$map['target_id'] = ['in',$idArr1];
}
if($gameId !== -1) {
$map['game_id'] = $gameId;
}
$conditions = json_encode($map,TRUE);
$addtime = time();
$type = "/Home/PromoteCoin/record";
$type = "/Home/PromoteCoin/transferLogs";
$data = [
'logid' => 'cr_'.time(),
'admin_id' => PID,
@ -1010,58 +996,46 @@ class DownloadController extends BaseController {
* @author sunke
*/
public function mycoinrecord_data_export() {
$map['tab_promote_coin_record.target_id'] = PID;
empty(I('type')) || $map['tab_promote_coin_record.type'] = I('type');
empty(I('sub_type')) || $map['tab_promote_coin_record.sub_type'] = I('sub_type');
if (!empty(I('start_time')) && empty(I('end_time'))) {
$map['tab_promote_coin_record.create_time'] = ['egt', strtotime(I('start_time'))];
} elseif (empty(I('start_time')) && !empty(I('end_time'))) {
$map['tab_promote_coin_record.create_time'] = ['elt', strtotime(I('end_time')) + 86399];
} elseif (!empty(I('start_time')) && !empty(I('end_time'))) {
$map['tab_promote_coin_record.create_time'] = ['between', [strtotime(I('start_time')), strtotime(I('end_time')) + 86399]];
$type = I('type', 0);
$subType = I('sub_type', 0);
$targetType = I('target_type', '');
$startTime = I('start_time', '');
$endTime = I('end_time', '');
$gameId = I('game_id', 0);
$loginPromote = $this->getLoginPromote();
$map = [];
$map['game_id'] = $gameId;
$map['promote_id'] = $loginPromote['id'];
if ($type != 0) {
$map['type'] = $type;
}
$having = '';
$where['_string'] = '1 = 1';
if (empty(I('get.game_id'))) {
$where['_logic'] = 'or';
$join = 'left join tab_promote_coin on tab_promote_coin_record.ref_id = tab_promote_coin.id and tab_promote_coin_record.sub_type > 2 and tab_promote_coin.banlan_type = 1';
$having = '(coin_id > 0 or pay_id > 0)';
} else {
$where['tab_promote_coin_record.sub_type'] = ['gt', 2];
$join = 'inner join tab_promote_coin on tab_promote_coin_record.ref_id = tab_promote_coin.id and tab_promote_coin.banlan_type = 2 and tab_promote_coin.game_id = ' . I('get.game_id');
if ($subType != 0) {
$map['sub_type'] = $subType;
}
if ($targetType != '') {
$targetTypeRow = explode('_', $targetType);
$map['target_type'] = $targetTypeRow[0];
if (count($targetTypeRow) == 2) {
$map['target_level'] = $targetTypeRow[1];
}
}
if (!empty(I('handle_type'))) {
switch (I('handle_type')) {
case 1:
$where['tab_promote_coin.source_type'] = 1;
$join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.parent_id = 0';
break;
case 2:
$where['tab_promote_coin.source_type'] = 1;
$join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.parent_id > 0 and tab_promote.grand_id = 0';
break;
case 3:
$where['tab_promote_coin.source_type'] = 1;
$join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.grand_id > 0';
break;
case 4:
$where['tab_promote_coin.source_type'] = 2;
break;
if ($startTime != '' || $endTime != '') {
if ($startTime != '') {
$map['create_time'] = ['egt', strtotime($startTime. ' 00:00:00')];
}
if ($endTime != '') {
$map['create_time'] = ['elt', strtotime($endTime. ' 23:59:59')];
}
}
$join .= ' left join tab_coin_pay_order on tab_promote_coin_record.ref_id = tab_coin_pay_order.id and tab_promote_coin_record.sub_type in (1,2)';
$map['_complex'] = $where;
$conditions = json_encode($map,TRUE);
$addtime = time();
$type = "/Home/PromoteCoin/coinRecord";
$data = [
'logid' => 'pt_'.time(),
'admin_id' => PID,
'type' => $type,
'type' => "/Home/PromoteCoin/coinRecord",
'dataname' => '我的平台币明细',
'status' => 0,
'addtime' => $addtime,
@ -1362,7 +1336,7 @@ class DownloadController extends BaseController {
'isContainSubs' => true,
'basicPromotes' => json_encode($basicPromotes,FALSE),
];
$map['promotes'] = json_encode($data,FALSE);
$map['promotes'] = json_encode($data,FALSE);
$map['ids'] = $ids;
if ($gameId > 0) {
$params['game_id'] = $gameId;
@ -1881,7 +1855,6 @@ class DownloadController extends BaseController {
array('create_time','创建时间'),
);
$model = M('promote','tab_');
$data = $model->where($map)->select();
$xlsData = [];
@ -1942,23 +1915,34 @@ class DownloadController extends BaseController {
$xlsName = "我的平台币明细";
$xlsCell = array(
array('sn','流水号'),
array('type','操作类型'),
array('sub_type','操作方式'),
array('handle_type','账号类型'),
array('type_text','操作类型'),
array('sub_type_text','操作方式'),
array('target_type_text','对手操作类型'),
array('coin','平台币数量'),
array('balance_coin','平台币余额'),
array('description','交易说明'),
array('create_time','交易时间'),
);
$join .= ' left join tab_coin_pay_order on tab_promote_coin_record.ref_id = tab_coin_pay_order.id and tab_promote_coin_record.sub_type in (1,2)';
$data = M('PromoteCoinRecord', 'tab_')
->field('tab_promote_coin_record.*,tab_promote_coin.id as coin_id,tab_promote_coin.source_type,tab_promote_coin.source_id,tab_coin_pay_order.id as pay_id')
->join($join)
->where($map)
->having($having)
->order('id desc')
// ->fetchSql(true)
->select();
$service = new PromoteCoinRecordService();
$data = M('promote_coin_record','tab_')->where($map)->select();
$records = [];
foreach ($data as $item) {
$records[] = [
'id' => $item['id'],
'sn' => $item['sn'],
'type_text' => $service->getTypeText($item['type']),
'sub_type_text' => $service->getSubTypeText($item['sub_type']),
'target_type_text' => $service->getTargetTypeText($item['target_type'], $item['target_level']),
'coin' => $item['coin'],
'balance_coin' => $item['balance_coin'],
'remark' => $item['remark'],
'description' => $item['description'],
'create_time' => date('Y-m-d H:i:s', $item['create_time']),
];
}
$xlsData = $records;
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
}
@ -1975,44 +1959,58 @@ class DownloadController extends BaseController {
array('create_time',"交易时间"),
array('status',"交易状态"),
);
$model = M("PromoteCoin",'tab_');
$data = $model->where($map)->order('create_time desc')->select();
$sourcePromoteIds = [];
$sourceUserIds = [];
foreach ($data as $item) {
if ($item['source_type'] == 1) {
$sourcePromoteIds[] = $item['source_id'];
} elseif ($item['source_type'] == 2) {
$sourceUserIds[] = $item['source_id'];
}
}
$sourceUsers = $this->getRecordsByIds(M('User', 'tab_'), $sourceUserIds, ['indexBy' => 'id']);
$sourcePromotes = $this->getRecordsByIds(M('Promote', 'tab_'), $sourcePromoteIds, ['indexBy' => 'id']);
$model = M('promote_coin_transfer_log', 'tab_');
$logs = $model->where($map)->select();
$service = new PromoteCoinTransferLogService();
$gameIds = [];
$promoteIds = [];
$uesrIds = [];
foreach ($logs as $log) {
$gameIds[] = $log['game_id'];
if ($log['target_type'] == 1) {
$promoteIds[] = $log['target_id'];
}
if ($log['target_type'] == 2) {
$uesrIds[] = $log['target_id'];
}
}
$games = [];
$promotes = [];
$users = [];
if (count($gameIds) > 0) {
$games = M('game', 'tab_')->field(['id', 'game_name'])->where(['id' => ['in', $gameIds]])->select();
}
if (count($promoteIds) > 0) {
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', $promoteIds]])->select();
}
if (count($uesrIds) > 0) {
$users = M('user', 'tab_')->field(['id', 'account'])->where(['id' => ['in', $uesrIds]])->select();
}
$users = index_by_column('id', $users);
$promotes = index_by_column('id', $promotes);
$games = index_by_column('id', $games);
$records = [];
foreach ($data as $item) {
$sourceName = '';
$promote = null;
if ($item['source_type'] == 2) {
$sourceName = $sourceUsers[$item['source_id']]['account'];
} elseif ($item['source_type'] == 1) {
$promote = $sourcePromotes[$item['source_id']];
$sourceName = $sourcePromotes[$item['source_id']]['account'];
}
$handleType = $this->getHandleType($item, $promote);
$records = [
'id' => $item['id'],
'sn' => $item['sn'],
'account' => $item['id'],
'game_name' => isset($games[$item['game_id']]) ? $games[$item['game_id']] : '所有游戏',
'create_time' => date('Y-m-d H:i:s', $item['create_time']),
'description' => $item['description'],
'num' => $item['num'],
'source_name' => $sourceName,
'handle_type' => $handleType,
'status' => $item['status'] == 1 ? '成功' : '失败',
foreach ($logs as $log) {
$targetAccount = '';
if ($log['target_type'] == 1) {
$targetAccount = isset($promotes[$log['target_id']]) ? $promotes[$log['target_id']]['account'] : '未知推广账号';
}
if ($log['target_type'] == 2) {
$targetAccount = isset($promotes[$log['target_id']]) ? $promotes[$log['target_id']]['account'] : '未知玩家';
}
$records[] = [
'id' => $log['id'],
'sn' => $log['sn'],
'target_account' => $targetAccount,
'game_name' => isset($games[$log['game_id']]) ? $games[$log['game_id']]['game_name'] : '所有游戏',
'target_type_text' => $service->getTargetTypeText($log['target_type'], $log['target_level']),
'num' => $log['num'],
'description' => $log['description'],
'status_text' => '成功',
'create_time' => date('Y-m-d H:i:s', $log['create_time'])
];
}
$xlsData[] = $records;
$xlsData = $records;
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
}

@ -5,6 +5,8 @@ namespace Home\Controller;
use OT\DataDictionary;
use User\Api\PromoteApi;
use Base\Service\PromoteService;
use Base\Service\PromoteCoinRecordService;
use Base\Service\PromoteCoinTransferLogService;
/**
* 前台首页控制器
@ -38,7 +40,9 @@ class PromoteCoinController extends BaseController
public function myCoin($p = 0)
{
$map['promote_id'] = PID;
$loginPromote = $this->getLoginPromote();
$map = [];
$map['promote_id'] = $loginPromote['id'];
empty(I('game_id')) || $map['game_id'] = I('game_id');
empty(I('status')) || $map['status'] = I('status');
@ -88,179 +92,105 @@ class PromoteCoinController extends BaseController
$this->assign('_page', $page);
}
$this->meta_title = '我的平台币';
$this->assign('data', $data);
$this->assign('count', $count);
$this->meta_title = '我的平台币';
$this->display();
}
public function coinRecord($p = 0)
public function coinDetails()
{
$map['tab_promote_coin_record.target_id'] = PID;
empty(I('type')) || $map['tab_promote_coin_record.type'] = I('type');
empty(I('sub_type')) || $map['tab_promote_coin_record.sub_type'] = I('sub_type');
if (!empty(I('start_time')) && empty(I('end_time'))) {
$map['tab_promote_coin_record.create_time'] = ['egt', strtotime(I('start_time'))];
} elseif (empty(I('start_time')) && !empty(I('end_time'))) {
$map['tab_promote_coin_record.create_time'] = ['elt', strtotime(I('end_time')) + 86399];
} elseif (!empty(I('start_time')) && !empty(I('end_time'))) {
$map['tab_promote_coin_record.create_time'] = ['between', [strtotime(I('start_time')), strtotime(I('end_time')) + 86399]];
}
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$having = '';
$where['_string'] = '1 = 1';
if (empty(I('get.game_id'))) {
$where['_logic'] = 'or';
$join = 'left join tab_promote_coin on tab_promote_coin_record.ref_id = tab_promote_coin.id and tab_promote_coin_record.sub_type > 2 and tab_promote_coin.banlan_type = 1';
$having = '(coin_id > 0 or pay_id > 0)';
} else {
$where['tab_promote_coin_record.sub_type'] = ['gt', 2];
$join = 'inner join tab_promote_coin on tab_promote_coin_record.ref_id = tab_promote_coin.id and tab_promote_coin.banlan_type = 2 and tab_promote_coin.game_id = ' . I('get.game_id');
$type = I('type', 0);
$subType = I('sub_type', 0);
$targetType = I('target_type', '');
$startTime = I('start_time', '');
$endTime = I('end_time', '');
$gameId = I('game_id', 0);
$loginPromote = $this->getLoginPromote();
$conditions = [];
$conditions['game_id'] = $gameId;
$conditions['promote_id'] = $loginPromote['id'];
if ($type != 0) {
$conditions['type'] = $type;
}
if ($subType != 0) {
$conditions['sub_type'] = $subType;
}
if ($targetType != '') {
$targetTypeRow = explode('_', $targetType);
$conditions['target_type'] = $targetTypeRow[0];
if (count($targetTypeRow) == 2) {
$conditions['target_level'] = $targetTypeRow[1];
}
}
if (!empty(I('handle_type'))) {
switch (I('handle_type')) {
case 1:
$where['tab_promote_coin.source_type'] = 1;
$join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.parent_id = 0';
break;
case 2:
$where['tab_promote_coin.source_type'] = 1;
$join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.parent_id > 0 and tab_promote.grand_id = 0';
break;
case 3:
$where['tab_promote_coin.source_type'] = 1;
$join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.grand_id > 0';
break;
case 4:
$where['tab_promote_coin.source_type'] = 2;
break;
if ($startTime != '' || $endTime != '') {
if ($startTime != '') {
$conditions['create_time'] = ['egt', strtotime($startTime. ' 00:00:00')];
}
if ($endTime != '') {
$conditions['create_time'] = ['elt', strtotime($endTime. ' 23:59:59')];
}
}
$join .= ' left join tab_coin_pay_order on tab_promote_coin_record.ref_id = tab_coin_pay_order.id and tab_promote_coin_record.sub_type in (1,2)';
$map['_complex'] = $where;
$data = M('PromoteCoinRecord', 'tab_')
->field('tab_promote_coin_record.*,tab_promote_coin.id as coin_id,tab_promote_coin.source_type,tab_promote_coin.source_id,tab_coin_pay_order.id as pay_id')
->join($join)
->where($map)
->having($having)
->order('id desc')
->page($page, $row)
// ->fetchSql(true)
->select();
$count = M('PromoteCoinRecord', 'tab_')
->field('tab_promote_coin.id as coin_id,tab_coin_pay_order.id as pay_id')
->join($join)
->where($map)
->having($having)
->select();
$count = count($count);
//分页
$parameter['p'] = I('get.p', 1);
$parameter['row'] = I('get.row');
empty(I('game_id')) || $parameter['game_id'] = I('get.game_id');
empty(I('type')) || $parameter['type'] = I('type');
empty(I('sub_type')) || $parameter['sub_type'] = I('sub_type');
empty(I('source_type')) || $parameter['source_type'] = I('source_type');
empty(I('start_time')) || $parameter['start_time'] = I('start_time');
empty(I('end_time')) || $parameter['end_time'] = I('end_time');
$service = new PromoteCoinRecordService();
$query = M('promote_coin_record', 'tab_')->where($conditions);
$page = set_pagination($count, $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
list($items, $pagination, $count) = $this->paginate($query);
if (!empty($data)) {
foreach ($data as $key => $list) {
if ($list['sub_type'] > 2) {
$promote = D('Promote')->where(array('id' => $list['source_id']))->find();
$data[$key]['handle_type'] = $this->getHandleType($list, $promote);
} else {
$data[$key]['handle_type'] = '未知';
}
}
$records = [];
foreach ($items as $item) {
$records[] = [
'id' => $item['id'],
'sn' => $item['sn'],
'type_text' => $service->getTypeText($item['type']),
'sub_type_text' => $service->getSubTypeText($item['sub_type']),
'target_type_text' => $service->getTargetTypeText($item['target_type'], $item['target_level']),
'coin' => $item['coin'],
'balance_coin' => $item['balance_coin'],
'remark' => $item['remark'],
'description' => $item['description'],
'create_time' => date('Y-m-d H:i:s', $item['create_time']),
];
}
$this->meta_title = '交易明细';
$this->assign('data', $data);
$this->assign('subTypes', PromoteCoinRecordService::$subTypes);
$this->assign('types', PromoteCoinRecordService::$types);
$this->assign('targetTypeLevels', $service->getTargetTypeLevels());
$this->assign('records', $records);
$this->assign('count', $count);
$this->assign('gameId', I('get.game_id'));
$this->assign('setDate', date("Y-m-d"));
$this->meta_title = '交易明细';
$this->assign('gameId', $gameId);
$this->assign('pagination', $pagination);
$this->display();
}
public function coinRecordDesc()
public function coinDetail()
{
if (empty(I('id'))) {
$this->error('网络异常');
}
$map['promote_id'] = PID;
$map['id'] = I('id');
$data['record'] = M('PromoteCoinRecord', 'tab_')
->where($map)
->find();
$data['desc'] = [];
if (!empty($data['record'])) {
switch ($data['record']['sub_type']) {
case 1:
case 2:
$tableName = 'CoinPayOrder';
break;
default:
$tableName = 'PromoteCoin';
break;
}
$data['desc'] = M($tableName, 'tab_')
->where(array('id' => $data['record']['ref_id']))
->find();
if ($data['record']['sub_type'] > 2) {
switch ($data['desc']['source_type']) {
case 1:
$data['payee'] = D('Promote')
->field('*,mobile_phone as phone')
->where(array('id' => $data['desc']['source_id']))
->find();
break;
case 2:
$data['payee'] = D('User')->where(array('id' => $data['desc']['source_id']))->find();
break;
default:
$data['payee'] = [];
break;
}
}
}
if (!empty($data['record'])) {
if ($data['record']['sub_type'] > 2) {
$promote = D('Promote')->where(array('id' => $data['desc']['source_id']))->find();
$data['record']['handle_type'] = $this->getHandleType($data['desc'], $promote);
} else {
$data['record']['handle_type'] = '未知';
}
}
$this->assign('data', $data);
$this->meta_title = '查看明细';
$id = I('id', 0);
$service = new PromoteCoinRecordService();
$loginPromote = $this->getLoginPromote();
$item = M('promote_coin_record', 'tab_')->where(['promote_id' => $loginPromote['id'], 'id' => $id])->find();
$refOrderName = '';
$ref = $service->getRef($item);
$refDetail = $service->getRefDetail($item, $ref);
$record = [
'id' => $item['id'],
'sn' => $item['sn'],
'type_text' => $service->getTypeText($item['type']),
'sub_type_text' => $service->getSubTypeText($item['sub_type']),
'target_type_text' => $service->getTargetTypeText($item['target_type'], $item['target_level']),
'coin_type' => $item['game_id'] > 0 ? '绑定币' : '通用币',
'coin' => $item['coin'],
'balance_coin' => $item['balance_coin'],
'remark' => $item['remark'],
'description' => $item['description'],
'create_time' => date('Y-m-d H:i:s', $item['create_time']),
];
$this->assign('record', $record);
$this->assign('refDetail', $refDetail);
$this->display();
}
@ -326,12 +256,19 @@ class PromoteCoinController extends BaseController
/**
* 转移平台币
*/
public function shift($p = 0)
public function shift()
{
$data = D('Promote')->find(PID);
$loginPromote = $this->getLoginPromote();
if (IS_POST) {
$num = I('num');
$password = I('password');
$shiftUserType = I('shift_user_type', 0);
$targetId = I('target_id', 0);
$gameId = I('game_id', 0);
$remark = I('remark', '');
$coinType = I('coin_type', 1);
if (!is_numeric($num)) {
$this->ajaxReturn(['status' => 0, 'msg' => '发送数量必须是数字']);
}
@ -340,42 +277,31 @@ class PromoteCoinController extends BaseController
$this->ajaxReturn(['status' => 0, 'msg' => '发送数量不正确']);
}
$password = I('password');
if ($data['second_pwd'] !== $this->think_ucenter_md5($password, UC_AUTH_KEY)) {
$promoteService = new PromoteService();
if ($loginPromote['second_pwd'] !== $promoteService->password($password, UC_AUTH_KEY)) {
$this->ajaxReturn(['status' => 0, 'msg' => '安全密码错误']);
}
$shiftUserType = I('shift_user_type', 0);
if ($shiftUserType == 0) {
$this->ajaxReturn(['status' => 0, 'msg' => '请选择帐号类型']);
}
$gameId = I('game_id', 0);
if ($shiftUserType == 3 && $gameId == 0) {
if ($shiftUserType == 4 && $gameId == 0) {
$this->ajaxReturn(['status' => 0, 'msg' => '请选择游戏']);
}
$promoteService = new PromoteService();
$params = [
'from_promote_id' => $loginPromote['id'],
'num' => $num,
'remark' => $remark,
'game_id' => $gameId,
'is_use_bind' => $coinType == 1 ? false : true,
];
$result = [];
if ($shiftUserType == 1 || $shiftUserType == 2) {
$params = [
'from_promote_id' => session('promote_auth.pid'),
'to_promote_id' => I('promote_id'),
'num' => $num,
'remark' => I('remark', ''),
'game_id' => I('game_id', 0),
'is_use_bind' => I('coin_type', 1) == 1 ? false : true,
];
$result = $promoteService->shiftCoin($params);
} elseif ($shiftUserType == 3) {
$params = [
'promote_id' => session('promote_auth.pid'),
'user_id' => I('promote_id'),
'num' => $num,
'remark' => I('remark', ''),
'game_id' => I('game_id', 0),
'is_use_bind' => I('coin_type', 1) == 1 ? false : true,
];
if ($shiftUserType == 1 || $shiftUserType == 2 || $shiftUserType == 3) {
$params['promote_id'] = $targetId;
$result = $promoteService->shiftPromoteCoin($params);
} elseif ($shiftUserType == 4) {
$params['user_id'] = $targetId;
$result = $promoteService->shiftUserCoin($params);
}
@ -385,10 +311,6 @@ class PromoteCoinController extends BaseController
$this->ajaxReturn(['status' => -1, 'msg' => $result['msg']]);
}
} else {
$this->assign('data', $data);//用户信息被覆盖,转移位置获取正确数据
$child = M('Promote', 'tab_')->field('account,balance_coin')->where(['parent_id' => PID])->select();
$this->assign('childData', $child);
$this->assign('childcount', count($child));
$this->meta_title = "平台币转移";
$this->display();
}
@ -430,136 +352,103 @@ class PromoteCoinController extends BaseController
$this->ajaxReturn($res);
}
/**
* 转移平台币记录
*/
public function record()
public function transferLogs()
{
$map['source_id'] = empty(I('promote_id')) ? ['neq', '0'] : I('promote_id');
$map['type'] = 2;
$map['promote_id'] = PID;
$end_time = strtotime(I('time_end'));
$start_time = strtotime(I('time_start'));
if (!empty($end_time) && !empty($start_time)) {
$map['create_time'] = ['between', [$start_time, $end_time + 86400 - 1]];
} elseif (!empty($start_time)) {
$map['create_time'] = array('gt', $start_time);
} elseif (!empty($end_time)) {
$map['create_time'] = array('lt', $end_time + 86400 - 1);
}
$account = I('account');
$sn = I('sn');
if ($sn) {
$map['sn'] = ['like', '%' . $sn . '%'];
}
if ($account) {
$searchUsers = M('User', 'tab_')->field('id')->where(['account' => ['like', '%' . $account . '%']])->select();
$searchPromotes = M('Promote', 'tab_')->field('id')->where(['account' => ['like', '%' . $account . '%']])->select();
if (empty($searchUsers) && empty($searchPromotes)) {
$map['_string'] = '1<>1';
}
if (empty($searchUsers) && !empty($searchPromotes)) {
$map['source_id'] = ['in', array_column($searchPromotes, 'id')];
}
if (!empty($searchUsers) && empty($searchPromotes)) {
$map['source_id'] = ['in', array_column($searchUsers, 'id')];
$this->meta_title = "平台币转移记录";
$gameId = I('game_id', -1);
$account = I('account', '');
$sn = I('sn', '');
$startTime = I('time_end', '');
$endTime = I('time_start', '');
$loginPromote = $this->getLoginPromote();
$conditions = ['promote_id' => $loginPromote['id']];
if ($startTime != '' || $endTime != '') {
if ($startTime != '') {
$conditions['create_time'] = ['egt', strtotime($startTime. ' 00:00:00')];
}
if (!empty($searchUsers) && !empty($searchPromotes)) {
$map['_string'] = '(source_id in (' . implode(',', array_column($searchUsers, 'id')) . ') or'
. '(source_id in (' . implode(',', array_column($searchPromotes, 'id')) . '))';
if ($endTime != '') {
$conditions['create_time'] = ['elt', strtotime($endTime. ' 23:59:59')];
}
}
$searchHandleType = I('handle_type', 0);
if ($searchHandleType) {
if ($searchHandleType == 2) {
$map['source_type'] = 2;
} else {
$query = M('promote_coin_transfer_log', 'tab_')->where($conditions)->order('create_time desc');
list($logs, $pagination, $count) = $this->paginate($query);
$service = new PromoteCoinTransferLogService();
$gameIds = [];
$promoteIds = [];
$uesrIds = [];
foreach ($logs as $log) {
$gameIds[] = $log['game_id'];
if ($log['target_type'] == 1) {
$promoteIds[] = $log['target_id'];
}
if ($log['target_type'] == 2) {
$uesrIds[] = $log['target_id'];
}
}
$searchGameId = I('game_id', -1);
if ($searchGameId != -1) {
$map['game_id'] = $searchGameId;
$games = [];
$promotes = [];
$users = [];
if (count($gameIds) > 0) {
$games = M('game', 'tab_')->field(['id', 'game_name'])->where(['id' => ['in', $gameIds]])->select();
}
$this->meta_title = "平台币转移记录";
$query = M('PromoteCoin', 'tab_')->where($map)->order('create_time desc');
list($items, $pagination, $count) = $this->paginate($query);
$gameIds = array_unique(array_column($items, 'game_id'));
$games = $this->getColumnsByIds(M('Game', 'tab_'), $gameIds, 'game_name', ['indexBy' => 'id']);
$sourcePromoteIds = [];
$sourceUserIds = [];
foreach ($items as $item) {
if ($item['source_type'] == 1) {
$sourcePromoteIds[] = $item['source_id'];
} elseif ($item['source_type'] == 2) {
$sourceUserIds[] = $item['source_id'];
}
if (count($promoteIds) > 0) {
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', $promoteIds]])->select();
}
$sourceUsers = $this->getRecordsByIds(M('User', 'tab_'), $sourceUserIds, ['indexBy' => 'id']);
$sourcePromotes = $this->getRecordsByIds(M('Promote', 'tab_'), $sourcePromoteIds, ['indexBy' => 'id']);
if (count($uesrIds) > 0) {
$users = M('user', 'tab_')->field(['id', 'account'])->where(['id' => ['in', $uesrIds]])->select();
}
$users = index_by_column('id', $users);
$promotes = index_by_column('id', $promotes);
$games = index_by_column('id', $games);
$records = [];
foreach ($items as $item) {
$sourceName = '';
$promote = null;
if ($item['source_type'] == 2) {
$sourceName = $sourceUsers[$item['source_id']]['account'];
} elseif ($item['source_type'] == 1) {
$promote = $sourcePromotes[$item['source_id']];
$sourceName = $sourcePromotes[$item['source_id']]['account'];
foreach ($logs as $log) {
$targetAccount = '';
if ($log['target_type'] == 1) {
$targetAccount = isset($promotes[$log['target_id']]) ? $promotes[$log['target_id']]['account'] : '未知推广账号';
}
if ($log['target_type'] == 2) {
$targetAccount = isset($promotes[$log['target_id']]) ? $promotes[$log['target_id']]['account'] : '未知玩家';
}
$handleType = $this->getHandleType($item, $promote);
$records[] = [
'id' => $item['id'],
'sn' => $item['sn'],
'account' => $item['id'],
'game_name' => isset($games[$item['game_id']]) ? $games[$item['game_id']] : '所有游戏',
'create_time' => date('Y-m-d H:i:s', $item['create_time']),
'description' => $item['description'],
'num' => $item['num'],
'source_name' => $sourceName,
'handle_type' => $handleType,
'status' => $item['status'] == 1 ? '成功' : '失败',
'id' => $log['id'],
'sn' => $log['sn'],
'target_account' => $targetAccount,
'game_name' => isset($games[$log['game_id']]) ? $games[$log['game_id']]['game_name'] : '所有游戏',
'target_type_text' => $service->getTargetTypeText($log['target_type'], $log['target_level']),
'num' => $log['num'],
'description' => $log['description'],
'status_text' => '成功',
'create_time' => date('Y-m-d H:i:s', $log['create_time'])
];
}
$rows = M('PromoteCoin', 'tab_')->field(['game_id'])->where(['type' => 2, 'promote_id' => PID])->group('game_id')->select();
$gameIds = array_column($rows, 'game_id');
$games = [];
if (count($gameIds) > 0) {
$games = M('Game', 'tab_')->field(['id', 'game_name'])->where(['id' => ['in', $gameIds]])->select();
}
$this->assign('games', $games);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
$this->assign('count', $count);
$this->assign('records', $records);
$this->display();
}
public function detail()
{
$id = I('id', 0);
$record = M('PromoteCoin', 'tab_')->where(['id' => $id])->find();
$sourceName = '';
$record = M('promote_coin_transfer_log', 'tab_')->where(['id' => $id])->find();
$targetName = '';
$sourceAccount = '';
$sourcePromote = null;
if ($record['source_type'] == 2) {
$sourceUser = M('User', 'tab_')->where(['id' => $record['source_id']])->find();
$sourceName = $sourceUser['real_name'];
$sourceAccount = $sourceUser['account'];
} elseif ($record['source_type'] == 1) {
$sourcePromote = M('Promote', 'tab_')->where(['id' => $record['source_id']])->find();
$sourceName = $sourcePromote['real_name'];
$sourceAccount = $sourcePromote['account'];
}
$handleType = $this->getHandleType($record, $sourcePromote);
if ($record['target_type'] == 2) {
$targetUser = M('user', 'tab_')->where(['id' => $record['target_id']])->find();
$targetName = $targetUser['real_name'];
$targetAccount = $targetUser['account'];
} elseif ($record['target_type'] == 1) {
$targetPromote = M('promote', 'tab_')->where(['id' => $record['target_id']])->find();
$targetName = $targetPromote['real_name'];
$targetAccount = $targetPromote['account'];
}
$service = new PromoteCoinTransferLogService();
$targetTypeText = $service->getTargetTypeText($record['target_type'], $record['target_level']);
$gameName = '所有游戏';
if ($record['game_id'] > 0) {
$game = M('Game', 'tab_')->field('game_name')->where(['id' => $record['game_id']])->find();
@ -571,9 +460,9 @@ class PromoteCoinController extends BaseController
'sn' => $record['sn'],
'game_name' => $gameName,
'create_time' => date('Y-m-d H:i:s', $record['create_time']),
'source_name' => $sourceName,
'source_account' => $sourceAccount,
'handle_type' => $handleType,
'target_name' => $targetName,
'target_account' => $targetAccount,
'target_type_text' => $targetTypeText,
'description' => $record['description'],
'remark' => $record['remark'],
'status' => $record['status'] == 1 ? '成功' : '失败',
@ -793,11 +682,6 @@ class PromoteCoinController extends BaseController
$this->display('promote_users');
}
public function think_ucenter_md5($str, $key = 'ThinkUCenter')
{
return '' === $str ? '' : md5(sha1($str) . $key);
}
public function promoteGames()
{
$promoteId = I('promote_id', 0);

@ -72,15 +72,36 @@
value="{:I('logid')}">
</div>
<div class="form-group fl" style="margin-left:10px">
<!-- <div class="form-group fl" style="margin-left:10px">
<select id="pid" name="pid" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="0">请选择推广员</option>
<volist name="promoteNameArr" id="vo">
<option value="{$vo.promote_id}" title="{$vo.name}">{$vo.name}</option>
</volist>
</select>
</div>
</div>-->
<input type="hidden" id="top-promote-id" value="{$loginer.id}">
<if condition="$loginer.level elt 1">
<div class="form-group fl" style="margin-left:10px">
<select name="level_promote_2" class="level-promote reselect select_gallery" style="width: 220px;" data-level="2" data-val="{:I('level_promote_2', 0)}">
<option value="0">请选择部门长</option>
</select>
</div>
</if>
<if condition="$loginer.level elt 2">
<div class="form-group fl" style="margin-left:10px">
<select name="level_promote_3" class="level-promote reselect select_gallery" style="width: 220px;" data-level="3" data-val="{:I('level_promote_3', 0)}">
<option value="0">请选择组长</option>
</select>
</div>
</if>
<if condition="$loginer.level elt 3">
<div class="form-group fl" style="margin-left:10px">
<select name="level_promote_4" class="level-promote reselect select_gallery" style="width: 220px;" data-level="4" data-val="{:I('level_promote_4', 0)}">
<option value="0">请选择推广员</option>
</select>
</div>
</if>
<div class="form-group normal_space fl">
<label class="form-title select-title" style="position: relative;">申请时间:</label>
@ -164,7 +185,10 @@
<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 type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$().ready(function () {
setValue('team_leader_id', {$Think.request.team_leader_id |default = '""'});
setValue('promote_id', {$Think.request.promote_id |default = 0});

@ -100,11 +100,11 @@
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">交易时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{$initBegTime}">
<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" id="edate" class="txt" name="endtime" placeholder="结束时间" value="{$initEndTime}">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{$initEndTime}">
</div>
</div>

@ -2,7 +2,7 @@
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/font-awesome/4.6.0/css/font-awesome.min.css">
<link href="__CSS__/transfer.css" rel="stylesheet" >
</block>
<block name="body">

@ -0,0 +1,83 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/platform.css" rel="stylesheet">
<style>
.trunk-list .table3 {width: 100%;}
.table3 tr td{border: 1px solid #E0E7EF;}
.pagenation{line-height: 6.5vh;}
.pagenation>div {text-align: right;}
.trunk-list .table3 tr {height: 4.2vh;}
.table_scroll {width:100%;table-layout:fixed;}
.table_scroll tr td {border:none;border-right:1px solid #E0E7EF;}
.table_scroll tr td:last-child{border-right:none;}
.table_scroll tr+tr td {border-top:1px solid #E0E7EF;}
.bill {
width: 900px;
margin: 0 auto;
margin-top: 100px;
}
.bill li {
line-height: 50px;
width: 450px;
float: left;
}
.bill li .item-title {
display: inline-block;
width: 120px;
text-align: right;
margin-right: 15px;
}
.back-btn {
width: 118px;
height: 36px;
line-height: 36px;
background: #E5E5E5;
color: #8B8CA0;
border-radius: 4px;
display: inline-block;
text-align: center;
margin-left: 20px;
border: none;
cursor: pointer;
}
</style>
</block>
<block name="body">
<div class="page-search normal_list promoteCoin-shift-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>平台币管理></span><span>交易流水明细</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_yve.png"><span class="title_main">交易流水明细</span>
</div>
<div class="trunk-content article">
<ul class="bill clearfix">
<li><span class="item-title">交易流水号:</span><span class="item-content">{$record.sn}</span></li>
<li><span class="item-title">交易时间:</span><span class="item-content">{$record.create_time}</span></li>
<li><span class="item-title">操作类型:</span><span class="item-content">{$record.type_text}</span></li>
<li><span class="item-title">操作方式:</span><span class="item-content">{$record.sub_type_text}</span></li>
<li><span class="item-title">平台币类型:</span><span class="item-content">{$record.coin_type}</span></li>
<li><span class="item-title">平台币数量:</span><span class="item-content">{$record.coin}</span></li>
<li><span class="item-title">平台币余额:</span><span class="item-content">{$record.balance_coin}</span></li>
<li><span class="item-title">交易说明:</span><span class="item-content">{$record.description}</span></li>
<li><span class="item-title">交易备注:</span><span class="item-content">{$record.remark}</span></li>
</ul>
</div>
<?php if ($refDetail):?>
<h3 style="margin: 15px 50px; border-bottom: 1px #8B8CA0 dotted; color: #8B8CA0; font-size: 14px; line-height: 30px;"><?= $refDetail['refTitle'] ?></h3>
<div class="trunk-content article">
<ul class="bill clearfix" style="margin-top: 50px;">
<?php foreach($refDetail['items'] as $item):?>
<li><span class="item-title"><?= $item['name'] ?></span><span class="item-content"><?= $item['value'] ?></span></li>
<?php endforeach;?>
</ul>
</div>
<?php endif;?>
<div style="margin-top: 20px;text-align: center; margin-bottom: 30px;">
<button type="button" class="back-btn btn" onclick="window.history.back();" >返回</button>
</div>
</div>
</div>
</block>

@ -0,0 +1,297 @@
<extend name="Public/promote_base"/>
<block name="css">
<link rel="stylesheet" href="__CSS__/20170831/select2.min.css" type="text/css"/>
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/game.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" rel="stylesheet">
<style type="text/css">
.trunk-list {
position: relative;
min-height: 66vh;
}
.pagenation {
text-align: center;
line-height: 5vh;
}
.lwx_dialog_prompt .layui-layer-content {
padding-top: 15px;
}
.lwx_dialog_title {
margin: 0;
padding: 0;
}
.launch_platform_prompt .layui-layer-input, .lwx_dialog_input, .lwx_dialog_select, .lwx_dialog_textarea {
display: block;
width: 220px;
height: 32px;
margin: 0 auto;
line-height: 32px;
padding: 0 5px;
border: 1px solid #ccc;
box-shadow: 1px 1px 5px rgba(0, 0, 0, .1) inset;
color: #333;
}
.lwx_dialog_select {
width: 272px;
}
.lwx_dialog_textarea {
height: 64px;
width: 260px;
margin-top: 10px;
resize: none;
}
.lwx_dialog_input {
width: 260px;
margin-top: 10px;
}
.launch_platform_prompt .layui-layer-btn, .lwx_dialog_prompt .layui-layer-btn {
text-align: center;
padding-bottom: 25px;
}
.launch_platform_prompt .layui-layer-btn .layui-layer-btn0, .lwx_dialog_prompt .layui-layer-btn .layui-layer-btn0 {
width: 81%;
line-height: 32px;
height: 32px;
margin: 0;
}
.lwx_dialog_notice {
position: absolute;
bottom: 6px;
left: 20px;
font-size: 12px;
color: #999;
}
.lwx_dialog_prompt .select2-container, .select2-container--default .select2-selection--single {
width: 272px !important;
}
.applycbtn {
display: block;
color: #50B370;
}
textarea {
font-family: inherit;
}
.trunk-content {
margin: 0 2%;
}
.pic-prev:hover, .pic-next:hover {
background-color: #4ac5c3;
}
.add-disable {
color: #999;
}
.trunk-search .form-group {
margin-left: 10px;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
</style>
</block>
<block name="body">
<div class="page-list normal_list apply-index-list jssearch">
<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">当前位置:<span>平台币管理></span><span>我的平台币></span><span>交易明细</span></div>
</div>
<img src="__IMG__/20180207/icon_jilu.png"><span class="title_main">交易明细</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<!-- <form action="{:U('PromoteCoin/coinRecord',array('game_id'=>I('get.game_id')))}" method="post" enctype="multipart/form-data"-->
<!-- class="marg_top20">-->
<div class="form-group normal_space fr">
<input type="submit" class="submit" id='submit' url="{:U('PromoteCoin/coinDetails',array('model'=>$model['name'],'game_id'=>I('get.game_id')),false)}"
value="查询">
</div>
<div class="form-group normal_space fr">
<label>充值时间:</label>
<div class="select-time">
<input type="text" id="start_time" class="txt" name="start_time" placeholder="" value="{:I('start_time')}" >
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" id="end_time" class="txt" name="end_time" placeholder="" value="{:I('end_time')}">
</div>
</div>
<div class="form-group normal_space fr">
<label>对手账号类型:</label>
<select id="target_type" name="target_type" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<?php foreach($targetTypeLevels as $key => $name):?>
<option value="<?=$key?>" title="<?=$name?>"><?=$name?></option>
<?php endforeach;?>
</select>
</div>
<div class="form-group normal_space fr">
<label>操作方式:</label>
<select id="sub_type" name="sub_type" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<volist name="subTypes" id="vo" key="k">
<option value="{$k}" title="{$vo}">{$vo}</option>
</volist>
</select>
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="end_time" class="txt" name="end_time" placeholder="" value="{:I('end_time')}">
</div>
</div>
<div class="form-group normal_space">
<input type="submit" class="submit" id='submit' url="{:U('PromoteCoin/coinDetails',array('model'=>$model['name'],'game_id'=>I('get.game_id')),false)}"
value="查询">
</div>
<!-- </form>-->
</div>
<div class="trunk-list">
<div class="div_bgtab">
<table class="table normal_table zwm_tab">
<tr class="odd <if condition='get_parent_id(PID) eq 0'>pid</if> zwm_tr">
<th>流水号</th>
<th>操作类型</th>
<th>操作方式</th>
<th>对手账号类型</th>
<th>平台币数量</th>
<th>平台币余额</th>
<th>交易说明</th>
<th>交易时间</th>
<th>操作</th>
</tr>
<empty name="records">
<tr>
<td colspan="9" 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="records" id="record">
<tr>
<td>{$record.sn}</td>
<td>{$record.type_text}</td>
<td>{$record.sub_type_text}</td>
<td>{$record.target_type_text}</td>
<td>{$record.coin}</td>
<td>{$record.balance_coin}</td>
<td>{$record.description}</td>
<td>{$record.create_time}</td>
<td>
<a href="{:U('coinDetail',array('id'=>$record['id']))}" style="text-decoration: underline;color: #3A97FF;">查看明细</a>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" href="{:U('download/mycoinrecord_data_export',array_merge(['promote_type'=>'xxx'],I('get.')))}" class="ajax-get" >导出</a>
<?php endif ;?>
{$pagination}
</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 src="__STATIC__/zeroclipboard/jquery.zclip.min.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script>
setValue('type', {$Think.request.type |default = '""'});
setValue('sub_type', {$Think.request.sub_type |default = '""'});
setValue('handle_type', {$Think.request.handle_type |default = '""'});
setValue('row', '{:I("row",10)}');
var date="{$setDate}";
$('#start_time').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
scrollMonth:false,
scrollTime:false,
scrollInput:false,
endDate:date
});
$('#end_time').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
pickerPosition:'bottom-left',
scrollMonth:false,
scrollTime:false,
scrollInput:false,
endDate:date
});
$(document).ready(function () {
$(".select_gallery").select2();
$('.back-btn').on('click', function () {
history.back(-1);
});
$('#submit').click(function () {
var sdate = $('#start_time').val();
var edate = $('#end_time').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;
});
});
</script>
</block>

@ -136,7 +136,7 @@
</div>
</div>
<div class="form-group normal_space fr">
<label>账号类型:</label>
<label>对手账号类型:</label>
<select id="handle_type" name="handle_type" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<volist name=":getCoinRecordHandleTypeName()" id="vo" key="k">

@ -57,9 +57,9 @@
<li><span class="item-title">转账标识:</span><span class="item-content">{$item.id}</span></li>
<li><span class="item-title">订单号:</span><span class="item-content">{$item.sn}</span></li>
<li><span class="item-title">适用游戏:</span><span class="item-content">{$item.game_name}</span></li>
<li><span class="item-title">账号类型:</span><span class="item-content">{$item.handle_type}</span></li>
<li><span class="item-title">收款方账号:</span><span class="item-content">{$item.source_account}</span></li>
<li><span class="item-title">收款方姓名:</span><span class="item-content">{$item.source_name}</span></li>
<li><span class="item-title">目标账号类型:</span><span class="item-content">{$item.target_type_text}</span></li>
<li><span class="item-title">收款方账号:</span><span class="item-content">{$item.target_account}</span></li>
<li><span class="item-title">收款方姓名:</span><span class="item-content">{$item.target_name}</span></li>
<li><span class="item-title">交易时间:</span><span class="item-content">{$item.create_time}</span></li>
<li><span class="item-title">交易状态:</span><span class="item-content">{$item.status}</span></li>
<li><span class="item-title">转账数量:</span><span class="item-content">{$item.num}</span></li>

@ -99,6 +99,19 @@
.add-disable {
color: #999;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
</style>
</block>
@ -114,44 +127,44 @@
<div class="trunk-search clearfix">
<!-- <form action="{:U('myCoin')}" method="post" enctype="multipart/form-data"-->
<!-- class="marg_top20">-->
<div class="form-group normal_space fr">
<input type="submit" class="submit" id='submit' url="{:U('myCoin','model='.$model['name'],false)}"
value="查询">
</div>
<div class="form-group normal_space fr">
<label>状态:</label>
<select id="status" name="status" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<option value="1"
<?=(I('status')==1)?'selected="selected"':''?>>正常</option>
<option value="2"
<?=(I('status')==2)?'selected="selected"':''?>>锁定</option>
<option value="3"
<?=(I('status')==3)?'selected="selected"':''?>>验证失败</option>
</select>
</div>
<div class="form-group normal_space fr">
<label>平台币类型:</label>
<select id="coin_type" name="coin_type" class="reselect select_gallery"
style="min-width:200px;width: 175px;">
<option value="">全部</option>
<option value="2"
<?=(I('coin_type')==2)?'selected="selected"':''?>>绑定币</option>
<option value="1"
<?=(I('coin_type')==1)?'selected="selected"':''?>>通用币</option>
</select>
</div>
<div class="form-group normal_space fr">
<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">
<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">
<label>平台币类型:</label>
<select id="coin_type" name="coin_type" class="reselect select_gallery"
style="min-width:200px;width: 175px;">
<option value="">全部</option>
<option value="2"
<?=(I('coin_type')==2)?'selected="selected"':''?>>绑定币</option>
<option value="1"
<?=(I('coin_type')==1)?'selected="selected"':''?>>通用币</option>
</select>
</div>
<div class="form-group normal_space">
<label>状态:</label>
<select id="status" name="status" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<option value="1"
<?=(I('status')==1)?'selected="selected"':''?>>正常</option>
<option value="2"
<?=(I('status')==2)?'selected="selected"':''?>>锁定</option>
<option value="3"
<?=(I('status')==3)?'selected="selected"':''?>>验证失败</option>
</select>
</div>
<div class="form-group normal_space">
<input type="submit" class="submit" id='submit' url="{:U('myCoin','model='.$model['name'],false)}"
value="查询">
</div>
<!-- </form>-->
</div>
<div class="trunk-list">
@ -184,7 +197,7 @@
<td>{$vo.num}</td>
<td>{:getCoinStatusName($vo['status'])}</td>
<td>
<a href="{:U('coinRecord',array('game_id'=>$vo['game_id']))}" style="text-decoration: underline;color: #3A97FF;">交易明细表</a>
<a href="{:U('coinDetails',array('game_id'=>$vo['game_id']))}" style="text-decoration: underline;color: #3A97FF;">交易明细表</a>
</td>
</tr>
</volist>

@ -210,11 +210,11 @@
}
var data = {}
var url = "{:U('PromoteCoin/promoteGames')}"
if (shiftUserType == 1 || shiftUserType == 2) {
if (shiftUserType == 1 || shiftUserType == 2 || shiftUserType == 3) {
data = {
promote_id: shiftUserId
}
} else if (shiftUserType == 3) {
} else if (shiftUserType == 4) {
data = {
user_id: shiftUserId
}
@ -242,7 +242,7 @@
data:{
shift_user_type: shiftUserType,
game_id: gameId,
promote_id: shiftUserId,
target_id: shiftUserId,
num: num,
remark: remark,
password: password,
@ -252,7 +252,7 @@
if(res.status==1){
layer.msg(res.msg);
setTimeout(function(){
window.location.href="{:U('record')}";
window.location.href="{:U('transferLogs')}";
}, 1500);
} else {
layer.msg(res.msg);
@ -274,7 +274,6 @@
function resetCoinItem(gameId) {
var result = getCoinNum(gameId)
console.log(result)
$('#coin1-count').html(result.commonCoin)
$('#coin2-count').html(result.gameCoin)
}
@ -300,7 +299,7 @@
function validation() {
var json_data = "";
var limits = parseInt("{$data['balance_coin']|default=0}");
var limits = parseInt("{$loginer['balance_coin']|default=0}");
if ($.trim($('#num').val()).length == 0) {
return json_data = {'status': 0, 'msg': '发送数量不能为空'}
}

@ -0,0 +1,159 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/platform.css" rel="stylesheet">
<style type="text/css">
@media screen and (max-width: 1480px) {
.form-group .submit{width: 55px;}
}
</style>
</block>
<block name="body">
<div class="page-search normal_list promoteCoin-record-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>平台币></span><span>转账记录</span></div>
</div>
<img src="__IMG__/20180207/icon_jilu.png"><span class="title_main">转账记录</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('PromoteCoin/record', array('row'=>I('get.row')))}" method="post" class="clearfix">
<div class="form-group fl normal_space">
<a href="{:U('PromoteCoin/shift')}" class="submit" style="line-height: 36px; text-align: center;">转账</a>
</div>
<div class="form-group normal_space fr">
<input type="submit" class="submit" value="查询">
</div>
<div class="form-group fr normal_space">
<label class="form-title select-title">订单号:</label>
<input type="text" name="sn" class="txt normal_txt" id="uid" placeholder="订单号" value="{:I('sn')}">
</div>
<div class="form-group fr normal_space">
<label class="form-title select-title">收款账号:</label>
<input type="text" name="account" class="txt normal_txt" id="uid" placeholder="收款账号" value="{:I('account')}">
</div>
<div class="form-group normal_space fr">
<label class="form-title select-title">转账时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="time_start" value="{:I('time_start')}" placeholder="开始时间">
</div>
<label class="form-title select-title">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" id="edate" class="txt" name="time_end" value="{:I('time_end')}" placeholder="结束时间">
</div>
</div>
<div class="form-group normal_space fr">
</div>
<!-- <div class="form-group fr normal_space">
<label class="form-title select-title">账号类型:</label>
<select name="handle_type" class="reselect select_gallery" style="min-width:170px;">
<option value="">全部</option>
<option value="1" <if condition="I('handle_type') === '1'">selected</if>>玩家转账</option>
<option value="2" <if condition="I('handle_type') === '2'">selected</if>>推广员转账</option>
<option value="3" <if condition="I('handle_type') === '3'">selected</if>>组长转账</option>
</select>
</div> -->
<div class="form-group fr">
<label class="form-title select-title">游戏:</label>
<select name="game_id" class="reselect select_gallery" style="min-width:170px;">
<option value="-1">全部</option>
<option value="0" <if condition="I('game_id') === '0'">selected</if>>所有游戏</option>
<volist name="games" id="vo">
<option value="{$vo.id}" <if condition="I('game_id') === $vo['id']">selected</if>>{$vo.game_name}</option>
</volist>
</select>
</div>
</form>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr>
<th>订单号</th>
<th>收款方帐号</th>
<th>适用游戏</th>
<th>目标帐号类型</th>
<th>转账数量</th>
<th>交易说明</th>
<th>交易时间</th>
<th>交易状态</th>
<th>操作</th>
</tr>
<empty name="records">
<tr><td colspan="9" 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="records" id="vo">
<tr>
<td>{$vo.sn}</td>
<td>{$vo.target_account}</td>
<td>{$vo.game_name}</td>
<td>{$vo.target_type_text}</td>
<td>{$vo.num}</td>
<td>{$vo.description}</td>
<td>{$vo.create_time}</td>
<td>{$vo.status_text}</td>
<td><a href="{:U('detail', ['id' => $vo['id']])}">查看详情</a></td>
</tr>
</volist>
</empty>
</table>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" href="{:U('download/coinrecord_data_export',array_merge(['promote_type'=>'xxx'],I('post.')))}" class="ajax-get" >导出</a>
<?php endif ;?>
{$pagination}
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link rel="stylesheet" type="text/css" href="__CSS__/p_jquery.datetimepicker.css">
<script type="text/javascript" src="__JS__/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
setValue('promote_id',{$Think.request.promote_id|default="''"});
setValue('row','{:I("get.row",10)}');
highlight_subnav('{:U('shift')}');
$().ready(function(){
highlight_subnav('{:U('Charge/agent_pay_list')}');
$('#sdate').datetimepicker({
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
scrollMonth:false,
scrollTime:false,
scrollInput:false,
timepicker:false
});
$(".select_gallery").select2();
$('#edate').datetimepicker({
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
scrollMonth:false,
scrollTime:false,
scrollInput:false,
timepicker:false
});
$(".submit").click(function(){
var sdate =$('#sdate').val();
var edate =$('#edate').val();
if(Date.parse(sdate) > Date.parse(edate)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
})
});
</script>
</block>

@ -115,16 +115,16 @@
</eq>-->
<!--<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>会长福利</span><i class="arrow_icon"></i></div>-->
<if condition="$loginer['level'] neq 4">
<?php if($loginer['level'] != 4):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>平台币管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('PromoteCoin/myCoin')}" class="<if condition='CONTROLLER_NAME eq PromoteCoin and (ACTION_NAME eq myCoin or ACTION_NAME eq coinRecord or ACTION_NAME eq coinRecordDesc) '>active</if> ">我的平台币</a>
<a href="{:U('PromoteCoin/record')}" class="<if condition='CONTROLLER_NAME eq PromoteCoin and (ACTION_NAME eq shift or ACTION_NAME eq record) '>active</if> ">平台币转移</a>
<if condition="$loginer['level'] eq 1">
<a href="{:U('PromoteCoin/transferLogs')}" class="<if condition='CONTROLLER_NAME eq PromoteCoin and (ACTION_NAME eq shift or ACTION_NAME eq transferLogs) '>active</if> ">平台币转移</a>
<?php if($loginer['level'] == 1):?>
<a href="{:U('CoinOrder/order_list')}" class="<if condition='CONTROLLER_NAME eq CoinOrder and (ACTION_NAME eq order_list or ACTION_NAME eq order_add or ACTION_NAME eq order_detail) '>active</if> ">平台币充值</a>
</if>
<?php endif;?>
</div>
</if>
<?php endif;?>
<!--<div class="subNav jssubNav"><i class="prev_icon icon_zhandian"></i><span>联盟站点</span><i class="arrow_icon"></i></div>-->
<!--<div class="navContent jsnavContent">-->
<!--<a href="{:U('SiteApply/index')}" class="<if condition='CONTROLLER_NAME eq SiteApply and ACTION_NAME eq index '>active</if> ">站点申请</a>-->

@ -118,11 +118,11 @@
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">起止时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}">
</div>
</div>

@ -64,11 +64,11 @@
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">起止时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}">
</div>
</div>

@ -370,4 +370,25 @@ ALTER TABLE `tab_withdraw` ADD COLUMN `transfer_proof` int(11) NOT NULL DEFAULT
-- 2019-11-08 cxj
ALTER TABLE `sys_document_download` MODIFY COLUMN `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '文档ID' FIRST;
ALTER TABLE `tab_promote`
CHANGE COLUMN `ver_status` `ver_status` TINYINT(2) NULL DEFAULT '3' COMMENT '资质认证审核状态(1是审核成功2审核失败3未审核)' AFTER `child_game_permission`;
CHANGE COLUMN `ver_status` `ver_status` TINYINT(2) NULL DEFAULT '3' COMMENT '资质认证审核状态(1是审核成功2审核失败3未审核)' AFTER `child_game_permission`;
-- 2019-11-11 elf
ALTER TABLE `tab_promote_coin_record` ADD COLUMN `promote_id` int(11) NOT NULL DEFAULT 0 COMMENT '推广员ID' AFTER `ref_id`;
ALTER TABLE `tab_promote_coin_record` ADD COLUMN `target_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT '目标对象等级' AFTER `target_type`;
ALTER TABLE `tab_promote_coin_record` ADD COLUMN `game_id` int(11) NOT NULL DEFAULT 0 COMMENT '游戏ID' AFTER `target_level`;
CREATE TABLE `tab_promote_coin_transfer_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`sn` varchar(30) NOT NULL DEFAULT '' COMMENT '订单号',
`promote_id` int(11) NOT NULL COMMENT '推广员ID',
`target_id` int(11) NOT NULL COMMENT '目标对象ID',
`target_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型 1 推广员 2 玩家',
`target_level` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '目标对象等级',
`num` int(11) NOT NULL DEFAULT '0' COMMENT '转账数量',
`game_id` int(1) NOT NULL DEFAULT '0' COMMENT '游戏ID',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 未处理 1 成功',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
`description` varchar(255) NOT NULL DEFAULT '' COMMENT '描述说明',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Loading…
Cancel
Save