初始版本
This commit is contained in:
45
server/app/shopapi/lists/BaseShopApiDataLists.php
Executable file
45
server/app/shopapi/lists/BaseShopApiDataLists.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?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\shopapi\lists;
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
|
||||
abstract class BaseShopApiDataLists extends BaseDataLists
|
||||
{
|
||||
protected int $shopId = 0;
|
||||
protected int $shopUserId = 0;
|
||||
protected array $shopInfo = [];
|
||||
|
||||
public string $export;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if (isset($this->request->shopInfo) && $this->request->shopInfo) {
|
||||
$this->shopInfo = $this->request->shopInfo;
|
||||
$this->shopId = $this->shopInfo['shop_id'] ?? 0;
|
||||
$this->shopUserId = $this->shopInfo['shop_user_id'] ?? 0;
|
||||
}
|
||||
$this->export = $this->request->get('export', '');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
51
server/app/shopapi/lists/CoachApplyLists.php
Executable file
51
server/app/shopapi/lists/CoachApplyLists.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\common\enum\shop\ShopEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\model\skill\Skill;
|
||||
use app\shopapi\lists\BaseShopApiDataLists;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class CoachController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class CoachApplyLists extends BaseShopApiDataLists{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$type = $this->params['type'] ?? 1;
|
||||
$where[] = ['SCA.shop_id','=',$this->shopId];
|
||||
$where[] = ['SCA.type','=',$type];
|
||||
$where[] = ['SCA.audit_status','=',ShopEnum::AUDIT_STATUS_WAIT];
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Coach::alias('C')
|
||||
->join('shop_coach_apply SCA','C.id = SCA.coach_id')
|
||||
->field('SCA.id,SCA.coach_id,SCA.type,C.name,C.good_comment,C.work_photo,C.order_num,C.skill_id')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->where($this->setWhere())
|
||||
->select()
|
||||
->toArray();
|
||||
$skillIds = array_column($lists,'skill_id');
|
||||
$skillLists = Skill::where(['id'=>$skillIds])->column('name','id');
|
||||
foreach ($lists as $key => $coach){
|
||||
$lists[$key]['good_comment'] = $coach['good_comment'].'%';
|
||||
$lists[$key]['skill_name'] = $skillLists[$coach['skill_id']] ?? '';
|
||||
}
|
||||
return $lists;
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Coach::alias('C')
|
||||
->join('shop_coach_apply SCA','C.id = SCA.coach_id')
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
}
|
||||
97
server/app/shopapi/lists/CoachOrderLists.php
Executable file
97
server/app/shopapi/lists/CoachOrderLists.php
Executable file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\enum\shop\ShopEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\order\Order;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* Class OrderLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class CoachOrderLists extends BaseShopApiDataLists implements ListsExtendInterface
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where[] = ['order_status','in',[
|
||||
OrderEnum::ORDER_STATUS_WAIT_RECEIVING,
|
||||
OrderEnum::ORDER_STATUS_WAIT_DEPART,
|
||||
OrderEnum::ORDER_STATUS_DEPART,
|
||||
OrderEnum::ORDER_STATUS_START_SERVER,
|
||||
OrderEnum::ORDER_STATUS_ARRIVE,
|
||||
// OrderEnum::ORDER_STATUS_SERVER_FINISH
|
||||
]];
|
||||
$where[] = ['pay_status','=',PayEnum::ISPAID];
|
||||
$coachId = $this->params['coach_id'] ?? '';
|
||||
if($coachId){
|
||||
$where[] = ['coach_id','=',$coachId];
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
}else{
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
}
|
||||
if(isset($this->params['start_time']) && $this->params['start_time']){
|
||||
$where[] = ['create_time','>',strtotime($this->params['start_time'])];
|
||||
}
|
||||
if(isset($this->params['end_time']) && $this->params['end_time']){
|
||||
$where[] = ['create_time','<',strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Order::field('id,sn,order_status,user_remark,pay_status,appoint_time,total_order_amount,order_amount,user_remark,address_snap,server_finish_time,create_time,coach_id,order_distance')
|
||||
->order('appoint_time','asc')
|
||||
->append(['order_distance_desc','appoint_time','appoint_date','order_status_desc','order_cancel_time'])
|
||||
->with(['order_goods' => function($query){
|
||||
$query->field('order_id,goods_snap,goods_num,duration,goods_image,goods_name,goods_price')->hidden(['goods_snap']);
|
||||
}])
|
||||
->where($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
return $lists;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
|
||||
return Order::where($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->count();
|
||||
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
|
||||
$where = $this->setWhere();
|
||||
unset($where[0]);
|
||||
$where = array_values($where);
|
||||
return [
|
||||
'wait_take_num' => Order::where($where)
|
||||
->where(['order_status'=>OrderEnum::ORDER_STATUS_WAIT_RECEIVING])
|
||||
->count(),
|
||||
'wait_server_num' => Order::where($where)
|
||||
->where('order_status','in',[
|
||||
OrderEnum::ORDER_STATUS_WAIT_DEPART,
|
||||
OrderEnum::ORDER_STATUS_DEPART,
|
||||
OrderEnum::ORDER_STATUS_START_SERVER,
|
||||
OrderEnum::ORDER_STATUS_ARRIVE
|
||||
])
|
||||
->count(),
|
||||
'wait_settle_num' => Order::where($where)
|
||||
->where('order_status','in',[OrderEnum::ORDER_STATUS_SERVER_FINISH,OrderEnum::ORDER_STATUS_CLOSE])
|
||||
->where(['is_settle'=>0])
|
||||
->whereRaw('total_order_amount>total_refund_amount')
|
||||
->count(),
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
104
server/app/shopapi/lists/CommentGoodsLists.php
Executable file
104
server/app/shopapi/lists/CommentGoodsLists.php
Executable file
@@ -0,0 +1,104 @@
|
||||
<?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\shopapi\lists;
|
||||
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderGoods;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\FileService;
|
||||
|
||||
class CommentGoodsLists extends BaseShopApiDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/2/18 2:25 下午
|
||||
*/
|
||||
public function setWhere()
|
||||
{
|
||||
$shopId = $this->shopId;
|
||||
$where = [];
|
||||
$id = $this->params['id'] ?? 0;
|
||||
switch ($id){
|
||||
case 1:
|
||||
$goodsCommentId = GoodsComment::alias('GC')
|
||||
->where(['shop_id'=>$shopId])
|
||||
->join('goods_comment_image GCI','GC.id = GCI.comment_id')
|
||||
->column('GC.id') ?: [];
|
||||
empty($goodsCommentId) && $goodsCommentId = [];
|
||||
$where[] = ['id','in',implode(',',$goodsCommentId)];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['service_comment','>',3];
|
||||
break;
|
||||
case 3:
|
||||
$where[] = ['service_comment','<=',3];
|
||||
break;
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 评价商品列表
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/2/21 5:59 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = GoodsComment::where(['shop_id'=>$this->shopId])
|
||||
->where($this->setWhere())
|
||||
->with(['goods_comment_image'])
|
||||
->field('id,user_id,service_comment,comment,reply,create_time')
|
||||
->order('id desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
$userIds = array_column($lists,'user_id');
|
||||
$userLists = [];
|
||||
if($userIds){
|
||||
$userLists = User::where(['id'=>$userIds])->field('id,nickname,avatar')->select()->toArray();
|
||||
$userLists = array_column($userLists,null,'id');
|
||||
}
|
||||
foreach ($lists as $key => $goodsComment){
|
||||
$lists[$key]['nickname'] = $userLists[$goodsComment['user_id']]['nickname'];
|
||||
$lists[$key]['avatar'] = $userLists[$goodsComment['user_id']]['avatar'];
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 评价商品总数
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/21 5:59 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return GoodsComment::where(['shop_id'=>$this->shopId])
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
||||
59
server/app/shopapi/lists/FinanceLists.php
Executable file
59
server/app/shopapi/lists/FinanceLists.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
|
||||
use app\common\enum\accountLog\ShopAccountLogEnum;
|
||||
use app\common\model\accountLog\ShopAccountLog;
|
||||
use app\common\model\shop\Shop;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
|
||||
/**
|
||||
* 财务管理列表
|
||||
* Class FinanceLists
|
||||
* @package app\shopapi\lists
|
||||
*/
|
||||
class FinanceLists extends BaseShopApiDataLists implements ListsExtendInterface
|
||||
{
|
||||
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$type = $this->params['type'] ?? '';
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
switch ($type){
|
||||
case 1:
|
||||
$where[] = ['change_type','in',ShopAccountLogEnum::MONEY_DESC];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['change_type','in',ShopAccountLogEnum::DEPOSIT_DESC];
|
||||
break;
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = ShopAccountLog::where(['shop_id'=>$this->shopId])
|
||||
->where($this->setWhere())
|
||||
->field('id,sn,action,change_object,change_type,change_amount,left_amount,create_time')
|
||||
->append(['change_type_desc'])
|
||||
->order('id desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return ShopAccountLog::where(['shop_id'=>$this->shopId])
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
$shop = Shop::where(['id'=>$this->shopId])->field('money,deposit')->findOrEmpty();
|
||||
return [
|
||||
'money' => $shop['money'],
|
||||
'deposit' => $shop['deposit'],
|
||||
];
|
||||
}
|
||||
}
|
||||
49
server/app/shopapi/lists/GoodsLists.php
Executable file
49
server/app/shopapi/lists/GoodsLists.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\coachapi\lists\BaseCoachApiDataLists;
|
||||
use app\common\enum\GoodsEnum;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
|
||||
/**
|
||||
* 服务列表
|
||||
* Class GoodsLists
|
||||
* @package app\shopapi\lists
|
||||
*/
|
||||
class GoodsLists extends BaseShopApiDataLists
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['status','=',1];
|
||||
$where[] = ['audit_status','=',GoodsEnum::AUDIT_STATUS_PASS];
|
||||
$where[] = ['shop_id','=',0];
|
||||
|
||||
if(isset($this->params['category_id']) && $this->params['category_id']){
|
||||
if(is_array(explode(',',$this->params['category_id']))) {
|
||||
$categoryIds = explode(',',$this->params['category_id']);
|
||||
}else{
|
||||
$categoryIds[] = $this->params['category_id'];
|
||||
}
|
||||
$categoryId = GoodsCategory::where(['pid'=>$categoryIds])->column('id');
|
||||
$categoryIds = array_merge($categoryId,$categoryIds);
|
||||
$where[] = ['category_id','in',$categoryIds];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Goods::where($this->setWhere())
|
||||
->field('id,name,image,status,price,audit_status,virtual_order_num+order_num as order_num')
|
||||
->append(['audit_status_desc','status_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Goods::where($this->setWhere())->count();
|
||||
}
|
||||
}
|
||||
98
server/app/shopapi/lists/IncomeLists.php
Executable file
98
server/app/shopapi/lists/IncomeLists.php
Executable file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
|
||||
use app\coachapi\lists\BaseCoachApiDataLists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\settle\Settle;
|
||||
use app\common\model\settle\SettleOrder;
|
||||
use app\common\model\shop\Shop;
|
||||
use think\facade\Db;
|
||||
|
||||
class IncomeLists extends BaseShopApiDataLists implements ListsExtendInterface
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
$type = $this->params['type'] ?? 1;
|
||||
$where[] = ['is_settle','=',$type];
|
||||
if(isset($this->params['start_time']) && $this->params['start_time']){
|
||||
$where[] = ['create_time','>',strtotime($this->params['start_time'])];
|
||||
}
|
||||
if(isset($this->params['end_time']) && $this->params['end_time']){
|
||||
$where[] = ['create_time','<',strtotime($this->params['end_time'])+86399];
|
||||
}
|
||||
$whereOr1 = array_merge($where,[['order_status','not in',[OrderEnum::ORDER_STATUS_WAIT_PAY,OrderEnum::ORDER_STATUS_WAIT_RECEIVING,OrderEnum::ORDER_STATUS_CLOSE]]],);
|
||||
$whereOr2 = array_merge($where, [
|
||||
['order_status','=',OrderEnum::ORDER_STATUS_CLOSE],
|
||||
['total_order_amount','exp',Db::raw('>total_refund_amount')],
|
||||
]);
|
||||
return [$whereOr1,$whereOr2];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
|
||||
$lists = Order::field('id,sn,order_status,total_refund_amount,total_order_amount,user_remark,pay_status,appoint_time,is_settle,total_num,order_amount,user_remark,address_snap,true_server_finish_time,server_finish_time,create_time,coach_id,order_distance')
|
||||
->order('id','desc')
|
||||
->append(['order_distance_desc','true_server_finish_time_desc','appoint_time','appoint_date','order_status_desc','order_cancel_time'])
|
||||
->with(['order_goods' => function($query){
|
||||
$query->field('order_id,goods_snap,duration,goods_num,goods_image,goods_name,goods_price')->hidden(['goods_snap']);
|
||||
}])
|
||||
->whereOr($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
$orderIds = array_column($lists,'id');
|
||||
$settleOrderLists = SettleOrder::where(['order_id'=>$orderIds])->column('*','order_id');
|
||||
foreach ($lists as $key => $order){
|
||||
$status = 0;
|
||||
$settleOrder = $settleOrderLists[$order['id']] ?? [];
|
||||
if($settleOrder){
|
||||
$status = 1;
|
||||
}
|
||||
$shopCommission = $settleOrder['shop_commission'] ?? 0;
|
||||
$shopCarAmount = $settleOrder['shop_car_amount'] ?? 0;
|
||||
$coachCommission = $settleOrder['coach_commission'] ?? 0;
|
||||
$coachCarAmount = $settleOrder['coach_car_amount'] ?? 0;
|
||||
|
||||
$lists[$key]['settle_info'] = [
|
||||
'status' => $status,
|
||||
'order_amount' => $settleOrder['order_amount'] ?? 0,
|
||||
'refund_amount' => $order['total_refund_amount'] ,
|
||||
'settle_car' => $settleOrder['shop_car_amount'] ?? 0 ,
|
||||
'settle_amount' => $settleOrder['total_commission'] ?? 0 ,
|
||||
'coach_settle' => $coachCommission,
|
||||
'shop_settle' => round($shopCommission-$shopCarAmount,2),
|
||||
];
|
||||
}
|
||||
return $lists;
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
|
||||
return Order::whereOr($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
|
||||
$type = $this->params['type'] ?? 1;
|
||||
if(1 == $type){
|
||||
$settleAmount = Order::whereOr($this->setWhere())->where(['is_settle'=>1])->value('sum(settle_shop_amount)') ?:0;
|
||||
}else{
|
||||
$settleAmount = Order::whereOr($this->setWhere())->value('sum(total_order_amount - total_refund_amount)') ?:0;
|
||||
}
|
||||
return [
|
||||
'settle_amount' => $settleAmount
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
41
server/app/shopapi/lists/MyGoodsLists.php
Executable file
41
server/app/shopapi/lists/MyGoodsLists.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\coachapi\lists\BaseCoachApiDataLists;
|
||||
use app\common\enum\GoodsEnum;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
use app\common\model\shop\ShopGoodsIndex;
|
||||
|
||||
/**
|
||||
* 服务列表
|
||||
* Class MyGoodsLists
|
||||
* @package app\shopapi\lists
|
||||
*/
|
||||
class MyGoodsLists extends BaseShopApiDataLists
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['status','=',1];
|
||||
$where[] = ['audit_status','=',GoodsEnum::AUDIT_STATUS_PASS];
|
||||
$goodsIds = ShopGoodsIndex::where(['shop_id'=>$this->shopId])->column('goods_id');
|
||||
empty($goodsIds) && $goodsIds = [];
|
||||
$where[] = ['id','in',implode(',',$goodsIds)];
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Goods::where($this->setWhere())
|
||||
->field('id,name,image,status,price,audit_status,virtual_order_num+order_num as order_num')
|
||||
->append(['audit_status_desc','status_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Goods::where($this->setWhere())->count();
|
||||
}
|
||||
}
|
||||
70
server/app/shopapi/lists/OrderLists.php
Executable file
70
server/app/shopapi/lists/OrderLists.php
Executable file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\coachapi\lists\BaseCoachApiDataLists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\order\Order;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* Class OrderLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class OrderLists extends BaseShopApiDataLists
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
$where[] = ['pay_status','=',PayEnum::ISPAID];
|
||||
if (isset($this->params['order_status']) && $this->params['order_status'] != '') {
|
||||
switch ($this->params['order_status']) {
|
||||
case 1:
|
||||
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_WAIT_RECEIVING];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['order_status','in',[OrderEnum::ORDER_STATUS_WAIT_DEPART,OrderEnum::ORDER_STATUS_DEPART,OrderEnum::ORDER_STATUS_START_SERVER,OrderEnum::ORDER_STATUS_ARRIVE]];
|
||||
break;
|
||||
case 3:
|
||||
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_SERVER_FINISH];
|
||||
break;
|
||||
case 4:
|
||||
$where[] = ['order_status','=',OrderEnum::ORDER_STATUS_CLOSE];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Order::field('id,sn,order_status,total_order_amount,user_remark,pay_status,appoint_time,order_amount,user_remark,address_snap,server_finish_time,create_time,coach_id,order_distance')
|
||||
->order('id','desc')
|
||||
->append(['order_distance_desc','appoint_time','appoint_date','order_status_desc','order_cancel_time'])
|
||||
->with(['order_goods' => function($query){
|
||||
$query->field('order_id,goods_snap,goods_num,duration,goods_image,goods_name,goods_price')->hidden(['goods_snap']);
|
||||
}])
|
||||
->where($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($lists as $key => $order){
|
||||
if(!isset($order['address_snap']['house_number'])){
|
||||
$lists[$key]['address_snap']['house_number'] = '';
|
||||
}
|
||||
}
|
||||
return $lists;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
|
||||
return Order::where($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->count();
|
||||
|
||||
}
|
||||
}
|
||||
45
server/app/shopapi/lists/ShopCoachLists.php
Executable file
45
server/app/shopapi/lists/ShopCoachLists.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\skill\Skill;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class CoachController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class ShopCoachLists extends BaseShopApiDataLists{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
if(isset($this->params['keyword']) && $this->params['keyword']){
|
||||
$where[] = ['keyword','like','%'.$this->params['keyword'].'%'];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Coach::where($this->setWhere())
|
||||
->field('id,name,good_comment,work_photo,order_num,location')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
// $ids = array_column($lists,'coach_id');
|
||||
// $skillIds = array_column($lists,'skill_id');
|
||||
// $skillLists = Skill::where(['id'=>$skillIds])->column('name','id');
|
||||
foreach ($lists as $key => $coach){
|
||||
$lists[$key]['good_comment'] = $coach['good_comment'].'%';
|
||||
// $lists[$key]['skill_name'] = $skillLists[$coach['skill_id']] ?? '';
|
||||
}
|
||||
return $lists;
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Coach::where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
}
|
||||
42
server/app/shopapi/lists/ShopGoodsLists.php
Executable file
42
server/app/shopapi/lists/ShopGoodsLists.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
use app\coachapi\lists\BaseCoachApiDataLists;
|
||||
use app\common\enum\GoodsEnum;
|
||||
use app\common\model\goods\Goods;
|
||||
|
||||
/**
|
||||
* 服务列表
|
||||
* Class GoodsShopLists
|
||||
* @package app\shopapi\lists
|
||||
*/
|
||||
class ShopGoodsLists extends BaseShopApiDataLists
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
// $where[] = ['status','=',1];
|
||||
// $where[] = ['audit_status','=',GoodsEnum::AUDIT_STATUS_PASS];
|
||||
$where[] = ['shop_id','=',$this->shopId];
|
||||
if(isset($this->params['category_id']) && $this->params['category_id']){
|
||||
$where[] = ['category_id','=',$this->params['category_id']];
|
||||
}
|
||||
if(isset($this->params['status']) && '' !== $this->params['status']){
|
||||
$where[] = ['audit_status','=',$this->params['status']];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Goods::where($this->setWhere())
|
||||
->field('id,name,image,audit_status,price,virtual_order_num+order_num as order_num,status')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Goods::where($this->setWhere())->count();
|
||||
}
|
||||
}
|
||||
58
server/app/shopapi/lists/WithdrawalLogLists.php
Executable file
58
server/app/shopapi/lists/WithdrawalLogLists.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace app\shopapi\lists;
|
||||
|
||||
use app\coachapi\lists\BaseCoachApiDataLists;
|
||||
use app\common\model\withdraw\WithdrawApply;
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
* Class LogLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class WithdrawalLogLists extends BaseShopApiDataLists
|
||||
{
|
||||
|
||||
public function setWhere(){
|
||||
$where = [];
|
||||
$where[] = ['source','=',2];
|
||||
$where[] = ['apply_type','=',$this->params['type'] ?? 1];
|
||||
$where[] = ['relation_id','=',$this->shopId];
|
||||
$status = $this->params['status'] ?? '';
|
||||
switch ($status){
|
||||
case 1:
|
||||
$where[] = ['status','=',1];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['status','=',4];
|
||||
break;
|
||||
case 3:
|
||||
$where[] = ['status','in',[2,5]];
|
||||
break;
|
||||
case 4:
|
||||
$where[] = ['status','in',[2,3,6]];
|
||||
break;
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = WithdrawApply::where($this->setWhere())
|
||||
->field('id,status,money,create_time')
|
||||
->append(['status_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($lists as $key => $log){
|
||||
$lists[$key]['desc'] = '提现';
|
||||
}
|
||||
return $lists;
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return WithdrawApply::where($this->setWhere())->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user