146 lines
4.4 KiB
PHP
146 lines
4.4 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
// +----------------------------------------------------------------------
|
||
// | Author: CRMEB Team <admin@crmeb.com>
|
||
// +----------------------------------------------------------------------
|
||
namespace app\api\controller\v1\publics;
|
||
|
||
use app\services\caseinfo\CaseServices;
|
||
|
||
/**
|
||
* 案例类
|
||
* Class ArticleController
|
||
* @package app\api\controller\publics
|
||
*/
|
||
class CaseController
|
||
{
|
||
protected $services;
|
||
|
||
public function __construct(CaseServices $services)
|
||
{
|
||
$this->services = $services;
|
||
}
|
||
|
||
/**
|
||
* 案例列表
|
||
* @param $cid
|
||
* @return mixed
|
||
* @throws \ReflectionException
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function lst($cid)
|
||
{
|
||
if ($cid == 0) {
|
||
$where = ['is_hot' => 1];
|
||
} else {
|
||
$where = ['cid' => $cid];
|
||
}
|
||
[$page, $limit] = $this->services->getPageValue();
|
||
$list = $this->services->getList($where, $page, $limit)['list'];
|
||
foreach ($list as &$item){
|
||
$item['add_time'] = date('Y-m-d H:i', $item['add_time']);
|
||
}
|
||
return app('json')->success($list);
|
||
}
|
||
|
||
/**
|
||
* 案例详情
|
||
* @param $id
|
||
* @return mixed
|
||
* @throws \ReflectionException
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function details($id)
|
||
{
|
||
$info = $this->services->getInfo($id);
|
||
return app('json')->success($info);
|
||
}
|
||
|
||
/**
|
||
* 获取热门案例
|
||
* @return mixed
|
||
* @throws \ReflectionException
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function hot()
|
||
{
|
||
[$page, $limit] = $this->services->getPageValue();
|
||
$list = $this->services->getList(['is_hot' => 1], $page, $limit)['list'];
|
||
foreach ($list as &$item){
|
||
$item['add_time'] = date('Y-m-d H:i', $item['add_time']);
|
||
}
|
||
return app('json')->success($list);
|
||
}
|
||
|
||
/**
|
||
* @return mixed
|
||
* @throws \ReflectionException
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function new()
|
||
{
|
||
[$page, $limit] = $this->services->getPageValue();
|
||
$list = $this->services->getList([], $page, $limit)['list'];
|
||
foreach ($list as &$item){
|
||
$item['add_time'] = date('Y-m-d H:i', $item['add_time']);
|
||
}
|
||
return app('json')->success($list);
|
||
}
|
||
|
||
/**
|
||
* 获取顶部banner案例
|
||
* @return mixed
|
||
* @throws \ReflectionException
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function banner()
|
||
{
|
||
[$page, $limit] = $this->services->getPageValue();
|
||
$list = $this->services->getList(['is_banner' => 1], $page, $limit)['list'];
|
||
foreach ($list as &$item){
|
||
$item['add_time'] = date('Y-m-d H:i', $item['add_time']);
|
||
}
|
||
return app('json')->success($list);
|
||
}
|
||
|
||
|
||
|
||
|
||
/**
|
||
* 官网客户见证数据
|
||
* @return mixed
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @throws \think\exception\DbException
|
||
*/
|
||
public function customer_witness()
|
||
{
|
||
$customer_witness = sys_data('customer_witness') ?? [];
|
||
// $searchKeyword = [];
|
||
// if (count($routineHotSearch)) {
|
||
// foreach ($routineHotSearch as $key => &$item) {
|
||
// array_push($searchKeyword, $item['title']);
|
||
// }
|
||
// }
|
||
return app('json')->success($customer_witness);
|
||
}
|
||
|
||
|
||
|
||
}
|