소스 검색

将categor.xml 配置文件修改为字符串

stanley-king 8 년 전
부모
커밋
f1cc6dc91b

+ 12 - 1
core/framework/libraries/sms.php

@@ -37,6 +37,7 @@ class Sms
 
     private function send_msg($mobile, $datas, $type)
     {
+        Log::record("SMS send:{$mobile} " . json_encode($datas) . " {$type}", Log::DEBUG);
         $folder = 'yuntx';
         $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $folder)));
         if (!empty($plugin)) {
@@ -44,7 +45,13 @@ class Sms
             require_once(PLUGIN_ROOT . DS . $plugin . DS . 'CCPRestSDK.php');
             require_once(PLUGIN_ROOT . DS . $plugin . DS . 'SendSMS.php');
 
-            return sendSMS($mobile, $datas, $type);
+            $datas_param = array();
+            foreach($datas as $key=>$val)
+            {
+                $datas_param[] = $val;
+            }
+
+            return sendSMS($mobile, $datas_param, $type);
         } else {
             return -1;
         }
@@ -69,6 +76,10 @@ class Sms
             unset($content['type']);
         }
 
+        if(array_key_exists('mobile',$content)) {
+            unset($content['mobile']);
+        }
+
         static $templates = array(self::register_code => '59006', self::resetpass_code => '63477', self::getbonus_code => '63479', self::getbind_code => '59006', self::bindbonus_register_code => '92893');
         if (!array_key_exists($type, $templates)) return -1;
 

+ 1 - 1
data/resource/mobile/bonus/js/tel.js

@@ -158,7 +158,7 @@ $(function(){
         //验证码验证
         active: function () {
             var that = this;
-            $('#bind').on('touchstart', function () {
+            $('#bind').on('touchend', function () {
                 var b = that.b;
                 //yanzVal = $('#yanz').val();
                 if (b == false) {

+ 0 - 21
helper/algorithm_helper.php

@@ -8,27 +8,6 @@
  */
 class algorithm_helper
 {
-//    static public function bsearch($needle, $haystack)
-//    {
-//        $high = count($haystack);
-//        $low = 0;
-//
-//        while ($high - $low >= 1){
-//            $probe = ($high + $low) / 2;
-//            if ($haystack[$probe] < $needle){
-//                $low = $probe;
-//            }else{
-//                $high = $probe;
-//            }
-//        }
-//
-//        if ($high == count($haystack) || $haystack[$high] != $needle) {
-//            return false;
-//        }else {
-//            return $high;
-//        }
-//    }
-
     static function bsearch($x, $list)
     {
         $left = 0;

+ 56 - 6
helper/category_helper.php

@@ -9,7 +9,7 @@
 class category_helper
 {
     const img_path = '/mobile/category';
-    private $file_name = '';
+    //private $file_name = '';
     private $mCategories = NULL;
     private $mCids = NULL;
 
@@ -25,19 +25,19 @@ class category_helper
     private function __construct()
     {
         $this->mCids = array();
-        $this->file_name = BASE_DATA_PATH . '/sales/category.xml';
-        self::load_xml($this->file_name);
+        //$this->file_name = BASE_DATA_PATH . '/sales/category.xml';
+        self::load_xml();
     }
 
-    private function load_xml($file)
+    private function load_xml()
     {
         libxml_use_internal_errors(true);
-        $xml = simplexml_load_file($file);
+        $xml = simplexml_load_string($this->content());
         if($xml === false) {
             $err_msg = json_encode(libxml_get_errors(),JSON_UNESCAPED_UNICODE);
             Log::record("{$err_msg}", Log::ERR);
             libxml_clear_errors();
-            throw new Exception("无法解析XML文件");
+            throw new Exception("无法解析XML.");
         }
 
         $url = RESOURCE_SITE_URL . self::img_path;
@@ -120,4 +120,54 @@ class category_helper
             return array();
         }
     }
+    private function content()
+    {
+        $content = <<<EOD
+<?xml version="1.0" encoding="utf-8"?>
+<category>
+  <item title="护肤" id ="1" cids="" img="hf.png">
+    <subitem title="洁面" id ="10" cids="50024975,50011977,50448025" img="jm.png" />
+    <subitem title="化妆水" id ="11" cids="50012002,50011978,121368014" img="hzs.png" />
+    <subitem title="面部精华" id ="12" cids="50011979,121756003" img="mbjh.png" />
+    <subitem title="乳液/面霜" id ="13" cids="50011996,50011980,121410035" img="ry.png" />
+    <subitem title="眼霜" id ="14" cids="121410013,121408040,121422013,121454013,121472009,121484013,121848006" img="ys.png" />
+    <subitem title="面膜" id ="15" cids="121390006,121366015,121426033,121454014,121460030,121468012,121474010" img="mm.png" />
+    <subitem title="防晒/隔离" id ="16" cids="121426007,50011982,121434025,121458034" img="fs.png" />
+    <subitem title="去角质" id ="17" cids="121384013,50011997,121408009" img="qjz.png" />
+  </item>
+  <item title="彩妆" id ="2" cids="" img="cz.png">
+    <subitem title="卸妆" id ="20" cids="50011990" img="xz.png" />
+    <subitem title="BB霜" id ="21" cids="50013794" img="bbs.png" />
+    <subitem title="粉底液" id ="22" cids="50010789" img="fdy.png" />
+    <subitem title="散粉" id ="23" cids="50010792" img="sf.png" />
+    <subitem title="粉饼" id ="24" cids="5001079,50010792" img="fb.png" />
+    <subitem title="腮红" id ="25" cids="50010805" img="sh.png" />
+    <subitem title="遮瑕" id ="26" cids="50010803" img="zx.png" />
+    <subitem title="睫毛膏" id ="27" cids="50010794" img="jmg.png" />
+    <subitem title="眼线" id ="28" cids="50010797" img="yx.png" />
+    <subitem title="眼影" id ="29" cids="50010796" img="yy.png" />
+    <subitem title="眉笔/眉粉" id ="290" cids="50010798" img="mb.png" />
+    <subitem title="唇膏/唇彩" id ="291" cids="50010801,50010807,50010808,121392016,121418013,121448009,121456011,121466011,121476007" img="cg.png" />
+  </item>
+  <item title="个人护理" id ="3" cids="" img="grhl.png">
+    <subitem title="洗发水" id ="30" cids="121396029,213202,121404024,121426020,121476023" img="xfs.png" />
+    <subitem title="美发护发" id ="31" cids="50023282,50016883,50024999,121410029" img="mfhf.png" />
+    <subitem title="头发造型" id ="32" cids="50023294,50023293,50023326" img="tfzx.png" />
+    <subitem title="身体护理" id ="33" cids="50012000,50011999,50012001,50012006,50014257,121396013,121412016,121422012,121466009,121478012,121484012" img="sthl.png" />
+    <subitem title="手足护理" id ="34" cids="121402008,121390007,121424012,121452007,121456010,121472008,122430002" img="szhl.png" />
+    <subitem title="止汗露" id ="35" cids="121392036,121392015" img="zhl.png" />
+    <subitem title="沐浴乳/露" id ="36" cids="50014254,213205,50023724,50014248,50014259,50014260,50458018,121386011" img="myr.png" />
+    <subitem title="香氛" id ="37" cids="50010815" img="xf.png" />
+  </item>
+  <item title="男士护肤" id ="4" cids="121410035" img="nshf.png">
+    <subitem title="男士洁面" id ="40" cids="121452027" img="nsjm.png" />
+    <subitem title="男士爽肤水" id ="41" cids="121392037" img="nssfs.png" />
+    <subitem title="男士乳霜" id ="42" cids="121410035" img="nsrs.png" />
+    <subitem title="男士护理" id ="43" cids="121366036,50022680,121368010,121386035,121392036,121398029,121404031,121416019,121450036,121470041,121482026" img="nshl.png" />
+  </item>
+</category>
+EOD;
+
+        return $content;
+    }
 }

+ 0 - 1
helper/session.php

@@ -95,7 +95,6 @@ class session
                 $_COOKIE[self::session_name] = $sid;
             }
         }
-        Log::record("HPHPSESSID = {$msid}.",Log::DEBUG);
 
         if(empty($sid))
         {

+ 0 - 1
helper/session_helper.php

@@ -151,7 +151,6 @@ class session_helper
                 'member_name' => $mobile,
                 'member_nickname' => substr_replace($mobile, '****', 3, 4),
                 'member_mobile_bind' => 1);
-
             $member_id = $mod_member->addMember($member_info);
             if ($member_id != false) {
                 sms_helper::send_nostore_message($mobile, Sms::bindbonus_register_code, $password);

+ 2 - 2
helper/sms_helper.php

@@ -65,9 +65,9 @@ class sms_helper
         return array('code' => 200);
     }
 
-    static public function send_nostore_message($mobile, $itype, $code)
+    static public function send_nostore_message($content)
     {
-        QueueClient::push('sendSMS',array('mobile'=>$mobile,'type'=>$itype,'code'=>$code,'time'=>'5'));
+        QueueClient::push('sendSMS', $content);
     }
 
     static public function check_code($itype,$code,$mobile)

+ 2 - 2
mobile/control/bonusex.php

@@ -471,8 +471,8 @@ function bonus_output_mine($output)
         echo('<input type="hidden" id="mine_bonus" value=' ."{$bonus->bonus_sn()}>");
 
         if($bonus->isBinded()) {
-            echo('<div class="link" id="link">');
-            echo('<p style="margin: 20px 0" ><a href="javascript:void(0)">请下载熊猫美妆APP,享用红包</a></p>');
+            echo('<div class="link" id="links">');
+            echo('<p style="margin: 20px 0"><a href="javascript:void(0)">请下载熊猫美妆APP,享用红包</a></p>');
             echo('</div>');
         }
     }

+ 2 - 1
mobile/control/category.php

@@ -14,7 +14,8 @@ class categoryControl extends mobileControl
 {
     public function indexOp()
     {
-        $cats = include BASE_DATA_PATH . '/sales/category.php';
+        //$cats = include BASE_DATA_PATH . '/sales/category.php';
+        $cats = category_helper::instance()->categories();
         return self::outsuccess(array('items' => $cats));
     }
 }

+ 10 - 6
mobile/control/login.php

@@ -237,14 +237,18 @@ class loginControl extends mobileHomeControl
         if(is_array($ret)) {
             return self::outerr($ret['code'], $ret['msg']);
         }
-
-        $model = Model('member');
+	
+	    $model = Model('member');
         $ret = $model->editMember(array('member_mobile' => $mobile),array('member_passwd' => md5($password)));
-        if($ret == false || $model->affected_rows() <= 0) {
-            return self::outerr(errcode::ErrMemberNotExist, "该手机号未注册");
-        } else {
-            return self::outsuccess(NULL);
+        if($ret == false || $model->affected_rows() <= 0)
+        {
+            $ret = $model->getMemberInfo(array('member_mobile' => $mobile));
+            if (empty($ret)) {
+                return self::outerr(errcode::ErrMemberNotExist, "该手机号未注册");
+            }
         }
+
+        return self::outsuccess(NULL);
     }
 
     /**

+ 19 - 0
mobile/templates/default/bonus/content.php

@@ -29,5 +29,24 @@
         ?>
     </div>
 </div>
+<script type="text/javascript">
+    $(function(){
+        function navtodown(){
+            var ua = navigator.userAgent.toLowerCase(),
+                downInstall=$('#links a');
+            if (/iphone|ipad|ipod/.test(ua)) {
+                downInstall.attr('href','http://a.app.qq.com/o/simple.jsp?pkgname=com.lrlz.beautyshop');
+            } else if (/android/.test(ua)) {
+                downInstall.attr('href','http://p.lrlz.com/data/upload/package/xmmz_release.apk');
+            }
+            else {
+                downInstall.attr('href','#');
+            }
+        }
+        navtodown();
+    });
+
+
+</script>
 </body>
 </html>

+ 37 - 0
test/category_helperTest.php

@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 16/7/2
+ * Time: 下午9:06
+ */
+define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
+
+require_once(BASE_ROOT_PATH . '/fooder.php');
+require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
+
+
+class category_helperTest extends PHPUnit_Framework_TestCase
+{
+    public static function setUpBeforeClass()
+    {
+        Base::run_util();
+    }
+
+    public function testCategories()
+    {
+        $cats = category_helper::instance()->categories();
+    }
+    public function testSearch()
+    {
+        $cats = category_helper::instance()->categories();
+        
+    }
+
+    public static function tearDownAfterClass()
+    {
+
+    }
+
+}