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
cfe21d14
authored
Dec 13, 2017
by
李洋
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
手动发消息接口联调
parent
294256d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
23 deletions
app/Http/Controllers/MessageApiController.php
app/Http/Controllers/MessageController.php
app/Http/function.php
public/js/Message/sendmanualmessage.js
resources/views/message/sendmanualmessage.blade.php
app/Http/Controllers/MessageApiController.php
View file @
cfe21d14
...
@@ -194,10 +194,39 @@ class MessageApiController extends Controller
...
@@ -194,10 +194,39 @@ class MessageApiController extends Controller
}
}
$this
->
Export
(
0
,
empty
(
$tpl_model
[
'tpl_id'
])
?
'新增成功'
:
'修改成功'
);
$this
->
Export
(
0
,
empty
(
$tpl_model
[
'tpl_id'
])
?
'新增成功'
:
'修改成功'
);
}
}
//编辑手动消息
//编辑手动消息
//发送手动消息
//发送手动消息
private
function
sendManualMessage
(
$request
)
private
function
sendManualMessage
(
$request
)
{
{
// Csrf($request);
$data
=
$request
->
input
();
$url
=
'http://api.liexin.com/msg/sendMessageByHandle'
;
$params
=
[];
$params
[
'channels'
]
=
$data
[
'channels'
];
$params
[
'msg_type'
]
=
$data
[
'msg_type'
];
// $params['creater'] = $data['creater'];
$params
[
'description'
]
=
$data
[
'description'
];
$params
[
'title_1'
]
=
$data
[
'title_1'
];
$params
[
'title_3'
]
=
$data
[
'title_3'
];
$params
[
'content_1'
]
=
$data
[
'content_1'
];
$params
[
'content_2'
]
=
$data
[
'content_2'
];
$params
[
'content_3'
]
=
$data
[
'content_3'
];
$params
[
'op_type'
]
=
$data
[
'op_type'
];
$params
[
'url'
]
=
$data
[
'url'
];
$params
[
'obj_user'
]
=
$data
[
'obj_user'
];
$params
[
'wechat_tpl_id'
]
=
$data
[
'wechat_tpl_id'
];
$params
[
'expect_send_time'
]
=
$data
[
'expect_send_time'
];
//csrf
$check
[
'k1'
]
=
time
();
$check
[
'k2'
]
=
pwdhash
(
$check
[
'k1'
],
'fh6y5t4rr351d2c3bryi'
);
$params
[
'pf'
]
=
1
;
$params
[
'k1'
]
=
$check
[
'k1'
];
$params
[
'k2'
]
=
$check
[
'k2'
];
$response
=
json_decode
(
curl
(
$url
,
$params
,
1
),
true
);
$this
->
Export
(
$response
[
'err_code'
],
$response
[
'err_msg'
]);
}
}
}
}
\ No newline at end of file
app/Http/Controllers/MessageController.php
View file @
cfe21d14
...
@@ -506,7 +506,7 @@ class MessageController extends Controller
...
@@ -506,7 +506,7 @@ class MessageController extends Controller
$info
=
(
object
)
null
;
$info
=
(
object
)
null
;
$info
->
tpl_id
=
$rq_tpl_id
;
$info
->
tpl_id
=
$rq_tpl_id
;
$info
->
obj_user
=
''
;
$info
->
obj_user
=
''
;
$info
->
expect_send_time
=
0
;
$info
->
expect_send_time
=
''
;
}
}
//通过tpl_id找到模板的渠道们 和 描述
//通过tpl_id找到模板的渠道们 和 描述
...
...
app/Http/function.php
View file @
cfe21d14
...
@@ -322,7 +322,7 @@ function curl($url, $params = false, $ispost = 0, $https = 0)
...
@@ -322,7 +322,7 @@ function curl($url, $params = false, $ispost = 0, $https = 0)
$response
=
curl_exec
(
$ch
);
$response
=
curl_exec
(
$ch
);
if
(
$response
===
FALSE
)
{
if
(
$response
===
FALSE
)
{
//
echo "cURL Error: " . curl_error($ch);
//
echo "cURL Error: " . curl_error($ch);
return
false
;
return
false
;
}
}
$httpCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
$httpCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
...
@@ -331,6 +331,16 @@ function curl($url, $params = false, $ispost = 0, $https = 0)
...
@@ -331,6 +331,16 @@ function curl($url, $params = false, $ispost = 0, $https = 0)
return
$response
;
return
$response
;
}
}
/**
* 统一密码加密
* @param [type] $pwd [description]
* @return [type] [description]
*/
function
pwdhash
(
$pwd
,
$salt
)
{
return
md5
(
md5
(
$pwd
)
.
$salt
);
}
//Csrf接口验证
//Csrf接口验证
function
Csrf
(
$request
){
function
Csrf
(
$request
){
// $Redis =RedisDB::connection('api');
// $Redis =RedisDB::connection('api');
...
...
public/js/Message/sendmanualmessage.js
View file @
cfe21d14
...
@@ -107,32 +107,37 @@ $('#msg_tpl_submit').click(function()
...
@@ -107,32 +107,37 @@ $('#msg_tpl_submit').click(function()
}
}
// addTemplat
e();
sendManualMessag
e
();
})
})
function
addTemplat
e
()
function
sendManualMessag
e
()
{
{
var
ue_inner
=
UE
.
getEditor
(
'inner-tpl-content'
);
var
ue_email
=
UE
.
getEditor
(
'email-tpl-content'
);
$
.
ajax
({
$
.
ajax
({
type
:
'post'
,
type
:
'post'
,
url
:
'/msgapi/
addTemplat
e'
,
url
:
'/msgapi/
sendManualMessag
e'
,
timeout
:
10000
,
//超时时间设置,单位毫秒
timeout
:
10000
,
//超时时间设置,单位毫秒
data
:
{
data
:
{
spu_id
:
$
(
'#spu_id'
).
val
(),
channels
:
getChosenMsgChannels
()?
getChosenMsgChannels
():
''
,
class_id1
:
$
(
'#class_id1'
).
val
(),
msg_type
:
$
(
'#inner-tpl-type option:selected'
).
val
()?
$
(
'#inner-tpl-type option:selected'
).
val
():
''
,
class_id2
:
$
(
'#class_id2'
).
val
(),
// creater:$('#creater').val()?$('#creater').val():'',
class_id3
:
$
(
'#class_id3'
).
val
(),
description
:
$
(
'#msg-tpl-desc'
).
val
()?
$
(
'#msg-tpl-desc'
).
val
():
''
,
brand_id
:
$
(
'#brand_id'
).
val
(),
spu_name
:
$
(
'#spu_name'
).
val
(),
title_1
:
$
(
'#inner-tpl-title'
).
val
()?
$
(
'#inner-tpl-title'
).
val
():
''
,
status
:
$
(
"input[name='status']:checked"
).
val
(),
content_1
:
ue_inner
.
getContent
()?
ue_inner
.
getContent
():
''
,
images_l
:
$
(
'#images_l'
).
val
(),
op_type
:
$
(
"input[name='inner-tpl-op']:checked"
).
val
()?
$
(
"input[name='inner-tpl-op']:checked"
).
val
():
''
,
images_s
:
$
(
'#images_s'
).
val
(),
url
:
$
(
'#inner-tpl-op-url-text'
).
val
()?
$
(
'#inner-tpl-op-url-text'
).
val
():
''
,
encap
:
$
(
'#encap'
).
val
(),
pdf
:
$
(
'#pdf'
).
val
(),
content_2
:
$
(
'#sms-tpl-content'
).
val
()?
$
(
'#sms-tpl-content'
).
val
():
''
,
spu_brief
:
$
(
'#spu_brief'
).
val
(),
has_rohs
:
$
(
"input[name='has_rohs']:checked"
).
val
(),
title_3
:
$
(
'#email-tpl-title'
).
val
()?
$
(
'#email-tpl-title'
).
val
():
''
,
attrs
:
$
(
'#spu_attrs'
).
val
(),
content_3
:
ue_email
.
getContent
()?
ue_email
.
getContent
():
''
,
spu_detail
:
ue
.
getContent
(),
bussiness_area
:
checkBoxes
,
wechat_tpl_id
:
$
(
'#wechat-notify_tpl_title'
).
val
()?
$
(
'#wechat-notify_tpl_title'
).
val
():
''
,
//存放的是微信模板的id
obj_user
:
$
(
'#msg-specified-users-text'
).
val
()?
$
(
'#msg-specified-users-text'
).
val
():
'is_to_all'
,
expect_send_time
:
$
(
'#Choice_start'
).
val
()?
$
(
'#Choice_start'
).
val
():
''
,
},
},
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
resp
){
success
:
function
(
resp
){
...
...
resources/views/message/sendmanualmessage.blade.php
View file @
cfe21d14
...
@@ -205,7 +205,7 @@
...
@@ -205,7 +205,7 @@
<div
class=
"col-sm-5"
>
<div
class=
"col-sm-5"
>
<input
type=
"radio"
id=
"inner-tpl-op-open"
name=
"inner-tpl-op"
value=
"1"
@
if
(!
empty
($
info-
>
channel_tpls['1'])
&&
1==$info->channel_tpls['1']->op_type) checked @endif/>
<label
for=
"inner-tpl-op-open"
>
打开消息
</label>
<input
type=
"radio"
id=
"inner-tpl-op-open"
name=
"inner-tpl-op"
value=
"1"
@
if
(!
empty
($
info-
>
channel_tpls['1'])
&&
1==$info->channel_tpls['1']->op_type) checked @endif/>
<label
for=
"inner-tpl-op-open"
>
打开消息
</label>
<input
type=
"radio"
id=
"inner-tpl-op-url"
name=
"inner-tpl-op"
value=
"2"
@
if
(!
empty
($
info-
>
channel_tpls['1'])
&&
2==$info->channel_tpls['1']->op_type) checked @endif/>
<label
for=
"inner-tpl-op-url"
>
打开URL
</label>
<input
type=
"radio"
id=
"inner-tpl-op-url"
name=
"inner-tpl-op"
value=
"2"
@
if
(!
empty
($
info-
>
channel_tpls['1'])
&&
2==$info->channel_tpls['1']->op_type) checked @endif/>
<label
for=
"inner-tpl-op-url"
>
打开URL
</label>
<input
type=
"text"
id=
"inner-tpl-op-url-text"
name=
"inner-tpl-url-text"
placeholder=
"请输入URL"
value=
@if(!empty($info-
>
channel_tpls['1'])
&&
2==$info->channel_tpls['1']->op_type) "{{ $info->channel_tpls['1']->url }}" @endif>
<input
class=
"form-control"
type=
"text"
id=
"inner-tpl-op-url-text"
name=
"inner-tpl-url-text"
placeholder=
"请输入URL"
value=
@if(!empty($info-
>
channel_tpls['1'])
&&
2==$info->channel_tpls['1']->op_type) "{{ $info->channel_tpls['1']->url }}" @endif>
</div>
</div>
</div>
</div>
...
@@ -259,7 +259,7 @@
...
@@ -259,7 +259,7 @@
<div
class=
"col-sm-5"
>
<div
class=
"col-sm-5"
>
<input
type=
"radio"
name=
"user-range"
id=
"user-range-all"
class=
"form-control"
value=
"1"
@
if
(
empty
($
info-
>
obj_user)) checked @endif/>
<label
for=
"user-range-all"
>
所有用户
</label>
<input
type=
"radio"
name=
"user-range"
id=
"user-range-all"
class=
"form-control"
value=
"1"
@
if
(
empty
($
info-
>
obj_user)) checked @endif/>
<label
for=
"user-range-all"
>
所有用户
</label>
<input
type=
"radio"
name=
"user-range"
id=
"user-range-specified"
class=
"form-control"
value=
"3"
@
if
(!
empty
($
info-
>
obj_user)) checked @endif/>
<label
for=
"user-range-specified"
>
指定用户
</label>
<input
type=
"radio"
name=
"user-range"
id=
"user-range-specified"
class=
"form-control"
value=
"3"
@
if
(!
empty
($
info-
>
obj_user)) checked @endif/>
<label
for=
"user-range-specified"
>
指定用户
</label>
<input
type=
"text"
id=
"msg-specified-users-text"
name=
"msg-specified-users-text"
placeholder=
"请输入指定用户"
style=
"width: 200px"
value=
"{{ $info->obj_user }}"
/>
<input
type=
"text"
class=
"form-control"
id=
"msg-specified-users-text"
name=
"msg-specified-users-text"
placeholder=
"请输入指定用户"
style=
"width: 200px"
value=
"{{ $info->obj_user }}"
/>
</div>
</div>
</div>
</div>
...
...
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