<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Http\Controllers\Admin;use App\Models\Dictionary;use App\Models\ProductArticleFromType;use App\Models\ProductMaterial;use App\Traits\Sms;use Illuminate\Http\Request;use App\Http\Controllers\Controller;use App\Models\ProductChannel;use App\Models\ProductCollectionName;use App\Models\ProductResource;use App\Models\ProductTrade;use App\Models\ProductType;use App\Models\ProductVideo;use App\Models\ProductWebsite;use App\Models\ProductZimeitiChannel;class DictionaryController extends Controller{use Sms;public function index(){return view('admin.dictionary.index');}public function data(){$res=Dictionary::all();$P2gAC0=array();$P2gAC0['code']=0;$P2gAC0['msg']='正在请求中...';$P2gAC0['count']=1;$P2gAC0['data']=$res;$data=$P2gAC0;return response()->json($data);}public function create(Request $request){$P2g0=new Dictionary();$dictionary=$P2g0;return view('admin.dictionary.create',compact('dictionary'));}public function store(Request $request){$data=$request->only(['function_name','field_name','slug']);if(Dictionary::create($data))goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:return redirect()->route('admin.dictionary')->with(['status'=>'添加成功']);goto P2gx1;P2gNextx2:return redirect()->back()->withErrors('添加失败');P2gx1:}public function sync(Request $request){$type=$request->type;$A_A_AAA="in_array";$P2gAC0=$A_A_AAA($type,['product_material','product_website','product_collection','product_type','product_channel','product_resource','product_video','product_trade','product_trade','product_zimeiti','product_from_type']);if($P2gAC0)goto P2gBodyx4;goto P2gNextx4;P2gBodyx4:$data=$this->syncDictionary(['type'=>$type]);$P2g0=$data['code']==200;if($P2g0)goto P2gBodyx6;goto P2gNextx6;P2gBodyx6:$res=$data['data']['data'];$P2gSwitchx7=$type;$P2g0=$P2gSwitchx7=='product_material';if($P2g0)goto P2gBodyx15;goto P2gNextx15;P2gBodyx15:goto P2gCasex8;goto P2gx14;P2gNextx15:P2gx14:$P2g0=$P2gSwitchx7=='product_website';if($P2g0)goto P2gBodyx13;goto P2gNextx13;P2gBodyx13:goto P2gCasex9;goto P2gx12;P2gNextx13:P2gx12:$P2g0=$P2gSwitchx7=='product_collection';if($P2g0)goto P2gBodyx11;goto P2gNextx11;P2gBodyx11:goto P2gCasexa;goto P2gxz;P2gNextx11:P2gxz:$P2g0=$P2gSwitchx7=='product_type';if($P2g0)goto P2gBodyxy;goto P2gNextxy;P2gBodyxy:goto P2gCasexb;goto P2gxx;P2gNextxy:P2gxx:$P2g0=$P2gSwitchx7=='product_channel';if($P2g0)goto P2gBodyxw;goto P2gNextxw;P2gBodyxw:goto P2gCasexc;goto P2gxv;P2gNextxw:P2gxv:$P2g0=$P2gSwitchx7=='product_resource';if($P2g0)goto P2gBodyxu;goto P2gNextxu;P2gBodyxu:goto P2gCasexd;goto P2gxt;P2gNextxu:P2gxt:$P2g0=$P2gSwitchx7=='product_video';if($P2g0)goto P2gBodyxs;goto P2gNextxs;P2gBodyxs:goto P2gCasexe;goto P2gxr;P2gNextxs:P2gxr:$P2g0=$P2gSwitchx7=='product_trade';if($P2g0)goto P2gBodyxq;goto P2gNextxq;P2gBodyxq:goto P2gCasexf;goto P2gxp;P2gNextxq:P2gxp:$P2g0=$P2gSwitchx7=='product_zimeiti';if($P2g0)goto P2gBodyxo;goto P2gNextxo;P2gBodyxo:goto P2gCasexg;goto P2gxn;P2gNextxo:P2gxn:$P2g0=$P2gSwitchx7=='product_from_type';if($P2g0)goto P2gBodyxm;goto P2gNextxm;P2gBodyxm:goto P2gCasexh;goto P2gxl;P2gNextxm:P2gxl:goto P2gDefaultAfterxi;$P2g0=!$P2gSwitchx7;if($P2g0)goto P2gBodyxk;goto P2gNextxk;P2gBodyxk:goto P2gDefaultxi;goto P2gxj;P2gNextxk:P2gxj:P2gDefaultAfterxi:goto P2gDefaultxi;goto P2gx7;P2gCasex8:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductMaterial::firstOrCreate($data);}goto P2gx7;P2gCasex9:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductWebsite::firstOrCreate($data);}goto P2gx7;P2gCasexa:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductCollectionName::firstOrCreate($data);}goto P2gx7;P2gCasexb:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$P2gAC0['tag']=$item['tag'];$data=$P2gAC0;ProductType::firstOrCreate($data);}goto P2gx7;P2gCasexc:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductChannel::firstOrCreate($data);}goto P2gx7;P2gCasexd:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductResource::firstOrCreate($data);}goto P2gx7;P2gCasexe:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductVideo::firstOrCreate($data);}goto P2gx7;P2gCasexf:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductTrade::firstOrCreate($data);}goto P2gx7;P2gCasexg:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductZimeitiChannel::firstOrCreate($data);}goto P2gx7;P2gCasexh:foreach($res as $item){$P2gAC0=array();$P2gAC0['name']=$item['name'];$data=$P2gAC0;ProductArticleFromType::firstOrCreate($data);}goto P2gx7;P2gDefaultxi:goto P2gx7;P2gx7:$this->set('info','更新成功');goto P2gx5;P2gNextx6:$this->set('code',1);$this->set('info','暂无数据');P2gx5:goto P2gx3;P2gNextx4:$this->set('code',1);P2gx3:return $this->ajaxResponse();}}
?>