初始版本

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,59 @@
<?php
namespace app\coachapi\logic;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsCityIndex;
use app\common\model\goods\GoodsSkillIndex;
use app\common\model\skill\Skill;
/**
* 服务逻辑类
* Class GoodsLogic
* @package app\coachapi\logic
*/
class GoodsLogic
{
/**
* @notes 获取技能列表
* @return mixed
* @author cjhao
* @date 2024/10/13 00:25
*/
public function skillLists($coachId)
{
$lists = Skill::alias('S')
->join('coach C','S.id = C.skill_id')
->where(['C.id'=>$coachId])
->field('S.id,S.name')
->select()->toArray();
array_unshift($lists,['id'=>0,'name'=>'全部']);
return $lists;
}
/**
* @notes 商品详情
* @param $id
* @return array
* @author cjhao
* @date 2024/11/27 14:41
*/
public function detail($id)
{
$result = Goods::where('id',$id)
->withoutField('update_time,delete_time')
->append(['category_desc','goods_image'])
->findOrEmpty()
->toArray();
$result['virtual_order_num'] = $result['virtual_order_num'] + $result['order_num'];
$goods_image = [];
foreach ($result['goods_image'] as &$image) {
$goods_image[] = $image['uri'];
}
$result['goods_image'] = $goods_image;
$result['skill_id'] = GoodsSkillIndex::where(['goods_id'=>$id])->column('skill_id');
return $result;
}
}