PurchaseController.php 828 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace shop\controllers;
  3. use biz\purchase\classes\PurchaseClass;
  4. use bizGhs\product\classes\ProductClass;
  5. use common\components\orderSn;
  6. use Yii;
  7. use common\components\util;
  8. class PurchaseController extends BaseController
  9. {
  10. //生成采购单 shish 2021.1.17
  11. public function actionCreateOrder()
  12. {
  13. $post = Yii::$app->request->post();
  14. $ghsShopId = $post['ghsShopId'] ?? 0;
  15. $shopId = $this->shopId;
  16. $post['shopId'] = $shopId;
  17. $product = $post['product'] ?? '';
  18. $arr = json_decode($product, true);
  19. //判断product数据是不是同个供货商的
  20. $ids = array_column($arr, 'productId');
  21. ProductClass::valid($ids, $ghsShopId);
  22. $post['product'] = $arr;
  23. PurchaseClass::addPurchase($post);
  24. util::complete();
  25. }
  26. }