|
|
@@ -6,6 +6,7 @@ use common\helpers\Cache;
|
|
|
use common\helpers\Tool;
|
|
|
use common\helpers\user\Info;
|
|
|
use Yii;
|
|
|
+use yii\data\Pagination;
|
|
|
use yii\helpers\Json;
|
|
|
use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
|
|
|
|
|
|
@@ -403,7 +404,7 @@ class User extends \common\components\ActiveRecord
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 判断用户是否是观察期
|
|
|
* 观望期:自加入算起2个月
|
|
|
@@ -428,10 +429,10 @@ class User extends \common\components\ActiveRecord
|
|
|
public static function sumDevPvByUserId($userId) {
|
|
|
$decOrderPv = DecOrder::find()
|
|
|
->select('SUM(DEC_PV) AS PV_SUM')
|
|
|
- ->where('TO_USER_ID=:TO_USER_ID AND IS_DEL=0',
|
|
|
+ ->where('TO_USER_ID=:TO_USER_ID AND IS_DEL=0',
|
|
|
[
|
|
|
- 'TO_USER_ID'=>$userId,
|
|
|
-
|
|
|
+ 'TO_USER_ID'=>$userId,
|
|
|
+
|
|
|
]
|
|
|
)
|
|
|
->asArray()
|
|
|
@@ -439,10 +440,10 @@ class User extends \common\components\ActiveRecord
|
|
|
$decOrderPv = isset($decOrderPv['PV_SUM']) ? $decOrderPv['PV_SUM'] : 0;
|
|
|
$orderDecPv = OrderDec::find()
|
|
|
->select('SUM(PAY_PV) AS PV_SUM')
|
|
|
- ->where('USER_ID=:USER_ID AND IS_DELETE=0',
|
|
|
+ ->where('USER_ID=:USER_ID AND IS_DELETE=0',
|
|
|
[
|
|
|
- 'USER_ID'=>$userId,
|
|
|
-
|
|
|
+ 'USER_ID'=>$userId,
|
|
|
+
|
|
|
]
|
|
|
)
|
|
|
->asArray()
|
|
|
@@ -451,10 +452,10 @@ class User extends \common\components\ActiveRecord
|
|
|
// 还得加上用户在老系统中的所有报单PV之和
|
|
|
$originPv = OriginDecPv::find()
|
|
|
->select('SUM(DEC_PV) AS PV_SUM')
|
|
|
- ->where('USER_ID=:USER_ID',
|
|
|
+ ->where('USER_ID=:USER_ID',
|
|
|
[
|
|
|
- 'USER_ID'=>$userId,
|
|
|
-
|
|
|
+ 'USER_ID'=>$userId,
|
|
|
+
|
|
|
]
|
|
|
)
|
|
|
->asArray()
|
|
|
@@ -572,4 +573,51 @@ class User extends \common\components\ActiveRecord
|
|
|
'SEX' => '性别',
|
|
|
];
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取列表
|
|
|
+ * @param string $condition
|
|
|
+ * @param array $params
|
|
|
+ * @param array $argv
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public static function lists($condition = '', $params = [], $argv = []) {
|
|
|
+ self::prepare($condition, $params, $argv, true);
|
|
|
+ unset($condition, $params, $argv);
|
|
|
+
|
|
|
+ $countQuery = clone self::$query;
|
|
|
+ $simpleQuery = clone self::$query;
|
|
|
+
|
|
|
+ if(!$simpleQuery->params){
|
|
|
+ $simpleQuery->join = [];
|
|
|
+ $count = $simpleQuery->count(self::$argv['count']);
|
|
|
+ } else {
|
|
|
+ $count = $countQuery->count(self::$argv['count']); // 得到总数
|
|
|
+ }
|
|
|
+// $count = $countQuery->count(self::$argv['count']); // 得到总数
|
|
|
+ $pagination = new Pagination(['totalCount' => $count]);
|
|
|
+ $pagination->setPageSize(self::$argv['pageSize']);
|
|
|
+ if(self::$argv['page'] !== null){
|
|
|
+ $pagination->setPage(self::$argv['page']);
|
|
|
+ }
|
|
|
+ self::$query->offset($pagination->offset)->limit($pagination->limit);
|
|
|
+ if(self::$argv['asArray']){
|
|
|
+ self::$query->asArray();
|
|
|
+ }
|
|
|
+ $lists = self::$query->all();
|
|
|
+
|
|
|
+ self::$query = null;
|
|
|
+ unset($countQuery);
|
|
|
+ $startNum = $pagination->page * $pagination->pageSize + 1;
|
|
|
+ return [
|
|
|
+ 'list' => $lists ? $lists : [],
|
|
|
+ 'pagination' => $pagination,
|
|
|
+ // 'sql'=self::$rawSql,
|
|
|
+ 'currentPage'=>$pagination->page,
|
|
|
+ 'totalPages'=>$pagination->pageCount,
|
|
|
+ 'startNum' => $startNum,
|
|
|
+ 'totalCount' => $pagination->totalCount,
|
|
|
+ 'pageSize' => $pagination->pageSize,
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|