getConfigByName('withdraw_is_open',1,'withdraw'); $withdrawOpen = $withdrawOpen? $withdrawOpen : 0; if(!$withdrawOpen){ return api_error_return('余额提现功能暂未开放'); } $cacheKey = "caches:withdraw:locks:{$request->uid}"; if(RedisCache::get($cacheKey)){ return api_error_return('请不要频繁提交'); } // 正常开放时间段 getActionBefore(2); RedisCache::setnx($cacheKey, 1, rand(2,3)); $service->withdraw($request->uid,$request->post('money'), $request->post('type'), $request->post()); Db::commit(); }catch (Exception $e){ Db::rollback(); return api_error_return($e->getMessage()); } return api_succ_return('提交成功'); } /** * 提现账号列表 * @param Request $request * @return \think\Response * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function withdrawAccountList(Request $request){ $params = $request->post(); if (empty($params['type'])){ return api_error_return('参数错误'); } $list = WithdrawAccountService::make()->getListByUser($request->uid, $params['type']); return api_succ_return(['msg'=>'成功', 'data'=>$list]); } }