<?php namespace myresto\controllers;use Yii;use yii\web\Controller;use myresto\models\ImportModifier;use myresto\models\SyncConfig;class ImportModifierController extends Controller{public function actionIndex(){$model=new ImportModifier();$tipe_tabel=$model::$tipe_tabel;$conn=SyncConfig::getConnection();$config=SyncConfig::find()->where(['type_con'=>'resto'])->one();$access_token=$config->api_key;if(isset($_POST['jenis_sinkron'])){$jenis_sinkron=$_POST['jenis_sinkron'];}else{$jenis_sinkron='';}$idHeaderLog=$_POST['idHeaderLog'];$result=$model->ambilData("import",$tipe_tabel,$idHeaderLog);if($result!=NULL){$response=$model->kirimData($result,$access_token,"POST");$simpan=$model->simpanStatus($response,$tipe_tabel,$idHeaderLog,$jenis_sinkron,$result,$access_token);$echo=$simpan;}else{$result=$model->ambilData("reimport",$tipe_tabel,$idHeaderLog);if($result!=NULL){$response=$model->kirimData($result,$access_token,"POST");$simpan=$model->simpanStatus($response,$tipe_tabel,$idHeaderLog,$jenis_sinkron,$result,$access_token);$echo=$simpan;}else{mysqli_query($conn,"UPDATE sync_data SET is_sync = '0' WHERE id_jurnal = '0' AND tipe_tabel = '$tipe_tabel'");$echo="mod";}}return $echo;}}