Commit a3b0e81d authored by liuyuzhen's avatar liuyuzhen

测试购物车

parent aa0a25b8
......@@ -313,12 +313,12 @@ class GoodsModel extends \DAO\AbstractModel {
$updateAllSql = $baseSql;
$dataIds = array();
for ($i = 0; $i < count($datas); $i++) {
$updateSql = \Our\Common::format(" WHEN {0} THEN goods_storage{2}{1} END,", $datas[$i]['goodsId'], $datas[$i]['goodsNum'],\Our\ArrayConst::ops[$op]);
$updateSql = \Our\Common::format(" WHEN {0} THEN goods_storage{2}{1} ", $datas[$i]['goodsId'], $datas[$i]['goodsNum'],\Our\ArrayConst::ops[$op]);
$dataIds[] = $datas[$i]['goodsId'];
$updateAllSql .= $updateSql;
if ($i % 1000 == 0 && $i != 0) {
$updateAllSql = trim($updateAllSql,',');
$updateAllSql .= \Our\Common::format(' where goods_id in ({0})',implode(',',$dataIds));
$updateAllSql .= \Our\Common::format(' END where goods_id in ({0})',implode(',',$dataIds));
$one = $this->db->update($this->_tableName)->query($updateAllSql);
if (!$one) {
$error++;
......@@ -329,7 +329,7 @@ class GoodsModel extends \DAO\AbstractModel {
}
if ($updateAllSql != $baseSql) {
$updateAllSql = trim($updateAllSql,',');
$updateAllSql .= \Our\Common::format(' where goods_id in ({0})',implode(',',$dataIds));
$updateAllSql .= \Our\Common::format(' END where goods_id in ({0})',implode(',',$dataIds));
$one = $this->db->update($this->_tableName)->query($updateAllSql);
if (!$one) {
$error++;
......
......@@ -223,9 +223,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
$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']);
$goodsCommonSql .= \Our\Common::format(" WHEN {0} THEN goods_storage{1}{2} ", $datas[$i]['goodsCommonId'],\Our\ArrayConst::ops[$op], $datas[$i]['goodsNum']);
if($updateSaleNumFlag){
$saleNumSql .= \Our\Common::format(" when {0} THEN sale_num {1}{2},", $datas[$i]['goodsCommonId'],$updateSaleNumOp, $datas[$i]['goodsNum']);
$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) {
......
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