Browse Source

Merge branch 'goods' of 121.43.114.153:/home/git/repositories/shopnc into goods

# Conflicts:
#	admin/templates/default/bonus.bonus_type_form.php
stanley-king 9 years ago
parent
commit
7d9d810a1d

+ 1 - 1
admin/control/bonus.php

@@ -36,7 +36,7 @@ class bonusControl extends SystemControl
     {
         $type_id = $_POST['type_id'] ? $_POST['type_id'] : 0;
         $bonus_value = array(
-            'type_name' => $_POST['type_name'],
+            'type_name' => $_POST['hb_words'],
             'send_type' => $_POST['send_type'],
             'send_start_date' => strtotime(trim($_POST['send_start_date'])),
             'send_end_date' => strtotime(trim($_POST['send_end_date'])),

+ 35 - 19
admin/templates/default/bonus.bonus_type_form.php

@@ -23,44 +23,36 @@
             <tbody>
 
             <tr class="noborder">
-                <td class="required" colspan="2"><label class="validation hb_name" for="type_name">红包名称:</label></td>
+                <td class="required" colspan="2"><label class="validation" for="sender">发送者名称</label></td>
             </tr>
             <tr class="noborder">
-                <td width="200"><input type="text" id="type_name" name="type_name" class="hb_input" value="<?php echo  isset($output['data'])? $output['data']['type_name'] : '';?>"></td>
-                <td class=" vatop tips"></td>
+                <td class="vatop rowform"><input type="text" id="sender" name="sender" class="txt" value="<?php echo  isset($output['data'])? $output['data']['sender'] : '';?>"></td>
+                <td class="vatop tips"></td>
             </tr>
 
             <tr class="noborder">
-                <td class="required" colspan="2"><label class="validation hb_name" for="pass_name">发送者:</label></td>
+                <td class="required" colspan="2"><label class="validation" for="hb_words">祝福语</label></td>
             </tr>
-            <tr>
-                <td><input type="text" id="pass_name" name="pass_name" class="hb_input" value="<?php echo  isset($output['data'])? $output['data'][''] : '';?>"></td>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="hb_words" name="hb_words" class="txt" value="<?php echo  isset($output['data'])? $output['data']['hb_words'] : '';?>"></td>
                 <td class="vatop tips"></td>
             </tr>
 
             <tr class="noborder">
-                <td><label class="hb_name" for="pass_msg">祝福语:</label></td>
+                <td class="required" colspan="2"><label class="validation" for="h5_link">H5链接</label></td>
             </tr>
-            <tr>
-                <td><input type="text" id="pass_msg" name="pass_msg" class="hb_input" value="<?php echo  isset($output['data'])? $output['data']['type_name'] : '';?>"></td>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="h5_link" name="h5_link" class="txt" value="<?php echo  isset($output['data'])? $output['data']['h5_link'] : '';?>"></td>
                 <td class="vatop tips"></td>
             </tr>
 
             <tr class="noborder">
-                <td class="required" colspan="2"><label class="validation hb_name" for="h5">H5链接:</label></td>
-            </tr>
-            <tr>
-                <td><input type="text" id="h5" name="h5" class="hb_input" value="<?php echo  isset($output['data'])? $output['data']['type_name'] : '';?>"></td>
-                <td class="vatop tips"></td>
+                <td class="required" colspan="2"><label class="validation" for="link_param">链接参数</label></td>
             </tr>
 
 
             <tr class="noborder">
-                <td class="required" colspan="2"><label class="validation hb_name" for="h5_url">链接参数:</label></td>
-            </tr>
-
-            <tr>
-                <td><input type="text" id="h5_url" name="h5_url" class="hb_input" value="<?php echo  isset($output['data'])? $output['data']['type_name'] : '';?>"></td>
+                <td class="vatop rowform"><input type="text" id="link_param" name="link_param" class="txt" value="<?php echo  isset($output['data'])? $output['data']['link_param'] : '';?>"></td>
                 <td class="vatop tips"></td>
             </tr>
 
@@ -149,6 +141,18 @@
                 error.appendTo(element.parent().parent().prev().find('td:first'));
             },
             rules : {
+                sender: {
+                    required : true
+                },
+                hb_words: {
+                    required : true
+                },
+                h5_link: {
+                    required : true
+                },
+                link_param: {
+                    required : true
+                },
                 type_name: {
                     required : true
                 },
@@ -182,6 +186,18 @@
                 }
             },
             messages : {
+                sender: {
+                    required : '发送者名称不能为空'
+                },
+                hb_words: {
+                    required : '祝福语不能为空'
+                },
+                h5_link: {
+                    required : 'H5链接不能为空'
+                },
+                link_param: {
+                    required : '链接参数不能为空'
+                },
                 type_name: {
                     required : '红包名称不能为空'
                 },

+ 3 - 1
data/model/member.model.php

@@ -78,8 +78,10 @@ class memberModel extends Model
             } else {
                 return -1;
             }
-            
+
+			Log::record("member.model.php,getMemberID,conditions['member_mobile']={$conditions['member_mobile']},conditions['member_passwd']={$conditions['member_passwd']},",Log::DEBUG);
             $user = $this->getMemberInfo($conditions,'member_id');
+			Log::record("member.model.php,getMemberID user={$user['member_id']}",Log::DEBUG);
             if(empty($user)) {
             	return -1;
             } else {

+ 26 - 0
h5_hb/mode.php

@@ -0,0 +1,26 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>熊猫美妆红包</title>
+    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
+    <link rel="stylesheet" href="css/base.css"/>
+    <link rel="stylesheet" href="css/index_commcon.css"/>
+</head>
+<body>
+    <div class="fullPage">
+        <div class="top">
+            <div class="rope"></div>
+            <div class="bag_header center font15">
+                <p>skyleao</p>
+                <p>送了你一个熊猫美妆红包</p>
+            </div>
+            <div class="bag_center center">
+                <a href="javascript:void(0)" class="just_btn inline center font17">立即领取</a>
+            </div>
+        </div>
+        <div class="footer"></div>
+    </div>
+    <script src="js/rem.js"></script>
+</body>
+</html>

+ 21 - 111
mobile/alipay_notify_url.php

@@ -1,140 +1,50 @@
 <?php
-/* *
- * 功能:支付宝服务器异步通知页面
- * 版本:3.3
- * 日期:2012-07-23
- * 说明:
- * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
- * 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
-
-
- *************************页面功能说明*************************
- * 创建该页面文件时,请留心该页面文件中无任何HTML代码及空格。
- * 该页面不能在本机电脑测试,请到服务器上做测试。请确保外部可以访问该页面。
- * 该页面调试工具请使用写文本函数logResult,该函数已被默认关闭,见alipay_notify_class.php中的函数verifyNotify
- * 如果没有收到该页面返回的 success 信息,支付宝会在24小时内按一定的时间策略重发通知
- */
 
 define('ALIPAY_PATH', BASE_MOBILE_PATH . '/api/payment/alipay');
-
 require_once(ALIPAY_PATH . '/alipay.config.php');
 require_once(ALIPAY_PATH . '/lib/alipay_notify.class.php');
 require_once(BASE_MOBILE_PATH . '/control/app_pay.php');
 
 
-//商户订单号
-$out_trade_no = $_POST['out_trade_no'];
-//支付宝交易号
-$trade_no = $_POST['trade_no'];
+$out_trade_no = $_POST['out_trade_no'];  // 商户订单号
+$trade_no = $_POST['trade_no'];          // 支付宝交易号
+Log::record("alipay_notify_url: out_trade_no={$out_trade_no}", Log::DEBUG);
 
-Log::record("alipay_notify_url: out_trade_no={$out_trade_no}",Log::DEBUG);
-
-//计算得出通知验证结果
+// 步骤一:验证数据来源正确性
 $alipayNotify = new AlipayNotify($alipay_config);
 $verify_result = $alipayNotify->verifyReturn();
+Log::record("verify_result={$verify_result}, out_trade_no={$out_trade_no}", Log::DEBUG);
 
-if ($verify_result)
-{//验证成功
-
-    Log::record("verify notify success : out_trade_no={$out_trade_no}",Log::DEBUG);
+if ($verify_result) {
 
-    //交易状态
     $trade_status = $_POST['trade_status'];
+    if ($trade_status === 'TRADE_FINISHED' || $trade_status === 'TRADE_SUCCESS') {
 
-    // 交易完成
-    if ($_POST['trade_status'] == 'TRADE_FINISHED') {  // 交易成功
-        //判断该笔订单是否在商户网站中已经做过处理
-        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
-        //如果有做过处理,不执行商户的业务程序
-
-        //注意:
-        //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
-        //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
-
-        //调试用,写文本函数记录程序运行情况是否正常
-        //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
-
-
-        // 支付类型
-        $payment_type = $_POST['payment_type'];
-
-        // 交易金额
-        $total_fee = $_POST['total_fee'];
-
-        // 购买数量
-        $quantity = $_POST['quantity'];
-
-        // 商品单价
-        $price = $_POST['price'];
-
-        // 交易付款时间
-        $gmt_payment = $_POST['gmt_payment'];
-
-        // 支付宝支付金额检查
-//        $ret = app_payControl::alipay_check();
-
-
+        // 步骤二:更新订单状态
         $cb_info = app_payControl::update_order($out_trade_no, $trade_no, 'alipay');
         if ($cb_info['state'] == false) {
-
+            Log::record("update_order fail: out_trade_no={$out_trade_no}", Log::DEBUG);
             echo('fail');
-            Log::record(">>>>alipay fail: trade_no={$trade_no}");
         } else {
             echo('success');
-            Log::record(">>>>>alipay success: trade_no={$trade_no}");
+            Log::record("update_order success: out_trade_no={$out_trade_no}", Log::DEBUG);
         }
 
-    } else if ($_POST['trade_status'] == 'TRADE_SUCCESS') {  // 交易成功
-        //判断该笔订单是否在商户网站中已经做过处理
-        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
-        //如果有做过处理,不执行商户的业务程序
-
-        //注意:
-        //付款完成后,支付宝系统发送该交易状态通知
-        //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
-
-        //调试用,写文本函数记录程序运行情况是否正常
-        //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
-
-        // 支付类型
-        $payment_type = $_POST['payment_type'];
-
-        // 交易金额
-        $total_fee = $_POST['total_fee'];
-
-        // 购买数量
-        $quantity = $_POST['quantity'];
-
-        // 商品单价
-        $price = $_POST['price'];
-
-        // 交易付款时间
-        $gmt_payment = $_POST['gmt_payment'];
-
-
-        $cb_info = app_payControl::update_order($out_trade_no, $trade_no, 'alipay');
-        if ($cb_info['state'] == false) {
-
-            echo('fail');
-            Log::record(">>>>alipay success: trade_no={$trade_no}");
-        } else {
-            echo('success');
-            Log::record(">>>>>alipay success: trade_no={$trade_no}");
+        // 步骤三:如果此用户为静默注册用户,将此用户置为普通用户
+        $ret = app_payControl::updateMember($out_trade_no);
+        if(!$ret){
+            Log::record("updateMember fail : out_trade_no={$out_trade_no}",Log::ERR);
         }
-    } else if ($_POST['trade_status'] == 'WAIT_BUYER_PAY'){  // 交易创建
 
-    }
+    } else if ($trade_status == 'WAIT_BUYER_PAY') {
 
-    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
-
-    echo("success");        //请不要修改或删除
-    Log::record(">>>>>alipay success: out_trade_no={$out_trade_no}");
+    }
 
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    echo("success"); // 交易正确时,返回success
 } else {
-    //验证失败
-    echo("fail");
-    Log::record(">>>>verify notify fail : out_trade_no={$out_trade_no}");
-    //调试用,写文本函数记录程序运行情况是否正常
+
+    echo("fail");  // 验证错误时,返回fail
+    Log::record("verify notify fail : out_trade_no={$out_trade_no}");
 }
+
 ?>

File diff suppressed because it is too large
+ 74 - 92
mobile/control/app_pay.php


+ 45 - 16
mobile/control/app_update.php

@@ -1,49 +1,78 @@
 <?php
 /**
  * 更新
- *
- *
- *
- ***/
-
+ */
 
 defined('InShopNC') or exit('Access Invalid!');
 
 class app_updateControl extends mobileHomeControl
 {
+    const CACHE_KEY = "app_update";
+    const CACHE_CHECK_VERSION_ID = 1;
+
     public function __construct()
     {
         parent::__construct();
     }
 
-    public function verifyVersionOp()
+    // 验证版本
+    public function checkVersionOp()
     {
-        $app_version = $_GET['version'];
+        $ver_code = $_GET['ver_code'];
         $app_platform = $_GET['platform'];
 
-        if (!empty($app_platform) && !empty($app_version)) {
+        if (isset($app_platform) && isset($ver_code)) {
+
+            // cache中读取
+            $ret = rcache(self::CACHE_KEY, self::CACHE_CHECK_VERSION_ID);
+
+            if (empty($ret)) {
 
-            $model = Model();
-            $data = $model->table('app_update')->where(array('cur_version' => '1', 'enable' => '1', 'platform' => $app_platform))->limit(1)->select();
+                $model = Model();
+                $data = $model->table('app_update')->where(array('cur_version' => '1', 'enable' => '1', 'platform' => $app_platform))->limit(1)->select();
 
-            if (empty($data)) {
-                output_error('系统错误!');
-                return;
+                if (empty($data)) {
+                    joutput_error('系统错误!');
+                    return;
+                }
+
+                // 写入cache
+                wcache(self::CACHE_KEY, array("cur_version" => serialize($data)), self::CACHE_CHECK_VERSION_ID);
+
+            } else {
+                $data = unserialize($ret['cur_version']);
             }
 
             $result = array();
-            if ($app_version === $data[0]['version']) {
+
+            $lowest_compatible_version = intval($data[0]['lowest_compatible_version']);
+
+            if ($ver_code === $data[0]['ver_code']) {
                 $result['latest'] = 0;
             } else {
+                $result['latest'] = 1;
+
+                // 强制升级
+                if ($lowest_compatible_version > intval($ver_code)) {
+                    $result['force_update'] = 1;
+                } else {
+                    $result['force_update'] = 0;
+                }
 
                 $update_info = array();
-                $update_info['version'] = $data[0]['version'];
+                $update_info['ver_code'] = $data[0]['ver_code'];
                 $update_info['app_path'] = $data[0]['app_path'];
+                $update_info['release_note'] = $data[0]['release_note'];
+                $update_info['remind_time'] = $data[0]['remind_time'];
+
+                $parse_url = parse_url($update_info['app_path']);
+                $update_info['md5_file'] = md5_file(BASE_ROOT_PATH . $parse_url['path']);
 
-                $result['latest'] = 1;
                 $result['update_info'] = $update_info;
             }
+
             joutput_data($result);
+
         } else {
             output_error('请输入平台和版本号!');
         }

+ 86 - 0
mobile/control/bonus.php

@@ -0,0 +1,86 @@
+<?php
+/**
+ * 红包管理
+ *
+ *
+ *
+ ***/
+defined('InShopNC') or exit('Access Invalid!');
+
+class bonusControl extends mobileMemberControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function bonus_listOp()
+    {
+        // 根据token获取用户ID
+        $condition['user_id'] = $this->member_info['member_id'];
+
+        if (!empty($condition['user_id'])) {
+
+            $ret = Model()->table("user_bonus")->where($condition)->select();
+
+            $total_value = 0;
+            $ret_array = array();
+            foreach ($ret as $value) {
+
+                $bonus_type = Model()->table('bonus_type')->where(array('type_id' => $value['bonus_type_id']))->limit(1)->select();
+
+                if (!empty($bonus_type)) {
+                    $result['type_name'] = $bonus_type[0]['type_name'];
+                    $result['use_start_date'] = $bonus_type[0]['use_start_date'];
+                    $result['use_end_date'] = $bonus_type[0]['use_end_date'];
+                }
+
+                $result['bonus_sn'] = $value['bonus_sn'];
+                $result['bonus_value'] = $value['bonus_value'];
+                $result['get_time'] = $value['get_time'];
+
+                $result['left_time'] = $result['use_end_date'] - time();
+
+                $total_value += intval($value[bonus_value]);
+
+                array_push($ret_array, $result);
+            }
+
+            joutput_data(array('total_value' => $total_value, 'bonus_list' => $ret_array));
+        }
+    }
+
+    // 红包绑定
+    public function bind_bonusOp(){
+
+        // 获取user_id
+        $condition['member_id'] = $this->member_info['member_id'];
+
+        if (!empty($condition['member_id'])) {
+
+            // get member_mobile 获取用户手机号
+            $member = Model()->table("member")->field("member_mobile")->where($condition)->select();
+
+            if(!empty($member)){
+
+                $user_bonus = Model()->table("user_bonus")->where(array('user_mobile'=>$member[0]['member_mobile'],'user_id'=>0))->select();
+
+                // 更新user_bonus
+                if(!empty($user_bonus)){
+
+                    $data['user_id'] = $this->member_info['member_id'];
+                    $ret = Model()->table('user_bonus')->where(array('user_mobile'=>$member[0]['member_mobile']))->update($data);
+
+                    // 返回存在红包
+                    joutput_data(array('have_bonus' => 1));
+
+                } else{
+                    joutput_data(array('have_bonus' => 0));
+                }
+
+            } else{
+                joutput_data(errcode::ErrTokenExpire,"用户手机号没绑定");
+            }
+        }
+    }
+}

+ 8 - 6
mobile/control/brand.php

@@ -1,10 +1,7 @@
 <?php
 /**
- * 前台品牌分类
- *
- *
- *
- ***/
+ * 品牌获取
+ */
 
 
 defined('InShopNC') or exit('Access Invalid!');
@@ -15,9 +12,11 @@ class brandControl extends mobileHomeControl
         parent::__construct();
     }
 
+    /**
+     * 获取品牌列表
+     */
     public function indexOp()
     {
-        //获得品牌列表
         $model = Model();
         $brand_area_list = $model->table('brand_area')->order('area_sort asc')->limit(false)->select();
         $brand_c_list = $model->table('brand')->where(array('brand_apply' => '1'))->order('brand_sort asc')->limit(false)->select();
@@ -46,6 +45,9 @@ class brandControl extends mobileHomeControl
         joutput_data($brand_list);
     }
 
+    /**
+     * 添加图片路径
+     */
     private function _formatBrandPic($filename)
     {
         return UPLOAD_SITE_URL . '/shop/brand/' . 'rect_'.$filename;

+ 3 - 2
mobile/control/control.php

@@ -54,14 +54,15 @@ class mobileMemberControl extends mobileControl
         }
         $mb_user_token_info = $model_mb_user_token->getMbUserTokenInfoByToken($key);
         if(empty($mb_user_token_info)) {
-            output_error('请登录', array('login' => '0'));
+            joutput_error('请登录', array('login' => '0'));
         }
 
         $model_member = Model('member');
         $this->member_info = $model_member->getMemberInfoByID($mb_user_token_info['member_id']);
         $this->member_info['client_type'] = $mb_user_token_info['client_type'];
         if(empty($this->member_info)) {
-            output_error('请登录', array('login' => '0'));
+
+            joutput_error('请登录', array('login' => '0'));
         } else {
             //读取卖家信息
             $seller_info = Model('seller')->getSellerInfo(array('member_id'=>$this->member_info['member_id']));

+ 4 - 4
mobile/control/efficacy.php

@@ -1,10 +1,7 @@
 <?php
 /**
- * 前台品牌分类
  *
- *
- *
- ***/
+ */
 
 
 defined('InShopNC') or exit('Access Invalid!');
@@ -19,6 +16,9 @@ class efficacyControl extends mobileHomeControl
 
     }
 
+    /**
+     * 获取功效列表
+     */
     public function efficacy_listOp()
     {
         $efficacy_list = Model()->table('goods_efficacy')->order('sort asc')->select();

+ 13 - 11
mobile/control/find.php

@@ -1,33 +1,35 @@
 <?php
 /**
- * 前台品牌分类
- *
- *
- *
- ***/
+ * 手机app发现tab页中的请求内容
+ */
 
 
 defined('InShopNC') or exit('Access Invalid!');
 
 class findControl extends mobileHomeControl
 {
-    public function __construct() {
+    public function __construct()
+    {
         parent::__construct();
     }
 
+    /**
+     * 发现页面左边栏请求内容
+     */
     public function category_listOp()
     {
-        $category_list = Model()->table('category_item')->order('sort asc')->select();
+        $category_list = Model()->table('category_item')->where(array('enable'=>'1'))->order('sort asc')->select();
 
         $result = array();
         foreach ($category_list as $value) {
 
             $item['id'] = $value['id'];
-            $item['name']=$value['name'];
-            $item['type']=$value['category_type'];
+            $item['name'] = $value['name'];
+            $item['type'] = $value['category_type'];
+            $item['gc_id'] = $value['gc_id'];
 
-            array_push($result,$item);
+            array_push($result, $item);
         }
-        joutput_data(array("category"=>$result));
+        joutput_data(array("category" => $result));
     }
 }

+ 3 - 2
mobile/control/goods.php

@@ -234,7 +234,7 @@ class goodsControl extends mobileHomeControl
         $model_goods = Model('goods');
         $goods_detail = $model_goods->getGoodsSku($goods_id);
         if (empty($goods_detail)) {
-            output_error('商品不存在');
+            joutput_error(errcode::ErrGoodsNotExist,'商品不存在');
             return ;
         }
 
@@ -312,7 +312,8 @@ class goodsControl extends mobileHomeControl
         $model_goods = Model('goods');
         $goods_detail = $model_goods->getGoodsDetail($goods_id);
         if (empty($goods_detail)) {
-            output_error('商品不存在');
+            joutput_error(errcode::ErrGoodsNotExist,'商品不存在');
+            return;
         }
 
         //推荐商品

+ 61 - 66
mobile/control/index.php

@@ -9,12 +9,14 @@
 //use Shopnc\Tpl;
 
 defined('InShopNC') or exit('Access Invalid!');
+
 class indexControl extends mobileHomeControl
 {
     private $mb_special;
     const HomeSpecialID = 0;
 
-    public function __construct() {
+    public function __construct()
+    {
         parent::__construct();
         $this->mb_special = Model('mb_special');
     }
@@ -22,9 +24,9 @@ class indexControl extends mobileHomeControl
     /**
      * 首页
      */
-	public function indexOp()
+    public function indexOp()
     {
-        if($_GET['type'] == 'html') {
+        if ($_GET['type'] == 'html') {
             $model_mb_special = Model('mb_special');
             $data = $model_mb_special->getMbSpecialIndex();
             $this->_output_special($data, $_GET['type']);
@@ -32,29 +34,30 @@ class indexControl extends mobileHomeControl
             $special_list = $this->mb_special->getMbSpecialItemUsableListByIDEx(self::HomeSpecialID);
             $sale_list = $this->sale_list();
 
-            $this->_output_special(array('special_list' => $special_list,'sale_list' => $sale_list),$_GET['type']);
+            $this->_output_special(array('special_list' => $special_list, 'sale_list' => $sale_list), $_GET['type']);
         }
-	}
+    }
 
     /**
      * 专题
      */
-    public function specialOp() {
+    public function specialOp()
+    {
         $model_mb_special = Model('mb_special');
         $special_list = $model_mb_special->getMbSpecialItemUsableListByIDEx($_GET['special_id']);
-        $this->_output_special(array('special_list' => $special_list),$_GET['type'], $_GET['special_id']);
+        $this->_output_special(array('special_list' => $special_list), $_GET['type'], $_GET['special_id']);
     }
 
-    static private function validate_type($type,$data)
+    static private function validate_type($type, $data)
     {
-        $types = array('keyword','special','goods','url');
-        if (empty($type) || !in_array($type,$types)) {
-            joutput_error(errcode::ErrSpecial,'error type.');
+        $types = array('keyword', 'special', 'goods', 'url');
+        if (empty($type) || !in_array($type, $types)) {
+            joutput_error(errcode::ErrSpecial, 'error type.');
             return false;
         }
         $validator = new Validate();
-        if($type === 'special') {
-            $validator->setValidate(Validate::verify_number($data,'special data error.'));
+        if ($type === 'special') {
+            $validator->setValidate(Validate::verify_number($data, 'special data error.'));
         } elseif ($type === 'keyword') {
 
         } elseif ($type === 'goods') {
@@ -65,7 +68,7 @@ class indexControl extends mobileHomeControl
 
         $err = $validator->validate();
         if ($err != '') {
-            joutput_error(errcode::ErrSpecial,$err);
+            joutput_error(errcode::ErrSpecial, $err);
             return false;
         } else {
             return true;
@@ -77,9 +80,9 @@ class indexControl extends mobileHomeControl
         $type = $_GET['type'];
         $data = $_GET['data'];
 
-        if(self::validate_type($type,$data) == false) return;
+        if (self::validate_type($type, $data) == false) return;
 
-        if($type === 'special') {
+        if ($type === 'special') {
             $ret = $this->mb_special->getMbSpecialItemUsableListByID($data);
         } elseif ($type === 'keyword') {
 
@@ -92,41 +95,39 @@ class indexControl extends mobileHomeControl
         joutput_data($ret);
     }
 
-    public function sale_listOp(){
+    public function sale_listOp()
+    {
         $prefix = 'mb_salelist_content';
         $codeid = 122;
 
         $ret = rcache($codeid, $prefix);
-        if(empty($ret))
-        {
+        if (empty($ret)) {
             $web_code = Model('web_code');
-            $result = $web_code->where(array('code_id' => 122,'web_id' => 122))->select();
-            if(!empty($result)) {
+            $result = $web_code->where(array('code_id' => 122, 'web_id' => 122))->select();
+            if (!empty($result)) {
                 $top = $result[0];
                 $tops = unserialize($top['code_info']);
             }
-            if(empty($tops)) return NULL;
+            if (empty($tops)) return NULL;
             $ret = array();
-            foreach($tops as $id => $val){
+            foreach ($tops as $id => $val) {
                 $item['id'] = $id;
 //                $item['image'] = UPLOAD_SITE_URL. DS.substr($val['img_name'],0,-4);
-                $item['image'] = UPLOAD_SITE_URL. DS.$val['img_name'];
+                $item['image'] = UPLOAD_SITE_URL . DS . $val['img_name'];
                 $item['title'] = $val['recommend']['name'];
-                $goods_list =  $val['goods_list'];
+                $goods_list = $val['goods_list'];
                 $item['goods_list'] = array();
-                foreach($goods_list as $goods_val){
-                    $goods_val['goods_pic'] = UPLOAD_SITE_URL. DS. $goods_val['goods_pic'];
+                foreach ($goods_list as $goods_val) {
+                    $goods_val['goods_pic'] = UPLOAD_SITE_URL . DS . $goods_val['goods_pic'];
                     array_push($item['goods_list'], $goods_val);
                 }
                 array_push($ret, $item);
             }
-            wcache($codeid,array("salelist_content"=>serialize($ret)),$prefix);
-        }
-        else
-        {
+            wcache($codeid, array("salelist_content" => serialize($ret)), $prefix);
+        } else {
             $ret = unserialize($ret['salelist_content']);
         }
-        joutput_data(array('sale_list'=>$ret));
+        joutput_data(array('sale_list' => $ret));
     }
 
     /**
@@ -138,32 +139,28 @@ class indexControl extends mobileHomeControl
         $codeid = 122;
 
         $ret = rcache($codeid, $prefix);
-        if(empty($ret))
-        {
+        if (empty($ret)) {
             $web_code = Model('web_code');
-            $result = $web_code->where(array('code_id' => 122,'web_id' => 122))->select();
-            if(!empty($result)) {
+            $result = $web_code->where(array('code_id' => 122, 'web_id' => 122))->select();
+            if (!empty($result)) {
                 $top = $result[0];
                 $tops = unserialize($top['code_info']);
             }
-            if(empty($tops)) return NULL;
+            if (empty($tops)) return NULL;
             $ret = array();
-            foreach($tops as $id => $val)
-            {
+            foreach ($tops as $id => $val) {
                 $item = array();
                 $item['id'] = $id;
                 $img = $val['img_name'];
-                if(!empty($img)) {
+                if (!empty($img)) {
 //                    $item['image'] = UPLOAD_SITE_URL. DS. substr($img,0,-4);
-                    $item['image'] = UPLOAD_SITE_URL. DS. $img;
+                    $item['image'] = UPLOAD_SITE_URL . DS . $img;
                     $item['title'] = $val['recommend']['name'];
-                    array_push($ret,$item);
+                    array_push($ret, $item);
                 }
             }
-            wcache($codeid,array("salelist"=>serialize($ret)),$prefix);
-        }
-        else
-        {
+            wcache($codeid, array("salelist" => serialize($ret)), $prefix);
+        } else {
             $ret = unserialize($ret['salelist']);
         }
 
@@ -173,25 +170,22 @@ class indexControl extends mobileHomeControl
     /**
      * 输出专题
      */
-    private function _output_special($data,$type = 'json', $special_id = 0)
+    private function _output_special($data, $type = 'json', $special_id = 0)
     {
         //$model_special = Model('mb_special');
-        if($type == 'html')
-        {
+        if ($type == 'html') {
             //$html_path = $model_special->getMbSpecialHtmlPath($special_id);
             //if(!is_file($html_path)) {
-                //ob_start();
-                Tpl::output('list', $data['special_list']);
-                Tpl::showpage('mb_special');
-                //file_put_contents($html_path, ob_get_clean());
-           // }
+            //ob_start();
+            Tpl::output('list', $data['special_list']);
+            Tpl::showpage('mb_special');
+            //file_put_contents($html_path, ob_get_clean());
+            // }
             //header('Location: ' . $model_special->getMbSpecialHtmlUrl($special_id));
-        } 
-        else 
-        {
-			if(empty($data)) {
-				$data=array();
-			}
+        } else {
+            if (empty($data)) {
+                $data = array();
+            }
             joutput_data($data);
         }
     }
@@ -199,13 +193,14 @@ class indexControl extends mobileHomeControl
     /**
      * android客户端版本号
      */
-    public function apk_versionOp() {
-		$version = C('mobile_apk_version');
-		$url = C('mobile_apk');
-        if(empty($version)) {
-           $version = '';
+    public function apk_versionOp()
+    {
+        $version = C('mobile_apk_version');
+        $url = C('mobile_apk');
+        if (empty($version)) {
+            $version = '';
         }
-        if(empty($url)) {
+        if (empty($url)) {
             $url = '';
         }
 

+ 5 - 3
mobile/control/login.php

@@ -51,11 +51,12 @@ class loginControl extends mobileHomeControl
 
         $model_member = Model('member');
         $userid = $model_member->getMemberID($openid,$type,$password);
+
         if($userid == -1) {
             joutput_error(errcode::ErrLogin,"{$openid}:{$password},登录失败");
         } 
         else
-        {    
+        {
             $key = memberModel::gen_uid_token($userid);
             $ret = rcache($key,'member');
             if(empty($ret)) {
@@ -176,7 +177,7 @@ class loginControl extends mobileHomeControl
 
         $validator = new Validate();
         $data = array();    
-        if($type == 'mobile') {
+        if($type == 'mobile' || $type = 'mobilenewpassword') {
             $code = trim($_POST['code']);
             $password = trim($_POST['password']);
             $validator->setValidate(Validate::smscode($code));  
@@ -196,7 +197,7 @@ class loginControl extends mobileHomeControl
             return joutput_error(errcode::ErrParamter, $err);
         }
         
-        if($type == 'mobile') 
+        if($type == 'mobile')
         { 
             $key = $this->gen_token_code($token);
             $ret = rcache($key, 'member');
@@ -204,6 +205,7 @@ class loginControl extends mobileHomeControl
                 $mobile = $ret['mobile'];
                 $cond = array('member_mobile' => $mobile);
                 $data['member_mobile'] = $mobile;
+                $data['member_type'] = 0;
             } else {
                 return false;
             }

+ 1 - 1
mobile/control/member_order.php

@@ -30,7 +30,7 @@ class member_orderControl extends mobileMemberControl
         $condition = array();
         $condition['buyer_id'] = $this->member_info['member_id'];
 
-        $order_list_array = $model_order->getNormalOrderList($condition, $this->page, '*', 'order_id desc', '', array('order_address', 'order_goods'));
+        $order_list_array = $model_order->getNormalOrderList($condition, 30, '*', 'order_id desc', '', array('order_address', 'order_goods'));
 
         $order_group_list = array();
         $order_pay_sn_array = array();

+ 2 - 0
mobile/util/errcode.php

@@ -26,6 +26,8 @@ class errcode extends SplEnum
     const ErrDB      = 11000;
     const ErrSms 	 = 12000;
 
+    const ErrGoodsNotExist = 13000;
+
     static function msg($code) 
     {
         switch ($code) {