Commit 86600816 by hcy001

1

parent e978e746
......@@ -196,4 +196,5 @@ class CommonModel extends Model
}
\ No newline at end of file
......@@ -163,8 +163,15 @@ class InquiryItemsModel extends Model
if ($res){ //存在 领取人才要写入吹询价表
$Redis= \RedisDB::connection();
$res = $res->toArray();
$item = $this->where("id",$inquiry_items_id)->first()->toArray();
$main = (new InquiryModel())->where("id",$item["inquiry_id"])->first()->toArray();
$CommonModel = new CommonModel();
foreach ($res as $k=>$v){
$Redis->sadd("frq_inquiry_items_urge",$inquiry_items_id."-".$v["assign_uid"]);
#发送信息
$CommonModel->send_msg($v["assign_uid"],$input["user_name"].'已催报价,询价单号:'.$main["inquiry_sn"].',型号:'.$item["goods_name"]);
}
$indata = ["inquiry_items_id"=>$inquiry_items_id,"remark"=>$input["remark"],"create_uid"=>$input["user_id"],"create_name"=>$input["user_name"],"create_time"=>time(),"update_time"=>time()];
......@@ -172,6 +179,8 @@ class InquiryItemsModel extends Model
}
#更新自动报价标志
(new InquiryItemsModel())->where("id",$inquiry_items_id)->update(["flag"=>0]);
return [0,"催价成功"];
}
......@@ -331,10 +340,20 @@ class InquiryItemsModel extends Model
$con->commit();
#发送消息
$info = $this->where("id",$inquiry_items_id)->value("inquiry_id");
$mainStatus = (new InquiryModel())->where("id",$inquiry_items_id)->value("status"); #主单状态
if ($mainStatus == 0){ #
$itemArr = $this->where("id",$inquiry_items_id)->first()->toArray(); #明细
$mainArr = (new InquiryModel())->where("id",$itemArr["inquiry_id"])->first()->toArray(); #主单状态
if ($mainArr["status"] == 1){ # 启动
#发送修改询价信息
$CommonModel = new CommonModel();
$assignInfo = (new InquiryItemsAssignModel())->select("assign_uid")->where("inquiry_items_id",$inquiry_items_id)->get();
if ($assignInfo){
$assignInfoArr = $assignInfo->toArray();
$currency = $itemArr["currency"] == 1 ? "¥":"$";
$msg = $b["user_name"].'已修改询价,询价单号:'.$mainArr["inquiry_sn"].',型号:'.$updateArr["goods_name"].' 修改内容:价格:'.$currency.$itemArr["target_price"].',目标价:'.$currency.$updateArr["target_price"];
foreach ($assignInfoArr as $k=>$v){
$CommonModel->send_msg($v["assign_uid"],$msg);
}
}
}
......@@ -528,7 +547,7 @@ class InquiryItemsModel extends Model
$b2["purArr"] = $userInfo;
break;
case "delivery_time": #交期
if (strpos($val,"天") === false || strpos($val,"周") === false){
if (strpos($val,"天") === false && strpos($val,"周") === false){
$err[] = $str_msg."交期输入名称有误";
}
$delivery_time = str_replace("天","",$val);
......
......@@ -185,11 +185,33 @@ class InquiryModel extends Model
*/
public function inquiryClose($input)
{
if (empty(@$input["inquiry_id"])) {
$inquiry_id = @$input["inquiry_id"];
if (empty(@$inquiry_id)) {
return [1001, "询价单ID不得为空"];
}
$this->where("id", $input["inquiry_id"])->update(["status" => -1, "remark" => @$input["remark"] ? $input["remark"] : "", "update_time" => time()]);
(new InquiryItemsModel())->where("inquiry_id", $input["inquiry_id"])->update(["status" => -1, "update_time" => time()]);
$this->where("id", $inquiry_id)->update(["status" => -1, "remark" => @$input["remark"] ? $input["remark"] : "", "update_time" => time()]);
(new InquiryItemsModel())->where("inquiry_id", $inquiry_id)->update(["status" => -1, "update_time" => time()]);
#发送消息
$con = DB::connection('rfq');
$sql = 'SELECT DISTINCT c.assign_uid,a.inquiry_sn
FROM
lie_inquiry a,
lie_inquiry_items b,
lie_inquiry_items_assign c
WHERE
a.id = b.inquiry_id
AND b.id = c.inquiry_items_id
AND a.`status` <>0
AND a.id ='.$inquiry_id;
$assignInfoArr = $con->select($sql);
$CommonModel = new CommonModel();
foreach ($assignInfoArr as $k=>$v){
$CommonModel->send_msg($v["assign_uid"],$input["user_name"].'已关闭询价,询价单号:'.$v["inquiry_sn"]);
}
return [0, "关闭整个询价单成功"];
}
......
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