Przeglądaj źródła

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

root 9 lat temu
rodzic
commit
a3c195d7ae

+ 1 - 0
admin/control/bonus.php

@@ -81,6 +81,7 @@ class bonusControl extends SystemControl
                 $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'),
+                    3=>array('menu_key'=>'bonus_type_add_random','menu_name'=>'添加随机红包', 'menu_url'=>'index.php?act=bonus&op=bonus_type_add_random'),
                 );
                 break;
             case 'type':

+ 32 - 1
admin/templates/default/bonus.bonus_type_form.php

@@ -49,6 +49,8 @@
             <tr class="noborder">
                 <td class="required" colspan="2"><label class="validation" for="link_param">链接参数</label></td>
             </tr>
+
+
             <tr class="noborder">
                 <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>
@@ -66,6 +68,7 @@
             <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">
@@ -74,6 +77,8 @@
                 </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>
@@ -127,6 +132,10 @@
         $("#send_end_date").datepicker();
         $("#use_start_date").datepicker();
         $("#use_end_date").datepicker();
+        $("#pass_name").datepicker();
+        $("#h5").datepicker();
+        $("#h5_url").datepicker();
+
         $("#type_form").validate({
             errorPlacement: function(error, element){
                 error.appendTo(element.parent().parent().prev().find('td:first'));
@@ -162,6 +171,18 @@
                 use_end_date: {
                     required : true,
                     date      : false
+                },
+                _name: {
+                    required : true,
+                    date      : false
+                },
+                h5: {
+                    required : true,
+                    date      : false
+                },
+                h5_url: {
+                    required : true,
+                    date      : false
                 }
             },
             messages : {
@@ -178,7 +199,7 @@
                     required : '链接参数不能为空'
                 },
                 type_name: {
-                    required : '红包类型名称不能为空'
+                    required : '红包名称不能为空'
                 },
                 send_start_date: {
                     required : '开始发放时间不能为空'
@@ -191,10 +212,20 @@
                 },
                 use_end_date: {
                     required : '结束使用时间不能为空'
+                },
+                pass_name: {
+                    required : '发送者不能为空'
+                },
+                h5: {
+                    required : 'h5链接不能为空'
+                },
+                h5_url: {
+                    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");

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

@@ -15,6 +15,7 @@
             </ul>
         </div>
     </div>
+
     <div class="fixed-empty"></div>
     <table class="table tb-type2" id="prompt">
         <tbody>

+ 2 - 1
core/framework/function/goods.php

@@ -55,7 +55,8 @@ function thumb($goods = array(), $type = ''){
  * @param mixed $store_id 店铺ID 如果传入,则返回图片完整URL,如果为假,返回系统默认图
  * @return string
  */
-function cthumb($file, $type = '', $store_id = false) {
+function cthumb($file, $type = '', $store_id = false)
+{
     $type_array = explode(',_', ltrim(GOODS_IMAGES_EXT, '_'));
     if (!in_array($type, $type_array)) {
         $type = '240';

+ 1 - 1
core/framework/libraries/log.php

@@ -9,7 +9,7 @@ class Log
     const open_sql = true;
     const SQL = 1;
 
-    const cur_level = 1;
+    const cur_level = 2;
     const INFO = 2;
     const DEBUG = 3;
     const WARING = 4;

+ 3 - 2
crontab/crawl/fetch_goods.php

@@ -22,6 +22,7 @@ require_once (BASE_CRONTAB_PATH . '/crawl/upload_file.php');
 require_once (BASE_CRONTAB_PATH . '/crawl/upload_control.php');
 require_once (BASE_CRONTAB_PATH . '/crawl/tm_pagereq.php');
 require_once (BASE_CORE_PATH . '/framework/libraries/uploadfile.php');
+require_once (BASE_CRONTAB_PATH . '/crawl/skumatcher.php');
 
 date_default_timezone_set('Asia/Shanghai');
 
@@ -51,5 +52,5 @@ function not_null($str)
 //$spec = new spec_attr_parser();
 //$spec->proc();
 
-$importer = new product_importer();
-$importer->proc_shop();
+//$importer = new product_importer();
+//$importer->proc_shop();

+ 3 - 3
crontab/crawl/product_importer.php

@@ -298,7 +298,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'] = not_null($item['outer_id']);
+        $general['goods_serial_tm'] = not_null($item['outer_id']);
         $general['goods_addtime'] = strtotime($item['created']);
     }
 
@@ -463,7 +463,7 @@ class product_importer
             $goods = $general;
 
             $goods['goods_edittime'] = strtotime($item['modified']);
-            $goods['goods_serial'] = not_null($item['outer_id']);
+            $goods['goods_serial_tm'] = not_null($item['outer_id']);
             $goods['goods_price'] = $item['price'];
             $goods['goods_addtime'] = strtotime($item['created']);
             $goods['goods_storage'] = empty($item['quantity']) ? 0 : $item['quantity'];
@@ -493,7 +493,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'] = not_null($sku['outer_id']);
+                    $goods['goods_serial_tm'] = not_null($sku['outer_id']);
 
 
                     $gd_id = $this->mod_goods->addGoods($goods);

+ 85 - 0
crontab/crawl/skumatcher.php

@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 16/1/9
+ * Time: 下午1:35
+ */
+class skumatcher
+{
+    private $input_file;
+    private $good_file;
+    private $err_file;
+    private $mod_goods_common;
+    private $mod_goods;
+
+    public function __construct($input)
+    {
+        if(file_exists($input) == false) {
+            throw new Exception("no such file {$input}.");
+        }
+
+        $this->input_file = new SplFileObject($input);
+        $this->input_file->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);
+        $this->good_file = new SplFileObject("./good.csv","a");
+        $this->err_file = new SplFileObject("./err.csv","a");
+
+        $this->mod_goods_common = Model('goods_common');
+        $this->mod_goods = Model('goods');
+    }
+
+    public function proc()
+    {
+        foreach($this->input_file as $line)
+        {
+            $this->parase_one($line[0]);
+        }
+    }
+
+    private function match_item($name)
+    {
+        $items = $this->mod_goods_common->field('goods_commonid,goods_name')->where(array('goods_name' => $name))->select();
+        if(empty($items)) {
+            $con['goods_name'] = array('like',"%{$name}%");
+            $items = $this->mod_goods_common->field('goods_commonid,goods_name')->where($con)->select();
+        }
+        if(empty($items)) {
+            $len = mb_strlen($name);
+            $name_x = mb_substr($name,0,$len / 2);
+            $con['goods_name'] = array('like',"%{$name_x}%");
+            $items = $this->mod_goods_common->field('goods_commonid,goods_name')->where($con)->select();
+        }
+
+        return $items;
+    }
+
+    private function parase_one($name)
+    {
+        $items = $this->match_item($name);
+
+        if(empty($items)) {
+            $fields = array($name);
+            $this->err_file->fputcsv($fields,',');
+            return;
+        }
+        $goods_commonid = $items[0]['goods_commonid'];
+        $goods = $this->mod_goods->field('*')->where(array('goods_commonid' => $goods_commonid))->limit(false)->select();
+        if(empty(goods)) {
+            $fields = array($name);
+            $this->err_file->fputcsv($fields,',');
+            return;
+        }
+
+        foreach($goods as $val)
+        {
+            $fields = array($val['goods_name'],$val['goods_serial_tm'],$val['num_iid']);
+            $this->good_file->fputcsv($fields,',');
+        }
+    }
+}
+
+
+$matcher =  new skumatcher('/Users/stanley-king/Desktop/name.csv');
+$matcher->proc();
+

+ 2 - 2
data/api/smsapi/yuntx/CCPRestSDK.php

@@ -257,11 +257,11 @@ class REST {
         }else{ //xml格式
            $datas = simplexml_load_string(trim($result," \t\n\r"));
         }
-      //  if($datas == FALSE){
+        //  if($datas == FALSE) {
 //            $datas = new stdClass();
 //            $datas->statusCode = '172003';
 //            $datas->statusMsg = '返回包体错误'; 
-//        }
+//          }
         return $datas; 
     }
     

+ 16 - 6
data/logic/delivery.logic.php

@@ -9,8 +9,10 @@
  */
 
 defined('InShopNC') or exit('Access Invalid!');
-class deliveryLogic {
-    private static $appURL = 'http://oms.shtest.lrlz.com:49521/lrlzApiRest/router/rest';
+class deliveryLogic
+{
+    private static $appURL = 'http://223.4.48.187:30004/lrlzApiRest/router/rest';
+    //'http://oms.shtest.lrlz.com:49521/lrlzApiRest/router/rest';
 
     private static $appkey = '2015panda';
     private static $appPassWord = 'nEs5vu86JSjh89WPW4de2d3e87rwli3e8rw';
@@ -19,11 +21,16 @@ class deliveryLogic {
         return md5(self::$appkey . self::$appPassWord . json_encode($data));
     }
 
-    public function putOrder($pay_sn, $trade_no) {
+    public function putOrder($pay_sn, $trade_no)
+    {
+        Log::record(__FUNCTION__,Log::DEBUG);
+
         $order_list = Model('order')->getNormalOrderList(array('pay_sn'=> $pay_sn), $this->page, '*', 'order_id desc', '', array('order_address', 'order_goods'));
         $delivery_order_list = array();
-        foreach ($order_list as $order_info) {
-            if ($order_info['order_state'] === '20') {
+        foreach ($order_list as $order_info)
+        {
+            if ($order_info['order_state'] === '20')
+            {
                 $delivery_order = array();
                 $delivery_order['tid'] = $order_info['order_sn'];
                 $delivery_order['total_fee'] = $order_info['order_amount'];
@@ -50,7 +57,9 @@ class deliveryLogic {
                 $delivery_order['receiver_phone'] = $order_info['reciver_info']['tel_phone'];
                 $delivery_order['order_size'] = count($order_info['extend_order_goods']);
                 $delivery_order['orderList'] = array();
-                foreach($order_info['extend_order_goods'] as $key => $goods){
+
+                foreach($order_info['extend_order_goods'] as $key => $goods)
+                {
                     $delivery_goods = array();
                     $delivery_goods['oid'] =  $order_info['order_sn'] . $key;
                     $delivery_goods['tid'] =  $order_info['order_sn'];
@@ -70,6 +79,7 @@ class deliveryLogic {
         $sign = $this->_getSign($data);
         $headers = array('v_appkey: '.self::$appkey, 'v_sign: '.$sign, 'Content-Type: application/json');
         $result = json_decode($this->_http_json_post(self::$appURL, json_encode($data), $headers));
+        Log::record("post data={$result}",Log::DEBUG);
         return $result;
     }
 

+ 10 - 0
data/model/goods.model.php

@@ -658,6 +658,16 @@ class goodsModel extends Model
         return $goods_info;
     }
 
+    public function getGoodsStorageById($goods_id)
+    {
+        $goods_info = $this->getGoodsInfoByID($goods_id);
+        if (empty($goods_info)) {
+            return array();
+        }
+
+        return $goods_info['goods_storage'];
+    }
+
     /**
      * 查询出售中的商品列表及其促销信息
      * @param array $goodsid_array

+ 2 - 1
fcgi_run.php

@@ -28,6 +28,8 @@ function run_fcgi()
         try
         {
             init_request();
+            Log::record(request_helper::req_uri(),Log::DEBUG);
+
             $file = request_helper::script_file();
             if(file_exists($file))
             {
@@ -35,7 +37,6 @@ function run_fcgi()
                     echo("Content-Type: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8; charset=UTF-8\r\n\r\n");
                     include $file;
                 } else {
-                    Log::record($file,Log::DEBUG);
                     echo("Content-Type: text/html; charset=UTF-8\r\n\r\n");
                     Base::mobile_control();
                 }

+ 1 - 0
fooder.php

@@ -7,6 +7,7 @@ define('BASE_DATA_PATH',BASE_ROOT_PATH.'/data');
 define('BASE_MOBILE_PATH',BASE_ROOT_PATH.'/mobile');
 define('BASE_CRONTAB_PATH',BASE_ROOT_PATH.'/crontab');
 define('BASE_UPLOAD_PATH',BASE_DATA_PATH.'/upload');
+define('BASE_UTIL_PATH',BASE_ROOT_PATH.'/util');
 
 require_once(BASE_MOBILE_PATH . '/util/errcode.php');
 require_once(BASE_ROOT_PATH . '/request_helper.php');

+ 8 - 7
mobile/control/app_pay.php

@@ -31,7 +31,7 @@ class app_payControl extends mobileHomeControl
         $payment = $_GET['payment'];
 
         if (in_array($payment, self::$pay_types) == false) {
-            return joutput_error(errcode::ErrPayment, 'err paytype : wxpay,alipay');
+            return joutput_error(errcode::ErrPayment, "err paytype {$payment}: only for wxpay,alipay");
         }
 
         $logic_payment = Logic('payment');
@@ -46,6 +46,7 @@ class app_payControl extends mobileHomeControl
         joutput_data($ret);
     }
 
+    //订单查询借口
     public function orderqueryOp()
     {
         $pay_sn = $_GET['paysn'];
@@ -57,18 +58,17 @@ class app_payControl extends mobileHomeControl
             $input->SetOut_trade_no($pay_sn);
             $input->SetTransaction_id($tractid);
             $result = WxPayApi::orderQuery($input);
-            //wxLog::DEBUG("query:" . json_encode($result));
 
             if (array_key_exists("return_code", $result)
                 && array_key_exists("result_code", $result)
                 && $result["return_code"] == "SUCCESS"
-                && $result["result_code"] == "SUCCESS"
-            ) {
+                && $result["result_code"] == "SUCCESS")
+            {
                 return joutput_data($result);
             }
             return joutput_error(errcode::ErrPayment, '支付失败.');
         } else {
-            return joutput_error(errcode::ErrPayment, '错误的参数.');
+            return joutput_error(errcode::ErrPayment, "错误的参数:payment = {$payment}");
         }
     }
 
@@ -83,8 +83,9 @@ class app_payControl extends mobileHomeControl
 
         if ($payment == 'wxpay') {
             return $this->uniorder($subject, $pay_sn, 1);
-        } else if ($payment === 'alipay') {
-
+        }
+        else if ($payment === 'alipay')
+        {
             $ret = array();
 
             $ret['rsa_private'] = self::alipay_rsa_private;                 // 私钥

+ 0 - 2
mobile/control/control.php

@@ -23,7 +23,6 @@ class mobileControl
 	public function __construct() 
     {
         Language::read('mobile');
-
         //分页数处理
         $page = intval($_GET['page']);
         if($page > 0) {
@@ -61,7 +60,6 @@ class mobileMemberControl extends mobileControl
         $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)) {
-
             joutput_error('请登录', array('login' => '0'));
         } else {
             //读取卖家信息

+ 35 - 18
mobile/control/member_cart.php

@@ -1,4 +1,4 @@
-000000000000000<?php
+<?php
 /**
  * 我的购物车
  *
@@ -25,12 +25,15 @@ class member_cartControl extends mobileMemberControl
         $model_cart = Model('cart');
         $model_goods = Model('goods');
 
+
         $condition = array('buyer_id' => $this->member_info['member_id']);
         $cart_list	= $model_cart->listCart('db', $condition);
         $sum = 0;
-        foreach ($cart_list as $key => $value) {
+        foreach ($cart_list as $key => $value)
+        {
             $goods_id = $value['goods_id'];
             $goods_promotion = $model_goods->getGoodsInfoAndPromotionById($goods_id);
+            $goos_storage = $model_goods->getGoodsStorageById($goods_id);
             $promotion_type = '';
             $promotion_price = '0.00';
             if(!empty( $goods_promotion['groupbuy_info'])){
@@ -43,9 +46,12 @@ class member_cartControl extends mobileMemberControl
             }
             $goods_spec = unserialize($goods_promotion['goods_spec']);
             $goods_spec_array = array();
-            foreach ($goods_spec as $value) {
-                array_push($goods_spec_array, $value);
+
+            foreach ($goods_spec as $val) {
+                array_push($goods_spec_array, $val);
             }
+
+            $cart_list[$key]['goos_storage'] = $goos_storage;
             $cart_list[$key]['goods_spec'] = implode(',', $goods_spec_array);
             $cart_list[$key]['promotion_type'] = $promotion_type;
             $cart_list[$key]['promotion_price'] = $promotion_price;
@@ -109,11 +115,14 @@ class member_cartControl extends mobileMemberControl
         }
     }
 
-    public function cart_editOp(){
+    public function cart_editOp()
+    {
         $cart_list = explode(',', urldecode($_POST['cart_list']));
         $new_cart_list= array();
-        if (is_array($cart_list)) {
-            foreach ($cart_list as $value) {
+        if (is_array($cart_list))
+        {
+            foreach ($cart_list as $value)
+            {
                 if (preg_match_all('/^(\d{1,10})\|(\d{1,6})$/', $value, $match)) {
                     if (intval($match[2][0]) > 0) {
                         $new_cart_list[$match[1][0]] = $match[2][0];
@@ -125,34 +134,42 @@ class member_cartControl extends mobileMemberControl
             $condition = array('buyer_id' => $this->member_info['member_id']);
             $original_cart_list	= $model_cart->listCart('db', $condition);
             $quantity_error = array();
-            foreach ($original_cart_list as $key => $value) {
-                if(array_key_exists($value['cart_id'], $new_cart_list)){
+            foreach ($original_cart_list as $key => $value)
+            {
+                if(array_key_exists($value['cart_id'], $new_cart_list))
+                {
                     $quantity = intval($new_cart_list[$value['cart_id']]);
-                    if(intval($value['goods_num']) !== $quantity){
+                    if(intval($value['goods_num']) !== $quantity)
+                    {
                         if(!$this->_check_goods_storage($value, $quantity, $this->member_info['member_id'])) {
                             array_push($quantity_error, array('cart_id' => $value['cart_id'], 'quantity' => $quantity));
-                        }else{
+                        }
+                        else
+                        {
                             $data = array();
                             $data['goods_num'] = $quantity;
                             $update = $model_cart->editCart($data, array('cart_id'=> $value['cart_id']));
-                            if(!$update){
+                            if(!$update) {
                                 joutput_error(errcode::ErrCart, '购物车修改失败');
                                 return;
                             }
                         }
                     }
-                }else{
-                    $delete = $model_cart->delCart('db', array('cart_id'=>$cart_id));
-                    if(!$delete){
+                }
+                else
+                {
+                    $delete = $model_cart->delCart('db', array('cart_id'=>$value['cart_id']));
+                    if(!$delete) {
                         joutput_error(errcode::ErrCart, '购物车修改失败');
                         return;
                     }
                 }
             }
-            if(count($quantity_error) > 0){
+
+            if(count($quantity_error) > 0) {
                 joutput_data(array('result'=> '0', 'quantity_error' => $quantity_error));
-            }else{
-                joutput_data(array('result'=> '1'));
+            } else {
+                joutput_data(array('result' => '1'));
             }
         }else{
             joutput_error(errcode::ErrCart, '购物车列表格式错误');

+ 23 - 12
mobile/wxnotify.php

@@ -15,17 +15,15 @@ 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');
-
+require_once (BASE_DATA_PATH . '/logic/delivery.logic.php');
 
 //初始化日志
 $log_path = BASE_ROOT_PATH . "/logs/wx-".date('Y-m-d').'.log';
-echo($log_path);
 $logHandler= new CLogFileHandler(BASE_ROOT_PATH . "/logs/wx-".date('Y-m-d').'.log');
 $log = wxLog::Init($logHandler, 15);
 
-if(empty($log))
-{
-    echo('open file error <br>');
+if(empty($log)) {
+    Log::record('open file error',Log::ERR);
 }
 
 
@@ -49,29 +47,39 @@ if(empty($log))
 //<transaction_id><![CDATA[1002150763201512142078937308]]></transaction_id>
 //</xml>';
 
-try {
-    $content = request_helper::content();
-    wxLog::DEBUG($content ."\r\n");
+try
+{
+    $content = $_POST['original_querystring'];//request_helper::content();
+    wxLog::DEBUG("content = {$content}");
     $result = WxPayResults::Init($content);
-
     $ret_wx = array();
-
     $ret_code = $result['result_code'];
+    Log::record("result_code= {$ret_code}",Log::DEBUG);
+    wxLog::DEBUG("result_code= {$ret_code}");
     if($ret_code == 'SUCCESS')
     {
         $out_trade_no = $result['out_trade_no'];
         $transaction_id=$result['transaction_id'];
-        wxLog::DEBUG("out_trade_no=".$out_trade_no . " and transaction_id = " . $transaction_id);
+        wxLog::DEBUG("out_trade_no={$out_trade_no} and transaction_id = {$transaction_id}");
+        Log::record("out_trade_no={$out_trade_no} and transaction_id = {$transaction_id}",Log::DEBUG);
 
         $cb_info = app_payControl::update_order($out_trade_no,$transaction_id,'wxpay');
+
         if($cb_info['state'] == false) {
-            wxLog::ERROR('wxpay error.');
+            wxLog::ERROR('wxpay error 1.');
+            Log::record('wxpay error.',Log::DEBUG);
         } else {
             wxLog::DEBUG('wxpay success.');
+            Log::record('wxpay success.',Log::DEBUG);
+            $logic_delivery = Logic('delivery');
+            $ret = $logic_delivery->putOrder($out_trade_no, $transaction_id);
         }
+
         $ret_wx['return_code'] = 'SUCCESS';
         $ret_wx['return_msg'] = 'OK';
     } else {
+        Log::record('wxpay error 2.',Log::DEBUG);
+        wxLog::ERROR('wxpay error 2.');
         $ret_wx['return_code'] = 'FAIL';
         $ret_wx['return_msg'] = 'Error.';
     }
@@ -81,9 +89,12 @@ try {
     $xml = $retoper->ToXml();
 
     wxLog::DEBUG($xml);
+    Log::record("return to wx= {$xml}",Log::DEBUG);
 
     echo($xml);
 } catch (WxPayException $e){
+    Log::record($e->getTraceAsString(),Log::ERR);
+    wxLog::DEBUG($e->getTraceAsString());
     $msg = $e->errorMessage();
     return false;
 }

+ 9 - 11
request_helper.php

@@ -202,17 +202,14 @@ class request_helper
             'PATH_INFO',
             'ORIG_PATH_INFO');
 
-        foreach ($fields as $field) {
-
+        foreach ($fields as $field)
+        {
             try{
                 unset($_SERVER[$field]);
-                Log::record($field,Log::DEBUG);
                 $param = fcgi_getparam($field);
-
                 $_SERVER[$field] = $param;
-                Log::record("{$field} : {$_SERVER[$field]}", Log::DEBUG);
             } catch(Exception $e){
-                $y = $e;
+                Log::record($e->getTraceAsString(),Log::ERR);
             }
         }
     }
@@ -235,18 +232,19 @@ class request_helper
             $squery = request_helper::query_string();
         } else {
             $squery = request_helper::content();
-
-            Log::record("====BEGIN POST DATA====");
             Log::record($squery);
-            Log::record("====END POST DATA====");
         }
 
         if ($squery == '') {
             return;
+        } else {
+            $_GET['original_querystring'] = $squery;
+            $_POST['original_querystring'] = $squery;
         }
 
         $params = preg_split('/&|=/', $squery);
-        if ($method == 'get' || $method == 'post') {
+        if ($method == 'get' || $method == 'post')
+        {
             for ($i = 0; $i < count($params); ++$i) {
                 $key = $params[$i];
                 $val = $params[++$i];
@@ -259,7 +257,7 @@ class request_helper
 
 function init_request()
 {
-//    request_helper::fill_server();
+    request_helper::fill_server();
     request_helper::fill_param();
 }
 

+ 1 - 1
run.php

@@ -4,7 +4,7 @@
 define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
 
 require_once (BASE_ROOT_PATH . '/fooder.php');
-$gfcgi_run = 1;
+$gfcgi_run = 2;
 
 if($gfcgi_run == 0) { //模拟请求
     $file = BASE_ROOT_PATH . '/debug_run.php';

+ 8 - 13
shop/control/seller_login.php

@@ -33,9 +33,8 @@ class seller_loginControl extends BaseSellerControl
     public function loginOp()
     {
         $result = chksubmit(true,true,'num');
-
-        Log::record("1",Log::INFO);
-        if ($result){
+        if ($result)
+        {
             if ($result === -11){
                 showDialog('用户名或密码错误','','error');
             } elseif ($result === -12){
@@ -44,14 +43,12 @@ class seller_loginControl extends BaseSellerControl
         } else {
             showDialog('非法提交','','error');
         }
-        Log::record("2",Log::INFO);
 
         $model_seller = Model('seller');
         $seller_info = $model_seller->getSellerInfo(array('seller_name' => $_POST['seller_name']));
-        Log::record("3",Log::INFO);
+
         if($seller_info)
         {
-            Log::record("4",Log::INFO);
             $model_member = Model('member');
             $member_info = $model_member->getMemberInfo(
                 array(
@@ -61,7 +58,6 @@ class seller_loginControl extends BaseSellerControl
             );
             if($member_info)
             {
-                Log::record("5",Log::INFO);
                 // 更新卖家登陆时间
                 $model_seller->editSeller(array('last_login_time' => TIMESTAMP), array('seller_id' => $seller_info['seller_id']));
 
@@ -101,22 +97,21 @@ class seller_loginControl extends BaseSellerControl
                 $seller_menu = $this->getSellerMenuList($seller_info['is_admin'], explode(',', $seller_group_info['limits']));
                 $_SESSION['seller_menu'] = $seller_menu['seller_menu'];
                 $_SESSION['seller_function_list'] = $seller_menu['seller_function_list'];
-                if(!empty($seller_info['seller_quicklink'])) {
+                if(!empty($seller_info['seller_quicklink']))
+                {
                     $quicklink_array = explode(',', $seller_info['seller_quicklink']);
                     foreach ($quicklink_array as $value) {
                         $_SESSION['seller_quicklink'][$value] = $value ;
                     }
                 }
-                Log::record("6",Log::INFO);
                 $this->recordSellerLog('登录成功');
                 redirect('index.php?act=seller_center');
-                Log::record("7",Log::INFO);
             } else {
-                Log::record("8",Log::INFO);
                 showMessage('用户名密码错误', '', '', 'error');
             }
-        } else {
-            Log::record("9",Log::INFO);
+        }
+        else
+        {
             showMessage('用户名密码错误', '', '', 'error');
         }
     }

+ 20 - 0
util.php

@@ -0,0 +1,20 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 16/1/11
+ * Time: 下午12:43
+ */
+
+
+define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
+require_once (BASE_ROOT_PATH . '/fooder.php');
+require_once (BASE_UTIL_PATH . '/sku_mapper.php');
+
+
+define('StartTime', microtime(true));
+define('TIMESTAMP', time());
+Base::run_test();
+
+$skumapper = new sku_mapper();
+$skumapper->proc();

+ 45 - 0
util/sku_mapper.php

@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 16/1/11
+ * Time: 上午11:31
+ */
+class sku_mapper
+{
+    private $mod_sku_map;
+    private $mod_goods;
+    private $mod_goods_common;
+
+    public function __construct()
+    {
+        $this->mod_sku_map = Model('sku_map');
+        $this->mod_goods = Model('goods');
+        $this->mod_goods_common = Model('goods_common');
+    }
+
+    public function proc()
+    {
+        $skumap = $this->mod_sku_map->field('psku,tmsku')->limit(false)->select();
+
+        foreach($skumap as $row)
+        {
+            $tmsku = $row['tmsku'];
+            $psku = $row['psku'];
+
+            $ret = $this->mod_goods_common->where(array('goods_serial_tm' => $tmsku))->update(array('goods_serial' => $psku,'goods_state' => 1));
+            if($ret == false) {
+                Log::record("sku_mapper update common err: tmsku = {$tmsku},psku = {$psku}.",Log::ERR);
+                //continue;
+            }
+            $this->mod_goods->where(array('goods_serial_tm' => $tmsku))->update(array('goods_serial' => $psku,'goods_state' => 1));
+            if($ret == false) {
+                Log::record("sku_mapper update common err: tmsku = {$tmsku},psku = {$psku}.",Log::ERR);
+            }
+
+            Log::record("sku_mapper update success: tmsku = {$tmsku},psku = {$psku}.",Log::DEBUG);
+        }
+    }
+}
+