Commit f8a79119 by 朱继来

调整

parent ef73785f
Showing with 9 additions and 7 deletions
......@@ -195,7 +195,9 @@ class InquiryModel extends Model
$list = $rqpConn->table('inquiry as a')->join('inquiry_items as b', 'a.id', '=', 'b.inquiry_id');
if ($type == 2) {
if ($type == 1) {
$list = $list->leftJoin('inquiry_items_assign as c', 'b.id', '=', 'c.inquiry_items_id');
} else if ($type == 2) {
$list = $list->join('inquiry_items_assign as c', 'b.id', '=', 'c.inquiry_items_id')->where('c.assign_uid', $user_id);
} else if ($type == 3) {
$list = $list->join('inquiry_items_assign as c', 'b.id', '=', 'c.inquiry_items_id')
......@@ -208,7 +210,7 @@ class InquiryModel extends Model
}
$list = $list->select(DB::Raw("lie_a.inquiry_sn,lie_a.currency,lie_a.status as status_a,lie_a.user_name,lie_a.com_name,lie_a.create_name,lie_a.create_time as inquiry_ctime,lie_b.*"))
->where(function ($query) use ($input, $type) {
->where(function ($query) use ($input, $type, $user_id) {
foreach ($input as $k => $v) {
$v = trim($v);
if (empty($v)) {
......@@ -244,10 +246,10 @@ class InquiryModel extends Model
$query->whereIn('a.status', [-1, 1]);
if ($type == 1) {
$query->whereNotIn('b.status', [-1, 5])->where('b.assign_type', 0); // 询价池需过滤已关闭、已确认、指定和领取的询价
$query->whereNotIn('b.status', [-1, 5]); // 询价池需过滤已关闭、已确认、指定和领取的询价
$time = time() - 7200; // 待报价的询价两小时后在询价池展示
$query->orWhereRaw('(lie_b.assign_type=1 and lie_b.status=1 and lie_b.create_time < ' . $time . ')');
$query->WhereRaw('((lie_c.assign_type=2 and lie_c.assign_uid <> '.$user_id.') or (lie_c.assign_type=1 and lie_b.status=1 and lie_b.create_time < ' . $time . '))');
}
});
......@@ -274,7 +276,7 @@ class InquiryModel extends Model
//报价
$v['status_val'] = InquiryMap::$status[$v["status"]];
if ($v["status_val"] == "已报价") {
$count = $QuoteModel->whereIn("status", QuoteMap::$status_used)->count();
$count = $QuoteModel->where('inquiry_items_id', $v['id'])->whereIn("status", QuoteMap::$status_used)->count();
$v['status_val'] = $v['status_val'] . "(" . $count . ")";
}
$v["customer_name"] = $v['com_name'] == "" ? $v['user_name'] : $v['com_name'];
......@@ -289,10 +291,10 @@ class InquiryModel extends Model
$v['assign_type_val'] = $v['assign_type'] == 1 ? '指定' : '领取'; // 指定/领取
$price_field = $v['currency'] == 1 ? 'price_rmb' : 'price_origin';
$quote = $QuoteModel->where('create_uid', $user_id)->first();
$quote = $QuoteModel->where(['inquiry_items_id' => $v['id'], 'create_uid' => $user_id])->orderBy('id', 'desc')->first();
// 我的报价
$v['self_quote'] = $quote ? $currency_sign . $quote[$price_field] . '(' . array_get(Config('quote.quote_status'), $quote['status'], '') . ')' : '';
$v['self_quote'] = $quote ? $currency_sign . $quote[$price_field] . '(' . array_get(Config('quote.quote_status'), $quote['status'], '') . ')' : '---';
// 在Redis集合中检查用户是否被催报价
$res = RedisDB::sIsMember('frq_inquiry_items_urge', $v['id'] . '-' . $user_id);
......
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