|
|
@@ -2,9 +2,6 @@
|
|
|
|
|
|
namespace console\controllers;
|
|
|
|
|
|
-use biz\shop\classes\ShopClass;
|
|
|
-use biz\stat\classes\StatRefundClass;
|
|
|
-use bizGhs\order\classes\RefundOrderClass;
|
|
|
use bizGhs\order\classes\RefundOrderItemClass;
|
|
|
use bizGhs\order\models\RefundOrder;
|
|
|
use bizHd\cg\classes\CgRefundClass;
|
|
|
@@ -59,39 +56,6 @@ class RefundController extends Controller
|
|
|
public function actionUpdate()
|
|
|
{
|
|
|
|
|
|
- $list = RefundOrderClass::getAllByCondition(['id>' => 0], 'id asc', '*', null, true);
|
|
|
- if (!empty($list)) {
|
|
|
- foreach ($list as $item) {
|
|
|
- $orderSn = $item->orderSn ?? '';
|
|
|
- $shopId = $item->shopId ?? 0;
|
|
|
- $addTime = $item->addTime ?? '';
|
|
|
-
|
|
|
- $connection = Yii::$app->db;
|
|
|
- $transaction = $connection->beginTransaction();
|
|
|
-
|
|
|
- $refundPrice = $item->refundPrice ?? 0;
|
|
|
-
|
|
|
- try {
|
|
|
-
|
|
|
- $shop = ShopClass::getLockById($shopId);
|
|
|
- if (empty($shop)) {
|
|
|
- echo '没有找到店铺 ' . $shopId . ' ' . $orderSn . "\n";
|
|
|
- continue;
|
|
|
- }
|
|
|
- $totalRefund = bcadd($refundPrice, $shop->totalRefund, 2);
|
|
|
- $shop->totalRefund = $totalRefund;
|
|
|
- $shop->save();
|
|
|
- $date = date("Ymd", strtotime($addTime));
|
|
|
- StatRefundClass::replace($shop, $payWay, $refundPrice, $date);
|
|
|
- $transaction->commit();
|
|
|
-
|
|
|
- } catch (\Exception $e) {
|
|
|
- $transaction->rollBack();
|
|
|
- $msg = $e->getMessage();
|
|
|
- echo "报错了:" . $msg . "\n";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
}
|