Commit 4c6a5ead authored by liuyuzhen's avatar liuyuzhen

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

parents 50554376 4a3ac41c
......@@ -67,6 +67,8 @@ class DescribeConst
const addCartSuccess = '加入购物车成功';
const refundDataError='退款退货数据异常';
const storeCloseTimePre='次日';
const allDay='全天';
const setMessageSuccess='消息设置成功';
......
......@@ -85,6 +85,15 @@ class Validate{
return true;
}
public static function checkPasswordLen($password, $minLen = 6, $maxLen = 16){
if(!$password){
return false;
}
if(strlen($password) >= $minLen&&strlen($password) <= $maxLen){
return true;
}
return false;
}
public static function checkPassword($password){
if(!$password){
......
......@@ -24,7 +24,7 @@ use Zend\Validator\File\Count;
*/
class RefundServiceModel extends \Business\AbstractModel
{
private $orderField = "buyer_id as buyerId,buyer_name as buyerName,order_id as orderId,order_sn as orderSn,store_name as storeName,add_time as AddTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,need_shipping_fee as needShippingFee,payment_code as paymentCode,delay_time as delayTime,gmt_update as gmtUpdate";
private $orderField = "buyer_id as buyerId,buyer_name as buyerName,order_id as orderId,order_sn as orderSn,store_name as storeName,refund_amount as refundAmount,add_time as AddTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,need_shipping_fee as needShippingFee,payment_code as paymentCode,delay_time as delayTime,gmt_update as gmtUpdate";
private $orderGoodsField = "commis_rate as commisRate,goods_type as goodsType,order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,goods_group as goodsGroup,refund_id as refundId";
private $refundOrderGoodsField = "rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_num as goodsNum,goods_image as goodsImage,goods_price as goodsPrice,goods_pay_price as goodsPayPrice,goods_spec as goodsSpec,goods_group as goodsGroup";
......@@ -1010,7 +1010,8 @@ class RefundServiceModel extends \Business\AbstractModel
$shippingFee = ApiConst::zero;
$allReadyGoodsCount=count($goodsIds);
$allGoodsCount=count($orderGoodses);
if($allReadyGoodsCount==$allGoodsCount){
// $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
if($allReadyGoodsCount==ApiConst::one){
$shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
}else{
$shippingFee == ApiConst::zero;
......@@ -1039,15 +1040,10 @@ class RefundServiceModel extends \Business\AbstractModel
);
$refundCondition = $orderInfo['refundCondition'] ? unserialize($orderInfo['refundCondition']) : array();
$returnData['needShippingFee'] = $orderInfo['needShippingFee'];
// if($orderInfo['shippingType']==ApiConst::bySelf){
if($orderInfo['shippingType']==ApiConst::bySelf){
$returnData['needShippingFee']=ApiConst::zero;
// }
//修改后的优惠金额
$discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
$mustReduceAmount=ApiConst::zero;
if($discountAmount){
$mustReduceAmount=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$discountAmount,$orderGoodsConvert);
}
if ($orderInfo['paymentTime']) {
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
......@@ -1061,6 +1057,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundAmount = $orderInfo['orderAmount'] - ApiConst::zero;;
}
}
$refundAmount=$refundAmount-$orderInfo['refundAmount'];
// if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount;
// }
......@@ -1072,18 +1069,34 @@ class RefundServiceModel extends \Business\AbstractModel
// $refundAmount=$refundAmount-$discountAmount;
// }
}
$refundAmount=$refundAmount-$mustReduceAmount;
if($orderInfo['shippingType']==ApiConst::bySeller){
if(!$shippingFee){
$refundAmount=$refundAmount+$orderInfo['shippingFee'];
if($allReadyGoodsCount==ApiConst::one){
$refundAmount=$refundAmount+$orderInfo['shippingFee'];
if($shippingFee && ($orderInfo['shippingType']==ApiConst::bySeller)){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
}
}
//修改后的优惠金额按比例退回
$discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
$mustReduceAmount=ApiConst::zero;
if($discountAmount){
$mustReduceAmount=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$discountAmount,$orderGoodsConvert);
}
$refundAmount=$refundAmount-$mustReduceAmount;
//配送订单配送费按比例收取
// if($orderInfo['shippingType']==ApiConst::bySeller){
// $mustSheepingFee=ApiConst::zero;
// if($discountAmount){
// $mustSheepingFee=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$orderInfo['shippingFee'],$orderGoodsConvert);
// }
// $refundAmount=$refundAmount-$mustSheepingFee;
// }
$liveMoney=$orderInfo['orderAmount']-$orderInfo['refundAmount'];
if($refundAmount>$liveMoney){
$refundAmount=$liveMoney;
}
// $returnData['refundAmount'] = $refundAmount - $orderInfo['refundAmount'] - $returnData['needShippingFee'] + $shippingFee;
$returnData['refundAmount'] = $refundAmount - $returnData['needShippingFee'];
// $returnData['refundAmount'] = $refundAmount - $returnData['needShippingFee'];
$returnData['refundAmount'] = $refundAmount;
if((int)$returnData['refundAmount'] <ApiConst::zero){
$returnData['refundAmount']=ApiConst::zero;
}
......@@ -1221,7 +1234,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero;
$refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods);
$updateOrderData['refund_amount']= $refundArray['refund_amount'];
$updateOrderData['refund_amount']= $orderInfo['refundAmount']+ $refundArray['refund_amount'];
$orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true);
$storeDao->deleteStoreCache($orderInfo['storeId'],$orderInfo['orderId']);
......
......@@ -384,8 +384,11 @@ class MemberModel extends \DAO\AbstractModel
if (!$where['password']) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPassword);
}
if (!\Our\Validate::checkPassword($where['password'])) {
/*if (!\Our\Validate::checkPassword($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit);
}*/
if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
}
if (!$where['deviceType']) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyDeviceType);
......@@ -399,8 +402,8 @@ class MemberModel extends \DAO\AbstractModel
public function checkChangedInfo($where)
{
$this->checkRegisterMobile($where);
if (!\Our\Validate::checkPassword($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit);
if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
}
}
......@@ -492,8 +495,8 @@ class MemberModel extends \DAO\AbstractModel
*/
public function checkWxBindMobile($where){
$this->checkWxBindMobileCommon($where);
if (!\Our\Validate::checkPassword($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit);
if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
}
}
......@@ -506,8 +509,8 @@ class MemberModel extends \DAO\AbstractModel
if ($data['password'] != $data['rePassword']) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::differentPasswordAndRepassword);
}
if (!\Our\Validate::checkPassword($data['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit);
if (!\Our\Validate::checkPasswordLen($data['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
}
}
......@@ -684,8 +687,8 @@ class MemberModel extends \DAO\AbstractModel
}
}
public function validPassword($where){
if (!\Our\Validate::checkPassword($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit);
if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
}
}
......
......@@ -551,6 +551,9 @@ class RefundReturnModel extends \DAO\AbstractModel
if (!isset($refund_array['refund_sn']) || !$refund_array['refund_sn']) {
$refund_array['refund_sn'] = $this->getRefundsn($order['storeId']);
}
if(!$refund_array['buyer_id'] || !$refund_array['order_id']){
throw new \Exception(DescribeConst::refundDataError);
}
$refund_id = $this->db->insert($this->_tableName)->rows($refund_array)->execute();
// 发送商家提醒
$param = array();
......
......@@ -104,6 +104,7 @@ class CodeConfigModel
const sellerNameUpdateFailed = 10116;
const notHaveAccess = 10117;
const sellerJoinUpdateFailed = 10118;
const passwordLenLimit = 10119;
//访问错误
const illegalAccess = 200001;
......@@ -536,6 +537,7 @@ class CodeConfigModel
self::sellerNameUpdateFailed => '更换手机时卖家手机号码更新失败',
self::notHaveAccess => '您没有权限使用',
self::sellerJoinUpdateFailed => '更换手机时卖家手机号码更新失败',
self::passwordLenLimit => '密码为6~16位的数字或字母组合',
//商品相关
self::emptyCommonId => '商品主键不能为空',
self::goodsNotExist => '商品不存在',
......
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