用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3331|回复: 3
收起左侧

求一个免费的客户管理系统

[复制链接]
发表于 2013-9-14 20:39:00 | 显示全部楼层 |阅读模式
类似一般的网吧   或者健身房里的

可以录入客户信息    每个操作员的操作都有详细记录      功能不需要太复杂      再有点简单的统计功能和搜索功能就行

感觉除了记录操作员的操作    别的东西用excel就基本可以实现了。。。。。
发表于 2013-9-14 21:37:03 | 显示全部楼层
我来给你写个。
发表于 2013-9-15 14:43:45 | 显示全部楼层
把我写了一上午的代码贴上来。不想写了。
PHP复制代码
<?php
if (! defined ( 'BASEPATH' ))
        exit ( 'No direct script access allowed' );
class Welcome extends CI_Controller {
        public function __construct() {
                parent::__construct ();
                $this->load->library ( 'session' );
                $this->load->database ();
                $this->load->helper ( 'url' );
        }
        public function index() {
                $this->home ();
        }
        public function edit() {
               
        }
        public function home($page = 0) {
                $this->check_login ();
               
                $this->load->library ( 'pagination' );
                $config ['base_url'] = site_url ( 'home' );
                $config ['per_page'] = 20;
               
                $users = $this->db->get_where ( 'user', array (
                                'role' => ROLE_GUEST
                ), $config ['per_page'], $page );
               
                $config ['total_rows'] = $users->num_rows;
                $config ['cur_page'] = $page;
                $this->pagination->initialize ( $config );
               
                $data ['users'] = $users->result_array ();
                $data ['page'] = $this->pagination->create_links ();
               
                $this->load->view ( 'home', $data );
        }
        public function admin() {
                $this->check_login();
                if ($this->session->userdata['role'] != ROLE_ADMIN) {
                        $this->session->set_flashdata('msg', '您没有管理权限');
                        redirect('login');
                }
        }
        public function install() {
                $this->db->query ( "
                        CREATE TABLE IF NOT EXISTS `crm_user` (
                                `id` INT(10) NOT NULL AUTO_INCREMENT,
                                `username` VARCHAR(20) NULL,
                                `userpass` VARCHAR(50) NULL,
                                `created_at` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间',
                                `last_login_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '最后登录时间',
                                `role` TINYINT(10) NOT NULL DEFAULT '3' COMMENT '角色 1 管理员 2 操作员 3 客户',
                                `info` TEXT NULL COMMENT '其他信息 json 格式',
                                PRIMARY KEY (`id`),
                                UNIQUE INDEX `username` (`username`)
                        )
                        COLLATE='utf8_general_ci'
                        ENGINE=InnoDB;"
);
                $this->db->query ( "
                        CREATE TABLE IF NOT EXISTS `crm_log` (
                                `id` INT(10) NOT NULL AUTO_INCREMENT,
                                `user_id` INT(10) NOT NULL COMMENT '操作员',
                                `guest_id` INT(10) NOT NULL COMMENT '被操作的客户',
                                `action` INT(10) NOT NULL COMMENT '1 新增 2 删除 3 更改',
                                `created_at` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '操作时间',
                                PRIMARY KEY (`id`)
                        )
                        COLLATE='utf8_general_ci'
                        ENGINE=InnoDB;"
);
                $q = $this->db->get ( 'user', 1, 0 );
                if ($q->num_rows ()) {
                        echo 'Your app has already been installed. Please click <a href="'.site_url('login').'">here</a> to log in.';
                        die ();
                }
                $admin = array (
                                'username' => 'admin',
                                'userpass' => $this->generate_pass ( '123456' ),
                                'role' => ROLE_ADMIN,
                                'created_at' => date ( 'Y-m-d H:i:s' )
                );             
                $this->db->insert ( 'user', $admin );
                $this->session->set_userdata ( $admin );
                redirect ( 'home' );
        }
        public function handle_login() {
                $this->db->where ( array (
                                'username' => $this->input->post ( 'name' ),
                                'userpass' => $this->generate_pass ( $this->input->post ( 'pass' ) )
                ) );
                $user = $this->db->get ( 'user' );
                if ($user = $user->row ()) {
                        $this->session->set_userdata ( $user );
                        redirect ( 'home' );
                } else {
                        $this->session->set_flashdata ( 'msg', '用户或密码错误' );
                        redirect ( 'login' );
                }
        }
        public function login() {
                $this->load->view ( 'login' );
        }
        public function logout() {
                $this->session->unset_userdata('role');
                $this->session->set_flashdata('msg', '您已注销登录');
                redirect ( 'login' );
        }
        private function check_login() {
                if (! $this->session->userdata ( 'role' )) {
                        redirect ( 'login' );
                }
        }
        private function generate_pass($str) {
                return md5 ( $str . 'CRM_SALT_rgergsadfaerge' );
        }
}
复制代码
 楼主| 发表于 2013-9-16 09:33:25 | 显示全部楼层
永恒forever 发表于 2013-9-15 14:43
把我写了一上午的代码贴上来。不想写了。

哇塞!好有热情!!太谢谢了    我先去试试。。。。

本版积分规则