This commit is contained in:
2022-09-08 16:43:38 +08:00
parent 2db27956f8
commit 3444b93c1c
10 changed files with 25 additions and 25 deletions

2
.env
View File

@@ -1 +1 @@
APP_DEBUG=true APP_DEBUG=true

View File

@@ -161,9 +161,9 @@ use OSS\OssClient;
if (!function_exists('aliyun')) { if (!function_exists('aliyun')) {
function aliyun($savePath, $category = '', $isunlink = false, $bucket = "hphb-storage") function aliyun($savePath, $category = '', $isunlink = false, $bucket = "hphb-storage")
{ {
$accessKeyId = env('aliyunsms.accessKeyId');//去阿里云后台获取秘钥 $accessKeyId = env('ALIYUNSMS.accessKeyId');//去阿里云后台获取秘钥
$accessKeySecret = env('aliyunsms.accesskey');//去阿里云后台获取秘钥 $accessKeySecret = env('ALIYUNSMS.accesskey');//去阿里云后台获取秘钥
$endpoint = env('aliyunsms.oss_endpoint');//你的阿里云OSS地址 $endpoint = env('ALIYUNSMS.oss_endpoint');//你的阿里云OSS地址
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint); $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
// 判断bucketname是否存在不存在就去创建 // 判断bucketname是否存在不存在就去创建
if (!$ossClient->doesBucketExist($bucket)) { if (!$ossClient->doesBucketExist($bucket)) {
@@ -172,7 +172,7 @@ if (!function_exists('aliyun')) {
$category = empty($category) ? $bucket : $category; $category = empty($category) ? $bucket : $category;
$savePath = str_replace("\\", "/", $savePath); $savePath = str_replace("\\", "/", $savePath);
$object = '/' . $savePath;//想要保存文件的名称 $object = '/' . $savePath;//想要保存文件的名称
$file = env("upload_directory").'\\' . $savePath;//文件路径,必须是本地的。 $file = env("UPLOAD_DIRECTORY").'\\' . $savePath;//文件路径,必须是本地的。
try { try {
echo 'bc'; echo 'bc';
@@ -185,7 +185,7 @@ if (!function_exists('aliyun')) {
} catch (OssException $e) { } catch (OssException $e) {
echo $e->getErrorMessage(); echo $e->getErrorMessage();
} }
$web = "https://hphb-storage.".env('aliyunsms.oss_endpoint').'/'.$object;//这里是你阿里云oss外网访问的Bucket域名 $web = "https://hphb-storage.".env('ALIYUNSMS.oss_endpoint').'/'.$object;//这里是你阿里云oss外网访问的Bucket域名
return $web; return $web;
} }
} }
@@ -194,13 +194,13 @@ if (!function_exists('aliyun')) {
function aliyun($localfile = '', $path = '') function aliyun($localfile = '', $path = '')
{ {
$config = [ $config = [
'access' => env('aliyunsms.accessKeyId'), 'access' => env('ALIYUNSMS.ACCESSKEYID'),
'access_key' => env('aliyunsms.accesskey'), 'access_key' => env('ALIYUNSMS.ACCESSKEY'),
'bucket' => 'hphb-storage', 'bucket' => 'hphb-storage',
'url' => 'https://oss-cn-beijing.aliyuncs.com' 'url' => 'https://oss-cn-beijing.aliyuncs.com'
]; ];
$path = "r/".$localfile; $path = "r/".$localfile;
$localfile = env("upload_directory").'/' . $localfile;//文件路径,必须是本地的。 $localfile = env("UPLOAD_DIRECTORY").'/' . $localfile;//文件路径,必须是本地的。
if (!file_exists($localfile)) { if (!file_exists($localfile)) {
return ('Not found file'); return ('Not found file');
} }
@@ -255,7 +255,7 @@ function StudentToArray($list = []) : array {
"age"=>$vo['age'], "age"=>$vo['age'],
]; ];
} }
if(count($list)<env("page_count")){ if(count($list)<env("PAGE_COUNT")){
$result["lastIndex"] = 0; $result["lastIndex"] = 0;
} }
return $result; return $result;

View File

@@ -66,7 +66,7 @@ class Article
$result['lastIndex'] = $vo['id']; $result['lastIndex'] = $vo['id'];
$result["list"][] = $vo; $result["list"][] = $vo;
} }
if(count($list)<env("page_count")){ if(count($list)<env("PAGE_COUNT")){
$result["lastIndex"] = 0; $result["lastIndex"] = 0;
} }
return show(SUCCESS_MESSAGE,SUCCESS_CODE,$result); return show(SUCCESS_MESSAGE,SUCCESS_CODE,$result);
@@ -108,7 +108,7 @@ class Article
$result['lastIndex'] = $vo['id']; $result['lastIndex'] = $vo['id'];
$result["list"][] = $vo; $result["list"][] = $vo;
} }
if(count($list)<env("page_count")){ if(count($list)<env("PAGE_COUNT")){
$result["lastIndex"] = 0; $result["lastIndex"] = 0;
} }
return show(SUCCESS_MESSAGE,SUCCESS_CODE,$result); return show(SUCCESS_MESSAGE,SUCCESS_CODE,$result);

View File

@@ -73,7 +73,7 @@ class Help
} }
$result = []; $result = [];
$list = Db::name("appHelp")->where("student_id",$student_id)->limit(env("page_count"))->order('count desc')->paginate([ $list = Db::name("appHelp")->where("student_id",$student_id)->limit(env("page_count"))->order('count desc')->paginate([
"list_rows"=>env("page_count"), "list_rows"=>env("PAGE_COUNT"),
"page"=>$lastIndex "page"=>$lastIndex
]); ]);

View File

@@ -30,7 +30,7 @@ class Ranking
} }
$result = []; $result = [];
$list = Db::name("student")->where($where)->limit(env("page_count"))->order('hot desc')->paginate([ $list = Db::name("student")->where($where)->limit(env("page_count"))->order('hot desc')->paginate([
"list_rows"=>env("page_count"), "list_rows"=>env("PAGE_COUNT"),
"page"=>$lastIndex "page"=>$lastIndex
]); ]);

View File

@@ -32,7 +32,7 @@ class Sign
"identifier"=>$info['identifier'], "identifier"=>$info['identifier'],
"nickname"=>$info['nickname'], "nickname"=>$info['nickname'],
"mobile"=>$info['mobile'], "mobile"=>$info['mobile'],
"avatar"=> env("admin_pannel_address") . $info['avatar'], "avatar"=> env("ADMIN_PANNEL_ADDRESS") . $info['avatar'],
"gender"=>$info['gender'], "gender"=>$info['gender'],
"birthday"=>$info['birthday'], "birthday"=>$info['birthday'],
"age"=>$info['age'], "age"=>$info['age'],
@@ -59,7 +59,7 @@ class Sign
"identifier"=>$info['identifier'], "identifier"=>$info['identifier'],
"nickname"=>$info['nickname'], "nickname"=>$info['nickname'],
"mobile"=>$info['mobile'], "mobile"=>$info['mobile'],
"avatar"=> env("admin_pannel_address") . $info['avatar'], "avatar"=> env("ADMIN_PANNEL_ADDRESS") . $info['avatar'],
"gender"=>$info['gender'], "gender"=>$info['gender'],
"birthday"=>$info['birthday'], "birthday"=>$info['birthday'],
"age"=>$info['age'], "age"=>$info['age'],

View File

@@ -28,7 +28,7 @@ class Student
} }
$result = []; $result = [];
$list = Db::name("student")->where($where)->limit(env("page_count"))->order('hot desc')->paginate([ $list = Db::name("student")->where($where)->limit(env("page_count"))->order('hot desc')->paginate([
"list_rows"=>env("page_count"), "list_rows"=>env("PAGE_COUNT"),
"page"=>$lastIndex "page"=>$lastIndex
]); ]);

View File

@@ -14,7 +14,7 @@ class Upload
return show("请选择图片!"); return show("请选择图片!");
} }
$file = $GLOBALS['data']['file']; $file = $GLOBALS['data']['file'];
$dir = env('upload_directory'); $dir = env('UPLOAD_DIRECTORY');
if(!is_dir($dir)){ if(!is_dir($dir)){
mkdir($dir, 0777, true); mkdir($dir, 0777, true);
} }

View File

@@ -21,14 +21,14 @@ class Sms
*/ */
public static function sendmsg($number, $code, $signName='', $template='') public static function sendmsg($number, $code, $signName='', $template='')
{ {
if(empty($signName)) $signName = env('aliyunsms.signName'); if(empty($signName)) $signName = env('ALIYUNSMS.SIGNNAME');
if(empty($template)) $template = env('aliyunsms.TemplateCode'); if(empty($template)) $template = env('ALIYUNSMS.TEMPLATECODE');
if (intval($number) == 0 || $code == "" || $signName == "" || $template == "") { if (intval($number) == 0 || $code == "" || $signName == "" || $template == "") {
return ['code' => 0, 'message' => '参数不全']; return ['code' => 0, 'message' => '参数不全'];
} }
AlibabaCloud::accessKeyClient(env('aliyunsms.accessKeyId'), env('aliyunsms.accesskey')) AlibabaCloud::accessKeyClient(env('ALIYUNSMS.ACCESSKEYID'), env('aliyunsms.accesskey'))
->regionId(env('aliyunsms.regionid')) ->regionId(env('ALIYUNSMS.REGIONID'))
->asDefaultClient(); ->asDefaultClient();
try { try {
$result = AlibabaCloud::rpc() $result = AlibabaCloud::rpc()
@@ -39,7 +39,7 @@ class Sms
->host('dysmsapi.aliyuncs.com') ->host('dysmsapi.aliyuncs.com')
->options([ ->options([
'query' => [ 'query' => [
'RegionId' => env('aliyunsms.regionid'), 'RegionId' => env('ALIYUNSMS.REGIONID'),
'PhoneNumbers' => $number, 'PhoneNumbers' => $number,
'SignName' => $signName, 'SignName' => $signName,
'TemplateCode' => $template, 'TemplateCode' => $template,
@@ -99,7 +99,7 @@ class Sms
if ($token == '') { if ($token == '') {
return ['code' => 0, 'message' => '参数不全']; return ['code' => 0, 'message' => '参数不全'];
} }
AlibabaCloud::accessKeyClient(env('aliyunsms.accessKeyId'), env('aliyunsms.accesskey')) AlibabaCloud::accessKeyClient(env('ALIYUNSMS.ACCESSKEYID'), env('ALIYUNSMS.ACCESSKEY'))
->regionId('cn-hangzhou') ->regionId('cn-hangzhou')
->asDefaultClient(); ->asDefaultClient();
try { try {

View File

@@ -5,7 +5,7 @@
return [ return [
// 默认语言 // 默认语言
'default_lang' => env('lang.default_lang', 'zh-cn'), 'default_lang' => env('lang.DEFAULT_LANG', 'zh-cn'),
// 允许的语言列表 // 允许的语言列表
'allow_lang_list' => [], 'allow_lang_list' => [],
// 多语言自动侦测变量名 // 多语言自动侦测变量名