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