|
@@ -0,0 +1,120 @@
|
|
|
+<?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\Db;
|
|
|
+
|
|
|
+class good extends Command
|
|
|
+{
|
|
|
+ private $db;
|
|
|
+ protected function configure()
|
|
|
+ { $this->setName('good')
|
|
|
+ ->setDescription('the good command');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function execute(Input $input, Output $output)
|
|
|
+ {
|
|
|
+ $this->db =Db::connect("mysql2");
|
|
|
+ $data = $this->Getdata();
|
|
|
+ foreach ($data as $value){
|
|
|
+ $isT=Db::table("good")->where("good_code","=",$value['good_code'])->find();
|
|
|
+ if($isT){
|
|
|
+ Db::table("good")->where($isT)->save($value);
|
|
|
+ }else{
|
|
|
+ Db::table("good")->save($value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function Getdata(){
|
|
|
+ $date = date("Y-m-d H:i:s",strtotime("-1 day"));
|
|
|
+ $sql="SELECT
|
|
|
+b.Date1618678149288 as 'createtime',
|
|
|
+b.ShortText1621438752474 as 'good_code',
|
|
|
+b.ShortText1615776172238 as 'item',
|
|
|
+b.text1615776332933 as 'good_name',
|
|
|
+b.ShortText1622973543024 as 'old_item',
|
|
|
+b.ShortText1618630964434 as 'tkcode',
|
|
|
+b.text1615776271768 as 'item_code',
|
|
|
+b.text1618981719029 as 'spucode',
|
|
|
+b.text1615776440661 as 'model',
|
|
|
+b.text1615776695388 as 'color',
|
|
|
+b.text1615776685415 as 'material',
|
|
|
+b.text1618677034797 as 'technology',
|
|
|
+b.ShortText1615776786473 as 'unit',
|
|
|
+b.text1618677035673 as 'good_type',
|
|
|
+b.text1619509430228 as 'specs',
|
|
|
+b.ShortText1618677119629 as 'is_main',
|
|
|
+b.ShortText1617875730953 as 'is_diff',
|
|
|
+b.Number1618677207590 as 'good_weight',
|
|
|
+b.Number1619054377997 as 'box_weight',
|
|
|
+b.ShortText1618677229373 as 'box_specs',
|
|
|
+b.text1618677251640 as 'box_size',
|
|
|
+b.text1618677252567 as 'pack_size',
|
|
|
+b.ShortText1618677280883 as 'bar_code',
|
|
|
+b.ShortText1618677293358 as 'good_addr',
|
|
|
+b.ShortText1618677303623 as 'fk_day',
|
|
|
+b.ShortText1618677324610 as 'supply_area',
|
|
|
+b.text1619517580239 as 'shipment',
|
|
|
+b.ShortText1615776990102 as 'gys_code',
|
|
|
+b.Number1618677463881 as 'min_num',
|
|
|
+b.number1619054436137 as 'order_minnum',
|
|
|
+b.Number1617867853654 as 'duration',
|
|
|
+b.Number1618677510201 as 'sampling_period',
|
|
|
+b.Number1618677523586 as 'sample_fee',
|
|
|
+b.number1615788597819 as 'cost_fee',
|
|
|
+b.number1617867867574 as 'logistics',
|
|
|
+b.number1615788674789 as 'logistics_fee',
|
|
|
+b.number1615788650916 as 'cert_fee',
|
|
|
+b.number1615788639684 as 'packing_fee',
|
|
|
+b.number1615788611295 as 'mark_fee',
|
|
|
+b.number1617875705335 as 'tech_fee',
|
|
|
+b.number1615788686735 as 'unit_price',
|
|
|
+b.ShortText1615454226082 as 'noble_metal',
|
|
|
+b.number1618677641446 as 'metal_weight',
|
|
|
+b.Number1616399256021 as 'market_fee',
|
|
|
+b.ShortText1616119282513 as 'wsm_nature',
|
|
|
+b.ShortText1619054472299 as 'is_step',
|
|
|
+b.ShortText1618677768792 as 'tax',
|
|
|
+b.Number1618677857395 as 'step_num_1',
|
|
|
+b.Number1619054496274 as 'step_post_1',
|
|
|
+b.Number1618677862829 as 'step_price_1',
|
|
|
+b.number1618677888101 as 'step_num_2',
|
|
|
+b.number1619054497412 as 'step_post_2',
|
|
|
+b.number1618677890766 as 'step_price_2',
|
|
|
+b.number1618677920417 as 'step_num_3',
|
|
|
+b.number1619054516068 as 'step_post_3',
|
|
|
+b.number1618677922828 as 'step_price_3',
|
|
|
+b.number1618677997457 as 'sale_1',
|
|
|
+b.number1618677998335 as 'sale_2',
|
|
|
+b.number1618678013601 as 'sale_3',
|
|
|
+b.number1618964483608 as 'sale_other',
|
|
|
+(SELECT
|
|
|
+ b_.`name`
|
|
|
+ FROM
|
|
|
+ h_org_user b_
|
|
|
+ WHERE b_.id = JSON_EXTRACT (
|
|
|
+ b.StaffSelector1616205980618,
|
|
|
+ '$[0].id'
|
|
|
+ )) as 'cg_saler',
|
|
|
+b.ShortText1618678061783 as 'is_online',
|
|
|
+b.ShortText1618678132819 as 'fund',
|
|
|
+b.ShortText1615802884401 as 'brand',
|
|
|
+b.ShortText1615776612618 as 'sort_f',
|
|
|
+b.text1615776646788 as 'sort_s',
|
|
|
+b.ShortText1618558317611 as 'sort_t',
|
|
|
+b.ShortText1616222832962 as 'supplier',
|
|
|
+b.ShortText1631180192195 as 'change',
|
|
|
+b.modifiedTime as 'updatetime'
|
|
|
+ from ibt0b_SPXX b where modifiedTime>='{$date}'";
|
|
|
+ $result = $this->db->query($sql);
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+}
|