Commit 31ba6060 authored by wwccw0591's avatar wwccw0591

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

parents fdaef8ed efcbee66
......@@ -14,7 +14,16 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
public function setGoodsStorage($storeId, $goodsId, $num = 0, $type='set') {
/**
* 设置库存
* @param $storeId
* @param $goodsId
* @param int $num
* @param string $type
* @return array
* @throws \Exception
*/
public function setGoodsStorage($storeId, $goodsId, $num = 0, $type='add') {
if($goodsId === 0){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError);
}
......@@ -27,13 +36,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if(!$data) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::goodsNotExist);
}
$op = isset($this->setStorageType[$type]) ? $this->setStorageType[$type] : 2; //默认设置库存
$op = isset($this->setStorageType[$type]) ? $this->setStorageType[$type] : 1; //默认增加库存
$goodsDao->db->doTransaction();
$ret1 = $goodsDao->updateStorage($goodsId, $num, $op);
$ret2 = true;
if($op==1) { //如果就库存调整
$ret2 = $commonDao->updateStorage($data['goods_commonid']);
}
$ret2 = $commonDao->updateStorage($data['goods_commonid'], $op);
if(!$ret1 || !$ret2) {
$goodsDao->db->doRollback();
......
......@@ -238,6 +238,7 @@ class RefundServiceModel extends \Business\AbstractModel
//$this->recordSellerLog('退款处理,退款编号:'.$refund['refund_sn']); //待确认
$refundReturnDao->deleteRefundCache($refund['buyer_id'], $refund['refund_id']);
$orderDao->deleteOrderCache($refund['buyer_id'],$refund['order_id'],$refund['store_id']);
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array(), array($refund['store_id']));
$refundReturnDao->db->doCommit();
return true;
}
......@@ -264,15 +265,15 @@ class RefundServiceModel extends \Business\AbstractModel
//检测该店铺是否开启直接退款功能
$storeDAO = \DAO\StoreModel::getInstance();
//店铺积分
$is_direct_refund = $storeDAO->getInfoById($storeId, 'is_direct_refund', true);
$is_direct_refund = $storeDAO->getInfoById($storeId, 'is_direct_refund', 'is_direct_refund');
$orderGoodsDao->update(array('rec_id'=>$refund['order_goods_id']), array('refund_state_name'=>'卖家同意退款'));
if($is_direct_refund==1){ //支持直接退款
//退款 检测该订单是否为线上支付
$updateData = array('is_suc_refund'=>1,'gmt_update'=>TIMESTAMP);
if($refund['refund_amount']>0){
if($refund_array['refund_amount']>0){
$payment_type = $order_info['payment_type'];
if(!in_array($payment_type,array(0,2))){
$state = $refundReturnDao->storeRefund(array_merge($order_info, array('refund_order_no'=>$refund['order_sn'], 'refund_amount'=> $refund['refund_amount'])));
$state = $refundReturnDao->storeRefund(array_merge($order_info, array('refund_order_no'=>$refund['order_sn'], 'refund_amount'=> $refund_array['refund_amount'])));
if (!$state) {
//throw new Exception('更新订单信息失败');
$refundReturnDao->db->doRollback();
......@@ -300,6 +301,7 @@ class RefundServiceModel extends \Business\AbstractModel
}
$refundReturnDao->deleteRefundCache($refund['buyer_id'], $refund['refund_id']);
$orderDao->deleteOrderCache($refund['buyer_id'],$refund['order_id'],$refund['store_id']);
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array(), array($refund['store_id']));
$refundReturnDao->db->doCommit();
return true;
}
......@@ -315,6 +317,7 @@ class RefundServiceModel extends \Business\AbstractModel
* @return bool
*/
private function edit_points($refund,$order_info){
return true; //暂时不对积分做处理
$settingDAO = \DAO\SettingModel::getInstance();
$points_ratio = floatval($settingDAO->getListCache(array('points_ratio'))['points_ratio']);
......@@ -389,6 +392,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao=\DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
$where['store_id'] = $storeId;
$where['order_lock'] = 2;
$order = array('add_time' => 'desc');
switch($type) {
case 1:
......@@ -407,7 +411,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsId = array_column($refundReturns['list'], 'orderGoodsId');
//获得售后商品列表getOrderGoodsByRecIds
if (!empty($orderGoodsId)) {
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByRecIds'), array($orderGoodsId, $this->refundOrderGoodsField), \Our\ApiConst::oneDaySecond, array($memberId));
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByRecIds'), array($orderGoodsId, $this->refundOrderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId));
$refundMerge = Common::intergrateOneToOne($refundReturns['list'], $orderGoods, 'orderGoodsId', 'recId');
foreach ($refundMerge as &$value) {
$value['stateName'] = $refundReturnDao->getRefundTextStatus($value);
......
......@@ -22,10 +22,11 @@ class FeedBackServiceModel extends \Business\AbstractModel
public function saveFeedback($param, $storeId, $memberId) {
$storeDAO = \DAO\StoreModel::getInstance();
$feedbackDescribe = trim($param['feedbackDescribe']);
$feedbackTelephone = $storeDAO->getInfoById($storeId, 'store_phone', true);
if(!$feedbackDescribe){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyFeedbackDescribe);
}
$feedbackTelephone = $storeDAO->getInfoById($storeId, 'store_phone', 'store_phone');
$insert = array();
$insert['feedback_type'] = 1; //店铺意见反馈
$insert['feedback_describe'] = $feedbackDescribe;
......
......@@ -35,10 +35,14 @@ class GoodsCommonModel extends \DAO\AbstractModel {
* @param $op 1增加 2设置
* @return mixed
*/
public function updateStorage($goodsCommonid) {
public function updateStorage($goodsCommonid, $op = 1) {
$this->setDb();
$whereSql = 'goods_commonid='.$goodsCommonid;
$updateSql = 'goods_storage = (select sum(t.goods_storage) from '.$this->_child_tableName.' t where t.goods_commonid='.$goodsCommonid.')';
if($op==1){
$updateSql = 'goods_storage = (select sum(t.goods_storage) from '.$this->_child_tableName.' t where t.goods_commonid='.$goodsCommonid.')';
} else {
$updateSql = 'goods_storage_alarm = 0';
}
$updateAllSql = "UPDATE {$this->_tableName} set {$updateSql} where {$whereSql}";
return $this->db->update($this->_tableName)->query($updateAllSql);
}
......
......@@ -413,7 +413,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
}
$this->setDb($this->dbName);
if (is_array($data)) {
$result = $this->db->update($this->_tableName)->rows($data)->where($where)->execute();
$result = $this->db->update($this->_tableName)->rows($data)->where($condition)->execute();
return $result;
} else {
return false;
......
File mode changed from 100755 to 100644
<?php
class FeedbackController extends \Our\Controller_AbstractApi {
class FeedbackController extends \Our\Controller_AbstractClient {
public function init(){
parent::init();
}
public function saveFeedbackAction(){
$msg = \Business\User\FeedBackServiceModel::getInstance()->saveFeedback($this->req[\Our\NameConst::data], $this->storeId,$this->memberId);
$msg = \Business\User\FeedBackServiceModel::getInstance()->saveFeedback($this->req[\Our\NameConst::data], $this->storeId, $this->memberId);
$this->success('');
}
}
\ No newline at end of file
......@@ -241,7 +241,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$type = intval($this->req['data']['type']);
$refundService=\Business\Order\RefundServiceModel::getInstance();
$pageIndex=$this->getPageIndex();
$pageSize=$this->getPageSize();
$pageSize=$this->getPageSize(8);
$res=$refundService->getStoreRefundList($this->storeId, $type, $pageIndex, $pageSize);
$this->success($res);
}
......
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