|
@@ -64,4 +64,76 @@ class DeleteService extends Service
|
|
|
SalesOrderInfo::insert($insert);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function fp($data,$user){
|
|
|
+ if(empty($data['id']) || empty($data['type']) || empty($data['man'])) return [false, '必填参数不能为空!'];
|
|
|
+
|
|
|
+ try {
|
|
|
+ DB::beginTransaction();
|
|
|
+ if($data['type'] == 1){
|
|
|
+ $this->fpSaleOrderMan($data);
|
|
|
+ }
|
|
|
+ DB::commit();
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ DB::rollBack();
|
|
|
+ return [false,$exception->getMessage()];
|
|
|
+ }
|
|
|
+
|
|
|
+ return [true,''];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function fpSaleOrderMan($data){
|
|
|
+ $time = time();
|
|
|
+ if(! empty($data['man'])){
|
|
|
+ $insert = [];
|
|
|
+ foreach ($data['man'] as $value){
|
|
|
+ $insert[] = [
|
|
|
+ 'sales_order_id' => $data['id'],
|
|
|
+ 'data_id' => $value,
|
|
|
+ 'type' => SalesOrderInfo::type_two,
|
|
|
+ 'crt_time' => $time,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ SalesOrderInfo::insert($insert);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function yj($data,$user){
|
|
|
+ if(empty($data['id']) || empty($data['type']) || empty($data['man'])) return [false, '必填参数不能为空!'];
|
|
|
+
|
|
|
+ try {
|
|
|
+ DB::beginTransaction();
|
|
|
+ if($data['type'] == 1){
|
|
|
+ $this->yjSaleOrderMan($data,$user);
|
|
|
+ }
|
|
|
+ DB::commit();
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ DB::rollBack();
|
|
|
+ return [false,$exception->getMessage()];
|
|
|
+ }
|
|
|
+
|
|
|
+ return [true,''];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function yjSaleOrderMan($data,$user){
|
|
|
+ $time = time();
|
|
|
+
|
|
|
+ SalesOrderInfo::where('del_time',0)
|
|
|
+ ->where('sales_order_id',$data['id'])
|
|
|
+ ->where('type', SalesOrderInfo::type_two)
|
|
|
+ ->where('data_id', $user['id'])
|
|
|
+ ->update(['del_time' => $time]);
|
|
|
+ if(! empty($data['man'])){
|
|
|
+ $insert = [];
|
|
|
+ foreach ($data['man'] as $value){
|
|
|
+ $insert[] = [
|
|
|
+ 'sales_order_id' => $data['id'],
|
|
|
+ 'data_id' => $value,
|
|
|
+ 'type' => SalesOrderInfo::type_two,
|
|
|
+ 'crt_time' => $time,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ SalesOrderInfo::insert($insert);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|