|
@@ -16,6 +16,26 @@ class Common extends CI_Controller {
|
|
|
$this->version = $version;
|
|
|
}
|
|
|
|
|
|
+ // 系统日志
|
|
|
+ protected function add_operation_log($optype, $content, $logtype = 1,$language=0){
|
|
|
+ $role = $this->userinfo['role'];
|
|
|
+ $companyid = $this->userinfo['company'];
|
|
|
+ $this->load->model('Syslog_model');
|
|
|
+ $userid = $this->userinfo['id'];
|
|
|
+ $data = array(
|
|
|
+ 'time' => date('Y-m-d H:i:s',time()),
|
|
|
+ 'logtype' => $logtype,
|
|
|
+ 'optype' => $optype,
|
|
|
+ 'userid' => $userid,
|
|
|
+ 'content' => $content,
|
|
|
+ 'language' => $language
|
|
|
+ );
|
|
|
+ if ($role != SYSTEM_ADMIN) {
|
|
|
+ $data['company'] = $companyid;
|
|
|
+ }
|
|
|
+ $this->Syslog_model->add($data);
|
|
|
+ }
|
|
|
+
|
|
|
public function login() {
|
|
|
$username = $this->input->post('username',true);
|
|
|
$password = $this->input->post('password',true);
|
|
@@ -48,6 +68,8 @@ class Common extends CI_Controller {
|
|
|
);
|
|
|
|
|
|
$this->userinfo = $user;
|
|
|
+ $this->add_operation_log('login','用户登录',0);
|
|
|
+ $this->add_operation_log('login','login',0,1);
|
|
|
exit(json_result('0000', $this->response['0000'], $data));
|
|
|
} else {
|
|
|
exit(json_result('0102', $this->response['0102']));
|