root 9 년 전
부모
커밋
542e9c2e9d
5개의 변경된 파일58개의 추가작업 그리고 27개의 파일을 삭제
  1. 23 13
      core/framework/libraries/log.php
  2. 2 2
      data/config/config.ini.php
  3. 3 1
      mobile/control/brand.php
  4. 1 1
      mobile/control/efficacy.php
  5. 29 10
      mobile/control/goods.php

+ 23 - 13
core/framework/libraries/log.php

@@ -1,31 +1,41 @@
 <?php
 /**
- * 记录日志 
+ * 记录日志
  ***/
 defined('InShopNC') or exit('Access Invalid!');
-class Log{
 
-    const SQL       = 'SQL';
-    const ERR       = 'ERR';
-    private static $log =   array();
+class Log
+{
 
-    public static function record($message,$level=self::ERR) {
-        $now = @date('Y-m-d H:i:s',time());
+    const SQL = 'SQL';
+    const ERR = 'ERR';
+    private static $log = array();
+
+    public static function record($message, $level = self::ERR)
+    {
+        $now = @date('Y-m-d H:i:s', time());
         switch ($level) {
             case self::SQL:
-               self::$log[] = "[{$now}] {$level}: {$message}\r\n";
-               break;
+                self::$log[] = "[{$now}] {$level}: {$message}\r\n";
+
+                $log_file = BASE_DATA_PATH . '/log/sql_' . date('Ymd', TIMESTAMP) . '.log';
+                $url = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
+                $url .= " ( act={$_GET['act']}&op={$_GET['op']} ) ";
+                $content = "[{$now}] {$url}\r\n{$level}: {$message}\r\n";
+                file_put_contents($log_file, $content, FILE_APPEND);
+                break;
             case self::ERR:
-                $log_file = BASE_DATA_PATH.'/log/'.date('Ymd',TIMESTAMP).'.log';
+                $log_file = BASE_DATA_PATH . '/log/' . date('Ymd', TIMESTAMP) . '.log';
                 $url = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
                 $url .= " ( act={$_GET['act']}&op={$_GET['op']} ) ";
                 $content = "[{$now}] {$url}\r\n{$level}: {$message}\r\n";
-                file_put_contents($log_file,$content, FILE_APPEND);
+                file_put_contents($log_file, $content, FILE_APPEND);
                 break;
         }
     }
 
-    public static function read(){
-    	return self::$log;
+    public static function read()
+    {
+        return self::$log;
     }
 }

+ 2 - 2
data/config/config.ini.php

@@ -4,7 +4,7 @@
 $config = array();
 
 const test_srv_host = 'http://121.43.114.153';
-const stanley_host = 'http://192.168.1.105';
+const stanley_host = 'http://192.168.1.131';
 const stanley_home = 'http://192.168.1.12';
 const boss_host = 'http://172.40.2.14';
 
@@ -31,7 +31,7 @@ $config['tablepre']		= 'lrlz_';
 $config['db']['1']['dbhost']       = '127.0.0.1';
 $config['db']['1']['dbport']       = '3306';
 $config['db']['1']['dbuser']       = 'root';
-$config['db']['1']['dbpwd']        = '55668899';
+$config['db']['1']['dbpwd']        = 'jeff1104';
 $config['db']['1']['dbname']       = '33hao';
 $config['db']['1']['dbcharset']    = 'UTF-8';
 $config['db']['slave']                  = $config['db']['master'];

+ 3 - 1
mobile/control/brand.php

@@ -11,7 +11,9 @@ defined('InShopNC') or exit('Access Invalid!');
 
 class brandControl extends mobileHomeControl
 {
-
+    public function __construct() {
+        parent::__construct();
+    }
 
     public function indexOp()
     {

+ 1 - 1
mobile/control/efficacy.php

@@ -27,6 +27,6 @@ class efficacyControl extends mobileHomeControl
 
             array_push($result,$item);
         }
-        joutput_data($result);
+        joutput_data(array("efficacy_list"=>$result));
     }
 }

+ 29 - 10
mobile/control/goods.php

@@ -18,7 +18,6 @@ class goodsControl extends mobileHomeControl
         parent::__construct();
     }
 
-
     /**
      * 商品列表
      */
@@ -28,8 +27,8 @@ class goodsControl extends mobileHomeControl
         $model_goods = Model('goods');
         $model_search = Model('search');
 
-        if(!empty($_GET['curpage'])){
-            pagecmd('setnowpage',$_GET['curpage']);
+        if (!empty($_GET['curpage'])) {
+            pagecmd('setnowpage', $_GET['curpage']);
         }
 
         //查询条件
@@ -69,7 +68,7 @@ class goodsControl extends mobileHomeControl
         //处理商品列表(抢购、限时折扣、商品图片)
         $goods_list = $this->_goods_list_extend($goods_list);
 
-        joutput_data(array('goods_list' => $goods_list,'mobile_page' => mobile_page($page_count)));
+        joutput_data(array('goods_list' => $goods_list, 'mobile_page' => mobile_page($page_count)));
     }
 
     /**
@@ -119,8 +118,7 @@ class goodsControl extends mobileHomeControl
         //促销
         $groupbuy_list = Model('groupbuy')->getGroupbuyListByGoodsCommonIDString(implode(',', $commonid_array));
         $xianshi_list = Model('p_xianshi_goods')->getXianshiGoodsListByGoodsString(implode(',', $goodsid_array));
-        foreach ($goods_list as $key => &$value)
-        {
+        foreach ($goods_list as $key => &$value) {
             //抢购
             if (isset($groupbuy_list[$value['goods_commonid']])) {
                 $goods_list[$key]['goods_price'] = $groupbuy_list[$value['goods_commonid']]['groupbuy_price'];
@@ -146,13 +144,13 @@ class goodsControl extends mobileHomeControl
 
             // 增加 品牌名
             $brand = Model()->table("brand")->find($value['brand_id']);
-            if(!empty($brand)){
+            if (!empty($brand)) {
                 $value['brand_name'] = $brand['brand_name'];
             }
 
             // 增加分类
             $gc_info = Model()->table('goods_class')->find($value['gc_id']);
-            if(!empty($gc_info)){
+            if (!empty($gc_info)) {
                 $value['gc_name'] = $gc_info['gc_name'];
             }
 
@@ -450,9 +448,9 @@ class goodsControl extends mobileHomeControl
         $out_type = $_GET ['type'];
         $model_goods = Model('goods');
 
-        if(empty($_GET ['goods_commonid'])) {
+        if (empty($_GET ['goods_commonid'])) {
             $goods_info = $model_goods->getGoodsInfoByID($goods_id, 'goods_commonid');
-        }else{
+        } else {
             $goods_info['goods_commonid'] = intval($_GET ['goods_commonid']);
         }
         $goods_common_info = $model_goods->getGoodeCommonInfoByID($goods_info['goods_commonid']);
@@ -487,4 +485,25 @@ class goodsControl extends mobileHomeControl
         output('goods_common_info', $goods_common_info);
         Tpl::showpage('goods_body');
     }
+
+
+    public function goods_filter_by_effectOp()
+    {
+
+        // 属性ID,类型ID
+        $attr_value_id = intval($_GET['attr_value_id']);
+        $type_id = intval($_GET['type_id']);
+
+        $fields = "distinct goods_commonid as goods_commonid";
+
+        // 功效
+        $goods_attr = Model()->table('goods_attr_index')->field($fields)->where(array('type_id' => $type_id, 'attr_value_id' => $attr_value_id))->select();
+
+        foreach ($goods_attr as $value) {
+
+
+
+        }
+
+    }
 }