stanley-king vor 8 Jahren
Ursprung
Commit
bb93f80882

+ 9 - 14
data/resource/phpqrcode/index.php

@@ -22,17 +22,12 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-class PhpQRCode{
-    
+class PhpQRCode
+{
 	//processing form input
 	//remember to sanitize user input in real-life solution !!!
 	private $errorCorrectionLevel = 'H';		// L M Q H
-	
-	
-	
 	private $matrixPointSize = 3;				// 1 2 3 4 5 6 7 8 9 10
-	
-	
 	private $date = 'shopnc';
 	
 	
@@ -51,13 +46,14 @@ class PhpQRCode{
 	    include "qrlib.php";
 	}
 	
-    public function init(){
+    public function init()
+    {
 	    //ofcourse we need rights to create temp dir
 	    if (!file_exists($this->pngTempDir))
 	        mkdir($this->pngTempDir);
 	
-	    if ($this->date != 'shopnc') { 
-	            
+	    if ($this->date != 'shopnc')
+	    {
 	        // user data
 	        if ($this->pngTempName != '') {
 	            $filename = $this->pngTempDir.$this->pngTempName;
@@ -66,8 +62,8 @@ class PhpQRCode{
 	        }
 	        QRcode::png($this->date, $filename, $this->errorCorrectionLevel, $this->matrixPointSize, 2);    
 	        
-	    } else {    
-	    
+	    }
+	    else {
 	        //default data
 	        QRcode::png('http://www.baidu.com', $filename, $this->errorCorrectionLevel, $this->matrixPointSize, 2);    
 	        
@@ -75,7 +71,6 @@ class PhpQRCode{
 	        
 	    //display generated file
 	    return basename($filename);
-	    
-	    QRtools::timeBenchmark();    
+	    //QRtools::timeBenchmark();
 	}
 }

+ 19 - 15
helper/fcgi_server.php

@@ -52,23 +52,27 @@ class fcgi_server
             }
         }
     }
-
-    private function do_clear($ar)
-    {
-        if(isset($ar) && is_array($ar))
-        {
-            foreach($ar as $key=>$value) {
-                unset($ar[$key]);
-            }
-
-        }
-    }
+//    private function do_clear($ar)
+//    {
+//        if(isset($ar) && is_array($ar))
+//        {
+//            foreach($ar as $key=>$value) {
+//                unset($ar[$key]);
+//            }
+//
+//        }
+//    }
     private function clear_global()
     {
-        $this->do_clear($_SESSION);
-        $this->do_clear($_COOKIE);
-        $this->do_clear($_POST);
-        $this->do_clear($_GET);
+        $_SESSION = [];
+        $_COOKIE = [];
+        $_POST = [];
+        $_GET = [];
+
+//        $this->do_clear($_SESSION);
+//        $this->do_clear($_COOKIE);
+//        $this->do_clear($_POST);
+//        $this->do_clear($_GET);
     }
 
     public function run_looper()

+ 72 - 4
mobile/control/member_bonus.php

@@ -18,7 +18,6 @@ require_once (BASE_ROOT_PATH . '/helper/search/util.php');
 require_once (BASE_ROOT_PATH . '/helper/search_param.php');
 require_once (BASE_ROOT_PATH . '/helper/goods_helper.php');
 
-
 class member_bonusControl extends mbMemberControl
 {
     private $mPred;
@@ -466,7 +465,78 @@ class member_bonusControl extends mbMemberControl
 
     public function topupOp()
     {
-        return self::outerr(errcode::ErrBonus,"APP版本太旧了,请升级到最新版本.");
+        $items = $this->mPred->topup_bonus($_SESSION['member_mobile']);
+        if($items === false) {
+            return self::outsuccess(array("count" => 0,'total_amount' => 0.00));
+        }
+        else
+        {
+            $total_amount = 0.00;
+            $max_rate = 0;
+            $max_share = 0;
+
+            $result = [];
+            foreach ($items as $item)
+            {
+                $bonus = \bonus\user_bonus::create_by_param($item);
+                $type = \bonus\type::create_by_sn($bonus->type_sn());
+                $user_id = $type->sender_id();
+                $member = new member_info($user_id);
+                $avatar = $member->avatar();
+
+                if($type->binded_over() == false && $type->getTotal_num())
+                {
+                    $share_num = $type->getTotal_num() - $type->binded_num();
+                    if($max_share < $share_num) {
+                        $result['max_share']['avatar'] = $avatar;
+                        $result['max_share']['count']  = $share_num;
+                        $result['max_share']['total_amount'] = $type->getTotal_amount();
+                        $result['max_share']['rate'] = $type->bonus_rate();
+                        $result['max_share']['type_sn'] = $type->getType_sn();
+                        $max_share = $share_num;
+                    }
+                }
+
+                $rate = $bonus->bonus_rate();
+                if ($max_rate < $rate)
+                {
+                    $result['max_rate']['avatar'] = $avatar;
+                    $result['max_rate']['rate'] = $rate;
+                    $result['max_rate']['type_sn'] = $type->getType_sn();
+                    $max_rate = $rate;
+                }
+                $total_amount += doubleval($item['bonus_value']);
+            }
+            $result['max_rate']['total_amount'] = $total_amount;
+            $result['max_rate']['count'] = count($items);
+
+            if(!empty($result['max_share'])) {
+                $info = $result['max_share'];
+                $count = intval($info['count']);
+                $title = "恭喜获得{$count}个红包";
+                $sub_title = "分享给小伙伴,大家一起抢。";
+                $btn_type  = 'send';
+                $btn_title = '发红包';
+            } else {
+                $info = $result['max_rate'];
+                $count = intval($info['count']);
+                $total_amount = $info['total_amount'];
+                $title = "您领了{$count}个,共{$total_amount}元的红包.";
+                $sub_title = "已帮你纳入\"我的红包\"中。";
+                $btn_type  = 'detail';
+                $btn_title = '查看详情';
+            }
+
+            $detail_url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=detail&client_type=wap&type_sn={$info['type_sn']}";
+            return self::outsuccess(array("count" => $count, 'total_amount' => $info['total_amount'],
+                'title' => $title,'sub_title' => $sub_title,
+                'avatar' => $info['avatar'],
+                'rate' => $info['rate'],
+                'type_sn' => $info['type_sn'],
+                'btn_type' => $btn_type,
+                'btn_title' => $btn_title,
+                'detail_url' => $detail_url));
+        }
     }
 
     public function topupexOp()
@@ -874,8 +944,6 @@ class member_bonusControl extends mbMemberControl
         $pages = $this->pages($count);
         return $type_infos;
     }
-
-
 }
 
 class tpl_invite

+ 19 - 0
mobile/control/member_info.php

@@ -6,6 +6,7 @@ defined('InShopNC') or exit('Access Invalid!');
 require_once(BASE_ROOT_PATH . '/helper/text_filter.php');
 require_once(BASE_ROOT_PATH . '/helper/FileUploader.php');
 require_once(BASE_ROOT_PATH . '/helper/relation_helper.php');
+require_once(BASE_RESOURCE_PATH . '/phpqrcode/index.php');
 
 
 class member_infoControl extends mbMemberControl
@@ -201,6 +202,24 @@ class member_infoControl extends mbMemberControl
             return self::outsuccess(NULL);
         }
     }
+    public function qrcodeOp()
+    {
+        $member_id = $_SESSION['member_id'];
+        $path = DS.ATTACH_MALBUM.DS.$member_id.DS;
+        $name = "{$member_id}.png";
+        $save_path = BASE_UPLOAD_PATH . $path;
+        if (!file_exists($save_path)) {
+            $PhpQRCode = new PhpQRCode();
+            $PhpQRCode->set('pngTempDir', $save_path);
+            $url = BASE_SITE_URL;
+            $PhpQRCode->set('date',$url);
+            $PhpQRCode->set('pngTempName',$name);
+            $PhpQRCode->init();
+        }
+
+        $url = UPLOAD_SITE_URL . $path . $name;
+        return self::outsuccess(['url' => $url]);
+    }
 
     /**
      * 微信绑定