Commit 7871cdae by 杜文军

历史报价数

parent c591332e
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Model\CommonModel;
use App\Model\InquiryItemsAssignModel;
use App\Model\InquiryItemsReportModel;
use App\Model\InquiryModel;
use App\Model\InquiryItemsModel;
......@@ -99,6 +100,39 @@ class ApiController extends Controller
ExportLayui((new QuoteModel())->ItemsList($input));
}
// 已领取列表
private function GetAssignList($input, $id){
$inquiry_items_id = $input['inquiry_items_id'];
$p = $input['p'] ? $input['p'] : 1;
$limit = $input['limit'] ? $input['limit'] : 10;
$InquiryItemsAssignModel = new InquiryItemsAssignModel;
$list = $InquiryItemsAssignModel->GetAssignList($inquiry_items_id, $p, $limit);
if ($list['data'] && is_array($list['data'])){
$InquiryItemsModel = new InquiryItemsModel();
$inquire_item_info = $InquiryItemsModel->where('id', $inquiry_items_id)->first()->toArray();
if ($inquire_item_info){
// 获取领取了询价单后已报价的uids
$QuoteModel = new QuoteModel();
$assign_uids = array_column($list['data'], 'assign_uid');
$quoted_uids = $QuoteModel->GetQuotedUids($inquiry_items_id, $assign_uids);
foreach ($list['data'] as $k => &$assign_item){
$assign_item['goods_name'] = $inquire_item_info['goods_name'];
$assign_item['brand_name'] = $inquire_item_info['brand_name'];
}
// 判断当前用户是否有对该询价单报价,如果有报价,那么过滤
if (in_array($assign_item['assign_uid'], $quoted_uids)){
unset($list['data'][$k]);
}
}
}
$data = [0, '成功', $list['data'], $list['total']];
ExportLayui($data);
}
//搜索品牌
private function ApiBrandList($input, $id){
(new CommonModel())->BrandList($input['k'],@$input["types"] ? @$input["types"] : 1);
......
......@@ -11,6 +11,12 @@ class InquiryItemsAssignModel extends Model
protected $primaryKey = 'id';
public $timestamps = false;
// 领取类型 1 指定 2 领取
const ASSIGN_TYPE_BIND = 1;
const ASSIGN_TYPE_SELECTED = 2;
// 领取询价
public function assign($inquiry_items_id, $assign_uid, $types=1)
{
......@@ -27,6 +33,16 @@ class InquiryItemsAssignModel extends Model
return $this->insert($data);
}
public function GetAssignList($inquiry_items_id, $p, $limit)
{
return $this
->where("inquiry_items_id", $inquiry_items_id)
->where("assign_type", self::ASSIGN_TYPE_SELECTED)
->orderBy('id','desc')
->paginate($limit ? $limit : 10, ['*'], 'p', $p ? $p : 1)
->toArray();
}
// 删除
public function delAssign($inquiry_items_id, $assign_uid, $types=1)
{
......
......@@ -109,6 +109,11 @@ class InquiryItemsModel extends Model
// 添加操作日志
$inquiry_items = $this->find($id);
// 检查询价单状态,如果状态为默认的 待报价 状态,那么更改为 已领取状态
if ($inquiry_items['status'] == InquiryMap::status_ready){
$this->where('id', $id)->update(['status' => InquiryMap::status_fix]);
}
$data = [];
$data['types'] = 1;
$data['relation_id'] = $id;
......
......@@ -77,7 +77,6 @@ class InquiryModel extends Model
}
}
});
#不同类别查询
switch (@$input["types"]) {
case "1": //我的询价
......@@ -166,6 +165,9 @@ class InquiryModel extends Model
$v['inquiry_sn_origin'] = $v["inquiry_sn"];
// 查询历史报价数
$v['history_inquiry_count'] = $QuoteModel->GetHistoryQuotedCount($v['goods_name']);
// 在Redis集合中检查是否有新的报价
if ($export == 0){
$res = $Redis->SISMEMBER('frq_quote_urge', $v['id']);
......
......@@ -3,7 +3,7 @@ namespace App\map;
//询价枚举
class InquiryMap{
//状态 -1:已关闭 1:待报价 2:已报价 3:已选中 4:已固定 5:已确认
//状态 -1:已关闭 1:待报价 2:已报价 3:已选中 4:已领取 5:已确认
const status_close = -1;
const status_ready = 1;
const status_replay = 2;
......@@ -15,7 +15,7 @@ class InquiryMap{
self::status_ready => "待报价",
self::status_replay => "已报价",
self::status_check => "已选中",
self::status_fix => "已固定",
self::status_fix => "已领取",
self::status_sure => "已确认",
];
......
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