Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
chenchuanwen
my-yaf-project
Commits
7538529c
Commit
7538529c
authored
Oct 30, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Plain Diff
temp
parents
1499bf76
c35a04e3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
17 deletions
+71
-17
AbstractClient.php
application/library/Our/Controller/AbstractClient.php
+55
-0
Shopkeeper.php
application/modules/Client/controllers/Shopkeeper.php
+15
-17
User.php
application/modules/Client/controllers/User.php
+1
-0
No files found.
application/library/Our/Controller/AbstractClient.php
0 → 100644
View file @
7538529c
<?php
namespace
Our
;
use
Business\User\MemberServiceModel
;
use
Error\CodeConfigModel
;
use
Error\ErrorModel
;
/**
* api模块控制器抽象类
*
* @package Our
* @author iceup <sjlinyu@qq.com>
*/
abstract
class
Controller_AbstractClient
extends
\Our\Controller_Abstract
{
public
$config
;
public
$redis
;
public
$key
;
public
$req
;
public
$memberId
;
/**
* api控制器直接输出json格式数据,不需要渲染视图
*/
public
function
init
()
{
$this
->
req
=
$this
->
getRequest
()
->
getPost
();
$this
->
checkEncrypt
();
if
(
empty
(
$this
->
req
[
'data'
][
'key'
])){
ErrorModel
::
throwException
(
CodeConfigModel
::
illegalAccess
);
}
session_id
(
$this
->
req
[
'data'
][
'key'
]);
// ini_set('session.gc_maxlifetime', ApiConst::tenDaySecond);
$sess
=
\Yaf\Session
::
getInstance
();
$sess
->
start
();
$this
->
memberId
=
$sess
->
get
(
'member_id'
);
$this
->
storeId
=
$sess
->
get
(
'store_id'
);
if
(
empty
(
$this
->
memberId
)){
ErrorModel
::
throwException
(
CodeConfigModel
::
noLogin
);
}
if
(
isset
(
$sess
[
'other_login'
])
&&
$sess
[
'other_login'
]
==
ApiConst
::
one
){
$memberService
=
MemberServiceModel
::
getInstance
();
$memberService
->
clearKey
(
$this
->
req
[
'data'
][
'key'
]);
ErrorModel
::
throwException
(
CodeConfigModel
::
otherDriverLogin
);
}
\Yaf\Dispatcher
::
getInstance
()
->
disableView
();
}
public
function
getAuthKey
(){
$this
->
key
=
Common
::
bulidToken
();
$this
->
redis
->
hset
(
$this
->
key
,
NameConst
::
sessionKey
,
$this
->
key
,
ApiConst
::
tenMin
);
}
public
function
loginCheck
(){
}
}
application/modules/Client/controllers/Shopkeeper.php
View file @
7538529c
<?php
use
Error\ErrorModel
;
...
...
@@ -15,7 +14,7 @@ use Business\Store\ShopkeeperServiceModel;
* @date 2018-5-10
* @author csw <993768343@qq.com>
*/
class
ShopkeeperController
extends
\Our\Controller_Abstract
Api
{
class
ShopkeeperController
extends
\Our\Controller_Abstract
Client
{
public
$memberService
;
public
$shopkeeperService
;
...
...
@@ -181,7 +180,7 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
/**
* 获得售后列表
*/
public
function
getRefunds
Action
(){
public
function
getRefunds
(){
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$pageIndex
=
$this
->
getPageIndex
();
$pageSize
=
$this
->
getPageSize
();
...
...
@@ -189,20 +188,6 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
$this
->
success
(
$res
);
}
/**
* 单一属性商品库存预警
*/
public
function
warningAction
(){
$goodsCommonService
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
();
$pageIndex
=
$this
->
getPageIndex
();
$pageSize
=
$this
->
getPageSize
();
$memberDao
=
\DAO\MemberModel
::
getInstance
();
$storeId
=
$memberDao
->
getInfo
(
$this
->
memberId
,
'store_id'
);
$res
=
$goodsCommonService
->
getGoodsStorageList
(
$storeId
,
$pageIndex
,
$pageSize
);
$this
->
success
(
$res
);
}
/**
* 获得订单数量
*/
...
...
@@ -235,4 +220,17 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
$res
=
$res
?
$res
:
new
\stdClass
();
$this
->
success
(
$res
,
\Our\DescribeConst
::
successMessage
);
}
/**
* 单一属性商品库存预警
*/
public
function
warningAction
(){
$goodsCommonService
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
();
$pageIndex
=
$this
->
getPageIndex
();
$pageSize
=
$this
->
getPageSize
();
$res
=
$goodsCommonService
->
getGoodsStorageList
(
$this
->
store_id
,
$pageIndex
,
$pageSize
);
$this
->
success
(
$res
);
}
}
application/modules/Client/controllers/User.php
View file @
7538529c
...
...
@@ -63,6 +63,7 @@ class UserController extends \Our\Controller_AbstractIndex {
$this
->
key
=
Common
::
bulidToken
(
$mobile
,
$password
);
session_id
(
$this
->
key
);
$this
->
sess
[
'member_id'
]
=
(
int
)
$member
[
'member_id'
];
$this
->
sess
[
'store_id'
]
=
(
int
)
$seller
[
'storeId'
];
$this
->
sess
[
NameConst
::
sessionKey
]
=
$this
->
key
;
$member
[
NameConst
::
sessionKey
]
=
$this
->
key
;
$member
[
'store_id'
]
=
$seller
[
'storeId'
];
...
...
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