123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- /**
- * Created by PhpStorm.
- * User: sicilon_IT
- * Date: 2021/6/25
- * Time: 15:27
- */
- namespace app\index\model;
- use think\Model;
- class payordermodel extends Model
- {
- protected $table = 't_payorder';
- /*
- * 20210625
- */
- public function insinfo($arr)
- {
- $this->setAttr('id', null)->isUpdate(false)->allowField(true)->save($arr);
- return $this->id;
- }
- /*
- * 20210625
- */
- public function updpaytimebypreid($preid)
- {
- $where_arr['prepay_id'] = $preid;
- $where_arr['orderstatus'] = 0;
- $update_arr['ispay'] = 1;
- $update_arr['orderstatus'] = 1;
- $update_arr['paytime'] = date('Y-m-d H:i:s');
- $this->where($where_arr)->update($update_arr);
- }
- /*
- * 20210627
- */
- public function updorederstatusbyorderno($orderno, $openid, $updarr)
- {
- $where_arr['outorderno'] = $orderno;
- $where_arr['openid'] = $openid;
- $where_arr['orderstatus'] = 0;
- $rcount = $this->where($where_arr)->update($updarr);
- return $rcount;
- }
- /*
- * 20210814
- */
- public function selinfobyorder($orderno)
- {
- $where_arr['outorderno'] = $orderno;
- $rec = $this->where($where_arr)->find();
- return $rec;
- }
- /**
- * 根据订单id改订单信息
- * 20211108
- * wj
- */
- public function updorederstatusbyid($id, $updarr)
- {
- $where_arr['id'] = $id;
- $where_arr['orderstatus'] = 0;
- $rcount = $this->where($where_arr)->update($updarr);
- return $rcount;
- }
- /**
- * 获取订单总量
- * 202112228
- * wj
- */
- public function getcount()
- {
- $count = $this->where([])->count();
- return $count;
- }
- /**
- * 获取分析数据
- * 20211117
- * wj
- */
- public function statistics()
- {
- $sql = "select ispay,count(*) as count from " . $this->table . " group by ispay";
- $list = $this->query("select * from (" . $sql . ") as t");
- return $list;
- }
- /*
- * 20211228
- * wj
- */
- public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
- {
- $sqlObj = $this->alias('po')->join("t_userinfo u", "po.wid=u.id")->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;
- }
- }
|