108 lines
1.7 KiB
PHP
108 lines
1.7 KiB
PHP
<?php
|
|
namespace app\massage\model;
|
|
|
|
use app\BaseModel;
|
|
use think\facade\Db;
|
|
|
|
class CarUserTrophy extends BaseModel
|
|
{
|
|
//定义表名
|
|
protected $name = 'shequshop_car_user_trophy';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:04
|
|
* @功能说明:添加
|
|
*/
|
|
public function dataAdd($data){
|
|
|
|
$res = $this->insert($data);
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:05
|
|
* @功能说明:编辑
|
|
*/
|
|
public function dataUpdate($dis,$data){
|
|
|
|
$res = $this->where($dis)->update($data);
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:06
|
|
* @功能说明:列表
|
|
*/
|
|
public function dataList($dis,$page=10){
|
|
|
|
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:43
|
|
* @功能说明:
|
|
*/
|
|
public function dataInfo($dis){
|
|
|
|
$data = $this->where($dis)->find();
|
|
|
|
return !empty($data)?$data->toArray():[];
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-09-26 16:10
|
|
* @功能说明:用户荣誉杯
|
|
*/
|
|
public function userTrophy($user_id){
|
|
|
|
//查看荣誉杯
|
|
$dis = [
|
|
|
|
'a.user_id' => $user_id,
|
|
|
|
'a.status' => 1,
|
|
|
|
'b.status' => 1,
|
|
];
|
|
|
|
$data = $this->alias('a')
|
|
->join('shequshop_car_trophy b','a.trophy_id = b.id')
|
|
->where($dis)
|
|
->field('a.*,b.title,b.cover')
|
|
->select()
|
|
->toArray();
|
|
|
|
|
|
return $data;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |