Showing
13 changed files
with
357 additions
and
2 deletions
... | @@ -38,6 +38,7 @@ class MembershipController extends AdminController | ... | @@ -38,6 +38,7 @@ class MembershipController extends AdminController |
38 | ->expand(function (){ | 38 | ->expand(function (){ |
39 | $th = ['id','price','line_price','limit_days','limit_unit']; | 39 | $th = ['id','price','line_price','limit_days','limit_unit']; |
40 | $data = MembershipGood::query()->where('membership_id',$this->id)->get($th)->toArray(); | 40 | $data = MembershipGood::query()->where('membership_id',$this->id)->get($th)->toArray(); |
41 | + $th = ['id','价格','划线价格','有效期','单位']; | ||
41 | return Table::make($th, $data); | 42 | return Table::make($th, $data); |
42 | }); | 43 | }); |
43 | $grid->column('video_url'); | 44 | $grid->column('video_url'); | ... | ... |
app/Admin/Controllers/SettingController.php
0 → 100755
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Admin\Controllers; | ||
4 | + | ||
5 | +use App\Admin\Repositories\LoginSetting; | ||
6 | +use Dcat\Admin\Grid; | ||
7 | +use Dcat\Admin\Http\Controllers\AdminController; | ||
8 | +use Dcat\Admin\Layout\Content; | ||
9 | +use Dcat\Admin\Layout\Row; | ||
10 | +use Dcat\Admin\Widgets\Card; | ||
11 | + | ||
12 | +class SettingController extends AdminController | ||
13 | +{ | ||
14 | + protected $title = 'App系统设置'; | ||
15 | + | ||
16 | + /** | ||
17 | + * Index interface. | ||
18 | + * | ||
19 | + * @param Content $content | ||
20 | + * @return Content | ||
21 | + */ | ||
22 | + public function index(Content $content) | ||
23 | + { | ||
24 | + return $content | ||
25 | + ->translation($this->translation()) | ||
26 | + ->title($this->title()) | ||
27 | + ->description($this->description()['index'] ?? trans('admin.list')) | ||
28 | + ->body(function ()use ($content){ | ||
29 | + // 一行多列 | ||
30 | + $content->row(function (Row $row) { | ||
31 | + $row->column(4, $this->loginGrid()); | ||
32 | +// $row->column(6, $this->grid()); | ||
33 | + }); | ||
34 | + }); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Make a grid builder. | ||
39 | + * | ||
40 | + * @return Card | ||
41 | + */ | ||
42 | + protected function loginGrid() | ||
43 | + { | ||
44 | + $grid = Grid::make(new LoginSetting(), function (Grid $grid) { | ||
45 | + $grid->disablePagination(); | ||
46 | + $grid->disableActions(); | ||
47 | + $grid->tableCollapse(false); | ||
48 | + $grid->disableCreateButton(); | ||
49 | + $grid->disableRefreshButton(); | ||
50 | + $grid->disableRowSelector(); | ||
51 | + | ||
52 | + $grid->column('icon')->display(function ($item){ | ||
53 | + return "<i class='$item'></i>"; | ||
54 | + }); | ||
55 | + $grid->column('name'); | ||
56 | + $grid->column('state')->switch(); | ||
57 | + | ||
58 | + }); | ||
59 | + | ||
60 | + $card = new Card(); | ||
61 | + $card->title('登录设置')->withHeaderBorder()->content($grid); | ||
62 | + return $card; | ||
63 | + } | ||
64 | +} |
app/Admin/Repositories/LoginSetting.php
0 → 100755
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Admin\Repositories; | ||
4 | + | ||
5 | +use App\Models\Setting as Model; | ||
6 | +use Dcat\Admin\Grid; | ||
7 | +use Dcat\Admin\Repositories\EloquentRepository; | ||
8 | + | ||
9 | +class LoginSetting extends EloquentRepository | ||
10 | +{ | ||
11 | + /** | ||
12 | + * Model. | ||
13 | + * | ||
14 | + * @var string | ||
15 | + */ | ||
16 | + protected $eloquentClass = Model::class; | ||
17 | + | ||
18 | + | ||
19 | + public function get(Grid\Model $model) | ||
20 | + { | ||
21 | + $setting = Model::query()->where('keyword', 'login_setting')->where('terminal', 1)->first(); | ||
22 | + | ||
23 | + | ||
24 | + return json_decode($setting->content,true); | ||
25 | + } | ||
26 | +} |
... | @@ -46,4 +46,10 @@ Route::group([ | ... | @@ -46,4 +46,10 @@ Route::group([ |
46 | // $router->resource('/push', 'PushController'); | 46 | // $router->resource('/push', 'PushController'); |
47 | }); | 47 | }); |
48 | 48 | ||
49 | + $router->group(['prefix'=>'/setting'],function (Router $router){ | ||
50 | + /** App设置*/ | ||
51 | + $router->resource('/android', 'SettingController'); | ||
52 | + $router->resource('/ios', 'SettingController'); | ||
53 | + }); | ||
54 | + | ||
49 | }); | 55 | }); | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Http\Controllers\V1; | ||
4 | + | ||
5 | +use App\Http\Controllers\Controller; | ||
6 | + | ||
7 | +use App\Models\Setting; | ||
8 | +use Jiannei\Response\Laravel\Support\Facades\Response; | ||
9 | + | ||
10 | +class SettingController extends Controller | ||
11 | +{ | ||
12 | + /** | ||
13 | + * Display a listing of the resource. | ||
14 | + * | ||
15 | + * @return \Illuminate\Http\JsonResponse | ||
16 | + */ | ||
17 | + public function index() | ||
18 | + { | ||
19 | + if ($this->getClientTerminal() == 'ios'){ | ||
20 | + $terminal = 2; | ||
21 | + }else{ | ||
22 | + $terminal = 1; | ||
23 | + } | ||
24 | + | ||
25 | + $array = []; | ||
26 | + $settings = Setting::query()->where('terminal', $terminal) | ||
27 | + ->where('version', Setting::CURRENT_VERSION) | ||
28 | + ->get(); | ||
29 | + foreach ($settings as $setting){ | ||
30 | + $array[$setting->keyword] = $setting->content; | ||
31 | + } | ||
32 | + | ||
33 | + return Response::success($array); | ||
34 | + } | ||
35 | +} |
app/Models/Setting.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Models; | ||
4 | + | ||
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
6 | +use Illuminate\Database\Eloquent\Model; | ||
7 | + | ||
8 | +class Setting extends Model | ||
9 | +{ | ||
10 | + const CURRENT_VERSION = 1; | ||
11 | + | ||
12 | + use HasFactory; | ||
13 | + | ||
14 | + public function getContentAttribute() | ||
15 | + { | ||
16 | + return json_decode($this->attributes['content'],true); | ||
17 | + } | ||
18 | +} |
... | @@ -8,9 +8,11 @@ | ... | @@ -8,9 +8,11 @@ |
8 | 8 | ||
9 | namespace App\Payment; | 9 | namespace App\Payment; |
10 | 10 | ||
11 | +use App\Models\Order; | ||
12 | + | ||
11 | class AliPayment implements PaymentInterface | 13 | class AliPayment implements PaymentInterface |
12 | { | 14 | { |
13 | - public function prepare() | 15 | + public function prepare(Order $order) |
14 | { | 16 | { |
15 | // TODO: Implement prepare() method. | 17 | // TODO: Implement prepare() method. |
16 | } | 18 | } | ... | ... |
... | @@ -51,6 +51,17 @@ class WechatPayment implements PaymentInterface | ... | @@ -51,6 +51,17 @@ class WechatPayment implements PaymentInterface |
51 | 51 | ||
52 | public function prepare(Order $order) | 52 | public function prepare(Order $order) |
53 | { | 53 | { |
54 | + // todo | ||
55 | + return [ | ||
56 | + 'appid' => env('WECHAT_APPID'), | ||
57 | + 'partnerid' => env('WECHAT_PAY_MCH_ID'), | ||
58 | + 'prepayid' => 'wx261153585405162d4d02642eabe7000000', | ||
59 | + 'package' => 'Sign=WXPay', | ||
60 | + 'noncestr' => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS', | ||
61 | + 'timestamp' => '1647249156', | ||
62 | + 'sign' => 'oR9d8PuhnIc+YZ8cBHFCwfgpaK9gd7vaRvkYD7rthRAZ\/X+QBhcCYL21N7cHCTUxbQ+EAt6Uy+lwSN22f5YZvI45MLko8Pfso0jm46v5hqcVwrk6uddkGuT+Cdvu4WBqDzaDjnNa5UK3GfE1Wfl2gHxIIY5lLdUgWFts17D4WuolLLkiFZV+JSHMvH7eaLdT9N5GBovBwu5yYKUR7skR8Fu+LozcSqQixnlEZUfyE55feLOQTUYzLmR9pNtPbPsu6WVhbNHMS3Ss2+AehHvz+n64GDmXxbX++IOBvm2olHu3PsOUGRwhudhVf7UcGcunXt8cqNjKNqZLhLw4jq\/xDg==' | ||
63 | + ]; | ||
64 | + | ||
54 | $body = [ | 65 | $body = [ |
55 | 'appid' => env('WECHAT_APPID'), | 66 | 'appid' => env('WECHAT_APPID'), |
56 | 'mchid' => env('WECHAT_PAY_MCH_ID'), | 67 | 'mchid' => env('WECHAT_PAY_MCH_ID'), | ... | ... |
... | @@ -17,6 +17,9 @@ | ... | @@ -17,6 +17,9 @@ |
17 | "laravel/socialite": "^5.2", | 17 | "laravel/socialite": "^5.2", |
18 | "laravel/tinker": "^2.5", | 18 | "laravel/tinker": "^2.5", |
19 | "socialiteproviders/apple": "^5.0", | 19 | "socialiteproviders/apple": "^5.0", |
20 | + "socialiteproviders/facebook": "^4.1", | ||
21 | + "socialiteproviders/tiktok": "^4.0", | ||
22 | + "socialiteproviders/twitter": "^4.1", | ||
20 | "socialiteproviders/weixin": "^4.1" | 23 | "socialiteproviders/weixin": "^4.1" |
21 | }, | 24 | }, |
22 | "require-dev": { | 25 | "require-dev": { | ... | ... |
... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
5 | "This file is @generated automatically" | 5 | "This file is @generated automatically" |
6 | ], | 6 | ], |
7 | - "content-hash": "2a26b7c5aa12ce822287c40356916250", | 7 | + "content-hash": "aa46d9704a095f2da2d480e58e475235", |
8 | "packages": [ | 8 | "packages": [ |
9 | { | 9 | { |
10 | "name": "asm89/stack-cors", | 10 | "name": "asm89/stack-cors", |
... | @@ -4312,6 +4312,53 @@ | ... | @@ -4312,6 +4312,53 @@ |
4312 | "time": "2021-08-04T07:43:47+00:00" | 4312 | "time": "2021-08-04T07:43:47+00:00" |
4313 | }, | 4313 | }, |
4314 | { | 4314 | { |
4315 | + "name": "socialiteproviders/facebook", | ||
4316 | + "version": "4.1.0", | ||
4317 | + "source": { | ||
4318 | + "type": "git", | ||
4319 | + "url": "https://github.com/SocialiteProviders/Facebook.git", | ||
4320 | + "reference": "9b94a9334b5d0f61de8f5a20928d63d4d8f4e00d" | ||
4321 | + }, | ||
4322 | + "dist": { | ||
4323 | + "type": "zip", | ||
4324 | + "url": "https://api.github.com/repos/SocialiteProviders/Facebook/zipball/9b94a9334b5d0f61de8f5a20928d63d4d8f4e00d", | ||
4325 | + "reference": "9b94a9334b5d0f61de8f5a20928d63d4d8f4e00d", | ||
4326 | + "shasum": "", | ||
4327 | + "mirrors": [ | ||
4328 | + { | ||
4329 | + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", | ||
4330 | + "preferred": true | ||
4331 | + } | ||
4332 | + ] | ||
4333 | + }, | ||
4334 | + "require": { | ||
4335 | + "ext-json": "*", | ||
4336 | + "php": "^7.2 || ^8.0", | ||
4337 | + "socialiteproviders/manager": "~4.0" | ||
4338 | + }, | ||
4339 | + "type": "library", | ||
4340 | + "autoload": { | ||
4341 | + "psr-4": { | ||
4342 | + "SocialiteProviders\\Facebook\\": "" | ||
4343 | + } | ||
4344 | + }, | ||
4345 | + "notification-url": "https://packagist.org/downloads/", | ||
4346 | + "license": [ | ||
4347 | + "MIT" | ||
4348 | + ], | ||
4349 | + "authors": [ | ||
4350 | + { | ||
4351 | + "name": "Oleksandr Prypkhan (Alex Wells)", | ||
4352 | + "email": "autaut03@googlemail.com" | ||
4353 | + } | ||
4354 | + ], | ||
4355 | + "description": "Facebook (facebook.com) OAuth2 Provider for Laravel Socialite", | ||
4356 | + "support": { | ||
4357 | + "source": "https://github.com/SocialiteProviders/Facebook/tree/4.1.0" | ||
4358 | + }, | ||
4359 | + "time": "2020-12-01T23:10:59+00:00" | ||
4360 | + }, | ||
4361 | + { | ||
4315 | "name": "socialiteproviders/manager", | 4362 | "name": "socialiteproviders/manager", |
4316 | "version": "v4.1.0", | 4363 | "version": "v4.1.0", |
4317 | "source": { | 4364 | "source": { |
... | @@ -4392,6 +4439,108 @@ | ... | @@ -4392,6 +4439,108 @@ |
4392 | "time": "2022-01-23T22:40:23+00:00" | 4439 | "time": "2022-01-23T22:40:23+00:00" |
4393 | }, | 4440 | }, |
4394 | { | 4441 | { |
4442 | + "name": "socialiteproviders/tiktok", | ||
4443 | + "version": "4.0.1", | ||
4444 | + "source": { | ||
4445 | + "type": "git", | ||
4446 | + "url": "https://github.com/SocialiteProviders/TikTok.git", | ||
4447 | + "reference": "435bd93c2c91df1d34b85dcd19bb39c1ade56aad" | ||
4448 | + }, | ||
4449 | + "dist": { | ||
4450 | + "type": "zip", | ||
4451 | + "url": "https://api.github.com/repos/SocialiteProviders/TikTok/zipball/435bd93c2c91df1d34b85dcd19bb39c1ade56aad", | ||
4452 | + "reference": "435bd93c2c91df1d34b85dcd19bb39c1ade56aad", | ||
4453 | + "shasum": "", | ||
4454 | + "mirrors": [ | ||
4455 | + { | ||
4456 | + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", | ||
4457 | + "preferred": true | ||
4458 | + } | ||
4459 | + ] | ||
4460 | + }, | ||
4461 | + "require": { | ||
4462 | + "php": "^7.2 || ^8.0", | ||
4463 | + "socialiteproviders/manager": "~4.0" | ||
4464 | + }, | ||
4465 | + "type": "library", | ||
4466 | + "autoload": { | ||
4467 | + "psr-4": { | ||
4468 | + "SocialiteProviders\\TikTok\\": "" | ||
4469 | + } | ||
4470 | + }, | ||
4471 | + "notification-url": "https://packagist.org/downloads/", | ||
4472 | + "license": [ | ||
4473 | + "MIT" | ||
4474 | + ], | ||
4475 | + "authors": [ | ||
4476 | + { | ||
4477 | + "name": "Thomas Banks", | ||
4478 | + "email": "thomas@tombanks.me" | ||
4479 | + } | ||
4480 | + ], | ||
4481 | + "description": "TikTok (tiktok.com) OAuth2 Provider for Laravel Socialite", | ||
4482 | + "keywords": [ | ||
4483 | + "TikTok ", | ||
4484 | + "laravel", | ||
4485 | + "oauth", | ||
4486 | + "provider", | ||
4487 | + "socialite" | ||
4488 | + ], | ||
4489 | + "support": { | ||
4490 | + "docs": "https://socialiteproviders.com/tiktok", | ||
4491 | + "issues": "https://github.com/socialiteproviders/providers/issues", | ||
4492 | + "source": "https://github.com/socialiteproviders/providers" | ||
4493 | + }, | ||
4494 | + "time": "2022-02-08T01:22:50+00:00" | ||
4495 | + }, | ||
4496 | + { | ||
4497 | + "name": "socialiteproviders/twitter", | ||
4498 | + "version": "4.1.1", | ||
4499 | + "source": { | ||
4500 | + "type": "git", | ||
4501 | + "url": "https://github.com/SocialiteProviders/Twitter.git", | ||
4502 | + "reference": "e5edf2b6e3f37e64be6488111629ed5e41e645ad" | ||
4503 | + }, | ||
4504 | + "dist": { | ||
4505 | + "type": "zip", | ||
4506 | + "url": "https://api.github.com/repos/SocialiteProviders/Twitter/zipball/e5edf2b6e3f37e64be6488111629ed5e41e645ad", | ||
4507 | + "reference": "e5edf2b6e3f37e64be6488111629ed5e41e645ad", | ||
4508 | + "shasum": "", | ||
4509 | + "mirrors": [ | ||
4510 | + { | ||
4511 | + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", | ||
4512 | + "preferred": true | ||
4513 | + } | ||
4514 | + ] | ||
4515 | + }, | ||
4516 | + "require": { | ||
4517 | + "ext-json": "*", | ||
4518 | + "php": "^7.2 || ^8.0", | ||
4519 | + "socialiteproviders/manager": "~4.0" | ||
4520 | + }, | ||
4521 | + "type": "library", | ||
4522 | + "autoload": { | ||
4523 | + "psr-4": { | ||
4524 | + "SocialiteProviders\\Twitter\\": "" | ||
4525 | + } | ||
4526 | + }, | ||
4527 | + "notification-url": "https://packagist.org/downloads/", | ||
4528 | + "license": [ | ||
4529 | + "MIT" | ||
4530 | + ], | ||
4531 | + "authors": [ | ||
4532 | + { | ||
4533 | + "name": "Brian Faust", | ||
4534 | + "email": "hello@brianfaust.de" | ||
4535 | + } | ||
4536 | + ], | ||
4537 | + "description": "Twitter OAuth1 Provider for Laravel Socialite", | ||
4538 | + "support": { | ||
4539 | + "source": "https://github.com/SocialiteProviders/Twitter/tree/4.1.1" | ||
4540 | + }, | ||
4541 | + "time": "2021-01-29T05:41:11+00:00" | ||
4542 | + }, | ||
4543 | + { | ||
4395 | "name": "socialiteproviders/weixin", | 4544 | "name": "socialiteproviders/weixin", |
4396 | "version": "4.1.0", | 4545 | "version": "4.1.0", |
4397 | "source": { | 4546 | "source": { | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +use Illuminate\Database\Migrations\Migration; | ||
4 | +use Illuminate\Database\Schema\Blueprint; | ||
5 | +use Illuminate\Support\Facades\Schema; | ||
6 | + | ||
7 | +class CreateSettingsTable extends Migration | ||
8 | +{ | ||
9 | + /** | ||
10 | + * Run the migrations. | ||
11 | + * | ||
12 | + * @return void | ||
13 | + */ | ||
14 | + public function up() | ||
15 | + { | ||
16 | + Schema::create('settings', function (Blueprint $table) { | ||
17 | + $table->id(); | ||
18 | + $table->string('title')->comment('标题'); | ||
19 | + $table->string('keyword')->comment('关键字'); | ||
20 | + $table->json('content')->comment('内容'); | ||
21 | + $table->unsignedTinyInteger('version')->default(1)->comment('版本'); | ||
22 | + $table->unsignedTinyInteger('terminal')->comment('1=安卓,2=IOS,3=全平台'); | ||
23 | + | ||
24 | + $table->timestamps(); | ||
25 | + }); | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * Reverse the migrations. | ||
30 | + * | ||
31 | + * @return void | ||
32 | + */ | ||
33 | + public function down() | ||
34 | + { | ||
35 | + Schema::dropIfExists('settings'); | ||
36 | + } | ||
37 | +} |
... | @@ -30,6 +30,8 @@ Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Route | ... | @@ -30,6 +30,8 @@ Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Route |
30 | /**首页*/ | 30 | /**首页*/ |
31 | $api->apiResource('/home', 'HomeController'); | 31 | $api->apiResource('/home', 'HomeController'); |
32 | 32 | ||
33 | + $api->get('/setting', 'SettingController@index'); | ||
34 | + | ||
33 | /** 临境 */ | 35 | /** 临境 */ |
34 | $api->apiResource('/immersive', 'ImmerseController'); | 36 | $api->apiResource('/immersive', 'ImmerseController'); |
35 | 37 | ... | ... |
-
Please register or login to post a comment