Commit bb922e45 by 孙龙

up

parent 02e220b7
......@@ -542,11 +542,11 @@ class MessageApiController extends Controller
public function updateMsgExcel(Request $request){
$file = $request->file('file');
$tp_id = $request->get('inner-choose-type');
if(!$tp_id) return back()->with("error_batch_msg","请选择对应消息模板");
if(!$tp_id) return $this->Export(-1, "请选择对应消息模板");
$info = DB::connection("message")->table("lie_msg_tpl")->where("tpl_id",intval($tp_id))->select("tpl_id","channels","description")->first();
if(!$info) return back()->with("error_batch_msg","没找到对应消息模板");
if(count(explode(",",$info->channels)) > 1) return back()->with("error_batch_msg","暂只支持一种渠道消息,请完善模板消息后再来");
if(!in_array($info->channels,[1,2,3])) return back()->with("error_batch_msg","暂支持单独发送邮件或短信");
if(!$info) return $this->Export(-1, "没找到对应消息模板");
if(count(explode(",",$info->channels)) > 1) return $this->Export(-1, "暂只支持一种渠道消息,请完善模板消息后再来");
if(!in_array($info->channels,[1,2,3])) return $this->Export(-1, "暂支持单独发送邮件或短信");
if($file){
try{
$excel_file_path = $file->getRealPath();
......@@ -615,13 +615,13 @@ class MessageApiController extends Controller
$channel->close();
$connection->close();
// exit;
return back()->with("success_batch_msg","上传成功");
return $this->Export(0, "上传成功");
}catch(\Exception $e){
$channel->tx_rollback();
return back()->with("error_batch_msg",$e->getMessage());
return $this->Export(-1, $e->getMessage());
}
}
return back()->with("error_batch_msg","请务必上传文件");
return $this->Export(-1, '请务必上传文件');
}
}
\ No newline at end of file
<script type="text/javascript" charset="utf-8" src="/js/Message/editor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/Message/editor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/Message/editor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/Message/jquery.form.js"></script>
<style type="text/css">
.demo{ background: #ffded7; padding: 2em 0;}
......@@ -98,21 +99,11 @@
}
</style>
@if(session("error_batch_msg"))
<div class="form-group">
<div class="alert alert-danger">
{{session("error_batch_msg")}}
</div>
</div>
@endif
@if(session("success_batch_msg"))
@if(session("error_batch_msg"))
<div class="form-group">
<div class="alert alert-success">
{{session("success_batch_msg")}}
{{session("error_batch_msg")}}
</div>
</div>
@endif
......@@ -342,7 +333,16 @@
layer.msg('请选择对应消息模板');
return false;
}
$("#postForm").submit();
// $("#postForm").submit();
$("#postForm").ajaxSubmit({
url: "/msgapi/updateMsgExcel",
type: "post",
enctype:'multipart/form-data',
success: function(data) {
alert(data.errmsg)
}
});
layer.msg('提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
// var index = layer.load(0, {shade: false});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment