|
|
@@ -7,6 +7,7 @@ use biz\item\classes\PtItemCatRelateClass;
|
|
|
use biz\item\classes\PtItemClass;
|
|
|
use biz\main\classes\MainClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
+use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
@@ -15,6 +16,57 @@ use yii\console\Controller;
|
|
|
class TestController extends Controller
|
|
|
{
|
|
|
|
|
|
+ //老油花材单位比修改 ssh 20240411
|
|
|
+ public function actionLy()
|
|
|
+ {
|
|
|
+ if (getenv('YII_ENV') == 'production') {
|
|
|
+ $mainId = 20528;
|
|
|
+ } else {
|
|
|
+ $mainId = 644;
|
|
|
+ }
|
|
|
+ $list = ItemClass::getAllByCondition(['mainId' => $mainId, 'delStatus' => 0], null, '*', null, true);
|
|
|
+ if (!empty($list)) {
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $name = $item->name ?? '';
|
|
|
+ $has = false;
|
|
|
+ if (strstr($name, '100支') != false) {
|
|
|
+ $ptItemId = $item->itemId ?? 0;
|
|
|
+ $ptItem = PtItemClass::getById($ptItemId, true);
|
|
|
+ if (!empty($ptItem)) {
|
|
|
+ $item->ratio = 100;
|
|
|
+ $item->smallUnit = '支';
|
|
|
+ $item->smallUnitId = 2;
|
|
|
+ $item->save();
|
|
|
+ $ptItem->ratio = 100;
|
|
|
+ $ptItem->smallUnit = '支';
|
|
|
+ $ptItem->smallUnitId = 2;
|
|
|
+ $ptItem->save();
|
|
|
+ $has = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strstr($name, '200支') != false) {
|
|
|
+ $ptItemId = $item->itemId ?? 0;
|
|
|
+ $ptItem = PtItemClass::getById($ptItemId, true);
|
|
|
+ if (!empty($ptItem)) {
|
|
|
+ $item->ratio = 200;
|
|
|
+ $item->smallUnit = '支';
|
|
|
+ $item->smallUnitId = 2;
|
|
|
+ $item->save();
|
|
|
+ $ptItem->ratio = 200;
|
|
|
+ $ptItem->smallUnit = '支';
|
|
|
+ $ptItem->smallUnitId = 2;
|
|
|
+ $ptItem->save();
|
|
|
+ $has = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($has) {
|
|
|
+ echo $name . "\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function actionItem()
|
|
|
{
|
|
|
$list = PtItemCatRelateClass::getAllByCondition(['id>' => 0], 'id asc', '*', null, true);
|