소스 검색

控制台收款

shish 6 년 전
부모
커밋
276312efec
2개의 변경된 파일53개의 추가작업 그리고 4개의 파일을 삭제
  1. 51 1
      app/business/controllers/OrderController.php
  2. 2 3
      common/services/xhMerchantAssetService.php

+ 51 - 1
app/business/controllers/OrderController.php

@@ -2,7 +2,11 @@
 
 namespace business\controllers;
 
+use biz\merchant\services\MerchantService;
 use biz\order\services\OrderService;
+use biz\user\services\UserService;
+use common\components\configDict;
+use common\services\xhPayToolService;
 use Yii;
 use common\components\util;
 use common\components\stringUtil;
@@ -50,7 +54,7 @@ class OrderController extends BaseController
 		OrderService::classify($id, $categoryId, $usageId);
 		util::ok();
 	}
-
+	
 	//更新配送单 shish 2019.12.17
 	public function actionUpdateSheet()
 	{
@@ -62,5 +66,51 @@ class OrderController extends BaseController
 		OrderService::updateSheet($order, $post);
 		util::ok('提交成功');
 	}
+	
+	//商家收款与发货 shish 2019.12.18
+	public function actionGathering()
+	{
+		$post = Yii::$app->request->post();
+		$price = isset($post['price']) && is_numeric($post['price']) ? $post['price'] : 0;
+		$payWay = isset($post['payWay']) && is_numeric($post['payWay']) ? $post['payWay'] : 0;
+		$userId = isset($post['userId']) ? $post['userId'] : 0;
+		$userInfo = UserService::getById($userId);
+		if (empty($userInfo) || $userInfo['merchantId'] != $this->merchantId) {
+			util::fail('您选择的客户无效');
+		}
+		if ($price <= 0) {
+			util::fail('请输入金额');
+		}
+		$post['prePrice'] = $price;
+		$post['actPrice'] = $price;
+		$post['payWay'] = $payWay;
+		$post['sourceType'] = 1;
+		$post['userId'] = $userId;
+		$post['goodsNum'] = 1;
+		$post['orderName'] = '商品';
+		$shopId = MerchantService::getDefaultShopId($this->merchant);
+		$post['shopId'] = $shopId;
+		$order = OrderService::addOrder($post);
+		$id = $order['id'];
+		$orderSn = $order['orderSn'];
+		
+		//流水类型列表
+		$capitalTypeList = configDict::getConfig('capitalType');
+		$capitalType = $capitalTypeList['xhOrder']['id'];
+		switch ($payWay) {
+			case 0:
+				xhPayToolService::weixinPay($orderSn, $price, $capitalType, 0);
+				break;
+			case 1:
+				xhPayToolService::alipay($orderSn, $price, $capitalType, 0, []);
+				break;
+			case 2:
+				xhPayToolService::balancePay($orderSn, $price, $capitalType, 0);
+				break;
+			default:
+				util::fail('无效支付方式');
+		}
+		util::success($order);
+	}
 
 }

+ 2 - 3
common/services/xhMerchantAssetService.php

@@ -62,7 +62,6 @@ class xhMerchantAssetService
 	public static function incomeChangeAsset($merchant, $merchantAsset, $updateData, $order, $capitalType)
 	{
 		$merchantId = $merchant['id'];
-		$admin = xhAdminToMerchantService::getAdminByMerchantId($merchantId);
 		$openMerchant = xhWxOpenService::getMerchant();
 		$openMerchantId = $openMerchant['id'];
 		$orderId = $order['id'];
@@ -233,7 +232,7 @@ class xhMerchantAssetService
 					return;
 				}
 				$merchantId = isset($draw['merchantId']) ? $draw['merchantId'] : 0;
-				$admin = xhAdminToMerchantService::getAdminByMerchantId($merchantId);
+				//$admin = xhAdminToMerchantService::getAdminByMerchantId($merchantId);
 				$time = strtotime(date("Y-m-d"));
 				$income = xhStatIncomeService::getByIds($merchantId, $time);
 				$amount = isset($income['amount']) ? $income['amount'] : 0;
@@ -331,7 +330,7 @@ class xhMerchantAssetService
 					}
 					weixinUtil::sendTaskInform($data, $openMerchant);
 					*/
-					xhCommonService::sendMobileMsg($admin['mobile'], "您的提现金额:{$drawAmount}元已经到帐,请注意查收。");
+					//xhCommonService::sendMobileMsg($admin['mobile'], "您的提现金额:{$drawAmount}元已经到帐,请注意查收。");
 				} else {
 					$msg = $result->$responseNode->msg;
 					$sub_code = $result->$responseNode->sub_code;