Commit a8e39254 by 朱继来

调整自营退货页面客服

parent a9a4f72a
......@@ -13,4 +13,23 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
// 二维数组,针对某个键名去重
public function assoc_unique($arr, $key='userId')
{
if (!$arr) return false;
$tmp = [];
foreach ($arr as $k=>$v) {
if (in_array($v->$key, $tmp)) {
unset($arr[$k]);
} else {
$tmp[] = $v->$key;
}
}
return array_merge($arr); // 重新索引
}
}
......@@ -572,24 +572,6 @@ Class OrderController extends Controller
return $info;
}
// 二维数组,针对某个键名去重
public function assoc_unique($arr, $key='userId')
{
if (!$arr) return false;
$tmp = [];
foreach ($arr as $k=>$v) {
if (in_array($v->$key, $tmp)) {
unset($arr[$k]);
} else {
$tmp[] = $v->$key;
}
}
return array_merge($arr); // 重新索引
}
// 订单其他信息
public function orderOtherInfoLoading(Request $request)
{
......
......@@ -11,6 +11,7 @@ use App\Model\OrderReturnItemsModel;
use DB;
use App\Http\Page;
use App\Model\UserMainModel;
use Illuminate\Support\Facades\Redis;
// 获取支付名称
function getPayName($order_id)
......@@ -164,11 +165,39 @@ class ReturnController extends Controller
$info['count'] = $response['data']['count'];
$info['page'] = $show;
$perm = new PermController;
$joint_kefu = $perm->getRoleUsers($request, '客服');
$self_kefu = $perm->getRoleUsers($request, '自营客服');
// $perm = new PermController;
// $joint_kefu = $perm->getRoleUsers($request, '客服');
// $self_kefu = $perm->getRoleUsers($request, '自营客服');
// $info['sale_list'] = array_merge($joint_kefu, $self_kefu);
$key = 'search_self_sales';
$redis = Redis::connection('read');
$sale_list = $redis->get($key);
if (!$sale_list) {
// 获取所有的业务员 (包括经理、交易员、客服、测试)
$perm = new PermController;
$sale_list = [];
$search_sales = Config('perm_args.search_self_sales');
if ($search_sales) {
foreach ($search_sales as $v) {
$role_name = array_keys(Config('perm_args.roles'), $v);
$temp = $perm->getRoleUsers($request, $role_name[0]);
$sale_list = array_merge($sale_list, $temp);
}
}
$sale_list = $this->assoc_unique($sale_list);
$expire = Config('perm_args.redis_search_sales_expire'); // 缓存两小时
Redis::setex($key, $expire, json_encode($sale_list));
} else {
$sale_list = json_decode($sale_list);
}
$info['sale_list'] = array_merge($joint_kefu, $self_kefu);
$info['sale_list'] = $sale_list;
return $info;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment