jh-admin/addon/supply/shop/controller/Follow.php

55 lines
1.7 KiB
PHP

<?php
namespace addon\supply\shop\controller;
use addon\ali1688\model\Choice;
use addon\ali1688\model\Goods as goodsModel;
use app\shop\controller\BaseShop;
class Follow extends BaseShop
{
private $goodsModel;
private $Choice;
public function __construct()
{
parent::__construct();
$this->goodsModel = new GoodsModel($this->site_id);
$this->Choice = new Choice($this->site_id);
}
public function lists()
{
if (request()->isAjax()) {
// 参数获取
$start_time = input('start_time', '');
$end_time = input('end_time', '');
$search = input('goods_name', '');
if ($start_time && $end_time) {
$condition[] = ['w.create_time', 'between', [date_to_time($start_time), date_to_time($end_time)]];
} elseif (!$start_time && $end_time) {
$condition[] = ['w.create_time', '<=', date_to_time($end_time)];
} elseif ($start_time && !$end_time) {
$condition[] = ['w.create_time', '>=', date_to_time($start_time)];
}
//筛选商品名称
if (!empty($search)) {
$condition[] = ['w.goods_name', 'like', '%' . $search . '%'];
}
$status = input('goods_state', '');
if (!empty($status)) {
$condition[] = ['w.goods_state', '=', $status];
}
$condition[] = ['w.site_id', '=', $this->site_id];
$page = input('page', 1);
$page_size = input('page_size', PAGE_LIST_ROWS);
return $this->goodsModel->getGoodsList($condition, $page, $page_size);
}
$this->forthMenu();
return $this->fetch("follow/lists");
}
}