Commit 9e150f7d authored by christ's avatar christ

pc

parent d8a06c7c
...@@ -668,14 +668,12 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -668,14 +668,12 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orders = isset($storeMemberStatisticDatas['list']) ? $storeMemberStatisticDatas['list'] : false; $orders = isset($storeMemberStatisticDatas['list']) ? $storeMemberStatisticDatas['list'] : false;
$this->taskIndex++; $this->taskIndex++;
if ($orders) { if ($orders) {
$i=0;
foreach($orders as $order){ foreach($orders as $order){
$storeMemberStatisticsData['storeId']=$order['storeId']; $storeMemberStatisticsData['storeId']=$order['storeId'];
$storeMemberStatisticsData['buyerId']=$order['buyerId']; $storeMemberStatisticsData['buyerId']=$order['buyerId'];
$orderRes=$orderDao->getSumAmountCountByMemberIdAndStoreId($storeMemberStatisticsData['storeId'],$storeMemberStatisticsData['buyerId']); $orderRes=$orderDao->getSumAmountCountByMemberIdAndStoreId($storeMemberStatisticsData['storeId'],$storeMemberStatisticsData['buyerId']);
$storeMemberStatisticsData['orderTotal']=$orderRes['orderTotal']?$orderRes['orderTotal']:ApiConst::zero; $storeMemberStatisticsData['orderTotal']=$orderRes['orderTotal']?$orderRes['orderTotal']:ApiConst::zero;
$orderGoodsRes=$orderGoodDao->getOrderGoodsCountBuyStoreIdAndMemberId( $storeMemberStatisticsData['storeId'],$storeMemberStatisticsData['buyerId']); $orderGoodsRes=$orderGoodDao->getOrderGoodsCountBuyStoreIdAndMemberId( $storeMemberStatisticsData['storeId'],$storeMemberStatisticsData['buyerId']);
echo $i++;echo "\r\n";
$orderGoodsCount=$orderGoodsRes?$orderGoodsRes['orderGoodsCount']:ApiConst::zero; $orderGoodsCount=$orderGoodsRes?$orderGoodsRes['orderGoodsCount']:ApiConst::zero;
$storeMemberStatisticsData['orderGoodsCount']=$orderGoodsCount; $storeMemberStatisticsData['orderGoodsCount']=$orderGoodsCount;
$storeMemberStatisticsData['addTime']=TIMESTAMP; $storeMemberStatisticsData['addTime']=TIMESTAMP;
...@@ -685,13 +683,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -685,13 +683,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
echo $ex->getMessage().json_encode($storeMemberStatisticsData)."\r\n"; echo $ex->getMessage().json_encode($storeMemberStatisticsData)."\r\n";
} }
} }
echo 4;
} }
echo 5;
echo $this->taskIndex;
echo 6;
} while ($orders); } while ($orders);
echo 234234;exit;
file_put_contents($this->baseDir . PathConst::orderGoodsCreateTime, TIMESTAMP); file_put_contents($this->baseDir . PathConst::orderGoodsCreateTime, TIMESTAMP);
} }
//任务脚本原来的方法是下面那个 //任务脚本原来的方法是下面那个
...@@ -912,20 +905,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -912,20 +905,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
if (!empty($refundReturns)) { if (!empty($refundReturns)) {
foreach ($refundReturns as $refundReturn) { foreach ($refundReturns as $refundReturn) {
$orderDao->deleteOrderCache($refundReturn['buyerId'], $refundReturn['orderId'], $refundReturn['storeId'], true, true); $orderDao->deleteOrderCache($refundReturn['buyerId'], $refundReturn['orderId'], $refundReturn['storeId'], true, true);
$res = $orderGoodsDao->find(array('order_id' => $refundReturn['orderId'], 'refund_id' => ApiConst::zero));
if (empty($res)) {
$reduceData['store_id']=$refundReturn['storeId']; $reduceData['store_id']=$refundReturn['storeId'];
$reduceData['member_id']=$refundReturn['buyerId']; $reduceData['buyer_id']=$refundReturn['buyerId'];
$reduceData['order_goods_count']=ApiConst::zero; $reduceData['order_goods_count']=ApiConst::zero;
$reduceData['order_total']=$refundReturn['orderAmount']; $reduceData['order_total']=$refundReturn['refundAmount'];
$reduceData['addTime']=TIMESTAMP; $reduceData['add_time']=TIMESTAMP;
array_push($reduceDatas,$reduceData); $where['store_id']=$reduceData['storeId'];
$where['buyer_id']=$reduceData['buyerId'];
$originOne=$storeMemberStatisticDao->find($where);
echo json_encode($originOne);exit;
if(!empty($originOne)){
$originOne['order_total']=$originOne['order_total']- $reduceData['orderTotal'];
$originOne['add_time']=TIMESTAMP;
echo json_encode($originOne);exit;
$storeMemberStatisticDao->update($originOne,$where);
}else{
$storeMemberStatisticDao->insert($reduceData,$where);
} }
} }
} }
} while ($refundReturns); } while ($refundReturns);
$storeMemberStatisticDao->addAllReduce($refundReturns); //$storeMemberStatisticDao->addAllReduce($refundReturns);
file_put_contents($this->baseDir . PathConst::refundRetrunGmtUpdate, TIMESTAMP); file_put_contents($this->baseDir . PathConst::refundRetrunGmtUpdate, TIMESTAMP);
} }
......
...@@ -55,18 +55,15 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel { ...@@ -55,18 +55,15 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
* @return mixed * @return mixed
*/ */
public function update($data,$where){ public function update($data,$where){
$this->setDb(); $this->setDb(DbNameConst::masterDBConnectName);
return $this->db->update($this->_tableName)->where($where)->rows($data)->execute(); return $this->db->update($this->_tableName)->where($where)->rows($data)->execute();
} }
/**
* 插入数据
* @param $data
* @return mixed
*/
public function insert($data){ public function insert($data){
$this->setDb(DbNameConst::masterDBConnectName);
return $this->db->insert($this->_tableName)->rows($data)->execute();
} }
/** /**
* 排序,1:关注时间降序,2:关注时间升序,3:购买力降序,4:购买力升序,默认1 * 排序,1:关注时间降序,2:关注时间升序,3:购买力降序,4:购买力升序,默认1
* @param $data * @param $data
...@@ -168,6 +165,7 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel { ...@@ -168,6 +165,7 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
} }
return $result; return $result;
} }
//插入数据大量 //插入数据大量
public function addOrUpdate($data) public function addOrUpdate($data)
{ {
......
...@@ -70,9 +70,9 @@ class cliShopkeeperIndex extends basecli ...@@ -70,9 +70,9 @@ class cliShopkeeperIndex extends basecli
$shopkeeperService = \Business\Store\ShopkeeperServiceModel::getInstance(); $shopkeeperService = \Business\Store\ShopkeeperServiceModel::getInstance();
$shopkeeperService->baseDir= \Our\Common::getConfig('out.config'); $shopkeeperService->baseDir= \Our\Common::getConfig('out.config');
try { try {
$shopkeeperService->insertStoreMemberStatics(); // $shopkeeperService->insertStoreMemberStatics();
//退货退款订单自动关闭 //退货退款订单自动关闭
// $shopkeeperService->reduceStoreMemberStatics(); $shopkeeperService->reduceStoreMemberStatics();
//$shopkeeperService->storeStatictisTask(); //$shopkeeperService->storeStatictisTask();
// $shopkeeperService->updateLastId(); // $shopkeeperService->updateLastId();
} catch (Exception $ex) { } catch (Exception $ex) {
......
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