|
@@ -59,13 +59,14 @@ class UserBill extends BaseModel
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @throws \think\exception\DbException
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
*/
|
|
|
- public static function userBillList($uid, $page, $limit, $category = 'integral')
|
|
|
|
|
|
|
+ public static function userBillList($uid, $page, $limit, $category = 'integral', $where = [])
|
|
|
{
|
|
{
|
|
|
if ($page) {
|
|
if ($page) {
|
|
|
$list = self::where('uid', $uid)
|
|
$list = self::where('uid', $uid)
|
|
|
->where('category', $category)
|
|
->where('category', $category)
|
|
|
->field('mark,pm,number,add_time')
|
|
->field('mark,pm,number,add_time')
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
|
|
+ ->where($where)
|
|
|
->order('add_time DESC')
|
|
->order('add_time DESC')
|
|
|
->page((int)$page, (int)$limit)
|
|
->page((int)$page, (int)$limit)
|
|
|
->select();
|
|
->select();
|
|
@@ -74,75 +75,23 @@ class UserBill extends BaseModel
|
|
|
->where('category', $category)
|
|
->where('category', $category)
|
|
|
->field('mark,pm,number,add_time')
|
|
->field('mark,pm,number,add_time')
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
|
|
+ ->where($where)
|
|
|
->order('add_time DESC')
|
|
->order('add_time DESC')
|
|
|
->select();
|
|
->select();
|
|
|
}
|
|
}
|
|
|
- $data['zj'] = [];
|
|
|
|
|
- $data['kc'] = [];
|
|
|
|
|
- $list = count($list) ? $list->toArray() : [];
|
|
|
|
|
- foreach ($list as &$v) {
|
|
|
|
|
|
|
+ $data['list'] = count($list) ? $list->toArray() : [];
|
|
|
|
|
+ $data['zc'] = self::where('uid', $uid)->where('category', $category)->where('pm', 0)->sum('number');
|
|
|
|
|
+ $data['sr'] = self::where('uid', $uid)->where('category', $category)->where('pm', 1)->sum('number');
|
|
|
|
|
+ foreach ($data['list'] as &$v) {
|
|
|
$v['add_time'] = date('Y/m/d H:i', $v['add_time']);
|
|
$v['add_time'] = date('Y/m/d H:i', $v['add_time']);
|
|
|
$v['number'] = floatval($v['number']);
|
|
$v['number'] = floatval($v['number']);
|
|
|
- if ($v['pm'] == 1) $data['zj'][] = $v;
|
|
|
|
|
- if ($v['pm'] == 0) $data['kc'][] = $v;
|
|
|
|
|
}
|
|
}
|
|
|
- return $data;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 广告值
|
|
|
|
|
- * @param $uid
|
|
|
|
|
- * @param $page
|
|
|
|
|
- * @param $limit
|
|
|
|
|
- * @param string $category
|
|
|
|
|
- * @return array|\think\Collection
|
|
|
|
|
- * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
- * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
- * @throws \think\exception\DbException
|
|
|
|
|
- */
|
|
|
|
|
- public static function userAnticipate($uid, $page, $limit, $category = 'anticipate')
|
|
|
|
|
- {
|
|
|
|
|
- if ($page) {
|
|
|
|
|
- $list = self::where('uid', $uid)
|
|
|
|
|
- ->where('category', $category)
|
|
|
|
|
- ->field('mark,pm,number,add_time')
|
|
|
|
|
- ->where('status', 1)
|
|
|
|
|
- ->order('add_time DESC')
|
|
|
|
|
- ->page((int)$page, (int)$limit)
|
|
|
|
|
- ->select();
|
|
|
|
|
- } else {
|
|
|
|
|
- $list = self::where('uid', $uid)
|
|
|
|
|
- ->where('category', $category)
|
|
|
|
|
- ->field('mark,pm,number,add_time')
|
|
|
|
|
- ->where('status', 1)
|
|
|
|
|
- ->order('add_time DESC')
|
|
|
|
|
- ->select();
|
|
|
|
|
- }
|
|
|
|
|
- $data['zj'] = [];
|
|
|
|
|
- $data['kc'] = [];
|
|
|
|
|
- $data['sr'] = 0;
|
|
|
|
|
- $data['zc'] = 0;
|
|
|
|
|
- $data['data'] = [];
|
|
|
|
|
- $data['data'] = count($list) ? $list->toArray() : [];
|
|
|
|
|
- foreach ($data['data'] as &$v) {
|
|
|
|
|
- $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
|
|
|
|
|
- $v['number'] = floatval($v['number']);
|
|
|
|
|
- if ($v['pm'] == 1) {
|
|
|
|
|
- $data['sr'] += $v['number'];
|
|
|
|
|
- $data['zj'][] = $v;
|
|
|
|
|
- }
|
|
|
|
|
- if ($v['pm'] == 0){
|
|
|
|
|
- $data['zc'] += $v['number'];
|
|
|
|
|
- $data['kc'][] = $v;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- $data['sr'] = round($data['sr'], 2);
|
|
|
|
|
- $data['zc'] = round($data['zc'], 2);
|
|
|
|
|
- return $data;
|
|
|
|
|
|
|
+ return $data;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 获取昨日佣金
|
|
* 获取昨日佣金
|
|
|
* @param $uid
|
|
* @param $uid
|
|
|
* @return float
|
|
* @return float
|