shish 6 лет назад
Родитель
Сommit
bc0f55dcf4

+ 33 - 0
app/business/controllers/AdminLogController.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace business\controllers;
+
+use biz\admin\services\AdminLogService;
+use common\components\util;
+use Yii;
+use yii\web\Controller;
+
+class AdminLogController extends BaseController
+{
+
+	//日志列表 shish 2019.12.9
+	public function actionList()
+	{
+		$get = Yii::$app->request->get();
+		//组建where
+		$adminId = isset($get['adminId']) ? $get['adminId'] : -1;
+		$startTime = isset($get['startTime']) ? $get['startTime'] : '';
+		$endTime = isset($get['endTime']) ? $get['endTime'] : '';
+		$where = [];
+		$where['merchantId'] = $this->merchantId;
+		if ($adminId != -1) {
+			$where['adminId'] = $adminId;
+		}
+		if (!empty($startTime) && !empty($endTime)) {
+
+		}
+		$list = AdminLogService::getLogList($where);
+		util::success($list);
+	}
+
+}

+ 17 - 0
biz/admin/classes/AdminLogClass.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace biz\admin\classes;
+
+use biz\admin\services\AdminRoleService;
+use biz\user\classes\UserClass;
+use biz\user\services\UserService;
+use common\components\util;
+use Yii;
+use biz\base\classes\BaseClass;
+
+class AdminLogClass extends BaseClass
+{
+
+	public static $baseFile = '\biz\admin\models\AdminLog';
+
+}

+ 13 - 0
biz/admin/models/AdminLog.php

@@ -0,0 +1,13 @@
+<?php
+namespace biz\admin\models;
+use biz\base\models\Base;
+
+class AdminLog extends Base
+{
+
+	public static function tableName()
+	{
+		return 'xhAdminLog';
+	}
+
+}

+ 32 - 0
biz/admin/services/AdminLogService.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace biz\admin\services;
+
+use biz\admin\classes\AdminClass;
+use biz\admin\classes\AdminLogClass;
+use biz\auth\services\AuthService;
+use biz\base\services\BaseService;
+use biz\merchant\services\MerchantService;
+use common\components\error;
+use common\components\stringUtil;
+use common\components\util;
+use common\services\xhTMessageService;
+use Yii;
+
+class AdminLogService extends BaseService
+{
+
+	public static $baseFile = '\biz\admin\classes\AdminLogClass';
+
+	//获取客户列表 shish 2019.11.30
+	public static function getLogList($where)
+	{
+		$data = AdminLogClass::getList('*', $where, 'addTime DESC');
+		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+		if (empty($list)) {
+			return $data;
+		}
+		return $data;
+	}
+
+}

+ 8 - 0
sql.txt

@@ -1,5 +1,13 @@
 2019.12.10 shish 角色相关
 ALTER TABLE xhAdminRole ADD `num` INT NOT NULL DEFAULT 0 COMMENT '成员数' AFTER `merchantId`;
+CREATE TABLE xhAdminLog(
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+`ip` BIGINT NOT NULL DEFAULT 0 COMMENT 'ip地址',
+`merchantId` INT NOT NULL DEFAULT 0 COMMENT '商家id',
+`content` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '操作内容',
+adminId INT NOT NULL DEFAULT 0 COMMENT '员工id;管理员id',
+`addTime` INT NOT NULL DEFAULT 0 COMMENT '添加时间'
+)COMMENT='员工操作日志';
 
 2019.12.9 shish 员工相关
 ALTER TABLE xhAdmin DROP COLUMN `openId`;

+ 3 - 0
相关文档/SQL设计规范.md

@@ -0,0 +1,3 @@
+SQL设计规范
+-------------------
+ip 使用bigint