Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
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
b7c5bb73
authored
Oct 18, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新用户推送到CRM
parent
b2060a0b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
app/Http/Controllers/CronController.php
config/website.php
app/Http/Controllers/CronController.php
View file @
b7c5bb73
...
...
@@ -273,10 +273,14 @@ class CronController extends Controller
if
(
empty
(
$user
))
return
'未获取到新用户'
;
$user_send_msg
=
[];
// 需要发送短信的用户ID集合
$crm_params
=
[];
// 推送到crm用户集合
foreach
(
$user
as
$v
)
{
foreach
(
$user
as
$
k
=>
$
v
)
{
if
(
$v
[
'is_new'
]
==
0
)
{
// 未下单用户
$user_send_msg
[]
=
$v
[
'user_id'
];
$crm_params
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$crm_params
[
$k
][
'is_create_order'
]
=
0
;
continue
;
}
...
...
@@ -284,6 +288,9 @@ class CronController extends Controller
$count
=
$OrderModel
->
where
(
'user_id'
,
$v
[
'user_id'
])
->
where
(
'status'
,
'>'
,
2
)
->
count
();
if
(
!
$count
)
$user_send_msg
[]
=
$v
[
'user_id'
];
// 不存在,则表示没有已付款的订单
$crm_params
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$crm_params
[
$k
][
'is_create_order'
]
=
1
;
// 标记已下单
}
if
(
empty
(
$user_send_msg
))
return
'没有需要推送活动短信的用户'
;
...
...
@@ -312,6 +319,17 @@ class CronController extends Controller
errorLog
(
$temp
[
'err_code'
],
$temp
[
'err_msg'
]
.
',用户ID:'
.
$uid
);
// 消息推送失败记录
}
}
// 推送到crm
$crm_url
=
Config
(
'website.crm_domain'
)
.
'/api/notifyNewUser'
;
$crm_header
=
array
(
'api-key: crm a1b2c3d4e5f6g7h8i9jk'
);
$res
=
json_decode
(
curlApi
(
$crm_url
,
$crm_params
,
"POST"
,
false
,
$crm_header
),
true
);
if
(
!
$res
||
$res
[
'err_code'
]
!=
0
)
{
errorLog
(
10001
,
'新用户推送到crm失败 '
.
$res
[
'err_msg'
]);
// 推送crm失败记录
}
}
}
\ No newline at end of file
config/website.php
View file @
b7c5bb73
...
...
@@ -80,4 +80,7 @@ return [
// 订单微服务
'order_api_domain'
=>
'http://orderapi.liexin.com'
,
// crm
'crm_domain'
=>
'http://lcrm.liexin.net'
,
];
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