提交其他文件

This commit is contained in:
2026-03-11 18:24:59 +08:00
parent 4b490670f1
commit f0d7f60fd5
1377 changed files with 73456 additions and 0 deletions

View File

@ -0,0 +1,48 @@
<?php
namespace app\teamapi\logic;
use app\common\logic\BaseLogic;
use app\common\model\Training;
use app\common\service\FileService;
class TrainingLogic extends BaseLogic
{
public static function trainingList($post){
$search = "";
if(isset($post['search'])){
if($post['search']!=""&&$post['search']!=null){
$a = $post['search'];
$search = "title like '%".$a."%'";
}
}
$count = Training::where("type_id",1)->where($search)->count();
$lists = Training::where("type_id",1)
->where($search)
->page($post['page'], $post['size'])
->order("id","desc")
->select()
->toarray();
foreach($lists as $key=>$value){
$lists[$key]['image'] = FileService::getImgUrl($value['image']);
$lists[$key]['dtime'] = date("Y-m-d H:i:s",$value['dtime']);
}
$data = [
'list' => $lists,
'page' => $post['page'],
'size' => $post['size'],
'count' => $count,
'more' => is_more($count, $post['page'], $post['size'])
];
return $data;
}
public static function trainingDetails($data){
$result = Training::where("id",$data['id'])
->find();
$result['image'] = FileService::getImgUrl($result['image']);
$result['dtime'] = date("Y-m-d H:i:s",$result['dtime']);
$d['details'] = $result;
return $d;
}
}