|
|
@@ -9,12 +9,71 @@ use biz\shop\classes\ShopClass;
|
|
|
use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\item\models\Item;
|
|
|
use common\components\stringUtil;
|
|
|
+use common\components\util;
|
|
|
use yii\console\Controller;
|
|
|
use Yii;
|
|
|
|
|
|
class ProductController extends Controller
|
|
|
{
|
|
|
|
|
|
+ //复制花材 ssh 20240422
|
|
|
+ public function actionClone()
|
|
|
+ {
|
|
|
+ if (getenv('YII_ENV') == 'production') {
|
|
|
+ $shopId = 0;
|
|
|
+ } else {
|
|
|
+ $shopId = 36523;
|
|
|
+ }
|
|
|
+ $shop = ShopClass::getById($shopId, true);
|
|
|
+ if (empty($shop)) {
|
|
|
+ util::stop();
|
|
|
+ }
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $productList = ProductClass::getAllByCondition(['mainId' => $mainId, 'classId' => 3180], null, '*');
|
|
|
+ if (!empty($productList)) {
|
|
|
+ foreach ($productList as $post) {
|
|
|
+ //复制标识
|
|
|
+ $post['copy'] = 1;
|
|
|
+ //去除无用的字段
|
|
|
+ unset($post['viewNum']);
|
|
|
+ unset($post['actualSold']);
|
|
|
+ unset($post['itemId']);
|
|
|
+ unset($post['id']);
|
|
|
+ unset($post['delStatus']);
|
|
|
+
|
|
|
+ $a = $post;
|
|
|
+ $a['name'] = $a['name'] . ' A级';
|
|
|
+ $a['py'] = stringUtil::py($a['name']);
|
|
|
+ \bizGhs\product\classes\ProductClass::addProduct($a, $shop);
|
|
|
+
|
|
|
+ $b = $post;
|
|
|
+ $b['name'] = $b['name'] . ' B级';
|
|
|
+ $b['py'] = stringUtil::py($b['name']);
|
|
|
+ \bizGhs\product\classes\ProductClass::addProduct($b, $shop);
|
|
|
+
|
|
|
+ $ab = $post;
|
|
|
+ $ab['name'] = $ab['name'] . ' AB级';
|
|
|
+ $ab['py'] = stringUtil::py($ab['name']);
|
|
|
+ \bizGhs\product\classes\ProductClass::addProduct($ab, $shop);
|
|
|
+
|
|
|
+ $c = $post;
|
|
|
+ $c['name'] = $c['name'] . ' C级';
|
|
|
+ $c['py'] = stringUtil::py($c['name']);
|
|
|
+ \bizGhs\product\classes\ProductClass::addProduct($c, $shop);
|
|
|
+
|
|
|
+ $d = $post;
|
|
|
+ $d['name'] = $d['name'] . ' D级';
|
|
|
+ $d['py'] = stringUtil::py($d['name']);
|
|
|
+ \bizGhs\product\classes\ProductClass::addProduct($d, $shop);
|
|
|
+
|
|
|
+ $e = $post;
|
|
|
+ $e['name'] = $e['name'] . ' E级';
|
|
|
+ $e['py'] = stringUtil::py($e['name']);
|
|
|
+ \bizGhs\product\classes\ProductClass::addProduct($e, $shop);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function actionChangeSk()
|
|
|
{
|
|
|
ini_set('memory_limit', '2045M');
|