|
|
@@ -7,16 +7,62 @@
|
|
|
namespace console\controllers;
|
|
|
|
|
|
use biz\item\classes\PtItemClass;
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
+use bizGhs\custom\classes\CustomClass;
|
|
|
+use bizGhs\ghs\classes\GhsClass;
|
|
|
use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use common\services\xhItemService;
|
|
|
use yii\console\Controller;
|
|
|
+
|
|
|
class GhsInitController extends Controller
|
|
|
{
|
|
|
|
|
|
- public function actionInit()
|
|
|
+ public function actionChangePtStyle()
|
|
|
{
|
|
|
+ ini_set('memory_limit', '2045M');
|
|
|
+ set_time_limit(0);
|
|
|
+
|
|
|
+ $shopList = ShopClass::getAllByCondition(['id>' => 0], null, '*', 'id');
|
|
|
+ $ghsList = GhsClass::getAllByCondition(['id>' => 0], null, '*', null, true);
|
|
|
+ if (!empty($ghsList)) {
|
|
|
+ foreach ($ghsList as $ghs) {
|
|
|
+ $ownShopId = $ghs->ownShopId ?? 0;
|
|
|
+ if (isset($shopList[$ownShopId]) == false) {
|
|
|
+ echo "没有找到供货商门店\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $shop = $shopList[$ownShopId];
|
|
|
+ $ptStyle = $shop['ptStyle'] ?? 0;
|
|
|
+ if (empty($ptStyle)) {
|
|
|
+ echo "没有找到ptStyle \n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $ghs->ownPtStyle = $ptStyle;
|
|
|
+ $ghs->save();
|
|
|
+ echo "ok \n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
|
|
|
+ if (!empty($customList)) {
|
|
|
+ foreach ($customList as $custom) {
|
|
|
+ $ownShopId = $custom->ownShopId ?? 0;
|
|
|
+ if (isset($shopList[$ownShopId]) == false) {
|
|
|
+ echo "没有找到客户门店\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $shop = $shopList[$ownShopId];
|
|
|
+ $ptStyle = $shop['ptStyle'] ?? 0;
|
|
|
+ if (empty($ptStyle)) {
|
|
|
+ echo "没有找到ptStyle \n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $custom->ownPtStyle = $ptStyle;
|
|
|
+ $custom->save();
|
|
|
+ echo "ok \n";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//清空某个商户的product
|
|
|
@@ -26,20 +72,20 @@ class GhsInitController extends Controller
|
|
|
|
|
|
public function actionPtUnit()
|
|
|
{
|
|
|
- $res = ProductClass::getAllList("*","");
|
|
|
- foreach ($res as $v){
|
|
|
+ $res = ProductClass::getAllList("*", "");
|
|
|
+ foreach ($res as $v) {
|
|
|
$id = $v['id'];
|
|
|
$obigU = $v['bigUnit'];
|
|
|
$oSmallU = $v['smallUnit'];
|
|
|
$bigUname = xhItemService::getUnitName($obigU);
|
|
|
$smallUName = xhItemService::getUnitName($oSmallU);
|
|
|
$data = [
|
|
|
- 'bigUnitId'=>$obigU,
|
|
|
- 'smallUnitId'=>$oSmallU,
|
|
|
- 'bigUnit'=>$bigUname,
|
|
|
- 'smallUnit'=>$smallUName,
|
|
|
+ 'bigUnitId' => $obigU,
|
|
|
+ 'smallUnitId' => $oSmallU,
|
|
|
+ 'bigUnit' => $bigUname,
|
|
|
+ 'smallUnit' => $smallUName,
|
|
|
];
|
|
|
- ProductClass::updateById($id,$data);
|
|
|
+ ProductClass::updateById($id, $data);
|
|
|
}
|
|
|
echo "done";
|
|
|
}
|