mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-11-12 12:50:48 +00:00
【程序目录】优化隐私协议
This commit is contained in:
parent
510277f9ce
commit
ae17f903c0
54
crmeb/app/adminapi/controller/v1/setting/SystemAgreement.php
Normal file
54
crmeb/app/adminapi/controller/v1/setting/SystemAgreement.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\v1\setting;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
use app\services\other\AgreementServices;
|
||||
use think\facade\App;
|
||||
|
||||
class SystemAgreement extends AuthController
|
||||
{
|
||||
/**
|
||||
* 构造方法
|
||||
* SystemCity constructor.
|
||||
* @param App $app
|
||||
* @param AgreementServices $services
|
||||
*/
|
||||
public function __construct(App $app, AgreementServices $services)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取协议内容
|
||||
* @param $type
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getAgreement($type)
|
||||
{
|
||||
if (!$type) return app('json')->fail('协议类型不存在');
|
||||
$info = $this->services->getAgreementBytype($type);
|
||||
return app('json')->success($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存协议内容
|
||||
* @return mixed
|
||||
*/
|
||||
public function saveAgreement()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['id', 0],
|
||||
['type', 0],
|
||||
['title', ''],
|
||||
['content', ''],
|
||||
]);
|
||||
$data['status'] = 1;
|
||||
$this->services->saveAgreement($data, $data['id']);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
}
|
||||
@ -148,6 +148,10 @@ Route::group('setting', function () {
|
||||
//修改消息状态
|
||||
Route::put('notification/set_status/:type/:status/:id', 'v1.setting.SystemNotification/set_status')->option(['real_name' => '修改消息状态']);
|
||||
|
||||
//协议设置
|
||||
Route::get('get_agreement/:type', 'v1.setting.SystemAgreement/getAgreement')->option(['real_name' => '获取协议内容']);
|
||||
Route::post('save_agreement', 'v1.setting.SystemAgreement/saveAgreement')->option(['real_name' => '设置协议内容']);
|
||||
|
||||
})->middleware([
|
||||
\app\http\middleware\AllowOriginMiddleware::class,
|
||||
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,
|
||||
|
||||
@ -15,6 +15,7 @@ use app\services\activity\combination\StorePinkServices;
|
||||
use app\services\diy\DiyServices;
|
||||
use app\services\message\service\StoreServiceServices;
|
||||
use app\services\order\DeliveryServiceServices;
|
||||
use app\services\other\AgreementServices;
|
||||
use app\services\other\CacheServices;
|
||||
use app\services\product\product\StoreCategoryServices;
|
||||
use app\services\product\product\StoreProductServices;
|
||||
@ -525,4 +526,19 @@ class PublicController
|
||||
$content = $cache->getDbCache('user_agreement', '');
|
||||
return app('json')->success(compact('content'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取协议
|
||||
* @param AgreementServices $agreementServices
|
||||
* @param $type
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getAgreement(AgreementServices $agreementServices, $type)
|
||||
{
|
||||
$data = $agreementServices->getAgreementBytype($type);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user