->asArray()
->all();
foreach ($result["analysts_business_operations"] as $operation) {
- if (!in_array($operation['guid'], array_keys($existingOperations))) {
+ if (!in_array($operation['id'], array_keys($existingOperations))) {
$newOperation = new AnalystsBusinessOperations();
- $newOperation->id = $operation['guid'];
+ $newOperation->id = $operation['id'];
$newOperation->name = $operation['name'];
$newOperation->type = (int)$operation['type'];
if (!in_array((int)$operation['type'], array_column($existingTypes, 'code'))) {
}
} else {
- if ($existingOperations[$operation['guid']]['type'] !== (int)$operation['type']) {
- $oldOperation = AnalystsBusinessOperations::findOne($operation['guid']);
+ if ($existingOperations[$operation['id']]['type'] !== (int)$operation['type']) {
+ $oldOperation = AnalystsBusinessOperations::findOne($operation['id']);
if (!in_array((int)$operation['type'], array_column($existingTypes, 'code'))) {
$newType = new AnalystsBusinessOperationsTypes();
$newType->code = (int)$operation['type'];
return 'ok';
}
+ //cron/one-c-cron-analysts
+ public function actionOneCCronAnalysts()
+ {
+ $req_id = time();
+
+ //Аналитика хозяйственных операций
+ $json_post = '{"request_id": "' . $req_id . '", "analysts_business_operations": true}';
+
+ $this->setApiCron($req_id, $json_post);
+
+ return 'ok';
+ }
+
// public function actionCreateResortings() {
//пересортица
// $req_id=time();