master
ELF 4 years ago
parent 5f5a6ee1af
commit 76fcfec7c2

@ -2560,3 +2560,27 @@ function getCompanyDevelopTypeText($type)
{
return getCompanyDevelopTypes()[$type] ?? '无';
}
function withMarketAdminCondition($map, $searchMarketAdminId = 0)
{
$adminId = 0;
$isMarketAdmin = isMarketAdmin();
if ($isMarketAdmin) {
$userAuth = session('user_auth');
$adminId = $userAuth['uid'];
}
if ($adminId == 0) {
$adminId = $searchMarketAdminId > 0 ? $searchMarketAdminId : 0;
}
if ($adminId) {
$topPromoteIds = M('promote', 'tab_')->where(['admin_id' => $adminId, 'level' => 1])->getField('id', true);
$promoteIds = getPromoteIdsByTopIds($topPromoteIds);
if (count($promoteIds) == 0) {
$promoteIds = [-1];
}
$map['promote_id'] = ['in', $promoteIds];
}
return $map;
}

@ -94,12 +94,12 @@ class ConsoleController extends Think {
}
}
public function runTask($type = null, $count = 1)
public function runTask($queue = 'common', $count = 1)
{
Printer::export($type);
Printer::export($queue);
Printer::export($count);
try {
$task = new Task($type);
$task = new Task($queue);
$task->run($count);
Printer::export('运行完成');
} catch (\Exception $e) {

@ -64,8 +64,8 @@ class ExportController extends Controller
// array('play_ip', "最后登录ip"),
// );
$xlsCell = array(
"创建时间","玩家账号", "游戏名称","游戏区服", L('Game_area_clothing'), "角色ID", "角色名", "游戏等级","所属推广员",
"最后登录时间", '最后登录ip',
"创建时间","玩家账号", "游戏名称","游戏区服", L('Game_area_clothing'), "角色ID", "角色名", "游戏等级","推广员ID", "所属推广员",
"最后登录时间", '最后登录ip','所属市场专员'
);
if (isset($_REQUEST['game_name'])) {
$map['game_name'] = ['like', trim($_REQUEST['game_name'])."%"];
@ -92,6 +92,8 @@ class ExportController extends Controller
unset($_REQUEST['role_name']);
}
$map = withMarketAdminCondition($map, I('market_admin_id', 0));
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
@ -147,13 +149,15 @@ class ExportController extends Controller
for($i = 1; $i <= $pages; $i++) {
$xlsData = M('user_play_info', 'tab_')
->field("create_time,user_account,game_name,server_id,server_name,role_id,role_name,role_level,promote_account,play_time,play_ip")
->field("create_time,user_account,game_name,server_id,server_name,role_id,role_name,role_level,promote_id,promote_account,play_time,play_ip")
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->order('play_time desc')
->select();
$adminList = getMarketAdminsByPromoteIds(array_column($xlsData, 'promote_id'));
foreach($xlsData as $value) {
$value['market_admin_username'] = isset($adminList[$value['promote_id']]) && $adminList[$value['promote_id']]['admin'] ? $adminList[$value['promote_id']]['admin']['username'] : '无';
$value['create_time'] = date("Y-m-d H:i:s",$value['create_time']);
$value['play_time'] = date("Y-m-d H:i:s",$value['play_time']);
mb_convert_variables('GBK', 'UTF-8', $value);

@ -164,7 +164,9 @@ class FinancePromoteController extends AdminController
data2csv($data,'公会统计',array(
"company_name"=>"推广公司",
"promote_account"=>"会长渠道",
"company_belong"=>"内外团",
"admin_username"=>"所属市场专员",
"company_belong"=>"团体类型",
"develop_type_text"=>"开发类型",
"cash_count"=>"游戏现金金额",
"balance_coin_count"=>"平台币直充支出",
"bind_coin_count"=>"内充支出",
@ -395,7 +397,9 @@ class FinancePromoteController extends AdminController
data2csv($data,'渠道统计',array(
"company_name"=>"推广公司",
"promote_account"=>"推广员账号",
"company_belong"=>"内外团",
"admin_username"=>"所属市场专员",
"company_belong"=>"团体类型",
"develop_type_text"=>"开发类型",
"cash_count"=>"游戏现金金额",
"balance_coin_count"=>"平台币直充支出",
"bind_coin_count"=>"内充支出",
@ -537,7 +541,9 @@ class FinancePromoteController extends AdminController
data2csv($data,$title, array(
"company_name"=>"推广公司",
"account"=>"会长账号",
"admin_username"=>"所属市场专员",
"company_belong"=>"团体类型",
"develop_type_text"=>"开发类型",
"game_name"=>"游戏",
"sdk_version"=>"设备",
"cash_count"=>"游戏现金金额",

@ -66,6 +66,7 @@ class MarketController extends ThinkController
0 => '待处理',
1 => '处理成功',
2 => '处理失败',
3 => '已取消'
];
$records = [];
@ -78,7 +79,7 @@ class MarketController extends ThinkController
'remark' => $item['remark'],
'from_username' => $recordAdmins[$item['from_id']]['username'],
'to_username' => $recordAdmins[$item['to_id']]['username'],
'split_time' => date('Y-m-d H:i:s', $item['split_time']),
'split_time' => $item['split_time'] == 0 ? '全部' : date('Y-m-d H:i:s', $item['split_time']),
'created_time' => date('Y-m-d H:i:s', $item['created_time']),
'status_text' => $statusList[$item['status']],
'status' => $item['status']
@ -116,13 +117,37 @@ class MarketController extends ThinkController
]);
}
$status = true;
$message = '';
foreach ($records as $record) {
if ($record['from_id'] == $record['to_id']) {
$status = false;
$message = '含有原市场专员与新市场专员相同数据,不可转换。';
break;
}
}
if (!$status) {
$this->ajaxReturn([
'status' => 0,
'message' => $message
]);
}
$hasRecord = M('market_shift', 'tab_')->where(['promote_id' => ['in', array_column($records, 'promote_id')], 'status' => 0])->find();
if ($hasRecord) {
$this->ajaxReturn([
'status' => 0,
'message' => '该会长含有未完成的市场换绑任务,请稍后再申请。'
]);
}
$userAuth = session('user_auth');
foreach ($records as $record) {
$item = [
'promote_id' => $record['promote_id'],
'from_id' => $record['from_id'],
'to_id' => $record['to_id'],
'split_time' => $record['split_time'],
'split_time' => strtotime($record['split_time']),
'remark' => $record['remark'],
'creator_id' => $userAuth['uid'],
'created_time' => time()
@ -158,6 +183,34 @@ class MarketController extends ThinkController
]);
}
public function cancel()
{
$id = I('id', 0);
$shift = M('market_shift', 'tab_')->where(['id' => $id])->find();
if ($shift['status'] != 0) {
$this->ajaxReturn([
'status' => 0,
'message' => '该换绑非待处理状态,不可取消'
]);
}
addOperationLog([
'op_type' => 2,
'key' => $id,
'op_name' => '取消市场换绑记录',
'url' => U('Market/delete', ['id' => $id]),
'menu' => '推广员-推广员管理-市场换绑-取消市场换绑记录'
]);
M('market_shift', 'tab_')->where(['id' => $id])->save(['status' => 3]);
$this->ajaxReturn([
'status' => 1,
'message' => '取消成功'
]);
}
public function getPromotesByCompany()
{
$companyId = I('company_id', 0);

@ -182,6 +182,7 @@ class MemberController extends ThinkController
if(empty($viplevel)) {$viplevel = false;}
}
$adminUsernameList = getAdminUsernameList(array_column($data, 'admin_id'));
foreach ($data as $k => &$v) {
$v['register_type'] = get_registertype($v['register_type']);
if(!$isadmin){
@ -211,10 +212,11 @@ class MemberController extends ThinkController
$v['lock_status'] = get_info_status($v['lock_status'],4);
$v['check_status'] = $v['check_status']==1 ? "正常" :"拉黑";
$v['is_repeat'] = $v['is_repeat']==1 ? "是" :"否";
$v['market_admin_username'] = $adminUsernameList[$v['admin_id']] ?? '无';
}
$field = array(
"id"=>"账号ID","account"=>"玩家账号","promote_account"=>"所属推广员","balance"=>"账户平台币","recharge_total"=>"累计充值","gold_coin"=>"金币",
"id"=>"账号ID","account"=>"玩家账号","promote_account"=>"所属推广员","market_admin_username"=>"所属市场专员","balance"=>"账户平台币","recharge_total"=>"累计充值","gold_coin"=>"金币",
"small_count"=>"小号","vip_level"=>"VIP等级","register_type"=>"注册方式","register_time"=>"注册时间","register_ip"=>"注册IP","login_time"=>"最后登录时间",
"device_number"=>"设备号","is_repeat"=>"去重数据","lock_remark"=>"锁定备注","lock_status"=>"账号状态","check_status"=>"拉黑状态"
);

@ -666,26 +666,7 @@ class UserController extends AdminController
unset($_REQUEST['role_id']);
}
$adminId = 0;
$isMarketAdmin = isMarketAdmin();
if ($isMarketAdmin) {
$userAuth = session('user_auth');
$adminId = $userAuth['uid'];
}
$marketAdminId = I('market_admin_id', 0);
if ($adminId == 0) {
$adminId = $marketAdminId > 0 ? $marketAdminId : 0;
}
if ($adminId) {
$topPromoteIds = M('promote', 'tab_')->where(['admin_id' => $adminId, 'level' => 1])->getField('id', true);
$promoteIds = getPromoteIdsByTopIds($topPromoteIds);
if (count($promoteIds) == 0) {
$promoteIds = [-1];
}
$map['promote_id'] = ['in', $promoteIds];
}
$map = withMarketAdminCondition($map, I('market_admin_id', 0));
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];

@ -73,7 +73,7 @@
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Market/rebind')}">搜索</a>
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Market/rebindRecords')}">搜索</a>
<a class="sch-btn" href="{:U('Market/rebind')}">添加</a>
<!-- <a class="sch-btn" href="javascript:;" id="batch-delete-btn">删除</a> -->
</div>
@ -99,7 +99,7 @@
<th>订单切分时间</th>
<th>状态</th>
<th>换绑操作时间</th>
<th>操作</th>
<!-- <th>操作</th> -->
</tr>
</thead>
@ -119,11 +119,14 @@
<td>{$data.split_time}</td>
<td>{$data.status_text}</td>
<td>{$data.created_time}</td>
<td>
<!-- <td>
<div class="partakebtn">
<a class="delete-btn">删除</a>
<?php if($data['status'] == 0):?>
<a class="cancel-btn">取消</a>
<?php endif;?>
</div>
</td>
</td> -->
</tr>
</volist>
</empty>
@ -232,6 +235,27 @@
})
}
})
$('.cancel-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("cancel")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
});
/* $(".export-btn").on("click",function(e){
e.preventDefault();

@ -194,6 +194,7 @@
'role_name'=>I('role_name'),
'promote_level'=>I('promote_level'),
'promote_id'=>I('promote_id'),
'market_admin_id'=>I('market_admin_id'),
'game_type'=>I('game_type'),
'xlsname'=>'玩家_角色查询',
'time_start'=>I('time_start'),

@ -7,12 +7,12 @@ class MarketService
{
public function shift($marketShift)
{
$formId = $marketShift['form_id'];
$fromId = $marketShift['from_id'];
$promoteId = $marketShift['promote_id'];
$toId = $marketShift['to_id'];
$time = $marketShift['split_time'] == 0 ? null : $marketShift['split_time'];
$promote = M('promote', 'tab_')->field(['chain', 'id', 'level', 'admin_id'])->where(['id' => $promoteId, 'admin_id' => $formId])->find();
$promote = M('promote', 'tab_')->field(['chain', 'id', 'level', 'admin_id'])->where(['id' => $promoteId, 'admin_id' => $fromId])->find();
if (!$promote) {
throw new \Exception('会长不存在');
@ -20,27 +20,34 @@ class MarketService
if ($promote['level'] != 1) {
throw new \Exception('该账号非会长');
}
if ($fromId == $toId) {
throw new \Exception('原市场专员与新市场专员相同,不可转换。');
}
if ($promote['admin_id'] == $toId) {
throw new \Exception('新市场专员与现市场专员相同,不可转换。');
}
$promotes = (new PromoteService)->getAllChildren($promote, 0, ['id']);
$promoteIds = [$promote['id']];
$promoteIds = array_merge(array_column($promotes, 'id'), $promoteIds);
$this->shiftPromote($formId, $toId);
$this->shiftSpend($promoteIds, $formId, $toId, $time);
$this->shiftDeposit($promoteIds, $formId, $toId, $time);
$this->shiftPromote($promoteId, $fromId, $toId);
$this->shiftSpend($promoteIds, $fromId, $toId, $time);
$this->shiftDeposit($promoteIds, $fromId, $toId, $time);
}
public function shiftPromote($promoteId, $formId, $toId, $time = null)
public function shiftPromote($promoteId, $fromId, $toId, $time = null)
{
$map = [];
$map['id'] = $promoteId;
$map['admin_id'] = $fromId;
M('promote', 'tab_')->where($map)->save(['admin_id' => $toId]);
}
public function shiftSpend($promoteIds, $formId, $toId, $time = null)
public function shiftSpend($promoteIds, $fromId, $toId, $time = null)
{
$map = [];
$map['promote_id'] = ['in', $promoteIds];
$map['market_admin_id'] = $formId;
$map['market_admin_id'] = $fromId;
if ($time) {
$map['pay_time'] = ['egt', $time];
}
@ -54,11 +61,11 @@ class MarketService
M('spend', 'tab_')->where($map)->save(['market_admin_id' => $toId]);
}
public function shiftDeposit($promoteIds, $formId, $toId, $time = null)
public function shiftDeposit($promoteIds, $fromId, $toId, $time = null)
{
$map = [];
$map['promote_id'] = ['in', $promoteIds];
$map['market_admin_id'] = $formId;
$map['market_admin_id'] = $fromId;
if ($time) {
$map['create_time'] = ['egt', $time];
}

@ -11,20 +11,32 @@ class Task
'market-shift' => '\Base\Task\MarketShiftTask',
];
public $type;
public static $queues = [
'common' => [],
'market-shift' => ['market-shift']
];
public $queue;
public $tasks;
public function __construct($type = null)
public function __construct($queue = 'common')
{
$this->type = $type;
$this->queue = $queue;
}
public function run($count = 1)
{
$map = ['status' => 0];
if ($this->type !== null) {
$map['type'] = $this->type;
if (!isset(self::$queues[$this->queue])) {
throw new \Exception('无此队列');
}
$types = self::$queues[$this->queue];
if (count($types) > 0) {
$map['type'] = ['in', $types];
} else {
throw new \Exception('暂无任务');
}
$this->tasks = M('tasks', 'tab_')->where($map)->limit($count)->select();
if (count($this->tasks) == 0) {
throw new \Exception('暂无任务');

Loading…
Cancel
Save