Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
25073c05
Commit
25073c05
authored
Jan 09, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整文件目录结构
parent
1b77f70a
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
188 additions
and
266 deletions
+188
-266
CategoryInterface.php
src/CategoryInterface.php
+0
-29
DepartmentInterface.php
src/DepartmentInterface.php
+0
-16
FactoryInterface.php
src/FactoryInterface.php
+0
-16
Helper.php
src/Helper.php
+59
-0
LogisticsInterface.php
src/LogisticsInterface.php
+0
-16
MaterialInterface.php
src/MaterialInterface.php
+0
-16
MessageInterface.php
src/MessageInterface.php
+0
-16
PermissionInterface.php
src/PermissionInterface.php
+0
-16
ProductChildInterface.php
src/ProductChildInterface.php
+0
-16
ProductInterface.php
src/ProductInterface.php
+0
-29
RoleInterface.php
src/RoleInterface.php
+0
-16
BaseService.php
src/Service/BaseService.php
+115
-0
UserServiceInterface.php
src/Service/Interfaces/UserServiceInterface.php
+14
-0
SiteInterface.php
src/SiteInterface.php
+0
-16
SizeInterface.php
src/SizeInterface.php
+0
-16
SupplierInterface.php
src/SupplierInterface.php
+0
-16
TeamInterface.php
src/TeamInterface.php
+0
-16
UserInterface.php
src/UserInterface.php
+0
-16
No files found.
src/CategoryInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* UserInterface: 梁俊杰
* Date: 2019/11/18
* Time: 17:15
* Description:
*/
namespace
Meibuyu\Micro
;
interface
CategoryInterface
{
/**
* 新增品类
* @param array $attribute
* @return bool
*/
public
function
add
(
$attribute
);
/**
* 更新品类
* @param array $attribute
* @param int $id
* @return bool
*/
public
function
update
(
$attribute
,
$id
);
public
function
delete
(
$id
);
}
src/DepartmentInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:44
* Description:
*/
namespace
Meibuyu\Micro
;
interface
DepartmentInterface
{
}
src/FactoryInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:43
* Description:
*/
namespace
Meibuyu\Micro
;
interface
FactoryInterface
{
}
src/Helper.php
0 → 100644
View file @
25073c05
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/12/03
* Time: 16:08
* Description:
*/
namespace
Meibuyu\Micro
;
class
Helper
{
/**
* 获取唯一编号
* @param string $prefix
* @return string
*/
public
static
function
uid
(
$prefix
=
''
)
{
return
uniqid
(
$prefix
);
}
/**
* 返回成功消息
* @param array|string $data 返回数据 默认空
* @param string $msg 消息,默认 Success
* @param int $code 成功代码,默认200
* @return array
*/
public
static
function
success
(
$data
=
''
,
$msg
=
'success'
,
$code
=
200
)
{
return
self
::
response
(
$data
,
$msg
,
$code
);
}
/**
* 返回失败消息
* @param array|string $data 返回数据 默认空
* @param string $msg 消息,默认 Error
* @param int $code 失败代码,默认400
* @return array
*/
public
static
function
fail
(
$data
=
''
,
$msg
=
'fail'
,
$code
=
400
)
{
return
self
::
response
(
$data
,
$msg
,
$code
);
}
/**
* 返回操作消息
* @param array|string $data 返回数据 默认空
* @param string $msg 消息,默认空
* @param int $code 操作代码,默认200
* @return array
*/
public
static
function
response
(
$data
=
''
,
$msg
=
''
,
$code
=
200
)
{
return
[
'data'
=>
$data
,
'msg'
=>
$msg
,
'code'
=>
$code
];
}
}
src/LogisticsInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:42
* Description:
*/
namespace
Meibuyu\Micro
;
interface
LogisticsInterface
{
}
src/MaterialInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:42
* Description:
*/
namespace
Meibuyu\Micro
;
interface
MaterialInterface
{
}
src/MessageInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:41
* Description:
*/
namespace
Meibuyu\Micro
;
interface
MessageInterface
{
}
src/PermissionInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:41
* Description:
*/
namespace
Meibuyu\Micro
;
interface
PermissionInterface
{
}
src/ProductChildInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:40
* Description:
*/
namespace
Meibuyu\Micro
;
interface
ProductChildInterface
{
}
src/ProductInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* UserInterface: 梁俊杰
* Date: 2019/11/18
* Time: 17:15
* Description:
*/
namespace
Meibuyu\Micro
;
interface
ProductInterface
{
/**
* 新增品类
* @param array $attribute
* @return bool
*/
public
function
add
(
$attribute
);
/**
* 更新品类
* @param array $attribute
* @param int $id
* @return bool
*/
public
function
update
(
$attribute
,
$id
);
public
function
delete
(
$id
);
}
src/RoleInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:39
* Description:
*/
namespace
Meibuyu\Micro
;
interface
RoleInterface
{
}
src/Service/BaseService.php
0 → 100644
View file @
25073c05
<?php
/**
* Created by PhpStorm.
* User: 王源
* Date: 2020/1/9
* Time: 15:08
*/
namespace
Meibuyu\Micro\Service
;
use
Exception
;
use
Hyperf\DbConnection\Model\Model
;
use
Meibuyu\Micro\Helper
;
class
BaseService
{
/**
* @var Model
*/
protected
$model
;
/**
* 查找一个数据
* @param $id
* @return Model | array
*/
public
function
find
(
$id
)
{
$model
=
$this
->
model
->
find
(
$id
);
if
(
!
$model
)
{
return
Helper
::
fail
(
''
,
'数据不存在'
,
404
);
}
return
$model
;
}
/**
* 获取一条数据
* @param $id
* @return array
*/
public
function
get
(
$id
)
{
$model
=
$this
->
find
(
$id
);
return
Helper
::
success
(
$model
);
}
/**
* 插入一条数据
* @param array $data
* @return array
*/
public
function
insert
(
array
$data
)
{
try
{
$res
=
$this
->
model
->
insert
(
$data
);
return
Helper
::
success
(
$res
);
}
catch
(
Exception
$e
)
{
return
Helper
::
fail
(
''
,
$e
->
getMessage
());
}
}
/**
* 新增一条数据
* @param array $data
* @return array
*/
public
function
create
(
array
$data
)
{
try
{
$model
=
$this
->
model
->
newInstance
(
$data
);
$model
->
save
();
return
Helper
::
success
(
$model
);
}
catch
(
Exception
$e
)
{
return
Helper
::
fail
(
''
,
$e
->
getMessage
());
}
}
/**
* 更新数据
* @param $id
* @param array $data
* @return array
*/
public
function
update
(
$id
,
array
$data
)
{
try
{
$model
=
$this
->
find
(
$id
);
$model
->
fill
(
$data
);
$model
->
save
();
return
Helper
::
success
(
$model
);
}
catch
(
Exception
$e
)
{
return
Helper
::
fail
(
''
,
$e
->
getMessage
());
}
}
/**
* 删除数据
* @param $id
* @return array
*/
public
function
delete
(
$id
)
{
try
{
$model
=
$this
->
find
(
$id
);
$res
=
$model
->
delete
();
if
(
$res
)
{
return
Helper
::
success
(
$res
,
'删除成功'
);
}
else
{
return
Helper
::
fail
(
$res
,
'删除失败'
);
}
}
catch
(
Exception
$e
)
{
return
Helper
::
fail
(
''
,
$e
->
getMessage
());
}
}
}
src/Service/Interfaces/UserServiceInterface.php
0 → 100644
View file @
25073c05
<?php
/**
* Created by PhpStorm.
* User: 王源
* Date: 2020/1/9
* Time: 15:07
*/
namespace
Meibuyu\Micro\Service\Interfaces
;
interface
UserServiceInterface
{
}
src/SiteInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:38
* Description:
*/
namespace
Meibuyu\Micro
;
interface
SiteInterface
{
}
src/SizeInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:38
* Description:
*/
namespace
Meibuyu\Micro
;
interface
SizeInterface
{
}
src/SupplierInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:37
* Description:
*/
namespace
Meibuyu\Micro
;
interface
SupplierInterface
{
}
src/TeamInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* User: 梁俊杰
* Date: 2019/11/19
* Time: 08:37
* Description:
*/
namespace
Meibuyu\Micro
;
interface
TeamInterface
{
}
src/UserInterface.php
deleted
100644 → 0
View file @
1b77f70a
<?php
/**
* Created by PhpStorm.
* UserInterface: 梁俊杰
* Date: 2019/11/19
* Time: 08:36
* Description:
*/
namespace
Meibuyu\Micro
;
interface
UserInterface
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment