|
|
@@ -3,90 +3,62 @@
|
|
|
namespace console\controllers;
|
|
|
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
-use bizHd\order\classes\OrderClass;
|
|
|
-use bizHd\order\models\Order;
|
|
|
-use common\components\util;
|
|
|
-use Yii;
|
|
|
+use bizHd\custom\classes\CustomClass;
|
|
|
+use bizHd\custom\classes\HdClass;
|
|
|
+use common\components\stringUtil;
|
|
|
use yii\console\Controller;
|
|
|
|
|
|
class InitController extends Controller
|
|
|
{
|
|
|
|
|
|
- //更新仅采购
|
|
|
- public function actionOnlyCg()
|
|
|
+ // ./yii init/hd
|
|
|
+ public function actionHd()
|
|
|
{
|
|
|
- $list = ShopClass::getAllByCondition(['ptStyle' => 2], null, '*', null, true);
|
|
|
- if (!empty($list)) {
|
|
|
- foreach ($list as $shop) {
|
|
|
- $lsShopId = $shop->lsShopId ?? 0;
|
|
|
- ShopClass::updateById($lsShopId, ['onlyCg' => 0]);
|
|
|
- $shop->onlyCg = 0;
|
|
|
- $shop->save();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function actionChange()
|
|
|
- {
|
|
|
- global $argv;
|
|
|
- $shopId = $argv[2] ?? 0;
|
|
|
- if (empty($shopId)) {
|
|
|
- util::stop('没有门店');
|
|
|
- }
|
|
|
- ini_set('memory_limit', '2045M');
|
|
|
- set_time_limit(0);
|
|
|
- $list = OrderClass::getAllByCondition(['shopId' => $shopId, 'fromType' => 3, 'reachDate>' => '2022-08-02'], null, '*', null, true);
|
|
|
- if (!empty($list)) {
|
|
|
- foreach ($list as $order) {
|
|
|
- $order->status = 2;
|
|
|
- if ($order->addTime < '2022-08-03 00:00:00' && $order->shopAdminId != 126651) {
|
|
|
- $order->status = 4;
|
|
|
- echo $order->id . "\n";
|
|
|
+ $customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
|
|
|
+ if (!empty($customList)) {
|
|
|
+ foreach ($customList as $custom) {
|
|
|
+ $hdId = $custom->hdId ?? 0;
|
|
|
+ if (!empty($hdId)) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- $order->save();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //供货商和花店历史订单和历史结账单 payStatus payTime更新
|
|
|
- // ./yii init/pay-status
|
|
|
- public function actionPayStatus()
|
|
|
- {
|
|
|
- ini_set('memory_limit', '2045M');
|
|
|
- set_time_limit(0);
|
|
|
-
|
|
|
- $sql = "UPDATE `xhOrder` SET `payStatus`=0;";
|
|
|
- Yii::$app->db->createCommand($sql)->execute();
|
|
|
- $sql = "UPDATE `xhGhsOrder` SET `payStatus`=0;";
|
|
|
- Yii::$app->db->createCommand($sql)->execute();
|
|
|
-
|
|
|
- $query = new \yii\db\Query();
|
|
|
- $query->from(Order::tableName());
|
|
|
- $query->where(['in', 'status', [2, 3, 4]]);
|
|
|
- $query->orderBy('deadline ASC');
|
|
|
- foreach ($query->batch() as $batchOrder) {
|
|
|
- foreach ($batchOrder as $hdOrder) {
|
|
|
- $addTime = $hdOrder['addTime'] ?? '';
|
|
|
- $id = $hdOrder['id'] ?? 0;
|
|
|
- OrderClass::updateById($id, ['payTime' => $addTime, 'payStatus' => 1]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $query = new \yii\db\Query();
|
|
|
- $query->from(\bizGhs\order\models\Order::tableName());
|
|
|
- $query->where(['in', 'status', [2, 3, 4]]);
|
|
|
- $query->orderBy('deadline ASC');
|
|
|
- foreach ($query->batch() as $batchOrder) {
|
|
|
- foreach ($batchOrder as $ghsOrder) {
|
|
|
- $addTime = $ghsOrder['addTime'] ?? '';
|
|
|
- $id = $ghsOrder['id'] ?? 0;
|
|
|
- \bizGhs\order\classes\OrderClass::updateById($id, ['payTime' => $addTime, 'payStatus' => 1]);
|
|
|
+ $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";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $sql = "UPDATE `xhClear` SET `payTime`=`addTime` where `status`=2;";
|
|
|
- Yii::$app->db->createCommand($sql)->execute();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|