| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\user\model;
- use think\Model;
- /**
- * 用户管理
- */
- class Userproduct extends Model
- {
- public function getProductCount($userId)
- {
- $result = $this
- ->where(['user_id' => $userId])
- ->count();
- return $result;
- }
- public function getRenewProductCount($userId)
- {
- $allData = $this
- ->field(['userProduct_dayNumber', 'userProduct_buyTime'])
- ->where(['user_id' => $userId])
- ->select();
- $count = 0;
- foreach ($allData as $key => $value) {
- $numberDay = $value->userProduct_dayNumber - 15;
- $remindDate = date("Y-m-d",strtotime($numberDay . " day"));
- if ($value->userProduct_buyTime >= $remindDate) {
- $count++;
- }
- }
- return $count;
- }
- }
|