first(); if ($param['mold'] == 1) { throw new \Exception('提现功能暂未开放!'); if (empty($system->is_money)) { throw new \Exception('提现功能暂未开放!'); } if ($system->min_money > $param['money']) { throw new \Exception('最小提现金额:' . $system->min_money . '元'); } } elseif ($param['mold'] == 2) { if (empty($system->is_money_one)) { throw new \Exception('兑换功能暂未开放!'); } if ($system->min_money_one > $param['money']) { throw new \Exception('最小兑换金额:' . $system->min_money_one . '元'); } } elseif ($param['mold'] == 3) { } elseif ($param['mold'] == 5) { } elseif ($param['mold'] == 6) { // if (empty($system->is_money_one)) { // throw new \Exception('兑换功能暂未开放!'); // } if (10 > $param['money']) { throw new \Exception('最小提现金额:10USD'); } } elseif ($param['mold'] == 10) { } elseif ($param['mold'] == 7) { if (empty($system->is_money_seven)) { throw new \Exception('提现功能暂未开放!'); } if ($system->min_money_seven > $param['money']) { throw new \Exception('最小提现金额:' . $system->min_money_seven . '元'); } } elseif ($param['mold'] == 8) { if (empty($system->is_money_eight)) { throw new \Exception('提现功能暂未开放!'); } if ($system->min_money_eight > $param['money']) { throw new \Exception('最小提现金额:' . $system->min_money_eight . '元'); } } elseif ($param['mold'] == 9) { if (empty($system->is_money_nine)) { throw new \Exception('提现功能暂未开放!'); } if ($system->min_money_nine > $param['money']) { throw new \Exception('最小提现金额:' . $system->min_money_nine . '元'); } } elseif ($param['mold'] == 11) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 12) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 55) { } elseif ($param['mold'] == 15) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 16) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 17) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 19) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 20) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } elseif ($param['mold'] == 21) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } }elseif ($param['mold'] == 22) { if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } }elseif ($param['mold'] == 23) { if($param['user_data']['new_is_num']<3){ throw new \Exception('邀请三人即可提现'); } if (10 > $param['money']) { throw new \Exception('最小提现金额:10元'); } } else { throw new \Exception('提现功能暂未开放!'); } $remarks = ''; if ($param['mold'] == 2) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; } elseif ($param['mold'] == 5) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; } elseif ($param['mold'] == 6) { $status = 1; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; } elseif ($param['mold'] == 10) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; $remarks = '全球通金卡提现申请通过,已打款'; }elseif ($param['mold'] == 17) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; } elseif ($param['mold'] == 1) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; $userdata = Db::table('wa_users')->where('id', $param['user_data']['id'])->first(); if ($userdata->money_fourteen < $param['money']) { throw new \Exception('今日提现额度不足!'); } if ($userdata->money_four < $param['money']) { throw new \Exception('银行卡基础额度不足!'); } } elseif ($param['mold'] == 55) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; $userdata = Db::table('wa_users')->where('id', $param['user_data']['id'])->first(); $money_five_value = bcmul($param['money'], $system->coin_value, 2); if ($userdata->money_thirteen < $money_five_value) { throw new \Exception('今日提现额度不足!'); } if ($userdata->money_four < $money_five_value) { throw new \Exception('银行卡基础额度不足!'); } } elseif ($param['mold'] == 17) { $status = 3; $affiliated_bank = ''; $account_holder = ''; $card_number = ''; $remarks = '提现成功'; } else { /** @var $bankCard 银行卡 */ $bankCard = Db::table('wa_bank_card')->where('uid', $param['user_data']['id'])->first(); if (empty($bankCard)) { throw new \Exception('请绑定银行卡!'); } /** @var $userIdentity 实名信息 */ $userIdentity = Db::table('wa_user_identity')->where('uid', $param['user_data']['id'])->first(); if (empty($userIdentity)) { throw new \Exception('请实名后,在提现!'); } $hasWithdraw = Db::table('wa_withdraw') ->where('type', $param['mold']) ->where('user_id', $param['user_data']['id']) ->whereBetween('created_at', [date('Y-m-d') . ' 00:00:00', date('Y-m-d') . ' 23:59:59'])->exists(); if ($hasWithdraw) { throw new \Exception('今日已提现,请次日在来提现!'); } $status = 1; $affiliated_bank = $bankCard->affiliated_bank; $account_holder = $bankCard->account_holder; $card_number = $bankCard->card_number; } $withdrawId = Db::table('wa_withdraw')->insertGetId([ 'order_no' => date('YmdHis') . mt_rand(10000, 99999), 'user_id' => $param['user_data']['id'], 'money' => $param['money'], 'type' => $param['mold'], 'affiliated_bank' => $affiliated_bank, 'account_holder' => $account_holder, 'card_number' => $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' => $status, 'remarks' => $remarks ]); if ($param['mold'] == 2) { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType14, $param['mold'], moldTypefild($param['mold']), $withdrawId); StreamBusiness::addStream($param['user_data']['id'], $param['money'], streamType14, moldType3, moldTypefild3, $withdrawId); } elseif ($param['mold'] == 5) { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType24, $param['mold'], moldTypefild($param['mold']), $withdrawId); StreamBusiness::delStream($param['user_data']['id'], 100, streamType22, moldType5, moldTypefild5, $withdrawId); StreamBusiness::addStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType24, moldType10, moldTypefild10, $withdrawId); } elseif ($param['mold'] == 10) { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, $param['mold'], moldTypefild($param['mold']), $withdrawId); // Db::table('wa_system')->where('id',1)->increment('completion_progress',10); Db::table('wa_users')->where('id', $param['user_data']['id'])->increment('bank_money', $param['money']); StreamBusiness::addStream($param['user_data']['id'],$param['money'], streamType4, moldType3, moldTypefild3,$withdrawId); } elseif ($param['mold'] == 17) { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, $param['mold'], moldTypefild($param['mold']), $withdrawId); StreamBusiness::addStream($param['user_data']['id'], $param['money'], streamType4, moldType3, moldTypefild3, $withdrawId); } elseif ($param['mold'] == 1) { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, $param['mold'], moldTypefild($param['mold']), $withdrawId); StreamBusiness::addStream($param['user_data']['id'], $param['money'], streamType4, moldType10, moldTypefild10, $withdrawId); StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType4, moldTypefild4, $withdrawId); StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType14, moldTypefild14, $withdrawId); } elseif ($param['mold'] == 55) { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType5, moldTypefild5, $withdrawId); StreamBusiness::addStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType4, moldType10, moldTypefild10, $withdrawId); StreamBusiness::delStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType4, moldType4, moldTypefild4, $withdrawId); StreamBusiness::delStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType4, moldType13, moldTypefild13, $withdrawId); } else { StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, $param['mold'], moldTypefild($param['mold']), $withdrawId); } } catch (\Throwable $exception) { throw new \Exception($exception->getMessage()); } return true; } /** 提现流水 * @param array $param * @return void */ static public function stream(array $param) { try { $data = Db::table('wa_withdraw') ->where(function ($query) use ($param) { if (!empty(Arr::get($param, 'mold'))) { if($param['mold']==111){ $query->whereIn('type', [10, 16, 17, 18]); }else{ $query->where('type', $param['mold']); } } })->where('money','>',0) ->where('user_id', $param['user_data']['id']) ->orderByDesc('id') ->paginate(Arr::get($param, 'limit', 10), ['*'], 'page', Arr::get($param, 'page')) ->toArray(); foreach ($data['data'] as $k => $v) { $is_buy_tuikuianll = Db::table('wa_payorder') ->where('user_id', $param['user_data']['id']) ->where('is_pay', 2) ->where('goods_type', 15) ->exists(); $jieshutime = strtotime(date('Y-m-23',time())); if(!$is_buy_tuikuianll && $jieshutimenew_state = 3; } $data['data'][$k]->mold_name = moldType($v->type); } } catch (\Throwable $exception) { throw new \Exception($exception->getMessage()); } return $data; } /** 转账至五行银行卡 * @param array $param * @return void */ static public function transfer_accounts(array $param) { try { $system = Db::table('wa_system')->first(); if ($param['mold'] != 2) { throw new \Exception('转账至五行银行卡暂未开放!'); } $param['mold'] = 5; /** @var $bankCard 银行卡 */ $bankCard = Db::table('wa_user_social_cark')->where('user_id', $param['user_data']['id'])->first(); if (empty($bankCard)) { throw new \Exception('请先领取五行银行卡!'); } /** @var $userIdentity 实名信息 */ $userIdentity = Db::table('wa_user_identity')->where('uid', $param['user_data']['id'])->first(); if (empty($userIdentity)) { throw new \Exception('请实名后,在转入!'); } if (empty($system->conversion_value_cost)) { throw new \Exception('暂时不能转入!'); } //五行银行卡余额变更 $money = bcmul($param['money'], $system->conversion_value_cost, 2); Db::table('wa_user_social_cark')->where('user_id', $param['user_data']['id'])->increment('money', $money); //转账到五行银行卡余额 StreamBusiness::addStream($param['user_data']['id'], $money, streamType14, moldType4, moldTypefild4); //减少股票账户 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType14, $param['mold'], moldTypefild($param['mold']), $param['user_data']['id']); } catch (\Throwable $exception) { throw new \Exception($exception->getMessage()); } return true; } }