Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
0f8f18ce
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0f8f18ce
编写于
4月 18, 2022
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
细节优化
上级
581f40cb
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
131 addition
and
36 deletion
+131
-36
app/admin/form/User.php
app/admin/form/User.php
+3
-3
app/api/controller/Goods.php
app/api/controller/Goods.php
+2
-2
app/index/controller/Goods.php
app/index/controller/Goods.php
+6
-6
app/service/BuyService.php
app/service/BuyService.php
+3
-3
app/service/GoodsCommentsService.php
app/service/GoodsCommentsService.php
+2
-2
app/service/GoodsService.php
app/service/GoodsService.php
+108
-16
app/service/SearchService.php
app/service/SearchService.php
+1
-1
app/service/UserService.php
app/service/UserService.php
+4
-1
app/service/WarehouseGoodsService.php
app/service/WarehouseGoodsService.php
+2
-2
未找到文件。
app/admin/form/User.php
浏览文件 @
0f8f18ce
...
...
@@ -76,7 +76,7 @@ class User
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
User
SystemTypeList
(),
'data'
=>
$this
->
SystemTypeList
(),
'is_multiple'
=>
1
,
],
],
...
...
@@ -283,14 +283,14 @@ class User
}
/**
*
用户
系统类型列表
* 系统类型列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-04-14
* @desc description
*/
public
function
User
SystemTypeList
()
public
function
SystemTypeList
()
{
return
Db
::
name
(
'User'
)
->
group
(
'system_type'
)
->
column
(
'system_type'
,
'system_type'
);
}
...
...
app/api/controller/Goods.php
浏览文件 @
0f8f18ce
...
...
@@ -64,8 +64,8 @@ class Goods extends Common
// 获取商品
$params
=
[
'where'
=>
[
'id'
=>
$goods_id
,
'is_delete_time'
=>
0
,
[
'id'
,
'='
,
$goods_id
]
,
[
'is_delete_time'
,
'='
,
0
]
,
],
'is_photo'
=>
true
,
'is_spec'
=>
true
,
...
...
app/index/controller/Goods.php
浏览文件 @
0f8f18ce
...
...
@@ -50,8 +50,8 @@ class Goods extends Common
$goods_id
=
isset
(
$this
->
data_request
[
'id'
])
?
$this
->
data_request
[
'id'
]
:
0
;
$params
=
[
'where'
=>
[
'id'
=>
$goods_id
,
'is_delete_time'
=>
0
,
[
'id'
,
'='
,
$goods_id
]
,
[
'is_delete_time'
,
'='
,
0
]
,
],
'is_photo'
=>
true
,
'is_spec'
=>
true
,
...
...
@@ -125,8 +125,8 @@ class Goods extends Common
{
$params
=
[
'where'
=>
[
'is_delete_time'
=>
0
,
'is_shelves'
=>
1
,
[
'is_shelves'
,
'='
,
1
]
,
[
'is_delete_time'
,
'='
,
0
]
,
],
'order_by'
=>
'sales_count desc'
,
'field'
=>
'id,title,title_color,price,images'
,
...
...
@@ -139,8 +139,8 @@ class Goods extends Common
// 左侧商品 看了又看
$params
=
[
'where'
=>
[
'is_delete_time'
=>
0
,
'is_shelves'
=>
1
[
'is_shelves'
,
'='
,
1
]
,
[
'is_delete_time'
,
'='
,
0
],
],
'order_by'
=>
'access_count desc'
,
'field'
=>
'id,title,title_color,price,images'
,
...
...
app/service/BuyService.php
浏览文件 @
0f8f18ce
...
...
@@ -550,9 +550,9 @@ class BuyService
// 获取商品
$goods_params
=
array_merge
(
$params
,
[
'where'
=>
[
'id'
=>
intval
(
$params
[
'goods_id'
])
,
'is_delete_time'
=>
0
,
'is_shelves'
=>
1
,
[
'id'
,
'='
,
intval
(
$params
[
'goods_id'
])]
,
[
'is_delete_time'
,
'='
,
0
]
,
[
'is_shelves'
,
'='
,
1
]
,
],
'field'
=>
'id,id AS goods_id, title, images, inventory_unit, buy_min_number, buy_max_number, model'
,
]);
...
...
app/service/GoodsCommentsService.php
浏览文件 @
0f8f18ce
...
...
@@ -226,8 +226,8 @@ class GoodsCommentsService
{
$goods_params
=
[
'where'
=>
[
'id'
=>
array_unique
(
array_column
(
$data
,
'goods_id'
))
,
'is_delete_time'
=>
0
,
[
'id'
,
'in'
,
array_unique
(
array_column
(
$data
,
'goods_id'
))]
,
[
'is_delete_time'
,
'='
,
0
]
,
],
'field'
=>
'id,title,images,price,min_price'
,
];
...
...
app/service/GoodsService.php
浏览文件 @
0f8f18ce
...
...
@@ -217,12 +217,11 @@ class GoodsService
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
// 商品大分类
$
where
=
[
$
data
=
self
::
GoodsCategoryList
([
'where'
=>
[
[
'pid'
,
'='
,
0
],
[
'is_home_recommended'
,
'='
,
1
],
[
'is_enable'
,
'='
,
1
],
];
$data
=
self
::
GoodsCategoryList
([
'where'
=>
$where
]);
]]);
if
(
!
empty
(
$data
))
{
// 楼层左侧商品分类从配置中读取
...
...
@@ -275,6 +274,15 @@ class GoodsService
break
;
}
// 首页获取数据信息钩子
$hook_name
=
'plugins_service_home_floor_data_begin'
;
MyEventTrigger
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
$params
,
'data'
=>
&
$data
,
]);
// 根据分类获取楼层商品
foreach
(
$data
as
&
$v
)
{
...
...
@@ -288,12 +296,20 @@ class GoodsService
// 获取分类ids
$category_ids
=
self
::
GoodsCategoryItemsIds
([
$v
[
'id'
]],
1
);
// 获取商品ids
$where
=
[
'gci.category_id'
=>
$category_ids
,
'g.is_shelves'
=>
1
,
// 获取商品id
$goods_params
=
[
'where'
=>
[
[
'gci.category_id'
,
'in'
,
$category_ids
],
[
'g.is_shelves'
,
'='
,
1
],
[
'g.is_delete_time'
,
'='
,
0
],
],
'order_by'
=>
$order_by
,
'field'
=>
'g.id'
,
'n'
=>
$goods_count
,
'is_data_handle'
=>
0
,
];
$v
[
'goods_ids'
]
=
Db
::
name
(
'Goods'
)
->
alias
(
'g'
)
->
join
(
'goods_category_join gci'
,
'g.id=gci.goods_id'
)
->
where
(
$where
)
->
group
(
'g.id'
)
->
order
(
$order_by
)
->
limit
(
$goods_count
)
->
column
(
'g.id'
);
$res
=
self
::
CategoryGoodsList
(
$goods_params
);
$v
[
'goods_ids'
]
=
empty
(
$res
)
?
[]
:
array_column
(
$res
,
'id'
);
}
break
;
...
...
@@ -344,11 +360,15 @@ class GoodsService
$goods_list
=
[];
if
(
!
empty
(
$goods_ids
))
{
$where
=
[
[
'id'
,
'in'
,
array_unique
(
$goods_ids
)],
[
'is_shelves'
,
'='
,
1
],
];
$res
=
self
::
GoodsList
([
'where'
=>
$where
,
'm'
=>
0
,
'n'
=>
0
,
'field'
=>
'*'
]);
$res
=
self
::
GoodsList
([
'where'
=>
[
[
'id'
,
'in'
,
array_unique
(
$goods_ids
)],
[
'is_shelves'
,
'='
,
1
],
],
'm'
=>
0
,
'n'
=>
0
,
'field'
=>
'*'
]);
$goods_list
=
empty
(
$res
[
'data'
])
?
[]
:
array_column
(
$res
[
'data'
],
null
,
'id'
);
}
...
...
@@ -533,7 +553,12 @@ class GoodsService
$data
=
Db
::
name
(
'Goods'
)
->
alias
(
'g'
)
->
join
(
'goods_category_join gci'
,
'g.id=gci.goods_id'
)
->
field
(
$field
)
->
where
(
$where
)
->
group
(
'g.id'
)
->
order
(
$order_by
)
->
limit
(
$m
,
$n
)
->
select
()
->
toArray
();
// 数据处理
return
self
::
GoodsDataHandle
(
$data
,
$params
);
if
(
!
isset
(
$params
[
'is_data_handle'
])
||
$params
[
'is_data_handle'
]
==
1
)
{
$data
=
self
::
GoodsDataHandle
(
$data
,
$params
);
}
return
$data
;
}
/**
...
...
@@ -1085,8 +1110,10 @@ class GoodsService
'n'
=>
&
$n
,
]);
// 查询商品
$data
=
Db
::
name
(
'Goods'
)
->
field
(
$field
)
->
where
(
$where
)
->
order
(
$order_by
)
->
limit
(
$m
,
$n
)
->
select
()
->
toArray
();
// 数据处理
return
self
::
GoodsDataHandle
(
$data
,
$params
);
}
...
...
@@ -2642,7 +2669,6 @@ class GoodsService
// 获取分类下所有分类id
$ids
=
self
::
GoodsCategoryItemsIds
([
$params
[
'id'
]]);
$ids
[]
=
$params
[
'id'
];
// 开始删除
if
(
Db
::
name
(
'GoodsCategory'
)
->
where
([
'id'
=>
$ids
])
->
delete
())
...
...
@@ -3017,5 +3043,71 @@ class GoodsService
{
return
(
APPLICATION_CLIENT_TYPE
==
'pc'
)
?
MyUrl
(
'index/goods/index'
,
[
'id'
=>
$goods_id
])
:
'/pages/goods-detail/goods-detail?id='
.
$goods_id
;
}
/**
* 获取商品列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-07
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
GoodsSearchList
(
$params
=
[])
{
// 返回格式
$result
=
[
'page_total'
=>
0
,
'total'
=>
0
,
'data'
=>
[],
];
// 搜索条件
$where_base
=
empty
(
$params
[
'where_base'
])
?
[]
:
$params
[
'where_base'
];
$where_keywords
=
empty
(
$params
[
'where_keywords'
])
?
[]
:
$params
[
'where_keywords'
];
// 排序
$order_by
=
empty
(
$params
[
'order_by'
])
?
'access_count desc, sales_count desc, id desc'
:
$params
[
'order_by'
];
// 分页计算
$field
=
empty
(
$params
[
'field'
])
?
'*'
:
$params
[
'field'
];
$page
=
max
(
1
,
isset
(
$params
[
'page'
])
?
intval
(
$params
[
'page'
])
:
1
);
$m
=
empty
(
$params
[
'm'
])
?
0
:
imtval
(
$params
[
'm'
]);
$n
=
empty
(
$params
[
'n'
])
?
20
:
intval
(
$params
[
'n'
]);
// 商品搜索列表读取前钩子
$hook_name
=
'plugins_service_goods_search_list_begin'
;
MyEventTrigger
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
$params
,
'where_base'
=>
&
$where_base
,
'where_keywords'
=>
&
$where_keywords
,
'field'
=>
&
$field
,
'order_by'
=>
&
$order_by
,
'page'
=>
&
$page
,
'm'
=>
&
$m
,
'n'
=>
&
$n
,
]);
// 获取商品总数
$result
[
'total'
]
=
(
int
)
Db
::
name
(
'Goods'
)
->
where
(
$where_base
)
->
where
(
function
(
$query
)
use
(
$where_keywords
)
{
$query
->
whereOr
(
$where_keywords
);
})
->
count
();
// 获取商品列表
if
(
$result
[
'total'
]
>
0
)
{
// 查询数据
$goods
=
GoodsService
::
GoodsDataHandle
(
Db
::
name
(
'Goods'
)
->
field
(
$field
)
->
where
(
$where_base
)
->
where
(
function
(
$query
)
use
(
$where_keywords
)
{
$query
->
whereOr
(
$where_keywords
);
})
->
order
(
$order_by
)
->
limit
(
$m
,
$n
)
->
select
()
->
toArray
());
// 返回数据
$result
[
'data'
]
=
$goods
[
'data'
];
$result
[
'page_total'
]
=
ceil
(
$result
[
'total'
]
/
$n
);
}
return
DataReturn
(
'处理成功'
,
0
,
$result
);
}
}
?>
\ No newline at end of file
app/service/SearchService.php
浏览文件 @
0f8f18ce
...
...
@@ -41,7 +41,7 @@ class SearchService
'total'
=>
0
,
'data'
=>
[],
];
// 搜索条件
$where
=
self
::
SearchWhereHandle
(
$params
);
$where_base
=
$where
[
'base'
];
...
...
app/service/UserService.php
浏览文件 @
0f8f18ce
...
...
@@ -2262,7 +2262,10 @@ class UserService
public
static
function
UserBaseHandle
(
$data
,
$params
)
{
// 系统类型
$data
[
'system_type'
]
=
SystemService
::
SystemTypeValue
();
if
(
empty
(
$data
[
'system_type'
]))
{
$data
[
'system_type'
]
=
SystemService
::
SystemTypeValue
();
}
// 基础参数处理
if
(
!
empty
(
$params
)
&&
is_array
(
$params
))
...
...
app/service/WarehouseGoodsService.php
浏览文件 @
0f8f18ce
...
...
@@ -68,8 +68,8 @@ class WarehouseGoodsService
{
$goods_params
=
[
'where'
=>
[
'id'
=>
array_unique
(
array_column
(
$data
,
'goods_id'
))
,
'is_delete_time'
=>
0
,
[
'id'
,
'='
,
array_unique
(
array_column
(
$data
,
'goods_id'
))]
,
[
'is_delete_time'
,
'='
,
0
]
,
],
'field'
=>
'id,title,images,price,min_price'
,
'm'
=>
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录