Commit 68332f2f authored by rlgy's avatar rlgy

update

parent 187b3423
......@@ -61,7 +61,7 @@ class BillController extends BaseController
} else {
$condition = ['OR', ['from' => $from], ['to' => $from]];
}
$result = Bill::getList2($page, $limit, $condition);
$result = Bill::getList2($page, $limit, $condition,['blocktime'=>SORT_DESC]);
foreach ($result['data'] as $key => $item) {
if ($item['from'] != $from) {
$result['data'][$key]['type'] = 1;
......
......@@ -55,6 +55,9 @@ class AdminController extends BaseController
if (empty($data['password']) || strlen($data['password']) < 6) {
$this->error('密码为空或小于6字符');
}
if (empty($data['status'])) {
$data['status'] = 0;
}
$model->setAttributes($data);
$model->generateAuthKey();
......
......@@ -75,6 +75,9 @@ class AuthController extends BaseController
$role->type = 1;
$role->description = $data['description'];
if (Yii::$app->authManager->add($role)) {
$auth = Yii::$app->authManager;
$administrator = $auth->getRole();
// Yii::$app->authManager->addChild();
$this->success('添加成功!', $this->getForward());
}
$this->error('添加失败!');
......
......@@ -26,15 +26,19 @@ class BaseActiveRecord extends \yii\db\ActiveRecord
return $data;
}
public static function getList2($page = 1, $limit = 10, $condition = [])
public static function getList2($page = 1, $limit = 10, $condition = [], $order_by = [])
{
$query = self::find();
if (!empty($condition)) {
$query = $query->where($condition);
}
$count = $query->count();
$data = $query->offset(($page - 1) * 10)->limit($limit)->asArray()->all();
$sql = $query->createCommand()->getSql();
$data = $query->offset(($page - 1) * 10)->limit($limit);
if (!empty($order_by)) {
# code...
$data = $data->orderby($order_by)->asArray()->all();
}
// $sql = $query->createCommand()->getSql();
$data = ['count' => $count, 'data' => $data];
if ($count > 0) {
$data['code'] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment