Commit c591332e by 杜文军

修改函数,支持php7

parent 9df7088c
Showing with 35 additions and 29 deletions
...@@ -104,45 +104,50 @@ class QuoteModel extends Model ...@@ -104,45 +104,50 @@ class QuoteModel extends Model
$map['brand_name'] = isset($input['brand_name']) ? trim($input['brand_name']) : ''; // 品牌 $map['brand_name'] = isset($input['brand_name']) ? trim($input['brand_name']) : ''; // 品牌
$map['quote_sn'] = isset($input['quote_sn']) ? trim($input['quote_sn']) : ''; // 报价单号 $map['quote_sn'] = isset($input['quote_sn']) ? trim($input['quote_sn']) : ''; // 报价单号
$map['status'] = isset($input['status']) ? $input['status'] : ''; // 报价状态 $map['status'] = isset($input['status']) ? $input['status'] : ''; // 报价状态
$map['create_uid'] = isset($input['create_uid']) ? $input['create_uid'] : ''; // 报价制单人
$map['start_time'] = !empty($input['start_time']) ? strtotime($input['start_time']) : ''; $map['start_time'] = !empty($input['start_time']) ? strtotime($input['start_time']) : '';
$map['end_time'] = !empty($input['end_time']) ? strtotime($input['end_time']) + 86399 : ''; $map['end_time'] = !empty($input['end_time']) ? strtotime($input['end_time']) + 86399 : '';
$map = array_filter($map) ? $map : [];
$field = ['q.id', 'q.inquiry_id', 'q.inquiry_sn', 'q.inquiry_items_id', 'q.quote_sn', 'q.source', 'q.price_origin', 'q.price_rmb', 'q.price_other', 'q.currency', 'q.goods_name as quote_goods_name', 'q.brand_name as quote_brand_name', 'q.supplier_id', 'q.supplier_name', 'q.quote_number', 'q.status', 'q.create_uid', 'q.create_name', 'q.delivery_time', 'q.batch', 'q.create_time', 'it.goods_name', 'it.brand_name', 'it.inquiry_number']; $field = ['q.id', 'q.inquiry_id', 'q.inquiry_sn', 'q.inquiry_items_id', 'q.quote_sn', 'q.source', 'q.price_origin', 'q.price_rmb', 'q.price_other', 'q.currency', 'q.goods_name as quote_goods_name', 'q.brand_name as quote_brand_name', 'q.supplier_id', 'q.supplier_name', 'q.quote_number', 'q.status', 'q.create_uid', 'q.create_name', 'q.delivery_time', 'q.batch', 'q.create_time', 'it.goods_name', 'it.brand_name', 'it.inquiry_number'];
if ($map){
$list = $this->from('quote as q')
->join('inquiry_items as it', 'q.inquiry_items_id', '=', 'it.id')
->where(function($query) use ($map) {
if ($map['inquiry_sn']) {
$query->where('q.inquiry_sn', '=', $map['inquiry_sn']);
}
$list = $this->from('quote as q') if ($map['goods_name']) {
->join('inquiry_items as it', 'q.inquiry_items_id', '=', 'it.id') $query->where('it.goods_name', 'like', $map['goods_name'].'%');
->where(function($query) use ($map) { }
if ($map['inquiry_sn']) {
$query->where('q.inquiry_sn', '=', $map['inquiry_sn']);
}
if ($map['goods_name']) {
$query->where('it.goods_name', 'like', $map['goods_name'].'%');
}
if ($map['brand_name']) { if ($map['brand_name']) {
$query->where('it.brand_name', 'like', $map['brand_name'].'%'); $query->where('it.brand_name', 'like', $map['brand_name'].'%');
} }
if ($map['quote_sn']) { if ($map['quote_sn']) {
$query->where('q.quote_sn', '=', $map['quote_sn']); $query->where('q.quote_sn', '=', $map['quote_sn']);
} }
if ($map['status']) { if ($map['status']) {
$query->where('q.status', '=', $map['status']); $query->where('q.status', '=', $map['status']);
} }
// 创建时间 // 创建时间
if(!empty($map['start_time']) && !empty($map['end_time'])) { if(!empty($map['start_time']) && !empty($map['end_time'])) {
$query->whereBetween('q.create_time', [$map['start_time'], $map['end_time']]); $query->whereBetween('q.create_time', [$map['start_time'], $map['end_time']]);
} else if(!empty($map['start_time'])) { } else if(!empty($map['start_time'])) {
$query->where('q.create_time', '>=', $map['start_time']); $query->where('q.create_time', '>=', $map['start_time']);
} else if(!empty($map['end_time'])) { } else if(!empty($map['end_time'])) {
$query->where('q.create_time', '<=', $map['end_time']); $query->where('q.create_time', '<=', $map['end_time']);
} }
}); });
} else {
$list = $this->from('quote as q')
->join('inquiry_items as it', 'q.inquiry_items_id', '=', 'it.id');
}
$map['create_uid'] = isset($input['create_uid']) ? $input['create_uid'] : ''; // 报价制单人
if ($type == 1) { if ($type == 1) {
$list = $list->where('q.create_uid', $input['user_id'])->where('q.status', '<>', 0); // 过滤报价草稿 $list = $list->where('q.create_uid', $input['user_id'])->where('q.status', '<>', 0); // 过滤报价草稿
} else if ($type == 2) { } else if ($type == 2) {
......
...@@ -41,6 +41,7 @@ $app->singleton( ...@@ -41,6 +41,7 @@ $app->singleton(
App\Exceptions\Handler::class App\Exceptions\Handler::class
); );
$app->useStoragePath(APP_STORAGE_PATH);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Return The Application | Return The Application
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment