51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\home\controller;
|
|
|
|
use app\BaseController;
|
|
|
|
/**
|
|
* ============================================================================
|
|
* 联课教育商城系统
|
|
* ============================================================================
|
|
* 版权所有 2022 刻羽互动科技有限公司,并保留所有权利。
|
|
* 网站地址: http://www.o1h.cn
|
|
* ----------------------------------------------------------------------------
|
|
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
|
|
* 不允许对程序代码以任何形式任何目的的再发布。
|
|
* ============================================================================
|
|
* 控制器
|
|
*/
|
|
class Apiv2 extends BaseController {
|
|
|
|
|
|
//联想搜索
|
|
public function search()
|
|
{
|
|
$name = input('param.name');
|
|
if (empty($name)) {
|
|
exit(json_encode(['status'=>0, 'data' => []]));
|
|
}
|
|
$goods_model = model('goods');
|
|
$course = array_slice($goods_model->getSearch($name, 'goods_id,goods_name,gc_id,ke_simple_college',764),0 , 10);
|
|
foreach ($course as &$val) {
|
|
$val['url'] = '/Goods?goods_id='.$val['goods_id'];
|
|
$val['ke_college'] = $val['ke_simple_college'];
|
|
}
|
|
|
|
/* $program = array_slice($goods_model->getSearch($name, 'goods_id,goods_name,gc_id,ke_simple_college',765),0 , 10);
|
|
foreach ($program as &$val) {
|
|
$val['url'] = '/Goods/program?gc_id='.$val['gc_id'];
|
|
$val['ke_college'] = $val['ke_simple_college'];
|
|
}*/
|
|
|
|
$program = [];
|
|
$data = [
|
|
'course' => $course,
|
|
'program' => $program,
|
|
];
|
|
exit(json_encode(['status'=>0, 'data' => $data]));
|
|
}
|
|
|
|
|
|
} |