feat: 添加批量采购询盘可选品类列表接口

This commit is contained in:
2025-03-14 10:43:54 +08:00
parent 94f870bc7c
commit 3e5a754580
3 changed files with 32 additions and 0 deletions

View File

@@ -4,12 +4,31 @@ declare (strict_types = 1);
namespace app\admin\controller\v1;
use app\admin\model\v1\BulkPurchaseInquiryModel;
use app\admin\model\v1\LanguageModel;
use app\admin\model\v1\SysConfigModel;
/**
* 批量采购询盘控制器
*/
class BulkPurchaseInquiry
{
// 采购可选品类
public function interested()
{
$config_name = 'bulk_purchase_inquiry_interested';
$lang = LanguageModel::bypk(request()->lang_id)->find();
if (empty($lang)) {
return error('当前选定语言出错');
}
$config = SysConfigModel::byName($lang->code . '_' . $config_name)->find();
if (empty($config)) {
return error('当前选定语言的采购可选品类配置出错');
}
return success('获取成功', explode(',', preg_replace('/\r?\n/', ',', $config->value)));
}
// 分页
public function index()
{

View File

@@ -47,4 +47,14 @@ class SysConfigModel extends SysConfigBaseModel
}
$query->where('group_id', '=', $value);
}
// 按name查询
public function scopeByName($query, $value)
{
if (is_array($value)) {
$query->where('name', 'in', $value);
return;
}
$query->where('name', '=', $value);
}
}

View File

@@ -530,6 +530,9 @@ Route::group('v1', function () {
// 反馈管理 - 批量采购底盘列表
Route::group('bp/inquiry', function() {
// 批量采购询盘可选品类
Route::get('interested', 'BulkPurchaseInquiry/interested');
// 批量采购底盘列表分页
Route::get('index', 'BulkPurchaseInquiry/index');