66 lines
2.3 KiB
PHP
66 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
/**
|
|
* ============================================================================
|
|
* 联课教育商城系统
|
|
* ============================================================================
|
|
* 版权所有 2022 刻羽互动科技有限公司,并保留所有权利。
|
|
* 网站地址: http://www.o1h.cn
|
|
* ----------------------------------------------------------------------------
|
|
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
|
|
* 不允许对程序代码以任何形式任何目的的再发布。
|
|
* ============================================================================
|
|
* 控制器
|
|
*/
|
|
class Common extends AdminControl {
|
|
|
|
public function initialize() {
|
|
parent::initialize(); // TODO: Change the autogenerated stub
|
|
}
|
|
|
|
/**
|
|
* 查询每月的周数组
|
|
*/
|
|
public function getweekofmonth() {
|
|
include_once root_path(). 'extend/mall/datehelper.php';
|
|
$year = input('param.y');
|
|
$month = input('param.m');
|
|
$week_arr = getMonthWeekArr($year, $month);
|
|
echo json_encode($week_arr);
|
|
die;
|
|
}
|
|
|
|
public function ajax_get_brand() {
|
|
$initial = trim(input('param.letter'));
|
|
$keyword = trim(input('param.keyword'));
|
|
$type = trim(input('param.type'));
|
|
if (!in_array($type, array('letter', 'keyword')) || ($type == 'letter' && empty($initial)) || ($type == 'keyword' && empty($keyword))) {
|
|
echo json_encode(array());
|
|
die();
|
|
}
|
|
|
|
// 实例化模型
|
|
$where = array();
|
|
// 验证类型是否关联品牌
|
|
if ($type == 'letter') {
|
|
switch ($initial) {
|
|
case 'all':
|
|
break;
|
|
case '0-9':
|
|
$where[] = array('brand_initial','in', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
|
|
break;
|
|
default:
|
|
$where[] = array('brand_initial','=',$initial);
|
|
break;
|
|
}
|
|
} else {
|
|
$where[] = array('brand_name|brand_initial','like', '%' . $keyword . '%');
|
|
}
|
|
$brand_array = model('brand')->getBrandPassedList($where, 'brand_id,brand_name,brand_initial', 0, 'brand_initial asc, brand_sort asc');
|
|
echo json_encode($brand_array);
|
|
die();
|
|
}
|
|
|
|
} |