Commit 256f1d6d authored by liuyuzhen's avatar liuyuzhen

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz_version1

parents 49b29af5 e9800167
...@@ -157,8 +157,8 @@ class ArrayConst ...@@ -157,8 +157,8 @@ class ArrayConst
); );
const defaultDeliveryMan=array( const defaultDeliveryMan=array(
'id'=>0, 'id'=>0,
'trueName'=>'配送员a', 'trueName'=>'',
'mobile'=>'18650329907', 'mobile'=>'',
); );
const messageOrderButtonsType=array( const messageOrderButtonsType=array(
0,1,2 0,1,2
......
...@@ -181,6 +181,10 @@ class NameConst { ...@@ -181,6 +181,10 @@ class NameConst {
const versionOne = '1.0.0'; const versionOne = '1.0.0';
const versionDefault = '1.0'; const versionDefault = '1.0';
const bySeller='bySeller';
const bySelf='bySelf';
} }
?> ?>
\ No newline at end of file
...@@ -36,10 +36,14 @@ class OrderConst { ...@@ -36,10 +36,14 @@ class OrderConst {
const refoundSuccess="已完成"; const refoundSuccess="已完成";
const sellerRefuse="卖家不同意退款"; const sellerRefuse="卖家不同意退款";
const waitVerify="待商家确认"; const waitVerify="待商家确认";
const sellerAgree="已退款"; const sellerAgree="卖家同意退款";
const sellerAgreeReturn="卖家同意退款,货无需回收";
const alreadyReufndMoney="已退款";
const sellerRefuseGoods="商家已拒绝"; const sellerRefuseGoods="商家已拒绝";
const sellerAgreeGoods="已退款"; // const sellerAgreeGoods="已退款";
const waitSellerRecieve='待收货'; const waitSellerRecieve='待收货';
const goodsStateUnRecieve='未收到货';
const goodsStateRecieved='已收货';
//订单列表描述信息 //订单列表描述信息
const unpayMessage="10分钟后未付款自动取消订单"; const unpayMessage="10分钟后未付款自动取消订单";
const payCancelMessage="付款后10分钟可取消订单"; const payCancelMessage="付款后10分钟可取消订单";
......
...@@ -251,6 +251,10 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -251,6 +251,10 @@ class MessageServiceModel extends \Business\AbstractModel
*/ */
public function getMemberList($memberId, $selfType, $toId, $otherId, $toType = ApiConst::systemMessageType, $field = '*', $pageIndex = ApiConst::pageIndex, $pageSize = ApiConst::pageSize) public function getMemberList($memberId, $selfType, $toId, $otherId, $toType = ApiConst::systemMessageType, $field = '*', $pageIndex = ApiConst::pageIndex, $pageSize = ApiConst::pageSize)
{ {
if($memberId==$toId){
$toType=ApiConst::storeMessageType;
$selfType=ApiConst::memberMessageType;
}
$messageHistory = \DAO\MessageHistoryModel::getInstance(); $messageHistory = \DAO\MessageHistoryModel::getInstance();
$self = $this->getUserByMemberIdAndSelfType($memberId, $selfType); $self = $this->getUserByMemberIdAndSelfType($memberId, $selfType);
if (empty($toId)) { if (empty($toId)) {
...@@ -352,6 +356,10 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -352,6 +356,10 @@ class MessageServiceModel extends \Business\AbstractModel
public function update($fromId, $fromType, $toId, $toType) public function update($fromId, $fromType, $toId, $toType)
{ {
if($fromId==$toId){
$fromType=ApiConst::memberMessageType;
$toType=ApiConst::storeMessageType;
}
$messageHistoryDao = \DAO\MessageHistoryModel::getInstance(); $messageHistoryDao = \DAO\MessageHistoryModel::getInstance();
$messageOneDao = \DAO\MessageOneModel::getInstance(); $messageOneDao = \DAO\MessageOneModel::getInstance();
$messageOneDao->setDb(DbNameConst::masterDBConnectName); $messageOneDao->setDb(DbNameConst::masterDBConnectName);
...@@ -359,8 +367,8 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -359,8 +367,8 @@ class MessageServiceModel extends \Business\AbstractModel
$isSuccess = $messageHistoryDao->updateByFromIdAndSelfTypeAndToIdAndToType($fromId, $fromType, $toId, $toType); $isSuccess = $messageHistoryDao->updateByFromIdAndSelfTypeAndToIdAndToType($fromId, $fromType, $toId, $toType);
$memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance(); $memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
if($isSuccess){ if($isSuccess){
$isSuccess=-1*$isSuccess; $isSuccess=-1*$isSuccess;
$memberDb0Redis->tableHIncrBy($fromId,'unread_message_count',$isSuccess); $memberDb0Redis->tableHIncrBy($fromId,'unread_message_count',$isSuccess);
} }
return $isSuccess; return $isSuccess;
......
...@@ -292,9 +292,17 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -292,9 +292,17 @@ class OrderServiceModel extends \Business\AbstractModel
$returnData['diliverymanId'] = ApiConst::zero; $returnData['diliverymanId'] = ApiConst::zero;
$returnData['deliveryman'] = new \stdClass(); $returnData['deliveryman'] = new \stdClass();
} }
if(!in_array($this->order['paymentType'],ArrayConst::payTypeOnlines)){
$returnData['offlinePayway']=$storeDao->convertOfflinePayway($this->store['offlinePayway']);
}else{
$returnData['offlinePayway']=new \stdClass();
}
if(CURRENTVERSION!=NameConst::versionOne){
$returnData['offlinePayway']='';
}
$returnData['storeMemberId']=$this->store['memberId']; $returnData['storeMemberId']=$this->store['memberId'];
$returnData['totalGoodsNum'] = $orderGoodsDao->getGoodsCount($this->orderGoodsList); $returnData['totalGoodsNum'] = $orderGoodsDao->getGoodsCount($this->orderGoodsList);
$returnData['offlinePayway'] = $this->store['offlinePayway'] ? $this->store['offlinePayway'] : ''; // $returnData['offlinePayway'] = $this->store['offlinePayway'] ? $this->store['offlinePayway'] : '';
$this->address['address']=$orderCommonDao->convertReceiveAddress($this->address['address']); $this->address['address']=$orderCommonDao->convertReceiveAddress($this->address['address']);
$returnData['reciverInfo'] = $this->address; $returnData['reciverInfo'] = $this->address;
$returnData['reciverInfo']['mobPhone']=!empty($returnData['reciverInfo']['mobPhone'])?$returnData['reciverInfo']['mobPhone']:''; $returnData['reciverInfo']['mobPhone']=!empty($returnData['reciverInfo']['mobPhone'])?$returnData['reciverInfo']['mobPhone']:'';
......
...@@ -443,7 +443,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -443,7 +443,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderCommons = $orderCommonDao->getAllByOrderIds($orderIds, $orderCommonDao->orderCommonField); $orderCommons = $orderCommonDao->getAllByOrderIds($orderIds, $orderCommonDao->orderCommonField);
$orderCommons=$orderDao->convertOrder($orderCommons,'orderId'); $orderCommons=$orderDao->convertOrder($orderCommons,'orderId');
foreach ($refundMerge as &$value) { foreach ($refundMerge as &$value) {
$value['stateName'] = $refundReturnDao->getRefundTextStatus($value); $value['stateName'] = $refundReturnDao->getRefundTextStatus($value,true);
/*$value['blId'] = isset($value['blId']) ? (!is_null($value['blId']) ? $value['blId'] : ApiConst::zero) : ApiConst::zero; /*$value['blId'] = isset($value['blId']) ? (!is_null($value['blId']) ? $value['blId'] : ApiConst::zero) : ApiConst::zero;
$value['canPlatformIn'] = $refundReturnDao->isPlatformIn($value) ? ApiConst::one : ApiConst::zero; $value['canPlatformIn'] = $refundReturnDao->isPlatformIn($value) ? ApiConst::one : ApiConst::zero;
$value['canSendShippingType'] = $refundReturnDao->checkIsAddReturnShipping($value) ? ApiConst::one : ApiConst::zero;*/ $value['canSendShippingType'] = $refundReturnDao->checkIsAddReturnShipping($value) ? ApiConst::one : ApiConst::zero;*/
...@@ -942,7 +942,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -942,7 +942,8 @@ class RefundServiceModel extends \Business\AbstractModel
if($info['refundShippingType']==ApiConst::bySeller){ if($info['refundShippingType']==ApiConst::bySeller){
if($info['returnType']==ApiConst::returnTypeMustReturn){ if($info['returnType']==ApiConst::returnTypeMustReturn){
if(!$info['diliverymanId']){ if(!$info['diliverymanId']){
$info['diliveryman']=ArrayConst::defaultDeliveryMan; $info['diliveryman']=new \stdClass();
// $info['diliveryman']=ArrayConst::defaultDeliveryMan;
}else{ }else{
$diliveryMan=$diliveryManDao->findById($info['diliverymanId']); $diliveryMan=$diliveryManDao->findById($info['diliverymanId']);
if(!empty($diliveryMan)){ if(!empty($diliveryMan)){
......
...@@ -388,6 +388,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -388,6 +388,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{ {
$order = array('gmt_update' => 'desc'); $order = array('gmt_update' => 'desc');
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeId = $this->_getStoreByMemberId($memberId); $storeId = $this->_getStoreByMemberId($memberId);
if (empty($storeId)) { if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::paramsError); ErrorModel::throwException(CodeConfigModel::paramsError);
...@@ -411,13 +412,16 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -411,13 +412,16 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$where = 'han_order.store_id=' . $storeId; $where = 'han_order.store_id=' . $storeId;
if ($orderState == ApiConst::oneHandred || (int)$orderState == ApiConst::oneHandredOne) { if ($orderState == ApiConst::oneHandred || (int)$orderState == ApiConst::oneHandredOne) {
if ($orderState == ApiConst::oneHandred) { if ($orderState == ApiConst::oneHandred) {
$where .= ' and han_order.shipping_type=' . ApiConst::bySelf; // $where=$orderDao->getWaitDeliveryCondition();
// $where .= ' and han_order.shipping_type=' . ApiConst::bySelf;
$where=$orderDao->getByselfCondition($storeId);
} else { } else {
$order=array( $order=array(
'diliveryman_id'=>'asc', 'diliveryman_id'=>'asc',
'gmt_update'=>'asc' 'gmt_update'=>'asc'
); );
$where .= ' and han_order.shipping_type=' . ApiConst::bySeller; // $where .= ' and han_order.shipping_type=' . ApiConst::bySeller;
$where=$orderDao->getWaitDeliveryCondition($storeId);
} }
} else { } else {
...@@ -916,8 +920,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -916,8 +920,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeId = $memberDao->getInfo($memberId, 'store_id'); $storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm); $waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm);
$waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySeller, ApiConst::orderStateWaitRecieve); $waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId);
$waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySelf, ApiConst::orderStateWaitRecieve); $waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId,NameConst::bySelf);
$orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount; $orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount;
return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount); return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount);
} }
......
...@@ -110,6 +110,7 @@ class SalespersonServiceModel extends \Business\AbstractModel ...@@ -110,6 +110,7 @@ class SalespersonServiceModel extends \Business\AbstractModel
'qrCode'=>$qrCode, 'qrCode'=>$qrCode,
'memberName'=>$storeInfo['store_name'], 'memberName'=>$storeInfo['store_name'],
'memberAvatarUrl'=>$storeLabel, 'memberAvatarUrl'=>$storeLabel,
'memberAvatarUrlR20'=>$storeModelDAO->getStoreLabelSrc($storeInfo['store_label'],'','',true).'?x-oss-process=image/rounded-corners,r_20',
'goods'=>$goods ? array($goods) : $goods 'goods'=>$goods ? array($goods) : $goods
]; ];
} }
...@@ -145,6 +146,7 @@ class SalespersonServiceModel extends \Business\AbstractModel ...@@ -145,6 +146,7 @@ class SalespersonServiceModel extends \Business\AbstractModel
'qrCode'=>$qrCode, 'qrCode'=>$qrCode,
'memberName'=>$storeInfo['store_name'], 'memberName'=>$storeInfo['store_name'],
'memberAvatarUrl'=>$storeLabel, 'memberAvatarUrl'=>$storeLabel,
'memberAvatarUrlR20'=>$storeModelDAO->getStoreLabelSrc($storeInfo['store_label'],'','',true).'?x-oss-process=image/rounded-corners,r_20',
'goods'=>$data ? array($data) : $data 'goods'=>$data ? array($data) : $data
]; ];
$hashData[$saleGoods[$id]][$saleGoods[$id].'_'.$memberId] = $qrCode; $hashData[$saleGoods[$id]][$saleGoods[$id].'_'.$memberId] = $qrCode;
...@@ -250,6 +252,7 @@ class SalespersonServiceModel extends \Business\AbstractModel ...@@ -250,6 +252,7 @@ class SalespersonServiceModel extends \Business\AbstractModel
$info['qrCode'] = $qrcode; $info['qrCode'] = $qrcode;
$info['memberName'] = $storeInfo['store_name']; $info['memberName'] = $storeInfo['store_name'];
$info['memberAvatarUrl'] = $storeLabel; $info['memberAvatarUrl'] = $storeLabel;
$info['memberAvatarUrlR20'] = $storeModelDAO->getStoreLabelSrc($storeInfo['store_label'],'','',true).'?x-oss-process=image/rounded-corners,r_20';
$info = array_merge($info,$goods); $info = array_merge($info,$goods);
}else{ }else{
\Error\ErrorModel::throwException(\Error\CodeConfigModel::saleActOrGoodsNotExist); \Error\ErrorModel::throwException(\Error\CodeConfigModel::saleActOrGoodsNotExist);
......
...@@ -72,7 +72,11 @@ class MessageHistoryModel extends \DAO\AbstractModel { ...@@ -72,7 +72,11 @@ class MessageHistoryModel extends \DAO\AbstractModel {
} }
public function updateByFromIdAndSelfTypeAndToIdAndToType($fromId,$fromType,$toId,$toType){ public function updateByFromIdAndSelfTypeAndToIdAndToType($fromId,$fromType,$toId,$toType){
$where=Common::format(" (((fromId={0} and toId={1} and toType={2} and fromType={3}) and status=0))",$toId,$fromId,$fromType,$toType); if($fromId!=$toId){
$where=Common::format(" (((fromId={0} and toId={1} and toType={2} and fromType={3}) and status=0))",$toId,$fromId,$fromType,$toType);
}else{
$where=Common::format(" (((fromId={0} and toId={1} and toType={2} and fromType={3}) and status=0))",$toId,$fromId,$toType,$fromType);
}
$data['status']=ApiConst::read; $data['status']=ApiConst::read;
return $this->updateByWhere($where,$data); return $this->updateByWhere($where,$data);
} }
......
...@@ -1035,7 +1035,8 @@ class OrderModel extends \DAO\AbstractModel ...@@ -1035,7 +1035,8 @@ class OrderModel extends \DAO\AbstractModel
'buyerId' => 'buyer_id', 'buyerId' => 'buyer_id',
'deliveryTime' => 'delivery_time', 'deliveryTime' => 'delivery_time',
'evaluationState'=>'evaluation_state', 'evaluationState'=>'evaluation_state',
'orderNote'=>'order_note' 'orderNote'=>'order_note',
'isReceivePayment'=>'is_receive_payment'
); );
} }
...@@ -1127,10 +1128,35 @@ class OrderModel extends \DAO\AbstractModel ...@@ -1127,10 +1128,35 @@ class OrderModel extends \DAO\AbstractModel
$count=$this->getCountByWhere($where); $count=$this->getCountByWhere($where);
return $count; return $count;
} }
public function getCountByShippingTypeAndOrderState($storeId,$shippingType,$orderState){ //获得店铺待配送或者待自提订单条件
$where['store_id']=$storeId; public function getWaitDeliveryCondition($id,$memberType='seller'){
$where['shipping_type']=$shippingType; if($memberType=='seller'){
$where['order_state']=$orderState; $where['store_id']=$id;
}else{
$where['member_id']=$id;
}
$where['shipping_type']=ApiConst::bySeller;
$where['order_state']=array('in',array(ApiConst::orderStateWaitSend,ApiConst::orderStateWaitRecieve));
return $where;
}
public function getByselfCondition($id,$memberType='seller'){
if($memberType=='seller'){
$where['store_id']=$id;
}else{
$where['member_id']=$id;
}
$where['shipping_type']=ApiConst::bySelf;
$where['order_state']=ApiConst::orderStateWaitRecieve;
return $where;
}
public function getCountByShippingTypeAndOrderState($storeId,$type=NameConst::bySeller){
if($type==NameConst::bySeller){
$where=$this->getWaitDeliveryCondition($storeId);
}
if($type==NameConst::bySelf){
$where=$this->getByselfCondition($storeId);
}
$count=$this->getCountByWhere($where); $count=$this->getCountByWhere($where);
return $count; return $count;
} }
......
...@@ -163,26 +163,36 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -163,26 +163,36 @@ class RefundReturnModel extends \DAO\AbstractModel {
return $this->getAll($where,$field); return $this->getAll($where,$field);
} }
public function getStatusExtent($returnRefund){ public function getStatusExtent($returnRefund,$isSeller=false){
// if($returnRefund['refundState']!=ApiConst::refundCompleted){ // if($returnRefund['refundState']!=ApiConst::refundCompleted){
if($returnRefund['sellerState']==ApiConst::refundSellerAgree){ if($returnRefund['sellerState']==ApiConst::refundSellerAgree){
if($returnRefund['isSucRefund']==ApiConst::refundSuccess){ if($returnRefund['isSucRefund']==ApiConst::refundSuccess){
return OrderConst::refoundSuccess; return OrderConst::alreadyReufndMoney;
} }
if($returnRefund['refundType']==ApiConst::refundTypeMoney){ if($returnRefund['refundType']==ApiConst::refundTypeMoney){
return OrderConst::sellerAgree; return OrderConst::sellerAgree;
} }
if($returnRefund['refundType']==ApiConst::refundTypeGoods){ if($returnRefund['refundType']==ApiConst::refundTypeGoods){
if($returnRefund['isSucRefund']==ApiConst::refundSuccess){ if($returnRefund['isSucRefund']==ApiConst::refundSuccess){
return OrderConst::sellerAgreeGoods; return OrderConst::alreadyReufndMoney;
}else{ }
if($returnRefund['goodsState']==ApiConst::goodsStateUnRecieve){
return OrderConst::goodsStateUnRecieve;
}
if($returnRefund['goodsState']==ApiConst::goodsStateRecieved){
return OrderConst::goodsStateRecieved;
}
if($returnRefund['returnType']==ApiConst::returnTypeNotReturn){
return OrderConst::sellerAgreeReturn;
}
if($returnRefund['returnType']==ApiConst::returnTypeMustReturn){
return OrderConst::waitSellerRecieve; return OrderConst::waitSellerRecieve;
} }
} }
} }
if($returnRefund['sellerState']==ApiConst::refundSellerRefuse){ if($returnRefund['sellerState']==ApiConst::refundSellerRefuse){
if($returnRefund['isSucRefund']==ApiConst::refundSuccess){ if($returnRefund['isSucRefund']==ApiConst::refundSuccess){
return OrderConst::refoundSuccess; return OrderConst::alreadyReufndMoney;
} }
if($returnRefund['platformState']==ApiConst::platAgree){ if($returnRefund['platformState']==ApiConst::platAgree){
return OrderConst::platFormAgree; return OrderConst::platFormAgree;
...@@ -204,15 +214,15 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -204,15 +214,15 @@ class RefundReturnModel extends \DAO\AbstractModel {
// }else{ // }else{
// return OrderConst::refoundSuccess; // return OrderConst::refoundSuccess;
// } // }
return '';
} }
public function getRefundTextStatus($refundReturn){ public function getRefundTextStatus($refundReturn,$isSeller=false){
$refundText=''; $refundText='';
switch($refundReturn['sellerState']){ switch($refundReturn['sellerState']){
case ApiConst::refundSellerVerify:$refundText=OrderConst::waitVerify;break; case ApiConst::refundSellerVerify:$refundText=OrderConst::waitVerify;break;
case ApiConst::refundSellerAgree:$refundText=$this->getStatusExtent($refundReturn);break; default: $refundText=$this->getStatusExtent($refundReturn,$isSeller);break;
case ApiConst::refundSellerRefuse:$refundText=$this->getStatusExtent($refundReturn);break;
} }
return $refundText; return $refundText;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace DAO; namespace DAO;
use Our\ApiConst; use Our\ApiConst;
use Our\ArrayConst;
use Our\DbNameConst; use Our\DbNameConst;
use Our\ImageConst; use Our\ImageConst;
...@@ -13,7 +14,7 @@ use Our\ImageConst; ...@@ -13,7 +14,7 @@ use Our\ImageConst;
class StoreModel extends \DAO\AbstractModel class StoreModel extends \DAO\AbstractModel
{ {
public $detailField= " member_id as memberId,store_id as storeId,offline_payway as offlinePayway,store_label as storeLabel"; public $detailField = " member_id as memberId,store_id as storeId,offline_payway as offlinePayway,store_label as storeLabel,offline_payway as offlinePayway";
protected function init() protected function init()
{ {
...@@ -35,6 +36,24 @@ class StoreModel extends \DAO\AbstractModel ...@@ -35,6 +36,24 @@ class StoreModel extends \DAO\AbstractModel
protected $_primaryKey = 'store_id'; protected $_primaryKey = 'store_id';
public function convertOfflinePayway($offlinPayway)
{
if (!empty($offlinPayway)) {
$offlinPayway=unserialize($offlinPayway);
$res['images']=[];
foreach($offlinPayway['images'] as $image){
$image= \Our\Common::getStaticFile($image, \Our\ImageConst::storeLabel);
array_push($res['images'],$image);
}
$res['payway']=$offlinPayway['payway']?$offlinPayway['payway']:'';
}
if(empty($res)){
$res=new \stdClass();
}
return $res;
}
/** /**
* 获取店铺信息 * 获取店铺信息
...@@ -52,7 +71,6 @@ class StoreModel extends \DAO\AbstractModel ...@@ -52,7 +71,6 @@ class StoreModel extends \DAO\AbstractModel
} }
public function getInfoById($id, $field = '*', $isField = false) public function getInfoById($id, $field = '*', $isField = false)
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
...@@ -83,7 +101,7 @@ class StoreModel extends \DAO\AbstractModel ...@@ -83,7 +101,7 @@ class StoreModel extends \DAO\AbstractModel
* @param $storeLabel * @param $storeLabel
* @return string * @return string
*/ */
public function getStoreLabelSrc($storeLabel, $width = \Our\ImageConst::circleStoreLabel, $height = 0) public function getStoreLabelSrc($storeLabel, $width = \Our\ImageConst::circleStoreLabel, $height = 0,$original = false)
{ {
$width = ceil($width * \Our\ImageConst::sizeScale); $width = ceil($width * \Our\ImageConst::sizeScale);
$height ? $height = ceil($height * \Our\ImageConst::sizeScale) : $height = $width; $height ? $height = ceil($height * \Our\ImageConst::sizeScale) : $height = $width;
...@@ -92,9 +110,12 @@ class StoreModel extends \DAO\AbstractModel ...@@ -92,9 +110,12 @@ class StoreModel extends \DAO\AbstractModel
} else { } else {
$storeLabel = \Our\Common::getStaticFile(ImageConst::defaultStoreLabelName, ImageConst::defaultPath); $storeLabel = \Our\Common::getStaticFile(ImageConst::defaultStoreLabelName, ImageConst::defaultPath);
} }
$storeLabel .= "?x-oss-process=image/resize,m_fill,h_{$height},w_{$width}"; if($original == false) {
$storeLabel .= "?x-oss-process=image/resize,m_fill,h_{$height},w_{$width}";
}
return $storeLabel; return $storeLabel;
} }
/** /**
* 店铺首页banner * 店铺首页banner
* *
...@@ -111,6 +132,7 @@ class StoreModel extends \DAO\AbstractModel ...@@ -111,6 +132,7 @@ class StoreModel extends \DAO\AbstractModel
$storeLabel .= "?x-oss-process=image/resize,m_fill,h_314,w_750"; $storeLabel .= "?x-oss-process=image/resize,m_fill,h_314,w_750";
return $storeLabel; return $storeLabel;
} }
/** /**
* 店铺月销量 * 店铺月销量
* *
...@@ -132,12 +154,12 @@ class StoreModel extends \DAO\AbstractModel ...@@ -132,12 +154,12 @@ class StoreModel extends \DAO\AbstractModel
* @param $field 可获取 * @param $field 可获取
* @return mixed 返回店铺列表 * @return mixed 返回店铺列表
*/ */
public function getOnlineStores($where = null, $field = '*', $limit=[]) public function getOnlineStores($where = null, $field = '*', $limit = [])
{ {
$conditionSql = 'store_state =1 and open_flag =1 and (store_end_time >=' . TIMESTAMP . ' or store_end_time =0 ) '; $conditionSql = 'store_state =1 and open_flag =1 and (store_end_time >=' . TIMESTAMP . ' or store_end_time =0 ) ';
if ($where) { if ($where) {
$conditionSql = $where. ' and '.$conditionSql; $conditionSql = $where . ' and ' . $conditionSql;
} }
$result = $this->getStores($conditionSql, $field, $limit); $result = $this->getStores($conditionSql, $field, $limit);
return $result; return $result;
...@@ -180,14 +202,15 @@ class StoreModel extends \DAO\AbstractModel ...@@ -180,14 +202,15 @@ class StoreModel extends \DAO\AbstractModel
return $this->isChargeGet($storeId); return $this->isChargeGet($storeId);
} }
} }
//获取是否应该收取服务费或快递费 //获取是否应该收取服务费或快递费
public function isFee($storeId,$shippingtype,$orderStatus) public function isFee($storeId, $shippingtype, $orderStatus)
{ {
if($shippingtype!=ApiConst::express){ if ($shippingtype != ApiConst::express) {
return $this->isGetFee($storeId,$orderStatus); return $this->isGetFee($storeId, $orderStatus);
}else{ } else {
return $this->isChargeGet($storeId); return $this->isChargeGet($storeId);
} }
} }
...@@ -197,12 +220,12 @@ class StoreModel extends \DAO\AbstractModel ...@@ -197,12 +220,12 @@ class StoreModel extends \DAO\AbstractModel
* @param $field * @param $field
* @return mixed * @return mixed
*/ */
public function getStores($where, $field = "*", $limit =[]) public function getStores($where, $field = "*", $limit = [])
{ {
$this->setDb(); $this->setDb();
if($limit){ if ($limit) {
$result = $this->db->select($field)->from($this->_tableName)->where($where)->limit($limit[0],$limit[1])->fetchAll(); $result = $this->db->select($field)->from($this->_tableName)->where($where)->limit($limit[0], $limit[1])->fetchAll();
}else{ } else {
$result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
} }
return $result; return $result;
...@@ -216,8 +239,9 @@ class StoreModel extends \DAO\AbstractModel ...@@ -216,8 +239,9 @@ class StoreModel extends \DAO\AbstractModel
return $stores; return $stores;
} }
public function delStoresCacheByCityCode($cityCode){ public function delStoresCacheByCityCode($cityCode)
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOnlineStores'),array(),array($cityCode)); {
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOnlineStores'), array(), array($cityCode));
} }
/** /**
...@@ -226,7 +250,7 @@ class StoreModel extends \DAO\AbstractModel ...@@ -226,7 +250,7 @@ class StoreModel extends \DAO\AbstractModel
* @return mixed 当前城市列表 * @return mixed 当前城市列表
* @throws \Our\Exception * @throws \Our\Exception
*/ */
public function getExpressStores( $field = 'store_id,store_longitude,store_latitude,max_sign_rang,max_sales_rang,store_sales_scope') public function getExpressStores($field = 'store_id,store_longitude,store_latitude,max_sign_rang,max_sales_rang,store_sales_scope')
{ {
$storeClassCondition = " express_distribution = 1 "; $storeClassCondition = " express_distribution = 1 ";
...@@ -235,9 +259,10 @@ class StoreModel extends \DAO\AbstractModel ...@@ -235,9 +259,10 @@ class StoreModel extends \DAO\AbstractModel
return $stores; return $stores;
} }
public function deleteExpressStores($field = 'store_id,store_longitude,store_latitude,max_sign_rang,max_sales_rang,store_sales_scope'){ public function deleteExpressStores($field = 'store_id,store_longitude,store_latitude,max_sign_rang,max_sales_rang,store_sales_scope')
{
$storeClassCondition = " express_distribution = 1 "; $storeClassCondition = " express_distribution = 1 ";
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOnlineStores'),array(array($storeClassCondition, $field))); \Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOnlineStores'), array(array($storeClassCondition, $field)));
} }
public function getNearbyStores($cityCode, $storeIds) public function getNearbyStores($cityCode, $storeIds)
...@@ -248,51 +273,55 @@ class StoreModel extends \DAO\AbstractModel ...@@ -248,51 +273,55 @@ class StoreModel extends \DAO\AbstractModel
return $returnStores; return $returnStores;
} }
public function delNearbyStoresCache($cityCode){ public function delNearbyStoresCache($cityCode)
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOnlineStores'),array(),array($cityCode)); {
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOnlineStores'), array(), array($cityCode));
} }
public function getAddress($storeId){ public function getAddress($storeId)
{
$storeInfo = $this->getStoreInfoCache($storeId); $storeInfo = $this->getStoreInfoCache($storeId);
//地址 //地址
$address = ''; $address = '';
if($storeInfo['area_info']){ if ($storeInfo['area_info']) {
$address .= $storeInfo['area_info']; $address .= $storeInfo['area_info'];
} }
if($storeInfo['store_address']){ if ($storeInfo['store_address']) {
$address .= $storeInfo['store_address']; $address .= $storeInfo['store_address'];
} }
return $address; return $address;
} }
public function get($storeId,$label = true,$reportError = true)
public function get($storeId, $label = true, $reportError = true)
{ {
$storeInfo = $this->getStoreInfoCache($storeId); $storeInfo = $this->getStoreInfoCache($storeId);
if(!$storeInfo) { if (!$storeInfo) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::storeNotExistOrClose); \Error\ErrorModel::throwException(\Error\CodeConfigModel::storeNotExistOrClose);
} }
if($storeInfo['open_flag'] != 1 || $storeInfo['store_state'] != 1){ if ($storeInfo['open_flag'] != 1 || $storeInfo['store_state'] != 1) {
if($reportError) { if ($reportError) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::storeNotExistOrClose); \Error\ErrorModel::throwException(\Error\CodeConfigModel::storeNotExistOrClose);
}else{ } else {
$storeInfo['isClose'] = 1; $storeInfo['isClose'] = 1;
} }
}else{ } else {
$storeInfo['isClose'] = 0; $storeInfo['isClose'] = 0;
} }
if($label){ if ($label) {
//店铺头像 //店铺头像
$storeLabel = $this->getStoreLabelSrc($storeInfo['store_label']); $storeLabel = $this->getStoreLabelSrc($storeInfo['store_label']);
return array($storeInfo,$storeLabel); return array($storeInfo, $storeLabel);
} }
return $storeInfo; return $storeInfo;
} }
public function getStoreInfoCache($storeId) { public function getStoreInfoCache($storeId)
$storeInfo = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(),array(&$this, 'getInfoById'),array($storeId),\Our\ApiConst::sevenDaySecond,array($storeId)); {
$storeInfo = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getInfoById'), array($storeId), \Our\ApiConst::sevenDaySecond, array($storeId));
return $storeInfo; return $storeInfo;
} }
...@@ -315,18 +344,18 @@ class StoreModel extends \DAO\AbstractModel ...@@ -315,18 +344,18 @@ class StoreModel extends \DAO\AbstractModel
*/ */
public function getShareInfo($storeInfo) public function getShareInfo($storeInfo)
{ {
if(!is_array($storeInfo)){ if (!is_array($storeInfo)) {
$storeInfo = $this->get($storeInfo,false); $storeInfo = $this->get($storeInfo, false);
} }
$share['title'] = $storeInfo['store_share_title']?$storeInfo['store_share_title']:$storeInfo['store_name']; $share['title'] = $storeInfo['store_share_title'] ? $storeInfo['store_share_title'] : $storeInfo['store_name'];
$share['desc']= $storeInfo['store_share_desc']?$storeInfo['store_share_desc']:$storeInfo['store_notice']; $share['desc'] = $storeInfo['store_share_desc'] ? $storeInfo['store_share_desc'] : $storeInfo['store_notice'];
if($storeInfo['store_share_img']){ if ($storeInfo['store_share_img']) {
$img = $this->getStoreShareSrc($storeInfo['store_share_img']); $img = $this->getStoreShareSrc($storeInfo['store_share_img']);
}else{ } else {
$img = $this->getStoreLabelSrc($storeInfo['store_label']); $img = $this->getStoreLabelSrc($storeInfo['store_label']);
} }
$share['imgUrl'] = $img; $share['imgUrl'] = $img;
$share['link']='http://www.shenbd.com'; $share['link'] = 'http://www.shenbd.com';
return $share; return $share;
} }
...@@ -336,15 +365,16 @@ class StoreModel extends \DAO\AbstractModel ...@@ -336,15 +365,16 @@ class StoreModel extends \DAO\AbstractModel
* @param $store * @param $store
* @return int * @return int
*/ */
public function checkAddressInServiceArea($address,$store){ public function checkAddressInServiceArea($address, $store)
{
$inAreaFlag = \Our\ApiConst::zero; $inAreaFlag = \Our\ApiConst::zero;
if($store['buyer_distribution']||$store['express_distribution']){//如果店铺开启了到店自提和快递配送,则认为存在可用配送方式 if ($store['buyer_distribution'] || $store['express_distribution']) {//如果店铺开启了到店自提和快递配送,则认为存在可用配送方式
$inAreaFlag = \Our\ApiConst::one; $inAreaFlag = \Our\ApiConst::one;
return $inAreaFlag; return $inAreaFlag;
} }
if($store['seller_distribution']&&$address){ if ($store['seller_distribution'] && $address) {
$result = \Store\StoreUtil::getInstance()->checkAddressInServiceArea(array('lng'=>$address['lng'],'lat'=>$address['lat']),$store['store_id']); $result = \Store\StoreUtil::getInstance()->checkAddressInServiceArea(array('lng' => $address['lng'], 'lat' => $address['lat']), $store['store_id']);
if($result){ if ($result) {
$inAreaFlag = \Our\ApiConst::one; $inAreaFlag = \Our\ApiConst::one;
} }
} }
...@@ -352,7 +382,6 @@ class StoreModel extends \DAO\AbstractModel ...@@ -352,7 +382,6 @@ class StoreModel extends \DAO\AbstractModel
} }
/** /**
* 类实例 * 类实例
* *
...@@ -365,7 +394,7 @@ class StoreModel extends \DAO\AbstractModel ...@@ -365,7 +394,7 @@ class StoreModel extends \DAO\AbstractModel
* *
* @return \DAO\UserModel * @return \DAO\UserModel
*/ */
public static function getInstance($dbName=\Our\DbNameConst::salveDBConnectName) public static function getInstance($dbName = \Our\DbNameConst::salveDBConnectName)
{ {
if (!(self::$_instance instanceof self)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self($dbName); self::$_instance = new self($dbName);
...@@ -449,23 +478,25 @@ class StoreModel extends \DAO\AbstractModel ...@@ -449,23 +478,25 @@ class StoreModel extends \DAO\AbstractModel
); );
} }
public function getAll($where=array()){ public function getAll($where = array())
{
$this->setDb($this->dbName); $this->setDb($this->dbName);
if($where){ if ($where) {
$where=$this->db->getSqlWhereByArray($where); $where = $this->db->getSqlWhereByArray($where);
} }
if($where){ if ($where) {
$res=$this->db->from($this->_tableName)->where($where)->fetchAll(); $res = $this->db->from($this->_tableName)->where($where)->fetchAll();
}else{ } else {
$res=$this->db->from($this->_tableName)->fetchAll(); $res = $this->db->from($this->_tableName)->fetchAll();
} }
$resArray=array(); $resArray = array();
foreach($res as $val){ foreach ($res as $val) {
$resArray[$val['store_id']]=$val; $resArray[$val['store_id']] = $val;
} }
return $resArray; return $resArray;
} }
/** /**
* 保存用户信息 * 保存用户信息
*/ */
...@@ -476,7 +507,8 @@ class StoreModel extends \DAO\AbstractModel ...@@ -476,7 +507,8 @@ class StoreModel extends \DAO\AbstractModel
return $result; return $result;
} }
public function save($data,$where){ public function save($data, $where)
{
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$result = $this->db->update($this->_tableName)->rows($data)->where($where)->execute(); $result = $this->db->update($this->_tableName)->rows($data)->where($where)->execute();
return $result; return $result;
......
...@@ -95,6 +95,11 @@ config.url.ossHost = "http://qmoss-01.oss-cn-hangzhou.aliyuncs.com" ...@@ -95,6 +95,11 @@ config.url.ossHost = "http://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
;推送域名 ;推送域名
config.url.pushHost="127.0.0.1:9503"; config.url.pushHost="127.0.0.1:9503";
config.url.indexUrl="/www/web/test_qm_com/application/library/React"
config.url.libary="/www/web/test_qm_com/application/library"
config.url.source="/www/web/test_qm_com/public_html/data/upload/"
;config.url.source="E:/WAMP/www/www.qm.com/data/upload/" ;config.url.source="E:/WAMP/www/www.qm.com/data/upload/"
; 文件目录 ; 文件目录
;店铺图片报错目录 ;店铺图片报错目录
......
...@@ -107,7 +107,10 @@ $serv->on('Message', function($server, $frame) use($conf){ ...@@ -107,7 +107,10 @@ $serv->on('Message', function($server, $frame) use($conf){
$sendMessage['toType']= $rev_data['toType']; $sendMessage['toType']= $rev_data['toType'];
if(!empty($sendFd)){ if(!empty($sendFd)){
echo '发送fd:'.$sendFd; echo '发送fd:'.$sendFd;
$server->push($sendFd, responseJson(1,"fromMsg","success", $sendMessage)); if($sendFd!=$frame->fd){
$server->push($sendFd, responseJson(1,"fromMsg","success", $sendMessage));
}
} }
echo 'afterSendFd:'.$sendFd; echo 'afterSendFd:'.$sendFd;
} }
......
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