Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zptz-sass-kelaidian
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
李大见
zptz-sass-kelaidian
Commits
c27325f7
提交
c27325f7
authored
9月 20, 2024
作者:
李大见
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
供货价修改
上级
5f4e1cbb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
113 行增加
和
33 行删除
+113
-33
CommonController.php
app/Http/Controllers/Common/CommonController.php
+24
-2
CompanyController.php
app/Http/Controllers/Common/CompanyController.php
+6
-4
SupplierPriceController.php
app/Http/Controllers/Service/SupplierPriceController.php
+69
-21
SupplierPriceService.php
app/Services/SupplierPriceService.php
+14
-6
没有找到文件。
app/Http/Controllers/Common/CommonController.php
浏览文件 @
c27325f7
...
...
@@ -270,6 +270,20 @@ class CommonController extends BaseController
if
(
$session
[
'admin_groupnew'
]
!=
7
){
//管理员可以看全部
$where
[
'company_id_searchin'
]
=
$session
[
'com_parent_id'
];
}
if
(
$request
->
filled
(
'function'
))
{
if
(
$request
->
input
(
'function'
)
==
'supplierPrice'
)
{
$gh_price
=
DB
::
table
(
'gh_price'
)
->
where
(
'ser_id'
,
$request
->
input
(
'ser_id'
))
->
where
(
'company_id'
,
$request
->
input
(
'company_id'
))
->
where
(
'type'
,
$request
->
input
(
'type'
))
->
select
(
'goods_id'
)
->
get
()
->
toarray
();
$goods_id
=
array_column
(
$gh_price
,
'goods_id'
);
if
(
!
empty
(
$goods_id
))
{
$where
[
'pg_id_notin'
]
=
$goods_id
;
}
}
}
$list
=
GoodsService
::
getGoodsBy
(
$where
);
if
(
$list
){
return
$this
->
success
(
'操作成功'
,
$list
);
...
...
@@ -1274,7 +1288,15 @@ class CommonController extends BaseController
public
function
getCompany
(
Request
$request
){
$session
=
$request
->
get
(
'session_token'
);
$data
=
new
Company
();
$data
=
$data
->
where
(
'com_type'
,
1
)
->
where
(
'id'
,
'!='
,
1
)
->
select
(
'com_id'
,
'com_name'
)
->
get
()
->
toarray
();
$data
=
$data
->
where
(
'com_type'
,
1
)
->
where
(
'com_id'
,
'!='
,
1
)
->
where
(
function
(
$query
)
use
(
$request
)
{
if
(
!
empty
(
$request
[
'com_name'
]
))
{
$query
->
where
(
'com_name'
,
$request
[
'com_name'
]);
}
})
->
select
(
'com_id'
,
'com_name'
)
->
get
()
->
toarray
();
return
$this
->
success
(
'获取成功'
,
$data
);
}
...
...
@@ -1291,7 +1313,7 @@ class CommonController extends BaseController
{
$list
=
DB
::
table
(
'admin'
)
->
where
(
'admin_groupnew'
,
3
)
->
select
(
'id'
,
'admin_acc'
,
'admin_name'
)
->
select
(
'id'
,
'admin_acc'
,
'admin_name'
,
'company_name'
)
->
get
()
->
toarray
();
if
(
$list
){
return
$this
->
success
(
'操作成功'
,
$list
);
...
...
app/Http/Controllers/Common/CompanyController.php
浏览文件 @
c27325f7
...
...
@@ -79,8 +79,8 @@ class CompanyController extends BaseController
* @Time: 14:24
*/
public
function
addCom
(
Request
$request
){
$parameter
=
$request
->
only
(
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
);
$checkKey
=
CommonService
::
checkKey
([
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
],
$parameter
);
$parameter
=
$request
->
only
(
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
,
'com_brand'
);
$checkKey
=
CommonService
::
checkKey
([
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
,
'com_brand'
],
$parameter
);
if
(
$checkKey
[
'code'
]
!=
1
){
return
$this
->
error
(
'参数'
.
$checkKey
[
'data'
]
.
'未填写,或值为空'
,
ErrorInc
::
INVALID_PARAM
,
[]);
exit
;
}
...
...
@@ -95,6 +95,7 @@ class CompanyController extends BaseController
$dataArr
[
'com_start_time'
]
=
$parameter
[
'com_start_time'
];
$dataArr
[
'com_end_time'
]
=
$parameter
[
'com_end_time'
];
$dataArr
[
'com_name'
]
=
$parameter
[
'com_name'
];
$dataArr
[
'com_brand'
]
=
$parameter
[
'com_brand'
];
$dataArr
[
'com_parent_id'
]
=
$request
->
get
(
'session_token'
)[
'com_parent_id'
];
$res
=
Company
::
insert
(
$dataArr
);
...
...
@@ -116,8 +117,8 @@ class CompanyController extends BaseController
* @Time: 14:31
*/
public
function
editCom
(
Request
$request
){
$parameter
=
$request
->
only
(
'id'
,
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
);
$checkKey
=
CommonService
::
checkKey
([
'id'
,
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
],
$parameter
);
$parameter
=
$request
->
only
(
'id'
,
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
,
'com_brand'
);
$checkKey
=
CommonService
::
checkKey
([
'id'
,
'com_name'
,
'com_phone'
,
'com_start_time'
,
'com_end_time'
,
'com_brand'
],
$parameter
);
if
(
$checkKey
[
'code'
]
!=
1
){
return
$this
->
error
(
'参数'
.
$checkKey
[
'data'
]
.
'未填写,或值为空'
,
ErrorInc
::
INVALID_PARAM
,
[]);
exit
;
}
...
...
@@ -130,6 +131,7 @@ class CompanyController extends BaseController
$dataArr
[
'com_phone'
]
=
$request
->
input
(
'com_phone'
);
$dataArr
[
'com_start_time'
]
=
$request
->
input
(
'com_start_time'
);
$dataArr
[
'com_end_time'
]
=
$request
->
input
(
'com_end_time'
);
$dataArr
[
'com_brand'
]
=
$request
->
input
(
'com_brand'
);
$dataArr
[
'com_name'
]
=
$com_name
;
$dataArr
[
'com_update_id'
]
=
$request
->
get
(
'session_token'
)[
'id'
];
$dataArr
[
'com_update_time'
]
=
date
(
"Y-m-d H:i:s"
);
...
...
app/Http/Controllers/Service/SupplierPriceController.php
浏览文件 @
c27325f7
...
...
@@ -96,7 +96,7 @@ public function index(Request $request)
//根据权限格式化页面button
$token
=
$request
->
input
(
'token'
);
$priId
=
$request
->
input
(
'Pri_id'
);
$data
=
$this
->
dataService
->
formatPageContent
(
$token
,
$priId
,
$data
);
$data
=
$this
->
dataService
->
formatPageContent
(
$token
,
$priId
,
$data
,
$session
,
$request
);
}
$data
[
'service_type'
][]
=
[
'type'
=>
1
,
'name'
=>
'自营'
];
$data
[
'service_type'
][]
=
[
'type'
=>
2
,
'name'
=>
'平台'
];
...
...
@@ -132,32 +132,78 @@ public function index(Request $request)
* {"ErrorCode":1,"ErrorMessage":"","Data":[]}
*
*/
// public function store(Request $request)
// {
// $input = $request->only('goods_id', 'ser_id', 'supply_price', 'goods_name','remark');
// if ($this->validateRules) {
// $validate = validator()->make($input, $this->validateRules['create_rules'], $this->validateRules['messages'], $this->validateRules['attributes']);
// if ($validate->fails()) {
// $error = CommonService::validatorToString($validate);
// return $this->error($error, ErrorInc::INVALID_PARAM);
// }
// }
// $input['company_id'] = $request->get('session_token')['company_id'];
// //新增时直接查询是不是已经存在该服务商的指定商品签约价
// $exist = SupplierPriceService::checkExistPrice($input['ser_id'], $input['goods_id'],$input['company_id']);
// if ($exist) {
// return $this->error('选择的服务商已拥有该商品的供货价', ErrorInc::REPEAT_SUBMIT);
// }
// $data = $this->_setStore($input);
// $data['company_id'] = $request->get('session_token')['company_id'];
// $res = $this->dataService->create($data);
// if ($res) {
// $this->_afterStore($data);
// return $this->success('新增成功');
// } else {
// return $this->error('新增失败', ErrorInc::MYSQL_FAILED);
// }
// }
/**
* 新增供货价
* @authors ldj
* @email 909490343@qq.com
* @date 2024-09-20
* @param Request $request [description]
* @return [type] [description]
*/
public
function
store
(
Request
$request
)
{
$
input
=
$request
->
only
(
'goods_id'
,
'ser_id'
,
'supply_price'
,
'goods_name'
,
'remark
'
);
$
session
=
$request
->
get
(
'session_token
'
);
if
(
$this
->
validateRules
)
{
$validate
=
validator
()
->
make
(
$input
,
$this
->
validateRules
[
'create_rules'
],
$this
->
validateRules
[
'messages'
],
$this
->
validateRules
[
'attributes'
]);
if
(
$validate
->
fails
())
{
$error
=
CommonService
::
validatorToString
(
$validate
);
return
$this
->
error
(
$error
,
ErrorInc
::
INVALID_PARAM
);
}
if
(
$session
[
'admin_groupnew'
]
!=
7
)
{
$request
[
'company_id'
]
=
$session
[
'company_id'
];
}
$input
[
'company_id'
]
=
$request
->
get
(
'session_token'
)[
'company_id'
];
//新增时直接查询是不是已经存在该服务商的指定商品签约价
$exist
=
SupplierPriceService
::
checkExistPrice
(
$input
[
'ser_id'
],
$input
[
'goods_id'
],
$input
[
'company_id'
]);
if
(
$exist
)
{
return
$this
->
error
(
'选择的服务商已拥有该商品的供货价'
,
ErrorInc
::
REPEAT_SUBMIT
);
if
(
empty
(
$request
[
'goods_data'
]))
{
return
$this
->
error
(
'请选择商品'
,
ErrorInc
::
REPEAT_SUBMIT
);
}
$data
=
$this
->
_setStore
(
$input
);
$data
[
'company_id'
]
=
$request
->
get
(
'session_token'
)[
'company_id'
];
$res
=
$this
->
dataService
->
create
(
$data
);
if
(
$res
)
{
$this
->
_afterStore
(
$data
);
return
$this
->
success
(
'新增成功'
);
}
else
{
return
$this
->
error
(
'新增失败'
,
ErrorInc
::
MYSQL_FAILED
);
DB
::
beginTransaction
();
foreach
(
$request
[
'goods_data'
]
as
$key
=>
$value
)
{
$poss
[
'ser_id'
]
=
$request
[
'ser_id'
];
$poss
[
'goods_id'
]
=
$value
[
'goods_id'
];
$poss
[
'goods_name'
]
=
$value
[
'goods_name'
];
$poss
[
'company_id'
]
=
$request
[
'company_id'
];
$poss
[
'supply_price'
]
=
$value
[
'supply_price'
];
$poss
[
'remark'
]
=
$value
[
'remark'
];
$poss
[
'type'
]
=
$request
[
'type'
];
//新增时直接查询是不是已经存在该服务商的指定商品签约价
$exist
=
SupplierPriceService
::
checkExistPrice
(
$poss
[
'ser_id'
],
$poss
[
'goods_id'
],
$poss
[
'company_id'
]);
if
(
$exist
)
{
return
$this
->
error
(
'选择的服务商已拥有该商品的供货价'
,
ErrorInc
::
REPEAT_SUBMIT
);
}
$data
=
$this
->
_setStore
(
$poss
);
$res
=
$this
->
dataService
->
create
(
$data
);
if
(
$res
)
{
$this
->
_afterStore
(
$data
);
}
else
{
DB
::
rollback
();
return
$this
->
error
(
'新增失败'
,
ErrorInc
::
MYSQL_FAILED
);
}
}
DB
::
commit
();
return
$this
->
success
(
'新增成功'
);
}
/**
...
...
@@ -176,6 +222,8 @@ public function index(Request $request)
$arr
[
'remarks'
]
=
$input
[
'remark'
];
}
$arr
[
'gh_gname'
]
=
$input
[
'goods_name'
];
$arr
[
'company_id'
]
=
$input
[
'company_id'
];
$arr
[
'type'
]
=
$input
[
'type'
];
return
$arr
;
}
...
...
app/Services/SupplierPriceService.php
浏览文件 @
c27325f7
...
...
@@ -73,9 +73,9 @@ class SupplierPriceService extends Service
$Db
=
$Db
->
where
(
"create_time"
,
'<='
,
$time
);
}
if
(
!
empty
(
$param
[
'type'
]))
{
//结束时间
$Db
=
$Db
->
where
(
"type"
,
$param
[
'type'
]);
$Db
=
$Db
->
where
(
"
gh_price.
type"
,
$param
[
'type'
]);
}
if
(
$session
[
'admin_groupnew'
]
!=
7
){
//管理员可以看全部 && $session['admin_groupnew'] != 8
if
(
$session
[
'admin_groupnew'
]
!=
7
){
//管理员可以看全部 && $session['admin_groupnew'] != 8
$Db
=
$Db
->
where
(
"gh_price.company_id"
,
$session
[
'company_id'
]);
}
...
...
@@ -98,12 +98,16 @@ class SupplierPriceService extends Service
return
[
'list'
=>
$list
,
'totalPage'
=>
$totalPage
,
'count'
=>
$count
,
'page'
=>
$page
,
'page_size'
=>
$pageSize
];
}
public
function
formatPageContent
(
$token
,
$priID
,
$data
)
public
function
formatPageContent
(
$token
,
$priID
,
$data
,
$session
,
$request
)
{
$list
=
$data
[
'list'
];
//按钮-添加
$all_button
=
BmmcService
::
wherebutton
(
$token
,
$priID
);
$addPt
=
BmmcService
::
getTopButton
(
'addGhprice'
,
''
,
$all_button
);
if
((
$request
[
'type'
]
==
2
&&
$session
[
'admin_groupnew'
]
==
7
)
||
$request
[
'type'
]
==
1
)
{
$addPt
=
BmmcService
::
getTopButton
(
'addGhprice'
,
''
,
$all_button
);
}
else
{
$addPt
=
BmmcService
::
getTopButton
(
''
,
''
,
$all_button
);
}
$data
[
'button_top'
]
=
$addPt
[
'button_top'
]
??
[];
//顶部按钮
$data
[
'button_search'
]
=
$addPt
[
'button_search'
]
??
[];
//搜索栏按钮
...
...
@@ -118,8 +122,12 @@ class SupplierPriceService extends Service
}
else
{
$list
[
$kl
][
'type'
]
=
$vl
[
'pg_series'
]
.
'-'
.
$vl
[
'version'
];
}
$button
=
BmmcService
::
getListButton
([
'editGhprice, delGhPrice'
],
$all_button
);
//编辑,删除按钮
if
((
$request
[
'type'
]
==
2
&&
$session
[
'admin_groupnew'
]
==
7
)
||
$request
[
'type'
]
==
1
)
{
$button
=
BmmcService
::
getListButton
([
'editGhprice, delGhPrice'
],
$all_button
);
//编辑,删除按钮
}
else
{
$button
=
BmmcService
::
getListButton
([],
$all_button
);
//编辑,删除按钮
}
// $button = BmmcService::getListButton(['editGhprice, delGhPrice'], $all_button);//编辑,删除按钮
$list
[
$kl
][
'button_one'
]
=
$button
[
'button_one'
]
??
[];
$list
[
$kl
][
'button_two'
]
=
$button
[
'button_two'
]
??
[];
$list
[
$kl
][
'button_three'
]
=
$button
[
'button_three'
]
??
[];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论