get('coin_id', '1'); if (empty($coin_id)) { return $this->apiResponseError('缺少必要参数'); } $withdraw_config = WithdrawConfig::where('id', 1)->select(['id','mix_money','proportion'])->first(); return $this->apiResponseSuccess( '获取数据成功',$withdraw_config); } /** * 用户提现申请 * @return \Illuminate\Http\JsonResponse */ function setWithdraw() { //redis访问频率限制 $m_id=request()->member['id']; $redis_on_name = 'add_withdraw' . $m_id; $redis_time = RedisDataServer::creatServer()->getData($redis_on_name); $time=time(); if(!empty($redis_time) && $redis_time >$time-3){ return $this->apiResponseError( '请不要频繁申请转账'); } RedisDataServer::creatServer()->setData($redis_on_name,$time,'str',3,false); $pay_pass = request()->input('pay_pass', ''); // if (empty($pay_pass)) { // return $this->apiResponseError('请输入支付密码'); // } $member = Member::where('id', $m_id)->select(['id', 'pay_pass', 'encrypt','money'])->first(); if (empty($member)) { return $this->apiResponseError( '账户信息错误'); } // if (empty($member->{'pay_pass'})) { // return $this->apiResponseError( '请设置支付密码',[],101); // } // if (!PassServer::creatServer($pay_pass,$member->{'encrypt'})->verifyPass($member->{'pay_pass'})) { // return $this->apiResponseError( '支付密码错误'); // } $money = request()->get('money', ''); if (empty($money)) { return $this->apiResponseError('请输入提现金额'); } $mix_money = WithdrawConfig::where('coin_id', 1)->value('mix_money'); if (!empty($mix_money) && $mix_money > 0 && $mix_money>$money) { return $this->apiResponseError('最低提现:' . $mix_money); } $money=$money*1; if(!is_numeric($money) || $money<=0){ return $this->apiResponseError('转账金额不合法'); } if ($member->{'money'} < $money) { return $this->apiResponseError( '会员余额不足'); } $ret = WithdrawServer::creatServer()->setWithdraw($member, $money); if (empty($ret)) { return $this->apiResponseError('操作失败'); } return $this->apiResponseSuccess( '提现申请成功'); } /** * 提现列表 * @return \Illuminate\Http\JsonResponse */ public function index() { $details = Withdraw::where('m_id', request()->member['id']) ->select(['id','created_at','status','m_id','money','service_money','withdraw_money']) ->orderBy('id', 'desc') ->paginate(20); foreach ($details as $key => $detail) { $detail['status_str'] = WithdrawServer::creatServer()->getStatusArr($detail->status); $detail['created_date'] = Carbon::parse($detail->created_at, config('app.timezone'))->format('Y/m/d H:i'); // 时间 } return $this->apiResponseSuccess('获取数据成功', ['total' => $details->total(), 'list' => $details->items()]); } }