|
|
@@ -4,6 +4,7 @@ namespace ghs\controllers;
|
|
|
|
|
|
use biz\item\classes\PtItemClass;
|
|
|
use biz\product\models\Product;
|
|
|
+use bizGhs\book\classes\BookItemClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\shop\classes\ShopAdminClass;
|
|
|
@@ -698,20 +699,25 @@ class ItemController extends BaseController
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
$beforeId = $get['beforeId'] ?? 0;
|
|
|
- $newId = $get['newId']??0;
|
|
|
- if(empty($beforeId) || empty($newId)){
|
|
|
+ $newId = $get['newId'] ?? 0;
|
|
|
+ if (empty($beforeId) || empty($newId)) {
|
|
|
util::fail('员工信息有问题');
|
|
|
}
|
|
|
- $new = ShopAdminClass::getById($newId,true);
|
|
|
- if(empty($new) || $new->mainId != $this->mainId){
|
|
|
+ $new = ShopAdminClass::getById($newId, true);
|
|
|
+ if (empty($new) || $new->mainId != $this->mainId) {
|
|
|
util::fail('错误的员工信息');
|
|
|
}
|
|
|
- $before = ShopAdminClass::getById($beforeId,true);
|
|
|
- if(empty($before) || $before->mainId != $this->mainId){
|
|
|
+ $before = ShopAdminClass::getById($beforeId, true);
|
|
|
+ if (empty($before) || $before->mainId != $this->mainId) {
|
|
|
util::fail('错误的员工信息2');
|
|
|
}
|
|
|
- $newName = $new->name??'';
|
|
|
- ItemClass::updateByCondition(['mainId'=>$this->mainId,'cgStaffId'=>$beforeId],['cgStaffId'=>$newId,'cgStaffName'=>$newName]);
|
|
|
+ $newName = $new->name ?? '';
|
|
|
+ ItemClass::updateByCondition(['mainId' => $this->mainId, 'cgStaffId' => $beforeId], ['cgStaffId' => $newId, 'cgStaffName' => $newName]);
|
|
|
+ $shop = $this->shop;
|
|
|
+ $bookSn = $shop->bookSn ?? 0;
|
|
|
+ if (!empty($bookSn)) {
|
|
|
+ BookItemClass::updateByCondition(['bookSn' => $bookSn, 'cgStaffId' => $beforeId], ['cgStaffId' => $newId, 'cgStaffName' => $newName]);
|
|
|
+ }
|
|
|
util::complete('修改成功');
|
|
|
}
|
|
|
|