123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?php
- declare (strict_types = 1);
- namespace app\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\input\Argument;
- use think\console\input\Option;
- use think\console\Output;
- use think\facade\Cache;
- use think\facade\Db;
- class datacopy extends Command
- {
- protected function configure()
- {
- // 指令配置
- $this->setName('datacopy')
- ->setDescription('the datacopy command');
- }
- protected function execute(Input $input, Output $output)
- {
- $redis = Cache::store('redis');
- $iscgd = $redis->get("data");
- if($iscgd==0){
- $redis->set("data",1,10800);
- }else{
- return;
- }
- for($i=0;$i<=1000;$i++){
- Db::startTrans();
- $data = $this->GetData();
- if (!empty($data)) {
- $result = false;
- $obj = json_decode($data['data'], true);
- if ($obj['appCode'] == "purchase") {
- $obj['StaffSelector1618885082387'] = isset($obj['StaffSelector1618885082387']['name']) ? $obj['StaffSelector1618885082387']['name'] : "";
- $obj['StaffSelector1620899427104'] = isset($obj['StaffSelector1620899427104']['name']) ? $obj['StaffSelector1620899427104']['name'] : "";
- $list = [
- "name" => $obj['name'],
- "createdTime" => $obj['createdTime'],
- "startTime" => $obj['startTime'],
- "finishTime" => $obj['finishTime'],
- "ownerName" => $obj['creater'],
- "department" => $obj['createdDeptId'],
- "sequenceNo" => $obj['sequenceNo'],
- "sequenceStatus" => $obj['sequenceStatus'],
- "ShortText1618270412964" => $obj['ShortText1618270412964'],
- "ShortText1618270466672" => $obj['ShortText1618270466672'],
- "number1618272663951" => $obj['number1618272663951'],
- "ShortText1618308753677" => $obj['ShortText1618308753677'],
- "ShortText1618315935182" => $obj['ShortText1618315935182'],
- "Date1618315953443" => $obj['Date1618315953443'],
- "Number1618316157066" => $obj['Number1618316157066'],
- "Number1618316171848" => $obj['Number1618316171848'],
- "ShortText1617866362204" => $obj['ShortText1617866362204'],
- "ShortText1617866360004" => $obj['ShortText1617866360004'],
- "ShortText1618239976714" => $obj['ShortText1618239976714'],
- "ShortText1617866364821" => $obj['ShortText1617866364821'],
- "ShortText1618239993162" => $obj['ShortText1618239993162'],
- "RelevanceForm1617860945268" => $obj['RelevanceForm1617860945268'],
- "ShortText1617861001482" => $obj['ShortText1617861001482'],
- "ShortText1617861966146" => $obj['ShortText1617861966146'],
- "ShortText1617865626160" => $obj['ShortText1617865626160'],
- "ShortText1617865633070" => $obj['ShortText1617865633070'],
- "ShortText1617865675342" => $obj['ShortText1617865675342'],
- "ShortText1617865678025" => $obj['ShortText1617865678025'],
- "ShortText1617865680605" => $obj['ShortText1617865680605'],
- "ShortText1617865683042" => $obj['ShortText1617865683042'],
- "text1618268357055" => $obj['text1618268357055'],
- "ShortText1617865685744" => $obj['ShortText1617865685744'],
- "Number1618240480148" => $obj['Number1618240480148'],
- "ShortText1618240134229" => $obj['ShortText1618240134229'],
- "Number1618240458074" => $obj['Number1618240458074'],
- "ShortText1617866158120" => $obj['ShortText1617866158120'],
- "Number1618240350696" => $obj['Number1618240350696'],
- "number1618240356104" => $obj['number1618240356104'],
- "ShortText1617865688485" => $obj['ShortText1617865688485'],
- "Number1617865804813" => $obj['Number1617865804813'],
- "Number1617865807879" => $obj['Number1617865807879'],
- "Number1617865810822" => $obj['Number1617865810822'],
- "Number1617865813284" => $obj['Number1617865813284'],
- "Number1617865816181" => $obj['Number1617865816181'],
- "number1618240204358" => $obj['number1618240204358'],
- "number1618240287778" => $obj['number1618240287778'],
- "Number1617865818517" => $obj['Number1617865818517'],
- "Number1617865824797" => $obj['Number1617865824797'],
- "ShortText1617866144054" => $obj['ShortText1617866144054'],
- "Number1618240600907" => $obj['Number1618240600907'],
- "Number1618240685904" => $obj['Number1618240685904'],
- "RelevanceForm1617861284547" => $obj['RelevanceForm1617861284547'],
- "ShortText1617861287265" => $obj['ShortText1617861287265'],
- "ShortText1617861449444" => $obj['ShortText1617861449444'],
- "ShortText1617861455145" => $obj['ShortText1617861455145'],
- "Date1617866234869" => $obj['Date1617866234869'],
- "Date1618324547052" => $obj['Date1618324547052'],
- "Number1618330470625" => $obj['Number1618330470625'],
- "Number1618330472961" => $obj['Number1618330472961'],
- "Number1618330541286" => $obj['Number1618330541286'],
- "Number1618330543270" => $obj['Number1618330543270'],
- "ShortText1618465932373" => $obj['ShortText1618465932373'],
- "number1618467257146" => $obj['number1618467257146'],
- "ShortText1618859161646" => $obj['ShortText1618859161646'],
- "Date1618859180209" => $obj['Date1618859180209'],
- "StaffSelector1618859194105" => $obj['StaffSelector1618859194105'],
- "ShortText1618859321070" => $obj['ShortText1618859321070']=='已发'? 3 :1,
- "StaffSelector1618885082387" => $obj['StaffSelector1618885082387'],
- "ShortText1618900704399" => $obj['ShortText1618900704399'],
- "Date1619009560712" => $obj['Date1619009560712'],
- "ShortText1619147112929" => $obj['ShortText1619147112929'],
- "ShortText1619164207953" => $obj['ShortText1619164207953'],
- "ShortText1619463188366" => $obj['ShortText1619463188366']=="已付"? 3 : 1,
- "ShortText1619463208482" => $obj['ShortText1619463208482']=="已回"? 3 : 1,
- "Date1619624209148" => $obj['Date1619624209148'],
- "ShortText1619624490635" => $obj['ShortText1619624490635'],
- "Number1619625470651" => $obj['Number1619625470651'],
- "Number1619625483510" => $obj['Number1619625483510'],
- "ShortText1619625566608" => $obj['ShortText1619625566608'],
- "Number1619632826654" => $obj['Number1619632826654'],
- "Number1619632830397" => $obj['Number1619632830397'],
- "RelevanceForm1620373842422" => $obj['RelevanceForm1620373842422'],
- "ShortText1620399144946" => $obj['ShortText1620399144946'],
- "ShortText1620753234895" => $obj['ShortText1620753234895'],
- "ShortText1620753237335" => $obj["ShortText1620753237335"],
- "StaffSelector1620899427104" => $obj["StaffSelector1620899427104"],
- ];
- $result = Db::name("cgd_info")->insert($list);
- }
- if ($obj['appCode'] == "kefuguanlibu") {
- $obj['StaffSelector1618445844046'] = isset($obj['StaffSelector1618445844046']['name']) ? $obj['StaffSelector1618445844046']['name'] : "";
- $obj['StaffSelector1619488013389'] = isset($obj['StaffSelector1619488013389']['name']) ? $obj['StaffSelector1619488013389']['name'] : "";
- $obj['StaffSelector1618445850209'] = isset($obj['StaffSelector1618445850209']['name']) ? $obj['StaffSelector1618445850209']['name'] : "";
- $list = [
- "name" => $obj['name'],
- "createdTime" => $obj['createdTime'],
- "startTime" => $obj['startTime'],
- "ownerName" => $obj['creater'],
- "departmentName" => $obj['createdDeptId'],
- "finishTime" => $obj['finishTime'],
- "sequenceNo" => $obj['sequenceNo'],
- "sequenceStatus" => $obj['sequenceStatus'],
- "Date1617081795606" => $obj['Date1617081795606'],
- "RelevanceForm1617022738190" => $obj['RelevanceForm1617022738190'],
- "ShortText1617081712980" => $obj['ShortText1617081712980'],
- "ShortText1617022967356" => $obj['ShortText1617022967356'],
- "ShortText1617023369580" => $obj['ShortText1617023369580'],
- "ShortText1617111725596" => $obj['ShortText1617111725596'],
- "ShortText1617365292699" => $obj['ShortText1617365292699'],
- "text1617499162303" => $obj['text1617499162303'],
- "ShortText1617365495029" => $obj['ShortText1617365495029'],
- "ShortText1617499192065" => $obj['ShortText1617499192065'],
- "ShortText1617499210157" => $obj['ShortText1617499210157'],
- "text1617365578699" => $obj['text1617365578699'],
- "text1617365594353" => $obj['text1617365594353'],
- "text1617365597522" => $obj['text1617365597522'],
- "text1617365646297" => $obj['text1617365646297'],
- "text1617365950353" => $obj['text1617365950353'],
- "ShortText1617366563255" => $obj['ShortText1617366563255'],
- "number1617366111666" => $obj['number1617366111666'],
- "number1617366110639" => $obj['number1617366110639'],
- "ShortText1617366186330" => $obj['ShortText1617366186330'],
- "ShortText1617367958909" => $obj['ShortText1617367958909'],
- "Number1617365688048" => $obj['Number1617365688048'],
- "Number1617366579767" => $obj['Number1617366579767'],
- "Number1617366626104" => $obj['Number1617366626104'],
- "ShortText1617650669915" => $obj['ShortText1617650669915'],
- "ShortText1617650701648" => $obj['ShortText1617650701648'],
- "ShortText1617670912205" => $obj['ShortText1617670912205'],
- "ShortText1617874567622" => $obj['ShortText1617874567622'],
- "Number1618248810624" => $obj['Number1618248810624'],
- "Number1618248813613" => $obj['Number1618248813613'],
- "Number1618249015661" => $obj['Number1618249015661'],
- "Number1618249019294" => $obj['Number1618249019294'],
- "Number1618249146997" => $obj['Number1618249146997'],
- "number1618249149738" => $obj['number1618249149738'],
- "Number1618249202608" => $obj['Number1618249202608'],
- "Number1618249205231" => $obj['Number1618249205231'],
- "number1618249258956" => $obj['number1618249258956'],
- "ShortText1618267589049" => $obj['ShortText1618267589049'],
- "StaffSelector1618445844046" => $obj['StaffSelector1618445844046'],
- "StaffSelector1618445850209" => $obj['StaffSelector1618445850209'],
- "ShortText1618446328311" => $obj['ShortText1618446328311'],
- "ShortText1618446949933" => $obj['ShortText1618446949933'],
- "ShortText1618446973813" => $obj['ShortText1618446973813'],
- "LongText1618446982973" => $obj['LongText1618446982973'],
- "Date1618447068290" => $obj['Date1618447068290'],
- "ShortText1618447165317" => $obj['ShortText1618447165317'],
- "ShortText1618559007040" => $obj['ShortText1618559007040'],
- "ShortText1618559043560" =>$obj['ShortText1618559043560']=="已回"? 3 : 1,
- "ShortText1618559274859" =>$obj['ShortText1618559274859']=="已开"? 3 : 1,
- "ShortText1618887148862" => $obj['ShortText1618887148862'],
- "ShortText1619146965777" => $obj['ShortText1619146965777'],
- "ShortText1619164078168" => $obj['ShortText1619164078168'],
- "Date1619401771986" => $obj['Date1619401771986'],
- "Date1619402124793" => $obj['Date1619402124793'],
- "Number1619403905454" => $obj['Number1619403905454'],
- "Number1619403908740" => $obj['Number1619403908740'],
- "ShortText1619413388848" => $obj['ShortText1619413388848'],
- "ShortText1619413394855" => $obj['ShortText1619413394855'],
- "ShortText1619413401534" => $obj['ShortText1619413401534'],
- "ShortText1619487657199" => $obj['ShortText1619487657199'],
- "StaffSelector1619488013389" => $obj['StaffSelector1619488013389'],
- "ShortText1619523689586" => $obj['ShortText1619523689586'],
- "ShortText1619523693355" => $obj['ShortText1619523693355'],
- "ShortText1619523892833" => $obj['ShortText1619523892833'],
- "Date1619542686640" => $obj['Date1619542686640'],
- "RelevanceForm1619542896677" => $obj['RelevanceForm1619542896677'],
- "ShortText1619542951283" => $obj['ShortText1619542951283'],
- "ShortText1619543001392" => $obj['ShortText1619543001392'],
- "ShortText1619610909619" => $obj['ShortText1619610909619'],
- "Date1619626098213" => $obj['Date1619626098213'],
- "ShortText1619626536464" => $obj['ShortText1619626536464'],
- "Number1619626656082" => $obj['Number1619626656082'],
- "Number1619626666450" => $obj['Number1619626666450'],
- "Number1619632062547" => $obj['Number1619632062547'],
- "ShortText1619743751825" => $obj['ShortText1619743751825'],
- "text1619743754479" => $obj['text1619743754479'],
- "text1619743755335" => $obj['text1619743755335'],
- "text1619743756377" => $obj['text1619743756377'],
- "Date1620370378620" => $obj['Date1620370378620'],
- "ShortText1620750298602" => $obj['ShortText1620750298602'],
- "ShortText1620750301301" => $obj['ShortText1620750301301'],
- "RelevanceForm1620750481892" => $obj['RelevanceForm1620750481892'],
- "Number1620751537737" => $obj['Number1620751537737'],
- "Date1620751562219" => $obj['Date1620751562219']
- ];
- $result = Db::name("qrd_info")->insert($list);
- }
- if ($result) {
- $l = Db::table("source_data")->where($data)->save(['status' => 0]);
- if ($l) {
- Db::commit();
- }
- }
- }
- Db::rollback();
- }
- $redis->set("data",0);
- $output->writeln('datacopy');
- }
- public function GetData(){
- $list = Db::table("source_data")->where("status","=",1)->lock(true)->find();
- return $list;
- }
- }
|