|
|
@@ -742,21 +742,21 @@ class UserController
|
|
|
public function transfer_account(Request $request)
|
|
|
{
|
|
|
$param = UtilService::postMore([
|
|
|
- ['phone', ''],
|
|
|
+ ['uid', ''],
|
|
|
['price', '']
|
|
|
]);
|
|
|
Db::startTrans();
|
|
|
$user = User::where('uid', $request->uid())->lock(true)->find();
|
|
|
- $tr_user = User::where('phone', $param['phone'])->find();
|
|
|
+ $tr_user = User::where('uid', $param['uid'])->find();
|
|
|
|
|
|
if (!$tr_user) return app('json')->fail('转账用户不存在');
|
|
|
- if ($user['phone'] == $param['phone']) return app('json')->fail('不能转给自己');
|
|
|
+ if ($user['uid'] == $param['uid']) return app('json')->fail('不能转给自己');
|
|
|
if ($user['brokerage_price'] < $param['price']) return app('json')->fail('佣金余额不足');
|
|
|
try {
|
|
|
- UserBill::expend('佣金', $request->uid(), 'now_money', 'extract', $param['price'], 0, $user['brokerage_price']-$param['price'], '佣金转账用户'.$tr_user['phone']);
|
|
|
- UserBill::income('佣金', $tr_user['uid'], 'now_money', 'brokerage', $param['price'], 0 , $tr_user['brokerage_price']+$param['price'], '接收用户'.$user['phone'].'转账佣金');
|
|
|
+ UserBill::expend('佣金', $request->uid(), 'now_money', 'extract', $param['price'], 0, $user['brokerage_price']-$param['price'], '佣金转账用户'.$tr_user['uid']);
|
|
|
+ UserBill::income('佣金', $tr_user['uid'], 'now_money', 'brokerage', $param['price'], 0 , $tr_user['brokerage_price']+$param['price'], '接收用户'.$user['uid'].'转账佣金');
|
|
|
User::where('uid', $request->uid())->dec('brokerage_price', $param['price'])->update();
|
|
|
- User::where('phone', $param['phone'])->inc('brokerage_price', $param['price'])->update();
|
|
|
+ User::where('uid', $param['uid'])->inc('brokerage_price', $param['price'])->update();
|
|
|
Db::commit();
|
|
|
return app('json')->success('转账成功');
|
|
|
} catch (\Exception $e) {
|