Browse Source

新增 寄新人手冊的功能

gary
gary_chen\gary_chen 1 year ago
parent
commit
5874e1f953
  1. 85
      wms/account-index-submit.php
  2. 27
      wms/account-index.php
  3. 5
      wms/class/Cmail.php
  4. BIN
      wms/public/file/永佳捷雲端空間使用設定方式.pdf

85
wms/account-index-submit.php

@ -0,0 +1,85 @@
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
include "database.php";
include 'class/Cmail.php';
header('Content-Type: application/json');
$method = $_POST['method'];
$id = empty($_POST['id']) ? '' : $_POST['id'];
$sql = "
SELECT * FROM account WHERE id = '$id'
";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_assoc($result);
$cmail = new Cmail();
$subject = "永佳捷新人文件";
$em_body = "";
$file_name = str_replace('/', '\\', __DIR__ . "/public/file/永佳捷雲端空間使用設定方式.pdf");
$file[0] = [$file_name, "永佳捷雲端空間使用設定方式.pdf"];
$sendlist[0] = [$data['name'], $data['email']];
// 保養人員
if (in_array($data['accounttype'], ['B'])) {
$em_body = "
您好,我是桃園資訊處的子苹,
以下是給新報到同仁的基本資訊,您再參考:
員編:" . $data['accountid'] . "
公司手機門號:請和資訊人員聯絡
你的email:" . $data['email'] . "
web收信:http://webmail.masada.com.tw:8081
帳號:" . explode('@', $data['email'])[0] . "
密碼:" . $data['accountid'] . "
登入後密碼可再自行更改
除了這個web方式收信,你也可以點擊手機裡的gmail收發信
桌面有安裝「維保APP系統」
登入帳號 " . $data['accountid'] . "
密碼 " . explode('@', $data['email'])[0] . "
GPS定位APP的登入帳密跟上面的一樣
http://oa.masada.com.tw
這是公司內部系統
登入帳號:" . $data['accountid'] . "
登入密碼:" . explode('@', $data['email'])[0] . "
https://cloud.masada.com.tw:1846/
這是公司雲端系統
預設帳密在信箱 請記得去更改密碼
以上,有問題請隨時與資訊聯繫,謝謝!
";
}
// 員工
if (in_array($data['accounttype'], ['M', 'E'])) {
$em_body = "
您好,
以下是給新報到同仁的基本資訊,您再參考:
員編:" . $data['accountid'] . "
你的email:" . $data['email'] . "
web收信:http://webmail.masada.com.tw:8081
帳號:" . explode('@', $data['email'])[0] . "
密碼:" . $data['accountid'] . "
登入後密碼可再自行更改
除了這個web方式收信,你也可以用電腦裡的outlook收發信
http://oa.masada.com.tw
這是公司內部系統
登入帳號:" . $data['accountid'] . "
登入密碼:" . explode('@', $data['email'])[0] . "
https://cloud.masada.com.tw:1846/
這是公司雲端系統
預設帳密在信箱 請記得去更改密碼
以上,有問題請隨時與資訊聯繫,謝謝!
";
}
$cmail->sendx($subject, $em_body, $sendlist, "永佳捷科技", "", $file);
echo json_encode([1, "信件發送成功"]);
}

27
wms/account-index.php

@ -63,19 +63,21 @@ img {
table { table {
width: 100%; width: 100%;
} }
#table_index_filter { #table_index_filter {
float: right; float: right;
} }
#table_index_paginate { #table_index_paginate {
float: right; float: right;
} }
label { label {
display: inline-flex; display: inline-flex;
margin-bottom: .5rem; margin-bottom: .5rem;
margin-top: .5rem; margin-top: .5rem;
} }
</style> </style>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
@ -99,6 +101,7 @@ label {
<th>建檔時間</th> <th>建檔時間</th>
<?php if ($user_auth & 2) { ?> <?php if ($user_auth & 2) { ?>
<th>修改</th> <th>修改</th>
<th>新人資料</th>
<!--<th>刪除</th>--> <!--<th>刪除</th>-->
<?php } ?> <?php } ?>
</tr> </tr>
@ -153,12 +156,34 @@ label {
</p> </p>
</td>--> </td>-->
<?php } ?> <?php } ?>
<td>
<button type="button" class="btn" onclick="sendJuniorStaffDoc(<?php echo $data['id']; ?>)">寄送</button>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
<script>
function sendJuniorStaffDoc(id) {
$.ajax({
url: window.location.origin + '/wms/account-index-submit.php',
type: 'POST',
data: {
'method': 'sendJuniorStaffDoc',
'id': id
},
dataType: 'json',
success: function(response) {
alert("寄送成功!");
},
error: function(xhr, status, error) {
alert("寄送失敗!");
}
});
}
</script>
<?php <?php
else : else :

5
wms/class/Cmail.php

@ -1,4 +1,5 @@
<?php <?php
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\Exception;
@ -52,6 +53,10 @@ class Cmail
//$mail->addCC("personC@gmail.com", "person C"); //$mail->addCC("personC@gmail.com", "person C");
//$mail->addBCC("personD@gmail.com", "person D"); //$mail->addBCC("personD@gmail.com", "person D");
//$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg //$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg
foreach ($files as $v) {
list($file, $file_name) = $v;
$mail->addAttachment($file, $file_name);
}
//print_r($mail);exit; //print_r($mail);exit;
if (!$mail->Send()) { if (!$mail->Send()) {
// echo "Mailer error: " . $mail->ErrorInfo; // echo "Mailer error: " . $mail->ErrorInfo;

BIN
wms/public/file/永佳捷雲端空間使用設定方式.pdf

Binary file not shown.
Loading…
Cancel
Save