|
|
@@ -275,6 +275,8 @@ class MemberService extends BaseService
|
|
|
'sbt_fee' => ConfigService::make()->getConfigByCode('profit_withdraw_sbt_fee', 0),
|
|
|
'recharge_min' => ConfigService::make()->getConfigByCode('recharge_min_money', 0.1),
|
|
|
'withdraw_min' => ConfigService::make()->getConfigByCode('withdraw_min_money', 0),
|
|
|
+ 'recharge_open' => ConfigService::make()->getConfigByCode('recharge_open', 1),
|
|
|
+ 'withdraw_open' => ConfigService::make()->getConfigByCode('withdraw_open', 1),
|
|
|
];
|
|
|
|
|
|
if ($type == 1) {
|
|
|
@@ -569,25 +571,29 @@ class MemberService extends BaseService
|
|
|
*/
|
|
|
public function makeQrcode($str, $dir='qrcode', $refresh = false, $size = 4, $margin = 2, $level = 2)
|
|
|
{
|
|
|
- $basePath = base_path() . '/public';
|
|
|
- $qrFile = "/images/{$dir}/";
|
|
|
- if (!is_dir($basePath . '/uploads' . $qrFile)) {
|
|
|
- @mkdir($basePath . '/uploads' . $qrFile, 0755, true);
|
|
|
- }
|
|
|
+ try {
|
|
|
+ $basePath = base_path() . '/public';
|
|
|
+ $qrFile = "/images/{$dir}/";
|
|
|
+ if (!is_dir($basePath . '/uploads' . $qrFile)) {
|
|
|
+ @mkdir($basePath . '/uploads' . $qrFile, 0755, true);
|
|
|
+ }
|
|
|
|
|
|
- $key = date('Ymd') . strtoupper(md5($str . '_' . $size . $margin . $level));
|
|
|
- $qrFile = $qrFile . "C_{$key}.png";
|
|
|
- $cacheKey = "caches:qrcodes:member_" . $key;
|
|
|
- if (RedisService::get($cacheKey) && is_file($basePath . '/uploads' . $qrFile) && !$refresh) {
|
|
|
- return $qrFile;
|
|
|
- }
|
|
|
+ $key = date('Ymd') . strtoupper(md5($str . '_' . $size . $margin . $level));
|
|
|
+ $qrFile = $qrFile . "C_{$key}.png";
|
|
|
+ $cacheKey = "caches:qrcodes:member_" . $key;
|
|
|
+ if (RedisService::get($cacheKey) && is_file($basePath . '/uploads' . $qrFile) && !$refresh) {
|
|
|
+ return $qrFile;
|
|
|
+ }
|
|
|
|
|
|
- QRcode::png($str, $basePath . '/uploads' . $qrFile, $level, $size, $margin);
|
|
|
- if (!file_exists($basePath . '/uploads' . $qrFile)) {
|
|
|
+ QRcode::png($str, $basePath . '/uploads' . $qrFile, $level, $size, $margin);
|
|
|
+ if (!file_exists($basePath . '/uploads' . $qrFile)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ RedisService::set($cacheKey, ['str' => $str, 'qrcode' => $qrFile, 'date' => date('Y-m-d H:i:s')], 7 * 24 * 3600);
|
|
|
+ return $qrFile;
|
|
|
+ }catch (\Exception $exception){
|
|
|
return false;
|
|
|
}
|
|
|
- RedisService::set($cacheKey, ['str' => $str, 'qrcode' => $qrFile, 'date' => date('Y-m-d H:i:s')], 7 * 24 * 3600);
|
|
|
- return $qrFile;
|
|
|
}
|
|
|
|
|
|
/**
|