@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (App::$cur->users->config['invites']) { |
|
3 | +if (App::$cur->users->config['invites']) { |
|
4 | 4 | return [ |
5 | 5 | 'name' => 'Мои партнеры', |
6 | 6 | 'fullWidget' => 'Users\cabinet/usersTree' |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public $distinct = false; |
33 | 33 | |
34 | 34 | /** |
35 | - * @param $instance |
|
35 | + * @param $instance |
|
36 | 36 | */ |
37 | 37 | public function __construct($instance = null) { |
38 | 38 | if (!$instance) { |
@@ -16,34 +16,34 @@ discard block |
||
16 | 16 | 'type' => 'decimal' |
17 | 17 | ] |
18 | 18 | ], |
19 | - 'viewer' => function ($level) { |
|
19 | + 'viewer' => function ($level) { |
|
20 | 20 | $levelTypes = [ |
21 | 21 | 'procent' => 'Процент', |
22 | 22 | 'amount' => 'Сумма', |
23 | 23 | ]; |
24 | 24 | return $levelTypes[$level->params['type']->value] . ': ' . $level->params['amount']->value . ' ' . ($level->params['type']->value == 'procent' ? '%' : ($level->params['currency_id']->value ? \Money\Currency::get($level->params['currency_id']->value)->acronym() : '')); |
25 | 25 | }, |
26 | - 'rewarder' => function ($reward, $sums, $user, $rootUser, $level, $rewardGet) { |
|
26 | + 'rewarder' => function ($reward, $sums, $user, $rootUser, $level, $rewardGet) { |
|
27 | 27 | $wallets = \App::$cur->money->getUserWallets($user->id); |
28 | 28 | $amount = 0; |
29 | - if (!empty($wallets[$level->params['currency_id']->value])) { |
|
30 | - switch ($level->params['type']->value) { |
|
29 | + if (!empty($wallets[$level->params['currency_id']->value])) { |
|
30 | + switch ($level->params['type']->value) { |
|
31 | 31 | case 'procent': |
32 | 32 | $finalSum = 0; |
33 | - foreach ($sums as $currency_id => $sum) { |
|
34 | - if ($currency_id != $level->params['currency_id']->value) { |
|
33 | + foreach ($sums as $currency_id => $sum) { |
|
34 | + if ($currency_id != $level->params['currency_id']->value) { |
|
35 | 35 | $rate = \Money\Currency\ExchangeRate::get([ |
36 | 36 | ['currency_id', $currency_id], |
37 | 37 | ['target_currency_id', $level->params['currency_id']->value], |
38 | 38 | ]); |
39 | - if ($rate) { |
|
39 | + if ($rate) { |
|
40 | 40 | $finalSum += $sum * $rate->rate; |
41 | 41 | } |
42 | - } else { |
|
42 | + } else { |
|
43 | 43 | $finalSum += $sum; |
44 | 44 | } |
45 | 45 | } |
46 | - switch ($reward->round_type) { |
|
46 | + switch ($reward->round_type) { |
|
47 | 47 | case 'round': |
48 | 48 | $finalSum = round($finalSum, $reward->round_precision); |
49 | 49 | $amount = $finalSum / 100 * (float)$level->params['amount']->value; |
@@ -59,33 +59,33 @@ discard block |
||
59 | 59 | case 'amount': |
60 | 60 | $amount = (float)$level->params['amount']->value; |
61 | 61 | } |
62 | - if (!$amount) { |
|
62 | + if (!$amount) { |
|
63 | 63 | return 0; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $text = 'Вознаграждение по программе "' . $reward->name . '"'; |
67 | - if ($rootUser->id != $user->id) { |
|
67 | + if ($rootUser->id != $user->id) { |
|
68 | 68 | $text .= ' от ' . $rootUser->name(); |
69 | 69 | } |
70 | 70 | |
71 | - if (!$rewardGet && $reward->block) { |
|
71 | + if (!$rewardGet && $reward->block) { |
|
72 | 72 | $block = new \Money\Wallet\Block(); |
73 | 73 | $block->wallet_id = $wallets[$level->params['currency_id']->value]->id; |
74 | 74 | $block->amount = $amount; |
75 | 75 | $block->comment = $text; |
76 | 76 | $block->data = 'reward:' . $reward->id; |
77 | 77 | $dateGenerators = \App::$cur->money->getSnippets('expiredDateGenerator'); |
78 | - if ($reward->block_date_expired && !empty($dateGenerators[$reward->block_date_expired])) { |
|
78 | + if ($reward->block_date_expired && !empty($dateGenerators[$reward->block_date_expired])) { |
|
79 | 79 | $date = $dateGenerators[$reward->block_date_expired]($reward, $user); |
80 | - if (!empty($date['date'])) { |
|
80 | + if (!empty($date['date'])) { |
|
81 | 81 | $block->date_expired = $date['date']; |
82 | 82 | } |
83 | - if (!empty($date['type'])) { |
|
83 | + if (!empty($date['type'])) { |
|
84 | 84 | $block->expired_type = $date['type']; |
85 | 85 | } |
86 | 86 | } |
87 | 87 | $block->save(); |
88 | - } else { |
|
88 | + } else { |
|
89 | 89 | $wallets[$level->params['currency_id']->value]->diff($amount, $text); |
90 | 90 | } |
91 | 91 | \App::$cur->users->AddUserActivity($user->id, 4, $text . '<br />' . $amount . ' ' . $wallets[$level->params['currency_id']->value]->currency->acronym()); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'name' => 'Последняя покупка не позднее 90 дней', |
5 | - 'checker' => function ($user) { |
|
5 | + 'checker' => function ($user) { |
|
6 | 6 | $query = 'SELECT * FROM inji_ecommerce_cart iec WHERE iec.cart_cart_status_id >= 5 AND iec.cart_date_create >= NOW() - INTERVAL 90 DAY AND cart_user_id = ?'; |
7 | 7 | $result = \App::$cur->db->query(['query' => $query, 'params' => [$user->id]]); |
8 | 8 | return (bool)$result ? $result->fetch() : false; |
@@ -61,6 +61,10 @@ |
||
61 | 61 | Inji::$inst->unBlockParallel(); |
62 | 62 | } |
63 | 63 | |
64 | + /** |
|
65 | + * @param string $command |
|
66 | + * @param string $path |
|
67 | + */ |
|
64 | 68 | public static function command($command, $needOutput = true, $path = null) { |
65 | 69 | while (!Inji::$inst->blockParallel()) { |
66 | 70 | sleep(2); |
@@ -15,6 +15,9 @@ |
||
15 | 15 | |
16 | 16 | public $xml = null; |
17 | 17 | |
18 | + /** |
|
19 | + * @param \SimpleXMLElement $xml |
|
20 | + */ |
|
18 | 21 | public function __construct($xml) { |
19 | 22 | $this->xml = $xml; |
20 | 23 | } |
@@ -43,6 +43,10 @@ |
||
43 | 43 | return $modelCols; |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $colPrefix |
|
48 | + * @param string $tableName |
|
49 | + */ |
|
46 | 50 | public function parseColsForTable($cols, $colPrefix, $tableName) { |
47 | 51 | |
48 | 52 | $colsExist = App::$cur->db->getTableCols($tableName); |
@@ -23,6 +23,9 @@ |
||
23 | 23 | public $attributes = []; |
24 | 24 | public $indexCol = null; |
25 | 25 | |
26 | + /** |
|
27 | + * @param string[] $cols |
|
28 | + */ |
|
26 | 29 | public function setCols($cols) { |
27 | 30 | $this->cols = $cols; |
28 | 31 | } |
@@ -145,6 +145,9 @@ discard block |
||
145 | 145 | return $result[1]; |
146 | 146 | } |
147 | 147 | |
148 | + /** |
|
149 | + * @param string $source |
|
150 | + */ |
|
148 | 151 | public function parseSource($source) { |
149 | 152 | $tags = $this->parseRaw($source); |
150 | 153 | foreach ($tags as $rawTag) { |
@@ -190,6 +193,9 @@ discard block |
||
190 | 193 | return substr($source, ($pos + strlen($rawTag) + 2)); |
191 | 194 | } |
192 | 195 | |
196 | + /** |
|
197 | + * @param string $type |
|
198 | + */ |
|
193 | 199 | public function getHref($type, $params) { |
194 | 200 | $href = ''; |
195 | 201 | if (is_string($params)) { |
@@ -518,6 +524,9 @@ discard block |
||
518 | 524 | } |
519 | 525 | } |
520 | 526 | |
527 | + /** |
|
528 | + * @param string $type |
|
529 | + */ |
|
521 | 530 | public function customAsset($type, $asset, $lib = false) { |
522 | 531 | if (!$lib) { |
523 | 532 | $this->dynAssets[$type][] = $asset; |
@@ -540,6 +549,9 @@ discard block |
||
540 | 549 | } |
541 | 550 | } |
542 | 551 | |
552 | + /** |
|
553 | + * @param string $lineParams |
|
554 | + */ |
|
543 | 555 | public function widget($_widgetName, $_params = [], $lineParams = null) { |
544 | 556 | $_paths = $this->getWidgetPaths($_widgetName); |
545 | 557 | $find = false; |