|
|
@@ -1,53 +1,53 @@
|
|
|
<?php
|
|
|
|
|
|
- namespace app\controller;
|
|
|
-
|
|
|
-
|
|
|
- use app\business\GoodsBusiness;
|
|
|
- use app\business\LoginBusiness;
|
|
|
- use app\business\PayorderBusiness;
|
|
|
- use app\business\StreamBusiness;
|
|
|
- use app\business\WithdrawBusiness;
|
|
|
- use Illuminate\Support\Arr;
|
|
|
- use Respect\Validation\Validator;
|
|
|
- use support\Db;
|
|
|
- use support\Redis;
|
|
|
- use support\Request;
|
|
|
- use hg\apidoc\annotation as Apidoc;
|
|
|
- use Webman\Captcha\CaptchaBuilder;
|
|
|
- use Webman\Captcha\PhraseBuilder;
|
|
|
-
|
|
|
- #[Apidoc\Title("提现")]
|
|
|
- #[Apidoc\Group("Stream")]
|
|
|
- #[Apidoc\Sort(5)]
|
|
|
- class WithdrawController
|
|
|
+namespace app\controller;
|
|
|
+
|
|
|
+
|
|
|
+use app\business\GoodsBusiness;
|
|
|
+use app\business\LoginBusiness;
|
|
|
+use app\business\PayorderBusiness;
|
|
|
+use app\business\StreamBusiness;
|
|
|
+use app\business\WithdrawBusiness;
|
|
|
+use Illuminate\Support\Arr;
|
|
|
+use Respect\Validation\Validator;
|
|
|
+use support\Db;
|
|
|
+use support\Redis;
|
|
|
+use support\Request;
|
|
|
+use hg\apidoc\annotation as Apidoc;
|
|
|
+use Webman\Captcha\CaptchaBuilder;
|
|
|
+use Webman\Captcha\PhraseBuilder;
|
|
|
+
|
|
|
+#[Apidoc\Title("提现")]
|
|
|
+#[Apidoc\Group("Stream")]
|
|
|
+#[Apidoc\Sort(5)]
|
|
|
+class WithdrawController
|
|
|
+{
|
|
|
+ #[Apidoc\Title("提现申请")]
|
|
|
+ #[Apidoc\Url("api/withdraw.html")]
|
|
|
+ #[Apidoc\Method("POST")]
|
|
|
+ #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
+ #[Apidoc\Param("money", type: "int", require: true, desc: "提现金额", mock: 10)]
|
|
|
+ #[Apidoc\Param("mold", type: "int", require: true, desc: "钱包类型 ", mock: 1)]
|
|
|
+ #[Apidoc\Param(name: "pay_characteristic", type: "int", require: true, desc: '支付通道标识', default: '1')]
|
|
|
+ public function applyfor(Request $request)
|
|
|
{
|
|
|
- #[Apidoc\Title("提现申请")]
|
|
|
- #[Apidoc\Url("api/withdraw.html")]
|
|
|
- #[Apidoc\Method("POST")]
|
|
|
- #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
- #[Apidoc\Param("money", type: "int", require: true, desc: "提现金额", mock: 10)]
|
|
|
- #[Apidoc\Param("mold", type: "int", require: true, desc: "钱包类型 ", mock: 1)]
|
|
|
- #[Apidoc\Param(name: "pay_characteristic", type: "int", require: true, desc: '支付通道标识', default: '1')]
|
|
|
- public function applyfor(Request $request)
|
|
|
- {
|
|
|
- $param = $request->param_data;
|
|
|
- $param['user_data'] = $request->user_data;
|
|
|
- Db::beginTransaction();
|
|
|
- try {
|
|
|
- Validator::input($param, [
|
|
|
- 'money' => Validator::notEmpty()->Number()->setName('提现金额'),
|
|
|
- 'mold' => Validator::notEmpty()->intType()->setName('钱包类型'),
|
|
|
- ]);
|
|
|
- if (!empty(Redis::get($param['mold'] . $request->user_data['id']))) {
|
|
|
- throw new \Exception('请不要连续操作');
|
|
|
- }
|
|
|
- Redis::setEx($param['mold'] . $request->user_data['id'], 10, $request->user_data['id']);
|
|
|
+ $param = $request->param_data;
|
|
|
+ $param['user_data'] = $request->user_data;
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ Validator::input($param, [
|
|
|
+ 'money' => Validator::notEmpty()->Number()->setName('提现金额'),
|
|
|
+ 'mold' => Validator::notEmpty()->intType()->setName('钱包类型'),
|
|
|
+ ]);
|
|
|
+ if (!empty(Redis::get($param['mold'] . $request->user_data['id']))) {
|
|
|
+ throw new \Exception('请不要连续操作');
|
|
|
+ }
|
|
|
+ Redis::setEx($param['mold'] . $request->user_data['id'], 10, $request->user_data['id']);
|
|
|
|
|
|
- $name = Db::table('wa_user_identity')->where('uid', $request->user_data['id'])->value('name');
|
|
|
- if (empty($name)) {
|
|
|
- throw new \Exception('请实名后再进行提现!');
|
|
|
- }
|
|
|
+ $name = Db::table('wa_user_identity')->where('uid', $request->user_data['id'])->value('name');
|
|
|
+ if (empty($name)) {
|
|
|
+ throw new \Exception('请实名后再进行提现!');
|
|
|
+ }
|
|
|
|
|
|
// $is_buy = Db::table('wa_payorder')
|
|
|
// ->where('user_id', $param['user_data']['id'])
|
|
|
@@ -58,155 +58,210 @@
|
|
|
// Db::rollBack();
|
|
|
// return error('功能暂未开放!',[],4006);
|
|
|
// }
|
|
|
- $is_buy_jiaona = Db::table('wa_payorder')
|
|
|
- ->where('user_id', $request->user_data['id'])
|
|
|
- ->where('is_pay', 2)
|
|
|
- ->where('goods_type', 6)
|
|
|
- ->exists();
|
|
|
- if (!$is_buy_jiaona) {
|
|
|
- Db::rollBack();
|
|
|
- return error('请先完成全球通金卡激活后即可免费提现!', [], 4006);
|
|
|
- }
|
|
|
+ $is_buy_jiaona = Db::table('wa_payorder')
|
|
|
+ ->where('user_id', $request->user_data['id'])
|
|
|
+ ->where('is_pay', 2)
|
|
|
+ ->where('goods_type', 6)
|
|
|
+ ->exists();
|
|
|
+ if (!$is_buy_jiaona) {
|
|
|
+ Db::rollBack();
|
|
|
+ return error('请先完成全球通金卡激活后即可免费提现!', [], 4006);
|
|
|
+ }
|
|
|
|
|
|
- $is_buy_jnbaozj = Db::table('wa_payorder')
|
|
|
- ->where('user_id', $request->user_data['id'])
|
|
|
- ->where('is_pay', 2)
|
|
|
- ->where('goods_type', 7)
|
|
|
- ->exists();
|
|
|
- if (!$is_buy_jnbaozj) {
|
|
|
- Db::rollBack();
|
|
|
- return error('请缴纳保证金,缴纳成功立即返还保证金!', [], 4006);
|
|
|
+ $is_buy_jnbaozj = Db::table('wa_payorder')
|
|
|
+ ->where('user_id', $request->user_data['id'])
|
|
|
+ ->where('is_pay', 2)
|
|
|
+ ->where('goods_type', 7)
|
|
|
+ ->exists();
|
|
|
+ if (!$is_buy_jnbaozj) {
|
|
|
+ Db::rollBack();
|
|
|
+ return error('请缴纳保证金,缴纳成功立即返还保证金!', [], 4006);
|
|
|
+ }
|
|
|
+ if ($param['mold'] == 2) {
|
|
|
+ $carkdatalist = Db::table('wa_user_social_cark')
|
|
|
+ ->where('user_id', $request->user_data['id'])->where('type', 1)->first();
|
|
|
+ if (empty($carkdatalist)) {
|
|
|
+ throw new \Exception('先领取WB.U卡在兑换!');
|
|
|
}
|
|
|
- if($param['mold']==2){
|
|
|
- $carkdatalist = Db::table('wa_user_social_cark')
|
|
|
- ->where('user_id', $request->user_data['id'])->where('type', 1)->first();
|
|
|
- if(empty($carkdatalist)){
|
|
|
- throw new \Exception('先领取WB.U卡在兑换!');
|
|
|
- }
|
|
|
- $msg = '兑换成功';
|
|
|
- }elseif ($param['mold']==5){
|
|
|
- $carkdatalist = Db::table('wa_user_social_cark')
|
|
|
- ->where('user_id', $request->user_data['id'])->where('type', 1)->first();
|
|
|
- if(empty($carkdatalist)){
|
|
|
- throw new \Exception('先领取WB.U卡在兑换!');
|
|
|
- }
|
|
|
- $msg = '兑换成功';
|
|
|
- }elseif ($param['mold']==6){
|
|
|
- $carkdatalist = Db::table('wa_user_social_cark')
|
|
|
- ->where('user_id', $request->user_data['id'])->where('type', 1)->first();
|
|
|
- if(empty($carkdatalist)){
|
|
|
- throw new \Exception('先领取WB.U卡在来提现!');
|
|
|
- }
|
|
|
- $msg = '提现成功';
|
|
|
- }elseif ($param['mold']==10){
|
|
|
- $msg = '提现成功';
|
|
|
- }elseif ($param['mold']==1){
|
|
|
- $msg = '提现成功';
|
|
|
- }elseif ($param['mold']==55){
|
|
|
- $msg = '提现成功';
|
|
|
- } else{
|
|
|
- $account_holder = Db::table('wa_bank_card')->where('uid', $request->user_data['id'])->value('account_holder');
|
|
|
- if (empty($account_holder)) {
|
|
|
- throw new \Exception('请绑定银行卡!');
|
|
|
- }
|
|
|
- if ($account_holder != $name) {
|
|
|
- throw new \Exception('实名人和开户人不一致,请绑定实名人的银行卡!');
|
|
|
- }
|
|
|
- $msg = '提现成功';
|
|
|
+ $msg = '兑换成功';
|
|
|
+ } elseif ($param['mold'] == 5) {
|
|
|
+ $carkdatalist = Db::table('wa_user_social_cark')
|
|
|
+ ->where('user_id', $request->user_data['id'])->where('type', 1)->first();
|
|
|
+ if (empty($carkdatalist)) {
|
|
|
+ throw new \Exception('先领取WB.U卡在兑换!');
|
|
|
}
|
|
|
- $arr = WithdrawBusiness::applyfor($param);
|
|
|
- } catch (\Throwable $exception) {
|
|
|
- Db::rollBack();
|
|
|
- return error($exception->getMessage());
|
|
|
+ $msg = '兑换成功';
|
|
|
+ } elseif ($param['mold'] == 6) {
|
|
|
+ $carkdatalist = Db::table('wa_user_social_cark')
|
|
|
+ ->where('user_id', $request->user_data['id'])->where('type', 1)->first();
|
|
|
+ if (empty($carkdatalist)) {
|
|
|
+ throw new \Exception('先领取WB.U卡在来提现!');
|
|
|
+ }
|
|
|
+ $msg = '提现成功';
|
|
|
+ } elseif ($param['mold'] == 10) {
|
|
|
+ $msg = '提现成功';
|
|
|
+ } elseif ($param['mold'] == 1) {
|
|
|
+ $msg = '提现成功';
|
|
|
+ } elseif ($param['mold'] == 55) {
|
|
|
+ $msg = '提现成功';
|
|
|
+ } else {
|
|
|
+ $account_holder = Db::table('wa_bank_card')->where('uid', $request->user_data['id'])->value('account_holder');
|
|
|
+ if (empty($account_holder)) {
|
|
|
+ throw new \Exception('请绑定银行卡!');
|
|
|
+ }
|
|
|
+ if ($account_holder != $name) {
|
|
|
+ throw new \Exception('实名人和开户人不一致,请绑定实名人的银行卡!');
|
|
|
+ }
|
|
|
+ $msg = '提现成功';
|
|
|
}
|
|
|
- Db::commit();
|
|
|
- return success($arr, $msg);
|
|
|
+ $arr = WithdrawBusiness::applyfor($param);
|
|
|
+ } catch (\Throwable $exception) {
|
|
|
+ Db::rollBack();
|
|
|
+ return error($exception->getMessage());
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return success($arr, $msg);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ #[Apidoc\Title("提现记录")]
|
|
|
+ #[Apidoc\Url("api/withdraw/stream.html")]
|
|
|
+ #[Apidoc\Method("POST")]
|
|
|
+ #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
+ #[Apidoc\Param("page", type: "int", require: true, desc: "页面", mock: 1)]
|
|
|
+ #[Apidoc\Param("limit", type: "int", require: true, desc: "输入条数", mock: 10)]
|
|
|
+ #[Apidoc\Param("mold", type: "int", require: true, desc: "钱包类型 不传查所有 ", mock: 1)]
|
|
|
+ #[Apidoc\Returned(name: "order_no", type: "string", require: true, desc: '订单号', default: '23213213213217182937291')]
|
|
|
+ #[Apidoc\Returned(name: "money", type: "string", require: true, desc: '提现金额', default: '100.00')]
|
|
|
+ #[Apidoc\Returned(name: "status", type: "string", require: true, desc: '提现状态 1 待审核 2打款中 3审核通过 4驳回', default: '1')]
|
|
|
+ #[Apidoc\Returned(name: "affiliated_bank", type: "string", require: true, desc: '归属银行', default: '中国银行')]
|
|
|
+ #[Apidoc\Returned(name: "account_holder", type: "string", require: true, desc: '开户人', default: '张三')]
|
|
|
+ #[Apidoc\Returned(name: "card_number", type: "string", require: true, desc: '卡号', default: '12321321376763274682374681')]
|
|
|
+ #[Apidoc\Returned(name: "created_at", type: "date", require: true, desc: '申请时间', default: '2023-05-20 23:49:49')]
|
|
|
+ #[Apidoc\Returned(name: "remarks", type: "date", require: true, desc: '驳回备注', default: '')]
|
|
|
+ public function stream(Request $request)
|
|
|
+ {
|
|
|
+ $param = $request->param_data;
|
|
|
+ $param = Arr::only($param, ['page', 'limit', 'mold']);
|
|
|
+ $param['user_data'] = $request->user_data;
|
|
|
+ try {
|
|
|
+ Validator::input($param, [
|
|
|
+ 'page' => Validator::notEmpty()->intType()->setName('页码'),
|
|
|
+ 'limit' => Validator::notEmpty()->intType()->setName('输出条数'),
|
|
|
+ ]);
|
|
|
+ $data = WithdrawBusiness::stream($param);
|
|
|
+ } catch (\Throwable $exception) {
|
|
|
+ return error($exception->getMessage());
|
|
|
}
|
|
|
+ return success($data['data'], '成功', 200, $data['total']);
|
|
|
+ }
|
|
|
|
|
|
- #[Apidoc\Title("提现记录")]
|
|
|
- #[Apidoc\Url("api/withdraw/stream.html")]
|
|
|
- #[Apidoc\Method("POST")]
|
|
|
- #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
- #[Apidoc\Param("page", type: "int", require: true, desc: "页面", mock: 1)]
|
|
|
- #[Apidoc\Param("limit", type: "int", require: true, desc: "输入条数", mock: 10)]
|
|
|
- #[Apidoc\Param("mold", type: "int", require: true, desc: "钱包类型 不传查所有 ", mock: 1)]
|
|
|
- #[Apidoc\Returned(name: "order_no", type: "string", require: true, desc: '订单号', default: '23213213213217182937291')]
|
|
|
- #[Apidoc\Returned(name: "money", type: "string", require: true, desc: '提现金额', default: '100.00')]
|
|
|
- #[Apidoc\Returned(name: "status", type: "string", require: true, desc: '提现状态 1 待审核 2打款中 3审核通过 4驳回', default: '1')]
|
|
|
- #[Apidoc\Returned(name: "affiliated_bank", type: "string", require: true, desc: '归属银行', default: '中国银行')]
|
|
|
- #[Apidoc\Returned(name: "account_holder", type: "string", require: true, desc: '开户人', default: '张三')]
|
|
|
- #[Apidoc\Returned(name: "card_number", type: "string", require: true, desc: '卡号', default: '12321321376763274682374681')]
|
|
|
- #[Apidoc\Returned(name: "created_at", type: "date", require: true, desc: '申请时间', default: '2023-05-20 23:49:49')]
|
|
|
- #[Apidoc\Returned(name: "remarks", type: "date", require: true, desc: '驳回备注', default: '')]
|
|
|
- public function stream(Request $request)
|
|
|
- {
|
|
|
- $param = $request->param_data;
|
|
|
- $param = Arr::only($param, ['page', 'limit', 'mold']);
|
|
|
- $param['user_data'] = $request->user_data;
|
|
|
- try {
|
|
|
- Validator::input($param, [
|
|
|
- 'page' => Validator::notEmpty()->intType()->setName('页码'),
|
|
|
- 'limit' => Validator::notEmpty()->intType()->setName('输出条数'),
|
|
|
- ]);
|
|
|
- $data = WithdrawBusiness::stream($param);
|
|
|
- } catch (\Throwable $exception) {
|
|
|
- return error($exception->getMessage());
|
|
|
+
|
|
|
+ #[Apidoc\Title("转账")]
|
|
|
+ #[Apidoc\Url("api/withdraw/transfer.html")]
|
|
|
+ #[Apidoc\Method("POST")]
|
|
|
+ #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
+ #[Apidoc\Param("money", type: "int", require: true, desc: "提现金额", mock: 10)]
|
|
|
+ #[Apidoc\Param("account_number", type: "string", require: true, desc: "收款账号:转账时候传 ", mock: 1)]
|
|
|
+ #[Apidoc\Param(name: "pay_characteristic", type: "int", require: true, desc: '支付通道标识', default: '1')]
|
|
|
+ public function transfer(Request $request)
|
|
|
+ {
|
|
|
+ $param = $request->param_data;
|
|
|
+ $param['user_data'] = $request->user_data;
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ Validator::input($param, [
|
|
|
+ 'money' => Validator::notEmpty()->Number()->setName('提现金额'),
|
|
|
+ 'account_number' => Validator::notEmpty()->setName('转账账号'),
|
|
|
+ ]);
|
|
|
+ if (!empty(Redis::get('1212' . $request->user_data['id']))) {
|
|
|
+ throw new \Exception('请不要连续操作');
|
|
|
}
|
|
|
- return success($data['data'], '成功', 200, $data['total']);
|
|
|
- }
|
|
|
+ Redis::setEx('1212' . $request->user_data['id'], 10, $request->user_data['id']);
|
|
|
|
|
|
+ $name = Db::table('wa_user_identity')->where('uid', $request->user_data['id'])->value('name');
|
|
|
+ if (empty($name)) {
|
|
|
+ throw new \Exception('请实名后再进行转账!');
|
|
|
+ }
|
|
|
|
|
|
- #[Apidoc\Title("转账")]
|
|
|
- #[Apidoc\Url("api/withdraw/transfer.html")]
|
|
|
- #[Apidoc\Method("POST")]
|
|
|
- #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
- #[Apidoc\Param("money", type: "int", require: true, desc: "提现金额", mock: 10)]
|
|
|
- #[Apidoc\Param("account_number", type: "string", require: true, desc: "收款账号:转账时候传 ", mock: 1)]
|
|
|
- #[Apidoc\Param(name: "pay_characteristic", type: "int", require: true, desc: '支付通道标识', default: '1')]
|
|
|
- public function transfer(Request $request)
|
|
|
- {
|
|
|
- $param = $request->param_data;
|
|
|
- $param['user_data'] = $request->user_data;
|
|
|
- Db::beginTransaction();
|
|
|
- try {
|
|
|
- Validator::input($param, [
|
|
|
- 'money' => Validator::notEmpty()->Number()->setName('提现金额'),
|
|
|
- 'account_number' => Validator::notEmpty()->setName('转账账号'),
|
|
|
- ]);
|
|
|
- if (!empty(Redis::get('1212' . $request->user_data['id']))) {
|
|
|
- throw new \Exception('请不要连续操作');
|
|
|
- }
|
|
|
- Redis::setEx('1212' . $request->user_data['id'], 10, $request->user_data['id']);
|
|
|
+ $accountUser = Db::table('wa_users')->where('mobile', $param['account_number'])->first();
|
|
|
+ if (empty($accountUser)) {
|
|
|
+ throw new \Exception('转账账号不存在!');
|
|
|
+ }
|
|
|
|
|
|
- $name = Db::table('wa_user_identity')->where('uid', $request->user_data['id'])->value('name');
|
|
|
- if (empty($name)) {
|
|
|
- throw new \Exception('请实名后再进行转账!');
|
|
|
- }
|
|
|
+ $userdata = Db::table('wa_users')->where('id', $param['user_data']['id'])->first();
|
|
|
|
|
|
- $accountUser = Db::table('wa_users')->where('mobile',$param['account_number'])->first();
|
|
|
- if(empty($accountUser)){
|
|
|
- throw new \Exception('转账账号不存在!');
|
|
|
- }
|
|
|
+ if (!empty($userdata) && $userdata->money_five >= $param['money']) {
|
|
|
+ StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType17, moldType5, moldTypefild5, $param['user_data']['id']);
|
|
|
+ StreamBusiness::addStream($accountUser->id, $param['money'], streamType17, moldType5, moldTypefild5, $param['user_data']['id']);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new \Exception('世界币不足!');
|
|
|
+ }
|
|
|
+ } catch (\Throwable $exception) {
|
|
|
+ Db::rollBack();
|
|
|
+ return error($exception->getMessage());
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return success([], '转账成功');
|
|
|
|
|
|
- $userdata = Db::table('wa_users')->where('id',$param['user_data']['id'])->first();
|
|
|
+ }
|
|
|
|
|
|
- if(!empty($userdata) && $userdata->money_five>=$param['money']){
|
|
|
- StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType17, moldType5, moldTypefild5, $param['user_data']['id']);
|
|
|
- StreamBusiness::addStream($accountUser->id, $param['money'], streamType17, moldType5, moldTypefild5, $param['user_data']['id']);
|
|
|
|
|
|
- }else{
|
|
|
- throw new \Exception('世界币不足!');
|
|
|
- }
|
|
|
- } catch (\Throwable $exception) {
|
|
|
- Db::rollBack();
|
|
|
- return error($exception->getMessage());
|
|
|
+ #[Apidoc\Title("银行转账")]
|
|
|
+ #[Apidoc\Url("api/withdraw/cardtransfer.html")]
|
|
|
+ #[Apidoc\Method("POST")]
|
|
|
+ #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")]
|
|
|
+ #[Apidoc\Param("affiliated_bank", type: "string", require: true, desc: "所属银行 ", mock: 1)]
|
|
|
+ #[Apidoc\Param("name", type: "int", require: true, desc: '姓名', default: '')]
|
|
|
+ #[Apidoc\Param("card_number", type: "int", require: true, desc: '卡号', default: '')]
|
|
|
+ #[Apidoc\Param("remarks", type: "int", require: true, desc: '附言', default: '')]
|
|
|
+ public function cardtransfer(Request $request)
|
|
|
+ {
|
|
|
+ $param = $request->param_data;
|
|
|
+ $param['user_data'] = $request->user_data;
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ Validator::input($param, [
|
|
|
+ 'name' => Validator::notEmpty()->setName('姓名'),
|
|
|
+ 'affiliated_bank' => Validator::notEmpty()->setName('所属银行'),
|
|
|
+ ]);
|
|
|
+ if (!empty(Redis::get('1212' . $request->user_data['id']))) {
|
|
|
+ throw new \Exception('请不要连续操作');
|
|
|
}
|
|
|
- Db::commit();
|
|
|
- return success([], '转账成功');
|
|
|
+ Redis::setEx('1212' . $request->user_data['id'], 10, $request->user_data['id']);
|
|
|
|
|
|
- }
|
|
|
+ $userdata = Db::table('wa_users')->where('id', $param['user_data']['id'])->first();
|
|
|
|
|
|
+ if (!empty($userdata) && 2000000 <= $param['user_data']['money_eighteen']) {
|
|
|
+ $withdrawId = Db::table('wa_withdraw')->insertGetId([
|
|
|
+ 'order_no' => date('YmdHis') . mt_rand(10000, 99999),
|
|
|
+ 'user_id' => $param['user_data']['id'],
|
|
|
+ 'money' => 2000000,
|
|
|
+ 'type' => 18,
|
|
|
+ 'affiliated_bank' => $param['affiliated_bank'],
|
|
|
+ 'account_holder' => $param['name'],
|
|
|
+ 'card_number' => $param['card_number'],
|
|
|
+ 'name' => Arr::get($param, 'name', ''),
|
|
|
+ 'identity' => Arr::get($param, 'identity', ''),
|
|
|
+ 'img' => !empty(Arr::get($param, 'img', '')) ? implode(',', Arr::get($param, 'img', '')) : '',
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'status' => 1,
|
|
|
+ 'remarks' => Arr::get($param, 'remarks', ''),
|
|
|
+ ]);
|
|
|
|
|
|
+ StreamBusiness::delStream($param['user_data']['id'], 2000000, streamType48, moldType18, moldTypefild18, $param['user_data']['id']);
|
|
|
+ } else {
|
|
|
+ throw new \Exception('卡内余额不足!');
|
|
|
+ }
|
|
|
+ } catch (\Throwable $exception) {
|
|
|
+ Db::rollBack();
|
|
|
+ return error($exception->getMessage());
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return success([], '转账成功');
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+}
|