Commit 59ba766c authored by liuyuzhen's avatar liuyuzhen

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

parents fc72a893 fc94ffd1
......@@ -24,7 +24,7 @@ class ApiConst
const halfHour = 1800;
//预警时间
const storageAlarmHour = 10800;
const storageAlarmHour = 100000000000000;
const twoMinSecond = 120;
......@@ -422,7 +422,7 @@ class ApiConst
const messageRefundProccessing=104;
//售后待收货
const messageRefundWaitReceive=105;
//用户被其它用户登录请退出
//预警商品数量
const messageGoodsAlert=106;
//用户被其它用户登录请退出
const messageOtherLogin=107;
......@@ -448,6 +448,8 @@ class ApiConst
const arriveTimeRadius=1800;
const arrBegin=0;
......
......@@ -171,5 +171,9 @@ class DescribeConst
const anonymity = '匿名用户';
const imageMessage='【图片】';
const updateSuccess='修改成功';
const updateFail='修改失败';
}
?>
\ No newline at end of file
......@@ -1314,4 +1314,13 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
public function getGoodsCount($storeIds){
$goodsDao=\DAO\GoodsModel::getInstance();
$storeIds=implode(',',$storeIds);
$where=Common::format(" store_id in({0}) and goods_storage<goods_storage_alarm",$storeIds);
$stores=$goodsDao->getListGroup($where,"store_id as storeId,count(*) as count","store_id");
return $stores;
}
}
......@@ -745,9 +745,6 @@ class OrderServiceModel extends \Business\AbstractModel
echo '物流信息更新成功订单号:' . $result['orderId'] . "\r\n";
}
};
}
/**
......@@ -826,6 +823,22 @@ class OrderServiceModel extends \Business\AbstractModel
}
public function updateOrderAmount($storeId,$orderId,$newOrderAmount)
{
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$orderDetail=$orderDao->getByOrderId($orderId,$orderDao->getOrderDetailField());
$orderDetail=$orderDetail[ApiConst::arrBegin];
if($orderDetail['storeId']!=$storeId){
ErrorModel::throwException(CodeConfigModel::orderNotExist);
}
if($orderDetail['isReceivePayment'] != ApiConst::noreceivePayment){
ErrorModel::throwException(CodeConfigModel::notAllowUpdataOrderAmount);
}
$data['order_amount']=$newOrderAmount;
$res=$orderDao->updateByOrderId($data,$orderId);
return $res;
}
/**
* 获得配送详情
*
......
......@@ -307,8 +307,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
}
if ($this->clientType && $this->clientType == NameConst::pcClient) {
$value['couponAmount'] = ($value['goodsAmount'] + $value['shippingFee']) - $value['orderAmount'];//优惠券金额
$value['receiveAmount'] = $value['goodsAmount'] - $value['couponAmount'];
$value['orderAmount'] = $value['orderAmount'] + $value['couponAmount'];
$value['receiveAmount'] = $value['goodsAmount']+$value['shippingFee'] - $value['couponAmount'];
// $value['orderAmount'] = $value['orderAmount'];
$value['reciverInfo'] = unserialize($value['reciverInfo']);
$value['dlyoPickupCode'] = intval(substr($value['orderSn'], ApiConst::positionPickupCodeBegin));
$value['deliveryTimeEnd'] = $value['deliveryTime'] + ApiConst::arriveTimeRadius;
......
......@@ -75,6 +75,9 @@ class GoodsModel extends \DAO\AbstractModel {
}
public function getListGroup($where,$field,$groupField){
$this->setDb($this->dbName);
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
return $this->db->select($field)->from($this->_tableName)->where($where)->group($groupField)->fetchAll();
}
// public function getOneById($id){
......
......@@ -258,22 +258,22 @@ class GoodsCommonModel extends \DAO\AbstractModel {
$updateSaleNumOp = $op==\Our\ApiConst::minus?'+':'-';
}
$goodsCommonSql = ' goods_storage = case goods_commonid ';
$goodsEdittimeSql = ' goods_edittime = case goods_commonid ';
// $goodsEdittimeSql = ' goods_edittime = case goods_commonid ';
if($updateSaleNumFlag){
$saleNumSql = 'sale_num = case goods_commonid ';
}
for ($i = 0; $i < count($datas); $i++) {
$goodsCommonSql .= \Our\Common::format(" WHEN {0} THEN goods_storage{1}{2} ", $datas[$i]['goodsCommonId'],\Our\ArrayConst::ops[$op], $datas[$i]['goodsNum']);
$goodsEdittimeSql .= \Our\Common::format(" WHEN {0} THEN goods_edittime={1}", $datas[$i]['goodsCommonId'],TIMESTAMP);
// $goodsEdittimeSql .= \Our\Common::format(" WHEN {0} THEN goods_edittime={1}", $datas[$i]['goodsCommonId'],TIMESTAMP);
if($updateSaleNumFlag){
$saleNumSql .= \Our\Common::format(" when {0} THEN sale_num {1}{2} ", $datas[$i]['goodsCommonId'],$updateSaleNumOp, $datas[$i]['goodsNum']);
}
$dataIds[] = $datas[$i]['goodsCommonId'];
if ($i % 1000 == 0 && $i != 0) {
$goodsCommonSql = trim($goodsCommonSql,',').' END';
$goodsEdittimeSql = trim($goodsEdittimeSql,',').' END';
// $goodsEdittimeSql = trim($goodsEdittimeSql,',').' END';
$updateAllSql .= $goodsCommonSql;
$updateAllSql .= $goodsEdittimeSql;
// $updateAllSql .= $goodsEdittimeSql;
if($updateSaleNumFlag){
$saleNumSql = ','.trim($saleNumSql,',').' END ';
$updateAllSql .= $saleNumSql;
......@@ -285,7 +285,7 @@ class GoodsCommonModel extends \DAO\AbstractModel {
}
$updateAllSql = $baseSql;
$goodsCommonSql = 'goods_storage = case goods_commonid ';
$goodsEdittimeSql = ' goods_edittime = case goods_commonid ';
// $goodsEdittimeSql = ' goods_edittime = case goods_commonid ';
if($updateSaleNumFlag){
$saleNumSql = 'sale_num = case goods_commonid ';
}
......@@ -294,9 +294,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
}
if ($goodsCommonSql) {
$goodsCommonSql = trim($goodsCommonSql,',').' END ';
$goodsEdittimeSql = trim($goodsEdittimeSql,',').' END';
// $goodsEdittimeSql = ','.trim($goodsEdittimeSql,',').' END';
$updateAllSql .= $goodsCommonSql;
$updateAllSql .= $goodsEdittimeSql;
// $updateAllSql .= $goodsEdittimeSql;
if($updateSaleNumFlag){
$saleNumSql = ','.trim($saleNumSql,',').' END ';
$updateAllSql .= $saleNumSql;
......
......@@ -292,6 +292,7 @@ class CodeConfigModel
const addDeliveryManError = 300124;
const updateOrderFail = 300120;
const selectDeliveryFail = 300121;
const notAllowUpdataOrderAmount = 300125;
const noEnoughStorageForBundlingGoods = 30118;
const noOrderWaitToPay = 30119;
const wrongEvaluation = 30120;
......@@ -778,6 +779,7 @@ class CodeConfigModel
self::selectDeliveryFail=>'配送员选择失败',
self::noEnoughStorageForBundlingGoods => '组合销售库存紧张,您购买的数量太多啦',
self::noOrderWaitToPay => '您的订单已支付,请勿重复支付',
self::notAllowUpdataOrderAmount=>'当前状态不允许修改订单金额',
self::wrongEvaluation => '商品评论应在6-500字之间',
self::selfGoodsForStoreOrder => '店主不能购买自己的商品',
//销售员
......
......@@ -278,9 +278,9 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
}
/**
* 确认收货
* @throws Exception
*/
* 确认收货
* @throws Exception
*/
public function confirmReceiveAction(){
$refundId= intval($this->req['data']['refundId']);
if(!$refundId) {
......@@ -293,6 +293,8 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
}
/**
* 获取应用版本
*/
......@@ -328,6 +330,27 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$this->success($res);
}
/**
* 修改订单金额
* @throws Exception
*/
public function modifyOrderAmountAction(){
$orderId= intval($this->req['data']['orderId']);
$orderAmount= intval($this->req['data']['orderAmount']);
if(empty($orderId) && empty($orderAmount)) {
ErrorModel::throwException(CodeConfigModel::paramsError);
}
$orderService=\Business\Order\OrderServiceModel::getInstance();
$res = $orderService->updateOrderAmount($this->storeId, $orderId,$orderAmount);
if($res !==false){
$this->success($res,\Our\DescribeConst::updateSuccess);
}
ErrorModel::throwException(CodeConfigModel::commonError);
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简单的html5 File测试 for pic2base64</title>
<style>
</style>
</head>
<body>
<form action="/client/shopkeeper/modifyOrderAmount" method="post">
用户登录状态key:<input name="data[key]" value="bd9b675342850f741b1818aa74aa63a8"/><br />
订单id:<input name="data[orderId]" value="403"/><br />
订单价格:<input name="data[orderAmount]" value="10"/><br />
<p id="img_area"></p>
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
......@@ -85,14 +85,19 @@ class cliOrderClose extends basecli
$push->addOneToClient($addData);
}
$goodsCommonService=\Business\Goods\GoodsCommonServiceModel::getInstance();
$stores=$goodsCommonService->getAlertGoods();
if(!empty($stores)){
foreach($stores as $store){
$addData=array('storeId'=>$store['storeId'],'type'=>\Our\ApiConst::messageGoodsAlert,'op'=>\Our\NameConst::set,'num'=>$store['count'],'params'=>array());
$push->addOneToClient($addData);
}
$storesBase=$goodsCommonService->getAlertGoods();
if($storesBase){
$storesIds=array_column($storesBase,'storeId');
$stores=$goodsCommonService->getGoodsCount($storesIds);
if(!empty($stores)){
foreach($stores as $store){
$addData=array('storeId'=>$store['storeId'],'type'=>\Our\ApiConst::messageGoodsAlert,'op'=>\Our\NameConst::set,'num'=>$store['count'],'params'=>array());
$push->addOneToClient($addData);
}
}
}
$push->sendTcpMessage();
$redis->close();
}
......
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