root il y a 9 ans
Parent
commit
62b02d3d7d

+ 88 - 0
admin/control/bonus.php

@@ -0,0 +1,88 @@
+<?php
+/**
+ * 红包管理
+ *
+ *
+ *
+ ***/
+defined('InShopNC') or exit('Access Invalid!');
+class bonusControl extends SystemControl{
+    public function __construct(){
+        parent::__construct();
+    }
+
+    public function bonus_typeOp(){
+        $bonus_type = Model('bonus_type');
+        $bonus_list = $bonus_type->getAll();
+        Tpl::output('bonus_list', $bonus_list) ;
+        $this->show_menu('bonus','bonus_type_list');
+        Tpl::showpage('bonus.bonus_type_list');
+    }
+
+    public function bonus_type_addOp() {
+        $this->show_menu('bonus','bonus_type_add');
+        $this->bonus_form();
+    }
+
+    public function bonus_type_editOp() {
+        $id = $_GET['id'];
+        $this->show_menu('type','bonus_type_edit');
+        $this->bonus_form($id);
+    }
+
+    public function bonus_type_saveOp() {
+        $type_id = $_POST['type_id'] ? $_POST['type_id'] : 0;
+        $bonus_value = array(
+            'type_name' => $_POST['type_name'],
+            'send_type' => $_POST['send_type'],
+            'send_start_date' => strtotime(trim($_POST['send_start_date'])),
+            'send_end_date' => strtotime(trim($_POST['send_end_date'])),
+            'use_start_date' => strtotime(trim($_POST['use_start_date'])),
+            'use_end_date' => strtotime(trim($_POST['use_end_date']))
+        );
+        $bonus_type = Model('bonus_type');
+        $bonus_type->save($bonus_value, $type_id);
+        if(intval($_POST['send_type']) === 1){
+            $bonus_file = $_FILES['bonus_file'];
+            if($bonus_file && !empty($bonus_file['name'])){
+                if ($bonus_file['tmp_name'] == ""){
+                    $this->setError('上传失败,请联系服务器管理员。');
+                    return false;
+                }
+                $bonus_file_content = file_get_contents($bonus_file['tmp_name']);
+                $bonus = Model('user_bonus');
+                $bonus->load_file($bonus_file_content);
+            }
+        }
+        $this->bonus_typeOp();
+    }
+
+    private function bonus_form($id = 0){
+        Tpl::output('id', $id);
+        if($id > 0){
+            $bonus_type = Model('bonus_type');
+            $bonus_type_data = $bonus_type->get($id);
+            Tpl::output('data', $bonus_type_data[0]);
+        }
+        Tpl::showpage('bonus.bonus_type_form');
+    }
+
+    private function show_menu($menu_type,$menu_key=''){
+        $menu_array		= array();
+        switch ($menu_type) {
+            case 'bonus':
+                $menu_array = array(
+                1=>array('menu_key'=>'bonus_type_list','menu_name'=>'红包类型列表', 'menu_url'=>'index.php?act=bonus&op=bonus_type'),
+                2=>array('menu_key'=>'bonus_type_add','menu_name'=>'添加红包类型', 'menu_url'=>'index.php?act=bonus&op=bonus_type_add'),
+                );
+                break;
+            case 'type':
+                $menu_array = array(
+                    1=>array('menu_key'=>'bonus_type_edit','menu_name'=>'编辑红包类型', 'menu_url'=>'index.php?act=bonus&op=bonus_type_edit')
+                );
+                break;
+        }
+        Tpl::output('menu',$menu_array);
+        Tpl::output('menu_key',$menu_key);
+    }
+}

+ 1 - 0
admin/include/menu.php

@@ -158,6 +158,7 @@ $arr = array(
 					array('args'=>'bundling_list,promotion_bundling,operation',	'text'=>$lang['nc_promotion_bundling']),
 					array('args'=>'goods_list,promotion_booth,operation',		'text'=>$lang['nc_promotion_booth']),
 					array('args'=>'voucher_apply,voucher,operation',            'text'=>$lang['nc_voucher_price_manage']),
+					array('args'=>'bonus_type,bonus,operation',            'text'=>'红包管理'),
 					array('args'=>'index,bill,operation',					    'text'=>$lang['nc_bill_manage']),
 					array('args'=>'index,vr_bill,operation',					'text'=>'虚拟订单结算'),
 					array('args'=>'activity,activity,operation',				'text'=>$lang['nc_activity_manage']),

+ 155 - 0
admin/templates/default/bonus.bonus_type_form.php

@@ -0,0 +1,155 @@
+<?php defined('InShopNC') or exit('Access Invalid!');?>
+
+<div class="page">
+    <!-- 页面导航 -->
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>红包管理</h3>
+            <ul class="tab-base">
+                <?php   foreach($output['menu'] as $menu) {  if($menu['menu_key'] == $output['menu_key']) { ?>
+                    <li><a href="JavaScript:void(0);" class="current"><span><?php echo $menu['menu_name'];?></span></a></li>
+                <?php }  else { ?>
+                    <li><a href="<?php echo $menu['menu_url'];?>" ><span><?php echo $menu['menu_name'];?></span></a></li>
+                <?php  } }  ?>
+            </ul>
+            </ul>
+        </div>
+    </div>
+
+    <div class="fixed-empty"></div>
+    <form id="type_form" method="post" enctype="multipart/form-data" action="index.php?act=bonus&op=bonus_type_save">
+        <input type="hidden" name="type_id" value="<?php echo $output['id'];?>"/>
+        <table class="table tb-type2">
+            <tbody>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label class="validation" for="type_name">红包类型名称</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="type_name" name="type_name" class="txt" value="<?php echo  isset($output['data'])? $output['data']['type_name'] : '';?>"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label class="validation" for="send_type">发放方式</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform">
+                    <input type="radio" id="send_type" name="send_type" value="1" checked><label>发放给特定用户</label>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label>上传CSV文件</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform">
+                    <span class="type-file-box">
+                        <input type="file" class="type-file-file" id="bonus_file" name="bonus_file" size="30" hidefocus="true" nc_type="upload_bonus_file" title="选择文件">
+                    </span>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label class="validation" for="send_start_date">开始发放时间</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="send_start_date" name="send_start_date"  class="txt date" readonly="readonly" value="<?php echo  isset($output['data'])? date('Y-m-d', $output['data']['send_start_date']) : '';?>"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label class="validation" for="send_end_date">结束发放时间</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="send_end_date" name="send_end_date"  class="txt date" readonly="readonly" value="<?php echo  isset($output['data'])? date('Y-m-d', $output['data']['send_end_date']) : '';?>"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label class="validation" for="use_start_date">开始使用时间</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="use_start_date" name="use_start_date"  class="txt date" readonly="readonly" value="<?php echo  isset($output['data'])? date('Y-m-d', $output['data']['use_start_date']) : '';?>"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td class="required" colspan="2"><label class="validation" for="use_end_date">结束使用时间</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" id="use_end_date" name="use_end_date"  class="txt date" readonly="readonly" value="<?php echo  isset($output['data'])? date('Y-m-d', $output['data']['use_end_date']) : '';?>"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<link type="text/css" rel="stylesheet" href="<?php echo RESOURCE_SITE_URL."/js/jquery-ui/themes/ui-lightness/jquery.ui.css";?>"/>
+<script src="<?php echo RESOURCE_SITE_URL."/js/jquery-ui/jquery.ui.js";?>"></script>
+<script src="<?php echo RESOURCE_SITE_URL."/js/jquery-ui/i18n/zh-CN.js";?>" charset="utf-8"></script>
+<script>
+    //按钮先执行验证再提交表单
+    $(function(){$("#submitBtn").click(function(){
+        if($("#type_form").valid()){
+            $("#type_form").submit();
+        }
+    });
+    });
+    $(document).ready(function(){
+        $("#send_start_date").datepicker();
+        $("#send_end_date").datepicker();
+        $("#use_start_date").datepicker();
+        $("#use_end_date").datepicker();
+        $("#type_form").validate({
+            errorPlacement: function(error, element){
+                error.appendTo(element.parent().parent().prev().find('td:first'));
+            },
+            rules : {
+                type_name: {
+                    required : true
+                },
+                send_start_date: {
+                    required : true,
+                    date      : false
+                },
+                send_end_date: {
+                    required : true,
+                    date      : false
+                },
+                use_start_date: {
+                    required : true,
+                    date      : false
+                },
+                use_end_date: {
+                    required : true,
+                    date      : false
+                }
+            },
+            messages : {
+                type_name: {
+                    required : '红包类型名称不能为空'
+                },
+                send_start_date: {
+                    required : '开始发放时间不能为空'
+                },
+                send_end_date: {
+                    required : '结束发放时间不能为空>'
+                },
+                use_start_date: {
+                    required : '开始使用时间不能为空'
+                },
+                use_end_date: {
+                    required : '结束使用时间不能为空'
+                }
+            }
+        });
+    });
+    $(function(){
+        var textButton="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='' class='type-file-button' />"
+        $(textButton).insertBefore("#bonus_file");
+        $("#bonus_file").change(function(){
+            $("#textfield1").val($("#bonus_file").val());
+        });
+    });
+</script>

+ 69 - 0
admin/templates/default/bonus.bonus_type_list.php

@@ -0,0 +1,69 @@
+<?php defined('InShopNC') or exit('Access Invalid!');?>
+
+<div class="page">
+    <!-- 页面导航 -->
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>红包管理</h3>
+            <ul class="tab-base">
+                <?php   foreach($output['menu'] as $menu) {  if($menu['menu_key'] == $output['menu_key']) { ?>
+                    <li><a href="JavaScript:void(0);" class="current"><span><?php echo $menu['menu_name'];?></span></a></li>
+                <?php }  else { ?>
+                    <li><a href="<?php echo $menu['menu_url'];?>" ><span><?php echo $menu['menu_name'];?></span></a></li>
+                <?php  } }  ?>
+            </ul>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <table class="table tb-type2" id="prompt">
+        <tbody>
+        <tr class="space odd">
+            <th class="nobg" colspan="12">
+                <div class="title">
+                    <h5><?php echo $lang['nc_prompts'];?></h5>
+                    <span class="arrow"></span>
+                </div>
+            </th>
+        </tr>
+        <tr>
+            <td><ul>
+                    <li>点击编辑链接修改红包类型数据</li>
+                </ul></td>
+        </tr>
+        </tbody>
+    </table>
+
+    <table class="table tb-type2">
+        <thead>
+        <tr class="thead">
+            <th class="w96">红包类型名称</th>
+            <th class="w96">发放类型</th>
+            <th class="w96">开始发放时间</th>
+            <th class="w96">结束发放时间</th>
+            <th class="w96">开始使用时间</th>
+            <th class="w96">结束使用时间</th>
+            <th class="w48">操作</th>
+        </tr>
+        </thead>
+        <tbody id="treet1">
+        <?php if(!empty($output['bonus_list']) && is_array($output['bonus_list'])){ ?>
+        <?php foreach($output['bonus_list'] as $k => $v){ ?>
+        <tr class="hover edit row">
+            <td><?php echo $v['type_name'];?></td>
+            <td><?php
+                if(intval($v['send_type']) === 1){
+                    echo '发放给特定用户';
+                }
+                ?></td>
+            <td><?php echo date('Y-m-d', $v['send_start_date']);?></td>
+            <td><?php echo date('Y-m-d',$v['send_end_date']);?></td>
+            <td><?php echo date('Y-m-d',$v['use_start_date']);?></td>
+            <td><?php echo date('Y-m-d',$v['use_end_date']);?></td>
+            <td><a href="index.php?act=bonus&op=bonus_type_edit&id=<?php echo $v['type_id'];?>">编辑</a></td>
+        </tr>
+        <?php }  ?>
+        <?php }  ?>
+        </tbody>
+    </table>
+</div>

+ 3 - 0
core/framework/libraries/log.php

@@ -23,6 +23,9 @@ class Log
                 $url .= " ( act={$_GET['act']}&op={$_GET['op']} ) ";
                 $content = "[{$now}] {$url}\r\n{$level}: {$message}\r\n";
                 file_put_contents($log_file, $content, FILE_APPEND);
+                $log_file = BASE_DATA_PATH.'/log/'.date('Ymd',TIMESTAMP).'.log';
+                $content = "[{$now}] {$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';

+ 2 - 0
core/framework/libraries/model.php

@@ -1087,6 +1087,8 @@ class ModelDb
             }
         }
         $sql   =  ($replace?'REPLACE ':'INSERT ').$this->parseAttr($options).' INTO '.$this->parseTable($options).' ('.implode(',', $fields).') VALUES ('.implode(',', $values).')';
+
+        Log::record($sql,Log::SQL);
         return DB::execute($sql);
     }
 

+ 7 - 0
crontab/crawl/fetch_goods.php

@@ -34,6 +34,13 @@ function is_excids($cid)
     return in_array($cid,$cids);
 }
 
+function not_null($str)
+{
+    return (empty($str)) ? '' : $str;
+}
+
+$str = md5('stanley%lrlz&00991122887733447755');
+
 //$tmreq = new tmrequest();
 //$tmreq->proc();
 //

+ 12 - 8
crontab/crawl/product_importer.php

@@ -280,11 +280,12 @@ class product_importer
     {
         $this->fill_class($cid, $general,$name);
 
+        $general['num_iid'] = $item['num_iid'];
         $general['store_id'] = self::store_id;
         $general['store_name'] = self::store_name;
-        $general['goods_name'] = $item['title'];
-        $general['goods_mobile_name'] = $item['title'];
-        $general['goods_jingle'] = empty($item['sell_point']) ? '' : $item['sell_point'];
+        $general['goods_name'] = not_null($item['title']);
+        $general['goods_mobile_name'] = not_null($item['title']);
+        $general['goods_jingle'] = not_null($item['sell_point']);
         $general['goods_price'] = $item['price'];
         $general['goods_marketprice'] = $item['price'];
         $general['goods_image'] = $item['pic_url'];
@@ -294,7 +295,7 @@ class product_importer
         $general['goods_vat'] = strtolower($item['has_invoice']) ? 1 : 0;
         $general['is_virtual'] = strtolower($item['is_virtual']) ? 1 : 0;
         $general['store_name'] = $item['nick'];
-        $general['goods_serial'] = $item['outer_id'];
+        $general['goods_serial'] = not_null($item['outer_id']);
         $general['goods_addtime'] = strtotime($item['created']);
     }
 
@@ -348,9 +349,13 @@ class product_importer
         {
             foreach($values as $vid => $vname)
             {
-                if($vid != 'name') {
-                    $this->mod_goods_attr_index->insert(array('goods_id' => $gd_id,'goods_commonid' => $gdcommon_id,
+                if($vid != 'name')
+                {
+                    $index = $this->mod_goods_attr_index->insert(array('goods_id' => $gd_id,'goods_commonid' => $gdcommon_id,
                         'gc_id' => $gc_id,'type_id' => $type_id, 'attr_id' => $attrid,'attr_value_id' => $vid));
+                    if($index == false) {
+                        Log::record('Cannot insert attr_index');
+                    }
                 }
             }
         }
@@ -492,7 +497,6 @@ class product_importer
                     $goods = $general;
 
                     $goods['goods_edittime'] = strtotime($sku['modified']);
-                    $goods['goods_serial'] = $sku['outer_id'];
                     $goods['goods_price'] = $sku['price'];
                     $goods['goods_addtime'] = strtotime($sku['created']);
                     $goods['goods_storage'] = $sku['quantity'];
@@ -501,7 +505,7 @@ class product_importer
                     $goods['goods_spec'] = serialize($goods_spec);
                     $goods['goods_image'] = $main_pic;
                     $goods['color_id'] = $this->goods_colorid($cid,$sku['properties']);
-                    $goods['goods_serial'] = $sku['outer_id'];
+                    $goods['goods_serial'] = not_null($sku['outer_id']);
 
 
                     $gd_id = $this->mod_goods->addGoods($goods);

+ 2 - 2
crontab/crawl/upload_control.php

@@ -27,8 +27,8 @@ class upload_control
     }
 
     const POST_NAME = 'goods_image';
-    //const tmp_file = '/private/var/tmp/phpxxkkdl';
-    const tmp_file = '/tmp/phpxxkkdl';
+    const tmp_file = '/private/var/tmp/phpxxkkdl';
+    //const tmp_file = '/tmp/phpxxkkdl';
 
     private function fill_files($filename)
     {

+ 26 - 0
data/api/wxpay/cert/apiclient_cert.pem

@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEazCCA9SgAwIBAgIDCCtbMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
+TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
+ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
+HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE1MTAyMjAyNDAwMloX
+DTI1MTAxOTAyNDAwMlowgZsxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
+bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
+EwVNTVBheTEwMC4GA1UEAxQn5LiK5rW35Li95Lq65Li95aaG5YyW5aaG5ZOB5pyJ
+6ZmQ5YWs5Y+4MREwDwYDVQQEEwgxMDczMzMwNzCCASIwDQYJKoZIhvcNAQEBBQAD
+ggEPADCCAQoCggEBAMojCgVtpAqLxraCsT5sGanh1ARVpYwFsHYUxBuNAPXXMMxm
+aLm1lD9H/Bmyf0n9j/I2XZDlUQgVxvd6oAqkjngZASFtMgLf9tdCEy31du7ytPTO
+FNnieFG0PQWLCkqGd7xaeWbOEmvXGAFVVbPeX04e3HWjjpBhebw5vNu7Xq39PFvz
+HsPPDq8ASqUMnkrwriKTERaKzUM15wdOevnWRZAujuO2jk5SIOlk4VNna3MCx4Ix
+1Qfsrlqs0PKK07pKmT6jtPYPEJtxgzFv64hpq8c2CnJd2borhPLuGFBMmb5IgFLo
+8RLCR8HdiEWbc/QQh7VkIbfUxhhN3c6d1Ngy5VsCAwEAAaOCAUYwggFCMAkGA1Ud
+EwQCMAAwLAYJYIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNh
+dGUiMB0GA1UdDgQWBBQoErMZ2YzhvCMqCJ0kdw8TG06suzCBvwYDVR0jBIG3MIG0
+gBQ+BSb2ImK0FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQ
+BgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1Rl
+bmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqG
+SIb3DQEJARYQbW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQE
+AwIGwDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQCX
+FhFBqz0q60cVyS4rMwGi6HZFx3gXbr18l2D5XArHZz/CLNtbxJ1aAh2F3/rJIMyA
+g6X5B1o728ywGpFYGAVn8BN/ez4Mf0RFlszz971xgc2GuLQ3UOQnFHbgLH9++zrB
+i8qoLFskBrjZzD5avH6M54dBjmdq76gg2SF8rgF55Q==
+-----END CERTIFICATE-----

+ 28 - 0
data/api/wxpay/cert/apiclient_key.pem

@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDKIwoFbaQKi8a2
+grE+bBmp4dQEVaWMBbB2FMQbjQD11zDMZmi5tZQ/R/wZsn9J/Y/yNl2Q5VEIFcb3
+eqAKpI54GQEhbTIC3/bXQhMt9Xbu8rT0zhTZ4nhRtD0FiwpKhne8WnlmzhJr1xgB
+VVWz3l9OHtx1o46QYXm8Obzbu16t/Txb8x7Dzw6vAEqlDJ5K8K4ikxEWis1DNecH
+Tnr51kWQLo7jto5OUiDpZOFTZ2tzAseCMdUH7K5arNDyitO6Spk+o7T2DxCbcYMx
+b+uIaavHNgpyXdm6K4Ty7hhQTJm+SIBS6PESwkfB3YhFm3P0EIe1ZCG31MYYTd3O
+ndTYMuVbAgMBAAECggEBAIezYD3mrlL6JWxPbuhGMDBxUCGc0eefxihvpnwMfFGO
+ps8CDVpnQV/+Vot13qhwlpt3zfbBTFYOMKXh5+FdOdv8hVrIcOOnMZKvZCrdeHvP
+6pXSaAMiW74WL0UyY7VGcsm7P3c57voAy7fRbxiyt+69HynGpKXfGpe3d0dYkaZh
+gYq9gubr7LOsSyoSrkmQ/6ECo9xqcxiPLAjTb9CFbcjtG25QAZRz8jrZxlRSBogc
+1e2lYb9vWZ3DLBY8kJcm6KeYz3XaLILfGbIqqphNImiUIeIm7hFCjWo3DbDKBqtI
+tJ+UFGyG3WTJPYR++dqKYN7gAA5xk2Np79E4cdBr8UkCgYEA+8q0vpXYNtiaCStv
+dxSNEpoAeMGcWqZKkB8xdsDlcaB5LiLL/pEH08PqNcaD/562fOcb8PXK/5UP5j9J
+jguFYZPZrZSAdljv+Zd9uY2Ix8i6JcAkfZBdfjRIVXqmGq7CEilMRusXOcvsaaei
+PjyQ/VZuQEQ2wt1a2UE/jgSkAV0CgYEAzYPiRodbJtsrstMcPwy7cxIvr48n+ReG
+3dtkJReBedhh6IoP3XGg0dQhLejC+8Y4gg3WdFfyuH0BD6zGbPE6LwMQ4Z7XJv5U
+/LbtImvag99xy6DK7Y0PcNGaCYUDKQxx5agz47bxdDfrvdCfD4DQWLa2EZeLFHcH
+sJnRiWRHfhcCgYAgE6HVCcfirNNqyaLIm9ChBwd6WsftcHPdSmwFwes4/4WQkBRG
+2PkTTEkhEqosPW7oGJUhrF5xEu9UmMlpFCSo2qoHh/yZlxjzRg5ZPiOnt/Wm64R6
+jpKqikSQxzA0BAFrSOGTw01RKp5yk02C+jpKW+FtxILpbkOtm7daA1NVbQKBgBW4
+EFu/xkRO+UlGwj9viwfYLi3xhRnwAJLFssmwuEA2O/KlVJPkhEhokLEXXjPZePNV
+nwpgmQgiPdB4Q+gTfkClpE0Tyk0Wp8ilVF5E46z4GkCY15lPRQh5PjwvUGwwIoFQ
+y1sPZGkR19oRiB3NUTdu58LoLwyUn71sJBbPADc1AoGBANX5A77leIKR5wD3RWR3
+W+GMuzmWgvyFHju2zG2nvnd3CIIHnZSlTvCd2H0imjmOPvLofUFnGDTgZWhsqNuk
+9FZ3qFdTgRg3XCWRHT3X5C93iNM7TTHxtDbc7jAdjS6rEDyZD0MD/En5PYxAfFln
+Q3JJqM0w2XNdnYnGL2P2a19l
+-----END PRIVATE KEY-----

+ 76 - 0
data/api/wxpay/doc/README

@@ -0,0 +1,76 @@
+SDK
+体验地址
+http://paysdk.weixin.qq.com/
+
+快速搭建指南
+①、安装配置nginx+phpfpm+php
+②、建SDK解压到网站根目录
+③、修改lib/WxPay.Config.php为自己申请的商户号的信息(配置详见说明)
+⑤、下载证书替换cert下的文件
+⑥、搭建完成
+
+SDK目录结构
+|-- cert
+|   |-- apiclient_cert.pem
+|   `-- apiclient_key.pem
+|-- index.php
+|-- lib
+|   |-- WxPay.Api.php
+|   |-- WxPay.Config.php
+|   |-- WxPay.Data.php
+|   |-- WxPay.Exception.php
+|   `-- WxPay.Notify.php
+|-- logs
+|   |-- 2015-03-06.log
+|   `-- 2015-03-11.log
+`-- example
+    |-- WxPay.JsApiPay.php
+    |-- WxPay.MicroPay.php
+    |-- WxPay.NativePay.php
+	|-- download.php
+	|-- micropay.php
+	|-- native.php
+	|-- native_notify.php
+	|-- notify.php
+	|-- orderquery.php
+	|-- qrcode.php
+	|-- refund.php
+	|-- refundquery.php
+	|-- jsapi.php
+    |-- log.php
+    `-- phpqrcode
+
+目录功能简介
+lib
+API接口封装代码
+WxPay.Api.php 包括所有微信支付API接口的封装
+WxPay.Config.php  商户配置
+WxPay.Data.php   输入参数封装
+WxPay.Exception.php  异常类
+WxPay.Notify.php    回调通知基类
+
+cert
+证书存放路径,证书可以登录商户平台https://pay.weixin.qq.com/index.php/account/api_cert下载
+
+example
+样例程序代码路径
+
+example/phpqrcode
+开源二维码php代码
+
+logs
+日志文件
+
+※配置指南
+MCHID = '1225312702';
+这里填开户邮件中的商户号
+
+APPID = 'wx426b3015555a46be';
+这里填开户邮件中的(公众账号APPID或者应用APPID)
+
+KEY = 'e10adc3949ba59abbe56e057f20f883e'
+这里请使用商户平台登录账户和密码登录http://pay.weixin.qq.com 平台设置的“API密钥”,为了安全,请设置为32字符串。
+
+APPSECRET = '01c6d59a3f9024db6336662ac95c8e74'
+改参数在JSAPI支付(open平台账户不能进行JSAPI支付)的时候需要用来获取用户openid,可使用APPID对应的公众平台登录http://mp.weixin.qq.com 的开发者中心获取AppSecret。
+

BIN
data/api/wxpay/doc/README.doc


+ 581 - 0
data/api/wxpay/lib/WxPay.Api.php

@@ -0,0 +1,581 @@
+<?php
+require_once "WxPay.Exception.php";
+require_once "WxPay.Config.php";
+require_once "WxPay.Data.php";
+
+/**
+ * 
+ * 接口访问类,包含所有微信支付API列表的封装,类中方法为static方法,
+ * 每个接口有默认超时时间(除提交被扫支付为10s,上报超时时间为1s外,其他均为6s)
+ * @author widyhu
+ *
+ */
+class WxPayApi
+{
+	/**
+	 * 
+	 * 统一下单,WxPayUnifiedOrder中out_trade_no、body、total_fee、trade_type必填
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayUnifiedOrder $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function unifiedOrder($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+		//检测必填参数
+		if(!$inputObj->IsOut_trade_noSet()) {
+			throw new WxPayException("缺少统一支付接口必填参数out_trade_no!");
+		}else if(!$inputObj->IsBodySet()){
+			throw new WxPayException("缺少统一支付接口必填参数body!");
+		}else if(!$inputObj->IsTotal_feeSet()) {
+			throw new WxPayException("缺少统一支付接口必填参数total_fee!");
+		}else if(!$inputObj->IsTrade_typeSet()) {
+			throw new WxPayException("缺少统一支付接口必填参数trade_type!");
+		}
+		
+		//关联参数
+		if($inputObj->GetTrade_type() == "JSAPI" && !$inputObj->IsOpenidSet()){
+			throw new WxPayException("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!");
+		}
+		if($inputObj->GetTrade_type() == "NATIVE" && !$inputObj->IsProduct_idSet()){
+			throw new WxPayException("统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!");
+		}
+		
+		//异步通知url未设置,则使用配置文件中的url
+		if(!$inputObj->IsNotify_urlSet()){
+			$inputObj->SetNotify_url(WxPayConfig::NOTIFY_URL);//异步通知url
+		}
+		
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']);//终端ip	  
+		//$inputObj->SetSpbill_create_ip("1.1.1.1");  	    
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		//签名
+		$inputObj->SetSign();
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 查询订单,WxPayOrderQuery中out_trade_no、transaction_id至少填一个
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayOrderQuery $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function orderQuery($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/orderquery";
+		//检测必填参数
+		if(!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+			throw new WxPayException("订单查询接口中,out_trade_no、transaction_id至少填一个!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 关闭订单,WxPayCloseOrder中out_trade_no必填
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayCloseOrder $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function closeOrder($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/closeorder";
+		//检测必填参数
+		if(!$inputObj->IsOut_trade_noSet()) {
+			throw new WxPayException("订单查询接口中,out_trade_no必填!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+
+	/**
+	 * 
+	 * 申请退款,WxPayRefund中out_trade_no、transaction_id至少填一个且
+	 * out_refund_no、total_fee、refund_fee、op_user_id为必填参数
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayRefund $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function refund($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/secapi/pay/refund";
+		//检测必填参数
+		if(!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+			throw new WxPayException("退款申请接口中,out_trade_no、transaction_id至少填一个!");
+		}else if(!$inputObj->IsOut_refund_noSet()){
+			throw new WxPayException("退款申请接口中,缺少必填参数out_refund_no!");
+		}else if(!$inputObj->IsTotal_feeSet()){
+			throw new WxPayException("退款申请接口中,缺少必填参数total_fee!");
+		}else if(!$inputObj->IsRefund_feeSet()){
+			throw new WxPayException("退款申请接口中,缺少必填参数refund_fee!");
+		}else if(!$inputObj->IsOp_user_idSet()){
+			throw new WxPayException("退款申请接口中,缺少必填参数op_user_id!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, true, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 查询退款
+	 * 提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,
+	 * 用零钱支付的退款20分钟内到账,银行卡支付的退款3个工作日后重新查询退款状态。
+	 * WxPayRefundQuery中out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayRefundQuery $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function refundQuery($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/refundquery";
+		//检测必填参数
+		if(!$inputObj->IsOut_refund_noSet() &&
+			!$inputObj->IsOut_trade_noSet() &&
+			!$inputObj->IsTransaction_idSet() &&
+			!$inputObj->IsRefund_idSet()) {
+			throw new WxPayException("退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+	/**
+	 * 下载对账单,WxPayDownloadBill中bill_date为必填参数
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayDownloadBill $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function downloadBill($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/downloadbill";
+		//检测必填参数
+		if(!$inputObj->IsBill_dateSet()) {
+			throw new WxPayException("对账单接口中,缺少必填参数bill_date!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		if(substr($response, 0 , 5) == "<xml>"){
+			return "";
+		}
+		return $response;
+	}
+	
+	/**
+	 * 提交被扫支付API
+	 * 收银员使用扫码设备读取微信用户刷卡授权码以后,二维码或条码信息传送至商户收银台,
+	 * 由商户收银台或者商户后台调用该接口发起支付。
+	 * WxPayWxPayMicroPay中body、out_trade_no、total_fee、auth_code参数必填
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayWxPayMicroPay $inputObj
+	 * @param int $timeOut
+	 */
+	public static function micropay($inputObj, $timeOut = 10)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/micropay";
+		//检测必填参数
+		if(!$inputObj->IsBodySet()) {
+			throw new WxPayException("提交被扫支付API接口中,缺少必填参数body!");
+		} else if(!$inputObj->IsOut_trade_noSet()) {
+			throw new WxPayException("提交被扫支付API接口中,缺少必填参数out_trade_no!");
+		} else if(!$inputObj->IsTotal_feeSet()) {
+			throw new WxPayException("提交被扫支付API接口中,缺少必填参数total_fee!");
+		} else if(!$inputObj->IsAuth_codeSet()) {
+			throw new WxPayException("提交被扫支付API接口中,缺少必填参数auth_code!");
+		}
+		
+		$inputObj->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']);//终端ip
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 撤销订单API接口,WxPayReverse中参数out_trade_no和transaction_id必须填写一个
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayReverse $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 */
+	public static function reverse($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/secapi/pay/reverse";
+		//检测必填参数
+		if(!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+			throw new WxPayException("撤销订单API接口中,参数out_trade_no和transaction_id必须填写一个!");
+		}
+		
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, true, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 测速上报,该方法内部封装在report中,使用时请注意异常流程
+	 * WxPayReport中interface_url、return_code、result_code、user_ip、execute_time_必填
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayReport $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function report($inputObj, $timeOut = 1)
+	{
+		$url = "https://api.mch.weixin.qq.com/payitil/report";
+		//检测必填参数
+		if(!$inputObj->IsInterface_urlSet()) {
+			throw new WxPayException("接口URL,缺少必填参数interface_url!");
+		} if(!$inputObj->IsReturn_codeSet()) {
+			throw new WxPayException("返回状态码,缺少必填参数return_code!");
+		} if(!$inputObj->IsResult_codeSet()) {
+			throw new WxPayException("业务结果,缺少必填参数result_code!");
+		} if(!$inputObj->IsUser_ipSet()) {
+			throw new WxPayException("访问接口IP,缺少必填参数user_ip!");
+		} if(!$inputObj->IsExecute_time_Set()) {
+			throw new WxPayException("接口耗时,缺少必填参数execute_time_!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetUser_ip($_SERVER['REMOTE_ADDR']);//终端ip
+		$inputObj->SetTime(date("YmdHis"));//商户上报时间	 
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		return $response;
+	}
+	
+	/**
+	 * 
+	 * 生成二维码规则,模式一生成支付二维码
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayBizPayUrl $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function bizpayurl($inputObj, $timeOut = 6)
+	{
+		if(!$inputObj->IsProduct_idSet()){
+			throw new WxPayException("生成二维码,缺少必填参数product_id!");
+		}
+		
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetTime_stamp(time());//时间戳	 
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		
+		return $inputObj->GetValues();
+	}
+	
+	/**
+	 * 
+	 * 转换短链接
+	 * 该接口主要用于扫码原生支付模式一中的二维码链接转成短链接(weixin://wxpay/s/XXXXXX),
+	 * 减小二维码数据量,提升扫描速度和精确度。
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayShortUrl $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function shorturl($inputObj, $timeOut = 6)
+	{
+		$url = "https://api.mch.weixin.qq.com/tools/shorturl";
+		//检测必填参数
+		if(!$inputObj->IsLong_urlSet()) {
+			throw new WxPayException("需要转换的URL,签名用原串,传输需URL encode!");
+		}
+		$inputObj->SetAppid(WxPayConfig::APPID);//公众账号ID
+		$inputObj->SetMch_id(WxPayConfig::MCHID);//商户号
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		
+		$inputObj->SetSign();//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut);
+		$result = WxPayResults::Init($response);
+		self::reportCostTime($url, $startTimeStamp, $result);//上报请求花费时间
+		
+		return $result;
+	}
+	
+ 	/**
+ 	 * 
+ 	 * 支付结果通用通知
+ 	 * @param function $callback
+ 	 * 直接回调函数使用方法: notify(you_function);
+ 	 * 回调类成员函数方法:notify(array($this, you_function));
+ 	 * $callback  原型为:function function_name($data){}
+ 	 */
+	public static function notify($callback, &$msg)
+	{
+		//获取通知的数据
+		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
+		//如果返回成功则验证签名
+		try {
+			$result = WxPayResults::Init($xml);
+		} catch (WxPayException $e){
+			$msg = $e->errorMessage();
+			return false;
+		}
+		
+		return call_user_func($callback, $result);
+	}
+	
+	/**
+	 * 
+	 * 产生随机字符串,不长于32位
+	 * @param int $length
+	 * @return 产生的随机字符串
+	 */
+	public static function getNonceStr($length = 32) 
+	{
+		$chars = "abcdefghijklmnopqrstuvwxyz0123456789";  
+		$str ="";
+		for ( $i = 0; $i < $length; $i++ )  {  
+			$str .= substr($chars, mt_rand(0, strlen($chars)-1), 1);  
+		} 
+		return $str;
+	}
+	
+	/**
+	 * 直接输出xml
+	 * @param string $xml
+	 */
+	public static function replyNotify($xml)
+	{
+		echo $xml;
+	}
+	
+	/**
+	 * 
+	 * 上报数据, 上报的时候将屏蔽所有异常流程
+	 * @param string $usrl
+	 * @param int $startTimeStamp
+	 * @param array $data
+	 */
+	private static function reportCostTime($url, $startTimeStamp, $data)
+	{
+		//如果不需要上报数据
+		if(WxPayConfig::REPORT_LEVENL == 0){
+			return;
+		} 
+		//如果仅失败上报
+		if(WxPayConfig::REPORT_LEVENL == 1 &&
+			 array_key_exists("return_code", $data) &&
+			 $data["return_code"] == "SUCCESS" &&
+			 array_key_exists("result_code", $data) &&
+			 $data["result_code"] == "SUCCESS")
+		 {
+		 	return;
+		 }
+		 
+		//上报逻辑
+		$endTimeStamp = self::getMillisecond();
+		$objInput = new WxPayReport();
+		$objInput->SetInterface_url($url);
+		$objInput->SetExecute_time_($endTimeStamp - $startTimeStamp);
+		//返回状态码
+		if(array_key_exists("return_code", $data)){
+			$objInput->SetReturn_code($data["return_code"]);
+		}
+		//返回信息
+		if(array_key_exists("return_msg", $data)){
+			$objInput->SetReturn_msg($data["return_msg"]);
+		}
+		//业务结果
+		if(array_key_exists("result_code", $data)){
+			$objInput->SetResult_code($data["result_code"]);
+		}
+		//错误代码
+		if(array_key_exists("err_code", $data)){
+			$objInput->SetErr_code($data["err_code"]);
+		}
+		//错误代码描述
+		if(array_key_exists("err_code_des", $data)){
+			$objInput->SetErr_code_des($data["err_code_des"]);
+		}
+		//商户订单号
+		if(array_key_exists("out_trade_no", $data)){
+			$objInput->SetOut_trade_no($data["out_trade_no"]);
+		}
+		//设备号
+		if(array_key_exists("device_info", $data)){
+			$objInput->SetDevice_info($data["device_info"]);
+		}
+		
+		try{
+			self::report($objInput);
+		} catch (WxPayException $e){
+			//不做任何处理
+		}
+	}
+
+	/**
+	 * 以post方式提交xml到对应的接口url
+	 * 
+	 * @param string $xml  需要post的xml数据
+	 * @param string $url  url
+	 * @param bool $useCert 是否需要证书,默认不需要
+	 * @param int $second   url执行超时时间,默认30s
+	 * @throws WxPayException
+	 */
+	private static function postXmlCurl($xml, $url, $useCert = false, $second = 30)
+	{		
+		$ch = curl_init();
+		//设置超时
+		curl_setopt($ch, CURLOPT_TIMEOUT, $second);
+		
+		//如果有配置代理这里就设置代理
+		if(WxPayConfig::CURL_PROXY_HOST != "0.0.0.0" 
+			&& WxPayConfig::CURL_PROXY_PORT != 0){
+			curl_setopt($ch,CURLOPT_PROXY, WxPayConfig::CURL_PROXY_HOST);
+			curl_setopt($ch,CURLOPT_PROXYPORT, WxPayConfig::CURL_PROXY_PORT);
+		}
+		curl_setopt($ch,CURLOPT_URL, $url);
+		curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE);
+		curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);//严格校验
+		//设置header
+		curl_setopt($ch, CURLOPT_HEADER, FALSE);
+		//要求结果为字符串且输出到屏幕上
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+	
+		if($useCert == true){
+			//设置证书
+			//使用证书:cert 与 key 分别属于两个.pem文件
+			curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
+			curl_setopt($ch,CURLOPT_SSLCERT, WxPayConfig::SSLCERT_PATH);
+			curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
+			curl_setopt($ch,CURLOPT_SSLKEY, WxPayConfig::SSLKEY_PATH);
+		}
+		//post提交方式
+		curl_setopt($ch, CURLOPT_POST, TRUE);
+		curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
+		//运行curl
+		$data = curl_exec($ch);
+		//返回结果
+		if($data){
+			curl_close($ch);
+			return $data;
+		} else { 
+			$error = curl_errno($ch);
+			curl_close($ch);
+			throw new WxPayException("curl出错,错误码:$error");
+		}
+	}
+	
+	/**
+	 * 获取毫秒级别的时间戳
+	 */
+	private static function getMillisecond()
+	{
+		//获取毫秒的时间戳
+		$time = explode ( " ", microtime () );
+		$time = $time[1] . ($time[0] * 1000);
+		$time2 = explode( ".", $time );
+		$time = $time2[0];
+		return $time;
+	}
+}
+

+ 59 - 0
data/api/wxpay/lib/WxPay.Config.php

@@ -0,0 +1,59 @@
+<?php
+/**
+* 	配置账号信息
+*/
+
+class WxPayConfig
+{
+	//=======【基本信息设置】=====================================
+	//
+	/**
+	 * TODO: 修改这里配置为您自己申请的商户信息
+	 * 微信公众号信息配置
+	 * 
+	 * APPID:绑定支付的APPID(必须配置,开户邮件中可查看)
+	 * 
+	 * MCHID:商户号(必须配置,开户邮件中可查看)
+	 * 
+	 * KEY:商户支付密钥,参考开户邮件设置(必须配置,登录商户平台自行设置)
+	 * 设置地址:https://pay.weixin.qq.com/index.php/account/api_cert
+	 * 
+	 * APPSECRET:公众帐号secert(仅JSAPI支付的时候需要配置, 登录公众平台,进入开发者中心可设置),
+	 * 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
+	 * @var string
+	 */
+	const APPID = 'wx24c5645aa986234a';
+	const MCHID = '1279745801';
+	const KEY = '0f86a4a9b1edb51b1a7d110fa223a157';
+	const APPSECRET = '41f93fef3207e917e742b9ebcd540cb2';
+	
+	//=======【证书路径设置】=====================================
+	/**
+	 * TODO:设置商户证书路径
+	 * 证书路径,注意应该填写绝对路径(仅退款、撤销订单时需要,可登录商户平台下载,
+	 * API证书下载地址:https://pay.weixin.qq.com/index.php/account/api_cert,下载之前需要安装商户操作证书)
+	 * @var path
+	 */
+	const SSLCERT_PATH = '../cert/apiclient_cert.pem';
+	const SSLKEY_PATH = '../cert/apiclient_key.pem';
+	
+	//=======【curl代理设置】===================================
+	/**
+	 * TODO:这里设置代理机器,只有需要代理的时候才设置,不需要代理,请设置为0.0.0.0和0
+	 * 本例程通过curl使用HTTP POST方法,此处可修改代理服务器,
+	 * 默认CURL_PROXY_HOST=0.0.0.0和CURL_PROXY_PORT=0,此时不开启代理(如有需要才设置)
+	 * @var unknown_type
+	 */
+	const CURL_PROXY_HOST = "0.0.0.0";//"10.152.18.220";
+	const CURL_PROXY_PORT = 0;//8080;
+	
+	//=======【上报信息配置】===================================
+	/**
+	 * TODO:接口调用上报等级,默认紧错误上报(注意:上报超时间为【1s】,上报无论成败【永不抛出异常】,
+	 * 不会影响接口调用流程),开启上报之后,方便微信监控请求调用的质量,建议至少
+	 * 开启错误上报。
+	 * 上报等级,0.关闭上报; 1.仅错误出错上报; 2.全量上报
+	 * @var int
+	 */
+	const REPORT_LEVENL = 1;
+}

Fichier diff supprimé car celui-ci est trop grand
+ 2984 - 0
data/api/wxpay/lib/WxPay.Data.php


+ 13 - 0
data/api/wxpay/lib/WxPay.Exception.php

@@ -0,0 +1,13 @@
+<?php
+/**
+ * 
+ * 微信支付API异常类
+ * @author widyhu
+ *
+ */
+class WxPayException extends Exception {
+	public function errorMessage()
+	{
+		return $this->getMessage();
+	}
+}

+ 85 - 0
data/api/wxpay/lib/WxPay.Notify.php

@@ -0,0 +1,85 @@
+<?php
+/**
+ * 
+ * 回调基础类
+ * @author widyhu
+ *
+ */
+class WxPayNotify extends WxPayNotifyReply
+{
+	/**
+	 * 
+	 * 回调入口
+	 * @param bool $needSign  是否需要签名输出
+	 */
+	final public function Handle($needSign = true)
+	{
+		$msg = "OK";
+		//当返回false的时候,表示notify中调用NotifyCallBack回调失败获取签名校验失败,此时直接回复失败
+		$result = WxpayApi::notify(array($this, 'NotifyCallBack'), $msg);
+		if($result == false){
+			$this->SetReturn_code("FAIL");
+			$this->SetReturn_msg($msg);
+			$this->ReplyNotify(false);
+			return;
+		} else {
+			//该分支在成功回调到NotifyCallBack方法,处理完成之后流程
+			$this->SetReturn_code("SUCCESS");
+			$this->SetReturn_msg("OK");
+		}
+		$this->ReplyNotify($needSign);
+	}
+	
+	/**
+	 * 
+	 * 回调方法入口,子类可重写该方法
+	 * 注意:
+	 * 1、微信回调超时时间为2s,建议用户使用异步处理流程,确认成功之后立刻回复微信服务器
+	 * 2、微信服务器在调用失败或者接到回包为非确认包的时候,会发起重试,需确保你的回调是可以重入
+	 * @param array $data 回调解释出的参数
+	 * @param string $msg 如果回调处理失败,可以将错误信息输出到该方法
+	 * @return true回调出来完成不需要继续回调,false回调处理未完成需要继续回调
+	 */
+	public function NotifyProcess($data, &$msg)
+	{
+		//TODO 用户基础该类之后需要重写该方法,成功的时候返回true,失败返回false
+		return true;
+	}
+	
+	/**
+	 * 
+	 * notify回调方法,该方法中需要赋值需要输出的参数,不可重写
+	 * @param array $data
+	 * @return true回调出来完成不需要继续回调,false回调处理未完成需要继续回调
+	 */
+	final public function NotifyCallBack($data)
+	{
+		$msg = "OK";
+		$result = $this->NotifyProcess($data, $msg);
+		
+		if($result == true){
+			$this->SetReturn_code("SUCCESS");
+			$this->SetReturn_msg("OK");
+		} else {
+			$this->SetReturn_code("FAIL");
+			$this->SetReturn_msg($msg);
+		}
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 回复通知
+	 * @param bool $needSign 是否需要签名输出
+	 */
+	final private function ReplyNotify($needSign = true)
+	{
+		//如果需要签名
+		if($needSign == true && 
+			$this->GetReturn_code($return_code) == "SUCCESS")
+		{
+			$this->SetSign();
+		}
+		WxpayApi::replyNotify($this->ToXml());
+	}
+}

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

@@ -6,9 +6,12 @@ $config = array();
 const test_srv_host = 'http://121.43.114.153';
 const stanley_host = 'http://192.168.1.131';
 const stanley_home = 'http://192.168.1.12';
+const stanley_host = 'http://192.168.1.105';
+const stanley_home = 'http://192.168.1.4';
 const boss_host = 'http://172.40.2.14';
 
-$SRV_HOST = stanley_host;
+const jeff_office = 'http://192.168.1.128';
+$SRV_HOST = jeff_office;
 
 $config['base_site_url']        = $SRV_HOST;
 $config['shop_site_url'] 		= $SRV_HOST.'/shop';
@@ -27,7 +30,7 @@ $config['version'] 		= '201502020388';
 $config['setup_date'] 	= '2015-08-22 15:52:34';
 $config['gip'] 			= 0;
 $config['dbdriver'] 	= 'mysqli';
-$config['tablepre']		= 'lrlz_';
+$config['tablepre']		= '33hao_';
 $config['db']['1']['dbhost']       = '127.0.0.1';
 $config['db']['1']['dbport']       = '3306';
 $config['db']['1']['dbuser']       = 'root';

+ 31 - 0
data/model/bonus_type.model.php

@@ -0,0 +1,31 @@
+<?php
+/**
+ * 红包类型模型
+ *
+
+ */
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class bonus_typeModel extends Model {
+    public function __construct()
+    {
+        parent::__construct('bonus_type');
+    }
+
+    public function getAll(){
+        return $this->select();
+    }
+
+    public function get($id){
+        return $this->where(array('type_id' => $id))->select();
+    }
+
+    public function save($data, &$id){
+        if($id > 0){
+            $this->where(array('type_id' => $id))->update($data);
+        }else{
+            $id = $this->insert($data);
+        }
+    }
+}

+ 39 - 0
data/model/user_bonus.model.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * ºì°üÄ£ÐÍ
+ *
+
+ */
+defined('InShopNC') or exit('Access Invalid!');
+class user_bonusModel extends Model {
+    public function __construct(){
+        parent::__construct('user_bonus');
+    }
+
+    public function load_file($content){
+        $lines = explode("\n", $content);
+        foreach($lines as $line){
+            $bonus = explode(',', trim($line));
+            $this->createBonus($bonus);
+        }
+    }
+
+    private function createBonus($bonus){
+        $bouns_sn = $this->generateSn();
+        $bonus_value = array(
+            'bonus_sn' => $bouns_sn,
+            'bonus_type_id' => 1,
+            'user_mobile' => $bonus[0],
+            'bonus_value' => $bonus[1]
+        );
+        $this->insert($bonus_value);
+    }
+
+    private function generateSn(){
+        $max_sn_rec = $this->field('MAX(bonus_sn) as max_sn')->select();
+        $max_sn = $max_sn_rec[0]['max_sn']? floor($max_sn_rec[0]['max_sn'] / 10000): 100000;
+
+        $bonus_sn = ($max_sn + 1) . str_pad(mt_rand(0, 9999), 4, '0', STR_PAD_LEFT);
+        return $bonus_sn;
+    }
+}

+ 3 - 3
mobile/api/payment/wxpay/lib/WxPay.pub.config.php

@@ -7,13 +7,13 @@ class WxPayConf_pub
 {
 	//=======【基本信息设置】=====================================
 	//微信公众号身份的唯一标识。审核通过后,在微信发送的邮件中查看
-	const APPID = 'wx181c8e7c3b271a9c';
+	const APPID = 'wx24c5645aa986234a';
 	//受理商ID,身份标识
-	const MCHID = '8f25b3730579f97cee0bb15ff02563ad';
+	const MCHID = '1279745801';
 	//商户支付密钥Key。审核通过后,在微信发送的邮件中查看
 	const KEY = 'e5f421ca4df74abcfa8451d7a3f8142e';
 	//JSAPI接口中获取openid,审核后在公众平台开启开发模式后可查看
-	const APPSECRET = '';
+	const APPSECRET = '41f93fef3207e917e742b9ebcd540cb2';
 	
 	//=======【JSAPI路径设置】===================================
 	//获取access_token过程中的跳转uri,通过跳转将code传入jsapi支付页面

+ 69 - 0
mobile/control/app_pay.php

@@ -0,0 +1,69 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 15/12/9
+ * Time: 上午12:25
+ */
+
+define(WXPAY_PATH,BASE_DATA_PATH.'/api/wxpay');
+require_once (WXPAY_PATH . '/lib/WxPay.Api.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Config.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Data.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Exception.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Notify.php');
+
+class app_payControl extends mobileHomeControl
+{
+
+    public function uniorderOp()
+    {
+//        $desc = $_POST['desc'];
+//        $attach = $_POST['attatch'];
+        $total_fee = 1;//intval($_POST['fee']) * 100;
+
+        $input = new WxPayUnifiedOrder();
+        $input->SetBody("test"); //商品或支付单简要描述
+        $input->SetAttach("test"); //附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
+        $input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis"));//商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号
+        $input->SetTotal_fee("1");//订单总金额,单位为分,详见支付金额
+        $input->SetTime_start(date("YmdHis")); //订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则
+        $input->SetTime_expire(date("YmdHis", time() + 600));//订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则
+        $input->SetGoods_tag("test");
+        $input->SetNotify_url("http://paysdk.weixin.qq.com/example/notify.php");
+        $input->SetTrade_type("APP");//JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里,MICROPAY--刷卡支付,刷卡支付有单独的支付接口,不调用统一下单接口
+        $order = WxPayApi::unifiedOrder($input);
+
+        $ret = $this->handle_order($order);
+
+        //$ret['sign'] = $order['sign'];
+        $ret['prepayid'] = $order['prepay_id'];
+        $ret['partnerid'] = WxPayConfig::MCHID;
+
+        joutput_data($ret);
+    }
+
+    private function handle_order($order)
+    {
+        $jsapi = new WxPayJsApiPay();
+        $jsapi->SetAppid($order["appid"]);
+        $timeStamp = time();
+        $jsapi->SetTimeStamp("$timeStamp");
+        $jsapi->SetNonceStr(WxPayApi::getNonceStr());
+        //$jsapi->SetPackage('Sign=WXPay');
+        $jsapi->SetPackage("prepay_id=" . $order['prepay_id']);
+        $jsapi->SetSignType("MD5");
+        //$sign = $jsapi->MakeSign();
+        $jsapi->SetSign();
+
+        $jsapi->SetPaySign($jsapi->MakeSign());
+
+        return $jsapi->GetValues();
+    }
+
+    public function notifyOp()
+    {
+
+    }
+}

+ 12 - 9
mobile/control/payment.php

@@ -36,18 +36,19 @@ class paymentControl extends mobileHomeControl{
     /**
      * 支付回调
      */
-    public function returnOp() {
+    public function returnOp()
+    {
         unset($_GET['act']);
         unset($_GET['op']);
         unset($_GET['payment_code']);
 
         $payment_api = $this->_get_payment_api();
-
         $payment_config = $this->_get_payment_config();
 
         $callback_info = $payment_api->getReturnInfo($payment_config);
 
-        if($callback_info) {
+        if($callback_info)
+        {
             //验证成功
             $result = $this->_update_order($callback_info['out_trade_no'], $callback_info['trade_no']);
             if($result['state']) {
@@ -69,7 +70,8 @@ class paymentControl extends mobileHomeControl{
     /**
      * 支付提醒
      */
-    public function notifyOp() {
+    public function notifyOp()
+    {
         // 恢复框架编码的post值
         $_POST['notify_data'] = html_entity_decode($_POST['notify_data']);
 
@@ -94,7 +96,6 @@ class paymentControl extends mobileHomeControl{
 		}
 
         //验证失败
-
         if($this->payment_code == 'wxpay'){
             echo '<xml><return_code><!--[CDATA[FAIL]]--></return_code></xml>';
             die;
@@ -135,7 +136,8 @@ class paymentControl extends mobileHomeControl{
     /**
      * 更新订单状态
      */
-    private function _update_order($out_trade_no, $trade_no) {
+    private function _update_order($out_trade_no, $trade_no)
+    {
         $model_order = Model('order');
         $logic_payment = Logic('payment');
 
@@ -174,7 +176,8 @@ class paymentControl extends mobileHomeControl{
 	/**
      * 支付回调
      */
-    public function wxpayreturnOp() {
+    public function wxpayreturnOp()
+    {
         unset($_GET['act']);
         unset($_GET['op']);
         unset($_GET['payment_code']);
@@ -205,7 +208,8 @@ class paymentControl extends mobileHomeControl{
     /**
      * 微信支付提醒
      */
-    public function wxpaynotifyOp() {
+    public function wxpaynotifyOp()
+    {
         // 恢复框架编码的post值
         $result_code= $_GET['result_code'] ;
         $out_trade_no=$_GET['out_trade_no'] ;
@@ -218,7 +222,6 @@ class paymentControl extends mobileHomeControl{
                 echo 'success';die;
             }
         }
-
         //验证失败
         echo "fail";die;
     }

+ 2 - 1
research_run.php

@@ -9,8 +9,9 @@ Base::run_test();
 
 
 //include BASE_ROOT_PATH . "/research/db.php";
-include BASE_ROOT_PATH . "/research/function_test.php";
+//include BASE_ROOT_PATH . "/research/function_test.php";
 //include BASE_ROOT_PATH . "/research/sms_test.php";
+include BASE_ROOT_PATH . "/research/wxpay.php";
 
 
 

+ 41 - 0
research/wxpay.php

@@ -0,0 +1,41 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 15/12/8
+ * Time: 下午10:53
+ */
+
+define(WXPAY_PATH,BASE_DATA_PATH.'/api/wxpay');
+require_once (WXPAY_PATH . '/lib/WxPay.Api.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Config.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Data.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Exception.php');
+require_once (WXPAY_PATH . '/lib/WxPay.Notify.php');
+
+//①、获取用户openid
+//$tools = new JsApiPay();
+//$openId = $tools->GetOpenid();
+
+//②、统一下单
+$input = new WxPayUnifiedOrder();
+$input->SetBody("test"); //商品或支付单简要描述
+$input->SetAttach("test"); //附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
+$input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis"));//商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号
+$input->SetTotal_fee("1");//订单总金额,单位为分,详见支付金额
+$input->SetTime_start(date("YmdHis")); //订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则
+$input->SetTime_expire(date("YmdHis", time() + 600));//订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则
+$input->SetGoods_tag("test");
+$input->SetNotify_url("http://paysdk.weixin.qq.com/example/notify.php");
+$input->SetTrade_type("APP");//JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里,MICROPAY--刷卡支付,刷卡支付有单独的支付接口,不调用统一下单接口
+//$input->SetOpenid($openId);
+$order = WxPayApi::unifiedOrder($input);
+
+echo $order;
+
+//echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
+//printf_info($order);
+//$jsApiParameters = $tools->GetJsApiParameters($order);
+//
+////获取共享收货地址js函数参数
+//$editAddress = $tools->GetEditAddressParameters();

+ 2 - 2
run.php

@@ -4,7 +4,7 @@
 define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
 
 require_once (BASE_ROOT_PATH . '/fooder.php');
-$gfcgi_run = 2;
+$gfcgi_run = 1;
 
 if($gfcgi_run == 0) { //模拟请求
     $file = BASE_ROOT_PATH . '/debug_run.php';
@@ -12,7 +12,7 @@ if($gfcgi_run == 0) { //模拟请求
     Base::mobile_init();
     Base::mobile_control();
 } elseif ($gfcgi_run == 1) {
-    $file = BASE_ROOT_PATH . '/research_run.php';   
+    $file = BASE_ROOT_PATH . '/research/research_run.php';
     include $file;
 } else {
     define('StartTime', microtime(true));

+ 1 - 1
shop/templates/default/seller/store_goods_add.step2.php

@@ -130,7 +130,7 @@
       <?php foreach ($output['spec_list'] as $k=>$val){?>
       <dl nc_type="spec_group_dl_<?php echo $i;?>" nctype="spec_group_dl" class="spec-bg" <?php if($k == '1'){?>spec_img="t"<?php }?>>
         <dt>
-          <input name="sp_name[<?php echo $k;?>]" type="text" class="text w60 tip2 tr" title="自定义规格类型名称,规格值名称最多不超过4个字" value="<?php if (isset($output['goods']['spec_name'][$k])) { echo $output['goods']['spec_name'][$k];} else {echo $val['sp_name'];}?>" maxlength="4" nctype="spec_name" data-param="{id:<?php echo $k;?>,name:'<?php echo $val['sp_name'];?>'}"/>
+          <input name="sp_name[<?php echo $k;?>]" type="text" class="text w60 tip2 tr" title="自定义规格类型名称,规格值名称最多不超过6个字" value="<?php if (isset($output['goods']['spec_name'][$k])) { echo $output['goods']['spec_name'][$k];} else {echo $val['sp_name'];}?>" maxlength="6" nctype="spec_name" data-param="{id:<?php echo $k;?>,name:'<?php echo $val['sp_name'];?>'}"/>
           <?php echo $lang['nc_colon']?></dt>
 
         <dd <?php if($k == '1'){?>nctype="sp_group_val"<?php }?>>