|
|
@@ -42,7 +42,7 @@ class UserServiceLogic extends BaseLogic
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @notes 添加农耕分类
|
|
|
+ * @notes 添加服务商
|
|
|
* @param array $params
|
|
|
* @author heshihu
|
|
|
* @date 2022/2/18 10:17
|
|
|
@@ -132,10 +132,55 @@ class UserServiceLogic extends BaseLogic
|
|
|
return ['code'=>0,'data'=>[]];
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @notes 编辑服务商
|
|
|
+ * @param array $params
|
|
|
+ * @author heshihu
|
|
|
+ * @date 2022/2/18 10:17
|
|
|
+ */
|
|
|
+ public static function edit(array $params,$type_name)
|
|
|
+ {
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
|
|
|
+// $where['user_id'] = $params['user_id'];
|
|
|
+// $where['type'] = $params['type'];
|
|
|
+// $userService = UserService::where($where)->findOrEmpty();
|
|
|
+//
|
|
|
+// if(!$userService->isEmpty()){
|
|
|
+// Db::rollback();
|
|
|
+// self::setError('当前用户存在'.$type_name.'服务信息,无需添加');
|
|
|
+// return ['code'=>0,'data'=>[]];
|
|
|
+// }
|
|
|
+ $result = UserService::where(['id'=>$params['id']])->update([
|
|
|
+ 'user_id' => $params['user_id'],
|
|
|
+ 'type' => $params['type'] ?? 1,
|
|
|
+ 'name' => $params['name'],
|
|
|
+ 'mobile' => $params['mobile'],
|
|
|
+ 'agricultural_machinery_model' =>$params['agricultural_machinery_model'],
|
|
|
+ 'images' => $params['images'],
|
|
|
+ 'agricultural_image'=>$params['agricultural_image'],
|
|
|
+ 'driver_image'=>$params['driver_image'],
|
|
|
+ 'driving_image'=>$params['driving_image'],
|
|
|
+ 'cate_id' => ','.$params['cate_id'].',',
|
|
|
+ 'area_id' => ','.$params['area_id'].',',
|
|
|
+ 'mechanical_cate_id' => ','.$params['mechanical_cate_id'].',',
|
|
|
+ 'money' => $params['money'],
|
|
|
+ 'content'=>$params['content']?? '',
|
|
|
+ ]);
|
|
|
+
|
|
|
+
|
|
|
+ Db::commit();
|
|
|
+ return ['code'=>1,'data'=>$result];
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return ['code'=>0,'data'=>[]];
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * @notes 删除农耕分类
|
|
|
+ * @notes 删除服务商
|
|
|
* @param array $params
|
|
|
* @author heshihu
|
|
|
* @date 2022/2/21 17:52
|