Kaynağa Gözat

add something

stanley-king 4 yıl önce
ebeveyn
işleme
1245344364

+ 2 - 2
conf/redis/6379.conf

@@ -40,7 +40,7 @@
 
 # By default Redis does not run as a daemon. Use 'yes' if you need it.
 # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize yes
+daemonize no
 
 # When running daemonized, Redis writes a pid file in /var/run/redis.pid by
 # default. You can specify a custom pid file location here.
@@ -106,7 +106,7 @@ loglevel notice
 # Specify the log file name. Also the empty string can be used to force
 # Redis to log on the standard output. Note that if you use standard
 # output for logging but daemonize, logs will be sent to /dev/null
-logfile /var/redis/redis.log
+logfile ./redis.log
 
 # To enable logging to the system logger, just set 'syslog-enabled' to yes,
 # and optionally update the other syslog parameters to suit your needs.

+ 2 - 2
core/framework/cache/cache.redis.php

@@ -30,7 +30,7 @@ class CacheRedis extends Cache
 	        $this->handler  = new Redis;
 	        $this->enable = $this->handler->$func($this->config['master']['host'], $this->config['master']['port']);
 	        $_cache = $this->handler;
-            //$_cache->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
+//            $_cache->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
     	}
     }
 
@@ -43,7 +43,7 @@ class CacheRedis extends Cache
 	        $this->handler = new Redis;
 	        $this->enable = $this->handler->$func($this->config['slave']['host'], $this->config['slave']['port']);
 	        $_cache = $this->handler;
-            //$_cache->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
+//            $_cache->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
     	}
     }
 

+ 2 - 2
core/framework/core/base.php

@@ -146,7 +146,7 @@ final class Base
 		$nc_config['db']['master'] = $nc_config['db'][1];
 		$setting_config = $nc_config;
 		$setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting',true);
-		$setting['shopnc_version'] = 'Copyright 2015</a>';
+		$setting['shopnc_version'] = 'Copyright 2020</a>';
 		$setting_config = array_merge_recursive($setting,$nc_config);
 	}
 
@@ -267,7 +267,7 @@ final class Base
 				throw new Exception("Class Error: {$class}.isn't exists!");
 			}
 		} elseif (!@include_once(BASE_CORE_PATH.'/framework/libraries/'.$class.'.php')){
-            throw new Exception("Class Error: {$class}.isn't exists!");
+            throw new Exception("Class Error: {$class} isn't exists!");
         }
 	}
 

+ 11 - 8
data/config/dev/base.ini.php

@@ -14,12 +14,12 @@ define('SERVER_TYPE','panda');
 //$SRV_HOST = 'https://www.xyzshops.cn';
 
 define('COOKIE_DOMAIN','192.168.1.200');
-$SRV_HOST = 'http://192.168.1.200';
-
-$config = [];
 
+$SRV_HOST = 'http://192.168.1.200';
 $REMOTE_IMG_HOST = $SRV_HOST;
 
+
+$config = [];
 $config['base_site_url']        = $SRV_HOST;
 $config['client_site_url']      = $SRV_HOST;
 $config['shop_site_url'] 		= $SRV_HOST.'/shop';
@@ -31,6 +31,7 @@ $config['mobile_site_url'] 		= $SRV_HOST.'/mobile';
 $config['wap_site_url'] 		= $SRV_HOST.'/wap';
 $config['chat_site_url'] 		= $SRV_HOST.'/chat';
 $config['node_site_url'] 		= 'http://127.0.0.1:8090';
+$config['delivery_site_url']    = $SRV_HOST.'/delivery';
 
 if(defined('USE_REMOTE_IMAGE') && USE_REMOTE_IMAGE == true) {
     $config['upload_site_url']		= $REMOTE_IMG_HOST.'/data/upload';
@@ -68,10 +69,14 @@ $config['thumb']['impath'] = '';
 
 $config['cache']['type'] 		= 'redis';
 $config['redis']['prefix']      	= 'nc_';
-$config['redis']['master']['host']     	= 'redisrv';
+$config['redis']['master']['host']     	= 'tcp://redisrv';
 $config['redis']['master']['port']     	= 6379;
 $config['redis']['master']['pconnect'] 	= 0;
-$config['redis']['slave']      	      = [];
+$config['redis']['slave']['host']     	= 'tcp://redisrv';
+$config['redis']['slave']['port']     	= 6379;
+$config['redis']['slave']['pconnect'] 	= 0;
+
+
 //$config['fullindexer']['open']      = false;
 //$config['fullindexer']['appname']   = '33hao';
 $config['debug'] 		      = false;
@@ -93,12 +98,10 @@ $config['sms']['password']     = '';
 $config['sms']['sessionKey']   = '';
 
 $config['queue']['open'] = true;
-$config['queue']['host'] = 'redisrv';
+$config['queue']['host'] = 'tcp://redisrv';
 $config['queue']['port'] = 6379;
 $config['cache_open']    = true;
-$config['delivery_site_url']    = $SRV_HOST.'/delivery';
 
 $config['return_address'] = ['address' => '上海市金山区朱吕公路7335号','name' => "大熊猫(丽帆供应链)",'tel_phone' => '17301603655','zip_code' => '201600'];
 $config['area_version'] = 5;
-
 $config['appjump_prefix'] = 'xyzshop://www.xyzshops.com';

+ 7 - 4
data/config/test/base.ini.php

@@ -28,6 +28,7 @@ $config['mobile_site_url'] 		= $SRV_HOST.'/mobile';
 $config['wap_site_url'] 		= $SRV_HOST.'/wap';
 $config['chat_site_url'] 		= $SRV_HOST.'/chat';
 $config['node_site_url'] 		= 'http://127.0.0.1:8090';
+$config['delivery_site_url']    = $SRV_HOST.'/delivery';
 
 if(defined('USE_REMOTE_IMAGE') && USE_REMOTE_IMAGE == true) {
     $config['upload_site_url']		= $REMOTE_IMG_HOST.'/data/upload';
@@ -65,10 +66,13 @@ $config['thumb']['impath'] = '';
 
 $config['cache']['type'] 		= 'redis';
 $config['redis']['prefix']      	= 'nc_';
-$config['redis']['master']['host']     	= 'tredisrv';
+$config['redis']['master']['host']     	= 'tcp://tredisrv';
 $config['redis']['master']['port']     	= 6379;
 $config['redis']['master']['pconnect'] 	= 0;
-$config['redis']['slave']      	      = [];
+$config['redis']['slave']['host']     	= 'tcp://tredisrv';
+$config['redis']['slave']['port']     	= 6379;
+$config['redis']['slave']['pconnect'] 	= 0;
+
 
 //$config['fullindexer']['open']      = false;
 //$config['fullindexer']['appname']   = '33hao';
@@ -92,10 +96,9 @@ $config['sms']['password']     = '';
 $config['sms']['sessionKey']   = '';
 
 $config['queue']['open'] = true;
-$config['queue']['host'] = 'tredisrv';
+$config['queue']['host'] = 'tcp://tredisrv';
 $config['queue']['port'] = 6379;
 $config['cache_open']    = true;
-$config['delivery_site_url']    = $SRV_HOST.'/delivery';
 $config['return_address'] = ['address' => '上海市金山区朱吕公路7335号','name' => "大熊猫(丽帆供应链)",'tel_phone' => '17301603655','zip_code' => '201600'];
 $config['area_version'] = 5;
 

+ 1 - 1
data/logic/payment.logic.php

@@ -84,7 +84,7 @@ class paymentLogic
             return callback(false, '该订单不存在');
         }
 
-        $order_info['subject'] = '虚拟订单_' . $order_sn;
+        $order_info['subject'] = '椰子订单_' . $order_sn;
         $order_info['order_type'] = 'vr_order';
         $order_info['pay_sn'] = $order_sn;
         //计算本次需要在线支付的订单总金额

+ 2 - 4
docker-compose-dev.yml

@@ -24,10 +24,10 @@ services:
       - "6379:6379"
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
-      - $PWD/conf/redis/6379.conf:/usr/local/etc/redis/redis.conf
+      - $PWD/conf/redis/6379.conf:/etc/redis/redis.conf
       - $PWD/conf/redis:/var/redis
     container_name: "panda-redis"
-    command: [ "redis-server"]
+    command: [redis-server,"/etc/redis/redis.conf"]
 
   mobilesrv:
     image: php-zts-debug:7.3.18
@@ -46,8 +46,6 @@ services:
     depends_on:
       - "redisrv"
       - "SearchSrv"
-    #docker run -it -v $PWD:/var/www/html -v $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini -p 9100:9100 --name mobilesrv  php-zts-debug:7.3.18
-    #spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -f "php /var/www/html/fcgi_run.php"
 
   fpmsrv:
       image: php-fpm:alpine

+ 2 - 2
docker-compose-test.yml

@@ -21,10 +21,10 @@ services:
     image: redis:alpine
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
-      - $PWD/conf/redis/6379.conf:/usr/local/etc/redis/redis.conf
+      - $PWD/conf/redis/6379.conf:/etc/redis/redis.conf
       - $PWD/conf/redis:/var/redis
     container_name: "xyztest-redis"
-    command: [ "redis-server"]
+    command: [ redis-server,"/etc/redis/redis.conf" ]
 
   tmobilesrv:
     image: php-zts-debug:7.3.18

+ 2 - 0
helper/activity/groupbuy.php

@@ -113,6 +113,8 @@ class groupbuy
 
             $common_id = commonid_helper::instance()->common_id($goods_id);
             $goods_ids = commonid_helper::instance()->goods_ids($common_id);
+            if($goods_ids == false) continue;
+
             foreach ($goods_ids as $tmp_id) {
                 self::add_goods_group($goodsidGroupIDS,$tmp_id,$gid);
             }

+ 0 - 29
helper/brand_helper.php

@@ -137,29 +137,6 @@ class brand_helper
         usort($alpha_list,['brand_helper','alpha_compare']);
 
         $brand_series = [];
-        if(defined('SERVER_TYPE') && SERVER_TYPE == 'car')
-        {
-            $i = 0;
-            while (true)
-            {
-                $start = $i * 1000;
-                $items = Model()->table('car_series')->field('*')->order('brand_id asc,series_id asc')->limit("{$start},1000")->select();
-                if (empty($items)) break;
-                $i++;
-
-                foreach ($items as $item)
-                {
-                    $brand_id    = intval($item['brand_id']);
-                    $series_id   = intval($item['series_id']);
-                    $series_name = $item['series_name'];
-                    if(!array_key_exists($brand_id,$brand_series)) {
-                        $brand_series[$brand_id] = [];
-                    }
-                    $brand_series[$brand_id][] = ['series_id' => $series_id,'series_name' => $series_name];
-                }
-            }
-        }
-
         $this->mAlphaList = [];
         foreach ($alpha_list as $item)
         {
@@ -169,12 +146,6 @@ class brand_helper
             $val['brand_logo'] = $item['brand_logo'];
             $val['brand_id'] = $item['brand_id'];
 
-            if(defined('SERVER_TYPE') && SERVER_TYPE == 'car') {
-                $brand_id   = intval($item['brand_id']);
-                $subs = $brand_series[$brand_id];
-                $val['subs'] = empty($subs) ? [] : $subs;
-            }
-
             $this->mAlphaList[] = $val;
         }
     }

+ 34 - 15
helper/calc_helper.php

@@ -50,6 +50,7 @@ class CalcPrice implements ICalc
             return false;
         }
     }
+
     private function order_num()
     {
         if($this->mUserId <= 0) return 0;
@@ -81,6 +82,15 @@ class CalcPrice implements ICalc
         }
     }
 
+    private function first_order($goods_id)
+    {
+        if($this->mOrderCount == 0) return false;
+
+        $share_policy = $this->share_policy($goods_id);
+
+        return empty($share_policy) ? false : $share_policy[0];
+    }
+
     public function left_invitees()
     {
         if($this->mUserId <= 0 || $this->mMemberInfo == null) {
@@ -221,14 +231,6 @@ class CalcPrice implements ICalc
 
     public function inviter_tips($goods_id)
     {
-//        $now = time();
-//        $nine = strtotime(date('Y-m-d',$now)) + 9*3600;
-//        $twenty_first = strtotime(date('Y-m-d',$now)) + 21*3600;
-//
-//        if($now < $nine || $now > $twenty_first) {
-//            return '试营业时间为9:00--21:00,其它时间会慢';
-//        }
-
         if($this->mCalcType == self::CalcTypeNormal || $this->mCalcType == self::CalcTypeInvitees)
         {
             $left_invitees = $this->left_invitees();
@@ -247,7 +249,7 @@ class CalcPrice implements ICalc
 
             if(empty($next)) {
                 $discount = $cur['discount'];
-                $tip = "您已领补贴{$discount}元";
+                $tip = "您已省{$discount}元,已经最优惠~";
             }
             else
             {
@@ -255,16 +257,23 @@ class CalcPrice implements ICalc
                 $discount = $next['discount'];
 
                 if(empty($cur)) {
-                    $tip = "成功分享{$count}人,可领补贴{$discount}元";
+                    $tip = "邀请{$count}人注册,可省{$discount}元";
                 }
                 else {
-                    $tip = "已领补贴{$cur['discount']}元,再分享{$count}人,可领补贴{$discount}元";
+                    $discount = $discount - $cur['discount'];
+                    $tip = "已省{$cur['discount']}元,再邀请{$count}人注册,还能省{$discount}元";
                 }
             }
 
-            return $tip;
-        } else {
-            return "";
+            return [$tip,true];
+        }
+        elseif($this->mCalcType == self::CalcTypeFirstOrder) {
+            $share_policy = $this->first_order($goods_id);
+            $tip = "已领新人优惠券,现在充值可省{$share_policy['discount']}元";
+            return [$tip,false];
+        }
+        else {
+            return ['',true];
         }
     }
 
@@ -283,10 +292,15 @@ class CalcPrice implements ICalc
             $price = $this->mUserCards->calc_price($goods_id, $goods_price);
             return ['price_des' => '会员价', 'accu_price' => round($price,2)];
         }
+        elseif(!empty($policy = $this->first_order($goods_id))) {
+            $this->mCalcType = self::CalcTypeFirstOrder;
+            $price = $policy['price'];
+            return ['price_des' => '优惠价', 'accu_price' => round($price,2)];
+        }
         elseif(!empty($policy = $this->select_invitees($goods_id))) {
             $this->mCalcType = self::CalcTypeInvitees;
             $price = $policy['price'];
-            return ['price_des' => '补贴价', 'accu_price' => round($price,2)];
+            return ['price_des' => '优惠价', 'accu_price' => round($price,2)];
         }
         else {
             $this->mCalcType = self::CalcTypeNormal;
@@ -323,6 +337,11 @@ class CalcPrice implements ICalc
             $goods_price = $this->goods_spec_amount($goods_id,$goods_price);
             return $this->mUserCards->calc_amount($goods_id, $goods_price * $num);
         }
+        elseif(!empty($policy = $this->first_order($goods_id))) {
+            $this->mCalcType = self::CalcTypeFirstOrder;
+            $price = $policy['price'];
+            return round($price * $num,2);
+        }
         elseif(!empty($policy = $this->select_invitees($goods_id))) {
             $this->mCalcType = self::CalcTypeInvitees;
             $price = $policy['price'];

+ 6 - 2
mobile/control/index.php

@@ -189,10 +189,14 @@ class indexControl extends specialControl
         }
 
         $ret['tips'] = $calctor->calc_tips();
-        foreach ($goods as $item) {
+        foreach ($goods as $item)
+        {
+            [$tip,$show_invite] = $calctor->inviter_tips($item['goods_id']);
+
             $ret['goods_inviter_tips'][] = [
                 'goods_id' => $item['goods_id'],
-                'tip' => $calctor->inviter_tips($item['goods_id'])];
+                'tip' => $tip,
+                'show_invite' => $show_invite];
         }
         $ret['inviter_tips'] = empty($ret['goods_inviter_tips']) ? '' : $ret['goods_inviter_tips'][0]['tip'];
         $ret['goods'] = $goods;

+ 34 - 2
mobile/control/member_invitee.php

@@ -62,12 +62,12 @@ class member_inviteeControl extends mbMemberControl
             $invitees = [];
 
             if($maxnum > $left_invitees) {
-                $result['tip_title'] = "邀请{$maxnum}好友,可以补贴{$amount}元";
+                $result['tip_title'] = "邀请{$maxnum}好友,可以{$amount}元";
                 $result['tip_num'] = $maxnum-$left_invitees;
                 $count = $left_invitees;
             }
             else {
-                $result['tip_title'] = "您已成功邀请{$maxnum}好友,下单后补贴{$amount}元";
+                $result['tip_title'] = "您已成功邀请{$maxnum}好友,下单即省{$amount}元";
                 $result['tip_num'] = 0;
                 $count = $maxnum;
             }
@@ -93,6 +93,8 @@ class member_inviteeControl extends mbMemberControl
                 }
             }
             $result['invitess'] = $invitees;
+            $result['mini_code'] = $this->mini_code();
+            $result['share_code'] = $this->share_code();
 
             return self::outsuccess($result);
         }
@@ -111,4 +113,34 @@ class member_inviteeControl extends mbMemberControl
         }
         return [$result,$item['num'],$item['discount']];
     }
+
+    private function mini_code()
+    {
+        $uid = session_helper::memberid();
+        $passwd = util::passwd;
+        $name = md5("{$uid}.{$passwd}") . ".png";
+        $save_path = BASE_UPLOAD_PATH . DS . ATTACH_MINI_QRCODE . DS . $name;
+        $url = UPLOAD_SITE_URL . DS . ATTACH_MINI_QRCODE . DS . $name;
+
+        if(!file_exists($save_path)) {
+            QueueClient::push('makeMemberMiniQrCode',['member_id' => $uid]);
+            return '';
+        }
+        return $url;
+    }
+    private function share_code()
+    {
+        $uid = session_helper::memberid();
+        $passwd = util::passwd;
+        $name = md5("{$uid}.{$passwd}") . ".png";
+        $name = "share-{$name}";
+
+        $save_path = BASE_UPLOAD_PATH . DS . ATTACH_MINI_QRCODE . DS . $name;
+        $url = UPLOAD_SITE_URL . DS . ATTACH_MINI_QRCODE . DS . $name;
+
+        if(!file_exists($save_path)) {
+            QueueClient::push('makeMemberMiniQrCode',['member_id' => $uid]);
+        }
+        return $url;
+    }
 }