|
|
@ -422,9 +422,9 @@ class PromoteService {
|
|
|
|
'status' => false,
|
|
|
|
'status' => false,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sn = date('YmdHis').strtoupper(md5(json_encode($params) . 'PromoteCoinRecord' . 'FROM' . rand(0, 99999)));
|
|
|
|
|
|
|
|
|
|
|
|
$promoteCoinRecordService = new PromoteCoinRecordService();
|
|
|
|
$fromRecord = [
|
|
|
|
$fromRecord = [
|
|
|
|
'sn' => $sn,
|
|
|
|
|
|
|
|
'type' => 2,
|
|
|
|
'type' => 2,
|
|
|
|
'sub_type' => 4,
|
|
|
|
'sub_type' => 4,
|
|
|
|
'ref_id' => $formRefId,
|
|
|
|
'ref_id' => $formRefId,
|
|
|
@ -432,21 +432,12 @@ class PromoteService {
|
|
|
|
'target_type' => 1,
|
|
|
|
'target_type' => 1,
|
|
|
|
'coin' => $num,
|
|
|
|
'coin' => $num,
|
|
|
|
'balance_coin' => $fromBalanceCoin - $num,
|
|
|
|
'balance_coin' => $fromBalanceCoin - $num,
|
|
|
|
'create_time' => time(),
|
|
|
|
|
|
|
|
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
|
|
|
|
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
|
|
|
|
'remark' => $remark,
|
|
|
|
'remark' => $remark,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$status = M('PromoteCoinRecord', 'tab_')->add($fromRecord);
|
|
|
|
$promoteCoinRecordService->addRecord($fromRecord);
|
|
|
|
if (!$status) {
|
|
|
|
|
|
|
|
$model->rollback();
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
'msg' => '系统异常',
|
|
|
|
|
|
|
|
'status' => false,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$sn = date('YmdHis').strtoupper(md5(json_encode($params) . 'PromoteCoinRecord' . 'TO' . rand(0, 99999)));
|
|
|
|
|
|
|
|
$toRecord = [
|
|
|
|
$toRecord = [
|
|
|
|
'sn' => $sn,
|
|
|
|
|
|
|
|
'type' => 1,
|
|
|
|
'type' => 1,
|
|
|
|
'sub_type' => 3,
|
|
|
|
'sub_type' => 3,
|
|
|
|
'ref_id' => $agentRefId,
|
|
|
|
'ref_id' => $agentRefId,
|
|
|
@ -454,18 +445,11 @@ class PromoteService {
|
|
|
|
'target_type' => 2,
|
|
|
|
'target_type' => 2,
|
|
|
|
'coin' => $num,
|
|
|
|
'coin' => $num,
|
|
|
|
'balance_coin' => $userPlay['bind_balance'] + $num,
|
|
|
|
'balance_coin' => $userPlay['bind_balance'] + $num,
|
|
|
|
'create_time' => time(),
|
|
|
|
|
|
|
|
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
|
|
|
|
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
|
|
|
|
'remark' => $remark,
|
|
|
|
'remark' => $remark,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$status = M('PromoteCoinRecord', 'tab_')->add($toRecord);
|
|
|
|
$promoteCoinRecordService->addRecord($toRecord);
|
|
|
|
if (!$status) {
|
|
|
|
|
|
|
|
$model->rollback();
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
'msg' => '系统异常',
|
|
|
|
|
|
|
|
'status' => false,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$incStatus = M('UserPlay', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num);
|
|
|
|
$incStatus = M('UserPlay', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num);
|
|
|
|
$decStatus = $this->decCoin($promoteId, $num, $isUseBind ? $gameId : 0);
|
|
|
|
$decStatus = $this->decCoin($promoteId, $num, $isUseBind ? $gameId : 0);
|
|
|
|
if (!$incStatus || !$decStatus) {
|
|
|
|
if (!$incStatus || !$decStatus) {
|
|
|
@ -542,9 +526,8 @@ class PromoteService {
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$sn = date('YmdHis').strtoupper(md5(json_encode($params) . 'PromoteCoinRecord' . 'FROM' . rand(0, 99999)));
|
|
|
|
$promoteCoinRecordService = new PromoteCoinRecordService();
|
|
|
|
$fromRecord = [
|
|
|
|
$fromRecord = [
|
|
|
|
'sn' => $sn,
|
|
|
|
|
|
|
|
'type' => 2,
|
|
|
|
'type' => 2,
|
|
|
|
'sub_type' => 4,
|
|
|
|
'sub_type' => 4,
|
|
|
|
'ref_id' => $formRefId,
|
|
|
|
'ref_id' => $formRefId,
|
|
|
@ -552,22 +535,12 @@ class PromoteService {
|
|
|
|
'target_type' => 1,
|
|
|
|
'target_type' => 1,
|
|
|
|
'coin' => $num,
|
|
|
|
'coin' => $num,
|
|
|
|
'balance_coin' => $fromBalanceCoin - $num,
|
|
|
|
'balance_coin' => $fromBalanceCoin - $num,
|
|
|
|
'create_time' => time(),
|
|
|
|
|
|
|
|
'description' => '平台币转账',
|
|
|
|
'description' => '平台币转账',
|
|
|
|
'remark' => $remark,
|
|
|
|
'remark' => $remark,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$status = M('PromoteCoinRecord', 'tab_')->add($fromRecord);
|
|
|
|
$promoteCoinRecordService->addRecord($fromRecord);
|
|
|
|
if (!$status) {
|
|
|
|
|
|
|
|
$model->rollback();
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
'msg' => '系统异常',
|
|
|
|
|
|
|
|
'status' => false,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sn = date('YmdHis').strtoupper(md5(json_encode($params) . 'PromoteCoinRecord' . 'TO' . rand(0, 99999)));
|
|
|
|
|
|
|
|
$toRecord = [
|
|
|
|
$toRecord = [
|
|
|
|
'sn' => $sn,
|
|
|
|
|
|
|
|
'type' => 1,
|
|
|
|
'type' => 1,
|
|
|
|
'sub_type' => 3,
|
|
|
|
'sub_type' => 3,
|
|
|
|
'ref_id' => $toRefId,
|
|
|
|
'ref_id' => $toRefId,
|
|
|
@ -575,18 +548,10 @@ class PromoteService {
|
|
|
|
'target_type' => 1,
|
|
|
|
'target_type' => 1,
|
|
|
|
'coin' => $num,
|
|
|
|
'coin' => $num,
|
|
|
|
'balance_coin' => $toBalanceCoin + $num,
|
|
|
|
'balance_coin' => $toBalanceCoin + $num,
|
|
|
|
'create_time' => time(),
|
|
|
|
|
|
|
|
'description' => '平台币转账',
|
|
|
|
'description' => '平台币转账',
|
|
|
|
'remark' => $remark,
|
|
|
|
'remark' => $remark,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$status = M('PromoteCoinRecord', 'tab_')->add($toRecord);
|
|
|
|
$promoteCoinRecordService->addRecord($toRecord);
|
|
|
|
if (!$status) {
|
|
|
|
|
|
|
|
$model->rollback();
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
'msg' => '系统异常',
|
|
|
|
|
|
|
|
'status' => false,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$incStatus = $this->incCoin($toPromoteId, $num, $gameId);
|
|
|
|
$incStatus = $this->incCoin($toPromoteId, $num, $gameId);
|
|
|
|
$decStatus = $this->decCoin($fromPromoteId, $num, $isUseBind ? $gameId : 0);
|
|
|
|
$decStatus = $this->decCoin($fromPromoteId, $num, $isUseBind ? $gameId : 0);
|
|
|
@ -687,9 +652,8 @@ class PromoteService {
|
|
|
|
$promoteCoinService = new PromoteCoinService();
|
|
|
|
$promoteCoinService = new PromoteCoinService();
|
|
|
|
$refId = $promoteCoinService->addRecord($log);
|
|
|
|
$refId = $promoteCoinService->addRecord($log);
|
|
|
|
|
|
|
|
|
|
|
|
$sn = date('YmdHis').strtoupper(md5($promoteId . $num . $adminId . 'PromoteCoinRecord' . rand(0, 99999)));
|
|
|
|
$promoteCoinRecordService = new PromoteCoinRecordService();
|
|
|
|
$record = [
|
|
|
|
$record = [
|
|
|
|
'sn' => $sn,
|
|
|
|
|
|
|
|
'type' => 2,
|
|
|
|
'type' => 2,
|
|
|
|
'sub_type' => 5,
|
|
|
|
'sub_type' => 5,
|
|
|
|
'ref_id' => $refId,
|
|
|
|
'ref_id' => $refId,
|
|
|
@ -697,14 +661,13 @@ class PromoteService {
|
|
|
|
'target_type' => 1,
|
|
|
|
'target_type' => 1,
|
|
|
|
'coin' => $num,
|
|
|
|
'coin' => $num,
|
|
|
|
'balance_coin' => $balanceCoin - $num,
|
|
|
|
'balance_coin' => $balanceCoin - $num,
|
|
|
|
'create_time' => time(),
|
|
|
|
|
|
|
|
'description' => '后台回收',
|
|
|
|
'description' => '后台回收',
|
|
|
|
'remark' => '',
|
|
|
|
'remark' => '',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$status2 = M('PromoteCoinRecord', 'tab_')->add($record);
|
|
|
|
$promoteCoinRecordService->addRecord($record);
|
|
|
|
|
|
|
|
|
|
|
|
$status1 = $this->decCoin($promoteId, $num, $gameId);
|
|
|
|
$status = $this->decCoin($promoteId, $num, $gameId);
|
|
|
|
if ($refId && $status1 && $status2) {
|
|
|
|
if ($refId && $status) {
|
|
|
|
$model->commit();
|
|
|
|
$model->commit();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -733,11 +696,10 @@ class PromoteService {
|
|
|
|
$promoteCoinService = new PromoteCoinService();
|
|
|
|
$promoteCoinService = new PromoteCoinService();
|
|
|
|
$refId = $promoteCoinService->addRecord($log);
|
|
|
|
$refId = $promoteCoinService->addRecord($log);
|
|
|
|
|
|
|
|
|
|
|
|
$status1 = $this->incCoin($promoteId, $num, $gameId);
|
|
|
|
$status = $this->incCoin($promoteId, $num, $gameId);
|
|
|
|
|
|
|
|
|
|
|
|
$sn = date('YmdHis').strtoupper(md5($promoteId . $num . $adminId . 'PromoteCoinRecord' . rand(0, 99999)));
|
|
|
|
$promoteCoinRecordService = new PromoteCoinRecordService();
|
|
|
|
$record = [
|
|
|
|
$record = [
|
|
|
|
'sn' => $sn,
|
|
|
|
|
|
|
|
'type' => 1,
|
|
|
|
'type' => 1,
|
|
|
|
'sub_type' => 2,
|
|
|
|
'sub_type' => 2,
|
|
|
|
'ref_id' => $refId,
|
|
|
|
'ref_id' => $refId,
|
|
|
@ -745,13 +707,12 @@ class PromoteService {
|
|
|
|
'target_type' => 1,
|
|
|
|
'target_type' => 1,
|
|
|
|
'coin' => $num,
|
|
|
|
'coin' => $num,
|
|
|
|
'balance_coin' => $balanceCoin + $num,
|
|
|
|
'balance_coin' => $balanceCoin + $num,
|
|
|
|
'create_time' => time(),
|
|
|
|
|
|
|
|
'description' => '后台发放',
|
|
|
|
'description' => '后台发放',
|
|
|
|
'remark' => '',
|
|
|
|
'remark' => '',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$status2 = M('PromoteCoinRecord', 'tab_')->add($record);
|
|
|
|
$promoteCoinRecordService->addRecord($record);
|
|
|
|
|
|
|
|
|
|
|
|
if ($refId && $status2 && $status1) {
|
|
|
|
if ($refId && $status) {
|
|
|
|
$model->commit();
|
|
|
|
$model->commit();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|