初始化

This commit is contained in:
chenrx
2024-05-26 15:51:51 +08:00
committed by lcc
parent bdb582188f
commit 078d6d8715
2935 changed files with 699241 additions and 2 deletions
+74
View File
@@ -0,0 +1,74 @@
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
.svn/
# Project-level settings
/.tgitconfig
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
.idea/
./script/qsy/config.php
.sftp-config.json
/admin/logs
/api/logs
+1 -2
View File
@@ -1,2 +1 @@
# spacestation
# liche
+6
View File
@@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+16
View File
@@ -0,0 +1,16 @@
<?php
/**
* Created by Vim
* User: lcc
* Desc: 支付宝配置
*/
$config = [
'default' => [
'app_id' => '2021000118631895',
'private_key' => 'MIIEpAIBAAKCAQEAk/KCpSBSJT8Ym6E2q8RhWXj6RHxP0orUOey/5pihXRj0UzQQiiB8pIb5TcB7G8bFSszhgao7DiObYnWUUvUpAGG8tL7aC+Td7JL11PR5Bv1e1HnymCrNWr/LrUAFBpmQ5480/BAX04SZh/RXRrYiM+L5JSRFwiiXaQ2lc9Q1oa+paKe6d19ZiHZ50JN9I9HLPmqchOLK+yIRRPyPoc0TOI7bz1kEW+U76/S+nE8RmSKq+LvDgWzgi4lIt1NXxfSU6z+MAtQHAF6TFeglquGnvFOHU/MkCPQ/+57n31L7DTEGsaLcUZfkipE70nlrYrJgE/jrqQLW4TsRPhJT2bUx4wIDAQABAoIBAHqCCeSqSttE0B+u8xJw3xuzrakgNwjkpLACdzV/lb79dvOe3UNDe3LRwYa8qDRr99rkpKc2Swh+O6DgNB4tm/IQ/K2+i9flgE7xslbQyZccH3ZaNKQEbV+ECihAJuk8KF1WnE1NFi20U13c2phXISNOA3jZ/Fm2Owpmnma3hmGHRbiXImsLhIDFl035Ekt605plriy6yvm6wyvdGGATQsXxDQ0CcOlWdgug7U+vyIc/afRC2kj/afVFqLFyUT2Xo1nTeedwTTSQ/rXRIurdLUVm75SDP1mdoAC+wMd/6LgY7byKPxlSslyaBm73o95feu7sV2dXhDipwThI+p1dQiECgYEA8wwk+l9Cxw5qZPtOXmLMUoqOtkESnZLIaFusm5Z0E1zdZhessVHQmWQ5RsVvYGYvcCG0ujTWNi6sq1fiPeZKnZj+r9Cy8UCQDssS3pV0jvy6ozKZvRMGzugQx3cPrmjwHO3Z6ycrtvz+la/H4VsWwdid8Tx1/KifHJq7XXQ3R/cCgYEAm9TuQOebvBA325rBJZnX6Ats6E9un9j5FRh7/j9CRHFFZmec79NX+306GH1j7WWO0g9nusQKysu9W54S37gIwta9h+46Hxq1bIqctDlL2SpgsZT8ZV8ejQePZwsaEaMh68u1yplPHuUWP4T+LEcH3X1E8l5KQ8Gg/B6aQXKRonUCgYEAqinKifDAFBWnr+OyzqplWzTfDgMpQWFPJqFoi9Yelp/h8mSI5+zcG0jsQPxiKh/g/qTan7P2diDfi2cQYz4k54oCZp27auVE9tZ+84+395RCJ5h5wsLbdWlMthpJxFZ8JgTxGY5nMMqYg7x6OPFJUZaTnh4yjR6Rp7k9jQSc36kCgYA5LQFWEyTS9ehozPk9QJs1aqvE+RAP2l5Z3Sfxe2hnEGB0WGP+or7PaX0dazR08CRc8oYOwstq6SJLMU6fgzjDtGLKMyBkNTqH3rvsbHFl9uSPg6iv0Ry2hiWZmzsvaXmSuKW09ldPcKKfH77apB1AqSvY+bup7KuSle/nP5Ar2QKBgQCbufjQ4I7Iej+KLz8/WVDIWa2to0tkQGxCUoVqxIxRQW8lHhRu5v9Y/gQ6d8dvx7rXb6V0VDf1joPFxnu3FwwMteMpQ8VrbH9vyqktSwCvU5t2dolcpv0MeePz9NPYdmz/MA/YIOmiUt0CVmca4q8WDNtJqjxShoIdbTH9oFXkeQ==',
'appCertPath' => COMMPATH.'third_party/alipaysdk/cert/appCertPublicKey.crt',
'alipayCertPath' => COMMPATH.'third_party/alipaysdk/cert/alipayCertPublicKey.crt',
'rootCertPath' => COMMPATH.'third_party/alipaysdk/cert/alipayRootCert.crt'
]
];
+135
View File
@@ -0,0 +1,135 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('comm', 'sys', 'url','image');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array('');
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();
+523
View File
@@ -0,0 +1,523 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://admin.dev.liche.cn/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = TRUE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'HD_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = COMMPATH.'/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = 'haodian.ai';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
+114
View File
@@ -0,0 +1,114 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
//add by 0fun
defined('ACTION_NODE_INDEX') OR define('ACTION_NODE_INDEX', 'index');
defined('ACTION_NODE_LIST') OR define('ACTION_NODE_LIST', 'lists');
defined('ACTION_NODE_GET') OR define('ACTION_NODE_GET', 'get');
defined('ACTION_NODE_ADD') OR define('ACTION_NODE_ADD', 'add');
defined('ACTION_NODE_EDIT') OR define('ACTION_NODE_EDIT', 'edit');
defined('ACTION_NODE_DEL') OR define('ACTION_NODE_DEL', 'del');
defined('ACTION_NODE_BATCH') OR define('ACTION_NODE_BATCH', 'batch');
defined('ACTION_NODE_EXPORT') OR define('ACTION_NODE_EXPORT', 'export');
defined('SYS_CODE_SUCCESS') OR define('SYS_CODE_SUCCESS', 1);
defined('SYS_CODE_FAIL') OR define('SYS_CODE_FAIL', 0);
defined('ERR_SYS_SUCCESS') OR define('ERR_SYS_SUCCESS', 1000);
defined('ERR_SYS_FAIL') OR define('ERR_SYS_FAIL', 9000);
defined('ERR_SYS_AUTH') OR define('ERR_SYS_AUTH', 9100);
defined('ERR_SYS_INVAL_PARAM') OR define('ERR_SYS_INVAL_PARAM', 9200);
defined('SUPER_ADMIN') OR define('SUPER_ADMIN', 1);
defined('LOGIN_COOKIE') OR define('LOGIN_COOKIE', 'hd_admin_cookies');
defined('LOGIN_CODE_COOKIE') OR define('LOGIN_CODE_COOKIE', 'hd_admin_cookie_codes');
//QSY LEVEL
defined('EXPERIENCE_INCREMENT') OR define('EXPERIENCE_INCREMENT', 2);
defined('EXPERIENCE_DECREMENT') OR define('EXPERIENCE_DECREMENT', 2);
+96
View File
@@ -0,0 +1,96 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'mysql:host=127.0.0.1;port=3306;dbname=ssdb',
'username' => 'devuser',
'password' => 'DEV@hdy123456',
'database' => 'ssdb',
'dbdriver' => 'pdo',
'dbprefix' => 'lc_',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8mb4',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
+24
View File
@@ -0,0 +1,24 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
);
+103
View File
@@ -0,0 +1,103 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д/' => 'D',
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);
+35
View File
@@ -0,0 +1,35 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/hooks.html
|
*/
$hook['post_controller_constructor'][] = array(
'class' => 'auth',
'function' => 'index',
'filename' => 'Auth.php',
'filepath' => 'hooks'
);
$hook['post_controller_constructor'][] = array(
'class' => 'adminlog',
'function' => 'index',
'filename' => 'Adminlog.php',
'filepath' => 'hooks',
);
$hook['pre_controller'][]= array(
'class' => 'auth',
'function' => 'initapp',
'filename' => 'Auth.php',
'filepath' => 'hooks'
);
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
*/
$config = array(
'default' => array(
'hostname' => '192.168.0.16',
'port' => '12001',
'weight' => '1',
),
);
+84
View File
@@ -0,0 +1,84 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default for security reasons.
| You should enable migrations whenever you intend to do a schema migration
| and disable it back when you're done.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| Migrations table
|--------------------------------------------------------------------------
|
| This is the name of the table that will store the current migrations state.
| When migrations runs it will store in a database table which migration
| level the system is at. It then compares the migration level in this
| table to the $config['migration_version'] if they are not the same it
| will migrate up. This must be set.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';
+184
View File
@@ -0,0 +1,184 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('audio/x-aiff', 'audio/aiff'),
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => array('video/mp4', 'video/x-f4v'),
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);
+13
View File
@@ -0,0 +1,13 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/2
* Time: 14:38
*/
defined('BASEPATH') OR exit('No direct script access allowed');
//$config['host'] = '10.0.0.51';
//$config['port'] = 20000;
$config['host'] = '192.168.0.16';
$config['port'] = 27017;
+14
View File
@@ -0,0 +1,14 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/
+26
View File
@@ -0,0 +1,26 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['access_key'] = 'Pn60lJXcaOGKvMjn5qv-OMr7wR1lp1p8QG7Ul6NK';
$config['secret_key'] = '83YE_xcHLuejVvbnCiMrMr-CYR7QshBfGgmPSknP';
$config['bucket'] = 'img-liche';
$config['region'] = '华南';
$config['is_https'] = 'https';
$config['domain'] = 'img.liche.cn';
$config['attch'] = 'liche/';
$config['img']['access_key'] = 'Pn60lJXcaOGKvMjn5qv-OMr7wR1lp1p8QG7Ul6NK';
$config['img']['secret_key'] = '83YE_xcHLuejVvbnCiMrMr-CYR7QshBfGgmPSknP';
$config['img']['bucket'] = 'img-liche';
$config['img']['region'] = '华南';
$config['img']['is_https'] = 'https';
$config['img']['domain'] = 'img.liche.cn';
$config['img']['attch'] = 'liche/';
$config['video']['access_key'] = 'Pn60lJXcaOGKvMjn5qv-OMr7wR1lp1p8QG7Ul6NK';
$config['video']['secret_key'] = '83YE_xcHLuejVvbnCiMrMr-CYR7QshBfGgmPSknP';
$config['video']['bucket'] = 'media-liche';
$config['video']['region'] = '华南';
$config['video']['is_https'] = 'https';
$config['video']['domain'] = 'media.liche.cn';
$config['video']['attch'] = 'liche/';
+11
View File
@@ -0,0 +1,11 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/2
* Time: 14:38
*/
defined('BASEPATH') OR exit('No direct script access allowed');
$config['host'] = '192.168.0.16';
$config['port'] = 6379;
+54
View File
@@ -0,0 +1,54 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
+64
View File
@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
':question:' => array('question.gif', '19', '19', 'question')
);
+6
View File
@@ -0,0 +1,6 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['host'] = '192.168.0.16';
$config['port'] = 9512;
$config['SPHINX_MAX_MATCHES'] = '2000';
+214
View File
@@ -0,0 +1,214 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
*/
$platforms = array(
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile'
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot'
);
+19
View File
@@ -0,0 +1,19 @@
<?php
/**
* Created by Vim
* User: lcc
* Desc: 微信支付配置
* Date: 2021/8/12
* Time: 14:12
*/
defined('BASEPATH') OR exit('No direct script access allowed');
$config['default'] = [ //服务商信息配置
'appid' => 'wxe66f905683582780', //服应用ID
'mchid' => '1612096731', //商户号
'merchantSerialNumber' => '761590F1FF6DFC2466894F96E2DE1169CE644A74', //商户号API证书序列号
'merchantPrivateKey' => '/home/dev28/liche/api/third_party/WXconfig/apiclient_key.pem', //商户私钥路径
'wechatpayCertificate' => '/home/dev28/liche/api/third_party/WXconfig/apiclient_wechatpay.pem', //微信支付平台证书路径
'sub_appid' => 'wx98e64c11aac45966' //子商户应用ID
];
+15
View File
@@ -0,0 +1,15 @@
<?php
/**
* Created by Vim
* User: lcc
* Desc: 晓致小号
* Date: 2021/4/15
* Time: 10:32
*/
$config['app_id'] = 1206;
$config['app_key'] = 'WX6HDVZX3AYSZDR1739332ZM';
$config['mobile_list'] = array(
'13391419510',
);
+129
View File
@@ -0,0 +1,129 @@
<?php
/**
* Notes:AppBase
* Created on: 2020/3/16 17:03
* Created by: dengbw
*/
abstract class AppBase extends HD_Controller
{
protected $app_id;
public $appUserAry = array();
private $map_app;
public function __construct()
{
parent::__construct();
$this->load->model('app/App_model', 'mdApp');
if(!$this->app_id){
$app_id = intval($this->input->get_post('app_id'));
$app_id && $this->app_id = $app_id;
} else {
$app_id = $this->app_id;
}
$this->data['app_id'] = $this->app_id = $app_id;
}
/**
* Notes:所属小程序
* Created on: 2020/3/16 12:00
* Created by: dengbw
* @return array
*/
public function app_list()
{
if ($this->app_id) {
$appList[] = $this->mdApp->get(array("id" => $this->app_id), 'id,name');
} else {
$appList[] = array("id" => "0", "name" => "选择小程序");
$resApp = $this->mdApp->select('', 'id DESC', 0, 0, 'id,name');
if ($resApp) {
foreach ($resApp as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['name'] = $value['name'];
$appList[$value['id']] = $setValue;
}
}
}
return $appList;
}
/**
* 获取管理员可操作的app列表
* @return mixed
*/
function admin_apps(){
if(SUPER_ADMIN == $this->role){
$where = array();
} else {
$app_ids = $_SESSION['admin_info']['app_id'];
if($app_ids){
$str_ids = implode(',', $app_ids);
$where = array("id in({$str_ids})" => null);
} else {
$where = array('id' => -1);
}
}
$rows = $this->mdApp->select($where, 'id asc', 0, 0, 'id,name');
return $rows;
}
/**
* Notes:获取小程序详情
* Created on: 2020/3/16 14:57
* Created by: dengbw
* @return array
*/
public function app_info()
{
$info = array();
if ($this->app_id) {
$info = $this->mdApp->get(array("id" => $this->app_id), 'id,name,logo,jsondata');
$info['jsondata'] = $info['jsondata'] ? json_decode($info['jsondata'], true) : '';
}
return $info;
}
/**
* Notes:获取用户
* Created on: 2020/4/17 10:18
* Created by: dengbw
* @param int $app_id
* @param int $app_uid
* @return array
*/
public function app_user($app_id = 0, $app_uid = 0)
{
$app_id = $app_id ? $app_id : $this->app_id;
if (!$this->appUserAry[$app_id]) {
if ($this->mdApp->appConfig()[$app_id]['model']) {
$this->load->model($this->mdApp->appConfig()[$app_id]['model'], 'mdAppUser');
$this->appUserAry[$app_id] = $this->mdAppUser;
}
}
$res = array();
if ($app_uid && $this->appUserAry[$app_id]) {
$res = $this->appUserAry[$app_id]->get(array('id' => $app_uid), 'nickname,mobile');
}
return $res;
}
public function get_app($app_id = 0){
$map_app = $this->map_app;
if(!$map_app){
$map_app = $this->mdApp->map('id','*', '', 'id DESC', 0, 0, 'id,name');
$this->map_app = $map_app;
}
if($app_id){
return $map_app[$app_id];
}
return $map_app ? $map_app : array();
}
}
+79
View File
@@ -0,0 +1,79 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2019/12/23
* Time: 10:51
*/
class Cache extends CI_Controller{
/**
* @param $method
* @param string $version
*/
function _remap($method, $version = ''){
$segments = array_slice($this->uri->segment_array(), 2);
if('redis' == $method){
$this->get_redis($segments);
}
}
function get_redis($params){
list($method, $key, $p1, $p2, $p3) = $params;
if(!$key){
exit('key is null');
}
$r = &load_cache('redis');
$redis = $r->redis();
switch(strtolower($method)){
case 'keys':
$ret = $redis->keys('*'.$key.'*');
break;
case 'get':
$ret = $redis->get($key);
break;
case 'smembers':
$ret = $redis->sMembers($key);
break;
case 'sismember':
$ret = $redis->sIsMember($key, $p1);
break;
case 'scard':
$ret = $redis->sCard($key);
break;
case 'zrange':
$ret = $redis->zRange($key, $p1, $p2, true);
break;
case 'zrangebyscore':
$ret = $redis->zRangeByScore($key, $p1, $p2);
break;
case 'llen':
$ret = $redis->lLen($key);
break;
case 'lindex':
$ret = $redis->lIndex($key, $p1);
break;
case 'lrange':
$ret = $redis->lRange($key, $p1, $p2);
break;
default:
exit("method forbidden");
}
if(is_string($ret)){
$json = json_decode($ret, true);
json_last_error() == JSON_ERROR_NONE && $ret = $json;
}
$data = array('params' => $params, 'ret' => $ret);
echo json_encode($data);
exit;
}
}
File diff suppressed because it is too large Load Diff
+59
View File
@@ -0,0 +1,59 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Demo extends HD_Controller
{
public function __construct()
{
parent::__construct();
}
//首页信息
public function index()
{
}
//数据列表
public function lists()
{
}
//展示单条数据
public function get()
{
}
//添加单条数据
public function add()
{
}
//编辑单条数据
public function edit()
{
}
//删除单条数据
public function del()
{
}
//批量操作(默认修改状态)
public function batch()
{
}
//导出数据列表
public function export()
{
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2020/7/9
* Time: 17:04
*/
class Expfile extends HD_Controller{
public function index(){
$this->lists();
}
public function lists(){
$page = $this->input->get('page');
$size = $this->input->get('size');
!$page && $page = 1;
!$size && $size = 20;
$this->load->model('sys/sys_plan_model', 'plan_model');
$this->load->model("sys/sys_admin_model", 'admin_model');
$where = array(
'type' => 1,
);
if(1 != $this->role){//超级管理员可以看到所有
$where['admin_id'] = $this->uid;
}
$total = $this->plan_model->count($where);
$lists = array();
if($total){
$select = "id, title, total_num, finish_num, plan_info, status, admin_id";
$order = "id DESC";
$rows = $this->plan_model->select($where, $order, $page, $size, $select);
$admin_ids = array_column($rows, 'admin_id');
$admin_ids = array_unique($admin_ids);
$where = array("id in (" . implode(',', $admin_ids) . ")" => null);
$select = 'id, username';
$map_admin = $this->admin_model->map('id', 'username', $where, 'id DESC', 0 ,0, $select);
foreach($rows as $row){
$plan_info = json_decode($row['plan_info'], true);
if(1 == $row['status']){
$percent = "100%";
} elseif($row['total_num'] <= $row['finish_num']) {
$percent = "99%";
} else {
$percent = round($row['finish_num'] * 100 / $row['total_num'], 2) . "%";
}
$url = $plan_info['file_info']['url'];
$http = server_http();
$url = str_replace('http://', $http, $url);
$lists[] = array(
'id' => $row['id'],
'admin_name' => $map_admin[$row['admin_id']],
'title' => $row['title'],
"file_name" => $plan_info['file_info']['name'],
'percent' => $percent,
"status" => $row['status'],
"url" => $url,
);
}
}
$this->data['pager'] = array('count' => ceil($total/$size), 'curr' => $page, 'totle' => $total, 'total' => $total);
$this->data['lists'] = $lists;
$this->data['_title'] = '导出文件列表';
return $this->show_view('app/appusual/expfile/lists', true);
}
public function get(){
// TODO: Implement get() method.
}
public function add(){
// TODO: Implement add() method.
}
public function edit(){
// TODO: Implement edit() method.
}
public function del(){
// TODO: Implement del() method.
}
public function batch(){
// TODO: Implement batch() method.
}
public function export(){
// TODO: Implement export() method.
}
}
+165
View File
@@ -0,0 +1,165 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Img extends CI_Controller
{
public function index()
{
$b64_imgs = $this->input->get('imgs');
$arr_imgs = explode(',',base64_decode($b64_imgs));
$lists = [];
if($arr_imgs){
foreach ($arr_imgs as $item) {
$lists[] = [
'alt' => '',
'pid' => '',
'src' => build_qiniu_image_url($item),
'thumb' => build_qiniu_image_url($item)
];
}
}
$data['lists'] = $lists;
$data['_title'] = '大图';
return $this->load->view('img', $data);
}
public function imgs(){
$data = '/liche/0f48c61017285abc0cff63f59ea5a25f.jpg,/liche/be842659e04f9b5b7bf3f9ab1459c611.jpg';
echo base64_encode($data);
}
//下载合同图片
public function down_contracts(){
$this->load->library('Ordersv2List');
$this->load->model('receiver/order/receiver_orders_v2_model');
$this->load->model('receiver/order/receiver_order_contracts_model', 'order_contracts_model');
require_once COMMPATH.'/third_party/TCPDF/tcpdf.php';
$brand_id = $this->input->get('brand_id');
$sid = $this->input->get('sid');
$page = $this->input->get('page');
$size = $this->input->get('size');
!$page && $page = 1;
!$size && $size = 5;
$params = [
'status_pid' => 0,
'status' => 1,
'brand_id' => $brand_id,
'page' => $page,
'size' => $size,
// 'order_time' => "2022-03-01 ~ 2022-05-22",
];
$sid && $params['sid'] = $sid;
$result = $this->ordersv2list->lists($params['status_pid'], $params);
$lists = $result['lists'];
$type_arr = [0=>'汽车购车协议',1=>'委托服务协议',2=>'车辆确定',3=>'车辆交付'];
$old_type_arr = [0=>'整车合同',1=>'委托服务协议',2=>'车辆确定',3=>'交车信息',4=>'车辆买卖合同补充协议',5=>'委托服务补充协议'];
if($lists){
foreach ($lists as $key => $val) {
echo "开始订单:{$val['o_id']}<br>";
$row = $this->receiver_orders_v2_model->get(['id'=>$val['o_id']],'sid,owner_mobile,owner_name');
$contract = $this->order_contracts_model->select(['o_id'=>$val['o_id'],"imgs <> ''",'type'=>0],'','','','id,o_id,file,imgs,type');
if($contract){
foreach ($contract as $v) {
$path = FCPATH."pdf/{$row['owner_name']}";
$row['owner_mobile'] && $path .= "({$row['owner_mobile']})";
if($val['o_id']>=10000){
$file_name = $type_arr[$v['type']] ? $type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
}else{
$file_name = $old_type_arr[$v['type']] ? $old_type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
}
if(file_exists($path.'/'.$file_name)){
echo "合同id:{$v['id']},已生成<br>";
continue;
}
$imgs = json_decode($v['imgs'],true);
if(is_array($imgs)){
if (!file_exists($path)) {
$oldumask = umask(0);
mkdir($path, 0777, true);
umask($oldumask);
}
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
//删除预定义的打印 页眉/页尾
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//设置默认等宽字体
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->SetFont('stsongstdlight', '', 20);
$pdf->AddPage();
$options = array(
// 解决SSL证书验证失败的问题
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
)
);
//设置文件信息
foreach ($imgs as $item) {
$img_url = build_qiniu_image_url($item);
$res = file_get_contents($img_url,false, stream_context_create($options));
$pdf->Ln();
$pdf->Image('@'.$res, '', '', '', '', '', $img_url,'' , false, 300, '', false, false, 0.05, false, false, false);
}
$pdf->Output( $path.'/'.$file_name,'F');
echo "合同id:{$v['id']},保存成功{$path}/{$file_name}<br>";
}else{
file_get_contents("https://api.liche.cn/wxapp/licheb/protocol/pdf_img?id={$v['id']}");
echo "合同id:{$v['id']},没有图片<br>";
}
}
}else{
echo "订单:{$val['o_id']},没有合同<br>";
}
}
}else{
echo "执行结束";
}
}
//修改文件名
public function change_dir_name(){
$this->load->model('receiver/order/receiver_orders_v2_model');
$path = FCPATH."pdf/";
//PHP遍历所有文件夹
$handle=opendir($path.".");
$array_file = array();
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..") {
$array_file[] = $file; //输出文件名
}
}
closedir($handle);
if(is_array($array_file)){
foreach ($array_file as $item) {
if(is_numeric($item)){
$dir = $path.$item;
$arr = scandir($dir);
$len = count($arr)-2;
if($len>0){
$row = $this->receiver_orders_v2_model->get(['sid'=>$item],'owner_mobile,owner_name');
if($row){
$rename = $path.$row['owner_name'];
$row['owner_mobile'] && $rename.="({$row['owner_mobile']})";
if(rename($dir,$rename)){
echo "更名成功{$rename}<br>";
}else{
echo "更名失败{$item}<br>";
}
}else{
echo "订单不存在{$item}<br>";
}
}else{
@unlink($dir);
echo "删除文件夹:{$dir}<br>";
}
}else{
echo "无需改名:{$item}.<br>";
}
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 查看日志
* Created by PhpStorm.
* User: xuxb
* Date: 2019/11/8
* Time: 15:33
*/
class Log extends CI_Controller{
function __construct(){
parent::__construct();
}
/**
* @param $method
* @param string $version
*/
function _remap($method, $version = ''){
$segments = array_slice($this->uri->segment_array(), 2);
$dir = implode('/', $segments);
$path = $this->path($method, $dir);
if(is_file($path)){
return $this->get_log($path);
} elseif(is_dir($path)) {//日志文件
return $this->get_dir($path);
} else {
exit("file unkonw;path=$path");
}
}
/**
* 获取日志
* @param $path
*/
protected function get_log($path){
$n = $this->input->get('n');
!$n && $n = 100;
$start = $this->input->get('start');
$start < $n && $start = $n;
if(!$fp=fopen($path,'r')){
exit("[error] file can not open;path=$path\n");
}
$pos = -2;
$t = " ";
while ($start > 0) {
while ($t != "\n") {
if(-1 != fseek($fp, $pos, SEEK_END)){
$t = fgetc($fp);
$pos--;
} else {
fseek($fp, 0, SEEK_SET);
$start = 0;
break;
}
}
$t = " ";
$start--;
}
while (!feof($fp) && $n-- > 0){
echo fgets($fp);
};
//关闭文件
fclose($fp);
}
/**
* 展示目录
* @param $path
*/
protected function get_dir($path){
$arr = array();
if ($dh = opendir($path)){
while (($file = readdir($dh)) !== false){
if('.' == $file || '..' == $file){
continue;
}
$arr[] = $file;
}
sort($arr);
$arr = array_reverse($arr);//倒序排列
// echo json_encode($arr);
foreach($arr as $v){
echo "<a href='/" .$this->uri->uri_string(). "/{$v}'>{$v}</a><br/>";
}
closedir($dh);
}
}
/**
* 获取文件路径
* @param $method
* @param $dir
* @return string
*/
private function path($method, $dir){
if('api' == $method){
$file_path = "../../api/logs/{$dir}";
} elseif('admin' == $method) {
$file_path = APPPATH . "logs/{$dir}";
} elseif('h5' == $method){
$file_path = "../../home/logs/{$dir}";;
} else {
exit("method unknow;method={$method};dir={$dir}");
}
return $file_path;
}
}
+234
View File
@@ -0,0 +1,234 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/12
* Time: 09:24
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller
{
public function index()
{
if ($cookie = $this->input->cookie(LOGIN_COOKIE)) {
header('Location:/welcome');
}
$arr = array();
if ($this->input->get('need_code') == 'logsms'){
$arr['need_code'] = 'logsms';
}
$this->load->view('login', $arr);
}
public function post()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->library('encryption');
$check_view = false;
$ip = get_client_ip();
$ip_arr = array();
if ($this->input->post('need_code') == 'get') {
return false;
}
$log = 0;//加日志
if ($this->input->post('need_code') == 'login' || $this->input->post('need_code') == 'logsms') {
$code = $this->input->post('code');
$mobile = $this->input->post('mobile');
$this->input->post('need_code') == 'logsms' && $mobile = $this->input->post('number');
$cookie = $this->input->cookie(LOGIN_CODE_COOKIE);
$code_cookie = $this->encryption->decrypt($cookie);
if (!$code_cookie) {
return $this->show_json(0, '验证码已过期');
}
if ($code_cookie != $code) {
return $this->show_json(0, '验证码错误');
}
$this->load->model('sys/sys_admin_model');
$admin_user = $this->sys_admin_model->get(array("mobile = '{$mobile}'" => null, 'status' => 1));
if (!$admin_user['id']) {
return $this->show_json(0, '用户不存在');
}
$log = 1;
} else {
if (!$username) {
return $this->show_json(0, '请输入用户名/手机号');
}
if (!$password) {
return $this->show_json(0, '请输入密码');
}
$this->load->model('sys/sys_admin_model');
$admin_user = $this->sys_admin_model->get(array("username like '{$username}' OR mobile like '{$username}'" => null, 'status' => 1));
if (!$admin_user['id']) {
return $this->show_json(0, '用户不存在');
} elseif (!$admin_user['status']) {
return $this->show_json(0, '用户状态异常');
} elseif (!password_verify($password, $admin_user['password'])) {
return $this->show_json(0, '密码错误');
} else {
if (false !== strpos($_SERVER['HTTP_HOST'], "admin.dev.liche.cn") || false !== strpos($_SERVER['HTTP_HOST'], "admin.lc.haodian.cn")) {
//开发测试不校验IP
} elseif (filter_var($ip, FILTER_VALIDATE_IP)) {
// $this->load->model('sys/sys_config_model');
// $config_ip = $this->sys_config_model->select(array("v LIKE '%\"status\":\"1\"%'" => NULL, "k" => "site"));
// foreach ($config_ip as $key => $value) {
// $ip_arr[] = json_decode($value['v'])->ip;
// }
// $ip_arr = array_merge($ip_arr, array_column($this->sys_admin_model->select(array(), '', '', '', 'login_ip'), 'login_ip'));
// if (!in_array($ip, $ip_arr)) {
// $check_view = true;
// $log = 1;
// }
}
}
}
$admin_info = array(
'id' => $admin_user['id'],
'username' => $admin_user['username'],
'role_id' => $admin_user['role_id'],
'login_ip' => $ip,
);
$http_host = explode(':', $_SERVER['HTTP_HOST']);
$domain = explode('.', $http_host[0]);
array_shift($domain);
$domain = implode('.', $domain);
$this->input->set_cookie(LOGIN_COOKIE, $this->encryption->encrypt(json_encode($admin_info)), 86400 * 30, $domain);
if ($log == 1) {
$this->load->model('sys/sys_admin_log_model');
$log = array(
'admin_id' => $admin_user['id'],
'username' => $admin_user['username'],
'target_id' => 0,
'descrip' => '外网IP登录',
'action' => '',
'ip' => $ip,
'jsondata' => json_encode($this->input->post(), JSON_UNESCAPED_UNICODE),
);
$this->sys_admin_log_model->add($log);
}
if ($check_view && $admin_user['id'] > 10) {//管理员id>10去掉验证码登录
return $this->show_json(SYS_CODE_SUCCESS, '访问IP发生变化,需要手机验证登录', '/login/check_view');
} else {
$this->sys_admin_model->update(array('login_ip' => $ip), array('id' => $admin_user['id']));
return $this->show_json(SYS_CODE_SUCCESS, ' 登 录 成 功', '/');
}
}
//获取验证码
public function get_code()
{
if ($this->input->method() == 'post') {
$mobile = $this->input->post('mobile', true);
if (!$mobile){
return false;
}
$this->load->model('sys/sys_admin_model');
$admin_user = $this->sys_admin_model->get(array("mobile = '{$mobile}'" => null, 'status' => 1));
if (!$admin_user['id']) {
return false;
}
$code = rand(100000, 999999);
$domain = explode('.', $_SERVER['HTTP_HOST']);
array_shift($domain);
$domain = implode('.', $domain);
$this->input->set_cookie(LOGIN_CODE_COOKIE, $this->encryption->encrypt(json_encode($code)), 60 * 5, $domain);
send_sms($mobile, $code);
}
}
public function check_view()
{
$this->load->library('encryption');
$this->load->model('sys/sys_admin_model');
$info = json_decode($this->encryption->decrypt($this->input->cookie(LOGIN_COOKIE)), true);
$admin_user = $this->sys_admin_model->get(array('id' => $info['id']));
$domain = explode('.', $_SERVER['HTTP_HOST']);
array_shift($domain);
$domain = implode('.', $domain);
$this->input->set_cookie(LOGIN_COOKIE, '', 0, $domain);
$this->input->set_cookie(LOGIN_CODE_COOKIE, '', 0, $domain);
if ($admin_user) {
$arr = array(
'mobile' => $admin_user['mobile'],
'need_code' => true
);
$this->load->view('login', $arr);
} else {
header('Location:/login');
}
$this->load->view('login', $arr);
}
//重置密码
public function reset_pwd()
{
if ($this->input->method() == 'post') {
$password = $this->input->post('password', true);
$confirm_password = $this->input->post('confirm_password', true);
$old_password = $this->input->post('old_password', true);
if (!$old_password) {
return $this->show_json(SYS_CODE_FAIL, '请输入旧密码');
}
if (!$password || mb_strlen($password) < 6) {
return $this->show_json(SYS_CODE_FAIL, '请输入6个字符的新密码');
}
if (!$confirm_password) {
return $this->show_json(SYS_CODE_FAIL, '请输入确认密码');
}
if ($password != $confirm_password) {
return $this->show_json(SYS_CODE_FAIL, '新密码和确认密码不一致');
}
$this->load->model('sys/sys_admin_model');
$admin_user = $this->sys_admin_model->get(array("id" => $this->uid));
if (!password_verify($old_password, $admin_user['password'])) {
return $this->show_json(SYS_CODE_FAIL, '旧密码不正确');
}
$data['password'] = password_hash($password, PASSWORD_BCRYPT);
$this->sys_admin_model->update($data, array('id' => $this->uid));
return $this->show_json(SYS_CODE_SUCCESS, '保存成功', array(), '/login/logout', 5000);
}
$this->load->view('reset');
}
//退出
public function logout()
{
$domain = explode('.', $_SERVER['HTTP_HOST']);
array_shift($domain);
$domain = implode('.', $domain);
$this->input->set_cookie(LOGIN_COOKIE, '', 0, $domain);
return $this->show_json(SYS_CODE_SUCCESS, '注销成功', '/login');
}
//返回json数据
protected function show_json($code = 0, $msg = 'success', $url = '', $wait = 0)
{
header('Content-Type:application/json; charset=utf-8');
echo json_encode(array('data' => $this->data, 'code' => $code, 'msg' => $msg, 'url' => $url, 'wait' => $wait), JSON_UNESCAPED_UNICODE);
return false;
}
}
+94
View File
@@ -0,0 +1,94 @@
<?php
//enter
defined('BASEPATH') OR exit('No direct script access allowed');
class Outer extends CI_Controller {
public function index()
{
$this->load->model('sys/sys_menu_model');
$list = $this->sys_menu_model->select(array('status' => 1), 'sort desc', 0, 0);
$this->load->model('sys/sys_role_model');
$role = $this->sys_role_model->get(array('id' => $this->role));
$menu_ids = explode(',', $role['menu_ids']);
//获取路由
$url = $this->input->get('url');
$url = str_replace('welcome', 'outer', $url);
$spm = $this->input->get('spm');
$this->data['url'] = $url;
foreach ($list as $item)
{
if($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids))
{
continue;
}
$map[$item['id']] = $item;
}
foreach ($list as $item)
{
if($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids))
{
continue;
}
if (isset($item['pid']) && isset($map[$item['pid']]))
{
$map[$item['pid']]['sub'][] = &$map[$item['id']];
}
else
{
$this->data['menus'][] = &$map[$item['id']];
}
}
unset($map);
//获取面包屑
$menus = $this->sys_menu_model->select(array("url like '" . $url . "%'" => null, 'status' => 1, 'outer_link' => 1));
$menu = array();
foreach($menus as $item){
if(!$menu){
$menu = $item;
continue;
}
//节点更匹配的菜单
if(0 !== strpos($menu['node'], $spm) || strlen($item['node']) > strlen($menu['node'])){
$menu = $item;
continue;
}
}
//获取面包屑
$menu && $spm = $menu['node'];
$spm_arr1 = explode('-', $spm);
$spm_arr1 && !is_numeric($spm_arr1[0]) && $spm_arr1 = array_slice($spm_arr1, 1);
if($spm_arr1){
$rows = $this->sys_menu_model->select(array("id in (" . implode(",",$spm_arr1) . ")" => null, 'status' => 1), 'sort desc');
$menu_arr = array();
$breads = array();
foreach($rows as $row){
$menu_arr[$row['id']] = $row;
}
foreach($spm_arr1 as $v){
$item = $menu_arr[$v];
$breads[] = array(
'spm' => $item['node'],
'url' => '#' == $item['url'] ? '' : $item['url'],
'name' => $item['name'],
);
}
$this->data['breads'] = $breads;
}
$this->data['_username'] = $this->username;
$this->data['_role'] = $role['name'];
$this->load->vars($this->data);
$this->load->view('bread');
$this->load->view('snav');
$this->load->view('outerlink');
}
}
+104
View File
@@ -0,0 +1,104 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/**
* 临时脚本
*/
class Tmp extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_cars_model');
$this->load->model('auto/auto_series_model');
$this->load->library('carHome');
$this->load->helper('order');
}
//临时导入车型库脚本
public function importCars()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$file = FCPATH . 'temp/cars.xlsx';
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
$col_max = $objWorksheet->getHighestColumn();//最大列
$arr = array();
for ($i = 2; $i <= $rowCnt; $i++) { //读取内容
$carId = $objWorksheet->getCell('A' . $i)->getValue();
$brand = $objWorksheet->getCell('B' . $i)->getValue();
$series = $objWorksheet->getCell('C' . $i)->getValue();
$name = $objWorksheet->getCell('D' . $i)->getValue();
if (!$this->auto_cars_model->get(['third_car_id' => $carId])) {
$brandRow = $this->auto_brand_model->get(['name' => $brand]);
if (!$brandRow) {
$brand_id = $this->auto_brand_model->add(['name' => $brand, 'c_time' => time()]);
} else {
$brand_id = $brandRow['id'];
}
$seriesRow = $this->auto_series_model->get(['name' => $series, 'brand_id' => $brand_id]);
if (!$seriesRow) {
$s_id = $this->auto_series_model->add(['name' => $series, 'brand_id' => $brand_id, 'c_time' => time()]);
} else {
$s_id = $seriesRow['id'];
}
$insert = [
'third_car_id' => $carId,
'brand_id' => $brand_id,
'series_id' => $s_id,
'name' => $name,
'c_time' => time(),
];
$this->auto_cars_model->add($insert);
}
}
echo '导入完成';
}
public function testApi(){
$data = [
'buyerType' => 1,
'buyerName' => '张三',
'buyerPhone' => '18355559999',
'specId' => 67266,
'storeId' => 11,
'outOrderId' => create_order_no(),
'outLeadId' => 1,
'outOrderCreateTime' => date('Y-m-d H:i:s', time()),
'registerCityId' => 433100,
];
$data['autohomeOrderId'] = 14;
$data['invoiceAmount'] = 5000.00;
$data['isRegisterInStore'] = 1;
$data['registerAmount'] = 600;
$data['isInsured'] = 1;
$data['isLoan'] = 1;
$data['loanAmount'] = 500000;
$data['loanPeriods'] = 36;
$data['monthlyPayment'] = 2600;
$data['carryCarDate'] = '2024-06-01';
$data['payDate'] = '2024-05-23';
$data['contractImg'] = 'https://img.liche.cn/liche/2024/05/18ead093c6f65269/53b4b876a3dccd57.jpg';
$data['invoiceImg'] = 'https://img.liche.cn/liche/2024/05/18ead093c6f65269/53b4b876a3dccd57.jpg';
$data['payImg'] = 'https://img.liche.cn/liche/2024/05/18ead093c6f65269/53b4b876a3dccd57.jpg';
$data['outColor'] = '白色';
$data['inColor'] = '棕色';
$data['deliveryDate'] = '2024-05-26';
$data['downpaymentType'] = 1;
$data['confirmAmount'] = 5000;
$data['discountAmount'] = 1000;
$data['isLocalInvoice'] = 1;
$data['idCardNo'] = '350522198910148675';
$data['carDocumentImg'] = 'https://img.liche.cn/liche/2024/05/18ead093c6f65269/53b4b876a3dccd57.jpg';
$data['insuranceImg'] = 'https://img.liche.cn/liche/2024/05/18ead093c6f65269/53b4b876a3dccd57.jpg';
$data['deliveryPhoto'] = 'https://img.liche.cn/liche/2024/05/18ead093c6f65269/53b4b876a3dccd57.jpg';
$req = $this->carhome->saveOrder($data);
print_r($req);
exit;
}
}
+150
View File
@@ -0,0 +1,150 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/13
* Time: 16:43
*/
defined('BASEPATH') OR exit('No direct script access allowed');
ini_set('display_errors', 'On');
class Upload extends CI_Controller
{
public function index()
{
$mode = $this->input->get('mode');
$types = $this->input->get('type');
$uptype = $this->input->get('uptype');
$field = $this->input->get('field');
$mark = $this->input->get('mark');
$source = $this->input->get('source');
if('file' == $mark){
return $this->pdf();
}
$data['mode'] = $mode ? $mode : '1';
$data['types'] = $types ? $types : 'jpg,png';
$data['uptype'] = $uptype ? $uptype : 'qiniu';
$data['mimes'] = $this->file_mime($data['types']);
$data['field'] = $field ? $field : 'file';
$data['source'] = $source ? $source : '';
if ($mark) {
$mark_data = explode(':', $mark);
$data['mark'] = $mark_data[0];
$data['mark_id'] = $mark_data[1];
$data['mark_url'] = count($mark_data) >= 3 ? $mark_data[2] : '/biz/store/pic/add';
}
return $this->load->view('upload', $data);
}
public function pdf(){
$mode = $this->input->get('mode');
$types = $this->input->get('type');
$uptype = $this->input->get('uptype');
$source = $this->input->get('source');
$field = $this->input->get('field');
$data['mode'] = $mode ? $mode : '1';
$data['types'] = $types;
$data['uptype'] = $uptype ? $uptype : 'qiniu';
$data['mimes'] = $this->file_mime($data['types']);
$data['source'] = $source ? $source : '';
$data['field'] = $field ? $field : '';
$this->load->view('uploadpdf', $data);
}
//文件状态检查
public function upstate()
{
$post = $this->input->post();
$this->load->library('qiniu');
$config = $this->qiniu->getConfig();
$filename = join('/', str_split($post['md5'], 16)) . '.' . strtolower(pathinfo($post['filename'], PATHINFO_EXTENSION));
$filename = $config['attch'] . date('Y/m') . '/' . $filename;
$ratio = number_format($post['height']/$post['width'], 1);
$ratio_exm = number_format(4/3, 1);
if ($ratio <= 0.3){
$picHeight = 225;
} else if(0.3 < $ratio && $ratio < $ratio_exm) {
$picHeight = number_format($post['height']/$post['width'], 2) * 750;
} else if($ratio >= $ratio_exm) {
$picHeight = 1000;
}
// 检查文件是否已上传
if ($site_url = $this->qiniu->getFileUrl($filename)) {
return $this->show_json('IS_FOUND', array(
'site_url' => $site_url, 'file_url' => $filename, 'picHeight' => $picHeight, 'width' => $post['width']
));
}
// 需要上传文件,生成上传配置参数
$config = array('uptype' => $post['uptype'], 'file_url' => $filename);
$config['server'] = $this->qiniu->getUploadQiniuUrl(true);
$config['token'] = $this->qiniu->getToken($filename);
$config['picHeight'] = $picHeight;
return $this->show_json('NOT_FOUND', $config);
}
//文件状态检查
public function upstate_pdf()
{
$post = $this->input->post();
$this->load->library('qiniu');
$config = $this->qiniu->getConfig();
$filename = join('/', str_split($post['md5'], 16)) . '.' . strtolower(pathinfo($post['filename'], PATHINFO_EXTENSION));
$filename = $config['attch'] . date('Y/m') . '/' . $filename;
// 检查文件是否已上传
if ($site_url = $this->qiniu->getFileUrl($filename)) {
return $this->show_json('IS_FOUND', array(
'site_url' => $site_url,
'file_url' => $filename,
'file_title' => substr($filename, strrpos($filename, '/')+1)
));
}
// 需要上传文件,生成上传配置参数
$config = array('uptype' => $post['uptype'], 'file_url' => $filename);
$config['server'] = $this->qiniu->getUploadQiniuUrl(true);
$config['token'] = $this->qiniu->getToken($filename);
$config['file_title'] = substr($filename, strrpos($filename, '/')+1);
return $this->show_json('NOT_FOUND', $config);
}
//返回json数据
protected function show_json($code = '', $data = array())
{
header('Content-Type:application/json; charset=utf-8');
echo json_encode(array('code' => $code, 'data' => $data), JSON_UNESCAPED_UNICODE);
return false;
}
private function file_mime($ext, $mime = array())
{
$mimes = &get_mimes();
foreach (is_string($ext) ? explode(',', $ext) : $ext as $e) {
$tmp = isset($mimes[strtolower($e)]) ? $mimes[strtolower($e)] : 'application/octet-stream';
if (is_array($tmp)) {
$mime = array_merge($mime, $tmp);
} else {
$mime[] = $tmp;
}
}
return join(',', array_unique($mime));
}
}
+57
View File
@@ -0,0 +1,57 @@
<?php
//enter
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->model('sys/sys_menu_model');
$list = $this->sys_menu_model->select(array('status' => 1), 'sort desc', 0, 0);
$this->load->model('sys/sys_role_model');
$role = $this->sys_role_model->get(array('id' => $this->role));
$menu_ids = explode(',', $role['menu_ids']);
foreach ($list as $item)
{
if($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids))
{
continue;
}
$map[$item['id']] = $item;
}
foreach ($list as $item)
{
if($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids))
{
continue;
}
if (isset($item['pid']) && isset($map[$item['pid']]))
{
$map[$item['pid']]['sub'][] = &$map[$item['id']];
}
else
{
$this->data['menus'][] = &$map[$item['id']];
}
}
unset($map);
$this->data['_username'] = $this->username;
$this->data['_role'] = $role['name'];
$this->load->view('index', $this->data);
return true;
}
public function nopage()
{
$this->load->view('nopage');
return true;
}
}
+155
View File
@@ -0,0 +1,155 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2019/11/20
* Time: 14:45
*/
class App extends HD_Controller
{
protected $log_file = 'app.log';
function __construct()
{
parent::__construct();
$this->load->model('app/app_model');
}
public function index()
{
$this->lists();
}
public function lists()
{
$keyword = $this->data['keyword'] = $this->input->get('keyword');
$page = $this->input->get('page');
$size = $this->input->get('size');
!$page && $page = 1;
!$size && $size = 20;
$where = array();
$keyword && $where['name like'] = "%{$keyword}%";
$total = $this->app_model->count($where);
$lists = array();
if($total){
$rows = $this->app_model->select($where, 'id DESC', $page, $size, 'id,name,jsondata,c_time');
foreach($rows as $item){
$jsondata = json_decode($item['jsondata'],true);
$lists[] = array(
'id' => $item['id'],
'name' => $item['name'],
'publish' => $jsondata['publish'] ? 1 : 0,
'c_time' => date('Y-m-d H:i', $item['c_time']),
);
}
}
$this->data['lists'] = $lists;
$this->data['pager'] = array('count'=>ceil($total/$size),'curr'=>$page,'totle'=>$total);
$this->data['_title'] = '小程序管理';
return $this->show_view('app/appusual/lists',true);
}
public function get()
{
$id = $this->input->get('id');
if($id){
$row = $this->app_model->get(array('id' => $id));
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '不存在');
}
$item = array(
'id' => $row['id'],
'name' => $row['name'],
'logo' => $row['logo'],
'logo_src' => $row['logo'] ? build_qiniu_image_url($row['logo']) : '',
);
$this->data['url'] = 'edit';
} else {
$this->data['url'] = 'add';
$item = array();
}
$this->data['item'] = $item;
return $this->show_view('app/appusual/get');
}
public function add()
{
$name = $this->input->post('name');
$logo = $this->input->post('logo');
if(!$name){
return $this->show_json(SYS_CODE_FAIL, '名称必填');
}
$add = array(
'name' => $name,
'logo' => $logo,
'jsondata' => '',
'c_time' => time(),
);
$ret = $this->app_model->add($add);
if(!$ret){
debug_log("[error]" . __FUNCTION__ . ":" . $this->app_model->db->last_query(), $this->log_file);
return $this->show_json(SYS_CODE_FAIL, '操作失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function edit()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = $this->input->post('id');
$name = $this->input->post('name');
$logo = $this->input->post('logo');
if(!$id){
return $this->show_json(SYS_CODE_FAIL, '选择ID');
}
if(!$name){
return $this->show_json(SYS_CODE_FAIL, '名称必填');
}
$upd = array(
'name' => $name,
'logo' => $logo,
);
$ret = $this->app_model->update($upd, array('id' => $id));
if(!$ret){
debug_log("[error]" . __FUNCTION__ . ":" . $this->app_model->db->last_query(), $this->log_file);
return $this->show_json(SYS_CODE_FAIL, '操作失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function del()
{
$id = $this->input->post('id');
if(!$id) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
$this->app_model->delete(array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS, '删除成功');
}
public function batch()
{
// TODO: Implement batch() method.
}
public function export()
{
// TODO: Implement export() method.
}
public function edit_publish(){
$id = $this->input->post('id');
$value = $this->input->post('value');
$row = $this->app_model->get(['id'=>$id]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$jsondata = json_decode($row['jsondata'],true);
$jsondata['publish'] = $value ? 1:0;
$jsondata = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
$this->app_model->update(['jsondata'=>$jsondata],['id'=>$id]);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
}
+86
View File
@@ -0,0 +1,86 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/**
* Created by Vim.
* User: lcc
* Date: 2019/12/06
* Time: 10:02
*/
class Main extends HD_Controller
{
public function __construct()
{
$this->app_id = 2;
parent::__construct();
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
}
public function index()
{
/*应用状况*/
$conditions = array();
/*小程序设置 start*/
$list = [];
$value = $this->userM->count([]);
$list[] = array(
'title' => '用户(人)',
'value' => $value,
'btns' => array(
array('name' => '查看详情', 'url' => '/app/licheb/member/index?status=1'),
),
);
$value = $this->userM->count(['group_id' => 4, 'status' => 1]);
$list[] = array(
'title' => '渠道列表(人)',
'value' => $value,
'btns' => array(
array('name' => '查看详情', 'url' => '/app/licheb/channel'),
),
);
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
$this->data['conditions'] = $conditions;
$this->data['_title'] = '狸车';
return $this->show_view('/app/main', true);
}
public function lists()
{
// TODO: Implement lists() method.
}
public function get()
{
}
public function add()
{
// TODO: Implement add() method.
}
public function edit()
{
}
public function del()
{
// TODO: Implement del() method.
}
public function batch()
{
// TODO: Implement batch() method.
}
public function export()
{
// TODO: Implement export() method.
}
}
+520
View File
@@ -0,0 +1,520 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Member extends HD_Controller
{
private $groups = [1 => '销售', 2 => '店长', 3 => '老板', 4 => '渠道经理'];
public function __construct()
{
parent::__construct();
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
$this->load->model("biz/biz_model");
}
//首页信息
public function index()
{
$this->lists();
}
//数据列表
public function lists($where = array())
{
$params = $this->input->get();
$page = $params['page'];
$size = $params['size'];
!$page && $page = 1;
!$size && $size = 20;
if ($params['name']) {
$where['uname like "%' . $params['name'] . '%"'] = null;
$this->data['name'] = $params['name'];
}
if ($params['mobile']) {
$where['mobile'] = $params['mobile'];
$this->data['mobile'] = $params['mobile'];
}
if ($params['group_id']) {
$where['group_id'] = $params['group_id'];
$this->data['group_id'] = $params['group_id'];
}
if ($params['biz_id']) {
$where['biz_id'] = $params['biz_id'];
} else {
$params['city_id'] = '';
$params['county_id'] = '';
$params['biz_id'] = '';
}
if(strlen($params['status'])){
$where['status'] = $params['status'];
}
$count = $this->userM->count($where);
$lists = $this->userM->select($where, 'id desc', $page, $size);
foreach ($lists as $key => $val) {
$biz_name = '';
if ($val['group_id'] == 4) {
$biz_name = ' <a href="javascript:void(0)" data-open="/app/licheb/channel/lists_biz?uid=' . $val['id'] . '">门店列表</a>';
} else if ($val['biz_id']) {
$re_biz = $this->biz_model->get(['id' => $val['biz_id']], 'biz_name');
$re_biz && $biz_name = $re_biz['biz_name'];
}
$lists[$key]['biz_name'] = $biz_name;
$lists[$key]['group_name'] = $this->groups[$val['group_id']];
$biz_name = '';
if ($val['group_id1'] == 4) {
$biz_name = ' <a href="javascript:void(0)" data-open="/app/licheb/channel/lists_biz?group_id1=1&uid=' . $val['id'] . '">门店列表</a>';
} else if ($val['biz_id1']) {
$re_biz = $this->biz_model->get(['id' => $val['biz_id1']], 'biz_name');
$re_biz && $biz_name = $re_biz['biz_name'];
}
$lists[$key]['biz_name1'] = $biz_name;
$lists[$key]['group_name1'] = $this->groups[$val['group_id1']];
if (SUPER_ADMIN == $this->role) {//超级管理员才允许操作用户的披上超级马甲
$majia = array();
if ($val['jsondata']) {
$json = json_decode($val['jsondata'], true);
$majia = $json['majia'] ? $json['majia'] : array();
}
$lists[$key]['umajia'] = $majia;
}
}
$this->data['app_id'] = 2;
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['groupAry'] = $this->groups;
$this->data['_title'] = '用户列表';
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
return $this->show_view('/app/licheb/member/lists', true);
}
//展示单条数据
public function get()
{
$this->load->model("sys/sys_city_model", 'mdSysCity');
$id = $this->input->get('id');
$row = $this->userM->get(['id' => $id]);
$selectedBrands = [];
$selectedBrands1 = [];
if ($id) {
$info = array(
'id' => $row['id'],
'uname' => $row['uname'],
'mobile' => $row['mobile'],
'group_id' => $row['group_id'],
'biz_id' => $row['biz_id'],
'city_id' => $row['city_id'],
'group_id1' => $row['group_id1'],
'biz_id1' => $row['biz_id1'],
'city_id1' => $row['city_id1'],
);
if ($row['group_id'] == 4) {
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
$res_biz = $this->mdChannelBiz->select(['uid' => $id], 'id desc', 0, 0, 'biz_id');
$res_biz && $biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
if ($res_biz) {
$biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
$ids = implode(',', $biz_id_arr);
$typeAry = $this->biz_model->type_ary();
$type_ids = implode(',',array_keys($typeAry));
$selectedBrands = $this->biz_model->select(["id in ($ids)" => null, "type in ($type_ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
}
} else if ($row['biz_id']) {
$re_biz = $this->biz_model->get(["id" => $row['biz_id'], 'status' => 1], 'id ,biz_name');
if ($re_biz) {
$selectedBrands[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
}
}
# group_id1
if ($row['group_id1'] == 4) {
$this->load->model('app/licheb/App_licheb_channel_biz1_model', 'mdChannelBiz1');
$res_biz = $this->mdChannelBiz1->select(['uid' => $id], 'id desc', 0, 0, 'biz_id');
$res_biz && $biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
if ($res_biz) {
$biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
$ids = implode(',', $biz_id_arr);
$typeAry = $this->biz_model->type_ary();
$type_ids = implode(',',array_keys($typeAry));
$selectedBrands1 = $this->biz_model->select(["id in ($ids)" => null, "type in ($type_ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
}
} else if ($row['biz_id1']) {
$re_biz = $this->biz_model->get(["id" => $row['biz_id1'], 'status' => 1], 'id ,biz_name');
if ($re_biz) {
$selectedBrands1[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
}
}
$action = '/app/licheb/member/edit';
$_title = '编辑用户';
} else {
$info = array('biz_id' => '', 'group_id' => '', 'city_id' => 0, 'biz_id1' => '', 'group_id1' => 0, 'city_id1' => 0);
$action = '/app/licheb/member/add';
$_title = '添加用户';
}
$type_ary = $this->biz_model->type_ary();
$typeStr = '1,2,3';//品牌 合伙 代理
$typeAry = [];
foreach ($type_ary as $k => $v) {
if (strstr($typeStr . ',', $k . ',')) {
$typeAry[$k] = $v;
}
}
$show_info['typeAry'] = $typeAry;
#$show_info['typeAry'] = $this->biz_model->type_ary();
$show_info['cityList'] = $this->mdSysCity->select(['status' => 1], 'id desc', 0, 0, 'city_id,name');
$this->data['selectedBrands'] = $selectedBrands;
$this->data['selectedBrands1'] = $selectedBrands1;
$this->data['show_info'] = $show_info;
$this->data['info'] = $info;
$this->data['groups'] = $this->groups;
$this->data['action'] = $action;
$this->data['_title'] = $_title;
return $this->show_view('app/licheb/member/get', true);
}
//添加单条数据
public function add()
{
$info = $this->input->post('info');
$uname = $info['uname'];
$mobile = $info['mobile'];
$group_id = $info['group_id'];
$bizs = $info['bizs'];
$city_id = $info['city_id'];
$biz_id_arr = array_column($bizs, 'biz_id');
$group_id1 = $info['group_id1'];
$bizs1 = $info['bizs1'];
$city_id1 = $info['city_id1'];
$biz_id_arr1 = is_array($bizs1) ? array_column($bizs1, 'biz_id') : '';
if (!mobile_valid($mobile)) {
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
}
if (!$uname) {
return $this->show_json(SYS_CODE_FAIL, '请输入姓名');
}
$exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null));
if ($exist) {
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
}
$add = array(
'mobile' => $mobile,
'uname' => $uname,
'city_id' => $city_id,
'city_id1' => $city_id1,
'status' => 1,
'c_time' => time(),
);
$group_id && $add['group_id'] = $group_id;
$biz_id_arr && $add['biz_id'] = implode(',', $biz_id_arr);
$add['group_id1'] = $group_id1 ? $group_id1 : 0;
$biz_id_arr1 && $add['biz_id1'] = implode(',', $biz_id_arr1);
$id = $this->userM->add($add);
if ($id && $group_id == 4 && $biz_id_arr) {//加狸车宝渠道门店
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr]);
}
if ($id && $group_id1 == 4 && $biz_id_arr1) {//加狸车宝渠道门店 group_id1
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr1, 'edit' => 1, 'group_id1'=>true]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功', '/app/licheb/member');
}
//编辑单条数据
public function edit()
{
$info = $this->input->post('info');
$id = $info['id'];
$uname = $info['uname'];
$nickname = $info['nickname'];
$mobile = $info['mobile'];
$group_id = $info['group_id'];
$bizs = $info['bizs'];
$city_id = $info['city_id'];
$biz_id_arr = is_array($bizs) ? array_column($bizs, 'biz_id') : '';
$group_id1 = $info['group_id1'];
$bizs1 = $info['bizs1'];
$city_id1 = $info['city_id1'];
$biz_id_arr1 = is_array($bizs1) ? array_column($bizs1, 'biz_id') : '';
if (!mobile_valid($mobile)) {
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
}
if (!$uname) {
return $this->show_json(SYS_CODE_FAIL, '请输入姓名');
}
$exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null, 'id <>' => $id));
if ($exist) {
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
}
$upd = array(
'mobile' => $mobile,
'city_id' => $city_id,
'city_id1' => $city_id1,
);
$upd['group_id'] = $group_id ? $group_id : 0;
$upd['biz_id'] = $biz_id_arr ? implode(',', $biz_id_arr) : 0;
$upd['group_id1'] = $group_id1 ? $group_id1 : 0;
$upd['biz_id1'] = $biz_id_arr1 ? implode(',', $biz_id_arr1) : 0;
$nickname && $upd['nickname'] = $nickname;
$uname && $upd['uname'] = $uname;
$this->userM->update($upd, array('id' => $id));
if ($id && $group_id == 4) {//加狸车宝渠道门店
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr, 'edit' => 1]);
}
if ($id && $group_id1 == 4) {//加狸车宝渠道门店 group_id1
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr1, 'edit' => 1, 'group_id1'=>true]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
//删除单条数据
public function del()
{
}
//批量操作(默认修改状态)
public function batch()
{
$field = $this->input->post('field');
if ($field === 'ifcheck') {
$status = intval($this->input->post('value'));
$ids = $this->input->post('id');
$ids = explode(',', $ids);
if (!$ids || count($ids) < 1) {
$this->show_json(0, '请选择要操作的选项');
}
$where = array('id in(' . implode(',', $ids) . ')' => null);
} else {
$id = intval($this->input->post('id'));
$status = intval($this->input->post('value'));
if (!$id) {
$this->show_json(0, '参数错误');
}
$where['id'] = $id;
}
$data['status'] = $status;
$this->userM->update($data, $where);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//导出数据列表
public function export()
{
}
function json_lists()
{
$biz_id = $this->input->post('biz_id');
$status = $this->input->post('status');
$page = $this->input->post('page');
$size = $this->input->post('size');
$type = intval($this->input->post('type'));
$if_mobile = intval($this->input->post('if_mobile'));
$where = array();
if (strlen($status) > 0) {
$where['status'] = $status;
} else {
$whre['status > -1'] = null;
}
$biz_id && $where['biz_id'] = $biz_id;
$total = $this->userM->count($where);
$lists = $uids = array();
if ($total) {
$select = $if_mobile ? 'id,uname,mobile' : 'id,uname';
$rows = $this->userM->select($where, 'id desc', $page, $size, $select);
foreach ($rows as $v) {
$uids[$v['id']] = $v['id'];
$title = $if_mobile ? $v['uname'] . "({$v['mobile']})" : $v['uname'];
$lists[] = array(
'id' => $v['id'],
'title' => $title,
);
}
}
if ($type == 1) {//查找渠道经理
$where2 = ['status' => 1, 'group_id' => 4];
$where2["id in(select uid from lc_app_licheb_channel_biz where biz_id = {$biz_id})"] = null;
$total2 = $this->userM->count($where2);
if ($total2) {
$rows2 = $this->userM->select($where2, 'id desc', $page, $size, 'id,uname,mobile');
foreach ($rows2 as $v) {
if (!$uids[$v['id']]) {
$title = $if_mobile ? $v['uname'] . "({$v['mobile']}渠道)" : $v['uname'] . '(渠道)';
$lists[] = array(
'id' => $v['id'],
'title' => $title,
);
}
}
}
}
$this->data = array('total' => $total, 'list' => $lists, 'list2' => $rows2);
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:加狸车宝渠道门店
* Created on: 2021/11/12 14:54
* Created by: dengbw
* @param array $json
*/
function channel_biz($json = [])
{
$biz_ids = $json['biz_id_arr'] ? implode(',', $json['biz_id_arr']) : 0;
$group_id1 = $json['group_id1'] ? true : false;
if ($json['edit'] == 1) {//编辑删除未添加的
$where_d['uid'] = $json['uid'];
$biz_ids && $where_d["biz_id not in({$biz_ids})"] = null;
!$group_id1 && $this->mdChannelBiz->delete($where_d);
$group_id1 && $this->mdChannelBiz1->delete($where_d);
}
if (!$biz_ids) {
return;
}
$res_b = $this->biz_model->select(["id in({$biz_ids})" => null], '', 0, 0, 'id as biz_id');
foreach ($res_b as $key => $value) {
$where = ["uid" => $json['uid'], 'biz_id' => $value['biz_id']];
!$group_id1 && $re_cb = $this->mdChannelBiz->get($where);
$group_id1 && $re_cb = $this->mdChannelBiz1->get($where);
if (!$re_cb) {
$where['c_time'] = time();
!$group_id1 && $this->mdChannelBiz->add($where);
$group_id1 && $this->mdChannelBiz1->add($where);
}
}
}
/**
* Notes:获取门店渠道经理
* Created on: 2021/11/15 11:31
* Created by: dengbw
* @return bool
*/
function get_channel_uid()
{
$biz_id = $this->input->get('biz_id');
if (!$biz_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$res_b = $this->mdChannelBiz->select(["biz_id" => $biz_id], '', 0, 0, 'uid');
$this->data = $res_b ? array_column($res_b, 'uid') : [];
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:保存渠道管理员
* Created on: 2021/11/15 15:54
* Created by: dengbw
* @return bool
*/
function edit_channel_uid()
{
$biz_id = $this->input->post('biz_id');
$channel_uid = $this->input->post('channel_uid');
if (!$biz_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$re_biz = $this->biz_model->get(['id' => $biz_id]);
if (!$re_biz) {
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
}
$where_del['biz_id'] = $biz_id;
if ($channel_uid) {
$channel_uid_str = implode(',', $channel_uid);
$where_del["uid not in({$channel_uid_str})"] = null;
}
$res_b = $this->mdChannelBiz->select($where_del, '', 0, 0, 'uid'); //临时
$this->mdChannelBiz->delete($where_del);
//临时
foreach ($res_b as $key => $value) {
$res_b2 = $this->mdChannelBiz->select(['uid' => $value['uid']], '', 0, 0, 'biz_id');
$biz_id_up = $res_b2 ? array_unique(array_column($res_b2, 'biz_id')) : 0;
$biz_id_up && $biz_id_up = implode(',', $biz_id_up);
$this->userM->update(['biz_id' => $biz_id_up], ['id' => $value['uid']]);
}
//临时
if ($channel_uid) {
foreach ($channel_uid as $key => $value) {
$uid = $value;
$where = ["uid" => $uid, 'biz_id' => $biz_id];
$re_cb = $this->mdChannelBiz->get($where);
if (!$re_cb) {
$where['c_time'] = time();
$this->mdChannelBiz->add($where);
//临时
$res_b2 = $this->mdChannelBiz->select(['uid' => $uid], '', 0, 0, 'biz_id');
$biz_id_up = $res_b2 ? array_unique(array_column($res_b2, 'biz_id')) : 0;
$biz_id_up && $biz_id_up = implode(',', $biz_id_up);
$this->userM->update(['biz_id' => $biz_id_up], ['id' => $uid]);
//临时
}
}
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
/**
* Notes:获取门店管理员
* Created on: 2021/11/15 17:33
* Created by: dengbw
* @return bool
*/
function get_users_group()
{
$group_id = $this->input->get('group_id');
$biz_id = $this->input->get('biz_id');
$admin_name = $this->input->get('admin_name');
if (!$group_id || !$biz_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$where = ["group_id" => $group_id, 'status >' => -1];
$admin_name && $where['uname like "%' . $admin_name . '%"'] = null;
$res_u = $this->userM->select($where, '', 0, 0, 'id,uname as name');
$res_u2 = $this->userM->select(array_merge($where, ['biz_id' => $biz_id]), '', 0, 0, 'id');
$this->data['admins'] = $res_u ? $res_u : [];
$this->data['admin_id'] = $res_u2 ? array_column($res_u2, 'id') : [];
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:保存门店管理员
* Created on: 2021/11/15 17:33
* Created by: dengbw
* @return bool
*/
function edit_users_group()
{
$biz_manage = $this->input->post('biz_manage');
if (!$biz_manage['biz_id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
if (!$biz_manage['admin_name']) {
$where_del = ['biz_id' => $biz_manage['biz_id'], 'group_id' => $biz_manage['group_id']];
if ($biz_manage['admin_id']) {
$admin_id_str = implode(',', $biz_manage['admin_id']);
$where_del["id not in({$admin_id_str})"] = null;
}
$this->userM->update(["biz_id" => 0], $where_del);
}
foreach ($biz_manage['admin_id'] as $key => $value) {
$this->userM->update(["biz_id" => $biz_manage['biz_id']], ['id' => $value]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
}
+161
View File
@@ -0,0 +1,161 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Brand extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_cars_model');
}
public function index()
{
$this->lists();
}
public function lists()
{
$params = $this->input->get();
$page = $this->input->get('page');
!$page && $page = 1;
$size = 20;
$where["status > -1"] = null;
$params['title'] && $where["name like '%{$params['title']}%'"] = null;
if (!strlen($params['status'])) {
$params['status'] = $where['status'] = 1;
} else {
if ($params['status'] != 'all') {
$where['status'] = $params['status'];
}
}
$count = $this->auto_brand_model->count($where);
$rows = $this->auto_brand_model->select($where, 'status desc, id desc', $page, $size);
$status_arr = $this->auto_brand_model->get_status();
$list = [];
if ($rows) {
foreach ($rows as $key => $val) {
$list[] = [
'id' => $val['id'],
'name' => $val['name'],
'status' => $val['status'],
'status_name' => $status_arr[$val['status']],
'c_time' => date('Y-m-d H:i:s', $val['c_time'])
];
}
}
$status_arr_list = $status_arr;
unset($status_arr_list[-1]);
$this->data['status_arr'] = $status_arr_list;
$this->data['lists'] = $list;
$this->data['params'] = $params;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['_title'] = '品牌列表';
$this->show_view('auto/brand/lists', true);
}
public function get()
{
$id = $this->input->get('id');
$info = [];
if ($id) {
$info = $this->auto_brand_model->get(array('id' => $id));
if (!$info || empty($info)) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
}
$this->data['info'] = $info;
$this->data['_title'] = $id ? '编辑品牌' : '新增品牌';
return $this->show_view('auto/brand/edit');
}
public function add()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$id = $this->input->post('id');
$name = $this->input->post('name');
$img = $this->input->post('img');
if (!$name || empty($name)) {
return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空');
}
$old = $this->auto_brand_model->get(['name' => $name, 'status>' => -1]);
if ($old) {
return $this->show_json(SYS_CODE_FAIL, '品牌已经存在');
}
$add_data = array(
'name' => $name,
'logo' => $img,
'c_time' => time()
);
$brand_id = $this->auto_brand_model->add($add_data);
if (!$brand_id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
public function edit()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$id = $this->input->post('id');
$name = $this->input->post('name');
$img = $this->input->post('img');
$row = $this->auto_brand_model->get(['id' => $id]);
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
if (!$name) {
return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空');
}
//防止品牌名称重复
$where = array('name' => $name, "status<>-1" => null);
$id && $where['id <>'] = $id;
$old = $this->auto_brand_model->get($where);
if ($old) {
return $this->show_json(SYS_CODE_FAIL, '品牌已经存在');
}
$up_data = array(
'name' => $name,
);
$img && $up_data['logo'] = $img;
$this->auto_brand_model->update($up_data, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del()
{
$id = $this->input->post('id');
if (!$id) {
$this->show_json(SYS_CODE_FAIL, '参数错误');
}
$stauts = $this->input->post('status');
$where = array('id' => $id);
$this->auto_brand_model->update(array('status' => $stauts), $where);
if ($stauts == -1) {
# 车型库
$this->auto_cars_model->update(array('status' => $stauts), array('brand_id' => $id));
# 车系
$this->auto_series_model->update(array('status' => $stauts), array('brand_id' => $id));
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function batch()
{
}
public function export()
{
}
}
+154
View File
@@ -0,0 +1,154 @@
<?php
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2021/8/6
* Time: 11:15
*/
class Cars extends HD_Controller
{
protected $log_dir;
public function __construct()
{
parent::__construct();
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_cars_model');
$this->log_dir = "auto_" . get_class($this);
}
public function index()
{
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$where = array();
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
$where['series_id in (select id from lc_auto_series where status > -1)'] = null;
if ($params['brand_id']) {
$where['brand_id'] = $params['brand_id'];
} else {
$params['brand_id'] = '';
}
if ($params['s_id']) {
$where['series_id'] = $params['s_id'];
} else {
$params['s_id'] = '';
}
if (strlen($params['status']) > 0) {
$where['status'] = $params['status'];
} else {
$params['status'] = '';
}
$page = $params['page'];
$page = !$page ? 1 : $page;
$size = $params['size'];
$size = !$size ? 20 : $size;
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map_brand($where_brand);
//状态
$statusAry = array('0' => '关闭', '1' => '开启');
$total = $this->auto_cars_model->count($where);
$lists = array();
if ($total) {
$rows = $this->auto_cars_model->select($where, 'id desc', $page, $size, "*");
if ($rows) {
$s_ids = array_unique(array_column($rows, 'series_id'));
//获取车系列表
$map_series = array();
if ($s_ids) {
$str_ids = implode(',', $s_ids);
$where_sery = array("id in ({$str_ids})" => null);
$map_series = $this->auto_series_model->map('id', 'name', $where_sery, 'id desc', 0, 0, 'id,name');
}
foreach ($rows as $v) {
$lists[] = array(
'id' => $v['id'],
'brand' => $map_brand[$v['brand_id']],
'series' => $map_series[$v['series_id']],
'name' => $v['name'],
'third_car_id' => $v['third_car_id'],
'status' => $v['status'],
);
}
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['statusAry'] = $statusAry;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
$this->data['_title'] = '车型库管理';
$this->show_view('auto/cars/lists', true);
}
public function get()
{
}
public function add()
{
}
public function edit()
{
}
function edit_status()
{
$id = $this->input->post('id');
$field = $this->input->post('field');
$value = $this->input->post('value');
$status = $this->input->post('status');
if ('status' == $field) {
$status = $value;
}
$upd = array('status' => $status);
if (is_numeric($id)) {
$where = array('id' => $id);
} else {
$where = array("id in ({$id})" => null);
}
$ret = $this->auto_cars_model->update($upd, $where);
if (!$ret) {
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del()
{
// TODO: Implement del() method.
}
public function batch()
{
// TODO: Implement batch() method.
}
public function export()
{
// TODO: Implement export() method.
}
}
+220
View File
@@ -0,0 +1,220 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2020/08/05
* Time: 10:19
*/
defined('BASEPATH') or exit('No direct script access allowed');
class Series extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
}
public function index()
{
$this->lists();
}
public function lists()
{
$params = $this->input->get();
$page = $this->input->get('page');
!$page && $page = 1;
$size = 20;
$where["status > -1"] = null;
$params['title'] && $where["name like '%{$params['title']}%'"] = null;
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
if ($params['brand_id']) {
$where['brand_id'] = $params['brand_id'];
} else {
$params['brand_id'] = '';
}
if (!strlen($params['status'])) {
$params['status'] = $where['status'] = 1;
} else {
if ($params['status'] != 'all') {
$where['status'] = $params['status'];
}
}
$count = $this->auto_series_model->count($where);
$rows = $this->auto_series_model->select($where, 'id desc', $page, $size);
$status_arr = $this->auto_series_model->get_status();
$list = [];
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map_brand($where_brand);
if ($rows) {
foreach ($rows as $key => $val) {
$brand_name = $map_brand[$val['brand_id']] ? $map_brand[$val['brand_id']] : '';
$list[] = [
'id' => $val['id'],
'brand_name' => $brand_name,
'name' => $val['name'],
'status' => $val['status'],
'status_name' => $status_arr[$val['status']],
'c_time' => date('Y-m-d H:i:s', $val['c_time'])
];
}
}
$status_arr_list = $status_arr;
unset($status_arr_list[-1]);
$this->data['status_arr'] = $status_arr_list;
$this->data['lists'] = $list;
$this->data['params'] = $params;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['_title'] = '车系列表';
$this->show_view('auto/series/lists', true);
}
/**
* 获取数据列表
* @return bool
*/
public function json_lists()
{
$brand_id = $this->input->get_post('brand_id');
$status = $this->input->get_post('status');
$page = $this->input->get_post('page');
$size = $this->input->get_post('size');
$where = array('status > -1' => null);
$brand_id && $where['brand_id'] = $brand_id;
if (strlen($status) > 0) {
if (strpos($status, '>') !== false || strpos($status, '<') !== false || strpos($status, 'in') !== false) {
$where["status {$status}"] = null;
} else {
$where['status'] = $status;
}
} else {
$where['status > -1'] = null;
}
$orderby = 'id desc';
$total = $this->auto_series_model->count($where);
$lists = array();
if ($total) {
$select = 'id, name';
$rows = $this->auto_series_model->select($where, $orderby, $page, $size, $select);
foreach ($rows as $v) {
$lists[] = array(
'id' => $v['id'],
'name' => $v['name'],
);
}
}
$this->data = array('total' => $total, 'list' => $lists);
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
public function get()
{
$id = $this->input->get('id');
$info = [];
if ($id) {
$info = $this->auto_series_model->get(array('id' => $id));
if (!$info || empty($info)) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
}
#$brands = $this->auto_brand_model->select([],'','','','id,name');
$brands = $this->auto_brand_model->map_brand_list($this->auto_brand_model->map_brand(array('status > -1' => null), false));
$this->data['brands'] = $brands;
$this->data['info'] = $info;
$this->data['_title'] = $id ? '编辑车系' : '新增车系';
return $this->show_view('auto/series/edit');
}
public function add()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$id = $this->input->post('id');
$name = $this->input->post('name');
$brand_id = $this->input->post('brand_id');
if (!$name || empty($name)) {
return $this->show_json(SYS_CODE_FAIL, '车系名称不能为空');
}
$old = $this->auto_series_model->get(['name' => $name, 'brand_id' => $brand_id, 'status>' => -1]);
if ($old) {
return $this->show_json(SYS_CODE_FAIL, '车系已经存在');
}
$add_data = array(
'name' => $name,
'brand_id' => $brand_id,
'c_time' => time()
);
$brand_id = $this->auto_series_model->add($add_data);
if (!$brand_id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
public function edit()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$id = $this->input->post('id');
$name = $this->input->post('name');
$brand_id = $this->input->post('brand_id');
$row = $this->auto_series_model->get(['id' => $id]);
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
if (!$name) {
return $this->show_json(SYS_CODE_FAIL, '车系名称不能为空');
}
//防止车系名称重复
$where = array('name' => $name, "status<>-1" => null);
$id && $where['id <>'] = $id;
$old = $this->auto_series_model->get($where);
if ($old) {
return $this->show_json(SYS_CODE_FAIL, '车系已经存在');
}
$up_data = array(
'brand_id' => $brand_id,
'name' => $name,
);
$this->auto_series_model->update($up_data, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del()
{
$id = $this->input->post('id');
if (!$id) {
$this->show_json(SYS_CODE_FAIL, '参数错误');
}
$stauts = $this->input->post('status');
$where = array('id' => $id);
$this->auto_series_model->update(array('status' => $stauts), $where);
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function batch()
{
}
public function export()
{
}
}
+329
View File
@@ -0,0 +1,329 @@
<?php
/**
* Created by PhpStorm.
* User: hrc
* Date: 2018/11/21
* Time: 14:33
*/
defined('BASEPATH') or exit('No direct script access allowed');
require_once COMMPATH . 'third_party/pinyin/PinYin.php';
class Store extends HD_Controller
{
private $roles = array('普通', '超级管理');
public function __construct()
{
parent::__construct();
$this->load->helper('image_helper');
$this->load->model("biz/biz_model");
$this->load->model('area_model');
}
public function index()
{
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$page = $this->input->get('page');
$status = $this->input->get('status');
$this->data['province_id'] = $province_id = 350;//默认福建城市
$this->data['city_id'] = $city_id = intval($this->input->get('_city_id', true));
$this->data['county_id'] = $county_id = intval($this->input->get('county_id', true));
$this->data['bizname'] = $bizname = $this->input->get('bizname');
$this->data['brand_id'] = $brand_id = intval($this->input->get('brand_id'));
$this->data['company_id'] = $company_id = intval($this->input->get('company_id'));
$status_arr = array('del' => -1, 'off' => 0, 'on' => 1);
$area_where = [];
if ($this->city_lists) {
$area_where["province_id in (" . implode(",", $this->city_lists) . ")"] = null;
}
$this->data['provinces'] = $this->area_model->select($area_where, '', 0, 0, 'distinct(province_id), province_name');
if ($province_id) {
//获取系统配置的城市
$map_city = $this->city_ary();
$rows_city = array();
foreach ($map_city as $k => $v) {
$rows_city[] = array(
'city_id' => $k,
'city_name' => $v
);
}
$this->data['citys'] = $rows_city;
}
if ($city_id) {
$this->data['countys'] = $this->area_model->select(array('city_id' => $city_id));
}
if (isset($status)) {
$this->data['status'] = $status;
if (strlen($status_arr[$status])) {
$where['status'] = $status_arr[$status];
} else {
$where['status > -1'] = null;
}
} else {
$this->data['status'] = 'on';
$where['status'] = 1;
}
$company_id && $where['company_id'] = $company_id;
!$page && $page = 1;
$pagesize = 20;
$bizname && $where['biz_name like "%' . $bizname . '%"'] = null;
$brand_id && $where['brand_id'] = $brand_id;
$province_id && $where['province_id'] = $province_id;
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
!$params['qdjl_id'] && $params['qdjl_id'] = '';
!$params['type'] && $params['type'] = '';
if ($params['type']) {
$where['type'] = $params['type'];
}
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
$c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
$typeAry = $this->biz_model->type_ary();
$type_ids = implode(',', array_keys($typeAry));
$type_ids && $where["type in ($type_ids)"] = null;
$biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize);
$count = $this->biz_model->count($where);
$bizlists = [];
foreach ($biz_lists as $v) {
$v['c_time'] = date('Y-m-d H:i:s', $v['c_time']);
$v['type_name'] = $typeAry[$v['type']];
$v['type'] = $v['type'];
$bizlists[] = $v;
}
$this->data['params'] = $params;
$this->data['typeAry'] = $typeAry;
$this->data['lists'] = $bizlists;
$this->data['_title'] = '门店列表';
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
$this->show_view('biz/store/lists', true);
}
public function get()
{
$id = intval($this->input->get('id'));
$area_where = [];
if ($this->city_lists) {
$area_where["province_id in (" . implode(",", $this->city_lists) . ")"] = null;
}
$this->data['provinces'] = $this->area_model->select($area_where, '', 0, 0, 'distinct(province_id), province_name');
if ($id) {
$biz = $this->biz_model->get(array('id' => $id, 'status>-1' => null));
if (!$biz || empty($biz)) {
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
}
$this->data['citys'] = $this->area_model->select(array('province_id' => $biz['province_id']), '', 0, 0, 'distinct(city_id), city_name');
$this->data['countys'] = $this->area_model->select(array('city_id' => $biz['city_id']));
$this->load->model("sys/sys_area_model");
$biz['county_id'] && $areas = $this->sys_area_model->select(array('county_id' => $biz['county_id']));
$this->data['areas'] = $areas;
$biz['avatar'] = build_qiniu_image_url($biz['headimg'], 200, 200);
$this->data['biz'] = $biz;
} else {
$map_city = $this->city_ary();
$rows_city = array();
foreach ($map_city as $k => $v) {
$rows_city[] = array(
'city_id' => $k,
'city_name' => $v
);
}
$this->data['citys'] = $rows_city;
$biz = array(
'province_id' => '350',
'type' => 0,
'company_id' => 0,
'auto_brands' => array(),
'car_brand_id' => 0
);//默认福建城市
$this->data['biz'] = $biz;
}
$this->data['_title'] = $id ? '编辑门店-' . $biz['biz_name'] : '新增门店';
$this->show_view('biz/store/edit', true);
}
public function add()
{
$biz['status'] = 1;
$biz['biz_name'] = $this->input->post('biz_name', true);
if (!$biz['biz_name']) {
return $this->show_json(SYS_CODE_FAIL, '门店不能为空');
}
//中文转拼音
$pinyin = new PinYin();
$py = $pinyin::encode($biz['biz_name']);
$biz['firstchar'] = strtoupper($py);
$biz['brand_id'] = intval($this->input->post('brand_id', true));
$biz['province_id'] = $this->input->post('province_id', true);
$biz['city_id'] = intval($this->input->post('city_id', true));
$biz['county_id'] = intval($this->input->post('county_id', true));
$biz['area_id'] = intval($this->input->post('area_id', true));
$biz['address'] = $this->input->post('address', true);
$biz['lat'] = $this->input->post('lat', true);
$biz['lng'] = $this->input->post('lng', true);
$biz['type'] = intval($this->input->post('type', true));
//上传头像
$biz['headimg'] = $this->input->post('headimg');
$biz['c_time'] = time();
$id = $this->biz_model->add($biz);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function edit()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$id = intval($this->input->post('id'));
$company_id = intval($this->input->post('company_id', true));
$srv_company_id = intval($this->input->post('srv_company_id', true));
$biz['biz_name'] = $this->input->post('biz_name', true);
if (!$biz['biz_name']) {
return $this->show_json(SYS_CODE_FAIL, '门店不能为空');
}
//中文转拼音
$pinyin = new PinYin();
$py = $pinyin::encode($biz['biz_name']);
$biz['firstchar'] = strtoupper($py);
$biz['brand_id'] = intval($this->input->post('brand_id', true));
$biz['province_id'] = $this->input->post('province_id', true);
$biz['city_id'] = intval($this->input->post('city_id', true));
$biz['county_id'] = intval($this->input->post('county_id', true));
$biz['area_id'] = intval($this->input->post('area_id', true));
$biz['address'] = $this->input->post('address', true);
$biz['lat'] = $this->input->post('lat', true);
$biz['lng'] = $this->input->post('lng', true);
$biz['type'] = intval($this->input->post('type', true));
//上传头像
$biz['headimg'] = $this->input->post('headimg');
$res = $this->biz_model->update($biz, array('id' => $id));
if (!$res) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function del()
{
$id = $this->input->post('id');
if (!$id) {
$this->show_json(SYS_CODE_FAIL, '删除出错');
}
$stauts = $this->input->post('status');
$where = array('id' => $id);
$this->biz_model->update(array('status' => $stauts), $where);
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function batch()
{
$field = $this->input->post('field');
if ($field === 'ifcheck') {
$status = intval($this->input->post('value'));
$ids = $this->input->post('id');
$ids = explode(',', $ids);
if (!$ids || count($ids) < 1) {
$this->show_json(0, '请选择要操作的选项');
}
$ids_str = implode(',', $ids);
$where = ["id in({$ids_str})" => null];
} else {
$id = intval($this->input->post('id'));
$status = intval($this->input->post('value'));
if (!$id) {
$this->show_json(0, '参数错误');
}
$where['id'] = $id;
}
$data['status'] = $status;
$this->biz_model->update($data, $where);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function export()
{
}
/**
* 获取门店可选列表
* @return bool
*/
function json_lists()
{
$province_id = $this->input->get('province_id');
$city_id = $this->input->get('city_id');
$county_id = $this->input->get('county_id');
$status = $this->input->get('status');
$page = $this->input->get('page');
$size = $this->input->get('size');
$title = $this->input->get('title');
$type = $this->input->get('type');
$where = array();
$typeAry = $this->biz_model->type_ary();
$type_ids = implode(',', array_keys($typeAry));
$type_ids && $where["type in ($type_ids)"] = null;
if (strlen($status) > 0) {
$where['status'] = $status;
} else {
$where['status > -1'] = null;
}
if ($type) {
$where["type in({$type})"] = null;
}
$province_id && $where['province_id'] = $province_id;
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
$title && $where["biz_name like '%{$title}%'"] = null;
$total = $this->biz_model->count($where);
$lists = array();
if ($total) {
$orderby = 'id desc';
$select = 'id, biz_name';
$rows = $this->biz_model->select($where, $orderby, $page, $size, $select);
foreach ($rows as $v) {
$lists[] = array(
'id' => $v['id'],
'title' => $v['biz_name'],
);
}
}
$this->data = array('total' => $total, 'list' => $lists);
return $this->show_json(SYS_CODE_SUCCESS);
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+870
View File
@@ -0,0 +1,870 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Clues extends HD_Controller
{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名');
private $cacheKeyPhone = 'xz_admin_phone';
protected $log_dir;
private $maintainAry = ['0-0' => '待处理', '1-10' => '已加微信', '3-7' => '明确拒绝', '2-4' => '未接通', '2-5' => '未完整触碰'];//保养客户专用
public function __construct()
{
parent::__construct();
$this->load->model('receiver/receiver_clues_model', 'clues_model');
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
// $this->load->model('receiver/receiver_xz_model', 'mdReceiverXz');
// $this->load->model('app/licheb/app_licheb_users_model');
$this->load->model("biz/biz_model");
// $this->load->model('auto/auto_brand_model', 'mdAutoBrand');
// $this->load->model('auto/auto_series_model', 'mdAutoSeries');
// $this->load->model('auto/auto_attr_model', 'mdAutoAttr');
$this->load->model('area_model');
$this->log_dir = 'receiver_clues';
}
//首页信息
public function index()
{
$this->lists();
}
public function lists($where = array())
{
$statusAry = $this->clues_model->statusAry();
$params = $this->input->get();
$this->data['city_id'] = $city_id = intval($params['city_id']);
$this->data['county_id'] = $county_id = intval($params['county_id']);
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
if ($params['title']) {
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
//最后报名时间
if ($params['en_time']) {
$en_time = explode(' ~ ', $params['en_time']);
if ($en_time[0]) {
$where["en_time >="] = $en_time[0] . ' 00:00:00';
}
if ($en_time[1]) {
$where["en_time <="] = $en_time[1] . ' 23:59:59';
}
}
strlen($params['status']) && $where["status"] = $params['status'];
strlen($params['status2']) && $where["status2"] = $params['status2'];
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
if ($params['cfrom_id'] || $params['cfrom_id2']) {
if ($params['cfrom_id2']) {
$where['cf_id'] = $params['cfrom_id2'];
} else {
$cf_rows = $this->clues_cfrom_model->select(['pid' => $params['cfrom_id']], '', '', '', 'id');
$cf_ids = array_column($cf_rows, 'id');
$cf_ids[] = $params['cfrom_id'];
$cf_str_ids = implode(',', array_filter($cf_ids));
$cf_str_ids && $where["cf_id in ({$cf_str_ids})"] = null;
}
}
$count = $this->clues_model->count($where);
$lists = [];
if ($count) {
$fileds = 'id,name,mobile,cf_id,c_time,admin_id,status,status2,en_time,county_id';
$rows = $this->clues_model->select($where, 'en_time desc,id desc', $page, $size, $fileds);
$map_admin = $map_cf_pid = $cf_title_arr = [];
//获取来源
$cf_id_arr = array_unique(array_column($rows, 'cf_id'));
if ($cf_id_arr) {
$cf_id_str = implode(',', $cf_id_arr);
$res_cfrom = $this->clues_cfrom_model->select(["id in({$cf_id_str})" => null], 'id desc', 0, 0, 'id,title,pid');
$cf_pid_arr = array_unique(array_column($res_cfrom, 'pid'));
if ($cf_pid_arr) {
$cf_pid_str = implode(',', $cf_pid_arr);
$map_cf_pid = $this->clues_cfrom_model->map('id', 'title', ["id in({$cf_pid_str})" => null]);
}
foreach ($res_cfrom as $key => $val) {
$title = $val['title'];
if ($val['pid']) {//一级分类
$map_cf_pid[$val['pid']] && $title = $map_cf_pid[$val['pid']] . '-' . $title;
}
$cf_title_arr[$val['id']] = $title;
}
}
//获取管理员
$this->load->model('sys/sys_admin_model', 'admin_model');
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
if ($admin_id_arr) {
$str_ids = implode(',', $admin_id_arr);
$map_admin = $this->admin_model->map('id', 'username', ["id in ({$str_ids})" => null]);
}
$county_id_arr = array_unique(array_column($rows, 'county_id'));
if ($county_id_arr) {
$str_ids = implode(',', $county_id_arr);
$map_area = $this->area_model->map('county_id', '', ["county_id in ({$str_ids})" => null], '', 0, $size, 'county_id,province_name,city_name,county_name');
}
foreach ($rows as $key => $val) {
$val['cf_title'] = $cf_title_arr[$val['cf_id']] ? $cf_title_arr[$val['cf_id']] : '';
$status_name = $statusAry[$val['status']]['name'];
$val['status2'] && $status_name .= '' . $statusAry[$val['status']]['list'][$val['status2']];
$val['status_name'] = $status_name;
$val['admin_name'] = $map_admin[$val['admin_id']] ? $map_admin[$val['admin_id']] : '';
if (SUPER_ADMIN == $this->role) {
$val['mobile_sub'] = $val['mobile'];
} else {
$val['mobile_sub'] = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : '';
}
$area = $map_area[$val['county_id']][0];
if ($area) {
$val['poi'] = "{$area['province_name']}-{$area['city_name']}-{$area['county_name']}";
}
$lists[] = $val;
}
}
$statusList = array();
foreach ($this->clues_model->statusAry() as $key => $value) {
$cate = array();
$where = array("status" => $key);
$count1 = $this->clues_model->count($where);
if ($value['list']) {
foreach ($value['list'] as $key2 => $value2) {
$where['status2'] = $key2;
$count2 = $this->clues_model->count($where);
$cate[] = array("id" => $key2, "name" => $value2, "count" => $count2);
}
}
$statusList[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1);
}
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['params'] = $params;
$this->data['statusList'] = $statusList;
$this->data['maintainAry'] = $this->maintainAry;
$this->data['_title'] = '线索池列表';
return $this->show_view('receiver/clues/lists', true);
}
public function get()
{
$params = $this->input->get();
$id = intval($params['id']);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$statusList = $status2List = $logsList = [];
$re = $this->clues_model->get(array('id' => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
$dataInfo = $re;
foreach ($this->clues_model->statusAry() as $key => $value) {
$statusList[] = array("id" => $key, "name" => $value['name']);
}
if (strlen($re['status'])) {
foreach ($this->clues_model->statusAry($re['status'])['list'] as $key => $value) {
$status2List[] = array("id" => $key, "name" => $value);
}
}
$dataInfo['editType'] = 0;
$re_cf = $this->clues_cfrom_model->get(array('id' => $re['cf_id']));
$re_cf_title_p = '';
if ($re_cf && $re_cf['pid']) {
$re_cf_pid = $this->clues_cfrom_model->get(array('id' => $re_cf['pid']));
$re_cf_title_p = $re_cf_pid['title'] ? $re_cf_pid['title'] . '-' : '';
}
$info_show['cfrom_title'] = $re_cf['title'] ? $re_cf_title_p . $re_cf['title'] : '';
$info_show['statusList'] = $statusList;
$info_show['status2List'] = $status2List;
$info_show['c_time'] = date('Y-m-d H:i', $re['c_time']);
$info_show['en_time'] = $re['en_time'];
if (SUPER_ADMIN == $this->role) {
$info_show['mobile_sub'] = $re['mobile'];
} else {
$info_show['mobile_sub'] = $re['mobile'] ? substr_replace($re['mobile'], '*****', 0, 5) : '';
}
$resLogs = $this->mdOplogs->select(array('clue_id' => $id), 'c_time desc', 0, 0);
foreach ($resLogs as $key => $value) {
$setValue = array();
$setValue['uname'] = $value['uname'];
$setValue['log'] = $value['log'];
$setValue['type_name'] = $this->mdOplogs->typeAry()[$value['type']];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
$rec_url = $rec_text = '';
if ($value['type'] == 2) {//拨打电话
$rec_text = '未接通';
$row = $this->mdReceiverXz->get(array('id' => $value['log']));
if ($row['duration']) {
$rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0, 0, 'video') : '';
$rec_text = '录音文件未生成';
} else {
$jsondata = json_decode($row['json_data'], true);
if ($row['c_time'] > strtotime('2023-03-21 13:00:00')) {
$rec_text = $this->mdReceiverXz->get_xz_status($jsondata['status']);
$answer_text = $this->mdReceiverXz->get_xz_noAnswerReason($jsondata['noAnswerReason']);
$answer_text && $rec_text .= "($answer_text)";
}
}
}
$setValue['rec_url'] = $rec_url;
$setValue['rec_text'] = $rec_text;
$logsList[] = $setValue;
}
$info_show['logsList'] = $logsList;
//意向信息
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
//获取城市区域
$dataInfo['city_id'] = $re['city_id'];
$dataInfo['county_id'] = $re['county_id'];
$dataInfo['v_id'] = intval($jsondata['car']['version']['id']);
$dataInfo['cor_id'] = intval($jsondata['car']['color']['id']);
//获取已分配店铺
$cus = $this->customers_model->select(['rid' => $re['id']], '', '', '', 'biz_id');
$biz_arr = [];
if ($cus) {
$biz_ids = implode(array_column($cus, 'biz_id'), ',');
if ($biz_ids) {
$where_biz["id in ($biz_ids)"] = null;
$cus_biz = $this->biz_model->select($where_biz, '', '', '', 'biz_name');
$biz_arr = array_column($cus_biz, 'biz_name');
}
}
$area_where = [];
if ($this->city_lists) {
$area_where["province_id in (" . implode(",", $this->city_lists) . ")"] = null;
}
$this->data['provinces'] = $this->area_model->select($area_where, '', 0, 0, 'distinct(province_id), province_name');
$info_show['cus_bizs'] = implode($biz_arr, ',');
$this->data['info'] = $dataInfo;
$this->data['info_show'] = $info_show;
$this->data['_title'] = '线索详情';
return $this->show_view('receiver/clues/edit', true);
}
/**
* Notes:二级分类
* Created on: 2021/9/15 14:16
* Created by: dengbw
* @return bool
*/
public function get_status2()
{
$params = $this->input->post();
$status = $params['status'];
$status2List = array();
if (strlen($status)) {
foreach ($this->clues_model->statusAry($status)['list'] as $key => $value) {
$status2List[] = array("id" => $key, "name" => $value);
}
}
$this->data = $status2List;
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* 新增
* @return bool
*/
function get_add()
{
$id = $this->input->get('id');
if ($id) {
$row = $this->clues_model->get(array('id' => $id));
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '记录不存在');
}
$cf_id1 = '';
$cf_id2 = '';
if ($row['cf_id']) {
$row_cfrom = $this->clues_cfrom_model->get(array('id' => $row['cf_id']));
if ($row_cfrom['pid']) {
$cf_id1 = $row_cfrom['pid'];
$cf_id2 = $row['cf_id'];
} else {
$cf_id1 = $row['cf_id'];
}
}
$this->data['citys'] = $this->area_model->select(array('province_id' => $row['province_id']), '', 0, 0, 'distinct(city_id), city_name');
$this->data['countys'] = $this->area_model->select(array('city_id' => $row['city_id']));
$info = array(
'name' => $row['name'],
'mobile' => $row['mobile'],
'cf_id1' => $cf_id1,
'cf_id2' => $cf_id2,
'province_id' => $row['province_id'],
'city_id' => $row['city_id'],
'county_id' => $row['county_id'],
'biz_id' => $row['biz_id'],
);
$title = "编辑线索";
$action = "edit";
} else {
$info = array(
'name' => '',
'mobile' => '',
'cf_id1' => '',
'cf_id2' => '',
'province_id' => 0,
'city_id' => 0,
'county_id' => 0,
'biz_id' => 0,
);
$title = "新增线索";
$action = "add";
}
$where = array('status' => 1, 'pid' => 0);
$select = 'id, title';
$map_cfrom = $this->clues_cfrom_model->map('id', 'title', $where, '', 0, 0, $select);
$area_where = [];
if ($this->city_lists) {
$area_where["province_id in (" . implode(",", $this->city_lists) . ")"] = null;
}
$this->data['provinces'] = $this->area_model->select($area_where, '', 0, 0, 'distinct(province_id), province_name');
$this->data['info'] = $info;
$this->data['cfromAry'] = $map_cfrom;
$this->data['action'] = $action;
$this->data['_title'] = $title;
return $this->show_view('receiver/clues/get');
}
//添加单条数据
public function add()
{
$info = $this->input->post('info');
if (!$info['name']) {
return $this->show_json(SYS_CODE_FAIL, '请填写姓名');
}
if (!mobile_valid($info['mobile'])) {
return $this->show_json(SYS_CODE_FAIL, '手机号码不准确');
}
if ($this->clues_model->get(['mobile' => $info['mobile']])) {
return $this->show_json(SYS_CODE_FAIL, '手机号已存在');
}
$cf_id = 0;
if ($info['cf_id2']) {
$cf_id = $info['cf_id2'];
} else if ($info['cf_id1']) {
$cf_id = $info['cf_id1'];
}
$add = array(
'name' => $info['name'],
'mobile' => $info['mobile'],
'cf_id' => $cf_id,
'admin_id' => $this->uid,
'c_time' => time(),
);
$info['province_id'] && $add['province_id'] = $info['province_id'];
$info['city_id'] && $add['city_id'] = $info['city_id'];
$info['county_id'] && $add['county_id'] = $info['county_id'];
$info['biz_id'] && $add['biz_id'] = $info['biz_id'];
$ret = $this->clues_model->add($add);
if (!$ret) {
debug_log("[error]# add fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
public function add_log()
{
$params = $this->input->post();
if (!$params['id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if (!$params['log']) {
return $this->show_json(SYS_CODE_FAIL, '请输入内容!');
}
$addData = array(
'clue_id' => $params['id'],
'uid' => $this->uid,
'uname' => $this->username,
'type' => intval($params['type']),
'log' => $params['log'],
'c_time' => time()
);
$id = $this->mdOplogs->add($addData);
if ($id) {
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
}
function add_excel()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
return $this->show_json(0, $res['message']);
}
$file = $res['path'];
if ($res['file_ext'] == '.xls') {
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
} elseif ($res['file_ext'] == '.xlsx') {
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
} else {
return $this->show_json(SYS_CODE_FAIL, '文件无法识别');
}
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
if ($rowCnt > 800) {
@unlink($file);
return $this->show_json(0, '数据大于800请拆分多个表格导入');
}
$data = array();
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
$data[] = array(
'name' => $objWorksheet->getCell('A' . $_row)->getValue(),
'mobile' => $objWorksheet->getCell('B' . $_row)->getValue(),
'cfrom' => $objWorksheet->getCell('C' . $_row)->getValue(),
);
}
$done = $this->add_batch($data);
@unlink($file);
$this->data['load_num'] = count($data);
$this->data['done'] = $done;
return $this->show_json(SYS_CODE_SUCCESS, "成功导入{$done}");
}
//编辑单条数据
public function edit()
{
$info = $this->input->post('info');
if (!$info) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$re = $this->clues_model->get(array('id' => $info['id']));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
$msg = '修改成功';
$code = SYS_CODE_SUCCESS;
if ($info['editType'] == 1) {
$statusAry = $this->clues_model->statusAry();
if ($info['status'] == $re['status'] && $info['status2'] == $re['status2']) {
return $this->show_json(SYS_CODE_FAIL, '状态未修改!');
}
$status_name = $statusAry[$re['status']]['name'];
$status_name_up = $statusAry[$info['status']]['name'];
if ($info['status2']) {
$status_name .= '-' . $statusAry[$re['status']]['list'][$re['status2']];
$status_name_up .= '-' . $statusAry[$info['status']]['list'][$info['status2']];
}
$log = '更新状态(' . $status_name . ')为(' . $status_name_up . ')';
$ret = $this->clues_model->update(array('status' => $info['status'], 'status2' => $info['status2']), array('id' => $info['id']));
if (!$ret) {
$code = SYS_CODE_FAIL;
$msg = '修改状态失败';
} else {
$msg = '修改状态成功';
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => $log));
}
} else if ($info['editType'] == 2) {
if ($info['name'] == $re['name']) {
return $this->show_json(SYS_CODE_FAIL, '客户姓名未修改!');
}
$log = '更新客户姓名(' . $re['name'] . ')为(' . $info['name'] . ')';
$ret = $this->clues_model->update(array('name' => $info['name']), array('id' => $info['id']));
if (!$ret) {
$code = SYS_CODE_FAIL;
$msg = '修改用户信息失败';
} else {
$msg = '修改用户信息成功';
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => $log));
}
} else if ($info['editType'] == 3) {
$up_data = [
'province_id' => $info['province_id'],
'city_id' => $info['city_id'],
'county_id' => $info['county_id'],
'biz_id' => $info['biz_id']
];
$ret = $this->clues_model->update($up_data, array('id' => $info['id']));
if (!$ret) {
$code = SYS_CODE_FAIL;
$msg = '修改意向信息失败';
} else {
$msg = '修改意向信息成功';
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => '修改意向信息'));
}
}
return $this->show_json($code, $msg);
}
/**
* Notes:增加日志
* Created on: 2021/7/23 10:48
* Created by: dengbw
* @param array $ary
* @return mixed
*/
private function addLog($ary = array())
{
$id = 0;
if ($ary['log']) {
$addData = array(
'clue_id' => $ary['clue_id'],
'uid' => $this->uid,
'uname' => $this->username,
'type' => intval($ary['type']),
'log' => $ary['log'],
'c_time' => time()
);
$id = $this->mdOplogs->add($addData);
}
return $id;
}
//删除单条数据
public function del()
{
}
//批量操作(默认修改状态)
public function batch()
{
$id = intval($this->input->post('id'));
$status = $this->input->post('value');
if (!$id || !$status) {
$this->show_json(0, '参数错误');
}
$status_ary = explode('-', $status);
$up_data['status'] = intval($status_ary[0]);
$up_data['status2'] = intval($status_ary[1]);
$this->clues_model->update($up_data, ['id' => $id]);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//导出数据列表
public function export()
{
}
//分配
public function get_adviser()
{
$ids = $this->input->get('ids');
if ($this->input->method() == 'post') {
$city_id = $this->input->post('city_id');
$county_id = $this->input->post('county_id');
$where = [
'status' => 1,
];
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
$typeAry = $this->biz_model->type_ary();
$type_ids = implode(',', array_keys($typeAry));
$type_ids && $where["type in ($type_ids)"] = null;
$bizList = $this->biz_model->select($where, '', '', '', 'id,biz_name');
$this->data['bizList'] = $bizList;
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
$this->data['ids'] = $ids;
return $this->show_view('receiver/clues/get_adviser');
}
public function edit_adviser()
{
$this->load->library('receiver/clues_entity');
$this->load->library('receiver/customers_entity');
$biz_id = $this->input->post('biz_id');
$ids = $this->input->post('ids');
$ids_arr = explode(',', $ids);
$biz = $this->biz_model->get(['id' => $biz_id]);
if (!$biz) {
return $this->show_json(SYS_CODE_FAIL, '请选择分配门店!');
}
if (!is_array($ids_arr)) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$where = [
"id in ($ids)" => null
];
$clues_rows = $this->clues_model->map('id', '', $where);
foreach ($ids_arr as $val) {
$clues_row = $clues_rows[$val][0];
//判断是否已分配
$cus_row = $this->customers_model->get(['rid' => $val, 'status>=' => 0]);
if ($clues_row && !$cus_row) {
$add_data = [
'rid' => $val,
'name' => $clues_row['name'],
'mobile' => $clues_row['mobile'],
'biz_id' => $biz_id,
'city_id' => $biz['city_id'],
'county_id' => $biz['county_id'],
'brand_id' => $clues_row['brand_id'],
'series_id' => $clues_row['series_id'],
'if_driver' => $clues_row['if_driver'],
'cf_title' => '平台分配',
'of_id' => 3,
'of2_id' => 37,
'cf_id' => $clues_row['cf_id'],
'p_time' => date('Y-m-d H:i:s'),
'c_time' => $clues_row['en_time'] == '0000-00-00 00:00:00' ? $clues_row['c_time'] : strtotime($clues_row['en_time'])
];
$customers_id = $this->customers_model->add($add_data);
if ($customers_id) {
$this->clues_model->update(['status' => 1], ['id' => $val]);
//同步线索日志到客户日志
// $this->customers_entity->syn_clues($customers_id, $val);
$this->customers_entity->add_log($customers_id, $this->uid, $this->username, "平台分配", 0, 'admin');
$this->clues_entity->add_log($val, $this->uid, $this->username, "分配给【{$biz['biz_name']}】商家");
}
}
}
return $this->show_json(SYS_CODE_SUCCESS, '分配成功!');
}
public function lists_call()
{
$this->load->model('sys/sys_admin_model', 'mdAdmin');
$cache = &load_cache('redis');
$xz_admin_phone = $cache->get($this->cacheKeyPhone);
$params = $this->input->get();
$username = $params['username'];
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = array();
$where['status'] = 1;
if (!empty($username)) $where["username like '%$username%'"] = null;
if (!empty($params['mobile'])) $where['mobile'] = $params['mobile'];
$count = $this->mdAdmin->count($where);
if ($count) {
$res = $this->mdAdmin->select($where, 'id desc', $params['page'], $params['size'], 'id,username,mobile');
foreach ($res as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['username'] = $value['username'];
$setValue['mobile'] = $value['mobile'];
$phone = $xz_admin_phone['admins'][$value['id']];
if ($phone) {
$phone_btn = '<a class="am-btn am-btn-danger am-btn-xs" data-action="/receiver/clues/edit_call" data-ajax="post"
data-params-type="1" data-params-id="' . $value['id'] . '" >取消分配</a>';
} else {
$phone = '未分配';
$phone_btn = '<a class="am-btn am-btn-primary am-btn-xs" data-action="/receiver/clues/edit_call" data-ajax="post"
data-params-type="0" data-params-id="' . $value['id'] . '" >分配号码</a>';
}
$setValue['phone'] = $phone;
$setValue['phone_btn'] = $phone_btn;
$lists[] = $setValue;
}
}
$this->data['params'] = $params;
$this->data['_title'] = '虚似号分配';
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
$this->data['lists'] = $lists;
return $this->show_view('receiver/clues/lists_call', true);
}
public function edit_call()
{
$id = intval($this->input->post('id'));
$type = $this->input->post('type');
if ($type != 3 && !$id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$cache = &load_cache('redis');
$xz_admin_phone = $cache->get($this->cacheKeyPhone);
$this->config->load('xcall', TRUE);
$mobiles = $this->config->item('mobile_list', 'xcall');
$mobiles && shuffle($mobiles);
if ($type == 0) {//分配手机
if (!$mobiles) {
return $this->show_json(SYS_CODE_FAIL, '无号码库!');
}
$number = '';
foreach ($mobiles as $key => $value) {
if (!$xz_admin_phone['numbers'][$value]) {
$number = $value;
break;
}
}
if ($number) {
$xz_admin_phone['admins'][$id] = $number;
$xz_admin_phone['numbers'][$number] = $id;
$cache->save($this->cacheKeyPhone, $xz_admin_phone);
return $this->show_json(SYS_CODE_SUCCESS, '分配号码成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '号码已全部分配完了');
}
} else if ($type == 1) {//取消分配
$number = $xz_admin_phone['admins'][$id];
unset($xz_admin_phone['admins'][$id]);
unset($xz_admin_phone['numbers'][$number]);
$cache->save($this->cacheKeyPhone, $xz_admin_phone);
return $this->show_json(SYS_CODE_SUCCESS, '取消分配成功');
} else if ($type == 3) {//全部重新分配
if (!$mobiles) {
return $this->show_json(SYS_CODE_FAIL, '无号码库!');
}
if (!$xz_admin_phone['admins']) {
return $this->show_json(SYS_CODE_FAIL, '未分配号码,不能重置');
}
$xz_admin_phone_new = array();
$i = 0;
foreach ($xz_admin_phone['admins'] as $key => $value) {
$number = $mobiles[$i];
$id = $key;
if ($number) {
$xz_admin_phone_new['admins'][$id] = $number;
$xz_admin_phone_new['numbers'][$number] = $id;
}
$i++;
}
$cache->save($this->cacheKeyPhone, $xz_admin_phone_new);
return $this->show_json(SYS_CODE_SUCCESS, '重置已分配成功');
}
}
/**
* 返回map select数据
* @return bool
*/
function json_map_cfrom()
{
$pid = $this->input->post('pid');
$status = $this->input->post('status');
$where = array();
if (strlen($pid) > 0) {
$where['pid'] = $pid;
}
if (strlen($status) > 0) {
$where['status'] = $status;
} else {
$where["status>-1"] = null;
}
$total = $this->clues_cfrom_model->count($where);
$map = array();
if ($total) {
$orderby = 'id desc';
$select = 'id, title';
$rows = $this->clues_cfrom_model->select($where, $orderby, 0, 0, $select);
foreach ($rows as $v) {
$map[$v['id']] = $v['title'];
}
}
$this->data = $map;
return $this->show_json(SYS_CODE_SUCCESS);
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = 'xls|xlsx';
$config['max_size'] = 5120;
$config['file_name'] = 'receiver_clues' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', ''));
} else {
$data = $this->upload->data();
return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']);
}
}
/**
* 批量新增
* @param $lists
* @return int
*/
private function add_batch($lists)
{
$done = 0;
$adds = array();
$where = array('status' => 1);
$select = 'id, title';
$map_cfrom = $this->clues_cfrom_model->map('title', 'id', $where, '', 0, 0, $select);
$fails = array();
foreach ($lists as $k => $v) {
if (!$v['name']) {
$fails[] = array('data' => $v, 'msg' => 'name is null');
continue;
}
if (!mobile_valid($v['mobile'])) {
$fails[] = array('data' => $v, 'msg' => 'mobile valid fail');
continue;
}
if ($this->clues_model->get(['mobile' => $v['mobile']])) {
$fails[] = array('data' => $v, 'msg' => '手机号已存在');
continue;
}
$cf_id = $map_cfrom[$v['cfrom']];
$adds[] = array(
'name' => $v['name'],
'mobile' => $v['mobile'],
'cf_id' => $cf_id ? $cf_id : 0,
'c_time' => time(),
);
$done++;
}
$fails && debug_log('[warning]# fails=' . json_encode($fails), __FUNCTION__, $this->log_dir);
if ($adds) {
$ret = $this->clues_model->add_batch($adds);
if (!$ret) {
debug_log("[error] add_batch fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
$done = 0;
}
}
return $done;
}
//获取线索来源
public function get_cfroms()
{
$id = $this->input->get('id');
$where = [
'status' => 1,
'pid' => 0
];
$id && $where['pid'] = $id;
$rows = $this->clues_cfrom_model->select($where, 'id desc', '', '', 'id,title');
$this->data['data'] = $rows;
return $this->show_json(SYS_CODE_SUCCESS);
}
public function get_bizInfo()
{
$id = $this->input->get('id');
$info = $this->biz_model->get(['id' => $id], 'city_id,county_id,address');
$city = $this->area_model->get(['county_id' => $info['county_id']]);
$bizinfo['city_name'] = $city['city_name'];
$bizinfo['county_name'] = $city['county_name'];
$bizinfo['address'] = $info['address'];
$this->data['bizinfo'] = $bizinfo;
return $this->show_json(SYS_CODE_SUCCESS);
}
}
+209
View File
@@ -0,0 +1,209 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class CluesCfrom extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
}
//首页信息
public function index()
{
return $this->lists();
}
//数据列表
public function lists()
{
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = [];
$where = ["status<>" => -1, 'pid' => 0];
if (strlen($params['status'])) {
$where['status'] = $params['status'];
}
if ($params['title']) {
$where["title like '%{$params['title']}%'"] = null;
}
$count = $this->mdCluesCfrom->count($where);
if ($count) {
$res = $this->mdCluesCfrom->select($where, "sort desc,id desc", $params['page'], $params['size']);
foreach ($res as $key => $value) {
$setValue = [];
$setValue['id'] = $value['id'];
$setValue['name'] = $value['title'];
$setValue['sort'] = $value['sort'];
$setValue['status'] = $value['status'];
$setValue['status_name'] = $value['status'] == 1 ? '正常' : '禁用';
$options = '';
$res_cfrom = $this->mdCluesCfrom->select(["status<>" => -1, 'pid' => $value['id']], "sort desc,id desc", 1, 10, 'title');
$res_cfrom && $options = implode(',', array_column($res_cfrom, 'title'));
$setValue['options'] = $options;
$lists[] = $setValue;
}
}
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['_title'] = '线索来源';
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
return $this->show_view('receiver/cluescfrom/lists', true);
}
public function get_options()
{
$id = intval($this->input->post('id'));
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$res_tag = $this->mdCluesCfrom->select(["status" => 1, 'pid' => $id], "sort desc,id desc", 0, 0, 'id,title as name,sort,status');
$this->data['lists'] = $res_tag;
return $this->show_json(SYS_CODE_SUCCESS);
}
//展示单条数据
public function get()
{
$id = intval($this->input->get('id'));
if ($id) {
$url = "receiver/CluesCfrom/edit";
$re = $this->mdCluesCfrom->get(['id' => $id]);
if (!$re) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
$name = $re['title'];
$sort = $re['sort'];
} else {
$url = "receiver/CluesCfrom/add";
$sort = 50;
$name = '';
}
$this->data['showInfo'] = ['id' => $id, 'name' => $name, 'sort' => $sort, 'url' => $url];
return $this->show_view('receiver/cluescfrom/edit');
}
//添加单条数据
public function add()
{
$params = $this->input->post();
if (!$params['name']) {
return $this->show_json(SYS_CODE_FAIL, '名称不能为空!');
}
$re = $this->mdCluesCfrom->get(['title' => $params['name'], 'pid' => 0, "status<>" => -1]);
if ($re) {
return $this->show_json(SYS_CODE_FAIL, '名称已存在了!');
}
$id = $this->mdCluesCfrom->add(['title' => $params['name'], 'sort' => $params['sort'], 'c_time' => time()]);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//编辑单条数据
public function edit()
{
$params = $this->input->post();
if (!$params['id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
if (!$params['name']) {
return $this->show_json(SYS_CODE_FAIL, '请输入名称');
}
$re = $this->mdCluesCfrom->get(array('title' => $params['name'], 'pid' => 0, "status<>" => -1));
if ($re && $re['id'] != $params['id']) {
return $this->show_json(SYS_CODE_FAIL, '名称已存在了!');
}
$this->mdCluesCfrom->update(['title' => $params['name'], 'sort' => $params['sort']], ['id' => $params['id']]);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//删除单条数据
public function del()
{
$id = $this->input->post('id');
if (!$id) {
$this->show_json(SYS_CODE_FAIL, '参数错误');
}
$re = $this->mdCluesCfrom->get(['id' => $id]);
if (!$re) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
$this->mdCluesCfrom->update(['status' => -1], ['id' => $id]);
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
//修改来源选项
function edit_options()
{
$pid = $this->input->post('id');
$options = $this->input->post('options');
if (!$pid || !$options) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$re = $this->mdCluesCfrom->get(['id' => $pid]);
if (!$re) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
foreach ($options as $key => $value) {
$sort = intval($value['sort']);
$data = ['title' => $value['name'], 'status' => $value['status'], 'sort' => $sort];
if ($value['name']) {
if ($value['id']) {//修改
$this->mdCluesCfrom->update($data, ['id' => $value['id']]);
} else {//新增
$data['pid'] = $pid;
$data['c_time'] = time();
$this->mdCluesCfrom->add($data);
}
}
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
function edit_status()
{
$id = $this->input->post('id');
$stauts = intval($this->input->post('status'));
if (!$id) {
$this->show_json(SYS_CODE_FAIL, '参数错误');
}
$this->mdCluesCfrom->update(['status' => $stauts], ['id' => $id]);
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
/**
* Notes:获取分类信息
* Created on: 2023/3/27 17:39
* Created by: dengbw
* @return bool
*/
function json_get()
{
$id = $this->input->get('id');
$where = [
'status' => 1,
'pid' => 0
];
$id && $where['pid'] = $id;
$rows = $this->mdCluesCfrom->select($where, 'sort desc,id desc', '', '', 'id,title');
$this->data['data'] = $rows;
return $this->show_json(SYS_CODE_SUCCESS);
}
//批量操作(默认修改状态)
public function batch()
{
}
//导出数据列表
public function export()
{
}
}
File diff suppressed because it is too large Load Diff
+288
View File
@@ -0,0 +1,288 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2021/8/20
* Time: 17:46
*/
class Addr extends HD_Controller{
protected $log_dir;
function __construct(){
parent::__construct();
$this->load->model("sys/sys_addr_model", 'addr_model');
$this->load->model("area_model");
$this->log_dir = 'sys_' . get_class($this);
}
public function index(){
return $this->lists();
}
public function lists(){
$params = $this->input->get();
$page = $params['page'];
$page = !$page ? 1 : $page;
$size = $params['size'];
$size = !$size ? 20 : $size;
$where = array('province_id' => '350');
if($params['title']){
$where["title like '%{$params['title']}%'"] = null;
}
if($params['city_id']){
$where['city_id'] = $params['city_id'];
} else {
$params['city_id'] = '';
}
if($params['county_id']){
$where['county_id'] = $params['county_id'];
} else {
$params['county_id'] = '';
}
if(strlen($params['status'])>0){
$where['status'] = $params['status'];
} else {
$where['status>-1'] = null;
$params['status'] = '';
}
$total = $this->addr_model->count($where);
$lists = array();
if($total){
$orderby = 'id desc';
$select = 'id, title, city_name, county_name, status';
$rows = $this->addr_model->select($where, $orderby, $page, $size, $select);
foreach($rows as $v){
$lists[] = array(
'id' => $v['id'],
'title' => $v['title'],
'city_name' => $v['city_name'],
'county_name' => $v['county_name'],
'status' => $v['status'],
'status_name' => 1 == $v['status'] ? '开启' : '停用',
);
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['pager'] = array('count'=>ceil($total/$size),'curr'=>$page,'totle'=>$total);
$this->data['_title'] = '地址管理';
$this->show_view('sys/addr/lists',true);
}
function json_lists(){
$params = $this->input->get();
$page = $params['page'];
$size = $params['size'];
$where = array('province_id' => '350');
if($params['title']){
$where["title like '%{$params['title']}%'"] = null;
}
if($params['city_id']){
$where['city_id'] = $params['city_id'];
} else {
$params['city_id'] = '';
}
if($params['county_id']){
$where['county_id'] = $params['county_id'];
} else {
$params['county_id'] = '';
}
if(strlen($params['status'])>0){
$where['status'] = $params['status'];
} else {
$where['status>-1'] = null;
$params['status'] = '';
}
$total = $this->addr_model->count($where);
$lists = array();
if($total){
$orderby = 'id desc';
$select = 'id, title';
$rows = $this->addr_model->select($where, $orderby, $page, $size, $select);
foreach($rows as $v){
$lists[] = array(
'id' => $v['id'],
'title' => $v['title'],
);
}
}
$this->data['lists'] = $lists;
$this->data['total'] = $total;
return $this->show_json(SYS_CODE_SUCCESS);
}
public function get(){
$id = $this->input->get('id');
if($id){
$row = $this->addr_model->get(array('id' => $id));
$info = array(
'id' => $row['id'],
'title' => $row['title'],
'city_id' => $row['city_id'],
'county_id' => $row['county_id'],
);
$action = '/sys/addr/edit';
$title = '编辑地址';
} else {
$info = array(
'title' => '',
'city_id' => '',
'county_id' => '',
);
$action = '/sys/addr/add';
$title = '新增地址';
}
$this->data['info'] = $info;
$this->data['action'] = $action;
$this->data['_title'] = $title;
$this->show_view('sys/addr/get');
}
public function add(){
$info = $this->input->post('info');
$title = trim($info['title']);
$city_id = $info['city_id'];
$county_id = $info['county_id'];
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入地址');
}
if(!$city_id){
return $this->show_json(SYS_CODE_FAIL, '请选择城市');
}
if(!$county_id){
return $this->show_json(SYS_CODE_FAIL, '请选行政区');
}
$where = array(
"title like '{$title}'" => null,
'county_id' => $county_id
);
$count = $this->addr_model->count($where);
if($count>0){
return $this->show_json(SYS_CODE_FAIL, '地址已存在');
}
//获取行政区信息
$where = array('county_id' => $county_id);
$row_area = $this->area_model->get($where);
if(!$row_area){
return $this->show_json(SYS_CODE_FAIL, '行政区不存在');
}
$add = array(
'title' => $title,
'province_id' => $row_area['province_id'],
'province_name' => $row_area['province_name'],
'city_id' => $row_area['city_id'],
'city_name' => $row_area['city_name'],
'county_id' => $row_area['county_id'],
'county_name' => $row_area['county_name'],
'status' => 1
);
$ret = $this->addr_model->add($add);
if(!$ret){
debug_log("[error]# " . $this->addr_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function edit(){
$info = $this->input->post('info');
$title = trim($info['title']);
$city_id = $info['city_id'];
$county_id = $info['county_id'];
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入地址');
}
if(!$city_id){
return $this->show_json(SYS_CODE_FAIL, '请选择城市');
}
if(!$county_id){
return $this->show_json(SYS_CODE_FAIL, '请选行政区');
}
$where = array(
"title like '{$title}'" => null,
"id<>{$info['id']}" => null,
'county_id' => $county_id
);
$count = $this->addr_model->count($where);
if($count>0){
return $this->show_json(SYS_CODE_FAIL, '地址已存在');
}
//获取行政区信息
$where = array('county_id' => $county_id);
$row_area = $this->area_model->get($where);
if(!$row_area){
return $this->show_json(SYS_CODE_FAIL, '行政区不存在');
}
$upd = array(
'title' => $title,
'province_id' => $row_area['province_id'],
'province_name' => $row_area['province_name'],
'city_id' => $row_area['city_id'],
'city_name' => $row_area['city_name'],
'county_id' => $row_area['county_id'],
'county_name' => $row_area['county_name'],
);
$ret = $this->addr_model->update($upd, array('id' => $info['id']));
if(!$ret){
debug_log("[error]# " . $this->company_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
function edit_status(){
$id = $this->input->post('id');
$status = $this->input->post('status');
$upd = array('status' => $status);
$where = array('id' => $id);
$ret = $this->addr_model->update($upd, $where);
if(!$ret){
debug_log("[error]# " . $this->addr_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del(){
// TODO: Implement del() method.
}
public function batch(){
// TODO: Implement batch() method.
}
public function export(){
// TODO: Implement export() method.
}
}
+227
View File
@@ -0,0 +1,227 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2021/7/29
* Time: 17:38
*/
class Company extends HD_Controller{
protected $log_dir;
function __construct(){
parent::__construct();
$this->load->model("sys/sys_company_model", 'company_model');
$this->log_dir = 'sys_' . get_class($this);
}
public function index(){
return $this->lists();
}
public function lists(){
$params = $this->input->get();
$where = array();
if ($params['keyword']){
$where["(title like '%{$params['keyword']}%' or short like '%{$params['keyword']}%')"] = null;
}
if(strlen($params['status']) > 0){
$where['status'] = $params['status'];
} else {
$params['status'] = '';
}
$page = $params['page'];
$page = !$page ? 1 : $page;
$size = $params['size'];
$size = !$size ? 20 : $size;
$statusAry = $this->company_model->status_ary();
$typeAry = $this->company_model->type_ary();
$count = $this->company_model->count($where);
$lists = array();
if($count){
$orderby = 'id desc';
$select = 'id, title, short, status, city_id,type';
$rows = $this->company_model->select($where, $orderby, $page, $size, $select);
$city_ids = array_column($rows,'city_id') ? implode(',',array_column($rows,'city_id')) : '';
$city_lists = [];
$city_ids && $city_lists = $this->sys_city_model->map('city_id','name',["city_id in ({$city_ids})"=>null],'','','','city_id,name');
foreach($rows as $k => $v){
$lists[] = array(
'id' => $v['id'],
'title' => $v['title'],
'short' => $v['short'],
'status' => $v['status'],
'status_name' => $statusAry[$v['status']],
'type_name' => $typeAry[$v['type']],
'city_name' => $city_lists[$v['city_id']] ? $city_lists[$v['city_id']] : '',
);
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['statusAry'] = $statusAry;
$this->data['pager'] = array('count'=>ceil($count/$size),'curr'=>$page,'totle'=>$count);
$this->data['_title'] = '公司管理';
$this->show_view('sys/company/lists',true);
}
public function get(){
$id = $this->input->get('id');
if($id){
$row = $this->company_model->get(array('id' => $id));
$info = array(
'id' => $row['id'],
'title' => $row['title'],
'short' => $row['short'],
'credit_code' => $row['credit_code'],
'wx_mchid' => $row['wx_mchid'],
'img_seal' => $row['img_seal'],
'img_seal_url' => $row['img_seal'] ? build_qiniu_image_url($row['img_seal']) : '',
'status' => $row['status'],
'city_id' => $row['city_id'] ? $row['city_id'] : '',
'type' => $row['type']
);
$action = '/sys/company/edit';
$title = '编辑公司';
} else {
$info = array(
'title' => '',
'short' => '',
'credit_code' => '',
'wx_mchid' => '',
'status' => 0,
'city_id' => '',
'type' => 0
);
$action = '/sys/company/add';
$title = '新增公司';
}
$city_lists = $this->sys_city_model->select(['status'=>1],'id desc','','','city_id,name');
$this->data['city_lists'] = $city_lists;
$this->data['info'] = $info;
$this->data['action'] = $action;
$this->data['statusAry'] = $this->company_model->status_ary();
$this->data['typeAry'] = $this->company_model->type_ary();
$this->data['_title'] = $title;
$this->show_view('sys/company/get');
}
public function add(){
$info = $this->input->post('info');
$title = trim($info['title']);
$short = trim($info['short']);
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入公司名称');
}
if(!$short){
return $this->show_json(SYS_CODE_FAIL, '请输入公司简称');
}
if(!$info['city_id']){
return $this->show_json(SYS_CODE_FAIL, '请选择城市');
}
// $where = array("title like '{$title}'" => null);
// $count = $this->company_model->count($where);
// if($count>0){
// return $this->show_json(SYS_CODE_FAIL, '公司已存在');
// }
$add = array(
'title' => $title,
'short' => $short,
'credit_code' => $info['credit_code'] ? $info['credit_code'] : '',
'wx_mchid' => $info['wx_mchid'] ? $info['wx_mchid'] : '',
'img_seal' => $info['img_seal'] ? $info['img_seal'] : '',
'status' => intval($info['status']),
'city_id' => $info['city_id'],
'type' => intval($info['type'])
);
$id = $this->company_model->add($add);
if(!$id){
debug_log("[error]# " . $this->company_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function edit(){
$info = $this->input->post('info');
$title = trim($info['title']);
$short = trim($info['short']);
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入公司名称');
}
if(!$short){
return $this->show_json(SYS_CODE_FAIL, '请输入公司简称');
}
if(!$info['city_id']){
return $this->show_json(SYS_CODE_FAIL, '请选择城市');
}
// $where = array("title like '{$title}'" => null, "id<>{$info['id']}" => null);
// $count = $this->company_model->count($where);
// if($count>0){
// return $this->show_json(SYS_CODE_FAIL, '公司已存在');
// }
$upd = array(
'title' => $title,
'short' => $short ? $short : '',
'credit_code' => $info['credit_code'] ? $info['credit_code'] : '',
'wx_mchid' => $info['wx_mchid'] ? $info['wx_mchid'] : '',
'img_seal' => $info['img_seal'] ? $info['img_seal'] : '',
'status' => intval($info['status']),
'city_id' => $info['city_id'],
'type' => intval($info['type'])
);
$ret = $this->company_model->update($upd, array('id' => $info['id']));
if(!$ret){
debug_log("[error]# " . $this->company_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
function edit_status(){
$id = $this->input->post('id');
$status = $this->input->post('status');
$upd = array('status' => $status);
$where = array('id' => $id);
$ret = $this->company_model->update($upd, $where);
if(!$ret){
debug_log("[error]# " . $this->company_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del(){
// TODO: Implement del() method.
}
public function batch(){
// TODO: Implement batch() method.
}
public function export(){
// TODO: Implement export() method.
}
}
+199
View File
@@ -0,0 +1,199 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2021/7/30
* Time: 10:52
*/
class Finance extends HD_Controller{
protected $log_dir;
function __construct(){
parent::__construct();
$this->load->model("sys/sys_finance_model", 'finance_model');
$this->log_dir = 'sys_' . get_class($this);
}
public function index(){
return $this->lists();
}
public function lists(){
$params = $this->input->get();
$where = array();
if ($params['keyword']){
$where["(title like '%{$params['keyword']}%')"] = null;
}
if(strlen($params['status']) > 0){
$where['status'] = $params['status'];
} else {
$params['status'] = '';
}
$page = $params['page'];
$page = !$page ? 1 : $page;
$size = $params['size'];
$size = !$size ? 20 : $size;
$statusAry = $this->finance_model->status_ary();
$count = $this->finance_model->count($where);
$lists = array();
if($count){
$orderby = 'id desc';
$select = 'id, title, money_min, money_max, first_pay, month_min, month_max, status';
$rows = $this->finance_model->select($where, $orderby, $page, $size, $select);
foreach($rows as $k => $v){
$lists[] = array(
'id' => $v['id'],
'title' => $v['title'],
'money' => "{$v['money_min']}-{$v['money_max']}",
'first_pay' => $v['first_pay'],
"month" => "{$v['month_min']}-{$v['month_max']}",
'status' => $v['status'],
'status_name' => $statusAry[$v['status']],
);
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['statusAry'] = $statusAry;
$this->data['pager'] = array('count'=>ceil($count/$size),'curr'=>$page,'totle'=>$count);
$this->data['_title'] = '金融产品';
$this->show_view('sys/finance/lists',true);
}
public function get(){
$id = $this->input->get('id');
if($id){
$row = $this->finance_model->get(array('id' => $id));
$info = array(
'id' => $row['id'],
'title' => $row['title'],
'logo' => $row['logo'],
'logo_url' => $row['logo'] ? build_qiniu_image_url($row['logo']) : '',
'money_min' => $row['money_min'],
'money_max' => $row['money_max'],
'first_pay' => $row['first_pay'],
'month_min' => $row['month_min'],
'month_max' => $row['month_max'],
'status' => $row['status'],
);
$action = '/sys/finance/edit';
$title = '编辑金融产品';
} else {
$info = array(
'title' => '',
'status' => 0,
);
$action = '/sys/finance/add';
$title = '新增金融产品';
}
$this->data['info'] = $info;
$this->data['action'] = $action;
$this->data['statusAry'] = $this->finance_model->status_ary();
$this->data['_title'] = $title;
$this->show_view('sys/finance/get');
}
public function add(){
$info = $this->input->post('info');
$title = trim($info['title']);
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入标题');
}
$where = array("title like '{$title}'" => null);
$count = $this->finance_model->count($where);
if($count>0){
return $this->show_json(SYS_CODE_FAIL, '产品已经存在');
}
$add = array(
'title' => $title,
'logo' => $info['logo'] ? $info['logo'] : '',
'money_min' => floatval($info['money_min']),
'money_max' => floatval($info['money_max']),
'first_pay' => floatval($info['first_pay']),
'month_min' => intval($info['month_min']),
'month_max' => intval($info['month_max']),
'status' => intval($info['status']),
);
$id = $this->finance_model->add($add);
if(!$id){
debug_log("[error]# " . $this->finance_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function edit(){
$info = $this->input->post('info');
$title = trim($info['title']);
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入产品名称');
}
$where = array("title like '{$title}'" => null, "id<>{$info['id']}" => null);
$count = $this->finance_model->count($where);
if($count>0){
return $this->show_json(SYS_CODE_FAIL, '产品已存在');
}
$upd = array(
'title' => $title,
'logo' => $info['logo'] ? $info['logo'] : '',
'money_min' => floatval($info['money_min']),
'money_max' => floatval($info['money_max']),
'first_pay' => floatval($info['first_pay']),
'month_min' => intval($info['month_min']),
'month_max' => intval($info['month_max']),
'status' => intval($info['status']),
);
$ret = $this->finance_model->update($upd, array('id' => $info['id']));
if(!$ret){
debug_log("[error]# " . $this->finance_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
function edit_status(){
$id = $this->input->post('id');
$status = $this->input->post('status');
$upd = array('status' => $status);
$where = array('id' => $id);
$ret = $this->finance_model->update($upd, $where);
if(!$ret){
debug_log("[error]# " . $this->finance_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del(){
// TODO: Implement del() method.
}
public function batch(){
// TODO: Implement batch() method.
}
public function export(){
// TODO: Implement export() method.
}
}
+264
View File
@@ -0,0 +1,264 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* ref Finance.php
*/
class Supplier extends HD_Controller{
protected $log_dir;
function __construct(){
parent::__construct();
$this->load->model("sys/sys_supplier_model", 'supplier_model');
$this->load->model('biz/biz_settle_srv_model');
$this->log_dir = 'sys_' . get_class($this);
}
public function index(){
return $this->lists();
}
public function lists(){
$params = $this->input->get();
$where = array();
if ($params['keyword']){
$params['keyword'] = trim($params['keyword']);
$where["(title like '%{$params['keyword']}%' or short like '%{$params['keyword']}%')"] = null;
}
if(strlen($params['status']) > 0){
$where['status'] = $params['status'];
} else {
$params['status'] = '';
}
if($params['type']){
$where['type'] = $params['type'];
} else {
$params['type'] = '';
}
$page = $params['page'];
$page = !$page ? 1 : $page;
$size = $params['size'];
$size = !$size ? 20 : $size;
$statusAry = $this->supplier_model->status_ary();
$typeAry = $this->supplier_model->type_ary();
$count = $this->supplier_model->count($where);
$lists = array();
if($count){
$orderby = 'status desc, id desc';
$select = '*';
$rows = $this->supplier_model->select($where, $orderby, $page, $size, $select);
foreach($rows as $k => $v){
$lists[] = array(
'id' => $v['id'],
'title' => $v['title'],
'short' => $v['short'],
'type' => $v['type'],
'type_name' => $typeAry[$v['type']],
'jsondata' => json_decode($v['jsondata'], true),
'status' => $v['status'],
'status_name' => $statusAry[$v['status']],
'c_time' => date('Y-m-d H:i:s', $v['c_time'])
);
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['statusAry'] = $statusAry;
$this->data['typeAry'] = $typeAry;
$this->data['pager'] = array('count'=>ceil($count/$size),'curr'=>$page,'totle'=>$count);
$this->data['_title'] = '供应商';
$this->show_view('sys/supplier/lists',true);
}
public function get(){
$id = $this->input->get('id');
if($id){
$row = $this->supplier_model->get(array('id' => $id));
$info = array(
'id' => $row['id'],
'title' => $row['title'],
'short' => $row['short'],
'type' => $row['type'],
'jsondata' => json_decode($row['jsondata'], true),
'status' => $row['status'],
);
$action = '/sys/supplier/edit';
$title = '编辑供应商';
} else {
$info = array(
'title' => '',
'short' =>'',
'type' => 1,
'status' => 1,
);
$action = '/sys/supplier/add';
$title = '新增供应商';
}
$this->data['info'] = $info;
$this->data['action'] = $action;
$this->data['statusAry'] = $this->supplier_model->status_ary();
$this->data['typeAry'] = $this->supplier_model->type_ary();
$this->data['_title'] = $title;
$this->show_view('sys/supplier/get');
}
public function add(){
$info = $this->input->post('info');
$type = trim($info['type']);
if(!$type){
return $this->show_json(SYS_CODE_FAIL, '请选择供应商类型');
}
$title = trim($info['title']);
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入供应商名字');
}
$where = array("title like '%{$title}%'" => null, "type" => $type);
$count = $this->supplier_model->count($where);
if($count>0){
return $this->show_json(SYS_CODE_FAIL, '供应商已经存在');
}
$short = trim($info['short']);
$short = $this->short_check($short, $type, $info['id']);
$add = array(
'title' => $title,
'short' => $short,
'jsondata' => json_encode(array()),
'type' => intval($type),
'status' => intval($info['status']),
'c_time' => time(),
);
$id = $this->supplier_model->add($add);
if(!$id){
debug_log("[error]# " . $this->supplier_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function edit(){
$info = $this->input->post('info');
$row = $this->supplier_model->get(array('id' => $info['id']));
if (!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误:ID不存在');
}
$type = trim($info['type']);
if(!$type){
return $this->show_json(SYS_CODE_FAIL, '请选择供应商类型');
}
$title = trim($info['title']);
if(!$title){
return $this->show_json(SYS_CODE_FAIL, '请输入供应商名字');
}
$where = array("title like '%{$title}%'" => null, "type" => $type, "id<>{$info['id']}" => null);
$count = $this->supplier_model->count($where);
if($count>0){
return $this->show_json(SYS_CODE_FAIL, '供应商已经存在');
}
$short = trim($info['short']);
$short = $this->short_check($short, $type, $info['id']);
$upd = array(
'title' => $title,
'short' => $short,
'jsondata' => json_encode(array()),
'type' => intval($type),
'status' => intval($info['status']),
);
$ret = $this->supplier_model->update($upd, array('id' => $info['id']));
if(!$ret){
debug_log("[error]# " . $this->supplier_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
# title修改要同步
if ($row['title'] != $title){
$upd = array(
'title' => $title,
"jsondata = json_set(jsondata, '$.supplier_title', '{$title}')" => null,
);
$where = array(
'type' => intval($type),
"JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$info['id']}'" => null,
);
$this->biz_settle_srv_model->update($upd, $where);
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
private function short_check($short='', $type=2, $id=0){
$short = trim($short);
if (!$short){
return $short;
}
$short = str_replace('',',', $short);
$short = str_replace(' ',',', $short);
$short = str_replace(' ',',', $short);
$shorts = explode(',', $short);
$shorts_new = array();
foreach ($shorts as $short){
if (!$short){
continue;
}
$shorts_new[] = $short;
$where = array("short like '%{$short}%'" => null, "type" => $type);
$id && $where["id<>{$id}"] = null;
$count = $this->supplier_model->count($where);
if($count>0){
$this->show_json(SYS_CODE_FAIL, "简称'{$short}'已经存在");exit();
}
}
$short = implode(',', $shorts_new);
return $short;
}
function edit_status(){
$id = $this->input->post('id');
$status = $this->input->post('status');
$upd = array('status' => $status);
$where = array('id' => $id);
$ret = $this->supplier_model->update($upd, $where);
if(!$ret){
debug_log("[error]# " . $this->supplier_model->db->last_query(), __FUNCTION__, $this->log_dir);
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del(){
// TODO: Implement del() method.
}
public function batch(){
// TODO: Implement batch() method.
}
public function export(){
// TODO: Implement export() method.
}
}
+267
View File
@@ -0,0 +1,267 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Admin extends HD_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('sys/Sys_admin_model','sysAdmin');
$this->load->model('sys/Sys_role_model','sysRole');
$this->load->model('sys/Sys_category_model','sysCate');
$this->load->model('sys/Sys_city_model','sysCity');
$this->load->model('biz/biz_model');
}
public function index()
{
}
public function lists($where = array(), $order = '',$page = 0,$size = 10)
{
$username = $this->input->get('username');
$mobile = $this->input->get('mobile');
$status = $this->input->get('status');
$role_id = $this->input->get('role_id');
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$status = $status === null ? 1 : $status;
if(!empty($username)) $where["username like '%$username%'"] = null;
if(!empty($mobile)) $where['mobile'] = $mobile;
if(!is_null($status) && $status != '') $where['status'] = $status;
if($role_id) $where['role_id'] = $role_id;
$count = $this->sysAdmin->count($where);
$data = $this->sysAdmin->select($where,$order,$page,$size,'id,username,mobile,role_id,status');
$role = $this->sysRole->select(['status' => '1'],'','','','id,name');
$role = array_combine(array_column($role, 'id'), $role);
foreach ($data as $key => $value) {
$data[$key]['role'] = $role[$value['role_id']]['name'];
}
$this->data['role'] = $role;
$this->data['role_id'] = $role_id;
$this->data['pager'] = ['count' => ceil($count/$size),'curr' => $page,'totle' => $count];
$this->data['lists'] = $data;
$this->data['username'] = $username;
$this->data['mobile'] = $mobile;
$this->data['status'] = $status;
$this->data['_title'] = '用户管理';
$this->data['pager']['total'] = $count;
$this->show_view('/sys/admin/lists',true);
}
function lists_json(){
$keyword = $this->input->get('keyword');
$page = 1;
$size = 20;
$where = array("(username LIKE '%{$keyword}%' OR mobile LIKE '%{$keyword}%')" => null);
$rows = $this->sysAdmin->select($where, 'id DESC', $page, $size);
$lists = array();
foreach($rows as $item){
$lists[] = array(
'id' => $item['id'],
'name' => $item['username'],
'mobile' => $item['mobile'],
);
}
$this->data = $lists;
$this->show_json(SYS_CODE_SUCCESS);
}
public function get()
{
$id = $this->input->get('id');
if(!$id) {
return $this->show_json(SYS_CODE_SUCCESS,'提交错误!');
}
if($id == SUPER_ADMIN){
return $this->show_json(SYS_CODE_SUCCESS,'您无权修改该账号!');
}
$this->data = $this->_get_info();
$data = $this->sysAdmin->get(['id' => $id]);
$json = (array)json_decode($data['other_json']);
//获取已选门店
if($json['biz_id']){
$ids = implode(',',$json['biz_id']);
$where = [
"id in ($ids)" => null
];
$this->data['selectBiz'] = $this->biz_model->select($where,'','','','id,biz_name as title');
}
$this->data['username'] = $data['username'];
$this->data['role_id'] = $data['role_id'];
$this->data['mobile'] = $data['mobile'];
$this->data['id'] = $id;
$this->load->vars('url','edit');
$this->show_view('/sys/admin/edit');
}
public function get_add()
{
$this->load->vars('url','add');
$this->data = $this->_get_info();
$this->show_view('/sys/admin/edit');
}
public function edit_password()
{
$id = intval($this->input->post('id'));
if (!$id){
$this->show_json(SYS_CODE_FAIL,'提交错误!');
}
if($id == SUPER_ADMIN){
return $this->show_json(SYS_CODE_SUCCESS,'您无权修改该账号!');
}
$rand_pwd = $this->_get_rand();
while (strlen($pwd) < 6){
$pwd .= substr($rand_pwd,mt_rand(0,35),1);
}
$password = 'fish_'.$pwd;
$data['password'] = password_hash($password,PASSWORD_BCRYPT);
$this->sysAdmin->update($data,['id' => $id]);
return $this->show_json(SYS_CODE_SUCCESS,'密码重置为:'.$password.',请及时记录您的密码!');
}
public function add()
{
//输入验证
$a = $this->_verify();
if($a !== true) {
return $this->show_json(SYS_CODE_FAIL,$a);
}
//输入流数据获取
$input = $this->_get_input();
$other_json = [];
$input['biz_id'] && $other_json['biz_id'] = $input['biz_id'];
$insert = [
'username' => $input['username'],
'mobile' => $input['mobile'],
'role_id' => $input['role'],
'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE),
'password' => password_hash($input['password1'],PASSWORD_BCRYPT),
'c_time' => time(),
];
$this->sysAdmin->add($insert);
return $this->show_json(SYS_CODE_SUCCESS,'新增成功!');
}
public function edit()
{
//输入验证
$a = $this->_verify();
if($a !== true) {
return $this->show_json(SYS_CODE_FAIL,$a);
}
//输入流数据获取
$input = $this->_get_input();
$other_json = [];
$input['biz_id'] && $other_json['biz_id'] = $input['biz_id'];
$upd = [
'username' => $input['username'],
'mobile' => $input['mobile'],
'role_id' => $input['role'],
'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE),
];
if($this->sysAdmin->update($upd,['id' => $input['id']])) {
return $this->show_json(SYS_CODE_SUCCESS,'修改成功!');
}
}
public function del()
{
$id = $this->input->post('id');
$status = $this->input->post('status');
if(!$id) {
return $this->show_json(SYS_CODE_FAIL, '提交错误!');
}
if($this->sysAdmin->update(['status' => $status], ['id' => $id])) {
return $this->show_json(SYS_CODE_SUCCESS, '操作成功!');
}
}
public function batch()
{
}
public function export()
{
}
private function _get_info()
{
$data['role'] = $this->sysRole->select(['status' => '1'],'','','','id,name');
return $data;
}
private function _verify()
{
$input = $this->_get_input();
if(!$input['username']) {
return '请输入用户名!';
}
if(!$input['mobile']) {
return '请输入手机号码';
}
if(!$input['role']) {
return '请选择角色权限';
}
//编辑修改
if($input['id']) {
$where = 'username = "'.$input['username'].'" AND id != '.$input['id'];
if($this->sysAdmin->select($where)) {
return '用户名已存在!';
}
$where = $where = 'mobile = "'.$input['mobile'].'" AND id != '.$input['id'];;
if($this->sysAdmin->select($where)) {
return '手机号码已存在!';
}
} else {
//新增
$where = ['username' => $input['username']];
if($this->sysAdmin->select($where)) {
return '用户名已存在!';
}
$where = ['mobile' => $input['mobile']];
if($this->sysAdmin->select($where)) {
return '手机号码已存在!';
}
if(!$input['password1']) {
return '请输入密码!';
}
if(!$input['password2']) {
return '请输入确认密码!';
}
if($input['password1'] != $input['password2']) {
return '俩次输入密码不符!';
}
}
return true;
}
private function _get_input()
{
$data = [
'id' => $this->input->post('id'),
'username' => trim($this->input->post('username')),
'mobile' => trim($this->input->post('mobile')),
'status' => $this->input->post('status'),
'role' => $this->input->post('role'),
'password1' => trim($this->input->post('password1')),
'password2' => trim($this->input->post('password2')),
'biz_id' => $this->input->post('biz_id'),
];
return $data;
}
private function _get_rand()
{
return md5(time().mt_rand(0,9999).uniqid());
}
}
+114
View File
@@ -0,0 +1,114 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/14
* Time: 14:09
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Log extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model("sys/sys_admin_log_model");
}
public function index()
{
return $this->lists();
}
public function lists()
{
$uid = intval($this->input->get('uid', true));
$time = $this->input->get('time', true);
$page = intval($this->input->get('page', true));
$status = $this->input->get('page', true);
$status = $status === null ? 1 : $status;
!$page && $page = 1;
$pagesize = 20;
$stime = $etime = '';
if ($time) {
$time_arr = explode('~', $time);
$stime = trim($time_arr[0]);
$etime = trim($time_arr[1]);
//$etime = date('Y-m-d H:i:s',strtotime($etime)+24*60*60-1);
}
$where = '';
if ($uid) {
$where['admin_id'] = $uid;
$search['uid'] = $uid;
}
if ($stime) {
$where["u_time >= '{$stime} 00:00:00'"] = null;
$search['u_time'] = $stime;
}
if ($etime) {
$where["u_time <='{$etime} 23:59:59'"] = null;
$search['u_time'] = $etime;
}
if ($status){
$where1['status'] = $status;
}
$this->data['search'] = $search;
$this->load->model("sys/sys_admin_model");
$this->data['status'] = $status;
$this->data['admin_list'] = $this->sys_admin_model->select($where1, '', '', '', 'id,username');
$count = $this->sys_admin_log_model->count($where);
$this->data['lists'] = $this->sys_admin_log_model->select($where, 'id desc', $page, $pagesize);
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
$this->data['_title'] = '日志管理';
$this->data['pager']['total'] = $count;
$this->show_view('sys/admin/log_lists', true);
}
public function get()
{
$this->data['id'] = $this->input->get('id');
if (!$this->data['id']) {
return $this->show_json(SYS_CODE_FAIL, '访问出错!');
}
$info = $this->sys_admin_log_model->get(array('id' => $this->data['id']));
$this->data['jsondata'] = $jsondata = json_decode($info['jsondata'], true);
$this->show_view('sys/admin/log_detail');
}
public function change(){
$status = $this->input->post('status');
$where1['status'] = $status;
$this->load->model("sys/sys_admin_model");
$this->data['admin_list'] = $this->sys_admin_model->select($where1, '', '', '', 'id,username');
return $this->show_json(SYS_CODE_SUCCESS,'');
}
public function add()
{
}
public function edit()
{
}
public function del()
{
}
public function batch()
{
}
public function export()
{
}
}
+195
View File
@@ -0,0 +1,195 @@
<?php
/**
* Created by PhpStorm.
* User: Johnny
* Date: 2018/11/6
* Time: 15:20
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Area extends HD_Controller {
private $typeAry = array(1 => '商圈', 2 => '路段', 3 => '卖场');
public function __construct()
{
parent::__construct();
$this->load->model('sys/sys_area_model','areaModel');
$this->load->model('Area_model','area');
$this->data['map'] = $this->area->map();
$this->data['map_info'] = $this->map_info();
}
public function index()
{
}
public function lists($where = array(), $order = 'id desc',$page = 0,$size = 10)
{
$type = $this->input->get('type');
$typeName = $this->input->get('typeName');
$page = $this->input->get('page') ? $this->input->get('page') : 1;
//查询条件
$map_info = $this->map_info();
//是否删除
$where['status <> -1'] = NULL;
if(!empty($typeName)) $where['name like \'%'.$typeName.'%\''] = null;
if(!empty($type)) $where['type'] = $type;
if(!empty($map_info['province_id'])) {
$where['province_id'] = $map_info['province_id'];
}
if(!empty($map_info['city_id'])) {
$where['city_id'] = $map_info['city_id'];
}
$this->data['city'] = $this->area->city($map_info['province_id']);
$this->data['county'] = $this->area->county($map_info['city_id']);
if(!empty($map_info['county_id'])) $where['county_id'] = $map_info['county_id'];
$count = $this->areaModel->count($where);
$data = $this->areaModel->select($where,$order,$page,$size);
foreach ($data as $key => &$value) {
$value['type_name'] = $value['type'] ? $this->typeAry[$value['type']]: '未选择';
}
//变量传递
$this->data['pager'] = ['count'=>ceil($count/$size), 'curr'=>$page,'totle' => $count];
$this->data['info'] = [
'type' => $type,
'typeName' => $typeName,
'data' => $data,
];
$this->data['province'] = $this->area->province();
$this->data['_title'] = '区域管理';
$this->data['map_info'] = $map_info;
$this->data['typeAry'] = $this->typeAry;
$this->data['pager']['total'] = $count;
$this->show_view('sys/area/lists',true);
}
public function get($where = array(), $order = '',$page = 0,$size = 10)
{
$id = $this->input->get('id');
if(!$id) {
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$data = $this->areaModel->get(['id' => $id]);
$this->data = $data;
$this->data['province'] = $this->area->province();
$this->data['city'] = $this->area->city($data['province_id']);
$this->data['county'] = $this->area->county($data['city_id']);
$this->data['typeAry'] = $this->typeAry;
$this->load->vars('url','edit');
$this->show_view('sys/area/edit');
}
public function get_add()
{
$this->data['province'] = $this->area->province();
$this->data['city'] = $this->area->city();
$this->data['county'] = $this->area->county();
$this->data['typeAry'] = $this->typeAry;
$this->load->vars('url','add');
$this->show_view('sys/area/edit');
}
public function add()
{
$map_info = $this->map_info();
$name = trim($this->input->post('typeName'));
$type = $this->input->post('type');
if(!$name) {
return $this->show_json(SYS_CODE_FAIL,'名称不能为空!');
}
$data = [
'name' => $name,
'type' => $type,
'province_id' => $map_info['province_id'],
'province_name' => $this->area->get(['province_id' => $map_info['province_id']],'province_name')['province_name'],
'city_id' => $map_info['city_id'],
'city_name' => $this->area->get(['city_id' => $map_info['city_id']],'city_name')['city_name'],
'county_id' => $map_info['county_id'],
'county_name' => $this->area->get(['county_id' => $map_info['county_id']],'county_name')['county_name'],
];
$this->areaModel->add($data);
return $this->show_json(SYS_CODE_SUCCESS,'新增成功');
}
public function edit()
{
$id = $this->input->post_get('id');
$map_info = $this->map_info();
$name = trim($this->input->post('typeName'));
$type = $this->input->post('type');
if(!$name) {
return $this->show_json(SYS_CODE_FAIL,'请输入名称');
}
$data = [
'name' => $name,
'type' => $type,
'province_id' => $map_info['province_id'],
'province_name' => $this->area->get(['province_id' => $map_info['province_id']],'province_name')['province_name'],
'city_id' => $map_info['city_id'],
'city_name' => $this->area->get(['city_id' => $map_info['city_id']],'city_name')['city_name'],
'county_id' => $map_info['county_id'],
'county_name' => $this->area->get(['county_id' => $map_info['county_id']],'county_name')['county_name'],
];
$this->areaModel->update($data,['id' => $id]);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function edit_status()
{
$id = $this->input->post('id');
$status = $this->input->post('status');
if($this->areaModel->update(['status' => $status],['id' => $id])) {
return $this->show_json(SYS_CODE_SUCCESS,'操作成功!');
} else {
return $this->show_json(SYS_CODE_FAIL,'操作失败!');
}
}
public function del()
{
$id = $this->input->post('id');
if($this->areaModel->update(['status' => '-1'],['id' => $id])) {
return $this->show_json(SYS_CODE_SUCCESS,'删除成功!');
} else {
return $this->show_json(SYS_CODE_FAIL,'删除失败!');
}
}
public function batch()
{
}
public function export()
{
}
public function lists_status(){
}
public function map_info()
{
if($this->input->method() == 'get') {
$data['province'] = $this->input->get('province');
$data['city'] = $this->input->get('city');
$data['county'] = $this->input->get('county');
$data['province_id'] = $this->input->get('province_id');
$data['city_id'] = $this->input->get('city_id');
$data['county_id'] = $this->input->get('county_id');
} else if($this->input->method() == 'post') {
$data['province'] = $this->input->post('province');
$data['city'] = $this->input->post('city');
$data['county'] = $this->input->post('county');
$data['province_id'] = $this->input->post('province_id');
$data['city_id'] = $this->input->post('city_id');
$data['county_id'] = $this->input->post('county_id');
}
return $data;
}
}
+135
View File
@@ -0,0 +1,135 @@
<?php
/**
* Created by PhpStorm.
* User: hrc
* Date: 2018/11/5
* Time: 13:39
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Category extends HD_Controller{
public function __construct()
{
parent::__construct();
$this->load->model("sys/sys_category_model");
}
public function index()
{
return $this->lists();
}
public function lists()
{
$this->data['lists'] =array();
$lists = $this->sys_category_model->select();
foreach ($lists as &$vo) {
$vo['ids'] = implode(',', array_sub_ids($lists, $vo['id']));
}
$this->data['lists'] = arr2table($lists);
$this->data['_title'] = '行业管理';
$this->show_view('sys/category/lists', true);
}
public function get()
{
$type = $this->input->get('type');
$this->data['id'] = $id = $this->input->get('id');
if($type=='add'){
$pid=0;
if($id || !empty($id)){
$info = $this->sys_category_model->get(array('id'=>$id));
if($info['pid'] == 0){
$lists = $this->sys_category_model->select(array('pid' => 0));
}else{
$lists = $this->sys_category_model->select(array('pid' => $info['pid']));
}
$pid = $info['id'];
}else{
$lists = $this->sys_category_model->select(array('pid'=>0));
}
$this->data['type'] = 'add';
}else{
if(!$this->data['id']){
return $this->show_json(SYS_CODE_FAIL,'访问出错!');
}
$info = $this->sys_category_model->get(array('id' => $this->data['id']));
$this->data['info'] = $info;
if($info['pid'] == 0){
$lists = $this->sys_category_model->select(array('pid' => $info['pid']));
}else{
$father_detail = $this->sys_category_model->get(array('id' => $info['pid']));
$lists = $this->sys_category_model->select(array('pid' => $father_detail['pid']));
$pid = $father_detail['id'];
}
}
$this->data['lists'] = $lists;
$this->data['pid'] = $pid;
$this->data['_title'] = $type?'新增行业':'编辑行业';
$this->show_view('sys/category/edit');
}
public function add()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$pid = $this->input->post('pid');
$name = $this->input->post('name');
if(!$name){
return $this->show_json(SYS_CODE_FAIL, '名称不能为空');
}
$data = array(
'pid' => $pid ? $pid : 0,
'name' => $name,
);
$this->sys_category_model->add($data);
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function edit()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = $this->input->get('id');
$pid = $this->input->post('pid');
$name = $this->input->post('name');
if(!$name){
return $this->show_json(SYS_CODE_FAIL, '名称不能为空');
}
$data = array(
'pid' => $pid ? $pid : 0,
'name' => $name,
);
$this->sys_category_model->update($data, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function del()
{
$ids = $this->input->post('id');
$stauts = $this->input->post('status');
if($stauts==1){
$where = array('id' => $ids);
}else{
$ids = explode(',',$ids);
if (!$ids || count($ids) < 1){
$this->show_json(SYS_CODE_FAIL,'请选择要操作的选项');
}
$where = array('id in('.implode(',',$ids).')'=>null);
}
$this->sys_category_model->update(array('status' => $stauts), $where);
return $this->show_json(SYS_CODE_SUCCESS,'操作成功');
}
public function batch()
{
}
public function export()
{
}
}
+248
View File
@@ -0,0 +1,248 @@
<?php
/**
* Created by PhpStorm.
* User: xiaobo
* Date: 2018/11/5
* Time: 13:39
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class City extends HD_Controller{
private $city = array('北京市', '上海市', '重庆市', '天津市');
protected $log_dir;
public function __construct()
{
parent::__construct();
$this->load->model("area_model");
$this->load->model("sys/sys_city_model");
$this->load->model('sys/sys_area_model');
$this->log_dir = 'sys_' . get_class($this);
}
public function index()
{
}
public function lists()
{
$params = $this->input->get();
$where = array();
if ($params['keyword']){
$where["name like '%{$params['keyword']}%'"] = null;
}
$page = $params['page'];
$page = !$page ? 1 : $page;
$size = $params['size'];
$size = !$size ? 20 : $size;
$count = $this->sys_city_model->count($where);
$lists = array();
if($count){
$rows = $this->sys_city_model->select($where,'id desc',$page,$size);
$map_checked = array();
$city_checked = array();
if($rows){
$city_ids = array_column($rows, 'city_id');
$str_ids = implode(',', $city_ids);
//获取城市下所有的区域
$where = array("city_id in ({$str_ids})" => null);
$orderby = 'city_id asc, county_id asc';
$select = 'city_id, county_id, county_name';
$rows_county = $this->area_model->select($where, $orderby, 0, 0, $select);
//获取已经选择的区域
$orderby = 'city_id asc, county_id asc';
$select = 'county_id, status';
$map_county = $this->sys_area_model->map('county_id', 'status', $where, $orderby, 0, 0, $select);
if($rows_county){
foreach($rows_county as $k => $v){
$city_id = $v['city_id'];
$county_id = $v['county_id'];
$checked = 1==$map_county[$county_id] ? 1 : 0;
$map_checked[$city_id][] = array(
'county_id' => $county_id,
'county_name' => $v['county_name'],
'checked' => $checked,
);
1 == $checked && $city_checked[$city_id] = $checked;
}
}
}
foreach($rows as $k => $v){
$city_id = $v['city_id'];
$lists[] = array(
'id' => $v['id'],
'city_id' => $city_id,
'firstchar' => $v['firstchar'],
'name' => $v['name'],
'fee_carno' => sprintf('%.2f', $v['fee_carno']),
'checked' => $city_checked[$city_id] ? 1 : 0,
'countys' => $map_checked[$city_id] ? $map_checked[$city_id] : array(),
);
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['pager'] = array('count'=>ceil($count/$size),'curr'=>$page,'totle'=>$count);
$this->data['_title'] = '城市管理';
$this->show_view('sys/city/lists',true);
}
public function get()
{
$info = array('province_id' => '350', 'city_id' => '', 'name' => '', 'firstchar' => '',);//默认添加福建城市
$this->data['info'] = $info;
$this->data['_title'] = '新增城市';
$this->show_view('sys/city/edit');
}
public function add()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$name = $this->input->post('name');
$firstchar = $this->input->post('firstchar');
if(!$name || empty($name)){
return $this->show_json(SYS_CODE_FAIL, '城市名称不能为空');
}
$get_city = $this->area_model->get(array('city_name'=>$name),'city_id');
if(!$get_city || empty($get_city)){
//查验直辖市
if(!in_array($name, $this->city)) {
return $this->show_json(SYS_CODE_FAIL, '请填写正确的城市名称');
} else {
$zhixia_city = $this->area_model->get(array('province_name'=>$name),'city_id');
$city_id = $zhixia_city['city_id'];
}
}else{
if($name == '市辖区') {
return $this->show_json(SYS_CODE_FAIL, '请填写正确的城市名称');
} else $city_id = $get_city['city_id'];
}
if(!$firstchar || empty($firstchar)){
return $this->show_json(SYS_CODE_FAIL, '首字母不能为空');
}
//判断是否重复
$row = $this->sys_city_model->get(array('city_id' => $city_id));
if($row){
return $this->show_json(SYS_CODE_FAIL, '该城市已经添加');
}
$data = array(
'city_id' => $city_id,
'name' => $name,
'firstchar' => $firstchar,
);
$this->sys_city_model->add($data);
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function edit()
{
}
/**
* 保存选中的区域
* @return bool
*/
function edit_areas(){
$lists = $this->input->post('lists');
$lists = json_decode($lists, true);
$add_ids = array();//需要新增选中的区域ID
$del_ids = array();//需要删除区域的城市ID
foreach($lists as $k => $v){
$upd = array('status' => $v['checked'] ? 1 : 0);
$where = array('id' => $v['id']);
//更新城市的状态
$ret = $this->sys_city_model->update($upd, $where);
if($ret){
$del_ids[] = $v['city_id'];
foreach($v['countys'] as $k_county => $v_county){
if($v_county['checked']){
$add_ids[] = $v_county['county_id'];
}
}
}
}
if($del_ids){
//删除旧的选中区域
$str_ids = implode(',', $del_ids);
$where = array("city_id in ({$str_ids})" => null);
$ret = $this->sys_area_model->delete($where);
}
if($add_ids){
//新增选中的区域
$adds = array();
$str_ids = implode(',', $add_ids);
$where = array("county_id in ({$str_ids})" => null);
$orderby = 'county_id asc';
$select = 'province_id, province_name, city_id, city_name, county_id, county_name';
$rows = $this->area_model->select($where, $orderby, 0, 0, $select);
foreach($rows as $v){
$adds[] = array(
'province_id' => $v['province_id'],
'province_name' => $v['province_name'],
'city_id' => $v['city_id'],
'city_name' => $v['city_name'],
'county_id' => $v['county_id'],
'county_name' => $v['county_name'],
'status' => 1,
);
}
if($adds){
$ret = $this->sys_area_model->add_batch($adds);
}
}
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
/**
* 保存挂牌价
* @return bool
*/
function edit_fee(){
$lists = $this->input->post('lists');
$lists = json_decode($lists, true);
foreach($lists as $k => $v){
$upd = array('fee_carno' => $v['fee_carno']);
$where = array('id' => $v['id']);
//更新城市的状态
$ret = $this->sys_city_model->update($upd, $where);
if(!$ret){
debug_log("[error]# " . $this->sys_city_model->db->last_query(), __FUNCTION__, $this->log_dir);
}
}
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function del()
{
$id = $this->input->post('id');
if($id)
{
$where = array('id' => $id);
$row = $this->sys_city_model->get($where);
$ret = $this->sys_city_model->delete($where);
if($ret){
$where = array('city_id' => $row['city_id']);
$this->sys_area_model->delete($where);
}
}
return $this->show_json(SYS_CODE_SUCCESS,'操作成功');
}
public function batch()
{
}
public function export()
{
}
}
+153
View File
@@ -0,0 +1,153 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Category extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('sys/Sys_tag_category_model', 'cateM');
}
//首页信息
public function index()
{
$this->lists();
}
//数据列表
public function lists()
{
$input = $this->input->get();
if($input['name']) {
$where['name like "%'.$input['name'].'%"'] = NULL;
}
if(status_verify($input['status'])) {
$where['status'] = $input['status'];
}
$lists = $this->cateM->select($where);
foreach($lists as $lk => $lv) {
$lists[$lk]['ids'] = implode(',', array_sub_ids($lists, $lv['id']));
}
$this->data['lists'] = arr2table($lists);
$this->data['_title'] = '内容标签分类列表';
return $this->show_view('sys/contag/category/lists', true);
}
//展示单条数据
public function get()
{
$this->data['id'] = $id = $this->input->get('id');
if(!$this->data['id']) {
return $this->show_json(SYS_CODE_FAIL,'访问出错!');
}
$info = $this->cateM->get(array('id' => $this->data['id']));
$this->data['info'] = $info;
if($info['pid'] == 0){
$lists = $this->cateM->select(array('pid' => $info['pid']));
}else{
$father_detail = $this->cateM->get(array('id' => $info['pid']));
$lists = $this->cateM->select(array('pid' => $father_detail['pid']));
$pid = $father_detail['id'];
}
$this->data['lists'] = $lists;
$this->data['pid'] = $pid;
$this->data['url'] = 'edit';
$this->data['_title'] = '编辑分类';
$this->show_view('sys/contag/category/edit');
}
public function get_add()
{
$this->data['id'] = $id = $this->input->get('id');
$pid = 0;
if($id || !empty($id)){
$info = $this->cateM->get(array('id'=>$id));
if($info['pid'] == 0){
$lists = $this->cateM->select(array('pid' => 0));
} else {
$lists = $this->cateM->select(array('pid' => $info['pid']));
}
$pid = $info['id'];
} else {
$lists = $this->cateM->select(array('pid' => 0));
}
$this->data['lists'] = $lists;
$this->data['pid'] = $pid;
$this->data['url'] = 'add';
$this->data['_title'] = '新增分类';
$this->show_view('sys/contag/category/edit');
}
//添加单条数据
public function add()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$pid = $this->input->post('pid');
$name = $this->input->post('name');
if(!$name){
return $this->show_json(SYS_CODE_FAIL, '名称不能为空');
}
$data = array(
'pid' => $pid ? $pid : 0,
'name' => $name,
);
$this->cateM->add($data);
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
//编辑单条数据
public function edit()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = $this->input->get('id');
$pid = $this->input->post('pid');
$name = $this->input->post('name');
if(!$name){
return $this->show_json(SYS_CODE_FAIL, '名称不能为空');
}
$data = array(
'pid' => $pid ? $pid : 0,
'name' => $name,
);
$this->cateM->update($data, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
//删除单条数据
public function del()
{
$ids = $this->input->post('id');
$stauts = $this->input->post('status');
if($stauts == 1){
$where = array('id' => $ids);
} else {
$ids = explode(',', $ids);
if(!$ids || count($ids) < 1) {
$this->show_json(SYS_CODE_FAIL,'请选择要操作的选项');
}
$where = array('id in('.implode(',',$ids).')' => null);
}
$this->cateM->update(array('status' => $stauts), $where);
return $this->show_json(SYS_CODE_SUCCESS,'操作成功');
}
//批量操作(默认修改状态)
public function batch()
{
}
//导出数据列表
public function export()
{
}
}
+181
View File
@@ -0,0 +1,181 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Tag extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('sys/Sys_content_tags_model', 'tagsM');
$this->load->model('app/App_model', 'appM');
$this->load->model('sys/Sys_tag_model', 'sysTag');
$this->load->model('sys/Sys_tag_category_model', 'cateM');
}
//首页信息
public function index()
{
return $this->lists();
}
//数据列表
public function lists($where = array('status' => 1), $order = '', $page = 1, $size = 10)
{
$input = $this->input->get();
if(status_verify($input['cate1_id'])) {
$where['cate_id'] = $input['cate1_id'];
$this->data['cate1_id'] = $input['cate1_id'];
}
if(status_verify($input['cate2_id'])) {
$where['cate2_id'] = $input['cate2_id'];
$this->data['cate2_id'] = $input['cate2_id'];
}
$page = $input['page'] ? $input['page'] : $page;
$lists = $this->tagsM->select($where, $order, $page, $size);
foreach($lists as $lk => $lv) {
$tmp = $this->sysTag->get(array('id' => $lv['tag_id']));
$lists[$lk]['name'] = $tmp['tag_name'];
$tmp = $this->cateM->get(array('id' => $lv['cate_id']));
if($tmp) {
$lists[$lk]['cate_name'] = $tmp['name'];
} else $lists[$lk]['cate_name'] = '-';
$tmp = $this->cateM->get(array('id' => $lv['cate2_id']));
if($tmp) {
$lists[$lk]['cate2_name'] = $tmp['name'];
} else $lists[$lk]['cate2_name'] = '-';
}
$count = $this->tagsM->count($where);
$cate = $this->cateM->select(array('pid' => '0'));
$this->data['cate'] = $cate;
$cate1_id = $input['cate1_id'] ? $input['cate1_id'] : '';
$this->data['cate1_id'] = $cate1_id;
$this->data['_title'] = '内容标签列表';
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count/$size), 'curr' => $page, 'totle' => $count);
return $this->show_view('/sys/contag/tag/lists', true);
}
public function get_add()
{
$cate = $this->cateM->select(array('pid' => '0'));
$this->data['cate'] = $cate;
$this->data['url'] = 'add';
return $this->show_view('/sys/contag/tag/edit');
}
//展示单条数据
public function get()
{
$id = $this->input->get('id');
if(!$id) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
$data = $this->db->select('hd_sys_tag.tag_name, hd_sys_content_tags.cate_id, hd_sys_content_tags.cate2_id')
->join('hd_sys_tag', 'hd_sys_tag.id = hd_sys_content_tags.tag_id', 'inner')
->where('hd_sys_content_tags.id', $id)
->get('hd_sys_content_tags')->row_array();
$this->data = $data;
$cate = $this->cateM->select(array('pid' => '0'));
$this->data['id'] = $id;
$this->data['cate'] = $cate;
$this->data['url'] = 'edit';
return $this->show_view('/sys/contag/tag/edit');
}
public function get_cate2()
{
$id = $this->input->post('id');
if(!$id) {
$this->data['cate'] = array();
return $this->show_json(SYS_CODE_SUCCESS, 'success');
}
$cate = $this->cateM->select(array('pid' => $id));
$this->data['cate'] = $cate;
return $this->show_json(SYS_CODE_SUCCESS, 'success');
}
//添加单条数据
public function add()
{
$input = $this->input->post();
if(!$input['tag_name']) {
return $this->show_json(SYS_CODE_FAIL, '标签名称不能为空');
}
if(!status_verify($input['cate1_id'])) {
return $this->show_json(SYS_CODE_FAIL, '请选择分类');
}
// if(status_verify($input['cate2_id'])) {
// return $this->show_json(SYS_CODE_FAIL, '请选择分类');
// }
$cate2_id = $input['cate2_id'] ? $input['cate2_id'] : '0';
$data = $this->sysTag->get(array('tag_name' => $input['tag_name']), 'id');
if($data) $tag_id = $data['id'];
else $tag_id = $this->sysTag->add(array('tag_name' => $input['tag_name']));
if(!$tag_id) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
$this->tagsM->add(array(
'cate_id' => $input['cate1_id'],
'cate2_id' => $cate2_id,
'tag_id' => $tag_id,
'status' => '1'
));
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//编辑单条数据
public function edit()
{
$input = $this->input->post();
if(!$input['id']) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
if(!$input['tag_name']) {
return $this->show_json(SYS_CODE_FAIL, '请输入标签名称');
}
if(!status_verify($input['cate1_id'])) {
return $this->show_json(SYS_CODE_FAIL, '请选择分类');
}
// if(status_verify($input['cate2_id'])) {
// return $this->show_json(SYS_CODE_FAIL, '请选择分类');
// }
$cate2_id = $input['cate2_id'] ? $input['cate2_id'] : '0';
$data = $this->sysTag->get(array('tag_name' => $input['tag_name']), 'id');
if($data) $tag_id = $data['id'];
else $tag_id = $this->sysTag->add(array('tag_name' => $input['tag_name']));
if(!$tag_id) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
$this->tagsM->update(array(
'cate_id' => $input['cate1_id'],
'cate2_id' => $cate2_id,
'tag_id' => $tag_id,
'status' => '1'
), array('id' => $input['id']));
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//删除单条数据
public function del()
{
$id = $this->input->post('id');
$re = $this->tagsM->update(array('status' => '-1'), array('id' => $id));
if($re) {
return $this->show_json(SYS_CODE_SUCCESS, '删除成功');
}
}
//批量操作(默认修改状态)
public function batch()
{
}
//导出数据列表
public function export()
{
}
}
+288
View File
@@ -0,0 +1,288 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/9
* Time: 15:20
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Menu extends HD_Controller {
public $action = array(
ACTION_NODE_LIST => '列表',
ACTION_NODE_GET => '查看',
ACTION_NODE_ADD => '新增',
ACTION_NODE_EDIT => '编辑',
ACTION_NODE_DEL => '删除',
);
public function __construct()
{
parent::__construct();
$this->load->model("sys/sys_menu_model");
}
public function index()
{
return $this->lists();
}
public function lists()
{
$where = array(
'status>=' => 0,
);
$lists = $this->sys_menu_model->select($where, 'sort desc,id desc');
foreach ($lists as &$vo) {
$vo['ids'] = implode(',', array_sub_ids($lists, $vo['id']));
}
$this->data['lists'] = arr2table($lists);
$this->data['_title'] = $type? '商家菜单管理':'菜单管理';
$this->show_view('sys/menu/lists',true);
}
public function get()
{
$this->data['id'] = $id = $this->input->get('id');
$type = $this->input->get('type');
if($type=='add'){
$id = $this->input->get('id');
$pid=0;
if($id || !empty($id)){
$info = $this->sys_menu_model->get(array('id'=>$id));
if($info['pid'] == 0){
$lists = $this->sys_menu_model->select(array('pid' => 0,'status'=>1));
}else{
$lists = $this->sys_menu_model->select(array('pid' => $info['pid'],'status'=>1));
}
$pid = $info['id'];
}else{
$lists = $this->sys_menu_model->select(array('pid'=>0,'status'=>1));
}
$this->data['type'] = 'add';
}else{
if(!$this->data['id']){
return $this->show_json(SYS_CODE_FAIL,'访问出错!');
}
$info = $this->sys_menu_model->get(array('id' => $this->data['id']));
$this->data['info'] = $info;
if($info['pid'] == 0){
$lists = $this->sys_menu_model->select(array('pid' => $info['pid']));
}else{
$father_detail = $this->sys_menu_model->get(array('id' => $info['pid']));
$lists = $this->sys_menu_model->select(array('pid' => $father_detail['pid']));
$pid = $father_detail['id'];
}
}
$this->data['lists'] = $lists;
$this->data['pid'] = $pid;
$this->data['_title'] = $type?'新增菜单':'编辑菜单';
$this->show_view('sys/menu/edit');
}
public function add()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$pid = intval($this->input->post('pid'));
$data['pid'] = $pid;
$data['name'] = $this->input->post('title',true);
$data['outer_link'] = $this->input->post('outer_link');
$data['outer_link'] = $data['outer_link'] ? 1 : 0;
if (!$data['name']){
return $this->show_json(SYS_CODE_FAIL,'请输入菜单名称');
}
$data['url'] = $this->input->post('url');
if (!$data['url']){
return $this->show_json(SYS_CODE_FAIL,'请输入菜单链接');
} else {
if(preg_match('/^(http|https){1}:\/\//', $data['url']) && !$data['outer_link']) {
return $this->show_json(SYS_CODE_FAIL,'您输入链接为外链,请勾选');
}
}
if($data['outer_link']) {
if(!preg_match('/^(http|https){1}:\/\//', $data['url'])) {
return $this->show_json(SYS_CODE_FAIL,'选择外链,请以http或https:开头');
}
if(!strstr($data['url'], 'welcome') && strstr($data['url'], '#')) {
$head = substr($data['url'], 0, strpos($data['url'], '#'));
$foot = substr($data['url'], strpos($data['url'], '#'), strlen($data['url']));
$data['url'] = $head.'welcome'.$foot;
}
if(strstr($data['url'], '?spm')) {
$data['url'] = substr($data['url'], 0, strpos($data['url'],'?spm'));
}
$data['outer_link'] = 1;
}
$data['icon'] = $this->input->post('icon');
$res=$this->sys_menu_model->add($data);
$menu = $this->sys_menu_model->get(array('id' => $res));
//设置node
if($pid){
$pmenu = $this->sys_menu_model->get(array('id' => $pid));
$node = $pmenu['node'] ? $pmenu['node']. "-{$res}" : '';
} else {
$node = "m-{$res}";
}
$node && $node != $menu['node'] && $this->sys_menu_model->update(array('node' => $node), array('id' => $res));
//父菜单不改,有些子菜单需要隐藏不显示的
// $this->sys_menu_model->update(array('url'=>'#'), array('id' => $menu['pid']));
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function edit()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = intval($this->input->get('id'));
$pid = intval($this->input->post('pid'));
$data['pid'] = $pid;
$data['name'] = $this->input->post('title',true);
$data['outer_link'] = $this->input->post('outer_link');
$data['outer_link'] = $data['outer_link'] ? 1 : 0;
if (!$data['name']){
return $this->show_json(SYS_CODE_FAIL,'请输入菜单名称');
}
$data['url'] = trim($this->input->post('url'));
if (!$data['url']){
return $this->show_json(SYS_CODE_FAIL,'请输入菜单链接');
} else {
if(preg_match('/^(http|https){1}:\/\//', $data['url']) && !$data['outer_link']) {
return $this->show_json(SYS_CODE_FAIL,'您输入链接为外链,请勾选');
}
}
if($data['outer_link']) {
if(!preg_match('/^(http|https){1}:\/\//', $data['url'])) {
return $this->show_json(SYS_CODE_FAIL,'选择外链,请以http或https:开头');
}
if(!strstr($data['url'], 'welcome') && strstr($data['url'], '#')) {
$head = substr($data['url'], 0, strpos($data['url'], '#'));
$foot = substr($data['url'], strpos($data['url'], '#'), strlen($data['url']));
$data['url'] = $head.'welcome'.$foot;
}
if(strstr($data['url'], '?spm')) {
$data['url'] = substr($data['url'], 0, strpos($data['url'],'?spm'));
}
$data['outer_link'] = 1;
}
$data['icon'] = $this->input->post('icon');
//获取node
if($pid){
$pmenu = $this->sys_menu_model->get(array('id' => $pid));
$node = $pmenu['node'] ? $pmenu['node']. "-{$id}" : '';
} else {
$node = "m-{$id}";
}
$node && $data['node'] = $node;
if($id)
{
$this->sys_menu_model->update($data, array('id' => $id));
}
// $menu = $this->sys_menu_model->get(array('id' => $id));
// $this->sys_menu_model->update(array('url'=>'#'), array('id' => $menu['pid']));
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function del()
{
$ids = $this->input->post('id');
$stauts = $this->input->post('status');
if($stauts==0 || $stauts==-1){
$ids = explode(',',$ids);
if (!$ids || count($ids) < 1){
$this->show_json(SYS_CODE_FAIL,'请选择要操作的选项');
}
$where = array('id in('.implode(',',$ids).')'=>null);
}
if($stauts==1){
$where = array('id' => $ids);
}
$this->sys_menu_model->update(array('status' => $stauts), $where);
return $this->show_json(SYS_CODE_SUCCESS,'操作成功');
}
//排序
public function sort(){
$sort = $this->input->post('sort');
if (!$sort || !is_array($sort)){
return $this->show_json(SYS_CODE_FAIL,'参数错误');
}
foreach ($sort as $key=>$value){
$this->sys_menu_model->update(array('sort'=>intval($value)),array('id'=>$key,));
}
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function batch()
{
return false;
}
public function batch_node(){
$count = $this->sys_menu_model->count(array("node" => ''));
if(!$count){
echo "no one \n";
return;
}
//处理主菜单
$doc = 0;
$rows = $this->sys_menu_model->select(array("node" => '', 'pid' => 0));
foreach($rows as $row){
$id = $row['id'];
$res = $this->sys_menu_model->update(array('node' => "m-{$id}"), array('id' => $id));
if(!$res){
debug_log("update sys_menu fail : " . $this->sys_menu_model->db->last_query(), 'sys_menu.log');
} else {
$doc++;
}
}
//处理子菜单
$rows = $this->sys_menu_model->select(array("node" => ''));
while(count($rows) > 0){
$row = array_shift($rows);
$pmenu = $this->sys_menu_model->get(array('id' => $row['pid']));
if(!$pmenu['node']){
array_push($rows, $row);
continue;
}
$node = "{$pmenu['node']}-{$row['id']}";
$res = $this->sys_menu_model->update(array('node' => $node), array('id' => $row['id']));
if(!$res){
debug_log("update sys_menu fail : " . $this->sys_menu_model->db->last_query(), 'sys_menu.log');
} else {
$doc++;
}
}
echo "all:{$count}, set:{$doc}\n";
}
public function export()
{
return false;
}
}
+312
View File
@@ -0,0 +1,312 @@
<?php
/**
* Created by PhpStorm.
* User: xiaobo
* Date: 2018/11/5
* Time: 13:39
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Role extends HD_Controller{
public function __construct()
{
parent::__construct();
$this->load->model("area_model");
$this->load->model("sys/sys_role_model");
$this->load->model("sys/sys_menu_model");
$this->data['sq_name'] = $this->auth_array();
}
public function index()
{
}
public function lists()
{
$name = $this->input->get('name');
$page = $this->input->get('page');
!$page && $page = 1;
$pagesize = 10;
$where['status > -1'] = null;
if(!empty($name)) $where["name like '%$name%'"] = null;
$count = $this->sys_role_model->count($where);
$lists = $this->sys_role_model->select($where , 'id desc',$page, $pagesize,'*');
foreach ($lists as $key => $val){
$lists[$key]['menu_json'] = json_decode($val['menu_json'],true);
}
$this->data['lists'] = $lists;
$this->data['name'] = $name;
$this->data['pager'] = array('count'=>ceil($count/$pagesize),'curr'=>$page,'totle'=>$count);
$this->data['_title'] = '角色权限管理';
$this->show_view('sys/role/lists',true);
}
public function get()
{
$id = intval($this->input->get('id'));
if($id){
$detail_news = $this->sys_role_model->get(array('id'=>$id),'*');
$this->data['info'] = $detail_news;
}
$this->data['_title'] = $id ? '编辑角色' : '添加角色';
$view = $id ? 'sys/role/edit' : 'sys/role/add';
$this->show_view($view);
}
public function get_menu(){
$id = intval($this->input->get('id'));
if(!$id){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项!');
}
$info = $this->sys_role_model->get(array('id'=>$id),'*');
if($info['menu_ids'] || !empty($info['menu_ids'])){
$checked = explode(',',$info['menu_ids']);
}else{
$checked = array();
}
$action_json = json_decode($info['action_json'],true);
$this->data['action_json'] = !empty($action_json) ? $action_json : array();
//目前角色选中菜单
$this->data['checked'] = $checked;
//获取后台总菜单列表
$menu_lists = $this->sys_menu_model->select(array('status'=>1),'sort desc');
$lists = array();
foreach ($menu_lists as $vo) {
$temp = $vo;
$ids = implode(',', array_sub_ids($menu_lists, $vo['id']));
$temp['ids'] = $ids;
$lists[] = $temp;
}
$this->data['lists'] = arr2table($lists);
$this->data['info'] = $info;
$this->data['_title'] = '【'.$info['name'].'】后台菜单编辑';
$this->show_view('sys/role/menu',true);
}
public function get_auth(){
$id = intval($this->input->get('id'));
$menu_id = intval($this->input->get('menu_id'));
if(!$id){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项!');
}
if(!$menu_id){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的菜单!');
}
$info = $this->sys_role_model->get(array('id'=>$id),'*');
$action_json = json_decode($info['action_json'],true);
if(!array_key_exists($menu_id,$action_json)){
return $this->show_json(SYS_CODE_FAIL,'请先设置菜单操作!');
}
$action_key = $action_json[$menu_id];
$this->data['action_key'] = $action_key;
$this->data['info'] = $info;
$this->data['menu_id'] = $menu_id;
$this->data['_title'] = '【'.$info['name'].'】后台授权编辑';
$this->show_view('sys/role/auth');
}
public function add()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$name = $this->input->post('name');
$descrip = $this->input->post('descrip');
if(!$name || empty($name)){
return $this->show_json(SYS_CODE_FAIL, '角色名称不能为空');
}
$is_have = $this->sys_role_model->get(array('name'=>$name),'id,name');
if($is_have || !empty($is_have)){
return $this->show_json(SYS_CODE_FAIL,$name.'名称已经存在!');
}
$data = array(
'name' => $name,
'descrip' => $descrip,
'status' => 1,
);
$this->sys_role_model->add($data);
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function edit()
{
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = $this->input->get('id');
if (!$id){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项');
}
$name = $this->input->post('name');
$descrip = $this->input->post('descrip');
if(!$name || empty($name)){
return $this->show_json(SYS_CODE_FAIL, '角色名称不能为空');
}
$where['id != \''.$id.'\''] = null;
$where['name'] = $name;
$is_have = $this->sys_role_model->get($where,'id,name');
if($is_have || !empty($is_have)){
return $this->show_json(SYS_CODE_FAIL,$name.'名称已经存在!');
}
$data = array(
'name' => $name,
'descrip' => $descrip,
);
$this->sys_role_model->update($data, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function edit_menu(){
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = $this->input->get('id');
$menus = $this->input->post('menu');
if(!$menus || empty($menus)){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项!');
}
$info = $this->sys_role_model->get(array('id'=>$id),'*');
if($info['menu_ids'] || !empty($info['menu_ids'])){
//比较差异
if(implode(',',$menus) != $info['menu_ids']){
$action_json = json_decode($info['action_json'],true);
//改变授权差异
$now_nemu_ids = explode(',',$info['menu_ids']);
$add_diff = $sub_diff = $final_action_json = array();
foreach ($now_nemu_ids as $key => $val){
if(!in_array($val,$menus)){
$sub_diff[] = $val;
}
}
foreach ($menus as $key => $val){
if(!in_array($val,$now_nemu_ids)){
$add_diff[] = $val;
}
}
if(!empty($sub_diff)){
//减操作
foreach ($action_json as $key => $val){
if(in_array($key,$sub_diff)){
unset($action_json[$key]);
}
}
$final_action_json = $action_json;
}
if(!empty($add_diff)){
//增操作
$menu_lists_news = $this->sys_menu_model->select(array("id in(".implode(',',$add_diff).")"=>null,"url != '#'"=>null));
$final_add_array = array();
if($menu_lists_news || !empty($menu_lists_news)){
foreach ($menu_lists_news as $key => $val){
$final_add_array[$val['id']] = $this->auth_node_array();
}
}
if(!empty($final_action_json)){
if(!empty($final_add_array)){
$final_action_json = $final_action_json + $final_add_array;
}
}else{
if(!empty($final_add_array)){
$final_action_json = $action_json + $final_add_array;
}
}
}
$data['menu_ids'] = implode(',',$menus);
if(!empty($final_action_json)){
$data['action_json'] = json_encode($final_action_json);
}
$this->sys_role_model->update($data, array('id' => $id));
}
}else{
$data['menu_ids'] = implode(',',$menus);
//默认添加权限
$where['id in('.implode(',',$menus).')'] = null;
$where['pid != 0'] = null;
$menu_lists = $this->sys_menu_model->select($where);
foreach ($menu_lists as $key => $val){
if($val['url'] != '#'){
$menu_keys[$val['id']] = $this->auth_node_array();
}
}
$data['action_json'] = json_encode($menu_keys);
$this->sys_role_model->update($data, array('id' => $id));
}
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function edit_auth(){
if(!$this->if_ajax){
return $this->show_json(SYS_CODE_FAIL,'提交出错!');
}
$id = $this->input->get('id');
$menu_id = $this->input->post('menu_id');
$c_ids = $this->input->post('c_ids');
$get_array = array();
$get_array[$menu_id] = $c_ids;
if(!$c_ids || empty($c_ids)){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项!');
}
$info = $this->sys_role_model->get(array('id'=>$id),'*');
if(!$info || empty($info)){
return $this->show_json(SYS_CODE_FAIL,'角色数据异常!');
}
$now_menu_ids = explode(',',$info['menu_ids']);
if(!in_array($menu_id,$now_menu_ids)){
return $this->show_json(SYS_CODE_FAIL,'请先勾选菜单操作!');
}
$menu_list = json_decode($info['action_json'],true);
if($menu_list || !empty($menu_list)){
if (array_key_exists($menu_id,$menu_list)){
unset($menu_list[$menu_id]);
$final_action = $menu_list + $get_array;
}else{
$final_action = $menu_list + $get_array;
}
}else{
$final_action = $get_array;
}
$data = array(
'action_json' => json_encode($final_action),
);
$this->sys_role_model->update($data, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
public function del()
{
$id = intval($this->input->post('id'));
$status = intval($this->input->post('status'));
if(!$id){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项');
}
$this->sys_role_model->update(array('status' => $status), array('id' => $id));
$text = '保存成功';
return $this->show_json(SYS_CODE_SUCCESS,$text);
}
public function batch()
{
$ids = $this->input->post('id');
$_ids = explode(',',$ids);
if (!$_ids || count($_ids) < 1){
return $this->show_json(SYS_CODE_FAIL,'请选择要操作的选项');
}
$where = array('id in('.$ids.')'=>null);
$this->sys_role_model->update(array('status'=>-1), $where);
$text = '成功删除';
return $this->show_json(SYS_CODE_SUCCESS,$text);
}
public function export()
{
}
public function auth_array(){
$auth_name = array();
$action_node = action_node();
$action_name = action_name();
foreach ($action_node as $key => $val){
$auth_name[$val] = $action_name[$key];
}
return $auth_name;
}
public function auth_node_array(){
$auth_node = array();
$action_node = action_node();
foreach ($action_node as $key => $val){
$auth_node[] = $val;
}
return $auth_node;
}
}
+288
View File
@@ -0,0 +1,288 @@
<?php
/**
* Created by PhpStorm.
* User: Johnny
* Date: 2018/11/6
* Time: 15:20
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Site extends HD_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('sys/sys_config_model','confModel');
}
public function index()
{
return $this->lists();
}
public function lists($where = array(), $order = '',$page = 0,$size = 10)
{
$page = $this->input->post_get('page') ? $this->input->get('page') : 1;
$ip = trim($this->input->post_get('ip'));
$site = trim($this->input->post_get('site'));
if($ip) {
$where["v LIKE '%\"ip\":\"".$ip."\"%'"] = NULL;
$this->data['ip'] = $ip;
}
if($site) {
$where["v LIKE '%\"site\":\"".$site."\"%'"] = NULL;
$this->data['site'] = $site;
}
$where['k'] = 'site';
$count = $this->confModel->count($where);
$temp = $this->confModel->select($where,$order,$page,$size);
foreach ($temp as $key => $value) {
$tmp = json_decode($value['v'], true);
$tmp['id'] = $value['id'];
$data[] = $tmp;
}
$this->data['pager'] = array('count'=> '', 'curr'=>$page, 'totle' => $count, 'total' => $count);
$this->data['lists'] = $data;
$this->data['_title'] = '站点设置';
$this->show_view('sys/site/lists', true);
}
public function lists_igadmin(){
$page = $this->input->get('page');
$size = $this->input->get('size');
!$page && $page = 1;
!$size && $size = 20;
$where = array(
'k' => 'igadmin',
);
$total = $this->confModel->count($where);
$lists = array();
if($total){
$rows = $this->confModel->select($where, 'id DESC', $page, $size);
foreach($rows as $item){
$json = json_decode($item['v']);
$lists[] = array(
'id' => $item['id'],
'admin_id' => $json->admin_id,
'name' => $json->name,
'mobile' => $json->mobile,
'status' => $json->status,
);
}
}
$this->data['pager'] = array('count'=> '', 'curr'=>$page, 'totle' => $total, 'total' => $total);
$this->data['lists'] = $lists;
$this->data['_title'] = '免检管理员';
$this->show_view('sys/site/lists_igadmin', true);
}
public function get($where = array(), $order = '',$page = 0,$size = 10)
{
$id = $this->input->get('id');
$data = $this->confModel->get(array('id' => $id));
$tmp = json_decode($data['v'], true);
$tmp['id'] = $id;
$this->data = $tmp;
$this->data['url'] = 'edit';
$this->show_view('sys/site/edit');
}
public function get_igadmin(){
$id = $this->input->get('id');
if($id){
$row = $this->confModel->get(array('id' => $id));
$json = json_decode($row['v']);
$item = array(
'id' => $row['id'],
'admin_id' => $json->admin_id,
'name' => $json->name,
'mobile' => $json->mobile,
'status' => $json->status,
);
} else {
$item = array();
}
$this->data['row'] = $item;
$this->show_view('sys/site/get_igadmin');
}
public function get_add()
{
$this->data['url'] = 'add';
$this->show_view('sys/site/edit');
}
public function add()
{
$input = $this->input->post();
if(!$input['ip']) {
return $this->show_json(SYS_CODE_FAIL, '请输入ip地址');
}
if(!$input['site']) {
return $this->show_json(SYS_CODE_FAIL, '请输入ip站点名称');
}
if(!filter_var($input['ip'], FILTER_VALIDATE_IP)) {
return $this->show_json(SYS_CODE_FAIL, '请输入正确的ip地址');
}
$arr = array('ip' => $input['ip'], 'site' => $input['site'], 'status' => '1');
$ins = array(
'k' => 'site',
'v' => json_encode($arr, JSON_UNESCAPED_UNICODE),
'c_time' => time(),
);
$re = $this->confModel->add($ins);
if($re) {
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
}
function add_igadmin(){
$admin_id = $this->input->post('admin_id');
$status = $this->input->post('status');
if(!$admin_id){
return $this->show_json(SYS_CODE_FAIL, '选择要操作的管理员');
}
$where = array('k' => 'igadmin', 'v LIKE \'%"admin_id":"' .$admin_id. '"%\'' => null);
$exist = $this->confModel->get($where);
if($exist){
return $this->show_json(SYS_CODE_FAIL, '已有该管理员的记录id'. $exist['id']);
}
$this->load->model('sys/sys_admin_model', 'admin_model');
$admin = $this->admin_model->get(array('id' => $admin_id));
$v = array(
'admin_id' => $admin_id,
'name' => $admin['username'],
'mobile' => $admin['mobile'],
'status' => $status,
);
$add = array(
'k' => 'igadmin',
'v' => json_encode($v),
'c_time' => time(),
);
$this->confModel->add($add);
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
public function edit()
{
$input = $this->input->post();
if(!$input['id']) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
if(!$input['ip']) {
return $this->show_json(SYS_CODE_FAIL, '请输入ip地址');
}
if(!$input['site']) {
return $this->show_json(SYS_CODE_FAIL, '请输入ip站点名称');
}
if(!filter_var($input['ip'], FILTER_VALIDATE_IP)) {
return $this->show_json(SYS_CODE_FAIL, '请输入正确的ip地址');
}
$re = $this->confModel->get(array('id' => $input['id']));
$status = json_decode($re['v'], true)['status'];
$upd = array('ip' => $input['ip'], 'site' => $input['site'],'status' => $status);
$re = $this->confModel->update(array('v' => json_encode($upd, JSON_UNESCAPED_UNICODE)), array('id' => $input['id']));
if($re) {
return $this->show_json(SYS_CODE_SUCCESS, '编辑成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '编辑失败');
}
}
public function edit_status()
{
$id = $this->input->post('id');
if(!$id) {
return $this->show_json(SYS_CODE_FAIL, '提交失败');
}
$status = $this->input->post('status');
$tmp = $this->confModel->get(array('id' => $id));
$tmp_val = json_decode($tmp['v'], true);
$tmp_val['status'] = $status;
$re = $this->confModel->update(array('v' => json_encode($tmp_val)), array('id' => $id));
if($re) {
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '操作失败');
}
}
public function edit_igadmin(){
$id = $this->input->post('id');
$status = $this->input->post('status');
if(!$id){
return $this->show_json(SYS_CODE_FAIL, '选择要操作的对象');
}
$old = $this->confModel->get(array('id' => $id));
if(!$old){
return $this->show_json(SYS_CODE_FAIL, '不存在');
}
$json = json_decode($old['v']);
$admin_id = $json->admin_id;
$this->load->model('sys/sys_admin_model', 'admin_model');
$admin = $this->admin_model->get(array('id' => $admin_id));
$v = array(
'admin_id' => $admin_id,
'name' => $admin['username'],
'mobile' => $admin['mobile'],
'status' => $status,
);
$upd = array('v' => json_encode($v));
$this->confModel->update($upd, array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function del()
{
$id = $this->input->post('id');
if(!$id) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
$this->confModel->delete(array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS, '删除成功');
}
public function del_igadmin(){
$this->del();
}
public function batch()
{
}
public function export()
{
}
public function lists_status(){
}
}
+103
View File
@@ -0,0 +1,103 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Tag extends HD_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('sys/Sys_tag_model','sysTag');
}
public function index()
{
return $this->lists();
}
public function lists($where = array(), $order = 'id desc',$page = 0,$size = 10)
{
$tag_name = $this->input->get('tag_name') ? $this->input->get('tag_name') : '';
$page = $this->input->get('page') ? $this->input->get('page') : 1;
if($tag_name) $where['tag_name'] = $tag_name;
$count = $this->sysTag->count($where);
$lists = $this->sysTag->select($where,$order,$page,$size,'id,tag_name');
$this->data['pager'] = ['count' => intval($count/$size),'curr' => $page];
$this->data['lists'] = $lists;
$this->data['tag_name'] = $tag_name;
$this->data['_title'] = '标签设置';
$this->show_view('/sys/tag/lists',true);
}
public function get()
{
$id = $this->input->post_get('id');
if(!$id) {
return $this->show_json(SYS_CODE_SUCCESS,'提交错误!');
}
$data = $this->sysTag->get(['id' => $id]);
$this->data['tag_name'] = $data['tag_name'];
$this->data['id'] = $id;
$this->load->vars('url','edit');
$this->show_view('/sys/tag/edit');
}
public function add()
{
if($this->input->method() == 'get') {
$this->load->vars('url','add');
$this->show_view('/sys/tag/edit');
} else {
//输入流数据获取
$tag_name = trim($this->input->post('tag_name'));
//标签名称唯一
$a = $this->sysTag->get(['tag_name' => $tag_name]);
if(!is_null($a)) {
if($a['id']) {
return $this->show_json(SYS_CODE_FAIL,'标签名称已存在!');
}
}
$insert = [
'tag_name' => $tag_name,
];
$this->sysTag->add($insert);
return $this->show_json(SYS_CODE_SUCCESS,'新增成功!');
}
}
public function edit()
{
//输入流数据获取
$id = $this->input->post_get('id');
$tag_name = trim($this->input->post('tag_name'));
if(!$id) {
return $this->show_json(SYS_CODE_SUCCESS,'提交错误!');
}
//标签名称唯一
$a = $this->sysTag->get(['tag_name' => $tag_name]);
if(!is_null($a)) {
if($id != $a['id']) {
return $this->show_json(SYS_CODE_FAIL,'标签名称已存在!');
}
}
$upd['tag_name'] = $tag_name;
if($this->sysTag->update($upd,['id' => $id])) {
return $this->show_json(SYS_CODE_SUCCESS,'修改成功!');
}
}
public function del()
{
}
public function batch()
{
}
public function export()
{
}
}
+211
View File
@@ -0,0 +1,211 @@
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This cms is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2018, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Exceptions Class
*
* @package CodeIgniter
* @subpackage Libraries
* @category Exceptions
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/exceptions.html
*/
class CI_Exceptions {
/**
* Nesting level of the output buffering mechanism
*
* @var int
*/
public $ob_level;
/**
* List of available error levels
*
* @var array
*/
public $levels = array(
E_ERROR => 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core Error',
E_CORE_WARNING => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice'
);
/**
* Class constructor
*
* @return void
*/
public function __construct()
{
$this->ob_level = ob_get_level();
// Note: Do not log messages from this constructor.
}
// --------------------------------------------------------------------
/**
* Exception Logger
*
* Logs PHP generated error messages
*
* @param int $severity Log level
* @param string $message Error message
* @param string $filepath File path
* @param int $line Line number
* @return void
*/
public function log_exception($severity, $message, $filepath, $line)
{
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
if($severity!='Notice')
{
log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
}
}
// --------------------------------------------------------------------
/**
* 404 Error Handler
*
* @uses CI_Exceptions::show_error()
*
* @param string $page Page URI
* @param bool $log_error Whether to log the error
* @return void
*/
public function show_404($page = '', $log_error = TRUE)
{
echo 'PAGE NOT FOUND';
exit(404);
}
// --------------------------------------------------------------------
/**
* General Error Page
*
* Takes an error message as input (either as a string or an array)
* and displays it using the specified template.
*
* @param string $heading Page heading
* @param string|string[] $message Error message
* @param string $template Template name
* @param int $status_code (default: 500)
*
* @return string Error page output
*/
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
var_dump($message) ;
}
// --------------------------------------------------------------------
public function show_exception($exception)
{
$templates_path = config_item('error_views_path');
if (empty($templates_path))
{
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
}
$message = $exception->getMessage();
if (empty($message))
{
$message = '(null)';
}
if (is_cli())
{
$templates_path .= 'cli'.DIRECTORY_SEPARATOR;
}
else
{
$templates_path .= 'html'.DIRECTORY_SEPARATOR;
}
if (ob_get_level() > $this->ob_level + 1)
{
ob_end_flush();
}
ob_start();
include($templates_path.'error_exception.php');
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
}
// --------------------------------------------------------------------
/**
* Native PHP error handler
*
* @param int $severity Error level
* @param string $message Error message
* @param string $filepath File path
* @param int $line Line number
* @return void
*/
public function show_php_error($severity, $message, $filepath, $line)
{
if($severity == 8)
{
return;
}
echo $severity."<br>";
echo $filepath." line:";
echo $line."<br>";
echo $message;
return false;
}
}
+128
View File
@@ -0,0 +1,128 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/3
* Time: 21:23
*/
defined('BASEPATH') or exit('No direct script access allowed');
abstract class HD_Controller extends CI_Controller
{
public $uid, $user_name, $role;
public $data = array(), $if_ajax = false;
public $city_lists = [430, 350]; //开发城市湖南 福建
public function __construct()
{
parent::__construct();
$this->if_ajax = $this->input->is_ajax_request();
}
/*
* * * 编码规则 * * *
*
* 默认实现抽象方法
*
* 默认操作前缀相同的方法权限保持一致,若不一致应分开成两个controller
*
* 根据需要添加方法 [操作]_[名称]
* 如 状态 get_status|edit_status
*
* 除private方法外不允许有其他方式的命名
*
* 操作id: index-1 lists-2 get-3 add-4 edit-5 del-6 batch-7 export-8
*
*/
//首页信息
public abstract function index();
//数据列表
public abstract function lists();
//展示单条数据
public abstract function get();
//添加单条数据
public abstract function add();
//编辑单条数据
public abstract function edit();
//删除单条数据
public abstract function del();
//批量操作(默认修改状态)
public abstract function batch();
//导出数据列表
public abstract function export();
//返回视图页面
protected function show_view($view, $refresh = false)
{
$this->load->vars($this->data);
if ($refresh) {
$this->load->view('refresh');
$this->load->view('bread');
}
$this->load->view($view);
$this->load->view('snav');
if ($this->uid == SUPER_ADMIN) {
debug_sql();
}
return true;
}
/**
* 返回json数据
* @param int $code
* @param string $msg
* @param string $url ('#/app/jjd/list')
* @param int $wait
* @return bool
*/
protected function show_json($code = 0, $msg = 'success', $url = '', $wait = 0)
{
header('Content-Type:application/json; charset=utf-8');
echo json_encode(array('data' => $this->data, 'code' => $code, 'msg' => $msg, 'url' => $url, 'wait' => $wait), JSON_UNESCAPED_UNICODE);
if ($this->uid == SUPER_ADMIN) {
debug_sql();
}
return false;
}
/**
* 获取可以管理的城市
* @param null $def
* @return mixed
*/
protected function city_ary($def = null)
{
$this->load->model("sys/sys_city_model", 'city_model');
if (!is_null($def)) {
return '';
}
$where = array('status' => 1);
$orderby = "id desc";
$select = "city_id, name";
$map_city = $this->city_model->map('city_id', 'name', $where, $orderby, 0, 0, $select);
return $map_city;
}
}
File diff suppressed because it is too large Load Diff
+610
View File
@@ -0,0 +1,610 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/1
* Time: 15:10
*/
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class HD_Model extends CI_Model {
private $table_name;
private $mc_cache_expire = '600';
private $file_cache_expire = '86400';
public $db;
static $dbs = array();
public function __construct($table_name = '', $db_group = 'default')
{
//走自定义db
$app_db = $GLOBALS['app_db'];
if($app_db && "default" == $db_group){
$this->load->config("dbtable", true, true);
$dbtable = $this->config->item($app_db, "dbtable");
if(is_array($dbtable) && in_array($table_name, $dbtable)){
$db_group = $GLOBALS['app_db'];
}
}
$this->set_db($db_group);
$this->set_table_name($table_name);
}
public function __call($func,$args)
{
if($func) {
if($args) {
return $this->db->$func($args);
}
return $this->db->$func();
}
}
public function set_db($db_group = 'default')
{
if(!isset(self::$dbs[$db_group]))
{
self::$dbs[$db_group] = $this->load->database($db_group, true);
}
$this->db = self::$dbs[$db_group];
}
/**
* 根据app应用表设置库
* @param $db_group
* @param $apptabs
*/
public function set_appdb($db_group, $apptabs){
$table_name = $this->table_name;
if(is_array($apptabs) && in_array($table_name, $apptabs)){
$this->set_db($db_group);
}
}
public function set_table_name($table_name)
{
$this->table_name = $table_name;
}
/**
* 表字段列表
* @return mixed
*/
public function fields(){
return $this->db->list_fields($this->table_name);
}
/**
* 添加单条数据
* @param $data
* @return mixed
*/
public function add($data)
{
$result = $this->db->insert($this->table_name, $data);
return $this->db->insert_id() ? $this->db->insert_id() : $result;
}
/**
* 添加多条数据
* @param $data_array
* @return mixed
*/
public function add_batch($data_array)
{
if(is_array($data_array))
{
return $this->db->insert_batch($this->table_name, $data_array);
}
return false;
}
/**
* 修改数据
* @param $data
* @param $where
* @return mixed
*/
public function update($data, $where)
{
foreach($data as $k => $v)
{
if($v == null) {
if(strstr($k, ' = ')) {
$field = explode(' = ', $k);
$this->db->set($field[0], $field[1], FALSE);
unset($data[$k]);
}
}
}
$result = $this->db->update($this->table_name, $data, $where);
return $this->db->affected_rows() ? $this->db->affected_rows() : $result;
}
/**
* 更新或插入数据
* @param $data
* @return mixed
*/
public function replace($data)
{
if($data)
{
$result = $this->db->replace($this->table_name, $data);
return $this->db->affected_rows() ? $this->db->affected_rows() : $result;
}
return false;
}
/**
* 批量插入
* @param $data
* @return CI_DB_active_record
*/
public function replace_batch($data)
{
if($data && is_array($data[0]))
{
$keys = array_keys($data[0]);
$keys = implode(',', $keys);
$values = array();
foreach($data as $item)
{
$item_values = array_values($item);
foreach($item_values as &$v)
{
if(!is_numeric($v))
{
$v = addslashes($v);
$v = "'{$v}'";
}
}
$item_values = implode(',', $item_values);
$values[] = "({$item_values})";
}
$values = implode(',', $values);
$sql = "REPLACE {$this->table_name}({$keys}) VALUES {$values}";
return $this->db->query($sql);
}
}
/**
* 获取单条数据
* @param $where
* @param string $select
* @param object $obj 自定义结果对象
* @return mixed
*/
public function get($where, $select = '', $obj = '')
{
if($select)
{
$this->db->select($select, false);
}
if($obj && file_exists($class = COMMPATH.'libraries/entity/'.ucfirst($obj).'.php'))
{
require_once $class;
if (class_exists(ucfirst($obj)))
{
return $this->db->get_where($this->table_name, $where)->custom_row_object(0, $obj);
}
}
return $this->db->get_where($this->table_name, $where)->row_array();
}
/**
* 获取多条数据集
* @param array $where
* @param string $order
* @param int $page
* @param int $page_size
* @param string $select
* @param object obj
* @return mixed
*/
public function select($where = array(), $order = '', $page = 0, $page_size = 20, $select = '', $obj = '')
{
if($select)
{
$this->db->select($select, false);
}
if($where)
{
$this->db->where($where);
}
if($order)
{
$this->db->order_by($order);
}
if($page)
{
$offset = ($page - 1) * $page_size;
$limit = $page_size;
}
else
{
$offset = null;
$limit = null;
}
$this->db->from($this->table_name);
$this->db->limit($limit, $offset);
$query = $this->db->get();
$result = $query ? $query->result_array() : [];
if($obj && file_exists($class = APPPATH.'libraries/entity/'.ucfirst($obj).'.php'))
{
require_once $class;
if(class_exists($obj))
{
$result = $this->db->get($this->table_name, $limit, $offset)->custom_result_object($obj);
}
}
return $result;
}
/**
* @param $groupby
* @param array $where
* @param string $order
* @param int $page
* @param int $page_size
* @param string $select
* @param string $obj
* @return mixed
*/
public function select_groupby($groupby, $where = array(), $order = '', $page = 0, $page_size = 20, $select = '', $obj = ''){
$this->db->group_by($groupby);
return $this->select($where, $order, $page, $page_size, $select, $obj);
}
/**
* 获取最大值
* @param $field
* @param array $where
* @return mixed
*/
public function max($field, $where=array())
{
if($where)
{
$this->db->where($where);
}
if(is_array($field))
{
foreach($field as $v)
{
$this->db->select_max($v);
}
}
else
{
$this->db->select_max($field);
}
return $this->db->get($this->table_name)->row_array();
}
/**
* 获取最小值
* @param $field
* @param array $where
* @return mixed
*/
public function min($field, $where=array())
{
if($where)
{
$this->db->where($where);
}
if(is_array($field))
{
foreach($field as $v)
{
$this->db->select_min($v);
}
}
else
{
$this->db->select_min($field);
}
return $this->db->get($this->table_name)->row_array();
}
/**
* 删除
* @param array $where
* @return mixed
*/
public function delete($where = array())
{
$result = $this->db->delete($this->table_name, $where);
return $this->db->affected_rows() ? $this->db->affected_rows() : $result;
}
/**
* 将获取的数据集组装成map类型
* @param string $map_key
* @param string $map_value
* @param array $where
* @param string $order
* @param int $page
* @param int $page_size
* @param string $select
* @return array
*/
public function map($map_key = 'id', $map_value = '', $where = array(), $order = '', $page = 0, $page_size = 20, $select = '')
{
$map = array();
$list = $this->select($where, $order, $page, $page_size, $select);
if($list)
{
foreach($list as $item)
{
//指定列, map格式为{k:v}
if($map_value)
{
//指定列存在,取具体值,格式为{k:v},指定列不存在取全部列值,格式为{k:{k1:v1,k2:v2}}
$map[$item[$map_key]] = null !== $item[$map_value] ? $item[$map_value] : $item;
}
else
{//不指定列,表示一个k对应多个v,格式为{k:[{k1:v1,k2:v2},{k1:v1,k2:v2}]}
$map[$item[$map_key]][] = $item;
}
}
}
return $map;
}
/**
* 获取总条数
* @param array $where
* @param string $distinct
* @return mixed
*/
public function count($where = array(), $distinct = '')
{
if($where)
{
$this->db->where($where);
}
if($distinct)
{
$this->db->distinct();
$this->db->select($distinct, false);
}
return $this->db->count_all_results($this->table_name);
}
/**
* 获取某字段总和
* @param $field
* @param array $where
* @return mixed
*/
public function sum($field, $where = array())
{
if(is_array($field))
{
foreach($field as $v)
{
$this->select_sum($v);
}
}
else
{
$this->db->select_sum($field);
}
if($where)
{
$this->db->where($where);
}
return $this->db->get($this->table_name)->row_array();
}
/**
* 对方法的某个结果集做mc缓存【结果集为非对象数组】
* @param $func
* @param array $param
* @param string $ttl
* @return mixed
*/
public function mc_cache($func, $param = array(), $ttl = 0, $skey = '')
{
if(IF_MC_CACHE)
{
$cache = & load_cache('mc');
$cache_key = MC_CACHE_PREFIX.md5(get_called_class().'.'.$func.json_encode($param));
$ttl = is_numeric($ttl) ? $ttl : $this->mc_cache_expire;
$result = $cache->get($cache_key);
if($result === FALSE )
{
$result = call_user_func_array(array($this, $func), $param);
$cache->save($cache_key, $result, $ttl);
$this->add_cache_key(get_called_class(), $func, 'mc', $cache_key, $ttl, $skey);
}
return $result;
}
return call_user_func_array(array($this, $func), $param);
}
/**
* 删除某方法某个结果集的mc缓存【结果集为非对象数组】
* @param $func
* @param array $param
* @return mixed
*/
public function un_mc_cache($func, $param = array())
{
if(IF_MC_CACHE)
{
$cache = & load_cache('mc');
$cache_key = MC_CACHE_PREFIX.md5(get_called_class().'.'.$func.json_encode($param));
return $cache->delete($cache_key);
}
return false;
}
/**
* 对方法的某个结果集做redis缓存【结果集为非对象数组】
* @param $func
* @param array $param
* @param bool $force
* @return array|mixed
*/
public function redis_cache($func,$param = array())
{
if(IF_REDIS_CACHE)
{
$cache = & load_cache('redis');
$cache_key = REDIS_CACHE_PREFIX.md5(get_called_class().'.'.$func.json_encode($param));
if(!$result = $cache->get($cache_key))
{
$result = call_user_func_array(array($this, $func), $param);
$cache->save($cache_key, $result);
$this->add_cache_key(get_called_class(), $func, 'redis', $cache_key);
}
return $result;
}
return call_user_func_array(array($this, $func), $param);
}
/**
* 删除某方法某个结果集的redis缓存【结果集为非对象数组】
* @param $func
* @param array $param
* @return mixed
*/
public function un_redis_cache($func, $param = array())
{
if(IF_REDIS_CACHE)
{
$cache = & load_cache('redis');
$cache_key = REDIS_CACHE_PREFIX.md5(get_called_class().'.'.$func.json_encode($param));
return $cache->delete($cache_key);
}
return false;
}
/**
* 对某方法某个结果集的file缓存【结果集为非对象数组】
* @param $func
* @param array $param
* @return mixed
*/
public function file_cache($func, $param = array())
{
if(IF_FILE_CACHE)
{
$cache = & load_cache('file');
$cache_key = FILE_CACHE_PREFIX.get_called_class().'.'.$func.'_'.md5($param);
if(!$result = $cache->get($cache_key))
{
$result = call_user_func_array(array($this, $func), $param);
$cache->save($cache_key, $result, $this->file_cache_expire);
$this->add_cache_key(get_called_class(), $func, 'file', $cache_key);
}
return $result;
}
return call_user_func_array(array($this, $func), $param);
}
/**
* 删除某方法某个结果集的file缓存【结果集为非对象数组】
* @param $func
* @param array $param
* @return mixed
*/
public function un_file_cache($func, $param =array())
{
if(IF_FILE_CACHE)
{
$cache = & load_cache('file');
$cache_key = FILE_CACHE_PREFIX.get_called_class().'.'.$func.'_'.md5($param);
return $cache->delete($cache_key);
}
}
/**
* 清除cache
* @param $method
* @param $type
* @return bool
*/
public function del_cache($method, $type, $skey = '')
{
$cache = & load_cache($type);
$db = $this->load->database('default', true);
$where = $skey ? array("skey like '{$skey}'" => null) : array('class' => get_called_class(), 'method' => $method, 'cache_type' => $type);
$db->where($where);
$cache_list = $db->get('hd_cache_key')->result_array();
if($cache_list)
{
foreach($cache_list as $v)
{
$cache->delete($v['cache_key']);
}
}
$db->delete('hd_cache_key', $where);
return true;
}
private function add_cache_key($class, $method, $type, $key, $expire_time = 0, $skey = '')
{
$db = $this->load->database('default', true);
$data = array(
'class' => $class,
'method' => $method,
'cache_type' => $type,
'cache_key' => $key,
'expire_time' => time() + $expire_time,
'skey' => $skey ? $skey : ''
);
$result = $db->insert('hd_cache_key', $data);
return $this->db->insert_id() ? $this->db->insert_id() : $result;
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
/**
* Created by PhpStorm.
* User: lcc
* Date: 2020/3/24
* Time: 15:10
*/
class HD_Service
{
public $CI;
protected $log_dir;
public function __construct()
{
$this->CI = & get_instance();
$this->log_dir = lcfirst(get_class($this));
}
function __get($name){
if('_model' === substr($name, -6)){
return $this->CI->$name;
} elseif('_service' === substr($name, -8)){
return $this->CI->$name;
} elseif('load' == $name){
return $this->CI->load;
} elseif('config' == $name){
return $this->CI->config;
} elseif(isset($this->CI->$name)){
return $this->CI->$name;
}
return null;
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+33
View File
@@ -0,0 +1,33 @@
<?php
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2019/7/18
* Time: 16:03
*/
if(!function_exists('httpPostForm')){
/**
* 表单提交数据
* @param $url
* @param $data
* @return array
*/
function httpPostForm($url, $data){
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//https
if (strlen($url) > 5 && strtolower(substr($url, 0, 5)) == "https") {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return array($httpCode, $response);
}
}
+124
View File
@@ -0,0 +1,124 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018-12-25
* Time: 15:47
*/
if (! function_exists('week_format'))
{
function week_format($arr = array())
{
if (!$arr)
{
return '';
}
$arr = is_array($arr) ? $arr : array();
if (count($arr) >= 7)
{
return '每天';
}
$week_text = array('周一', '周二', '周三', '周四', '周五', '周六', '周日');
$res = array();
foreach ($arr as $key => $tmp)
{
if (!isset($week_text[$tmp]))
{
continue;
}
$res_len = count($res);
if ($res_len < 1)
{
array_push($res, array($tmp));
continue;
}
$pre = $res[$res_len - 1];
if ($tmp == $pre[count($pre) - 1] + 1)
{
array_push($res[$res_len - 1], $tmp);
}
else
{
array_push($res, array($tmp));
}
}
$res2 = array();
foreach ($res as $key => $value)
{
$len = count($value);
if ($len > 2)
{
array_push($res2, $week_text[$value[0]] . '到' . $week_text[$value[$len - 1]]);
}
elseif ($len > 1)
{
array_push($res2, $week_text[$value[0]], $week_text[$value[0]]);
}
else
{
array_push($res2, $week_text[$value[0]]);
}
}
return implode(',', $res2);
}
}
if (! function_exists('time_format'))
{
function time_format($arr = array())
{
if (!$arr)
{
return '';
}
$arr = is_array($arr) ? $arr : array();
$res = array();
foreach ($arr as $value)
{
array_push($res, $value === '00:00 - 23:59' ? '24小时' : $value);
}
return implode(',', $res);
}
}
if (!function_exists('filesize_format')) {
function filesize_format($num)
{
$p = 0;
$format = 'bytes';
if ($num > 0 && $num < 1024) {
$p = 0;
return number_format($num) . ' ' . $format;
}
if ($num >= 1024 && $num < pow(1024, 2)) {
$p = 1;
$format = 'KB';
}
if ($num >= pow(1024, 2) && $num < pow(1024, 3)) {
$p = 2;
$format = 'MB';
}
if ($num >= pow(1024, 3) && $num < pow(1024, 4)) {
$p = 3;
$format = 'GB';
}
if ($num >= pow(1024, 4) && $num < pow(1024, 5)) {
$p = 3;
$format = 'TB';
}
$num /= pow(1024, $p);
return number_format($num, 3) . ' ' . $format;
}
}
+121
View File
@@ -0,0 +1,121 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018-12-03
* Time: 21:39
*/
if (!function_exists('upload_content_image')) {
/**
* Notes:抓取网络图片
* Created on: 2020/1/14 14:21
* Created by: dengbw
* @param $content
* @return string|string[]|null
*/
function fetch_content_image($content, $path = '')
{
//解析内容
$content = preg_replace('/data-.*?["|\'](.*?)["|\']/', '', $content);
preg_match_all('/\<[img|IMG].*?src=["|\'](.*?)["|\'].*?\>/', $content, $match);
$ci = &get_instance();
$ci->load->library('qiniu');
if ($match[0]) {
foreach ($match[1] as $key => $val) {
if (!strstr($val, 'qimg')) {
$file = $ci->qiniu->fetch($val, getFileName($val, $path));
if (!$file) {
$content = str_replace($match[1][$key], "", $content);
continue;
} else {
$content = str_replace($match[1][$key], $file['url'], $content);
}
}
}
}
preg_match_all('/url\((.*?)\)/', $content, $match2);
if ($match2[0]) {
foreach ($match2[1] as $key => $val) {
if (!strstr($val, 'qimg')) {
$file = $ci->qiniu->fetch($val, getFileName($val, $path));
if (!$file) {
$content = str_replace($match2[1][$key], "", $content);
continue;
} else {
$content = str_replace($match2[1][$key], '&quot;' . $file['url'] . '&quot;', $content);
}
}
}
}
return $content;
}
function getFileName($file, $path = '')
{
$list = ['gif', 'jpg', 'png', 'bmp', 'jpeg']; //定义图片后缀数组
$pattern = "/" . implode("|", $list) . "/i"; //定义正则表达式
$patternList = array();
if (preg_match_all($pattern, $file, $matches)) { //匹配到了结果
$patternList = $matches[0]; //匹配到的数组
}
$ext = $patternList ? $patternList[0] : 'jpg';
$phoId = md5(uniqid() . mt_rand(0, 10000) . time());
$oriKey = 'p_' . $phoId . '.' . $ext;
// 上传到七牛后保存的文件名
$path = $path ? $path . "/" : '';
$photo = $path . date('Ym') . "/" . $oriKey;
return $photo;
}
function upload_content_image($content)
{
//解析内容
$content = preg_replace('/data-.*?["|\'](.*?)["|\']/', '', $content);
preg_match_all('/\<[img|IMG].*?src=["|\'](.*?)["|\'].*?\>/', $content, $match);
if ($match[0]) {
$ci = &get_instance();
$ci->load->library('qiniu');
foreach ($match[1] as $key => $val) {
if (!strstr($val, 'qimg')) {
$img = @file_get_contents($val);
$filename = $ci->qiniu->getFileName($val);
$filename = date('Y/m') . '/' . $filename;
$file = $ci->qiniu->save($filename, $img);
if (!$file) {
$content = str_replace($match[1][$key], "", $content);
continue;
} else {
$content = str_replace($match[1][$key], $file['url'], $content);
}
}
}
}
preg_match_all('/url\((.*?)\)/', $content, $match2);
if ($match2[0]) {
foreach ($match2[1] as $key => $val) {
if (!strstr($val, 'qimg')) {
$img = @file_get_contents($val);
$filename = $ci->qiniu->getFileName($val);
$filename = date('Y/m') . '/' . $filename;
$file = $ci->qiniu->save($filename, $img);
if (!$file) {
$content = str_replace($match2[1][$key], "", $content);
continue;
} else {
$content = str_replace($match2[1][$key], '&quot;' . $file['url'] . '&quot;', $content);
}
}
}
}
return $content;
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/6
* Time: 17:23
*/
defined('BASEPATH') OR exit('No direct script access allowed');
//操作节点对应值
if ( ! function_exists('action_node'))
{
function action_node($action = '')
{
$action_nodes = array(
ACTION_NODE_INDEX => 1,
ACTION_NODE_LIST => 2,
ACTION_NODE_GET => 3,
ACTION_NODE_ADD => 4,
ACTION_NODE_EDIT => 5,
ACTION_NODE_DEL => 6,
ACTION_NODE_BATCH => 7,
ACTION_NODE_EXPORT => 8,
);
if(isset($action_nodes[$action]))
{
return $action_nodes[$action];
}
return $action_nodes;
}
}
//操作节点对应名称
if ( ! function_exists('action_name'))
{
function action_name($action = '')
{
$action_names = array(
ACTION_NODE_INDEX => '首页',
ACTION_NODE_LIST => '列表',
ACTION_NODE_GET => '查看',
ACTION_NODE_ADD => '新增',
ACTION_NODE_EDIT => '编辑',
ACTION_NODE_DEL => '删除',
ACTION_NODE_BATCH => '批量操作',
ACTION_NODE_EXPORT => '导出',
);
if(isset($action_names[$action]))
{
return $action_names[$action];
}
return $action_names;
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/19
* Time: 10:29
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class adminlog{
public function index()
{
$CI = & get_instance();
$request = $CI->input->post();
$dir = $CI->router->fetch_directory() ? $CI->router->fetch_directory() : '';
$ctrl = $CI->router->fetch_class();
$methods = explode('_', $method = $CI->router->fetch_method());
$action = is_array(action_name($methods[0])) ? '' : action_name($methods[0]);
$node = DIRECTORY_SEPARATOR.$dir.$ctrl;
if($request && $dir)
{
$CI->load->model('sys/sys_admin_log_model');
$CI->load->model('sys/sys_menu_model');
$menu = $CI->sys_menu_model->get(array("url like '" . $node . "%'" => null, 'status' => 1));
//action_descrip 自定义操作描述
$descrip = $request['action_descrip'] ? $request['action_descrip'] : $menu['name'].' '.$action;
$log = array(
'admin_id' => $CI->uid,
'username' => $CI->username,
'target_id' => $request['id'] ? $request['id'] : 0,
'descrip' => $descrip,
'action' => $node.DIRECTORY_SEPARATOR.$method,
'ip' => get_client_ip(),
'jsondata' => json_encode($request, JSON_UNESCAPED_UNICODE),
);
$CI->sys_admin_log_model->add($log);
}
}
}
+311
View File
@@ -0,0 +1,311 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/7
* Time: 14:10
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
//session_start();
class Auth {
public $uid, $username, $role;
public function index()
{
$CI = &get_instance();
$cookie = $CI->input->cookie(LOGIN_COOKIE);
$CI->load->library('encryption');
$user_info = $CI->encryption->decrypt($cookie);
$CI->load->helper('sys');
$dir = $CI->router->fetch_directory() ? $CI->router->fetch_directory() : '';
$ctrl = $CI->router->fetch_class();
$mth = $CI->router->fetch_method();
$methods = explode('_', $mth);
$action = action_node($methods[0]);
$node = DIRECTORY_SEPARATOR.$dir.$ctrl;
$auth_match = array(1 => 'index', 2 => 'lists', 3 => 'get', 4 => 'add', 5 => 'edit', 6 => 'del', 7 => 'batch', 8 => 'export');
$CI->load->model('sys/sys_admin_model');
$CI->load->model('sys/sys_menu_model');
$CI->load->model('sys/sys_role_model');
$CI->load->model('sys/sys_city_model');
$CI->load->model('Area_model');
if($user_info = json_decode($user_info, true))
{
//登录ip判断
$admin_user = $CI->sys_admin_model->get(array('id' => $user_info['id']));
$ip = get_client_ip();
$ip_arr = array();
if(SUPER_ADMIN == $admin_user['role_id']){
//超级管理员免检
} else if($this->is_ignore($user_info['id'])){
//免检
} elseif(false !== strpos($_SERVER['HTTP_HOST'], "admin.dev.liche.cn") || false !== strpos($_SERVER['HTTP_HOST'], "admin.lc.haodian.cn")){
//开发测试免检
} elseif(filter_var($ip, FILTER_VALIDATE_IP) && $ip != $admin_user['login_ip']) {
// $CI->load->model('sys/sys_config_model');
// $config_ip = $CI->sys_config_model->select(array("v LIKE '%\"status\":\"1\"%'" => NULL,"k" => "site"));
// $ip_arr = array();
// foreach ($config_ip as $key => $value)
// {
// $ip_arr[] = json_decode($value['v'])->ip;
// }
// $ip_arr = array_merge($ip_arr, array_column($CI->sys_admin_model->select(array(),'','','','login_ip'), 'login_ip'));
// if(!in_array($ip, $ip_arr) && $dir)
// {
// if($admin_user['id'] > 10){//管理员id>10去掉验证码登录
// $admin_info = array(
// 'id' => $admin_user['id'],
// );
// $domain = explode('.', $_SERVER['HTTP_HOST']);
// array_shift($domain);
// $domain = implode('.', $domain);
// $CI->input->set_cookie(LOGIN_COOKIE, $CI->encryption->encrypt(json_encode($admin_info)), time() + 86400, $domain);
// $this->returnMsg('访问IP发生变化,请重新登录', '/login/check_view');
// }
// }
}
//权限分类筛选
$info = (array)json_decode($admin_user['other_json']);
if($admin_user['role_id'] == SUPER_ADMIN) {
$_SESSION['admin_role_id'] = '0';
} else {
if($info['city_id']) {
$province = $CI->Area_model->select(['city_id in ( '.implode(',', $info['city_id']).')' => null]);
$city = array_column($CI->sys_city_model->select(['status' => '0']), 'city_id');
foreach ($info['city_id'] as $key => $value) {
if(in_array($value, $city)) {
unset($info['city_id'][$key]);
}
}
$info['province_id'] = array_column($province, 'province_id');
$info['province_name'] = array_column($province, 'province_name');
}
$_SESSION['admin_role_id'] = $admin_user['role_id'];
$_SESSION['admin_info'] = $info;
}
$spm = $CI->input->get('spm');
//获取当前请求最符合的菜单节点
// $menus = $CI->sys_menu_model->select(array("url like '" . $node . "%'" => null, 'status' => 1), "id ASC");
// $menu = array();
// foreach($menus as $item){
// if(!$menu){
// $menu = $item;
// continue;
// }
// //节点更匹配的菜单
// $url_arr = explode('?', $item['url']);
// $url_arr2 = explode('?', $menu['url']);
// $url = $node . "/{$mth}";
//
// $p1 = strpos($url, $url_arr[0]);
// $p2 = strpos($url, $url_arr2[0]);
// //url匹配到method的优先级高
// if(0 === $p1 && 0 !== $p2){
// $menu = $item;
// continue;
// } elseif(0 !== $p1 && 0 === $p2) {
// continue;
// }
// if('index' == $mth){
// //访问index方法,有可能url里只到ct一级
// if((0 === $p1 || $node == $url_arr[0]) && (0 !== $p2 && $node != $p2)){
// $menu = $item;
// continue;
// } elseif(0 !== $p1 && $node != $url_arr[0] && (0 === $p2 || $node == $p2)) {
// continue;
// }
// } else {//非index,判断ct是否匹配
// $ct_arr1 = array_slice(explode('/', $url_arr[0]), -2);
// $ct_arr2 = array_slice(explode('/', $url_arr2[0]), -2);
// if(!in_array($ctrl, $ct_arr1)){
// continue;
// } elseif(!in_array($ctrl, $ct_arr2)){
// $menu = $item;
// continue;
// }
// }
//
// //匹配节点更高的项
// if(($spm && 0 !== strpos($menu['node'], $spm)) || strlen($item['node']) > strlen($menu['node'])){
// $menu = $item;
// continue;
// }
// }
$role = $CI->sys_role_model->get(array('id' => $admin_user['role_id']));
$action_json = $role['action_json'] ? json_decode($role['action_json'], true) : array();
$menus = $CI->sys_menu_model->select(array("url like '" . $node . "%'" => null, 'status' => 1), "id ASC");
foreach($menus as $item) {
if (isset($action_json[$item['id']])) {
$menu = $item;
break;
}
}
if($admin_user['role_id'] != SUPER_ADMIN && $dir)
{
if(!$admin_user['status'])
{
return $this->returnMsg('您的账号已被禁用');
}
else
{
$menu_ids = explode(',', $role['menu_ids']);
if(!$role['status'])
{
return $this->returnMsg('您的权限已被禁用');
} elseif('json' == $methods[0]){
//弹框等公共搜索使用,无需菜单权限校验
}
else
{
/*edit by xuxianbin 20190521 同一个url有可能对应多个节点*/
// $menu = $CI->sys_menu_model->get(array("url like '" . $node . "%'" => null, 'status' => 1));
if(!$action_json[$menu['id']])
{
return $this->returnMsg('系统菜单尚未创建');
}
if(!in_array($action, $action_json[$menu['id']]))
{
return $this->returnMsg('您的权限不足');
}
}
}
}
if($spm)
{
$spm_arr = explode('-', $spm);
if(!$menu_ids)
{
$role = $CI->sys_role_model->get(array('id' => $admin_user['role_id']));
$menu_ids = explode(',', $role['menu_ids']);
}
if(count($spm_arr) >= 5)
{
$four = $CI->sys_menu_model->select(array('pid' => $spm_arr[3], 'status' => 1), 'sort desc');
if($four)
{
$arr = $spm_arr;
foreach ($four as $v)
{
if($admin_user['role_id'] != SUPER_ADMIN && !in_array($v['id'], $menu_ids))
{
continue;
}
$active = $v['id'] == $spm_arr[4] ? true : false;
$arr[4] = $v['id'];
$CI->data['snavs'][] = array(
'active' => $active,
'spm' => implode('-', $arr),
'url' => $v['url'],
'name' => $v['name'],
);
}
}
}
//获取面包屑
$spm_arr1 = explode('-', $menu['node']);
$spm_arr1 && !is_numeric($spm_arr1[0]) && $spm_arr1 = array_slice($spm_arr1, 1);
if($spm_arr1){
$rows = $CI->sys_menu_model->select(array("id in (" . implode(",",$spm_arr1) . ")" => null, 'status' => 1), 'sort desc');
$menu_arr = array();
$breads = array();
foreach($rows as $row){
$menu_arr[$row['id']] = $row;
}
foreach($spm_arr1 as $v){
$item = $menu_arr[$v];
$breads[] = array(
'spm' => $item['node'],
'url' => '#' == $item['url'] ? '' : $item['url'],
'name' => $item['name'],
);
}
$CI->data['breads'] = $breads;
}
}
$CI->uid = $admin_user ? $admin_user['id'] : 0;
$CI->username = $admin_user ? $admin_user['username'] : '';
$CI->role = $admin_user ? $admin_user['role_id'] : 0;
}
elseif($ctrl != 'login')
{
header('location:/login');
}
return true;
}
/**
* 初始化app参数
*/
public function initapp(){
$Input = &load_class("Input", "core");
$Config = &load_class('Config', 'core');
$key_cookie = "hd_app_id";
$app_id = $Input->get_post("app_id");
if(!$app_id){
$app_id = $Input->cookie($key_cookie);
}
if($app_id){
$Input->set_cookie($key_cookie, $app_id, time() + 86400);
$Config->load('app', true, true);
$configs = $Config->item('app');
$config = $configs[$app_id];
//根据应用加载库
if($config['db']){
$GLOBALS['app_db'] = $config['db'];
}
}
}
private function returnMsg($msg = '网络错误', $url = '')
{
header('Content-Type:application/json; charset=utf-8');
echo json_encode(array('data' => $this->data, 'code' => 0, 'msg' => $msg, 'url' => $url, 'wait' => 2000), JSON_UNESCAPED_UNICODE);
exit;
}
/**
* 判断管理员是否免检
* @param $admin_id
* @return bool
*/
private function is_ignore($admin_id){
$CI = &get_instance();
$CI->load->model('sys/sys_config_model', 'config_model');
$where = array('k' => 'igadmin', 'v LIKE \'%"admin_id":"' .$admin_id. '"%\'' => null);
$exist = $CI->config_model->get($where);
if($exist){
$json = json_decode($exist['v'], true);
if($json['status']){
return true;
}
}
return false;
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/6
* Time: 17:23
*/
//系统
$lang[ERR_SYS_FAIL] = "操作失败";
$lang[ERR_SYS_SUCCESS] = "操作成功";
$lang[ERR_SYS_AUTH] = "权限不足";
$lang[ERR_SYS_INVAL_PARAM] = "非法参数";
//用户
$lang[ERR_USER_NOT_LOGIN] = "您还未登录";
$lang[ERR_USER_LOGIN_FAIL] = "帐号或密码错误";
$lang[ERR_ACCOUNT_NOT_EXISTS] = "帐号不存在";
$lang[ERR_MOBILE_EXISTS] = "手机号已存在";
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+28
View File
@@ -0,0 +1,28 @@
<form id="vue-app" class="am-form am-form-horizontal" action="/app/app/<?=$url?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<input type="hidden" value="<?=$item?$item['id']:''?>" name="id"/>
<div class="am-form-group ">
<label class="am-para-label">小程序名称:</label>
<div class="am-para-input">
<input type="text" placeholder="最多30个字符" name="name" value="<?=$item['name']?>" maxlength="30"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">logo</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="logo"><i class="am-icon-cloud-upload"></i> 上传logo</button>
<input type="hidden" name="logo" onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)" value="<?=$item['logo']?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="<?=$item['logo_src']?>"/>
</div>
</div>
</div>
<div class="am-form-group">
<div class="am-para-input"><button class="am-btn am-btn-success w100" type="submit">提交</button></div>
</div>
</form>
<script type="text/javascript">
</script>
+77
View File
@@ -0,0 +1,77 @@
<div class="coms-table-wrap">
<!-- no-border 去掉头部就有边控了-->
<div class="coms-table-hd clearfix no-border">
<form action="/app/app/lists" class="form-search" onsubmit="return false">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<div class="am-para-inline w150">
<input type="text" name="keyword" value="<?=$keyword?>" placeholder="请输入小程序名称"/>
</div>
</div>
<div class="am-form-group fl" style="margin-left: 10px">
<button id="search-btn" type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
</div>
<div class="am-form-group fl" style="margin-left: 10px">
<button type="button" data-modal="/app/app/get" class="am-btn am-btn-success am-btn-sm w100">新增</button>
</div>
<div class="am-form-group fr ml10" style="font-size: 15px;line-height: 32px;">
<span>共有<?=$pager['totle']?>条数据</span>
</div>
</div>
</form>
</div>
<div class="coms-table-bd">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="10%"><span>ID</span></th>
<th width="30%"><span>小程序名称</span></th>
<th width="10%"><span>发布审核</span></th>
<th width="20%"><span>创建时间</span></th>
<th width="20%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $key=> $item) {?>
<tr>
<td style="vertical-align:middle;word-wrap:break-word"><?=$item['id']?></td>
<td style="vertical-align:middle;word-wrap:break-word"><?=$item['name']?></td>
<td style="vertical-align:middle;word-wrap:break-word">
<input id="publish" type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" <?=$item['publish']?'checked':''?> onchange="set_publish(this,<?=$item['id']?>)"/>
</td>
<td style="vertical-align:middle;word-wrap:break-word"><?=$item['c_time']?></td>
<td style="vertical-align:middle;word-wrap:break-word">
<a class="am-btn am-btn-primary am-btn-xs mr10" href="javascript:void(0);" data-modal="/app/app/get?id=<?=$item['id']?>">详情</a>
<a class="am-btn am-btn-danger am-btn-xs mr10" data-ajax="post" data-params-id="<?=$item['id']?>" data-action="/app/app/del">删除</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
</div>
</div>
</div>
<script>
function set_publish(obj,id){
var value = '';
if($(obj).get(0).checked) {
value = 1;
}else{
value = 0;
}
var data = {'id':id,'value':value};
$.post('/app/app/edit_publish',data,function(result){
if(result.code){
layer.msg(result.msg, {time: 2000,icon:1 }, function () {
$.form.reload();
});
}else{
layer.msg(result.msg,{icon:2});
}
},'json')
}
</script>
+17
View File
@@ -0,0 +1,17 @@
<form class="am-form am-form-horizontal" action="<?=$url?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<div class="am-form-group">
<label class="am-para-label">手机号:</label>
<div class="am-para-input"><input type="text" placeholder="手机号" name="mobile" value="<?=$mobile?>"/></div>
</div>
<div class="am-form-group">
<label class="am-para-label">内容:</label>
<div class="am-para-input"><textarea name="content"><?=$content?></textarea></div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="submit">发送</button></div>
</div>
</form>
+587
View File
@@ -0,0 +1,587 @@
<form id="vue-edit" class="am-form am-form-horizontal" action="<?= $action ?>" data-auto="true" method="post"
style="width: 90%;padding-top: 10px">
<input type="hidden" name="id" value="<?= $row['id'] ?>"/>
<div class="am-form-group">
<label class="am-para-label w120">姓名:</label>
<div class="am-para-input w300" style="margin-left: 130px">
<input type="text" placeholder="输入姓名" name="uname" v-model="info.uname" maxlength="30"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w120">手机号:</label>
<div class="am-para-input w300" style="margin-left: 130px">
<input type="text" placeholder="输入手机号" name="mobile" v-model="info.mobile" maxlength="30"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w120">默认角色:</label>
<div class="am-para-input w100" style="margin-left: 130px">
<select name="group_id" v-model="info.group_id" @change="resetBiz">
<option value="">选择角色</option>
<option :value="i" v-for="(v,i) in groups">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group" v-if="info.group_id==4">
<label class="am-para-label w120">默认角色城市:</label>
<div class="am-para-input w100" style="margin-left: 130px">
<select v-model="info.city_id">
<option value="0">选择城市</option>
<option :value="v.city_id" v-for="(v,i) in show_info.cityList">{{v.name}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w120">默认角色门店:</label>
<div class="am-para-input lh-default" style="margin-left: 130px">
<button class="am-btn am-btn-default" type="button" @click="brandModal">选择门店</button>
<div class="mt5">
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal"
v-for="(item) in selectedBrands">{{item.name}}
</button>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w120">第二角色:</label>
<div class="am-para-input w100" style="margin-left: 130px">
<select name="group_id1" v-model="info.group_id1" @change="resetBiz1">
<option value="0">选择角色</option>
<option :value="i" v-for="(v,i) in groups">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group" v-if="info.group_id1==4">
<label class="am-para-label w120">第二角色城市:</label>
<div class="am-para-input w100" style="margin-left: 130px">
<select v-model="info.city_id1">
<option value="0">选择城市</option>
<option :value="v.city_id" v-for="(v,i) in show_info.cityList">{{v.name}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w120">第二角色门店:</label>
<div class="am-para-input lh-default" style="margin-left: 130px">
<button class="am-btn am-btn-default" type="button" @click="brandModal1">选择门店</button>
<div class="mt5">
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal1"
v-for="(item) in selectedBrands1">{{item.name}}
</button>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-success" type="button" @click='saveEdit'>提交</button>
</div>
</div>
<div id="brand-modal" style="display:none">
<div class="modal-body">
<div class="header">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<div class="am-form-group am-para-inline w150">
<select title="城市" v-model="search_info.city_id">
<option value="0">城市</option>
<template v-for="(v,i) in cityAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="行政区" v-model="search_info.county_id">
<option value="0">行政区</option>
<template v-for="(v,i) in countyAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="类型" v-model="search_info.type">
<option value="0">类型</option>
<template v-for="(v,i) in show_info.typeAry">
<option :value="i">{{v}}</option>
</template>
</select>
</div>
<div class="am-form-group fl ml10">
<a class="am-btn am-btn-success am-btn-sm w100" @click="search()">搜索</a>
</div>
</div>
</div>
<div style="padding-top: 10px;">
<div class="vuetable-body-wrapper">
<table class="vuetable table table-middle table-hover fixed">
<colgroup>
<col class="vuetable-col-title" style="width: 50%;">
<col class="vuetable-col-actions text-right" style="width: 10%;">
</colgroup>
<thead>
<tr>
<th class="vuetable-th-slot-title">商家名</th>
<th class="vuetable-th-slot-actions text-right">操作</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody class="vuetable-body">
<tr v-for="(v,i) in brandsList">
<td class="vuetable-slot">
{{v.name}}
</td>
<td class="vuetable-slot text-right">
<button type='button' v-if="v.is_checked==0 || !v.is_checked"
class="btn btn-sm btn-success"
@click="addItem(i)">添加
</button>
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
@click="removeItem(v)">删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clearfix">
<span class="pull-left text-muted">{{brandsPage.page}}(每页{{brandsPage.pageLimit}},{{brandsPage.pageCount}})</span>
<nav class="pull-right" aria-label="Page navigation">
<ul class="pagination pagination-sm">
<li>
<a href="javascript:void(0);" @click="beforeShopPage();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="brandsPage.hasNext">
<a href="javascript:void(0);" @click="afterShopPage();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="brand-modal1" style="display:none">
<div class="modal-body">
<div class="header">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<div class="am-form-group am-para-inline w150">
<select title="城市" v-model="search_info.city_id1">
<option value="0">城市</option>
<template v-for="(v,i) in cityAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="行政区" v-model="search_info.county_id1">
<option value="0">行政区</option>
<template v-for="(v,i) in countyAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="类型" v-model="search_info.type1">
<option value="0">类型</option>
<template v-for="(v,i) in show_info.typeAry">
<option :value="i">{{v}}</option>
</template>
</select>
</div>
<div class="am-form-group fl ml10">
<a class="am-btn am-btn-success am-btn-sm w100" @click="search1()">搜索</a>
</div>
</div>
</div>
<div style="padding-top: 10px;">
<div class="vuetable-body-wrapper">
<table class="vuetable table table-middle table-hover fixed">
<colgroup>
<col class="vuetable-col-title" style="width: 50%;">
<col class="vuetable-col-actions text-right" style="width: 10%;">
</colgroup>
<thead>
<tr>
<th class="vuetable-th-slot-title">商家名</th>
<th class="vuetable-th-slot-actions text-right">操作</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody class="vuetable-body">
<tr v-for="(v,i) in brandsList1">
<td class="vuetable-slot">
{{v.name}}
</td>
<td class="vuetable-slot text-right">
<button type='button' v-if="v.is_checked==0 || !v.is_checked"
class="btn btn-sm btn-success"
@click="addItem1(i)">添加
</button>
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
@click="removeItem1(v)">删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clearfix">
<span class="pull-left text-muted">{{brandsPage.page}}(每页{{brandsPage.pageLimit}},{{brandsPage.pageCount}})</span>
<nav class="pull-right" aria-label="Page navigation">
<ul class="pagination pagination-sm">
<li>
<a href="javascript:void(0);" @click="beforeShopPage1();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="brandsPage.hasNext">
<a href="javascript:void(0);" @click="afterShopPage1();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</form>
<script type="text/javascript">
var vue_app;
var loading = false;
$(function () {
vue_app = new Vue({
el: '#vue-edit',
data: {
info: {},
groups: [],
biz: {bizAry: [], biz_id: ''},
brandsThPage: 0,
brandsPage: [],
bizIds: [],
brandsList: [],
brandsList1: [],
selectedBrands: [],
selectedBrands1: [],
cityAry: [],
countyAry: [],
show_info: {cityList: [], typeAry: []},
search_info: {city_id: 0, county_id: 0, type: 0, city_id1: 0, county_id1: 0, type1: 0}
},
computed: {},
created: function () {
},
updated: function () {
},
mounted: function () {
var vm = this;
vm.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
vm.groups = <?=json_encode($groups, JSON_UNESCAPED_UNICODE)?>;
vm.selectedBrands = <?=json_encode($selectedBrands, JSON_UNESCAPED_UNICODE)?>;
vm.selectedBrands1 = <?=json_encode($selectedBrands1, JSON_UNESCAPED_UNICODE)?>;
vm.show_info = <?=json_encode($show_info, JSON_UNESCAPED_UNICODE)?>;
vm.init_citys();
},
methods: {
resetBiz: function () {
this.selectedBrands = [];
},
resetBiz1: function () {
this.selectedBrands1 = [];
},
search: function () {
this.changePage(1);
},
changePage: function (page) {
var that = this;
that.brandsThPage = page;
return this.brandModal();
},
beforeShopPage: function () {
var vm = this;
if (vm.brandsThPage == 1) {
alert('已经是第一页了');
return;
}
vm.brandsThPage--;
return this.brandModal();
},
afterShopPage: function () {
var vm = this;
vm.brandsThPage++;
return this.brandModal();
},
addItem: function (index) {
var vm = this;
var brand_id;
var biz_id;
biz_id = vm.brandsList[index]['id'];
var _shop = {
biz_id: biz_id,
name: vm.brandsList[index]['name'],
};
if (vm.info.group_id == 4) {
vm.selectedBrands.push(_shop);
vm.brandsList[index]['is_checked'] = 1;
} else {
vm.selectedBrands = [];
vm.selectedBrands.push(_shop);
this.brandsList.map(function (_item, _index) {
if (vm.brandsList[index]['id'] == _item['id']) {
vm.brandsList[_index]['is_checked'] = 1;
} else {
vm.brandsList[_index]['is_checked'] = 0;
}
})
}
},
removeItem: function (item) {
var vm = this;
if (vm.info.group_id == 4) {
this.selectedBrands = this.selectedBrands.filter(function (_item) {
var id = _item.biz_id > 0 ? _item.biz_id : _item.brand_id;
return id != item.id;
})
} else {
vm.selectedBrands = [];
}
this.brandsList.map(function (_item, _index) {
if (item.id == _item.id) {
vm.brandsList[_index].is_checked = 0;
}
})
},
//选择商家
brandModal: function () {
var that = this;
layer.open({
type: 1,
area: ['55%', '80%'], //宽高
content: $('#brand-modal'),
title: '选择商家',
shade: false,
btn: ['选好了'],
yes: function (index) {
layer.close(index);
}
});
$.ajax({
url: '/common/shop_app',
type: 'post',
dataType: 'json',
data: {
page: that.brandsThPage,
type: that.search_info.type,
city_id: that.search_info.city_id,
county_id: that.search_info.county_id,
types:'1,2,3',
},
success: function (json) {
var brandsList = json.data.shopList;
that.brandsPage = json.data.shopPage;
brandsList.map(function (_item, _index) {
for (var index in that.selectedBrands) {
var item = that.selectedBrands[index];
var id = that.sys_type_id == 1 ? item.brand_id : item.biz_id;
if (id == _item.id) {
brandsList[_index].is_checked = 1;
break;
} else {
brandsList[_index].is_checked = 0;
}
}
})
that.brandsList = brandsList;
}
});
},
//group_id1
search1: function () {
this.changePage1(1);
},
changePage1: function (page) {
var that = this;
that.brandsThPage = page;
return this.brandModal1();
},
beforeShopPage1: function () {
var vm = this;
if (vm.brandsThPage == 1) {
alert('已经是第一页了');
return;
}
vm.brandsThPage--;
return this.brandModal1();
},
afterShopPage1: function () {
var vm = this;
vm.brandsThPage++;
return this.brandModal1();
},
addItem1: function (index) {
var vm = this;
var brand_id;
var biz_id;
biz_id = vm.brandsList1[index]['id'];
var _shop = {
biz_id: biz_id,
name: vm.brandsList1[index]['name'],
};
if (vm.info.group_id1 == 4) {
vm.selectedBrands1.push(_shop);
vm.brandsList1[index]['is_checked'] = 1;
} else {
vm.selectedBrands1 = [];
vm.selectedBrands1.push(_shop);
this.brandsList1.map(function (_item, _index) {
if (vm.brandsList1[index]['id'] == _item['id']) {
vm.brandsList1[_index]['is_checked'] = 1;
} else {
vm.brandsList1[_index]['is_checked'] = 0;
}
})
}
},
removeItem1: function (item) {
var vm = this;
if (vm.info.group_id1 == 4) {
this.selectedBrands1 = this.selectedBrands1.filter(function (_item) {
var id = _item.biz_id > 0 ? _item.biz_id : _item.brand_id;
return id != item.id;
})
} else {
vm.selectedBrands1 = [];
}
this.brandsList1.map(function (_item, _index) {
if (item.id == _item.id) {
vm.brandsList1[_index].is_checked = 0;
}
})
},
brandModal1: function () {
var that = this;
layer.open({
type: 1,
area: ['55%', '80%'], //宽高
content: $('#brand-modal1'),
title: '选择商家',
shade: false,
btn: ['选好了'],
yes: function (index) {
layer.close(index);
}
});
$.ajax({
url: '/common/shop_app',
type: 'post',
dataType: 'json',
data: {
page: that.brandsThPage,
type: that.search_info.type1,
city_id: that.search_info.city_id1,
county_id: that.search_info.county_id1,
types:'1,2,3',
},
success: function (json) {
var brandsList1 = json.data.shopList;
that.brandsPage = json.data.shopPage;
brandsList1.map(function (_item, _index) {
for (var index in that.selectedBrands1) {
var item = that.selectedBrands1[index];
var id = that.sys_type_id == 1 ? item.brand_id : item.biz_id;
if (id == _item.id) {
brandsList1[_index].is_checked = 1;
break;
} else {
brandsList1[_index].is_checked = 0;
}
}
})
that.brandsList1 = brandsList1;
}
});
},
init_citys: function () {
var vm = this;
$.get('common/area', {id: '350', key: 'city', type: 1}, function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
});
if (vm.search_info.city_id > 0) {
$.get('common/area', {id: vm.search_info.city_id, key: 'county', type: 1}, function (response) {
if (response.code == 1) {
vm.countyAry = response.data;
}
});
}
},
saveEdit: function () {
if (loading) {
return;
}
var vm = this;
vm.info.bizs = vm.selectedBrands;
vm.info.bizs1 = vm.selectedBrands1;
loading = true;
$.ajax({
url: '<?=$action?>',
type: 'post',
dataType: 'json',
data: {
info: vm.info
},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (data) {
loading = false;
if (data.code) {
layer.msg(data.msg, {
icon: 1,
time: 2000
}, function () {
window.location.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
loading = false;
layer.closeAll('loading');
}
});
}
},
watch: {
'search_info.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.countyAry = [];
that.search_info.county_id = 0;
} else {
$.get('common/area', {id: nv, key: 'county', type: 1}, function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
});
}
},
}
});
});
</script>
+248
View File
@@ -0,0 +1,248 @@
<div class="coms-table-wrap mt10">
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/app/licheb/member/index">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">昵称:</label>
<div class="am-para-inline w150">
<input type="text" name="name" value="<?= $name ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">手机号码:</label>
<div class="am-para-inline w150">
<input type="text" name="mobile" value="<?= $mobile ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">默认角色:</label>
<div class="am-para-inline w150">
<select name="group_id">
<option value="">全部</option>
<?php foreach ($groupAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['group_id'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w100">状态:</label>
<div class="am-para-inline w150">
<select name="status">
<option value="">全部</option>
<option value="1" <?= 1 == $params['status'] ? 'selected' : '' ?>>正常</option>
<option value="0" <?= strlen($params['status']) && 0 == $params['status'] ? 'selected' : '' ?>>禁用</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">默认门店:</label>
<div class="am-form-group am-para-inline w150">
<select title="城市" name="city_id" v-model="params.city_id">
<option value="">城市</option>
<option :value="v.id" v-for="(v,i) in cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="行政区" name="county_id" v-model="params.county_id">
<option value="">行政区</option>
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="门店" name="biz_id" v-model="params.biz_id">
<option value="">选择门店</option>
<option :value="v.id" v-for="(v,i) in bizAry">{{v.title}}</option>
</select>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<button type="button" data-open="/app/licheb/member/get" class="am-btn am-btn-success am-btn-sm w100">
添加用户
</button>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="10%"><span>ID</span></th>
<th width="20%"><span>姓名</span></th>
<th width="20%"><span>手机号码</span></th>
<th width="20%"><span>默认角色</span></th>
<th width="20%"><span>默认门店</span></th>
<th width="20%"><span>第二角色</span></th>
<th width="20%"><span>第二角色门店</span></th>
<th width="20%"><span>创建时间</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['uname'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['group_name'] ?></td>
<td><?= $v['biz_name'] ?></td>
<td><?= $v['group_name1'] ?></td>
<td><?= $v['biz_name1'] ?></td>
<td><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
</tr>
<tr>
<td colspan="8" class="align-r">
<input type="hidden" class="id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
<select data-update-group="" data-list-target=".id-<?= $v['id'] ?>"
data-action="/app/licheb/member/batch" data-field=""
style="height: 30px;width: 70px;">
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>禁用</option>
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>正常</option>
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
</select>
<a data-open="/app/licheb/member/get?id=<?= $v['id'] ?>"
class="am-btn am-btn-primary am-btn-xs">修改</a>
<? if ($v['umajia']) { ?>
<a class="am-btn am-btn-primary am-btn-xs"
data-open="/app/appusual/umajia/get?uid=<?= $v['id'] ?>&app_id=<?= $app_id ?>"
data-title="编辑马甲">编辑马甲</a>
<a href="javascript:void(0)" data-ajax="post"
data-action="/app/appusual/umajia/del?app_id=<?= $app_id ?>"
data-params-uid="<?= $v['id'] ?>" class="am-btn am-btn-xs am-btn-danger">脱去马甲</a>
<? } elseif (isset($v['umajia'])) { ?>
<a class="am-btn am-btn-primary am-btn-xs"
data-open="/app/appusual/umajia/get?uid=<?= $v['id'] ?>&app_id=<?= $app_id ?>"
data-title="披上马甲">披上马甲</a>
<? } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vm = new Vue({
el: '#vue-app',
data: {
params: [],
cityAry: [],//城市
countyAry: [],//行政区
bizAry: [],
province_id: '350'
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.init_citys(vm.province_id);
},
methods: {
init_citys: function (province_id) {
var vm = this;
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: province_id,
key: 'city',
type: 1
},
success: function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
}
});
},
get_bizs: function () {
var that = this;
if (that.params.city_id > 0 || that.params.county_id > 0) {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
province_id: that.province_id,
city_id: that.params.city_id,
county_id: that.params.county_id,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.bizAry = response.data.list;
if (that.params.biz_id > 0) {
var biz_id = '';
for (var i in that.bizAry) {
if (that.params.biz_id == that.bizAry[i].id) {
biz_id = that.params.biz_id;
break;
}
}
that.params.biz_id = biz_id;
}
}
}
});
} else {
that.bizAry = [];
that.params.biz_id = '';
}
}
},
watch: {
'params.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.countyAry = [];
that.params.county_id = '';
} else {
if (nv.substring(0, 4) != that.params.county_id.substring(0, 4)) {
that.params.county_id = '';
}
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: nv,
key: 'county',
type: 1
},
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
}
});
}
that.get_bizs();
},
'params.county_id': function (nv, ov) {
var that = this;
that.get_bizs();
}
}
});
$(function () {
<?php page_script($pager) ?>
});
$('#majia').change(function () {
$('#vue-app').submit();
});
$('#dealer').change(function () {
$('#vue-app').submit();
});
</script>
+100
View File
@@ -0,0 +1,100 @@
<style>
.section-mod-1 {
border: 1px solid #e5e5e5
}
.section-mod-1 .caption {
height: 40px;
line-height: 40px;
background: #f2f2f2;
text-align: left;
padding: 0 15px
}
.mod-1-item {
position: relative;
padding-left: 120px;
border-bottom: 1px solid #e5e5e5;
padding-bottom: 20px
}
.mod-1-item:last-child {
border: none
}
.mod-1-item .cpic-icon {
position: absolute;
top: 50%;
margin-top: -24px;
left: 20px
}
.mod-1-item ul li {
float: left;
margin-top: 15px;
min-width: 150px;
margin-right: 30px
}
.mod-1-item ul li p {
margin: 0
}
.mod-1-item ul li .tit {
color: #666
}
.mod-1-item ul li .num {
line-height: 38px;
font-family: arial;
font-size: 25px;
color: #5fb878;
margin-top: 5px;
font-weight: 700
}
.mod-1-item ul li .c-btn {
margin-top: 15px
}
</style>
<!-- table 表格样式************************************* -->
<div class="section-mod-1 mb10">
<p class="caption">应用状况</p>
<?foreach($conditions as $condition){?>
<div class="mod-1-item clearfix">
<p class="cpic-icon"><i class="am-icon-btn am-success <?=$condition['icon']?>"></i></p>
<ul class="clearfix">
<?foreach($condition['list'] as $li){?>
<li>
<p class="tit"><?=$li['title']?></p>
<p class="num"><?=$li['value']?></p>
<?
if (is_array($li['values'])) {
foreach ($li['values'] as $li2) { ?>
<p class="num" style="font-size: 14px;line-height: 18px;">
<a href="javascript:;" data-open="<?= $li2['url'] ?>">
<?= $li2['name'] ?><?= $li2['value'] ?></a></p>
<? }
} ?>
<?foreach($li['btns'] as $btn){?>
<?if(isset($btn['_blank'])&&$btn['_blank']){?>
<a href="<?=$btn['url']?>" target="_blank" class="c-btn am-btn am-btn-primary am-btn-xs"><?=$btn['name']?></a>
<?}else if($li['type'] == 'modal') {?>
<a href="javascript:;" data-modal="<?=$btn['url']?>" class="c-btn am-btn am-btn-primary am-btn-xs"><?=$btn['name']?></a>
<?}else if($li['type'] == 'ajax') {?>
<a href="javascript:;" data-ajax="post" data-action="<?=$btn['url']?>" class="c-btn am-btn am-btn-primary am-btn-xs"><?=$btn['name']?></a>
<?}else{?>
<a href="javascript:;" data-open="<?=$btn['url']?>" class="c-btn am-btn am-btn-primary am-btn-xs <?=$btn['url'] ? '' : 'am-disabled'?>"><?=$btn['name']?></a>
<?}?>
<?}?>
</li>
<?}?>
</ul>
</div>
<?}?>
</div>
<script>
<?=$js?>
</script>
+29
View File
@@ -0,0 +1,29 @@
<form class="am-form am-form-horizontal" action="/app/profinish/edit" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<div class="am-form-group">
<label class="am-para-label w150">子商户号:</label>
<div class="am-para-input">
<input type="text" placeholder="子商户号" name="sub_mchid" value="" style="width:300px;display:inline"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w150">微信支付订单号:</label>
<div class="am-para-input">
<input type="text" placeholder="微信支付订单号" name="transaction_id" value="" style="width:300px;display:inline"/>
<span class="text-success mt10">支付transaction_id</span>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w150">分账描述:</label>
<div class="am-para-input">
<textarea style="width:80%" name="description">已完成分账</textarea>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="submit">确定</button>
<a target="_blank" href="/log/admin/<?=date('Y')?>/<?=date('m')?>/<?=date('d')?>/wxapi/<?=$log_file?>" class="am-btn am-btn-default" type="submit">查看今日日志</a>
</div>
</div>
</form>
+65
View File
@@ -0,0 +1,65 @@
<script type="text/javascript">
var vm = new Vue({
el: '#area',
data: {
province_id: '',
city_id: '',
county_id: '',
province: JSON.parse('<?=json_encode($province)?>'),
city: [],
county: [],
},
methods: {
getCity: function(index) {
$.get('/common/area',{pid:_self.cate_id}, function (res) {
_self.lists.level2 = res.data;
},'json');
var c = JSON.parse('<?=json_encode($this->data['map']['city'])?>');
var tmp = new Array;
for(var i in c) {
if(c[i].province_id == index) {
tmp.push(c[i]);
}
}
this.city = tmp;
this.init();
this.county = '';
$('#city1').val('市');
$('#county1').val('区');
return true;
},
getCounty: function(index) {
var c = JSON.parse('<?=json_encode($this->data['map']['county'])?>');
var tmp = new Array;
for(var i in c) {
if(c[i].city_id == index) {
tmp.push(c[i]);
}
}
this.county = tmp;
$('#county_id1').find('option').eq(0).text('区');
$('#county_id1').find('option').eq(0).attr('value','');
$('#county1').val('区');
this.county_id = '';
return true;
},
init: function(index) {
$('#city_id1').find('option').eq(0).text('市');
$('#city_id1').find('option').eq(0).attr('value','');
this.city_id = '';
$('#county_id1').find('option').eq(0).text('区');
$('#county_id1').find('option').eq(0).attr('value','');
this.county_id = '';
},
setProvince: function(index) {
$('#province1').val($('#province_id1').find('option:selected').text());
},
setCity: function(index) {
$('#city1').val($('#city_id1').find('option:selected').text());
},
setCounty: function(index) {
$('#county1').val($('#county_id1').find('option:selected').text());
}
}
})
</script>
+30
View File
@@ -0,0 +1,30 @@
<form class="am-form am-form-horizontal" action="<?=$info?'/auto/brand/edit':'auto/brand/add'?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<input type="hidden" value="<?=$info['id']?>" name="id">
<div class="am-form-group">
<label class="am-para-label">品牌名称:</label>
<div class="am-para-input">
<input type="text" placeholder="输入品牌名称" name="name" value="<?=$info['name']?>"/>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0">
<label class="am-para-label">logo</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="img"><i class="am-icon-cloud-upload"></i> 选择要上传的文件
</button>
<input type="hidden" name="img" value="<?= $info['logo'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;max-width:32px"
src="<?= $info['logo'] ? build_qiniu_image_url($info['logo']) : '' ?>"/>
尺寸100x100
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="submit">保存</button>
</div>
</div>
</form>
+99
View File
@@ -0,0 +1,99 @@
<div class="coms-table-wrap mt10">
<form class="form-search" onsubmit="return false" action="/auto/brand/lists">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">品牌名称:</label>
<div class="am-para-inline w200">
<input type="text" name="title" v-model="params.title"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">状态:</label>
<div class="am-para-inline w150">
<select name="status" v-model="params.status">
<option value="all">所有</option>
<option v-for="(item,index) in status_arr" :value="index">{{item}}</option>
</select>
</div>
</div>
<div class="am-form-group fl ml10">
<label class="am-para-label w50"></label>
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<button type="button" data-title="新增品牌" data-modal="/auto/brand/get" class="am-btn am-btn-success w100">新增</button>
</div>
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
共有<?= $pager['totle'] ?>条数据
</div>
</div>
</form>
<div class="coms-table-bd">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="10%"><span>ID</span></th>
<th width="20%"><span>品牌名称</span></th>
<th width="10%"><span>状态</span></th>
<th width="15%"><span>创建时间</span></th>
<th width="35%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['name'] ?></td>
<td><?= $v['status_name'] ?></td>
<td><?= $v['c_time'] ?></td>
<td>
<?php if ($v['status'] > -1) { ?>
<a href="javascript:void (0);" data-title="编辑品牌" data-modal="/auto/brand/get?id=<?= $v['id'] ?>"
class="am-text-primary"><?= '编辑' ?></a>
<?php } ?>
<?php if ($v['status'] == 1) { ?>
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
<?php }
elseif ($v['status'] == 0) { ?>
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
<?php } ?>
<?php if ($v['status'] > -1) { ?>
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vue_obj;
var loading = 0;
$(function(){
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params:[],
status_arr: []
},
mounted:function() {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.status_arr = <?=json_encode($status_arr)?>;
},
methods:{},
watch:{}
});
<?php page_script($pager) ?>
});
</script>
+216
View File
@@ -0,0 +1,216 @@
<div class="coms-table-wrap">
<div class="coms-table-hd clearfix no-border">
<form action="/auto/cars/lists" class="form-search" onsubmit="return false">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label">车辆属性:</label>
<div class="am-para-inline w150">
<select name="brand_id" v-model="params.brand_id">
<option value="">选择品牌</option>
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
</select>
</div>
<div class="am-para-inline w150">
<select name="s_id" v-model="params.s_id">
<option value="">选择车系</option>
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label">状态:</label>
<div class="am-para-inline w150">
<select name="status" v-model="params.status">
<option value="">全部</option>
<option :value="i" v-for="(v,i) in statusAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl ml20">
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
</div>
</div>
</form>
</div>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%">
<label><input type="checkbox" data-check-target=".ids"></label>
<span>ID</span>
</th>
<th width="10%"><span>车型id</span></th>
<th width="10%"><span>品牌</span></th>
<th width="10%"><span>车系</span></th>
<th width="20%"><span>车型</span></th>
<th width="8%"><span>状态</span></th>
<th width="10%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<template v-for="(v,i) in lists">
<tr >
<td>
<label><input type="checkbox" name="ids[]" class="ids" :value="v.id"/></label>
<span>{{v.id}}</span>
</td>
<td>{{v.third_car_id}}</td>
<td>{{v.brand}}</td>
<td>{{v.series}}</td>
<td>{{v.name}}</td>
<td>{{statusAry[v.status]}}</td>
<td>
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-danger am-btn-xs"
data-field="status" data-value="0" v-if="1==v.status">关闭</a>
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-success am-btn-xs"
data-field="status" data-value="1" v-if="0==v.status">开启</a>
</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
<label class="fl mr5"><input type="checkbox" data-check-target=".ids">全选</label>
<div class="am-para-inline w120">
<select data-update-group="" data-list-target=".ids" data-action="/auto/cars/edit_status"
data-field="status">
<option value="">批量操作</option>
<option value="0">关闭</option>
<option value="1">开启</option>
</select>
</div>
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vue_obj;
var loading = 0;
$(function(){
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params:[],
lists:[],
statusAry:[],
brandAry:[],
seryAry:[],
attrvAry:[],
info_edit:{}
},
mounted:function() {
var vm = this;
var lists = [];
lists = <?=json_encode($lists)?>;
vm.params = <?=json_encode($params)?>;
vm.statusAry = <?=json_encode($statusAry)?>;
vm.brandAry = <?=json_encode($brandAry)?>;
for(var i in lists){
lists[i].edit = 0;
}
vm.lists = lists;
},
methods:{
set_edit:function(index, type){
var vm = this;
var row = vm.lists[index];
if(1 == type){
if(undefined != vm.info_edit.index){
//旧的编辑取消
vm.lists[vm.info_edit.index].edit = 0;
}
row.edit = 1;
vm.info_edit = JSON.parse(JSON.stringify(row));
vm.info_edit.index = index;
} else {
row.edit = 0;
vm.info_edit = {};
}
},
save_edit:function(){
var vm = this;
if(1 == loading){
return 0;
}
loading = 1;
$.ajax({
url: 'auto/cars/edit',
type: 'post',
dataType: 'json',
data: {info:vm.info_edit},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (data) {
loading = 0;
if (data['code']) {
layer.msg(data.msg, {
icon: 1,
time: 2000
}, function () {
$.form.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
loading = 0;
layer.closeAll('loading');
}
});
}
},
watch:{
'params.brand_id':function(nv, ov){
var vm = this;
vm.seryAry = {};
if(nv > 0){
$.ajax({
url: '/auto/series/json_lists',
type: 'post',
dataType: 'json',
data: {brand_id:nv},
beforeSend: function () {},
success: function (data) {
if (1 == data.code) {
var lists = data.data.list;
var seryAry = {};
for (var i in lists){
var row = lists[i];
seryAry[row.id] = row.name;
}
vm.seryAry = seryAry;
if(vm.params.s_id>0 && undefined == seryAry[vm.params.s_id]){
vm.params.s_id = '';
}
}
},
complete: function () {
loading = 0;
layer.closeAll('loading');
}
});
} else {
vm.params.s_id = '';
}
},
}
});
<?php page_script($pager) ?>
});
</script>
+24
View File
@@ -0,0 +1,24 @@
<form class="am-form am-form-horizontal" action="<?=$info?'/auto/series/edit':'auto/series/add'?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<input type="hidden" value="<?=$info['id']?>" name="id">
<div class="am-form-group">
<label class="am-para-label">所属品牌:</label>
<div class="am-para-input w200">
<select name="brand_id">
<?foreach($brands as $key=>$val){?>
<option value="<?=$val['id']?>" <?=$val['id']==$info['brand_id']?'selected':''?>><?=$val['name']?></option>
<?}?>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">车系名称:</label>
<div class="am-para-input">
<input type="text" placeholder="输入车系名称" name="name" value="<?=$info['name']?>"/>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="submit">保存</button>
</div>
</div>
</form>
+113
View File
@@ -0,0 +1,113 @@
<div class="coms-table-wrap mt10">
<form class="form-search" onsubmit="return false" action="/auto/series/lists">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">车系名称:</label>
<div class="am-para-inline w200">
<input type="text" name="title" v-model="params.title"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">品牌:</label>
<div class="am-para-inline w150">
<select name="brand_id" v-model="params.brand_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">状态:</label>
<div class="am-para-inline w150">
<select name="status" v-model="params.status">
<option value="all">所有</option>
<option v-for="(item,index) in status_arr" :value="index">{{item}}</option>
</select>
</div>
</div>
<div class="am-form-group fl ml10">
<label class="am-para-label w50"></label>
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<button type="button" data-title="新增车系" data-modal="/auto/series/get" class="am-btn am-btn-success w100">新增</button>
</div>
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
共有<?= $pager['totle'] ?>条数据
</div>
</div>
</form>
<div class="coms-table-bd">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="10%"><span>ID</span></th>
<th width="20%"><span>品牌名称</span></th>
<th width="20%"><span>车系名称</span></th>
<th width="10%"><span>状态</span></th>
<th width="15%"><span>创建时间</span></th>
<th width="15%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['brand_name'] ?></td>
<td><?= $v['name'] ?></td>
<td><?= $v['status_name'] ?></td>
<td><?= $v['c_time'] ?></td>
<td>
<?php if ($v['status'] > -1) { ?>
<a href="javascript:void (0);" data-title="编辑车系" data-modal="/auto/series/get?id=<?= $v['id'] ?>"
class="am-text-primary"><?= '编辑' ?></a>
<?php } ?>
<?php if ($v['status'] == 1) { ?>
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
<?php }
elseif ($v['status'] == 0) { ?>
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
<?php } ?>
<?php if ($v['status'] > -1) { ?>
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vue_obj;
var loading = 0;
$(function(){
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params:[],
brandAry:[],
status_arr: [],
},
mounted:function() {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.brandAry = <?=json_encode($brandAry)?>;
vm.status_arr = <?=json_encode($status_arr)?>;
},
methods:{},
watch:{}
});
<?php page_script($pager) ?>
});
</script>
+452
View File
@@ -0,0 +1,452 @@
<style type="text/css">
.apptese-con {
position: relative;
margin: 80px 0 10px 0;
border-top: #ddd 1px solid;
border-left: #ddd 1px solid;
}
.apptese-con:before {
display: block;
position: absolute;
top: -65px;
left: -1px;
right: -1px;
padding-left: 10px;
text-align: left;
font-size: 14px;
color: #999;
content: "提示:此页面屏蔽了鼠标右键,多张图片可以不回车直接复制添加,文本内容要修改,请不要把内容删光再复制新内容进来,请用替换或者先粘贴再删除旧的内容;";
}
.apptese-tx,
.apptese-img {
position: relative;
min-height: 60px;
border-right: #ddd 1px solid;
border-bottom: #ddd 1px solid;
line-height: 30px;
font-size: 16px;
color: #999;
}
.apptese-tx {
padding: 20px 20px 51px 20px;
}
.apptese-img {
padding: 10px 20px 51px 20px;
}
.apptese-img img {
display: block;
margin: 10px auto 0 auto;
max-width: 400px;
}
.apptese-tx:before {
display: block;
position: absolute;
top: -31px;
left: -1px;
right: -1px;
height: 31px;
padding-left: 10px;
background-color: #fafafa;
border: #ddd 1px solid;
border-bottom: none;
text-align: left;
font-size: 14px;
color: #666;
content: "请输入文本内容";
}
.apptese-img:before {
display: block;
position: absolute;
top: -31px;
left: -1px;
right: -1px;
height: 31px;
padding-left: 10px;
background-color: #fafafa;
border: #ddd 1px solid;
border-bottom: none;
text-align: left;
font-size: 14px;
color: #666;
content: "请插入图片(可多张)";
}
.edui-icon-fullscreen {
display: none;
}
.edui-container .edui-toolbar {
position: relative !important;
width: auto !important;
}
.scshopcon {
display: none;
position: absolute;
left: 0;
top: 37px;
width: 400px;
max-height: 235px;
background-color: #fff;
border: #ccc 1px solid;
border-top: none;
overflow-y: auto;
z-index: 10;
}
.scshopcon.active {
display: block;
}
.scshopcon .scshop-item {
display: block;
padding: 5px 10px;
border-bottom: #fafafa 1px solid;
font-size: 16px;
color: #555;
}
.scshopcon .scshop-item.active,
.scshopcon .scshop-item:hover {
background-color: #388aff;
color: #fff;
}
.ck-editor__editable {
min-height: 300px;
}
</style>
<?php if ($biz['id']){ ?>
<form id="vue-app" class="am-form am-form-horizontal" action="/biz/store/store/edit?id=<?= $biz['id'] ?>"
data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<input type="hidden" value="<?= $biz['id'] ?>" name="id"/>
<?php }else{ ?>
<form id="vue-app" class="am-form am-form-horizontal" action="/biz/store/store/add?>" data-auto="true" method="post"
style="width: 90%;padding-top: 10px">
<?php } ?>
<div class="am-form-group">
<label class="am-para-label">门店:</label>
<div class="am-para-input"><input type="text" placeholder="(最多 30 个字符)" name="biz_name"
value="<?= $biz['biz_name'] ?>"/></div>
</div>
<div class="am-form-group">
<label class="am-para-label">门店地址:</label>
<div class="am-para-input">
<div class="am-form-inline">
<div class="am-form-group">
<select name="province_id" style="width: 200px;" data-toggle="next-select"
data-refurl="/common/area?key=city&id={value}&url=edit" data-next="#bd-hd-city">
<option value="0">省份</option>
<?php if ($provinces) {
foreach ($provinces as $v) { ?>
<option value="<?= $v['province_id'] ?>"
<?= $v['province_id'] == $biz['province_id'] ? 'selected' : '' ?>><?= $v['province_name'] ?></option>
<?php }
} ?>
</select>
</div>
<div class="am-form-group">
<select id="bd-hd-city" name="city_id" style="width: 200px;" data-toggle="next-select"
data-refurl="/common/area?key=county&id={value}" data-next="#bd-hd-county">
<option value="0">城市</option>
<?php if ($citys) {
foreach ($citys as $v) { ?>
<option value="<?= $v['city_id'] ?>"
<?= $v['city_id'] == $biz['city_id'] ? 'selected' : '' ?>><?= $v['city_name'] ?></option>
<?php }
} ?>
</select>
</div>
<div class="am-form-group">
<!--<select id="bd-hd-county" name="county_id" style="width: 200px;" data-toggle="next-select"-->
<!-- data-refurl="/common/area?key=street&id={value}" data-next="#bd-hd-street">-->
<select id="bd-hd-county" name="county_id" style="width: 200px;">
<option value="0">行政区</option>
<?php if ($countys) {
foreach ($countys as $value) { ?>
<option value="<?= $value['county_id'] ?>"
<?= $value['county_id'] == $biz['county_id'] ? 'selected' : '' ?>><?= $value['county_name'] ?></option>
<?php }
} ?>
</select>
</div>
<div class="am-form-group" style="display: none">
<select id="bd-hd-street" name="street_id" style="width: 200px;">
<option value="0">街道/乡镇</option>
<?php if ($street) {
foreach ($street as $value) { ?>
<option value="<?= $value['id'] ?>"
<?= $value['id'] == $biz['street_id'] ? 'selected' : '' ?>><?= $value['name'] ?></option>
<?php }
} ?>
</select>
</div>
<div class="am-form-group" style="display: none">
<select name="area_id" style="width: 200px;" id="bd-hd-area">
<option value="0">商圈</option>
<?php if ($areas) {
foreach ($areas as $value) { ?>
<option value="<?= $value['id'] ?>"
<?= $value['id'] == $biz['area_id'] ? 'selected' : '' ?>><?= $value['name'] ?></option>
<?php }
} ?>
</select>
</div>
</div>
</div>
</div>
<div class="am-form-group">
<div class="am-para-input">
<div class="am-input-group am-input-group-primary">
<input type="text" placeholder="详细地址" id="address" name="address" value="<?= $biz['address'] ?>"/>
<span class="am-input-group-btn">
<button id="addr-btn" class="am-btn am-btn-primary" type="button"><span
class="am-icon-search"></span></button>
</span>
</div>
</div>
</div>
<div class="am-form-group">
<div class="am-para-input">
<div class="am-form-inline">
<div class="am-input-group">
<span class="am-input-group-label">经度</span>
<input type="text" class="am-form-field" placeholder="经度" name="lng" value="<?= $biz['lng'] ?>"
id="biz-edit-lng">
</div>
<div class="am-input-group">
<span class="am-input-group-label">纬度</span>
<input type="text" class="am-form-field" placeholder="纬度" name="lat" value="<?= $biz['lat'] ?>"
id="biz-edit-lat">
</div>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label"></label>
<div class="am-para-input" id="qq-map" style="height: 600px;width: 90%;">
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0">
<label class="am-para-label">logo</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="headimg"><i class="am-icon-cloud-upload"></i> 选择要上传的文件
</button>
<input type="hidden" name="headimg"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $biz['headimg'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $biz['avatar'] ?>"/>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-success" type="submit">提交</button>
</div>
</div>
</form>
<script>
$(document).ready(function () {
/**qq地图**/
function QQMAP() {
this.marker = null;
this.map = null;
this.point = {lat: false, lng: false}
this.lngElemId = '#lng';
this.latElemId = '#lat';
}
QQMAP.prototype.init = function (elemId, lngElemId, latElemId) {
this.point.lat = $('#' + latElemId).val();
this.point.lng = $('#' + lngElemId).val();
lngElemId && (this.lngElemId = lngElemId);
latElemId && (this.latElemId = latElemId);
this.map = new qq.maps.Map(document.getElementById(elemId), {
zoom: 10,
center: new qq.maps.LatLng(24.497771154019727, 118.1418228149414),
mapTypeId: qq.maps.MapTypeId.ROADMAP
});
if (this.point.lat && this.point.lat) {
this.addMarker(this.point.lat, this.point.lng);
}
var _self = this;
qq.maps.event.addListener(this.map, 'click', function (event) {
_self.removeMarker();
_self.point = {lat: event.latLng.getLat(), lng: event.latLng.getLng()};
$('#' + lngElemId).val(_self.point.lng);
$('#' + latElemId).val(_self.point.lat);
_self.addMarker(event.latLng.getLat(), event.latLng.getLng());
}
);
};
QQMAP.prototype.removeMarker = function () {
this.marker && this.marker.setMap(null);
this.point = {lat: 24.497771154019727, lng: 118.1418228149414}
};
QQMAP.prototype.addMarker = function (lat, lng) {
var center = new qq.maps.LatLng(lat, lng), _self = this;
this.marker = new qq.maps.Marker({draggable: true, position: center, map: this.map});
this.map.panTo(center);
this.map.zoomTo(15);
qq.maps.event.addListener(this.marker, 'dragend', function (event) {
_self.point = {
lat: event.latLng.getLat(), lng: event.latLng.getLng()
};
$('#' + _self.lngElemId).val(_self.point.lng);
$('#' + _self.latElemId).val(_self.point.lat);
});
};
QQMAP.prototype.getLocation = function (addr) {
_self = this;
if (!this.geocoder) {
this.geocoder = new qq.maps.Geocoder();
}
this.geocoder.getLocation(addr);
this.geocoder.setComplete(function (result) {
_self.map.setCenter(result.detail.location);
_self.removeMarker();
_self.point = result.detail.location;
$('#' + _self.lngElemId).val(_self.point.lng);
$('#' + _self.latElemId).val(_self.point.lat);
_self.addMarker(_self.point.lat, _self.point.lng);
});
};
QQMAP.prototype.loadScript = function (init) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://map.qq.com/api/js?v=2.exp&key=KUBBZ-HYIKF-II2J3-NYSEA-IY3ZQ-KTBP3&callback=" + init;
document.body.appendChild(script);
};
window.QQMAP = new QQMAP();
});
function mapInit() {
QQMAP.init('qq-map', 'biz-edit-lng', 'biz-edit-lat');
}
QQMAP.loadScript('mapInit');
var vm = new Vue({
el: '#vue-app',
data: {
cate_id: <?=$biz['cate_id'] ? $biz['cate_id'] : "''"?>,
info:<?=json_encode($biz)?>,
},
mounted: function () {
},
methods: {
},
created: function () {
},
watch: {
}
});
/**
* 根据地址定位
* @param addr
*/
function to_location(addr) {
var map = window.QQMAP;
map.getLocation(addr);
}
$('#bd-hd-city').change(function () {
var city = $(this).find('option:selected').text();
var addr = city;
to_location(addr);
});
$('#bd-hd-county').change(function () {
var city = $('#bd-hd-city').find('option:selected').text();
var county = $(this).find('option:selected').text();
var addr = city + ',' + county;
to_location(addr);
});
$('#addr-btn').click(function () {
var sel_city = '#bd-hd-city';
var sel_county = '#bd-hd-county';
var addr = $('#address').val();
if ($(sel_county).val() > 0) {
addr = $(sel_county).find('option:selected').text() + ',' + addr;
}
if ($(sel_city).val() > 0) {
addr = $(sel_city).find('option:selected').text() + ',' + addr;
}
to_location(addr);
});
$('#address').change(function () {
var sel_city = '#bd-hd-city';
var sel_county = '#bd-hd-county';
var addr = $(this).val();
if ($(sel_county).val() > 0) {
addr = $(sel_county).find('option:selected').text() + ',' + addr;
}
if ($(sel_city).val() > 0) {
addr = $(sel_city).find('option:selected').text() + ',' + addr;
}
to_location(addr);
});
jQuery("body").on("click", function (e) {
if (jQuery(e.target).parents(".sc-con").length == 0) {
jQuery(".scshopcon").removeClass("active");
}
});
jQuery("input#keyword").focus(function () {
jQuery(this).siblings(".scshopcon").addClass("active");
});
jQuery("input#keyword").on("input propertychange", function () {
var sctx = jQuery("#keyword").val();
$('#brand_id').val('');//修改了品牌
vm.$data.brand_id = '';
$(".scshopcon").html('');
jQuery(this).siblings(".scshopcon").addClass("active");
$('#brand_id option').each(function (i) {
text = $(this).text();
if (sctx.length < 0 || -1 != text.indexOf(sctx)) {
$(".scshopcon").append('<a class="scshop-item" data-id="' + $(this).val() + '" href="javascript:">' + text + '</a>');
}
});
});
jQuery(".scshopcon").on("click", ".scshop-item", function (e) {
jQuery("input#keyword").val(jQuery(this).text());
vm.$data.brand_name = jQuery(this).text();
jQuery(".scshopcon").removeClass("active");
$('#brand_id').val($(this).attr('data-id'));
vm.$data.brand_id = $(this).attr('data-id');
});
</script>
+378
View File
@@ -0,0 +1,378 @@
<div class="coms-table-wrap mt10" id="vue-app">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/biz/store/store/lists">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">门店:</label>
<div class="am-para-inline w150">
<input type="text" name="bizname" value="<?= $bizname ?>"/>
</div>
</div>
<div class="am-form-group fl" style="display: none">
<label class="am-para-label w80">品牌:</label>
<div class="am-para-inline w250">
<select name="brand_id" v-model="brand_id">
<option value="">请选择</option>
<template v-for="v in lists.brand">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">状态:</label>
<div class="am-para-inline w100">
<select name="status">
<option value="0">请选择</option>
<option value="on" <?= 'on' == $status ? 'selected' : '' ?>>上架</option>
<option value="off" <?= 'off' == $status ? 'selected' : '' ?>>下架</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">门店地址:</label>
<div class="am-form-group am-para-inline w150">
<select name="province_id" data-toggle="next-select"
data-refurl="/common/area?key=city&id={value}&url=search" data-next="#bd-hd-city">
<option value="0">省份</option>
<?php if ($provinces) {
foreach ($provinces as $v) { ?>
<option value="<?= $v['province_id'] ?>"
<?= $v['province_id'] == $province_id ? 'selected' : '' ?>><?= $v['province_name'] ?></option>
<?php }
} ?>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select id="bd-hd-city" name="_city_id" data-toggle="next-select"
data-refurl="/common/area?key=county&id={value}" data-next="#bd-hd-county">
<option value="0">城市</option>
<?php if ($citys) {
foreach ($citys as $v) { ?>
<option value="<?= $v['city_id'] ?>"
<?= $v['city_id'] == $city_id ? 'selected' : '' ?>><?= $v['city_name'] ?></option>
<?php }
} ?>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select id="bd-hd-county" name="county_id" data-toggle="next-select"
data-refurl="/common/areas?id={value}" data-next="#bd-hd-area">
<option value="0">行政区</option>
<?php if ($countys) {
foreach ($countys as $value) { ?>
<option value="<?= $value['county_id'] ?>"
<?= $value['county_id'] == $county_id ? 'selected' : '' ?>><?= $value['county_name'] ?></option>
<?php }
} ?>
</select>
</div>
</div>
<div class="am-form-group">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks">本周</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month">本月</a>
</div>
</div>
</div>
<div class="am-form-group fl ml20">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml20">
<button type="button" data-open="/biz/store/store/get" class="am-btn am-btn-success am-btn-sm w100">
新增
</button>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="50"></th>
<th width="5%"><span>ID</span></th>
<th><span>门店</span></th>
<th width="12%"><span>类型</span></th>
<th width="15%"><span>创建时间</span></th>
</tr>
</thead>
<tbody>
<? $statuscn = array('下架', '上架', '待审'); ?>
<?php foreach ($lists as $v) { ?>
<tr>
<td rowspan="2">
<input type="checkbox" name="ids[]" class="biz-ids" value="<?= $v['id'] ?>"/>
</td>
<td><?= $v['id'] ?></td>
<td><?= $v['biz_name'] ?></td>
<td><?= $statuscn[$v['status']] ?></td>
<td><?= $v['c_time'] ?></td>
</tr>
<tr>
<td colspan="4" class="align-r">
<a data-open="/biz/store/store/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
<input type="hidden" class="biz-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
<select data-update-group="" data-list-target=".biz-id-<?= $v['id'] ?>"
data-action="/biz/store/store/batch" data-field="" style="height: 30px;width: 70px;">
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>下架</option>
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>上架</option>
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
</select>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
<label class="checkall">
<input type="checkbox" data-check-target=".biz-ids">全选</label>
<div class="am-para-inline w120">
<select data-update-group="" data-list-target=".biz-ids" data-action="/biz/store/store/batch"
data-field="ifcheck">
<option value="">批量操作</option>
<option value="0">下架</option>
<option value="1">上架</option>
<option value="-1">删除</option>
</select>
</div>
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
<div id="channel-modal" style="display: none;">
<div class="am-form am-form-horizontal">
<div class="am-form-group" style="padding-top: 15px">
<label class="am-para-label">渠道经理:</label>
<div class="am-para-input">
<div class="am-g">
<label class="am-checkbox-inline" v-for="(v,i) in qdjl_lists">
<input type="checkbox" :value="v.id" v-model="channel_uid"/> {{v.city_name}}
</label>
</div>
</div>
</div>
</div>
</div>
<div id="biz_manage-modal" style="display: none;">
<div class="am-form am-form-horizontal" style="padding-top: 15px">
<div class="am-form-group">
<label class="am-para-label">角色:</label>
<div class="am-para-input">
<div class="am-g">
<select v-model="biz_manage.group_id" style="width: 150px;">
<option value="1">销售</option>
<option value="2">店长</option>
<option value="3">老板</option>
</select>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">管理员:</label>
<div class="am-para-input">
<div class="am-g">
<div class="col-sm-4" style="padding-left: 0px;">
<input type="text" v-model="biz_manage.admin_name" placeholder="门店管理员关键字"/>
</div>
<div class="col-sm-3" style="padding-top: 3px;">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="users_group">
搜索
</button>
</div>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">请选择:</label>
<div class="am-para-input">
<div class="am-g">
<label class="am-checkbox-inline" v-for="(v,i) in biz_manage.admins">
<input type="checkbox" :value="v.id" v-model="biz_manage.admin_id"/> {{v.name}}
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var vm = new Vue({
el: '#vue-app',
data: {
brand_id: <?=$brand_id ? $brand_id : "''"?>,
company_id:<?=$company_id ? $company_id : 0?>,
lists: {
brand: <?=json_encode($brand_list)?>
},
params: [],
qdjl_lists: [],
channel_uid: [],
biz_manage: {admins: [], group_id: 2, admin_id: 0, biz_id: 0, admin_name: ''},
companyAry:<?=$companyAry ? json_encode($companyAry) : '[]'?>,
typeAry:<?=$typeAry ? json_encode($typeAry) : '[]'?>
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.qdjl_lists = <?=json_encode($qdjl_lists)?>;
},
methods: {
channel_modal: function (biz_id,biz_name) {
//选择渠道归属
var vm = this;
vm.channels = [];
$.ajax({
type: 'get',
url: '/app/licheb/member/get_channel_uid',
dataType: 'json',
data: {biz_id: biz_id},
success: function (response) {
if (response.code == 1) {
vm.channel_uid = response.data;
}
}
});
layer.open({
type: 1,
area: ['50%', '40%'], //宽高
content: $('#channel-modal'),
title: biz_name+'-渠道归属',
shade: false,
btn: ['保存选择'],
yes: function (index) {
layer.close(index);
$.ajax({
type: 'post',
url: '/app/licheb/member/edit_channel_uid',
dataType: 'json',
data: {biz_id: biz_id, channel_uid: vm.channel_uid},
success: function (response) {
if (response.code == 1) {
layer.msg(response.msg, {icon: 1});
} else {
layer.msg(response.msg, {icon: 2});
}
}
});
}
});
},
biz_manage_modal: function (biz_id,biz_name) {
//选择门店管理员
var vm = this;
vm.biz_manage = {admins: [], group_id: 2, admin_id: 0, biz_id: biz_id, admin_name: ''};
vm.users_group();
layer.open({
type: 1,
area: ['50%', '50%'], //宽高
content: $('#biz_manage-modal'),
title: biz_name+'-门店管理员',
shade: false,
btn: ['保存选择'],
yes: function (index) {
layer.close(index);
$.ajax({
type: 'post',
url: '/app/licheb/member/edit_users_group',
dataType: 'json',
data: {biz_manage: vm.biz_manage},
success: function (response) {
if (response.code == 1) {
layer.msg(response.msg, {icon: 1});
} else {
layer.msg(response.msg, {icon: 2});
}
}
});
}
});
},
users_group: function () {
var vm = this;
if (!vm.biz_manage.group_id) {
return;
}
$.ajax({
type: 'get',
url: '/app/licheb/member/get_users_group',
dataType: 'json',
data: {
group_id: vm.biz_manage.group_id,
biz_id: vm.biz_manage.biz_id,
admin_name: vm.biz_manage.admin_name
},
success: function (response) {
if (response.code == 1) {
vm.biz_manage.admins = response.data.admins;
vm.biz_manage.admin_id = response.data.admin_id;
}
}
});
},
getBrandList: function () {
var _self = this;
_self.brand_id = '';
_self.cate2_id = '';
$.get('/common/category', {pid: _self.cate_id}, function (res) {
_self.lists.level2 = res.data;
}, 'json');
$.get('/common/brand', {cate_id: _self.cate_id}, function (res) {
_self.lists.brand = res.data;
}, 'json');
},
},
watch: {
'biz_manage.group_id': function (nv, ov) {
var vm = this;
vm.users_group();
}
}
});
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', nowDate = new Date();
var beginDate = '', endDate = '';
switch (type) {
case 'today':
beginDate = endDate = nowDate.Format('yyyy-MM-dd');
break;
case 'yesterday':
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
break;
case 'weeks':
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
nowDate.setDate(nowDate.getDate() + 6);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
break;
case 'month':
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
break;
}
date = beginDate + ' ~ ' + endDate;
$('#id-create-time').val(date);
});
});
$(function () {
<?php page_script($pager) ?>
});
</script>

Some files were not shown because too many files have changed in this diff Show More