Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
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
fddf8d7f
authored
Feb 13, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev/ver/1.0.0' of
http://git.ichunt.net/semour/semour_web
into dev/ver/1.0.0
parents
45aa4c3b
1ceaa074
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
2 deletions
app/Http/Controllers/HomeController.php
app/Http/Services/InquiryService.php
app/Http/Services/OrderService.php
app/helpers.php
app/Http/Controllers/HomeController.php
View file @
fddf8d7f
...
@@ -26,6 +26,16 @@ class HomeController extends Controller
...
@@ -26,6 +26,16 @@ class HomeController extends Controller
*/
*/
public
function
index
()
public
function
index
()
{
{
// $data = [
// 'name'=>rand(100,100000),
// 'order_sn'=>rand(100,100000),
// ];
// $res = SendMsg($data,'semour_order',['13713025362'],0);
// $res = SendMsg($data,'semour_order',['578953158@qq.com'],1);
// print_r($res);
// die();
return
view
(
'home.home'
);
return
view
(
'home.home'
);
}
}
}
}
app/Http/Services/InquiryService.php
View file @
fddf8d7f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Http\Services
;
namespace
App\Http\Services
;
use
App\Models\Cms\CmsUserModel
;
use
App\Models\InquiryModel
;
use
App\Models\InquiryModel
;
use
App\Models\InquiryItemsModel
;
use
App\Models\InquiryItemsModel
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
...
@@ -15,8 +16,9 @@ class InquiryService
...
@@ -15,8 +16,9 @@ class InquiryService
$items
=
\Arr
::
get
(
$data
,
'items'
,
[]);
$items
=
\Arr
::
get
(
$data
,
'items'
,
[]);
$items
=
json_decode
(
$items
,
true
);
$items
=
json_decode
(
$items
,
true
);
$remark
=
$data
[
'remark'
];
$remark
=
$data
[
'remark'
];
$sn
=
self
::
generateSn
();
$inquiry
=
[
$inquiry
=
[
'inquiry_sn'
=>
self
::
generateSn
()
,
'inquiry_sn'
=>
$sn
,
'user_id'
=>
$user
->
id
,
'user_id'
=>
$user
->
id
,
'sales_id'
=>
$user
->
sale_id
,
'sales_id'
=>
$user
->
sale_id
,
'priority'
=>
InquiryModel
::
PRIORITY_HIGH
,
'priority'
=>
InquiryModel
::
PRIORITY_HIGH
,
...
@@ -35,7 +37,25 @@ class InquiryService
...
@@ -35,7 +37,25 @@ class InquiryService
'remark'
=>
$remark
,
'remark'
=>
$remark
,
];
];
}
}
return
InquiryItemsModel
::
addInquiryItems
(
$inquiryItems
);
$result
=
InquiryItemsModel
::
addInquiryItems
(
$inquiryItems
);
if
(
$result
)
{
//判断客户类型,如果是个人则取客户名称,如果是公司取公司名称
if
(
$user
->
account_properties
==
1
)
{
$name
=
$user
->
name
;
}
else
{
$name
=
$user
->
company_name
;
}
if
(
empty
(
$user
->
sale_id
))
{
return
true
;
}
$salesEmail
=
CmsUserModel
::
where
(
'userId'
,
$user
->
sale_id
)
->
value
(
'email'
);
$data
=
[
'name'
=>
$name
,
'inquiry_sn'
=>
$sn
,
];
SendMsg
(
$data
,
'semour_inquire'
,
[
$salesEmail
],
1
);
}
return
$result
;
});
});
}
}
...
...
app/Http/Services/OrderService.php
View file @
fddf8d7f
...
@@ -4,6 +4,7 @@ namespace App\Http\Services;
...
@@ -4,6 +4,7 @@ namespace App\Http\Services;
use
App\Exceptions\InvalidRequestException
;
use
App\Exceptions\InvalidRequestException
;
use
App\Http\Models\User\TaxInfoModel
;
use
App\Http\Models\User\TaxInfoModel
;
use
App\Models\Cms\CmsUserModel
;
use
App\Models\OrderAddressModel
;
use
App\Models\OrderAddressModel
;
use
App\Models\OrderItemsModel
;
use
App\Models\OrderItemsModel
;
use
App\Models\OrderModel
;
use
App\Models\OrderModel
;
...
@@ -226,6 +227,19 @@ class OrderService
...
@@ -226,6 +227,19 @@ class OrderService
$con
->
commit
();
$con
->
commit
();
#发送钉钉消息
$saleInfo
=
CmsUserModel
::
getInfoByUserId
(
$userInfo
[
"sale_id"
]);
$msgData
=
[
'name'
=>
$userInfo
[
"account_properties"
]
==
1
?
$userInfo
[
"name"
]
:
$userInfo
[
"company_name"
],
'order_sn'
=>
$order_sn
,
];
if
(
$saleInfo
[
"mobile"
]){
SendMsg
(
$msgData
,
'semour_order'
,[
$saleInfo
[
"mobile"
]],
0
);
}
if
(
$saleInfo
[
"email"
]){
SendMsg
(
$msgData
,
'semour_order'
,[
$saleInfo
[
"email"
]],
1
);
}
return
$order_id
;
return
$order_id
;
}
catch
(
\Exception
$e
){
}
catch
(
\Exception
$e
){
$con
->
rollback
();
$con
->
rollback
();
...
...
app/helpers.php
View file @
fddf8d7f
...
@@ -26,6 +26,38 @@ if (!function_exists('generate_letters')) {
...
@@ -26,6 +26,38 @@ if (!function_exists('generate_letters')) {
}
}
/*
/*
* 发送信息
* @param array $data 替换的内容数组,["name"=>"小红"]
* @param string $key 在消息系统新建的模板编号,如:
semour_inquire 深茂询价消息
semour_order 深茂订单消息
* @param array $ToUser 指定接收人 [13713025362,13713025363]
*/
function
SendMsg
(
$data
=
[],
$key
=
''
,
$ToUser
=
'INNER_PERSON'
,
$is_ignore
=
0
){
if
(
$key
==
""
){
return
false
;
}
$touser_json
=
json_encode
(
$ToUser
);
$check
[
'touser'
]
=
$touser_json
;
$check
[
'data'
]
=
urldecode
(
json_encode
(
$data
,
JSON_UNESCAPED_UNICODE
));
# $check['data'] ="{\"goods_name\":\"MPVZ5004GW7U\",\"brand_name\":\"恩智浦牌\\/NXP牌\",\"goods_title\":\"多元件集成电路\",\"material_sn\":\"WL2021060300070421\",\"tax_rate_low\":\"0.7000\",\"tax_rate_land\":\"0.0000\",\"tax_rate_added\":\"13.0000\",\"supervision_con\":\"\",\"number\":\"8542391000\"}";
$check
[
'pf'
]
=
1
;
$check
[
'keyword'
]
=
$key
;
$check
[
'is_ignore'
]
=
$is_ignore
;
$check
[
'k1'
]
=
time
();
$check
[
'k2'
]
=
MD5
(
MD5
(
$check
[
'k1'
])
.
"fh6y5t4rr351d2c3bryi"
);
$response
=
Http
::
asForm
()
->
post
(
"http://api.ichunt.com/msg/sendMessageByAuto"
,
$check
);
# print_r($response->body());
# die();
$res
=
json_decode
(
$response
->
body
(),
true
);
if
(
empty
(
$res
[
'err_code'
])
||
$res
[
'err_code'
]
!=
0
)
return
false
;
return
true
;
}
/*
* 反爬虫用html标签替换数字,不包括“.”
* 反爬虫用html标签替换数字,不包括“.”
* $number 数字串
* $number 数字串
*/
*/
...
...
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