|
|
@@ -13,6 +13,7 @@ use bizHd\merchant\classes\SjClass;
|
|
|
use bizHd\merchant\services\ShopService;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use bizHd\saas\services\RegionService;
|
|
|
+use bizHd\shop\classes\ShopExtClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\dirUtil;
|
|
|
use common\components\imgUtil;
|
|
|
@@ -533,4 +534,48 @@ class ShopController extends BaseController
|
|
|
}
|
|
|
util::fail('头像参数出错');
|
|
|
}
|
|
|
+
|
|
|
+ //获取充值设置
|
|
|
+ public function actionGetRechargeSetting()
|
|
|
+ {
|
|
|
+ $shopId = $this->shop->id;
|
|
|
+ $shop = ShopClass::getById($shopId, false, 'rechargeWeal');
|
|
|
+ $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], false, false, 'reachVip');
|
|
|
+
|
|
|
+ $return = [
|
|
|
+ 'rechargeRule' => $shop['rechargeWeal'] == 3 ? 2 : $shop['rechargeWeal'],
|
|
|
+ 'isVipMember' => $shopExt['reachVip'] > 0 ? 1 : 0,
|
|
|
+ 'vipAmount' => $shopExt['reachVip'],
|
|
|
+ 'hbPayable' => $shop['rechargeWeal'] == 2 ? 1 : 0,
|
|
|
+ ];
|
|
|
+
|
|
|
+ util::success($return);
|
|
|
+ }
|
|
|
+
|
|
|
+ //充值设置
|
|
|
+ public function actionSaveRechargeSetting()
|
|
|
+ {
|
|
|
+ $data = Yii::$app->request->post();
|
|
|
+ $rechargeWeal = intval($data['rechargeRule']);
|
|
|
+ $isVipMember = intval($data['isVipMember']);
|
|
|
+ if ($isVipMember == 1 && $data['vipAmount'] > 0) {
|
|
|
+ $reachVip = floatval($data['vipAmount']);
|
|
|
+ } else {
|
|
|
+ $reachVip = 0.00;
|
|
|
+ }
|
|
|
+ $hbPayable = intval($data['hbPayable']);
|
|
|
+ if ($rechargeWeal == 2 && $hbPayable == 0) {
|
|
|
+ $rechargeWeal = 3;
|
|
|
+ }
|
|
|
+
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
+ util::fail('超管才能操作');
|
|
|
+ }
|
|
|
+ $shopId = $this->shop->id;
|
|
|
+ ShopClass::updateById($shopId, ['rechargeWeal' => $rechargeWeal]);
|
|
|
+ ShopExtClass::updateByCondition(['shopId' => $shopId], ['reachVip' => $reachVip]);
|
|
|
+
|
|
|
+ util::complete('充值设置成功');
|
|
|
+ }
|
|
|
}
|