|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
+use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\live\classes\LiveOrderClass;
|
|
|
use bizGhs\live\classes\LiveOrderCustomClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
@@ -108,17 +109,47 @@ class LiveOrderController extends BaseController
|
|
|
public function actionGetDetail()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
- $id = $get['id']??0;
|
|
|
- $live = LiveOrderClass::getById($id,true);
|
|
|
- if(empty($live)){
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ $live = LiveOrderClass::getById($id, true);
|
|
|
+ if (empty($live)) {
|
|
|
util::fail('没有找到记录');
|
|
|
}
|
|
|
- if($live->mainId != $this->mainId){
|
|
|
+ if ($live->mainId != $this->mainId) {
|
|
|
util::fail('不是你的记录');
|
|
|
}
|
|
|
- $orderSn = $live->orderSn??'';
|
|
|
- $customList = LiveOrderCustomClass::getAllByCondition(['orderSn'=>$orderSn],null,'*');
|
|
|
- util::success(['customList'=>$customList,'info'=>$live]);
|
|
|
+ $orderSn = $live->orderSn ?? '';
|
|
|
+ $customList = LiveOrderCustomClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
+ util::success(['customList' => $customList, 'info' => $live]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加客户 ssh 20241005
|
|
|
+ public function actionAddCustom()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $id = $post['id'] ?? 0;
|
|
|
+ $customId = $post['customId'] ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ if (empty($custom)) {
|
|
|
+ util::fail('没有找到客户');
|
|
|
+ }
|
|
|
+ if ($custom->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的客户');
|
|
|
+ }
|
|
|
+ $num = $post['num'] ?? 0;
|
|
|
+ $price = $post['price'] ?? 0;
|
|
|
+ $live = LiveOrderClass::getById($id, true);
|
|
|
+ if (empty($live)) {
|
|
|
+ util::fail('没有找到记录');
|
|
|
+ }
|
|
|
+ if ($live->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的记录');
|
|
|
+ }
|
|
|
+ if ($live->switchOrder == 1) {
|
|
|
+ util::fail('已转订单,不能添加');
|
|
|
+ }
|
|
|
+ $params = ['num' => $num, 'price' => $price];
|
|
|
+ LiveOrderClass::addCustom($params, $custom, $live);
|
|
|
+ util::complete('添加成功');
|
|
|
}
|
|
|
|
|
|
}
|