Charlie 8 years ago
parent
commit
928ca2a0ac

+ 1 - 1
webshell/SyncCodeDev.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
-DEPLOY_DIR=/data/yiguanjia-php
+DEPLOY_DIR=/data/php
 if [ ! -d $DEPLOY_DIR ] ; then
 echo >&2 "fatal: post-receive: DEPLOY_DIR_NOT_EXIST: \"$DEPLOY_DIR\""
 exit 1

+ 1 - 1
webshell/dailyAnalys.sh

@@ -1,3 +1,3 @@
 #! /bin/bash
-cd /data/wozhua/www/protected
+cd /data/php/www/protected
 /usr/local/php/bin/php yiic dailyanalys

+ 1 - 1
webshell/hourlyWork.sh

@@ -1,4 +1,4 @@
 #! /bin/bash
-cd /data/yiguanjia-php/www/protected
+cd /data/php/www/protected
 /usr/local/php/bin/php yiic hourlywork
 /usr/local/php/bin/php yiic dealvideoconv

+ 1 - 1
webshell/pushListener.sh

@@ -1,3 +1,3 @@
 #! /bin/bash
-cd /data/yiguanjia-php/www/protected
+cd /data/php/www/protected
 /usr/local/php/bin/php yiic pushlistener

+ 1 - 1
www/js/hybrid.js

@@ -82,7 +82,7 @@ function do_login(res){
 }
 //分享
 function do_share(opts){
-    var share_img = 'http://www.wozhua.mobi/images/logo.png';
+    var share_img = 'http://www.yiguanjia.me/images/logo.png';
     var share_str = '';
     var share_url = '';
     var title = '';

+ 1 - 1
www/protected/commands/AsyncWorkCommand.php

@@ -123,7 +123,7 @@ class AsyncWorkCommand extends CConsoleCommand{
                         $tech = TechInfo::get(intval($order->technician));
                         if ($tech->weixin_userid) {
                             $wechat = O2oApp::getWechatActive();
-                            $url_prefix = ENVIRONMENT == 'product' ? 'http://api.wozhua.mobi' : 'http://apitest.wozhua.mobi';
+                            $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
                             $wechat_data = [
                                 'touser' => $tech->weixin_userid,
                                 'msgtype' => 'news',

+ 2 - 2
www/protected/commands/GiveCouponsCommand.php

@@ -43,7 +43,7 @@ class GiveCouponsCommand extends CConsoleCommand{
                         if(isset($address['mobile'])){
                             $status = $cache->get('sendsms_'.$address['mobile']);
                             if(!$status){
-                                $sms_data['tpl'] = '【壹管家宠物】送你60元代金券,可用于全部上门服务,下单立减→http://t.cn/R2DKttW 回T退订';
+                                $sms_data['tpl'] = '【壹管家宠物】送你60元代金券,可用于全部上门服务,下单立减→http://t.cn/ 回T退订';
                                 $sms_data['mobile'] = $address['mobile'];
                                 $list = new ARedisList('send_sms_list');
                                 $list->push(json_encode($sms_data));
@@ -54,7 +54,7 @@ class GiveCouponsCommand extends CConsoleCommand{
                 }else{
                     $data = array();
                     $time_str = CommonFn::sgmdate("Y年n月d日", time(),1);
-                    $data['content'] = '送你60元代金券,可用于全部上门服务,下单立减→<a href="http://www.wozhua.mobi/index.php?r=o2o/web/index&need_header=0">点击这里</a>预约';
+                    $data['content'] = '送你60元代金券,可用于全部上门服务,下单立减→<a href="http://common.yiguanjia.me/index.php?r=o2o/web/index&need_header=0">点击这里</a>预约';
                     $data['title'] = '系统通知';
                     $data['custom'] = array(
                         'type'=>'user_status',

+ 1 - 10
www/protected/commands/MobileAnalysCommand.php

@@ -4,16 +4,7 @@ class MobileAnalysCommand extends CConsoleCommand{
         error_reporting(E_ALL);
         ini_set('memory_limit', '1024M');
         set_time_limit(0);
-        // $mongo = new MongoClient(DB_CONNETC);
-        // $cursor=$mongo->wozhua_o2o->customers->find(array('province' => '上海','name'=>array('$ne' => '')));
-        // file_put_contents(APP_PATH.'/download/no_reg_user.csv',"姓名,手机号,地址\r\n");
-        // foreach ($cursor as $key => $value) {
-        //     $cache = new ARedisCache();
-        //     $status = $cache->get('sendsms_'.$value['mobile']);
-        //     if(!$status){
-        //         file_put_contents(APP_PATH.'/download/no_reg_user.csv',$value['name'].",".$value['mobile'].','.$value['address']."\r\n",FILE_APPEND);
-        //     }
-        // }
+
         $file = file_get_contents('d://no_reg_user.csv');
         $info_arr = explode("\r\n",$file);
         foreach ($info_arr as $key => $value) {

+ 3 - 3
www/protected/commands/SendSMSCommand.php

@@ -23,10 +23,10 @@ class SendSMSCommand extends CConsoleCommand{
             $user_info = explode("----", $value);
             if(preg_match("/\d{11}/", $user_info[1])){
                 $user_info[1] = trim($user_info[1]);
-                $result = $smsservice->send_sms('【壹管家宠物】炎热酷暑,清凉一夏,下载壹管家APP即获248元优惠大礼包,狗狗上门洗护仅10元起,有效期至6.30日,猛戳 http://dwz.cn/wozhua,回T退订',$user_info[1]);
+                $result = $smsservice->send_sms('【壹管家宠物】炎热酷暑,清凉一夏,下载壹管家APP即获248元优惠大礼包,狗狗上门洗护仅10元起,有效期至6.30日,猛戳 http://dwz.cn,回T退订',$user_info[1]);
                 if($i==1000){
-                    $result = $smsservice->send_sms('【壹管家宠物】炎热酷暑,清凉一夏,下载壹管家APP即获248元优惠大礼包,狗狗上门洗护仅10元起,有效期至6.30日,猛戳 http://dwz.cn/wozhua,回T退订','18521093629');
-                    $result = $smsservice->send_sms('【壹管家宠物】炎热酷暑,清凉一夏,下载壹管家APP即获248元优惠大礼包,狗狗上门洗护仅10元起,有效期至6.30日,猛戳 http://dwz.cn/wozhua,回T退订','18817554864');
+                    $result = $smsservice->send_sms('【壹管家宠物】炎热酷暑,清凉一夏,下载壹管家APP即获248元优惠大礼包,狗狗上门洗护仅10元起,有效期至6.30日,猛戳 http://dwz.cn,回T退订','18521093629');
+                    $result = $smsservice->send_sms('【壹管家宠物】炎热酷暑,清凉一夏,下载壹管家APP即获248元优惠大礼包,狗狗上门洗护仅10元起,有效期至6.30日,猛戳 http://dwz.cn,回T退订','18817554864');
                 }
                 echo $i++;
                 echo iconv('utf-8', 'gbk', $result);

+ 5 - 388
www/protected/components/CommonFn.php

@@ -199,15 +199,7 @@ class CommonFn
         } else {
             $tmp_str = json_encode($res);
         }
-        ob_start();
-        $tmp_str = str_replace('wozhua-pics.qiniudn.com','odulvej8l.bkt.clouddn.com',$tmp_str);
-        $tmp_str = str_replace('wozhua-avatars.qiniudn.com','odulcd8g1.bkt.clouddn.com',$tmp_str);
-        //$tmp_str = str_replace('wozhua-icons.qiniudn.com','odug4508u.bkt.clouddn.com',$tmp_str);
-        $tmp_str = str_replace('wozhua-icons.qiniudn.com','oduj3utzz.bkt.clouddn.com',$tmp_str);
-        //$tmp_str = str_replace('wozhua-voice.qiniudn.com','7pn5mi.com2.z0.glb.qiniucdn.com',$tmp_str);
-        $tmp_str = str_replace('wozhua-video.qiniudn.com','odulfeiql.bkt.clouddn.com',$tmp_str);
-        //$tmp_str = str_replace('wozhua-test.qiniudn.com','odufxpjo7.bkt.clouddn.com',$tmp_str);
-        $tmp_str = str_replace('wozhua-test.qiniudn.com','odujh0tsx.bkt.clouddn.com',$tmp_str);
+ 
         echo $tmp_str;
         exit();
     }
@@ -451,15 +443,6 @@ class CommonFn
         }
     }
 
-    public static function isDeviceId($char){
-        if(preg_match('/\d{14,16}/',$char)){
-            return true;
-        }elseif (preg_match('/\S{8}-\S{4}-\S{4}-\S{4}-\S{12}/',$char)) {
-            return true;
-        }else{
-            return false;
-        }
-    }
     
     //检查图标和图片的格式
     public static function checkPicFormat($pic){
@@ -792,127 +775,7 @@ class CommonFn
         }   
     }
 
-    /**
-     * 内容合法性检测
-     * @author   >
-     *@param array $data 内容数组,包含需要检测的数据
-     * 示例:$data = array(
-     *                                'content'=>'呵呵呵呵',
-     *                                'pics'=>array(‘http:xxxxxx.jpg’,'jkkkk.jpg'),
-     *                           );
-     *@param string $type 按何类型检测  
-     */
-    public static function checkContent($data,$type){
-        if($type=='topic' || $type == 'post'){
-            // $data['content'] = preg_replace(array('/\[.*?\]/','/(沙发|顶)/'),'',$data['content']);
-            $data['content'] = urlencode($data['content']);
-            $data['content'] = preg_replace("/(%7E|%60|%21|%40|%23|%24|%25|%5E|%26|%27|%2A|%28|%29|%2B|%7C|%5C|%3D|\-|_|%5B|%5D|%7D|%7B|%3B|%22|%3A|%3F|%3E|%3C|%2C|\.|%2F|%A3%BF|%A1%B7|%A1%B6|%A1%A2|%A1%A3|%A3%AC|%7D|%A1%B0|%A3%BA|%A3%BB|%A1%AE|%A1%AF|%A1%B1|%A3%FC|%A3%BD|%A1%AA|%A3%A9|%A3%A8|%A1%AD|%A3%A4|%A1%A4|%A3%A1|%E3%80%82|%EF%BC%81|%EF%BC%8C|%EF%BC%9B|%EF%BC%9F|%EF%BC%9A|%E3%80%81|%E2%80%A6%E2%80%A6|%E2%80%9D|%E2%80%9C|%E2%80%98|%E2%80%99)+/",'',$data['content']);
-            $data['content'] = urldecode($data['content']);
-        }
-        
-        if($type=='topic'){
-            // if(empty($data['pics']) && empty($data['video'])){
-                if(mb_strlen($data['content'],'utf-8') > Yii::app()->params['limit_conf']['topic_words_max']){
-                    return '发帖字数超长';
-                }elseif(mb_strlen($data['content'],'utf-8')<Yii::app()->params['limit_conf']['topic_words_min'] && mb_strlen($data['content'],'utf-8')>=0){
-                    return '帖子最少要有4个字哦';
-                }
-            // }
-            //判断图片是否合法
-            if(!empty($data['pics'])){
-                foreach ($data['pics'] as $value) {
-                    if(!is_array($value)||empty($value['url'])||empty($value['width'])||empty($value['height'])){
-                        return '上传的图片好像出了点问题呢';
-                    }
-                }
-            }
-            //判断视频是否合法
-            if(!empty($data['video'])){
-                if(!is_array($data['video'])||empty($data['video']['url'])||empty($data['video']['length'])){
-                    return '上传的视频好像出了点问题呢';
-                }
-            }
-            return true;
-        }elseif ($type=='post') {
-            $status = 0;
-            foreach ($data as  $value) {
-                if(!empty($value)){
-                    $status+=1;
-                }
-            }
-            if($status<1){
-                return '内容不合法';
-            }
-            if(!empty($data['content'])){
-                if(mb_strlen($data['content'],'utf-8')>Yii::app()->params['limit_conf']['post_words_max']){
-                    return '回复太长了呢';
-                }
-                if(mb_strlen($data['content'],'utf-8')<Yii::app()->params['limit_conf']['post_words_min']){
-                    return '回复最少要有2个字哦';
-                }
-
-            }
-            //判断图片是否合法
-            if(!empty($data['pics'])){
-                foreach ($data['pics'] as $value) {
-                    if(!is_array($value)||empty($value['url'])||empty($value['width'])||empty($value['height'])){
-                        return '上传的图片好像出了点问题呢';
-                    }
-                }
-            }
-            //判断视频是否合法
-            if(!empty($data['video'])){
-                if(!is_array($data['video'])||empty($data['video']['url'])||empty($data['video']['length'])||empty($data['video']['avatar'])){
-                    return '上传的视频好像出了点问题呢';
-                }
-            }
-            //判断语音是否合法
-            if(!empty($data['voice'])){
-                if(!is_array($data['voice'])||empty($data['voice']['url'])||empty($data['voice']['length'])){
-                    return '语音好像出了点问题呢';
-                }
-            }
-            return true;
-        }elseif($type=='message'){
-            $status = 0;
-            foreach ($data as  $value) {
-                if(!empty($value)){
-                    $status+=1;
-                }
-            }
-            if($status<1){
-                return '内容不合法';
-            }
-            if(!empty($data['content'])){
-                if(mb_strlen($data['content'],'utf-8')>2000||mb_strlen($data['content'],'utf-8')<1){
-                    return '文字要为1到2000个字呢';
-                }
-            }
-            //判断图片是否合法
-            if(!empty($data['pics'])){
-                foreach ($data['pics'] as $value) {
-                    if(!is_array($value)||empty($value['url'])||empty($value['width'])||empty($value['height'])){
-                        return '上传的图片好像出了点问题呢';
-                    }
-                }
-            }
-            //判断视频是否合法
-            if(!empty($data['video'])){
-                if(!is_array($data['video'])||empty($data['video']['url'])||empty($data['video']['length'])||empty($data['video']['avatar'])){
-                    return '上传的视频好像出了点问题呢';
-                }
-            }
-            //判断语音是否合法
-            if(!empty($data['voice'])){
-                if(!is_array($data['voice'])||empty($data['voice']['url'])||empty($data['voice']['length'])){
-                    return '语音好像出了点问题呢';
-                }
-            }
-            return true;
-        }else{
-            return false;
-        }
-    }
+    
 
     /**
      * 返回系统消息提示信息
@@ -1053,31 +916,7 @@ class CommonFn
 
     }
 
-    //为了防止用户的滥用行为,对用户特定动作进行记录,某一天不能超多特定次数
-    //目前记录的行为有:
-    //1. send_topic 2.send_post 3.send_message
-    //
-    public static function record_user_action($user_id, $act){
-        $today = intval(date("Ymd"));
-        $_id=$today.'-'.$act.'-'.$user_id;
-        return inc('wozhua_data', 'user_records', $_id, 'times');
-    }
 
-    //记录设备的操作记录
-    public static function record_device_action($act, $ip)
-    {
-        $_id=$today = intval(date("Ymd")).'-'.$act.'-'.$ip;
-        return inc('wozhua_data', 'user_records', $_id, 'times');
-    }
-
-    //返回设备的操作记录
-    public static function get_ip_action($act, $ip)
-    {
-        $mongo = new MongoClient(DB_CONNETC);
-        $_id=intval(date("Ymd")).'-'.$act.'-'.$ip;
-        $row=$mongo->wozhua_data->user_records->findOne(array('_id'=>$_id));
-        return $row && $row['times'] ? $row['times'] : 0;
-    }
 
     //获得用户自上次访问后的天数
     public static function get_user_last_visit_days($last_vt){
@@ -1124,76 +963,7 @@ class CommonFn
         return false;
     }
 
-    //把某些url 生成图片截图
-    public static function screenshot($type,$id,$title,$width)
-    {
-        $file=APP_PATH."/images/temp/".md5($type."_".$id."v2").".jpg";
-
-        if(!file_exists($file)){
-            if(ENVIRONMENT=='develop' || ENVIRONMENT=='test'){
-                $q=" -q";
-                $host = "http://wwwtest.wozhua.mobi/";
-            }else{
-                $q="";
-                $host = "http://www.wozhua.mobi/";
-            }
-            $url = $host.$type.'/'.$id."&screenshot=1";
-            $cmd="wkhtmltoimage --width $width $q --quality 90 \"{$url}\" $file";
-            exec($cmd);
-        }
-
-        $content=file_get_contents($file);
-        header('Content-type:image/jpeg');
-        header('Content-Length:'.strlen($content));
-
-        echo $content;
-        exit;
-    }
-
-    /**
-     * 七牛音频转码 amr2MP3
-     * @param string $bucket 七牛上传的位置 
-     * @param string $upname 源文件key 
-     * 生成的MP3保存在同个bucket下,与原文件同名,后缀为MP3
-     */
-    public static function ConvVoice($bucket,$key){
-        if(!strpos($key,'amr')){
-            return false;
-        }
-        $new_name = str_replace('amr','mp3',$key);
-        $entry = $bucket.':'.$new_name;
-        $encodedEntryURI = self::urlsafe_base64_encode($entry);
-        $op = 'avthumb/mp3/ar/44100/aq/3|saveas/'.$encodedEntryURI;
-        $qiniu_config = Yii::app()->params['qiniuConfig'];
-        $accessKey = $qiniu_config['ak'];
-        $secretKey = $qiniu_config['sk'];
-        $url = 'http://api.qiniu.com';
-        $query = 'bucket='.urlencode($bucket).'&key='.urlencode($key).'&fops='.urlencode($op);
-        $variety_str = "/pfop/\n".$query;
-        $access_token = self::generate_token($accessKey,$secretKey,$variety_str);
-        try {
-            $ch = curl_init();
-            curl_setopt($ch, CURLOPT_URL,'http://api.qiniu.com/pfop/');
-            $header[] = "Content-Type: application/x-www-form-urlencoded";
-            $header[] = "Authorization: QBox $access_token";
-            curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
-            curl_setopt ( $ch, CURLOPT_POST, 1 );
-            curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
-            curl_setopt ( $ch, CURLOPT_POSTFIELDS,$query);
-            $res = curl_exec($ch);
-            curl_close($ch);
-            $res = json_decode($res,true);
-            if(isset($res['persistentId'])){
-                return true;
-            }else{
-                return false;
-            }
-        } catch (Exception $e) {
-            return false;
-        }
-        
-
-    }
+    
 
     //URL安全的Base64编码
     public static function urlsafe_base64_encode($str){
@@ -1272,121 +1042,7 @@ class CommonFn
         );
     }
 
-    //根据请求post参数生成大众点评sign
-    public static function getDianPingSing($post_args){
-        $sign='';
-        if(is_array($post_args)){
-            ksort($post_args);
-            $arg_str = '';
-            foreach($post_args as $k=>$v){
-                $arg_str .= $k.$v;
-            }
-            $arg_str .= Yii::app()->params['dianPingAK'];
-            $sign= strtoupper(md5($arg_str));
-            return $sign;
-        }else{
-            return false;
-        }
-    }
-
-    /**
-     * 七牛视频截图
-     * @param string $bucket 七牛上传的位置
-     * @param string $upname 源文件key
-     * 生成的视频截图保存在同个bucket下,文件名为原文件名(包括拓展名)+.jpg
-     */
-    public static function VideoPrt ($bucket, $key){
-        // if(!strpos($key,'mp4')){
-        //     return false;
-        // }
-        $new_name = $key.'.jpg';
-        // $new_name = str_replace('mp4','jpg',$key);
-        $entry = $bucket.':'.$new_name;
-        $encodedEntryURI = CommonFn::urlsafe_base64_encode($entry);
-
-        // echo 'encodedEntryURI: '.$encodedEntryURI.'<br>';
-
-        $op = 'vframe/jpg/offset/1|saveas/'.$encodedEntryURI;
-        // $op = 'vframe/jpg/offset/1/'.$encodedEntryURI;
-        $pipeline = 'videopic';
-        $qiniu_config = Yii::app()->params['qiniuConfig'];
-        $accessKey = $qiniu_config['ak'];
-        $secretKey = $qiniu_config['sk'];
-        $url = 'http://api.qiniu.com';
-        $query = 'bucket='.urlencode($bucket).'&key='.urlencode($key).'&fops='.urlencode($op).'&pipeline='.urlencode($pipeline);
-        $variety_str = "/pfop/\n".$query;
-        $access_token = CommonFn::generate_token($accessKey,$secretKey,$variety_str);
-        // echo 'access_token: '.$access_token.'<br>';
-        try {
-            $ch = curl_init();
-            curl_setopt($ch, CURLOPT_URL,'http://api.qiniu.com/pfop/');
-            $header[] = "Content-Type: application/x-www-form-urlencoded";
-            $header[] = "Authorization: QBox $access_token";
-            curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
-            curl_setopt($ch, CURLOPT_POST, 1);
-            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-            curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
-            $res = curl_exec($ch);
-            curl_close($ch);
-            $res = json_decode($res,true);
-
-            if (isset($res['persistentId'])){
-                return true;
-            } else {
-                return false;
-            }
-        } catch (Exception $e) {
-            return false;
-        }
-    }
-
-    /**
-     * 七牛视频转换
-     * @param string $bucket 上传的位置
-     * @param string $key    上传文件的文件名
-     * @param number $width  上传文件的宽度
-     * @param number $height 上传文件的高度
-     * 生成的视频覆盖原视频
-     */
-    public static function VideoCon ($bucket, $key, $option, $saveas = true, $newname = '') {
-        $newname = empty($newname) ? $key : $newname;
-        $entry = $bucket.':'.$key;
-        $encodedEntryURI = CommonFn::urlsafe_base64_encode($entry);
-
-        $op = $saveas ? $option.$encodedEntryURI : $option;
-        // $op = 'avthumb/mp4/s/480x480/autoscale/1/aspect/'.$aspect.'|saveas/'.$encodedEntryURI;
-        // $op = 'avthumb/mp4/rotate/90|saveas/'.$encodedEntryURI;
-        $pipeline = 'videopic';
-        $qiniu_config = Yii::app()->params['qiniuConfig'];
-        $accessKey = $qiniu_config['ak'];
-        $secretKey = $qiniu_config['sk'];
-        $url = 'http://api.qiniu.com';
-        $query = 'bucket='.urlencode($bucket).'&key='.urlencode($key).'&fops='.urlencode($op).'&pipeline='.urlencode($pipeline).'&force=1';
-        $variety_str = "/pfop/\n".$query;
-        $access_token = CommonFn::generate_token($accessKey,$secretKey,$variety_str);
-
-        try {
-            $ch = curl_init();
-            curl_setopt($ch, CURLOPT_URL,'http://api.qiniu.com/pfop/');
-            $header[] = "Content-Type: application/x-www-form-urlencoded";
-            $header[] = "Authorization: QBox $access_token";
-            curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
-            curl_setopt($ch, CURLOPT_POST, 1);
-            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-            curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
-            $res = curl_exec($ch);
-            curl_close($ch);
-            $res = json_decode($res,true);
-            if (isset($res['persistentId'])){
-                return $res['persistentId'];
-            } else {
-                return false;
-            }
-        } catch (Exception $e) {
-            return false;
-        }
-    }
-
+    
 
     //格式化距离    1公里以内  都显示多少米    一公里以上  都显示整数公里
     public static function parseDistance($dis){
@@ -1419,45 +1075,6 @@ class CommonFn
         }
     }
 
-    /**
-     * 运营发帖、私信内容URL检查
-     * @param  String $content : 需要检查的内容
-     */
-    public static function checkContentURL($content) {
-        $result = preg_match_all('/href="([\S\s]*?)"/', $content, $matches, PREG_SET_ORDER);
-        if ($result) {
-            foreach ($matches as $key => $match) {
-                if (preg_match('/[\s]+/', $match[1])) {
-                    $url = preg_replace('/[\s]+/', '', $match[1]);
-                    $content = preg_replace('/'.preg_quote($match[0], '/').'/', 'href="'.$url.'"', $content);
-                }
-            }
-        }
-
-        return $content;
-    }
-
-     /**
-     * 版本号判断
-     * 判断v1版本号是否大于v2,若v1大于v2,返回1
-     */
-    public static function compareVersion($v1,$v2){
-        if(empty($v1)){
-            return 0;
-        }
-        $l1  = explode('.',$v1);
-        $l2  = explode('.',$v2);
-        $len = count($l1) > count($l2) ? count($l1): count($l2);
-        for ($i = 0; $i < $len; $i++){
-            $n1 = isset($l1[$i])?$l1[$i]:0;
-            $n2 = isset($l2[$i])?$l2[$i]:0;
-            if ($n1 > $n2){
-                return 1;//需要更新
-            }else if ($n1 < $n2){
-                return 0;//不需要更新
-            }
-        }
-        return 0;
-    }
+ 
 
 }

+ 3 - 36
www/protected/components/CommonWeb.php

@@ -122,16 +122,7 @@ class CommonWeb
     }
 
 
-    //生成二维码图片
-    public static function get_qrcode_image_url($url){
-        $pic_name  = 'guanwang_yingyongbao.png';
-        $image = APP_PATH.'/images/qrcode/'.$pic_name;
-        if(!file_exists($image)){
-            Service::factory('QRcodeService')->CreatQrcode($url,$image);
-        }
-        return 'http://'.SERVERNAME.'/images/qrcode/'.$pic_name;
-    }
-
+    
     //判断终端类型
     //返回设备类型
     public static function checkmobile() {
@@ -176,37 +167,13 @@ class CommonWeb
         return 'pc';
     }
 
-    //获得用户数最多的圈子
-    public static function getHotGroups($count){
-        //改善效率,加入缓存
-        $cache = new ARedisCache();
-        $hot_groups = $cache->get('commonweb_hot_group');
-        if($hot_groups){
-            $hot_groups = unserialize($hot_groups);
-        }else{
-            $criteral = new EMongoCriteria();
-            $criteral->limit($count)->sort('users_count',EMongoCriteria::SORT_DESC);
-            $group_cursor = Group::model()->findAll($criteral);
-            $hot_groups = array();
-            foreach ($group_cursor as $key => $value) {
-                $hot_groups[] = Group::model()->parseRow($value);
-            }
-            $cache->set('commonweb_hot_group',serialize($hot_groups),86400);
-        }
-        return $hot_groups;
-    }
+    
 
     public static function header_redirect($url, $code=301){
         header('Location: '.$url, true, $code);
         return false;
     }
 
-    public static function getAppDownLoadUrl($type='mobile'){
-        if($type!='pc'){
-            return 'http://download.wozhua.mobi/xz_wozhua.php?view=1&background=yc&package_name=wozhua_guanwang';
-        }else{
-            return "http://www.wozhua.mobi/download";
-        }
-    }
+    
 
 }

+ 1 - 1
www/protected/components/O2oApp.php

@@ -190,7 +190,7 @@ class O2oApp {
 
         // group生成统计数据
         $mongo = new MongoClient(DB_CONNETC);
-        $db = $mongo->wozhua_o2o;
+        $db = $mongo->fuwu;
         $collection = $db->selectCollection('commision');
         $keys = array('user' => 1);
         $initial = array('sum' => 0.0, 'order' => 0, 'append' => 0);

+ 6 - 6
www/protected/config/console.php

@@ -98,12 +98,12 @@ if(trim($env) == 'develop'){// 本地配置
                 'qiniuConfig' => array(
                     'ak'=>'Kn8GNMFOLKTNMUaKZ6r1wnjsgTk4ideQifK3umUr',
                     'sk'=>'mLtD4GhBjQt_llcgx4rKlhAts9j8iJ0Qa5VmNyi2',
-                    'icons'=>'wozhua-test',//后台可能上传一些图标    如宠物种类的图标    活动banner   圈子的图标
-                    'pics'=>'wozhua-test',//后台和app上  上传到帖子、回帖里面的图片
-                    'avatars'=>'wozhua-test',//用户的头像
-                    'others'=>'wozhua-test',//其他类型的图片
-                    'voice'=>'wozhua-test',//音频文件
-                    'video'=>'wozhua-test',//视频文件
+                    'icons'=>'icons',
+                    'pics'=>'pics',//
+                    'avatars'=>'avatars',//用户的头像
+                    'others'=>'others',//其他类型的图片
+                    'voice'=>'voice',//音频文件
+                    'video'=>'video',//视频文件
                 ),
             )
         )

+ 0 - 9
www/protected/config/main.php

@@ -50,15 +50,6 @@ return array(
             'enableCsrfValidation'=>false,
 
         ),
-        // uncomment the following to enable URLs in path-format
-        // 'urlManager'=>array(
-        //  'urlFormat'=>'path',
-        //  'showScriptName'=>true,
-        //   'rules'=>array(
-        //     // 'http://api.wozhuadev.mobi/<controller:\w+>/<action:\w+>' => 'api/<controller>/<action>',
-        //     // 'http://api.wozhua.mobi/<controller:\w+>/<action:\w+>' => 'api/<controller>/<action>',
-        //   ),
-        // ),
         'cache' => array (
              'class' => 'system.caching.CFileCache',
              'directoryLevel' => 2,

+ 1 - 1
www/protected/controllers/OrderController.php

@@ -4,7 +4,7 @@ class OrderController extends AdminController{
     public function actionCount() {
         header('Content-Type: application/json; charset=utf-8');
         $mongo      = new MongoClient(DB_CONNETC);
-        $db         = $mongo->wozhua_data;
+        $db         = $mongo->fuwu;
         $collection = $db->selectCollection('orders');
 
         $pipleline  = array(

+ 5 - 68
www/protected/controllers/ROrderController.php

@@ -254,7 +254,7 @@ class ROrderController extends AdminController{
             foreach($technician_ids as $key => $technician_id) {
                 $technician_obj = TechInfo::get($technician_id);
                 if ($technician_obj && $technician_obj->weixin_userid) {
-                    $url_prefix = ENVIRONMENT == 'product' ? 'http://api.wozhua.mobi' : 'http://apitest.wozhua.mobi';
+                    $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
                     $wechat = O2oApp::getWechatActive();
                     $wechat_data = array(
                         'touser' => $technician_obj->weixin_userid,
@@ -278,27 +278,7 @@ class ROrderController extends AdminController{
                     $wechat->sendMessage($wechat_data);
                 }
             }
-            // if (!empty($order->append_orders)) {
-            //     $wechat_data = array(
-            //         'touser'  => $technician_obj->userid,
-            //         'msgtype' => 'news',
-            //         'agentid' => '24',
-            //         'news'    => array(
-            //             'articles' => array(
-            //                 array(
-            //                     'title' => '壹管家提示-追加订单退款完成',
-            //                     'description' => $technician_obj->name.'你好!用户于'.date('m月d日H:i', $order->apply_refund_time).'申请退款的追加订单已处理完成,请点击下方条目查看详情。',
-            //                 ),
-            //             ),
-            //         ),
-            //     );
-            //     foreach ($order->append_orders as $key => $value) {
-            //         $wechat_data['news']['articles'][] = array(
-            //             'description' => '追加订单' . ($key + 1),
-            //             'url' => 'http://api.wozhua.mobi/index.php?r=o2o/myOrder/info&order='.$id.'&user='.$technician_id,
-            //         );
-            //     }
-            // }
+
         }
 
 
@@ -375,7 +355,7 @@ class ROrderController extends AdminController{
         if (in_array($status, array(1,2,3,4,5)) && $toTech && $success) {
         // if ($toTech) {
             if ($technician_obj && $technician_obj->weixin_userid) {
-                $url_prefix = ENVIRONMENT == 'product' ? 'http://api.wozhua.mobi' : 'http://apitest.wozhua.mobi';
+                $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
                 $wechat = O2oApp::getWechatActive();
                 $wechat_data = array(
                     'touser'  => $technician_obj->weixin_userid,
@@ -480,50 +460,7 @@ class ROrderController extends AdminController{
         echo json_encode($result);exit;
 
 
-        /*$map = new MongoCode('
-                function(){
-                    emit(this.address.name,this.address);
-                }
-        ');
-
-        $reduce = new MongoCode('
-                function(key,values){
-                    var ret={age:key,names:values[0]};
-                    return ret;
-                }
-        ');
-
-        $query = array('address.mobile' => array('=' => $mobile));
-
-        $instance = Message::model()->getDb();
-
-        $cmd = $instance->command(array(
-            'mapreduce' => 'orders',
-            'map'       => $map,
-            'reduce'    => $reduce,
-            'query'	=> $query,
-            'out' => array('merge' => 'admin_message')
-        ));*/
-
-        /**
-         * note time : 2015-10-16
-         * noted by  :    
-         */
-        /*$mongo = new MongoClient(DB_CONNETC);
-
-        $pipeline = array(
-            array(
-                '$match' => array(
-                    '_id' => array('address.mobile' => $mobile)
-                ),
-                '$group' => array(
-                    'mobile' => array('state' => '$state' ),
-                    'user' => array('$first' => '$pop' )
-                )
-            )
-        );
-        $out = $mongo->wozhua_o2o->orders->aggregate($pipeline);
-        var_dump($out);exit;*/
+        
     }
 
     public function actionAdd () {
@@ -733,7 +670,7 @@ class ROrderController extends AdminController{
         if ($toTech && $success) {
             // 发送给被分配保洁师
             $wechat = O2oApp::getWechatActive();
-            $url_prefix = ENVIRONMENT == 'product' ? 'http://api.wozhua.mobi' : 'http://apitest.wozhua.mobi';
+            $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
             if (!empty($technician_obj->weixin_userid)) {
                 $wechat_data = array(
                     'touser'  => $technician_obj->weixin_userid,

+ 1 - 109
www/protected/controllers/RUserController.php

@@ -116,113 +116,5 @@ class RUserController extends AdminController{
         echo CommonFn::composeDatagridData($data, $total);
     }
 
-    /**
-     * 后台发送优惠券
-     *     2015-11-23
-     */
-    // public function actionSendCoupon() {
-    //     $user_id = Yii::app()->request->getParam('user_id', '');
-    //     $coupon_id = Yii::app()->request->getParam('coupon_id', '');
-    //     $start_time = Yii::app()->request->getParam('start_time', '');
-    //     $end_time = Yii::app()->request->getParam('end_time', '');
-    //     $need_sms = intval(Yii::app()->request->getParam('need_sms', '0'));
-    //     $need_zpush = intval(Yii::app()->request->getParam('need_zpush', '0'));
-    //     $copy = Yii::app()->request->getParam('copy', '');
-
-    //     $mongo = new MongoClient(DB_CONNETC);
-    //     $db = $mongo->wozhua_o2o;
-    //     $coll = 'admin_send_coupon_log';
-    //     $collection = $db->selectCollection($coll);
-
-    //     $admin = Yii::app()->user;
-    //     $admin_id = $admin->id;
-    //     $user_id = new MongoId($user_id);
-    //     $coupon_id = new MongoId($coupon_id);
-    //     $time = time();
-
-    //     $user = RUser::get($user_id);
-
-    //     // 开始与结束时间处理
-    //     $start_time = empty($start_time) ? $time : strtotime($start_time);
-    //     $end_time   = empty($end_time) ? strtotime('+30 day', $start_time) : strtotime($end_time);
-
-    //     // 插入user_coupons表
-    //     $flag_user_coupon = Service::factory('CouponService')->giveCoupon($user_id, $coupon_id, $start_time, $end_time);
-    //     if (!$flag_user_coupon) {
-    //         CommonFn::requestAjax($flag_user_coupon, '发放优惠券失败', array());
-    //     }
-
-    //     // 插入admin_send_coupon_log表
-    //     $data = array(
-    //         'admin_id'  => $admin_id,
-    //         'user_id'   => $user_id,
-    //         'coupon_id' => $coupon_id,
-    //         'time'      => $time
-    //     );
-    //     $flag_send_log = $collection->insert($data);
-    //     if ($flag_send_log['err'] != null) {
-    //         CommonFn::requestAjax($flag_user_coupon, '优惠券已发放,日志记录失败', array());
-    //     }
-
-    //     // 推送私信
-    //     // 前端表单已注释,该段代码会跳过
-    //     if ($need_zpush) {
-    //         $android_data = array();
-
-    //         $time_str = CommonFn::sgmdate('Y年n月d日', time(), 1);
-    //         $android_data['title'] = '系统通知';
-    //         $android_data['content'] = $copy.'<a href="http://www.wozhua.mobi/index.php?r=o2o/web/index&need_header=0">点击这里</a>预约';
-    //         $android_data['custom'] = array(
-    //             'type' => 'user_status',
-    //             'data' => array(
-    //                 'status'   => 1,
-    //                 'user_id'  => (string)$user_id,
-    //                 'time'     => time(),
-    //                 'time_str' => $time_str,
-    //             ),
-    //         );
-    //         $android_data['account'] = (string)$user_id;
-
-    //         $ios_data = array();
-    //         $ios_data['alert']   = '系统通知:'.'恭喜你获得一张壹管家上门券';
-    //         $ios_data['account'] = (string)$user_id;
-    //         $ios_data['custom']  = array(
-    //             't' => 'a',
-    //             'v' => 1
-    //         );
-
-    //         $z_push = new ZPush();
-    //         $z_push->PushSingleAccount($android_data, $ios_data);
-    //     }
-
-    //     // 发送短信
-    //     // 前端表单已注释,该段代码会跳过
-    //     if ($need_sms) {
-    //         if ($user->mobile != '') {
-    //             Service::factory('SendSMSService')->send_sms($copy, $user->mobile);
-    //         } else if (!empty($user->shop_address) && isset($user->shop_address[0]['mobile'])) {
-    //             $mobile = $user->shop_address[0]['mobile'];
-    //             Service::factory('SendSMSService')->send_sms($copy, $mobile);
-    //         } else {
-    //             $criteria = new EMongoCriteria();
-    //             //$criteria->channel('==', 'wz_app');
-    //             $criteria->user('==', $user_id);
-    //             $criteria->sort('order_time', EMongoCriteria::SORT_DESC);
-    //             $cursor = ROrder::model()->findAll($criteria);
-    //             if ($cursor->count() == 0) {
-    //                 CommonFn::requestAjax(false, '优惠券已发放,因用户未填手机号,短信发送失败');
-    //             } else {
-    //                 foreach ($cursor as $key => $row) {
-    //                     $address = $row->address;
-    //                     $mobile = $address['mobile'];
-    //                     break;
-    //                 }
-    //                 Service::factory('SendSMSService')->send_sms($copy, $mobile);
-    //             }
-    //         }
-    //     }
-
-    //     CommonFn::requestAjax(true, '优惠券已成功发放');
-    // }
-
+    
 }

+ 1 - 1
www/protected/controllers/UserController.php

@@ -186,7 +186,7 @@ class UserController extends AdminController
      */
     public function actionGetDBLogList()
     {
-        $params['db_name'] = "wozhua";
+        $params['db_name'] = "backend";
         $criteria = new EMongoCriteria($params);
         $dbLog = DbAction::model()->findAll($criteria);
         CommonFn::showList($dbLog,"dblog");

+ 2 - 2
www/protected/models/data/Slide.php

@@ -104,8 +104,8 @@ class Slide extends MongoAr
             $newRow['obj'] = $row['obj'];
         // 暂时不上线 2015-12-24    
             if(empty($newRow['obj']['url'])){
-                $newRow['obj']['url'] = 'http://www.wozhua.mobi';
-                $newRow['obj']['id'] = 'http://www.wozhua.mobi';
+                $newRow['obj']['url'] = 'http://www.yiguanjia.me';
+                $newRow['obj']['id'] = 'http://www.yiguanjia.me';
             } else {
                 $newRow['obj']['id'] = $newRow['obj']['url'];
             }

+ 2 - 138
www/protected/modules/api/controllers/ApiBaseController.php

@@ -19,34 +19,7 @@ class ApiBaseController extends CController{
        return $result;
     }
 
-    //用户行为需要增加爪币,调用此方法
-    protected function addScore($user_id,$action){
-        $result = Service::factory('ScoreService')->syncScore($user_id,$action);
-        if($result){
-            $score_value = Service::factory('VariableService')->getVariable($action);
-            return array('status'=>true,'score'=>intval($score_value),'current_score'=>$result);
-        }else{
-            return array('status'=>false);
-        }
-    }
-
-    /**
-     * 增加用户活跃天数
-     * @param string $user_id
-     */
-    protected function addActive($user_id){
-        $cache = new ARedisCache();
-        $key = 'user_active_'.date('Ymd').$user_id;
-        $status = $cache->get($key);
-        if($status){
-            return false;
-        }else{
-            $cache->set($key,1,86400);
-            $list = new ARedisList('user_active_list');
-            $list->push($user_id);
-            return true;
-        }
-    }
+   
     
 
     //判断用户是否是当日首次访问应用,可以将一些定期任务放入此方法内调用
@@ -73,88 +46,7 @@ class ApiBaseController extends CController{
         }
     }
 
-    //所有访问者 记录资料信息  通过device_id
-    protected function log_visitor($request){
-        $mongo = new MongoClient(DB_CONNETC);
-        $device_id = CommonFn::get_val_if_isset($request,'device_id',"");
-        $os_version = CommonFn::get_val_if_isset($request,'os_version',"");
-
-        $api_version = CommonFn::get_val_if_isset($request,'api_version',"");
-        $app_version = CommonFn::get_val_if_isset($request,'app_version',"");
-        $phone_type = CommonFn::get_val_if_isset($request,'phone_type',"");
-
-        $user_id = CommonFn::get_val_if_isset($request,'user_id',"");
-        $channel = CommonFn::get_val_if_isset($request,'channel',"");
-        $app_client_id = CommonFn::get_val_if_isset($request,'app_client_id',"");
-        if(isset($request['city_info']) && $request['city_info']){
-            $city_info =  json_decode($request['city_info'],true);
-            //防止city_info出现非法数据
-            if(!isset($city_info['province'])){
-                $city_info['province'] = '';
-                $city_info['city'] = '';
-                $city_info['area'] = '';
-            }elseif(!isset($city_info['city'])){
-                $city_info['city'] = '';
-                $city_info['area'] = '';
-            }elseif(!isset($city_info['area'])){
-                $city_info['area'] = '';
-            }
-        }
-
-        if(isset($request['position']) && $request['position']){
-            $position_arr = json_decode($request['position'],true);
-            $position[0] = isset($position_arr['lng'])?floatval($position_arr['lng']):0;
-            $position[1] = isset($position_arr['lat'])?floatval($position_arr['lat']):0;
-        }
-
-        if($device_id){
-            $criteria = new EMongoCriteria();
-            $criteria->device_id('==',$device_id);
-            $visitor = Visitors::model()->find($criteria);
-            if($visitor){
-                $visitor->device_id = $device_id;
-                $visitor->os_version = $os_version;
-                $visitor->api_version = $api_version;
-                $visitor->time = time();
-                if(!isset($visitor->first_time) || !$visitor->first_time){
-                    $visitor->first_time = time();
-                }
-                $visitor->channel = $channel;
-                $visitor->app_version = $app_version;
-                $visitor->phone_type = $phone_type;
-                $visitor->user_id = $user_id;
-                $visitor->app_client_id = $app_client_id;
-                if(isset($city_info) && !empty($city_info)){
-                    $visitor->city_info = $city_info;
-                }
-                if(isset($position) && !empty($position)){
-                    $visitor->position = $position;
-                }
-                $visitor->update(array('device_id','os_version','api_version','first_time','time','channel','app_version','phone_type','user_id','app_client_id','city_info','position'));
-            }else{
-                $visitor = new Visitors();
-                $visitor->device_id = $device_id;
-                $visitor->os_version = $os_version;
-                $visitor->api_version = $api_version;
-                $visitor->time = time();
-                $visitor->first_time = time();
-                $visitor->channel = $channel;
-                $visitor->app_version = $app_version;
-                $visitor->phone_type = $phone_type;
-                $visitor->user_id = $user_id;
-                $visitor->app_client_id = $app_client_id;
-                if(isset($city_info) && !empty($city_info)){
-                    $visitor->city_info = $city_info;
-                }
-                if(isset($position) && !empty($position)){
-                    $visitor->position = $position;
-                }
-                $visitor->save();
-            }
-        }
-    }
-
-
+    
     //签名验证方法
     //每次GET/POST请求的参数,凡是在这个列表以内的参数名字:["id","app_client_id","time","topic_id","group_id","user_id","post_id"]加上private_key按key字母升序排列拼接,然后md5运算之后生成
     protected function api_check_sign(){
@@ -233,34 +125,6 @@ class ApiBaseController extends CController{
         }
     }
 
-    public function check_version(){
-        $version = Yii::app()->request->getParam('app_version');
-        $app_client_id = Yii::app()->request->getParam('app_client_id');
-        if(Yii::app()->request->getParam('no_sign')){
-            return true;
-        }
-        if( empty($version)||empty($app_client_id)){
-            CommonFn::requestAjax(false,CommonFn::getMessage('message','request_illegal'));
-        }
-        if($app_client_id == 2){
-            $limit_version = Yii::app()->params['android_latest_version'];
-            $leatest_version = Service::factory('VariableService')->getVariable('android_new_version');
-        }elseif($app_client_id == 1){
-            $limit_version = Yii::app()->params['ios_latest_version'];
-            $leatest_version = Service::factory('VariableService')->getVariable('ios_new_version');
-        }else{
-            CommonFn::requestAjax(false,CommonFn::getMessage('message','request_illegal'));
-        }
-        if(!CommonFn::compareVersion(Yii::app()->request->getParam('app_version',''),$limit_version)){
-            if($app_client_id == 2){
-                $download_url = 'http://7xjqyz.com5.z0.glb.clouddn.com/wozhua_guanwang.apk';
-                $info = array('new_version'=>$leatest_version,'download'=>$download_url);
-            }else{
-                $info = array('new_version'=>$leatest_version);
-            }
-            CommonFn::requestAjax(true,CommonFn::getMessage('message', 'have_newer'),$info,203);
-        }
-    }
 
 
 }

+ 1 - 1
www/protected/modules/api/controllers/CommonController.php

@@ -449,7 +449,7 @@ class CommonController extends ApiBaseController {
         if($data_cache){
             $data = unserialize($data_cache);
         }else{
-            $host = ENVIRONMENT=='product'?'www.wozhua.mobi':'wwwtest.wozhua.mobi';
+            $host = ENVIRONMENT=='product'?'www.yiguanjia.me':'wwwtest.yiguanjia.me';
             $hot_keys = trim(Service::factory('VariableService')->getVariable('hot_keywords'));
             $hot_keys = explode("\n",$hot_keys);
             $criteria = new EMongoCriteria();

+ 0 - 342
www/protected/modules/api/controllers/IndexController.php

@@ -14,348 +14,6 @@ class IndexController extends ApiBaseController {
         return $this->verify();
     }
 
-    public function actionV3(){
-        //根据自定义参数生成缓存key
-        $user_id = Yii::app()->request->getParam('user_id','');
-        $device_id = Yii::app()->request->getParam('device_id','0');
-        $city_info =  json_decode(Yii::app()->request->getParam('city_info'),true);
-        $province = isset($city_info['province'])?$city_info['province']:'';
-        $position_city_info =  json_decode(Yii::app()->request->getParam('position_city_info'),true);
-        $position_province = isset($position_city_info['province'])?$position_city_info['province']:'';
-        $get_new = Yii::app()->request->getParam('get_new',0);
-        $z_User = new ZUser();
-        $host = ENVIRONMENT=='product'?'www.wozhua.mobi':'wwwtest.wozhua.mobi';
-        $f_host = ENVIRONMENT=='product'?'f.wozhua.mobi':'ftest.wozhua.mobi';
-        $user = $z_User->idExist($user_id);
-        //$new_user_coupons = 0;
-        $no_recommond_groups = Yii::app()->params['no_recommond_groups'];
-        //登陆用户根据上次访问时间,关注圈子,页数,当前时间生成唯一key
-        if($user){
-            $add_score = $this->today_first_login($user_id);
-            $last_visit_hours = CommonFn::get_user_last_visit_hours($user['last_visit_time']);
-            $group_ids = $user['groups'];
-            $sort_group = array();
-            foreach ($group_ids as $key => $value) {
-                $sort_group[] = (string)$value;
-            }
-            sort($sort_group);
-            $stamp = '3';
-            foreach ($sort_group as $key => $value) {
-                $stamp.=$value;
-            }
-            $cache_key = md5($stamp.$last_visit_hours.$get_new);
-        //未登录用户根据页数,默认获取推荐关注圈子七天内帖子
-        }elseif($device_id){
-            $cache = new ARedisCache();
-            $key = 'guest_last_visit_time_'.$device_id;
-            $guest_last_visit_time = $cache->get($key);
-            if($guest_last_visit_time){
-                $last_visit_hours = CommonFn::get_user_last_visit_hours($guest_last_visit_time);
-            }else{
-                $last_visit_hours = 168;
-            }
-            $cache->set($key,time());
-            //未登录用户获取获取推荐的圈子
-            $default_follow_group = Service::factory('VariableService')->getVariable('default_follow_group');
-            $groups =  explode(',',trim($default_follow_group,','));
-            if(isset($city_info['province'])){
-                $criteria = new EMongoCriteria();
-                $criteria->status('==',1);
-                $criteria->addCond('city_info.province','==',$city_info['province']);
-                $cursor = Group::model()->findAll($criteria);
-                foreach ($cursor as $value) {
-                    $groups[] = (string)$value->_id;
-                }
-            }
-            $stamp = '3';
-            foreach ($groups as $key => $value) {
-                if(!CommonFn::isMongoId($value)){
-                    unset($groups[$key]);
-                    continue;
-                }
-                $groups[$key] = new MongoId($value);
-                $stamp.=$value;
-            }
-            $group_ids = array_values($groups);
-            $cache_key = md5($stamp.$last_visit_hours.$get_new);
-        }else{
-            $default_follow_group = Service::factory('VariableService')->getVariable('default_follow_group');
-            $groups =  explode(',',trim($default_follow_group,','));
-            $stamp = '3';
-            foreach ($groups as $key => $value) {
-                if(!CommonFn::isMongoId($value)){
-                    unset($groups[$key]);
-                    continue;
-                }
-                $groups[$key] = new MongoId($value);
-                $stamp.=$value;
-            }
-            $group_ids = array_values($groups);
-            $last_visit_hours = 168;
-            $cache_key = md5($stamp.$last_visit_hours.$get_new);
-        }
-        foreach ($group_ids as $key => $value) {
-            if(in_array((string)$value,$no_recommond_groups)){
-                unset($group_ids[$key]);
-            }
-        }
-        $group_ids = array_values($group_ids);
-        $cache = new ARedisCache();
-        $cache_data = $cache->get($cache_key);
-        if($cache_data && !YII_DEBUG){
-            $cache_res = unserialize($cache_data);
-            $data = $cache_res['data'];
-        }else{
-            //按钮链接
-            $link_button[] = array(
-                    'title'=>'买宠物',
-                    'link_text'=>'有保障/大礼包',
-                    'icon_url'=>'http://7oxep6.com1.z0.glb.clouddn.com/huotijiaoyi.png',
-                    'link'=>'http://'.$host.'/o2o/web/index/deal?need_header=0'
-                );
-            $link_button[] = array(
-                    'title'=>'问专家',
-                    'link_text'=>'看病/训犬/养护',
-                    'icon_url'=>'http://7oxep6.com1.z0.glb.clouddn.com/doctorhij.png',
-                    'link'=>'http://'.$host.'/group/54a0fa1f0eb9fb17308b47a6'
-                );
-            $data['link_button'] = $link_button;
 
-            //活体交易部分
-            $deal['type'] = 'deal';
-            $deal['title'] = '放心、有保障的宠物交易';
-            $deal['more'] = 'http://'.$host.'/o2o/web/index/deal?need_header=0';
-            //todo pettype
-            $new_pets = DealPet::getNewPet();
-            foreach ($new_pets as $key => $value) {
-                $new_pets[$key]['url'] = 'http://'.$host.'/o2o/web/index/deal?need_header=0/#!/detail/'.$value['id'];
-            }
-            $deal['pets'] = $new_pets;
-            $data['modules'][] = $deal;
-
-            $res_topics = array();
-            $conditions = array(    
-                                    'group'=>array('in',$group_ids),
-                                    'status'=>array('==',1),
-                                    'time'=>array('>=',time()-3600*$last_visit_hours)
-                                );
-            //最新最热帖排序规则
-            $order = $get_new?['_id'=>'desc']:['like_count'=>'desc'];
-            $model = new Topic();
-            $pagedata = CommonFn::getPagedata($model,1,20,$conditions,$order,false);
-            $topics = $pagedata['res'];
-            foreach($topics as $topic){
-                $_topic = $model->parseRow($topic,array('id','content','city_info','city_info_str','city_topic_str','time','time_str','group','visit_count','reply_count','fav_count','like_count','user','pics','voice','video','last_post_time','last_post_time_str'));
-                if($user){
-                    $z_like = new ZLike();
-                    $like = $z_like->getLikeByLikeObj((string)$user['_id'],$_topic['id']);
-                    if(empty($like)){
-                        $_topic['is_liked'] = false;
-                    }else{
-                        $_topic['is_liked'] = true;
-                    }
-                }else{
-                    $_topic['is_liked'] = false;
-                }
-                $res_topics[] = $_topic;
-            }
-            $data['topics'] = $res_topics;
-            $cache_data = array();
-            $cache_data['data'] = $data;
-            $cache->set($cache_key,serialize($cache_data),3600);
-        }
-        //首页轮播图
-        $province_tag = isset($city_info['province'])?$city_info['province']:'no';
-        $slide = Slide::getIndexSlide($province_tag);
-        $data['slide'] = $slide;
-        if(isset($add_score['status'])){
-            $score_info['score_change'] = $add_score['score'];
-            $score_info['current_score'] = $add_score['current_score'];
-            $score_info['score_type'] = '签到';
-            CommonFn::requestAjax(true,CommonFn::getMessage('message','operation_success'),$data,303,$score_info);
-        }else{
-            CommonFn::requestAjax(true,CommonFn::getMessage('message','operation_success'),$data,200,array('last_visit_hours' =>$last_visit_hours));
-        }
-    }
-
-    public function actionV4(){
-        //根据自定义参数生成缓存key
-        $user_id = Yii::app()->request->getParam('user_id','');
-        $device_id = Yii::app()->request->getParam('device_id','0');
-        $page = intval(Yii::app()->request->getParam('page',1));
-        $city_info =  json_decode(Yii::app()->request->getParam('city_info'),true);
-        $province = isset($city_info['province'])?$city_info['province']:'';
-        $position_city_info =  json_decode(Yii::app()->request->getParam('position_city_info'),true);
-        $position_province = isset($position_city_info['province'])?$position_city_info['province']:'';
-        $get_new = Yii::app()->request->getParam('get_new',0);
-        $z_User = new ZUser();
-        $host = ENVIRONMENT=='product'?'www.wozhua.mobi':'wwwtest.wozhua.mobi';
-        $f_host = ENVIRONMENT=='product'?'f.wozhua.mobi':'ftest.wozhua.mobi';
-        $user = $z_User->idExist($user_id);
-        //$new_user_coupons = 0;
-        $no_recommond_groups = Yii::app()->params['no_recommond_groups'];
-        //登陆用户根据上次访问时间,关注圈子,页数,当前时间生成唯一key
-        if($user){
-            $add_score = $this->today_first_login($user_id);
-            $last_visit_hours = CommonFn::get_user_last_visit_hours($user['last_visit_time']);
-            $group_ids = $user['groups'];
-            $sort_group = array();
-            foreach ($group_ids as $key => $value) {
-                $sort_group[] = (string)$value;
-            }
-            sort($sort_group);
-            $stamp = '3';
-            foreach ($sort_group as $key => $value) {
-                $stamp.=$value;
-            }
-            $cache_key = md5($stamp.$last_visit_hours.$get_new);
-        //未登录用户根据页数,默认获取推荐关注圈子七天内帖子
-        }elseif($device_id){
-            $cache = new ARedisCache();
-            $key = 'guest_last_visit_time_'.$device_id;
-            $guest_last_visit_time = $cache->get($key);
-            if($guest_last_visit_time){
-                $last_visit_hours = CommonFn::get_user_last_visit_hours($guest_last_visit_time);
-            }else{
-                $last_visit_hours = 168;
-            }
-            $cache->set($key,time());
-            //未登录用户获取获取推荐的圈子
-            $default_follow_group = Service::factory('VariableService')->getVariable('default_follow_group');
-            $groups =  explode(',',trim($default_follow_group,','));
-            if(isset($city_info['province'])){
-                $criteria = new EMongoCriteria();
-                $criteria->status('==',1);
-                $criteria->addCond('city_info.province','==',$city_info['province']);
-                $cursor = Group::model()->findAll($criteria);
-                foreach ($cursor as $value) {
-                    $groups[] = (string)$value->_id;
-                }
-            }
-            $stamp = '3';
-            foreach ($groups as $key => $value) {
-                if(!CommonFn::isMongoId($value)){
-                    unset($groups[$key]);
-                    continue;
-                }
-                $groups[$key] = new MongoId($value);
-                $stamp.=$value;
-            }
-            $group_ids = array_values($groups);
-            $cache_key = md5($stamp.$last_visit_hours.$get_new);
-        }else{
-            $default_follow_group = Service::factory('VariableService')->getVariable('default_follow_group');
-            $groups =  explode(',',trim($default_follow_group,','));
-            $stamp = '3';
-            foreach ($groups as $key => $value) {
-                if(!CommonFn::isMongoId($value)){
-                    unset($groups[$key]);
-                    continue;
-                }
-                $groups[$key] = new MongoId($value);
-                $stamp.=$value;
-            }
-            $group_ids = array_values($groups);
-            $last_visit_hours = 168;
-            $cache_key = md5($stamp.$last_visit_hours.$get_new);
-        }
-        foreach ($group_ids as $key => $value) {
-            if(in_array((string)$value,$no_recommond_groups)){
-                unset($group_ids[$key]);
-            }
-        }
-        $group_ids = array_values($group_ids);
-        $cache = new ARedisCache();
-        $cache_data = $cache->get($cache_key.'v4');
-        if($cache_data && !YII_DEBUG){
-            $cache_res = unserialize($cache_data);
-            $data = $cache_res['data'];
-        }else{
-            
-            //按钮链接
-            $link_button[] = array(
-                    'title'=>'买宠物',
-                    'link_text'=>'有保障/大礼包',
-                    'icon_url'=>'http://7oxep6.com1.z0.glb.clouddn.com/huotijiaoyi.png',
-                    'link'=>'http://'.$host.'/o2o/web/index/deal?need_header=0'
-                );
-            $link_button[] = array(
-                    'title'=>'问专家',
-                    'link_text'=>'看病/训犬/养护',
-                    'icon_url'=>'http://7oxep6.com1.z0.glb.clouddn.com/doctorhij.png',
-                    'link'=>'http://'.$host.'/group/54a0fa1f0eb9fb17308b47a6'
-                );
-            $data['link_button'] = $link_button;
-
-            //活体交易部分
-            $deal['type'] = 'deal';
-            $deal['title'] = '放心、有保障的宠物交易';
-            $deal['more'] = 'http://'.$host.'/o2o/web/index/deal?need_header=0';
-            //todo pettype
-            $new_pets = DealPet::getNewPet();
-            foreach ($new_pets as $key => $value) {
-                $new_pets[$key]['url'] = 'http://'.$host.'/o2o/web/index/deal?need_header=0/#!/detail/'.$value['id'];
-            }
-            $deal['pets'] = $new_pets;
-            $data['modules'][] = $deal;
-
-            $res_topics = array();
-            $conditions = array(    
-                                    'group'=>array('in',$group_ids),
-                                    'status'=>array('==',1),
-                                    'time'=>array('>=',time()-3600*$last_visit_hours)
-                                );
-            //最新最热帖排序规则
-            $order = $get_new?['_id'=>'desc']:['like_count'=>'desc'];
-            $model = new Topic();
-            $pagedata = CommonFn::getPagedata($model,1,200,$conditions,$order,false);
-            $topics = $pagedata['res'];
-            foreach($topics as $topic){
-                $res_topics[] = $topic['_id'];
-            }
-            $data['topics'] = $res_topics;
-            $cache_data = array();
-            $cache_data['data'] = $data;
-            $cache->set($cache_key.'v4',serialize($cache_data),3600);
-        }
-        $res_topics = array();
-        $topics = $data['topics'];
-        $skip = 20*$page-20;
-        if($skip+20 >= count($topics)){
-            $has_more = 0;
-        }else{
-            $has_more = 1;
-        }
-        $topics_ids = array_slice($topics,$skip,20);
-        $model = new Topic();
-        foreach ($topics_ids as $key => $topic_id) {
-            $_topic = $model->parseRow(Topic::get(new MongoId($topic_id)),array('id','content','city_info','city_info_str','city_topic_str','time','time_str','group','visit_count','reply_count','fav_count','like_count','user','pics','voice','video','last_post_time','last_post_time_str'));
-            if($user){
-                $z_like = new ZLike();
-                $like = $z_like->getLikeByLikeObj((string)$user['_id'],$_topic['id']);
-                if(empty($like)){
-                    $_topic['is_liked'] = false;
-                }else{
-                    $_topic['is_liked'] = true;
-                }
-            }else{
-                $_topic['is_liked'] = false;
-            }
-            $res_topics[] = $_topic;
-        }
-        $data['topics'] = $res_topics;
-        //首页轮播图
-        $province_tag = isset($city_info['province'])?$city_info['province']:'no';
-        $slide = Slide::getIndexSlide($province_tag);
-        $data['slide'] = $slide;
-        if(isset($add_score['status'])){
-            $score_info['score_change'] = $add_score['score'];
-            $score_info['current_score'] = $add_score['current_score'];
-            $score_info['score_type'] = '签到';
-            CommonFn::requestAjax(true,CommonFn::getMessage('message','operation_success'),$data,303,$score_info);
-        }else{
-            CommonFn::requestAjax(true,CommonFn::getMessage('message','operation_success'),$data,200,array('has_more'=>$has_more,'last_visit_hours' =>$last_visit_hours));
-        }
-    }
 
 }

+ 8 - 8
www/protected/modules/o2o/controllers/ProductController.php

@@ -47,12 +47,12 @@ class  ProductController extends O2oBaseController{
             $conditions = array(
                                 'status'=>array('==',1),
                                 'type'=>array('==',$type),
-                                'is_extra'=>array('==',0),
+                                //'is_extra'=>array('==',0),
                             );
         }else{
             $conditions = array(
                                 'status'=>array('==',1),
-                                'is_extra'=>array('==',0),
+                                //'is_extra'=>array('==',0),
                             );
         }
         $order = array(
@@ -66,11 +66,11 @@ class  ProductController extends O2oBaseController{
         if($type){
             $criteria->type('==',$type);
         }
-        $criteria->is_extra('==',1);
-        $extra_products = $model->findAll($criteria);
-        $extra_products = CommonFn::getRows($extra_products);
-        $extra_products = $model->parse($extra_products);
-        $data['extra_products'] = $extra_products;
+        //$criteria->is_extra('==',1);
+        //$extra_products = $model->findAll($criteria);
+        //$extra_products = CommonFn::getRows($extra_products);
+        //$extra_products = $model->parse($extra_products);
+        //$data['extra_products'] = $extra_products;
         CommonFn::requestAjax(true,'true',$data,200,array('sum_count' => $pagedata['sum_count'],'sum_page'=>$pagedata['sum_page'],'page_size'=>$pagedata['page_size'],'current_page'=>$pagedata['current_page'],'holiday' => $holiday));
     }
 
@@ -163,7 +163,7 @@ class  ProductController extends O2oBaseController{
             if ($technician) {
                 $technicianObj = TechInfo::get($technician);
                 if ($technicianObj && $technicianObj->weixin_userid) {
-                    $url_prefix = ENVIRONMENT == 'product' ? 'http://api.wozhua.mobi' : 'http://apitest.wozhua.mobi';
+                    $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
                     $wechat = O2oApp::getWechatObj();
                     $wechat_data = array(
                         'touser'  => $technicianObj->weixin_userid,