|
|
@@ -4,6 +4,7 @@ namespace console\controllers;
|
|
|
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
+use biz\shop\models\Shop;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\order\classes\OrderClass;
|
|
|
use bizGhs\order\models\Order;
|
|
|
@@ -14,6 +15,31 @@ use Yii;
|
|
|
class ShopController extends Controller
|
|
|
{
|
|
|
|
|
|
+ public function actionHasGhs()
|
|
|
+ {
|
|
|
+ $query = new \yii\db\Query();
|
|
|
+ $query->from(Shop::tableName());
|
|
|
+ $query->where(['ptStyle' => 1]);
|
|
|
+ foreach ($query->batch() as $shopList) {
|
|
|
+ foreach ($shopList as $shop) {
|
|
|
+ $shopId = $shop['id'] ?? 0;
|
|
|
+ $where = ['ownShopId' => $shopId];
|
|
|
+ $count = GhsClass::getCount($where);
|
|
|
+ if ($count == 0) {
|
|
|
+ //无操作
|
|
|
+ } elseif ($count == 1) {
|
|
|
+ $ghs = GhsClass::getByCondition($where, true);
|
|
|
+ $ghsId = $ghs->id ?? 0;
|
|
|
+ if (!empty($ghsId)) {
|
|
|
+ ShopClass::updateById($shopId, ['uniGhsId' => $ghsId]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ShopClass::updateById($shopId, ['hasManyGhs' => 1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function actionOrder()
|
|
|
{
|
|
|
$query = new \yii\db\Query();
|