|
@@ -2,8 +2,11 @@
|
|
|
|
|
|
namespace app\common\service;
|
|
|
|
|
|
+use app\common\constant\ApplyConstant;
|
|
|
use app\common\constant\CommonConstant;
|
|
|
+use app\common\model\ApplyGoods;
|
|
|
use app\common\model\Approve;
|
|
|
+use app\common\model\ApproveEvectionPeerUser;
|
|
|
use app\common\model\ApproveInfo;
|
|
|
use app\common\model\User;
|
|
|
use think\Db;
|
|
@@ -38,8 +41,9 @@ class ApproveService
|
|
|
->where('module', 'in', $modules)
|
|
|
->where('status', CommonConstant::STATUS_2)
|
|
|
->group('module')
|
|
|
- ->select();
|
|
|
- $object = $list ? array_column($list->toArray(), null, 'module') : [];
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ $object = $list ? array_column($list, null, 'module') : [];
|
|
|
}
|
|
|
|
|
|
$data = [];
|
|
@@ -142,9 +146,69 @@ class ApproveService
|
|
|
}
|
|
|
]);
|
|
|
}
|
|
|
- $list = $list->limit($offset, $length)
|
|
|
- ->order('approve_id desc')
|
|
|
+ $list = $list->order('approve_id desc')
|
|
|
+ ->limit($offset, $length)
|
|
|
->select();
|
|
|
+ return self::get_array($list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function get_array($list)
|
|
|
+ {
|
|
|
+ $apply_goods_info_ids = [];
|
|
|
+ $peer_user_info_ids = [];
|
|
|
+ $apply_goods_list = [];
|
|
|
+ $peer_user_list = [];
|
|
|
+ foreach ($list as $value) {
|
|
|
+ $module = $value['module'];
|
|
|
+ switch ($module) {
|
|
|
+ case CommonConstant::MODULE_1:
|
|
|
+ if ($value['type'] == ApplyConstant::TYPE_1) {
|
|
|
+ $apply_goods_info_ids[] = $value['info_id'];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case CommonConstant::MODULE_5:
|
|
|
+ $peer_user_info_ids[] = $value['info_id'];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($apply_goods_info_ids) {
|
|
|
+ $apply_goods_list = ApplyGoods::field('id,info_id,goods_name')
|
|
|
+ ->where('info_id', 'in', $apply_goods_info_ids)
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ }
|
|
|
+ if ($peer_user_info_ids) {
|
|
|
+ $peer_user_list = ApproveEvectionPeerUser::field('id,info_id,name')
|
|
|
+ ->where('info_id', 'in', $peer_user_info_ids)
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ }
|
|
|
+ foreach ($list as $value) {
|
|
|
+ $module = $value['module'];
|
|
|
+ $apply_goods = [];
|
|
|
+ $peer_user = [];
|
|
|
+ switch ($module) {
|
|
|
+ case CommonConstant::MODULE_1:
|
|
|
+ if ($value['type'] == ApplyConstant::TYPE_1) {
|
|
|
+ foreach ($apply_goods_list as $val) {
|
|
|
+ if ($value['info_id'] == $val['info_id']) {
|
|
|
+ $apply_goods[] = $val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case CommonConstant::MODULE_5:
|
|
|
+ foreach ($peer_user_list as $val) {
|
|
|
+ if ($value['info_id'] == $val['info_id']) {
|
|
|
+ $peer_user[] = $val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $value['apply_goods'] = $apply_goods;
|
|
|
+ $value['peer_user'] = $peer_user;
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
|
|
|
// $info_ids = [];
|
|
|
// foreach ($list as $value){
|
|
@@ -168,8 +232,6 @@ class ApproveService
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
- return $list;
|
|
|
}
|
|
|
|
|
|
/**
|