diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php
new file mode 100755
index 00000000..aff301c0
--- /dev/null
+++ b/app/Http/Controllers/Api/ProjectController.php
@@ -0,0 +1,144 @@
+where('project_users.userid', $user->userid)
+ ->orderByDesc('projects.id')
+ ->paginate(Base::getPaginate(200, 100));
+ //
+ return Base::retSuccess('success', $list);
+ }
+
+ /**
+ * 项目详情
+ *
+ * @apiParam {Number} project_id 项目ID
+ */
+ public function detail()
+ {
+ $user = User::authE();
+ if (Base::isError($user)) {
+ return $user;
+ } else {
+ $user = User::IDE($user['data']);
+ }
+ //
+ $project_id = intval(Request::input('project_id'));
+ //
+ $project = Project::with(['projectColumn' => function($query) {
+ $query->with(['projectTask' => function($taskQuery) {
+ $taskQuery->where('parent_id', 0);
+ }]);
+ }, 'projectUser'])
+ ->join('project_users', 'projects.id', '=', 'project_users.project_id')
+ ->where('projects.id', $project_id)
+ ->where('project_users.userid', $user->userid)
+ ->first();
+ //
+ return Base::retSuccess('success', $project);
+ }
+
+ /**
+ * 添加项目
+ *
+ * @apiParam {String} name 项目名称
+ * @apiParam {String} [desc] 项目描述
+ * @apiParam {Array} [columns] 流程,格式[流程1, 流程2]
+ */
+ public function add()
+ {
+ $user = User::authE();
+ if (Base::isError($user)) {
+ return $user;
+ } else {
+ $user = User::IDE($user['data']);
+ }
+ //项目名称
+ $name = trim(Request::input('name', ''));
+ $desc = trim(Request::input('desc', ''));
+ if (mb_strlen($name) < 2) {
+ return Base::retError('项目名称不可以少于2个字!');
+ } elseif (mb_strlen($name) > 32) {
+ return Base::retError('项目名称最多只能设置32个字!');
+ }
+ //流程
+ $columns = Request::input('columns');
+ if (!is_array($columns)) $columns = [];
+ $insertColumns = [];
+ $inorder = 0;
+ foreach ($columns AS $column) {
+ $column = trim($column);
+ if ($column) {
+ $insertColumns[] = [
+ 'name' => $column,
+ 'inorder' => $inorder++,
+ ];
+ }
+ }
+ if (empty($insertColumns)) {
+ $insertColumns[] = [
+ 'name' => 'Default',
+ 'inorder' => 0,
+ ];
+ }
+ if (count($insertColumns) > 30) {
+ return Base::retError('项目流程最多不能超过30个!');
+ }
+ //开始创建
+ $project = Project::createInstance([
+ 'name' => $name,
+ 'desc' => $desc,
+ 'userid' => $user->userid,
+ ]);
+ return AbstractModel::transaction(function() use ($user, $insertColumns, $project) {
+ $project->save();
+ ProjectUser::createInstance([
+ 'project_id' => $project->id,
+ 'userid' => $user->userid,
+ 'owner' => 1,
+ ])->save();
+ ProjectLog::createInstance([
+ 'project_id' => $project->id,
+ 'userid' => $user->userid,
+ 'detail' => '创建项目',
+ ])->save();
+ foreach ($insertColumns AS $column) {
+ $column['project_id'] = $project->id;
+ ProjectColumn::createInstance($column)->save();
+ }
+ return Base::retSuccess('添加成功!');
+ });
+ }
+}
diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php
index eab1b08d..51d90d49 100755
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@ -311,7 +311,7 @@ class UsersController extends AbstractController
}
/**
- * @api {get} api/users/searchinfo 08. 搜索会员列表
+ * @api {get} api/users/search 08. 搜索会员列表
*
* @apiDescription 搜索会员列表
* @apiVersion 1.0.0
@@ -319,65 +319,29 @@ class UsersController extends AbstractController
* @apiName searchinfo
*
* @apiParam {Object} where 搜索条件
- * - where.email
- * - where.noemail
- * - where.username
- * - where.nousername
- * - where.usernameequal
- * - where.noidentity
- * - where.identity
+ * - where.key 昵称、邮箱、用户名
* @apiParam {Number} [take] 获取数量,10-100
*
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
* @apiSuccess {String} msg 返回信息(错误描述)
* @apiSuccess {Object} data 返回数据
*/
- public function searchinfo()
+ public function search()
{
+ $builder = User::select(['userid', 'email', 'username', 'nickname', 'userimg']);
+ //
$keys = Request::input('where');
- $whereArr = [];
- $whereRaw = null;
- if ($keys['email']) $whereArr[] = ['email', '=', $keys['email']];
- if ($keys['usernameequal']) $whereArr[] = ['username', '=', $keys['usernameequal']];
- if ($keys['identity']) $whereArr[] = ['identity', 'like', '%,' . $keys['identity'] . ',%'];
- if ($keys['noidentity']) $whereArr[] = ['identity', 'not like', '%,' . $keys['noidentity'] . ',%'];
- if ($keys['username']) {
- $whereRaw.= $whereRaw ? ' AND ' : '';
- $whereRaw.= "(`username` LIKE '%" . $keys['username'] . "%' OR `nickname` LIKE '%" . $keys['username'] . "%')";
- }
- if ($keys['nousername']) {
- $nousername = [];
- foreach (explode(",", $keys['nousername']) AS $name) {
- $name = trim($name);
- if ($name && !in_array($name, $nousername)) {
- $nousername[] = $name;
- }
- }
- if ($nousername) {
- $whereRaw.= $whereRaw ? ' AND ' : '';
- $whereRaw.= "(`username` NOT IN ('" . implode("','", $nousername) . "'))";
- }
- }
- if ($keys['noemail']) {
- $noemail = [];
- foreach (explode(",", $keys['noemail']) AS $email) {
- $email = trim($email);
- if ($email && !in_array($email, $noemail)) {
- $noemail[] = $email;
- }
- }
- if ($noemail) {
- $whereRaw.= $whereRaw ? ' AND ' : '';
- $whereRaw.= "(`email` NOT IN ('" . implode("','", $noemail) . "'))";
+ if (is_array($keys)) {
+ if ($keys['key']) {
+ $builder->where(function($query) use ($keys) {
+ $query->where('email', 'like', '%,' . $keys['key'] . ',%')
+ ->orWhere('username', 'like', '%,' . $keys['key'] . ',%')
+ ->orWhere('nickname', 'like', '%,' . $keys['key'] . ',%');
+ });
}
}
//
- $list = User::select(['userid', 'email', 'username', 'nickname', 'userimg'])
- ->where($whereArr)
- ->whereRaw($whereRaw)
- ->orderBy('userid')
- ->take(Base::getPaginate(100, 10, 'take'))
- ->get();
+ $list = $builder->orderBy('userid')->take(Base::getPaginate(100, 10, 'take'))->get();
return Base::retSuccess('success', $list);
}
@@ -389,7 +353,7 @@ class UsersController extends AbstractController
* @apiGroup users
* @apiName basic
*
- * @apiParam {String} email 会员用户名(多个格式:jsonArray,一次最多30个)
+ * @apiParam {Number} userid 会员ID(多个格式:jsonArray,一次最多30个)
*
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
* @apiSuccess {String} msg 返回信息(错误描述)
@@ -397,17 +361,17 @@ class UsersController extends AbstractController
*/
public function basic()
{
- $email = trim(Request::input('email'));
- $array = Base::json2array($email);
+ $userid = Request::input('userid');
+ $array = Base::json2array($userid);
if (empty($array)) {
- $array[] = $email;
+ $array[] = $userid;
}
if (count($array) > 50) {
return Base::retError(['一次最多只能获取%条数据!', 50]);
}
$retArray = [];
- foreach ($array AS $name) {
- $basic = User::email2basic($name);
+ foreach ($array AS $id) {
+ $basic = User::userid2basic($id);
if ($basic) {
$retArray[] = $basic;
}
diff --git a/app/Models/Project.php b/app/Models/Project.php
new file mode 100644
index 00000000..e7c28a0d
--- /dev/null
+++ b/app/Models/Project.php
@@ -0,0 +1,66 @@
+hasMany(projectColumn::class, 'project_id', 'id')->orderByDesc('id');
+ }
+
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function projectLog(): \Illuminate\Database\Eloquent\Relations\HasMany
+ {
+ return $this->hasMany(projectLog::class, 'project_id', 'id')->orderByDesc('id');
+ }
+
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function projectUser(): \Illuminate\Database\Eloquent\Relations\HasMany
+ {
+ return $this->hasMany(projectUser::class, 'project_id', 'id')->orderByDesc('id');
+ }
+}
diff --git a/app/Models/ProjectColumn.php b/app/Models/ProjectColumn.php
new file mode 100644
index 00000000..8cd7169d
--- /dev/null
+++ b/app/Models/ProjectColumn.php
@@ -0,0 +1,37 @@
+hasMany(projectTask::class, 'column_id', 'id')->orderByDesc('id');
+ }
+}
diff --git a/app/Models/ProjectLog.php b/app/Models/ProjectLog.php
new file mode 100644
index 00000000..acf74918
--- /dev/null
+++ b/app/Models/ProjectLog.php
@@ -0,0 +1,31 @@
+email;
- }
-
/**
* 昵称
* @param $value
@@ -88,7 +78,7 @@ class User extends AbstractModel
if ($this->username) {
return $this->username;
}
- return Base::getMiddle($this->email, null, "@");
+ return Base::cardFormat($this->email);
}
/**
@@ -367,12 +357,13 @@ class User extends AbstractModel
* @param int $userid 会员ID
* @return self
*/
- public static function userid2basic(int $userid)
+ public static function userid2basic($userid)
{
global $_A;
if (empty($userid)) {
return null;
}
+ $userid = intval($userid);
if (isset($_A["__static_userid2basic_" . $userid])) {
return $_A["__static_userid2basic_" . $userid];
}
diff --git a/app/Module/Base.php b/app/Module/Base.php
index 0d409e52..5bd48ad4 100755
--- a/app/Module/Base.php
+++ b/app/Module/Base.php
@@ -53,7 +53,7 @@ class Base
$log = self::array2json($log, JSON_UNESCAPED_UNICODE);
}
Tmp::createInstance([
- 'title' => 'log_' . ($title ?: date("Y-m-d H:i:s", time())),
+ 'name' => 'log_' . ($title ?: date("Y-m-d H:i:s", time())),
'value' => date("Y-m-d H:i:s", time()),
'content' => $log,
])->save();
@@ -1139,11 +1139,11 @@ class Base
return $_A["__static_setting_" . $setname];
}
$setting = [];
- $row = Setting::whereTitle($setname)->first();
+ $row = Setting::whereName($setname)->first();
if (!empty($row)) {
$setting = Base::string2array($row->setting);
} else {
- $row = Setting::createInstance(['title' => $setname]);
+ $row = Setting::createInstance(['name' => $setname]);
$row->save();
}
if ($array !== false) {
@@ -2629,19 +2629,19 @@ class Base
/**
* 缓存数据
- * @param $title
+ * @param $name
* @param null $value
* @return mixed|null
*/
- public static function cacheData($title, $value = null)
+ public static function cacheData($name, $value = null)
{
- $title = "cacheData::" . $title;
- $tmp = Tmp::where('title', $title)->select('value')->first();
+ $name = "cacheData::" . $name;
+ $tmp = Tmp::whereName($name)->select('value')->first();
if ($value !== null) {
if (empty($tmp)) {
- Tmp::insert(['title' => $title, 'value' => $value]);
+ Tmp::createInstance(['name' => $name, 'value' => $value])->save();
} else {
- Tmp::where('title', $title)->update(['value' => $value]);
+ Tmp::whereName($name)->update(['value' => $value]);
}
return $value;
} else {
diff --git a/package.json b/package.json
index 13a06183..00e82413 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,7 @@
"dependencies": {
"echarts": "^5.1.1",
"tinymce": "^5.8.1",
- "view-design-hi": "^4.5.0-4",
+ "view-design-hi": "^4.5.0-10",
"vue-clipboard2": "^0.3.1",
"vue-emoji-picker": "^1.0.1",
"vue-kityminder-gg": "^1.3.6",
diff --git a/resources/assets/js/components/TEditor.vue b/resources/assets/js/components/TEditor.vue
index e18a84ca..eba17d75 100755
--- a/resources/assets/js/components/TEditor.vue
+++ b/resources/assets/js/components/TEditor.vue
@@ -191,7 +191,13 @@
type: String,
default: ' undo redo | styleselect | uploadImages | uploadFiles | bold italic underline forecolor backcolor | alignleft aligncenter alignright | bullist numlist outdent indent | link image emoticons media codesample | preview screenload',
},
- other_options: {
+ options: {
+ type: Object,
+ default: () => {
+ return {};
+ }
+ },
+ optionFull: {
type: Object,
default: () => {
return {};
@@ -262,23 +268,31 @@
methods: {
init() {
this.$nextTick(() => {
- tinymce.init(this.concatAssciativeArrays(this.options(false), this.other_options));
+ tinymce.init(this.concatAssciativeArrays(this.option(false), this.options));
});
},
initTransfer() {
this.$nextTick(() => {
- tinymce.init(this.concatAssciativeArrays(this.options(true), this.other_options));
+ tinymce.init(this.concatAssciativeArrays(this.option(true), this.optionFull));
});
},
- options(isFull) {
+ plugin(isFull) {
+ if (isFull) {
+ return this.plugins.filter((val) => val != 'autoresize');
+ } else {
+ return this.plugins;
+ }
+ },
+
+ option(isFull) {
return {
selector: (isFull ? '#T_' : '#') + this.id,
- base_url: $A.serverUrl('js/build'),
+ base_url: $A.serverUrl('js/tinymce'),
language: "zh_CN",
toolbar: this.toolbar,
- plugins: this.plugins,
+ plugins: this.plugin(isFull),
save_onsavecallback: (e) => {
this.$emit('editorSave', e);
},
diff --git a/resources/assets/js/components/UserInput.vue b/resources/assets/js/components/UserInput.vue
new file mode 100755
index 00000000..1071c6b1
--- /dev/null
+++ b/resources/assets/js/components/UserInput.vue
@@ -0,0 +1,138 @@
+
+