123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\admin\model;
- use support\Db;
- use support\Model;
- /**
- * 亲属列表
- * Class Users
- * @package app\api\model
- */
- class UserTravelers extends Model
- {
- const IS_DEL_YES = 1;
- const IS_DEL_NO = 0;
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'user_travelers';
- public $timestamps = false;
- /**
- * Notes:获取亲属列表
- * @return array
- * User: YCP
- * Date: 2022/11/10
- */
- public static function getUserTravelersList(int $page,int $limit,int $travelers_user_id)
- {
- $list = static::select('*')
- ->where(['travelers_del'=>static::IS_DEL_NO,'travelers_user_id'=>$travelers_user_id])
- ->orderBy('travelers_add_time','DESC')
- ->get();
- $count = static::where(['travelers_del'=>static::IS_DEL_NO,'travelers_user_id'=>$travelers_user_id])
- ->count();
- return [$list, $count];
- }
- /**
- * Notes:根据手机号获取会员信息
- * @param int $mobile
- * User: YCP
- * Date: 2022/11/10
- */
- public static function getUserInfo(int $mobile)
- {
- return static::where(['travelers_phone' => $mobile])
- ->first();
- }
- //时间格式
- public function getTravelersAddTimeAttribute($value)
- {
- return date('Y-m-d H:i:s', $value);
- }
-
- }
|