Commit 4ee48f63 authored by christ's avatar christ

ccw

parent 532835a5
......@@ -45,7 +45,7 @@ class IndexController extends \Our\Controller_Abstract {
if($paramsStr['type']==\Our\ApiConst::shareStore){
$this->_view->display('index/store.phtml');
}
if($paramsStr['type']==\Our\ApiConst::shareGoods){
if($paramsStr['type']==\Our\ApiConst::shareGoods || \Our\ApiConst::shareGroup){
$this->_view->display('index/goods.phtml');
}
if($paramsStr['type']==\Our\ApiConst::shareSaler){
......
......@@ -394,6 +394,7 @@ class ApiConst
const shareStore = 2;//店铺
const shareGoods = 3;//商品
const shareSaler=4;//销售员分享
const shareGroup = 31;//分享组合商品
const wxAppPayType = 1; //APP微信支付
const aliPayType = 2; //APP支付宝支付
......
......@@ -26,7 +26,8 @@ class PathConst {
const sharePlat="http://www.shenbd.com";
const shareStore="http://share.shenbd.com/share.html?type=store&id={0}";
const shareGoods="http://share.shenbd.com/share.html?type=goods&gid={0}&cid={1}&sid={2}";
const shareGroups="http://share.shenbd.com/share.html?type=group&gid={0}&sid={1}";
const timeParam='&param='.TIMESTAMP;
const cutVertical='|';
......
......@@ -34,6 +34,23 @@ class ShareServiceModel extends \Business\AbstractModel
public function getSaveData($data){
$driverType = \Our\Common::getDriverType();
$data['driverType'] = $driverType;
if($data['type']==ApiConst::shareGoods){
if(!empty($data['id'])){
$goodsDao=\DAO\GoodsModel::getInstance();
$goods=$goodsDao->getOnlineOne($data['id']);
$data['goodsId']=$goods['goods_id'];
$data['goodsCommonid']=$goods['goods_commonid'];
$data['storeId']=$goods['store_id'];
}
}
if($data['type']==ApiConst::shareGroup){
if(!empty($data['id'])){
$pBundlingDao=\DAO\PBundlingModel::getInstance();
$pBundling=$pBundlingDao->findById($data['groupId']);
$data['groupId']=$data['groupId'];
$data['storeId']=$pBundling['store_id'];
}
}
$data['qrCode']=$this->growQrcode($data);
if($data['type']==ApiConst::shareStore || $data['type']== ApiConst::shareSaler){
if(!empty($data['id'])){
......@@ -47,6 +64,7 @@ class ShareServiceModel extends \Business\AbstractModel
}
// $data['qrCode']=\Our\RedisHelper::cachedFunction(\Redis\Db0\MemberRedisModel::getInstance(), array(&$this, 'growQrcode'), array($data));
return $data;
......@@ -74,8 +92,17 @@ class ShareServiceModel extends \Business\AbstractModel
));
return $res;
}
public function getQrUrl($id){
return Common::format(PathConst::shareStore,$id);
public function getQrUrl($data,$type='store'){
if($type=='store'){
return Common::format(PathConst::shareStore,$data['id']);
}
if($type=='goods'){
return Common::format(PathConst::shareGoods,$data['goodsId'],$data['goodsCommonid'],$data['storeId']);
}
if($type=='group'){
return Common::format(PathConst::shareGroups,$data['groupId'],$data['storeId']);
}
}
public function growQrcode($data){
......@@ -93,11 +120,11 @@ class ShareServiceModel extends \Business\AbstractModel
$this->memberDb0Redis->tableCacheSet($fileName,$url,ApiConst::zero);
return $url;
}else{
return $this->getQrUrl($data['id']);
return $this->getQrUrl($data);
// return PathConst::wxDefaultPath;
}
}else{
return $this->getQrUrl($data['id']);
return $this->getQrUrl($data);
//不是微信分享就是普通下载的二维码图片
//return PathConst::downLoadQrcode;
}
......@@ -115,12 +142,34 @@ class ShareServiceModel extends \Business\AbstractModel
$this->memberDb0Redis->tableCacheSet($fileName,$url,ApiConst::zero);
return $url;
}else{
return $this->getQrUrl($data['id']);
return $this->getQrUrl($data,'goods');
//return PathConst::wxDefaultPath;
}
}else{
//不是微信分享就是普通下载的二维码图片
return $this->getQrUrl($data['id']);
return $this->getQrUrl($data,'goods');
//return PathConst::downLoadQrcode;
}
}
if($data['type']==\Our\ApiConst::shareGroup){
if(($data['shareType']==ApiConst::shareWxFriend || $data['shareType']==ApiConst::shareWxFriends)){
if(\Our\ApiConst::isWxPublish){
$scene= \Our\Common::format(\Our\PathConst::wxGoodsParams,$data['id']);
$page=\Our\PathConst::wxGoodsPath;
$res=$this->getQrcode($page,$scene);
$fileName=md5($page.$res);
$fileName=$fileName.NameConst::jpgSuffix;
$base64image=$this->dataUri($res,ImageConst::imagePgn);
$url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName);
$this->memberDb0Redis->tableCacheSet($fileName,$url,ApiConst::zero);
return $url;
}else{
return $this->getQrUrl($data,'group');
//return PathConst::wxDefaultPath;
}
}else{
//不是微信分享就是普通下载的二维码图片
return $this->getQrUrl($data,'group');
//return PathConst::downLoadQrcode;
}
}
......
......@@ -20,6 +20,8 @@ class GoodsModel extends \DAO\AbstractModel {
private $cartGoodsField = 'goods_id,goods_storage,store_id,goods_commonid,goods_name,goods_image,goods_spec,snapshot_id';
public $goodsDetailField='goods_id as goodsId,goods_commonid as goodsCommonid,goods_name as goodsName,store_id as storeId';
/**
* 主键
*
......
......@@ -81,7 +81,6 @@ class PBundlingModel extends \DAO\AbstractModel {
public function findById($blId,$field = \Our\NameConst::allField){
$where['bl_id'] = $blId;
$data = $this->find($where,$field);
return $data;
}
......
......@@ -37,6 +37,7 @@ class PBundlingGoodsModel extends \DAO\AbstractModel {
$this->setDb($this->dbName);
return $this->db->select($field)->from($this->_tableName)->join('han_p_bundling_goods',"han_p_bundling_goods.bl_id = han_p_bundling.bl_id",'inner')->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->limit($limit)->fetchAll();
}
/**
* 类实例
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment