|
|
@@ -4,209 +4,237 @@ namespace App\Services;
|
|
|
|
|
|
use App\Order;
|
|
|
use App\OrderCommodity;
|
|
|
+use App\Services\common\BatchUpdateService;
|
|
|
+use App\Services\common\DataHandlerService;
|
|
|
use Carbon\Carbon;
|
|
|
|
|
|
Class OrderCommodityService
|
|
|
{
|
|
|
- public function syncOrderCommodities(&$orderHeaders)
|
|
|
+
|
|
|
+ public function insert($innerParams){
|
|
|
+ if(!$innerParams)return false;
|
|
|
+ if(count($innerParams)==0)return false;
|
|
|
+ try {
|
|
|
+ $bool = OrderCommodity::query()->insert($innerParams);
|
|
|
+ if ($bool) app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities SUCCESS' . ' || ' . count($innerParams) . ' || ' . json_encode($innerParams));
|
|
|
+ else app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities FAULT' . ' || ' . count($innerParams) . ' || ' . json_encode($innerParams));
|
|
|
+ return $bool;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities ERROR'. ' || ' . count($innerParams) . ' || ' . json_encode($innerParams).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function batchUpdate($updateParams){
|
|
|
+ return app(BatchUpdateService::class)->batchUpdate('order_commodities',$updateParams);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function syncOrderCommodity(&$orderHeaders)
|
|
|
{
|
|
|
/**
|
|
|
- * @var CommodityService $commodityService
|
|
|
* @var OwnerService $ownerService
|
|
|
+ * @var CommodityService $commodityService
|
|
|
+ * @var DataHandlerService $dataHandlerService
|
|
|
*/
|
|
|
- $commodityService = app('CommodityService');
|
|
|
$ownerService = app('OwnerService');
|
|
|
- if(count($orderHeaders) == 0)return ;
|
|
|
- $order_nos = array_unique(data_get($orderHeaders,'*.orderno'));
|
|
|
- $commodities_map = [];$owners_id_maps = [];
|
|
|
- $owner_code_maps = (function()use(&$ownerService,&$orderHeaders,&$owners_id_maps){
|
|
|
- $customer_ids= array_unique(data_get($orderHeaders,'*.customerid'));
|
|
|
- $owners = $ownerService->getOwnerByCodes($customer_ids);
|
|
|
- $owner_code_maps = [];
|
|
|
- if(count($owners) == 0)return $owner_code_maps;
|
|
|
- foreach ($owners as $owner) {
|
|
|
- $owner_code_maps[$owner['code']]= $owner['id'];
|
|
|
- $owners_id_maps[$owner['id']] = $owner['code'];
|
|
|
- }
|
|
|
- return $owner_code_maps;
|
|
|
- })();
|
|
|
- // 重组OrderDetails
|
|
|
- $orderDetails_map = (function()use(&$orderHeaders,&$owner_code_maps,&$commodities_map){
|
|
|
- $map = [];
|
|
|
- if(count($orderHeaders)==0)return $map;
|
|
|
- foreach ($orderHeaders as $orderHeader) {
|
|
|
- $Order_Details = $orderHeader->oracleDOCOrderDetails;
|
|
|
- $Order_Details->each(function($item)use(&$map,&$owner_code_maps,&$commodities_map){
|
|
|
- if(!empty($item['customerid']) && !empty($item['sku'])){
|
|
|
- $key = "owner_code_{$item['customerid']}_sku_{$item['sku']}";
|
|
|
- $commodities_map[$key] = ['owner_code'=>$item['customerid'],'sku'=>$item['sku']];
|
|
|
- }
|
|
|
- $key = "orderno_{$item['orderno']}_sku{$item['sku']}_each_{$item['qtyordered']}_location_{$item['location']}";
|
|
|
- if(empty($map[$key]))$map[$key]=[];
|
|
|
- $map[$key][] = [
|
|
|
- 'code' => $item['orderno'],
|
|
|
- 'sku' => $item['sku'],
|
|
|
- 'owner_id'=>$owner_code_maps[$item['customerid']],
|
|
|
- 'amount' => $item['qtyordered'],
|
|
|
- 'location' => $item['location']
|
|
|
- ];
|
|
|
- });
|
|
|
- }
|
|
|
- return $map;
|
|
|
- })();
|
|
|
- $commodities = $commodityService->getCommoditiesByMap($commodities_map);
|
|
|
- $commodities_maps = (function()use($commodities,$owners_id_maps){
|
|
|
- $map = [];
|
|
|
- if(count($commodities) == 0)return $map;
|
|
|
- foreach ($commodities as $commodity) {
|
|
|
- $owner_code = $owners_id_maps[$commodity['owner_id']];
|
|
|
- $key ="owner_code_{$owner_code}_sku_{$commodity['sku']}";
|
|
|
- $map[$key] = $commodity;
|
|
|
+ $commodityService = app('CommodityService');
|
|
|
+ $dataHandlerService = app('DataHandlerService');
|
|
|
+ $orderNos = data_get($orderHeaders,'*.orderno');
|
|
|
+ $owner_codes = [];$sku_codes = [];
|
|
|
+ foreach ($orderHeaders as $orderHeader) {
|
|
|
+ $actAllocationDetails = $orderHeader->actAllocationDetails;
|
|
|
+ foreach ($actAllocationDetails as $actAllocationDetail) {
|
|
|
+ $owner_codes[$actAllocationDetail['customerid']] = $actAllocationDetail['customerid'];
|
|
|
+ $sku_codes[$actAllocationDetail['sku']] = $actAllocationDetail['sku'];
|
|
|
}
|
|
|
- return $map;
|
|
|
- })();
|
|
|
- $order_id_map = [];
|
|
|
- $orders_map = (function()use($order_nos,&$order_id_map){
|
|
|
- $map = [];
|
|
|
- if(count($order_nos)==0)return $map;
|
|
|
- $orders = Order::query()->whereIn('code',$order_nos)->get();
|
|
|
- $orders->each(function($item)use(&$map,&$order_id_map){
|
|
|
- $map[$item['code']] = ['id'=> $item['id'], 'owner_id' => $item['owner_id']];
|
|
|
- $order_id_map[$item['id']] = ['code'=> $item['code'], 'owner_id' => $item['owner_id']];
|
|
|
- });
|
|
|
- return $map;
|
|
|
- })();
|
|
|
- $orderCommodities = OrderCommodity::query()->with('commodity','order')->whereHas('order',function($query)use($order_nos){
|
|
|
- $query->whereIn('code',$order_nos);
|
|
|
+ }
|
|
|
+ if(count($sku_codes) ==0)return;
|
|
|
+ $owners = $ownerService->getOwnerByCodes($owner_codes);
|
|
|
+ $owner_id_maps = $dataHandlerService->dataHeader(['id'],$owners);
|
|
|
+ $commodities = $commodityService->get_(data_get($owners,'*.id'),$sku_codes,[],true);
|
|
|
+ unset($owner_codes,$sku_codes);
|
|
|
+ $commodity_map = [];
|
|
|
+ foreach ($commodities as $commodity) {
|
|
|
+ $owner = $dataHandlerService->getKeyValue(['id'=>$commodity->owner_id],$owner_id_maps);
|
|
|
+ $key = "_owner_code_{$owner['code']}_sku_{$commodity['sku']}";
|
|
|
+ $commodity_map[$key] = $commodity;
|
|
|
+ }
|
|
|
+
|
|
|
+ $orderCommodities = OrderCommodity::query()->with(['order','commodity'])->whereIn('order_id',function ($query)use($orderNos){
|
|
|
+ $query->from('orders')->select('id')->whereIn('code',$orderNos);
|
|
|
})->get();
|
|
|
+ $orders = Order::query()->with('packages.commodities')->whereIn('code',$orderNos)->get();
|
|
|
+ $order_code_map = $dataHandlerService->dataHeader(['code'],$orders);
|
|
|
+ $ActAllocationDetail_maps = $this->getRegroupActAllocationDetails($orderHeaders);
|
|
|
+ $orderCommodity_maps = $this->getRegroupOrderCommodities($orderCommodities,$owner_id_maps);
|
|
|
+ unset($orderCommodities,$owner_id_maps,$owners,$orderNos);
|
|
|
+ $this->filterHasExist($ActAllocationDetail_maps,$orderCommodity_maps);
|
|
|
+ $delete_ids = $this->getDeleteIds($ActAllocationDetail_maps,$orderCommodity_maps);
|
|
|
+ $create_params = $this->getCreateParams($ActAllocationDetail_maps,$orderCommodity_maps);
|
|
|
+ unset($orderCommodity_maps,$ActAllocationDetail_maps);
|
|
|
+
|
|
|
+ $inner_params = $this->getInnerParamsByParams($create_params,$order_code_map,$commodity_map);
|
|
|
+ unset($create_params,$order_code_map,$orders,$commodity_map);
|
|
|
+
|
|
|
+// $update_params = $this->getUpdateParamsByParamsAndDeleteIds($inner_params,$delete_ids);
|
|
|
+// if(count($update_params)>0)$this->batchUpdate($update_params);
|
|
|
+// unset($update_params);
|
|
|
|
|
|
- $orderCommodities_map = $this->regroupOrderCommodities($orderCommodities); // 重组orderCommodities
|
|
|
- $inner_params = $this->filterInnerParams($orderDetails_map,$orderCommodities_map);
|
|
|
- $del_ids = $this->filterDeleteParams($orderDetails_map,$orderCommodities_map);
|
|
|
if(count($inner_params)>0){
|
|
|
- $inner_arr = array_chunk($inner_params,4000);
|
|
|
- foreach ($inner_arr as $item) {
|
|
|
- $created_params = $this->createByInnerParams($item,$orders_map,$commodities_maps,$owners_id_maps);
|
|
|
- $this->insert($created_params);
|
|
|
- }
|
|
|
+ $inner_params = array_chunk($inner_params,4000);
|
|
|
+ foreach ($inner_params as $inner_param) {$this->insert($inner_param);}
|
|
|
+ unset($inner_params);
|
|
|
}
|
|
|
- if(count($del_ids)>0){
|
|
|
- $orderCommodities = OrderCommodity::query()->whereIn('id',$del_ids)->get();
|
|
|
- $this->batchDelete($orderCommodities);
|
|
|
+
|
|
|
+ if(count($delete_ids)==0)return;
|
|
|
+ OrderCommodity::query()->whereIn('id',$delete_ids)->delete();
|
|
|
+ app('LogService')->log(__METHOD__,__FUNCTION__,"delete OrderCommodity ".json_encode($delete_ids));
|
|
|
+ unset($delete_ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getRegroupActAllocationDetails(&$orderHeaders)
|
|
|
+ {
|
|
|
+ $map = [];
|
|
|
+ if($orderHeaders->count()==0) return $map;
|
|
|
+ $orderHeaders->each(function($orderHeader)use(&$map){
|
|
|
+ $orderHeader->actAllocationDetails->each(function ($details)use(&$map){
|
|
|
+ $key = "order_{$details['orderno']}_owner_code_{$details['customerid']}_sku_{$details['sku']}_location_{$details['location']}_amount_{$details['qty_each']}";
|
|
|
+ if(empty($map[$key]))$map[$key]=[];
|
|
|
+ $map[$key][] = [
|
|
|
+ 'code' => $details['orderno'],
|
|
|
+ 'sku' => $details['sku'],
|
|
|
+ 'owner_code'=> $details['customerid'],
|
|
|
+ 'amount' => $details['qty_each'],
|
|
|
+ 'location' => $details['location']
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return $map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function filterHasExist(&$ActAllocationDetail_maps,&$orderCommodity_maps)
|
|
|
+ {
|
|
|
+ foreach ($ActAllocationDetail_maps as $key=>$actAllocationDetail_map) {
|
|
|
+ $orderCommodity_map = $orderCommodity_maps[$key] ?? null;
|
|
|
+ if($orderCommodity_map == null)continue;
|
|
|
+ foreach ($actAllocationDetail_map as $index=>$item) {
|
|
|
+ if(count($orderCommodity_map)==0)break;
|
|
|
+ array_shift($orderCommodity_map);
|
|
|
+ unset($actAllocationDetail_map[$index]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function regroupOrderCommodities(&$orderCommodities)
|
|
|
+ public function getRegroupOrderCommodities(&$orderCommodities,$owner_id_maps)
|
|
|
{
|
|
|
+ /** @var DataHandlerService $dataHandlerService */
|
|
|
+ $dataHandlerService = app(DataHandlerService::class);
|
|
|
$map = [];
|
|
|
- if(count($orderCommodities)==0)return $map;
|
|
|
- foreach ($orderCommodities as $orderCommodity) {
|
|
|
- $key = "orderno_{$orderCommodity['order']['code']}_sku{$orderCommodity['commodity']['sku']}_each_{$orderCommodity['amount']}_location_{$orderCommodity['location']}";
|
|
|
- if(empty($map[$key]))$map[$key] =[];
|
|
|
- $map[$key][] = [
|
|
|
- 'id' =>$orderCommodity['id'],
|
|
|
- 'code' => $orderCommodity['order']['orderno'],
|
|
|
- 'sku' => $orderCommodity['commodity']['sku'],
|
|
|
- 'owner_id' => $orderCommodity['order']['owner_id'],
|
|
|
- 'amount' => $orderCommodity['amount'],
|
|
|
- 'location' => $orderCommodity['location'] ?? ''
|
|
|
+ if($orderCommodities->count() == 0)return $map;
|
|
|
+ $orderCommodities->each(function($orderCommodity)use(&$map,$owner_id_maps,$dataHandlerService){
|
|
|
+ $order = $orderCommodity->order;
|
|
|
+ $owner = $dataHandlerService->getKeyValue(['id'=>$order->owner_id ?? ''],$owner_id_maps);
|
|
|
+ $sku = $orderCommodity->commodity->sku ?? '';
|
|
|
+ $key = "order_{$order->code}_owner_code_{$owner['code']}_sku_{ $sku}_location_{$orderCommodity->location}_amount_{$orderCommodity->amount}";
|
|
|
+ if(empty($map[$key]))$map[$key]=[];
|
|
|
+ $map[$key][] =[
|
|
|
+ 'id' => $orderCommodity->id,
|
|
|
+ 'code' => $orderCommodity->order->code ?? '',
|
|
|
+ 'sku' => $sku,
|
|
|
+ 'owner_code' => $owner->code ?? '',
|
|
|
+ 'amount' => $orderCommodity->amount,
|
|
|
+ 'location' => $orderCommodity->location,
|
|
|
];
|
|
|
- }
|
|
|
+ });
|
|
|
return $map;
|
|
|
}
|
|
|
|
|
|
- private function filterInnerParams(&$orderDetails_map,&$orderCommodities_map)
|
|
|
+ public function getDeleteIds(&$ActAllocationDetail_maps,&$orderCommodity_maps)
|
|
|
{
|
|
|
- $inner_params = [];
|
|
|
- if(count($orderDetails_map) == 0)return $inner_params;
|
|
|
- foreach ($orderDetails_map as $key=>&$map) {
|
|
|
- if(empty($orderCommodities_map[$key])){
|
|
|
- foreach ($map as &$item) {
|
|
|
- $inner_params[] = $item;
|
|
|
+ $ids = [];
|
|
|
+ if(count($orderCommodity_maps)==0)return $ids;
|
|
|
+ foreach ($orderCommodity_maps as $key=>$orderCommodity_map) {
|
|
|
+ $ActAllocationDetail_map = $ActAllocationDetail_maps[$key] ?? null;
|
|
|
+ if($ActAllocationDetail_map==null){
|
|
|
+ foreach ($orderCommodity_map as $index=>$orderCommodity) {
|
|
|
+ $ids[] =$orderCommodity['id'];
|
|
|
+ unset($orderCommodity_map[$index]);
|
|
|
}
|
|
|
- }elseif(count($map)>count($orderCommodities_map[$key])){
|
|
|
- foreach ($map as &$obj) {
|
|
|
- if($orderCommodities_map[$key]>0)array_shift($orderCommodities_map[$key]);
|
|
|
- elseif($orderCommodities_map[$key]==0)$inner_params[] = $obj;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(count($ActAllocationDetail_map) == count($orderCommodity_map))continue;
|
|
|
+ if(count($ActAllocationDetail_map) < count($orderCommodity_map)){
|
|
|
+ foreach ($orderCommodity_map as $index=>$item) {
|
|
|
+ if(count($ActAllocationDetail_map) == 0)$ids[] =$item['id'];
|
|
|
+ array_shift($ActAllocationDetail_map);
|
|
|
+ unset($orderCommodity_map[$index]);
|
|
|
}
|
|
|
- } elseif(count($map)==count($orderCommodities_map[$key]))continue;
|
|
|
- unset($orderDetails_map[$key]);
|
|
|
- $map = null;
|
|
|
+ }
|
|
|
}
|
|
|
- return $inner_params;
|
|
|
+ return $ids;
|
|
|
}
|
|
|
- private function filterDeleteParams(&$orderDetails_map,&$orderCommodities_map)
|
|
|
+
|
|
|
+ public function getCreateParams(&$ActAllocationDetail_maps,&$orderCommodity_maps)
|
|
|
{
|
|
|
- $del_ids = [];
|
|
|
- if(count($orderDetails_map) == 0)return $del_ids;
|
|
|
- foreach ($orderCommodities_map as $key=>$map) {
|
|
|
- if(empty($orderDetails_map[$key])){
|
|
|
- foreach ($map as &$item) {
|
|
|
- $del_ids[] = $item['id'];
|
|
|
+ $params = [];
|
|
|
+ foreach ($ActAllocationDetail_maps as $key=>$actAllocationDetail_map) {
|
|
|
+ $orderCommodity_map = $orderCommodity_maps[$key] ?? null;
|
|
|
+ if($orderCommodity_map == null){
|
|
|
+ foreach ($actAllocationDetail_map as $index=>$actAllocationDetail) {
|
|
|
+ $params[] = $actAllocationDetail;
|
|
|
+ unset($actAllocationDetail_map[$key]);
|
|
|
}
|
|
|
- }elseif(count($map)>count($orderDetails_map[$key])){
|
|
|
- foreach ($map as $key1=>&$obj) {
|
|
|
- if(count($orderDetails_map[$key]) == 0){
|
|
|
- $del_ids [] = $obj['id'];
|
|
|
- unset($map[$key1]);
|
|
|
- } else{
|
|
|
- array_shift($orderDetails_map[$key]);
|
|
|
- }
|
|
|
+ continue;
|
|
|
+ }elseif(count($actAllocationDetail_map) == count($orderCommodity_map)){
|
|
|
+ continue;
|
|
|
+ }elseif(count($actAllocationDetail_map) > count($orderCommodity_map)){
|
|
|
+ foreach ($actAllocationDetail_map as $index=>$item) {
|
|
|
+ if(count($orderCommodity_map) == 0)$params[] = $item;
|
|
|
+ array_shift($orderCommodity_map);
|
|
|
+ unset($actAllocationDetail_map[$key]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return $del_ids;
|
|
|
+ return $params;
|
|
|
}
|
|
|
|
|
|
- private function createByInnerParams(&$inner_params,&$orders_map,&$commodities_maps,&$owner_id_maps)
|
|
|
+ public function getInnerParamsByParams(&$create_params,&$order_code_map,&$commodity_map)
|
|
|
{
|
|
|
- $created_params = [];
|
|
|
- if(count($inner_params) == 0)return $created_params;
|
|
|
- $data = Carbon::now();
|
|
|
- foreach ($inner_params as &$item) {
|
|
|
- $order = $orders_map[$item['code']] ?? false;
|
|
|
- if(!$order)continue;
|
|
|
- $owner_code = $owner_id_maps[$item['owner_id']];
|
|
|
- $key = "owner_code_{$owner_code}_sku_{$item['sku']}";
|
|
|
- $commodity = $commodities_maps[$key];
|
|
|
- $created_params[] = [
|
|
|
- 'order_id' =>$order['id'],
|
|
|
- 'commodity_id' =>$commodity['id'],
|
|
|
- 'amount' =>$item['amount'],
|
|
|
- 'location' =>$item['location'],
|
|
|
- 'created_at' =>$data,
|
|
|
- 'updated_at' => $data
|
|
|
+ /** @var DataHandlerService $dataHandlerService */
|
|
|
+ $dataHandlerService = app(DataHandlerService::class);
|
|
|
+ $inner_params = [];
|
|
|
+ $date = (string) Carbon::now();
|
|
|
+ foreach ($create_params as $item) {
|
|
|
+ $order = $dataHandlerService->getKeyValue(['code'=>$item['code']],$order_code_map);
|
|
|
+ $key = "_owner_code_{$item['owner_code']}_sku_{$item['sku']}";
|
|
|
+ $commodity = $commodity_map[$key] ?? null;
|
|
|
+ $inner_params[] = [
|
|
|
+ 'order_id' => $order['id'] ?? '',
|
|
|
+ 'commodity_id' => $commodity['id'] ?? '',
|
|
|
+ 'amount' => $item['amount'],
|
|
|
+ 'location' => $item['location'],
|
|
|
+ 'created_at' => $date,
|
|
|
+ 'updated_at' => $date
|
|
|
];
|
|
|
}
|
|
|
- return $created_params;
|
|
|
+ return $inner_params;
|
|
|
}
|
|
|
|
|
|
- public function batchDelete($orderCommodities)
|
|
|
+ // TODO 更新后续添加进更新逻辑
|
|
|
+ public function getUpdateParamsByParamsAndDeleteIds(&$inner_params,&$ids)
|
|
|
{
|
|
|
- if(count($orderCommodities) == 0)return true;
|
|
|
- try {
|
|
|
- $bool = OrderCommodity::destroy(data_get($orderCommodities, '*.id'));
|
|
|
- if($bool)app('LogService')->log(__METHOD__,__FUNCTION__,'批量删除 OrderCommodities'.' || '.count($orderCommodities).' || '.json_encode($orderCommodities));
|
|
|
- else app('LogService')->log(__METHOD__,__FUNCTION__,'批量删除 OrderCommodities FAULT'.' || '.count($orderCommodities).' || '.json_encode($orderCommodities).' || ');
|
|
|
- return $bool;
|
|
|
- } catch (\Exception $e) {
|
|
|
- app('LogService')->log(__METHOD__,__FUNCTION__,'批量删除 OrderCommodities ERROR'.' || '.count($orderCommodities).' || '.json_encode($orderCommodities).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function insert($innerParams){
|
|
|
- if(!$innerParams)return false;
|
|
|
- if(count($innerParams)==0)return false;
|
|
|
- try {
|
|
|
- $bool = OrderCommodity::query()->insert($innerParams);
|
|
|
- if ($bool) app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities SUCCESS' . ' || ' . count($innerParams) . ' || ' . json_encode($innerParams));
|
|
|
- else app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities FAULT' . ' || ' . count($innerParams) . ' || ' . json_encode($innerParams));
|
|
|
- return $bool;
|
|
|
- } catch (\Exception $e) {
|
|
|
- app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities ERROR'. ' || ' . count($innerParams) . ' || ' . json_encode($innerParams).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
|
|
|
- return false;
|
|
|
+ $update_params = [['id','order_id', 'commodity_id', 'amount', 'location', 'created_at', 'updated_at']];
|
|
|
+ if(count($inner_params)==0)return $update_params;
|
|
|
+ $date = (string)Carbon::now();
|
|
|
+ foreach ($inner_params as $key=>$inner_param) {
|
|
|
+ if(count($ids)==0)break;
|
|
|
+ $inner_param['id'] = array_shift($ids);
|
|
|
+ $inner_param['updated_at'] = $date;
|
|
|
+ $inner_param['created_at'] = $date;
|
|
|
+ $update_params[] = $inner_param;
|
|
|
+ unset($inner_params[$key]);
|
|
|
}
|
|
|
+ return $update_params;
|
|
|
}
|
|
|
}
|
|
|
|