| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace ghs\controllers;
- use biz\merchant\services\MerchantExtendService;
- use bizGhs\admin\classes\AdminClass;
- use bizGhs\custom\classes\CustomClass;
- use bizGhs\merchant\services\ShopService;
- use bizGhs\order\classes\OrderClass;
- use bizGhs\order\services\OrderService;
- use biz\saas\services\RegionService;
- use biz\user\services\UserService;
- use bizGhs\product\classes\ProductClass;
- use common\components\configDict;
- use common\components\httpUtil;
- use common\services\xhPayToolService;
- use Yii;
- use common\components\util;
- use common\components\stringUtil;
- class OrderController extends BaseController
- {
- public $withoutLogin = ['order-relate', 'fast-pay'];
- //商城下单操作 shish 2021.1.14
- public function actionCreateOrder()
- {
- $post = Yii::$app->request->post();
- $adminId = $this->adminId;
- $shopId = $this->shopId;
- if (!empty($shopId)) {
- //供货商端 员工 开单
- $post['customId'] = $post['customId'] ?? 0;
- $post['adminId'] = $adminId;
- $post['userId'] = 0;
- } else {
- //供货商端 客户 开单
- $post['userId'] = $adminId;
- $post['adminId'] = 0;
- $post['customId'] = CustomClass::addCustom();
- }
- $post['payWay'] = $this->isWx == true ? 0 : 1;
- $post['merchantId'] = $this->merchantId;
- $post['shopId'] = 0;
- $post['deadline'] = time() + 1800;//订单30分钟后过期
- $post['fromType'] = 1;//商城
- $post['prePrice'] = 0.01;
- $post['actPrice'] = 0.01;
- $post['sendSide'] = $post['sendSide'] ?? 0;
- $productJson = $post['product'] ?? '';
- if (empty($productJson)) {
- util::fail('请选择花材');
- }
- $productList = json_decode($productJson, true);
- if (empty($productList)) {
- util::fail('请选择花材');
- }
- $productIds = array_column($productList, 'productId');
- ProductClass::valid($productIds, $this->merchantId);
- $post['product'] = $productList;
- $order = OrderClass::addOrder($post);
- $orderSn = $order['orderSn'] ?? '';
- $orderId = $order['id'] ?? 0;
- util::success([
- 'orderId' => $orderId,
- 'orderSn' => $orderSn,
- 'totalPrice' => 0.01,
- 'sendType' => '快递送',
- 'sendTime' => '15:00',
- 'qrCode' => Yii::$app->params['imgHost'] . '/hhb_small.png',
- ]);
- }
- //延期支付 shish 2021.1.19
- public function actionDebt()
- {
- $get = Yii::$app->request->get();
- $orderId = $get['orderId'] ?? 0;
- util::complete();
- }
- }
|