예제 #1
0
파일: MallService.php 프로젝트: zwq/unpei
 public static function getredis($GoodsID, $search = '')
 {
     $info = Yii::app()->redis->get('GoodsID' . $GoodsID);
     if ($info) {
         $info = json_decode($info, true);
         //            $info['atBrand'] = Yii::app()->redis->get('Brand' . $Goods->attributes['BrandID'] . 'o' . $Goods->attributes['OrganID']);
     } else {
         $Goods = PapGoods::model()->findBypk($GoodsID);
         //            if ($search != 'search') {
         //                if (!$Goods || $Goods->ISdelete == 0) {
         //                    return 'null';
         //                } else if ($Goods->IsSale == 0) {
         //                    return 'nosale';
         //                }
         //            }
         $redis = $Goods->attributes;
         $brandid = $Goods->attributes['BrandID'];
         if ($brandid) {
             $sql = "select BrandName from pap_brand where ID={$brandid}";
             $res = Yii::app()->papdb->createCommand($sql)->queryRow();
         }
         //if($res['Name']){
         $redis['Brand'] = $res['BrandName'] ? $res['BrandName'] : '';
         //品牌认证
         //}
         //机构名称
         $redis['OrganName'] = DealergoodsService::getnamebyorganid($Goods->attributes['OrganID']);
         $redis['PartsLevelName'] = Yii::app()->getParams()->PartsLevel[$Goods->attributes['PartsLevel']];
         $redis['StandCodeName'] = DealergoodsService::StandCodegetcpname($Goods->attributes['StandCode'], 'Name');
         //var_dump($redis);exit;
         $gcategory = self::getCategory($Goods->attributes['StandCode']);
         //            $version['gcategory'] = $gcategory->attributes;
         $redis['gcategory']['BigParts'] = $gcategory['BigPartsID'];
         $redis['gcategory']['SubParts'] = $gcategory['SubPartsID'];
         $redis['gcategory']['BigName'] = $gcategory['BigParts'];
         $redis['gcategory']['SubName'] = $gcategory['SubParts'];
         $oeno = PapGoodsOeRelation::model()->findAll('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID));
         if ($oeno) {
             foreach ($oeno as $value) {
                 $redis['oeno'][] = $value->attributes['OENO'];
             }
         }
         $img = PapGoodsImageRelation::model()->findAll('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID));
         if ($img) {
             foreach ($img as $key => $value) {
                 $redis['img'][$key]['ImageUrl'] = $value->attributes['ImageUrl'];
                 $redis['img'][$key]['ImageName'] = $value->attributes['ImageName'];
                 $redis['img'][$key]['MallImage'] = $value->attributes['MallImage'];
                 $redis['img'][$key]['BigImage'] = $value->attributes['BigImage'];
             }
         }
         $spec = PapGoodsSpec::model()->find('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID));
         $redis['spec']['ValidityType'] = $spec->attributes['ValidityType'];
         $redis['spec']['ValidityDate'] = $spec->attributes['ValidityDate'];
         $redis['spec']['Unit'] = $spec->attributes['Unit'];
         $redis['spec']['BganCompany'] = $spec->attributes['BganCompany'];
         $redis['spec']['BganGoodsNO'] = $spec->attributes['BganGoodsNO'];
         $pack = PapGoodsPack::model()->find('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID));
         $redis['pack']['MinQuantity'] = $pack->attributes['MinQuantity'];
         $vehicle = PapGoodsVehicleRelation::model()->findAll('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID));
         if ($vehicle) {
             foreach ($vehicle as $value) {
                 $redis['vehicle'][$key]['Make'] = $value->attributes['Make'];
                 $redis['vehicle'][$key]['Car'] = $value->attributes['Car'];
                 $redis['vehicle'][$key]['Year'] = $value->attributes['Year'];
                 $redis['vehicle'][$key]['Model'] = $value->attributes['Model'];
                 $redis['vehicle'][$key]['Marktxt'] = $value->attributes['Marktxt'];
                 $redis['vehicle'][$key]['Cartxt'] = $value->attributes['Cartxt'];
                 $redis['vehicle'][$key]['Modeltxt'] = $value->attributes['Modeltxt'];
             }
         }
         if ($search == 'search') {
             $redis['atBrand'] = Yii::app()->redis->get('Brand' . $Goods->attributes['BrandID'] . 'o' . $Goods->attributes['OrganID']);
             return $redis;
         }
         $info = $redis;
         Yii::app()->redis->set('GoodsID' . $GoodsID, json_encode($redis));
     }
     $info['atBrand'] = Yii::app()->redis->get('Brand' . $Goods->attributes['BrandID'] . 'o' . $Goods->attributes['OrganID']);
     return $info;
 }
예제 #2
0
파일: preview.php 프로젝트: zwq/unpei
                <?php 
// $this->widget('widgets.default.WGoodsCarModel', array('goodsID' => $r['GoodsID']));
?>
                                    <div style="clear:both"></div>     
                                </div>-->

                <div class="p_number">
                    <span class="float_l" style="padding-left:10px"> 购买数量:</span>
                    <div class="f_l add_chose">
                        <a class="reduce_num" href="javascript:void(0)"></a>
                        <input type="text" name="qty_item_1" value="1" id="qty_item" class="text" onBlur="setAmount(this);"/>
                        <a class="add_num" href="javascript:void(0)"></a>
                    </div>
                </div>
                <p class="bh">服务:由<span class="lanse"><?php 
echo DealergoodsService::getnamebyorganid(Yii::app()->user->getOrganID());
?>
</span>从<?php 
echo $r['Address'][0] . $r['Address'][1];
?>
发货,并提供售后服务</span></p>
                <p class="gm" goodsid="<?php 
echo $r['GoodsID'];
?>
"><button class="addgwc">加入购物车</button>
                    <button class="ljgm" id="quickbuy" goodsid="<?php 
echo $r['GoodsID'];
?>
">立即购买</button></p>
            </div>
            <!--content1b结束-->