Skip to content

Commit 7b39419

Browse files
committed
feat: tecmz captcha and sms support
1 parent fdd20fe commit 7b39419

File tree

44 files changed

+761
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+761
-264
lines changed

config/module.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
'position' => '[{"k":"home","v":"首页"}]',
3838
],
3939
],
40+
'CaptchaTecmz' => [
41+
'enable' => true,
42+
],
43+
'SmsTecmz' => [
44+
'enable' => true,
45+
],
46+
'Cms' => [
47+
'enable' => true,
48+
],
4049
'Member' => [
4150
'enable' => true,
4251
'config' => [
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Module\CaptchaTecmz\Admin\Controller;
4+
5+
use Illuminate\Routing\Controller;
6+
use ModStart\Admin\Layout\AdminConfigBuilder;
7+
use Module\Vendor\Tecmz\TecmzUtil;
8+
9+
class ConfigController extends Controller
10+
{
11+
public function setting(AdminConfigBuilder $builder)
12+
{
13+
$builder->pageTitle('魔众智能验证码');
14+
$builder->display('CaptchaTecmz_Remark', '说明')->addable(true)
15+
->help('<div>访问 <a href="' . TecmzUtil::url() . '" target="_blank">' . TecmzUtil::url() . '</a> 申请</div>');
16+
$builder->text('CaptchaTecmz_AppId', 'AppId');
17+
$builder->text('CaptchaTecmz_AppSecret', 'AppSecret');
18+
return $builder->perform();
19+
}
20+
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
/* @var \Illuminate\Routing\Router $router */
4+
5+
$router->match(['get', 'post'], 'captcha_tecmz', 'IndexController@index');
6+
7+
$router->match(['get', 'post'], 'captcha_tecmz/config/setting', 'ConfigController@setting');
8+
9+
10+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
4+
namespace Module\CaptchaTecmz\Api\Controller;
5+
6+
7+
use Illuminate\Routing\Controller;
8+
use ModStart\Core\Input\Response;
9+
10+
class IndexController extends Controller
11+
{
12+
public function info()
13+
{
14+
$config = modstart_config();
15+
return Response::generateSuccessData([
16+
'appId' => $config->getWithEnv('CaptchaTecmz_AppId', '')
17+
]);
18+
}
19+
}

module/CaptchaTecmz/Api/routes.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/* @var \Illuminate\Routing\Router $router */
3+
$router->group([
4+
'middleware' => [
5+
\Module\Member\Middleware\ApiAuthMiddleware::class,
6+
],
7+
], function () use ($router) {
8+
9+
$router->match(['post'], 'captcha_tecmz/info', 'IndexController@info');
10+
11+
});
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace Module\CaptchaTecmz\Core;
4+
5+
use Illuminate\Events\Dispatcher;
6+
use Illuminate\Support\ServiceProvider;
7+
use ModStart\Admin\Config\AdminMenu;
8+
use Module\CaptchaTecmz\Provider\TecmzCaptchaProvider;
9+
use Module\Vendor\Provider\Captcha\CaptchaProvider;
10+
11+
class ModuleServiceProvider extends ServiceProvider
12+
{
13+
/**
14+
* Bootstrap any application services.
15+
*
16+
* @return void
17+
*/
18+
public function boot(Dispatcher $events)
19+
{
20+
AdminMenu::register(function () {
21+
return [
22+
[
23+
'title' => L('Site Manage'),
24+
'icon' => 'cog',
25+
'sort' => 400,
26+
'children' => [
27+
[
28+
'title' => '接口配置',
29+
'children' => [
30+
[
31+
'title' => '魔众智能验证码',
32+
'url' => '\Module\CaptchaTecmz\Admin\Controller\ConfigController@setting',
33+
],
34+
]
35+
]
36+
]
37+
]
38+
];
39+
});
40+
CaptchaProvider::register(TecmzCaptchaProvider::class);
41+
}
42+
43+
/**
44+
* Register any application services.
45+
*
46+
* @return void
47+
*/
48+
public function register()
49+
{
50+
51+
}
52+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 魔众智能验证码配置说明
2+
3+
---
4+
5+
## 申请接口信息
6+
7+
访问 [api.tecmz.com](https://api.tecmz.com) ,在用户中心 → 我的接口,购买开通「智能验证码」接口。
8+
9+
![](https://ms-assets.modstart.com/data/image/2022/10/06/43502_nqyi_4214.png)
10+
11+
在我的接口查看 `AppId``AppSecret`
12+
13+
![](https://ms-assets.modstart.com/data/image/2022/10/06/43257_chxm_1236.png)
14+
15+
## 后台配置接口参数
16+
17+
![](https://ms-assets.modstart.com/data/image/2022/10/06/43549_j8op_7880.png)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## 模块介绍
2+
3+
「魔众智能验证码」提供了一个基于人机交互的智能验证服务。
4+
5+
## 功能特性
6+
7+
告别传统验证码的单点防御,十道安全栅栏打造立体全面的安全验证。
8+
9+
## 轻松解决以下场景安全问题
10+
11+
### 登录注册
12+
13+
为你防护撞库攻击、阻止注册机批量注册
14+
15+
### 活动秒杀
16+
17+
有效拦截刷单操作,让羊毛党空手而归
18+
19+
### 点赞发帖
20+
21+
有效解决广告屠版、恶意灌水、刷票问题
22+
23+
### 数据保护
24+
25+
防止自动机、爬虫盗取网页内容和数据
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://ms-assets.modstart.com/data/image/2021/11/23/36152_ba3f_9710.jpg
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://ms-assets.modstart.com/data/image/2021/11/23/36152_nzqs_2657.jpg

0 commit comments

Comments
 (0)