初始版本
This commit is contained in:
113
server/app/adminapi/lists/coach/CoachApplyLists.php
Executable file
113
server/app/adminapi/lists/coach/CoachApplyLists.php
Executable file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
namespace app\adminapi\lists\coach;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\coach\CoachEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\coach\CoachGoodsIndex;
|
||||
use app\common\model\skill\Skill;
|
||||
|
||||
class CoachApplyLists extends BaseAdminDataLists implements ListsExtendInterface
|
||||
{
|
||||
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
if(isset($this->params['keyword']) && $this->params['keyword']){
|
||||
$where[] = ['name|mobile','like',$this->params['keyword']];
|
||||
}
|
||||
if(isset($this->params['coach_keyword']) && $this->params['coach_keyword']){
|
||||
$where[] = ['sn|account','like',$this->params['coach_keyword']];
|
||||
}
|
||||
if(isset($this->params['work_status']) && '' != $this->params['work_status']){
|
||||
$where[] = ['work_status','=',$this->params['work_status']];
|
||||
}
|
||||
if(isset($this->params['server_status']) && '' != $this->params['server_status']){
|
||||
$where[] = ['server_status','=',$this->params['server_status']];
|
||||
}
|
||||
if(isset($this->params['skill_id']) && '' != $this->params['skill_id']){
|
||||
$skillIds = Skill::alias('S')
|
||||
->join('coach_skill_index CSI','S.id = CSI.skill_id')
|
||||
->column('CSI.coach_id');
|
||||
$where[] = ['C.id','in',$skillIds];
|
||||
}
|
||||
if(isset($this->params['start_time']) && $this->params['start_time']){
|
||||
$where[] = ['C.create_time','>=',$this->params['start_time']];
|
||||
}
|
||||
if(isset($this->params['end_time']) && $this->params['end_time']){
|
||||
$where[] = ['C.create_time','<=',$this->params['end_time']];
|
||||
}
|
||||
if(isset($this->params['type']) && '' != $this->params['type']){
|
||||
$where[] = ['audit_status','=',$this->params['type']];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->field('UC.sn,C.mobile,C.audit_status,C.skill_id,C.province_id,C.city_id,C.region_id,C.id,C.name,C.work_photo,C.deposit,C.work_status,C.create_time,C.money')
|
||||
->append(['skill_desc','region_desc','audit_status_desc'])
|
||||
->where($this->setWhere())
|
||||
->order('C.id desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
$goodsCountLists = CoachGoodsIndex::group('coach_id')->column('count(goods_id) as count','coach_id');
|
||||
foreach ($lists as $key => $list){
|
||||
$lists[$key]['goods_count'] = $goodsCountLists[$list['id']] ?? 0;
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 统计人数
|
||||
* @return int
|
||||
* @author cjhao
|
||||
* @date 2024/8/21 17:53
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
public function extend()
|
||||
{
|
||||
$whereLists = $this->setWhere();
|
||||
foreach ($whereLists as $key => $where){
|
||||
if(isset($where['audit_status'])){
|
||||
unset($whereLists[$key]);
|
||||
}
|
||||
}
|
||||
$whereLists = array_values($whereLists);
|
||||
$allCount = Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($whereLists)
|
||||
->count();
|
||||
$waitCount = Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($whereLists)
|
||||
->where(['audit_status'=>CoachEnum::AUDIT_STATUS_WAIT])
|
||||
->count();
|
||||
$passCount = Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($whereLists)
|
||||
->where(['audit_status'=>CoachEnum::AUDIT_STATUS_PASS])
|
||||
->count();
|
||||
$refuseCount = Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($whereLists)
|
||||
->where(['audit_status'=>CoachEnum::AUDIT_STATUS_REFUSE])
|
||||
->count();
|
||||
return [
|
||||
'all_count' => $allCount,
|
||||
'wait_count' => $waitCount,
|
||||
'pass_count' => $passCount,
|
||||
'refuse_count' => $refuseCount,
|
||||
];
|
||||
}
|
||||
}
|
||||
145
server/app/adminapi/lists/coach/CoachLists.php
Executable file
145
server/app/adminapi/lists/coach/CoachLists.php
Executable file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
namespace app\adminapi\lists\coach;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\coach\CoachEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\deposit\DepositPackage;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\skill\Skill;
|
||||
|
||||
class CoachLists extends BaseAdminDataLists
|
||||
{
|
||||
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
$auditStatus = $this->params['audit_status'] ?? CoachEnum::AUDIT_STATUS_PASS;
|
||||
if($auditStatus){
|
||||
$where[] = ['audit_status','=',$auditStatus];
|
||||
}
|
||||
if(isset($this->params['staff_info']) && $this->params['staff_info']){
|
||||
$where[] = ['C.sn|name|mobile','like',$this->params['staff_info']];
|
||||
}
|
||||
// if(isset($this->params['coach_keyword']) && $this->params['coach_keyword']){
|
||||
// $where[] = ['C.sn|account','like',$this->params['coach_keyword']];
|
||||
// }
|
||||
if(isset($this->params['skill_id']) && '' != $this->params['skill_id']){
|
||||
$where[] = ['skill_id','=',$this->params['skill_id']];
|
||||
}
|
||||
if(isset($this->params['city_id']) && $this->params['city_id']){
|
||||
$where[] = ['city_id','=',$this->params['city_id']];
|
||||
}
|
||||
if(isset($this->params['work_status']) && '' != $this->params['work_status']){
|
||||
$where[] = ['work_status','=',$this->params['work_status']];
|
||||
}
|
||||
if(isset($this->params['status']) && '' != $this->params['status']){
|
||||
$where[] = ['server_status','=',$this->params['status']];
|
||||
}
|
||||
if(isset($this->params['start_time']) && $this->params['start_time']){
|
||||
$where[] = ['C.create_time','>=',strtotime($this->params['start_time'])];
|
||||
}
|
||||
if(isset($this->params['end_time']) && $this->params['end_time']){
|
||||
$where[] = ['C.create_time','<=',strtotime($this->params['end_time'])];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
// public function lists(): array
|
||||
// {
|
||||
// $lists = Coach::alias('C')
|
||||
// ->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
// ->field('UC.sn,C.id,C.province_id,C.city_id,C.region_id,C.mobile,C.name,C.work_photo,C.server_status,C.deposit,C.work_status,C.create_time,C.money')
|
||||
// ->append(['work_status_desc','server_status_desc','province_name','city_name','region_name'])
|
||||
// ->order('id desc')
|
||||
// ->where($this->setWhere())
|
||||
// ->limit($this->limitOffset, $this->limitLength)
|
||||
// ->select()->toArray();
|
||||
// $coachIds = array_column($lists,'id');
|
||||
// $depositLists = DepositPackage::where(['type'=>1])->column('order_limit,money');
|
||||
// $orderLists = Order::where(['coach_id'=>$coachIds])
|
||||
// ->where('order_status','>',OrderEnum::ORDER_STATUS_WAIT_RECEIVING)
|
||||
// ->field('count(id) as num,coach_id')
|
||||
// ->select()->toArray();
|
||||
// $orderLists = array_column($orderLists,null,'coach_id');
|
||||
// foreach ($lists as $key => $coach){
|
||||
// $depositPackage = [];
|
||||
// foreach ($depositLists as $deposit){
|
||||
// if($coach['deposit'] >= $deposit['money']){
|
||||
// $depositPackage = $deposit;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// $lists[$key]['work_info'] = [
|
||||
// 'take_order' => $depositPackage['order_limit'] ?? 0,
|
||||
// 'total_order' => $orderLists[$coach['id']]['num'] ?? 0,
|
||||
// ];
|
||||
// }
|
||||
// return $lists;
|
||||
// }
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Coach::alias('C')
|
||||
->join('coach_user UC', 'UC.id = C.coach_user_id')
|
||||
->field('UC.sn,C.id,C.province_id,C.city_id,C.region_id,C.mobile,C.name,C.work_photo,C.server_status,C.deposit,C.work_status,C.create_time,C.money')
|
||||
->append(['work_status_desc','server_status_desc','province_name','city_name','region_name'])
|
||||
->order('id desc')
|
||||
->where($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$coachIds = array_column($lists, 'id');
|
||||
|
||||
// 获取保证金套餐
|
||||
$depositLists = DepositPackage::where(['type' => 1])
|
||||
->column('order_limit,money');
|
||||
|
||||
// 修复后的订单统计查询
|
||||
$orderLists = [];
|
||||
if (!empty($coachIds)) {
|
||||
$orderLists = Order::where('coach_id', 'in', $coachIds)
|
||||
->where('order_status', '>', OrderEnum::ORDER_STATUS_WAIT_RECEIVING)
|
||||
->field('coach_id, count(id) as num')
|
||||
->group('coach_id') // 按教练分组统计
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
// 转换为以 coach_id 为键的数组
|
||||
$orderLists = array_column($orderLists, null, 'coach_id');
|
||||
|
||||
foreach ($lists as $key => $coach) {
|
||||
$depositPackage = [];
|
||||
|
||||
// 匹配保证金套餐
|
||||
foreach ($depositLists as $deposit) {
|
||||
if ($coach['deposit'] >= $deposit['money']) {
|
||||
$depositPackage = $deposit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$lists[$key]['work_info'] = [
|
||||
'take_order' => $depositPackage['order_limit'] ?? 0,
|
||||
'total_order' => $orderLists[$coach['id']]['num'] ?? 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 统计人数
|
||||
* @return int
|
||||
* @author cjhao
|
||||
* @date 2024/8/21 17:53
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Coach::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
}
|
||||
60
server/app/adminapi/lists/coach/DepositPackageLists.php
Executable file
60
server/app/adminapi/lists/coach/DepositPackageLists.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?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\coach;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\deposit\DepositPackage;
|
||||
|
||||
class DepositPackageLists 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 3:51 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new DepositPackage())
|
||||
->order(['id'=>'desc'])
|
||||
->where(['type'=>1])
|
||||
->withoutField('update_time,delete_time')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务分类数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/8 3:51 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new DepositPackage())->count();
|
||||
}
|
||||
}
|
||||
62
server/app/adminapi/lists/coach/SkillLists.php
Executable file
62
server/app/adminapi/lists/coach/SkillLists.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?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\coach;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
use app\common\model\skill\Skill;
|
||||
|
||||
class SkillLists 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 3:51 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new Skill())
|
||||
->order(['id'=>'desc'])
|
||||
->withoutField('update_time,delete_time')
|
||||
->withCount(['coach','goods'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务分类数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/8 3:51 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new Skill())->count();
|
||||
}
|
||||
}
|
||||
103
server/app/adminapi/lists/coach/UpdateCoachLists.php
Executable file
103
server/app/adminapi/lists/coach/UpdateCoachLists.php
Executable file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
namespace app\adminapi\lists\coach;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\coach\CoachEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\coach\CoachGoodsIndex;
|
||||
use app\common\model\coach\CoachUpdate;
|
||||
use app\common\model\skill\Skill;
|
||||
|
||||
class UpdateCoachLists extends BaseAdminDataLists implements ListsExtendInterface
|
||||
{
|
||||
|
||||
public function setWhere()
|
||||
{
|
||||
$where = [];
|
||||
if(isset($this->params['keyword']) && $this->params['keyword']){
|
||||
$where[] = ['name|mobile','like',$this->params['keyword']];
|
||||
}
|
||||
if(isset($this->params['coach_keyword']) && $this->params['coach_keyword']){
|
||||
$where[] = ['sn|account','like',$this->params['coach_keyword']];
|
||||
}
|
||||
if(isset($this->params['work_status']) && '' != $this->params['work_status']){
|
||||
$where[] = ['work_status','=',$this->params['work_status']];
|
||||
}
|
||||
if(isset($this->params['server_status']) && '' != $this->params['server_status']){
|
||||
$where[] = ['server_status','=',$this->params['server_status']];
|
||||
}
|
||||
if(isset($this->params['skill_id']) && '' != $this->params['skill_id']){
|
||||
$skillIds = Skill::alias('S')
|
||||
->join('coach_skill_index CSI','S.id = CSI.skill_id')
|
||||
->column('CSI.coach_id');
|
||||
$where[] = ['C.id','in',$skillIds];
|
||||
}
|
||||
if(isset($this->params['start_time']) && $this->params['start_time']){
|
||||
$where[] = ['C.create_time','>=',$this->params['start_time']];
|
||||
}
|
||||
if(isset($this->params['end_time']) && $this->params['end_time']){
|
||||
$where[] = ['C.create_time','<=',$this->params['end_time']];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = CoachUpdate::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->field('UC.sn,C.mobile,C.audit_status,C.skill_id,C.province_id,C.city_id,C.region_id,C.id,C.name,C.audit_remark,C.work_photo,C.goods_ids,C.create_time')
|
||||
->append(['skill_desc','region_desc','audit_status_desc'])
|
||||
->order('id desc')
|
||||
->where($this->setWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->toArray();
|
||||
foreach ($lists as $key => $list){
|
||||
$lists[$key]['goods_count'] = count($list['goods_ids']);
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 统计人数
|
||||
* @return int
|
||||
* @author cjhao
|
||||
* @date 2024/8/21 17:53
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CoachUpdate::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
public function extend()
|
||||
{
|
||||
$allCount = CoachUpdate::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->count();
|
||||
$waitCount = CoachUpdate::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->where(['audit_status'=>CoachEnum::AUDIT_STATUS_WAIT])
|
||||
->count();
|
||||
$passCount = CoachUpdate::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->where(['audit_status'=>CoachEnum::AUDIT_STATUS_PASS])
|
||||
->count();
|
||||
$refuseCount = CoachUpdate::alias('C')
|
||||
->join('coach_user UC','UC.id = C.coach_user_id')
|
||||
->where($this->setWhere())
|
||||
->where(['audit_status'=>CoachEnum::AUDIT_STATUS_REFUSE])
|
||||
->count();
|
||||
return [
|
||||
'all_count' => $allCount,
|
||||
'wait_count' => $waitCount,
|
||||
'pass_count' => $passCount,
|
||||
'refuse_count' => $refuseCount,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user