Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
php_frq_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
afcbe111
authored
Mar 10, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整报价
parent
5604124a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
15 deletions
app/Model/QuoteModel.php
app/Model/QuoteModel.php
View file @
afcbe111
...
...
@@ -7,8 +7,9 @@ use App\map\QuoteMap;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
DB
;
use
App\Model\Op
l
ogModel
;
use
App\Model\Op
L
ogModel
;
use
App\Model\UserModel
;
use
App\Model\InquiryItemsModel
;
use
App\Http\Controllers\PermController
;
use
App\Http\Controllers\ApiController
;
use
RedisDB
;
...
...
@@ -182,7 +183,7 @@ class QuoteModel extends Model
return
$data
;
}
// 撤销
// 撤销
报价
public
function
cancel
(
$input
)
{
$id
=
$input
[
'id'
];
...
...
@@ -191,10 +192,13 @@ class QuoteModel extends Model
if
(
!
$id
)
return
[
-
1
,
'参数缺失'
];
try
{
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
-
1
,
'cancel_reason'
=>
$cancel_reason
]);
$quote_info
=
$this
->
find
(
$id
);
if
(
$quote_info
[
'status'
]
==
-
1
)
return
[
1
,
'该报价已撤销,请刷新页面查看'
];
if
(
$quote_info
[
'status'
]
>
1
)
return
[
1
,
'当前报价状态不能撤销,请刷新页面查看'
];
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
-
1
,
'cancel_reason'
=>
$cancel_reason
]);
$UserModel
=
new
UserModel
;
$data
=
[];
...
...
@@ -205,7 +209,7 @@ class QuoteModel extends Model
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
@@ -221,24 +225,36 @@ class QuoteModel extends Model
if
(
!
$quote_info
)
return
[
1
,
'报价数据不存在'
];
try
{
$res
=
$this
->
create
(
$quote_info
);
// 询价明细单状态
$inquiry_items_status
=
InquiryItemsModel
::
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$inquiry_items_status
==
-
1
)
return
[
1
,
'新增报价失败,该询价明细已关闭'
];
$UserModel
=
new
UserModel
;
$create_name
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
$quote_info
[
'status'
]
=
1
;
// 已报价
$quote_info
[
'create_uid'
]
=
$input
[
'user_id'
];
$quote_info
[
'create_uid'
]
=
$create_name
;
$res
=
$this
->
create
(
$quote_info
);
if
(
$res
===
false
)
return
[
2
,
'新增报价失败'
];
if
(
$inquiry_items_status
==
1
)
{
// 询价明细为待报价时,更新为已报价
InquiryItemsModel
::
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
2
]);
}
// 通知询价人,放入redis
RedisDB
::
set
(
'frq_quote_urge'
,
$quote_info
[
'inquiry_items_id'
]);
$UserModel
=
new
UserModel
;
$data
=
[];
$data
[
'types'
]
=
2
;
$data
[
'relation_id'
]
=
$quote_info
[
'inquiry_items_id'
];
$data
[
'relation_sn'
]
=
''
;
$data
[
'content'
]
=
'新增报价,报价单号:'
.
$quote_info
[
'quote_sn'
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$data
[
'create_name'
]
=
$
create_name
;
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
@@ -249,6 +265,10 @@ class QuoteModel extends Model
// 报价导入
public
function
import
(
$input
)
{
// 询价明细单状态
$inquiry_items_status
=
InquiryItemsModel
::
where
(
'id'
,
$input
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$inquiry_items_status
==
-
1
)
return
[
1
,
'导入报价失败,该询价明细已关闭'
];
$file
=
$_FILES
[
'file'
];
// $request->file('file')
$filePath
=
$file
[
'tmp_name'
];
// 临时路径
...
...
@@ -300,7 +320,7 @@ class QuoteModel extends Model
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
@@ -418,7 +438,7 @@ class QuoteModel extends Model
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
@@ -431,6 +451,10 @@ class QuoteModel extends Model
{
if
(
!
$input
[
'inquiry_items_id'
])
return
[
-
1
,
'参数缺失'
];
// 询价明细单状态
$inquiry_items_status
=
InquiryItemsModel
::
where
(
'id'
,
$input
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$inquiry_items_status
==
-
1
)
return
[
1
,
'批量提交报价失败,该询价明细已关闭'
];
try
{
$map
=
[];
$map
[
'inquiry_items_id'
]
=
$input
[
'inquiry_items_id'
];
...
...
@@ -443,6 +467,10 @@ class QuoteModel extends Model
$this
->
where
(
$map
)
->
update
([
'status'
=>
1
]);
if
(
$inquiry_items_status
==
1
)
{
// 询价明细为待报价时,更新为已报价
InquiryItemsModel
::
where
(
'id'
,
$input
[
'inquiry_items_id'
])
->
update
([
'status'
=>
2
]);
}
// 通知询价人,放入redis
RedisDB
::
set
(
'frq_quote_urge'
,
$input
[
'inquiry_items_id'
]);
...
...
@@ -456,7 +484,7 @@ class QuoteModel extends Model
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
@@ -482,7 +510,7 @@ class QuoteModel extends Model
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
@@ -574,7 +602,7 @@ class QuoteModel extends Model
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$UserModel
->
FinduserInfoName
(
$input
[
'user_id'
]);
Op
l
ogModel
::
log
(
$data
);
Op
L
ogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment