first commit
This commit is contained in:
Executable
+6
@@ -0,0 +1,6 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+135
@@ -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();
|
||||
Executable
+523
@@ -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'] = 'haodian.dev.xiaoyu.com';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = '';
|
||||
Executable
+114
@@ -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);
|
||||
|
||||
Executable
+96
@@ -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=192.168.0.11;port=3308;dbname=lichedb',
|
||||
'username' => 'devuser',
|
||||
'password' => '123456',
|
||||
'database' => 'lichedb',
|
||||
'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
|
||||
);
|
||||
Executable
+24
@@ -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">'
|
||||
);
|
||||
Executable
+103
@@ -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'
|
||||
);
|
||||
Executable
+35
@@ -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'
|
||||
);
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+19
@@ -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',
|
||||
),
|
||||
);
|
||||
Executable
+84
@@ -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/';
|
||||
Executable
+184
@@ -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'
|
||||
);
|
||||
Executable
+13
@@ -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;
|
||||
Executable
+14
@@ -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
|
||||
|
|
||||
*/
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$config['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
|
||||
$config['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
|
||||
$config['bucket'] = 'img-haodian';
|
||||
$config['region'] = '华东';
|
||||
$config['is_https'] = 'https';
|
||||
$config['domain'] = 'qimg.haodian.cn';
|
||||
$config['attch'] = 'hdi/';
|
||||
|
||||
$config['img']['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
|
||||
$config['img']['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
|
||||
$config['img']['bucket'] = 'img-haodian';
|
||||
$config['img']['region'] = '华东';
|
||||
$config['img']['is_https'] = 'https';
|
||||
$config['img']['domain'] = 'qimg.haodian.cn';
|
||||
$config['img']['attch'] = 'hdi/';
|
||||
|
||||
$config['video']['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
|
||||
$config['video']['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
|
||||
$config['video']['bucket'] = 'video-haodian';
|
||||
$config['video']['region'] = '华南';
|
||||
$config['video']['is_https'] = 'https';
|
||||
$config['video']['domain'] = 'qv.haodian.cn';
|
||||
$config['video']['attch'] = 'hdi/';
|
||||
Executable
+11
@@ -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;
|
||||
Executable
+54
@@ -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;
|
||||
Executable
+64
@@ -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')
|
||||
|
||||
);
|
||||
Executable
+6
@@ -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';
|
||||
Executable
+214
@@ -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'
|
||||
);
|
||||
Executable
+129
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
Executable
+59
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+95
@@ -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.
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+124
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
$this->load->view('login');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if ($this->input->post('need_code') == 'login') {
|
||||
$code = $this->input->post('code');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$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));
|
||||
} 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'], "hd-admin.dev.xiaoyu.com") || false !== strpos($_SERVER['HTTP_HOST'], "admin.test.haodian.cn")){
|
||||
//开发测试不校验IP
|
||||
}elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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 ($check_view) {
|
||||
$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);
|
||||
|
||||
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);
|
||||
$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, array($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;
|
||||
}
|
||||
}
|
||||
Executable
+94
@@ -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,'type'=>0), '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,'type'=>0));
|
||||
$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,'type'=>0), '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');
|
||||
}
|
||||
}
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
<?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');
|
||||
|
||||
$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';
|
||||
}
|
||||
$this->load->view('upload', $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);
|
||||
}
|
||||
|
||||
//返回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));
|
||||
}
|
||||
}
|
||||
Executable
+57
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
<?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,c_time');
|
||||
foreach($rows as $item){
|
||||
$lists[] = array(
|
||||
'id' => $item['id'],
|
||||
'name' => $item['name'],
|
||||
'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 get_servicer(){
|
||||
$app_id = $this->input->get('app_id');
|
||||
$target_id = intval($this->input->get('id'));
|
||||
$type = $this->input->get('type');
|
||||
|
||||
$this->load->model('app/app_servicer_model', 'servicer_model');
|
||||
|
||||
$where = array('app_id' => $app_id, 'type' => $type, 'target_id' => $target_id);
|
||||
$total = $this->servicer_model->count($where);
|
||||
$info = array();
|
||||
$lists = array();
|
||||
if($total){
|
||||
$select = 'id,type,show_type,msg_type,title,contact,jsondata';
|
||||
$rows = $this->servicer_model->select($where, 'id ASC', 0, 0, $select);
|
||||
foreach($rows as $row){
|
||||
$info = array(
|
||||
'app_id' => $app_id,
|
||||
'type' => $type,
|
||||
'show_type' => $row['show_type'],
|
||||
'contact' => $row['contact'],
|
||||
'target_id' => $target_id,
|
||||
);
|
||||
if(1 == $info['show_type']){//自定义才显示列表
|
||||
$arr = array(
|
||||
'id' => $row['id'],
|
||||
'msg_type' => $row['msg_type'],
|
||||
'keyword' => $row['title'],
|
||||
);
|
||||
|
||||
if($row['jsondata']){
|
||||
$json = json_decode($row['jsondata'], true);
|
||||
$arr = array_merge($arr, $json);
|
||||
$arr['msg']['img'] && $arr['msg']['img_url'] = build_qiniu_image_url($arr['msg']['img']);
|
||||
}
|
||||
$lists[] = $arr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
!$info && $info = array(
|
||||
'app_id' => $app_id,
|
||||
'type' => $type,
|
||||
'show_type' => 0,
|
||||
'target_id' => $target_id,
|
||||
);
|
||||
$this->data['msg_types'] = array('图文', '文章链接');
|
||||
$this->data['info'] = $info;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['max_num'] = 2;//最多两个
|
||||
if ($app_id == 13){ // 20210428莫莫:要支持不限制数量
|
||||
$this->data['max_num'] = 200;
|
||||
}
|
||||
$this->data['_title'] = '编辑客服';
|
||||
$this->show_view('app/appusual/get_servicer');
|
||||
}
|
||||
|
||||
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, '操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑客服信息
|
||||
* @return bool
|
||||
*/
|
||||
public function edit_servicer(){
|
||||
$info = $this->input->post('info');
|
||||
$lists = $this->input->post('lists');
|
||||
|
||||
$this->load->model('app/app_servicer_model', 'servicer_model');
|
||||
|
||||
$app_id = $info['app_id'];
|
||||
$type = $info['type'];
|
||||
|
||||
$where = array('app_id' => $app_id, 'type' => $info['type'], 'target_id' => $info['target_id']);
|
||||
$select = 'id, show_type, msg_type, title, contact, jsondata';
|
||||
$olds = $this->servicer_model->select($where, 'id ASC', 0, 0, $select);
|
||||
$where_del = array();
|
||||
$upds = array();
|
||||
$adds = array();
|
||||
switch($info['show_type']){
|
||||
case 0://默认
|
||||
$where_del = $where;
|
||||
break;
|
||||
case 1://自定义
|
||||
$where_del = $where;
|
||||
//id作数组key
|
||||
$olds_key = array();
|
||||
foreach($olds as $row){
|
||||
$olds_key[$row['id']] = $row;
|
||||
}
|
||||
|
||||
$ids = array();//被编辑的ID
|
||||
if($lists){
|
||||
foreach($lists as $row){
|
||||
//口令是否被设置
|
||||
$keyword = $row['keyword'];
|
||||
//判断口令是否被占用
|
||||
$where = array('app_id' => $app_id, 'title' => $keyword);
|
||||
$rows = $this->servicer_model->select($where, 'id DESC', 0, 0, 'type, target_id');
|
||||
foreach($rows as $arr){
|
||||
if($type != $arr['type'] || $info['target_id'] != $arr['target_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, "口令“{$keyword}”已经被设置");
|
||||
}
|
||||
}
|
||||
if($row['id']){//编辑
|
||||
$row_old = $olds_key[$row['id']];
|
||||
$jsondata = $row_old['jsondata'] ? json_decode($row_old['jsondata'], true) : array();
|
||||
$jsondata['msg'] = $row['msg'];
|
||||
$upds[] = array(
|
||||
array(
|
||||
'msg_type' => $row['msg_type'],
|
||||
'title' => $keyword,
|
||||
'contact' => $info['contact'],
|
||||
'show_type' => $info['show_type'],
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
),
|
||||
array('id' => $row['id']),
|
||||
);
|
||||
$ids[] = $row['id'];
|
||||
} else{//新增
|
||||
$jsondata['msg'] = $row['msg'];
|
||||
$adds[] = array(
|
||||
'app_id' => $app_id,
|
||||
'type' => $type,
|
||||
'target_id' => $info['target_id'],
|
||||
'show_type' => $info['show_type'],
|
||||
'contact' => $info['contact'],
|
||||
'msg_type' => $row['msg_type'],
|
||||
'title' => $keyword,
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
'c_time' => time(),
|
||||
);
|
||||
}
|
||||
}
|
||||
if($ids){
|
||||
$where_del["id not in (" . implode(',', $ids) . ")"] = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -1://隐藏
|
||||
if(!$olds){
|
||||
$adds[] = array(
|
||||
'app_id' => $app_id,
|
||||
'type' => $type,
|
||||
'target_id' => $info['target_id'],
|
||||
'show_type' => $info['show_type'],
|
||||
'c_time' => time(),
|
||||
);
|
||||
}elseif($olds && -1 != $olds[0]['show_type']){
|
||||
$where_del = $where;
|
||||
$adds[] = array(
|
||||
'app_id' => $app_id,
|
||||
'type' => $type,
|
||||
'target_id' => $info['target_id'],
|
||||
'show_type' => $info['show_type'],
|
||||
'c_time' => time(),
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$where_del && $this->servicer_model->delete($where_del);
|
||||
$adds && $this->servicer_model->add_batch($adds);
|
||||
foreach($upds as $row){
|
||||
$this->servicer_model->update($row[0], $row[1]);
|
||||
}
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: John
|
||||
* Date: 2019/11/26
|
||||
* Time: 9:58
|
||||
*/
|
||||
abstract class Appconf extends HD_Controller
|
||||
{
|
||||
protected $app_id;
|
||||
protected $u_entity;
|
||||
protected $role_sbcards;//sbcard角色
|
||||
protected $log_dir;
|
||||
|
||||
protected static $title = array(
|
||||
'cms' => array(1 => '内容推送'),
|
||||
);
|
||||
protected static $position_arr = array(
|
||||
'1' => array(0 => '首页banner', 1 => '热门活动'),
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$class_name = strtolower(get_class($this));
|
||||
|
||||
$key_cookie = "hd_app_id";
|
||||
|
||||
$this->load->model('app/App_model', 'appM');
|
||||
|
||||
if(!$this->app_id){
|
||||
$app_id = $this->input->get_post('app_id');
|
||||
if(!$app_id){
|
||||
$app_id = $this->input->cookie($key_cookie);
|
||||
}
|
||||
$app_id && $this->app_id = $app_id;
|
||||
} else {
|
||||
$app_id = $this->app_id;
|
||||
}
|
||||
|
||||
if($app_id) {
|
||||
$this->input->set_cookie($key_cookie, $app_id, time() + 86400);//保存cookie
|
||||
}
|
||||
|
||||
$this->load->library('entity/user_entity');
|
||||
if($app_id){
|
||||
$info = $this->appM->get(array('id' => $this->app_id));
|
||||
$this->info = json_decode($info['jsondata'], true);
|
||||
|
||||
$this->u_entity = new User_entity($this->app_id);
|
||||
}
|
||||
|
||||
$this->data['app_id'] = $app_id;
|
||||
|
||||
$this->log_dir = "{$class_name}_{$app_id}";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取城市ID
|
||||
* @def 默认城市
|
||||
* @return mixed
|
||||
*/
|
||||
protected function cityAry($def = false){
|
||||
$this->load->model("sys/sys_city_model", 'city_model');
|
||||
|
||||
if($def){
|
||||
return $this->info['city_id'];
|
||||
}
|
||||
|
||||
$citys = $this->info['citys'];
|
||||
$citys = $citys ? array_keys($citys) : array();
|
||||
|
||||
$where = array('status' => 1);
|
||||
$orderby = "id desc";
|
||||
$select = "city_id, name";
|
||||
if(SUPER_ADMIN != $this->role){
|
||||
$city_ids = $_SESSION['admin_info']['city_id'];
|
||||
$city_ids = $city_ids ? array_intersect($citys, $city_ids) : array();
|
||||
} else {
|
||||
$city_ids = $citys;
|
||||
}
|
||||
$str_ids = $city_ids ? implode(',', $city_ids) : '-1';
|
||||
$where["city_id in ({$str_ids})"] = null;
|
||||
$map_city = $this->city_model->map('city_id', 'name', $where, $orderby, 0, 0, $select);
|
||||
|
||||
return $map_city;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+245
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Johnny
|
||||
* Date: 2019/04/23
|
||||
* Time: 9:50
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once(dirname(__DIR__) . '/Appconf.php');
|
||||
|
||||
class Cms extends Appconf
|
||||
{
|
||||
private $img_sizes;//图片建议尺寸
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/appusual/App_cms_model', 'cmsM');
|
||||
$this->load->model('app/App_model', 'appM');
|
||||
$this->load->model("sys/sys_city_model", 'mdCity');
|
||||
if ($this->app_id) {
|
||||
$this->pos_arr = parent::$position_arr[$this->app_id];
|
||||
$this->title = self::$title['cms'][$this->app_id];
|
||||
}
|
||||
$this->img_sizes = array(//图片建议尺寸
|
||||
1 => array(0 => '750x325', 1 => '74x74'),
|
||||
);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists($where = array(), $order = 'sort DESC, id DESC ', $page = '1', $size = '10')
|
||||
{
|
||||
$this->data['title'] = $title = $this->input->get('title');
|
||||
$this->data['status'] = $status = $this->input->get('status');
|
||||
$this->data['position'] = $position = $this->input->get('position');
|
||||
$this->data['city_id'] = $city_id = $this->input->get('city_id');
|
||||
$where['app_id'] = $this->app_id;
|
||||
$page = $this->input->get('page') ? $this->input->get('page') : '1';
|
||||
|
||||
$cityAry = $this->cityAry();
|
||||
|
||||
if ($title) {
|
||||
$where['title LIKE "%' . trim($title) . '%"'] = NULL;
|
||||
}
|
||||
if (status_verify($status)) {
|
||||
$where['status'] = $status;
|
||||
}
|
||||
if (status_verify($position)) {
|
||||
$where['position'] = $position;
|
||||
}
|
||||
if (status_verify($position)) {
|
||||
$where['position'] = $position;
|
||||
}
|
||||
if ($city_id) {
|
||||
$where['city_id'] = $city_id;
|
||||
}
|
||||
|
||||
$lists = $this->cmsM->select($where, $order, $page, $size, 'id,s_time,e_time,status,title,sort,position,city_id');
|
||||
foreach ($lists as $key => $value) {
|
||||
$city_name = $cityAry[$value['city_id']];
|
||||
$lists[$key]['s_time'] = date('Y-m-d H:i:s', $value['s_time']);
|
||||
$lists[$key]['e_time'] = date('Y-m-d H:i:s', $value['e_time']);
|
||||
$lists[$key]['position'] = $this->pos_arr [$value['position']];
|
||||
$lists[$key]['city_name'] = $city_name ? $city_name : '-';
|
||||
}
|
||||
$count = $this->cmsM->count($where);
|
||||
$this->data['pos_arr'] = $this->pos_arr;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['city_list'] = $cityAry;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count, 'total' => $count);
|
||||
$this->data['_title'] = $this->title . '列表';
|
||||
return $this->show_view('/app/appusual/cms/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$img_sizes = $this->img_sizes;
|
||||
//列表
|
||||
$lists = $this->cmsM->get(['id' => $id]);
|
||||
$lists['link'] = $lists['url'];
|
||||
$lists['cover_str'] = $lists['cover'];
|
||||
$lists['cover'] = explode(',', $lists['cover']);
|
||||
$lists['icon_str'] = build_qiniu_image_url($lists['icon']);
|
||||
$lists['s_time'] = date('Y-m-d H:i:s', $lists['s_time']);
|
||||
$lists['e_time'] = date('Y-m-d H:i:s', $lists['e_time']);
|
||||
$city_id = intval($lists['city_id']);
|
||||
$lists['city_list'] = $this->cityAry();
|
||||
$lists['city_id'] = $city_id;
|
||||
$this->data = $lists;
|
||||
$this->data['img_sizes'] = $img_sizes;
|
||||
$this->data['icon_sizes'] = $icon_sizes;
|
||||
$this->data['url'] = 'edit';
|
||||
$this->data['pos_arr'] = $this->pos_arr;
|
||||
$this->data['_title'] = '编辑' . $this->title;
|
||||
return $this->show_view('/app/appusual/cms/edit', true);
|
||||
}
|
||||
|
||||
public function get_add()
|
||||
{
|
||||
$img_sizes = $this->img_sizes;
|
||||
$citys = $this->get_citys();
|
||||
$this->data['app_id'] = $this->app_id;
|
||||
$this->data['img_sizes'] = $img_sizes;
|
||||
$this->data['icon_sizes'] = $icon_sizes;
|
||||
$this->data['url'] = 'add';
|
||||
$this->data['pos_arr'] = $this->pos_arr;
|
||||
$this->data['city_list'] = $this->cityAry();
|
||||
$this->data['city_id'] = $citys['city_id'];
|
||||
$this->data['_title'] = '添加推送信息';
|
||||
return $this->show_view('/app/appusual/cms/edit', true);
|
||||
}
|
||||
|
||||
private function get_citys()
|
||||
{
|
||||
$citys = $this->info['citys'];
|
||||
$city_list = array();
|
||||
if ($citys) {
|
||||
$city_ids = array();
|
||||
foreach ($citys as $key => $value) {
|
||||
$city_ids[] = $key;
|
||||
}
|
||||
if ($city_ids) {
|
||||
$city_ids_str = implode(',', $city_ids);
|
||||
$where = array("city_id in ($city_ids_str)" => null);
|
||||
$city_list = $this->mdCity->select($where, 'id DESC', 0, 0, 'city_id,name');
|
||||
}
|
||||
}
|
||||
$data['city_id'] = $this->info['city_id'] ? $this->info['city_id'] : 0;
|
||||
$data['list'] = $city_list;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$input = $this->input->post(['position', 'app_id', 'id', 'title', 'link', 'cover', 'icon', 's_time', 'e_time'
|
||||
, 'sort', 'city_id', 'content'], true);
|
||||
if (empty($input['title'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标题不能为空!');
|
||||
}
|
||||
if (empty($input['position']) && $input['position'] != '0') {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择推送位置');
|
||||
}
|
||||
if (empty($input['app_id'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误!');
|
||||
}
|
||||
if (empty($input['s_time']) || empty($input['e_time'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '有效时间不能为空!');
|
||||
}
|
||||
$cover = !empty($input['cover']) ? str_replace('https://qimg.haodian.cn/', '', $input['cover']) : $input['cover'];
|
||||
$icon = $input['icon'];
|
||||
$input['link'] = $input['link'] . trim($input['param']);
|
||||
$insert = [
|
||||
'title' => $input['title'],
|
||||
'url' => $input['link'],
|
||||
'cover' => $cover,
|
||||
'icon' => $icon ? $icon : '',
|
||||
'position' => $input['position'],
|
||||
'app_id' => $input['app_id'],
|
||||
'content' => $input['content'],
|
||||
's_time' => strtotime($input['s_time']),
|
||||
'e_time' => strtotime($input['e_time']),
|
||||
'sort' => $input['sort'],
|
||||
'city_id' => $input['city_id'] ? $input['city_id'] : 0,
|
||||
];
|
||||
$this->cmsM->add($insert);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功!');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$input = $this->input->post(['position', 'app_id', 'id', 'title', 'link', 'cover', 'icon', 's_time', 'e_time'
|
||||
, 'sort', 'sort', 'city_id', 'content', 'param'], true);
|
||||
if (empty($input['title'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标题不能为空!');
|
||||
}
|
||||
if (empty($input['position']) && $input['position'] != '0') {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择推送位置');
|
||||
}
|
||||
if (empty($input['app_id'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误!');
|
||||
}
|
||||
if (empty($input['s_time']) || empty($input['e_time'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '有效时间不能为空!');
|
||||
}
|
||||
$cover = !empty($input['cover']) ? str_replace('https://qimg.haodian.cn/', '', $input['cover']) : $input['cover'];
|
||||
$icon = $input['icon'];
|
||||
$input['link'] = $input['link'] . trim($input['param']);
|
||||
$upd = [
|
||||
'title' => $input['title'],
|
||||
'url' => $input['link'],
|
||||
'cover' => $cover,
|
||||
'icon' => $icon ? $icon : '',
|
||||
'position' => $input['position'],
|
||||
'app_id' => $input['app_id'],
|
||||
'content' => $input['content'],
|
||||
's_time' => strtotime($input['s_time']),
|
||||
'e_time' => strtotime($input['e_time']),
|
||||
'sort' => $input['sort'],
|
||||
'city_id' => $input['city_id'] ? $input['city_id'] : 0,
|
||||
];
|
||||
$this->cmsM->update($upd, ['id' => $input['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
public function edit_status()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$status = $this->input->post('status');
|
||||
$this->cmsM->update(['status' => $status], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
function edit_sort(){
|
||||
$lists = $this->input->post('lists');
|
||||
if (!$lists || !is_array($lists)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
foreach ($lists as $key => $value) {
|
||||
$this->cmsM->update(array('sort' => intval($value['sort'])), array('id' => $value['id']));
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$this->cmsM->delete(array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '删除成功!');
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once(dirname(__DIR__) . '/Appconf.php');
|
||||
|
||||
class Config extends Appconf
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/app_model');
|
||||
$this->load->model("app/appusual/app_config_model");
|
||||
$this->load->model('vipcard/Vipcard_rights_model', 'rightsM');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//展示单条数据
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('app_id');
|
||||
$this->load->model('app/app_model');
|
||||
$this->load->model("sys/sys_city_model", 'city_model');
|
||||
|
||||
$app = $this->app_model->get(array('id' => $id));
|
||||
if (!$app) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "小程序不存在");
|
||||
}
|
||||
$json = $app['jsondata'] ? json_decode($app['jsondata'], true) : array();
|
||||
$json['id'] = $id;
|
||||
$json['name'] = $app['name'];
|
||||
$where = array('status' => 1);
|
||||
$total = $this->city_model->count($where);
|
||||
$citys = array();
|
||||
if ($total) {
|
||||
$rows = $this->city_model->select($where, 'id DESC', 1, 20, 'city_id,name,firstchar');
|
||||
foreach ($rows as $item) {
|
||||
$status = intval($json['citys'][$item['city_id']]);
|
||||
$citys[] = array(
|
||||
'city_id' => $item['city_id'],
|
||||
'firstchar' => $item['firstchar'],
|
||||
'name' => $item['name'],
|
||||
'status' => $status,
|
||||
'statusion' => $status ? '开启' : '关闭',
|
||||
'default_city_id' => $json['city_id'] == $item['city_id'] ? 1 : 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$where = array('app_id' => $id);
|
||||
$select = "k,v";
|
||||
$map_config = $this->app_config_model->map('k', 'v', $where, '', 0, 0, $select);
|
||||
$arr_key = array('hotword');
|
||||
foreach($arr_key as $k){
|
||||
$v = $map_config[$k] ? json_decode($map_config[$k], true) : '';
|
||||
if(!$v && in_array($k, array('hotword'))){
|
||||
$v = [];
|
||||
}
|
||||
$json[$k] = $v;
|
||||
}
|
||||
|
||||
$this->data['type_arr'] = self::$rights_type;
|
||||
$this->data['coup_arr'] = self::$coupon_type;
|
||||
$this->data['info'] = $json;
|
||||
$this->data['citys'] = $citys;
|
||||
$this->data['_title'] = "{$app['name']}-基础设置";
|
||||
return $this->show_view('/app/appusual/get_config', true);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit_city()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
|
||||
$id = $this->input->post('id');
|
||||
$city = $this->input->post('city');
|
||||
$status = $this->input->post('status');
|
||||
$type = $this->input->post('type');
|
||||
|
||||
$this->load->model('app/app_model');
|
||||
|
||||
$app = $this->app_model->get(array('id' => $id));
|
||||
if (!$app) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "id为{$id}小程序不存在");
|
||||
}
|
||||
$json = $app['jsondata'] ? json_decode($app['jsondata'], true) : array();
|
||||
if ($type == 1) {
|
||||
if ($status) {
|
||||
$json['city_id'] = $city;
|
||||
} else {
|
||||
$json['city_id'] = 0;
|
||||
}
|
||||
} else {
|
||||
if ($status) {
|
||||
!$json['citys'][$city] && $json['citys'][$city] = 1;
|
||||
} else {
|
||||
unset($json['citys'][$city]);
|
||||
if (!$json['citys']) {
|
||||
unset($json['citys']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$ret = $this->app_model->update(array('jsondata' => json_encode($json)), 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 edit()
|
||||
{
|
||||
$input = $this->input->post('info');
|
||||
if (!$input['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
$app = $this->app_model->get(array('id' => $input['id']));
|
||||
if (!$app) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "小程序不存在");
|
||||
}
|
||||
$json = json_decode($app['jsondata'], true);
|
||||
//是否开启自定义店铺分类
|
||||
$json_k = array('biz_cate', 'vipcard', 'rights', 'coupons', 'ebiz', 'publish', 'lock_fans', "rpackets");
|
||||
foreach ($json_k as $k) {
|
||||
switch($k){
|
||||
case 'rights':
|
||||
case 'coupons':
|
||||
case 'rpackets':
|
||||
if($input[$k] && is_array($input[$k])){
|
||||
$json[$k] = $input[$k];
|
||||
} else {
|
||||
unset($json[$k]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($input[$k]) {
|
||||
$json[$k] = $input[$k];
|
||||
} else {
|
||||
unset($json[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->app_model->update(array('jsondata' => json_encode($json, JSON_UNESCAPED_UNICODE)), array('id' => $input['id']));
|
||||
|
||||
$config_k = array('hotword');
|
||||
foreach($config_k as $k){
|
||||
$where = array('app_id' => $input['id'], 'k' => $k);
|
||||
$row_config = $this->app_config_model->get($where);
|
||||
if($input[$k]){
|
||||
if($row_config){
|
||||
$upd = array("v" => json_encode($input[$k], JSON_UNESCAPED_UNICODE));
|
||||
$ret = $this->app_config_model->update($upd, array('id' => $row_config['id']));
|
||||
} else {
|
||||
$add = array(
|
||||
'app_id' => $input['id'],
|
||||
'k' => $k,
|
||||
'v' => json_encode($input[$k], JSON_UNESCAPED_UNICODE),
|
||||
'admin_id' => $this->uid,
|
||||
'c_time' => time()
|
||||
);
|
||||
$ret = $this->app_config_model->add($add);
|
||||
}
|
||||
} elseif($row_config) {
|
||||
$ret = $this->app_config_model->delete(array('id' => $row_config['id']));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
//require_once(dirname(__DIR__) . '/Appconf.php');
|
||||
require_once(dirname(__DIR__) . '../../AppBase.php');
|
||||
|
||||
class Subjects extends AppBase
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('Subjects_model', 'subM');
|
||||
$this->load->model('Subject_user_fond_model', 'user_fond_model');
|
||||
$this->load->model('sys/Sys_tag_model', 'sysTag');
|
||||
|
||||
$this->load->service("app/user_service", array("app_id" => $this->app_id));
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists($where = array('status <> -1' => null), $order = 'sort desc, id desc', $page = 1, $size = 20)
|
||||
{
|
||||
$params = $this->input->get();
|
||||
|
||||
$searchTpAry = array("title" => "标题", "nickname" => "用户昵称", "mobile" => "手机号", 'id' => "ID");
|
||||
|
||||
if($params['search_v']){
|
||||
if('nickname' == $params['search_k'] || "mobile" == $params['search_k']){
|
||||
$where_user = array("{$params['search_k']} like '%{$params['search_v']}%'" => null);
|
||||
$orderby = "id desc";
|
||||
$select = "id";
|
||||
$count_user = $this->user_service->count($where_user);
|
||||
if($count_user > 1000){
|
||||
return $this->show_json(SYS_CODE_FAIL, '匹配的用户数过多,请输入更多关键字');
|
||||
}
|
||||
$rows_user = $this->user_service->select($where_user, $orderby, 0, 0, $select);
|
||||
if(count($rows_user) > 1){
|
||||
$str_ids = implode(',', array_column($rows_user, 'id'));
|
||||
$where["app_uid in ({$str_ids})"] = null;
|
||||
} elseif($rows_user){
|
||||
$where["app_uid"] = $rows_user[0]['id'];
|
||||
} else {
|
||||
$where["app_uid"] = -1;
|
||||
}
|
||||
} elseif('title' == $params['search_k']) {
|
||||
$where["{$params['search_k']} like '%{$params['search_v']}%'"] = null;
|
||||
} else {
|
||||
$where[$params['search_k']] = $params['search_v'];
|
||||
}
|
||||
}
|
||||
!$params['search_k'] && $params['search_k'] = 'title';
|
||||
|
||||
if (status_verify($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
} else {
|
||||
$params['status'] = '';
|
||||
}
|
||||
if(strlen($params['top']) > 0){
|
||||
$where['top'] = $params['top'];
|
||||
} else {
|
||||
$params['top'] = '';
|
||||
}
|
||||
if ($params['app_id']) {
|
||||
$where['app_id'] = $params['app_id'];
|
||||
}
|
||||
|
||||
if($params['appcate_id']){
|
||||
$where['cate_id'] = $params['appcate_id'];
|
||||
} else {
|
||||
$params['appcate_id'] = 0;
|
||||
}
|
||||
|
||||
$page = $params['page'] ? $params['page'] : $page;
|
||||
|
||||
$total = $this->subM->count($where);
|
||||
$lists = array();
|
||||
if ($total) {
|
||||
$rows = $this->subM->select($where, $order, $page, $size);
|
||||
$map_reply = array();
|
||||
$map_user= array();
|
||||
if($rows){
|
||||
$ids = array();
|
||||
$uids = array();
|
||||
foreach($rows as $v){
|
||||
!in_array($v['id'], $ids) && $ids[] = $v['id'];
|
||||
!in_array($v['app_uid'], $uids) && $uids[] = $v['app_uid'];
|
||||
}
|
||||
if($uids){
|
||||
$str_ids = implode(',', $uids);
|
||||
$where_user = array("id in ({$str_ids})" => null);
|
||||
$select = 'id, nickname';
|
||||
$map_user = $this->user_service->map('id', 'nickname', $where_user, 'id desc', 0, 0, $select);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($rows as $v) {
|
||||
if (!$v['title']) {
|
||||
$title = mb_strwidth($v['content'], 'utf8') > 30 ? mb_strimwidth($v['content'], 0, 30, '...', 'utf8') : $v['content'];
|
||||
} else {
|
||||
$title = $v['title'];
|
||||
}
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'user' => $map_user[$v['app_uid']],
|
||||
'title' => $title,
|
||||
'status' => $v['status'],
|
||||
'sort' => $v['sort'],
|
||||
'top' => $v['top'],
|
||||
'type' => $v['type']
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
|
||||
$this->data['appList'] = $this->app_list();
|
||||
$this->data['searchTpAry'] = $searchTpAry;
|
||||
$this->data['_title'] = '好评管理';
|
||||
return $this->show_view('/app/appusual/subjects/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
$app_id = intval($this->input->get('app_id'));
|
||||
|
||||
$this->load->service("app/user_service", array("app_id" => $app_id));
|
||||
|
||||
if ($id) {
|
||||
$row_sub = $this->subM->get(array('id' => $id));
|
||||
$row_user = $this->user_service->get(array('id' => $row_sub['app_uid']));
|
||||
//封面
|
||||
$arr = $row_sub['cover'] ? explode(',', $row_sub['cover']) : array();
|
||||
$covers = array();
|
||||
foreach($arr as $v){
|
||||
list($img, $query) = explode('?', $v);
|
||||
parse_str($query, $query_arr);
|
||||
$height = $query_arr['picHeight'];
|
||||
$covers[]= array(
|
||||
'src' => build_qiniu_image_url($img),
|
||||
'value' => $img,
|
||||
'rheight' => $height
|
||||
);
|
||||
}
|
||||
//详细图片
|
||||
$imgs = $row_sub['imgs'] ? json_decode($row_sub['imgs'], true) : array();
|
||||
$img_arr = array();
|
||||
foreach ($imgs as $img) {
|
||||
$str = $img['img'];
|
||||
$img_arr[] = array(
|
||||
'src' => build_qiniu_image_url($str),
|
||||
'value' => $str,
|
||||
'rheight' => $img['height']
|
||||
);
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'id' => $id,
|
||||
'app_id' => $row_sub['app_id'],
|
||||
'uid' => $row_sub['app_uid'],
|
||||
'nickname' => $row_user['nickname'] ? $row_user['nickname'] : '无用户名',
|
||||
'title' => $row_sub['title'],
|
||||
'cate_id' => $row_sub['cate_id'],
|
||||
'imgs' => $img_arr,
|
||||
'video' => $row_sub['video'] ? $row_sub['video'] : '',
|
||||
'video_cover' => $row_sub['video'] ? $row_sub['video']."?vframe/jpg/offset/1" : '',
|
||||
'share_num' => $row_sub['share_num'],
|
||||
'zan_num' => $row_sub['zan_num'],
|
||||
'type' => $row_sub['type'],
|
||||
'content' => $row_sub['content'],
|
||||
);
|
||||
|
||||
$action = 'edit';
|
||||
$acto = "";
|
||||
$_title = '编辑好评';
|
||||
} else {
|
||||
$info = array(
|
||||
'app_id' => $app_id,
|
||||
'uid'=> 0,
|
||||
'nickname' => '请选择用户',
|
||||
'cate_id' => 0,
|
||||
'cover' => array(),
|
||||
'imgs' => array(),
|
||||
'video' => '',
|
||||
'video_cover' => '',
|
||||
'share_num' => rand(10, 100),
|
||||
'zan_num' => rand(10, 100),
|
||||
'type' => 0,
|
||||
);
|
||||
|
||||
$action = 'add';
|
||||
$acto = "/app/appusual/subjects/index?app_id={$app_id}";
|
||||
$_title = '新增好评';
|
||||
}
|
||||
$this->data['info'] = $info;
|
||||
$this->data['app_id'] = $info['app_id'];
|
||||
$this->data['action'] = $action;
|
||||
$this->data['acto'] = $acto;
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view('/app/appusual/subjects/get', 'true');
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
if (!$info['app_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择机构');
|
||||
}
|
||||
if (!$info['uid']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择发布用户');
|
||||
}
|
||||
if (!$info['title']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请填写标题');
|
||||
}
|
||||
if (!$info['content']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请填写内容');
|
||||
}
|
||||
|
||||
//视频
|
||||
$video = $info['video'] ? $info['video'] : '';
|
||||
!$info['type'] && $video = '';
|
||||
//图片列表
|
||||
$imgs = array();
|
||||
$img_arr = $info['imgs'] ? $info['imgs'] : array();
|
||||
foreach ($img_arr as $val) {
|
||||
$imgs[] = array(
|
||||
'img' => $val['value'],
|
||||
'height' => $val['rheight'],
|
||||
);
|
||||
}
|
||||
|
||||
$ins = array(
|
||||
'title' => $info['title'],
|
||||
'app_uid' => $info['uid'],
|
||||
'app_id' => $info['app_id'],
|
||||
'type' => $info['type'],
|
||||
'imgs' => $imgs ? json_encode($imgs, JSON_UNESCAPED_UNICODE) : '',
|
||||
'video' => $video,
|
||||
'content' => $info['content'] ? $info['content'] : '',
|
||||
'fav_num' => $info['fav_num'] ? $info['fav_num'] : '0',
|
||||
'zan_num' => $info['zan_num'] ? $info['zan_num'] : '0',
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
);
|
||||
|
||||
$sub_id = $this->subM->add($ins);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
if (!$info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误');
|
||||
}
|
||||
if (!$info['app_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误');
|
||||
}
|
||||
if (!$info['uid']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择发布用户');
|
||||
}
|
||||
if (!$info['title']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请填写标题');
|
||||
}
|
||||
if (!$info['content']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请填写内容');
|
||||
}
|
||||
//视频
|
||||
$video = $info['video'] ? $info['video'] : '';
|
||||
!$info['type'] && $video = '';
|
||||
//图片列表
|
||||
$imgs = array();
|
||||
$img_arr = $info['imgs'] ? $info['imgs'] : array();
|
||||
foreach ($img_arr as $val) {
|
||||
$imgs[] = array(
|
||||
'img' => $val['value'],
|
||||
'height' => $val['rheight'],
|
||||
);
|
||||
}
|
||||
|
||||
$upd = array(
|
||||
'title' => $info['title'],
|
||||
'app_uid' => $info['uid'],
|
||||
'app_id' => $info['app_id'],
|
||||
'type' => $info['type'],
|
||||
'imgs' => $imgs ? json_encode($imgs, JSON_UNESCAPED_UNICODE) : '',
|
||||
'video' => $video,
|
||||
'content' => $info['content'] ? $info['content'] : '',
|
||||
'share_num' => $info['share_num'] ? $info['share_num'] : '0',
|
||||
'zan_num' => $info['zan_num'] ? $info['zan_num'] : '0',
|
||||
'status' => 1,
|
||||
);
|
||||
|
||||
$this->subM->update($upd, array('id' => $info['id']));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
/**
|
||||
* 置顶
|
||||
* @return bool
|
||||
*/
|
||||
public function edit_top()
|
||||
{
|
||||
$app_id = $this->input->get('app_id');
|
||||
$input = $this->input->post();
|
||||
if (!$input['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误');
|
||||
}
|
||||
$this->subM->update(array('top' => $input['top']), array('id' => $input['id'], 'app_id' => $app_id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功');
|
||||
}
|
||||
|
||||
//修改状态
|
||||
public function edit_status()
|
||||
{
|
||||
$app_id = $this->input->get('app_id');
|
||||
$status = $this->input->post('status');
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误');
|
||||
}
|
||||
$this->subM->update(array('status' => $status), array('id' => $id, 'app_id' => $app_id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* @return bool
|
||||
*/
|
||||
function edit_sort(){
|
||||
$app_id = $this->input->get('app_id');
|
||||
$lists = $this->input->post('lists');
|
||||
if (!$lists || !is_array($lists)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
foreach ($lists as $key => $value) {
|
||||
$this->subM->update(array('sort' => intval($value['sort'])), array('id' => $value['id'], 'app_id' => $app_id));
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del(){
|
||||
// TODO: Implement del() method.
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
$app_id = $this->input->get('app_id');
|
||||
$input = $this->input->post();
|
||||
if (!$input['id'] || !status_verify($input['value'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交错误');
|
||||
}
|
||||
$this->subM->update(array('status' => $input['value']), array('id in (' . $input['id'] . ')' => null, 'app_id' => $app_id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+202
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Vim.
|
||||
* User: lcc
|
||||
* Date: 2021/06/28
|
||||
* Time: 16:50
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Cms extends HD_Controller
|
||||
{
|
||||
private $log_dir;
|
||||
static $pos_arr = array(
|
||||
'首页bannber','热门活动','购车banner'
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/liche/App_liche_cms_model', 'liche_cms_model');
|
||||
$this->load->model('app/App_model', 'appM');
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists($where = array(), $order = 'sort DESC, id DESC', $page = '1', $size = '10')
|
||||
{
|
||||
$this->data['title'] = $title = $this->input->get('title');
|
||||
$this->data['status'] = $status = $this->input->get('status');
|
||||
$this->data['position'] = $position = $this->input->get('position');
|
||||
$this->data['area'] = $area = $this->input->get('area');
|
||||
$page = $this->input->get('page') ? $this->input->get('page') : '1';
|
||||
if ($title) {
|
||||
$where['title LIKE "%' . trim($title) . '%"'] = NULL;
|
||||
}
|
||||
if (status_verify($status)) {
|
||||
$where['status'] = $status;
|
||||
}
|
||||
if (status_verify($position)) {
|
||||
$where['position'] = $position;
|
||||
}
|
||||
$lists = $this->liche_cms_model->select($where, $order, $page, $size, 'id,s_time,e_time,status,title,sort,position');
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['s_time'] = date('Y-m-d H:i:s', $value['s_time']);
|
||||
$lists[$key]['e_time'] = date('Y-m-d H:i:s', $value['e_time']);
|
||||
$lists[$key]['position'] = self::$pos_arr[$value['position']];
|
||||
}
|
||||
$count = $this->liche_cms_model->count($where);
|
||||
$this->data['pos_arr'] = self::$pos_arr;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count, 'total' => $count);
|
||||
$this->data['_title'] = $this->title . '列表';
|
||||
return $this->show_view('/app/liche/cms/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
if($id){
|
||||
$row = $this->liche_cms_model->get(array('id' => $id));
|
||||
$arr = $row['cover'] ? explode(',', $row['cover']) : array();
|
||||
|
||||
$covers = array();
|
||||
foreach($arr as $val){
|
||||
$covers[] = build_qiniu_image_url($val);
|
||||
}
|
||||
|
||||
$row['link'] = $row['url'];
|
||||
$row['s_time'] = date('Y-m-d H:i:s', $row['s_time']);
|
||||
$row['e_time'] = date('Y-m-d H:i:s', $row['e_time']);
|
||||
$opration = 'edit';
|
||||
$title = "编辑{$row['title']}";
|
||||
|
||||
} else {
|
||||
$row = array('position' => '', 'type' => 1);
|
||||
$opration = 'add';
|
||||
$title = '添加推送信息';
|
||||
$covers = array();
|
||||
}
|
||||
//列表
|
||||
$this->data['app_id'] = 3;
|
||||
$this->data['info'] = $row;
|
||||
$this->data['pos_arr'] = self::$pos_arr;
|
||||
$this->data['covers'] = $covers;
|
||||
$this->data['url'] = $opration;
|
||||
$this->data['_title'] = $title;
|
||||
return $this->show_view('/app/liche/cms/edit', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$input = $this->input->post('info');
|
||||
if (empty($input['title'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标题不能为空!');
|
||||
}
|
||||
if (!status_verify($input['position'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择推送位置');
|
||||
}
|
||||
if (!$input['s_time'] || !$input['e_time']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '有效时间不能为空!');
|
||||
}
|
||||
|
||||
$cover = !empty($input['cover']) ? str_replace('https://qimg.haodian.cn/', '', $input['cover']) : $input['cover'];
|
||||
$input['link'] = $input['link'] . trim($input['param']);
|
||||
$insert = [
|
||||
'title' => $input['title'] ? $input['title'] : '',
|
||||
'url' => $input['link'] ? $input['link'] : '',
|
||||
'type' => intval($input['type']),
|
||||
'cover' => $cover ? $cover : '',
|
||||
'target_id' => intval($input['target_id']),
|
||||
'position' => intval($input['position']),
|
||||
'content' => $input['content'] ? $input['content'] : '',
|
||||
's_time' => strtotime($input['s_time']),
|
||||
'e_time' => strtotime($input['e_time']),
|
||||
'sort' => intval($input['sort']),
|
||||
];
|
||||
|
||||
$json = array();
|
||||
if($json){
|
||||
$insert['jsondata'] = json_encode($json, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$ret = $this->liche_cms_model->add($insert);
|
||||
if(!$ret){
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败!');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功!');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$input = $this->input->post('info');
|
||||
if (empty($input['title'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标题不能为空!');
|
||||
}
|
||||
if (!status_verify($input['position'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择推送位置');
|
||||
}
|
||||
if (empty($input['s_time']) || empty($input['e_time'])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '有效时间不能为空!');
|
||||
}
|
||||
|
||||
$cover = !empty($input['cover']) ? str_replace('https://qimg.haodian.cn/', '', $input['cover']) : $input['cover'];
|
||||
$input['link'] = $input['link'] . trim($input['param']);
|
||||
$upd = [
|
||||
'title' => $input['title'] ? $input['title'] : '',
|
||||
'url' => $input['link'] ? $input['link'] : '',
|
||||
'type' => intval($input['type']),
|
||||
'cover' => $cover ? $cover : '',
|
||||
'target_id' => intval($input['target_id']),
|
||||
'position' => intval($input['position']),
|
||||
'content' => $input['content'] ? $input['content'] : '',
|
||||
's_time' => strtotime($input['s_time']),
|
||||
'e_time' => strtotime($input['e_time']),
|
||||
'sort' => intval($input['sort']),
|
||||
];
|
||||
$this->liche_cms_model->update($upd, ['id' => $input['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
public function edit_status()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$status = $this->input->post('status');
|
||||
$this->liche_cms_model->update(['status' => $status], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$this->liche_cms_model->delete(array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '删除成功!');
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function get_car(){
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->auto_series_model->get(['id'=>$id]);
|
||||
$b_row = $this->auto_brand_model->get(['id'=>$row['brand_id']]);
|
||||
$info['id'] = $row['id'];
|
||||
$info['title'] = $b_row['name'].$row['name'];
|
||||
$info['img'] = '/img/visits/add.jpg';
|
||||
$this->data['data'] = $info;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?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 = 1;
|
||||
parent::__construct();
|
||||
$this->load->model('app/liche/App_liche_cms_model', 'cmsM');
|
||||
$this->load->model('app/liche/App_liche_users_model', 'userM');
|
||||
|
||||
$this->load->model('Subjects_model', 'subM');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
/*应用状况*/
|
||||
$conditions = array();
|
||||
|
||||
/*小程序设置 start*/
|
||||
$list = array();
|
||||
// 用户数据
|
||||
$value = $this->userM->count([]);
|
||||
$list[] = array(
|
||||
'title' => '用户(人)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/liche/member/index'),
|
||||
),
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
$list = [];
|
||||
$value = $this->subM->count(array('app_id' => $this->app_id));
|
||||
$list[] = array(
|
||||
'title' => '话题管理',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/appusual/subjects/index?app_id=' . $this->app_id),
|
||||
),
|
||||
);
|
||||
|
||||
$value = $this->cmsM->count();
|
||||
$list[] = array(
|
||||
'title' => '内容推送',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/liche/cms/index'),
|
||||
),
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
/*小程序设置 end*/
|
||||
|
||||
/*实时数据 end*/
|
||||
|
||||
$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.
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+163
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Member extends HD_Controller{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/liche/App_liche_users_model', 'userM');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists($where = array())
|
||||
{
|
||||
$input = $this->input->get();
|
||||
$page = $input['page'];
|
||||
$size = $input['size'];
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
if ($input['enCredits']) {
|
||||
$where['credits <> 0'] = null;
|
||||
}
|
||||
if ($input['name']) {
|
||||
$where['nickname like "%' . $input['name'] . '%"'] = null;
|
||||
$this->data['name'] = $input['name'];
|
||||
}
|
||||
if ($input['mobile']) {
|
||||
$where['mobile'] = $input['mobile'];
|
||||
$this->data['mobile'] = $input['mobile'];
|
||||
}
|
||||
if ($input['card_id']) {
|
||||
$where['card_id'] = $input['card_id'];
|
||||
$this->data['card_id'] = $input['card_id'];
|
||||
}
|
||||
|
||||
$count = $this->userM->count($where);
|
||||
$lists = $this->userM->select($where,'id desc',$page,$size);
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['_title'] = '用户列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
|
||||
return $this->show_view('/app/liche/member/lists', true);
|
||||
}
|
||||
|
||||
|
||||
//展示单条数据
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
if ($id) {
|
||||
$row = $this->userM->get(array('id' => $id));
|
||||
$item = array(
|
||||
'id' => $row['id'],
|
||||
'nickname' => $row['nickname'],
|
||||
'mobile' => $row['mobile'],
|
||||
'logo' => $row['headimg'],
|
||||
'logo_src' => build_qiniu_image_url($row['headimg']),
|
||||
);
|
||||
} else {
|
||||
$item = array();
|
||||
}
|
||||
|
||||
$this->data['item'] = $item;
|
||||
$this->data['_title'] = $item['id'] ? '编辑马甲' : '新增马甲';
|
||||
return $this->show_view('app/flyish/member/get', true);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
$nickname = $this->input->post('nickname');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$headimg = $this->input->post('logo');
|
||||
|
||||
if (!$mobile) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入手机号');
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入昵称');
|
||||
}
|
||||
|
||||
$exist = $this->userM->get(array('mobile' => $mobile));
|
||||
if ($exist) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
|
||||
}
|
||||
|
||||
$add = array(
|
||||
'mobile' => $mobile,
|
||||
'nickname' => $nickname,
|
||||
'headimg' => $headimg ? $headimg : '',
|
||||
'group_id' => 4,
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
);
|
||||
|
||||
$id = $this->userM->add($add);
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$nickname = $this->input->post('nickname');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$headimg = $this->input->post('logo');
|
||||
|
||||
if (!$mobile) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入手机号');
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入昵称');
|
||||
}
|
||||
|
||||
$old = $this->userM->get(array('id' => $id));
|
||||
if (4 != $old['group_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '只支持编辑马甲');
|
||||
}
|
||||
|
||||
$exist = $this->userM->get(array('mobile' => $mobile, 'id <>' => $id));
|
||||
if ($exist) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
|
||||
}
|
||||
|
||||
$upd = array(
|
||||
'mobile' => $mobile,
|
||||
'nickname' => $nickname,
|
||||
'headimg' => $headimg ? $headimg : '',
|
||||
);
|
||||
|
||||
$this->userM->update($upd, array('id' => $id));
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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 = array();
|
||||
// 用户数据
|
||||
$value = $this->userM->count([]);
|
||||
$list[] = array(
|
||||
'title' => '用户(人)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/licheb/member/index'),
|
||||
),
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
/*小程序设置 end*/
|
||||
|
||||
/*实时数据 end*/
|
||||
|
||||
$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.
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+139
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Member extends HD_Controller{
|
||||
|
||||
private $groups = [1=>'销售',2=>'店长',3=>'掌柜'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists($where = array())
|
||||
{
|
||||
$input = $this->input->get();
|
||||
$page = $input['page'];
|
||||
$size = $input['size'];
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
if ($input['name']) {
|
||||
$where['uname like "%' . $input['name'] . '%"'] = null;
|
||||
$this->data['name'] = $input['name'];
|
||||
}
|
||||
if ($input['mobile']) {
|
||||
$where['mobile'] = $input['mobile'];
|
||||
$this->data['mobile'] = $input['mobile'];
|
||||
}
|
||||
|
||||
$count = $this->userM->count($where);
|
||||
$lists = $this->userM->select($where,'id desc',$page,$size);
|
||||
foreach($lists as $key=>$val){
|
||||
$lists[$key]['group_name'] = $this->groups[$val['group_id']];
|
||||
}
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$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()
|
||||
{
|
||||
$row = [];
|
||||
$this->data['row'] = $row;
|
||||
$this->data['groups'] = $this->groups;
|
||||
$this->data['_title'] = $row ? '编辑用户' : '添加用户';
|
||||
return $this->show_view('app/licheb/member/get');
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add(){
|
||||
|
||||
$uname = $this->input->post('uname');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$group_id = $this->input->post('group_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));
|
||||
if ($exist) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
|
||||
}
|
||||
|
||||
$add = array(
|
||||
'mobile' => $mobile,
|
||||
'uname' => $uname,
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
);
|
||||
$group_id && $add['group_id'] = $group_id;
|
||||
$id = $this->userM->add($add);
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$nickname = $this->input->post('nickname');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$group_id = $this->input->post('group_id');
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
|
||||
}
|
||||
|
||||
$exist = $this->userM->get(array('mobile' => $mobile, 'id <>' => $id));
|
||||
if ($exist) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
|
||||
}
|
||||
|
||||
$upd = array(
|
||||
'mobile' => $mobile,
|
||||
);
|
||||
|
||||
$group_id && $add['group_id'] = $group_id;
|
||||
$nickname && $add['nickname'] = $nickname;
|
||||
|
||||
$this->userM->update($upd, array('id' => $id));
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+782
@@ -0,0 +1,782 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: hrc
|
||||
* edit by xiaobo
|
||||
* Date: 2018/11/20
|
||||
* Time: 14:19
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Brand extends HD_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model("biz/biz_brand_model", 'bizBrand');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$this->data['brand_name'] = $this->input->get('brand_name');
|
||||
$page = $this->input->get('page');
|
||||
!$page && $page = 1;
|
||||
$pagesize = 20;
|
||||
$where = array();
|
||||
$where["status > -1"] = null;
|
||||
$this->data['brand_name'] && $where["brand_name like '%" . $this->data['brand_name'] . "%'"] = null;
|
||||
$count = $this->bizBrand->count($where);
|
||||
$list = $this->bizBrand->select($where, 'id desc', $page, $pagesize);
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['_title'] = '品牌列表';
|
||||
$this->data['pager']['total'] = $count;
|
||||
$this->show_view('biz/brand/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
if ($id) {
|
||||
$info = $this->bizBrand->get(array('id' => $id));
|
||||
if (!$info || empty($info)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$this->data['id'] = $id;
|
||||
$this->data['info'] = $info;
|
||||
}
|
||||
$this->data['_title'] = $id ? '编辑品牌' : '新增品牌';
|
||||
return $this->show_view('biz/brand/edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* json格式获取品牌数据
|
||||
* @return bool
|
||||
*/
|
||||
function get_json(){
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$row = $this->bizBrand->get(array('id' => $id));
|
||||
$info = array(
|
||||
'id' => $row['id'],
|
||||
'brand_name' => $row['brand_name'],
|
||||
);
|
||||
$this->data = $info;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
$brand_name = $this->input->post('brand_name');
|
||||
$img = $this->input->post('img');
|
||||
if (!$brand_name || empty($brand_name)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空');
|
||||
}
|
||||
//防止品牌名称重复添加
|
||||
$where1 = array('brand_name' => $brand_name, 'status>-1' => null);
|
||||
$old = $this->bizBrand->get($where1);
|
||||
if ($old) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌已经存在');
|
||||
}
|
||||
$add_brand_data = array(
|
||||
'brand_name' => $brand_name,
|
||||
'brand_logo' => $img,
|
||||
'c_time' => time()
|
||||
);
|
||||
$brand_id = $this->bizBrand->add($add_brand_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->get('id');
|
||||
$info = $this->bizBrand->get(array('id' => $id));
|
||||
if (!$info || empty($info)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$brand_name = $this->input->post('brand_name');
|
||||
$img = $this->input->post('img');
|
||||
if (!$brand_name || empty($brand_name)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空');
|
||||
}
|
||||
//防止品牌名称重复添加
|
||||
$where1 = array('brand_name' => $brand_name, "status<>-1" => null);
|
||||
$id && $where1['id <>'] = $id;//修改时也不允许重复
|
||||
$old = $this->bizBrand->get($where1);
|
||||
if ($old) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌已经存在');
|
||||
}
|
||||
$add_brand_data = array(
|
||||
'brand_name' => $brand_name,
|
||||
'brand_logo' => $img,
|
||||
);
|
||||
$this->bizBrand->update($add_brand_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->bizBrand->update(array('status' => $stauts), $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:品牌管理员
|
||||
* Created on: 2020/4/7 10:16
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function lists_admin()
|
||||
{
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$brand_id = intval($params['brand_id']);
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||||
}
|
||||
$brand = $this->bizBrand->get(array('id' => $brand_id));
|
||||
if (!$brand || empty($brand)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌不存在!');
|
||||
}
|
||||
$brand_name = $brand['brand_name'];
|
||||
$where['brand_id'] = $brand_id;
|
||||
$where['biz_id'] = 0;
|
||||
if ($params['mobile']) {
|
||||
$user = $this->mdUser->get(array('mobile' => $params['mobile'], 'status' => 1));
|
||||
$where['uid'] = $user ? $user['uid'] : '0';
|
||||
}
|
||||
$count = $this->mdUserBiz->count($where);
|
||||
$lists = array();
|
||||
if ($count) {
|
||||
$lists = $this->mdUserBiz->select($where, "id desc", $params['page'], $params['size']);
|
||||
foreach ($lists as $key => &$value) {
|
||||
$user = $this->mdUser->get(array('uid' => $value['uid']));
|
||||
$value['uname'] = $user['uname'];
|
||||
$value['mobile'] = $user['mobile'];
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['_title'] = "品牌{$brand_name}管理员列表";
|
||||
$this->data['params'] = $params;
|
||||
$this->show_view('biz/brand/lists_admin', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取品牌管理员
|
||||
* Created on: 2020/4/7 10:46
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function get_admin()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
$info = array();
|
||||
$id && $info = $this->mdUserBiz->get(array('id' => $id));
|
||||
if ($info) {
|
||||
$brand_id = $info['brand_id'];
|
||||
$user = $this->mdUser->get(array('uid' => $info['uid']));
|
||||
$info['mobile'] = $user['mobile'];
|
||||
$info['uname'] = $user['uname'];
|
||||
} else {
|
||||
$info['brand_id'] = $brand_id;
|
||||
$info['role'] = 0;
|
||||
}
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌不存在!');
|
||||
}
|
||||
$info['plugins'] = json_decode($info['plugins'], true);
|
||||
$info['plugins'] = $info['plugins'] ? $info['plugins'] : null;
|
||||
|
||||
//店铺名称
|
||||
$brand = $this->bizBrand->get(array('id' => $brand_id));
|
||||
$brand_name = $brand['brand_name'];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['plugins_lists'] = array(array('title' => '接单宝', 'value' => 'jdb'),
|
||||
array('title' => '核销', 'value' => 'hx'), array('title' => '私域通', 'value' => 'syt'),
|
||||
array('title' => '电销通', 'value' => 'dxt'));
|
||||
$this->data['_title'] = "店铺{$brand_name}管理员";
|
||||
$this->show_view('biz/brand/edit_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:新增品牌管理员
|
||||
* Created on: 2020/4/7 10:48
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function add_admin()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$brand_id = intval($info['brand_id']);
|
||||
$mobile = trim($info['mobile']);
|
||||
$uname = trim($info['uname']);
|
||||
$role = intval($info['role']);
|
||||
$plugins = $info['plugins'];
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌不存在');
|
||||
}
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
$uid = $user['uid'];
|
||||
$isbiz = $this->mdUserBiz->get(array('uid' => $uid, 'biz_id' => 0, 'type' => 0));
|
||||
if ($isbiz) {
|
||||
$re_b = $this->bizBrand->get(array('id' => $isbiz['brand_id']));
|
||||
$brand_name = $re_b['brand_name'] ? $re_b['brand_name'] : '品牌';
|
||||
return $this->show_json(0, "该用户已是【" . $brand_name . "】管理员了");
|
||||
}
|
||||
//绑定商家
|
||||
$data['uid'] = $uid;
|
||||
$data['brand_id'] = $brand_id;
|
||||
$data['biz_id'] = 0;
|
||||
$data['type'] = 0;
|
||||
$data['role'] = $role;
|
||||
$plugins && $data['plugins'] = json_encode($plugins, JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->mdUserBiz->add($data);
|
||||
if (!$id) {
|
||||
return $this->show_json(0, "提交失败");
|
||||
}
|
||||
$this->data = $data;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改品牌管理员
|
||||
* Created on: 2020/4/7 14:50
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function edit_admin()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$id = $info['id'];
|
||||
$brand_id = $info['brand_id'];
|
||||
$mobile = trim($info['mobile']);
|
||||
$uname = trim($info['uname']);
|
||||
$role = intval($info['role']);
|
||||
$plugins = $info['plugins'];
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌不存在');
|
||||
}
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
$uid = $user['uid'];
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
$isbiz = $this->mdUserBiz->get(array('id <>' => $id, 'uid' => $uid, 'biz_id' => 0, 'type' => 0));
|
||||
if ($isbiz) {
|
||||
$re_b = $this->bizBrand->get(array('id' => $isbiz['brand_id']));
|
||||
$brand_name = $re_b['brand_name'] ? $re_b['brand_name'] : '品牌';
|
||||
return $this->show_json(0, "该用户已是【" . $brand_name . "】管理员了");
|
||||
}
|
||||
//绑定商家
|
||||
$data['uid'] = $uid;
|
||||
$data['brand_id'] = $brand_id;
|
||||
$data['role'] = $role;
|
||||
$data['plugins'] = $plugins ? json_encode($plugins, JSON_UNESCAPED_UNICODE) : '{}';
|
||||
$this->mdUserBiz->update($data, array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除品牌管理员
|
||||
* Created on: 2020/4/7 10:28
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function del_admin()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '非法参数');
|
||||
}
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('app/jdb/receiver_orders_model');
|
||||
|
||||
//删除管理员先解除占用的接单宝订单
|
||||
$upd = array('r_ubid' => 0);
|
||||
$where = array('r_ubid' => $id);
|
||||
$ret = $this->receiver_orders_model->update($upd, $where);
|
||||
if (!$ret) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
|
||||
$this->mdUserBiz->delete(array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 管理员列表
|
||||
*/
|
||||
public function lists_manager()
|
||||
{
|
||||
$this->data['brand_id'] = $brand_id = intval($this->input->get('brand_id', true));
|
||||
$this->data['mobile'] = $mobile = $this->input->get('mobile', true);
|
||||
$status = $this->input->get('status');
|
||||
!isset($status) && $status = 'a';
|
||||
$this->data['status'] = $status;
|
||||
|
||||
$page = $this->input->get('page');
|
||||
!$page && $page = 1;
|
||||
$size = 20;
|
||||
$user_model = "user_model";
|
||||
$ub_model = "user_brand_model";
|
||||
$this->load->model('user/user_model');
|
||||
$this->load->model('user/user_brand_model');
|
||||
|
||||
$brand = $this->bizBrand->get(array('id' => $brand_id));
|
||||
$brand_name = $brand['brand_name'];
|
||||
|
||||
$where = array('brand_id' => $brand_id);
|
||||
if ($mobile) {
|
||||
$where1 = array('mobile' => $mobile, 'status' => 1);
|
||||
$user = $this->$user_model->get($where1);
|
||||
$where['uid'] = $user ? $user['uid'] : '0';
|
||||
}
|
||||
|
||||
'a' != $status && $where['status'] = $status;
|
||||
$count = $this->$ub_model->count($where);
|
||||
$lists = array();
|
||||
if ($count) {
|
||||
$lists = $this->$ub_model->select($where, 'id DESC', $page, $size);
|
||||
foreach ($lists as &$item) {
|
||||
$user = $this->$user_model->get(array('uid' => $item['uid']));
|
||||
$item['uname'] = $user['uname'];
|
||||
$item['mobile'] = $user['mobile'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page);
|
||||
$this->data['_title'] = "品牌{$brand_name}管理员列表";
|
||||
|
||||
$this->show_view('biz/brand/lists_manager', true);
|
||||
}
|
||||
|
||||
public function get_manager()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$user_model = "user_model";
|
||||
$ub_model = "user_brand_model";
|
||||
$this->load->model('user/user_model');
|
||||
$this->load->model('user/user_brand_model');
|
||||
$info = array();
|
||||
$id && $info = $this->$ub_model->get(array('id' => $id));
|
||||
if ($info) {
|
||||
$brand_id = $info['brand_id'];
|
||||
$user = $this->$user_model->get(array('uid' => $info['uid']));
|
||||
$info['mobile'] = $user['mobile'];
|
||||
$info['uname'] = $user['uname'];
|
||||
} else {
|
||||
$info['brand_id'] = $brand_id;
|
||||
}
|
||||
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家不存在!');
|
||||
}
|
||||
|
||||
//店铺名称
|
||||
$brand = $this->bizBrand->get(array('id' => $brand_id));
|
||||
$brand_name = $brand['brand_name'];
|
||||
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = "店铺{$brand_name}管理员";
|
||||
$this->show_view('biz/brand/edit_manager');
|
||||
}
|
||||
|
||||
public function add_manager()
|
||||
{
|
||||
$brand_id = $this->input->post('brand_id');
|
||||
$mobile = trim($this->input->post('mobile'));
|
||||
$uname = trim($this->input->post('uname'));
|
||||
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在');
|
||||
}
|
||||
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
$ub_model = "user_brand_model";
|
||||
$this->load->model("user/{$ub_model}");
|
||||
$sup = $this->$ub_model->get(array('brand_id' => $brand_id));
|
||||
if ($sup) {
|
||||
return $this->show_json(0, "该品牌已经有管理员了");
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
$uid = $user['uid'];
|
||||
$this->load->model("user/user_biz_model");
|
||||
$this->load->model("user/user_model");
|
||||
$isbiz = $this->user_biz_model->get(array('uid' => $uid));
|
||||
if ($isbiz) {
|
||||
$re_b = $this->bizBrand->get(array('id' => $isbiz['brand_id']));
|
||||
$brand_name = $re_b['brand_name'] ? $re_b['brand_name'] : '品牌';
|
||||
return $this->show_json(0, "该用户已是【" . $brand_name . "】管理员了");
|
||||
}
|
||||
//绑定商家
|
||||
$data = array('uid' => $uid);
|
||||
$data['brand_id'] = $brand_id;
|
||||
$this->$ub_model->add($data);
|
||||
//生成商家关联数据
|
||||
//座上宾
|
||||
$this->load->model('app/zsb/app_zsb_user_model');
|
||||
$res = $this->app_zsb_user_model->get(array('mobile' => $mobile));
|
||||
if (!$res) {
|
||||
$this->app_zsb_user_model->add(array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time()));
|
||||
$tmp = $this->user_model->get(array('mobile' => $mobile));
|
||||
if (!$tmp) {
|
||||
$this->user_model->add(array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time()));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
|
||||
}
|
||||
|
||||
public function edit_manager()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$brand_id = $this->input->post('brand_id');
|
||||
$mobile = trim($this->input->post('mobile'));
|
||||
$uname = trim($this->input->post('uname'));
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$brand_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '品牌不存在');
|
||||
}
|
||||
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
|
||||
$uid = $user['uid'];
|
||||
$this->load->model("user/user_biz_model");
|
||||
$isbiz = $this->user_biz_model->get(array('uid' => $uid));
|
||||
if ($isbiz) {
|
||||
$re_b = $this->bizBrand->get(array('id' => $isbiz['brand_id']));
|
||||
$brand_name = $re_b['brand_name'] ? $re_b['brand_name'] : '品牌';
|
||||
return $this->show_json(0, "该用户已是【" . $brand_name . "】管理员了");
|
||||
}
|
||||
$ub_model = "user_brand_model";
|
||||
$this->load->model("user/{$ub_model}");
|
||||
$this->load->model('app/zsb/app_zsb_user_model');
|
||||
$this->load->model("user/user_model");
|
||||
$ubiz = $this->$ub_model->get(array('id' => $id));
|
||||
//uid不变,不做修改
|
||||
if ($ubiz['uid'] == $uid) {
|
||||
//座上宾修改
|
||||
$this->app_zsb_user_model->update(array('uname' => $uname), array('mobile' => $mobile));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
//绑定商家
|
||||
$data = array('uid' => $uid);
|
||||
$data['brand_id'] = $brand_id;
|
||||
$this->$ub_model->update($data, array('id' => $id));
|
||||
//生成商家关联数据
|
||||
//座上宾
|
||||
$res = $this->app_zsb_user_model->get(array('mobile' => $mobile));
|
||||
if (!$res) {
|
||||
$this->app_zsb_user_model->add(array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time()));
|
||||
$tmp = $this->user_model->get(array('mobile' => $mobile));
|
||||
if (!$tmp) {
|
||||
$this->user_model->add(array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time()));
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
|
||||
public function del_manager()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '操作出错');
|
||||
}
|
||||
$this->load->model('user/user_brand_model');
|
||||
$this->user_brand_model->delete(array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息(不存在新增,可以修改名称)
|
||||
* @param $mobile
|
||||
* @param $uname
|
||||
* @return array (status, data, msg)
|
||||
*/
|
||||
private function get_hduser($mobile, $uname)
|
||||
{
|
||||
$status = 1;
|
||||
$msg = '';
|
||||
$data = array();
|
||||
|
||||
if (!$mobile || !$uname) {
|
||||
$status = 0;
|
||||
$msg = "手机号或者名称不能为空";
|
||||
goto end;
|
||||
}
|
||||
|
||||
$where = array('mobile' => $mobile);
|
||||
|
||||
$this->load->model('user/user_model');
|
||||
$info = $this->user_model->get($where);
|
||||
|
||||
//新增
|
||||
if (!$info) {
|
||||
$data = array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time(), 'cf_title' => '管理员', 'cf_platform' => '后台添加');
|
||||
$uid = $this->user_model->add($data);
|
||||
if (!$uid) {
|
||||
$status = 0;
|
||||
$msg = "用户添加失败";
|
||||
} else {
|
||||
$data['uid'] = $uid;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
|
||||
//状态异常
|
||||
if (1 != $info['status']) {
|
||||
$status = 0;
|
||||
$msg = "用户存在,但状态异常";
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
$data = array('uname' => $uname);
|
||||
$this->user_model->update($data, array('uid' => $info['uid']));
|
||||
$info['uname'] = $uname;
|
||||
|
||||
$data = $info;
|
||||
|
||||
end:
|
||||
return array($status, $data, $msg);
|
||||
}
|
||||
|
||||
public function get_brand_smcard()
|
||||
{
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$this->load->model('biz/biz_brand_smcard_model', 'brand_smcard_model');
|
||||
$row = $this->brand_smcard_model->get(array('brand_id' => $brand_id));
|
||||
$jsondata = json_decode($row['jsondata'], true);
|
||||
!$row && $row['brand_id'] = $brand_id;
|
||||
$this->data['row'] = $row;
|
||||
$this->data['json'] = $jsondata;
|
||||
$this->show_view('biz/brand/edit_smcard');
|
||||
}
|
||||
|
||||
public function edit_brand_smcard()
|
||||
{
|
||||
if ($this->input->method() == 'post') {
|
||||
$id = $this->input->post('id');
|
||||
$mid = $this->input->post('mid');
|
||||
$merchant_no = $this->input->post('merchant_no');
|
||||
$main = $this->input->post('main');
|
||||
$other = $this->input->post('other');
|
||||
$this->load->model('biz/biz_brand_smcard_model', 'brand_smcard_model');
|
||||
$row = $this->brand_smcard_model->get(array('id' => $id,'type'=>0));
|
||||
$jsondata = [];
|
||||
$row && $jsondata = json_decode($row['jsondata'], true);
|
||||
$jsondata['main'] = $main;
|
||||
$jsondata['other'] = $other;
|
||||
$data = [
|
||||
'mid' => $mid,
|
||||
'merchant_no' => $merchant_no,
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
if ($row) {
|
||||
$res = $this->brand_smcard_model->update($data, array('id' => $row['id']));
|
||||
} else {
|
||||
$data['brand_id'] = $this->input->post('brand_id');
|
||||
$data['type'] = 0;
|
||||
$data['c_time'] = time();
|
||||
$res = $this->brand_smcard_model->add($data);
|
||||
}
|
||||
if ($res) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get_brand_yshd()
|
||||
{
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$this->load->model('biz/biz_brand_smcard_model', 'brand_smcard_model');
|
||||
$row = $this->brand_smcard_model->get(array('brand_id' => $brand_id,'type'=>1));
|
||||
$jsondata = json_decode($row['jsondata'], true);
|
||||
!$row && $row['brand_id'] = $brand_id;
|
||||
$this->data['row'] = $row;
|
||||
$this->data['json'] = $jsondata;
|
||||
$this->show_view('biz/brand/edit_yshd');
|
||||
}
|
||||
|
||||
public function edit_brand_yshd()
|
||||
{
|
||||
if ($this->input->method() == 'post') {
|
||||
$id = $this->input->post('id');
|
||||
$mid = $this->input->post('mid');
|
||||
$merchant_no = $this->input->post('merchant_no');
|
||||
$main = $this->input->post('main');
|
||||
$other = $this->input->post('other');
|
||||
$this->load->model('biz/biz_brand_smcard_model', 'brand_smcard_model');
|
||||
$row = $this->brand_smcard_model->get(array('id' => $id,'type' => 1));
|
||||
$jsondata = [];
|
||||
$row && $jsondata = json_decode($row['jsondata'], true);
|
||||
if ($mid) {
|
||||
if (!$main['srv_rate']) return $this->show_json(SYS_CODE_FAIL, '请输入主商户手续费');
|
||||
if ($main['srv_rate'] >= 100 || $main['srv_rate'] < 0) return $this->show_json(SYS_CODE_FAIL, '请输入正确主商户手续费');
|
||||
}
|
||||
if ($merchant_no) {
|
||||
if (!$other['srv_rate']) return $this->show_json(SYS_CODE_FAIL, '请输入特惠商户手续费');
|
||||
if ($other['srv_rate'] >= 100 || $main['srv_rate'] < 0) return $this->show_json(SYS_CODE_FAIL, '请输入正确特惠商户收续费');
|
||||
}
|
||||
$jsondata['main'] = $main;
|
||||
$jsondata['other'] = $other;
|
||||
$data = [
|
||||
'mid' => $mid,
|
||||
'merchant_no' => $merchant_no,
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
if ($row) {
|
||||
$res = $this->brand_smcard_model->update($data, array('id' => $row['id']));
|
||||
} else {
|
||||
$data['brand_id'] = $this->input->post('brand_id');
|
||||
$data['type'] = 1;
|
||||
$data['c_time'] = time();
|
||||
$res = $this->brand_smcard_model->add($data);
|
||||
}
|
||||
if ($res) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get_brand_qkpay()
|
||||
{
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$this->load->model('biz/biz_brand_smcard_model', 'brand_smcard_model');
|
||||
$row = $this->brand_smcard_model->get(array('brand_id' => $brand_id,'type'=>2));
|
||||
$jsondata = json_decode($row['jsondata'], true);
|
||||
!$row && $row['brand_id'] = $brand_id;
|
||||
$this->data['row'] = $row;
|
||||
$this->data['json'] = $jsondata;
|
||||
$this->show_view('biz/brand/edit_qkpay');
|
||||
}
|
||||
|
||||
public function edit_brand_qkpay()
|
||||
{
|
||||
if ($this->input->method() == 'post') {
|
||||
$id = $this->input->post('id');
|
||||
$mid = $this->input->post('mid');
|
||||
$merchant_no = $this->input->post('merchant_no');
|
||||
$main = $this->input->post('main');
|
||||
$other = $this->input->post('other');
|
||||
$this->load->model('biz/biz_brand_smcard_model', 'brand_smcard_model');
|
||||
$row = $this->brand_smcard_model->get(array('id' => $id));
|
||||
$jsondata = [];
|
||||
$row && $jsondata = json_decode($row['jsondata'], true);
|
||||
$jsondata['main'] = $main;
|
||||
$jsondata['other'] = $other;
|
||||
$data = [
|
||||
'mid' => $mid,
|
||||
'merchant_no' => $merchant_no,
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
if ($row) {
|
||||
$res = $this->brand_smcard_model->update($data, array('id' => $row['id']));
|
||||
} else {
|
||||
$data['brand_id'] = $this->input->post('brand_id');
|
||||
$data['type'] = 2;
|
||||
$data['c_time'] = time();
|
||||
$res = $this->brand_smcard_model->add($data);
|
||||
}
|
||||
if ($res) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+810
@@ -0,0 +1,810 @@
|
||||
<?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("biz/biz_tagdata_model");
|
||||
|
||||
$this->load->model("biz/biz_brand_model", 'bizBrand');
|
||||
$this->load->model('area_model');
|
||||
//$this->load->model("user/user_model");
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
|
||||
$page = $this->input->get('page');
|
||||
$status = $this->input->get('status');
|
||||
|
||||
$this->data['province_id'] = $province_id = $this->input->get('province_id', true);
|
||||
$this->data['city_id'] = $city_id = intval($this->input->get('city_id', true));
|
||||
$this->data['bizname'] = $bizname = $this->input->get('bizname');
|
||||
$this->data['brand_id'] = $brand_id = intval($this->input->get('brand_id'));
|
||||
$this->data['content'] = $content = $this->input->get('content');
|
||||
$this->data['article'] = $article = $this->input->get('article');
|
||||
$status_arr = array('del' => -1, 'off' => 0, 'on' => 1);
|
||||
$this->data['provinces'] = $this->area_model->select(array(), '', 0, 0, 'distinct(province_id), province_name');
|
||||
if ($province_id) {
|
||||
$this->data['citys'] = $this->area_model->select(array('province_id' => $province_id), '', 0, 0, 'distinct(city_id), city_name');
|
||||
}
|
||||
if (isset($status_arr[$status])) {
|
||||
$this->data['status'] = $status;
|
||||
$where['status'] = $status_arr[$status];
|
||||
} else {
|
||||
$where['status > -1'] = null;
|
||||
}
|
||||
|
||||
!$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;
|
||||
|
||||
$biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize);
|
||||
$count = $this->biz_model->count();
|
||||
$bizlists = [];
|
||||
foreach ($biz_lists as $v) {
|
||||
$brand = $this->bizBrand->get(array('id' => $v['brand_id']),'brand_name');
|
||||
$v['brand_name'] = $brand['brand_name'];
|
||||
|
||||
$bizlists[] = $v;
|
||||
}
|
||||
|
||||
//获取品牌
|
||||
$lists = $this->bizBrand->select(array('status' => 1),'','','','brand_name,id');
|
||||
$data = array();
|
||||
if ($lists) {
|
||||
foreach ($lists as $value) {
|
||||
$data[] = array('name' => $value['brand_name'], 'id' => $value['id']);
|
||||
}
|
||||
}
|
||||
$this->data['brand_list'] = $data;
|
||||
|
||||
$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'));
|
||||
$this->data['provinces'] = $this->area_model->select(array(), '', 0, 0, 'distinct(province_id), province_name');
|
||||
//获取品牌
|
||||
$lists = $this->bizBrand->select(array('status' => 1),'','','','brand_name,id');
|
||||
$data = array();
|
||||
if ($lists) {
|
||||
foreach ($lists as $value) {
|
||||
$data[] = array('name' => $value['brand_name'], 'id' => $value['id']);
|
||||
}
|
||||
}
|
||||
$this->data['brand_list'] = $data;
|
||||
|
||||
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);
|
||||
//获取品牌名称
|
||||
if ($biz && $this->data['brand_list']) {
|
||||
$brand_id = $biz['brand_id'];
|
||||
$brand_name = '';
|
||||
foreach ($this->data['brand_list'] as $item) {
|
||||
if ($brand_id == $item['id']) {
|
||||
$brand_name = $item['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$biz['brand_name'] = $brand_name;
|
||||
}
|
||||
//标签
|
||||
$biz_tags = $this->biz_tagdata_model->select(array('biz_id' => $id, 'type' => 2));
|
||||
if ($biz_tags) {
|
||||
foreach ($biz_tags as $v) {
|
||||
$biz['biz_tag_more'][] = $v['tag_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['biz'] = $biz;
|
||||
}
|
||||
|
||||
$this->data['_title'] = $id ? '编辑门店' : '新增门店';
|
||||
$this->show_view('biz/store/edit', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
$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));
|
||||
if (!$biz['brand_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择品牌');
|
||||
}
|
||||
|
||||
$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['headimg'] = $this->input->post('headimg');
|
||||
//商家标签
|
||||
$tag_more = $this->input->post('tag_more');
|
||||
if (!$tag_more || !is_array($tag_more)) {
|
||||
$tag_more = array();
|
||||
}
|
||||
|
||||
$biz['c_time'] = time();
|
||||
$id = $this->biz_model->add($biz);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
}
|
||||
|
||||
foreach ($tag_more as $key => $value) {
|
||||
if ($value) {
|
||||
$biz_tags[$value] = array(
|
||||
'type' => 2,
|
||||
'biz_id' => $id,
|
||||
'tag_id' => $value
|
||||
);
|
||||
}
|
||||
}
|
||||
if (count($biz_tags)) {
|
||||
$this->biz_tagdata_model->add_batch($biz_tags);
|
||||
}
|
||||
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'));
|
||||
|
||||
$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));
|
||||
if (!$biz['brand_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择品牌');
|
||||
}
|
||||
|
||||
$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['headimg'] = $this->input->post('headimg');
|
||||
|
||||
//商家标签
|
||||
$tag_more = $this->input->post('tag_more');
|
||||
if (!$tag_more || !is_array($tag_more)) {
|
||||
$tag_more = array();
|
||||
}
|
||||
|
||||
$res = $this->biz_model->update($biz, array('id' => $id));
|
||||
if (!$res) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
}
|
||||
|
||||
foreach ($tag_more as $key => $value) {
|
||||
if ($value) {
|
||||
$biz_tags[$value] = array(
|
||||
'type' => 2,
|
||||
'biz_id' => $id,
|
||||
'tag_id' => $value
|
||||
);
|
||||
}
|
||||
}
|
||||
$res = $this->biz_tagdata_model->delete(array('biz_id' => $id, 'type in(2,3)' => null));
|
||||
if (count($biz_tags) && $res) {
|
||||
$this->biz_tagdata_model->add_batch($biz_tags);
|
||||
}
|
||||
|
||||
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->bizBrand->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, '请选择要操作的选项');
|
||||
}
|
||||
$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->biz_model->update($data, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function lists_bd($where = [], $order = '', $page = 0, $size = 20)
|
||||
{
|
||||
$page = $this->input->get('page') ? $this->input->get('page') : '1';
|
||||
$id = $this->input->get('id');
|
||||
$biz_name = $this->biz_model->get(['id' => $id], 'biz_name')['biz_name'];
|
||||
$sort = 'sort desc';
|
||||
$count = $this->bd_biz->count(['biz_id' => $id]);
|
||||
$bd_ids = $this->bd_biz->select(['biz_id' => $id], $order, $page, $size, 'bd_id');
|
||||
$bd_ids = array_column($bd_ids, 'bd_id');
|
||||
foreach ($bd_ids as $key => $value) {
|
||||
$bd = $this->bd->get(['id' => $value], 'uid,title,c_time');
|
||||
$data[$key]['c_time'] = date('Y-m-d H:i:s', $bd['c_time']);
|
||||
$data[$key]['title'] = $bd['title'];
|
||||
$data[$key]['user'] = $this->xhbUser->get(['id' => $bd['uid']], 'nickname')['nickname'];
|
||||
}
|
||||
$this->data['lists'] = $data;
|
||||
$this->data['pager'] = ['count' => ceil($count / $size), 'curr' => $page];
|
||||
$this->data['_title'] = $biz_name . '-入选榜单';
|
||||
return $this->show_view('/biz/store/lists_bd', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:门店管理员
|
||||
* Created on: 2020/4/7 10:16
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function lists_admin()
|
||||
{
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$biz_id = intval($params['biz_id']);
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||||
}
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
if (!$biz || empty($biz)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家不存在!');
|
||||
}
|
||||
$biz_name = $biz['biz_name'];
|
||||
$where['biz_id'] = $biz_id;
|
||||
if ($params['mobile']) {
|
||||
$user = $this->mdUser->get(array('mobile' => $params['mobile'], 'status' => 1));
|
||||
$where['uid'] = $user ? $user['uid'] : '0';
|
||||
}
|
||||
$count = $this->mdUserBiz->count($where);
|
||||
$lists = array();
|
||||
if ($count) {
|
||||
$lists = $this->mdUserBiz->select($where, "id desc", $params['page'], $params['size']);
|
||||
foreach ($lists as $key => &$value) {
|
||||
$user = $this->mdUser->get(array('uid' => $value['uid']));
|
||||
$value['uname'] = $user['uname'];
|
||||
$value['mobile'] = $user['mobile'];
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['_title'] = "门店{$biz_name}管理员列表";
|
||||
$this->data['params'] = $params;
|
||||
$this->show_view('biz/store/lists_admin', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取门店管理员
|
||||
* Created on: 2020/4/7 10:46
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function get_admin()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$biz_id = $this->input->get('biz_id');
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
$info = array();
|
||||
$id && $info = $this->mdUserBiz->get(array('id' => $id));
|
||||
if ($info) {
|
||||
$biz_id = $info['biz_id'];
|
||||
$user = $this->mdUser->get(array('uid' => $info['uid']));
|
||||
$info['mobile'] = $user['mobile'];
|
||||
$info['uname'] = $user['uname'];
|
||||
} else {
|
||||
$info['biz_id'] = $biz_id;
|
||||
$info['type'] = 1;
|
||||
$info['role'] = 0;
|
||||
}
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
|
||||
}
|
||||
$info['plugins'] = json_decode($info['plugins'], true);
|
||||
$info['plugins'] = $info['plugins'] ? $info['plugins'] : null;
|
||||
|
||||
//门店名称
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
$biz_name = $biz['biz_name'];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = "门店{$biz_name}管理员";
|
||||
return $this->show_view('biz/store/edit_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:新增门店管理员
|
||||
* Created on: 2020/4/7 10:48
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function add_admin()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$biz_id = intval($info['biz_id']);
|
||||
// $type = intval($info['type']);
|
||||
$mobile = trim($info['mobile']);
|
||||
$uname = trim($info['uname']);
|
||||
$role = intval($info['role']);
|
||||
$plugins = $info['plugins'];
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在');
|
||||
}
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
$uid = $user['uid'];
|
||||
$isbiz = $this->mdUserBiz->get(array('uid' => $uid, 'biz_id >' => 0));
|
||||
if ($isbiz) {
|
||||
return $this->show_json(0, "该用户已是门店管理员了");
|
||||
}
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
$data['uid'] = $uid;
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$data['biz_id'] = $biz_id;
|
||||
$data['type'] = 1;
|
||||
$data['role'] = $role;
|
||||
$plugins && $data['plugins'] = json_encode($plugins, JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->mdUserBiz->add($data);
|
||||
if (!$id) {
|
||||
return $this->show_json(0, "提交失败");
|
||||
}
|
||||
$this->data = $data;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改门店管理员
|
||||
* Created on: 2020/4/7 14:50
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function edit_admin()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$id = $info['id'];
|
||||
$biz_id = $info['biz_id'];
|
||||
// $type = intval($info['type']);
|
||||
$role = intval($info['role']);
|
||||
$mobile = trim($info['mobile']);
|
||||
$uname = trim($info['uname']);
|
||||
$plugins = $info['plugins'];
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在');
|
||||
}
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
$uid = $user['uid'];
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->load->model('user/user_model', 'mdUser');
|
||||
$isbiz = $this->mdUserBiz->get(array('uid' => $uid, 'biz_id >' => 0, 'id <>' => $id));
|
||||
if ($isbiz) {
|
||||
return $this->show_json(0, "该用户已是门店管理员了");
|
||||
}
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
$data['uid'] = $uid;
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$data['biz_id'] = $biz_id;
|
||||
// $data['type'] = $type;
|
||||
$data['role'] = $role;
|
||||
$data['plugins'] = $plugins ? json_encode($plugins, JSON_UNESCAPED_UNICODE) : '{}';
|
||||
$this->mdUserBiz->update($data, array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除门店管理员
|
||||
* Created on: 2020/4/7 10:28
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function del_admin()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '非法参数');
|
||||
}
|
||||
$this->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
|
||||
$this->load->model('app/jdb/receiver_orders_model');
|
||||
|
||||
//删除管理员先解除占用的接单宝订单
|
||||
$upd = array('r_ubid' => 0);
|
||||
$where = array('r_ubid' => $id);
|
||||
$ret = $this->receiver_orders_model->update($upd, $where);
|
||||
if(!$ret){
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
|
||||
$this->mdUserBiz->delete(array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 管理员列表
|
||||
*/
|
||||
public function lists_manager()
|
||||
{
|
||||
$this->data['biz_id'] = $biz_id = intval($this->input->get('biz_id', true));
|
||||
$this->data['mobile'] = $mobile = $this->input->get('mobile', true);
|
||||
$status = $this->input->get('status');
|
||||
!isset($status) && $status = 'a';
|
||||
$this->data['status'] = $status;
|
||||
|
||||
$page = $this->input->get('page');
|
||||
!$page && $page = 1;
|
||||
$size = 20;
|
||||
$user_model = "user_model";
|
||||
$ub_model = "user_biz_model";
|
||||
$this->load->model('user/user_model');
|
||||
$this->load->model('user/user_biz_model');
|
||||
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
$biz_name = $biz['biz_name'];
|
||||
|
||||
$where = array('biz_id' => $biz_id);
|
||||
if ($mobile) {
|
||||
$where1 = array('mobile' => $mobile, 'status' => 1);
|
||||
$user = $this->$user_model->get($where1);
|
||||
$where['uid'] = $user ? $user['uid'] : '0';
|
||||
}
|
||||
|
||||
'a' != $status && $where['status'] = $status;
|
||||
$count = $this->$ub_model->count($where);
|
||||
$lists = array();
|
||||
if ($count) {
|
||||
$lists = $this->$ub_model->select($where, 'id DESC', $page, $size);
|
||||
foreach ($lists as &$item) {
|
||||
$user = $this->$user_model->get(array('uid' => $item['uid']));
|
||||
$item['uname'] = $user['uname'];
|
||||
$item['mobile'] = $user['mobile'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page);
|
||||
$this->data['_title'] = "商家{$biz_name}管理员列表";
|
||||
|
||||
$this->show_view('biz/store/lists_manager', true);
|
||||
}
|
||||
|
||||
public function get_manager()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$biz_id = $this->input->get('biz_id');
|
||||
$user_model = "user_model";
|
||||
$ub_model = "user_biz_model";
|
||||
$this->load->model('user/user_model');
|
||||
$this->load->model('user/user_biz_model');
|
||||
$info = array();
|
||||
$id && $info = $this->$ub_model->get(array('id' => $id));
|
||||
|
||||
if ($info) {
|
||||
$biz_id = $info['biz_id'];
|
||||
$user = $this->$user_model->get(array('uid' => $info['uid']));
|
||||
$info['mobile'] = $user['mobile'];
|
||||
$info['uname'] = $user['uname'];
|
||||
} else {
|
||||
$info['biz_id'] = $biz_id;
|
||||
}
|
||||
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家不存在!');
|
||||
}
|
||||
|
||||
//店铺名称
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
$biz_name = $biz['biz_name'];
|
||||
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = "店铺{$biz_name}管理员";
|
||||
$this->show_view('biz/store/edit_manager');
|
||||
}
|
||||
|
||||
public function add_manager()
|
||||
{
|
||||
$biz_id = $this->input->post('biz_id');
|
||||
$mobile = trim($this->input->post('mobile'));
|
||||
$uname = trim($this->input->post('uname'));
|
||||
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在');
|
||||
}
|
||||
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
$uid = $user['uid'];
|
||||
$this->load->model('user/user_brand_model');
|
||||
$isbrand = $this->user_brand_model->get(array('uid' => $uid));
|
||||
if ($isbrand) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "该用户已是品牌管理员了");
|
||||
}
|
||||
|
||||
$ub_model = "user_biz_model";
|
||||
$this->load->model('user/user_biz_model');
|
||||
//是否已经存在该店铺下
|
||||
$old = $this->$ub_model->get(array('uid' => $uid, 'biz_id' => $biz_id));
|
||||
if ($old) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "用户已经绑定该商户");
|
||||
}
|
||||
//该用户已经正常绑定的信息
|
||||
// $normal = $this->$ub_model->get(array('uid' => $uid));
|
||||
// $norbiz = $this->biz_model->get(array('id' => $normal['biz_id']));
|
||||
|
||||
//已经绑定其他商户(家装店铺)
|
||||
// if($norbiz['cate_id']==4){
|
||||
// return $this->show_json(0, "用户已经绑定商户:{$norbiz['biz_name']}");
|
||||
// }
|
||||
//店铺名称
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
$data = array('uid' => $uid);
|
||||
$data['biz_id'] = $biz_id;
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$this->$ub_model->add($data);
|
||||
//生成商家关联数据
|
||||
//座上宾
|
||||
$this->load->model('app/zsb/app_zsb_user_model');
|
||||
$this->load->model('user/user_model', 'user_model');
|
||||
$res = $this->app_zsb_user_model->get(array('mobile' => $mobile));
|
||||
if (!$res) {
|
||||
$this->app_zsb_user_model->add(array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time()));
|
||||
$this->user_model->add(array('uname' => $uname, 'mobile' => $mobile, 'c_time' => time()));
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
|
||||
}
|
||||
|
||||
public function edit_manager()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$biz_id = $this->input->post('biz_id');
|
||||
$mobile = trim($this->input->post('mobile'));
|
||||
$uname = trim($this->input->post('uname'));
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在');
|
||||
}
|
||||
|
||||
if (!$mobile || !$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号或者名称不能为空');
|
||||
}
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号格式不正确');
|
||||
}
|
||||
//获取用户信息
|
||||
list($status, $user, $msg) = $this->get_hduser($mobile, $uname);
|
||||
if (!$status) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $msg);
|
||||
}
|
||||
|
||||
$uid = $user['uid'];
|
||||
$this->load->model('user/user_brand_model');
|
||||
|
||||
$isbrand = $this->user_brand_model->get(array('uid' => $uid));
|
||||
if ($isbrand) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "该用户已是品牌管理员了");
|
||||
}
|
||||
$this->load->model('app/zsb/app_zsb_user_model');
|
||||
$ub_model = "user_biz_model";
|
||||
$this->load->model('user/user_biz_model');
|
||||
$ubiz = $this->$ub_model->get(array('id' => $id));
|
||||
//uid不变,不做修改
|
||||
if ($ubiz['uid'] == $uid) {
|
||||
//座上宾修改
|
||||
$this->app_zsb_user_model->update(array('uname' => $uname), array('mobile' => $mobile));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
//是否已经存在该店铺下
|
||||
$old = $this->$ub_model->get(array('uid' => $uid, 'biz_id' => $biz_id));
|
||||
if ($old) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "用户已经绑定该商户");
|
||||
}
|
||||
//店铺名称
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
$data = array('uid' => $uid);
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$this->$ub_model->update($data, array('id' => $id));
|
||||
//生成商家关联数据
|
||||
//座上宾
|
||||
$res = $this->app_zsb_user_model->get(array('mobile' => $mobile));
|
||||
if (!$res) {
|
||||
$this->app_zsb_user_model->add(array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time()));
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功');
|
||||
}
|
||||
|
||||
public function del_manager()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '操作出错');
|
||||
}
|
||||
$this->load->model('user/user_biz_model');
|
||||
$this->user_biz_model->delete(array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息(不存在新增,可以修改名称)
|
||||
* @param $mobile
|
||||
* @param $uname
|
||||
* @return array (status, data, msg)
|
||||
*/
|
||||
private function get_hduser($mobile, $uname)
|
||||
{
|
||||
$status = 1;
|
||||
$msg = '';
|
||||
$data = array();
|
||||
|
||||
if (!$mobile || !$uname) {
|
||||
$status = 0;
|
||||
$msg = "手机号或者名称不能为空";
|
||||
goto end;
|
||||
}
|
||||
|
||||
$where = array('mobile' => $mobile);
|
||||
|
||||
$this->load->model('user/user_model');
|
||||
$info = $this->user_model->get($where);
|
||||
|
||||
//新增
|
||||
if (!$info) {
|
||||
$data = array('mobile' => $mobile, 'uname' => $uname, 'c_time' => time(), 'cf_title' => '管理员', 'cf_platform' => '后台添加');
|
||||
$uid = $this->user_model->add($data);
|
||||
if (!$uid) {
|
||||
$status = 0;
|
||||
$msg = "用户添加失败";
|
||||
} else {
|
||||
$data['uid'] = $uid;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
|
||||
//状态异常
|
||||
if (1 != $info['status']) {
|
||||
$status = 0;
|
||||
$msg = "用户存在,但状态异常";
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
$data = array('uname' => $uname);
|
||||
$this->user_model->update($data, array('uid' => $info['uid']));
|
||||
$info['uname'] = $uname;
|
||||
|
||||
$data = $info;
|
||||
|
||||
end:
|
||||
return array($status, $data, $msg);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Clues extends HD_Controller{
|
||||
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名');
|
||||
|
||||
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_status_model','status_model');
|
||||
$this->load->model('receiver/receiver_customers_model','customers_model');
|
||||
$this->load->model('app/licheb/app_licheb_users_model');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index(){
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists($where = array()){
|
||||
$params = $this->input->get();
|
||||
|
||||
$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');
|
||||
$where_yx["c.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
}
|
||||
if ($c_time[1]) {
|
||||
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
$where_yx["c.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
}
|
||||
}
|
||||
|
||||
$count = $this->clues_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$fileds = 'id,name,mobile,cf_id,status_id,c_time,admin_id';
|
||||
$rows = $this->clues_model->select($where,'id desc',$page,$size,$fileds);
|
||||
//获取来源
|
||||
$cf_id_arr = array_unique(array_column($rows,'cf_id'));
|
||||
$cf_rows = $this->clues_cfrom_model->get_map_by_ids($cf_id_arr,'id,title');
|
||||
//获取状态
|
||||
$status_id_arr = array_unique(array_column($rows,'status_id'));
|
||||
$status_rows = $this->status_model->get_map_by_ids($status_id_arr,'id,name');
|
||||
//获取销售员
|
||||
$admin_id_arr = array_unique(array_column($rows,'admin_id'));
|
||||
$admin_rows = $this->app_licheb_users_model->get_map_by_ids($admin_id_arr,'id,uname');
|
||||
foreach($rows as $key => $val){
|
||||
$val['cf_title'] = isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '';
|
||||
$val['status_name'] = isset($status_rows[$val['status_id']]) ? $status_rows[$val['status_id']][0]['name'] : '';
|
||||
$val['admin_name'] = isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '';
|
||||
$lists[] = $val;
|
||||
}
|
||||
}
|
||||
$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['_title'] = '线索池列表';
|
||||
return $this->show_view('receiver/clues/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add(){
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit(){
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del(){
|
||||
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch(){
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export(){
|
||||
|
||||
}
|
||||
|
||||
//分配
|
||||
public function get_adviser()
|
||||
{
|
||||
$ids = $this->input->get('ids');
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'group_id' => 1
|
||||
];
|
||||
$adminList = $this->app_licheb_users_model->select($where,'','','','id,uname,mobile');
|
||||
$this->data['adminList'] = $adminList;
|
||||
$this->data['ids'] = $ids;
|
||||
return $this->show_view('receiver/clues/get_adviser');
|
||||
}
|
||||
|
||||
public function edit_adviser()
|
||||
{
|
||||
$admin_id = $this->input->post('admin_id');
|
||||
$ids = $this->input->post('ids');
|
||||
$ids_arr = explode(',',$ids);
|
||||
$user = $this->app_licheb_users_model->get(['id'=>$admin_id]);
|
||||
if (!$user) {
|
||||
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 != 3'=>null]);
|
||||
if($clues_row && !$cus_row){
|
||||
$jsondata = json_decode($clues_row['jsondata'],true);
|
||||
$add_data = [
|
||||
'rid' => $val,
|
||||
'name' => $clues_row['name'],
|
||||
'mobile' => $clues_row['mobile'],
|
||||
'brand_id' => $clues_row['brand_id'],
|
||||
's_id' => $clues_row['s_id'],
|
||||
'if_driver' => $clues_row['if_driver'],
|
||||
'admin_id' => $admin_id,
|
||||
'cf_id' => $clues_row['cf_id'],
|
||||
'p_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => time()
|
||||
];
|
||||
if($jsondata['car']){
|
||||
isset($jsondata['car']['version']) && $add_data['v_id'] = $jsondata['car']['version']['id'];
|
||||
$add_data['car_json'] = json_encode($jsondata['car'],JSON_UNESCAPED_UNICODE);
|
||||
unset($jsondata['car']);
|
||||
}
|
||||
$jsondata && $add_data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$customers_id = $this->customers_model->add($add_data);
|
||||
if($customers_id){
|
||||
$this->clues_model->update(['admin_id'=>$admin_id],['id'=>$val]);
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$this->clues_entity->add_log($val,$this->uid,$this->username,"分配给【{$user['uname']}】用户");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '分配成功!');
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+287
@@ -0,0 +1,287 @@
|
||||
<?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('app/app_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(isset($json['cate_id'])) {
|
||||
$this->data['cate_id'] = array_combine($json['cate_id'], $json['cate_id']);
|
||||
}
|
||||
if(isset($json['city_id'])) {
|
||||
if(is_array($json['city_id'])) {
|
||||
$this->data['city_id'] = array_combine($json['city_id'], $json['city_id']);
|
||||
}
|
||||
}
|
||||
if(isset($json['platfrom_id']) && is_array($json['platfrom_id'])) {
|
||||
$this->data['platfrom_id'] = array_combine($json['platfrom_id'], $json['platfrom_id']);
|
||||
}
|
||||
if(isset($json['app_id']) && is_array($json['app_id'])) {
|
||||
$this->data['app_id'] = array_combine($json['app_id'], $json['app_id']);
|
||||
}
|
||||
$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();
|
||||
$insert = [
|
||||
'username' => $input['username'],
|
||||
'mobile' => $input['mobile'],
|
||||
'role_id' => $input['role'],
|
||||
'role_id' => $input['role'],
|
||||
'other_json' => json_encode([
|
||||
'cate_id' => $input['category'],
|
||||
'city_id' => $input['city'],
|
||||
'platfrom_id' => $input['platfrom'],
|
||||
'app_id' => $input['apps'],
|
||||
]),
|
||||
'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();
|
||||
$upd = [
|
||||
'username' => $input['username'],
|
||||
'mobile' => $input['mobile'],
|
||||
'role_id' => $input['role'],
|
||||
'other_json' => json_encode([
|
||||
'cate_id' => $input['category'],
|
||||
'city_id' => $input['city'],
|
||||
'platfrom_id' => $input['platfrom'],
|
||||
'app_id' => $input['apps'],
|
||||
]),
|
||||
];
|
||||
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');
|
||||
$data['category'] = $this->sysCate->select(['pid' => '0', 'status' => '1']);
|
||||
$data['city'] = $this->sysCity->select(['status' => '1']);
|
||||
$data['platfrom'] = array(0=>'总后台',1=>'商家后台');
|
||||
$data['apps'] = $this->app_model->select(array(),'','','','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'),
|
||||
'category' => $this->input->post('category'),
|
||||
'city' => $this->input->post('city[]'),
|
||||
'platfrom' => $this->input->post('platfrom[]'),
|
||||
'username' => trim($this->input->post('username')),
|
||||
'mobile' => trim($this->input->post('mobile')),
|
||||
'status' => $this->input->post('status'),
|
||||
'role' => $this->input->post('role'),
|
||||
'apps' => $this->input->post('apps'),
|
||||
'password1' => trim($this->input->post('password1')),
|
||||
'password2' => trim($this->input->post('password2')),
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function _get_rand()
|
||||
{
|
||||
return md5(time().mt_rand(0,9999).uniqid());
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+114
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+195
@@ -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;
|
||||
}
|
||||
}
|
||||
Executable
+135
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+107
@@ -0,0 +1,107 @@
|
||||
<?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('北京市', '上海市', '重庆市', '天津市');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model("area_model");
|
||||
$this->load->model("sys/sys_city_model");
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
public function lists()
|
||||
{
|
||||
$this->data['bizname'] = $bizname = $this->input->get('bizname');
|
||||
if ($bizname){
|
||||
$where['name like \'%'.$bizname.'%\''] = null;
|
||||
}
|
||||
$page = $this->input->get('page');
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $this->input->get('size');
|
||||
$size = !$size ? 20 : $size;
|
||||
$lists = $this->sys_city_model->select($where,'id desc',$page,$size);
|
||||
$count = $this->sys_city_model->count($where);
|
||||
$this->data['pager'] = array('count'=>ceil($count/$size),'curr'=>$page,'totle'=>$count);
|
||||
$this->data['_title'] = '城市管理';
|
||||
$this->data['city_lists'] = $lists;
|
||||
$this->data['pager']['total'] = $count;
|
||||
$this->data['status_arr'] = array(1=>'开启',0=>'关闭');
|
||||
$this->show_view('sys/city/lists',true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$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, '首字母不能为空');
|
||||
}
|
||||
$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()
|
||||
{
|
||||
|
||||
}
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$stauts = $this->input->post('status');
|
||||
if($id)
|
||||
{
|
||||
$this->sys_city_model->update(array('status' => $stauts), array('id' => $id));
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+153
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+181
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+288
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+312
@@ -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;
|
||||
}
|
||||
}
|
||||
Executable
+288
@@ -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(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+103
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+211
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+107
@@ -0,0 +1,107 @@
|
||||
<?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 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;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+1584
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,612 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$result = $this->db->get($this->table_name, $limit, $offset)->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;
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+32
@@ -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;
|
||||
}
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+33
@@ -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);
|
||||
}
|
||||
}
|
||||
Executable
+124
@@ -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;
|
||||
}
|
||||
}
|
||||
Executable
+121
@@ -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], '"' . $file['url'] . '"', $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], '"' . $file['url'] . '"', $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+59
@@ -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;
|
||||
}
|
||||
}
|
||||
Executable
+47
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
<?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($this->is_ignore($user_info['id'])){
|
||||
//免检
|
||||
} elseif(false !== strpos($_SERVER['HTTP_HOST'], "hd-admin.dev.xiaoyu.com") || false !== strpos($_SERVER['HTTP_HOST'], "admin.test.haodian.cn")){
|
||||
//开发测试免检
|
||||
} elseif(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) && $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)
|
||||
{
|
||||
$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('您的权限已被禁用');
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+19
@@ -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] = "手机号已存在";
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+351
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xuxb
|
||||
* Date: 2019/7/25
|
||||
* Time: 16:40
|
||||
*/
|
||||
class Hdwechat{
|
||||
private $log_file = "wechat.log";
|
||||
|
||||
public $appid = '';
|
||||
public $secret = '';
|
||||
public $token_url = '';//第三方地址获取token
|
||||
private $access_token = '';
|
||||
|
||||
|
||||
/**
|
||||
* Hdwechat constructor.
|
||||
* @param array $config {'appid':'', 'secret':'', 'token_url':'第三方方式获取token'}
|
||||
*/
|
||||
function __construct($config = array()){
|
||||
$config && $this->init($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $config ('appid', 'secret')
|
||||
*/
|
||||
function init($config){
|
||||
$this->appid = $config['appid'];
|
||||
$this->secret = $config['secret'];
|
||||
$this->token_url = $config['token_url'];
|
||||
|
||||
$CI = & get_instance();
|
||||
$CI->load->library("hd_wechat", $config);
|
||||
/*这里用new的方式,因为load如果对象已经存在,会去取旧的,不会生成新配置的对象*/
|
||||
$this->hd_wechat = new Hd_wechat($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取或者重置access_token
|
||||
* @param $reset (是否重置)
|
||||
* @return mixed
|
||||
*/
|
||||
function access_token($reset = false){
|
||||
$this->access_token = $this->hd_wechat->access_token($reset);
|
||||
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取小程序scheme码
|
||||
* Created on: 2021/3/5 17:00
|
||||
* Created by: dengbw
|
||||
* 文档 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
function urlscheme($params = array()){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
$pre_url = 'https://api.weixin.qq.com/wxa/generatescheme?access_token=';
|
||||
$url = $pre_url . $access_token;
|
||||
$data = array(
|
||||
'jump_wxa' => array('path'=>$params['path'],'query'=>$params['query']),//跳转到的目标小程序信息
|
||||
'is_expire' => $params['is_expire'],//到期失效:true,永久有效:false
|
||||
'expire_time' => $params['expire_time'],//失效时间
|
||||
);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
return array('openlink' => $ret['openlink']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
* @param $filename (文件名称)
|
||||
* @param $scene (最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)
|
||||
* @param $page (必须是已经发布的小程序存在的页面(否则报错),例如 pages/index/index, 根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面)
|
||||
* @param $width (二维码的宽度,单位 px,最小 280px,最大 1280px,默认430px)
|
||||
* @return array {'file':'文件路径', 'url':'访问相对路径'}
|
||||
*/
|
||||
function qrcode($filename, $scene, $page, $width){
|
||||
$file = APPPATH . '../www/api/wx/' . $filename . '.png';
|
||||
$dir = substr($file, 0, strrpos($file, '/'));
|
||||
if(!is_dir($dir)){
|
||||
$ret = mkdir($dir, 0777, true);// 如果文件夹不存在,将以递归方式创建该文件夹
|
||||
if(!$ret){
|
||||
debug_log("[error] ". __FUNCTION__ . ": mkdir {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($file)){
|
||||
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
|
||||
}
|
||||
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$pre_url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=';
|
||||
$url = $pre_url . $access_token;
|
||||
$data = array(
|
||||
'scene' => $scene,
|
||||
'page' => $page,
|
||||
'width' => $width ? $width : 430,
|
||||
);
|
||||
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ": httpcode:{$code}, response:{$res}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$ret = file_put_contents($file, $res);
|
||||
if(false === $ret){
|
||||
debug_log("[error] ". __FUNCTION__ . ": file_put_contents {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信用户信息
|
||||
* @param $openid
|
||||
* @return array|mixed
|
||||
*/
|
||||
function user($openid){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$pre_url = "https://api.weixin.qq.com/cgi-bin/user/info?openid={$openid}&lang=zh_CN&access_token=";
|
||||
$url = $pre_url . $access_token;
|
||||
$res = $this->url_get($url);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
$res = $this->url_get($url);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ":url=$url, res={$res}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"subscribe": 1,//是否关注
|
||||
"openid": "o6_bmjrPTlm6_2sgVt7hMZOPfL2M",
|
||||
"nickname": "Band",
|
||||
"sex": 1,
|
||||
"language": "zh_CN",
|
||||
"city": "广州",
|
||||
"province": "广东",
|
||||
"country": "中国",
|
||||
"headimgurl":"http://thirdwx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/0",
|
||||
"subscribe_time": 1382694957,
|
||||
"unionid": " o6_bmasdasdsad6_2sgVt7hMZOPfL"
|
||||
"remark": "",
|
||||
"groupid": 0,
|
||||
"tagid_list":[128,2],
|
||||
"subscribe_scene": "ADD_SCENE_QR_CODE",
|
||||
"qr_scene": 98765,
|
||||
"qr_scene_str": ""
|
||||
}
|
||||
*/
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param $next_openid (起始openid,默认从头开始)
|
||||
* @return array {'total':'总数', 'count':'这次获取数', 'data':{'openid'['openid'],'next_openid':'下一页起始openid'}}
|
||||
*/
|
||||
function openids($next_openid = ''){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$pre_url = "https://api.weixin.qq.com/cgi-bin/user/get?next_openid={$next_openid}&access_token=";
|
||||
$url = $pre_url . $access_token;
|
||||
$res = $this->url_get($url);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
$res = $this->url_get($url);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ":url=$url, res={$res}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"total":2,
|
||||
"count":2,
|
||||
"data":{
|
||||
"openid":["OPENID1","OPENID2"]},
|
||||
"next_openid":"NEXT_OPENID"
|
||||
}
|
||||
*/
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function tag_get(){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$pre_url = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token=";
|
||||
$url = $pre_url . $access_token;
|
||||
$res = $this->url_get($url);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
$res = $this->url_get($url);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ":url=$url, res={$res}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"tags":[{
|
||||
"id":1,
|
||||
"name":"每天一罐可乐星人",
|
||||
"count":0 //此标签下粉丝数
|
||||
}]
|
||||
}
|
||||
*/
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function tag_user($tagid, $next_openid = ''){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$pre_url = "https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=";
|
||||
$url = $pre_url . $access_token;
|
||||
|
||||
$data = array(
|
||||
'tagid' => $tagid,
|
||||
'next_openid' => $next_openid,
|
||||
);
|
||||
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ":url=$url, res={$res}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"count":2,//这次获取的粉丝数量
|
||||
"data":{//粉丝列表
|
||||
"openid":[
|
||||
"ocYxcuAEy30bX0NXmGn4ypqx3tI0",
|
||||
"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" ]
|
||||
},
|
||||
"next_openid":"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"//拉取列表最后一个用户的openid
|
||||
}
|
||||
*/
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
private function curl_post($url, $data){
|
||||
debug_log("[info] ". __FUNCTION__ . ":url={$url}, data=".json_encode($data), $this->log_file);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
||||
$res = curl_exec($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
$size = strlen($res);
|
||||
if($size > 5000){
|
||||
debug_log("[info] ". __FUNCTION__ . ":httpcode={$code}, response is big only show size={$size}", $this->log_file);
|
||||
} else {
|
||||
debug_log("[info] ". __FUNCTION__ . ":httpcode={$code}, response={$res}", $this->log_file);
|
||||
}
|
||||
|
||||
return array($code, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @return string
|
||||
*/
|
||||
private function url_get($url){
|
||||
$res = file_get_contents($url);
|
||||
debug_log("[info] ". __FUNCTION__ . ":url={$url}, res={$res}", $this->log_file);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Notes:好店服务公众号操作
|
||||
* Created on: 2020/6/22 10:00
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class HdyServer
|
||||
{
|
||||
static $app_id = 6;//小程序id
|
||||
private $ci;
|
||||
private $api_url = "http://api.haodian.cn";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci = &get_instance();
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'dev')) { //dev 测试
|
||||
$this->api_url = 'http://hd-api-dev.xiaoyu.com';
|
||||
} elseif (false !== strpos($_SERVER['HTTP_HOST'], 'test')) {//test 测试
|
||||
$this->api_url = 'http://api.test.haodian.cn';
|
||||
} else { // 正式
|
||||
$this->api_url = 'http://api.haodian.cn';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取二维码图片
|
||||
* Created on: 2020/6/22 10:18
|
||||
* Created by: dengbw
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
function get_qrurl($params)
|
||||
{
|
||||
$this->ci->load->model("/sys/sys_admin_model", 'mdSysAdmin');
|
||||
$scene = $qrcode = $mobile = '';
|
||||
if ($params['act_type'] == 1) {
|
||||
$re = $this->ci->mdSysAdmin->get(array('id' => $params['uid']), 'mobile');
|
||||
$mobile = $re['mobile'];
|
||||
$re['mobile'] && $scene = 'mobile=' . $mobile;
|
||||
}
|
||||
$post_data = array("scene" => $scene, 'type' => $params['type']);
|
||||
$result = http_post_com($this->api_url . '/wechat/haodianyun/get_qrurl', $post_data);
|
||||
$qrcode = $result['data'] ? $result['data'] : '';
|
||||
return array('mobile' => $mobile, 'qrcode' => $qrcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:商家发送公众号通知
|
||||
* Created on: 2020/6/22 17:45
|
||||
* Created by: dengbw
|
||||
* @param $params type 1订单加日志 2订单结算状态
|
||||
*/
|
||||
function biz_send_template($params)
|
||||
{
|
||||
$this->ci->load->model('user/user_biz_model', 'mdUserBiz');
|
||||
$this->ci->load->model('user/user_model', 'mdUser');
|
||||
$reUserBiz = array();
|
||||
if ($params['biz_id']) {
|
||||
$reUserBiz = $this->ci->mdUserBiz->select(array('biz_id' => $params['biz_id'], 'type' => 1)
|
||||
, 'id ASC', 0, 0, 'uid');
|
||||
} else if ($params['brand_id']) {
|
||||
$reUserBiz = $this->ci->mdUserBiz->select(array('brand_id' => $params['brand_id'], 'type' => 0)
|
||||
, 'id ASC', 0, 0, 'uid');
|
||||
}
|
||||
if ($reUserBiz) {//给商家发送公众号通知
|
||||
$this->ci->load->model('app/App_model', 'mdApp');
|
||||
$this->ci->load->model('app/App_wechat_model', 'mdWechat');
|
||||
$appConfig = $this->ci->mdApp->appConfig()[self::$app_id];
|
||||
foreach ($reUserBiz as $key => $value) {
|
||||
$reUser = $this->ci->mdUser->get(array('uid' => $value['uid'], 'status' => 1), 'mobile');
|
||||
if ($reUser['mobile']) {
|
||||
$reWechat = $this->ci->mdWechat->get(array('app_id' => self::$app_id, 'mobile' => $reUser['mobile']), 'openid');
|
||||
if ($reWechat['openid']) {
|
||||
$temp_ary = array();
|
||||
$pagepath = $params['id'] ? $appConfig['wx']['pages_order_detail'] . '?id=' . $params['id']
|
||||
: $appConfig['wx']['pages_order'];
|
||||
if ($params['type'] == 1) {
|
||||
$temp_ary = array(
|
||||
'touser' => $reWechat['openid'],
|
||||
'template_id' => 'f9ZGhhddKg3ysYH8ZzE8onH_c_ho3hdRfj-B4l9r5Rg',
|
||||
'miniprogram' => array(
|
||||
'appid' => $appConfig['wx']['appid'],
|
||||
'pagepath' => $pagepath
|
||||
),
|
||||
'data' => array(
|
||||
'first' => array('value' => '商户经理' . $params['username'] . '新增一条小记'),
|
||||
'keyword1' => array('value' => '新增小记'),
|
||||
'keyword2' => array('value' => date('Y-m-d H:i:s')),
|
||||
'remark' => array('value' => $params['log'])
|
||||
)
|
||||
);
|
||||
} else if ($params['type'] == 2) {
|
||||
$temp_ary = array(
|
||||
'touser' => $reWechat['openid'],
|
||||
'template_id' => 'f9ZGhhddKg3ysYH8ZzE8onH_c_ho3hdRfj-B4l9r5Rg',
|
||||
'miniprogram' => array(
|
||||
'appid' => $appConfig['wx']['appid'],
|
||||
'pagepath' => $pagepath
|
||||
),
|
||||
'data' => array(
|
||||
'first' => array('value' => '商户经理' . $params['username'] . '更新了订单结算状态'),
|
||||
'keyword1' => array('value' => $params['status_name_up']),
|
||||
'keyword2' => array('value' => date('Y-m-d H:i:s')),
|
||||
'remark' => array('value' => $params['log'])
|
||||
)
|
||||
);
|
||||
}
|
||||
$temp_ary && http_post_com($this->api_url . '/wechat/haodianyun/send_template', $temp_ary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:派单给商家/商户经理发送公众号通知
|
||||
* Created on: 2020/6/24 9:56
|
||||
* Created by: dengbw
|
||||
* @param $params
|
||||
*/
|
||||
function orders_send_template($params)
|
||||
{
|
||||
$this->ci->load->model('app/App_model', 'mdApp');
|
||||
$this->ci->load->model('app/App_wechat_model', 'mdWechat');
|
||||
$this->ci->load->model('app/jdb/receiver_model', 'mdReceiver');
|
||||
$this->ci->load->model('sys/Sys_admin_model', 'mdSysAdmin');
|
||||
$appConfig = $this->ci->mdApp->appConfig()[self::$app_id];
|
||||
if ($params['biz']) {//商家
|
||||
foreach ($params['biz'] as $key => $value) {
|
||||
$reWechat = $this->ci->mdWechat->get(array('app_id' => self::$app_id, 'mobile' => $value['mobile']), 'openid');
|
||||
if ($reWechat['openid']) {
|
||||
$remark = '截止' . date('m-d H:i') . ',您本月总共收到' . $value['count'] . '条订单';
|
||||
$pagepath = $value['order_id'] ? $appConfig['wx']['pages_order_detail'] . '?id=' . $value['order_id']
|
||||
: $appConfig['wx']['pages_order'];
|
||||
$temp_ary = array(
|
||||
'touser' => $reWechat['openid'],
|
||||
'template_id' => 'SPpgqoIexkTHubovh6-ZySbWLUFG52ixpa8a-BcJEJQ',
|
||||
'miniprogram' => array(
|
||||
'appid' => $appConfig['wx']['appid'],
|
||||
'pagepath' => $pagepath
|
||||
),
|
||||
'data' => array(
|
||||
'first' => array('value' => '您有一条新订单!请及时联系!'),
|
||||
'tradeDateTime' => array('value' => date('Y-m-d H:i:s')),
|
||||
'orderType' => array('value' => '新订单'),
|
||||
'customerInfo' => array('value' => $value['rc_name']),
|
||||
'orderItemName' => array('value' => '小区名称'),
|
||||
'orderItemData' => array('value' => $value['rc_community']),
|
||||
'remark' => array('value' => $remark)
|
||||
),
|
||||
);
|
||||
http_post_com($this->api_url . '/wechat/haodianyun/send_template', $temp_ary);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($params['manager']) {//商户经理
|
||||
$brands = array();
|
||||
$reReceiver = $this->ci->mdReceiver->get(array('id' => $params['rid']), 'managers');
|
||||
if ($reReceiver['managers']) {
|
||||
$managers = json_decode($reReceiver['managers'], true);
|
||||
foreach ($managers as $key => $value) {
|
||||
foreach ($value['brands'] as $key2 => $value2) {
|
||||
$brands[$value2['id']] = $value['admin_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($params['manager'] as $key => $value) {
|
||||
$admin_id = $brands[$value['brand_id']];
|
||||
if ($admin_id) {
|
||||
$reAdmin = $this->ci->mdSysAdmin->get(array('id' => $admin_id), 'mobile');
|
||||
$reWechat = $this->ci->mdWechat->get(array('app_id' => self::$app_id, 'mobile' => $reAdmin['mobile']), 'openid');
|
||||
if ($reWechat['openid']) {
|
||||
$remark = '截止' . date('m-d H:i') . ',(' . $value['brand_name'] . ')本月总共收到' . $value['count'] . '条订单';
|
||||
$temp_ary = array(
|
||||
'touser' => $reWechat['openid'],
|
||||
'template_id' => 'SPpgqoIexkTHubovh6-ZySbWLUFG52ixpa8a-BcJEJQ',
|
||||
'data' => array(
|
||||
'first' => array('value' => $value['brand_name'] . '有一条新订单!请及时跟进'),
|
||||
'tradeDateTime' => array('value' => date('Y-m-d H:i:s')),
|
||||
'orderType' => array('value' => '新订单'),
|
||||
'customerInfo' => array('value' => $value['brand_name']),
|
||||
'orderItemName' => array('value' => '商家状态'),
|
||||
'orderItemData' => array('value' => '待处理'),
|
||||
'remark' => array('value' => $remark)
|
||||
),
|
||||
);
|
||||
http_post_com($this->api_url . '/wechat/haodianyun/send_template', $temp_ary);
|
||||
if ($value['prompt']) { //到达预警值会给商户经理发送续费通知
|
||||
$remark = date('Y-m-d H:i:s') . '您对接的商家' . $value['brand_name'] . $value['prompt'];
|
||||
$temp_ary2 = array(
|
||||
'touser' => $reWechat['openid'],
|
||||
'template_id' => 'Bbh8oxPcr-WzHDze9fui2XT0WNstIx9dWYslX6nwNCU',
|
||||
'data' => array(
|
||||
'first' => array('value' => $value['brand_name'] . '到达预警值!请及时跟进'),
|
||||
'keyword1' => array('value' => '到达预警值'),
|
||||
'keyword2' => array('value' => '紧急'),
|
||||
'remark' => array('value' => $remark)
|
||||
),
|
||||
);
|
||||
http_post_com($this->api_url . '/wechat/haodianyun/send_template', $temp_ary2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xiexiaochao
|
||||
* Date: 2021/5/13
|
||||
* Time: 11:27
|
||||
*/
|
||||
|
||||
class WechatMsgServer{
|
||||
|
||||
private $wxnotice_model;
|
||||
|
||||
function __construct(){
|
||||
$this->ci = & get_instance();
|
||||
$this->ci->load->model('app/app_wxnotice_model');
|
||||
$this->wxnotice_model = $this->ci->app_wxnotice_model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信消息预约信息更新
|
||||
* @param $id
|
||||
* @param $type
|
||||
* @param $appid
|
||||
* @param $uid
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update_book($id, $type, $appid, $uid){
|
||||
$where = array('app_id' => $appid, 'app_uid' => $uid, 'target_id' => $id, 'status' => 0);
|
||||
switch($type){
|
||||
case 0://医生问答消息通知
|
||||
$where['type'] = 3;
|
||||
$row = $this->wxnotice_model->get($where);
|
||||
if(!$row){
|
||||
throw new Exception('该消息不存在', 0);
|
||||
}
|
||||
$upd = array(
|
||||
'status' => 2,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new Exception('您没有权限', 0);
|
||||
}
|
||||
|
||||
if($upd){
|
||||
$res = $this->wxnotice_model->update($upd, array('id' => $row['id']));
|
||||
if(!(!is_bool($res) && $res)){
|
||||
debug_log("[error] ". __FUNCTION__ . "# " . $this->wxnotice_model->db->last_query());
|
||||
throw new Exception('数据库更新失败', 0);
|
||||
}
|
||||
return 'success';
|
||||
}
|
||||
|
||||
throw new Exception('选择的消息提醒不对', 0);
|
||||
}
|
||||
}
|
||||
Executable
+290
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
|
||||
include_once 'Hdwechat.php';
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xuxb
|
||||
* Date: 2019/8/8
|
||||
* Time: 10:36
|
||||
*/
|
||||
class Wechatmsg{
|
||||
|
||||
private static $max_form = 10;
|
||||
|
||||
private $wechat;
|
||||
private $temp_id = '';//模板消息id
|
||||
private $temp_appage = '';//模板消息跳转小程序页面
|
||||
private $temp_appid = '';//模板消息跳转小程序appid
|
||||
private $temp_url = '';//模板消息跳外链
|
||||
private $log_file = "wechat_msg.log";
|
||||
|
||||
/**
|
||||
* Wechatmsg constructor.
|
||||
* @param array $config {'appid':'', 'secret':'', 'token_url':'第三方方式获取token'}
|
||||
*/
|
||||
function __construct($config = array()){
|
||||
$this->wechat = new Hdwechat($config);
|
||||
$this->cf_app = $config['cf_app'];
|
||||
if($config){
|
||||
$this->log_file = "wechat_msg_{$config['appid']}.log";
|
||||
}
|
||||
}
|
||||
|
||||
function init_wechat($config){
|
||||
$this->wechat->init($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化服务号消息模板
|
||||
* @param $id (模板ID)
|
||||
* @param $appage (小程序跳转页)
|
||||
* @param $appid (小程序appid, 默认当前小程序)
|
||||
* @param $url (跳转外链)
|
||||
*/
|
||||
function init_template($id, $appage = '', $appid = '', $url = ''){
|
||||
$this->temp_id = $id;
|
||||
$this->temp_appage = $appage;
|
||||
$this->temp_appid = $appid;
|
||||
$this->temp_url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送服务号消息
|
||||
* @param $openid
|
||||
* @param $data (消息主体)
|
||||
* @return mixed
|
||||
*/
|
||||
function send_oa($openid, $data){
|
||||
$access_token = $this->wechat->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token; openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
$pre_url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=';
|
||||
$url = $pre_url . $access_token;
|
||||
$post = array(
|
||||
'touser' => $openid,
|
||||
'template_id' => $this->temp_id,
|
||||
'url' => $this->temp_url ? $this->temp_url : '',
|
||||
'data' => $data
|
||||
);
|
||||
if($this->temp_appage){
|
||||
$post['miniprogram'] =array(
|
||||
'appid' => $this->temp_appid,
|
||||
'pagepath' => $this->temp_appage
|
||||
);
|
||||
}
|
||||
|
||||
list($code, $res) = $this->curl_json($url, $post);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->wechat->access_token(true);
|
||||
list($code, $res) = $this->curl_json($url, $post);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if($ret['errcode'] != 0){
|
||||
debug_log("[error] ". __FUNCTION__ . ": openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送小程序消息
|
||||
* @param $openid
|
||||
* @param $data
|
||||
* @return bool
|
||||
*/
|
||||
function send_app($openid, $data){
|
||||
$access_token = $this->wechat->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token; openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
$pre_url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=";
|
||||
$url = $pre_url.$access_token;
|
||||
|
||||
$form_id = $this->pop_formid($openid);
|
||||
if(!$form_id){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not form_id; openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
$post = array(
|
||||
'touser' => $openid,
|
||||
'template_id' => $this->temp_id,
|
||||
'form_id' => $form_id,
|
||||
'page' => $this->temp_appage,
|
||||
'data' => $data
|
||||
);
|
||||
|
||||
list($code, $res) = $this->curl_json($url, $post);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->wechat->access_token(true);
|
||||
list($code, $res) = $this->curl_json($url, $post);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if($ret['errcode'] != 0){
|
||||
debug_log("[error] ". __FUNCTION__ . ": from_id={$form_id}, openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送小程序订阅通知
|
||||
* @param $openid
|
||||
* @param $data
|
||||
* @return bool
|
||||
*/
|
||||
function send_appsub($openid, $data){
|
||||
$access_token = $this->wechat->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ":not access_token; openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
$pre_url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=";
|
||||
$url = $pre_url.$access_token;
|
||||
|
||||
$post = array(
|
||||
'touser' => $openid,
|
||||
'template_id' => $this->temp_id,
|
||||
'page' => $this->temp_appage,
|
||||
'data' => $data
|
||||
);
|
||||
|
||||
list($code, $res) = $this->curl_json($url, $post);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->wechat->access_token(true);
|
||||
list($code, $res) = $this->curl_json($url, $post);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if($ret['errcode'] != 0){
|
||||
debug_log("[error] ". __FUNCTION__ . ":openid={$openid}", $this->log_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集新的form_id
|
||||
* @param $openid (用户ID)
|
||||
* @param $form_id
|
||||
* @param $expire (到期时间戳)
|
||||
* @return bool
|
||||
*/
|
||||
public function push_formid($openid, $form_id, $expire = 0){
|
||||
//从redis获取
|
||||
$r = &load_cache('redis');
|
||||
$redis = $r->redis();
|
||||
$key = "wechat_formid_{$this->wechat->appid}_{$openid}";
|
||||
$long = 7 * 24 * 3600;
|
||||
|
||||
!$expire && $expire = time() + $long;
|
||||
$form = array('id' => $form_id, 'expire' => $expire);
|
||||
|
||||
$ret = $redis->lPush($key, json_encode($form));
|
||||
$len = $redis->lLen($key);
|
||||
//限制redis列表长度,去掉旧的
|
||||
$ret && $len > self::$max_form && $redis->rPop($key);
|
||||
//更新redis有效期
|
||||
$redis->expire($key, $long);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取formid数量
|
||||
* @param $openid
|
||||
* @return mixed
|
||||
*/
|
||||
function count_formid($openid){
|
||||
$key = "wechat_formid_{$this->wechat->appid}_{$openid}";
|
||||
|
||||
$r = &load_cache('redis');
|
||||
$redis = $r->redis();
|
||||
return $redis->lLen($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
* @param $openid
|
||||
* @return mixed
|
||||
*/
|
||||
function view_formid($openid){
|
||||
$key = "wechat_formid_{$this->wechat->appid}_{$openid}";
|
||||
$r = &load_cache('redis');
|
||||
$redis = $r->redis();
|
||||
return $redis->lRange($key, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出fromid
|
||||
* @param $openid
|
||||
* @return string
|
||||
*/
|
||||
public function pop_formid($openid){
|
||||
//从redis获取
|
||||
$r = &load_cache('redis');
|
||||
$redis = $r->redis();
|
||||
$key = "wechat_formid_{$this->wechat->appid}_{$openid}";
|
||||
|
||||
$now = time();
|
||||
while(1) {//循环获取fromid
|
||||
$form = $redis->rPop($key);
|
||||
$form && $form = json_decode($form, true);
|
||||
if(!$form){break;}
|
||||
if($form['expire'] >= $now){
|
||||
return $form['id'];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
private function curl_json($url, $data){
|
||||
$data = urldecode(json_encode($data));
|
||||
debug_log("[info] ". __FUNCTION__ . ":url={$url}, data={$data}", $this->log_file);
|
||||
|
||||
$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);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json; charset=utf-8',
|
||||
'Content-Length: ' . strlen($data)
|
||||
)
|
||||
);
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
debug_log("[info] ". __FUNCTION__ . ":httpcode={$httpCode}, response={$response}", $this->log_file);
|
||||
|
||||
return array($httpCode, $response);
|
||||
}
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+138
@@ -0,0 +1,138 @@
|
||||
<form class="am-form am-form-horizontal" action="/app/appusual/cms/<?= $url ?>" data-auto="true" method="post"
|
||||
style="width: 90%;padding-top: 10px" onsubmit="return false">
|
||||
<input type="hidden" value="<?= $this->data['id'] ?>" name="id"/>
|
||||
<div id="vue-edit">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">推送位置:</label>
|
||||
<div class="am-para-input wp60" style="width : 20%">
|
||||
<select name="position" id="position">
|
||||
<option value="">请选择</option>
|
||||
<?php foreach ($pos_arr as $pk => $pv) : ?>
|
||||
<option <?= $position == $pk ? 'selected' : '' ?> value="<?= $pk ?>"><?= $pv ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0">
|
||||
<label class="am-para-label">图片:</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="cover"><i
|
||||
class="am-icon-cloud-upload"></i> 选择图片<span style="color: blue">{{cover_note}}</span>
|
||||
</button>
|
||||
<input type="hidden" name="cover" value="<?= $cover_str ?>" class="layui-input">
|
||||
<?php if (!empty($cover)) {
|
||||
foreach ($cover as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
?>
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
src="<?= build_qiniu_image_url($value) ?>"/>
|
||||
|
||||
<?php }
|
||||
}
|
||||
} else { ?>
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" src=""/>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">排序:</label>
|
||||
<div class="am-para-input wp60 w300">
|
||||
<input style="display: inline;width: 80%" type="text" placeholder="输入排序,数值大的排前面"
|
||||
value="<?= $sort ? $sort : '' ?>" name="sort"/>
|
||||
<span style="color: blue">(数值大的排前面)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">标题:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="输入标题" value="<?= $title ? $title : '' ?>" name="title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">链接:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="输入链接" value="<?= $link ? $link : '' ?>" name="link"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">详细规则:</label>
|
||||
<div class="am-para-input" style="min-height: 300px">
|
||||
<textarea id="editor" name="content" class="am-para-input"><?= $content ? $content : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">有效时间:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="开始时间" value="<?= $s_time ?>" name="s_time" value=""
|
||||
id="datetimepicker1" autocomplete="off">
|
||||
</div>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="结束时间" value="<?= $e_time ?>" name="e_time" id="datetimepicker2" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button class="am-btn ml20 am-btn-sm am-btn-success w100" type="submit">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
require(['ckeditor'], function (ckeditor) {
|
||||
window.createEditor('[name="content"]');
|
||||
});
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#datetimepicker1'
|
||||
, type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#datetimepicker2'
|
||||
, type: 'datetime'
|
||||
, done: function (value, date) {
|
||||
if (date.hours == "0" && date.minutes == "0" && date.seconds == "0") {
|
||||
// 改变结束时间默认值
|
||||
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
|
||||
$(".laydate-main-list-0 .layui-laydate-content li ol li:last-child").click();
|
||||
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
var vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
img_sizes: [],
|
||||
app_id: 0,
|
||||
cover_note: '',
|
||||
},
|
||||
mounted: function () {
|
||||
var that = this;
|
||||
that.img_sizes = <?=json_encode($img_sizes, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.app_id = <?=$app_id?>;
|
||||
that.show_note();
|
||||
},
|
||||
methods: {
|
||||
show_note: function () {
|
||||
var that = this;
|
||||
var position = $('#position').val();
|
||||
var img_size = '';
|
||||
if (that.img_sizes[that.app_id] && that.img_sizes[that.app_id][position]) {
|
||||
img_size = that.img_sizes[that.app_id][position];
|
||||
}
|
||||
that.cover_note = img_size ? '(' + img_size + ')' : '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#position').change(function () {
|
||||
vue_obj.show_note();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
<div class="coms-table-wrap">
|
||||
<!-- no-border 去掉头部就有边控了-->
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/app/appusual/cms/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">
|
||||
<input type="text" placeholder="标题" value="<?= $title ? $title : '' ?>" name="title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status">
|
||||
<option value="">全部</option>
|
||||
<option <?= $status == '1' ? 'selected' : '' ?> value="1">上架</option>
|
||||
<option <?= $status == '0' ? 'selected' : '' ?> value="0">下架</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">位置:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="position">
|
||||
<option value="">全部</option>
|
||||
<?php foreach ($pos_arr as $pk => $pv) : ?>
|
||||
<option <?= $position == strval($pk) ? 'selected' : '' ?>
|
||||
value="<?= $pk ?>"><?= $pv ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ">
|
||||
<button type="submit" class="am-btn ml20 am-btn-sm am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ">
|
||||
<button type="button" data-open="/app/appusual/cms/get_add?app_id=<?= $app_id ?>"
|
||||
class="am-btn ml20 am-btn-sm am-btn-success w100">新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
|
||||
共有<?= $pager['total'] ?>条数据
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="10%" class="no-boder-lr">
|
||||
<button class="am-btn am-btn-secondary am-btn-sm" @click="saveSort">排序</button>
|
||||
</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="15%"><span>状态</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="value in lists">
|
||||
<tr>
|
||||
<td>{{value.id}}</td>
|
||||
<td class="no-boder-lr">
|
||||
<input class="am-form-field am-input-sm" type="text" v-model="value.sort"/>
|
||||
</td>
|
||||
<td>{{value.title}}</td>
|
||||
<td>{{value.position}}</td>
|
||||
<td>{{value.s_time}}</td>
|
||||
<td>{{value.e_time}}</td>
|
||||
<td v-if="value.status == '0'">下架</td>
|
||||
<td v-else-if="value.status == '1'">上架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="<?= $city_list ? 8 : 9 ?>" class="align-r">
|
||||
<input type="button" class="am-btn am-btn-xs am-btn-primary"
|
||||
:data-open="'/app/appusual/cms/get?app_id=<?= $app_id ?>&id='+value.id" value="修改"/>
|
||||
<input v-if="value.status == '0'" type="button" class="am-btn am-btn-xs am-btn-primary"
|
||||
data-ajax="post" data-action="/app/appusual/cms/edit_status?id="
|
||||
:data-params-id="value.id" data-params-status="1" value="上架"/>
|
||||
<input v-else-if="value.status == '1'" type="button" class="am-btn am-btn-xs am-btn-danger"
|
||||
data-ajax="post" data-action="/app/appusual/cms/edit_status" :data-params-id="value.id"
|
||||
data-params-status="0" value="下架"/>
|
||||
<input type="button" class="am-btn am-btn-xs am-btn-danger" data-ajax="post"
|
||||
data-action="/app/appusual/cms/del" :data-params-id="value.id" value="删除"/>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#datepicker1'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#datepicker2'
|
||||
});
|
||||
});
|
||||
var vm = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
lists: JSON.parse('<?=json_encode($this->data['lists'])?>'),
|
||||
},
|
||||
created: function () {
|
||||
},
|
||||
methods: {
|
||||
saveSort:function(){
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url:'/app/appusual/cms/edit_sort',
|
||||
type:'post',
|
||||
dataType:'json',
|
||||
data:{lists:vm.lists},
|
||||
success:function(data){
|
||||
if(data.code){
|
||||
layer.msg('操作成功',{'time':2000},function(){
|
||||
$.form.reload();
|
||||
})
|
||||
}else{
|
||||
layer.msg(data.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
Executable
+28
@@ -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>
|
||||
@@ -0,0 +1,300 @@
|
||||
<style type="text/css">
|
||||
.am-para-label {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.note-text {
|
||||
color: blue
|
||||
}
|
||||
|
||||
.va-mid {
|
||||
vertical-align: middle
|
||||
}
|
||||
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/hd.css?v=1581252500">
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" data-auto="true" action="/app/appusual/config/edit" 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="checkbox" class="mui-switch mui-switch-anim" true-value="1" false-value="0" v-model="info.biz_cate" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">是否开通卡功能:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim" true-value="1" false-value="0" v-model="info.vipcard" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">小程序发布设置:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" v-model="info.publish"/>
|
||||
<span class="note-text va-mid">(小程序发布审核时开启,可以隐藏一些敏感内容)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">可使用权益类型:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-g">
|
||||
<label class="mr10" style="margin-top: 7px" v-for="(tv, tk) in type_arr">
|
||||
<input type="checkbox" :value="tk" v-model="info.rights"/>{{tv}}
|
||||
</label>
|
||||
</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="mr10" style="margin-top: 7px">
|
||||
<input type="checkbox" value="1" v-model="info.coupons"/>erp电子券
|
||||
</label>
|
||||
<label class="mr10" style="margin-top: 7px">
|
||||
<input type="checkbox" value="2" v-model="info.coupons"/>线下买单抵用券
|
||||
</label>
|
||||
</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="mr10" style="margin-top: 7px">
|
||||
<input type="checkbox" value="3" v-model="info.rpackets"/>线上红包
|
||||
</label>
|
||||
</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="am-g">
|
||||
<label class="mr10" style="margin-top: 7px">
|
||||
<input disabled type="checkbox" name="func[]" value="1"/>好评
|
||||
</label>
|
||||
<label class="mr10" style="margin-top: 7px">
|
||||
<input disabled type="checkbox" name="func[]" value="2"/>文章
|
||||
</label>
|
||||
<label class="mr10" style="margin-top: 7px">
|
||||
<input disabled type="checkbox" name="func[]" value="3"/>活动
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">是否开启电商:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" name="ebiz" class="mui-switch mui-switch-anim" true-value="1" false-value="0" v-model="info.ebiz"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">是否开启分销锁粉:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" name="lock_fans" class="mui-switch mui-switch-anim" true-value="1" false-value="0" v-model="info.lock_fans" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">系统客服:</label>
|
||||
|
||||
<div class="am-para-input">
|
||||
<a class="am-btn am-btn-primary" style="margin-top: 5px;"
|
||||
:data-modal="'/app/app/get_servicer?type=0&app_id='+info.id"
|
||||
:data-title="info.name+'客服设置'">客服设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="14==info.id">
|
||||
<label class="am-para-label label-width">热门搜索设置:</label>
|
||||
<div class="am-para-input input-left">
|
||||
<div class="am-form-inline">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm" @click="word_modal()">添加热词</button>
|
||||
<span class="f12 clr999 lh-default ml5">热门搜索,已加<strong class="text-danger"
|
||||
v-if="info.hotword">{{info.hotword.length}}</strong>个</span>
|
||||
</div>
|
||||
<div class="label-group-wrap label-group-sortable">
|
||||
<draggable class="app-simulator-inner" v-model="info.hotword" group="info.hotword"
|
||||
@start="drag=true" @end="drag=false" @sort="sort">
|
||||
<div class="label-group" v-for="(v,i) in info.hotword">
|
||||
<span class="label label-default sort-shop-list" :data-id="i" :data-name="v"
|
||||
:data-sort="v">{{v}}</span>
|
||||
<a href="javascript:void(0);" @click="rm_item(i, 'word',v)" class="label label-default"><i
|
||||
class="fa fa-remove del_word"></i></a>
|
||||
</div>
|
||||
</draggable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group mb20">
|
||||
<label class="am-para-label">开通城市:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>城市ID</span></th>
|
||||
<th width="10%"><span>首字母</span></th>
|
||||
<th width="20%"><span>城市名称</span></th>
|
||||
<th width="20%"><span>状态</span></th>
|
||||
<th width=""><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v,k) in citys">
|
||||
<td>{{v.city_id}}</td>
|
||||
<td>{{v.firstchar}}</td>
|
||||
<td>{{v.name}}</td>
|
||||
<td>{{v.statusion}}</td>
|
||||
<td>
|
||||
<a v-if="1==v.status" data-ajax="post" data-action="/app/appusual/config/edit_city"
|
||||
:data-params-id="info.id" :data-params-city="v.city_id"
|
||||
data-params-status="0" class="am-btn am-btn-danger am-btn-xs">关闭</a>
|
||||
<a v-else data-ajax="post" data-action="/app/appusual/config/edit_city"
|
||||
:data-params-id="info.id" :data-params-city="v.city_id"
|
||||
data-params-status="1" class="am-btn am-btn-primary am-btn-xs">开启</a>
|
||||
<a v-if="1==v.default_city_id" data-ajax="post" data-action="/app/appusual/config/edit_city"
|
||||
:data-params-id="v.id" :data-params-city="v.city_id"
|
||||
data-params-type="1" data-params-status="0"
|
||||
class="am-btn am-btn-danger am-btn-xs">取消默认</a>
|
||||
<a v-else data-ajax="post" data-action="/app/appusual/config/edit_city"
|
||||
:data-params-id="v.id" :data-params-city="v.city_id"
|
||||
data-params-type="1" data-params-status="1"
|
||||
class="am-btn am-btn-primary am-btn-xs">设为默认</a>
|
||||
<a v-if="1==v.status&&13==v.id" href="javascript:;" :data-open="'app/xmfish/main/get_city?city_id='+v.city_id" class="c-btn am-btn am-btn-primary am-btn-xs">设置</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</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="word-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
|
||||
<label class="am-para-label" style="margin-left: -60px;" >热搜词:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group" style="width: 75%">
|
||||
<input type="text" class="hot_word" v-model="hot_word" placeholder="请输入热搜词">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var vue_obj;
|
||||
var loading = false;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info:'',
|
||||
type_arr:'',
|
||||
coup_arr:'',
|
||||
citys:'',
|
||||
hot_word:''
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.type_arr = <?=json_encode($type_arr, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.coup_arr = <?=json_encode($coup_arr, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.citys = <?=json_encode($citys, JSON_UNESCAPED_UNICODE)?>;
|
||||
if(vm.info.rights == undefined){vm.info.rights=[];}
|
||||
if(vm.info.coupons == undefined){vm.info.coupons=[];}
|
||||
if(vm.info.rpackets == undefined){vm.info.rpackets=[];}
|
||||
if(vm.info.hotword == undefined){vm.info.hotword=[];}
|
||||
console.log(vm.info);
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
word_modal:function(){
|
||||
var vm = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '30%'], //宽高
|
||||
content: $('#word-modal'),
|
||||
title: '热词搜索',
|
||||
shade: false,
|
||||
btn: ['确定添加'],
|
||||
yes: function (index) {
|
||||
if(vm.hot_word){
|
||||
var sear=new RegExp(vm.hot_word);
|
||||
if(!sear.test(vm.info.hotword)){
|
||||
vm.info.hotword.push(vm.hot_word);
|
||||
vm.hot_word = '';
|
||||
}else{
|
||||
layer.msg("该热词已存在", {icon: 2});
|
||||
}
|
||||
}
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
rm_item:function(i, type, word){
|
||||
var vm = this;
|
||||
if (type == 'word'){
|
||||
vm.info.hotword.splice(i,1);
|
||||
}
|
||||
},
|
||||
sort:function(){
|
||||
var vm = this;
|
||||
},
|
||||
saveEdit: function () {
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
var vm = this;
|
||||
loading = true;
|
||||
$.ajax({
|
||||
url: '/app/appusual/config/edit',
|
||||
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 () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+251
@@ -0,0 +1,251 @@
|
||||
<form id="vue-servicer" class="am-form am-form-horizontal ml20" action="/app/app/edit_servicer"
|
||||
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">
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="0" v-model='info.show_type'>默认</label></div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="1" v-model='info.show_type'>自定义</label></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="radio"><label><input type="radio" value="-1" v-model='info.show_type'>隐藏</label></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="service-type" v-if="info.show_type==1">
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">客服电话</span>
|
||||
<input placeholder="" class="am-form-field form-control" v-model="info.contact">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-panel-group" id="accordion">
|
||||
<div class="am-panel am-panel-default" v-for="(v, i) in lists">
|
||||
<div class="am-panel-hd">
|
||||
<h4 class="am-panel-title" style="font-weight: bold;" :data-am-collapse="'{parent: \'#accordion\', target: \'#do-not-say-' + i +'\'}'">
|
||||
{{v.keyword}}
|
||||
<a class="ml20 am-close am-close-alt am-icon-times" @click="rm_item(i);"></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div :id="'do-not-say-'+i" :class="['am-panel-collapse','am-collapse', , v.show==1 ? 'am-in' : '']">
|
||||
<div class="am-panel-bd">
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">回复口令</span>
|
||||
<input placeholder="" class="am-form-field form-control" v-model="v.keyword">
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg-text" v-if="v.msg_type==0">
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">消息文案</span>
|
||||
<input placeholder="请输入文案" class="am-form-field form-control" v-model="v.msg.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="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="'msg_img'+i"><i
|
||||
class="am-icon-cloud-upload"></i> 上传二维码图片
|
||||
</button>
|
||||
<input :id="'msg-img-'+i" type="hidden" :name="'msg_img'+i"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
v-model="v.msg.img" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" :src="v.msg.img_url"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg-article" v-else-if="v.msg_type==1">
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">文章标题</span>
|
||||
<input placeholder="" class="am-form-field form-control" v-model="v.msg.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">文章链接</span>
|
||||
<input placeholder="" class="am-form-field form-control" v-model="v.msg.link">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">文章描述</span>
|
||||
<textarea placeholder="" class="am-form-field form-control" v-model="v.msg.content">{{v.msg.content}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="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="'msg_img'+i"><i
|
||||
class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<input :id="'msg-img-'+i" type="hidden" :name="'msg_img'+i"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
v-model="v.msg.img" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" :src="v.msg.img_url"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="am-input-group">
|
||||
<span class="am-input-group-label">新增</span>
|
||||
<select v-model="add_type" class="am-form-field form-control">
|
||||
<template v-for="(v,i) in msg_types">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
<span class="am-input-group-btn">
|
||||
<button class="am-btn am-btn-default" type="button" @click="new_item();">+</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click='saveEdit();'>保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var vue_servicer;
|
||||
var loading = false;
|
||||
$(function(){
|
||||
vue_servicer = new Vue({
|
||||
el: '#vue-servicer',
|
||||
data: {
|
||||
info:{},
|
||||
lists: [],
|
||||
msg_types: [],
|
||||
add_type: 0,
|
||||
max_num: 0
|
||||
},
|
||||
mounted:function() {
|
||||
var that = this;
|
||||
that.info = <?=$info ? json_encode($info, JSON_UNESCAPED_UNICODE) : '{}'?>;
|
||||
that.lists = <?=$lists ? json_encode($lists, JSON_UNESCAPED_UNICODE) : '[]'?>;
|
||||
that.msg_types = <?=$msg_types ? json_encode($msg_types, JSON_UNESCAPED_UNICODE) : "[]"?>;
|
||||
that.max_num = <?=intval($max_num)?>;
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
rm_item:function(index){
|
||||
var vm = this;
|
||||
vm.lists.splice(index,1);
|
||||
},
|
||||
new_item:function(){
|
||||
var vm = this;
|
||||
if(vm.max_num > 0 && vm.lists.length >= vm.max_num){
|
||||
layer.msg('最多设置'+vm.max_num+'个口令', {icon: 2});
|
||||
return;
|
||||
}
|
||||
var item = {
|
||||
'msg_type': vm.add_type,
|
||||
'msg':{},
|
||||
'show':1
|
||||
};
|
||||
vm.lists.push(item);
|
||||
vm.add_type = 0;
|
||||
},
|
||||
saveEdit: function () {
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
var vm = this;
|
||||
|
||||
if(1 == vm.info.show_type){//自定义参数校验
|
||||
if(undefined == vm.info.contact ||0 == vm.info.contact.length){
|
||||
layer.msg("联系方式不为空", {icon: 2});
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
return;
|
||||
}
|
||||
//校验口令是否重复
|
||||
var lists = vm.lists;
|
||||
var lenth = lists.length;
|
||||
if(lenth==0){
|
||||
layer.msg("请添加消息模板", {icon: 2});
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
return;
|
||||
}
|
||||
|
||||
for(var i=0; i < lenth; i++){
|
||||
var keyword = lists[i].keyword;
|
||||
if(undefined == keyword || 0 == keyword.length){
|
||||
layer.msg("口令不能为空", {icon: 2});
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
return;
|
||||
}
|
||||
if(undefined == lists[i].msg.title || 0 == lists[i].msg.title.length){
|
||||
layer.msg("文案或者标题不能为空", {icon: 2});
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
return;
|
||||
}
|
||||
for(var j=i+1;j<lenth; j++){
|
||||
if(keyword == lists[j].keyword){
|
||||
layer.msg("口令“" + keyword + "” 重复了", {icon: 2});
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
return;
|
||||
}
|
||||
}
|
||||
//图片是js修改的,不会触发vue的数据绑定需要手动修改
|
||||
var img = $('#msg-img-'+i).val();
|
||||
undefined != img && (lists[i].msg.img = img);
|
||||
}
|
||||
}
|
||||
|
||||
loading = true;
|
||||
$.ajax({
|
||||
url: '/app/app/edit_servicer',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info,
|
||||
lists: vm.lists
|
||||
},
|
||||
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 () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
<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="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"><?=$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>
|
||||
</script>
|
||||
@@ -0,0 +1,444 @@
|
||||
<style type="text/css">
|
||||
|
||||
.apptese-img img {
|
||||
display: block;
|
||||
margin: 10px auto 0 auto;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" action="/app/appusual/subjects/<?= $action ?>" data-auto="true"
|
||||
method="post" style="width: 90%;padding-top: 10px" onsubmit="return false">
|
||||
<input type="hidden" v-model="info.id" name="id"/>
|
||||
<input type="hidden" v-model="info.uid" name="uid"/>
|
||||
<input type="hidden" v-model="info.type" name="type"/>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">发布用户:</label>
|
||||
<div class="am-para-input wp60 w300" style="width: 20%">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
@click="userModal">{{info.nickname}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.app_id==14">
|
||||
<label class="am-para-label">分类:</label>
|
||||
<div class="am-form-group am-para-inline w120">
|
||||
<select v-model="info.cate_id">
|
||||
<option :value="i" v-for="(v,i) in cateAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">标题:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="标题" v-model="info.title" name="title"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label label-width">类型:</label>
|
||||
<div class="am-para-input input-left">
|
||||
<label class="am-checkbox-inline style">
|
||||
<input type="radio" v-model='info.type' value='0'>图片</label>
|
||||
<label class="am-checkbox-inline style">
|
||||
<input type="radio" v-model='info.type' value='1'>视频</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" v-if="info.type==0">
|
||||
<div class="admin-content">
|
||||
<label class="am-para-label">详情图片:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<div class="photo-upload">
|
||||
<div class="photo-upload-item" v-for="(v,i) in info.imgs">
|
||||
<img :src="v.src" class="img-thumbnail" :data-value="v.value" data-tips-image style="width:100px;height:100px;">
|
||||
<span class="photo-upload-item-remove">
|
||||
<i class="fa fa-remove" data-rm-vue="vue_obj.info.imgs" :data-index="i"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm" data-file="20"
|
||||
data-type="jpg,png,gif,png,jpeg" data-uptype="qiniu"
|
||||
data-field="img_rheight" data-params-source="vue_obj.info.imgs" v-if="info.imgs.length<20">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" v-if="info.type==1">
|
||||
<label class="am-para-label">详情视频:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" id="video-url" name="video" v-model="info.video" placeholder="视频地址"/>
|
||||
<div class="am-form-inline" style="margin-top: 15px;">
|
||||
<div class="am-form-group" style="margin-right: 10px;">
|
||||
<button id="upload-video" type="button" class="am-btn am-btn-default am-btn-sm" @click="btn_video">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的视频
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group" id="show-video">
|
||||
<a href="javascript:void(0)" :data-modal="'/common/show_video?video='+info.video"
|
||||
data-title="查看视频" v-if="info.video_cover">
|
||||
<img :src="info.video_cover" style="height:auto;max-height:32px;min-width:32px"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分享数:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="分享数" v-model="info.share_num" name="share_num"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">点赞数:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="点赞数" v-model="info.zan_num" name="zan_num"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">内容:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<textarea id="content-text" name="content_text" style="min-height: 250px">{{info.content}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button class="am-btn ml20 am-btn-sm am-btn-success w100" type="button" @click="saveEdit">保存</button>
|
||||
</div>
|
||||
|
||||
<div id="user-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="35%" style="font-weight: bold;padding-left: 8px;">用户名</td>
|
||||
<td width="20%"></td>
|
||||
<td width="35%" style="padding-right: 8px;"><label class="sr-only" for="search">用户名</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" style="font-size: 1.2rem;font-weight: bold;"
|
||||
v-model='usersTitle' placeholder="用户名">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" @click='getUsers(1);' class="btn btn-default">搜</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="border-bottom: 1px solid #ddd;height: 1px;margin-top: 8px;"></div>
|
||||
<table class="table table-middle">
|
||||
<colgroup>
|
||||
<col width="70%"/>
|
||||
<col width="10%"/>
|
||||
<col width="20%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in usersList">
|
||||
<td>{{v.nickname}}</td>
|
||||
<td class="text-right">
|
||||
<a v-if="v.selected==0" href="javascript:void(0);" @click="setUsers(v,1)"
|
||||
class="btn btn-primary btn-sm">选择</a>
|
||||
<a v-else-if="v.selected==1" href="javascript:void(0);" @click="setUsers(v,0)"
|
||||
class="btn btn-default btn-sm">移除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{usersPage.page}}页(每页{{usersPage.pageLimit}}条,共{{usersPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeUsersPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="usersPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterUsersPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var loading = false;
|
||||
var vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: '',
|
||||
usersList: [],
|
||||
usersPage: [],
|
||||
usersTitle: '',
|
||||
|
||||
tags: [],
|
||||
tag_s_id: [],
|
||||
tag_s: [],
|
||||
cate: [],
|
||||
tourl:''
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.tags = <?=$tags ? json_encode($tags) : '[]'?>;
|
||||
vm.tag_s_id = <?=$tag_s_id ? json_encode($tag_s_id) : '[]'?>;
|
||||
vm.tag_s = <?=$tag_s ? json_encode($tag_s) : '[]'?>;
|
||||
vm.cate = <?=json_encode($cate)?>;
|
||||
vm.cateAry = <?=json_encode($cateAry)?>;
|
||||
vm.acto = '<?=$acto?>';
|
||||
},
|
||||
methods: {
|
||||
userModal: function () {
|
||||
var vm = this;
|
||||
vm.getUsers(1);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '80%'], //宽高
|
||||
content: $('#user-modal'),
|
||||
title: '选择用户',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
getUsers: function (page) {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/common/users_app',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: page,
|
||||
app_id: vm.info.app_id,
|
||||
nickname: vm.usersTitle,
|
||||
},
|
||||
success: function (re) {
|
||||
var usersList = re.data.usersList;
|
||||
vm.usersPage = re.data.usersPage;
|
||||
usersList.map(function (_item, _index) {
|
||||
if (vm.info.uid == _item.id) {
|
||||
usersList[_index].selected = 1;
|
||||
} else {
|
||||
usersList[_index].selected = 0;
|
||||
}
|
||||
});
|
||||
vm.usersList = usersList;
|
||||
}
|
||||
});
|
||||
},
|
||||
setUsers: function (users, checked) {
|
||||
var vm = this;
|
||||
var usersList = vm.usersList;
|
||||
usersList.map(function (_item, _index) {
|
||||
usersList[_index].selected = 0;
|
||||
});
|
||||
vm.usersList = usersList;
|
||||
if (checked) {
|
||||
vm.info.uid = users.id;
|
||||
vm.info.nickname = users.nickname;
|
||||
users.selected = 1;
|
||||
} else {
|
||||
vm.info.uid = 0;
|
||||
vm.info.nickname = '请选择用户';
|
||||
}
|
||||
},
|
||||
beforeUsersPage: function () {
|
||||
var vm = this;
|
||||
if (vm.usersPage.page == 1) {
|
||||
layer.msg('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.usersPage.page--;
|
||||
vm.getUsers(vm.usersPage.page);
|
||||
},
|
||||
afterUsersPage: function () {
|
||||
var vm = this;
|
||||
vm.usersPage.page++;
|
||||
vm.getUsers(vm.usersPage.page);
|
||||
},
|
||||
get_tags: function () {
|
||||
var vm = this;
|
||||
$.post('<?=$tag_url?>', {app_id: vm.app_id}, function (res) {
|
||||
vm.tag_s = [];
|
||||
vm.tag_s_id = [];
|
||||
vm.tags = res.data;
|
||||
})
|
||||
},
|
||||
removeTag: function (index, id) {
|
||||
this.tag_s.splice(index, 1);
|
||||
for (var i in this.tag_s) {
|
||||
if (this.tag_s[i] == id) {
|
||||
this.tag_s.splice(i, 1);
|
||||
}
|
||||
}
|
||||
for (var i in this.tag_s_id) {
|
||||
if (this.tag_s_id[i] == id) {
|
||||
this.tag_s_id.splice(i, 1);
|
||||
}
|
||||
}
|
||||
console.log(this.tag_s_id);
|
||||
},
|
||||
trigger: function (index) {
|
||||
var f = true;
|
||||
for (var i in this.tag_s) {
|
||||
if (this.tag_s[i].tag_id == index.tag_id) {
|
||||
this.tag_s.splice(i, 1);
|
||||
this.tag_s_id.splice(i, 1);
|
||||
f = false;
|
||||
}
|
||||
}
|
||||
if (f) {
|
||||
this.tag_s.push(index);
|
||||
this.tag_s_id.push(index.tag_id);
|
||||
}
|
||||
console.log(this.tag_s);
|
||||
},
|
||||
btn_video:function(){
|
||||
upvideo(this);
|
||||
},
|
||||
saveEdit:function(){
|
||||
var vm =this;
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
loading = true;
|
||||
|
||||
if(1 == vm.info.type){
|
||||
vm.info.video = $('#video-url').val();
|
||||
}
|
||||
vm.info.content = $('#content-text').val();
|
||||
|
||||
$.ajax({
|
||||
url: '/app/appusual/subjects/<?=$action?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info,
|
||||
tag_ids:vm.tag_s_id
|
||||
},
|
||||
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 () {
|
||||
if(vm.acto.length > 0){
|
||||
$.form.href(vm.acto);
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
$.post('<?=$tag_url?>', {app_id: this.app_id}, function (res) {
|
||||
if(res.data){
|
||||
vue_obj.tags = res.data;
|
||||
} else {
|
||||
vue_obj.tags = [];
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
});
|
||||
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");
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param btn
|
||||
*/
|
||||
function upvideo(btn){
|
||||
var show_video = $('#show-video');
|
||||
var _this = $(btn);
|
||||
var qiniu = new Qiniu.UploaderBuilder()
|
||||
.domain('https://upload-z2.qiniup.com')//配置参考https://developer.qiniu.com/kodo/manual/1671/region-endpoint
|
||||
.retry(0)//设置重传次数,默认0,不重传
|
||||
.size(1024 * 1024)//分片大小,最多为4MB,单位为字节,默认1MB
|
||||
.chunk(true)//是否分块上传,默认true,当chunk=true并且文件大于4MB才会进行分块上传
|
||||
.auto(true)//选中文件后立即上传,默认true
|
||||
.multiple(false)//是否支持多文件选中,默认true
|
||||
.accept(['video/*'])//过滤文件,默认无
|
||||
.tokenShare(true)//在一次上传队列中,是否分享token,如果为false每上传一个文件都需要请求一次Token,默认true
|
||||
.tokenFunc(function (setToken, task) {
|
||||
//token获取函数,token获取完成后,必须调用`setToken(token);`不然上传任务不会执行。
|
||||
var ret = $.ajax({
|
||||
url: "/common/qiniu_token",
|
||||
type: 'POST',
|
||||
data: {filename: task.key, type: "video"},
|
||||
async: false
|
||||
}).responseText;
|
||||
ret = JSON.parse(ret);
|
||||
setToken(ret.data);
|
||||
})
|
||||
.listener({
|
||||
onReady: function (tasks) {
|
||||
// write(tasks)
|
||||
}, onStart: function (tasks) {
|
||||
}, onTaskGetKey: function (task) {
|
||||
//为每一个上传的文件指定key,如果不指定则由七牛服务器自行处理
|
||||
var ret = $.ajax({
|
||||
url: "/common/qiniu_video",
|
||||
type: 'POST',
|
||||
data: {filename: task.file.name},
|
||||
async: false
|
||||
}).responseText;
|
||||
ret = JSON.parse(ret);
|
||||
if (ret.code == 0) {
|
||||
layer.msg(ret.msg, {icon: 2});
|
||||
return;
|
||||
}
|
||||
return ret.data;
|
||||
}, onTaskProgress: function (task) {
|
||||
show_video.empty();
|
||||
show_video.prepend("视频上传进度" + task.progress + "%");
|
||||
}, onTaskSuccess: function (task) {
|
||||
// console.log(task);
|
||||
show_video.empty();
|
||||
var res = task._result.data;
|
||||
vue_obj.info.video = res.site_url;
|
||||
vue_obj.info.video_cover = res.site_url + '?vframe/jpg/offset/1';
|
||||
var html = '<a href="javascript:void(0)" data-modal="/common/show_video?video=' + res.site_url + '" data-title="查看视频">' +
|
||||
'<img src="' + res.site_url + '?vframe/jpg/offset/1" ' +
|
||||
'style="height:auto;max-height:32px;min-width:32px"></a>';
|
||||
show_video.prepend(html);
|
||||
$('#video-url').val(res.site_url);
|
||||
}, onTaskFail: function (task) {
|
||||
show_video.empty();
|
||||
show_video.prepend("上传失败");
|
||||
}, onTaskRetry: function (task) {
|
||||
// write(task)
|
||||
}, onFinish: function (tasks) {
|
||||
// write(tasks)
|
||||
}
|
||||
}).build();
|
||||
qiniu.chooseFile();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,158 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-list">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/appusual/subjects/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 w120">
|
||||
<select name="search_k" v-model="params.search_k" >
|
||||
<option v-for="(v,i) in searchTpAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="search_v" name="search_v" type="text" v-model="params.search_v"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">状态:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">下架</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 w120">
|
||||
<select name="app_id" v-model="params.app_id">
|
||||
<option :value="v.id" v-for="(v,i) in appList">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100" @click="saveEdit">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" :data-open="'/app/appusual/subjects/get?app_id='+params.app_id"
|
||||
class="am-btn am-btn-success am-btn-sm w100">新增</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="6%"><span>ID</span></th>
|
||||
<th width="10%"><span>用户</span></th>
|
||||
<th width="15%"><span>标题</span></th>
|
||||
<th width="10%"><span>类型</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width="10%" class="no-boder-lr">
|
||||
<button class="am-btn am-btn-secondary am-btn-sm" @click="saveSort">排序</button>
|
||||
</th>
|
||||
<th width="5%" v-if="13 == params.app_id"><span>回复数</span></th>
|
||||
<th width="25%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in lists">
|
||||
<td>
|
||||
<span><input class="ids" type="checkbox" :value="v.id"></span>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.user}}</td>
|
||||
<td>{{v.title}}</td>
|
||||
<td>{{v.type==1?'视频':'图片'}}</td>
|
||||
<td>{{1==v.status?'正常':'下架'}}</td>
|
||||
<td class="no-boder-lr">
|
||||
<input class="am-form-field am-input-sm" type="text" v-model="v.sort"/>
|
||||
</td>
|
||||
<td>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
:data-open="'/app/appusual/subjects/get?app_id='+params.app_id+'&id='+v.id">查看详情</a>
|
||||
<a :class="'am-btn am-btn-xs am-btn-'+('1'==v.status?'danger':'primary')" data-ajax="post"
|
||||
:data-params-status="'1'==v.status?'0':'1'" :data-params-id="v.id"
|
||||
:data-action="'/app/appusual/subjects/edit_status?app_id='+params.app_id">{{1==v.status?'下架':'上架'}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="checkall">
|
||||
<input type="checkbox" data-check-target=".ids">全选</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select data-update-group="" data-list-target=".ids" :data-action="'/app/appusual/subjects/batch?app_id='+params.app_id"
|
||||
data-field="ifcheck">
|
||||
<option value="">批量操作</option>
|
||||
<option value="1">上架</option>
|
||||
<option value="0">下架</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var vue_obj;
|
||||
var loading = false;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-list',
|
||||
data: {
|
||||
params:[],
|
||||
appList:[],
|
||||
searchTpAry:[],
|
||||
lists:[]
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.appList = <?=json_encode($appList, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.searchTpAry = <?=json_encode($searchTpAry, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.lists = <?=json_encode($lists, JSON_UNESCAPED_UNICODE)?>;
|
||||
},
|
||||
created: function () {},
|
||||
methods: {
|
||||
saveEdit:function(){
|
||||
$("form").submit();
|
||||
},
|
||||
saveSort:function(){
|
||||
var vm = this;
|
||||
var lists = [];
|
||||
vm.lists.map(function (v, i,arr) {
|
||||
lists.push({id:v.id, sort:v.sort});
|
||||
});
|
||||
$.ajax({
|
||||
url:'/app/appusual/subjects/edit_sort?app_id='+vm.params.app_id,
|
||||
type:'post',
|
||||
dataType:'json',
|
||||
data:{
|
||||
lists:lists
|
||||
},
|
||||
success:function(data){
|
||||
if(data.code){
|
||||
layer.msg("操作成功",{time:2000},function(){
|
||||
$.form.reload();
|
||||
})
|
||||
}else{
|
||||
layer.msg("修改失败");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
|
||||
</script>
|
||||
Executable
+219
@@ -0,0 +1,219 @@
|
||||
<style type="text/css">
|
||||
|
||||
.apptese-img img {
|
||||
display: block;
|
||||
margin: 10px auto 0 auto;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" action="/app/appusual/subreply/add" data-auto="true"
|
||||
method="post" style="width: 90%;padding-top: 10px" onsubmit="return false">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">发布用户:</label>
|
||||
<div class="am-para-input wp60 w300" style="width: 20%">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
@click="userModal">{{info.nickname}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">内容:</label>
|
||||
<textarea id="content-text" name="content_text" style="min-height: 250px; width: 600px">{{info.content}}</textarea>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button class="am-btn ml20 am-btn-sm am-btn-success w100" type="button" @click="saveEdit" style="margin-left: 300px">保存</button>
|
||||
</div>
|
||||
|
||||
<div id="user-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="35%" style="font-weight: bold;padding-left: 8px;">用户名</td>
|
||||
<td width="20%"></td>
|
||||
<td width="35%" style="padding-right: 8px;"><label class="sr-only" for="search">用户名</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" style="font-size: 1.2rem;font-weight: bold;"
|
||||
v-model='usersTitle' placeholder="用户名">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" @click='getUsers(1);' class="btn btn-default">搜</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="border-bottom: 1px solid #ddd;height: 1px;margin-top: 8px;"></div>
|
||||
<table class="table table-middle">
|
||||
<colgroup>
|
||||
<col width="70%"/>
|
||||
<col width="10%"/>
|
||||
<col width="20%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in usersList">
|
||||
<td>{{v.nickname}}</td>
|
||||
<td class="text-right">
|
||||
<a v-if="v.selected==0" href="javascript:void(0);" @click="setUsers(v,1)"
|
||||
class="btn btn-primary btn-sm">选择</a>
|
||||
<a v-else-if="v.selected==1" href="javascript:void(0);" @click="setUsers(v,0)"
|
||||
class="btn btn-default btn-sm">移除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{usersPage.page}}页(每页{{usersPage.pageLimit}}条,共{{usersPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeUsersPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="usersPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterUsersPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var loading = false;
|
||||
var vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: {},
|
||||
usersList: [],
|
||||
usersPage: [],
|
||||
usersTitle: '',
|
||||
tourl:"",
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.app_id = <?=$app_id?>;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
},
|
||||
methods: {
|
||||
userModal: function () {
|
||||
var vm = this;
|
||||
vm.getUsers(1);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '80%'], //宽高
|
||||
content: $('#user-modal'),
|
||||
title: '选择用户',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
getUsers: function (page) {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
// url: '/common/users_app',
|
||||
url: '/app/xmfish/member/lists_json',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: page,
|
||||
app_id: vm.info.app_id,
|
||||
nickname: vm.usersTitle,
|
||||
group_id: 4
|
||||
},
|
||||
success: function (re) {
|
||||
// var usersList = re.data.usersList; // 对应'/common/users_app'
|
||||
var usersList = re.data.list;
|
||||
vm.usersPage = re.data.usersPage;
|
||||
usersList.map(function (_item, _index) {
|
||||
if (vm.info.uid == _item.id) {
|
||||
usersList[_index].selected = 1;
|
||||
} else {
|
||||
usersList[_index].selected = 0;
|
||||
}
|
||||
});
|
||||
vm.usersList = usersList;
|
||||
}
|
||||
});
|
||||
},
|
||||
setUsers: function (users, checked) {
|
||||
var vm = this;
|
||||
var usersList = vm.usersList;
|
||||
usersList.map(function (_item, _index) {
|
||||
usersList[_index].selected = 0;
|
||||
});
|
||||
vm.usersList = usersList;
|
||||
if (checked) {
|
||||
vm.info.uid = users.id;
|
||||
vm.info.nickname = users.nickname;
|
||||
users.selected = 1;
|
||||
} else {
|
||||
vm.info.uid = 0;
|
||||
vm.info.nickname = '请选择用户';
|
||||
}
|
||||
},
|
||||
beforeUsersPage: function () {
|
||||
var vm = this;
|
||||
if (vm.usersPage.page == 1) {
|
||||
layer.msg('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.usersPage.page--;
|
||||
vm.getUsers(vm.usersPage.page);
|
||||
},
|
||||
afterUsersPage: function () {
|
||||
var vm = this;
|
||||
vm.usersPage.page++;
|
||||
vm.getUsers(vm.usersPage.page);
|
||||
},
|
||||
saveEdit:function(){
|
||||
var vm =this;
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
loading = true;
|
||||
|
||||
vm.info.content = $('#content-text').val();
|
||||
$.ajax({
|
||||
url: '/app/appusual/subreply/add',
|
||||
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 () {
|
||||
if(vm.tourl.length > 0){
|
||||
$.form.href(vm.tourl);
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Executable
+17
@@ -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>
|
||||
|
||||
|
||||
Executable
+389
@@ -0,0 +1,389 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" action="/app/liche/cms/<?= $url ?>" data-auto="true"
|
||||
method="post" style="width: 90%;padding-top: 10px" onsubmit="return false">
|
||||
<input type="hidden" :value="info.id" name="id"/>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">标题:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="输入标题" v-model="info.title" name="title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0">
|
||||
<label class="am-para-label">图片:</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="cover"><i
|
||||
class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</button>
|
||||
<input id="cover" type="hidden" name="cover" value="<?=$info['cover']?>" class="layui-input">
|
||||
<?foreach($covers as $val){?>
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="<?=$val?>"/>
|
||||
<?}?>
|
||||
<?if(!$covers){?>
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" src=""/>
|
||||
<?}?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">排序:</label>
|
||||
<div class="am-para-input wp60 w300">
|
||||
<input type="text" style="display: inline;width: 80%" placeholder="输入排序,数值大的排前面" v-model="info.sort"/>
|
||||
<span style="color: blue">(数值大的排前面)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">推送位置:</label>
|
||||
<div class="am-para-inline wp60" style="width : 20%">
|
||||
<select name="position" v-model="info.position">
|
||||
<option value="">请选择</option>
|
||||
<template v-for="(v,i) in positions">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.position==2">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input" style="margin-top: 5px;">
|
||||
<span class="mr10">车型<input type="radio" name="type" v-model='info.type' value="2" @change="change_type"/></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">链接:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" placeholder="输入链接" v-model="info.link" name="link"/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="info.type == 2">
|
||||
<v-cars-select :target_id.sync="info.target_id" :app_id="app_id"></v-cars-select>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">简介:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<textarea id="content" name="content" style="min-height: 150px" v-model="info.content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">有效时间:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="开始时间" value="<?= $info['s_time'] ?>" autocomplete="off" name="s_time" id="s-time">
|
||||
</div>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="结束时间" value="<?= $info['e_time'] ?>" autocomplete="off" name="e_time" id="e-time">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button class="am-btn ml20 am-btn-sm am-btn-success w100" type="button" @click='saveEdit();'>保存</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<template id="v-cars-select">
|
||||
<div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label"><span class="text-danger">*</span>选择车型:</label>
|
||||
<div class="am-para-input input-left">
|
||||
<img :src='select.img' width="100" height="100" @click="itemsModal"/>
|
||||
{{select.title}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="items-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="35%" style="font-weight: bold;padding-left: 8px;">车型</td>
|
||||
<td width="35%" style="padding-right: 8px;"><label class="sr-only" for="search">搜车系</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" style="font-size: 1.2rem;font-weight: bold;"
|
||||
v-model='itemsTitle' placeholder="车系名">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" @click='getItems(1);' class="btn btn-default">搜</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="border-bottom: 1px solid #ddd;height: 1px;margin-top: 8px;"></div>
|
||||
<table class="table table-middle">
|
||||
<colgroup>
|
||||
<col width="50%"/>
|
||||
<col width="30%"/>
|
||||
<col width="20%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>车系</th>
|
||||
<th>品牌</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
<tr v-for="(b,i) in itemsList">
|
||||
<td>{{b.name}}</td>
|
||||
<td>{{b.b_name}}</td>
|
||||
<td>
|
||||
<a v-if="b.is_checked==0" href="javascript:void(0);" @click="setItems(i,1)"
|
||||
class="btn btn-primary btn-sm">选择</a>
|
||||
<a v-else-if="b.is_checked==1" href="javascript:void(0);" @click="setItems(i,0)"
|
||||
class="btn btn-default btn-sm">移除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{itemsPage.page}}页(每页{{itemsPage.pageLimit}}条,共{{itemsPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeItemsPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="itemsPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterItemsPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var editor;
|
||||
require(['laydate','ckeditor'], function (laydate) {
|
||||
//window.createEditor('[name="content"]');
|
||||
editor = CKEDITOR.replace('content');
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#s-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#e-time'
|
||||
,type: 'datetime'
|
||||
,done: function (value, date) {
|
||||
if (date.hours == "0" && date.minutes == "0" && date.seconds == "0") {
|
||||
// 改变结束时间默认值
|
||||
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
|
||||
$(".laydate-main-list-0 .layui-laydate-content li ol li:last-child").click();
|
||||
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var vue_obj;
|
||||
var vue_goods;
|
||||
var loading = false;
|
||||
$(function(){
|
||||
vue_goods = Vue.component('v-cars-select', {
|
||||
props:{
|
||||
'app_id': {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
'target_id':{
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
template: '#v-cars-select',
|
||||
data:function(){
|
||||
return {
|
||||
select:[],
|
||||
itemsTitle:'',
|
||||
itemsList:[],
|
||||
itemsPage:[],
|
||||
}
|
||||
},
|
||||
mounted: function (){
|
||||
var that = this;
|
||||
that.select = {};
|
||||
if(that.target_id > 0){
|
||||
that.init_item();
|
||||
}else{
|
||||
that.select.img = '/img/visits/add.jpg';
|
||||
that.select.title = '';
|
||||
that.select.id = 0;
|
||||
}
|
||||
console.log(that.select);
|
||||
},
|
||||
methods:{
|
||||
init_item: function(){
|
||||
var vm = this;
|
||||
if(vm.target_id > 0){
|
||||
$.ajax({
|
||||
url: '/app/liche/cms/get_car',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: vm.target_id
|
||||
},
|
||||
success: function (re) {
|
||||
console.dir(re.data.data);
|
||||
vm.select = re.data.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
itemsModal: function (index) {
|
||||
//选择商品
|
||||
var vm = this;
|
||||
vm.getItems(1);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '80%'], //宽高
|
||||
content: $('#items-modal'),
|
||||
title: '选取商品',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
getItems: function (page) {
|
||||
var vm = this;
|
||||
var select_list = [];
|
||||
if(vm.select.id > 0){
|
||||
select_list.push(vm.select);
|
||||
}
|
||||
console.dir(select_list)
|
||||
$.ajax({
|
||||
url: '/common/cars',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: page,
|
||||
use_items_list: select_list,
|
||||
app_id: vm.app_id,
|
||||
title: vm.itemsTitle,
|
||||
status:1
|
||||
},
|
||||
success: function (re) {
|
||||
vm.itemsList = re.data.itemsList;
|
||||
vm.itemsPage = re.data.itemsPage;
|
||||
}
|
||||
});
|
||||
},
|
||||
setItems: function (index, checked) {
|
||||
//设置商品是否选中
|
||||
var vm = this;
|
||||
vm.removeItems();
|
||||
if (checked == 1) {
|
||||
vm.itemsList[index]['is_checked'] = checked;
|
||||
var _items = {
|
||||
id: vm.itemsList[index]['id'],
|
||||
title: vm.itemsList[index]['b_name']+vm.itemsList[index]['name'],
|
||||
img : '/img/visits/add.jpg'
|
||||
};
|
||||
vm.select = _items;
|
||||
vm.$emit('update:target_id', vm.select.id);
|
||||
}
|
||||
},
|
||||
removeItems: function (index) {
|
||||
//删除选中商品
|
||||
var vm = this;
|
||||
for (var i = 0; i < vm.itemsList.length; i++) {
|
||||
vm.itemsList[i]['is_checked'] = 0;
|
||||
}
|
||||
vm.select.img = '/img/visits/add.jpg';
|
||||
vm.select.title = '';
|
||||
vm.select.id = 0;
|
||||
vm.$emit('update:target_id', 0);
|
||||
},
|
||||
beforeItemsPage: function () {
|
||||
var vm = this;
|
||||
if (vm.itemsPage.page == 1) {
|
||||
layer.msg("已经是第一页了");
|
||||
return;
|
||||
}
|
||||
vm.itemsPage.page--;
|
||||
vm.getItems(vm.itemsPage.page);
|
||||
},
|
||||
afterItemsPage: function () {
|
||||
var vm = this;
|
||||
vm.itemsPage.page++;
|
||||
vm.getItems(vm.itemsPage.page);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info:[],
|
||||
positions:[],
|
||||
areas:[],
|
||||
covers:[],
|
||||
app_id:0,
|
||||
},
|
||||
mounted: function(){
|
||||
var that = this;
|
||||
that.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.positions = <?=json_encode($pos_arr, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.areas = <?=json_encode($area_arr, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.covers = <?=json_encode($covers, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.app_id = <?=$app_id?>;
|
||||
},
|
||||
methods: {
|
||||
change_type: function () {
|
||||
var vm = this;
|
||||
vm.info.target_id = 0;
|
||||
},
|
||||
saveEdit: function () {
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
loading = true;
|
||||
var vm = this;
|
||||
vm.info.cover = $('#cover').val();
|
||||
vm.info.s_time = $('#s-time').val();
|
||||
vm.info.e_time = $('#e-time').val();
|
||||
vm.info.content = editor.getData();
|
||||
|
||||
$.ajax({
|
||||
url: $('#vue-edit').attr('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 () {
|
||||
if (data.data.status == 1) {
|
||||
$.form.reload();
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+127
@@ -0,0 +1,127 @@
|
||||
<div class="coms-table-wrap">
|
||||
<!-- no-border 去掉头部就有边控了-->
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/app/liche/cms/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">
|
||||
<input type="text" placeholder="标题" value="<?= $title ? $title : '' ?>" name="title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status">
|
||||
<option value="">请选择</option>
|
||||
<option <?= $status == '1' ? 'selected' : '' ?> value="1">上架</option>
|
||||
<option <?= $status == '0' ? 'selected' : '' ?> value="0">下架</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">位置:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="position">
|
||||
<option value="">请选择</option>
|
||||
<?php foreach ($pos_arr as $pk => $pv) : ?>
|
||||
<option <?= $position == strval($pk) ? 'selected' : '' ?>
|
||||
value="<?= $pk ?>"><?= $pv ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ">
|
||||
<button type="submit" class="am-btn ml20 am-btn-sm am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ">
|
||||
<button type="button" data-open="/app/liche/cms/get"
|
||||
class="am-btn ml20 am-btn-sm am-btn-success w100">新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
|
||||
共有<?= $pager['total'] ?>条数据
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- th 中 复选框的宽度 写死 固定50 然后其他的用百分比,但是必须有一个是不要设置值得(这样可以自适应省去计算麻烦) -->
|
||||
<!-- <th width="50">-->
|
||||
<!-- <input type="checkbox" /> -->
|
||||
<!-- </th>-->
|
||||
<!-- <th width="8%"><span><input type="button" class="am-btn am-btn-success am-btn-sm" v-on:click="ToSort()" value="排序"/></span></th> -->
|
||||
<th width="8%"><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="15%"><span>状态</span></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="value in lists">
|
||||
<tr>
|
||||
<!-- <td rowspan="2"><input class="cms-ids" :value="value.id" type="checkbox" /></td>-->
|
||||
<td>{{value.id}}</td>
|
||||
<td>{{value.title}}</td>
|
||||
<td>{{value.position}}</td>
|
||||
<td>{{value.s_time}}</td>
|
||||
<td>{{value.e_time}}</td>
|
||||
<td v-if="value.status == '0'">下架</td>
|
||||
<td v-else-if="value.status == '1'">上架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="align-r">
|
||||
<input type="button" class="am-btn am-btn-xs am-btn-primary"
|
||||
:data-open="'/app/liche/cms/get?&id='+value.id" value="修改"/>
|
||||
<input v-if="value.status == '0'" type="button" class="am-btn am-btn-xs am-btn-danger"
|
||||
data-ajax="post" data-action="/app/liche/cms/edit_status?id=" :data-params-id="value.id"
|
||||
data-params-status="1" value="上架"/>
|
||||
<input v-else-if="value.status == '1'" type="button" class="am-btn am-btn-xs am-btn-danger"
|
||||
data-ajax="post" data-action="/app/liche/cms/edit_status" :data-params-id="value.id"
|
||||
data-params-status="0" value="下架"/>
|
||||
<input type="button" class="am-btn am-btn-xs am-btn-danger" data-ajax="post"
|
||||
data-action="/app/liche/cms/del" :data-params-id="value.id" value="删除"/>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#datepicker1'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#datepicker2'
|
||||
});
|
||||
});
|
||||
var vm = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
lists: [],
|
||||
},
|
||||
mounted() {
|
||||
var that = this;
|
||||
that.lists = <?=json_encode($lists)?>;
|
||||
},
|
||||
created: function () {
|
||||
},
|
||||
methods: {}
|
||||
})
|
||||
|
||||
</script>
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/liche/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 ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</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="20%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['nickname'] ?></td>
|
||||
<td><?= $v['mobile'] ?></td>
|
||||
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td colspan="3" class="align-r">
|
||||
</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>
|
||||
$('#bd-hd-city').change(function () {
|
||||
var city = $(this).find('option:selected').text();
|
||||
});
|
||||
|
||||
$('#majia').change(function () {
|
||||
$('#vue-app').submit();
|
||||
});
|
||||
$('#dealer').change(function () {
|
||||
$('#vue-app').submit();
|
||||
});
|
||||
</script>
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
<form id="vue-app" class="am-form am-form-horizontal" action="/app/licheb/member/<?=$row['id'] ? 'edit' : 'add'?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
|
||||
<input type="hidden" name="id" v-model="info.id"/>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">姓名:</label>
|
||||
<div class="am-para-input w300">
|
||||
<input type="text" placeholder="输入姓名" name="uname" value="<?=$row['uname']?>" maxlength="30"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">手机号:</label>
|
||||
<div class="am-para-input w300">
|
||||
<input type="text" placeholder="输入手机号" name="mobile" value="<?=$row['mobile']?>" maxlength="30"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">角色:</label>
|
||||
<div class="am-para-input w100">
|
||||
<select name="group_id">
|
||||
<?foreach($groups as $key=>$val){?>
|
||||
<option value="<?=$key?>" <?=$key==$row['group_id']?'selected':''?>><?=$val?></option>
|
||||
<?}?>
|
||||
</select>
|
||||
</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 type="text/javascript">
|
||||
</script>
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
<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 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-modal="/app/licheb/member/get" class="am-btn am-btn-success am-btn-sm w100">添加用户</button>
|
||||
</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="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['nickname'] ?></td>
|
||||
<td><?= $v['uname'] ?></td>
|
||||
<td><?= $v['mobile'] ?></td>
|
||||
<td><?= $v['group_name']?></td>
|
||||
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></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>
|
||||
$('#bd-hd-city').change(function () {
|
||||
var city = $(this).find('option:selected').text();
|
||||
});
|
||||
|
||||
$('#majia').change(function () {
|
||||
$('#vue-app').submit();
|
||||
});
|
||||
$('#dealer').change(function () {
|
||||
$('#vue-app').submit();
|
||||
});
|
||||
</script>
|
||||
@@ -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>
|
||||
|
||||
Executable
+65
@@ -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>
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
<?php if ($info || !empty($info)){ ?>
|
||||
<form class="am-form am-form-horizontal" action="/biz/brand/brand/edit?id=<?= $info['id'] ?>" data-auto="true" method=""
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<?php }else{ ?>
|
||||
<form class="am-form am-form-horizontal" action="/biz/brand/brand/add" data-auto="true" method=""
|
||||
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="输入品牌名称" name="brand_name"
|
||||
value="<?= $info['brand_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['brand_logo'] ?>" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;max-width:32px"
|
||||
src="<?= $info['brand_logo'] ? build_qiniu_image_url($info['brand_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>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user