|
|
@@ -24,14 +24,16 @@ class LowPriceGoods extends Api
|
|
|
* @date 2025-12-09
|
|
|
*
|
|
|
*/
|
|
|
- public function list(Request $request, LowPriceGoodsModel $LowPriceGoodsModel, EmployeeModel $EmployeeModel,LowPriceGoodsMemberModel $LowPriceGoodsMemberModel)
|
|
|
+ public function list(Request $request, LowPriceGoodsModel $LowPriceGoodsModel, EmployeeModel $EmployeeModel, LowPriceGoodsMemberModel $LowPriceGoodsMemberModel)
|
|
|
{
|
|
|
$user_info = $this->checkLogin();
|
|
|
if (!$user_info) return json_send(['code' => 'error', 'msg' => '请先登录']);
|
|
|
$user_id = $user_info['uid'];
|
|
|
$request->scene('list')->validate();
|
|
|
+ $company_id = $user_info['company_id'];
|
|
|
// 查询条件
|
|
|
$map = [];
|
|
|
+ $map[] = ['company_id', '=', $company_id];
|
|
|
$limit = request('limit', config('page_num', 10));
|
|
|
$status = request('status', '');
|
|
|
$start_time = request('start_time', '');
|
|
|
@@ -53,47 +55,48 @@ class LowPriceGoods extends Api
|
|
|
if ($end_time) $map[] = ['insert_time', '<=', strtotime($end_time)];
|
|
|
// 其他条件
|
|
|
if ($product_name) $map[] = ['product_name', 'like', "%$product_name%"];
|
|
|
- if ($store_name) $map[] = ['store_name','like',"%$store_name%"];
|
|
|
+ if ($store_name) $map[] = ['store_name', 'like', "%$store_name%"];
|
|
|
+
|
|
|
|
|
|
//多选平台查询
|
|
|
- if($platform && is_string($platform)){
|
|
|
+ if ($platform && is_string($platform)) {
|
|
|
$platform = explode(',', $platform);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('platform', $platform);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('platform', $platform);
|
|
|
}
|
|
|
//多选处理状态查询
|
|
|
- if($processing_status && is_string($processing_status)){
|
|
|
+ if ($processing_status && is_string($processing_status)) {
|
|
|
$processing_status = explode(',', $processing_status);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('processing_status', $processing_status);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('processing_status', $processing_status);
|
|
|
}
|
|
|
//多选状态查询
|
|
|
- if($status && is_string($status)){
|
|
|
+ if ($status && is_string($status)) {
|
|
|
$status = explode(',', $status);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('status', $status);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('status', $status);
|
|
|
}
|
|
|
//多选店铺名称查询
|
|
|
- if($store_names && is_string($store_names)){
|
|
|
+ if ($store_names && is_string($store_names)) {
|
|
|
$store_names = explode(',', $store_names);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('store_name', $store_names);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('store_name', $store_names);
|
|
|
}
|
|
|
//多选违规挂网次数查询
|
|
|
- if($online_posting_count && is_string($online_posting_count)){
|
|
|
+ if ($online_posting_count && is_string($online_posting_count)) {
|
|
|
$online_posting_count = explode(',', $online_posting_count);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('online_posting_count', $online_posting_count);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('online_posting_count', $online_posting_count);
|
|
|
}
|
|
|
//多选规格查询
|
|
|
- if($product_specs && is_string($product_specs)){
|
|
|
+ if ($product_specs && is_string($product_specs)) {
|
|
|
$product_specs = explode(',', $product_specs);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('product_specs', $product_specs);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('product_specs', $product_specs);
|
|
|
}
|
|
|
//多选商品查询
|
|
|
if ($product_names && is_string($product_names)) {
|
|
|
$product_names = explode(',', $product_names);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('product_name', $product_names);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('product_name', $product_names);
|
|
|
}
|
|
|
//多选公司查询
|
|
|
if ($company_name && is_string($company_name)) {
|
|
|
$company_name = explode(',', $company_name);
|
|
|
- $LowPriceGoodsModel=$LowPriceGoodsModel->whereIn('company_name', $company_name);
|
|
|
+ $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('company_name', $company_name);
|
|
|
}
|
|
|
//多选第一责任人
|
|
|
if ($first_responsible_person && is_string($first_responsible_person)) {
|
|
|
@@ -123,12 +126,12 @@ class LowPriceGoods extends Api
|
|
|
// 查询数据
|
|
|
$result = $LowPriceGoodsModel->where($map)->where(function ($q) use ($user_id) {
|
|
|
$q->where('first_responsible_person', 'like', "%,$user_id,%")
|
|
|
- ->orWhere('responsible_person', 'like', "%,$user_id,%")
|
|
|
- ->orWhere('source_responsible_person', 'like', "%,$user_id,%");
|
|
|
+ ->orWhere('responsible_person', 'like', "%,$user_id,%")
|
|
|
+ ->orWhere('source_responsible_person', 'like', "%,$user_id,%");
|
|
|
})
|
|
|
- ->orderByDesc('id')
|
|
|
- ->paginate($limit)
|
|
|
- ->toArray();
|
|
|
+ ->orderByDesc('id')
|
|
|
+ ->paginate($limit)
|
|
|
+ ->toArray();
|
|
|
// 分配数据
|
|
|
if (!$result) return json_send(['code' => 'error', 'msg' => '暂无数据']);
|
|
|
if (isset($result['data']) && count($result['data']) > 0) {
|
|
|
@@ -162,9 +165,11 @@ class LowPriceGoods extends Api
|
|
|
$user_info = $this->checkLogin();
|
|
|
if (!$user_info) return json_send(['code' => 'error', 'msg' => '请先登录']);
|
|
|
$request->scene('detail')->validate();
|
|
|
+ $company_id = $user_info['company_id'];
|
|
|
// 接收参数
|
|
|
$id = request('id', 0);
|
|
|
$map = ['id' => $id];
|
|
|
+ $map['company_id'] = $company_id;
|
|
|
$data = $LowPriceGoodsModel->where($map)->first();
|
|
|
if (!$data) return json_send(['code' => 'error', 'msg' => '记录不存在']);
|
|
|
//查询第一责任人名称
|
|
|
@@ -194,6 +199,7 @@ class LowPriceGoods extends Api
|
|
|
{
|
|
|
$user_info = $this->checkLogin();
|
|
|
if (!$user_info) return json_send(['code' => 'error', 'msg' => '请先登录']);
|
|
|
+ $company_id = $user_info['company_id'];
|
|
|
// 验证参数
|
|
|
$request->scene('set_status')->validate();
|
|
|
// 接收数据
|
|
|
@@ -201,6 +207,7 @@ class LowPriceGoods extends Api
|
|
|
$status = request('status', 0);
|
|
|
// 查询用户
|
|
|
$where = ['id' => $id];
|
|
|
+ $where['company_id'] = $company_id;
|
|
|
// 执行修改
|
|
|
$result = $LowPriceGoodsModel->changeStatus($where, $status);
|
|
|
// 提示新增失败
|
|
|
@@ -220,6 +227,7 @@ class LowPriceGoods extends Api
|
|
|
{
|
|
|
$user_info = $this->checkLogin();
|
|
|
if (!$user_info) return json_send(['code' => 'error', 'msg' => '请先登录']);
|
|
|
+ $company_id = $user_info['company_id'];
|
|
|
// 验证参数
|
|
|
$request->scene('set_processing_status')->validate();
|
|
|
// 接收数据
|
|
|
@@ -227,6 +235,7 @@ class LowPriceGoods extends Api
|
|
|
$processing_status = request('processing_status', 0);
|
|
|
// 查询用户
|
|
|
$where = ['id' => $id];
|
|
|
+ $where['company_id'] = $company_id;
|
|
|
// 执行修改
|
|
|
$result = $LowPriceGoodsModel->changeProcessingStatus($where, $processing_status);
|
|
|
// 提示新增失败
|