Commit 9e150f7d authored by christ's avatar christ

pc

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