Commit f6fbde7a authored by zhz's avatar zhz

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

parents dfa2faa7 5a0049df
...@@ -312,10 +312,11 @@ class OrderConfirmUtil { ...@@ -312,10 +312,11 @@ class OrderConfirmUtil {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongPaywayForStoreForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongPaywayForStoreForOrder);
} }
$reliefAmount = isset($tempStore['reliefAmount'])?$tempStore['reliefAmount']:\Our\ApiConst::zero; $reliefAmount = isset($tempStore['reliefAmount'])?$tempStore['reliefAmount']:\Our\ApiConst::zero;
$orderAmount = $tempStore['storeTotalPrice'] - $reliefAmount + $deliveryFee; $orderGoodsAmount = $tempStore['storeTotalPrice'] - $reliefAmount;
if($orderAmount<=\Our\ApiConst::zero){ if($orderGoodsAmount<=\Our\ApiConst::zero){
$orderAmount = \Our\ApiConst::zero; $orderGoodsAmount = \Our\ApiConst::zero;
} }
$orderAmount = $orderGoodsAmount + $deliveryFee ;
if($orderAmount!=$requestData['totalFee']){ if($orderAmount!=$requestData['totalFee']){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongTotalFeeForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongTotalFeeForOrder);
} }
...@@ -397,10 +398,11 @@ class OrderConfirmUtil { ...@@ -397,10 +398,11 @@ class OrderConfirmUtil {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongPaywayForStoreForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongPaywayForStoreForOrder);
} }
$reliefAmount = isset($tempStore['reliefAmount'])?$tempStore['reliefAmount']:\Our\ApiConst::zero; $reliefAmount = isset($tempStore['reliefAmount'])?$tempStore['reliefAmount']:\Our\ApiConst::zero;
$orderAmount = $tempStore['storeTotalPrice'] - $reliefAmount + $deliveryFee; $orderGoodsAmount = $tempStore['storeTotalPrice'] - $reliefAmount;
if($orderAmount<=\Our\ApiConst::zero){ if($orderGoodsAmount<=\Our\ApiConst::zero){
$orderAmount = \Our\ApiConst::zero; $orderGoodsAmount = \Our\ApiConst::zero;
} }
$orderAmount = $orderGoodsAmount + $deliveryFee;
if($orderAmount!=$requestData['totalFee']){ if($orderAmount!=$requestData['totalFee']){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongTotalFeeForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongTotalFeeForOrder);
} }
...@@ -981,8 +983,10 @@ class OrderConfirmUtil { ...@@ -981,8 +983,10 @@ class OrderConfirmUtil {
$newCouponList = array(); $newCouponList = array();
$giftCouponIds = array(); $giftCouponIds = array();
foreach($couponList as $temp){ foreach($couponList as $temp){
$newCouponList[$temp['couponId']] = $temp;
$storeCouponList[$temp['store_id']][] = $temp; $storeCouponList[$temp['store_id']][] = $temp;
$temp['order_amount'] = $temp['order_amount']*\Our\ApiConst::hundred;
$temp['cash_money'] = $temp['cash_money']*\Our\ApiConst::hundred;
$newCouponList[$temp['couponId']] = $temp;
if($temp['coupon_type']==\Our\ApiConst::fullForCouponCouponType&&$temp['gift_coupon_id']>\Our\ApiConst::zero){ if($temp['coupon_type']==\Our\ApiConst::fullForCouponCouponType&&$temp['gift_coupon_id']>\Our\ApiConst::zero){
$giftCouponIds[$temp['couponId']] = $temp['gift_coupon_id']; $giftCouponIds[$temp['couponId']] = $temp['gift_coupon_id'];
} }
...@@ -1133,9 +1137,7 @@ class OrderConfirmUtil { ...@@ -1133,9 +1137,7 @@ class OrderConfirmUtil {
return array('flag'=>\Our\ApiConst::zero,'errorCode'=>$errorCode,'data'=>$data); return array('flag'=>\Our\ApiConst::zero,'errorCode'=>$errorCode,'data'=>$data);
} }
$oldOrderPay = $orderPayModel->find(array('pay_sn'=>$paySn)); $oldOrderPay = $orderPayModel->find(array('pay_sn'=>$paySn));
\Our\Log::getInstance()->write(json_encode($oldOrderPay),'/data/log/apptest');
if($oldOrderPay['api_pay_state']==\Our\ApiConst::one){ if($oldOrderPay['api_pay_state']==\Our\ApiConst::one){
\Our\Log::getInstance()->write('testaldeary','/data/log/apptest');
return array('flag'=>\Our\ApiConst::one,'errorCode'=>$errorCode); return array('flag'=>\Our\ApiConst::one,'errorCode'=>$errorCode);
} }
$resultOrderPay = $orderPayModel->update(array('api_pay_state'=>\Our\ApiConst::one,'pay_type'=>$data['pay_type']),array('pay_sn'=>$paySn)); $resultOrderPay = $orderPayModel->update(array('api_pay_state'=>\Our\ApiConst::one,'pay_type'=>$data['pay_type']),array('pay_sn'=>$paySn));
......
...@@ -67,6 +67,8 @@ class DescribeConst ...@@ -67,6 +67,8 @@ class DescribeConst
const addCartSuccess = '加入购物车成功'; const addCartSuccess = '加入购物车成功';
const refundDataError='退款退货数据异常';
const storeCloseTimePre='次日'; const storeCloseTimePre='次日';
const allDay='全天'; const allDay='全天';
const setMessageSuccess='消息设置成功'; const setMessageSuccess='消息设置成功';
......
...@@ -85,6 +85,15 @@ class Validate{ ...@@ -85,6 +85,15 @@ class Validate{
return true; 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){ public static function checkPassword($password){
if(!$password){ if(!$password){
......
...@@ -12,6 +12,7 @@ class TencentPay { ...@@ -12,6 +12,7 @@ class TencentPay {
protected $sslkey_path = '/application/library/Payment/cert/qq/apiclient_key.pem'; protected $sslkey_path = '/application/library/Payment/cert/qq/apiclient_key.pem';
protected $appid = ''; protected $appid = '';
protected $pay_url = "https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi"; protected $pay_url = "https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi";
protected $orderquery_url = 'https://api.mch.weixin.qq.com/pay/orderquery';
protected $curl_timeout = 30; protected $curl_timeout = 30;
protected $notify_url = ''; protected $notify_url = '';
protected $response = ''; protected $response = '';
...@@ -107,6 +108,28 @@ class TencentPay { ...@@ -107,6 +108,28 @@ class TencentPay {
return $prepay_id; return $prepay_id;
} }
function getOrderPayResult($pay_sn,$subMchId=false){
if($subMchId){
$this->parameters['appid']=$this->s_appid;
$this->parameters['mch_id']=$this->s_mch_id;
$this->parameters['sub_appid']=$this->appid;
$this->parameters['sub_mch_id']=$subMchId;
$this->key = $this->s_key;
}else{
$this->parameters['appid']=$this->appid;
$this->parameters['mch_id']=$this->mch_id;
}
$this->parameters['out_trade_no']=$pay_sn;
$this->parameters['nonce_str']=\Our\CommonExtension::createNoncestr(32);
$this->postXml($this->orderquery_url);
$this->result = $this->xmlToArray($this->response);
\Our\Log::getInstance()->write(json_encode($this->result),'/data/log/apptest');
if($this->result['return_code']=="SUCCESS"&&$this->result['result_code']=="SUCCESS"&&$this->result['trade_state']=="SUCCESS"){
return true;
}
return false;
}
/** /**
* 作用:将xml转为array * 作用:将xml转为array
*/ */
...@@ -121,11 +144,11 @@ class TencentPay { ...@@ -121,11 +144,11 @@ class TencentPay {
/** /**
* 作用:post请求xml * 作用:post请求xml
*/ */
function postXml() function postXml($url=false)
{ {
$xml = $this->createXml(); $xml = $this->createXml();
\Our\Log::getInstance()->write($xml,'/data/log/applog'); \Our\Log::getInstance()->write($xml,'/data/log/applog');
$this->response = $this->postXmlCurl($xml,$this->pay_url,$this->curl_timeout); $this->response = $this->postXmlCurl($xml,$url?$url:$this->pay_url,$this->curl_timeout);
\Our\Log::getInstance()->write(serialize($this->response),'/data/log/applog'); \Our\Log::getInstance()->write(serialize($this->response),'/data/log/applog');
return $this->response; return $this->response;
} }
......
...@@ -12,8 +12,8 @@ class WxLitePay extends \Payment\TencentPay{ ...@@ -12,8 +12,8 @@ class WxLitePay extends \Payment\TencentPay{
public function __construct() public function __construct()
{ {
$this->appid = \Our\PayConst::wxLiteAppId; $this->appid = \Our\PayConst::wxLiteAppId;
//$this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxLiteNotifyUrl; $this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxLiteNotifyUrl;
$this->notify_url = \Our\NameConst::httpPrefix. $_SERVER['SERVER_NAME'] .\Our\PayConst::wxLiteNotifyUrl; //$this->notify_url = \Our\NameConst::httpPrefix. $_SERVER['SERVER_NAME'] .\Our\PayConst::wxLiteNotifyUrl;
$this->mch_id = \Our\PayConst::wxPayMchId; $this->mch_id = \Our\PayConst::wxPayMchId;
$this->key = \Our\PayConst::wxSPayKey; $this->key = \Our\PayConst::wxSPayKey;
$this->sslcert_path = \Our\PayConst::wxSslcertPath; $this->sslcert_path = \Our\PayConst::wxSslcertPath;
......
...@@ -304,6 +304,7 @@ class GoodsClassServiceModel extends \Business\AbstractModel{ ...@@ -304,6 +304,7 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$whereSql = \Our\Common::format(' gc_id in ({0})',implode(',',$secondGcIds)); $whereSql = \Our\Common::format(' gc_id in ({0})',implode(',',$secondGcIds));
$secondGcList=$goodsClassDao->getList('gc_id as gcId,gc_name as gcName',$whereSql); $secondGcList=$goodsClassDao->getList('gc_id as gcId,gc_name as gcName',$whereSql);
foreach($secondGcList as $secTemp){ foreach($secondGcList as $secTemp){
$secTemp['gcName'] = htmlspecialchars_decode($secTemp['gcName']);
$newSecondGcList[$secTemp['gcId']] = $secTemp; $newSecondGcList[$secTemp['gcId']] = $secTemp;
} }
} }
...@@ -312,6 +313,7 @@ class GoodsClassServiceModel extends \Business\AbstractModel{ ...@@ -312,6 +313,7 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$whereSql = \Our\Common::format(' gc_id in ({0})',implode(',',$platThirdGcIds)); $whereSql = \Our\Common::format(' gc_id in ({0})',implode(',',$platThirdGcIds));
$platThirdGcList=$goodsClassDao->getList('gc_id as gcId,gc_name as gcName',$whereSql); $platThirdGcList=$goodsClassDao->getList('gc_id as gcId,gc_name as gcName',$whereSql);
foreach($platThirdGcList as $platThirdTemp){ foreach($platThirdGcList as $platThirdTemp){
$platThirdTemp['gcName'] = htmlspecialchars_decode($platThirdTemp['gcName']);
$platThirdTemp['gcImage'] = \Our\Common::getStaticFile(\Our\ImageConst::categoryPicPrefix.$platThirdTemp['gcId'].\Our\NameConst::jpgSuffix,\Our\ImageConst::defaultPath); $platThirdTemp['gcImage'] = \Our\Common::getStaticFile(\Our\ImageConst::categoryPicPrefix.$platThirdTemp['gcId'].\Our\NameConst::jpgSuffix,\Our\ImageConst::defaultPath);
$newPlatThirdGcList[$platThirdTemp['gcId']] = $platThirdTemp; $newPlatThirdGcList[$platThirdTemp['gcId']] = $platThirdTemp;
} }
......
...@@ -10,7 +10,7 @@ use Zend\Json\Server\Exception\ErrorException; ...@@ -10,7 +10,7 @@ use Zend\Json\Server\Exception\ErrorException;
class GoodsCommonServiceModel extends \Business\AbstractModel class GoodsCommonServiceModel extends \Business\AbstractModel
{ {
private $goodsStorageField = 'goods_id goodsId,goods_name goodsName,goods_verify goodsVerify,goods_state goodsState,goods_image goodsImage,goods_price goodsPrice,goods_storage goodsStorage,goods_spec goodsAttr,goods_storage_alarm as goodsStorageAlarm'; private $goodsStorageField = 'goods_id goodsId,goods_name goodsName,goods_verify goodsVerify,goods_state goodsState,goods_image goodsImage,goods_price goodsPrice,goods_storage goodsStorage,goods_spec goodsAttr';
private $setStorageType = array('add'=> 1, 'set'=>2); private $setStorageType = array('add'=> 1, 'set'=>2);
public function init() { public function init() {
...@@ -28,8 +28,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -28,8 +28,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/ */
public function setGoodsStorage($storeId, $goodsId, $num = 0, $type='add') { public function setGoodsStorage($storeId, $goodsId, $num = 0, $type='add') {
$orderService=\Business\Order\OrderServiceModel::getInstance(); $orderService=\Business\Order\OrderServiceModel::getInstance();
$goodsDao=\DAO\GoodsModel::getInstance(DbNameConst::masterDBConnectName);
$commonDao = \DAO\GoodsCommonModel::getInstance();
if($goodsId === 0){ if($goodsId === 0){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError); \Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError);
} }
...@@ -38,21 +36,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -38,21 +36,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}else{ }else{
$type=ApiConst::set; $type=ApiConst::set;
$where = array();
$where['store_id'] = $storeId;
$where['goods_id'] = $goodsId;
$data = $goodsDao->find($where, 'goods_id, goods_commonid');
$goodsDao->setDb($goodsDao->dbName);
$goodsDao->db->doTransaction();
$ret1 = $goodsDao->updateStorage($goodsId, $num, ApiConst::zero);
$ret2 = $commonDao->updateStorage($data['goods_commonid'],ApiConst::zero);
if(!$ret1 || !$ret2) {
$goodsDao->db->doRollback();
\Error\ErrorModel::throwException(\Error\CodeConfigModel::updateGoodsStorageForOrder);
}
$goodsDao->db->doCommit();
return true;
} }
$res=$orderService->updateGoodsStoregeByGoodsIds($storeId,$goodsId,$num,$type); $res=$orderService->updateGoodsStoregeByGoodsIds($storeId,$goodsId,$num,$type);
return $res; return $res;
...@@ -103,7 +86,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -103,7 +86,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where = array(); $where = array();
$where[] = 'store_id = '.$storeId; $where[] = 'store_id = '.$storeId;
$where[] = 'goods_storage_alarm > 0'; $where[] = 'goods_storage_alarm > 0';
$where[] = 'goods_storage<goods_storage_alarm'; $where[] = 'goods_storage<=goods_storage_alarm';
//获得列表 //获得列表
if($datas = $goodsDao->getList(implode($where, ' and '), $this->goodsStorageField)) { if($datas = $goodsDao->getList(implode($where, ' and '), $this->goodsStorageField)) {
foreach ($datas as $key=>$val) { foreach ($datas as $key=>$val) {
...@@ -186,7 +169,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -186,7 +169,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where[] = 'goods_commonid in('.trim($ids,',').')'; $where[] = 'goods_commonid in('.trim($ids,',').')';
} }
} }
$order[] = ['goodsCommonid','DESC'];
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond; $saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if($activities){ if($activities){
$activities = array_keys($activities); $activities = array_keys($activities);
...@@ -438,12 +420,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -438,12 +420,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
} }
if(!$result) { if(!$result) {
$statGoodsDao->db->doRollback(); $statGoodsDao->db->doRollback();
} } else { //商品报表更新成功
} $statGoodsDao->db->doCommit();
file_put_contents($this->baseDir . \Our\PathConst::goodsSellStatTime, $endTime);
if($result) { //商品报表更新成功 }
$statGoodsDao->db->doCommit();
file_put_contents($this->baseDir . \Our\PathConst::goodsSellStatTime, $endTime);
} }
} }
...@@ -486,7 +466,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -486,7 +466,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$keyword !== '' && $where[] = "goods_name like '%{$keyword}%'"; $keyword !== '' && $where[] = "goods_name like '%{$keyword}%'";
list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort); list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$where = array_merge($where,$_where); $where = array_merge($where,$_where);
$order[] = ['goodsCommonId','DESC'];
$commonDAO = \DAO\GoodsCommonModel::getInstance(); $commonDAO = \DAO\GoodsCommonModel::getInstance();
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond; $saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if(!$activities){ if(!$activities){
...@@ -1364,7 +1344,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1364,7 +1344,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
break; break;
} }
} }
return true;
} }
/** /**
...@@ -1378,9 +1357,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1378,9 +1357,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if(!$oldTemp){ if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass); $storeOnlineGoodsClassDao->insert($goodsClass);
} }
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getList'),array(),array($goodsClass['store_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getStoreOnlineGoodsClassesByGcId'),array(),array($goodsClass['store_id']));
return true; return true;
} }
...@@ -1395,18 +1371,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1395,18 +1371,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where['store_id'] = $goodsClass['store_id']; $where['store_id'] = $goodsClass['store_id'];
$where['goods_state'] = \Our\ApiConst::onlineGoodsState; $where['goods_state'] = \Our\ApiConst::onlineGoodsState;
$where['goods_verify'] = \Our\ApiConst::onlineGoodsVerify; $where['goods_verify'] = \Our\ApiConst::onlineGoodsVerify;
$where['is_del'] = \Our\ApiConst::zero;
if($gcFrom==\Our\ApiConst::one){ if($gcFrom==\Our\ApiConst::one){
$where['goods_class_t_id'] = $goodsClass['gc_id_3']; $where['goods_class_t_id'] = $goodsClass['gc_id_3'];
} }
$tempOne = $goodsCommonDao->getOne($where,'goods_commonid'); $tempOne = $goodsCommonDao->getOne($where,'goods_commonid');
if(!$tempOne){ if(!$tempOne){
$result = $storeOnlineGoodsClassDao->del($goodsClass); $storeOnlineGoodsClassDao->del($goodsClass);
if($result){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getList'),array(),array($goodsClass['store_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getStoreOnlineGoodsClassesByGcId'),array(),array($goodsClass['store_id']));
}
} }
} }
} }
...@@ -1505,9 +1475,4 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1505,9 +1475,4 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
} }
public function syncGoodsCommonStorageByGoods(){
$goodsCommonDao = \DAO\GoodsCommonModel::getInstance();
$return = $goodsCommonDao->syncGoodsCommonStorageByGoods();
}
} }
...@@ -1161,12 +1161,42 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -1161,12 +1161,42 @@ class OrderServiceModel extends \Business\AbstractModel
if (!$orderList) { if (!$orderList) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::noOrderListForPaySn); \Error\ErrorModel::throwException(\Error\CodeConfigModel::noOrderListForPaySn);
} }
$storeDao = \DAO\StoreModel::getInstance();
$orderPayModel = \DAO\Order\OrderPayModel::getInstance();
$paySn = $data['paySn'];
$oldOrderPay = $orderPayModel->find(array('pay_sn'=>$paySn));
$orderStateArray = array_column($orderList,'order_state');
if(in_array(\Our\ApiConst::orderStateWaitPay,$orderStateArray)&&in_array($oldOrderPay['pay_type'],array(\Our\ApiConst::wxAppPayType,\Our\ApiConst::wxLitePayType))&&((isset($data['payFlag'])&&$data['payFlag']==\Our\ApiConst::one)||!isset($data['payFlag']))){
if($oldOrderPay['pay_type']==\Our\ApiConst::wxLitePayType){
$wxLitePay = \Payment\WxLitePay::getInstance();
$storeId = $orderList[0]['store_id'];
$mchIdArray = $storeDao->getStoreWxMchId($storeId);
if($mchIdArray['errorCode']>0){
\Error\ErrorModel::throwException($mchIdArray['errorCode']);
}
$subMchId = $mchIdArray['mchId'];
$payResult = $wxLitePay->getOrderPayResult($paySn,$subMchId);
}else{
$wxPay = \Payment\WxPay::getInstance();
$payResult = $wxPay->getOrderPayResult($paySn);
}
\Our\Log::getInstance()->write('支付结果'.$payResult,'/data/log/apptest');
if($payResult){
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
$return = $orderConfirmUtil->updateOrderToPayed(array('paySn'=>$paySn,'pay_type'=>$oldOrderPay['pay_type']));
if(!$return['flag']){
\Error\ErrorModel::throwException($return['errorCode']);
}else{
$orderList = $orderDao->getListByCon(array('pay_sn' => $data['paySn'], 'buyer_id' => $memberId));
}
}
}
$return = array(); $return = array();
$totalOrderAmount = array_sum(array_column($orderList, 'order_amount')); $totalOrderAmount = array_sum(array_column($orderList, 'order_amount'));
$orderTips = \Our\DescribeConst::paySuccessTips; $orderTips = \Our\DescribeConst::paySuccessTips;
$orderSubTips = \Our\DescribeConst::paySuccessSubTips; $orderSubTips = \Our\DescribeConst::paySuccessSubTips;
$orderContents = array(); $orderContents = array();
$storeDao = \DAO\StoreModel::getInstance();
$orderIds = array(); $orderIds = array();
$orderNos = array(); $orderNos = array();
$orderState = \Our\ApiConst::one; $orderState = \Our\ApiConst::one;
......
...@@ -16,6 +16,7 @@ class PaymentServiceModel extends \Business\AbstractModel{ ...@@ -16,6 +16,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
} }
public function checkChargeData($data){ public function checkChargeData($data){
$dbName = \Our\DbNameConst::masterDBConnectName;
if(!($data['channel']&&in_array($data['channel'],array(\Our\NameConst::wxAppChannel,\Our\NameConst::wxLiteChannel,\Our\NameConst::aliApiChannel,\Our\NameConst::qqAppChannel)))){ if(!($data['channel']&&in_array($data['channel'],array(\Our\NameConst::wxAppChannel,\Our\NameConst::wxLiteChannel,\Our\NameConst::aliApiChannel,\Our\NameConst::qqAppChannel)))){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongChannelForPay); \Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongChannelForPay);
} }
...@@ -27,6 +28,22 @@ class PaymentServiceModel extends \Business\AbstractModel{ ...@@ -27,6 +28,22 @@ class PaymentServiceModel extends \Business\AbstractModel{
if(!$order){ if(!$order){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::noOrderWaitToPay); \Error\ErrorModel::throwException(\Error\CodeConfigModel::noOrderWaitToPay);
} }
$orderPayModel = \DAO\Order\OrderPayModel::getInstance($dbName);
$paySn = $data['paySn'];
$channel = $data['channel'];
if($channel == \Our\NameConst::wxLiteChannel){
$pay_type = \Our\ApiConst::wxLitePayType;
}else if($channel == \Our\NameConst::qqAppChannel){
$pay_type = \Our\ApiConst::qqPayType;
}else if($channel==\Our\NameConst::aliApiChannel){
$pay_type = \Our\ApiConst::aliPayType;
}else{
$pay_type = \Our\ApiConst::wxAppPayType;
}
$resultOrderPay = $orderPayModel->update(array('pay_type'=>$pay_type),array('pay_sn'=>$paySn));
if(!$resultOrderPay){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::payTypeUpdateError);
}
} }
public function updateOrderToPayedWxLite(){ public function updateOrderToPayedWxLite(){
...@@ -41,7 +58,6 @@ class PaymentServiceModel extends \Business\AbstractModel{ ...@@ -41,7 +58,6 @@ class PaymentServiceModel extends \Business\AbstractModel{
* app微信支付回调 * app微信支付回调
*/ */
public function updateOrderToPayed($channel = \Our\NameConst::wxAppChannel){ public function updateOrderToPayed($channel = \Our\NameConst::wxAppChannel){
\Our\Log::getInstance()->write(microtime(),'/data/log/apptest');
if($channel == \Our\NameConst::wxLiteChannel){ if($channel == \Our\NameConst::wxLiteChannel){
$wxpay = \Payment\WxLitePay::getInstance(); $wxpay = \Payment\WxLitePay::getInstance();
$param['pay_type'] = \Our\ApiConst::wxLitePayType; $param['pay_type'] = \Our\ApiConst::wxLitePayType;
...@@ -58,9 +74,6 @@ class PaymentServiceModel extends \Business\AbstractModel{ ...@@ -58,9 +74,6 @@ class PaymentServiceModel extends \Business\AbstractModel{
$param['paySn'] = $callbackInfo['out_trade_no']; $param['paySn'] = $callbackInfo['out_trade_no'];
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance(); $orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
$return = $orderConfirmUtil->updateOrderToPayed($param); $return = $orderConfirmUtil->updateOrderToPayed($param);
\Our\Log::getInstance()->write(json_encode($return),'/data/log/apptest');
\Our\Log::getInstance()->write(microtime(),'/data/log/apptest');
\Our\Log::getInstance()->write(json_encode($callbackInfo),'/data/log/apptest');
if($return['flag']) { if($return['flag']) {
echo $callbackInfo['returnXml']; echo $callbackInfo['returnXml'];
die; die;
......
...@@ -24,7 +24,7 @@ use Zend\Validator\File\Count; ...@@ -24,7 +24,7 @@ use Zend\Validator\File\Count;
*/ */
class RefundServiceModel extends \Business\AbstractModel 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 $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"; 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";
...@@ -780,7 +780,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -780,7 +780,7 @@ class RefundServiceModel extends \Business\AbstractModel
if($value['goodsState']>ApiConst::goodsStateWaitRecieve){ if($value['goodsState']>ApiConst::goodsStateWaitRecieve){
$value['shippingOver']=ApiConst::shippingOver; $value['shippingOver']=ApiConst::shippingOver;
} }
if($value['isSucRefund']==ApiConst::isNotSuccessRefund && ($value['sellerState']==ApiConst::refundSellerAgree || $value['platformState']==ApiConst::platAgree) ){ if($value['isSucRefund']==ApiConst::isNotSuccessRefund && ($value['sellerState']==ApiConst::refundSellerAgree || (!in_array($value['paymentType'],ArrayConst::payTypeOnlines))&&($value['platformState']==ApiConst::platAgree))){
$value['markRefundButton']=ApiConst::one; $value['markRefundButton']=ApiConst::one;
}else{ }else{
$value['markRefundButton']=ApiConst::zero;; $value['markRefundButton']=ApiConst::zero;;
...@@ -1010,7 +1010,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1010,7 +1010,8 @@ class RefundServiceModel extends \Business\AbstractModel
$shippingFee = ApiConst::zero; $shippingFee = ApiConst::zero;
$allReadyGoodsCount=count($goodsIds); $allReadyGoodsCount=count($goodsIds);
$allGoodsCount=count($orderGoodses); $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; $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
}else{ }else{
$shippingFee == ApiConst::zero; $shippingFee == ApiConst::zero;
...@@ -1039,15 +1040,10 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1039,15 +1040,10 @@ class RefundServiceModel extends \Business\AbstractModel
); );
$refundCondition = $orderInfo['refundCondition'] ? unserialize($orderInfo['refundCondition']) : array(); $refundCondition = $orderInfo['refundCondition'] ? unserialize($orderInfo['refundCondition']) : array();
$returnData['needShippingFee'] = $orderInfo['needShippingFee']; $returnData['needShippingFee'] = $orderInfo['needShippingFee'];
// if($orderInfo['shippingType']==ApiConst::bySelf){ if($orderInfo['shippingType']==ApiConst::bySelf){
$returnData['needShippingFee']=ApiConst::zero; $returnData['needShippingFee']=ApiConst::zero;
// }
//修改后的优惠金额
$discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
$mustReduceAmount=ApiConst::zero;
if($discountAmount){
$mustReduceAmount=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$discountAmount,$orderGoodsConvert);
} }
if ($orderInfo['paymentTime']) { if ($orderInfo['paymentTime']) {
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance(); $orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
...@@ -1061,6 +1057,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1061,6 +1057,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundAmount = $orderInfo['orderAmount'] - ApiConst::zero;; $refundAmount = $orderInfo['orderAmount'] - ApiConst::zero;;
} }
} }
$refundAmount=$refundAmount-$orderInfo['refundAmount'];
// if(!$alreadyRefundGoodsIds){ // if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount; // $refundAmount=$refundAmount-$discountAmount;
// } // }
...@@ -1072,18 +1069,34 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1072,18 +1069,34 @@ class RefundServiceModel extends \Business\AbstractModel
// $refundAmount=$refundAmount-$discountAmount; // $refundAmount=$refundAmount-$discountAmount;
// } // }
} }
$refundAmount=$refundAmount-$mustReduceAmount; if($allReadyGoodsCount==ApiConst::one){
if($orderInfo['shippingType']==ApiConst::bySeller){ $refundAmount=$refundAmount+$orderInfo['shippingFee'];
if(!$shippingFee){ if($shippingFee && ($orderInfo['shippingType']==ApiConst::bySeller)){
$refundAmount=$refundAmount+$orderInfo['shippingFee']; $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']; $liveMoney=$orderInfo['orderAmount']-$orderInfo['refundAmount'];
if($refundAmount>$liveMoney){ if($refundAmount>$liveMoney){
$refundAmount=$liveMoney; $refundAmount=$liveMoney;
} }
// $returnData['refundAmount'] = $refundAmount - $orderInfo['refundAmount'] - $returnData['needShippingFee'] + $shippingFee; // $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){ if((int)$returnData['refundAmount'] <ApiConst::zero){
$returnData['refundAmount']=ApiConst::zero; $returnData['refundAmount']=ApiConst::zero;
} }
...@@ -1221,7 +1234,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1221,7 +1234,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero; $refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero;
$refundArrayUnLine=Common::convertUnderline($refundArray); $refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods); $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); $orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true);
$storeDao->deleteStoreCache($orderInfo['storeId'],$orderInfo['orderId']); $storeDao->deleteStoreCache($orderInfo['storeId'],$orderInfo['orderId']);
...@@ -1373,6 +1386,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1373,6 +1386,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$storeDao=\DAO\StoreModel::getInstance();
$where['buyer_id']=$buyerId; $where['buyer_id']=$buyerId;
$where['refund_id']=$refundId; $where['refund_id']=$refundId;
$res= $refundReturnDao->find($where,$refundReturnDao->refundDetailField); $res= $refundReturnDao->find($where,$refundReturnDao->refundDetailField);
...@@ -1386,6 +1400,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1386,6 +1400,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsDao->update($whereOrderGoods,$updateData); $orderGoodsDao->update($whereOrderGoods,$updateData);
$refundReturnDao->deleteRefundCache($buyerId,$refundId); $refundReturnDao->deleteRefundCache($buyerId,$refundId);
$orderDao->deleteOrderCache($buyerId,$res['orderId'],$res['storeId']); $orderDao->deleteOrderCache($buyerId,$res['orderId'],$res['storeId']);
$storeDao->deleteStoreRefundCache($res['storeId']);
return true; return true;
} else { } else {
return false; return false;
......
...@@ -147,7 +147,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -147,7 +147,7 @@ class StoreServiceModel extends \Business\AbstractModel{
} }
//处理新店铺信息 //处理新店铺信息
$where = 'store_id not in (select ss.store_id from han_stat_store ss)'; $where = 'store_id not in (select ss.store_id from han_stat_store ss) and is_own_shop=0';
$field = 'store_id,store_state,store_time,store_end_time,province_id,city_id,area_id,(select se.cashed_deposit from han_store_extend se where se.store_id=han_store.store_id) cashed_deposit'; $field = 'store_id,store_state,store_time,store_end_time,province_id,city_id,area_id,(select se.cashed_deposit from han_store_extend se where se.store_id=han_store.store_id) cashed_deposit';
$field .= ',(select count(qs.store_id) from han_qm_store_class qs where qs.is_charged<>0 and qs.store_id=han_store.store_id) class_style1_count, (select count(qs.store_id) from han_qm_store_class qs where qs.is_charged<>0 and qs.class_style=2 and qs.store_id=han_store.store_id) class_style2_count, if((store_state=1 and store_end_time>=0), ifnull((select sum(qs.service_fee) from han_qm_store_class qs where qs.is_charged<>0 and qs.class_style=2 and qs.store_id=han_store.store_id), 0), ifnull((select sum(qs.service_fee) from han_qm_store_class qs where qs.is_charged<>0 and qs.class_style=2 and qs.store_id=han_store.store_id and qs.deadline>=0), 0)) service_fee'; $field .= ',(select count(qs.store_id) from han_qm_store_class qs where qs.is_charged<>0 and qs.store_id=han_store.store_id) class_style1_count, (select count(qs.store_id) from han_qm_store_class qs where qs.is_charged<>0 and qs.class_style=2 and qs.store_id=han_store.store_id) class_style2_count, if((store_state=1 and store_end_time>=0), ifnull((select sum(qs.service_fee) from han_qm_store_class qs where qs.is_charged<>0 and qs.class_style=2 and qs.store_id=han_store.store_id), 0), ifnull((select sum(qs.service_fee) from han_qm_store_class qs where qs.is_charged<>0 and qs.class_style=2 and qs.store_id=han_store.store_id and qs.deadline>=0), 0)) service_fee';
$field .= ',(select count(fs.store_id) from han_favorites_store fs where fs.fav_type=1 and fs.store_id=han_store.store_id) fav_total,(select count(fs.store_id) from han_favorites_store fs where fs.fav_type=1 and fs.fav_from=3 and fs.store_id=han_store.store_id) fav3_total'; $field .= ',(select count(fs.store_id) from han_favorites_store fs where fs.fav_type=1 and fs.store_id=han_store.store_id) fav_total,(select count(fs.store_id) from han_favorites_store fs where fs.fav_type=1 and fs.fav_from=3 and fs.store_id=han_store.store_id) fav3_total';
...@@ -373,7 +373,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -373,7 +373,7 @@ class StoreServiceModel extends \Business\AbstractModel{
$returnClass = []; $returnClass = [];
if($class){ if($class){
foreach ($class as $v){ foreach ($class as $v){
$returnClass[] = $v['gc_name']; $returnClass[] = htmlspecialchars_decode($v['gc_name']);
} }
} }
list($qualificationPics,$detailImg) = $this->getStoreQualification($storeId,$storeInfo['member_id']); list($qualificationPics,$detailImg) = $this->getStoreQualification($storeId,$storeInfo['member_id']);
...@@ -833,7 +833,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -833,7 +833,7 @@ class StoreServiceModel extends \Business\AbstractModel{
if($goodsClassList){ if($goodsClassList){
foreach($goodsClassList as $goodsClass){ foreach($goodsClassList as $goodsClass){
$returnStores = array(); $returnStores = array();
$returnStores['gcName'] = $goodsClass['gcName']; $returnStores['gcName'] = htmlspecialchars_decode($goodsClass['gcName']);
$existStoreIds = null; $existStoreIds = null;
$returnStores['stores'] = null; $returnStores['stores'] = null;
$exitStore = array(); $exitStore = array();
......
...@@ -64,6 +64,7 @@ class GoodsClassModel extends \DAO\AbstractModel { ...@@ -64,6 +64,7 @@ class GoodsClassModel extends \DAO\AbstractModel {
if($result){ if($result){
foreach ($result as &$class){ foreach ($result as &$class){
$class['gcName'] = htmlspecialchars_decode($class['gcName']);
$class['gcImage'] = \Our\Common::getStaticFile(\Our\ImageConst::categoryPicPrefix.$class['gcId'].\Our\NameConst::jpgSuffix,\Our\ImageConst::defaultPath); $class['gcImage'] = \Our\Common::getStaticFile(\Our\ImageConst::categoryPicPrefix.$class['gcId'].\Our\NameConst::jpgSuffix,\Our\ImageConst::defaultPath);
$classes[$class['gcId']] = $class; $classes[$class['gcId']] = $class;
} }
......
...@@ -384,8 +384,11 @@ class MemberModel extends \DAO\AbstractModel ...@@ -384,8 +384,11 @@ class MemberModel extends \DAO\AbstractModel
if (!$where['password']) { if (!$where['password']) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPassword); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPassword);
} }
if (!\Our\Validate::checkPassword($where['password'])) { /*if (!\Our\Validate::checkPassword($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit); \Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit);
}*/
if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
} }
if (!$where['deviceType']) { if (!$where['deviceType']) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyDeviceType); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyDeviceType);
...@@ -399,8 +402,8 @@ class MemberModel extends \DAO\AbstractModel ...@@ -399,8 +402,8 @@ class MemberModel extends \DAO\AbstractModel
public function checkChangedInfo($where) public function checkChangedInfo($where)
{ {
$this->checkRegisterMobile($where); $this->checkRegisterMobile($where);
if (!\Our\Validate::checkPassword($where['password'])) { if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit); \Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
} }
} }
...@@ -492,8 +495,8 @@ class MemberModel extends \DAO\AbstractModel ...@@ -492,8 +495,8 @@ class MemberModel extends \DAO\AbstractModel
*/ */
public function checkWxBindMobile($where){ public function checkWxBindMobile($where){
$this->checkWxBindMobileCommon($where); $this->checkWxBindMobileCommon($where);
if (!\Our\Validate::checkPassword($where['password'])) { if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit); \Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
} }
} }
...@@ -506,8 +509,8 @@ class MemberModel extends \DAO\AbstractModel ...@@ -506,8 +509,8 @@ class MemberModel extends \DAO\AbstractModel
if ($data['password'] != $data['rePassword']) { if ($data['password'] != $data['rePassword']) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::differentPasswordAndRepassword); \Error\ErrorModel::throwException(\Error\CodeConfigModel::differentPasswordAndRepassword);
} }
if (!\Our\Validate::checkPassword($data['password'])) { if (!\Our\Validate::checkPasswordLen($data['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit); \Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
} }
} }
...@@ -684,8 +687,8 @@ class MemberModel extends \DAO\AbstractModel ...@@ -684,8 +687,8 @@ class MemberModel extends \DAO\AbstractModel
} }
} }
public function validPassword($where){ public function validPassword($where){
if (!\Our\Validate::checkPassword($where['password'])) { if (!\Our\Validate::checkPasswordLen($where['password'])) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLimit); \Error\ErrorModel::throwException(\Error\CodeConfigModel::passwordLenLimit);
} }
} }
......
...@@ -233,7 +233,9 @@ class OrderGoodsModel extends \DAO\AbstractModel ...@@ -233,7 +233,9 @@ class OrderGoodsModel extends \DAO\AbstractModel
public function getMustReduceAmount($orderGoodses, $discountAmount, $orderGoods) public function getMustReduceAmount($orderGoodses, $discountAmount, $orderGoods)
{ {
$allNumbers = array_column($orderGoodses, 'goodsNum'); $allNumbers = array_column($orderGoodses, 'goodsNum');
$allNumbers=array_sum($allNumbers);
$allGoodsPrice = array_column($orderGoodses, 'goodsPrice'); $allGoodsPrice = array_column($orderGoodses, 'goodsPrice');
$allGoodsPrice=array_sum($allGoodsPrice);
$allMoney = $allNumbers * $allGoodsPrice; $allMoney = $allNumbers * $allGoodsPrice;
$thisOrderGoodsAmount = $orderGoods['goodsNum'] * $orderGoods['goodsPrice']; $thisOrderGoodsAmount = $orderGoods['goodsNum'] * $orderGoods['goodsPrice'];
$reduceAmount=($discountAmount*$thisOrderGoodsAmount)/($allMoney); $reduceAmount=($discountAmount*$thisOrderGoodsAmount)/($allMoney);
......
...@@ -80,7 +80,7 @@ class OrderPayModel extends \DAO\AbstractModel{ ...@@ -80,7 +80,7 @@ class OrderPayModel extends \DAO\AbstractModel{
* 单例模式获取类实例 * 单例模式获取类实例
* *
*/ */
public static function getInstance($dbName = 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);
......
...@@ -551,6 +551,9 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -551,6 +551,9 @@ class RefundReturnModel extends \DAO\AbstractModel
if (!isset($refund_array['refund_sn']) || !$refund_array['refund_sn']) { if (!isset($refund_array['refund_sn']) || !$refund_array['refund_sn']) {
$refund_array['refund_sn'] = $this->getRefundsn($order['storeId']); $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(); $refund_id = $this->db->insert($this->_tableName)->rows($refund_array)->execute();
// 发送商家提醒 // 发送商家提醒
$param = array(); $param = array();
......
...@@ -104,6 +104,7 @@ class CodeConfigModel ...@@ -104,6 +104,7 @@ class CodeConfigModel
const sellerNameUpdateFailed = 10116; const sellerNameUpdateFailed = 10116;
const notHaveAccess = 10117; const notHaveAccess = 10117;
const sellerJoinUpdateFailed = 10118; const sellerJoinUpdateFailed = 10118;
const passwordLenLimit = 10119;
//访问错误 //访问错误
const illegalAccess = 200001; const illegalAccess = 200001;
...@@ -323,6 +324,7 @@ class CodeConfigModel ...@@ -323,6 +324,7 @@ class CodeConfigModel
const refundMoneyError=300142; const refundMoneyError=300142;
const refundWriteError=300143; const refundWriteError=300143;
const beyondRecieverTime=300144; const beyondRecieverTime=300144;
const payTypeUpdateError = 30145;
//店铺相关错误码 //店铺相关错误码
//商品分类 //商品分类
...@@ -535,6 +537,7 @@ class CodeConfigModel ...@@ -535,6 +537,7 @@ class CodeConfigModel
self::sellerNameUpdateFailed => '更换手机时卖家手机号码更新失败', self::sellerNameUpdateFailed => '更换手机时卖家手机号码更新失败',
self::notHaveAccess => '您没有权限使用', self::notHaveAccess => '您没有权限使用',
self::sellerJoinUpdateFailed => '更换手机时卖家手机号码更新失败', self::sellerJoinUpdateFailed => '更换手机时卖家手机号码更新失败',
self::passwordLenLimit => '密码为6~16位的数字或字母组合',
//商品相关 //商品相关
self::emptyCommonId => '商品主键不能为空', self::emptyCommonId => '商品主键不能为空',
self::goodsNotExist => '商品不存在', self::goodsNotExist => '商品不存在',
...@@ -828,6 +831,7 @@ class CodeConfigModel ...@@ -828,6 +831,7 @@ class CodeConfigModel
self::refundMoneyError=>'退款失败', self::refundMoneyError=>'退款失败',
self::refundWriteError=>'退款表写入失败', self::refundWriteError=>'退款表写入失败',
self::beyondRecieverTime=>'设置收货时间不能早于当前时间', self::beyondRecieverTime=>'设置收货时间不能早于当前时间',
self::payTypeUpdateError=> '更新支付类型失败',
//销售员 //销售员
self::emptySaleGoodsId => '商品id不能为空', self::emptySaleGoodsId => '商品id不能为空',
self::emptySaleGoods => '销售商品不存在', self::emptySaleGoods => '销售商品不存在',
......
...@@ -404,7 +404,7 @@ elastic.master.scheme="http"; ...@@ -404,7 +404,7 @@ elastic.master.scheme="http";
resources.database.params.driver = "pdo_mysql" resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "127.0.0.1" resources.database.params.hostname = "127.0.0.1"
resources.database.params.port = 3306 resources.database.params.port = 3306
resources.database.params.database = "qmcs" resources.database.params.database = "testqmcs"
resources.database.params.username = "root" resources.database.params.username = "root"
resources.database.params.password = "123456" resources.database.params.password = "123456"
resources.database.params.charset = "UTF8" resources.database.params.charset = "UTF8"
...@@ -414,7 +414,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8" ...@@ -414,7 +414,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8"
resources.database.slave.params.driver = "pdo_mysql" resources.database.slave.params.driver = "pdo_mysql"
resources.database.slave.params.hostname = "127.0.0.1" resources.database.slave.params.hostname = "127.0.0.1"
resources.database.slave.params.port = 3306 resources.database.slave.params.port = 3306
resources.database.slave.params.database = "qmcs" resources.database.slave.params.database = "testqmcs"
resources.database.slave.params.username = "root" resources.database.slave.params.username = "root"
resources.database.slave.params.password = "123456" resources.database.slave.params.password = "123456"
resources.database.slave.params.charset = "UTF8" resources.database.slave.params.charset = "UTF8"
......
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