diff --git a/niucloud/app/api/controller/upload/Upload.php b/niucloud/app/api/controller/upload/Upload.php index c5e422ff..1463faaf 100644 --- a/niucloud/app/api/controller/upload/Upload.php +++ b/niucloud/app/api/controller/upload/Upload.php @@ -15,6 +15,7 @@ use app\service\api\upload\Base64Service; use app\service\api\upload\FetchService; use app\service\api\upload\UploadService; use core\base\BaseApiController; +use think\Request; use think\Response; class Upload extends BaseApiController @@ -24,12 +25,15 @@ class Upload extends BaseApiController * 图片上传 * @return Response */ - public function image(){ + public function image(Request $request){ + + $extraData = $request->all(); + $data = $this->request->params([ ['file', 'file'], ]); $upload_service = new UploadService(); - return success($upload_service->image($data['file'])); + return success($upload_service->image($data['file'],$extraData)); } /** diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 28a6e959..c639879e 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -201,7 +201,7 @@ Route::group(function () { //需要token验证的 Route::group(function () { - //上传图片 + //员工端-上传图片 Route::post('uploadImage', 'upload.Upload/image'); //员工端详情 Route::get('personnel/info', 'apiController.Personnel/info'); diff --git a/niucloud/app/model/chat_friends/ChatFriends.php b/niucloud/app/model/chat_friends/ChatFriends.php index 33d14738..37c74acc 100644 --- a/niucloud/app/model/chat_friends/ChatFriends.php +++ b/niucloud/app/model/chat_friends/ChatFriends.php @@ -80,8 +80,8 @@ class ChatFriends extends BaseModel } - public function campus(){ - return $this->hasOne(CustomerResources::class, 'id', 'customer_resources_id')->joinType('left')->withField('name,id')->bind(['customer_resources_id'=>'name']); + public function customer(){ + return $this->hasOne(CustomerResources::class, 'id', 'customer_resources_id')->joinType('left')->withField('name,id')->bind(['customer_resources_id_name'=>'name']); } public function personnel(){ diff --git a/niucloud/app/service/api/apiService/ChatService.php b/niucloud/app/service/api/apiService/ChatService.php index fb568558..c8ffa763 100644 --- a/niucloud/app/service/api/apiService/ChatService.php +++ b/niucloud/app/service/api/apiService/ChatService.php @@ -48,7 +48,12 @@ class ChatService extends BaseApiService $model = $model->where('customer_resources_id', $where['customer_resources_id']); } - $data = $model->paginate([ + $data = $model + ->with([ + 'personnel', + 'customer', + ]) + ->paginate([ 'list_rows' => $limit, 'page' => $page, ])->toArray(); diff --git a/niucloud/app/service/api/upload/UploadService.php b/niucloud/app/service/api/upload/UploadService.php index 30856447..b666bf47 100644 --- a/niucloud/app/service/api/upload/UploadService.php +++ b/niucloud/app/service/api/upload/UploadService.php @@ -34,9 +34,9 @@ class UploadService extends BaseApiService * @return array * @throws Exception */ - public function image($file) + public function image($file,array $extraData = []) { - $dir = $this->root_path . '/' . 'image' . '/' . date('Ym') . '/' . date('d'); + $dir = $this->root_path . '/' . 'image' . '/' . date('Ym') . '/' . date('d');//打印结果 例如=file/image/202505/29 $core_upload_service = new CoreUploadService(); return $core_upload_service->image($file, $dir, $this->cate_id); }