//产品多图排序
public function to_forward_product_img(Request $request)
{
$id = $request->param('id');
$ph_upload_img_arr = $request->param('ph_upload_img_arr');
$res = Db::name('product')->where('product_id',$id)
->field('ph_upload_img_arr')->find();
//转成数组格式
$arr = explode(',',$res['ph_upload_img_arr']);
//获取键值
$key = array_search($ph_upload_img_arr,$arr);
//改变数组的排序
array_splice($arr, $key-1,1,...array_splice($arr, $key,1, $arr[$key-1]));
$str_img_arr = implode(',',$arr);
$data = Db::name('product')->where('product_id', $id)
->update(['ph_upload_img_arr' => $str_img_arr]);;
if($data>0){
return json(['code'=>'200', 'msg'=>"操作成功"]);
}
}