Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
3d72d072
Commit
3d72d072
authored
Dec 26, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
Feature/optimize See merge request
!254
parents
1b737475
492173a0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
404 additions
and
29 deletions
+404
-29
NoticeController.php
api/controllers/NoticeController.php
+3
-0
SupportedChainController.php
api/controllers/SupportedChainController.php
+3
-2
User.php
common/models/User.php
+2
-0
CoinSupportedChain.php
common/models/psources/CoinSupportedChain.php
+2
-2
Notice.php
common/models/pwallet/Notice.php
+30
-11
TrusteeShipService.php
common/service/trusteeship/TrusteeShipService.php
+42
-0
FlashController.php
wallet/controllers/FlashController.php
+305
-0
NoticeController.php
wallet/controllers/NoticeController.php
+17
-14
No files found.
api/controllers/NoticeController.php
View file @
3d72d072
...
...
@@ -50,6 +50,9 @@ class NoticeController extends BaseController
if
(
false
!=
$type
)
{
$query
->
andWhere
([
'type'
=>
(
int
)
$type
]);
if
(
Notice
::
TOP_TRUE
==
(
int
)
$type
)
{
$size
=
1
;
}
}
$countQuery
=
clone
$query
;
...
...
api/controllers/SupportedChainController.php
View file @
3d72d072
...
...
@@ -28,9 +28,10 @@ class SupportedChainController extends BaseController
}
$data
=
[];
foreach
(
$supported_chain_model
as
$key
=>
&
$val
)
{
$data
[
]
=
!
empty
(
$val
->
coin
)
?
$val
->
co
in
:
''
;
}
$data
[
$key
][
'chain'
]
=
isset
(
$val
->
coin
->
chain
)
?
$val
->
coin
->
cha
in
:
''
;
$data
[
$key
][
'icon'
]
=
isset
(
$val
->
coin
->
icon
)
?
$val
->
coin
->
icon
:
''
;
}
$msg
=
'success'
;
$code
=
0
;
doEnd
:
...
...
common/models/User.php
View file @
3d72d072
...
...
@@ -26,6 +26,8 @@ class User extends ActiveRecord implements IdentityInterface
const
STATUS_DELETED
=
0
;
const
STATUS_ACTIVE
=
10
;
const
AUTH_SUPER
=
'administrator'
;
/**
* @inheritdoc
...
...
common/models/psources/CoinSupportedChain.php
View file @
3d72d072
...
...
@@ -41,11 +41,11 @@ class CoinSupportedChain extends BaseActiveRecord
public
function
attributes
()
{
return
array_merge
(
parent
::
attributes
(),
[
'c
oins
'
]);
return
array_merge
(
parent
::
attributes
(),
[
'c
hain'
,
'icon
'
]);
}
public
function
getCoin
()
{
return
$this
->
hasOne
(
Coin
::
className
(),
[
'id'
=>
'coin_id'
])
->
select
(
'name as chain'
);
return
$this
->
hasOne
(
Coin
::
className
(),
[
'id'
=>
'coin_id'
])
->
select
(
'name as chain
, icon
'
);
}
}
common/models/pwallet/Notice.php
View file @
3d72d072
...
...
@@ -19,6 +19,8 @@ class Notice extends BaseActiveRecord
const
TYPE_ROLL
=
1
;
//滚动
const
TYPE_POP
=
0
;
//弹窗
const
TOP_TRUE
=
1
;
//置顶公告
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
...
...
@@ -33,15 +35,15 @@ class Notice extends BaseActiveRecord
return
[
[[
'title'
,
'content'
,
'type'
,
'status'
,
'platform_id'
,
'author'
],
'required'
],
[[
'status'
,
'type'
,
'platform_id'
,
'is_top'
],
'integer'
],
[
'is_top'
,
'verfiyIsTop'
],
[
'type'
,
'verfiyType'
],
[[
'is_top'
],
'safe'
]
//
['is_top', 'verfiyIsTop'],
//
['type', 'verfiyType'],
//
[['is_top'], 'safe']
];
}
public
function
verfiyIsTop
(
$attribute
,
$params
)
{
$count
=
self
::
find
()
->
where
([
'platform_id'
=>
$this
->
platform_id
,
'is_top'
=>
$this
->
is_top
])
->
count
();
$count
=
self
::
find
()
->
where
([
'platform_id'
=>
$this
->
platform_id
,
'is_top'
=>
Notice
::
TOP_TRUE
])
->
count
();
if
(
$count
>=
1
)
{
$this
->
addError
(
$attribute
,
'置顶公告只能1条'
);
return
false
;
...
...
@@ -50,22 +52,39 @@ class Notice extends BaseActiveRecord
public
function
verfiyType
(
$attribute
,
$params
)
{
if
(
'create'
==
self
::
getScenario
())
{
$count
=
self
::
find
()
->
where
([
'platform_id'
=>
$this
->
platform_id
,
'type'
=>
$this
->
type
])
->
count
();
if
(
Notice
::
TYPE_ROLL
==
$this
->
type
)
{
if
(
$count
>=
3
)
{
$count
=
self
::
find
()
->
where
([
'platform_id'
=>
$this
->
platform_id
,
'type'
=>
$this
->
type
])
->
count
();
if
(
Notice
::
TYPE_ROLL
==
$this
->
type
)
{
if
(
'create'
==
self
::
getScenario
())
{
if
(
$count
==
3
)
{
$this
->
addError
(
$attribute
,
'滚动公告最多只能3条'
);
return
false
;
}
}
if
(
'update'
==
self
::
getScenario
())
{
if
(
$count
>
3
)
{
$this
->
addError
(
$attribute
,
'滚动公告最多只能3条'
);
return
false
;
}
}
if
(
Notice
::
TYPE_POP
==
$this
->
type
)
{
if
(
$count
>=
1
)
{
$this
->
addError
(
$attribute
,
'弹窗公告最多只能3条'
);
}
if
(
Notice
::
TYPE_POP
==
$this
->
type
)
{
if
(
'create'
==
self
::
getScenario
())
{
if
(
$count
==
1
)
{
$this
->
addError
(
$attribute
,
'弹窗公告最多只能1条'
);
return
false
;
}
}
if
(
'update'
==
self
::
getScenario
())
{
if
(
$count
>
1
)
{
$this
->
addError
(
$attribute
,
'弹窗公告最多只能1条'
);
return
false
;
}
}
}
}
public
function
scenarios
()
...
...
common/service/trusteeship/TrusteeShipService.php
View file @
3d72d072
...
...
@@ -71,6 +71,48 @@ class TrusteeShipService
return
$this
->
send
(
"GET"
,
$uri
,
$params
);
}
public
function
getFlashListConfig
(
$params
=
[])
{
$uri
=
'backend/flash/flash-list-config'
;
return
$this
->
send
(
"GET"
,
$uri
,
$params
);
}
public
function
getFlashDefaultConfig
(
$params
=
[])
{
$uri
=
'backend/flash/flash-default-config'
;
return
$this
->
send
(
"GET"
,
$uri
,
$params
);
}
public
function
flashAddConfig
(
$params
=
[])
{
$uri
=
'backend/flash/flash-add-config'
;
return
$this
->
send
(
"POST"
,
$uri
,
$params
);
}
public
function
flashUpdateConfig
(
$params
=
[])
{
$uri
=
'backend/flash/flash-update-config'
;
return
$this
->
send
(
"POST"
,
$uri
,
$params
);
}
public
function
flashDeleteConfig
(
$params
=
[])
{
$uri
=
'backend/flash/flash-delete-config'
;
return
$this
->
send
(
"POST"
,
$uri
,
$params
);
}
public
function
flashCloneConfig
(
$params
=
[])
{
$uri
=
'backend/flash/flash-clone-config'
;
return
$this
->
send
(
"POST"
,
$uri
,
$params
);
}
public
function
getUserAsset
(
$params
=
[])
{
$uri
=
'backend/user/asset'
;
...
...
wallet/controllers/FlashController.php
0 → 100644
View file @
3d72d072
<?php
namespace
wallet\controllers
;
use
common\models\User
;
use
Yii
;
use
wallet\base\BaseController
;
use
common\service\trusteeship\TrusteeShipService
;
class
FlashController
extends
BaseController
{
/**
* 闪兑获取币种支持的交易对
* @return array
*/
public
function
actionFlashListConfig
()
{
$msg
=
'success'
;
$code
=
0
;
$data
=
null
;
$group
=
Yii
::
$app
->
request
->
getGroup
();
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
0
);
if
(
User
::
AUTH_SUPER
!==
$group
&&
$platform_id
!=
Yii
::
$app
->
request
->
getPlatformId
())
{
$msg
=
'暂无权限'
;
$code
=
-
1
;
goto
doEnd
;
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'此钱包节点尚未开通'
];
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$from
=
Yii
::
$app
->
request
->
get
(
'from'
,
''
);
$to
=
Yii
::
$app
->
request
->
get
(
'to'
,
''
);
$params
=
[
'from'
=>
$from
,
'to'
=>
$to
];
$time
=
time
();
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
'FZM-Wallet-Signature'
=>
$signature
,
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
getFlashListConfig
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
$msg
=
$result
[
'msg'
];
$code
=
-
1
;
goto
doEnd
;
}
$data
=
$result
[
'msg'
];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
/**
* 闪兑获取默认的币种列表
* @return array
*/
public
function
actionFlashDefaultConfig
()
{
$msg
=
'success'
;
$code
=
0
;
$data
=
null
;
$group
=
Yii
::
$app
->
request
->
getGroup
();
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
0
);
if
(
User
::
AUTH_SUPER
!==
$group
&&
$platform_id
!=
Yii
::
$app
->
request
->
getPlatformId
())
{
$msg
=
'暂无权限'
;
$code
=
-
1
;
goto
doEnd
;
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'此钱包节点尚未开通'
];
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$from
=
Yii
::
$app
->
request
->
get
(
'from'
,
''
);
$to
=
Yii
::
$app
->
request
->
get
(
'to'
,
''
);
$params
=
[
'from'
=>
$from
,
'to'
=>
$to
];
$time
=
time
();
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
'FZM-Wallet-Signature'
=>
$signature
,
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
getFlashDefaultConfig
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
$msg
=
$result
[
'msg'
];
$code
=
-
1
;
goto
doEnd
;
}
$data
=
$result
[
'msg'
];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
/**
* 闪兑添加交易对
* 闪兑更新交易对
* 闪兑删除交易对
* @return array
*/
public
function
actionFlashConfig
()
{
$msg
=
'success'
;
$code
=
0
;
$data
=
null
;
$group
=
Yii
::
$app
->
request
->
getGroup
();
$platform_id
=
Yii
::
$app
->
request
->
post
(
'platform_id'
,
0
);
if
(
User
::
AUTH_SUPER
!==
$group
&&
$platform_id
!=
Yii
::
$app
->
request
->
getPlatformId
())
{
$msg
=
'暂无权限'
;
$code
=
-
1
;
goto
doEnd
;
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
$msg
=
'此钱包节点尚未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$result
=
Yii
::
$app
->
request
->
post
();
$time
=
time
();
if
(
Yii
::
$app
->
request
->
isPost
)
{
$params
=
[
'type'
=>
$result
[
'type'
]
??
''
,
'from'
=>
$result
[
'from'
]
??
''
,
'to'
=>
$result
[
'to'
]
??
''
,
'min_amount'
=>
$result
[
'min_amount'
]
??
''
,
'from_scale'
=>
$result
[
'from_scale'
]
??
''
,
'to_scale'
=>
$result
[
'to_scale'
]
??
''
,
'manual_price'
=>
$result
[
'manual_price'
]
??
''
,
'manual_price_status'
=>
$result
[
'manual_price_status'
]
??
''
,
'price_scale'
=>
$result
[
'price_scale'
]
??
''
,
'min_fee'
=>
$result
[
'min_fee'
]
??
''
,
'fee_percent'
=>
$result
[
'fee_percent'
]
??
''
,
'sort'
=>
$result
[
'sort'
]
??
''
,
'market_price_float'
=>
$result
[
'market_price_float'
]
??
''
];
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
'FZM-Wallet-Signature'
=>
$signature
,
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
flashAddConfig
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
$code
=
$result
[
'code'
];
$msg
=
$result
[
'msg'
];
goto
doEnd
;
}
}
if
(
Yii
::
$app
->
request
->
isPut
)
{
$params
=
[
'id'
=>
$result
[
'id'
]
??
''
,
'from'
=>
$result
[
'from'
]
??
''
,
'to'
=>
$result
[
'to'
]
??
''
,
'min_amount'
=>
$result
[
'min_amount'
]
??
''
,
'from_scale'
=>
$result
[
'from_scale'
]
??
''
,
'to_scale'
=>
$result
[
'to_scale'
]
??
''
,
'manual_price'
=>
$result
[
'manual_price'
]
??
''
,
'manual_price_status'
=>
$result
[
'manual_price_status'
]
??
''
,
'price_scale'
=>
$result
[
'price_scale'
]
??
''
,
'min_fee'
=>
$result
[
'min_fee'
]
??
''
,
'fee_percent'
=>
$result
[
'fee_percent'
]
??
''
,
'sort'
=>
$result
[
'sort'
]
??
''
,
'market_price_float'
=>
$result
[
'market_price_float'
]
??
''
];
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
'FZM-Wallet-Signature'
=>
$signature
,
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
flashUpdateConfig
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
$code
=
$result
[
'code'
];
$msg
=
$result
[
'msg'
];
goto
doEnd
;
}
}
if
(
Yii
::
$app
->
request
->
isDelete
)
{
$params
=
[
'id'
=>
Yii
::
$app
->
request
->
post
(
'id'
,
''
)
];
$time
=
time
();
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
'FZM-Wallet-Signature'
=>
$signature
,
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
flashDeleteConfig
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
$code
=
$result
[
'code'
];
$msg
=
$result
[
'msg'
];
goto
doEnd
;
}
}
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
/**
* 闪兑克隆交易对
* @return array
*/
public
function
actionFlashCloneConfig
()
{
$msg
=
'success'
;
$code
=
0
;
$data
=
null
;
$group
=
Yii
::
$app
->
request
->
getGroup
();
$platform_id
=
Yii
::
$app
->
request
->
post
(
'platform_id'
,
0
);
if
(
User
::
AUTH_SUPER
!==
$group
&&
$platform_id
!=
Yii
::
$app
->
request
->
getPlatformId
())
{
$msg
=
'暂无权限'
;
$code
=
-
1
;
goto
doEnd
;
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
$msg
=
'此钱包节点尚未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$params
=
[
'id'
=>
Yii
::
$app
->
request
->
post
(
'id'
,
''
),
'type'
=>
Yii
::
$app
->
request
->
post
(
'type'
,
''
),
'system_id'
=>
Yii
::
$app
->
request
->
post
(
'system_id'
,
''
)
];
$time
=
time
();
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
'FZM-Wallet-Signature'
=>
$signature
,
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
flashCloneConfig
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
$code
=
$result
[
'code'
];
$msg
=
$result
[
'msg'
];
goto
doEnd
;
}
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
wallet/controllers/NoticeController.php
View file @
3d72d072
...
...
@@ -3,6 +3,7 @@
namespace
wallet\controllers
;
use
common\models\pwallet\Notice
;
use
common\models\User
;
use
Yii
;
use
yii\data\Pagination
;
use
wallet\base\BaseController
;
...
...
@@ -18,13 +19,14 @@ class NoticeController extends BaseController
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$size
=
Yii
::
$app
->
request
->
get
(
'size'
,
10
);
$group
=
Yii
::
$app
->
request
->
getGroup
();
if
(
'administrator'
==
$group
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
Yii
::
$app
->
request
->
getPlatformId
());
}
else
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
}
if
(
Yii
::
$app
->
request
->
isPost
)
{
if
(
User
::
AUTH_SUPER
==
$group
)
{
$platform_id
=
Yii
::
$app
->
request
->
post
(
'platform_id'
,
Yii
::
$app
->
request
->
getPlatformId
());
}
else
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
}
$model
=
new
Notice
();
$model
->
setScenario
(
Notice
::
SCENARIOS_CREATE
);
$params
=
Yii
::
$app
->
request
->
post
();
...
...
@@ -40,9 +42,14 @@ class NoticeController extends BaseController
}
if
(
Yii
::
$app
->
request
->
isGet
)
{
if
(
User
::
AUTH_SUPER
==
$group
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
Yii
::
$app
->
request
->
getPlatformId
());
}
else
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
}
$status
=
Yii
::
$app
->
request
->
get
(
'status'
,
0
);
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
0
);
$query
=
Notice
::
find
()
->
select
(
'id, title, type, create_time'
)
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
(
);
$query
=
Notice
::
find
()
->
where
([
'platform_id'
=>
$platform_id
]
);
if
(
false
!=
$status
)
{
$query
->
andWhere
([
'status'
=>
(
int
)
$status
]);
...
...
@@ -50,7 +57,7 @@ class NoticeController extends BaseController
if
(
false
!=
$type
)
{
$query
->
andWhere
([
'type'
=>
(
int
)
$type
]);
}
$model
=
$query
->
offset
((
$page
-
1
)
*
$size
)
->
orderBy
(
'create_time'
)
->
limit
(
$size
)
->
asArray
()
->
all
();
$model
=
$query
->
offset
((
$page
-
1
)
*
$size
)
->
orderBy
(
'create_time
desc
'
)
->
limit
(
$size
)
->
asArray
()
->
all
();
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
$size
]);
...
...
@@ -74,11 +81,7 @@ class NoticeController extends BaseController
$code
=
0
;
$data
=
null
;
$group
=
Yii
::
$app
->
request
->
getGroup
();
if
(
'administrator'
==
$group
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
Yii
::
$app
->
request
->
getPlatformId
());
}
else
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
}
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
Yii
::
$app
->
request
->
isGet
)
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
);
...
...
@@ -100,7 +103,7 @@ class NoticeController extends BaseController
$code
=
-
1
;
goto
doEnd
;
}
if
(
'administrator'
!=
$group
&&
$platform_id
!=
$model
->
platform_id
){
if
(
User
::
AUTH_SUPER
!=
$group
&&
$platform_id
!=
$model
->
platform_id
){
$msg
=
'无权操作'
;
$code
=
-
1
;
goto
doEnd
;
...
...
@@ -134,7 +137,7 @@ class NoticeController extends BaseController
}
if
(
Yii
::
$app
->
request
->
isDelete
)
{
$model
=
Notice
::
findOne
(
$id
);
if
(
'administrator'
!=
$group
&&
$platform_id
!=
$model
->
platform_id
){
if
(
User
::
AUTH_SUPER
!=
$group
&&
$platform_id
!=
$model
->
platform_id
){
$msg
=
'无权删除'
;
$code
=
-
1
;
goto
doEnd
;
...
...
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