|
@@ -4,6 +4,7 @@ namespace App\Service;
|
|
|
|
|
|
|
|
|
use App\Jobs\OperationLog;
|
|
|
+use App\Model\Depart;
|
|
|
use App\Model\Employee;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
@@ -402,6 +403,28 @@ class Service
|
|
|
return $user['depart_select']['depart_id'];
|
|
|
}
|
|
|
|
|
|
+ public function getMyTopDepart($user){
|
|
|
+ if(empty($user)) return 0;
|
|
|
+ //当前门店
|
|
|
+ $current_top_depart_id = $user['depart_top'][0] ?? [];
|
|
|
+ $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
|
|
|
+
|
|
|
+ return $current_top_depart_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function returnOrderEditErrorCommon($current_top_depart_id, $order_top_depart_id){
|
|
|
+ if($current_top_depart_id != $order_top_depart_id){
|
|
|
+ $depart_map = Depart::whereIn('id', [$current_top_depart_id, $order_top_depart_id])
|
|
|
+ ->pluck('title', 'id')
|
|
|
+ ->toArray();
|
|
|
+ $current_top_depart_title = $depart_map[$current_top_depart_id] ?? "";
|
|
|
+ $order_top_depart_title = $depart_map[$order_top_depart_id] ?? "";
|
|
|
+ return [false, "单据所属门店:" . $order_top_depart_title . ",当前所在门店:" . $current_top_depart_title . ",操作失败"];
|
|
|
+ }
|
|
|
+
|
|
|
+ return [true, ''];
|
|
|
+ }
|
|
|
+
|
|
|
public function getTopId($id, $data) {
|
|
|
foreach ($data as $item) {
|
|
|
if ($item['id'] == $id) {
|