| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace console\controllers;
- use biz\ghs\classes\GhsClass;
- use biz\shop\classes\ShopClass;
- use bizGhs\custom\classes\CustomClass;
- use bizGhs\order\classes\OrderClass;
- use bizGhs\order\models\Order;
- use yii\console\Controller;
- use Yii;
- class ShopController extends Controller
- {
- public function actionOrder()
- {
- $query = new \yii\db\Query();
- $query->from(Order::tableName());
- $query->where(['>', 'id', 0]);
- foreach ($query->batch() as $orderList) {
- foreach ($orderList as $order) {
- $payTime = $order['payTime'] ?? '';
- if (!empty($payTime) && $payTime != '0000-00-00 00:00:00') {
- $addTime = $order['addTime'] ?? '';
- if ($payTime > $addTime) {
- echo "id:{$order['id']} {$payTime} {$addTime}\n";
- }
- }
- }
- }
- }
- public function actionCustom()
- {
- $custom = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
- if (empty($custom)) {
- echo '空';
- return false;
- }
- foreach ($custom as $item) {
- $shopId = $item->shopId ?? 0;
- $shop = ShopClass::getById($shopId, true);
- if ($shop->mainId != $item->mainId) {
- echo "客户id:{$item->id} {$shop->mainId} {$item->mainId}\n";
- if (!empty($shop->mainId)) {
- $item->mainId = $shop->mainId;
- $item->save();
- }
- }
- $ownShopId = $item->ownShopId ?? 0;
- $ownShop = ShopClass::getById($ownShopId, true);
- if ($ownShop->mainId != $item->ownMainId) {
- echo "客户own {$item->id} {$item->ownMainId} {$ownShop->mainId}\n";
- if (!empty($ownShop->mainId)) {
- $item->ownMainId = $ownShop->mainId;
- $item->save();
- }
- }
- }
- }
- public function actionGhs()
- {
- $ghs = GhsClass::getAllByCondition(['id>' => 0], null, '*', null, true);
- if (empty($ghs)) {
- echo '空';
- return false;
- }
- foreach ($ghs as $item) {
- $shopId = $item->shopId ?? 0;
- $mainId = $item->mainId ?? 0;
- $shop = ShopClass::getById($shopId, true);
- if ($shop->mainId != $mainId) {
- echo "ghs {$item->id} {$mainId} {$shop->mainId} \n";
- }
- $ownShopId = $item->ownShopId ?? 0;
- $ownMainId = $item->ownMainId ?? 0;
- $ownShop = ShopClass::getById($ownShopId, true);
- if ($ownShop->mainId != $ownMainId) {
- echo "ghs own {$item->id} {$ownMainId} {$ownShop->mainId} \n";
- if (!empty($ownShop->mainId)) {
- $item->ownMainId = $ownShop->mainId;
- $item->save();
- }
- }
- }
- }
- }
|