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
9241ba94
authored
Mar 18, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
ssh://119.23.72.7:22611/q578953158/php_frq_api
parents
d0c81d9d
396f6d36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
app/Model/QuoteModel.php
app/Model/QuoteModel.php
View file @
9241ba94
...
...
@@ -10,6 +10,7 @@ use DB;
use
App\Model\OpLogModel
;
use
App\Model\UserModel
;
use
App\Model\InquiryItemsModel
;
use
App\Model\SearchModel
;
use
App\Http\Controllers\PermController
;
use
App\Http\Controllers\ApiController
;
use
RedisDB
;
...
...
@@ -137,7 +138,7 @@ class QuoteModel extends Model
$list
=
$list
->
where
(
'q.create_uid'
,
$input
[
'user_id'
]);
}
else
if
(
$type
==
2
)
{
$perm
=
new
PermController
;
$role
=
$perm
->
getUserRole
(
$input
[
'user_id'
],
$input
[
'
user_name
'
]);
// 用户角色
$role
=
$perm
->
getUserRole
(
$input
[
'user_id'
],
$input
[
'
email
'
]);
// 用户角色
if
(
$role
==
4
)
{
// 采购查看下级
$sub_sale_ids
=
$perm
->
getSubSaleId
(
$input
[
'user_id'
]);
...
...
@@ -202,15 +203,13 @@ class QuoteModel extends Model
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
-
1
,
'cancel_reason'
=>
$cancel_reason
]);
$UserModel
=
new
UserModel
;
$data
=
[];
$data
[
'types'
]
=
2
;
$data
[
'relation_id'
]
=
$id
;
$data
[
'relation_sn'
]
=
$quote_info
[
'quote_sn'
];
$data
[
'content'
]
=
'撤销报价,撤销原因:'
.
$cancel_reason
.
',报价单号:'
.
$quote_info
[
'quote_sn'
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$data
[
'create_name'
]
=
$
input
[
'user_name'
]
;
OpLogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
...
...
@@ -308,6 +307,18 @@ class QuoteModel extends Model
$inquiry_items_status
=
InquiryItemsModel
::
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$inquiry_items_status
==
-
1
)
return
[
1
,
'新增报价失败,该询价明细已关闭'
];
$params
=
[];
$params
[
'spu_name'
]
=
strtoupper
(
$quote_info
[
'goods_name'
]);
$params
[
'brand_name'
]
=
$quote_info
[
'brand_name'
];
$SearchModel
=
new
SearchModel
;
$res
=
$SearchModel
->
getClassName
(
json_encode
(
$params
));
// 获取型号分类
if
(
$res
)
{
$quote_info
[
'class_id2'
]
=
$res
[
$params
[
'spu_name'
]][
'class_id2'
];
$quote_info
[
'class_id2_name'
]
=
$res
[
$params
[
'spu_name'
]][
'class_id2_name'
];
}
$quote_info
[
'status'
]
=
1
;
// 已报价
$quote_info
[
'create_uid'
]
=
$input
[
'user_id'
];
$quote_info
[
'create_name'
]
=
$input
[
'user_name'
];
...
...
@@ -368,7 +379,6 @@ class QuoteModel extends Model
// 插入到报价表 -- 状态:草稿
try
{
$UserModel
=
new
UserModel
;
$ApiController
=
new
ApiController
;
foreach
(
$excel
as
&
$v
)
{
...
...
@@ -379,7 +389,7 @@ class QuoteModel extends Model
$v
[
'inquiry_items_id'
]
=
$input
[
'inquiry_items_id'
];
$v
[
'status'
]
=
0
;
$v
[
'create_uid'
]
=
$input
[
'user_id'
];
$v
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$v
[
'create_name'
]
=
$
input
[
'user_name'
]
;
$v
[
'create_time'
]
=
time
();
$v
[
'update_time'
]
=
time
();
}
...
...
@@ -393,7 +403,7 @@ class QuoteModel extends Model
$data
[
'relation_sn'
]
=
''
;
$data
[
'content'
]
=
'批量导入报价,添加到草稿'
;
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$data
[
'create_name'
]
=
$
input
[
'user_name'
]
;
OpLogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
...
...
@@ -503,15 +513,13 @@ class QuoteModel extends Model
$res
=
$this
->
where
(
'id'
,
$id
)
->
delete
();
$UserModel
=
new
UserModel
;
$data
=
[];
$data
[
'types'
]
=
2
;
$data
[
'relation_id'
]
=
$input
[
'inquiry_items_id'
];
$data
[
'relation_sn'
]
=
''
;
$data
[
'content'
]
=
$content
;
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$data
[
'create_name'
]
=
$
input
[
'user_name'
]
;
OpLogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
...
...
@@ -549,15 +557,13 @@ class QuoteModel extends Model
// 通知询价人,放入redis
RedisDB
::
sadd
(
'frq_quote_urge'
,
$input
[
'inquiry_items_id'
]);
$UserModel
=
new
UserModel
;
$data
=
[];
$data
[
'types'
]
=
2
;
$data
[
'relation_id'
]
=
$input
[
'inquiry_items_id'
];
$data
[
'relation_sn'
]
=
''
;
$data
[
'content'
]
=
'批量提交报价,询价型号:'
.
$input
[
'inquiry_goods_name'
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$data
[
'create_name'
]
=
$
input
[
'user_name'
]
;
OpLogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
...
...
@@ -575,15 +581,13 @@ class QuoteModel extends Model
try
{
$this
->
where
(
'id'
,
$input
[
'quote_id'
])
->
update
(
$input
[
'quote_info'
]);
$UserModel
=
new
UserModel
;
$data
=
[];
$data
[
'types'
]
=
2
;
$data
[
'relation_id'
]
=
$input
[
'quote_id'
];
$data
[
'relation_sn'
]
=
$input
[
'quote_sn'
];
$data
[
'content'
]
=
'修改报价,报价单号:'
.
$input
[
'quote_sn'
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$
UserModel
->
FinduserInfoName
(
$input
[
'user_id'
])
;
$data
[
'create_name'
]
=
$
input
[
'user_name'
]
;
OpLogModel
::
log
(
$data
);
}
catch
(
Exception
$e
)
{
...
...
@@ -667,7 +671,6 @@ class QuoteModel extends Model
try
{
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
$status
,
'update_time'
=>
time
()]);
$quote_info
=
$this
->
find
(
$id
);
$UserModel
=
new
UserModel
;
$data
=
[];
$data
[
'types'
]
=
1
;
...
...
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