فهرست منبع

去掉老的会员充值方法

shish 1 سال پیش
والد
کامیت
3f288028ef
2فایلهای تغییر یافته به همراه0 افزوده شده و 215 حذف شده
  1. 0 124
      app-hd/controllers/UserController.php
  2. 0 91
      common/services/xhRechargeService.php

+ 0 - 124
app-hd/controllers/UserController.php

@@ -128,130 +128,6 @@ class UserController extends BaseController
         util::complete();
         util::complete();
     }
     }
 
 
-    //充值 ssh 2019.12.1
-    public function actionRecharge()
-    {
-        util::fail('此功能已停用');
-        $post = Yii::$app->request->post();
-        $payPassword = isset($post['payPassword']) ? $post['payPassword'] : '';
-        AdminService::verifyPayPassword($this->adminId, $payPassword);
-
-        $userId = isset($post['userId']) ? $post['userId'] : 0;
-        $rechargeAmount = isset($post['rechargeAmount']) ? $post['rechargeAmount'] : 1;
-        $user = UserService::getById($userId);
-        if (empty($user)) {
-            util::fail('找不到客户');
-        }
-        if ($user['sjId'] != $this->sjId) {
-            util::fail('您无法操作');
-        }
-        $userAsset = UserAssetService::getByUserId($userId);
-        $totalBalance = $userAsset['balance'] + $rechargeAmount;
-        $totalRecharge = $userAsset['totalRecharge'] + $rechargeAmount;
-        $upData['balance'] = $totalBalance;
-        $upData['totalRecharge'] = $totalRecharge;
-        $merchantAsset = MerchantAssetService::getBySjId($this->sjId);
-        $return = xhRechargeService::recharge($rechargeAmount, $user, $this->adminId, $this->sj->attributes, $this->sjExtend->attributes, $merchantAsset);
-        if ($return['code'] == 'A0001') {
-            util::complete();
-        }
-        util::fail();
-    }
-
-    //升级 ssh 2019.12.1
-    public function actionUpgrade()
-    {
-        util::fail('此功能已停用');
-        $post = Yii::$app->request->post();
-        $userId = isset($post['userId']) ? $post['userId'] : 0;
-        $member = isset($post['member']) ? $post['member'] : 0;
-        $user = UserService::getById($userId);
-        if (empty($user)) {
-            util::fail('客户不存在');
-        }
-        //验证是否商家客户
-        UserService::valid($user, $this->sjId);
-        //验证确认密码
-        $payPassword = $post['payPassword'];
-        AdminService::verifyPayPassword($this->adminId, $payPassword);
-
-        $grade = xhMerchantExtendService::getGradeList($this->sjExtend->attributes, 'desc');
-        //升级后的成长值
-        $newLevelGrowth = $grade[$member]['growth'];
-        $newDiscount = $grade[$member]['discount'];
-        $userAsset = UserAssetService::getByUserId($userId);
-        if ($userAsset['member'] >= $member) {
-            util::fail('客户已经达到此级别了');
-        }
-
-        $now = time();
-        $date = date("Y-m-d H:i", $now);
-
-        $connection = Yii::$app->db;
-        $transaction = $connection->beginTransaction();
-        try {
-
-            $addGrowth = $newLevelGrowth - $userAsset['growth'];
-            $upData['growth'] = $newLevelGrowth;
-            $upData['member'] = $member;
-            $upData['discount'] = $newDiscount;
-            UserAssetService::updateByUserId($userId, $upData);
-            UserService::updateById($userId, ['member' => $member]);
-
-            $upgradeData = [
-                'member' => $member,
-                'prevMember' => $userAsset['member'],
-                'sjId' => $this->sjId,
-                'gainType' => 0,
-                'addTime' => $now,
-                'userId' => $userId,
-            ];
-            $upgradeRespond = UserUpgradeService::add($upgradeData);
-
-            $growthData = [
-                'userId' => $userId,
-                'userName' => $user['userName'],
-                'sjId' => $this->sjId,
-                'relateId' => $upgradeRespond['id'],
-                'growth' => $newLevelGrowth,
-                'num' => $addGrowth,
-                'io' => 1,
-                'payWay' => 4,
-                'alipayId' => '',
-                'event' => '管理员操作升到' . $member . '级增加成长值',
-                'operatorId' => $userId,
-                'createTime' => $date,
-                'gainType' => 0,
-                'addTime' => $now,
-            ];
-            UserGrowthService::add($growthData);
-            $transaction->commit();
-        } catch (Exception $e) {
-            $transaction->rollBack();
-            util::fail();
-        }
-        $allTM = xhTMessageService::getList($this->sjId);
-        $openId = isset($user['openId']) ? $user['openId'] : '';
-        if (empty($openId)) {
-            util::complete();
-        }
-        $shortTempId = 'OPENTM205211943';//升级通知
-        if (isset($allTM[$shortTempId]) == false) {
-            util::complete();
-        }
-        $tempId = $allTM[$shortTempId];
-        $data = [
-            "touser" => $openId, "template_id" => $tempId, "url" => '',
-            "data" => [
-                "first" => ["value" => "恭喜,您已经升为{$member}级会员。", "color" => "#173177"],
-                "keyword1" => ["value" => $user['userName'], "color" => "#173177"],
-                "keyword2" => ["value" => $date, "color" => "#173177"],
-                "remark" => ["value" => "点击查看会员权益", "color" => "#173177"],
-            ]];
-        wxUtil::sendTaskInform($data, $this->sj);
-        util::complete();
-    }
-
     //重置客户密码
     //重置客户密码
     public function actionResetPayPassword()
     public function actionResetPayPassword()
     {
     {

+ 0 - 91
common/services/xhRechargeService.php

@@ -134,97 +134,6 @@ class xhRechargeService
         }
         }
     }
     }
 
 
-    public static function recharge($rechargeAmount, $user, $adminId, $merchant, $merchantExtend, $merchantAsset)
-    {
-        $connection = Yii::$app->db;
-        $transaction = $connection->beginTransaction();
-        try {
-            $sjId = $merchant['id'];
-            $userId = $user['id'];
-            $payWay = 3;//现金方式
-            $payStyle = 1;
-            $now = time();
-            $date = date("Y-m-d H:i:s", $now);
-            //流水类型列表
-            $capitalType = dict::getDict('capitalType', 'xhRecharge', 'id');
-            $userAsset = xhUserAssetService::getByUserId($userId);
-            $gainGrowth = floor($rechargeAmount);//去掉小数点部分
-            $totalGrowth = stringUtil::calcAdd($userAsset['growth'], $gainGrowth);
-            $totalBalance = stringUtil::calcAdd($userAsset['balance'], $rechargeAmount);
-            $totalRecharge = stringUtil::calcAdd($userAsset['totalRecharge'], $rechargeAmount);
-            $merchantTotalRecharge = stringUtil::calcAdd($merchantAsset['totalRecharge'], $rechargeAmount);
 
 
-            $rechargeData = [
-                'payWay' => $payWay,
-                'payStyle' => $payStyle,
-                'sjId' => $sjId,
-                'userId' => $userId,
-                'userName' => $user['userName'],
-                'amount' => $rechargeAmount,
-                'balance' => $totalBalance,
-                'event' => "现金充值 {$rechargeAmount}元",
-                'addTime' => $now,
-                'userTotalRecharge' => $totalRecharge,
-                'merchantTotalRecharge' => $merchantTotalRecharge,
-                'status' => 1,
-            ];
-            $order = self::add($rechargeData);//用户充值记录增加
-
-            $upData['growth'] = $totalGrowth;
-            $upData['balance'] = $totalBalance;
-            $upData['totalRecharge'] = $totalRecharge;
-            xhUserAssetService::ioChangeAsset($user, $userAsset, $upData, $merchant, $merchantExtend, $order, $capitalType);//用户资产变化
-
-            //充值暂时算到默认门店
-            $shopId = ShopClass::getDefaultShopId($merchant);
-            $mPreDeal = $merchantAsset['totalDeal'];
-            $mDeal = $mPreDeal + 1;//交易量+1
-            $upMData = ['totalDeal' => $mDeal, 'totalRecharge' => $merchantTotalRecharge];
-            xhMerchantAssetService::incomeChangeAsset($merchant, $merchantAsset, $shopId, $upMData, $order, $capitalType, true);//商家资产变化
-
-            $integralData = [
-                'userId' => $userId,
-                'userName' => $user['userName'],
-                'sjId' => $sjId,
-                'relateId' => (string)$order['id'],
-                'integral' => $totalGrowth,
-                'num' => $gainGrowth,
-                'io' => 1,
-                'payWay' => $payWay,
-                'event' => "现金充值 {$rechargeAmount}元",
-                'operatorId' => $adminId,
-                'capitalType' => $capitalType,
-                'createTime' => $date,
-                'addTime' => $now,
-            ];
-            //xhUserIntegralService::add($integralData);//用户兑换型积分流水增加
-
-            $userCapitalData = [
-                'relateId' => (string)$order['id'],
-                'balance' => $totalBalance,
-                'totalIncome' => $userAsset['totalIncome'],
-                'totalExpend' => $userAsset['totalExpend'],
-                'amount' => $rechargeAmount,
-                'io' => 1,
-                'payWay' => $payWay,
-                'event' => "现金充值",
-                'sjId' => $sjId,
-                'userId' => $userId,
-                'userName' => $user['userName'],
-                'operateId' => $adminId,
-                'createTime' => $date,
-                'capitalType' => $capitalType,
-                'addTime' => time(),
-            ];
-            xhUserCapitalService::add($userCapitalData);//用户资金流水增加
-
-            $transaction->commit();
-            return ['code' => 'A0001', 'msg' => '充值成功', 'data' => []];
-        } catch (Exception $e) {
-            $transaction->rollBack();
-            return ['code' => 'A0002', 'msg' => '充值没有成功'];
-        }
-
-    }
 
 
 }
 }