1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /*
- * @Author: wang jun
- * @Date: 2021-09-27 08:39:30
- * @Last Modified by: wang jun
- * @Last Modified time: 2021-11-05 14:22:09
- */
- namespace app\index\model;
- use think\Model;
- class useraccountaddrecordmodel extends Model
- {
- protected $table = 't_useraccountaddrecord';
- public function insertData($data)
- {
- $id = $this->insertGetId($data);
- return empty($id) ? false : $id;
- }
- public function getInfo($where, $field = "*", $row = true)
- {
- $info = $this->field($field)->where($where);
- if ($row) {
- $info = $info->find();
- } else {
- $info = $info->select();
- }
- return empty($info) ? false : $info;
- }
- public function updateinfo($where, $updateData)
- {
- $row = $this->where($where)->update($updateData);
- return empty($row) ? false : $row;
- }
- public function deleteinfo($where)
- {
- $row = $this->where($where)->delete();
- return empty($row) ? false : $row;
- }
- public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
- {
- $sqlObj = $this->where($where);
- if ("count" != $field) {
- $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
- if ($row) {
- $data = $sqlObj->find();
- } else {
- $data = $sqlObj->select();
- }
- } else {
- $data = $sqlObj = $sqlObj->count();
- }
- return $data;
- }
- public function getaddrecordlistforreduce($userid, $enddate, $scoretype = 0)
- {
- $tablesql = "select * from t_useraccountaddrecord where userid='" . $userid . "' and activescore>0 and (enddate is null or enddate <= '" . $enddate . "')";
- if ($scoretype > 0) {
- $tablesql .= " scoretype='" . $scoretype . "'";
- }
- $tablesql .= " order by scoretype desc,id asc";
- $sql = "select * from (" . $tablesql . ") as tab";
- $list = $this->query($sql);
- return $list;
- }
- /*
- * 2022-01-03
- * steelxu
- * 获取指定用户某一天被赠送的积分
- */
- public function seladdlistbyuid2date($uid,$date){
- $strsql="select * from t_useraccountaddrecord where scoretype=2 and userid=".$uid." and createdate >'".$date."' ";
- $list=$this->query($strsql);
- $list=collection($list)->toArray();
- return $list;
- }
- }
|