初始版本
This commit is contained in:
129
server/app/adminapi/lists/goods/GoodsCategoryLists.php
Executable file
129
server/app/adminapi/lists/goods/GoodsCategoryLists.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\goods;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
|
||||
class GoodsCategoryLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2023/4/12 10:13 上午
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
$category_ids = [];
|
||||
if (isset($this->params['name']) && $this->params['name'] != '') {
|
||||
$category_lists = GoodsCategory::field('id,pid')->where('name','like','%'.$this->params['name'].'%')->select()->toArray();
|
||||
if (empty($category_lists)) {
|
||||
return [];
|
||||
}
|
||||
$category_ids = array_column($category_lists,'id');
|
||||
foreach ($category_lists as $val) {
|
||||
if ($val['pid'] > 0) {
|
||||
$category_ids[] = $val['pid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($this->params['is_show']) && $this->params['is_show'] != '') {
|
||||
$category_lists = GoodsCategory::field('id,pid')->where('is_show','=',$this->params['is_show'])->select()->toArray();
|
||||
if (empty($category_lists)) {
|
||||
return [];
|
||||
}
|
||||
$ids_arr = array_column($category_lists,'id');
|
||||
foreach ($category_lists as $val) {
|
||||
if ($val['pid'] > 0) {
|
||||
$ids_arr[] = $val['pid'];
|
||||
}
|
||||
}
|
||||
if (!empty($category_ids)) {
|
||||
$category_ids = array_intersect($category_ids,$ids_arr);
|
||||
} else {
|
||||
$category_ids = $ids_arr;
|
||||
}
|
||||
}
|
||||
if (isset($this->params['is_recommend']) && $this->params['is_recommend'] != '') {
|
||||
$category_lists = GoodsCategory::field('id,pid')->where('is_recommend','=',$this->params['is_recommend'])->select()->toArray();
|
||||
if (empty($category_lists)) {
|
||||
return [];
|
||||
}
|
||||
$ids_arr = array_column($category_lists,'id');
|
||||
foreach ($category_lists as $val) {
|
||||
if ($val['pid'] > 0) {
|
||||
$ids_arr[] = $val['pid'];
|
||||
}
|
||||
}
|
||||
if (!empty($category_ids)) {
|
||||
$category_ids = array_intersect($category_ids,$ids_arr);
|
||||
} else {
|
||||
$category_ids = $ids_arr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($category_ids)) {
|
||||
$category_ids = array_unique($category_ids);
|
||||
$where[] = ['id','in',$category_ids];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务分类列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/8 3:51 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new GoodsCategory())->field('id,name,pid,level,image,sort,is_show,is_recommend,create_time')
|
||||
->where($this->where())
|
||||
->order(['sort'=>'desc','id'=>'asc'])
|
||||
->append(['recommend_desc','relevance_num'])
|
||||
->select()
|
||||
->toArray();
|
||||
$lists = linear_to_tree($lists,'sons');
|
||||
|
||||
// 分页
|
||||
$index = ($this->limitOffset -1) * $this->limitLength;
|
||||
$lists = array_slice($lists, $index, $this->limitLength);
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务分类数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/8 3:51 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new GoodsCategory())->where($this->where())->where(['level'=>1])->count();
|
||||
}
|
||||
}
|
||||
114
server/app/adminapi/lists/goods/GoodsCommentLists.php
Executable file
114
server/app/adminapi/lists/goods/GoodsCommentLists.php
Executable file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\goods;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\service\FileService;
|
||||
|
||||
class GoodsCommentLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/2/9 6:00 下午
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
$params = $this->params;
|
||||
if (isset($params['goods_info']) && $params['goods_info'] != '') {
|
||||
$where[] = ['g.name','like','%'.$params['goods_info'].'%'];
|
||||
}
|
||||
if (isset($params['user_info']) && $params['user_info'] != '') {
|
||||
$where[] = ['u.nickname','like','%'.$params['user_info'].'%'];
|
||||
}
|
||||
if (isset($params['status']) && $params['status'] != '') {
|
||||
$where[] = ['gc.status','=',$params['status']];
|
||||
}
|
||||
if (isset($params['comment_level']) && $params['comment_level'] != '') {
|
||||
switch ($params['comment_level']){
|
||||
case 'good'://好评
|
||||
$where[]= ['gc.service_comment', '>', 3];
|
||||
break;
|
||||
case 'medium'://中评
|
||||
$where[]= ['gc.service_comment', '=', 3];
|
||||
break;
|
||||
case 'bad'://差评
|
||||
$where[]= ['gc.service_comment', '<', 3];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isset($params['start_time']) && $params['start_time'] != '') {
|
||||
$where[] = ['gc.create_time','>=',strtotime($params['start_time'])];
|
||||
}
|
||||
if (isset($params['end_time']) && $params['end_time'] != '') {
|
||||
$where[] = ['gc.create_time','<=',strtotime($params['end_time'])];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务评价列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/9 6:00 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$where = self::where();
|
||||
|
||||
$lists = (new GoodsComment())->alias('gc')
|
||||
->join('user u', 'u.id = gc.user_id')
|
||||
->join('goods g', 'g.id = gc.goods_id')
|
||||
->field('gc.id,gc.goods_id,gc.user_id,gc.order_goods_id,gc.service_comment,gc.comment,gc.reply,gc.status,gc.create_time,g.name as goods_name,g.image as goods_image')
|
||||
->with(['user'])
|
||||
->order(['gc.id'=>'desc'])
|
||||
->where($where)
|
||||
->append(['comment_level','status_desc','goods_comment_image'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$list) {
|
||||
$list['goods_image'] = FileService::getFileUrl($list['goods_image']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务评价总数
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/9 5:59 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$where = self::where();
|
||||
return (new GoodsComment())->alias('gc')->join('user u', 'u.id = gc.user_id')->join('goods g', 'g.id = gc.goods_id')->where($where)->count();
|
||||
}
|
||||
}
|
||||
202
server/app/adminapi/lists/goods/GoodsLists.php
Executable file
202
server/app/adminapi/lists/goods/GoodsLists.php
Executable file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\goods;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
use app\common\model\goods\GoodsSkillIndex;
|
||||
|
||||
class GoodsLists extends BaseAdminDataLists implements ListsExtendInterface
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/11/24 11:00
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
$shopId = 0;
|
||||
$coachId = $this->params['coach_id'] ?? 0;
|
||||
if($coachId){
|
||||
$shopId = Coach::where(['id'=>$coachId])->value('shop_id');
|
||||
}
|
||||
if($shopId){
|
||||
$where[] = ['shop_id','in',[0,$shopId]];
|
||||
}else{
|
||||
$where[] = ['shop_id','=',0];
|
||||
}
|
||||
|
||||
if (isset($this->params['name']) && $this->params['name'] != '') {
|
||||
$where[] = ['name','like','%'.$this->params['name'].'%'];
|
||||
}
|
||||
if (isset($this->params['status']) && $this->params['status'] != '') {
|
||||
switch ($this->params['status']) {
|
||||
case 1://销售中
|
||||
$where[] = ['status','=',1];
|
||||
break;
|
||||
case 2://仓库中
|
||||
$where[] = ['status','=',0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$auditStatus = $this->params['audit_status'] ?? 1;
|
||||
if('' != $auditStatus){
|
||||
$where[] = ['audit_status','=',$auditStatus];
|
||||
}
|
||||
if (isset($this->params['category_id']) && $this->params['category_id']) {
|
||||
$categoryIds = [];
|
||||
foreach ($this->params['category_id'] as $categoryId){
|
||||
$categoryIds[] = $categoryId;
|
||||
$category = GoodsCategory::where(['id'=>$categoryId])->findOrEmpty();
|
||||
if(1 == $category['level']){
|
||||
$categoryId = GoodsCategory::where(['pid'=>$category['id']])->column('id');
|
||||
$categoryIds = array_merge($categoryId,$categoryIds);
|
||||
}
|
||||
}
|
||||
$where[] = ['category_id','in',implode(',',$categoryIds)];
|
||||
}
|
||||
|
||||
if (isset($this->params['second_id']) && $this->params['second_id']) {
|
||||
$where[] = ['category_id','=',$this->params['second_id']];
|
||||
}elseif (isset($this->params['first_id']) && $this->params['first_id']) {
|
||||
$category_lists = GoodsCategory::select()->toArray();
|
||||
$category_arr = [];
|
||||
foreach ($category_lists as $item) {
|
||||
$category_arr[$item['pid']][] = $item['id'];
|
||||
}
|
||||
$ids_arr = $category_arr[$this->params['first_id']] ?? '';
|
||||
$ids = $this->params['first_id'];
|
||||
if ($ids_arr) {
|
||||
$ids = implode(',',$ids_arr).','.$this->params['first_id'];
|
||||
}
|
||||
$where[] = ['category_id','in',$ids];
|
||||
}
|
||||
if(isset($this->params['skill_id']) && $this->params['skill_id']){
|
||||
$goodsIds = GoodsSkillIndex::where(['skill_id'=>$this->params['skill_id']])->column('goods_id');
|
||||
$where[] = ['id','in',$goodsIds];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/9 11:23 上午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$where = self::where();
|
||||
|
||||
$lists = (new Goods())
|
||||
->field('id,name,category_id,image,price,status,sort,order_num,create_time')
|
||||
->order(['sort'=>'desc','id'=>'desc'])
|
||||
->where($where)
|
||||
->append(['category_desc','status_desc','skill_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/9 11:24 上午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$where = self::where();
|
||||
return (new Goods())->where($where)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务数据统计
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/21 5:16 下午
|
||||
*/
|
||||
public function extend(): array
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['shop_id','=',0];
|
||||
if (isset($this->params['name']) && $this->params['name'] != '') {
|
||||
$where[] = ['name','like','%'.$this->params['name'].'%'];
|
||||
}
|
||||
if(isset($this->params['audit_status']) && '' != $this->params['audit_status']){
|
||||
$where[] = ['audit_status','=',$this->params['audit_status']];
|
||||
}
|
||||
if (isset($this->params['second_id']) && $this->params['second_id']) {
|
||||
$where[] = ['category_id','=',$this->params['second_id']];
|
||||
}elseif (isset($this->params['first_id']) && $this->params['first_id']) {
|
||||
$category_lists = GoodsCategory::select()->toArray();
|
||||
$category_arr = [];
|
||||
foreach ($category_lists as $item) {
|
||||
$category_arr[$item['pid']][] = $item['id'];
|
||||
}
|
||||
$ids_arr = $category_arr[$this->params['first_id']] ?? '';
|
||||
$ids = $this->params['first_id'];
|
||||
if ($ids_arr) {
|
||||
$ids = implode(',',$ids_arr).','.$this->params['first_id'];
|
||||
}
|
||||
|
||||
$where[] = ['category_id','in',$ids];
|
||||
}
|
||||
if(isset($this->params['skill_id']) && $this->params['skill_id']){
|
||||
$goodsIds = GoodsSkillIndex::where(['skill_id'=>$this->params['skill_id']])->column('goods_id');
|
||||
$where[] = ['id','in',$goodsIds];
|
||||
}
|
||||
$lists = (new Goods())->where($where)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$data['all_count'] = 0;
|
||||
$data['SHELVE'] = 0;
|
||||
$data['UNSHELVE'] = 0;
|
||||
foreach ($lists as $val) {
|
||||
$data['all_count'] += 1;
|
||||
|
||||
if ($val['status'] == 1) {
|
||||
$data['SHELVE'] += 1;
|
||||
}
|
||||
if ($val['status'] == 0) {
|
||||
$data['UNSHELVE'] += 1;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
58
server/app/adminapi/lists/goods/GoodsUnitLists.php
Executable file
58
server/app/adminapi/lists/goods/GoodsUnitLists.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\goods;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\goods\GoodsUnit;
|
||||
|
||||
class GoodsUnitLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 服务单位列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/8 11:06 上午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new GoodsUnit())->field('id,name,sort,create_time')
|
||||
->order(['sort'=>'desc','id'=>'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务单位数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/8 11:06 上午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new GoodsUnit())->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user