| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace console\controllers;
- use biz\shop\classes\ShopClass;
- use bizHd\custom\classes\CustomClass;
- use bizHd\custom\classes\HdClass;
- use common\components\stringUtil;
- use yii\console\Controller;
- class InitController extends Controller
- {
- // ./yii init/hd
- public function actionHd()
- {
- ini_set('memory_limit', '2045M');
- set_time_limit(0);
- $customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
- if (!empty($customList)) {
- foreach ($customList as $custom) {
- $hdId = $custom->hdId ?? 0;
- if (!empty($hdId)) {
- continue;
- }
- $shopId = $custom->shopId ?? 0;
- $shop = ShopClass::getById($shopId, true);
- if (empty($shop)) {
- echo "没有门店 \n";
- continue;
- }
- $userId = $custom->userId ?? 0;
- $shopName = $shop->shopName ?? '';
- $hdMobile = $shop->mobile ?? '';
- $sjId = $shop->sjId ?? 0;
- $sjName = $shop->merchantName ?? '';
- $hdName = $shop->default == 1 ? $sjName : $sjName . ' ' . $shopName;
- $hdPy = stringUtil::py($hdName);
- $customId = $custom->id ?? 0;
- $hdAvatar = $shop->avatar ?? '';
- $hdData = [
- 'shopId' => $shopId,
- 'userId' => $userId,
- 'name' => $hdName,
- 'sjId' => $sjId,
- 'customId' => $customId,
- 'avatar' => $hdAvatar,
- 'py' => $hdPy,
- 'mobile' => $hdMobile,
- 'province' => $shop->province ?? '',
- 'city' => $shop->city ?? '',
- 'dist' => $shop->dist ?? '',
- 'address' => $shop->address ?? '',
- 'floor' => $shop->floor ?? '',
- 'fullAddress' => $shop->fullAddress ?? '',
- 'showAddress' => $shop->showAddress ?? '',
- 'lat' => $shop->lat ?? '',
- 'long' => $shop->long ?? '',
- ];
- HdClass::addData($hdData);
- echo "OK\n";
- }
- }
- }
- }
|