12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\admin\controller;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 控制器
- */
- 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();
- }
- }
|