582 lines
24 KiB
PHP
582 lines
24 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Server\Admin;
|
|
|
|
use App\Models\Server\MerchantUserPhoto;
|
|
use App\Models\Server\MerchantUserProfile;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\MerchantUsers;
|
|
use App\Models\IdentityAuthorization;
|
|
use App\Models\ProfileCourtship;
|
|
use App\Models\RecommendLinkingNew;
|
|
use App\Models\User;
|
|
use App\Models\Wechat;
|
|
use App\Models\UnionUser;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Redis;
|
|
use App\Models\ProfilePhoto;
|
|
use App\Jobs\SynchronizeUsers;
|
|
use App\Models\ClientComment;
|
|
use App\Models\Server\MerchantAccount;
|
|
use App\Models\Server\MerchantAdmins;
|
|
use App\Models\Server\MerchantUser;
|
|
use PDO;
|
|
|
|
class MakeFriendsController extends Controller
|
|
{
|
|
/**
|
|
* 增加用户信息
|
|
* *
|
|
* @param Request $Request
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function addUser(Request $Request)
|
|
{
|
|
$mobile = $Request->mobile;
|
|
if(!$mobile){
|
|
return $this->failure('用户手机号不能为空');
|
|
}
|
|
$merchant_user = MerchantUsers::where('mobile', $mobile)->first();
|
|
if ($merchant_user) {
|
|
$exist = IdentityAuthorization::where('m_user_id', $merchant_user->id)->where('m_id', $Request->account_id)->exists();
|
|
if ($exist) return $this->failure('该用户已添加');
|
|
}
|
|
$rand_str = $this->randString(8);
|
|
$nickname = $Request->nickname ?? '用户'.$rand_str;
|
|
$pic = $Request->pic;
|
|
$sex = $Request->sex ?: 0;
|
|
$province = $Request->province;
|
|
$city = $Request->city;
|
|
$ideal_mate = $Request->ideal_mate;
|
|
$birthday = $Request->birthday;
|
|
$age = $this->getAge($birthday);
|
|
$belief = $Request->belief;
|
|
$state = $Request->state;
|
|
$stature = $Request->stature;
|
|
$weight = $Request->weight;
|
|
$resident_province = $Request->resident_province;
|
|
$resident_city = $Request->resident_city;
|
|
$income = $Request->income;
|
|
$degree = $Request->degree;
|
|
$industry_sub = $Request->industry_sub;
|
|
$industry = $Request->industry;
|
|
$introduction = $Request->introduction;
|
|
$interest_hobby = $Request->interest_hobby;
|
|
$mate_conditon = $Request->mate_conditon;
|
|
$photos = $Request->photos;
|
|
try {
|
|
\DB::beginTransaction();
|
|
if (!$merchant_user) {
|
|
$merchant_user = new MerchantUsers();
|
|
$merchant_user->mobile = $mobile;
|
|
$merchant_user->rand_str = $rand_str;
|
|
$merchant_user->nickname = $nickname;
|
|
$merchant_user->sex = $sex;
|
|
$merchant_user->city = $city;
|
|
$merchant_user->pic = $pic;
|
|
} else {
|
|
$merchant_user->nickname = $nickname;
|
|
$merchant_user->sex = $sex;
|
|
$merchant_user->city = $city;
|
|
$merchant_user->pic = $pic;
|
|
}
|
|
$UnionUser = UnionUser::where('mobile', $mobile)->first();
|
|
if (!$UnionUser) {
|
|
$UnionUser = new UnionUser;
|
|
$UnionUser->mobile = $mobile;
|
|
$UnionUser->source = 'SPA';
|
|
$UnionUser->save();
|
|
}
|
|
$user = User::where('mobile', $mobile)->first();
|
|
if (!$user) {
|
|
$user = new User();
|
|
$user->regist_channel = 'sass';
|
|
$user->hidden_profile = 'ALLSEX';
|
|
$user->can_be_found = 0;
|
|
}
|
|
$user->industry_sub = $industry_sub;
|
|
$user->industry = $industry;
|
|
$user->nickname = $nickname;
|
|
$user->uuid = $UnionUser->id;
|
|
$user->age = $age;
|
|
$user->sex = $sex;
|
|
$user->photo = $pic;
|
|
$user->mobile = $mobile;
|
|
$user->belief = $belief;
|
|
$user->type = 'single';
|
|
$user->save();
|
|
$merchant_user->uuid = $UnionUser->id;
|
|
$merchant_user->user_id = $user->id;
|
|
$merchant_user->save();
|
|
$IdentityAuthorization = new IdentityAuthorization();
|
|
$IdentityAuthorization->m_user_id = $merchant_user->id;
|
|
$IdentityAuthorization->m_id = $Request->account_id;
|
|
$IdentityAuthorization->save();
|
|
|
|
$profile = ProfileCourtship::where('user_id', $user->id)->first();
|
|
if (!$profile) {
|
|
$profile = new ProfileCourtship();
|
|
$profile->user_id = $user->id;
|
|
}
|
|
$profile->belief = $belief;
|
|
$profile->birthday = $birthday;
|
|
$profile->sex = $sex;
|
|
$profile->age = $age;
|
|
$profile->city = $city;
|
|
$profile->degree = $degree;
|
|
$profile->province = $province;
|
|
$profile->income = $income;
|
|
$profile->ideal_mate = $ideal_mate;
|
|
$profile->resident_province = $resident_province;
|
|
$profile->resident_city = $resident_city;
|
|
$profile->introduction = $introduction;
|
|
$profile->state = $state;
|
|
$profile->stature = $stature;
|
|
$profile->weight = $weight;
|
|
$profile->interest_hobby = $interest_hobby;
|
|
$profile->mate_conditon = json_encode($mate_conditon);
|
|
$profile->save();
|
|
|
|
if ($Request->photos && is_array($Request->photos)) {
|
|
foreach ($photos as $photo) {
|
|
if (empty($photo)) {
|
|
continue;
|
|
}
|
|
$photo_obj = new ProfilePhoto();
|
|
$photo_obj->photo = $photo;
|
|
$photo_obj->user_id = $user->id;
|
|
$photo_obj->dateline = date('Y-m-d');
|
|
$photo_obj->save();
|
|
}
|
|
}
|
|
\DB::commit();
|
|
return $this->success('ok');
|
|
} catch (\Exception $e) {
|
|
//回滚事务
|
|
\DB::rollback();
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息中,请稍后再试');
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public function addUserV2(Request $request)
|
|
{
|
|
try {
|
|
DB::beginTransaction();
|
|
$m_id = $request->account_id;
|
|
$mobile = $request->input('mobile');
|
|
if (empty($mobile)) return $this->failure("请输入手机号");
|
|
$user = MerchantUser::where('mobile', $mobile)->first();
|
|
if ($user) {
|
|
$profile = MerchantUserProfile::where(['m_id'=>$m_id, 'user_id'=>$user->id])->first();
|
|
if ($profile) {
|
|
IdentityAuthorization::firstOrCreate(['m_id'=>$m_id, 'm_user_id'=>$user->id]);
|
|
DB::commit();
|
|
return $this->success('ok');
|
|
}else {
|
|
$profile = MerchantUserProfile::create(['m_id'=>$m_id, 'user_id'=>$user->id]);
|
|
}
|
|
}else {
|
|
$user = new MerchantUser();
|
|
$profile = new MerchantUserProfile();
|
|
}
|
|
|
|
$keys = ['belief', 'birthday', 'degree', 'ideal_mate', 'income', 'industry', 'industry_sub', 'interest_hobby', 'introduction', 'province', 'city', 'mate_conditon',
|
|
'state', 'stature', 'weight', 'sex', 'resident_province','resident_city'];
|
|
$user_keys = ['nickname', 'pic', 'mobile','sex'];
|
|
foreach ($user_keys as $user_key) {
|
|
$user->$user_key = $request->$user_key;
|
|
}
|
|
foreach ($keys as $key) {
|
|
if ($key == 'mate_conditon') {
|
|
$profile->$key = json_encode($request->$key);
|
|
continue;
|
|
}
|
|
$profile->$key = $request->$key;
|
|
}
|
|
$user->save();
|
|
$profile->user_id = $user->id;
|
|
$profile->m_id = $m_id;
|
|
$profile->save();
|
|
//最后一项填完加入交友管理
|
|
IdentityAuthorization::firstOrCreate(['m_id'=>$m_id, 'm_user_id'=>$user->id]);
|
|
//图片
|
|
$photos = $request->input('photos');
|
|
if ($photos == 'null' || empty($photos)) {
|
|
$photos = [];
|
|
}
|
|
if (count($photos)) {
|
|
foreach ($photos as $photo) {
|
|
MerchantUserPhoto::firstOrCreate(['m_id'=>$m_id, 'user_id'=>$user->id, 'photo'=>$photo]);
|
|
}
|
|
}
|
|
DB::commit();
|
|
return $this->success('ok');
|
|
|
|
}catch (\Exception $e) {
|
|
DB::rollBack();
|
|
$this->getError($e);
|
|
return $this->failure();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 更新用户信息
|
|
* @param Request $Request
|
|
* @param $id
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function updateUser(Request $request, $merchant_user_id)
|
|
{
|
|
$m_id = $request->account_id;
|
|
$user = MerchantUser::find($merchant_user_id);
|
|
$profile = MerchantUserProfile::where(["m_id"=>$m_id, 'user_id'=>$merchant_user_id])->first();
|
|
if (empty($profile)) {
|
|
$profile = new MerchantUserProfile;
|
|
}
|
|
if ($request->input('pic') && $user->pic != $request->pic) {
|
|
$user->pic = $request->pic;
|
|
}
|
|
if ($request->input('nickname') && $user->pic != $request->nickname) {
|
|
$user->nickname = $request->nickname;
|
|
}
|
|
if ($request->input('birthday') && $profile->birthday != $request->birthday) {
|
|
$profile->birthday = $request->birthday;
|
|
}
|
|
if ($request->input('sex') && $profile->sex != $request->sex) {
|
|
$profile->sex = $request->sex;
|
|
$user->sex = $request->sex;
|
|
}
|
|
if ($request->input('province') && $profile->province != $request->province) {
|
|
$profile->province = $request->province;
|
|
}
|
|
if ($request->input('city') && $profile->city != $request->city) {
|
|
$profile->city = $request->city;
|
|
}
|
|
if ($request->input('state') && $profile->state != $request->state) {
|
|
$profile->state = $request->state;
|
|
}
|
|
if ($request->input('belief') && $profile->belief != $request->belief) {
|
|
$profile->belief = $request->belief;
|
|
}
|
|
if ($request->input('stature') && $profile->stature != $request->stature) {
|
|
$profile->stature = $request->stature;
|
|
}
|
|
if ($request->input('weight') && $profile->weight != $request->weight) {
|
|
$profile->weight = $request->weight;
|
|
}
|
|
if ($request->input('resident_province') && $profile->resident_province != $request->resident_province) {
|
|
$profile->resident_province = $request->resident_province;
|
|
}
|
|
if ($request->input('resident_city') && $profile->resident_city != $request->resident_city) {
|
|
$profile->resident_city = $request->resident_city;
|
|
}
|
|
if ($request->input('degree') && $profile->degree != $request->degree) {
|
|
$profile->degree = $request->degree;
|
|
}
|
|
if ($request->input('industry') && $profile->industry != $request->industry) {
|
|
$profile->industry = $request->industry;
|
|
}
|
|
if ($request->input('industry_sub') && $profile->industry_sub != $request->industry_sub) {
|
|
$profile->industry_sub = $request->industry_sub;
|
|
}
|
|
if ($request->input('income') && $profile->income != $request->income) {
|
|
$profile->income = $request->income;
|
|
}
|
|
if ($request->input('introduction') && $profile->introduction != $request->introduction) {
|
|
$profile->introduction = $request->introduction;
|
|
}
|
|
if ($request->input('interest_hobby') && $profile->interest_hobby != $request->interest_hobby) {
|
|
$profile->interest_hobby = $request->interest_hobby;
|
|
}
|
|
if ($request->input('mate_conditon') && json_encode($profile->mate_conditon) != $request->mate_conditon) {
|
|
$profile->mate_conditon = json_encode($request->mate_conditon);
|
|
}
|
|
if ($request->input('ideal_mate') && $profile->ideal_mate != $request->ideal_mate) {
|
|
$profile->ideal_mate = $request->ideal_mate;
|
|
//最后一项填完加入交友管理
|
|
IdentityAuthorization::firstOrCreate(['m_id'=>$m_id, 'm_user_id'=>$merchant_user_id]);
|
|
}
|
|
try {
|
|
DB::beginTransaction();
|
|
//图片
|
|
$photos = $request->input('photos',[]);
|
|
if (count($photos)) {
|
|
MerchantUserPhoto::where(['m_id'=>$m_id, 'user_id'=>$merchant_user_id])->delete();
|
|
foreach ($photos as $photo) {
|
|
MerchantUserPhoto::create(['m_id'=>$m_id, 'user_id'=>$merchant_user_id, 'photo'=>$photo]);
|
|
}
|
|
}
|
|
$user->save();
|
|
$profile->save();
|
|
DB::commit();
|
|
return $this->success('ok');
|
|
}catch (\Exception $e) {
|
|
DB::rollBack();
|
|
$this->getError($e);
|
|
return $this->failure();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 智能匹配列表
|
|
* *
|
|
* @param Request $Request
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function MatchList(Request $Request)
|
|
{
|
|
try {
|
|
// 用户信息
|
|
$user_id = MerchantUsers::where('id', $Request->merchant_user_id)->value('user_id');
|
|
// 匹配者信息
|
|
$wechat = Wechat::where('user_id', $user_id)->first();
|
|
if (empty($wechat)) {
|
|
$openid = '无';
|
|
$official_openid = '无';
|
|
} else {
|
|
$openid = $wechat->openid ?: '无';
|
|
$official_openid = $wechat->official_openid ?: '无';
|
|
}
|
|
|
|
$ids = User::orderBy('id', 'desc')->where(function ($sql) use ($openid, $official_openid, $user_id) {
|
|
$sql->where('from_openid', $openid)
|
|
->orWhere('from_official_openid', $official_openid)
|
|
->orWhere('from_user_id', $user_id);
|
|
})->where('type', 'single')->pluck('id');
|
|
|
|
$linking_ids = RecommendLinkingNew::where('id_users_left', $user_id)->wherein('id_users_right', $ids)->orderBy('id', 'desc')->pluck('id_users_right');
|
|
$merchant_user = MerchantUsers::select('id', 'user_id', 'pic', 'nickname', 'created_at')->whereIn('user_id', $linking_ids)->paginate();
|
|
foreach ($merchant_user as $key => $value) {
|
|
if (!$value->pic) {
|
|
$value->pic = $value->user->photo ?: $value->user->circle_avatar;
|
|
}
|
|
$value->info = $value->user->sass_profileCourtship;
|
|
$value->info->mate_conditon = json_decode($value->info->mate_conditon);
|
|
$value->info->industry_sub = $value->user->industry_sub;
|
|
$value->info->mobile = $value->user->mobile;
|
|
$value->info->industry = $value->user->industry;
|
|
$merchant_user->photos = ProfilePhoto::where('user_id', $value->user_id)->orderBy('id', 'desc')->limit(9)->pluck('photo');
|
|
unset($value->user);
|
|
}
|
|
return $this->success('ok', $merchant_user);
|
|
}catch (\Exception $e){
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 用户详情
|
|
* @param Request $Request
|
|
* @param $id
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function userInfo(Request $request, $id)
|
|
{
|
|
try {
|
|
$m_id = $request->account_id;
|
|
$merchant_user = MerchantUsers::select('id', 'user_id', 'pic', 'nickname', 'created_at','mobile')->where('id', $id)->first();
|
|
$profile = MerchantUserProfile::where(['m_id'=>$m_id, 'user_id'=>$id])->first();
|
|
$merchant_user->info = $profile;
|
|
$merchant_user->info->mate_conditon = json_decode($profile->mate_conditon);
|
|
$merchant_user->info->industry_sub = $profile->industry_sub;
|
|
$merchant_user->info->industry = $profile->industry;
|
|
$merchant_user->info->mobile = $merchant_user->mobile;
|
|
$merchant_user->photos = MerchantUserPhoto::where(['m_id'=>$m_id,'user_id'=> $id])->orderBy('id', 'desc')
|
|
->limit(9)->pluck('photo');
|
|
|
|
return $this->success('ok', $merchant_user);
|
|
}catch (\Exception $e){
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 用户列表
|
|
* @param Request $Request
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function userList(Request $request)
|
|
{
|
|
try {
|
|
$m_id = $request->account_id;
|
|
$ids = IdentityAuthorization::where('m_id', $m_id)->orderBy('id', 'desc')->pluck('m_user_id');
|
|
$users = MerchantUsers::select('id', 'user_id', 'pic', 'nickname', 'created_at','mobile')->whereIn('id', $ids);
|
|
$keyword = $request->input('keyword');
|
|
if ($keyword) {
|
|
$users = $users->where(function ($sql) use($keyword) {
|
|
$sql->where("nickname", 'like', '%'.$keyword.'%')
|
|
->orWhere('mobile', 'like', '%'.$keyword.'%');
|
|
});
|
|
}
|
|
$users = $users->paginate();
|
|
foreach ($users as $user) {
|
|
$profile = MerchantUserProfile::firstOrCreate(['m_id'=>$m_id, 'user_id'=>$user->id]);
|
|
$user->info = $profile;
|
|
$user->info->mate_conditon = json_decode($profile->mate_conditon);
|
|
$user->info->industry_sub = $profile->industry_sub;
|
|
$user->info->industry = $profile->industry;
|
|
$user->info->mobile = $user->mobile;
|
|
$user->photos = MerchantUserPhoto::where(['m_id'=>$m_id, 'user_id'=> $user->id])->orderBy('id', 'desc')->limit(9)->pluck('photo');
|
|
$user->info->age = \CommonUtilsService::getAge($profile->birthday);
|
|
if ($m_id == 491) {
|
|
$user->pv = Redis::zscore('MakeFriend_S', $user->id) ? : 0;
|
|
}else {
|
|
$user->pv = Redis::zscore('MakeFriend_S', $m_id.'-'.$user->id) ? : 0;
|
|
}
|
|
}
|
|
return $this->success('ok', $users);
|
|
}catch (\Exception $e){
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* 删除好友
|
|
* *
|
|
* @param Request $request
|
|
* @param $id
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function deleteFriend(Request $request, $id)
|
|
{
|
|
try {
|
|
$friend = IdentityAuthorization::where('m_user_id', $id)->where('m_id', $request->account_id)->first();
|
|
if (!$friend) {
|
|
return $this->success('已删除成功');
|
|
} else {
|
|
$friend->delete();
|
|
return $this->success('ok');
|
|
}
|
|
} catch (\Exception $e) {
|
|
Log::error($e->getMessage());
|
|
return $this->failure('数据错误,请稍后再试');
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* 同步福恋数据
|
|
* @param Request $Request
|
|
* @return JsonResponse
|
|
*/
|
|
public function synchronizeUsers(Request $Request)
|
|
{
|
|
try {
|
|
$m_id = $Request->account_id;
|
|
$mobile = MerchantAccount::where('id', $Request->account_id)->value('mobile');
|
|
$user_id = User::where('mobile', $mobile)->value('id');
|
|
if (!$user_id) return $this->failure('您暂无可同步的用户数据');
|
|
SynchronizeUsers::dispatch($user_id, $m_id)->onQueue('love');
|
|
}catch (\Exception $e){
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 邀请地址和二维码
|
|
* @param Request $Request
|
|
* @return JsonResponse|string
|
|
*/
|
|
public function inviteUrl(Request $Request)
|
|
{
|
|
try {
|
|
$serve_tab = $Request->serve_tab;
|
|
$url = env('APP_URL') . '/pu/#/editorUserData';
|
|
$url = urlencode($url);
|
|
$m_id = $Request->account_id;
|
|
$MerchantAccount = MerchantAccount::where('id', $m_id)->first();
|
|
$url = env('APP_URL') . '/api/official/live/wechat/FamilyAuth?from_openid=' . $MerchantAccount->openid . '&merchant_id=' . $m_id . '&serve_tab=' . $serve_tab
|
|
. '&url=' . $url;
|
|
$qr_code = Redis::get('friend-inviteUrl' . $m_id);
|
|
if (!$qr_code) {
|
|
$qr_code = $this->getPreviewQrcode($url);
|
|
Redis::setex('friend-inviteUrl' . $m_id, 60 * 60 * 24 * 30, $qr_code);
|
|
$qr_code = Redis::get('friend-inviteUrl' . $m_id);
|
|
}
|
|
$data['url'] = $url;
|
|
$data['qr_code'] = $qr_code;
|
|
$data['make_friends'] = $MerchantAccount->info->make_friends ?? 0;
|
|
return $this->success('ok', $data);
|
|
}catch (\Exception $e){
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
}
|
|
|
|
//用户详情增加备注
|
|
public function addComment(Request $request){
|
|
try {
|
|
$merchant_user_id = $request->merchant_user_id;
|
|
$admin_id = $request->merchant_admin_id??0;
|
|
$comment = $request->comment;
|
|
if(!$comment) return $this->failure('备注内容不能为空');
|
|
if($admin_id){
|
|
$admin_mobile = MerchantAdmins::where('id',$admin_id)->value('mobile');
|
|
}else{
|
|
$admin_mobile = MerchantAccount::where('id',$request->account_id)->value('mobile');
|
|
}
|
|
$admin_user_id = User::where('mobile',$admin_mobile)->value('id');
|
|
$merchant_user = MerchantUser::find($merchant_user_id);
|
|
if(!$merchant_user) return $this->failure('用户不存在');
|
|
$user_id = $this->matchFulinkUser($merchant_user_id);
|
|
ClientComment::create([
|
|
'user_id'=>$user_id,
|
|
'maker_user_id'=>$admin_user_id??0,
|
|
'pics'=>!empty($request->pics) ? json_encode($request->pics):null,
|
|
'comment'=>$comment,
|
|
]);
|
|
return $this->success('ok');
|
|
} catch (\Exception $e) {
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
|
|
}
|
|
|
|
//备注列表
|
|
public function comments(Request $request){
|
|
try {
|
|
$merchant_user_id = $request->merchant_user_id;
|
|
$user_id = $this->matchFulinkUser($merchant_user_id);
|
|
$comments = ClientComment::where('user_id',$user_id)->with('user:id,nickname,name,mobile,app_avatar,circle_avatar,photo','makerUser:id,nickname,name,mobile,app_avatar,circle_avatar,photo')->orderBy('id','desc')->paginate();
|
|
foreach ($comments as $key => $value) {
|
|
$value->pics = json_decode($value->pics);
|
|
}
|
|
return $this->success('ok',$comments);
|
|
} catch (\Exception $e) {
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
|
|
}
|
|
|
|
//修改备注信息
|
|
public function updateComment(Request $request,$id){
|
|
try {
|
|
$comment = $request->comment;
|
|
$pics = $request->pics;
|
|
$result = ClientComment::find($id);
|
|
if(!$result) return $this->failure('备注信息不存在');
|
|
$result->comment = $comment;
|
|
$result->pics = json_encode($pics);
|
|
$result->save();
|
|
return $this->success('ok');
|
|
} catch (\Exception $e) {
|
|
$this->getError($e);
|
|
return $this->failure('服务器休息了,请稍后再试');
|
|
}
|
|
|
|
}
|
|
}
|