优化迁移用户addshifttask

master
chenzhi 5 years ago
parent 2dd1372b78
commit 7e37f3a2df

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

@ -91,6 +91,7 @@ class PromoteService {
$balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0;
$type = isset($params['type']) ? $params['type'] : 0;
$shiftIds = isset($params['shift_ids']) && $params['shift_ids'] ? $params['shift_ids'] : [];
$create_promote_id = empty(session('promote_auth.pid')) ? 0 : session('promote_auth.pid');
if ($fromPromoteId == $toPromoteId) {
return [
@ -122,7 +123,7 @@ class PromoteService {
'order_time' => strtotime($orderTime),
'balance_coin_mode' => $balanceCoinMode,
'create_time' => time(),
'create_promote_id' => session('promote_auth.pid'),
'create_promote_id' => $create_promote_id,
'status' => 0,
'type' => $type,
'shift_ids' => json_encode($shiftIds)
@ -134,7 +135,8 @@ class PromoteService {
if ($isFuture) {
return [
'status' => true,
'msg'=>'迁移任务创建成功'
'msg'=>'迁移任务创建成功',
'id'=>$id
];
} else {
if ($type == 1) {
@ -344,7 +346,7 @@ class PromoteService {
M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1]);
return ['status' => true, 'msg' => '玩家迁移成功'];
return ['status' => true, 'msg' => '玩家迁移成功','id'=>$task['id']];
}
public function cancelShift($params)

Loading…
Cancel
Save