jh-admin/addon/saas/shop/controller/Supplygoods.php

56 lines
1.8 KiB
PHP

<?php
namespace addon\saas\shop\controller;
use addon\ali1688\model\Choice;
use addon\ali1688\model\Goods as goodsModel;
class Supplygoods extends SaasBase
{
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', '');
$condition[] = ['w.site_id', '=', $this->site_id];
$condition[] = ['w.is_supply', '=', 1];
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];
}
$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("supply/goodslists");
}
}