Commit 475ad9c8 authored by zhz's avatar zhz

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

parents 926e0b3d 2dbed9ac
......@@ -36,8 +36,10 @@ class IndexController extends \Our\Controller_Abstract {
// ErrorModel::throwException(CodeConfigModel::authExpire);
}
$this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$paramsStr= $this->memberDb0Redis->tablelpop($this->key);
$paramsStr=json_decode($paramsStr,true);
$this->_view->assign("params", $paramsStr);
if($paramsStr['type']==\Our\ApiConst::sharePlat){
$this->_view->display('index/plat.phtml');
......@@ -45,7 +47,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 || $paramsStr['type']==\Our\ApiConst::shareGroup){
$this->_view->display('index/goods.phtml');
}
if($paramsStr['type']==\Our\ApiConst::shareSaler){
......
......@@ -387,6 +387,7 @@ class OrderConfirmUtil {
$delivery['deliveryFee'] = $deliveryFee;
$delivery['deliveryType'] = $requestData['deliveryType'];
$delivery['deliveryTime'] = isset($deliveryTime)?$deliveryTime:\Our\ApiConst::zero;
$delivery['needShippingFee'] = isset($temp['other'])?$temp['other']:\Our\ApiConst::zero;
$storeCartData['cartList'][$storeId]['delivery'] = $delivery;
if(($requestData['payway'] == \Our\ApiConst::payOnline&&$temp['onelinePay']==\Our\ApiConst::one)||
($requestData['payway'] == \Our\ApiConst::payOffline&&$temp['offlinePay']==\Our\ApiConst::one)||
......@@ -510,7 +511,15 @@ class OrderConfirmUtil {
$order['store_name'] = $storeCarts['storeName'];
$order['buyer_id'] = $this->memberId;
$order['buyer_name'] = $this->member['memberName'];
if(CURRENTVERSION==\Our\NameConst::versionOne){
if($storeCarts['delivery']['deliveryType'] == \Our\ApiConst::deliveryBuyer){
$order['buyer_email'] = $storeCarts['delivery']['buyerMobile'];
}else{
$order['buyer_email'] = $this->address['mob_phone'];
}
}else{
$order['buyer_email'] = $this->member['memberEmail'];
}
$order['add_time'] = TIMESTAMP;
$order['payment_type'] = $storeCarts['payway'];
$order['order_amount'] = $storeCarts['orderAmount'];
......@@ -527,6 +536,7 @@ class OrderConfirmUtil {
$logMsg = \Our\DescribeConst::addNoPayOrderLog;
}
$order['shipping_fee'] = $storeCarts['delivery']['deliveryFee'];
$order['need_shipping_fee'] = isset($storeCarts['delivery']['needShippingFee'])?$storeCarts['delivery']['needShippingFee']:\Our\ApiConst::zero;
$order['goods_amount'] = $storeCarts['storeTotalPrice'];
$order['shipping_type'] = $storeCarts['delivery']['deliveryType'];
if($storeCarts['delivery']['deliveryType'] == \Our\ApiConst::deliveryStore){
......
......@@ -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支付宝支付
......
......@@ -152,6 +152,9 @@ class DescribeConst
const refund='退款';
const refundRetund='退货';
const sellerRefuseReturn='卖家拒绝退货';
const sellerAgreeReturn='卖家同意退货';
//用户订单送达消息
const reacheRemindTitle='你的订单卖家已经送达';
const reacheRemindContent='你有新的订单号为{0}的订单已经已经送达';
......
......@@ -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='|';
......
......@@ -734,6 +734,7 @@ class CartServiceModel extends \Business\AbstractModel{
$deliverySetting['deliverTimeList'] =$deliverTimeList['timeList'];
$storeCartData['cartList'][$storeId]['storeDistance'] = $storeDistance;
$deliverySetting['sellerDefaultFee'] = $deliverTimeList['default']?$deliverTimeList['default']:\Our\ApiConst::zero;
$deliverySetting['other'] = $deliverTimeList['other']?$deliverTimeList['other']:\Our\ApiConst::zero;
}
}
}
......
......@@ -732,6 +732,23 @@ class OrderServiceModel extends \Business\AbstractModel
if ($order['paymentTime'] > ApiConst::zero && in_array($order['paymentType'], ArrayConst::orderPayTypeOnlines)) {
$this->changeOrderStateCancelUnconditional($order);
}
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
$storeDao->deleteStoreCache($order['storeId'],$order['orderId']);
$push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order['storeId'],
'type'=>ApiConst::messageWaitReceive,
'waitReceiveCount'=>ApiConst::reduceOne,
'waitDeliveryCount'=>0,
'waitGetCount'=>0,
'orderCount'=>ApiConst::reduceOne,
'waitRefundProccessCount'=>ApiConst::zero,
'waitRefundReceiveCount'=>ApiConst::zero,
'refundCount'=>ApiConst::zero,
'alertCount'=>ApiConst::zero,
'params'=>array('c'=>'shopkeeper',
'm'=>'orderDetail',
'orderId'=>$order['orderId']));
$push->addOneToClient($pushData);
}
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
$storeDao->deleteStoreCache($order['storeId'],$order['orderId']);
......@@ -1065,7 +1082,9 @@ class OrderServiceModel extends \Business\AbstractModel
$dlyoPickupCode = \Our\NameConst::emptyString;
foreach ($orderList as $order) {
$orderNos[] = $order['order_sn'];
if($order['shipping_type']==\Our\ApiConst::bySelf){
$dlyoPickupCode = substr($order['order_sn'], ApiConst::positionPickupCodeBegin);
}
if ($order['order_state'] == \Our\ApiConst::orderStateWaitPay) {
$orderTips = \Our\DescribeConst::payFailedTips;
$orderSubTips = \Our\DescribeConst::payFailedSubTips;
......
......@@ -58,7 +58,11 @@ class DeliveryServiceModel extends \Business\AbstractModel
$qmDeliveryManLogData['delivery_state'] = ApiConst::deliveryStateWait;
$qmDeliveryManLogData['distribution_fee'] =$data['distributionFee'];
$qmDeliveryManLogData['order_type'] = $data['orderType'];
if($data['orderType']==ApiConst::orderTypeRefund){
$qmDeliveryManLogData['shipping_fee']=$orderD['need_shipping_fee'];
}else{
$qmDeliveryManLogData['shipping_fee'] = $orderD['shippingFee'];
}
$qmDeliveryManLogData['order_sn'] = $orderD['orderSn'];
$qmDeliveryManLogData['get_time'] = TIMESTAMP;
// $qmDeliveryWhere['diliveryman_id']= $qmDeliveryManLogData['diliveryman_id'];
......
......@@ -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,'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['id']);
return $this->getQrUrl($data,'group');
//return PathConst::downLoadQrcode;
}
}
......
......@@ -133,7 +133,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}
public function delDeliverFormulaByStoreId($storeId){
return \Our\RedisHelper::delCachedFunction(\Redis\Db6\DeliveryFormulaRedisModel::getInstance(),array(&$this, 'getOne'),array(),\Our\ApiConst::sevenDaySecond,array($storeId));
return \Our\RedisHelper::delCachedFunction(\Redis\Db6\DeliveryFormulaRedisModel::getInstance(),array(&$this, 'getOne'),array(),array($storeId));
}
/**
......@@ -297,7 +297,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
$dayList['list']= $value;
$returnList[] = $dayList;
}
return array('timeList'=>$returnList,'default'=>$defaultFee);
return array('timeList'=>$returnList,'default'=>$defaultFee,'other'=>$formula['other']*\Our\ApiConst::hundred);
}
return $return;
......
......@@ -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';
/**
* 主键
*
......
......@@ -515,12 +515,27 @@ class RefundReturnModel extends \DAO\AbstractModel {
$this->deleteFindByOrderIdCache($refundId);
}
}
// public function editOrderUnlock($order_id) {
// $order_id = intval($order_id);
// if ($order_id > 0) {
// $condition = array();
// $condition['order_id'] = $order_id;
// $condition['lock_state'] = array('egt','1');
// $data = array();
// $data['lock_state'] = array('exp','lock_state-1');
// $data['delay_time'] = time();
// $model_order =\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
// $result = $model_order->update($condition,$data);
// return $result;
// }
// return false;
// }
/**
*获得退货退款列表
*
* @var \DAO\getList
*/
public function getList($where, $field, $pageIndex, $pageSize, $order = array('add_time' => 'desc'))
public function getList($where, $field, $pageIndex=ApiConst::zero, $pageSize=ApiConst::pageSize, $order = array('add_time' => 'desc'))
{
$this->setDb($this->dbName);
$refunds = $this->lists($where, $order, $field, $pageIndex, $pageSize);
......@@ -535,6 +550,44 @@ class RefundReturnModel extends \DAO\AbstractModel {
return $returnType;
}
public function getRefundOperateState($operate,$refund_info,$order_info = null) {
if (!is_array($refund_info) || empty($refund_info)) return false;
switch ($operate){
//选择配送员
case 'select_deliveryman':
$state = ($refund_info['refund_shipping_type'] == 1 && $refund_info['return_type'] == 2 && $refund_info['goods_state'] == 2 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1));
break;
//收货
case 'take_delivery':
$state = ($refund_info['return_type'] == 2 && $refund_info['goods_state'] == 2 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1));
//修改退款金额/处理
break;
case 'change_refund':
$state = ($refund_info['seller_state']==1);
break;
//退货
case 'return_goods':
$state = ($refund_info['seller_state']==1 && $refund_info['refund_type']==2);
break;
//退款
case 'return_money':
$state = ($refund_info['seller_state']==1 && $refund_info['refund_type']==1);
break;
//修改收货时间
case 'change_time':
$state = (!$refund_info['receive_time'] && $refund_info['refund_shipping_type'] == 1 && $refund_info['return_type'] == 2 && $refund_info['goods_state'] == 2 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1));
break;
//原路退回
case 'return_origin':
$state = ($refund_info['refund_type'] == 1 || ($refund_info['refund_type'] == 2 && $refund_info['goods_state'] == 4)) && $refund_info['is_suc_refund'] == 0 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1) && ($order_info && $order_info['payment_type'] != 0 && $order_info['payment_type'] != 2);
break;
//标记为已退款
case 'mark':
$state = ($refund_info['refund_type'] == 1 || ($refund_info['refund_type'] == 2 && $refund_info['goods_state'] == 4)) && $refund_info['is_suc_refund'] == 0 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1) && ($order_info && ($order_info['payment_type'] == 0 ||$order_info['payment_type'] == 2)) ;
break;
}
return $state;
}
public function getMemberStoreStaticsByGmtUpdate($gmtUpdate,$pageIndex,$pageSize){
$this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete);
......@@ -587,13 +640,14 @@ class RefundReturnModel extends \DAO\AbstractModel {
//获得售后待处理订单条件
public function getProccessOrderBySeller($id){
$where['store_id']=$id;
$where['refund_state']=ApiConst::refundSellerVerify;
$where['seller_state']=ApiConst::refundSellerVerify;
return $where;
}
//获得售后待收货订单条件
public function getReturnWaitReceive($id){
$where['store_id']=$id;
$where['refund_type']=ApiConst::refundTypeGoods;
$where['return_type']=ApiConst::returnTypeMustReturn;
$where['goods_state']=ApiConst::goodsStateWaitRecieve;
return $where;
}
......
......@@ -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();
}
/**
* 类实例
*
......
......@@ -315,7 +315,9 @@ class CodeConfigModel
const orderWxPayError = 30137;
const orderWxPaySignError = 30138;
const wrongRefundState=300139;
const updateIsRefundFail=300140;
const updateRefundStateNameFail=300141;
//店铺相关错误码
//商品分类
......@@ -811,6 +813,9 @@ class CodeConfigModel
self::selfGoodsForStoreOrder => '店主不能购买自己的商品',
self::orderWxPayError => '微信支付尚未开通',
self::orderWxPaySignError => '微信支付签名错误',
self::wrongRefundState=>'订单状态有误',
self::updateIsRefundFail=>'更新is_refund失败',
self::updateRefundStateNameFail=>'更新order表refund_state_name失败',
//销售员
self::emptySaleGoodsId => '商品id不能为空',
self::emptySaleGoods => '销售商品不存在',
......
......@@ -259,8 +259,13 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$refundService=\Business\Order\RefundServiceModel::getInstance();
$refundAmount = floatval($this->req['data']['refundAmount']);
$text = trim($this->req['data']['text']);
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId, $refundAmount, $text);
$this->success($res);
$isGiveUp=$this->req['data']['isGiveUp']?$this->req['data']['isGiveUp']:\Our\ApiConst::zero;
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId, $refundAmount, $text,\Our\ApiConst::refundSellerAgree,$isGiveUp);
if($res){
$this->success('操作成功');
}
ErrorModel::throwException(CodeConfigModel::commonError);
}
/**
......
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