初始版本

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,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();
}
}