chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
96
app/controller/supplier/system/Config.php
Normal file
96
app/controller/supplier/system/Config.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\controller\supplier\system;
|
||||
|
||||
|
||||
use app\controller\supplier\AuthController;
|
||||
use app\services\store\StoreConfigServices;
|
||||
use app\services\system\config\SystemConfigServices;
|
||||
use app\services\system\config\SystemConfigTabServices;
|
||||
use think\facade\App;
|
||||
use app\Request;
|
||||
|
||||
/**
|
||||
* Class Config
|
||||
* @package app\controller\supplier\system
|
||||
*/
|
||||
class Config extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* Config constructor.
|
||||
* @param App $app
|
||||
* @param SystemConfigServices $services
|
||||
*/
|
||||
public function __construct(App $app, SystemConfigServices $services)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门店配置
|
||||
* @param $type
|
||||
* @param StoreConfigServices $services
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfig($type, StoreConfigServices $services)
|
||||
{
|
||||
if (!isset(StoreConfigServices::CONFIG_TYPE[$type])) {
|
||||
return $this->fail('类型不正确');
|
||||
}
|
||||
return $this->success($services->getConfigAll(StoreConfigServices::CONFIG_TYPE[$type], 2, (int)$this->supplierId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param StoreConfigServices $services
|
||||
* @return mixed
|
||||
*/
|
||||
public function save(StoreConfigServices $services)
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$services->saveConfig($data,2, (int)$this->supplierId);
|
||||
\crmeb\services\SystemConfigService::clear();
|
||||
return $this->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础配置
|
||||
* @param Request $request
|
||||
* @param StoreConfigServices $services
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function edit_basics(Request $request, StoreConfigServices $services)
|
||||
{
|
||||
$name = $this->request->param('name', '');
|
||||
if (!$name) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$supplier_id = (int)$this->supplierId;
|
||||
return $this->success($services->getFormBuildRule($name, 2, $supplier_id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFormBuild(StoreConfigServices $services, string $type)
|
||||
{
|
||||
$supplier_id = (int)$this->supplierId;
|
||||
return $this->success($services->getFormBuildRule($type, 2, $supplier_id));
|
||||
}
|
||||
}
|
||||
133
app/controller/supplier/system/PrintDocument.php
Normal file
133
app/controller/supplier/system/PrintDocument.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller\supplier\system;
|
||||
|
||||
use app\controller\supplier\AuthController;
|
||||
use app\services\system\PrintDocumentServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
class PrintDocument extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var PrintDocumentServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected PrintDocumentServices $services;
|
||||
|
||||
/**
|
||||
* 打印机列表
|
||||
* @return \think\Response
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2024/8/21
|
||||
*/
|
||||
public function printList()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['type', 0],
|
||||
['keyword', ''],
|
||||
]);
|
||||
$where['supplier_id'] = $this->supplierId;
|
||||
return $this->success($this->services->printList($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印机添加表单
|
||||
* @param $id
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2024/8/21
|
||||
*/
|
||||
public function printForm($id)
|
||||
{
|
||||
return $this->success($this->services->printForm($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存打印机
|
||||
* @param $id
|
||||
* @return \think\Response
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2024/8/21
|
||||
*/
|
||||
public function printSave($id)
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['print_name', ''],
|
||||
['type', 0],
|
||||
['yly_user_id', ''],
|
||||
['yly_app_id', ''],
|
||||
['yly_app_secret', ''],
|
||||
['yly_sn', ''],
|
||||
['fey_user', ''],
|
||||
['fey_ukey', ''],
|
||||
['fey_sn', ''],
|
||||
['times', 1],
|
||||
['print_type', 1],
|
||||
['status', 1],
|
||||
]);
|
||||
$data['supplier_id'] = $this->supplierId;
|
||||
$this->services->printSave($id, $data);
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印机状态修改
|
||||
* @param $id
|
||||
* @param $status
|
||||
* @return \think\Response
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2024/8/21
|
||||
*/
|
||||
public function printSetStatus($id, $status)
|
||||
{
|
||||
$this->services->printSetStatus($id, $status);
|
||||
return $this->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除打印机
|
||||
* @param $id
|
||||
* @return \think\Response
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2024/8/21
|
||||
*/
|
||||
public function printDel($id)
|
||||
{
|
||||
$this->services->printDel($id);
|
||||
return $this->success('删除成功');
|
||||
}
|
||||
|
||||
public function getPrintContent($id)
|
||||
{
|
||||
return $this->success($this->services->getPrintContent($id));
|
||||
}
|
||||
|
||||
public function savePrintContent($id)
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['header', 0],
|
||||
['delivery', 0],
|
||||
['buyer_remarks', 0],
|
||||
['goods', []],
|
||||
['freight', 0],
|
||||
['preferential', []],
|
||||
['pay', []],
|
||||
['custom', 0],
|
||||
['order', []],
|
||||
['code', 0],
|
||||
['code_url', ''],
|
||||
['show_notice', 0],
|
||||
['notice_content', '']
|
||||
]);
|
||||
$this->services->savePrintContent($id, $data);
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
}
|
||||
151
app/controller/supplier/system/Supplier.php
Normal file
151
app/controller/supplier/system/Supplier.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\controller\supplier\system;
|
||||
|
||||
use app\controller\supplier\AuthController;
|
||||
use app\services\supplier\SystemSupplierServices;
|
||||
use app\services\system\admin\SystemAdminServices;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 供应商控制器
|
||||
* Class Supplier
|
||||
* @package app\controller\supplier
|
||||
*/
|
||||
class Supplier extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var SystemSupplierServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemSupplierServices $services;
|
||||
|
||||
/**
|
||||
* 获取供应商信息
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$info = $this->services->getSupplierInfo((int)$this->supplierId, 'id, supplier_name, name, phone, admin_id, email, address, province, city, area, street, detailed_address, sort, is_show, mark', ['admin']);
|
||||
$info->hidden(['roles', 'admin_is_del', 'admin_type', 'level','admin_id']);
|
||||
$info = $info->toArray();
|
||||
$info['pwd'] = '';
|
||||
return $this->success($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新供应商信息
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['supplier_name', ''],
|
||||
['name', ''],
|
||||
['phone', ''],
|
||||
['email', ''],
|
||||
['address', ''],
|
||||
['province', 0],
|
||||
['city', 0],
|
||||
['area', 0],
|
||||
['street', 0],
|
||||
['detailed_address', ''],
|
||||
['account', ''],
|
||||
['conf_pwd', ''],
|
||||
['pwd', ''],
|
||||
]);
|
||||
|
||||
$this->validate($data, \app\validate\supplier\SystemSupplierValidate::class, 'update');
|
||||
$data['address'] = str_replace([' ', '/', '\\'], '', $data['address']);
|
||||
$data['detailed_address'] = str_replace([' ', '/', '\\'], '', $data['detailed_address']);
|
||||
/** @var SystemAdminServices $adminServices */
|
||||
$adminServices = app()->make(SystemAdminServices::class);
|
||||
if (!$adminInfo = $adminServices->get($this->supplierInfo['admin_id'])) {
|
||||
return $this->fail('管理员不存在,无法修改');
|
||||
}
|
||||
if ($adminInfo->is_del) {
|
||||
return $this->fail('管理员已经删除');
|
||||
}
|
||||
//修改账号
|
||||
if (isset($data['account']) && $data['account'] !=$adminInfo->account && $adminServices->isAccountUsable($data['account'], $this->supplierInfo['admin_id'], 4)) {
|
||||
return $this->fail('管理员账号已存在');
|
||||
}
|
||||
if ($data['pwd']) {
|
||||
if (!$data['conf_pwd']) {
|
||||
return $this->fail('请输入确认密码');
|
||||
}
|
||||
|
||||
if ($data['conf_pwd'] != $data['pwd']) {
|
||||
return $this->fail('上次输入的密码不相同');
|
||||
}
|
||||
|
||||
$adminInfo->pwd = $adminServices->passwordHash($data['pwd']);
|
||||
|
||||
}
|
||||
$adminInfo->real_name = $data['name'] ?? $adminInfo->real_name;
|
||||
$adminInfo->phone = $data['phone'] ?? $adminInfo->phone;
|
||||
$adminInfo->account = $data['account'] ?? $adminInfo->account;
|
||||
|
||||
unset($data['account']);
|
||||
unset($data['pwd']);
|
||||
unset($data['conf_pwd']);
|
||||
|
||||
// 修改管理员
|
||||
$res = $adminInfo->save();
|
||||
if (!$res) return $this->fail('管理员修改失败');
|
||||
$this->services->update((int)$this->supplierId, $data);
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取供应商财务信息
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFinanceInfo()
|
||||
{
|
||||
$Info = $this->services->get((int)$this->supplierId);
|
||||
if (!$Info) {
|
||||
return app('json')->fail('供应商不存在');
|
||||
}
|
||||
return app('json')->success($Info->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置供应商财务信息
|
||||
* @return mixed
|
||||
*/
|
||||
public function setFinanceInfo()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['bank_code', ''],
|
||||
['bank_address', ''],
|
||||
['alipay_account', ''],
|
||||
['alipay_qrcode_url', ''],
|
||||
['wechat', ''],
|
||||
['wechat_qrcode_url', '']
|
||||
]);
|
||||
$Info = $this->services->get((int)$this->supplierId);
|
||||
if (!$Info) {
|
||||
return app('json')->fail('供应商不存在');
|
||||
}
|
||||
if ($this->services->update($Info['id'], $data)) {
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
174
app/controller/supplier/system/SupplierAdmin.php
Normal file
174
app/controller/supplier/system/SupplierAdmin.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\supplier\system;
|
||||
|
||||
use app\controller\supplier\AuthController;
|
||||
use app\services\supplier\SystemSupplierServices;
|
||||
use app\services\system\admin\SystemAdminServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* Class SystemAdmin
|
||||
* @package app\controller\admin\v1\setting
|
||||
*/
|
||||
class SupplierAdmin extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var SystemSupplierServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemSupplierServices $services;
|
||||
|
||||
/**
|
||||
* @var SystemAdminServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemAdminServices $adminServices;
|
||||
|
||||
/**
|
||||
* 显示管理员资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$where = [
|
||||
'is_del' => 1,
|
||||
'admin_type' => 4,
|
||||
'relation_id' => $this->supplierId,
|
||||
'level' => 1
|
||||
];
|
||||
return $this->success($this->adminServices->getAdminList($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表单
|
||||
* @return mixed
|
||||
* @throws \FormBuilder\Exception\FormBuilderException
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return $this->success($this->adminServices->createForm(0, '/admin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存管理员
|
||||
* @return mixed
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['account', ''],
|
||||
['phone', ''],
|
||||
['conf_pwd', ''],
|
||||
['pwd', ''],
|
||||
['real_name', ''],
|
||||
['phone', ''],
|
||||
['roles', []],
|
||||
['status', 0],
|
||||
['head_pic', ''],
|
||||
]);
|
||||
|
||||
$this->validate($data, \app\validate\admin\setting\SystemAdminValidate::class, 'supplier_save');
|
||||
$data['admin_type'] = 4;
|
||||
$data['relation_id'] = $this->supplierId;
|
||||
if ($this->adminServices->create($data)) {
|
||||
return $this->success('添加成功');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit(int $id)
|
||||
{
|
||||
if (!$id) {
|
||||
return $this->fail('管理员信息读取失败');
|
||||
}
|
||||
return $this->success($this->adminServices->updateForm(0, (int)$id, '/admin/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新管理员
|
||||
* @param int $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(int $id)
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['account', ''],
|
||||
['phone', ''],
|
||||
['conf_pwd', ''],
|
||||
['pwd', ''],
|
||||
['real_name', ''],
|
||||
['phone', ''],
|
||||
['roles', []],
|
||||
['status', 0],
|
||||
['head_pic', ''],
|
||||
]);
|
||||
|
||||
$this->validate($data, \app\validate\admin\setting\SystemAdminValidate::class, 'supplier_update');
|
||||
if ($this->adminServices->save($id, $data)) {
|
||||
return $this->success('修改成功');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员详情
|
||||
* @param int $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function read(int $id)
|
||||
{
|
||||
$info = $this->adminServices->get($id);
|
||||
if (!$info) {
|
||||
return $this->fail('获取失败');
|
||||
}
|
||||
return $this->success($info->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除管理员
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete(int $id)
|
||||
{
|
||||
if (!$id) {
|
||||
return $this->fail('删除失败,缺少参数');
|
||||
}
|
||||
|
||||
if ($this->adminServices->update($id, ['is_del' => 1, 'status' => 0])) {
|
||||
return $this->success('删除成功!');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param $id
|
||||
* @param $status
|
||||
* @return mixed
|
||||
*/
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
$this->adminServices->update((int)$id, ['status' => $status]);
|
||||
return $this->success($status == 0 ? '关闭成功' : '开启成功');
|
||||
}
|
||||
}
|
||||
67
app/controller/supplier/system/SupplierTicketPrint.php
Normal file
67
app/controller/supplier/system/SupplierTicketPrint.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\supplier\system;
|
||||
|
||||
use app\controller\supplier\AuthController;
|
||||
use app\services\supplier\SupplierTicketPrintServices;
|
||||
use think\annotation\Inject;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* Class SupplierTicketPrint
|
||||
* @package app\controller\supplier
|
||||
*/
|
||||
|
||||
class SupplierTicketPrint extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var SupplierTicketPrintServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected SupplierTicketPrintServices $services;
|
||||
|
||||
/**
|
||||
* 获取打印信息
|
||||
* @return \think\Response
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
return $this->success($this->services->getTicketInfo((int)$this->supplierId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新打印信息
|
||||
* @return void
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['develop_id', 0],
|
||||
['api_key', ''],
|
||||
['client_id', ''],
|
||||
['terminal_number', ''],
|
||||
['status', 0],
|
||||
]);
|
||||
|
||||
$this->validate($data, \app\validate\supplier\SupplierTicketPrintValidate::class, 'update');
|
||||
$this->services->savePrintData((int)$this->supplierId, $data);
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
}
|
||||
76
app/controller/supplier/system/form/SystemForm.php
Normal file
76
app/controller/supplier/system/form/SystemForm.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\controller\supplier\system\form;
|
||||
|
||||
|
||||
use app\controller\supplier\AuthController;
|
||||
use app\services\system\form\SystemFormServices;
|
||||
use think\facade\App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class SystemForm
|
||||
* @package app\controller\supplier\system\form
|
||||
*/
|
||||
class SystemForm extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* Diy constructor.
|
||||
* @param App $app
|
||||
* @param SystemFormServices $services
|
||||
*/
|
||||
public function __construct(App $app, SystemFormServices $services)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 所有系统表单
|
||||
*/
|
||||
public function allSystemForm()
|
||||
{
|
||||
$data = $this->services->getFormList([], ['id', 'name']);
|
||||
return $this->success($data['list'] ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一条数据
|
||||
* @param int $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo(int $id)
|
||||
{
|
||||
if (!$id) return $this->fail('数据不存在');
|
||||
[$type] = $this->request->postMore([
|
||||
['type', 0],
|
||||
], true);
|
||||
$info = $this->services->get($id);
|
||||
if ($info) {
|
||||
$info = $info->toArray();
|
||||
} else {
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
$info['value'] = json_decode($info['value'], true);
|
||||
if ($type == 1) {//处理表单数据
|
||||
$value = $info['value'] ?? [];
|
||||
$info = $this->services->handleForm($value);
|
||||
}
|
||||
return $this->success(compact('info'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user