Explorar o código

Merge branch 'master' of http://git.huaml.com/zhh/huahuibao

# Conflicts:
#	sql.sql
林琦海 %!s(int64=5) %!d(string=hai) anos
pai
achega
9f35b66a3b
Modificáronse 3 ficheiros con 153 adicións e 5 borrados
  1. 6 5
      app-hd/controllers/PurchaseController.php
  2. 116 0
      app-pt/controllers/CashController.php
  3. 31 0
      sql.sql

+ 6 - 5
app-hd/controllers/PurchaseController.php

@@ -96,7 +96,7 @@ class PurchaseController extends BaseController
             $transaction->rollBack();
             util::fail('支付失败');
         }
-        util::complete();
+        util::success($info->attributes);
     }
 
     //余额支付 ssh 2021.1.24
@@ -125,7 +125,7 @@ class PurchaseController extends BaseController
             $transaction->rollBack();
             util::fail('支付失败');
         }
-        util::complete();
+        util::success($info->attributes);
     }
 
     //采购记录 ssh 2021.1.24
@@ -183,14 +183,14 @@ class PurchaseController extends BaseController
         $post = Yii::$app->request->post();
         $couponId = $post['couponId'] ?? 0;
         $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
-        $order = PurchaseClass::getByCondition(['orderSn' => $orderSn]);
+        $order = PurchaseClass::getByCondition(['orderSn' => $orderSn],true);
         if (empty($order)) {
             util::fail('订单号无效');
         }
-        $id = $order['id'];
+        $id = $order->id;
 
         $name = $orderSn;
-        $totalFee = $order['actPrice'];
+        $totalFee = $order->actPrice;
 
         //强制使用小程序的miniOpenId
         $openId = $this->admin['miniOpenId'];
@@ -239,6 +239,7 @@ class PurchaseController extends BaseController
         $current = date("Y-m-d H:i:s");
         $updateData = ['deadline' => $current, 'changePrice' => 2];
         PurchaseClass::updateById($id, $updateData);
+        $newParams['id'] = $id;
         util::success($newParams);
     }
 

+ 116 - 0
app-pt/controllers/CashController.php

@@ -0,0 +1,116 @@
+<?php
+
+namespace pt\controllers;
+
+use biz\sj\classes\CashClass;
+use common\components\util;
+use Yii;
+
+class CashController extends BaseController
+{
+
+    //提现记录 shish 2021.5.17
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $status = $get['status'] ?? 0;
+        $where = [];
+        if (!empty($status)) {
+            $where['status'] = $status;
+        }
+        $list = CashClass::getCashList($where);
+        util::success($list);
+    }
+
+    //提现审核通过 shish 2021.5.17
+    public function actionCheck()
+    {
+        util::complete();
+//        $get = Yii::$app->request->get();
+//        $id = isset($get['id']) ? $get['id'] : 0;
+//        $cash = CashClass::getById($id, true);
+//        if ($cash['status'] == 2) {
+//            util::fail('已经完成转账,请不要重复请求!');
+//        }
+//        $cashAmount = isset($cash->amount) ? floatval($cash->amount) : 0;
+//        $sjId = isset($cash->sjId) ? $cash->sjId : 0;
+//        $admin = xhAdminToMerchantService::getAdminByMerchantId($sjId);
+//        $time = strtotime(date("Y-m-d"));
+//        $income = xhStatIncomeService::getByIds($sjId, $time);
+//        $amount = isset($income['amount']) ? $income['amount'] : 0;
+//        $merchantExtInfo = xhMerchantExtendService::getByMerchantId($sjId);//取支付宝帐号
+//
+//        $asset = xhMerchantAssetService::getByMerchantId($sjId);
+//
+//        if ($merchantExtInfo['alipayAccount'] == '') {
+//            util::fail('转账接收方的支付宝帐号为空');
+//        }
+//        if ($cashAmount == 0) {
+//            util::fail('转账金额为0');
+//        }
+//        $alipayWap = Yii::getAlias("@vendor/alipayWap");
+//        require_once($alipayWap . '/aop/AopClient.php');
+//        require_once($alipayWap . '/aop/request/AlipayFundTransToaccountTransferRequest.php');
+//        require_once($alipayWap . '/config.php');
+//
+//        $aop = new \AopClient();
+//        $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
+//        $aop->appId = $config['app_id'];
+//        $aop->rsaPrivateKey = $config['merchant_private_key'];
+//        $aop->alipayrsaPublicKey = $config['alipay_public_key'];
+//        $aop->apiVersion = '1.0';
+//        $aop->signType = 'RSA2';
+//        $aop->postCharset = 'UTF-8';
+//        $aop->format = 'json';
+//        $request = new \AlipayFundTransToaccountTransferRequest ();
+//        $request->setBizContent("{" .
+//            "\"out_biz_no\":\"" . $id . "\"," .
+//            "\"payee_type\":\"ALIPAY_LOGONID\"," .
+//            "\"payee_account\":\"" . $merchantExtInfo['alipayAccount'] . "\"," .
+//            "\"amount\":\"" . $cashAmount . "\"," .
+//            "\"payee_real_name\":\"" . $merchantExtInfo['alipayAccountName'] . "\"," .
+//            "\"payer_show_name\":\"厦门中花汇信息科技有限公司\"," .
+//            "\"remark\":\"提现申请\"" .
+//            "  }");
+//        $result = $aop->execute($request);
+//        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
+//        $resultCode = $result->$responseNode->code;
+//        $returnOrderId = $result->$responseNode->order_id;
+//        if (!empty($resultCode) && $resultCode == 10000) {
+//            xhDrawCashService::updateById($id, ['thirdSerialNumber' => $returnOrderId, 'status' => 1]);
+//            $remainAmount = stringUtil::calcSub($asset['freezeBalance'], $cashAmount);
+//            xhMerchantAssetService::updateByMerchantId($sjId, ['freezeBalance' => $remainAmount]);
+//            /*
+//            $openId = $admin['openId'];
+//            $openMerchant = xhWxOpenService::getMerchant();//取平台绑定的商家
+//            $openMerchantId = $openMerchant['id'];
+//            $allTM = xhTMessageService::getList($openMerchantId);
+//            $shortTempId = 'OPENTM201319876';
+//            if(isset($allTM[$shortTempId])){
+//            $tempId =  $allTM[$shortTempId];
+//            $data = [
+//                "touser" => $openId,
+//                "template_id" => $tempId,
+//                "url" => Yii::$app->params['adminUrl'] . '/draw-cash/list',
+//                "data" => [
+//                    "first" => ["value" => '已经完成结算。', "color" => "#173177"],
+//                    "keyword1" => ["value" => '当天', "color" => "#173177"],
+//                    "keyword2" => ["value" => $amount . '元', "color" => "#173177"],
+//                    "remark" => ["value" => "支付宝收入:{$cashAmount}元,已汇入您的帐户。\n点击查看结算记录", "color" => "#173177"]
+//                ]
+//            ];
+//            wxUtil::sendTaskInform($data, $openMerchant);
+//            }
+//            */
+//            xhCommonService::sendMobileMsg($admin['mobile'], "您申请的提现金额:{$cashAmount}元已经到帐,请注意查收。");
+//            util::complete();
+//        } else {
+//            $msg = $result->$responseNode->msg;
+//            $sub_code = $result->$responseNode->sub_code;
+//            $sub_msg = $result->$responseNode->sub_msg;
+//            Yii::info("转帐失败,原因:code:" . $resultCode . " msg:" . $msg . " sub_code:" . $sub_code . " sub_msg:" . $sub_msg);
+//        }
+//        util::fail('转账失败');
+    }
+
+}

+ 31 - 0
sql.sql

@@ -2527,6 +2527,37 @@ INSERT INTO xhSetMeal(id,`style`,`name`,price,num) VALUES(NULL,1,'基础版',198
 ALTER TABLE `xhSetMeal` RENAME TO `xhSet`;
 ALTER TABLE xhRenew MODIFY `status` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '1 待付款 2已付款';
 
+
+drop table if exists `xhShopYeChange`;
+CREATE TABLE if not exists `xhShopYeChange` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `relateId` int(11) NOT NULL DEFAULT '0' COMMENT '关联订单id',
+  `capitalType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '流水类型',
+  `amount` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '变动金额',
+  `balance` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '余额',
+  `txBalance` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '可提现余额',
+  `io` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型 0减少 1增加',
+  `payWay` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付方式',
+  `fromType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '来源 0门店 1商城 2朋友圈 3..',
+  `event` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '事项',
+  `sjId` int(11) NOT NULL DEFAULT '0' COMMENT '商家id',
+  `shopId` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
+  `remark` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '备注',
+  `addTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
+  `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+  PRIMARY KEY (`id`)
+) COMMENT='门店余额变化记录';
+ALTER TABLE xhShopYeChange MODIFY `balance` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '当前余额';
+ALTER TABLE xhShopYeChange MODIFY `txBalance` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '当前可提现余额';
+ALTER TABLE xhCash MODIFY `event` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '说明';
+ALTER TABLE xhCash ADD sjName VARCHAR(100) NOT NULL DEFAULT '' COMMENT '商家名称' AFTER `shopId`;
+ALTER TABLE xhCash ADD shopName VARCHAR(100) NOT NULL DEFAULT '' COMMENT '门店名称' AFTER `sjName`;
+ALTER TABLE xhCash ADD shopAdminId INT NOT NULL DEFAULT 0 COMMENT '申请提现的员工' AFTER `shopId`;
+
+
+
 --------linqh 2021.5.17
 ALTER TABLE `xhGhsStockRecord`
 ADD COLUMN `productId`  int(11) NOT NULL DEFAULT 0 AFTER `orderSn`;
+
+