|
@@ -13,6 +13,7 @@ use app\api\model\CartModel;
|
|
|
use app\api\model\OrderModel;
|
|
|
use app\api\model\OrderProductModel;
|
|
|
use app\api\model\ProductModel;
|
|
|
+use app\api\model\StoreModel;
|
|
|
use app\api\model\UserModel;
|
|
|
use app\api\model\WriteOffModel;
|
|
|
use app\common\until\Until;
|
|
@@ -29,6 +30,7 @@ class OrderService {
|
|
|
|
|
|
|
|
|
public function payOrder($input) {
|
|
|
+ $payCode = (new StoreModel())->getPayCode($input['storeId']);
|
|
|
$this->time[] = 'start' . time();
|
|
|
$orderSn = Until::createSn();
|
|
|
$productInfo = (new ProductModel())::where(['id' => $input['productId']])->find();
|
|
@@ -102,7 +104,7 @@ class OrderService {
|
|
|
'mark' => '购买了' . $productInfo['product_name'],
|
|
|
'orderId' => $orderSn,
|
|
|
'username' => $userInfo['name'],
|
|
|
- 'payCode' => strtoupper($this->userName),
|
|
|
+ 'payCode' => strtoupper($payCode),
|
|
|
];
|
|
|
$this->time[] = 'leo-start' . time();
|
|
|
$wxOrderInfo = $this->createOrderForOther($otherData);
|
|
@@ -134,6 +136,7 @@ class OrderService {
|
|
|
$storeId = $info['store_id'];
|
|
|
$orderMoney += $info['num'] * $info['current_price'];
|
|
|
}
|
|
|
+ $payCode = (new StoreModel())->getPayCode($storeId);
|
|
|
$userInfo = (new UserModel())::where(['id' => Until::$userId])->find();
|
|
|
$userInfo = Until::modelToArray($userInfo);
|
|
|
if (empty($userInfo)) {
|
|
@@ -198,7 +201,7 @@ class OrderService {
|
|
|
'mark' => '购买了小食',
|
|
|
'orderId' => $orderSn,
|
|
|
'username' => $userInfo['name'],
|
|
|
- 'payCode' => strtoupper($this->userName),
|
|
|
+ 'payCode' => strtoupper($payCode),
|
|
|
];
|
|
|
$this->time[] = 'leo-start' . time();
|
|
|
$wxOrderInfo = $this->createOrderForOther($otherData);
|
|
@@ -220,6 +223,7 @@ class OrderService {
|
|
|
public function payAgain(int $orderId) {
|
|
|
$model = new OrderModel();
|
|
|
$info = $model::where(['id' => $orderId])->find();
|
|
|
+ $payCode = (new StoreModel())->getPayCode($info['store_id']);
|
|
|
// $productInfo = (new ProductModel())::where(['id' => $info['product_id']])->find();
|
|
|
if ($info['status'] === OrderModel::IS_PAY) {
|
|
|
throw new ApiException('订单已支付');
|
|
@@ -237,7 +241,7 @@ class OrderService {
|
|
|
'mark' => '购买了商品',
|
|
|
'orderId' => $paySn,
|
|
|
'username' => $userInfo['name'],
|
|
|
- 'payCode' => strtoupper($this->userName),
|
|
|
+ 'payCode' => strtoupper($payCode),
|
|
|
];
|
|
|
$wxOrderInfo = $this->createOrderForOther($otherData);
|
|
|
$order = [
|