初始版本
This commit is contained in:
45
server/app/coachapi/lists/BaseCoachApiDataLists.php
Executable file
45
server/app/coachapi/lists/BaseCoachApiDataLists.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\coachapi\lists;
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
|
||||
abstract class BaseCoachApiDataLists extends BaseDataLists
|
||||
{
|
||||
protected int $coachId = 0;
|
||||
protected int $coachUserId = 0;
|
||||
protected array $coachInfo = [];
|
||||
|
||||
public string $export;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if (isset($this->request->coachInfo) && $this->request->coachInfo) {
|
||||
$this->coachInfo = $this->request->coachInfo;
|
||||
$this->coachId = $this->coachInfo['coach_id'] ?? 0;
|
||||
$this->coachUserId = $this->coachInfo['coach_user_id'] ?? 0;
|
||||
}
|
||||
$this->export = $this->request->get('export', '');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
55
server/app/coachapi/lists/CoachOrderLists.php
Executable file
55
server/app/coachapi/lists/CoachOrderLists.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\order\Order;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* Class OrderLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class CoachOrderLists extends BaseCoachApiDataLists
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['coach_id','=',$this->coachId];
|
||||
$where[] = ['pay_status','=',PayEnum::ISPAID];
|
||||
$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
|
||||
]];
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Order::field('id,sn,order_status,user_remark,pay_status,appoint_time,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,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();
|
||||
|
||||
}
|
||||
}
|
||||
56
server/app/coachapi/lists/FinanceLists.php
Executable file
56
server/app/coachapi/lists/FinanceLists.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\accountLog\CoachAccountLog;
|
||||
use app\common\model\coach\Coach;
|
||||
|
||||
/**
|
||||
* 财务管理列表
|
||||
* Class FinanceLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class FinanceLists extends BaseCoachApiDataLists implements ListsExtendInterface
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['coach_id','=',$this->coachId];
|
||||
$type = $this->params['type'] ?? '';
|
||||
switch ($type){
|
||||
case 1:
|
||||
$where[] = ['change_type','in',CoachAccountLogEnum::MONEY_DESC];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['change_type','in',CoachAccountLogEnum::DEPOSIT_DESC];
|
||||
break;
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = CoachAccountLog::where($this->setWhere())
|
||||
->field('id,sn,action,change_object,change_type,action,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 CoachAccountLog::where($this->setWhere())->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
$coach = Coach::where(['id'=>$this->coachId])->field('deposit,money')->findOrEmpty();
|
||||
return [
|
||||
'money' => $coach['money'],
|
||||
'deposit' => $coach['deposit'],
|
||||
];
|
||||
}
|
||||
}
|
||||
68
server/app/coachapi/lists/GoodsCommentLists.php
Executable file
68
server/app/coachapi/lists/GoodsCommentLists.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace app\coachapi\lists;
|
||||
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 订单评论列表
|
||||
* Class GoodsComment
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class GoodsCommentLists extends BaseCoachApiDataLists
|
||||
{
|
||||
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$id = $this->params['id'] ?? 0;
|
||||
switch ($id){
|
||||
case 1:
|
||||
$coachOrderId = GoodsComment::alias('GC')
|
||||
->where(['GC.coach_id'=>$this->coachId])
|
||||
->join('goods_comment_image GCI','GC.id = GCI.comment_id')
|
||||
->column('GC.id') ?: [];
|
||||
$where[] = ['id','in',$coachOrderId];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['service_comment','>',3];
|
||||
break;
|
||||
case 3:
|
||||
$where[] = ['service_comment','<=',3];
|
||||
break;
|
||||
}
|
||||
return $where;
|
||||
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = GoodsComment::where(['coach_id'=>$this->coachId])
|
||||
->where($this->setWhere())
|
||||
->with(['goods_comment_image'])
|
||||
->field('id,user_id,service_comment,comment,reply,create_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id desc')
|
||||
->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;
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return GoodsComment::where(['coach_id'=>$this->coachId])
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
}
|
||||
52
server/app/coachapi/lists/GoodsLists.php
Executable file
52
server/app/coachapi/lists/GoodsLists.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
use app\common\enum\coach\CoachEnum;
|
||||
use app\common\enum\GoodsEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\coach\CoachGoodsIndex;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsSkillIndex;
|
||||
|
||||
class GoodsLists extends BaseCoachApiDataLists
|
||||
{
|
||||
public function setWhere(){
|
||||
$where = [];
|
||||
$where[] = ['status','=',1];
|
||||
$id = $this->params['id'] ?? 0;
|
||||
$isCoach = $this->params['is_coach'] ?? 0;
|
||||
$where[] = ['audit_status','=',GoodsEnum::AUDIT_STATUS_PASS];
|
||||
$shopId = Coach::where(['id'=>$this->coachId])->value('shop_id');
|
||||
if($shopId){
|
||||
$where[] = ['shop_id','in',[$shopId,0]];
|
||||
}else{
|
||||
$where[] = ['shop_id','=',0];
|
||||
}
|
||||
if($id){
|
||||
$goodsIds = GoodsSkillIndex::where(['skill_id'=>$id])->column('goods_id');
|
||||
empty($goodsIds) && $goodsIds = [];
|
||||
$where[] = ['id','in',implode(',',$goodsIds)];
|
||||
}
|
||||
if($isCoach){
|
||||
$goodsIds = CoachGoodsIndex::where(['coach_id'=>$this->coachId])->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,price')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Goods::where(['status'=>1])
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
}
|
||||
103
server/app/coachapi/lists/IncomeLists.php
Executable file
103
server/app/coachapi/lists/IncomeLists.php
Executable file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\settle\Settle;
|
||||
use app\common\model\settle\SettleOrder;
|
||||
use think\facade\Db;
|
||||
|
||||
class IncomeLists extends BaseCoachApiDataLists implements ListsExtendInterface
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['coach_id','=',$this->coachId];
|
||||
$type = $this->params['type'] ?? 1;
|
||||
if(1 == $type){
|
||||
$where[] = ['shop_id','=',0];
|
||||
}else{
|
||||
$where[] = ['shop_id','>',0];
|
||||
}
|
||||
$where[] = ['order_status','not in',[OrderEnum::ORDER_STATUS_WAIT_PAY,OrderEnum::ORDER_STATUS_WAIT_RECEIVING]];
|
||||
|
||||
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_order_amount,user_remark,pay_status,appoint_time,is_settle,total_num,order_amount,user_remark,total_refund_amount,address_snap,true_server_finish_time,server_finish_time,is_settle,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_image,goods_name,goods_price')->hidden(['goods_snap']);
|
||||
}])
|
||||
->whereOr($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
|
||||
$orderIds = array_column($lists,'id');
|
||||
$settleOrderLists = [];
|
||||
if($orderIds){
|
||||
$settleOrderLists = SettleOrder::where(['order_id'=>$orderIds])->column('*','order_id');
|
||||
}
|
||||
foreach ($lists as $key => $order){
|
||||
$status = 0;
|
||||
$settleOrder = $settleOrderLists[$order['id']] ?? [];
|
||||
if($settleOrder){
|
||||
$status = 1;
|
||||
}
|
||||
$coachCommission = $settleOrder['coach_commission'] ?? 0;
|
||||
$coachCarCommission = $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['coach_car_amount'] ?? 0 ,
|
||||
'settle_amount' => $settleOrder['total_commission'] ?? 0,
|
||||
'coach_settle' => round($coachCommission - $coachCarCommission,2),
|
||||
'shop_settle' => 0,
|
||||
];
|
||||
}
|
||||
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_coach_amount)') ?: 0;
|
||||
|
||||
}else{
|
||||
$settleAmount = Order::whereOr($this->setWhere())->where(['is_settle'=>1])->value('sum(settle_coach_amount)') ?: 0;
|
||||
}
|
||||
return [
|
||||
'settle_amount' => round($settleAmount,2)
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
94
server/app/coachapi/lists/OrderLists.php
Executable file
94
server/app/coachapi/lists/OrderLists.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\order\Order;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* Class OrderLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class OrderLists extends BaseCoachApiDataLists
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['coach_id','=',$this->coachId];
|
||||
$where[] = ['pay_status','=',PayEnum::ISPAID];
|
||||
// if (isset($this->params['date_type']) && '' != $this->params['date_type']){
|
||||
// $todayDate = date('Y-m-d',time());
|
||||
// //今天的时间戳
|
||||
// $todayStart = strtotime($todayDate);
|
||||
// $todayEnd = strtotime($todayDate . ' 23:59:59');
|
||||
// switch ($this->params['date_type']){
|
||||
// case 1:
|
||||
// $where[] = ['appoint_time','>=',$todayStart];
|
||||
// $where[] = ['appoint_time','<=',$todayEnd];
|
||||
// break;
|
||||
// case 2:
|
||||
// //明天的时间戳
|
||||
// $tomorrowStart = strtotime('+1 day',$todayStart);
|
||||
// $tomorrowEnd = strtotime('+1 day',$todayEnd);
|
||||
// $where[] = ['appoint_time','>=',$tomorrowStart];
|
||||
// $where[] = ['appoint_time','<=',$tomorrowEnd];
|
||||
// break;
|
||||
// case 3:
|
||||
// //后天的时间戳
|
||||
// $dayAfterTomorrowStart = strtotime('+2 day',$todayStart);
|
||||
// $dayAfterTomorrowEnd = strtotime('+2 day',$todayEnd);
|
||||
// $where[] = ['appoint_time','>=',$dayAfterTomorrowStart];
|
||||
// $where[] = ['appoint_time','<=',$dayAfterTomorrowEnd];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
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','take_order_btn','depart_btn','arrive_btn','server_start_btn','server_finish_btn','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']);
|
||||
}])
|
||||
->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();
|
||||
|
||||
}
|
||||
}
|
||||
62
server/app/coachapi/lists/ShopLists.php
Executable file
62
server/app/coachapi/lists/ShopLists.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
use app\common\enum\shop\ShopEnum;
|
||||
use app\common\model\city\City;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
use app\common\model\shop\Shop;
|
||||
|
||||
class ShopLists extends BaseCoachApiDataLists
|
||||
{
|
||||
|
||||
public function setWhere()
|
||||
{
|
||||
$where[] = ['audit_status','=',ShopEnum::AUDIT_STATUS_PASS];
|
||||
$where[] = ['server_status','=',ShopEnum::SERVERSTATUSOPEN];
|
||||
if(isset($this->params['keyword']) && $this->params['keyword']){
|
||||
$where[] = ['name|sn','like','%'.$this->params['keyword'].'%'];
|
||||
}
|
||||
else{
|
||||
$coachInfo = Coach::where(['id'=>$this->coachId])->field('city_id')->findOrEmpty();
|
||||
$where[] = ['city_id','=',$coachInfo['city_id']];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
|
||||
$shopLists = Shop::where($this->setWhere())
|
||||
->field('id,logo,sn,name,synopsis,city_id')
|
||||
->append(['category_ids'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
$coach = Coach::where(['id'=>$this->coachId])->field('shop_id,city_id')->findOrEmpty();
|
||||
$categoryLists = GoodsCategory::column('name','id');
|
||||
foreach ($shopLists as $key => $shop){
|
||||
$shopLists[$key]['category_name'] = '';
|
||||
$isJoin = false;
|
||||
if(0 == $coach['shop_id'] && $coach['city_id'] == $shop['city_id']){
|
||||
$isJoin = true;
|
||||
}
|
||||
$shopLists[$key]['is_join'] = $isJoin;
|
||||
$categoryIds = array_column($shop['category_ids']->toArray(),'id');
|
||||
$categoryNameLists = [];
|
||||
foreach ($categoryIds as $id){
|
||||
$categoryNameLists[] = $categoryLists[$id] ??'';
|
||||
}
|
||||
|
||||
$shopLists[$key]['category_name'] = implode(' ',$categoryNameLists);
|
||||
|
||||
|
||||
}
|
||||
return $shopLists;
|
||||
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Shop::where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
}
|
||||
56
server/app/coachapi/lists/WithdrawalLogLists.php
Executable file
56
server/app/coachapi/lists/WithdrawalLogLists.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace app\coachapi\lists;
|
||||
|
||||
use app\common\model\withdraw\WithdrawApply;
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
* Class LogLists
|
||||
* @package app\coachapi\lists
|
||||
*/
|
||||
class WithdrawalLogLists extends BaseCoachApiDataLists
|
||||
{
|
||||
|
||||
public function setWhere(){
|
||||
$where = [];
|
||||
$where[] = ['source','=',1];
|
||||
$where[] = ['relation_id','=',$this->coachId];
|
||||
$where[] = ['apply_type','=',$this->params['type'] ?? 1];
|
||||
$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