修改冲突

master
ELF 5 years ago
commit edc6a7be73

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

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

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

@ -157,7 +157,7 @@
<th ><a class="paixu" data-order='create_time'>注册时间</a></th> <th ><a class="paixu" data-order='create_time'>注册时间</a></th>
<th ><a class="paixu" data-order='last_login_time'>最后登录时间</a></th> <th ><a class="paixu" data-order='last_login_time'>最后登录时间</a></th>
<th>渠道类型</th> <th>渠道类型</th>
<th>会长</th> <th>线会长</th>
<th>商务专员</th> <th>商务专员</th>
<th>状态</th> <th>状态</th>
<th>可申请游戏</th> <th>可申请游戏</th>
@ -184,7 +184,7 @@
<td>{:set_show_time($data['create_time'])}</td> <td>{:set_show_time($data['create_time'])}</td>
<td>{:set_show_time($data['last_login_time'])}</td> <td>{:set_show_time($data['last_login_time'])}</td>
<td>{:get_promote_levels($data['id'])}</td> <td>{:get_promote_levels($data['id'])}</td>
<td><?php echo (new \Base\Service\PromoteService())->getTopPromote($data)['account']?></td> <td>{:getTopPromote($data['id'])['account']}</td>
<td>{:get_business_affairs_account($data['ba_id'])}</td> <td>{:get_business_affairs_account($data['ba_id'])}</td>
<td><if condition="$data['status'] eq 0"> <td><if condition="$data['status'] eq 0">
<span class="preview_status">{:get_info_status($data['status'],3)}</span> <span class="preview_status">{:get_info_status($data['status'],3)}</span>

@ -92,6 +92,7 @@ class PromoteService {
$balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0; $balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0;
$type = isset($params['type']) ? $params['type'] : 0; $type = isset($params['type']) ? $params['type'] : 0;
$shiftIds = isset($params['shift_ids']) && $params['shift_ids'] ? $params['shift_ids'] : []; $shiftIds = isset($params['shift_ids']) && $params['shift_ids'] ? $params['shift_ids'] : [];
$create_promote_id = empty(session('promote_auth.pid')) ? 0 : session('promote_auth.pid');
if ($fromPromoteId == $toPromoteId) { if ($fromPromoteId == $toPromoteId) {
return [ return [
@ -123,7 +124,7 @@ class PromoteService {
'order_time' => strtotime($orderTime), 'order_time' => strtotime($orderTime),
'balance_coin_mode' => $balanceCoinMode, 'balance_coin_mode' => $balanceCoinMode,
'create_time' => time(), 'create_time' => time(),
'create_promote_id' => session('promote_auth.pid'), 'create_promote_id' => $create_promote_id,
'status' => 0, 'status' => 0,
'type' => $type, 'type' => $type,
'shift_ids' => json_encode($shiftIds) 'shift_ids' => json_encode($shiftIds)

Loading…
Cancel
Save