初始版本

This commit is contained in:
贾祥聪
2025-08-19 14:16:51 +08:00
commit f937a1f9b9
4373 changed files with 359728 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
<?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\api\lists;
use app\common\enum\accountLog\AccountLogEnum;
use app\common\model\accountLog\AccountLog;
class AccountLogLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/6/9 10:20 上午
*/
public function where()
{
$where[] = ['user_id','=',$this->userId];
if (isset($this->params['change_object']) && $this->params['change_object'] != '') {
$where[] = ['change_object','=',$this->params['change_object']];
}else {
$where[] = ['change_object','=',AccountLogEnum::MONEY];
}
if (isset($this->params['action']) && $this->params['action'] != '') {
$where[] = ['action','=',$this->params['action']];
}
return $where;
}
/**
* @notes 账户明细列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/6/9 10:21 上午
*/
public function lists(): array
{
$lists = AccountLog::field('id,change_amount,change_type,remark,create_time,action')
->append(['change_type_desc'])
->where(self::where())
->limit($this->limitOffset, $this->limitLength)
->order('id','desc')
->select()
->toArray();
return $lists;
}
/**
* @notes 账户明细数量
* @return int
* @author ljj
* @date 2022/6/9 10:21 上午
*/
public function count(): int
{
return AccountLog::where(self::where())->count();
}
}

View File

@@ -0,0 +1,85 @@
<?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\api\lists;
use app\common\enum\AdEnum;
use app\common\enum\MenuEnum;
use app\common\lists\BaseDataLists;
use app\common\model\ad\Ad;
use app\common\model\goods\Goods;
class AdLists extends BaseDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/3/25 9:54 上午
*/
public function where()
{
$where[] = ['pid','=',$this->params['pid'] ?? 1];
$where[] = ['status','=',1];
return $where;
}
/**
* @notes 广告列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/25 9:54 上午
*/
public function lists(): array
{
$where = self::where();
$lists = Ad::field('id,name,pid,image,link_type,link_address')
->where($where)
->order(['sort'=>'desc','id'=>'desc'])
->select()
->toArray();
foreach ($lists as &$list) {
if ($list['link_type'] == AdEnum::LINK_SHOP) {
$shop_page = array_column(MenuEnum::SHOP_PAGE,NULL,'index');
$list['link_address'] = $shop_page[$list['link_address']]['path'];
}
}
return $lists;
}
/**
* @notes 广告数量
* @return int
* @author ljj
* @date 2022/3/25 9:55 上午
*/
public function count(): int
{
$where = self::where();
return Ad::where($where)->count();
}
}

View File

@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | likeshop100%开源免费商用商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | 商业版本务必购买商业授权,以免引起法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | 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团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshopTeam
// +----------------------------------------------------------------------
namespace app\api\lists;
use app\common\lists\BaseDataLists;
abstract class BaseApiDataLists extends BaseDataLists
{
protected array $userInfo = [];
protected int $userId = 0;
public string $export;
public function __construct()
{
parent::__construct();
if (isset($this->request->userInfo) && $this->request->userInfo) {
$this->userInfo = $this->request->userInfo;
$this->userId = $this->request->userId;
}
$this->export = $this->request->get('export', '');
}
}

View File

@@ -0,0 +1,107 @@
<?php
namespace app\api\lists;
use app\common\enum\coach\CoachEnum;
use app\common\logic\CityLogic;
use app\common\logic\CoachLogic;
use app\common\model\coach\Coach;
use app\common\model\coach\CoachGoodsIndex;
use app\common\model\coach\Collect;
use app\common\model\goods\GoodsComment;
use app\common\service\ConfigService;
/**
* 技师列表类
* Class CoachLists
* @package app\api\lists
*/
class CoachLists extends BaseApiDataLists
{
public $longitude = '';
public $latitude = '';
public $where = '';
public function setWhere()
{
$this->longitude = $this->params['longitude'] ?? '';
$this->latitude = $this->params['latitude'] ?? '';
$keyword = $this->params['keyword'] ?? '';
$skillId = $this->params['skill_id'] ?? '';
$goodsId = $this->params['goods_id'] ?? '';
$shopId = $this->params['shop_id'] ?? '';
$cityLists = CityLogic::getNearbyCity($this->longitude,$this->latitude);
$cityId = $cityLists[0]['city_id'] ?? '';
$where[] = ['city_id','=',$cityId];
$where[] = ['server_status','=',1];
$where[] = ['work_status','=',1];
$where[] = ['audit_status','=',CoachEnum::AUDIT_STATUS_PASS];
if($keyword){
$where[] = ['name','like','%'.$keyword.'%'];
}
if($skillId){
$where[] = ['skill_id','=',$skillId];
}
if($goodsId){
$coachId = CoachGoodsIndex::where(['goods_id'=>$goodsId])->column('coach_id');
empty($coachId) && $coachId = [0];
$where[] = ['id','in',implode(',',$coachId)];
}
if($shopId){
$where[] = ['shop_id','=',$shopId];
}
$this->where = $where;
}
/**
* @notes 技师列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author cjhao
* @date 2024/9/4 16:32
*/
public function lists(): array
{
$coachServerScope = ConfigService::get('server_setting', 'coach_server_scope');
$this->setWhere();
$field = 'id,work_status,work_photo,shop_id,name,round(st_distance_sphere(point('.$this->longitude.','.$this->latitude.'),
point(longitude, latitude))/1000,2) as distance,order_num,good_comment';
$coachLists = Coach::where($this->where)
->append(['distance_desc'])
->order('distance asc')
->limit($this->limitOffset, $this->limitLength)
->having('distance < '.$coachServerScope)
->field($field)
->select()
->toArray();
$userId = $this->userId;
$collect = '';
if($userId){
$collect = Collect::where(['user_id'=>$userId,'type'=>1])->value('relation_id');
}
$coachIds = array_column($coachLists,'id');
$collectLists = Collect::where(['type'=>1,'relation_id'=>$coachIds])
->group('relation_id')
->column('count(id) as num','relation_id');
$commentLists = GoodsComment::where(['coach_id'=>$coachIds])
->group('coach_id')
->column('count(id) as num','coach_id');
foreach ($coachLists as $key => $coach)
{
$coachLists[$key]['first_appoint'] = CoachLogic::getLatelyLeisureTime($coach['id']);
$coachLists[$key]['is_collect'] = $collect ? 1 : 0;
$coachLists[$key]['comment_num'] = $commentLists[$coach['id']] ?? 0;
$coachLists[$key]['good_comment'] = $coach['good_comment'].'%';
$coachLists[$key]['collect_num'] = $collectLists[$coach['id']] ?? 0;
}
return $coachLists;
}
public function count(): int
{
return Coach::where($this->where)->count();
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace app\api\lists;
use app\common\enum\GoodsEnum;
use app\common\logic\CoachLogic;
use app\common\model\coach\Coach;
use app\common\model\coach\Collect;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsCategory;
use app\common\model\goods\GoodsComment;
use app\common\model\shop\Shop;
class CollectLists extends BaseApiDataLists
{
public $where = [];
public function setWhere(){
$where[] = ['user_id','=',$this->userId];
$type = $this->params['type'] ?? 1;
// if(isset($type) && $type){
// }
$relationIds = Collect::where(['user_id'=>$this->userId,'type'=>$type])
->column('relation_id');
$this->where[] = ['id','in',$relationIds];
}
public function lists(): array
{
$this->setWhere();
$lists = [];
switch ($this->params['type']){
case 1:
$lists = Coach::where($this->where)
->append(['distance_desc'])
->order('distance asc')
->limit($this->limitOffset, $this->limitLength)
->field('id,work_status,shop_id,work_photo,name,round(st_distance_sphere(point('.$this->params['longitude'].','.$this->params['latitude'].'),
point(longitude, latitude))/1000,2) as distance,order_num,good_comment')
->select()
->toArray();
$collect = Collect::where(['user_id'=>$this->userId,'type'=>1])->value('relation_id');
$coachIds = array_column($lists,'id');
$collectLists = Collect::where(['type'=>1,'relation_id'=>$coachIds])
->group('relation_id')
->column('count(id) as num','relation_id');
foreach ($lists as $key => $coach)
{
$lists[$key]['first_appoint'] = CoachLogic::getLatelyLeisureTime($coach['id']);;
$lists[$key]['is_collect'] = $collect ? 1 : 0;
$lists[$key]['comment_num'] = GoodsComment::where(['coach_id'=>$coach['id']])->count('id');
$lists[$key]['good_comment'] = $coach['good_comment'].'%';
$lists[$key]['collect_num'] = $collectLists[$coach['id']] ?? 0;
}
break;
case 2:
$lists = Goods::field('id,name,image,tags,price,order_num+virtual_order_num as order_num,duration,scribing_price')
->where($this->where)
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
break;
case 3:
$lists = Shop::where($this->where)
->append(['distance_desc','categoryIds'])
->order('distance asc')
->field('id,name,good_comment,logo,round(st_distance_sphere(point('.$this->params['longitude'].','.$this->params['latitude'].'),
point(longitude, latitude))/1000,2) as distance,work_status')
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
$categoryLists = GoodsCategory::where(['is_show'=>1])->column('name','id');
foreach ($lists as $key => $coach)
{
$categoryNameLists = [];
foreach ($coach['categoryIds'] as $category){
$categoryNameLists[] = $categoryLists[$category['category_id']] ?? '';
}
$lists[$key]['consumption'] = '¥56';
$lists[$key]['category_name'] = $categoryNameLists;
}
break;
}
return $lists;
}
public function count(): int
{
return Coach::where($this->where)->count();
}
}

View File

@@ -0,0 +1,132 @@
<?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\api\lists;
use app\common\enum\OrderEnum;
use app\common\enum\YesNoEnum;
use app\common\lists\ListsExtendInterface;
use app\common\model\coach\Coach;
use app\common\model\goods\Goods;
use app\common\model\order\OrderGoods;
use app\common\service\FileService;
class CommentGoodsLists extends BaseApiDataLists implements ListsExtendInterface
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/2/18 2:25 下午
*/
public function setSearch()
{
$where = [];
$where[] = ['o.user_id', '=', $this->userId];
$where[] = ['o.order_status', '=', OrderEnum::ORDER_STATUS_SERVER_FINISH];
$where[] = ['og.is_comment','=',$this->params['type'] ?? 0];
return $where;
}
/**
* @notes 评价商品列表
* @return array
* @author ljj
* @date 2022/2/21 5:59 下午
*/
public function lists(): array
{
$lists = OrderGoods::alias('og')
->join('order o', 'o.id = og.order_id')
->join('goods_comment gc','gc.order_goods_id = og.id')
->field('og.id,o.coach_id,og.goods_id,og.goods_name,og.goods_price,og.is_comment,appoint_time,og.goods_snap,gc.create_time')
->append(['goods_comment'])
->where($this->setSearch())
->limit($this->limitOffset, $this->limitLength)
->order('gc.id','desc')
->group('og.id')
->select()
->toArray();
$goodsIds = array_column($lists,'goods_id');
$coachIds = array_column($lists,'coach_id');
$goodsLists = Goods::where(['id'=>$goodsIds])->column('tags,order_num','id');
$coachLists = Coach::where(['id'=>$coachIds])->column('name,work_photo','id');
foreach ($lists as &$list) {
$list['goods_snap']['image'] = FileService::getFileUrl($list['goods_snap']['image']);
$list['goods_snap']['tags'] = $goodsLists[$list['goods_id']]['tags'] ?? 0;
$list['goods_snap']['order_num'] = $goodsLists[$list['goods_id']]['order_num'] ?? 0;
$list['appoint_date'] = date('m-d',$list['appoint_time']);
$list['appoint_time'] = date('H:i',$list['appoint_time']);
$list['coach_info'] = $coachLists[$list['coach_id']] ?? [];
$list['coach_info']['work_photo'] = FileService::getFileUrl($list['coach_info']['work_photo'] ?? '');
}
return $lists;
}
/**
* @notes 评价商品总数
* @return int
* @author ljj
* @date 2022/2/21 5:59 下午
*/
public function count(): int
{
return OrderGoods::alias('og')
->join('order o', 'o.id = og.order_id')
->where($this->setSearch())
->group('og.id')
->count();
}
/**
* @notes 评价商品数据统计
* @return array
* @author ljj
* @date 2022/2/21 6:00 下午
*/
public function extend()
{
$waitWhere = [
['o.user_id', '=', $this->userId],
['o.order_status', '=', 3],
['og.is_comment', '=', YesNoEnum::NO],
];
$wait = OrderGoods::alias('og')
->leftJoin('order o', 'o.id = og.order_id')
->where($waitWhere)
->count();
$finishWhere = [
['o.user_id', '=', $this->userId],
['o.order_status', '=', 3],
['og.is_comment', '=', YesNoEnum::YES],
];
$finish = OrderGoods::alias('og')
->leftJoin('order o', 'o.id = og.order_id')
->Join('goods_comment go', 'og.id = go.order_goods_id')
->where($finishWhere)
->whereNull('go.delete_time')
->count();
return [
'wait' => $wait,
'finish' => $finish
];
}
}

View 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\api\lists;
use app\common\model\goods\GoodsCategory;
class GoodsCategoryLists extends BaseApiDataLists
{
/**
* @notes 服务分类列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/18 10:55 上午
*/
public function lists(): array
{
$lists = (new GoodsCategory())->field('id,pid,name,level,image')
->order(['sort'=>'desc','id'=>'asc'])
->where(['is_show'=>1])
->select()
->toArray();
$lists = linear_to_tree($lists,'sons');
return $lists;
}
/**
* @notes 服务分类总数
* @return int
* @author ljj
* @date 2022/2/18 10:55 上午
*/
public function count(): int
{
return (new GoodsCategory())->where(['is_show'=>1])->count();
}
}

View File

@@ -0,0 +1,94 @@
<?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\api\lists;
use app\common\model\goods\GoodsComment;
class GoodsCommentLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/2/18 11:18 上午
*/
public function setSearch()
{
$where= [];
$where[] = ['gc.goods_id','=',$this->params['goods_id'] ?? 0];
if (!isset($this->params['id']) || $this->params['id'] == '') {
return $where;
}
switch ($this->params['id']){
case 1://有图
$where[]= ['gci.uri','not null',''];
break;
case 2://好评
$where[]= ['gc.service_comment','>',3];
break;
case 3://中差评
$where[]= ['gc.service_comment','<=',3];
break;
default:
break;
}
return $where;
}
/**
* @notes 服务评价列表
* @return array
* @author ljj
* @date 2022/2/18 11:18 上午
*/
public function lists(): array
{
$lists = GoodsComment::alias('gc')
->leftjoin('goods_comment_image gci', 'gc.id = gci.comment_id')
->with(['goods_comment_image','user'])
->field('gc.id,gc.goods_id,gc.user_id,gc.service_comment,gc.comment,gc.reply,gc.create_time')
->append(['comment_level'])
->where($this->setSearch())
->limit($this->limitOffset, $this->limitLength)
->order('gc.id','desc')
->group('gc.id')
->select()
->toArray();
return $lists;
}
/**
* @notes 服务评价总数
* @return int
* @author ljj
* @date 2022/2/18 11:23 上午
*/
public function count(): int
{
return GoodsComment::alias('gc')
->leftjoin('goods_comment_image gci', 'gc.id = gci.comment_id')
->field('gc.id,gc.goods_id,gc.user_id,gc.service_comment,gc.comment,gc.reply')
->where($this->setSearch())
->count();
}
}

View File

@@ -0,0 +1,76 @@
<?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\api\lists;
use app\common\enum\GoodsEnum;
use app\common\model\goods\Goods;
class GoodsLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/2/17 5:18 下午
*/
public function setSearch(): array
{
return array_diff(array_keys($this->params), ['page_no', 'page_size']);
}
/**
* @notes 服务列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/17 5:17 下午
*/
public function lists(): array
{
$lists = Goods::field('id,name,image,scribing_price,duration,tags,price')
->withSearch($this->setSearch(), $this->params)
->where(['status'=>GoodsEnum::SHELVE])
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
foreach ($lists as &$list) {
$list['price'] = trim(rtrim(sprintf("%.4f", $list['price'] ), '0'),'.');
}
return $lists;
}
/**
* @notes 服务总数
* @return int
* @author ljj
* @date 2022/2/17 5:17 下午
*/
public function count(): int
{
return Goods::withSearch($this->setSearch(), $this->params)
->where(['status'=>GoodsEnum::SHELVE])
->count();
}
}

View File

@@ -0,0 +1,126 @@
<?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\api\lists;
use app\common\enum\GoodsEnum;
use app\common\model\coach\CoachGoodsIndex;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsComment;
use app\common\model\goods\GoodsSearchLog;
use app\common\model\HotSearch;
class IndexServerLists extends BaseApiDataLists
{
public $wehre = [];
public $sort = [];
public $sortRaw = 'sort desc,id desc';
public function setWhere()
{
$where[] = ['status','=',1];
$where[] = ['audit_status','=',GoodsEnum::AUDIT_STATUS_PASS];
$cityId = $this->params['city_id'] ?? '';
$keyword = $this->params['keyword'] ?? '';
$orderSales = $this->params['order_sales'] ?? '';
$commentSales = $this->params['comment_sales'] ?? '';
$price = $this->params['price'] ?? '';
$coachId = $this->params['coach_id'] ?? '';
$sort = [];
if($keyword){
$where[] = ['name','like','%'.$keyword.'%'];
}
if($orderSales){
$sort = ['order_num',$orderSales];
}
if($price){
$sort = ['price',$price];
}
if($coachId){
$goodsIds = CoachGoodsIndex::where(['coach_id'=>$coachId])->column('goods_id');
$where = ['id','in',$goodsIds];
}else{
$allCityGoodsIds = Goods::alias('G')
->leftjoin('goods_city_index GCI','G.id = GCI.goods_id')
->where(['GCI.id '=>null,'status'=>1])
->column('G.id');
$cityGoodsIds = Goods::alias('G')
->leftjoin('goods_city_index GCI','G.id = GCI.goods_id')
->where(['status'=>1,'city_id'=>$cityId])
->column('G.id');
$goodsIds = array_merge($allCityGoodsIds,$cityGoodsIds);
empty($goodsIds) && $goodsIds = [];
$where[] = ['id','in',implode(',',$goodsIds)];
}
if($sort){
$this->sortRaw = implode(' ',$sort);
}
if($commentSales){
$commentGoodsIds = GoodsComment::where('service_comment','>',3)->column('goods_id');
$goodsIds = Goods::where('id','not in',$commentGoodsIds)->order('sort desc,id desc')->column('id');
$goodsIds = array_merge($commentGoodsIds,$goodsIds);
$this->sortRaw = 'field(id,'.implode(',',$goodsIds).')';
}
// $sort['sort'] = 'desc';
$this->wehre = $where;
}
/**
* @notes 获取列表
* @return array
* @author cjhao
* @date 2024/9/3 23:13
*/
public function lists(): array
{
$this->setWhere();
$lists = Goods::where($this->wehre)
->field('id,name,image,price,scribing_price,duration,order_num+virtual_order_num as order_num')
->limit($this->limitOffset, $this->limitLength)
->orderRaw($this->sortRaw)
// ->order($this->sort)
->select()
->toArray();
$keyword = $this->params['keyword'] ?? '';
//记录搜索记录
if($this->userId && $keyword){
GoodsSearchLog::create([
'user_id' => $this->userId,
'keyword' => $keyword
]);
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author cjhao
* @date 2024/9/3 23:13
*/
public function count(): int
{
return Goods::where($this->wehre)
->count();
}
}

View 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\api\lists;
use app\common\enum\OrderEnum;
use app\common\model\coach\Coach;
use app\common\model\order\Order;
class OrderLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/2/28 9:31 上午
*/
public function where()
{
$where = [];
$where[] = ['user_id','=',$this->userId];
if (isset($this->params['order_status']) && $this->params['order_status'] != '') {
switch ($this->params['order_status']) {
case 1:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_WAIT_PAY];
break;
case 2:
$where[] = ['order_status','in',[OrderEnum::ORDER_STATUS_WAIT_RECEIVING,OrderEnum::ORDER_STATUS_ARRIVE,OrderEnum::ORDER_STATUS_DEPART]];
break;
case 3:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_START_SERVER];
break;
case 4:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_SERVER_FINISH];
break;
case 5:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_CLOSE];
break;
}
}
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/28 9:31 上午
*/
public function lists(): array
{
$lists = Order::field('id,sn,order_status,pay_status,total_order_amount,appoint_time,user_remark,address_snap,order_amount,server_finish_time,create_time,coach_id')
->order('id','desc')
->with(['order_goods' => function($query){
$query->field('id,order_id,goods_id,goods_snap,goods_num,duration,goods_image,goods_name,goods_price')->hidden(['goods_snap']);
}])
->append(['appoint_time','appoint_date','order_status_desc','pay_btn','gap_btn','append_btn','user_cancel_btn','del_btn','comment_btn','look_comment_btn','order_cancel_time'])
->where($this->where())
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
$coachIds = array_column($lists,'coach_id');
$coachLists = Coach::where(['id'=>$coachIds])
->field('name,work_photo,mobile,sn,id')->select()->toArray();
$coachLists = array_column($coachLists,null,'id');
foreach ($lists as $key => $order){
$lists[$key]['coach_info'] = [];
if(in_array($order['order_status'],[OrderEnum::ORDER_STATUS_DEPART,OrderEnum::ORDER_STATUS_ARRIVE,OrderEnum::ORDER_STATUS_START_SERVER,OrderEnum::ORDER_STATUS_SERVER_FINISH])){
$lists[$key]['coach_info'] = [
'name' => $coachLists[$order['coach_id']]['name'] ?? '',
'work_photo' => $coachLists[$order['coach_id']]['work_photo'] ?? '',
'sn' => $coachLists[$order['coach_id']]['sn'] ?? '',
'mobile' => $coachLists[$order['coach_id']]['mobile'] ?? ''
];
}
if(!isset($order['address_snap']['house_number'])){
$lists[$key]['address_snap']['house_number'] = '';
}
}
return $lists;
}
/**
* @notes 订单数量
* @return int
* @author ljj
* @date 2022/2/28 9:32 上午
*/
public function count(): int
{
return Order::where($this->where())->count();
}
}

View 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\api\lists;
use app\common\enum\PayEnum;
use app\common\model\RechargeOrder;
class RechargeLists extends BaseApiDataLists
{
/**
* @notes 充值记录列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/12/16 16:19
*/
public function lists(): array
{
$lists = RechargeOrder::field('order_amount,create_time')
->where(['user_id' => $this->userId,'pay_status' => PayEnum::ISPAID])
->order('id', 'desc')
->select()
->toArray();
return $lists;
}
/**
* @notes 充值记录数量
* @return int
* @author ljj
* @date 2022/12/16 16:20
*/
public function count(): int
{
return RechargeOrder::where(['user_id' => $this->userId,'pay_status' => PayEnum::ISPAID])->count();
}
}

View File

@@ -0,0 +1,111 @@
<?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\api\lists;
use app\common\enum\OrderEnum;
use app\common\enum\YesNoEnum;
use app\common\lists\ListsExtendInterface;
use app\common\model\coach\Coach;
use app\common\model\goods\Goods;
use app\common\model\order\Order;
use app\common\model\order\OrderGoods;
use app\common\model\user\User;
use app\common\service\FileService;
class ShopCommentGoodsLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/2/18 2:25 下午
*/
public function setSearch()
{
$shopId = $this->params['shop_id'];
$coachIds = Coach::where(['shop_id'=>$shopId])->field('id')->select()->toArray();
$coachIds = array_column($coachIds,'id');
$orderGoodsIds = Order::alias('O')
->join('order_goods OG','O.id = OG.order_id')
->where(['coach_id'=>$coachIds])
->field('OG.id')->select()->toArray();
$orderGoodsIds = array_column($orderGoodsIds,'id');
$where[] = ['og.id','in',$orderGoodsIds];
$where[] = ['o.order_status', '=', OrderEnum::ORDER_STATUS_SERVER_FINISH];
$where[] = ['og.is_comment','=',1];
return $where;
}
/**
* @notes 评价商品列表
* @return array
* @author ljj
* @date 2022/2/21 5:59 下午
*/
public function lists(): array
{
$lists = OrderGoods::alias('og')
->join('order o', 'o.id = og.order_id')
->field('o.user_id,og.id,coach_id,og.goods_id,og.goods_name,og.goods_price,og.is_comment,appoint_time,og.goods_snap')
->append(['goods_comment'])
->where($this->setSearch())
->limit($this->limitOffset, $this->limitLength)
->order('og.id','desc')
->group('og.id')
->select()
->toArray();
// $goodsIds = array_column($lists,'goods_id');
// $coachIds = array_column($lists,'coach_id');
// $goodsLists = Goods::where(['id'=>$goodsIds])->column('tags,order_num','id');
// $coachLists = Coach::where(['id'=>$coachIds])->column('name,work_photo','id');
$userIds = array_column($lists,'user_id');
$userLists = User::where(['id'=>$userIds])->column('id,nickname,avatar','id');
foreach ($lists as &$list) {
// $list['goods_snap']['image'] = FileService::getFileUrl($list['goods_snap']['image']);
// $list['goods_snap']['tags'] = $goodsLists[$list['goods_id']]['tags'];
// $list['goods_snap']['order_num'] = $goodsLists[$list['goods_id']]['order_num'];
// $list['appoint_date'] = date('m-d',$list['appoint_time']);
// $list['appoint_time'] = date('H:i',$list['appoint_time']);
// $list['coach_info'] = $coachLists[$list['coach_id']] ?? [];
$list['nickname'] = $userLists[$list['user_id']]['nickname'] ?? '';
$list['avatar'] = FileService::getFileUrl($userLists[$list['user_id']]['avatar'] ?? '');
}
return $lists;
}
/**
* @notes 评价商品总数
* @return int
* @author ljj
* @date 2022/2/21 5:59 下午
*/
public function count(): int
{
return OrderGoods::alias('og')
->join('order o', 'o.id = og.order_id')
->where($this->setSearch())
->group('og.id')
->select()
->count();
}
}

View File

@@ -0,0 +1,117 @@
<?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\api\lists;
use app\common\enum\AdEnum;
use app\common\enum\MenuEnum;
use app\common\enum\PayEnum;
use app\common\enum\shop\ShopEnum;
use app\common\lists\BaseDataLists;
use app\common\model\ad\Ad;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsCategory;
use app\common\model\order\Order;
use app\common\model\shop\Shop;
use app\common\model\shop\ShopCategoryIndex;
class ShopLists extends BaseDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/3/25 9:54 上午
*/
public function where()
{
$where = [];
if(isset($this->params['keyword']) && $this->params['keyword']){
$where[] = ['name','like','%'.$this->params['keyword'].'%'];
}
if(isset($this->params['category_id']) && $this->params['category_id']){
$shopIds = ShopCategoryIndex::where(['category_id'=>$this->params['category_id']])->column('shop_id');
empty($shopIds) && $shopIds = [];
$where[] = ['id','in',$shopIds];
}
if(isset($this->params['city_id']) && $this->params['city_id']){
$where[] = ['city_id','=',$this->params['city_id']];
}
$where[] = ['audit_status','=',ShopEnum::AUDIT_STATUS_PASS];
$where[] = ['server_status','=',ShopEnum::SERVERSTATUSOPEN];
return $where;
}
/**
* @notes 广告列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/25 9:54 上午
*/
public function lists(): array
{
$field = 'id,name,good_comment,logo,work_status,0 as distance';
if (!empty($params['longitude']) && !empty($params['latitude'])) {
$field = 'id,name,good_comment,logo,work_status,round(st_distance_sphere(point('.$this->params['longitude'].','.$this->params['latitude'].'),point(longitude, latitude))/1000,2) as distance';
}
$lists = Shop::where($this->where())
->append(['distance_desc','categoryIds','work_status_desc'])
->order('distance asc')
->field($field)
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
$categoryLists = GoodsCategory::where(['is_show'=>1])->column('name','id');
$consumptionLists = Order::where(['pay_status'=>PayEnum::ISPAID])
->where('shop_id','>',0)
->group('shop_id')
->column('round(sum(order_amount)/count(id),2) as consumption,shop_id');
$consumptionLists = array_column($consumptionLists,null,'shop_id');
foreach ($lists as $key => $shop)
{
$categoryNameLists = [];
foreach ($shop['categoryIds'] as $category){
$categoryNameLists[] = $categoryLists[$category['category_id']] ?? '';
}
$lists[$key]['consumption'] = $consumptionLists[$shop['id']]['consumption'] ?? 0;
$lists[$key]['category_name'] = $categoryNameLists;
}
return $lists;
}
/**
* @notes 广告数量
* @return int
* @author ljj
* @date 2022/3/25 9:55 上午
*/
public function count(): int
{
return Shop::where($this->where())
->count();
}
}

View File

@@ -0,0 +1,75 @@
<?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\api\lists;
use app\common\enum\DefaultEnum;
use app\common\model\staff\Staff;
class StaffLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return \string[][]
* @author ljj
* @date 2022/2/23 5:48 下午
*/
public function where(): array
{
$where[] = ['status','=',DefaultEnum::SHOW];
if (isset($this->params['name']) && $this->params['name'] != '') {
$where[] = ['name','like','%'.$this->params['name'].'%'];
}
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/23 5:56 下午
*/
public function lists(): array
{
$lists = Staff::field('id,user_id,name,goods_ids,province_id,city_id,district_id,address')
->where($this->where())
->append(['goods_name','user_image','province','city','district'])
->order(['id'=>'desc'])
->select()
->toArray();
return $lists;
}
/**
* @notes 师傅总数
* @return int
* @author ljj
* @date 2022/2/23 5:56 下午
*/
public function count(): int
{
return Staff::where($this->where())->count();
}
}

View File

@@ -0,0 +1,94 @@
<?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\api\lists;
use app\common\enum\OrderEnum;
use app\common\model\order\Order;
use app\common\model\staff\Staff;
class StaffOrderLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author ljj
* @date 2022/3/1 2:46 下午
*/
public function where()
{
$where = [];
$staff_id = Staff::where('user_id',$this->userId)->value('id');
$where[] = ['staff_id','=',$staff_id];
if (isset($this->params['order_status']) && $this->params['order_status'] != '') {
switch ($this->params['order_status']) {
case 1:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_APPOINT];
break;
case 2:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_SERVICE];
break;
case 3:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_FINISH];
break;
case 4:
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_CLOSE];
break;
}
}
return $where;
}
/**
* @notes 订单服务列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/1 3:01 下午
*/
public function lists(): array
{
$lists = Order::field('id,sn,order_status,pay_status,order_amount,appoint_time_start,appoint_time_end')
->order('id','desc')
->append(['appoint_time','appoint_week','order_status_desc','confirm_service_btn','verification_btn'])
->with(['order_goods' => function($query){
$query->field('order_id,goods_snap,goods_name')->append(['goods_image'])->hidden(['goods_snap']);
}])
->where($this->where())
->select()
->toArray();
return $lists;
}
/**
* @notes 订单服务数量
* @return int
* @author ljj
* @date 2022/3/1 3:12 下午
*/
public function count(): int
{
return Order::where($this->where())->count();
}
}