|
|
@@ -38,6 +38,35 @@ use yii\console\Controller;
|
|
|
class TestController extends Controller
|
|
|
{
|
|
|
|
|
|
+ public function actionCustomBuyAmount()
|
|
|
+ {
|
|
|
+ ini_set('memory_limit', '2045M');
|
|
|
+ set_time_limit(0);
|
|
|
+ $mainId = 50;
|
|
|
+ $customList = \bizGhs\custom\classes\CustomClass::getAllByCondition(['ownMainId' => $mainId], null, '*', null, true);
|
|
|
+ if (!empty($customList)) {
|
|
|
+ foreach ($customList as $custom) {
|
|
|
+ $customId = $custom->id ?? 0;
|
|
|
+ $ghsId = $custom->ghsId ?? 0;
|
|
|
+ $ghs = \biz\ghs\classes\GhsClass::getById($ghsId, true);
|
|
|
+ if (empty($ghs)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $orderList = \bizGhs\order\classes\OrderClass::getAllByCondition(['customId' => $customId], null, 'id, actPrice');
|
|
|
+ $buyAmount = 0;
|
|
|
+ if (!empty($orderList)) {
|
|
|
+ foreach ($orderList as $order) {
|
|
|
+ $buyAmount = bcadd($buyAmount, $order['actPrice'], 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $custom->buyAmount = $buyAmount;
|
|
|
+ $custom->save();
|
|
|
+ $ghs->expendAmount = $buyAmount;
|
|
|
+ $ghs->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function actionShop()
|
|
|
{
|
|
|
$sql = "select id,shopName,`merchantName` ,ptStyle,mobile from xhShop where ptstyle = 4 and mobile not like '10000%'";
|