Commit 2d10c44d9ae520cce69211168e6b04aaa880f4fd
1 parent
7aaeda8e
temp commit - work with console controller and log settings
Showing
7 changed files
with
293 additions
and
9 deletions
Show diff stats
backend/controllers/ParserController.php
| ... | ... | @@ -299,7 +299,7 @@ class ParserController extends BaseController |
| 299 | 299 | } |
| 300 | 300 | } else { |
| 301 | 301 | // Yii::$app->log-> |
| 302 | - // не дошли до конца по этому остаки вернем в кеш | |
| 302 | + // не дошли до конца по этому остатки вернем в кеш | |
| 303 | 303 | Yii::$app->cache->set( 'files_to_parse',json_encode( $arr_id_files ) ); |
| 304 | 304 | } |
| 305 | 305 | } | ... | ... |
common/models/User.php
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This is the model class for table "w_accounts". | |
| 9 | + * | |
| 10 | + * @property integer $id | |
| 11 | + * @property integer $if_manager | |
| 12 | + * @property string $email | |
| 13 | + * @property string $pass | |
| 14 | + * @property integer $margin_id | |
| 15 | + * @property string $name | |
| 16 | + * @property string $phones | |
| 17 | + * @property integer $country | |
| 18 | + * @property integer $city | |
| 19 | + * @property string $address | |
| 20 | + * @property string $comment | |
| 21 | + * @property integer $rating | |
| 22 | + * @property string $dt | |
| 23 | + * @property integer $is_active | |
| 24 | + * @property integer $is_firm | |
| 25 | + * @property string $last_loginin | |
| 26 | + * @property string $firm_inn | |
| 27 | + * @property string $firm_bank | |
| 28 | + * @property double $balance | |
| 29 | + * @property integer $office_id | |
| 30 | + * @property integer $is_scribe | |
| 31 | + * @property integer $set_manager_id | |
| 32 | + * @property string $phones2 | |
| 33 | + * @property string $phones3 | |
| 34 | + * @property integer $car | |
| 35 | + * @property integer $mod | |
| 36 | + * @property string $snumb | |
| 37 | + * @property integer $deliveries | |
| 38 | + * @property integer $scode | |
| 39 | + * @property string $firm_ur_adr | |
| 40 | + * @property string $firm_fiz_adr | |
| 41 | + * @property string $firm_code_eg | |
| 42 | + * @property string $firm_rs | |
| 43 | + * @property string $firm_mfo | |
| 44 | + * @property string $firm_site | |
| 45 | + * @property string $company | |
| 46 | + */ | |
| 47 | +class WAccounts extends \yii\db\ActiveRecord | |
| 48 | +{ | |
| 49 | + /** | |
| 50 | + * @inheritdoc | |
| 51 | + */ | |
| 52 | + public static function tableName() | |
| 53 | + { | |
| 54 | + return 'w_accounts'; | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * @inheritdoc | |
| 59 | + */ | |
| 60 | + public function rules() | |
| 61 | + { | |
| 62 | + return [ | |
| 63 | + [['if_manager', 'margin_id', 'country', 'city', 'rating', 'dt', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], | |
| 64 | + [['email', 'pass', 'name', 'phones', 'comment', 'dt', 'set_manager_id'], 'required'], | |
| 65 | + [['comment'], 'string'], | |
| 66 | + [['balance'], 'number'], | |
| 67 | + [['email', 'name', 'firm_site'], 'string', 'max' => 150], | |
| 68 | + [['pass'], 'string', 'max' => 30], | |
| 69 | + [['phones', 'phones2', 'phones3'], 'string', 'max' => 50], | |
| 70 | + [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254], | |
| 71 | + [['last_loginin'], 'string', 'max' => 15], | |
| 72 | + [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255], | |
| 73 | + [['email'], 'unique'] | |
| 74 | + ]; | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * @inheritdoc | |
| 79 | + */ | |
| 80 | + public function attributeLabels() | |
| 81 | + { | |
| 82 | + return [ | |
| 83 | + 'id' => Yii::t('app', 'ID'), | |
| 84 | + 'if_manager' => Yii::t('app', 'If Manager'), | |
| 85 | + 'email' => Yii::t('app', 'Email'), | |
| 86 | + 'pass' => Yii::t('app', 'Pass'), | |
| 87 | + 'margin_id' => Yii::t('app', 'Margin ID'), | |
| 88 | + 'name' => Yii::t('app', 'Name'), | |
| 89 | + 'phones' => Yii::t('app', 'Phones'), | |
| 90 | + 'country' => Yii::t('app', 'Country'), | |
| 91 | + 'city' => Yii::t('app', 'City'), | |
| 92 | + 'address' => Yii::t('app', 'Address'), | |
| 93 | + 'comment' => Yii::t('app', 'Comment'), | |
| 94 | + 'rating' => Yii::t('app', 'Rating'), | |
| 95 | + 'dt' => Yii::t('app', 'Dt'), | |
| 96 | + 'is_active' => Yii::t('app', 'Is Active'), | |
| 97 | + 'is_firm' => Yii::t('app', 'Is Firm'), | |
| 98 | + 'last_loginin' => Yii::t('app', 'Last Loginin'), | |
| 99 | + 'firm_inn' => Yii::t('app', 'Firm Inn'), | |
| 100 | + 'firm_bank' => Yii::t('app', 'Firm Bank'), | |
| 101 | + 'balance' => Yii::t('app', 'Balance'), | |
| 102 | + 'office_id' => Yii::t('app', 'Office ID'), | |
| 103 | + 'is_scribe' => Yii::t('app', 'Is Scribe'), | |
| 104 | + 'set_manager_id' => Yii::t('app', 'Set Manager ID'), | |
| 105 | + 'phones2' => Yii::t('app', 'Phones2'), | |
| 106 | + 'phones3' => Yii::t('app', 'Phones3'), | |
| 107 | + 'car' => Yii::t('app', 'Car'), | |
| 108 | + 'mod' => Yii::t('app', 'Mod'), | |
| 109 | + 'snumb' => Yii::t('app', 'Snumb'), | |
| 110 | + 'deliveries' => Yii::t('app', 'Deliveries'), | |
| 111 | + 'scode' => Yii::t('app', 'Scode'), | |
| 112 | + 'firm_ur_adr' => Yii::t('app', 'Firm Ur Adr'), | |
| 113 | + 'firm_fiz_adr' => Yii::t('app', 'Firm Fiz Adr'), | |
| 114 | + 'firm_code_eg' => Yii::t('app', 'Firm Code Eg'), | |
| 115 | + 'firm_rs' => Yii::t('app', 'Firm Rs'), | |
| 116 | + 'firm_mfo' => Yii::t('app', 'Firm Mfo'), | |
| 117 | + 'firm_site' => Yii::t('app', 'Firm Site'), | |
| 118 | + 'company' => Yii::t('app', 'Company'), | |
| 119 | + ]; | |
| 120 | + } | |
| 121 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use yii\base\Model; | |
| 7 | +use yii\data\ActiveDataProvider; | |
| 8 | +use common\models\WAccounts; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * WAccountsSearch represents the model behind the search form about `common\models\WAccounts`. | |
| 12 | + */ | |
| 13 | +class WAccountsSearch extends WAccounts | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @inheritdoc | |
| 17 | + */ | |
| 18 | + public function rules() | |
| 19 | + { | |
| 20 | + return [ | |
| 21 | + [['id', 'if_manager', 'margin_id', 'country', 'city', 'rating', 'dt', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], | |
| 22 | + [['email', 'pass', 'name', 'phones', 'address', 'comment', 'last_loginin', 'firm_inn', 'firm_bank', 'phones2', 'phones3', 'snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'firm_site', 'company'], 'safe'], | |
| 23 | + [['balance'], 'number'], | |
| 24 | + ]; | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * @inheritdoc | |
| 29 | + */ | |
| 30 | + public function scenarios() | |
| 31 | + { | |
| 32 | + // bypass scenarios() implementation in the parent class | |
| 33 | + return Model::scenarios(); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * Creates data provider instance with search query applied | |
| 38 | + * | |
| 39 | + * @param array $params | |
| 40 | + * | |
| 41 | + * @return ActiveDataProvider | |
| 42 | + */ | |
| 43 | + public function search($params) | |
| 44 | + { | |
| 45 | + $query = WAccounts::find(); | |
| 46 | + | |
| 47 | + $dataProvider = new ActiveDataProvider([ | |
| 48 | + 'query' => $query, | |
| 49 | + ]); | |
| 50 | + | |
| 51 | + $this->load($params); | |
| 52 | + | |
| 53 | + if (!$this->validate()) { | |
| 54 | + // uncomment the following line if you do not want to return any records when validation fails | |
| 55 | + // $query->where('0=1'); | |
| 56 | + return $dataProvider; | |
| 57 | + } | |
| 58 | + | |
| 59 | + $query->andFilterWhere([ | |
| 60 | + 'id' => $this->id, | |
| 61 | + 'if_manager' => $this->if_manager, | |
| 62 | + 'margin_id' => $this->margin_id, | |
| 63 | + 'country' => $this->country, | |
| 64 | + 'city' => $this->city, | |
| 65 | + 'rating' => $this->rating, | |
| 66 | + 'dt' => $this->dt, | |
| 67 | + 'is_active' => $this->is_active, | |
| 68 | + 'is_firm' => $this->is_firm, | |
| 69 | + 'balance' => $this->balance, | |
| 70 | + 'office_id' => $this->office_id, | |
| 71 | + 'is_scribe' => $this->is_scribe, | |
| 72 | + 'set_manager_id' => $this->set_manager_id, | |
| 73 | + 'car' => $this->car, | |
| 74 | + 'mod' => $this->mod, | |
| 75 | + 'deliveries' => $this->deliveries, | |
| 76 | + 'scode' => $this->scode, | |
| 77 | + ]); | |
| 78 | + | |
| 79 | + $query->andFilterWhere(['like', 'email', $this->email]) | |
| 80 | + ->andFilterWhere(['like', 'pass', $this->pass]) | |
| 81 | + ->andFilterWhere(['like', 'name', $this->name]) | |
| 82 | + ->andFilterWhere(['like', 'phones', $this->phones]) | |
| 83 | + ->andFilterWhere(['like', 'address', $this->address]) | |
| 84 | + ->andFilterWhere(['like', 'comment', $this->comment]) | |
| 85 | + ->andFilterWhere(['like', 'last_loginin', $this->last_loginin]) | |
| 86 | + ->andFilterWhere(['like', 'firm_inn', $this->firm_inn]) | |
| 87 | + ->andFilterWhere(['like', 'firm_bank', $this->firm_bank]) | |
| 88 | + ->andFilterWhere(['like', 'phones2', $this->phones2]) | |
| 89 | + ->andFilterWhere(['like', 'phones3', $this->phones3]) | |
| 90 | + ->andFilterWhere(['like', 'snumb', $this->snumb]) | |
| 91 | + ->andFilterWhere(['like', 'firm_ur_adr', $this->firm_ur_adr]) | |
| 92 | + ->andFilterWhere(['like', 'firm_fiz_adr', $this->firm_fiz_adr]) | |
| 93 | + ->andFilterWhere(['like', 'firm_code_eg', $this->firm_code_eg]) | |
| 94 | + ->andFilterWhere(['like', 'firm_rs', $this->firm_rs]) | |
| 95 | + ->andFilterWhere(['like', 'firm_mfo', $this->firm_mfo]) | |
| 96 | + ->andFilterWhere(['like', 'firm_site', $this->firm_site]) | |
| 97 | + ->andFilterWhere(['like', 'company', $this->company]); | |
| 98 | + | |
| 99 | + return $dataProvider; | |
| 100 | + } | |
| 101 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This is the model class for table "w_dic_cities". | |
| 9 | + * | |
| 10 | + * @property integer $id | |
| 11 | + * @property string $name | |
| 12 | + * @property integer $is_active | |
| 13 | + * @property integer $parent | |
| 14 | + */ | |
| 15 | +class WDicCities extends \yii\db\ActiveRecord | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * @inheritdoc | |
| 19 | + */ | |
| 20 | + public static function tableName() | |
| 21 | + { | |
| 22 | + return 'w_dic_cities'; | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * @inheritdoc | |
| 27 | + */ | |
| 28 | + public function rules() | |
| 29 | + { | |
| 30 | + return [ | |
| 31 | + [['name', 'parent'], 'required'], | |
| 32 | + [['is_active', 'parent'], 'integer'], | |
| 33 | + [['name'], 'string', 'max' => 254], | |
| 34 | + [['parent', 'name'], 'unique', 'targetAttribute' => ['parent', 'name'], 'message' => 'The combination of Name and Parent has already been taken.'] | |
| 35 | + ]; | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * @inheritdoc | |
| 40 | + */ | |
| 41 | + public function attributeLabels() | |
| 42 | + { | |
| 43 | + return [ | |
| 44 | + 'id' => Yii::t('app', 'ID'), | |
| 45 | + 'name' => Yii::t('app', 'Name'), | |
| 46 | + 'is_active' => Yii::t('app', 'Is Active'), | |
| 47 | + 'parent' => Yii::t('app', 'Parent'), | |
| 48 | + ]; | |
| 49 | + } | |
| 50 | +} | ... | ... |
console/config/main.php
| ... | ... | @@ -18,8 +18,14 @@ return [ |
| 18 | 18 | 'class' => 'yii\log\FileTarget', |
| 19 | 19 | 'levels' => ['error', 'warning'], |
| 20 | 20 | ], |
| 21 | - ], | |
| 21 | + [ | |
| 22 | + 'class' => 'yii\log\FileTarget', | |
| 23 | + 'logFile' => 'C:\xampp\htdocs\ital\console\runtime\logs\parser.log', | |
| 24 | + 'levels' => ['info', 'error'], | |
| 25 | + // 'categories' => ['parser'], | |
| 26 | + ], | |
| 22 | 27 | ], |
| 23 | 28 | ], |
| 24 | 29 | 'params' => $params, |
| 30 | +] | |
| 25 | 31 | ]; | ... | ... |
console/controllers/ParserController.php
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Created by PhpStorm. | |
| 4 | - * User: Cibermag | |
| 5 | - * Date: 30.09.2015 | |
| 6 | - * Time: 14:38 | |
| 7 | - */ | |
| 2 | +namespace console\controllers; | |
| 3 | + | |
| 8 | 4 | use yii\console\Controller; |
| 9 | 5 | use yii\helpers\Console; |
| 10 | 6 | use common\components\PriceWriter; |
| ... | ... | @@ -61,4 +57,14 @@ class ParserController extends Controller{ |
| 61 | 57 | |
| 62 | 58 | return false; |
| 63 | 59 | } |
| 60 | + | |
| 61 | + public function actionTest () | |
| 62 | + { | |
| 63 | + // Console::output('It is working '); | |
| 64 | + \Yii::warning('1'); | |
| 65 | + \Yii::info('2'); | |
| 66 | +// \Yii::info('3'); | |
| 67 | +// \Yii::warning('4'); | |
| 68 | + | |
| 69 | + } | |
| 64 | 70 | } |
| 65 | 71 | \ No newline at end of file | ... | ... |