| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace hd\controllers;
- use bizHd\custom\classes\CustomClass;
- use common\components\util;
- use Yii;
- class DeductController extends BaseController
- {
- public $guestAccess = [];
- //减少余额 ssh 20250329(这个方法应该建在CustomController的)
- public function actionDeductBalance()
- {
- $post = Yii::$app->request->post();
- $customId = $post['customId'] ?? 0;
- $custom = CustomClass::getByID($customId, true);
- if (empty($custom)) {
- util::fail('没有找到客户');
- }
- if ($custom->shopId != $this->shopId) {
- util::fail('不是你的客户');
- }
- $amount = $post['amount'] ?? 0;
- if (empty($amount)) {
- util::fail('请填写金额');
- }
- if ($amount < 0) {
- util::fail('金额要大于0');
- }
- util::complete('减少成功');
- }
- }
|