代码提交
This commit is contained in:
@@ -24,7 +24,7 @@ class AccountController extends BaseController
|
|||||||
$params = [
|
$params = [
|
||||||
'showNormalAccount' => $this->request->param('showNormalAccount', ''),
|
'showNormalAccount' => $this->request->param('showNormalAccount', ''),
|
||||||
'keyword' => $this->request->param('keyword', ''),
|
'keyword' => $this->request->param('keyword', ''),
|
||||||
'departmentId' => $this->request->param('departmentId', ''),
|
'departmentId' => $this->request->param('companyId', ''),
|
||||||
'pageIndex' => $this->request->param('pageIndex', 0),
|
'pageIndex' => $this->request->param('pageIndex', 0),
|
||||||
'pageSize' => $this->request->param('pageSize', 12)
|
'pageSize' => $this->request->param('pageSize', 12)
|
||||||
];
|
];
|
||||||
@@ -123,7 +123,7 @@ class AccountController extends BaseController
|
|||||||
$realName = $this->request->param('realName', '');
|
$realName = $this->request->param('realName', '');
|
||||||
$nickname = $this->request->param('nickname', '');
|
$nickname = $this->request->param('nickname', '');
|
||||||
$memo = $this->request->param('memo', '');
|
$memo = $this->request->param('memo', '');
|
||||||
$departmentId = $this->request->param('departmentId', 0);
|
$companyId = $this->request->param('companyId', 0);
|
||||||
|
|
||||||
// 用户名验证
|
// 用户名验证
|
||||||
if (empty($userName)) {
|
if (empty($userName)) {
|
||||||
@@ -154,7 +154,7 @@ class AccountController extends BaseController
|
|||||||
|
|
||||||
// 部门ID验证
|
// 部门ID验证
|
||||||
if (empty($departmentId)) {
|
if (empty($departmentId)) {
|
||||||
return errorJson('部门ID不能为空');
|
return errorJson('公司ID不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建请求参数
|
// 构建请求参数
|
||||||
@@ -164,8 +164,8 @@ class AccountController extends BaseController
|
|||||||
'realName' => $realName,
|
'realName' => $realName,
|
||||||
'nickname' => $nickname,
|
'nickname' => $nickname,
|
||||||
'memo' => $memo,
|
'memo' => $memo,
|
||||||
'departmentId' => $departmentId,
|
'departmentId' => $companyId,
|
||||||
'departmentIdArr' => empty($departmentId) ? [914] : [914, $departmentId]
|
'departmentIdArr' => empty($companyId) ? [914] : [914, $companyId]
|
||||||
];
|
];
|
||||||
// 设置请求头
|
// 设置请求头
|
||||||
$headerData = ['client:system'];
|
$headerData = ['client:system'];
|
||||||
@@ -197,7 +197,7 @@ class AccountController extends BaseController
|
|||||||
$deleteTime = isset($item['deleteTime']) ? strtotime($item['deleteTime']) : null;
|
$deleteTime = isset($item['deleteTime']) ? strtotime($item['deleteTime']) : null;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'accountId' => $item['id'],
|
'tenantId' => $item['id'],
|
||||||
'accountType' => isset($item['accountType']) ? $item['accountType'] : 0,
|
'accountType' => isset($item['accountType']) ? $item['accountType'] : 0,
|
||||||
'status' => isset($item['status']) ? $item['status'] : 0,
|
'status' => isset($item['status']) ? $item['status'] : 0,
|
||||||
'tenantId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
|
'tenantId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
|
||||||
@@ -211,7 +211,7 @@ class AccountController extends BaseController
|
|||||||
'creator' => isset($item['creator']) ? $item['creator'] : 0,
|
'creator' => isset($item['creator']) ? $item['creator'] : 0,
|
||||||
'creatorUserName' => isset($item['creatorUserName']) ? $item['creatorUserName'] : '',
|
'creatorUserName' => isset($item['creatorUserName']) ? $item['creatorUserName'] : '',
|
||||||
'creatorRealName' => isset($item['creatorRealName']) ? $item['creatorRealName'] : '',
|
'creatorRealName' => isset($item['creatorRealName']) ? $item['creatorRealName'] : '',
|
||||||
'departmentId' => isset($item['departmentId']) ? $item['departmentId'] : 0,
|
'companyId' => isset($item['departmentId']) ? $item['departmentId'] : 0,
|
||||||
'departmentName' => isset($item['departmentName']) ? $item['departmentName'] : '',
|
'departmentName' => isset($item['departmentName']) ? $item['departmentName'] : '',
|
||||||
'privilegeIds' => isset($item['privilegeIds']) ? $item['privilegeIds'] : [],
|
'privilegeIds' => isset($item['privilegeIds']) ? $item['privilegeIds'] : [],
|
||||||
'alive' => isset($item['alive']) ? $item['alive'] : false,
|
'alive' => isset($item['alive']) ? $item['alive'] : false,
|
||||||
@@ -220,8 +220,8 @@ class AccountController extends BaseController
|
|||||||
'deleteTime' => $deleteTime
|
'deleteTime' => $deleteTime
|
||||||
];
|
];
|
||||||
|
|
||||||
// 使用accountId作为唯一性判断
|
// 使用tenantId作为唯一性判断
|
||||||
$account = CompanyAccountModel::where('accountId', $item['id'])->find();
|
$account = CompanyAccountModel::where('tenantId', $item['id'])->find();
|
||||||
|
|
||||||
if ($account) {
|
if ($account) {
|
||||||
$account->save($data);
|
$account->save($data);
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class DeviceController extends BaseController
|
|||||||
'wechatAccounts' => isset($item['wechatAccounts']) ? json_encode($item['wechatAccounts']) : json_encode([]),
|
'wechatAccounts' => isset($item['wechatAccounts']) ? json_encode($item['wechatAccounts']) : json_encode([]),
|
||||||
'alive' => isset($item['alive']) ? $item['alive'] : false,
|
'alive' => isset($item['alive']) ? $item['alive'] : false,
|
||||||
'lastAliveTime' => isset($item['lastAliveTime']) ? $item['lastAliveTime'] : null,
|
'lastAliveTime' => isset($item['lastAliveTime']) ? $item['lastAliveTime'] : null,
|
||||||
'tenantId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
|
'companyId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
|
||||||
'groupId' => isset($item['groupId']) ? $item['groupId'] : 0,
|
'groupId' => isset($item['groupId']) ? $item['groupId'] : 0,
|
||||||
'currentAccountId' => isset($item['currentAccountId']) ? $item['currentAccountId'] : 0,
|
'currentAccountId' => isset($item['currentAccountId']) ? $item['currentAccountId'] : 0,
|
||||||
'imei' => $item['imei'],
|
'imei' => $item['imei'],
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ class Api extends Controller
|
|||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
|
||||||
header('Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');
|
header('Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');
|
||||||
|
header('Access-Control-Max-Age: 1728000');
|
||||||
|
header('Access-Control-Allow-Credentials: true');
|
||||||
|
|
||||||
|
|
||||||
// 对OPTIONS请求直接返回
|
// 对OPTIONS请求直接返回
|
||||||
if ($this->requestType === 'OPTIONS') {
|
if ($this->requestType === 'OPTIONS') {
|
||||||
Response::create()->send();
|
Response::create()->send();
|
||||||
|
|||||||
Reference in New Issue
Block a user