mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
no message
This commit is contained in:
parent
542e3b9a49
commit
66c8a4db23
@ -503,7 +503,7 @@ class DialogController extends AbstractController
|
|||||||
$user = User::auth();
|
$user = User::auth();
|
||||||
//
|
//
|
||||||
$id = Request::input('id');
|
$id = Request::input('id');
|
||||||
$ids = Base::arrayRetainInt(is_array($id) ? $id : Base::explodeInt($id));
|
$ids = Base::explodeInt($id);
|
||||||
//
|
//
|
||||||
WebSocketDialogMsg::whereIn('id', $ids)->chunkById(20, function($list) use ($user) {
|
WebSocketDialogMsg::whereIn('id', $ids)->chunkById(20, function($list) use ($user) {
|
||||||
/** @var WebSocketDialogMsg $item */
|
/** @var WebSocketDialogMsg $item */
|
||||||
|
|||||||
@ -497,7 +497,7 @@ class ReportController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($ids)) {
|
if (is_string($ids)) {
|
||||||
$ids = explode(",", $ids);
|
$ids = Base::explodeInt($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = Report::with(["receivesUser" => function (BelongsToMany $query) use ($user) {
|
$data = Report::with(["receivesUser" => function (BelongsToMany $query) use ($user) {
|
||||||
|
|||||||
@ -214,6 +214,7 @@ class UsersController extends AbstractController
|
|||||||
{
|
{
|
||||||
"userid": 1,
|
"userid": 1,
|
||||||
"identity": [ ],
|
"identity": [ ],
|
||||||
|
"department": [ ],
|
||||||
"az": "",
|
"az": "",
|
||||||
"email": "admin@admin.com",
|
"email": "admin@admin.com",
|
||||||
"nickname": "admin",
|
"nickname": "admin",
|
||||||
@ -234,6 +235,7 @@ class UsersController extends AbstractController
|
|||||||
//
|
//
|
||||||
$data = $user->toArray();
|
$data = $user->toArray();
|
||||||
$data['nickname_original'] = $user->getRawOriginal('nickname');
|
$data['nickname_original'] = $user->getRawOriginal('nickname');
|
||||||
|
$data['department_name'] = $user->getDepartmentName();
|
||||||
return Base::retSuccess('success', $data);
|
return Base::retSuccess('success', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,6 +640,9 @@ class UsersController extends AbstractController
|
|||||||
if (!is_array($data['department'])) {
|
if (!is_array($data['department'])) {
|
||||||
$data['department'] = [];
|
$data['department'] = [];
|
||||||
}
|
}
|
||||||
|
if (count($data['department']) > 10) {
|
||||||
|
return Base::retError('最多只可加入10个部门');
|
||||||
|
}
|
||||||
foreach ($data['department'] as $id) {
|
foreach ($data['department'] as $id) {
|
||||||
if (!UserDepartment::whereId($id)->exists()) {
|
if (!UserDepartment::whereId($id)->exists()) {
|
||||||
return Base::retError('修改部门不存在');
|
return Base::retError('修改部门不存在');
|
||||||
@ -791,7 +796,7 @@ class UsersController extends AbstractController
|
|||||||
*
|
*
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
* @apiSuccess {Object} data 返回数据(同"获取我的信息"接口)
|
* @apiSuccess {Object} data 返回数据
|
||||||
*/
|
*/
|
||||||
public function email__verification()
|
public function email__verification()
|
||||||
{
|
{
|
||||||
@ -839,7 +844,7 @@ class UsersController extends AbstractController
|
|||||||
*
|
*
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
* @apiSuccess {Object} data 返回数据(同"获取我的信息"接口)
|
* @apiSuccess {Object} data 返回数据
|
||||||
*/
|
*/
|
||||||
public function umeng__alias()
|
public function umeng__alias()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -145,7 +145,24 @@ class User extends AbstractModel
|
|||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return array_filter(is_array($value) ? $value : explode(",", trim($value, ",")));
|
return array_filter(is_array($value) ? $value : Base::explodeInt($value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所属部门名称
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDepartmentName()
|
||||||
|
{
|
||||||
|
if (empty($this->department)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
$list = UserDepartment::select(['id', 'owner_userid', 'name'])->whereIn('id', $this->department)->take(10)->get();
|
||||||
|
$array = [];
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$array[] = $item->name . ($item->owner_userid === $this->userid ? '(M)' : '');
|
||||||
|
}
|
||||||
|
return implode(', ', $array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,7 +230,9 @@ class User extends AbstractModel
|
|||||||
'userid' => $this->userid,
|
'userid' => $this->userid,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
'reason' => $reason,
|
'reason' => $reason,
|
||||||
'cache' => $this->getRawOriginal()
|
'cache' => array_merge($this->getRawOriginal(), [
|
||||||
|
'department_name' => $this->getDepartmentName()
|
||||||
|
])
|
||||||
]);
|
]);
|
||||||
$userDelete->save();
|
$userDelete->save();
|
||||||
// 删除未读
|
// 删除未读
|
||||||
@ -478,12 +497,7 @@ class User extends AbstractModel
|
|||||||
$userInfo = self::whereUserid($userid)->select(User::$basicField)->first();
|
$userInfo = self::whereUserid($userid)->select(User::$basicField)->first();
|
||||||
if ($userInfo) {
|
if ($userInfo) {
|
||||||
$userInfo->online = $userInfo->getOnlineStatus();
|
$userInfo->online = $userInfo->getOnlineStatus();
|
||||||
$departments = [];
|
$userInfo->department_name = $userInfo->getDepartmentName();
|
||||||
$list = UserDepartment::select(['id', 'owner_userid', 'name'])->whereIn('id', $userInfo->department)->get();
|
|
||||||
foreach ($list as $item) {
|
|
||||||
$departments[] = $item->name . ($item->owner_userid === $userid ? '(M)' : '');
|
|
||||||
}
|
|
||||||
$userInfo->department_name = implode(', ', $departments);
|
|
||||||
}
|
}
|
||||||
return $_A["__static_userid2basic_" . $userid] = ($userInfo ?: []);
|
return $_A["__static_userid2basic_" . $userid] = ($userInfo ?: []);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,8 @@ class UserDelete extends AbstractModel
|
|||||||
$name = ($value['userid'] - 1) % 21 + 1;
|
$name = ($value['userid'] - 1) % 21 + 1;
|
||||||
$value['userimg'] = url("images/avatar/default_{$name}.png");
|
$value['userimg'] = url("images/avatar/default_{$name}.png");
|
||||||
}
|
}
|
||||||
|
// 部门
|
||||||
|
$value['department'] = array_filter(is_array($value['department']) ? $value['department'] : Base::explodeInt($value['department']));
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
@ -69,9 +71,8 @@ class UserDelete extends AbstractModel
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$cache = $row->cache;
|
$cache = $row->cache;
|
||||||
$cache = array_intersect_key($cache, array_flip(User::$basicField));
|
$cache = array_intersect_key($cache, array_flip(array_merge(User::$basicField, ['department_name'])));
|
||||||
$cache['delete_at'] = $row->created_at->format($row->dateFormat ?: 'Y-m-d H:i:s');
|
$cache['delete_at'] = $row->created_at->format($row->dateFormat ?: 'Y-m-d H:i:s');
|
||||||
$cache['department_name'] = $cache['department'] ? UserDepartment::whereIn('id', $cache['department'])->pluck('name')->implode(',') : '';
|
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -873,30 +873,31 @@ class Base
|
|||||||
* 打散字符串,只留为数字的项
|
* 打散字符串,只留为数字的项
|
||||||
* @param $delimiter
|
* @param $delimiter
|
||||||
* @param $string
|
* @param $string
|
||||||
|
* @param bool $reInt 是否格式化值
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function explodeInt($delimiter, $string = null)
|
public static function explodeInt($delimiter, $string = null, $reInt = true)
|
||||||
{
|
{
|
||||||
if ($string == null) {
|
if ($string == null) {
|
||||||
$string = $delimiter;
|
$string = $delimiter;
|
||||||
$delimiter = ',';
|
$delimiter = ',';
|
||||||
}
|
}
|
||||||
$array = is_array($string) ? $string : explode($delimiter, $string);
|
$array = is_array($string) ? $string : explode($delimiter, $string);
|
||||||
return self::arrayRetainInt($array);
|
return self::arrayRetainInt($array, $reInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数组只保留数字的
|
* 数组只保留数字的
|
||||||
* @param $array
|
* @param $array
|
||||||
* @param bool $int 是否格式化值
|
* @param bool $reInt 是否格式化值
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function arrayRetainInt($array, $int = false)
|
public static function arrayRetainInt($array, $reInt = false)
|
||||||
{
|
{
|
||||||
foreach ($array as $k => $v) {
|
foreach ($array as $k => $v) {
|
||||||
if (!is_numeric($v)) {
|
if (!is_numeric($v)) {
|
||||||
unset($array[$k]);
|
unset($array[$k]);
|
||||||
} elseif ($int === true) {
|
} elseif ($reInt === true) {
|
||||||
$array[$k] = intval($v);
|
$array[$k] = intval($v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class ProjectLogsRecordUserid extends Migration
|
|||||||
foreach ($lists as $log) {
|
foreach ($lists as $log) {
|
||||||
$record = $log->record;
|
$record = $log->record;
|
||||||
if (is_string($record['userid']) && str_contains($record['userid'], ",")) {
|
if (is_string($record['userid']) && str_contains($record['userid'], ",")) {
|
||||||
$record['userid'] = Base::explodeInt(',', $record['userid']);
|
$record['userid'] = Base::explodeInt($record['userid']);
|
||||||
$log->record = Base::array2json($record);
|
$log->record = Base::array2json($record);
|
||||||
$log->save();
|
$log->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,10 +199,10 @@
|
|||||||
<Form :model="departmentEditData" label-width="auto" @submit.native.prevent>
|
<Form :model="departmentEditData" label-width="auto" @submit.native.prevent>
|
||||||
<Alert type="error" style="margin-bottom:18px">{{$L(`正在进行帐号【ID:${departmentEditData.userid},${departmentEditData.nickname}】部门修改。`)}}</Alert>
|
<Alert type="error" style="margin-bottom:18px">{{$L(`正在进行帐号【ID:${departmentEditData.userid},${departmentEditData.nickname}】部门修改。`)}}</Alert>
|
||||||
<FormItem :label="$L('原部门')">
|
<FormItem :label="$L('原部门')">
|
||||||
<div>{{departmentEditData.old || '-'}}</div>
|
<div style="line-height:24px;padding:4px 0" v-html="departmentEditData.old || '-'"></div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('修改部门')">
|
<FormItem :label="$L('修改部门')">
|
||||||
<Select v-model="departmentEditData.department" multiple :placeholder="$L('留空为默认部门')">
|
<Select v-model="departmentEditData.department" multiple :multiple-max="10" :placeholder="$L('留空为默认部门')">
|
||||||
<Option v-for="(item, index) in departmentList" :value="item.id" :key="index">{{ item.name }}</Option>
|
<Option v-for="(item, index) in departmentList" :value="item.id" :key="index">{{ item.name }}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -718,7 +718,7 @@ export default {
|
|||||||
row.department.some(did => {
|
row.department.some(did => {
|
||||||
const data = this.departmentList.find(d => d.id == did)
|
const data = this.departmentList.find(d => d.id == did)
|
||||||
if (data) {
|
if (data) {
|
||||||
departments.push(data.name)
|
departments.push(data.owner_userid === row.userid ? `${data.name} (${this.$L('负责人')})` : data.name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.departmentEditData = {
|
this.departmentEditData = {
|
||||||
@ -726,7 +726,7 @@ export default {
|
|||||||
userid: row.userid,
|
userid: row.userid,
|
||||||
nickname: row.nickname,
|
nickname: row.nickname,
|
||||||
department: row.department.map(id => parseInt(id)),
|
department: row.department.map(id => parseInt(id)),
|
||||||
old: departments.join(", ")
|
old: departments.join("<br/>")
|
||||||
};
|
};
|
||||||
this.departmentEditShow = true;
|
this.departmentEditShow = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user