|
|
@@ -10,6 +10,7 @@ use bizGhs\custom\classes\CustomLevelClass;
|
|
|
use bizHd\stat\classes\StatVisitClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
|
+use common\components\stringUtil;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
@@ -24,18 +25,24 @@ class GhsController extends BaseController
|
|
|
'zs' => ['name' => '金店', 'num' => 0, 'amount' => 0, 'key' => 'zs'],
|
|
|
];
|
|
|
|
|
|
+ //添加虚拟的供货商 ssh 20230305
|
|
|
public function actionAddGhs()
|
|
|
{
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $name = $get['name'] ?? '';
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $name = $post['name'] ?? '';
|
|
|
if (empty($name)) {
|
|
|
util::fail('请填写名称');
|
|
|
}
|
|
|
+ if (stringUtil::getWordNum($name) > 8) {
|
|
|
+ util::fail('名称不能超过8个汉字');
|
|
|
+ }
|
|
|
$shopId = $this->shopId;
|
|
|
$has = GhsClass::getByCondition(['ownShopId' => $shopId, 'name' => $name], true);
|
|
|
- if (empty($has)) {
|
|
|
+ if (!empty($has)) {
|
|
|
util::fail($name . ' 已经存在了');
|
|
|
}
|
|
|
+ \bizHd\ghs\services\GhsService::addVirtualGhs($post, $this->shop);
|
|
|
+ util::complete();
|
|
|
}
|
|
|
|
|
|
//是否屏蔽 ssh 20230226
|