作者 lyh

gx

@@ -2,9 +2,11 @@ @@ -2,9 +2,11 @@
2 2
3 namespace App\Helper; 3 namespace App\Helper;
4 4
  5 +use App\Models\WebSetting\WebSettingCountry;
  6 +
5 class Country 7 class Country
6 { 8 {
7 - public static $tls_list = [ 9 + public $tls_list = [
8 'en' => [ 10 'en' => [
9 'text' => '英语', 11 'text' => '英语',
10 'lang_text' => 'English', 12 'lang_text' => 'English',
@@ -665,4 +667,20 @@ class Country @@ -665,4 +667,20 @@ class Country
665 'con_flag' => '', 667 'con_flag' => '',
666 ], 668 ],
667 ]; 669 ];
  670 +
  671 + /**
  672 + * @name :(获取翻译国家)set_country
  673 + * @author :lyh
  674 + * @method :post
  675 + * @time :2023/5/4 17:57
  676 + */
  677 + public function set_country(){
  678 + $data = [];
  679 + foreach ($this->tls_list as $k=>$v){
  680 + $data[] = ['name'=>$v['text'],'alias'=>$k];
  681 + }
  682 + $webCountry = new WebSettingCountry();
  683 + $webCountry->insert($data);
  684 + return;
  685 + }
668 } 686 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Controllers\Bside; 3 namespace App\Http\Controllers\Bside;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Helper\Country;
6 use App\Models\Project\Project; 7 use App\Models\Project\Project;
7 use App\Models\Project\Project as ProjectModel; 8 use App\Models\Project\Project as ProjectModel;
8 use App\Models\User\ProjectMenu as ProjectMenuModel; 9 use App\Models\User\ProjectMenu as ProjectMenuModel;
@@ -115,4 +116,8 @@ class ComController extends BaseController @@ -115,4 +116,8 @@ class ComController extends BaseController
115 $this->response('success'); 116 $this->response('success');
116 } 117 }
117 118
  119 + public function get_country(){
  120 + $country = new Country();
  121 + return $country->set_country();
  122 + }
118 } 123 }
@@ -193,6 +193,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -193,6 +193,7 @@ Route::middleware(['bloginauth'])->group(function () {
193 //无需登录验证的路由组 193 //无需登录验证的路由组
194 Route::group([], function () { 194 Route::group([], function () {
195 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); 195 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login');
  196 + Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country');
196 Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); 197 Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download');
197 Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\ImageController::class,'index'])->name('image_show'); 198 Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\ImageController::class,'index'])->name('image_show');
198 199