first commit

This commit is contained in:
2026-01-18 09:52:48 +08:00
commit 836bdc9409
584 changed files with 40891 additions and 0 deletions

View File

@@ -0,0 +1,150 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Controllers\Api;
use Illuminate\Http\Request;
use App\Http\Controllers\BaseController;
use Modules\Wechat\Services\OauthService;
use Modules\Wechat\Services\WechatService;
class Index extends BaseController {
/**
* 获取微信用户授权跳转
*/
public function oauth(Request $request, OauthService $service){
if($request->filled('code')){
if($request->filled('url')){
return redirect($request->input('url') . '?code=' . $request->input('code', ''));
}
}else{
$res = $service->oauth($request);
return redirect($res);
}
}
/**
* @title 微信登录
*
* @param Request $request
* @param OauthService $service
* @return void
*/
public function login(Request $request, OauthService $service){
$type = $request->input('type', 'wechat');
if($request->filled('code')){
$info = [];
switch ($type) {
case 'wechat':
try {
$info = $service->wechatLogin($request->input('code', ''));
} catch (\Throwable $th) {
$this->data['message'] = $th->getMessage();
$this->data['code'] = 0;
return $this->data;
}
break;
case 'miniapp':
try {
$info = $service->miniappLogin($request);
} catch (\Throwable $th) {
$this->data['message'] = $th->getMessage();
$this->data['code'] = 0;
return $this->data;
}
break;
default:
$this->data['message'] = "非法操作!";
$this->data['code'] = 0;
break;
}
if(isset($info['member_id']) && $info['member_id']){
$token = auth('api')->tokenById($info['member_id']);
if($token){
$this->data['data'] = [
'access_token' => $token,
'token_type' => 'bearer',
'expires_in' => auth('api')->factory()->getTTL() * 60
];
}elseif(isset($info['openid']) && $info['openid']){
$this->data['data'] = $info;
$this->data['message'] = "初次登录未绑定用户,请先绑定用户,或注册新用户绑定!";
$this->data['code'] = 100;
}else{
$this->data['message'] = "登录失败!";
$this->data['code'] = 0;
}
}else{
if(isset($info['openid']) && $info['openid']){
$this->data['data'] = $info;
$this->data['message'] = "初次登录未绑定用户,请先绑定用户,或注册新用户绑定!";
$this->data['code'] = 100;
}else{
$this->data['message'] = "登录失败!";
$this->data['code'] = 0;
}
}
}else{
$this->data['message'] = "非法操作!";
$this->data['code'] = 0;
}
return response()->json($this->data);
}
/**
* @title 微信公众号验证
*
* @param OauthService $service
* @return void
*/
public function serve(OauthService $service){
return $service->WechatServe();
}
/**
* @title 获取微信jssdk配置
*
* @param WechatService $service
* @return void
*/
public function jssdk(OauthService $service){
try {
$this->data['data'] = $service->getJsSdk($this->request);
} catch (\think\Exception $e) {
$this->data['message'] = $e->getMessage();
$this->data['code'] = 0;
}
return $this->data;
}
public function invitecode(Request $request, WechatService $service){
try {
$this->data['data'] = $service->getInviteCode($request);
} catch (\think\Exception $e) {
$this->data['message'] = $e->getMessage();
$this->data['code'] = 0;
}
return $this->data;
}
public function qrcode(Request $request, WechatService $service){
try {
$request->mergeIfMissing([
'doctor_id' => auth('doctor')->id(),
]);
$this->data['data'] = $service->getSingleQrcode($request);
} catch (\think\Exception $e) {
$this->data['message'] = $e->getMessage();
$this->data['code'] = 0;
}
return $this->data;
}
}

View File

@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Listeners;
use Modules\Member\Events\LoginEvent;
use Modules\Wechat\Models\MemberSocial;
class LoginBind {
/**
* @title 会员登录后更新用户信息
*
* @param LoginEvent $event
* @return void
*/
public function handle(LoginEvent $event) {
$member = $event->member;
$openid = $event->openid;
$type = $event->type;
$social = MemberSocial::where('openid', $openid)->where('type', $type)->first();
if ($social && $social->member_id == 0) {
$social->member_id = $member->uid;
$social->save();
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Listeners;
use Modules\Member\Events\Registered;
use Modules\Wechat\Models\MemberSocial;
class RegisterBind {
/**
* @title 会员登录后更新用户信息
*
* @param LoginEvent $event
* @return void
*/
public function handle(Registered $event) {
$member = $event->member;
$openid = $event->openid;
$type = $event->type;
$social = MemberSocial::where('openid', $openid)->where('type', $type)->first();
if ($social && $social->member_id == 0) {
$social->member_id = $member->uid;
$social->save();
}
}
}

View File

@@ -0,0 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Models;
use App\Models\BaseModel;
class MemberSocial extends BaseModel {
protected $table = 'member_social';
protected $fillable = ['nickname', 'member_id', 'type', 'gender', 'openid', 'avatar', 'county', 'province', 'city', 'language', 'unionid'];
// protected $hidden = ['deleted_at'];
}

View File

View File

@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array<string, array<int, string>>
*/
protected $listen = [
'Modules\Member\Events\LoginEvent' => [
'Modules\Wechat\Listeners\LoginBind',
],
'Modules\Member\Events\Registered' => [
'Modules\Wechat\Listeners\RegisterBind',
],
];
/**
* Indicates if events should be discovered.
*
* @var bool
*/
protected static $shouldDiscoverEvents = true;
/**
* Configure the proper event listeners for email verification.
*
* @return void
*/
protected function configureEmailVerification(): void
{
}
}

View File

@@ -0,0 +1,67 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
$this->mapAdminRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path('Wechat', '/routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Wechat', '/routes/api.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapAdminRoutes(): void
{
Route::middleware('api')->prefix('admin')->name('admin.')->group(module_path('Wechat', '/routes/admin.php'));
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace Modules\Wechat\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class WechatServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Wechat';
protected string $moduleNameLower = 'wechat';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(EventServiceProvider::class);
$this->app->register(RouteServiceProvider::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
}
/**
* Get the services provided by the provider.
*
* @return array<string>
*/
public function provides(): array
{
return [];
}
/**
* @return array<string>
*/
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
$paths[] = $path.'/modules/'.$this->moduleNameLower;
}
}
return $paths;
}
}

View File

@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Services;
use Illuminate\Support\Facades\Config;
use EasyWeChat\OfficialAccount\Application;
class MessageService {
/**
* 发送模板消息
* @param $openid
* @param $template_id
* @param $url
* @param $data
* @return mixed
*/
public function sendMessage($openid, $template_id, $url, $data){
$config = Config::get('wechat.wx');
$app = new Application($config);
$client = $app->getClient();
$result = $client->postJson('/cgi-bin/message/template/send', [
'touser' => $openid,
'template_id' => $template_id,
'page' => $url,
'data' => $data,
'miniprogram_state' => 'formal',
'lang' => 'zh_CN',
]);
return $result;
}
}

View File

@@ -0,0 +1,179 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Services;
use Illuminate\Support\Facades\Config;
use EasyWeChat\OfficialAccount\Application;
use EasyWeChat\MiniApp\Application as MiniApp;
use Modules\Wechat\Models\MemberSocial;
use Illuminate\Support\Str;
class OauthService {
/**
* @title 微信授权登录
*
* @param [type] $request
* @return void
*/
public function oauth($request){
$config = Config::get('wechat.wx');
$url = $request->fullUrl();
$app = new Application($config);
try {
//获取openid
$oauth = $app->getOAuth();
$redirect = $oauth->scopes(['snsapi_userinfo'])->redirect($url);
return $redirect;
} catch (\Exception $e) {
throw new \Exception($e->getMessage(), 100);
}
}
/**
* @title 微信用户登录
*
* @param [type] $code
* @return void
*/
public function wechatLogin($code){
$config = Config::get('wechat.wx');
$app = new Application($config);
try {
//获取openid
$oauth = $app->getOAuth();
$user = $oauth->userFromCode($code);
$userinfo = $user->toArray();
$social = MemberSocial::where('openid', '=', $userinfo['id'])->where('type', '=', 'wechat')->first();
if(!$social){
$data = [
'type' => 'wechat',
'member_id' => 0,
'openid' => isset($userinfo['id']) ? $userinfo['id'] : '',
'nickname' => isset($userinfo['nickname']) ? $userinfo['nickname'] : '',
'avatar' => isset($userinfo['avatar']) ? $userinfo['avatar'] : '',
'gender' => isset($userinfo['gender']) ? $userinfo['gender'] : '',
];
$social = MemberSocial::create($data);
}
return $social;
} catch (\Exception $e) {
throw new \Exception($e->getMessage(), 100);
}
}
public function miniappLogin($request){
$config = Config::get('wechat.miniapp');
$app = new MiniApp($config);
try {
//获取openid
$utils = $app->getUtils();
$session = $utils->codeToSession($request->input('code'));
$social = MemberSocial::where('openid', '=', $session['openid'])->where('type', '=', 'miniapp')->first();
if(!$social){
if($request->filled('iv') && $request->filled('encryptedData')){
$userinfo = $utils->decryptSession($session['session_key'], $request->input('iv'), $request->input('encryptedData'));
}else{
$userinfo = ['nickName' => '微信用户' . Str::substr($session['openid'], -7), 'avatarUrl' => '', 'gender' => 1];
}
$data = [
'type' => 'miniapp',
'member_id' => 0,
'openid' => isset($session['openid']) ? $session['openid'] : '',
'unionid' => isset($session['unionid']) ? $session['unionid'] : '',
'nickname' => $userinfo['nickName'] ? $userinfo['nickName'] : '',
'avatar' => isset($userinfo['avatarUrl']) ? $userinfo['avatarUrl'] : '',
'gender' => isset($userinfo['gender']) ? $userinfo['gender'] : '',
];
$social = MemberSocial::create($data);
}
return $social;
} catch (\Exception $e) {
throw new \Exception($e->getMessage(), 100);
}
}
/**
* @title 获取微信JS-SDK配置
*
* @param [type] $request
* @return void
*/
public function getJsSdk($request){
$config = Config::get('wechat.wx');
$url = $request->input('url', '');
$url = $url ? urldecode($url) : $request->url(true);
$app = new Application($config);
try {
$utils = $app->getUtils();
$config = $utils->buildJsSdkConfig(
url: $url,
jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'scanQRCode', 'closeWindow', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem', 'openAddress'],
openTagList: [],
debug: false,
);
return $config;
} catch (\Exception $e) {
throw new \Exception($e->getMessage(), 100);
}
}
/**
* @title 微信公众号服务
*
* @return void
*/
public function WechatServe(){
$config = Config::get('wechat.wx');
$app = new Application($config);
$server = $app->getServer();
$server->with(function($message, \Closure $next){
if ($message->MsgType === 'text') {
return [
'MsgType' => 'text',
'Content' => '暂未开通自动回复功能!'
];
}
return $next($message);
});
$server->addEventListener('subscribe', function() {
return '欢迎!!';
});
$server->addEventListener('unsubscribe', function() {
return '再见~';
});
return $server->serve();
}
/**
* @title 获取微信用户信息
*
* @param [type] $openid
* @return void
*/
public function getWechatInfo($openid){
$config = Config::get('wechat.wx');
$app = new Application($config);
$api = $app->getClient();
$userinfo = $api->post('cgi-bin/user/info', [
'json' => [
'openid' => $openid,
'lang' => 'zh_CN',
]
]);
return $userinfo;
}
}

View File

@@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Services;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Config;
use EasyWeChat\MiniApp\Application;
class WechatService {
public function getSingleQrcode($request){
$config = config('wechat.miniapp');
$doctor_id = $request->input('doctor_id');
$refresh = $request->input('refresh', 0);
$pic_name = md5('doctor_' . $doctor_id);
$path = "qrcode/{$pic_name}.png";
if (Storage::disk('public')->exists($path) && !$refresh) {
return Storage::disk('public')->url($path);
}
$app = new Application($config);
$client = $app->getClient();
$response = $client->postJson('/wxa/getwxacodeunlimit', [
'scene' => $doctor_id,
'page' => 'pages/health/patient/form',
'width' => 430,
'check_path' => false,
// 'env_version' => $config['env_version'],
]);
if ($response->isFailed()) {
throw new \Exception($response->getContent(), $response->getStatusCode());
}else{
Storage::disk('public')->put($path, $response->toStream());
return Storage::disk('public')->url($path);
}
}
public function getInviteCode($request){
$config = Config::get('wechat.miniapp');
$app = new Application($config);
$refresh = $request->input('refresh', 0);
$pic_name = md5('invite_code_' . $request->input('uid', ''));
$path = "qrcode/{$pic_name}.png";
if (Storage::disk('public')->exists($path) && !$refresh) {
return Storage::disk('public')->url($path);
}
$client = $app->getClient();
$response = $client->postJson('/wxa/getwxacodeunlimit', [
'scene' => 'invite_uid=' . $request->input('uid', ''),
'page' => 'pages/ucenter/login/index',
'width' => 430,
'check_path' => false,
// 'env_version' => $config['env_version'],
]);
if ($response->isFailed()) {
throw new \Exception($response->getContent(), $response->getStatusCode());
}else{
Storage::disk('public')->put($path, $response->toStream());
return Storage::disk('public')->url($path);
}
}
}

View File

@@ -0,0 +1,30 @@
{
"name": "tensent/wechat",
"description": "",
"authors": [
{
"name": "molong",
"email": "molong@tensent.cn"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Wechat\\": "app/",
"Modules\\Wechat\\Database\\Factories\\": "database/factories/",
"Modules\\Wechat\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Wechat\\Tests\\": "tests/"
}
}
}

View File

View File

@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Wechat',
];

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('member_social', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->unsignedBigInteger('member_id')->comment('会员id');
$table->string('type', 20)->comment('第三方类型');
$table->string('openid', 50)->comment('第三方openid');
$table->string('nickname')->comment('昵称');
$table->string('avatar')->nullable()->comment('头像');
$table->string('gender', 10)->nullable()->comment('性别');
$table->string('country', 50)->nullable()->comment('国家');
$table->string('province', 50)->nullable()->comment('省份');
$table->string('city', 50)->nullable()->comment('城市');
$table->string('language', 50)->nullable()->comment('语言');
$table->string('unionid', 50)->nullable()->comment('第三方unionid');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员第三方登录表');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('member_social');
}
};

View File

View File

@@ -0,0 +1,22 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Database\Seeders;
use Illuminate\Database\Seeder;
class WechatDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "Wechat",
"alias": "wechat",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Wechat\\Providers\\WechatServiceProvider"
],
"files": []
}

View File

@@ -0,0 +1,15 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"sass": "^1.69.5",
"postcss": "^8.3.7",
"vite": "^4.0.0"
}
}

View File

@@ -0,0 +1,7 @@
@extends('wechat::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('wechat.name') !!}</p>
@endsection

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Wechat Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-wechat', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-wechat', 'resources/assets/js/app.js') }} --}}
</body>

View File

View File

@@ -0,0 +1,9 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
use Illuminate\Support\Facades\Route;

View File

@@ -0,0 +1,31 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
use Illuminate\Support\Facades\Route;
use Modules\Wechat\Controllers\Api\Index;
Route::post('/wechat/login', [Index::class, 'login']);
Route::post('/wechat/oauth', [Index::class, 'oauth']);
Route::get('serve', [Index::class, 'serve']);
Route::name('wechat.')->prefix('wechat')->middleware(['auth.check:api'])->group(function () {
Route::get('jssdk', [Index::class, 'jssdk']);
Route::get('phone', [Index::class, 'phone']);
Route::get('invitecode', [Index::class, 'invitecode']);
Route::controller(Modules\Wechat\Controllers\Api\Pay::class)->prefix('pay')->name('pay.')->group(function () {
Route::post('miniapp', 'miniapp')->name('miniapp');
});
});
Route::name('wechat.')->prefix('wechat')->middleware(['auth.check:doctor'])->group(function () {
Route::controller(Modules\Wechat\Controllers\Api\Index::class)->prefix('index')->name('index.')->group(function () {
Route::get('qrcode', 'qrcode')->name('qrcode');
});
});

View File

@@ -0,0 +1,9 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
use Illuminate\Support\Facades\Route;

View File

@@ -0,0 +1,26 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
outDir: '../../public/build-wechat',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-wechat',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
//export const paths = [
// 'Modules/Wechat/resources/assets/sass/app.scss',
// 'Modules/Wechat/resources/assets/js/app.js',
//];